@fluentui/react-accordion 9.3.13 → 9.3.16

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 CHANGED
@@ -2,7 +2,160 @@
2
2
  "name": "@fluentui/react-accordion",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 20 Sep 2023 14:13:55 GMT",
5
+ "date": "Tue, 26 Sep 2023 17:44:07 GMT",
6
+ "tag": "@fluentui/react-accordion_v9.3.16",
7
+ "version": "9.3.16",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "yuanboxue@microsoft.com",
12
+ "package": "@fluentui/react-accordion",
13
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
14
+ "comment": "chore: trigger manual version bump after broken release"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-accordion",
19
+ "comment": "Bump @fluentui/react-aria to v9.3.38",
20
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-accordion",
25
+ "comment": "Bump @fluentui/react-context-selector to v9.1.36",
26
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-accordion",
31
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
32
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-accordion",
37
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
38
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-accordion",
43
+ "comment": "Bump @fluentui/react-tabster to v9.13.1",
44
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-accordion",
49
+ "comment": "Bump @fluentui/react-theme to v9.1.14",
50
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-accordion",
55
+ "comment": "Bump @fluentui/react-utilities to v9.13.5",
56
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "date": "Tue, 26 Sep 2023 15:32:06 GMT",
63
+ "tag": "@fluentui/react-accordion_v9.3.15",
64
+ "version": "9.3.15",
65
+ "comments": {
66
+ "patch": [
67
+ {
68
+ "author": "martinhochel@microsoft.com",
69
+ "package": "@fluentui/react-accordion",
70
+ "commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
71
+ "comment": "fix: bump swc core to mitigate transpilation memory leaks"
72
+ },
73
+ {
74
+ "author": "ololubek@microsoft.com",
75
+ "package": "@fluentui/react-accordion",
76
+ "commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
77
+ "comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-accordion",
82
+ "comment": "Bump @fluentui/react-aria to v9.3.37",
83
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-accordion",
88
+ "comment": "Bump @fluentui/react-context-selector to v9.1.35",
89
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
90
+ },
91
+ {
92
+ "author": "beachball",
93
+ "package": "@fluentui/react-accordion",
94
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
95
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
96
+ },
97
+ {
98
+ "author": "beachball",
99
+ "package": "@fluentui/react-accordion",
100
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
101
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
102
+ },
103
+ {
104
+ "author": "beachball",
105
+ "package": "@fluentui/react-accordion",
106
+ "comment": "Bump @fluentui/react-tabster to v9.13.0",
107
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
108
+ },
109
+ {
110
+ "author": "beachball",
111
+ "package": "@fluentui/react-accordion",
112
+ "comment": "Bump @fluentui/react-theme to v9.1.13",
113
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
114
+ },
115
+ {
116
+ "author": "beachball",
117
+ "package": "@fluentui/react-accordion",
118
+ "comment": "Bump @fluentui/react-utilities to v9.13.4",
119
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ {
125
+ "date": "Wed, 20 Sep 2023 17:47:34 GMT",
126
+ "tag": "@fluentui/react-accordion_v9.3.14",
127
+ "version": "9.3.14",
128
+ "comments": {
129
+ "patch": [
130
+ {
131
+ "author": "martinhochel@microsoft.com",
132
+ "package": "@fluentui/react-accordion",
133
+ "commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0",
134
+ "comment": "chore: trigger manual version bump after broken release"
135
+ },
136
+ {
137
+ "author": "beachball",
138
+ "package": "@fluentui/react-accordion",
139
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.10",
140
+ "commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
141
+ },
142
+ {
143
+ "author": "beachball",
144
+ "package": "@fluentui/react-accordion",
145
+ "comment": "Bump @fluentui/react-shared-contexts to v9.8.1",
146
+ "commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
147
+ },
148
+ {
149
+ "author": "beachball",
150
+ "package": "@fluentui/react-accordion",
151
+ "comment": "Bump @fluentui/react-tabster to v9.12.11",
152
+ "commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
153
+ }
154
+ ]
155
+ }
156
+ },
157
+ {
158
+ "date": "Wed, 20 Sep 2023 14:59:53 GMT",
6
159
  "tag": "@fluentui/react-accordion_v9.3.13",
7
160
  "version": "9.3.13",
8
161
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,57 @@
1
1
  # Change Log - @fluentui/react-accordion
2
2
 
3
- This log was last generated on Wed, 20 Sep 2023 14:13:55 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 26 Sep 2023 17:44:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.3.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.3.16)
8
+
9
+ Tue, 26 Sep 2023 17:44:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.3.15..@fluentui/react-accordion_v9.3.16)
11
+
12
+ ### Patches
13
+
14
+ - chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
15
+ - Bump @fluentui/react-aria to v9.3.38 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
16
+ - Bump @fluentui/react-context-selector to v9.1.36 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
17
+ - Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
18
+ - Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
19
+ - Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
20
+ - Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
21
+ - Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
22
+
23
+ ## [9.3.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.3.15)
24
+
25
+ Tue, 26 Sep 2023 15:32:06 GMT
26
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.3.14..@fluentui/react-accordion_v9.3.15)
27
+
28
+ ### Patches
29
+
30
+ - fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
31
+ - chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
32
+ - Bump @fluentui/react-aria to v9.3.37 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
33
+ - Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
34
+ - Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
35
+ - Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
36
+ - Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
37
+ - Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
38
+ - Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
39
+
40
+ ## [9.3.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.3.14)
41
+
42
+ Wed, 20 Sep 2023 17:47:34 GMT
43
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.3.13..@fluentui/react-accordion_v9.3.14)
44
+
45
+ ### Patches
46
+
47
+ - chore: trigger manual version bump after broken release ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by martinhochel@microsoft.com)
48
+ - Bump @fluentui/react-jsx-runtime to v9.0.10 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
49
+ - Bump @fluentui/react-shared-contexts to v9.8.1 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
50
+ - Bump @fluentui/react-tabster to v9.12.11 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
51
+
7
52
  ## [9.3.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.3.13)
8
53
 
9
- Wed, 20 Sep 2023 14:13:55 GMT
54
+ Wed, 20 Sep 2023 14:59:53 GMT
10
55
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.3.12..@fluentui/react-accordion_v9.3.13)
11
56
 
12
57
  ### Patches
@@ -22,9 +22,8 @@ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
22
22
  tabbable: true
23
23
  });
