@wix/site-ui 1.346.0 → 1.348.0

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.
Files changed (226) hide show
  1. package/dist/{6706.js → 1093.js} +3 -3
  2. package/dist/{8724.js → 1219.js} +2 -2
  3. package/dist/{7373.js → 1288.js} +8 -2
  4. package/dist/{5299.js → 1381.js} +98 -127
  5. package/dist/{3056.js → 1607.js} +32 -34
  6. package/dist/1629.js +2 -0
  7. package/dist/1669.js +75 -0
  8. package/dist/1718.js +26 -0
  9. package/dist/{1477.js → 201.js} +17 -26
  10. package/dist/2221.js +9 -0
  11. package/dist/{2445.js → 226.js} +12 -48
  12. package/dist/2387.js +7 -0
  13. package/dist/2580.js +6 -0
  14. package/dist/{1500.js → 2859.js} +10 -34
  15. package/dist/3014.js +178 -0
  16. package/dist/{6247.js → 3054.js} +3 -3
  17. package/dist/{7642.js → 3093.js} +1 -1
  18. package/dist/3189.js +5 -0
  19. package/dist/{7564.js → 331.js} +2 -2
  20. package/dist/3357.js +7 -0
  21. package/dist/{487.js → 3398.js} +38 -39
  22. package/dist/3502.js +224 -0
  23. package/dist/3695.js +50 -0
  24. package/dist/3829.js +1 -1
  25. package/dist/{6588.js → 3859.js} +115 -92
  26. package/dist/{3670.js → 3910.js} +28 -21
  27. package/dist/392.js +7 -0
  28. package/dist/{4549.js → 4155.js} +11 -3
  29. package/dist/4226.js +7 -0
  30. package/dist/{6329.js → 4229.js} +1 -1
  31. package/dist/4293.js +3 -0
  32. package/dist/4346.js +853 -2
  33. package/dist/{285.js → 4472.js} +3 -3
  34. package/dist/4605.js +207 -0
  35. package/dist/{7366.js → 488.js} +60 -7
  36. package/dist/{8750.js → 497.js} +190 -375
  37. package/dist/4989.js +35 -0
  38. package/dist/{6270.js → 510.js} +157 -196
  39. package/dist/5258.js +26 -0
  40. package/dist/{5036.js → 5275.js} +0 -3
  41. package/dist/{8171.js → 5298.js} +90 -102
  42. package/dist/5473.js +11 -0
  43. package/dist/{4745.js → 5490.js} +3 -1
  44. package/dist/{6089.js → 5561.js} +869 -786
  45. package/dist/{8996.js → 5595.js} +4 -3
  46. package/dist/5890.js +25 -0
  47. package/dist/{6046.js → 5969.js} +1 -1
  48. package/dist/5984.js +38 -0
  49. package/dist/{8527.js → 6006.js} +3 -3
  50. package/dist/6040.js +97 -0
  51. package/dist/{8758.js → 6137.js} +10 -8
  52. package/dist/{4281.js → 6140.js} +18 -10
  53. package/dist/{8960.js → 6191.js} +2 -2
  54. package/dist/6240.js +121 -0
  55. package/dist/{4490.js → 6373.js} +7 -5
  56. package/dist/{904.js → 6487.js} +19 -17
  57. package/dist/{9635.js → 6498.js} +1 -1
  58. package/dist/6499.js +4 -7
  59. package/dist/6508.js +7 -0
  60. package/dist/{8225.js → 6540.js} +1 -0
  61. package/dist/6551.js +46 -0
  62. package/dist/{9369.js → 6620.js} +35 -34
  63. package/dist/{4143.js → 6838.js} +19 -10
  64. package/dist/6902.js +48 -0
  65. package/dist/6904.js +51 -0
  66. package/dist/70.js +24 -0
  67. package/dist/7024.js +39 -0
  68. package/dist/{6882.js → 721.js} +737 -362
  69. package/dist/{951.js → 7270.js} +4 -4
  70. package/dist/{3485.js → 7323.js} +143 -111
  71. package/dist/{7541.js → 7488.js} +2 -2
  72. package/dist/{4863.js → 7542.js} +7 -6
  73. package/dist/7551.js +28 -0
  74. package/dist/{7021.js → 7640.js} +1 -1
  75. package/dist/{353.js → 7692.js} +3 -7
  76. package/dist/{4707.js → 7930.js} +2 -2
  77. package/dist/{8052.js → 8.js} +80 -64
  78. package/dist/{6914.js → 8129.js} +3 -15
  79. package/dist/{3319.js → 8358.js} +62 -63
  80. package/dist/{5864.js → 8407.js} +13 -13
  81. package/dist/8488.js +15 -0
  82. package/dist/{4768.js → 8495.js} +1 -1
  83. package/dist/8734.js +171 -0
  84. package/dist/{1763.js → 9018.js} +205 -331
  85. package/dist/9053.js +29 -0
  86. package/dist/9067.js +41 -0
  87. package/dist/{2861.js → 9120.js} +2 -2
  88. package/dist/{42.js → 9197.js} +2 -2
  89. package/dist/{9189.js → 9248.js} +36 -17
  90. package/dist/{2801.js → 9252.js} +4 -9
  91. package/dist/9295.js +7 -0
  92. package/dist/9303.js +8 -0
  93. package/dist/{167.js → 9374.js} +1 -1
  94. package/dist/{9352.js → 9540.js} +17 -47
  95. package/dist/9576.js +51 -0
  96. package/dist/{8272.js → 9591.js} +36 -46
  97. package/dist/{6107.js → 9770.js} +2 -2
  98. package/dist/{5085.js → 9880.js} +6 -3
  99. package/dist/Accordion/index.d.ts +207 -41
  100. package/dist/Accordion/index.js +75 -177
  101. package/dist/AlertDialog/index.d.ts +440 -140
  102. package/dist/AlertDialog/index.js +3 -13
  103. package/dist/Autocomplete/index.d.ts +722 -150
  104. package/dist/Autocomplete/index.js +16 -29
  105. package/dist/Avatar/index.d.ts +38 -3
  106. package/dist/Avatar/index.js +82 -28
  107. package/dist/Breadcrumbs/index.d.ts +63 -91
  108. package/dist/Breadcrumbs/index.js +1 -1
  109. package/dist/Button/index.d.ts +11 -0
  110. package/dist/Button/index.js +2 -2
  111. package/dist/Checkbox/index.d.ts +206 -36
  112. package/dist/Checkbox/index.js +293 -8
  113. package/dist/CheckboxField/index.css +1 -1
  114. package/dist/CheckboxField/index.d.ts +40 -36
  115. package/dist/CheckboxGroup/index.d.ts +50 -36
  116. package/dist/CheckboxGroup/index.js +87 -58
  117. package/dist/CheckboxGroupField/index.css +1 -1
  118. package/dist/Collapsible/index.d.ts +128 -36
  119. package/dist/Collapsible/index.js +21 -25
  120. package/dist/Combobox/index.d.ts +801 -158
  121. package/dist/Combobox/index.js +70 -114
  122. package/dist/ContextMenu/index.d.ts +1162 -195
  123. package/dist/ContextMenu/index.js +46 -36
  124. package/dist/Dialog/index.d.ts +425 -133
  125. package/dist/Dialog/index.js +8 -4
  126. package/dist/Drawer/index.d.ts +589 -144
  127. package/dist/Drawer/index.js +482 -562
  128. package/dist/Field/index.css +1 -1
  129. package/dist/Field/index.d.ts +341 -42
  130. package/dist/Field/index.js +123 -273
  131. package/dist/Fieldset/index.d.ts +11 -0
  132. package/dist/Fieldset/index.js +10 -17
  133. package/dist/Form/index.d.ts +43 -39
  134. package/dist/Form/index.js +58 -50
  135. package/dist/Input/index.css +1 -1
  136. package/dist/Input/index.d.ts +94 -42
  137. package/dist/Input/index.js +1 -1
  138. package/dist/Menu/index.d.ts +1140 -175
  139. package/dist/Menu/index.js +51 -67
  140. package/dist/Menubar/index.d.ts +651 -173
  141. package/dist/Menubar/index.js +12 -16
  142. package/dist/Meter/index.js +21 -18
  143. package/dist/NavigationMenu/index.d.ts +370 -86
  144. package/dist/NavigationMenu/index.js +144 -178
  145. package/dist/NumberField/index.css +1 -1
  146. package/dist/NumberField/index.d.ts +507 -47
  147. package/dist/NumberField/index.js +434 -718
  148. package/dist/Popover/index.d.ts +561 -142
  149. package/dist/Popover/index.js +181 -252
  150. package/dist/PreviewCard/index.d.ts +507 -143
  151. package/dist/PreviewCard/index.js +97 -151
  152. package/dist/Progress/index.d.ts +117 -3
  153. package/dist/Progress/index.js +37 -36
  154. package/dist/Radio/index.d.ts +177 -7
  155. package/dist/Radio/index.js +54 -70
  156. package/dist/RadioField/index.css +1 -1
  157. package/dist/RadioField/index.d.ts +23 -7
  158. package/dist/RadioGroup/index.d.ts +51 -37
  159. package/dist/RadioGroup/index.js +60 -51
  160. package/dist/RadioGroupField/index.css +1 -1
  161. package/dist/RadioGroupField/index.d.ts +40 -37
  162. package/dist/ScrollArea/index.d.ts +295 -1
  163. package/dist/ScrollArea/index.js +256 -324
  164. package/dist/Select/index.d.ts +516 -123
  165. package/dist/Select/index.js +513 -635
  166. package/dist/SelectField/index.css +1 -1
  167. package/dist/SelectField/index.d.ts +109 -134
  168. package/dist/SelectField/index.js +5 -1
  169. package/dist/Separator/index.d.ts +12 -0
  170. package/dist/Separator/index.js +1 -1
  171. package/dist/Slider/index.d.ts +383 -64
  172. package/dist/Slider/index.js +298 -374
  173. package/dist/Switch/index.d.ts +184 -37
  174. package/dist/Switch/index.js +44 -58
  175. package/dist/Tabs/index.d.ts +220 -35
  176. package/dist/Tabs/index.js +199 -193
  177. package/dist/Toast/index.d.ts +280 -64
  178. package/dist/Toast/index.js +299 -374
  179. package/dist/Toggle/index.d.ts +55 -35
  180. package/dist/Toggle/index.js +19 -13
  181. package/dist/ToggleGroup/index.d.ts +62 -35
  182. package/dist/ToggleGroup/index.js +13 -31
  183. package/dist/Toolbar/index.d.ts +117 -2
  184. package/dist/Toolbar/index.js +31 -43
  185. package/dist/Tooltip/index.d.ts +507 -150
  186. package/dist/Tooltip/index.js +163 -213
  187. package/dist/index.d.ts +12912 -5382
  188. package/package.json +3 -3
  189. package/dist/2205.js +0 -26
  190. package/dist/2274.js +0 -34
  191. package/dist/2287.js +0 -17
  192. package/dist/3020.js +0 -7
  193. package/dist/3021.js +0 -72
  194. package/dist/3140.js +0 -4
  195. package/dist/3248.js +0 -307
  196. package/dist/4026.js +0 -12
  197. package/dist/4922.js +0 -15
  198. package/dist/5659.js +0 -4
  199. package/dist/5992.js +0 -447
  200. package/dist/6330.js +0 -30
  201. package/dist/6535.js +0 -72
  202. package/dist/6917.js +0 -55
  203. package/dist/7725.js +0 -10
  204. package/dist/7871.js +0 -38
  205. package/dist/8106.js +0 -239
  206. package/dist/8685.js +0 -102
  207. package/dist/8935.js +0 -8
  208. package/dist/8971.js +0 -40
  209. package/dist/8979.js +0 -10
  210. package/dist/9048.js +0 -52
  211. package/dist/9087.js +0 -256
  212. package/dist/9255.js +0 -136
  213. /package/dist/{1457.js → 1068.js} +0 -0
  214. /package/dist/{6003.js → 1234.js} +0 -0
  215. /package/dist/{4723.js → 1282.js} +0 -0
  216. /package/dist/{6825.js → 1876.js} +0 -0
  217. /package/dist/{5778.js → 1885.js} +0 -0
  218. /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
  219. /package/dist/{1279.js → 3278.js} +0 -0
  220. /package/dist/{3296.js → 5568.js} +0 -0
  221. /package/dist/{8685.css → 6240.css} +0 -0
  222. /package/dist/{9829.js → 6488.js} +0 -0
  223. /package/dist/{9863.js → 6534.js} +0 -0
  224. /package/dist/{4495.js → 7718.js} +0 -0
  225. /package/dist/{3395.js → 8866.js} +0 -0
  226. /package/dist/{2418.js → 9837.js} +0 -0
