@fluentui/react-accordion 9.0.0-rc.1 → 9.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +150 -1
- package/CHANGELOG.md +45 -2
- package/Spec.md +36 -4
- package/dist/react-accordion.d.ts +3 -2
- package/lib/Accordion.js.map +1 -1
- package/lib/AccordionHeader.js.map +1 -1
- package/lib/AccordionItem.js.map +1 -1
- package/lib/AccordionPanel.js.map +1 -1
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/Accordion.types.d.ts +3 -2
- package/lib/components/Accordion/Accordion.types.js.map +1 -1
- package/lib/components/Accordion/AccordionContext.js +0 -1
- package/lib/components/Accordion/AccordionContext.js.map +1 -1
- package/lib/components/Accordion/index.js.map +1 -1
- package/lib/components/Accordion/renderAccordion.js.map +1 -1
- package/lib/components/Accordion/useAccordion.js +13 -18
- package/lib/components/Accordion/useAccordion.js.map +1 -1
- package/lib/components/Accordion/useAccordionContextValues.js +2 -2
- package/lib/components/Accordion/useAccordionContextValues.js.map +1 -1
- package/lib/components/Accordion/useAccordionStyles.js.map +1 -1
- package/lib/components/AccordionHeader/AccordionHeader.js.map +1 -1
- package/lib/components/AccordionHeader/AccordionHeader.types.js.map +1 -1
- package/lib/components/AccordionHeader/AccordionHeaderContext.js.map +1 -1
- package/lib/components/AccordionHeader/index.js.map +1 -1
- package/lib/components/AccordionHeader/renderAccordionHeader.js.map +1 -1
- package/lib/components/AccordionHeader/useAccordionHeader.js.map +1 -1
- package/lib/components/AccordionHeader/useAccordionHeaderContextValues.js.map +1 -1
- package/lib/components/AccordionHeader/useAccordionHeaderStyles.js.map +1 -1
- package/lib/components/AccordionItem/AccordionItem.js.map +1 -1
- package/lib/components/AccordionItem/AccordionItem.types.js.map +1 -1
- package/lib/components/AccordionItem/AccordionItemContext.js.map +1 -1
- package/lib/components/AccordionItem/index.js.map +1 -1
- package/lib/components/AccordionItem/renderAccordionItem.js.map +1 -1
- package/lib/components/AccordionItem/useAccordionItem.js +5 -7
- package/lib/components/AccordionItem/useAccordionItem.js.map +1 -1
- package/lib/components/AccordionItem/useAccordionItemContextValues.js.map +1 -1
- package/lib/components/AccordionItem/useAccordionItemStyles.js.map +1 -1
- package/lib/components/AccordionPanel/AccordionPanel.js.map +1 -1
- package/lib/components/AccordionPanel/AccordionPanel.types.js.map +1 -1
- package/lib/components/AccordionPanel/index.js.map +1 -1
- package/lib/components/AccordionPanel/renderAccordionPanel.js.map +1 -1
- package/lib/components/AccordionPanel/useAccordionPanel.js.map +1 -1
- package/lib/components/AccordionPanel/useAccordionPanelStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Accordion.js.map +1 -1
- package/lib-commonjs/AccordionHeader.js.map +1 -1
- package/lib-commonjs/AccordionItem.js.map +1 -1
- package/lib-commonjs/AccordionPanel.js.map +1 -1
- package/lib-commonjs/components/Accordion/Accordion.js.map +1 -1
- package/lib-commonjs/components/Accordion/Accordion.types.d.ts +3 -2
- package/lib-commonjs/components/Accordion/Accordion.types.js.map +1 -1
- package/lib-commonjs/components/Accordion/AccordionContext.js +0 -1
- package/lib-commonjs/components/Accordion/AccordionContext.js.map +1 -1
- package/lib-commonjs/components/Accordion/index.js.map +1 -1
- package/lib-commonjs/components/Accordion/renderAccordion.js.map +1 -1
- package/lib-commonjs/components/Accordion/useAccordion.js +14 -18
- package/lib-commonjs/components/Accordion/useAccordion.js.map +1 -1
- package/lib-commonjs/components/Accordion/useAccordionContextValues.js +2 -2
- package/lib-commonjs/components/Accordion/useAccordionContextValues.js.map +1 -1
- package/lib-commonjs/components/Accordion/useAccordionStyles.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/AccordionHeader.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/AccordionHeader.types.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/AccordionHeaderContext.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/index.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/renderAccordionHeader.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/useAccordionHeader.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/useAccordionHeaderContextValues.js.map +1 -1
- package/lib-commonjs/components/AccordionHeader/useAccordionHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/AccordionItem.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/AccordionItem.types.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/AccordionItemContext.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/index.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/renderAccordionItem.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/useAccordionItem.js +4 -6
- package/lib-commonjs/components/AccordionItem/useAccordionItem.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/useAccordionItemContextValues.js.map +1 -1
- package/lib-commonjs/components/AccordionItem/useAccordionItemStyles.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/AccordionPanel.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/AccordionPanel.types.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/index.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/renderAccordionPanel.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/useAccordionPanel.js.map +1 -1
- package/lib-commonjs/components/AccordionPanel/useAccordionPanelStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +14 -7
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,156 @@
|
|
|
2
2
|
"name": "@fluentui/react-accordion",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 04 Mar 2022 05:15:47 GMT",
|
|
6
|
+
"tag": "@fluentui/react-accordion_v9.0.0-rc.5",
|
|
7
|
+
"version": "9.0.0-rc.5",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-accordion",
|
|
13
|
+
"commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
|
|
14
|
+
"comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-accordion",
|
|
19
|
+
"comment": "Bump @fluentui/react-aria to v9.0.0-rc.5",
|
|
20
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-accordion",
|
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.5",
|
|
26
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-accordion",
|
|
31
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.5",
|
|
32
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-accordion",
|
|
37
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
|
|
38
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-accordion",
|
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
|
|
44
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Tue, 01 Mar 2022 02:17:40 GMT",
|
|
51
|
+
"tag": "@fluentui/react-accordion_v9.0.0-rc.4",
|
|
52
|
+
"version": "9.0.0-rc.4",
|
|
53
|
+
"comments": {
|
|
54
|
+
"prerelease": [
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-accordion",
|
|
58
|
+
"comment": "Bump @fluentui/react-aria to v9.0.0-rc.4",
|
|
59
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@fluentui/react-accordion",
|
|
64
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.4",
|
|
65
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@fluentui/react-accordion",
|
|
70
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.4",
|
|
71
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "beachball",
|
|
75
|
+
"package": "@fluentui/react-accordion",
|
|
76
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
|
|
77
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"date": "Fri, 18 Feb 2022 13:35:37 GMT",
|
|
84
|
+
"tag": "@fluentui/react-accordion_v9.0.0-rc.3",
|
|
85
|
+
"version": "9.0.0-rc.3",
|
|
86
|
+
"comments": {
|
|
87
|
+
"prerelease": [
|
|
88
|
+
{
|
|
89
|
+
"author": "bsunderhus@microsoft.com",
|
|
90
|
+
"package": "@fluentui/react-accordion",
|
|
91
|
+
"commit": "5a45a787f2669a9f694a274b220823dbc10b04e2",
|
|
92
|
+
"comment": "Updates initial open items value to be empty on every case"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"author": "lingfangao@hotmail.com",
|
|
96
|
+
"package": "@fluentui/react-accordion",
|
|
97
|
+
"commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
|
|
98
|
+
"comment": "fix: Source maps contain original source code"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"author": "bsunderhus@microsoft.com",
|
|
102
|
+
"package": "@fluentui/react-accordion",
|
|
103
|
+
"commit": "ea090f75ef4a477f6ea9ffa2b4d7bec826a99b5f",
|
|
104
|
+
"comment": "Breaking change: navigable becomes navigation"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"author": "beachball",
|
|
108
|
+
"package": "@fluentui/react-accordion",
|
|
109
|
+
"comment": "Bump @fluentui/react-aria to v9.0.0-rc.3",
|
|
110
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"author": "beachball",
|
|
114
|
+
"package": "@fluentui/react-accordion",
|
|
115
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.3",
|
|
116
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"author": "beachball",
|
|
120
|
+
"package": "@fluentui/react-accordion",
|
|
121
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.3",
|
|
122
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"author": "beachball",
|
|
126
|
+
"package": "@fluentui/react-accordion",
|
|
127
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.3",
|
|
128
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"author": "beachball",
|
|
132
|
+
"package": "@fluentui/react-accordion",
|
|
133
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
|
|
134
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"author": "beachball",
|
|
138
|
+
"package": "@fluentui/react-accordion",
|
|
139
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3",
|
|
140
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"none": [
|
|
144
|
+
{
|
|
145
|
+
"author": "bsunderhus@microsoft.com",
|
|
146
|
+
"package": "@fluentui/react-accordion",
|
|
147
|
+
"commit": "3068d4518c5e599c60a216455eac40531d896162",
|
|
148
|
+
"comment": "Updates spec and story to add warning about heading level"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"date": "Thu, 10 Feb 2022 08:52:11 GMT",
|
|
6
155
|
"tag": "@fluentui/react-accordion_v9.0.0-rc.1",
|
|
7
156
|
"version": "9.0.0-rc.1",
|
|
8
157
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-accordion
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 04 Mar 2022 05:15:47 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.0.0-rc.5)
|
|
8
|
+
|
|
9
|
+
Fri, 04 Mar 2022 05:15:47 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.0.0-rc.4..@fluentui/react-accordion_v9.0.0-rc.5)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-aria to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
16
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
17
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.0.0-rc.4)
|
|
22
|
+
|
|
23
|
+
Tue, 01 Mar 2022 02:17:40 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.0.0-rc.3..@fluentui/react-accordion_v9.0.0-rc.4)
|
|
25
|
+
|
|
26
|
+
### Changes
|
|
27
|
+
|
|
28
|
+
- Bump @fluentui/react-aria to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
29
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
30
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
31
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
32
|
+
|
|
33
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.0.0-rc.3)
|
|
34
|
+
|
|
35
|
+
Fri, 18 Feb 2022 13:35:37 GMT
|
|
36
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.0.0-rc.1..@fluentui/react-accordion_v9.0.0-rc.3)
|
|
37
|
+
|
|
38
|
+
### Changes
|
|
39
|
+
|
|
40
|
+
- Updates initial open items value to be empty on every case ([PR #21728](https://github.com/microsoft/fluentui/pull/21728) by bsunderhus@microsoft.com)
|
|
41
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
|
42
|
+
- Breaking change: navigable becomes navigation ([PR #21729](https://github.com/microsoft/fluentui/pull/21729) by bsunderhus@microsoft.com)
|
|
43
|
+
- Bump @fluentui/react-aria to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
44
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
45
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
46
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
47
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
48
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
49
|
+
|
|
7
50
|
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.0.0-rc.1)
|
|
8
51
|
|
|
9
|
-
Thu, 10 Feb 2022 08:
|
|
52
|
+
Thu, 10 Feb 2022 08:52:11 GMT
|
|
10
53
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.0.0-beta.5..@fluentui/react-accordion_v9.0.0-rc.1)
|
|
11
54
|
|
|
12
55
|
### Changes
|
package/Spec.md
CHANGED
|
@@ -37,9 +37,10 @@ The root level component serves context and common API between all children.
|
|
|
37
37
|
export type AccordionProps = ComponentProps &
|
|
38
38
|
React.HTMLAttributes<HTMLElement> & {
|
|
39
39
|
/**
|
|
40
|
-
* Indicates if keyboard navigation is available
|
|
40
|
+
* Indicates if keyboard navigation is available and gives two options,
|
|
41
|
+
* linear or circular navigation
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
|
+
navigation?: 'linear' | 'circular';
|
|
43
44
|
/**
|
|
44
45
|
* Indicates if Accordion support multiple Panels opened at the same time
|
|
45
46
|
*/
|
|
@@ -410,6 +411,37 @@ As a general rule, once the accordion is closed the focus should return to the h
|
|
|
410
411
|
| Keyboard | Home | Moves Focus | Moves focus to the first panel heading |
|
|
411
412
|
| Keyboard | End | Moves Focus | Moves focus to the last panel heading |
|
|
412
413
|
|
|
413
|
-
##
|
|
414
|
+
## Accessibility
|
|
414
415
|
|
|
415
|
-
Accessibility
|
|
416
|
+
Accessibility behavior is built into the spec as much as possible. This section addresses specific issues that don't fit well with the standard definition of the component.
|
|
417
|
+
|
|
418
|
+
### No heading level on `AccordionHeader` by default
|
|
419
|
+
|
|
420
|
+
As described on [WAI-ARIA Roles, States, and Properties](https://www.w3.org/TR/wai-aria-practices/#wai-aria-roles-states-and-properties) documentation for accordion:
|
|
421
|
+
|
|
422
|
+
> Each accordion header button is wrapped in an element with role heading that has a value set for aria-level that is appropriate for the information architecture of the page.
|
|
423
|
+
|
|
424
|
+
Every `AccordionHeader` should have as its root a semantic heading element: `h1`, `h2`, `h3`, `h4`, `h5` or `h6`. Alternatively `role="heading"` and a proper `aria-level` attribute. This behavior is not implemented by default on `AccordionHeader` as it's impossible to predict which heading level will be required by the user. Requiring manual addition of such ARIA requirement.
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
{/* No heading level by default */}
|
|
428
|
+
<AccordionHeader>This is a header</AccordionHeader>
|
|
429
|
+
{/* Generated html */}
|
|
430
|
+
<div>
|
|
431
|
+
<button>This is a header</button>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
{/* as semantic heading */}
|
|
435
|
+
<AccordionHeader as="h4">This is a header</AccordionHeader>
|
|
436
|
+
{/* Generated html */}
|
|
437
|
+
<h4>
|
|
438
|
+
<button>This is a header</button>
|
|
439
|
+
</h4>
|
|
440
|
+
|
|
441
|
+
{/* if no semantic heading can be used */}
|
|
442
|
+
<AccordionHeader role="heading" aria-level="4">This is a header</AccordionHeader>
|
|
443
|
+
{/* Generated html */}
|
|
444
|
+
<div role="heading" aria-level="4">
|
|
445
|
+
<button>This is a header</button>
|
|
446
|
+
</h4>
|
|
447
|
+
```
|
|
@@ -15,9 +15,10 @@ export declare const accordionClassName = "fui-Accordion";
|
|
|
15
15
|
|
|
16
16
|
declare type AccordionCommons = {
|
|
17
17
|
/**
|
|
18
|
-
* Indicates if keyboard navigation is available
|
|
18
|
+
* Indicates if keyboard navigation is available and gives two options,
|
|
19
|
+
* linear or circular navigation
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
navigation?: 'linear' | 'circular';
|
|
21
22
|
/**
|
|
22
23
|
* Indicates if Accordion support multiple Panels opened at the same time
|
|
23
24
|
*/
|
package/lib/Accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"../src/","sources":["Accordion.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './components/Accordion/index';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHeader.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AccordionHeader.js","sourceRoot":"../src/","sources":["AccordionHeader.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC","sourcesContent":["export * from './components/AccordionHeader/index';\n"]}
|
package/lib/AccordionItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AccordionItem.js","sourceRoot":"../src/","sources":["AccordionItem.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './components/AccordionItem/index';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionPanel.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AccordionPanel.js","sourceRoot":"../src/","sources":["AccordionPanel.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/AccordionPanel/index';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,kCAAT,QAAmD,6BAAnD;AAGA,SAAS,2BAAT,QAA4C,sBAA5C;AAEA;;AAEG;;AACH,OAAO,MAAM,SAAS,gBAAwC,KAAK,CAAC,UAAN,CAC5D,CAAC,KAAD,EAAQ,GAAR,KAAe;AACb,QAAM,KAAK,GAAG,qBAAqB,CAAC,KAAD,EAAQ,GAAR,CAAnC;AACA,QAAM,aAAa,GAAG,kCAAkC,CAAC,KAAD,CAAxD;AAEA,EAAA,2BAA2B,CAAC,KAAD,CAA3B;AAEA,SAAO,wBAAwB,CAAC,KAAD,EAAQ,aAAR,CAA/B;AACD,CAR2D,CAAvD;AAWP,SAAS,CAAC,WAAV,GAAwB,WAAxB","sourcesContent":["import * as React from 'react';\nimport { renderAccordion_unstable } from './renderAccordion';\nimport { useAccordion_unstable } from './useAccordion';\nimport { useAccordionContextValues_unstable } from './useAccordionContextValues';\nimport type { AccordionProps } from './Accordion.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useAccordionStyles_unstable } from './useAccordionStyles';\n\n/**\n * Define a styled Accordion, using the `useAccordion_unstable` and `useAccordionStyles_unstable` hooks.\n */\nexport const Accordion: ForwardRefComponent<AccordionProps> = React.forwardRef<HTMLDivElement, AccordionProps>(\n (props, ref) => {\n const state = useAccordion_unstable(props, ref);\n const contextValues = useAccordionContextValues_unstable(state);\n\n useAccordionStyles_unstable(state);\n\n return renderAccordion_unstable(state, contextValues);\n },\n);\n\nAccordion.displayName = 'Accordion';\n"],"sourceRoot":"../src/"}
|
|
@@ -6,9 +6,10 @@ export declare type AccordionToggleEvent<E = HTMLElement> = React.MouseEvent<E>
|
|
|
6
6
|
export declare type AccordionToggleEventHandler = (event: AccordionToggleEvent, data: AccordionToggleData) => void;
|
|
7
7
|
declare type AccordionCommons = {
|
|
8
8
|
/**
|
|
9
|
-
* Indicates if keyboard navigation is available
|
|
9
|
+
* Indicates if keyboard navigation is available and gives two options,
|
|
10
|
+
* linear or circular navigation
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
navigation?: 'linear' | 'circular';
|
|
12
13
|
/**
|
|
13
14
|
* Indicates if Accordion support multiple Panels opened at the same time
|
|
14
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"Accordion.types.js","sourceRoot":"../src/","sources":["components/Accordion/Accordion.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';\n\nexport type AccordionIndex = number | number[];\n\nexport type AccordionToggleEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;\n\nexport type AccordionToggleEventHandler = (event: AccordionToggleEvent, data: AccordionToggleData) => void;\n\ntype AccordionCommons = {\n /**\n * Indicates if keyboard navigation is available and gives two options,\n * linear or circular navigation\n */\n navigation?: 'linear' | 'circular';\n /**\n * Indicates if Accordion support multiple Panels opened at the same time\n */\n multiple: boolean;\n /**\n * Indicates if Accordion support multiple Panels closed at the same time\n */\n collapsible: boolean;\n};\n\nexport type AccordionContextValue = Omit<AccordionCommons, 'multiple'> & {\n /**\n * The list of opened panels by index\n */\n openItems: AccordionItemValue[];\n /**\n * Callback used by AccordionItem to request a change on it's own opened state\n * Should be used to toggle AccordionItem\n */\n requestToggle: (event: AccordionToggleEvent, data: AccordionToggleData) => void;\n};\n\nexport type AccordionContextValues = {\n accordion: AccordionContextValue;\n};\n\nexport type AccordionSlots = {\n root: Slot<'div'>;\n};\n\nexport type AccordionToggleData = {\n value: AccordionItemValue;\n};\n\nexport type AccordionProps = ComponentProps<AccordionSlots> &\n Partial<AccordionCommons> & {\n /**\n * Controls the state of the panel\n */\n openItems?: AccordionItemValue | AccordionItemValue[];\n /**\n * Default value for the uncontrolled state of the panel\n */\n defaultOpenItems?: AccordionItemValue | AccordionItemValue[];\n onToggle?: AccordionToggleEventHandler;\n };\n\nexport type AccordionState = ComponentState<AccordionSlots> & AccordionCommons & AccordionContextValue;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/AccordionContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,kCAA9B;AAIA,OAAO,MAAM,gBAAgB,gBAAmC,aAAa,CAAwB;AACnG,EAAA,SAAS,EAAE,EADwF;AAEnG,EAAA,WAAW,EAAE,KAFsF;;AAGnG,EAAA,aAAa,GAAA;AACX;AACD;;AALkG,CAAxB,CAAtE","sourcesContent":["import { createContext } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { AccordionContextValue } from './Accordion.types';\n\nexport const AccordionContext: Context<AccordionContextValue> = createContext<AccordionContextValue>({\n openItems: [],\n collapsible: false,\n requestToggle() {\n /* noop */\n },\n});\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Accordion/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Accordion';\nexport * from './Accordion.types';\nexport * from './renderAccordion';\nexport * from './useAccordion';\nexport * from './useAccordionStyles';\nexport * from './useAccordionContextValues';\nexport * from './AccordionContext';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/renderAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,gBAAT,QAAiC,oBAAjC;AAGA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAAwB,aAAxB,KAAiE;AACvG,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAiB,KAAjB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,gBAAgB,CAAC,QAAlB,EAA0B;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAA1B,EAA4D,SAAS,CAAC,IAAV,CAAe,QAA3E,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n\nimport { AccordionContext } from './AccordionContext';\nimport type { AccordionState, AccordionSlots, AccordionContextValues } from './Accordion.types';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderAccordion_unstable = (state: AccordionState, contextValues: AccordionContextValues) => {\n const { slots, slotProps } = getSlots<AccordionSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <AccordionContext.Provider value={contextValues.accordion}>{slotProps.root.children}</AccordionContext.Provider>\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { getNativeElementProps, useControllableState, useEventCallback } from '@fluentui/react-utilities';
|
|
3
|
+
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
3
4
|
/**
|
|
4
5
|
* Returns the props and state required to render the component
|
|
5
6
|
* @param props - Accordion properties
|
|
@@ -13,36 +14,37 @@ export const useAccordion_unstable = (props, ref) => {
|
|
|
13
14
|
multiple = false,
|
|
14
15
|
collapsible = false,
|
|
15
16
|
onToggle,
|
|
16
|
-
|
|
17
|
+
navigation
|
|
17
18
|
} = props;
|
|
18
19
|
const [openItems, setOpenItems] = useControllableState({
|
|
19
20
|
state: React.useMemo(() => normalizeValues(controlledOpenItems), [controlledOpenItems]),
|
|
20
21
|
defaultState: () => initializeUncontrolledOpenItems({
|
|
21
|
-
collapsible,
|
|
22
22
|
defaultOpenItems,
|
|
23
23
|
multiple
|
|
24
24
|
}),
|
|
25
25
|
initialState: []
|
|
26
26
|
});
|
|
27
|
+
const arrowNavigationProps = useArrowNavigationGroup({
|
|
28
|
+
circular: navigation === 'circular'
|
|
29
|
+
});
|
|
27
30
|
const requestToggle = useEventCallback((event, data) => {
|
|
28
31
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, data);
|
|
29
|
-
setOpenItems(previousOpenItems => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
});
|
|
32
|
+
setOpenItems(previousOpenItems => updateOpenItems(data.value, previousOpenItems, {
|
|
33
|
+
collapsible,
|
|
34
|
+
multiple
|
|
35
|
+
}));
|
|
35
36
|
});
|
|
36
37
|
return {
|
|
37
38
|
multiple,
|
|
38
39
|
collapsible,
|
|
39
|
-
|
|
40
|
+
navigation,
|
|
40
41
|
openItems,
|
|
41
42
|
requestToggle,
|
|
42
43
|
components: {
|
|
43
44
|
root: 'div'
|
|
44
45
|
},
|
|
45
46
|
root: getNativeElementProps('div', { ...props,
|
|
47
|
+
...(navigation ? arrowNavigationProps : {}),
|
|
46
48
|
ref
|
|
47
49
|
})
|
|
48
50
|
};
|
|
@@ -53,8 +55,7 @@ export const useAccordion_unstable = (props, ref) => {
|
|
|
53
55
|
|
|
54
56
|
function initializeUncontrolledOpenItems({
|
|
55
57
|
defaultOpenItems,
|
|
56
|
-
multiple
|
|
57
|
-
collapsible
|
|
58
|
+
multiple
|
|
58
59
|
}) {
|
|
59
60
|
if (defaultOpenItems !== undefined) {
|
|
60
61
|
if (Array.isArray(defaultOpenItems)) {
|
|
@@ -63,14 +64,8 @@ function initializeUncontrolledOpenItems({
|
|
|
63
64
|
|
|
64
65
|
return [defaultOpenItems];
|
|
65
66
|
}
|
|
66
|
-
/**
|
|
67
|
-
* TODO: since the dropping of descendants API due to performance issues,
|
|
68
|
-
* the default behavior of Accordion has been compromised and [0] makes no sense
|
|
69
|
-
* indexes are not used anymore to ensure the position of the element which should be opened by default
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
67
|
|
|
73
|
-
return
|
|
68
|
+
return [];
|
|
74
69
|
}
|
|
75
70
|
/**
|
|
76
71
|
* Updates the list of open indexes based on an index that changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/useAccordion.ts"],"names":[],"mapp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AS,eAAT,CAAyB,KAAzB,EAA0E;AACxE,MAAI,KAAK,KAAK,SAAd,EAAyB;AACvB,WAAO,SAAP;AACD;;AACD,SAAO,KAAK,CAAC,OAAN,CAAc,KAAd,IAAuB,KAAvB,GAA+B,CAAC,KAAD,CAAtC;AACD","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { AccordionProps, AccordionState, AccordionToggleData, AccordionToggleEvent } from './Accordion.types';\nimport type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Returns the props and state required to render the component\n * @param props - Accordion properties\n * @param ref - reference to root HTMLElement of Accordion\n */\nexport const useAccordion_unstable = (props: AccordionProps, ref: React.Ref<HTMLElement>): AccordionState => {\n const {\n openItems: controlledOpenItems,\n defaultOpenItems,\n multiple = false,\n collapsible = false,\n onToggle,\n navigation,\n } = props;\n const [openItems, setOpenItems] = useControllableState({\n state: React.useMemo(() => normalizeValues(controlledOpenItems), [controlledOpenItems]),\n defaultState: () => initializeUncontrolledOpenItems({ defaultOpenItems, multiple }),\n initialState: [],\n });\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: navigation === 'circular',\n });\n\n const requestToggle = useEventCallback((event: AccordionToggleEvent, data: AccordionToggleData) => {\n onToggle?.(event, data);\n setOpenItems(previousOpenItems =>\n updateOpenItems(data.value, previousOpenItems, {\n collapsible,\n multiple,\n }),\n );\n });\n\n return {\n multiple,\n collapsible,\n navigation,\n openItems,\n requestToggle,\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ...props,\n ...(navigation ? arrowNavigationProps : {}),\n ref,\n }),\n };\n};\n\n/**\n * Initial value for the uncontrolled case of the list of open indexes\n */\nfunction initializeUncontrolledOpenItems({\n defaultOpenItems,\n multiple,\n}: Pick<AccordionProps, 'defaultOpenItems' | 'multiple'>): AccordionItemValue[] {\n if (defaultOpenItems !== undefined) {\n if (Array.isArray(defaultOpenItems)) {\n return multiple ? defaultOpenItems : [defaultOpenItems[0]];\n }\n return [defaultOpenItems];\n }\n return [];\n}\n\n/**\n * Updates the list of open indexes based on an index that changes\n * @param value - the index that will change\n * @param previousOpenItems - list of current open indexes\n * @param param2 - {multiple, collapsible}\n */\nfunction updateOpenItems(\n value: AccordionItemValue,\n previousOpenItems: AccordionItemValue[],\n { multiple, collapsible }: Pick<AccordionState, 'multiple' | 'collapsible'>,\n) {\n if (multiple) {\n if (previousOpenItems.includes(value)) {\n if (previousOpenItems.length > 1 || collapsible) {\n return previousOpenItems.filter(i => i !== value);\n }\n } else {\n return [...previousOpenItems, value].sort();\n }\n } else {\n return previousOpenItems[0] === value && collapsible ? [] : [value];\n }\n return previousOpenItems;\n}\n\n/**\n * Normalizes Accordion index into an array of indexes\n */\nfunction normalizeValues(index?: AccordionItemValue | AccordionItemValue[]): AccordionItemValue[] | undefined {\n if (index === undefined) {\n return undefined;\n }\n return Array.isArray(index) ? index : [index];\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export function useAccordionContextValues_unstable(state) {
|
|
2
2
|
const {
|
|
3
|
-
|
|
3
|
+
navigation,
|
|
4
4
|
openItems,
|
|
5
5
|
requestToggle,
|
|
6
6
|
collapsible
|
|
7
7
|
} = state; // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
|
|
8
8
|
|
|
9
9
|
const accordion = {
|
|
10
|
-
|
|
10
|
+
navigation,
|
|
11
11
|
openItems,
|
|
12
12
|
requestToggle,
|
|
13
13
|
collapsible
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/useAccordionContextValues.ts"],"names":[],"mappings":"AAEA,OAAM,SAAU,kCAAV,CAA6C,KAA7C,EAAkE;AACtE,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,SAAd;AAAyB,IAAA,aAAzB;AAAwC,IAAA;AAAxC,MAAwD,KAA9D,CADsE,CAGtE;;AACA,QAAM,SAAS,GAA0B;AACvC,IAAA,UADuC;AAEvC,IAAA,SAFuC;AAGvC,IAAA,aAHuC;AAIvC,IAAA;AAJuC,GAAzC;AAOA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD","sourcesContent":["import type { AccordionContextValue, AccordionContextValues, AccordionState } from './Accordion.types';\n\nexport function useAccordionContextValues_unstable(state: AccordionState): AccordionContextValues {\n const { navigation, openItems, requestToggle, collapsible } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const accordion: AccordionContextValue = {\n navigation,\n openItems,\n requestToggle,\n collapsible,\n };\n\n return { accordion };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/Accordion/useAccordionStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,gBAA7B;AAGA,OAAO,MAAM,kBAAkB,GAAG,eAA3B;AAEP,OAAO,MAAM,2BAA2B,GAAI,KAAD,IAA0B;AACnE,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,kBAAD,EAAqB,KAAK,CAAC,IAAN,CAAW,SAAhC,CAAnC;AAEA,SAAO,KAAP;AACD,CAJM","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport type { AccordionState } from './Accordion.types';\n\nexport const accordionClassName = 'fui-Accordion';\n\nexport const useAccordionStyles_unstable = (state: AccordionState) => {\n state.root.className = mergeClasses(accordionClassName, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/AccordionHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,2BAAT,QAA4C,sBAA5C;AACA,SAAS,8BAAT,QAA+C,yBAA/C;AACA,SAAS,iCAAT,QAAkD,4BAAlD;AACA,SAAS,wCAAT,QAAyD,mCAAzD;AAIA;;;AAGG;;AACH,OAAO,MAAM,eAAe,gBAA8C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxG,QAAM,KAAK,GAAG,2BAA2B,CAAC,KAAD,EAAQ,GAAR,CAAzC;AACA,QAAM,aAAa,GAAG,wCAAwC,CAAC,KAAD,CAA9D;AAEA,EAAA,iCAAiC,CAAC,KAAD,CAAjC;AAEA,SAAO,8BAA8B,CAAC,KAAD,EAAQ,aAAR,CAArC;AACD,CAPyE,CAAnE;AASP,eAAe,CAAC,WAAhB,GAA8B,iBAA9B","sourcesContent":["import * as React from 'react';\nimport { useAccordionHeader_unstable } from './useAccordionHeader';\nimport { renderAccordionHeader_unstable } from './renderAccordionHeader';\nimport { useAccordionHeaderStyles_unstable } from './useAccordionHeaderStyles';\nimport { useAccordionHeaderContextValues_unstable } from './useAccordionHeaderContextValues';\nimport type { AccordionHeaderProps } from './AccordionHeader.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled AccordionHeader, using the `useAccordionHeader_unstable` and `useAccordionHeaderStyles_unstable`\n * hooks.\n */\nexport const AccordionHeader: ForwardRefComponent<AccordionHeaderProps> = React.forwardRef((props, ref) => {\n const state = useAccordionHeader_unstable(props, ref);\n const contextValues = useAccordionHeaderContextValues_unstable(state);\n\n useAccordionHeaderStyles_unstable(state);\n\n return renderAccordionHeader_unstable(state, contextValues);\n});\n\nAccordionHeader.displayName = 'AccordionHeader';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHeader.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AccordionHeader.types.js","sourceRoot":"../src/","sources":["components/AccordionHeader/AccordionHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\n\nexport type AccordionHeaderSize = 'small' | 'medium' | 'large' | 'extra-large';\nexport type AccordionHeaderExpandIconPosition = 'start' | 'end';\n\nexport type AccordionHeaderContextValue = {\n disabled: boolean;\n open: boolean;\n expandIconPosition: AccordionHeaderExpandIconPosition;\n size: AccordionHeaderSize;\n};\n\nexport type AccordionHeaderContextValues = {\n accordionHeader: AccordionHeaderContextValue;\n};\n\nexport type AccordionHeaderSlots = {\n /**\n * The element wrapping the button. By default this is a div, but can be a heading.\n */\n root: Slot<'div', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>;\n /**\n * The component to be used as button in heading\n */\n button: NonNullable<Slot<ARIAButtonSlotProps>>;\n /**\n * Expand icon slot rendered before (or after) children content in heading\n */\n expandIcon: Slot<'span'>;\n /**\n * Expand icon slot rendered before (or after) children content in heading\n */\n icon?: Slot<'div'>;\n};\n\ntype AccordionHeaderCommons = {\n /**\n * Size of spacing in the heading\n */\n size: AccordionHeaderSize;\n /**\n * The position of the expand icon slot in heading\n */\n expandIconPosition: AccordionHeaderExpandIconPosition;\n /**\n * Indicates if the AccordionHeader should be rendered inline\n */\n inline: boolean;\n};\n\nexport type AccordionHeaderProps = ComponentProps<Partial<AccordionHeaderSlots>> & Partial<AccordionHeaderCommons>;\n\nexport type AccordionHeaderState = ComponentState<AccordionHeaderSlots> &\n AccordionHeaderCommons &\n AccordionHeaderContextValue;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/AccordionHeaderContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,OAAO,MAAM,sBAAsB,gBAAG,KAAK,CAAC,aAAN,CAAiD;AACrF,EAAA,IAAI,EAAE,KAD+E;AAErF,EAAA,QAAQ,EAAE,KAF2E;AAGrF,EAAA,IAAI,EAAE,QAH+E;AAIrF,EAAA,kBAAkB,EAAE;AAJiE,CAAjD,CAA/B;AAOP,OAAO,MAAM,yBAAyB,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,sBAAjB,CAAxC","sourcesContent":["import * as React from 'react';\nimport type { AccordionHeaderContextValue } from './AccordionHeader.types';\n\nexport const AccordionHeaderContext = React.createContext<AccordionHeaderContextValue>({\n open: false,\n disabled: false,\n size: 'medium',\n expandIconPosition: 'start',\n});\n\nexport const useAccordionHeaderContext = () => React.useContext(AccordionHeaderContext);\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/AccordionHeader/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './AccordionHeader';\nexport * from './AccordionHeader.types';\nexport * from './renderAccordionHeader';\nexport * from './useAccordionHeader';\nexport * from './useAccordionHeaderContextValues';\nexport * from './useAccordionHeaderStyles';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/renderAccordionHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,sBAAT,QAAuC,0BAAvC;AAGA;;AAEG;;AACH,OAAO,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,aAF4C,KAG1C;AACF,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAuB,KAAvB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,sBAAsB,CAAC,QAAxB,EAAgC;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAAhC,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,EAAA,GAAK,SAAS,CAAC;AAAf,GAAb,EACG,KAAK,CAAC,kBAAN,KAA6B,OAA7B,iBAAwC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAjB,CAD3C,EAEG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAFjB,EAGG,SAAS,CAAC,IAAV,CAAe,QAHlB,EAIG,KAAK,CAAC,kBAAN,KAA6B,KAA7B,iBAAsC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAjB,CAJzC,CADF,CADF,CADF;AAYD,CAlBM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { AccordionHeaderContext } from './AccordionHeaderContext';\nimport type { AccordionHeaderState, AccordionHeaderSlots, AccordionHeaderContextValues } from './AccordionHeader.types';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderAccordionHeader_unstable = (\n state: AccordionHeaderState,\n contextValues: AccordionHeaderContextValues,\n) => {\n const { slots, slotProps } = getSlots<AccordionHeaderSlots>(state);\n\n return (\n <AccordionHeaderContext.Provider value={contextValues.accordionHeader}>\n <slots.root {...slotProps.root}>\n <slots.button {...slotProps.button}>\n {state.expandIconPosition === 'start' && <slots.expandIcon {...slotProps.expandIcon} />}\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slotProps.root.children}\n {state.expandIconPosition === 'end' && <slots.expandIcon {...slotProps.expandIcon} />}\n </slots.button>\n </slots.root>\n </AccordionHeaderContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/useAccordionHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,gBAAlD,QAA0E,2BAA1E;AACA,SAAS,gCAAT,QAAiD,wBAAjD;AACA,SAAS,aAAT,QAA8B,sBAA9B;AAEA,SAAS,kBAAT,QAAmC,kCAAnC;AACA,SAAS,gBAAT,QAAiC,+BAAjC;AACA,SAAS,mBAAT,QAAoC,uBAApC;AACA,SAAS,SAAT,QAA0B,iCAA1B;AAEA;;;;AAIG;;AACH,OAAO,MAAM,2BAA2B,GAAG,CACzC,KADyC,EAEzC,GAFyC,KAGjB;AACxB,QAAM;AAAE,IAAA,EAAF;AAAM,IAAA,IAAN;AAAY,IAAA,MAAZ;AAAoB,IAAA,UAApB;AAAgC,IAAA,MAAM,GAAG,KAAzC;AAAgD,IAAA,IAAI,GAAG,QAAvD;AAAiE,IAAA,kBAAkB,GAAG;AAAtF,MAAkG,KAAxG;AACA,QAAM;AAAE,IAAA,aAAa,EAAE,sBAAjB;AAAyC,IAAA,QAAzC;AAAmD,IAAA;AAAnD,MAA4D,gCAAgC,EAAlG;AAEA;;;AAGG;;AACH,QAAM,iBAAiB,GAAG,kBAAkB,CAC1C,gBAD0C,EAE1C,GAAG,IAAI,CAAC,GAAG,CAAC,WAAL,IAAoB,GAAG,CAAC,SAAJ,CAAc,MAAd,KAAyB,CAA7C,IAAkD,IAFf,CAA5C;AAKA,QAAM;AAAE,IAAA;AAAF,MAAU,SAAS,EAAzB,CAbwB,CAexB;;AACA,MAAI,kBAAJ;;AACA,MAAI,kBAAkB,KAAK,KAA3B,EAAkC;AAChC;AACA,IAAA,kBAAkB,GAAG,IAAI,G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uB,EAAA,CAAA,IAAA,CAAvB,eAAuB,EAAG,EAAH,CAAvB;;AACA,YAAI,CAAC,EAAE,CAAC,gBAAR,EAA0B;AACxB,UAAA,sBAAsB,CAAC,EAAD,CAAtB;AACD;AACF,OANsB;AAFnB;AAxBH,GAAP;AAoCD,CAzEM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useEventCallback } from '@fluentui/react-utilities';\nimport { useAccordionItemContext_unstable } from '../AccordionItem/index';\nimport { useARIAButton } from '@fluentui/react-aria';\nimport type { AccordionHeaderProps, AccordionHeaderState } from './AccordionHeader.types';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport { AccordionContext } from '../Accordion/AccordionContext';\nimport { ChevronRightRegular } from '@fluentui/react-icons';\nimport { useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * Returns the props and state required to render the component\n * @param props - AccordionHeader properties\n * @param ref - reference to root HTMLElement of AccordionHeader\n */\nexport const useAccordionHeader_unstable = (\n props: AccordionHeaderProps,\n ref: React.Ref<HTMLElement>,\n): AccordionHeaderState => {\n const { as, icon, button, expandIcon, inline = false, size = 'medium', expandIconPosition = 'start' } = props;\n const { onHeaderClick: onAccordionHeaderClick, disabled, open } = useAccordionItemContext_unstable();\n\n /**\n * force disabled state on button if accordion isn't collapsible\n * and this is the only item opened\n */\n const disabledFocusable = useContextSelector(\n AccordionContext,\n ctx => !ctx.collapsible && ctx.openItems.length === 1 && open,\n );\n\n const { dir } = useFluent();\n\n // Calculate how to rotate the expand icon [>] (ChevronRightRegular)\n let expandIconRotation: 0 | 90 | -90 | 180;\n if (expandIconPosition === 'end') {\n // If expand icon is at the end, the chevron points up [^] when open, and down [v] when closed\n expandIconRotation = open ? -90 : 90;\n } else {\n // Otherwise, the chevron points down [v] when open, and right [>] (or left [<] in RTL) when closed\n expandIconRotation = open ? 90 : dir !== 'rtl' ? 0 : 180;\n }\n\n const buttonShorthand = useARIAButton(button, {\n required: true,\n defaultProps: {\n disabled,\n disabledFocusable,\n 'aria-expanded': open,\n },\n });\n\n return {\n disabled,\n open,\n size,\n inline,\n expandIconPosition,\n components: {\n root: 'div',\n button: 'button',\n expandIcon: 'span',\n icon: 'div',\n },\n root: getNativeElementProps(as || 'div', {\n ref,\n ...props,\n }),\n icon: resolveShorthand(icon),\n expandIcon: resolveShorthand(expandIcon, {\n required: true,\n defaultProps: {\n children: <ChevronRightRegular transform={`rotate(${expandIconRotation})`} />,\n 'aria-hidden': true,\n },\n }),\n button: {\n ...buttonShorthand,\n onClick: useEventCallback(\n (ev: React.MouseEvent<HTMLButtonElement & HTMLDivElement & HTMLSpanElement & HTMLAnchorElement>) => {\n buttonShorthand.onClick?.(ev);\n if (!ev.defaultPrevented) {\n onAccordionHeaderClick(ev);\n }\n },\n ),\n },\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/useAccordionHeaderContextValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAOA,OAAM,SAAU,wCAAV,CAAmD,KAAnD,EAA8E;AAClF,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,kBAAZ;AAAgC,IAAA,IAAhC;AAAsC,IAAA;AAAtC,MAA+C,KAArD;AAEA,QAAM,eAAe,GAAG,KAAK,CAAC,OAAN,CACtB,OAAO;AACL,IAAA,QADK;AAEL,IAAA,kBAFK;AAGL,IAAA,IAHK;AAIL,IAAA;AAJK,GAAP,CADsB,EAOtB,CAAC,QAAD,EAAW,kBAAX,EAA+B,IAA/B,EAAqC,IAArC,CAPsB,CAAxB;AAUA,SAAO;AAAE,IAAA;AAAF,GAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type {\n AccordionHeaderContextValue,\n AccordionHeaderState,\n AccordionHeaderContextValues,\n} from './AccordionHeader.types';\n\nexport function useAccordionHeaderContextValues_unstable(state: AccordionHeaderState): AccordionHeaderContextValues {\n const { disabled, expandIconPosition, open, size } = state;\n\n const accordionHeader = React.useMemo<AccordionHeaderContextValue>(\n () => ({\n disabled,\n expandIconPosition,\n open,\n size,\n }),\n [disabled, expandIconPosition, open, size],\n );\n\n return { accordionHeader };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionHeader/useAccordionHeaderStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAGA,OAAO,MAAM,wBAAwB,GAAG,qBAAjC;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AA+EA;;;AACA,OAAO,MAAM,iCAAiC,GAAI,KAAD,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AnC;AAKD;;AACD,SAAO,KAAP;AACD,CArCM","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { AccordionHeaderState } from './AccordionHeader.types';\n\nexport const accordionHeaderClassName = 'fui-AccordionHeader';\n\nconst useStyles = makeStyles({\n // TODO: this should be extracted to another package\n resetButton: {\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n lineHeight: 'normal',\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n WebkitAppearance: 'button',\n userSelect: 'none',\n textAlign: 'unset',\n },\n focusIndicator: createFocusOutlineStyle(),\n root: {\n color: tokens.colorNeutralForeground1,\n backgroundColor: tokens.colorNeutralBackground1,\n ...shorthands.margin(0),\n ...shorthands.borderRadius('2px'),\n },\n rootDisabled: {\n backgroundImage: 'none',\n color: tokens.colorNeutralForegroundDisabled,\n },\n rootInline: {\n display: 'inline-block',\n },\n button: {\n position: 'relative',\n width: 'calc(100% - 22px)',\n ...shorthands.border('1px', 'solid', 'transparent'),\n paddingRight: '10px',\n paddingLeft: '10px',\n height: '44px',\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n fontSize: tokens.fontSizeBase300,\n fontFamily: tokens.fontFamilyBase,\n },\n buttonSmall: {\n height: '32px',\n fontSize: tokens.fontSizeBase200,\n },\n buttonLarge: {\n fontSize: tokens.fontSizeBase400,\n },\n buttonExtraLarge: {\n fontSize: tokens.fontSizeBase500,\n },\n buttonInline: {\n display: 'inline-flex',\n },\n expandIcon: {\n lineHeight: '0',\n fontSize: '20px',\n },\n expandIconStart: {\n paddingRight: '8px',\n },\n expandIconEnd: {\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n display: 'flex',\n justifyContent: 'flex-end',\n paddingLeft: '8px',\n },\n icon: {\n marginRight: '8px',\n fontSize: '20px',\n },\n iconExpandIconEnd: {\n marginLeft: '10px',\n },\n});\n\n/** Applies style classnames to slots */\nexport const useAccordionHeaderStyles_unstable = (state: AccordionHeaderState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n accordionHeaderClassName,\n styles.root,\n state.inline && styles.rootInline,\n state.disabled && styles.rootDisabled,\n state.root.className,\n );\n\n state.button.className = mergeClasses(\n styles.resetButton,\n styles.button,\n styles.focusIndicator,\n state.inline && styles.buttonInline,\n state.size === 'small' && styles.buttonSmall,\n state.size === 'large' && styles.buttonLarge,\n state.size === 'extra-large' && styles.buttonExtraLarge,\n state.button.className,\n );\n\n if (state.expandIcon) {\n state.expandIcon.className = mergeClasses(\n styles.expandIcon,\n state.expandIconPosition === 'start' && styles.expandIconStart,\n state.expandIconPosition === 'end' && styles.expandIconEnd,\n state.expandIcon.className,\n );\n }\n if (state.icon) {\n state.icon.className = mergeClasses(\n styles.icon,\n state.expandIconPosition === 'end' && styles.iconExpandIconEnd,\n state.icon.className,\n );\n }\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["components/AccordionItem/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,sCAAT,QAAuD,iCAAvD;AACA,SAAS,4BAAT,QAA6C,uBAA7C;AAGA,SAAS,+BAAT,QAAgD,0BAAhD;AAEA;;AAEG;;AACH,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpG,QAAM,KAAK,GAAG,yBAAyB,CAAC,KAAD,EAAQ,GAAR,CAAvC;AACA,QAAM,aAAa,GAAG,sCAAsC,CAAC,KAAD,CAA5D;AAEA,EAAA,+BAA+B,CAAC,KAAD,CAA/B;AAEA,SAAO,4BAA4B,CAAC,KAAD,EAAQ,aAAR,CAAnC;AACD,CAPqE,CAA/D;AASP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { useAccordionItem_unstable } from './useAccordionItem';\nimport { useAccordionItemContextValues_unstable } from './useAccordionItemContextValues';\nimport { renderAccordionItem_unstable } from './renderAccordionItem';\nimport type { AccordionItemProps } from './AccordionItem.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useAccordionItemStyles_unstable } from './useAccordionItemStyles';\n\n/**\n * Define a styled AccordionItem, using the `useAccordionItem_unstable` and `useAccordionItemStyles_unstable` hooks.\n */\nexport const AccordionItem: ForwardRefComponent<AccordionItemProps> = React.forwardRef((props, ref) => {\n const state = useAccordionItem_unstable(props, ref);\n const contextValues = useAccordionItemContextValues_unstable(state);\n\n useAccordionItemStyles_unstable(state);\n\n return renderAccordionItem_unstable(state, contextValues);\n});\n\nAccordionItem.displayName = 'AccordionItem';\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AccordionItem.types.js","sourceRoot":"../src/","sources":["components/AccordionItem/AccordionItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AccordionItemContextValue = Omit<AccordionItemCommons, 'value'> & {\n open: boolean;\n onHeaderClick(ev: React.MouseEvent | React.KeyboardEvent): void;\n};\n\nexport type AccordionItemContextValues = {\n accordionItem: AccordionItemContextValue;\n};\n\nexport type AccordionItemSlots = {\n root: Slot<'div'>;\n};\n\ntype AccordionItemCommons = {\n /**\n * Disables opening/closing of panel\n */\n disabled: boolean;\n /**\n * required value that identifies this item inside an Accordion component\n */\n value: AccordionItemValue;\n};\n\nexport type AccordionItemProps = ComponentProps<AccordionItemSlots> &\n Partial<AccordionItemCommons> &\n Pick<AccordionItemCommons, 'value'>;\n\nexport type AccordionItemValue = unknown;\n\nexport type AccordionItemState = ComponentState<AccordionItemSlots> & AccordionItemCommons & AccordionItemContextValue;\n"]}
|