1
- import { attr , FASTElement , nullableNumberConverter } from '@microsoft/fast-element' ;
2
- import { uniqueId } from '@microsoft/fast-web-utilities' ;
1
+ import { attr } from '@microsoft/fast-element' ;
3
2
import type { StaticallyComposableHTML } from '../utils/index.js' ;
4
3
import { StartEnd } from '../patterns/index.js' ;
5
4
import type { StartEndOptions } from '../patterns/index.js' ;
6
5
import { applyMixins } from '../utils/apply-mixins.js' ;
7
6
import { swapStates , toggleState } from '../utils/element-internals.js' ;
7
+ import { BaseAccordionItem } from './accordion-item.base.js' ;
8
8
import { AccordionItemMarkerPosition , AccordionItemSize } from './accordion-item.options.js' ;
9
9
10
10
/**
@@ -16,96 +16,6 @@ export type AccordionItemOptions = StartEndOptions<AccordionItem> & {
16
16
collapsedIcon ?: StaticallyComposableHTML < AccordionItem > ;
17
17
} ;
18
18
19
- /**
20
- *
21
- * @slot start - Content positioned before heading in the collapsed state
22
- * @slot heading - Content which serves as the accordion item heading and text of the expand button
23
- * @slot - The default slot for accordion item content
24
- * @slot marker-expanded - The expanded icon
25
- * @slot marker-collapsed - The collapsed icon
26
- * @csspart heading - Wraps the button
27
- * @csspart button - The button which serves to invoke the item
28
- * @csspart content - The wrapper for the accordion item content
29
- *
30
- * @public
31
- */
32
- export class BaseAccordionItem extends FASTElement {
33
- /**
34
- * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
35
- *
36
- * @internal
37
- */
38
- public elementInternals : ElementInternals = this . attachInternals ( ) ;
39
-
40
- /**
41
- * Configures the {@link https://www.w3.org/TR/wai-aria-1.1/#aria-level | level} of the
42
- * heading element.
43
- *
44
- * @public
45
- * @remarks
46
- * HTML attribute: heading-level
47
- */
48
- @attr ( {
49
- attribute : 'heading-level' ,
50
- mode : 'fromView' ,
51
- converter : nullableNumberConverter ,
52
- } )
53
- public headinglevel : 1 | 2 | 3 | 4 | 5 | 6 = 2 ;
54
-
55
- /**
56
- * Expands or collapses the item.
57
- *
58
- * @public
59
- * @remarks
60
- * HTML attribute: expanded
61
- */
62
- @attr ( { mode : 'boolean' } )
63
- public expanded : boolean = false ;
64
-
65
- /**
66
- * Handles expanded changes
67
- * @param prev - previous value
68
- * @param next - next value
69
- */
70
- public expandedChanged ( prev : boolean , next : boolean ) : void {
71
- toggleState ( this . elementInternals , 'expanded' , next ) ;
72
- }
73
-
74
- /**
75
- * Disables an accordion item
76
- *
77
- * @public
78
- * @remarks
79
- * HTML attribute: disabled
80
- */
81
- @attr ( { mode : 'boolean' } )
82
- public disabled : boolean = false ;
83
-
84
- /**
85
- * Handles disabled changes
86
- * @param prev - previous value
87
- * @param next - next value
88
- */
89
- public disabledChanged ( prev : boolean , next : boolean ) : void {
90
- toggleState ( this . elementInternals , 'disabled' , next ) ;
91
- }
92
-
93
- /**
94
- * The item ID
95
- *
96
- * @public
97
- * @remarks
98
- * HTML Attribute: id
99
- */
100
- @attr
101
- public id : string = uniqueId ( 'accordion-' ) ;
102
-
103
- /**
104
- * @internal
105
- */
106
- public expandbutton ! : HTMLElement ;
107
- }
108
-
109
19
/**
110
20
* An Accordion Item Custom HTML Element.
111
21
* Based on BaseAccordionItem and includes style and layout specific attributes
0 commit comments