24
24
  const requestToggle = useEventCallback((data)=>{
25
- var _onToggle;
26
25
  const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);
27
- (_onToggle = onToggle) === null || _onToggle === void 0 ? void 0 : _onToggle(data.event, {
26
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle(data.event, {
28
27
  value: data.value,
29
28
  openItems: nextOpenItems
30
29
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["useAccordion.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { AccordionProps, AccordionState } from './Accordion.types';\nimport type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { AccordionRequestToggleData } from '../../contexts/accordion';\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 = <Value = AccordionItemValue>(\n props: AccordionProps<Value>,\n ref: React.Ref<HTMLElement>,\n): AccordionState<Value> => {\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 tabbable: true,\n });\n\n const requestToggle = useEventCallback((data: AccordionRequestToggleData<Value>) => {\n const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);\n onToggle?.(data.event, { value: data.value, openItems: nextOpenItems });\n setOpenItems(nextOpenItems);\n });\n\n return {\n collapsible,\n multiple,\n navigation,\n openItems,\n requestToggle,\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ...props,\n ...(navigation ? arrowNavigationProps : undefined),\n ref,\n }),\n { elementType: 'div' },\n ),\n };\n};\n\n/**\n * Initial value for the uncontrolled case of the list of open indexes\n */\nfunction initializeUncontrolledOpenItems<Value = AccordionItemValue>({\n defaultOpenItems,\n multiple,\n}: Pick<AccordionProps<Value>, 'defaultOpenItems' | 'multiple'>): Value[] {\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 multiple - if Accordion support multiple Panels opened at the same time\n * @param collapsible - if Accordion support multiple Panels closed at the same time\n */\nfunction updateOpenItems<Value = AccordionItemValue>(\n value: Value,\n previousOpenItems: Value[],\n multiple: boolean,\n collapsible: boolean,\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<Value = AccordionItemValue>(index?: Value | Value[]): Value[] | undefined {\n if (index === undefined) {\n return undefined;\n }\n return Array.isArray(index) ? index : [index];\n}\n"],"names":["React","getNativeElementProps","useControllableState","useEventCallback","slot","useArrowNavigationGroup","useAccordion_unstable","props","ref","openItems","controlledOpenItems","defaultOpenItems","multiple","collapsible","onToggle","navigation","setOpenItems","state","useMemo","normalizeValues","defaultState","initializeUncontrolledOpenItems","initialState","arrowNavigationProps","circular","tabbable","requestToggle","data","nextOpenItems","updateOpenItems","value","event","components","root","always","undefined","elementType","Array","isArray","previousOpenItems","includes","length","filter","i","sort","index"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAGhH,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE;;;;CAIC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EACJC,WAAWC,mBAAmB,EAC9BC,gBAAgB,EAChBC,WAAW,KAAK,EAChBC,cAAc,KAAK,EACnBC,QAAQ,EACRC,UAAU,EACX,GAAGR;IACJ,MAAM,CAACE,WAAWO,aAAa,GAAGd,qBAAqB;QACrDe,OAAOjB,MAAMkB,OAAO,CAAC,IAAMC,gBAAgBT,sBAAsB;YAACA;SAAoB;QACtFU,cAAc,IAAMC,gCAAgC;gBAAEV;gBAAkBC;YAAS;QACjFU,cAAc,EAAE;IAClB;IAEA,MAAMC,uBAAuBlB,wBAAwB;QACnDmB,UAAUT,eAAe;QACzBU,UAAU;IACZ;IAEA,MAAMC,gBAAgBvB,iBAAiB,CAACwB;YAEtCb;QADA,MAAMc,gBAAgBC,gBAAgBF,KAAKG,KAAK,EAAErB,WAAWG,UAAUC;SACvEC,YAAAA,sBAAAA,gCAAAA,UAAWa,KAAKI,KAAK,EAAE;YAAED,OAAOH,KAAKG,KAAK;YAAErB,WAAWmB;QAAc;QACrEZ,aAAaY;IACf;IAEA,OAAO;QACLf;QACAD;QACAG;QACAN;QACAiB;QACAM,YAAY;YACVC,MAAM;QACR;QACAA,MAAM7B,KAAK8B,MAAM,CACfjC,sBAAsB,OAAO;YAC3B,GAAGM,KAAK;YACR,GAAIQ,aAAaQ,uBAAuBY,SAAS;YACjD3B;QACF,IACA;YAAE4B,aAAa;QAAM;IAEzB;AACF,EAAE;AAEF;;CAEC,GACD,SAASf,gCAA4D,EACnEV,gBAAgB,EAChBC,QAAQ,EACqD;IAC7D,IAAID,qBAAqBwB,WAAW;QAClC,IAAIE,MAAMC,OAAO,CAAC3B,mBAAmB;YACnC,OAAOC,WAAWD,mBAAmB;gBAACA,gBAAgB,CAAC,EAAE;aAAC;QAC5D;QACA,OAAO;YAACA;SAAiB;IAC3B;IACA,OAAO,EAAE;AACX;AAEA;;;;;;CAMC,GACD,SAASkB,gBACPC,KAAY,EACZS,iBAA0B,EAC1B3B,QAAiB,EACjBC,WAAoB;IAEpB,IAAID,UAAU;QACZ,IAAI2B,kBAAkBC,QAAQ,CAACV,QAAQ;YACrC,IAAIS,kBAAkBE,MAAM,GAAG,KAAK5B,aAAa;gBAC/C,OAAO0B,kBAAkBG,MAAM,CAACC,CAAAA,IAAKA,MAAMb;YAC7C;QACF,OAAO;YACL,OAAO;mBAAIS;gBAAmBT;aAAM,CAACc,IAAI;QAC3C;IACF,OAAO;QACL,OAAOL,iBAAiB,CAAC,EAAE,KAAKT,SAASjB,cAAc,EAAE,GAAG;YAACiB;SAAM;IACrE;IACA,OAAOS;AACT;AAEA;;CAEC,GACD,SAASpB,gBAA4C0B,KAAuB;IAC1E,IAAIA,UAAUV,WAAW;QACvB,OAAOA;IACT;IACA,OAAOE,MAAMC,OAAO,CAACO,SAASA,QAAQ;QAACA;KAAM;AAC/C"}
1
+ {"version":3,"sources":["useAccordion.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { AccordionProps, AccordionState } from './Accordion.types';\nimport type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { AccordionRequestToggleData } from '../../contexts/accordion';\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 = <Value = AccordionItemValue>(\n props: AccordionProps<Value>,\n ref: React.Ref<HTMLElement>,\n): AccordionState<Value> => {\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 tabbable: true,\n });\n\n const requestToggle = useEventCallback((data: AccordionRequestToggleData<Value>) => {\n const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);\n onToggle?.(data.event, { value: data.value, openItems: nextOpenItems });\n setOpenItems(nextOpenItems);\n });\n\n return {\n collapsible,\n multiple,\n navigation,\n openItems,\n requestToggle,\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ...props,\n ...(navigation ? arrowNavigationProps : undefined),\n ref,\n }),\n { elementType: 'div' },\n ),\n };\n};\n\n/**\n * Initial value for the uncontrolled case of the list of open indexes\n */\nfunction initializeUncontrolledOpenItems<Value = AccordionItemValue>({\n defaultOpenItems,\n multiple,\n}: Pick<AccordionProps<Value>, 'defaultOpenItems' | 'multiple'>): Value[] {\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 multiple - if Accordion support multiple Panels opened at the same time\n * @param collapsible - if Accordion support multiple Panels closed at the same time\n */\nfunction updateOpenItems<Value = AccordionItemValue>(\n value: Value,\n previousOpenItems: Value[],\n multiple: boolean,\n collapsible: boolean,\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<Value = AccordionItemValue>(index?: Value | Value[]): Value[] | undefined {\n if (index === undefined) {\n return undefined;\n }\n return Array.isArray(index) ? index : [index];\n}\n"],"names":["React","getNativeElementProps","useControllableState","useEventCallback","slot","useArrowNavigationGroup","useAccordion_unstable","props","ref","openItems","controlledOpenItems","defaultOpenItems","multiple","collapsible","onToggle","navigation","setOpenItems","state","useMemo","normalizeValues","defaultState","initializeUncontrolledOpenItems","initialState","arrowNavigationProps","circular","tabbable","requestToggle","data","nextOpenItems","updateOpenItems","value","event","components","root","always","undefined","elementType","Array","isArray","previousOpenItems","includes","length","filter","i","sort","index"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,oBAAoB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAGhH,SAASC,uBAAuB,QAAQ,0BAA0B;AAGlE;;;;CAIC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EACJC,WAAWC,mBAAmB,EAC9BC,gBAAgB,EAChBC,WAAW,KAAK,EAChBC,cAAc,KAAK,EACnBC,QAAQ,EACRC,UAAU,EACX,GAAGR;IACJ,MAAM,CAACE,WAAWO,aAAa,GAAGd,qBAAqB;QACrDe,OAAOjB,MAAMkB,OAAO,CAAC,IAAMC,gBAAgBT,sBAAsB;YAACA;SAAoB;QACtFU,cAAc,IAAMC,gCAAgC;gBAAEV;gBAAkBC;YAAS;QACjFU,cAAc,EAAE;IAClB;IAEA,MAAMC,uBAAuBl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;CAEC,GACD,SAASpB,gBAA4C0B,KAAuB;IAC1E,IAAIA,UAAUV,WAAW;QACvB,OAAOA;IACT;IACA,OAAOE,MAAMC,OAAO,CAACO,SAASA,QAAQ;QAACA;KAAM;AAC/C"}
@@ -72,8 +72,8 @@ import { useAccordionItemContext_unstable } from '../../contexts/accordionItem';
72
72
  }),
73
73
  onClick: useEventCallback((event)=>{
74
74
  if (isResolvedShorthand(button)) {
75
- var _button_onClick, _button;
76
- (_button_onClick = (_button = button).onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(_button, event);
75
+ var _button_onClick;
76
+ (_button_onClick = button.onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(button, event);
77
77
  }
78
78
  if (!event.defaultPrevented) {
79
79
  requestToggle({
@@ -1 +1 @@
1
- {"version":3,"sources":["useAccordionHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { ARIAButtonSlotProps, useARIAButtonShorthand } from '@fluentui/react-aria';\nimport type { AccordionHeaderProps, AccordionHeaderState } from './AccordionHeader.types';\nimport { useAccordionContext_unstable } from '../../contexts/accordion';\nimport { ChevronRightRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAccordionItemContext_unstable } from '../../contexts/accordionItem';\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 { value, disabled, open } = useAccordionItemContext_unstable();\n const requestToggle = useAccordionContext_unstable(ctx => ctx.requestToggle);\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 = useAccordionContext_unstable(ctx => !ctx.collapsible && ctx.openItems.length === 1 && open);\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 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: slot.always(\n getNativeElementProps(as || 'div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n icon: slot.optional(icon, { elementType: 'div' }),\n expandIcon: slot.optional(expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: <ChevronRightRegular style={{ transform: `rotate(${expandIconRotation}deg)` }} />,\n 'aria-hidden': true,\n },\n elementType: 'span',\n }),\n button: slot.always<ARIAButtonSlotProps<'a'>>(\n {\n ...useARIAButtonShorthand(button, {\n required: true,\n defaultProps: {\n disabled,\n disabledFocusable,\n 'aria-expanded': open,\n type: 'button',\n },\n }),\n onClick: useEventCallback(event => {\n if (isResolvedShorthand(button)) {\n button.onClick?.(event);\n }\n if (!event.defaultPrevented) {\n requestToggle({ value, event });\n }\n }),\n },\n { elementType: 'button' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","isResolvedShorthand","useEventCallback","slot","useARIAButtonShorthand","useAccordionContext_unstable","ChevronRightRegular","useFluent_unstable","useFluent","useAccordionItemContext_unstable","useAccordionHeader_unstable","props","ref","as","icon","button","expandIcon","inline","size","expandIconPosition","value","disabled","open","requestToggle","ctx","disabledFocusable","collapsible","openItems","length","dir","expandIconRotation","components","root","always","elementType","optional","renderByDefault","defaultProps","children","style","transform","required","type","onClick","event","defaultPrevented"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC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aAAa;QAAM;QAC/ClB,YAAYb,KAAKgC,QAAQ,CAACnB,YAAY;YACpCoB,iBAAiB;YACjBC,cAAc;gBACZC,wBAAU,oBAAChC;oBAAoBiC,OAAO;wBAAEC,WAAW,CAAC,OAAO,EAAEV,mBAAmB,IAAI,CAAC;oBAAC;;gBACtF,eAAe;YACjB;YACAI,aAAa;QACf;QACAnB,QAAQZ,KAAK8B,MAAM,CACjB;YACE,GAAG7B,uBAAuBW,QAAQ;gBAChC0B,UAAU;gBACVJ,cAAc;oBACZhB;oBACAI;oBACA,iBAAiBH;oBACjBoB,MAAM;gBACR;YACF,EAAE;YACFC,SAASzC,iBAAiB0C,CAAAA;gBACxB,IAAI3C,oBAAoBc,SAAS;wBAC/BA,iBAAAA;qBAAAA,kBAAAA,CAAAA,UAAAA,QAAO4B,OAAO,cAAd5B,sCAAAA,qBAAAA,SAAiB6B;gBACnB;gBACA,IAAI,CAACA,MAAMC,gBAAgB,EAAE;oBAC3BtB,cAAc;wBAAEH;wBAAOwB;oBAAM;gBAC/B;YACF;QACF,GACA;YAAEV,aAAa;QAAS;IAE5B;AACF,EAAE"}
1
+ {"version":3,"sources":["useAccordionHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { ARIAButtonSlotProps, useARIAButtonShorthand } from '@fluentui/react-aria';\nimport type { AccordionHeaderProps, AccordionHeaderState } from './AccordionHeader.types';\nimport { useAccordionContext_unstable } from '../../contexts/accordion';\nimport { ChevronRightRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAccordionItemContext_unstable } from '../../contexts/accordionItem';\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 { value, disabled, open } = useAccordionItemContext_unstable();\n const requestToggle = useAccordionContext_unstable(ctx => ctx.requestToggle);\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 = useAccordionContext_unstable(ctx => !ctx.collapsible && ctx.openItems.length === 1 && open);\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 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: slot.always(\n getNativeElementProps(as || 'div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n icon: slot.optional(icon, { elementType: 'div' }),\n expandIcon: slot.optional(expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: <ChevronRightRegular style={{ transform: `rotate(${expandIconRotation}deg)` }} />,\n 'aria-hidden': true,\n },\n elementType: 'span',\n }),\n button: slot.always<ARIAButtonSlotProps<'a'>>(\n {\n ...useARIAButtonShorthand(button, {\n required: true,\n defaultProps: {\n disabled,\n disabledFocusable,\n 'aria-expanded': open,\n type: 'button',\n },\n }),\n onClick: useEventCallback(event => {\n if (isResolvedShorthand(button)) {\n button.onClick?.(event);\n }\n if (!event.defaultPrevented) {\n requestToggle({ value, event });\n }\n }),\n },\n { elementType: 'button' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","isResolvedShorthand","useEventCallback","slot","useARIAButtonShorthand","useAccordionContext_unstable","ChevronRightRegular","useFluent_unstable","useFluent","useAccordionItemContext_unstable","useAccordionHeader_unstable","props","ref","as","icon","button","expandIcon","inline","size","expandIconPosition","value","disabled","open","requestToggle","ctx","disabledFocusable","collapsible","openItems","length","dir","expandIconRotation","components","root","always","elementType","optional","renderByDefault","defaultProps","children","style","transform","required","type","onClick","event","defaultPrevented"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAC/G,SAA8BC,sBAAsB,QAAQ,uBAAuB;AAEnF,SAASC,4BAA4B,QAAQ,2BAA2B;AACxE,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,gCAAgC,QAAQ,+BAA+B;AAEhF;;;;CAIC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,KAAK,EAAEC,OAAO,QAAQ,EAAEC,qBAAqB,OAAO,EAAE,GAAGR;IACxG,MAAM,EAAES,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGb;IAClC,MAAMc,gBAAgBlB,6BAA6BmB,CAAAA,MAAOA,IAAID,aAAa;IAE3E;;;GAGC,GACD,MAAME,oBAAoBpB,6BAA6BmB,CAAAA,MAAO,CAACA,IAAIE,WAAW,IAAIF,IAAIG,SAAS,CAACC,MAAM,KAAK,KAAKN;IAEhH,MAAM,EAAEO,GAAG,EAAE,GAAGrB;IAEhB,oEAAoE;IACpE,IAAIsB;IACJ,IAAIX,uBAAuB,OAAO;QAChC,8FAA8F;QAC9FW,qBAAqBR,OAAO,CAAC,KAAK;IACpC,OAAO;QACL,mGAAmG;QACnGQ,qBAAqBR,OAAO,KAAKO,QAAQ,QAAQ,IAAI;IACvD;IAEA,OAAO;QACLR;QACAC;QACAJ;QACAD;QACAE;QACAY,YAAY;YACVC,MAAM;YACNjB,QAAQ;YACRC,YAAY;YACZF,MAAM;QACR;QACAkB,MAAM7B,KAAK8B,MAAM,CACfjC,sBAAsBa,MAAM,OAAO;YACjCD;YACA,GAAGD,KAAK;QACV,IACA;YAAEuB,aAAa;QAAM;QAEvBpB,MAAMX,KAAKgC,QAAQ,CAACrB,MAAM;YAAEoB,aAAa;QAAM;QAC/ClB,YAAYb,KAAKgC,QAAQ,CAACnB,YAAY;YACpCoB,iBAAiB;YACjBC,cAAc;gBACZC,wBAAU,oBAAChC;oBAAoBiC,OAAO;wBAAEC,WAAW,CAAC,OAAO,EAAEV,mBAAmB,IAAI,CAAC;oBAAC;;gBACtF,eAAe;YACjB;YACAI,aAAa;QACf;QACAnB,QAAQZ,KAAK8B,MAAM,CACjB;YACE,GAAG7B,uBAAuBW,QAAQ;gBAChC0B,UAAU;gBACVJ,cAAc;oBACZhB;oBACAI;oBACA,iBAAiBH;oBACjBoB,MAAM;gBACR;YACF,EAAE;YACFC,SAASzC,iBAAiB0C,CAAAA;gBACxB,IAAI3C,oBAAoBc,SAAS;wBAC/BA;qBAAAA,kBAAAA,OAAO4B,OAAO,cAAd5B,sCAAAA,qBAAAA,QAAiB6B;gBACnB;gBACA,IAAI,CAACA,MAAMC,gBAAgB,EAAE;oBAC3BtB,cAAc;wBAAEH;wBAAOwB;oBAAM;gBAC/B;YACF;QACF,GACA;YAAEV,aAAa;QAAS;IAE5B;AACF,EAAE"}
@@ -7,5 +7,7 @@ const accordionHeaderContextDefaultValue = {
7
7
  expandIconPosition: 'start'
8
8
  };
9
9
  export const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;
10
- var _React_useContext;
11
- export const useAccordionHeaderContext_unstable = ()=>(_React_useContext = React.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;
10
+ export const useAccordionHeaderContext_unstable = ()=>{
11
+ var _React_useContext;
12
+ return (_React_useContext = React.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;
13
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["accordionHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport type {\n AccordionHeaderExpandIconPosition,\n AccordionHeaderSize,\n} from '../components/AccordionHeader/AccordionHeader.types';\n\nexport type AccordionHeaderContextValue = {\n disabled: boolean;\n open: boolean;\n expandIconPosition: AccordionHeaderExpandIconPosition;\n size: AccordionHeaderSize;\n};\n\nconst AccordionHeaderContext = React.createContext<AccordionHeaderContextValue | undefined>(\n undefined,\n) as React.Context<AccordionHeaderContextValue>;\n\nconst accordionHeaderContextDefaultValue = {\n open: false,\n disabled: false,\n size: 'medium',\n expandIconPosition: 'start',\n};\n\nexport const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;\n\nexport const useAccordionHeaderContext_unstable = () =>\n React.useContext(AccordionHeaderContext) ?? accordionHeaderContextDefaultValue;\n"],"names":["React","AccordionHeaderContext","createContext","undefined","accordionHeaderContextDefaultValue","open","disabled","size","expandIconPosition","Provider","AccordionHeaderProvider","useAccordionHeaderContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAa/B,MAAMC,yBAAyBD,MAAME,aAAa,CAChDC;AAGF,MAAMC,qCAAqC;IACzCC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,oBAAoB;AACtB;AAEA,OAAO,MAAM,EAAEC,UAAUC,uBAAuB,EAAE,GAAGT,uBAAuB;IAG1ED;AADF,OAAO,MAAMW,qCAAqC,IAChDX,CAAAA,oBAAAA,MAAMY,UAAU,CAACX,qCAAjBD,+BAAAA,oBAA4CI,mCAAmC"}
1
+ {"version":3,"sources":["accordionHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport type {\n AccordionHeaderExpandIconPosition,\n AccordionHeaderSize,\n} from '../components/AccordionHeader/AccordionHeader.types';\n\nexport type AccordionHeaderContextValue = {\n disabled: boolean;\n open: boolean;\n expandIconPosition: AccordionHeaderExpandIconPosition;\n size: AccordionHeaderSize;\n};\n\nconst AccordionHeaderContext = React.createContext<AccordionHeaderContextValue | undefined>(\n undefined,\n) as React.Context<AccordionHeaderContextValue>;\n\nconst accordionHeaderContextDefaultValue = {\n open: false,\n disabled: false,\n size: 'medium',\n expandIconPosition: 'start',\n};\n\nexport const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;\n\nexport const useAccordionHeaderContext_unstable = () =>\n React.useContext(AccordionHeaderContext) ?? accordionHeaderContextDefaultValue;\n"],"names":["React","AccordionHeaderContext","createContext","undefined","accordionHeaderContextDefaultValue","open","disabled","size","expandIconPosition","Provider","AccordionHeaderProvider","useAccordionHeaderContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAa/B,MAAMC,yBAAyBD,MAAME,aAAa,CAChDC;AAGF,MAAMC,qCAAqC;IACzCC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,oBAAoB;AACtB;AAEA,OAAO,MAAM,EAAEC,UAAUC,uBAAuB,EAAE,GAAGT,uBAAuB;AAE5E,OAAO,MAAMU,qCAAqC;QAChDX;WAAAA,CAAAA,oBAAAA,MAAMY,UAAU,CAACX,qCAAjBD,+BAAAA,oBAA4CI;AAAiC,EAAE"}
@@ -29,9 +29,8 @@ const useAccordion_unstable = (props, ref)=>{
29
29
  tabbable: true
30
30
  });
31
31
  const requestToggle = (0, _reactutilities.useEventCallback)((data)=>{
32
- var _onToggle;
33
32
  const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);
34
- (_onToggle = onToggle) === null || _onToggle === void 0 ? void 0 : _onToggle(data.event, {
33
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle(data.event, {
35
34
  value: data.value,
36
35
  openItems: nextOpenItems
37
36
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["useAccordion.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\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 */ export const useAccordion_unstable = (props, ref)=>{\n const { openItems: controlledOpenItems, defaultOpenItems, multiple = false, collapsible = false, onToggle, navigation } = props;\n const [openItems, setOpenItems] = useControllableState({\n state: React.useMemo(()=>normalizeValues(controlledOpenItems), [\n controlledOpenItems\n ]),\n defaultState: ()=>initializeUncontrolledOpenItems({\n defaultOpenItems,\n multiple\n }),\n initialState: []\n });\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: navigation === 'circular',\n tabbable: true\n });\n const requestToggle = useEventCallback((data)=>{\n var _onToggle;\n const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);\n (_onToggle = onToggle) === null || _onToggle === void 0 ? void 0 : _onToggle(data.event, {\n value: data.value,\n openItems: nextOpenItems\n });\n setOpenItems(nextOpenItems);\n });\n return {\n collapsible,\n multiple,\n navigation,\n openItems,\n requestToggle,\n components: {\n root: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ...props,\n ...navigation ? arrowNavigationProps : undefined,\n ref\n }), {\n elementType: 'div'\n })\n };\n};\n/**\n * Initial value for the uncontrolled case of the list of open indexes\n */ function initializeUncontrolledOpenItems({ defaultOpenItems, multiple }) {\n if (defaultOpenItems !== undefined) {\n if (Array.isArray(defaultOpenItems)) {\n return multiple ? defaultOpenItems : [\n defaultOpenItems[0]\n ];\n }\n return [\n defaultOpenItems\n ];\n }\n return [];\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 multiple - if Accordion support multiple Panels opened at the same time\n * @param collapsible - if Accordion support multiple Panels closed at the same time\n */ function updateOpenItems(value, previousOpenItems, multiple, collapsible) {\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 [\n ...previousOpenItems,\n value\n ].sort();\n }\n } else {\n return previousOpenItems[0] === value && collapsible ? [] : [\n value\n ];\n }\n return previousOpenItems;\n}\n/**\n * Normalizes Accordion index into an array of indexes\n */ function normalizeValues(index) {\n if (index === undefined) {\n return undefined;\n }\n return Array.isArray(index) ? index : [\n index\n ];\n}\n"],"names":["useAccordion_unstable","props","ref","openItems","controlledOpenItems","defaultOpenItems","multiple","collapsible","onToggle","navigation","setOpenItems","useControllableState","state","React","useMemo","normalizeValues","defaultState","initializeUncontrolledOpenItems","initialState","arrowNavigationProps","useArrowNavigationGroup","circular","tabbable","requestToggle","useEventCallback","data","_onToggle","nextOpenItems","updateOpenItems","value","event","components","root","slot","always","getNativeElementProps","undefined","elementType","Array","isArray","previousOpenItems","includes","length","filter","i","sort","index"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;gCAC6D;8BAC5C;AAK7B,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,WAAWC,mBAAmB,EAAEC,gBAAgB,EAAEC,WAAW,KAAK,EAAEC,cAAc,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGR;IAC1H,MAAM,CAACE,WAAWO,aAAa,GAAGC,IAAAA,oCAAoB,EAAC;QACnDC,OAAOC,OAAMC,OAAO,CAAC,IAAIC,gBAAgBX,sBAAsB;YAC3DA;SACH;QACDY,cAAc,IAAIC,gCAAgC;gBAC1CZ;gBACAC;YACJ;QACJY,cAAc,EAAE;IACpB;IACA,MAAMC,uBAAuBC,IAAAA,qCAAuB,EAAC;QACjDC,UAAUZ,eAAe;QACzBa,UAAU;IACd;IACA,MAAMC,gBAAgBC,IAAAA,gCAAgB,EAAC,CAACC;QACpC,IAAIC;QACJ,MAAMC,gBAAgBC,gBAAgBH,KAAKI,KAAK,EAAE1B,WAAWG,UAAUC;QACtEmB,CAAAA,YAAYlB,QAAO,MAAO,QAAQkB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUD,KAAKK,KAAK,EAAE;YACrFD,OAAOJ,KAAKI,KAAK;YACjB1B,WAAWwB;QACf;QACAjB,aAAaiB;IACjB;IACA,OAAO;QACHpB;QACAD;QACAG;QACAN;QACAoB;QACAQ,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3C,GAAGlC,KAAK;YACR,GAAGQ,aAAaU,uBAAuBiB,SAAS;YAChDlC;QACJ,IAAI;YACAmC,aAAa;QACjB;IACJ;AACJ;AACA;;CAEC,GAAG,SAASpB,gCAAgC,EAAEZ,gBAAgB,EAAEC,QAAQ,EAAE;IACvE,IAAID,qBAAqB+B,WAAW;QAChC,IAAIE,MAAMC,OAAO,CAAClC,mBAAmB;YACjC,OAAOC,WAAWD,mBAAmB;gBACjCA,gBAAgB,CAAC,EAAE;aACtB;QACL;QACA,OAAO;YACHA;SACH;IACL;IACA,OAAO,EAAE;AACb;AACA;;;;;;CAMC,GAAG,SAASuB,gBAAgBC,KAAK,EAAEW,iBAAiB,EAAElC,QAAQ,EAAEC,WAAW;IACxE,IAAID,UAAU;QACV,IAAIkC,kBAAkBC,QAAQ,CAACZ,QAAQ;YACnC,IAAIW,kBAAkBE,MAAM,GAAG,KAAKnC,aAAa;gBAC7C,OAAOiC,kBAAkBG,MAAM,CAAC,CAACC,IAAIA,MAAMf;YAC/C;QACJ,OAAO;YACH,OAAO;mBACAW;gBACHX;aACH,CAACgB,IAAI;QACV;IACJ,OAAO;QACH,OAAOL,iBAAiB,CAAC,EAAE,KAAKX,SAAStB,cAAc,EAAE,GAAG;YACxDsB;SACH;IACL;IACA,OAAOW;AACX;AACA;;CAEC,GAAG,SAASzB,gBAAgB+B,KAAK;IAC9B,IAAIA,UAAUV,WAAW;QACrB,OAAOA;IACX;IACA,OAAOE,MAAMC,OAAO,CAACO,SAASA,QAAQ;QAClCA;KACH;AACL"}
1
+ {"version":3,"sources":["useAccordion.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useControllableState, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\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 */ export const useAccordion_unstable = (props, ref)=>{\n const { openItems: controlledOpenItems, defaultOpenItems, multiple = false, collapsible = false, onToggle, navigation } = props;\n const [openItems, setOpenItems] = useControllableState({\n state: React.useMemo(()=>normalizeValues(controlledOpenItems), [\n controlledOpenItems\n ]),\n defaultState: ()=>initializeUncontrolledOpenItems({\n defaultOpenItems,\n multiple\n }),\n initialState: []\n });\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: navigation === 'circular',\n tabbable: true\n });\n const requestToggle = useEventCallback((data)=>{\n const nextOpenItems = updateOpenItems(data.value, openItems, multiple, collapsible);\n onToggle === null || onToggle === void 0 ? void 0 : onToggle(data.event, {\n value: data.value,\n openItems: nextOpenItems\n });\n setOpenItems(nextOpenItems);\n });\n return {\n collapsible,\n multiple,\n navigation,\n openItems,\n requestToggle,\n components: {\n root: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ...props,\n ...navigation ? arrowNavigationProps : undefined,\n ref\n }), {\n elementType: 'div'\n })\n };\n};\n/**\n * Initial value for the uncontrolled case of the list of open indexes\n */ function initializeUncontrolledOpenItems({ defaultOpenItems, multiple }) {\n if (defaultOpenItems !== undefined) {\n if (Array.isArray(defaultOpenItems)) {\n return multiple ? defaultOpenItems : [\n defaultOpenItems[0]\n ];\n }\n return [\n defaultOpenItems\n ];\n }\n return [];\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 multiple - if Accordion support multiple Panels opened at the same time\n * @param collapsible - if Accordion support multiple Panels closed at the same time\n */ function updateOpenItems(value, previousOpenItems, multiple, collapsible) {\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 [\n ...previousOpenItems,\n value\n ].sort();\n }\n } else {\n return previousOpenItems[0] === value && collapsible ? [] : [\n value\n ];\n }\n return previousOpenItems;\n}\n/**\n * Normalizes Accordion index into an array of indexes\n */ function normalizeValues(index) {\n if (index === undefined) {\n return undefined;\n }\n return Array.isArray(index) ? index : [\n index\n ];\n}\n"],"names":["useAccordion_unstable","props","ref","openItems","controlledOpenItems","defaultOpenItems","multiple","collapsible","onToggle","navigation","setOpenItems","useControllableState","state","React","useMemo","normalizeValues","defaultState","initializeUncontrolledOpenItems","initialState","arrowNavigationProps","useArrowNavigationGroup","circular","tabbable","requestToggle","useEventCallback","data","nextOpenItems","updateOpenItems","value","event","components","root","slot","always","getNativeElementProps","undefined","elementType","Array","isArray","previousOpenItems","includes","length","filter","i","sort","index"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;gCAC6D;8BAC5C;AAK7B,MAAMA,wBAAwB,CAACC,OAAOC;IAC7C,MAAM,EAAEC,WAAWC,mBAAmB,EAAEC,gBAAgB,EAAEC,WAAW,KAAK,EAAEC,cAAc,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGR;IAC1H,MAAM,CAACE,WAAWO,aAAa,GAAGC,IAAAA,oCAAoB,EAAC;QACnDC,OAAOC,OAAMC,OAAO,CAAC,IAAIC,gBAAgBX,sBAAsB;YAC3DA;SACH;QACDY,cAAc,IAAIC,gCAAgC;gBAC1CZ;gBACAC;YACJ;QACJY,cAAc,EAAE;IACpB;IACA,MAAMC,uBAAuBC,IAAAA,qCAAuB,EAAC;QACjDC,UAAUZ,eAAe;QACzBa,UAAU;IACd;IACA,MAAMC,gBAAgBC,IAAAA,gCAAgB,EAAC,CAACC;QACpC,MAAMC,gBAAgBC,gBAAgBF,KAAKG,KAAK,EAAEzB,WAAWG,UAAUC;QACvEC,aAAa,QAAQA,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASiB,KAAKI,KAAK,EAAE;YACrED,OAAOH,KAAKG,KAAK;YACjBzB,WAAWuB;QACf;QACAhB,aAAagB;IACjB;IACA,OAAO;QACHnB;QACAD;QACAG;QACAN;QACAoB;QACAO,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3C,GAAGjC,KAAK;YACR,GAAGQ,aAAaU,uBAAuBgB,SAAS;YAChDjC;QACJ,IAAI;YACAkC,aAAa;QACjB;IACJ;AACJ;AACA;;CAEC,GAAG,SAASnB,gCAAgC,EAAEZ,gBAAgB,EAAEC,QAAQ,EAAE;IACvE,IAAID,qBAAqB8B,WAAW;QAChC,IAAIE,MAAMC,OAAO,CAACjC,mBAAmB;YACjC,OAAOC,WAAWD,mBAAmB;gBACjCA,gBAAgB,CAAC,EAAE;aACtB;QACL;QACA,OAAO;YACHA;SACH;IACL;IACA,OAAO,EAAE;AACb;AACA;;;;;;CAMC,GAAG,SAASsB,gBAAgBC,KAAK,EAAEW,iBAAiB,EAAEjC,QAAQ,EAAEC,WAAW;IACxE,IAAID,UAAU;QACV,IAAIiC,kBAAkBC,QAAQ,CAACZ,QAAQ;YACnC,IAAIW,kBAAkBE,MAAM,GAAG,KAAKlC,aAAa;gBAC7C,OAAOgC,kBAAkBG,MAAM,CAAC,CAACC,IAAIA,MAAMf;YAC/C;QACJ,OAAO;YACH,OAAO;mBACAW;gBACHX;aACH,CAACgB,IAAI;QACV;IACJ,OAAO;QACH,OAAOL,iBAAiB,CAAC,EAAE,KAAKX,SAASrB,cAAc,EAAE,GAAG;YACxDqB;SACH;IACL;IACA,OAAOW;AACX;AACA;;CAEC,GAAG,SAASxB,gBAAgB8B,KAAK;IAC9B,IAAIA,UAAUV,WAAW;QACrB,OAAOA;IACX;IACA,OAAOE,MAAMC,OAAO,CAACO,SAASA,QAAQ;QAClCA;KACH;AACL"}
@@ -79,8 +79,8 @@ const useAccordionHeader_unstable = (props, ref)=>{
79
79
  }),
80
80
  onClick: (0, _reactutilities.useEventCallback)((event)=>{
81
81
  if ((0, _reactutilities.isResolvedShorthand)(button)) {
82
- var _button_onClick, _button;
83
- (_button_onClick = (_button = button).onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(_button, event);
82
+ var _button_onClick;
83
+ (_button_onClick = button.onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(button, event);
84
84
  }
85
85
  if (!event.defaultPrevented) {
86
86
  requestToggle({
@@ -1 +1 @@
1
- {"version":3,"sources":["useAccordionHeader.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { useAccordionContext_unstable } from '../../contexts/accordion';\nimport { ChevronRightRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAccordionItemContext_unstable } from '../../contexts/accordionItem';\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 */ export const useAccordionHeader_unstable = (props, ref)=>{\n const { as, icon, button, expandIcon, inline = false, size = 'medium', expandIconPosition = 'start' } = props;\n const { value, disabled, open } = useAccordionItemContext_unstable();\n const requestToggle = useAccordionContext_unstable((ctx)=>ctx.requestToggle);\n /**\n * force disabled state on button if accordion isn't collapsible\n * and this is the only item opened\n */ const disabledFocusable = useAccordionContext_unstable((ctx)=>!ctx.collapsible && ctx.openItems.length === 1 && open);\n const { dir } = useFluent();\n // Calculate how to rotate the expand icon [>] (ChevronRightRegular)\n let expandIconRotation;\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 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: slot.always(getNativeElementProps(as || 'div', {\n ref,\n ...props\n }), {\n elementType: 'div'\n }),\n icon: slot.optional(icon, {\n elementType: 'div'\n }),\n expandIcon: slot.optional(expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(ChevronRightRegular, {\n style: {\n transform: `rotate(${expandIconRotation}deg)`\n }\n }),\n 'aria-hidden': true\n },\n elementType: 'span'\n }),\n button: slot.always({\n ...useARIAButtonShorthand(button, {\n required: true,\n defaultProps: {\n disabled,\n disabledFocusable,\n 'aria-expanded': open,\n type: 'button'\n }\n }),\n onClick: useEventCallback((event)=>{\n if (isResolvedShorthand(button)) {\n var _button_onClick, _button;\n (_button_onClick = (_button = button).onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(_button, event);\n }\n if (!event.defaultPrevented) {\n requestToggle({\n value,\n event\n });\n }\n })\n }, {\n elementType: 'button'\n })\n };\n};\n"],"names":["useAccordionHeader_unstable","props","ref","as","icon","button","expandIcon","inline","size","expandIconPosition","value","disabled","open","useAccordionItemContext_unstable","requestToggle","useAccordionContext_unstable","ctx","disabledFocusable","collapsible","openItems","length","dir","useFluent","expandIconRotation","components","root","slot","always","getNativeElementProps","elementType","optional","renderByDefault","defaultProps","children","React","createElement","ChevronRightRegular","style","transform","useARIAButtonShorthand","required","type","onClick","useEventCallback","event","isResolvedShorthand","_button_onClick","_button","call","defaultPrevented"],"mappings":";;;;+BAWiBA;;;eAAAA;;;;iEAXM;gCAC4D;2BAC5C;2BACM;4BACT;qCACY;+BACC;AAKtC,MAAMA,8BAA8B,CAACC,OAAOC;IACnD,MAAM,EAAEC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,KAAK,EAAEC,OAAO,QAAQ,EAAEC,qBAAqB,OAAO,EAAE,GAAGR;IACxG,MAAM,EAAES,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,IAAAA,+CA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AC,CAACC;gBACvB,IAAIC,IAAAA,mCAAmB,EAACxC,SAAS;oBAC7B,IAAIyC,iBAAiBC;oBACpBD,CAAAA,kBAAkB,AAACC,CAAAA,UAAU1C,MAAK,EAAGqC,OAAO,AAAD,MAAO,QAAQI,oBAAoB,KAAK,IAAI,KAAK,IAAIA,gBAAgBE,IAAI,CAACD,SAASH;gBACnI;gBACA,IAAI,CAACA,MAAMK,gBAAgB,EAAE;oBACzBnC,cAAc;wBACVJ;wBACAkC;oBACJ;gBACJ;YACJ;QACJ,GAAG;YACCf,aAAa;QACjB;IACJ;AACJ"}
1
+ {"version":3,"sources":["useAccordionHeader.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, isResolvedShorthand, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { useAccordionContext_unstable } from '../../contexts/accordion';\nimport { ChevronRightRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAccordionItemContext_unstable } from '../../contexts/accordionItem';\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 */ export const useAccordionHeader_unstable = (props, ref)=>{\n const { as, icon, button, expandIcon, inline = false, size = 'medium', expandIconPosition = 'start' } = props;\n const { value, disabled, open } = useAccordionItemContext_unstable();\n const requestToggle = useAccordionContext_unstable((ctx)=>ctx.requestToggle);\n /**\n * force disabled state on button if accordion isn't collapsible\n * and this is the only item opened\n */ const disabledFocusable = useAccordionContext_unstable((ctx)=>!ctx.collapsible && ctx.openItems.length === 1 && open);\n const { dir } = useFluent();\n // Calculate how to rotate the expand icon [>] (ChevronRightRegular)\n let expandIconRotation;\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 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: slot.always(getNativeElementProps(as || 'div', {\n ref,\n ...props\n }), {\n elementType: 'div'\n }),\n icon: slot.optional(icon, {\n elementType: 'div'\n }),\n expandIcon: slot.optional(expandIcon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(ChevronRightRegular, {\n style: {\n transform: `rotate(${expandIconRotation}deg)`\n }\n }),\n 'aria-hidden': true\n },\n elementType: 'span'\n }),\n button: slot.always({\n ...useARIAButtonShorthand(button, {\n required: true,\n defaultProps: {\n disabled,\n disabledFocusable,\n 'aria-expanded': open,\n type: 'button'\n }\n }),\n onClick: useEventCallback((event)=>{\n if (isResolvedShorthand(button)) {\n var _button_onClick;\n (_button_onClick = button.onClick) === null || _button_onClick === void 0 ? void 0 : _button_onClick.call(button, event);\n }\n if (!event.defaultPrevented) {\n requestToggle({\n value,\n event\n });\n }\n })\n }, {\n elementType: 'button'\n })\n };\n};\n"],"names":["useAccordionHeader_unstable","props","ref","as","icon","button","expandIcon","inline","size","expandIconPosition","value","disabled","open","useAccordionItemContext_unstable","requestToggle","useAccordionContext_unstable","ctx","disabledFocusable","collapsible","openItems","length","dir","useFluent","expandIconRotation","components","root","slot","always","getNativeElementProps","elementType","optional","renderByDefault","defaultProps","children","React","createElement","ChevronRightRegular","style","transform","useARIAButtonShorthand","required","type","onClick","useEventCallback","event","isResolvedShorthand","_button_onClick","call","defaultPrevented"],"mappings":";;;;+BAWiBA;;;eAAAA;;;;iEAXM;gCAC4D;2BAC5C;2BACM;4BACT;qCACY;+BACC;AAKtC,MAAMA,8BAA8B,CAACC,OAAOC;IACnD,MAAM,EAAEC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,KAAK,EAAEC,OAAO,QAAQ,EAAEC,qBA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AAc;oBACVrB;oBACAM;oBACA,iBAAiBL;oBACjB6B,MAAM;gBACV;YACJ,EAAE;YACFC,SAASC,IAAAA,gCAAgB,EAAC,CAACC;gBACvB,IAAIC,IAAAA,mCAAmB,EAACxC,SAAS;oBAC7B,IAAIyC;oBACHA,CAAAA,kBAAkBzC,OAAOqC,OAAO,AAAD,MAAO,QAAQI,oBAAoB,KAAK,IAAI,KAAK,IAAIA,gBAAgBC,IAAI,CAAC1C,QAAQuC;gBACtH;gBACA,IAAI,CAACA,MAAMI,gBAAgB,EAAE;oBACzBlC,cAAc;wBACVJ;wBACAkC;oBACJ;gBACJ;YACJ;QACJ,GAAG;YACCf,aAAa;QACjB;IACJ;AACJ"}
@@ -26,5 +26,7 @@ const accordionHeaderContextDefaultValue = {
26
26
  expandIconPosition: 'start'
27
27
  };
28
28
  const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;
29
- var _React_useContext;
30
- const useAccordionHeaderContext_unstable = ()=>(_React_useContext = _react.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;
29
+ const useAccordionHeaderContext_unstable = ()=>{
30
+ var _React_useContext;
31
+ return (_React_useContext = _react.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;
32
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["accordionHeader.js"],"sourcesContent":["import * as React from 'react';\nconst AccordionHeaderContext = React.createContext(undefined);\nconst accordionHeaderContextDefaultValue = {\n open: false,\n disabled: false,\n size: 'medium',\n expandIconPosition: 'start'\n};\nexport const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;\nvar _React_useContext;\nexport const useAccordionHeaderContext_unstable = ()=>(_React_useContext = React.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;\n"],"names":["AccordionHeaderProvider","useAccordionHeaderContext_unstable","AccordionHeaderContext","React","createContext","undefined","accordionHeaderContextDefaultValue","open","disabled","size","expandIconPosition","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQyBA,uBAAuB;eAAvBA;;IAEZC,kCAAkC;eAAlCA;;;;iEAVU;AACvB,MAAMC,uCAAyBC,OAAMC,aAAa,CAACC;AACnD,MAAMC,qCAAqC;IACvCC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,oBAAoB;AACxB;AACO,MAAM,EAAEC,UAAUX,uBAAuB,EAAE,GAAGE;AACrD,IAAIU;AACG,MAAMX,qCAAqC,IAAI,AAACW,CAAAA,oBAAoBT,OAAMU,UAAU,CAACX,uBAAsB,MAAO,QAAQU,sBAAsB,KAAK,IAAIA,oBAAoBN"}
1
+ {"version":3,"sources":["accordionHeader.js"],"sourcesContent":["import * as React from 'react';\nconst AccordionHeaderContext = React.createContext(undefined);\nconst accordionHeaderContextDefaultValue = {\n open: false,\n disabled: false,\n size: 'medium',\n expandIconPosition: 'start'\n};\nexport const { Provider: AccordionHeaderProvider } = AccordionHeaderContext;\nexport const useAccordionHeaderContext_unstable = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(AccordionHeaderContext)) !== null && _React_useContext !== void 0 ? _React_useContext : accordionHeaderContextDefaultValue;\n};\n"],"names":["AccordionHeaderProvider","useAccordionHeaderContext_unstable","AccordionHeaderContext","React","createContext","undefined","accordionHeaderContextDefaultValue","open","disabled","size","expandIconPosition","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAQyBA,uBAAuB;eAAvBA;;IACZC,kCAAkC;eAAlCA;;;;iEATU;AACvB,MAAMC,uCAAyBC,OAAMC,aAAa,CAACC;AACnD,MAAMC,qCAAqC;IACvCC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,oBAAoB;AACxB;AACO,MAAM,EAAEC,UAAUX,uBAAuB,EAAE,GAAGE;AAC9C,MAAMD,qCAAqC;IAC9C,IAAIW;IACJ,OAAO,AAACA,CAAAA,oBAAoBT,OAAMU,UAAU,CAACX,uBAAsB,MAAO,QAAQU,sBAAsB,KAAK,IAAIA,oBAAoBN;AACzI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-accordion",
3
- "version": "9.3.13",
3
+ "version": "9.3.16",
4
4
  "description": "Fluent UI accordion component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -33,14 +33,14 @@
33
33
  "@fluentui/scripts-tasks": "*"
34
34
  },
35
35
  "dependencies": {
36
- "@fluentui/react-aria": "^9.3.36",
37
- "@fluentui/react-context-selector": "^9.1.34",
38
- "@fluentui/react-icons": "^2.0.207",
39
- "@fluentui/react-jsx-runtime": "^9.0.9",
40
- "@fluentui/react-shared-contexts": "^9.8.0",
41
- "@fluentui/react-tabster": "^9.12.10",
42
- "@fluentui/react-theme": "^9.1.12",
43
- "@fluentui/react-utilities": "^9.13.3",
36
+ "@fluentui/react-aria": "^9.3.38",
37
+ "@fluentui/react-context-selector": "^9.1.36",
38
+ "@fluentui/react-icons": "^2.0.217",
39
+ "@fluentui/react-jsx-runtime": "^9.0.12",
40
+ "@fluentui/react-shared-contexts": "^9.9.1",
41
+ "@fluentui/react-tabster": "^9.13.1",
42
+ "@fluentui/react-theme": "^9.1.14",
43
+ "@fluentui/react-utilities": "^9.13.5",
44
44
  "@griffel/react": "^1.5.14",
45
45
  "@swc/helpers": "^0.5.1"
46
46
  },