@@ -1,93 +1,70 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ChevronDown } from "@wix/wix-ui-icons-common";
3
3
  import clsx from "clsx";
4
- import { resolveStyle, warn, useMergedRefs, useRenderElement, esm_formatErrorMessage } from "../8272.js";
5
- import { CollapsibleRootContext, useCollapsibleRootContext, collapsibleOpenStateMapping, triggerOpenStateMapping, useCollapsiblePanel, useCollapsibleRoot } from "../8052.js";
6
- import { transitionStatusMapping } from "../9369.js";
7
- import { useCompositeListItem } from "../3021.js";
8
- import { useBaseUiId } from "../6046.js";
9
- import { useStableCallback } from "../7541.js";
10
- import { isElementDisabled } from "../3140.js";
11
- import { useButton } from "../9189.js";
12
- import { useIsoLayoutEffect } from "../6499.js";
13
- import { ARROW_LEFT, ARROW_UP, COMPOSITE_KEYS, ARROW_DOWN, ARROW_RIGHT } from "../1500.js";
14
- import { stopEvent } from "../6330.js";
15
- import { useDirection } from "../9863.js";
16
- import { useControlled } from "../8527.js";
17
- import { createChangeEventDetails } from "../4768.js";
18
- import { CompositeList } from "../9255.js";
4
+ import { utils_formatErrorMessage } from "../5473.js";
5
+ import { CollapsibleRootContext, useCollapsibleRootContext, collapsibleOpenStateMapping, triggerOpenStateMapping, useCollapsiblePanel, useCollapsibleRoot } from "../8.js";
6
+ import { transitionStatusMapping } from "../8488.js";
7
+ import { useCompositeListItem } from "../9576.js";
8
+ import { useBaseUiId } from "../5969.js";
9
+ import { useStableCallback } from "../7488.js";
10
+ import { resolveStyle, warn, EMPTY_ARRAY, useRenderElement } from "../9591.js";
11
+ import { useButton } from "../9248.js";
12
+ import { useIsoLayoutEffect } from "../3357.js";
13
+ import { useControlled } from "../6006.js";
14
+ import { CompositeList } from "../3014.js";
19
15
  import { Typography } from "../Typography/index.js";
20
16
  import * as __rspack_external_react from "react";
21
17
  const AccordionRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
22
18
  if ("production" !== process.env.NODE_ENV) AccordionRootContext.displayName = "AccordionRootContext";
23
19
  function useAccordionRootContext() {
24
20
  const context = __rspack_external_react.useContext(AccordionRootContext);
25
- if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: AccordionRootContext is missing. Accordion parts must be placed within <Accordion.Root>.' : esm_formatErrorMessage(10));
21
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: AccordionRootContext is missing. Accordion parts must be placed within <Accordion.Root>.' : utils_formatErrorMessage(10));
26
22
  return context;
27
23
  }
28
24
  const AccordionItemContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
29
25
  if ("production" !== process.env.NODE_ENV) AccordionItemContext.displayName = "AccordionItemContext";
30
26
  function useAccordionItemContext() {
31
27
  const context = __rspack_external_react.useContext(AccordionItemContext);
32
- if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: AccordionItemContext is missing. Accordion parts must be placed within <Accordion.Item>.' : esm_formatErrorMessage(9));
28
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: AccordionItemContext is missing. Accordion parts must be placed within <Accordion.Item>.' : utils_formatErrorMessage(9));
33
29
  return context;
34
30
  }
35
- let AccordionItemDataAttributes_AccordionItemDataAttributes = /*#__PURE__*/ function(AccordionItemDataAttributes) {
36
- AccordionItemDataAttributes["index"] = "data-index";
37
- AccordionItemDataAttributes["disabled"] = "data-disabled";
38
- AccordionItemDataAttributes["open"] = "data-open";
39
- return AccordionItemDataAttributes;
40
- }({});
31
+ const AccordionItemDataAttributes_index = 'data-index';
41
32
  const accordionStateAttributesMapping = {
42
33
  ...collapsibleOpenStateMapping,
43
- index: (value)=>Number.isInteger(value) ? {
44
- [AccordionItemDataAttributes_AccordionItemDataAttributes.index]: String(value)
45
- } : null,
34
+ index: (value)=>({
35
+ [AccordionItemDataAttributes_index]: String(value)
36
+ }),
46
37
  ...transitionStatusMapping,
47
38
  value: ()=>null
48
39
  };
49
40
  const AccordionItem_AccordionItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
50
41
  const { className, disabled: disabledProp = false, onOpenChange: onOpenChangeProp, render, value: valueProp, style, ...elementProps } = componentProps;
51
42
  const { ref: listItemRef, index } = useCompositeListItem();
52
- const mergedRef = useMergedRefs(forwardedRef, listItemRef);
53
43
  const { disabled: contextDisabled, handleValueChange, state: rootState, value: openValues } = useAccordionRootContext();
54
44
  const fallbackValue = useBaseUiId();
55
45
  const value = valueProp ?? fallbackValue;
56
46
  const disabled = disabledProp || contextDisabled;
57
- const isOpen = __rspack_external_react.useMemo(()=>{
58
- if (!openValues) return false;
59
- for(let i = 0; i < openValues.length; i += 1)if (openValues[i] === value) return true;
60
- return false;
61
- }, [
62
- openValues,
63
- value
64
- ]);
47
+ const isOpen = openValues.includes(value);
65
48
  const onOpenChange = useStableCallback((nextOpen, eventDetails)=>{
66
49
  onOpenChangeProp?.(nextOpen, eventDetails);
67
50
  if (eventDetails.isCanceled) return;
68
- handleValueChange(value, nextOpen);
51
+ handleValueChange(value, nextOpen, eventDetails);
69
52
  });
70
53
  const collapsible = useCollapsibleRoot({
71
54
  open: isOpen,
72
55
  onOpenChange,
73
56
  disabled
74
57
  });
75
- const collapsibleState = __rspack_external_react.useMemo(()=>({
76
- open: collapsible.open,
77
- disabled: collapsible.disabled,
78
- transitionStatus: collapsible.transitionStatus
79
- }), [
80
- collapsible.open,
81
- collapsible.disabled,
82
- collapsible.transitionStatus
83
- ]);
84
58
  const collapsibleContext = __rspack_external_react.useMemo(()=>({
85
59
  ...collapsible,
86
60
  onOpenChange,
87
- state: collapsibleState
61
+ state: {
62
+ open: collapsible.open,
63
+ disabled: collapsible.disabled,
64
+ transitionStatus: collapsible.transitionStatus
65
+ }
88
66
  }), [
89
67
  collapsible,
90
- collapsibleState,
91
68
  onOpenChange
92
69
  ]);
93
70
  const state = __rspack_external_react.useMemo(()=>({
@@ -104,13 +81,16 @@ const AccordionItem_AccordionItem = /*#__PURE__*/ __rspack_external_react.forwar
104
81
  rootState
105
82
  ]);
106
83
  const defaultTriggerId = useBaseUiId();
107
- const [triggerId, setTriggerId] = __rspack_external_react.useState(defaultTriggerId);
84
+ const [registeredTriggerId, setTriggerId] = __rspack_external_react.useState();
85
+ const triggerId = null === registeredTriggerId ? void 0 : registeredTriggerId ?? defaultTriggerId;
108
86
  const accordionItemContext = __rspack_external_react.useMemo(()=>({
87
+ defaultTriggerId,
109
88
  open: isOpen,
110
89
  state,
111
90
  setTriggerId,
112
91
  triggerId
113
92
  }), [
93
+ defaultTriggerId,
114
94
  isOpen,
115
95
  state,
116
96
  setTriggerId,
@@ -118,7 +98,10 @@ const AccordionItem_AccordionItem = /*#__PURE__*/ __rspack_external_react.forwar
118
98
  ]);
119
99
  const element = useRenderElement('div', componentProps, {
120
100
  state,
121
- ref: mergedRef,
101
+ ref: [
102
+ forwardedRef,
103
+ listItemRef
104
+ ],
122
105
  props: elementProps,
123
106
  stateAttributesMapping: accordionStateAttributesMapping
124
107
  });
@@ -143,87 +126,35 @@ const AccordionHeader_AccordionHeader = /*#__PURE__*/ __rspack_external_react.fo
143
126
  return element;
144
127
  });
145
128
  if ("production" !== process.env.NODE_ENV) AccordionHeader_AccordionHeader.displayName = "AccordionHeader";
146
- function getActiveTriggers(accordionItemRefs) {
147
- const { current: accordionItemElements } = accordionItemRefs;
148
- const output = [];
149
- for(let i = 0; i < accordionItemElements.length; i += 1){
150
- const section = accordionItemElements[i];
151
- if (!isElementDisabled(section)) {
152
- const trigger = section?.querySelector('[type="button"], [role="button"]');
153
- if (trigger && !isElementDisabled(trigger)) output.push(trigger);
154
- }
155
- }
156
- return output;
157
- }
129
+ const stateAttributesMapping = {
130
+ ...accordionStateAttributesMapping,
131
+ ...triggerOpenStateMapping
132
+ };
158
133
  const AccordionTrigger_AccordionTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
159
134
  const { disabled: disabledProp, className, id: idProp, render, nativeButton = true, style, ...elementProps } = componentProps;
160
135
  const { panelId, open, handleTrigger, disabled: contextDisabled } = useCollapsibleRootContext();
161
- const disabled = disabledProp ?? contextDisabled;
136
+ const disabled = disabledProp || contextDisabled;
162
137
  const { getButtonProps, buttonRef } = useButton({
163
138
  disabled,
164
- focusableWhenDisabled: true,
165
- native: nativeButton,
166
- composite: true
139
+ native: nativeButton
167
140
  });
168
- const { accordionItemRefs, direction, loopFocus, orientation } = useAccordionRootContext();
169
- const isRtl = 'rtl' === direction;
170
- const isHorizontal = 'horizontal' === orientation;
171
- const { state, setTriggerId, triggerId: id } = useAccordionItemContext();
141
+ const { defaultTriggerId, state, setTriggerId } = useAccordionItemContext();
142
+ const registeredId = idProp || void 0;
143
+ const id = registeredId ?? defaultTriggerId;
172
144
  useIsoLayoutEffect(()=>{
173
- if (idProp) setTriggerId(idProp);
145
+ setTriggerId((currentId)=>registeredId ?? (null === currentId ? void 0 : currentId));
174
146
  return ()=>{
175
- setTriggerId(void 0);
147
+ setTriggerId((currentId)=>currentId === registeredId ? null : currentId);
176
148
  };
177
149
  }, [
178
- idProp,
150
+ registeredId,
179
151
  setTriggerId
180
152
  ]);
181
153
  const props = {
182
154
  'aria-controls': open ? panelId : void 0,
183
155
  'aria-expanded': open,
184
156
  id,
185
- tabIndex: 0,
186
- onClick: handleTrigger,
187
- onKeyDown (event) {
188
- if (!COMPOSITE_KEYS.has(event.key)) return;
189
- stopEvent(event);
190
- const triggers = getActiveTriggers(accordionItemRefs);
191
- const numOfEnabledTriggers = triggers.length;
192
- const lastIndex = numOfEnabledTriggers - 1;
193
- let nextIndex = -1;
194
- const thisIndex = triggers.indexOf(event.currentTarget);
195
- function toNext() {
196
- nextIndex = loopFocus ? thisIndex + 1 > lastIndex ? 0 : thisIndex + 1 : Math.min(thisIndex + 1, lastIndex);
197
- }
198
- function toPrev() {
199
- nextIndex = loopFocus ? 0 === thisIndex ? lastIndex : thisIndex - 1 : thisIndex - 1;
200
- }
201
- switch(event.key){
202
- case ARROW_DOWN:
203
- if (!isHorizontal) toNext();
204
- break;
205
- case ARROW_UP:
206
- if (!isHorizontal) toPrev();
207
- break;
208
- case ARROW_RIGHT:
209
- if (isHorizontal) if (isRtl) toPrev();
210
- else toNext();
211
- break;
212
- case ARROW_LEFT:
213
- if (isHorizontal) if (isRtl) toNext();
214
- else toPrev();
215
- break;
216
- case 'Home':
217
- nextIndex = 0;
218
- break;
219
- case 'End':
220
- nextIndex = lastIndex;
221
- break;
222
- default:
223
- break;
224
- }
225
- if (nextIndex > -1) triggers[nextIndex].focus();
226
- }
157
+ onClick: handleTrigger
227
158
  };
228
159
  const element = useRenderElement('button', componentProps, {
229
160
  state,
@@ -236,43 +167,40 @@ const AccordionTrigger_AccordionTrigger = /*#__PURE__*/ __rspack_external_react.
236
167
  elementProps,
237
168
  getButtonProps
238
169
  ],
239
- stateAttributesMapping: triggerOpenStateMapping
170
+ stateAttributesMapping: stateAttributesMapping
240
171
  });
241
172
  return element;
242
173
  });
243
174
  if ("production" !== process.env.NODE_ENV) AccordionTrigger_AccordionTrigger.displayName = "AccordionTrigger";
244
- let AccordionPanelCssVars_AccordionPanelCssVars = /*#__PURE__*/ function(AccordionPanelCssVars) {
245
- AccordionPanelCssVars["accordionPanelHeight"] = "--accordion-panel-height";
246
- AccordionPanelCssVars["accordionPanelWidth"] = "--accordion-panel-width";
247
- return AccordionPanelCssVars;
248
- }({});
175
+ const accordionPanelHeight = '--accordion-panel-height';
176
+ const accordionPanelWidth = '--accordion-panel-width';
249
177
  const AccordionPanel_AccordionPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
250
178
  const { className, hiddenUntilFound: hiddenUntilFoundProp, keepMounted: keepMountedProp, id: idProp, render, style, ...elementProps } = componentProps;
251
179
  const { hiddenUntilFound: contextHiddenUntilFound, keepMounted: contextKeepMounted } = useAccordionRootContext();
252
- const { mounted, onOpenChange, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus } = useCollapsibleRootContext();
180
+ const { defaultPanelId, mounted, onOpenChange, open, setMounted, setOpen, setPanelIdState, transitionStatus } = useCollapsibleRootContext();
253
181
  const hiddenUntilFound = hiddenUntilFoundProp ?? contextHiddenUntilFound;
254
182
  const keepMounted = keepMountedProp ?? contextKeepMounted;
255
- if ('production' !== process.env.NODE_ENV) useIsoLayoutEffect(()=>{
183
+ const registeredId = idProp || void 0;
184
+ const id = idProp ?? defaultPanelId;
185
+ if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
256
186
  if (false === keepMountedProp && hiddenUntilFound) warn('The `keepMounted={false}` prop on an `Accordion.Panel` is ignored when `hiddenUntilFound` is enabled on the panel or root, since the panel must remain mounted while closed.');
257
187
  }, [
258
188
  hiddenUntilFound,
259
189
  keepMountedProp
260
190
  ]);
261
191
  useIsoLayoutEffect(()=>{
262
- if (idProp) {
263
- setPanelIdState(idProp);
264
- return ()=>{
265
- setPanelIdState(void 0);
266
- };
267
- }
192
+ setPanelIdState((currentId)=>registeredId ?? (null === currentId ? void 0 : currentId));
193
+ return ()=>{
194
+ setPanelIdState((currentId)=>currentId === registeredId ? null : currentId);
195
+ };
268
196
  }, [
269
- idProp,
197
+ registeredId,
270
198
  setPanelIdState
271
199
  ]);
272
200
  const { height, props, ref, shouldPreventOpenAnimation, shouldRender, transitionStatus: panelTransitionStatus, width } = useCollapsiblePanel({
273
201
  externalRef: forwardedRef,
274
202
  hiddenUntilFound,
275
- id: idProp ?? panelId,
203
+ id,
276
204
  keepMounted,
277
205
  mounted,
278
206
  onOpenChange,
@@ -299,8 +227,8 @@ const AccordionPanel_AccordionPanel = /*#__PURE__*/ __rspack_external_react.forw
299
227
  'aria-labelledby': triggerId,
300
228
  role: 'region',
301
229
  style: {
302
- [AccordionPanelCssVars_AccordionPanelCssVars.accordionPanelHeight]: void 0 === height ? 'auto' : `${height}px`,
303
- [AccordionPanelCssVars_AccordionPanelCssVars.accordionPanelWidth]: void 0 === width ? 'auto' : `${width}px`
230
+ [accordionPanelHeight]: void 0 === height ? 'auto' : `${height}px`,
231
+ [accordionPanelWidth]: void 0 === width ? 'auto' : `${width}px`
304
232
  }
305
233
  },
306
234
  elementProps,
@@ -323,20 +251,14 @@ const rootStateAttributesMapping = {
323
251
  value: ()=>null
324
252
  };
325
253
  const AccordionRoot_AccordionRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
326
- const { render, className, disabled = false, hiddenUntilFound: hiddenUntilFoundProp, keepMounted: keepMountedProp, loopFocus = true, onValueChange, multiple = false, orientation = 'vertical', value: valueProp, defaultValue: defaultValueProp, style, ...elementProps } = componentProps;
327
- const direction = useDirection();
328
- if ('production' !== process.env.NODE_ENV) useIsoLayoutEffect(()=>{
254
+ const { render, className, disabled = false, hiddenUntilFound: hiddenUntilFoundProp, keepMounted: keepMountedProp, loopFocus, onValueChange, multiple = false, orientation = 'vertical', value: valueProp, defaultValue: defaultValueProp, style, ...elementProps } = componentProps;
255
+ const defaultValue = defaultValueProp ?? EMPTY_ARRAY;
256
+ if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
329
257
  if (hiddenUntilFoundProp && false === keepMountedProp) warn('The `keepMounted={false}` prop on `Accordion.Root` is ignored when `hiddenUntilFound` is enabled, since panels must remain mounted while closed.');
330
258
  }, [
331
259
  hiddenUntilFoundProp,
332
260
  keepMountedProp
333
261
  ]);
334
- const defaultValue = __rspack_external_react.useMemo(()=>{
335
- if (void 0 === valueProp) return defaultValueProp ?? [];
336
- }, [
337
- valueProp,
338
- defaultValueProp
339
- ]);
340
262
  const accordionItemRefs = __rspack_external_react.useRef([]);
341
263
  const [value, setValue] = useControlled({
342
264
  controlled: valueProp,
@@ -344,28 +266,17 @@ const AccordionRoot_AccordionRoot = /*#__PURE__*/ __rspack_external_react.forwar
344
266
  name: 'Accordion',
345
267
  state: 'value'
346
268
  });
347
- const handleValueChange = useStableCallback((newValue, nextOpen)=>{
348
- const details = createChangeEventDetails("none");
349
- if (multiple) if (nextOpen) {
350
- const nextOpenValues = value.slice();
351
- nextOpenValues.push(newValue);
352
- onValueChange?.(nextOpenValues, details);
353
- if (details.isCanceled) return;
354
- setValue(nextOpenValues);
355
- } else {
356
- const nextOpenValues = value.filter((v)=>v !== newValue);
357
- onValueChange?.(nextOpenValues, details);
358
- if (details.isCanceled) return;
359
- setValue(nextOpenValues);
360
- }
361
- else {
362
- const nextValue = value[0] === newValue ? [] : [
363
- newValue
364
- ];
365
- onValueChange?.(nextValue, details);
366
- if (details.isCanceled) return;
367
- setValue(nextValue);
368
- }
269
+ const handleValueChange = useStableCallback((newValue, nextOpen, details)=>{
270
+ let nextValue;
271
+ nextValue = multiple ? nextOpen ? [
272
+ ...value,
273
+ newValue
274
+ ] : value.filter((v)=>v !== newValue) : value[0] === newValue ? [] : [
275
+ newValue
276
+ ];
277
+ onValueChange?.(nextValue, details);
278
+ if (details.isCanceled) return;
279
+ setValue(nextValue);
369
280
  });
370
281
  const state = __rspack_external_react.useMemo(()=>({
371
282
  value,
@@ -377,37 +288,24 @@ const AccordionRoot_AccordionRoot = /*#__PURE__*/ __rspack_external_react.forwar
377
288
  orientation
378
289
  ]);
379
290
  const contextValue = __rspack_external_react.useMemo(()=>({
380
- accordionItemRefs,
381
- direction,
382
291
  disabled,
383
292
  handleValueChange,
384
293
  hiddenUntilFound: hiddenUntilFoundProp ?? false,
385
294
  keepMounted: keepMountedProp ?? false,
386
- loopFocus,
387
- orientation,
388
295
  state,
389
296
  value
390
297
  }), [
391
- direction,
392
298
  disabled,
393
299
  handleValueChange,
394
300
  hiddenUntilFoundProp,
395
301
  keepMountedProp,
396
- loopFocus,
397
- orientation,
398
302
  state,
399
303
  value
400
304
  ]);
401
305
  const element = useRenderElement('div', componentProps, {
402
306
  state,
403
307
  ref: forwardedRef,
404
- props: [
405
- {
406
- dir: direction,
407
- role: 'region'
408
- },
409
- elementProps
410
- ],
308
+ props: elementProps,
411
309
  stateAttributesMapping: rootStateAttributesMapping
412
310
  });
413
311
  return /*#__PURE__*/ jsx(AccordionRootContext.Provider, {