@wix/site-ui 1.30.0 → 1.31.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 (173) hide show
  1. package/dist/1268.js +99 -0
  2. package/dist/1279.js +7 -0
  3. package/dist/1457.js +10 -0
  4. package/dist/1477.js +106 -0
  5. package/dist/1500.js +111 -0
  6. package/dist/167.js +6 -0
  7. package/dist/2274.js +34 -0
  8. package/dist/2287.js +17 -0
  9. package/dist/2418.js +31 -0
  10. package/dist/2801.js +20 -0
  11. package/dist/285.js +86 -0
  12. package/dist/2861.js +6 -0
  13. package/dist/3020.js +7 -0
  14. package/dist/3021.js +72 -0
  15. package/dist/3056.js +229 -0
  16. package/dist/3140.js +4 -0
  17. package/dist/3248.js +307 -0
  18. package/dist/3296.js +4 -0
  19. package/dist/3319.js +400 -0
  20. package/dist/3395.js +4 -0
  21. package/dist/3485.js +854 -0
  22. package/dist/353.js +14 -0
  23. package/dist/3670.js +418 -0
  24. package/dist/3829.js +113 -0
  25. package/dist/4026.js +12 -0
  26. package/dist/4143.js +46 -0
  27. package/dist/42.js +32 -0
  28. package/dist/4281.js +30 -0
  29. package/dist/4346.js +2 -0
  30. package/dist/4388.js +418 -0
  31. package/dist/4490.js +32 -0
  32. package/dist/4495.js +9 -0
  33. package/dist/4549.js +24 -0
  34. package/dist/4586.js +41 -0
  35. package/dist/4586.js.LICENSE.txt +19 -0
  36. package/dist/4707.js +19 -0
  37. package/dist/4723.js +7 -0
  38. package/dist/4745.js +7 -0
  39. package/dist/4768.js +35 -0
  40. package/dist/4922.js +15 -0
  41. package/dist/5036.js +17 -0
  42. package/dist/5085.js +20 -0
  43. package/dist/5299.js +597 -0
  44. package/dist/5659.js +4 -0
  45. package/dist/5778.js +10 -0
  46. package/dist/5864.js +86 -0
  47. package/dist/5992.js +913 -0
  48. package/dist/5992.js.LICENSE.txt +19 -0
  49. package/dist/6003.js +10 -0
  50. package/dist/6046.js +29 -0
  51. package/dist/6089.js +2355 -0
  52. package/dist/6107.js +10 -0
  53. package/dist/6247.js +20 -0
  54. package/dist/6270.js +487 -0
  55. package/dist/6329.js +32 -0
  56. package/dist/6330.js +30 -0
  57. package/dist/6499.js +7 -0
  58. package/dist/6535.js +71 -0
  59. package/dist/6588.js +382 -0
  60. package/dist/6706.js +16 -0
  61. package/dist/6825.js +7 -0
  62. package/dist/6882.js +1562 -0
  63. package/dist/6914.js +30 -0
  64. package/dist/7021.js +13 -0
  65. package/dist/7366.js +83 -0
  66. package/dist/7373.js +25 -0
  67. package/dist/7541.js +25 -0
  68. package/dist/7564.js +10 -0
  69. package/dist/7642.js +20 -0
  70. package/dist/7725.js +10 -0
  71. package/dist/7871.js +38 -0
  72. package/dist/8052.js +352 -0
  73. package/dist/8106.js +238 -0
  74. package/dist/8171.js +346 -0
  75. package/dist/8225.js +21 -0
  76. package/dist/8272.js +333 -0
  77. package/dist/8527.js +58 -0
  78. package/dist/8724.js +10 -0
  79. package/dist/8750.js +1920 -0
  80. package/dist/8758.js +43 -0
  81. package/dist/880.js +149 -0
  82. package/dist/8935.js +8 -0
  83. package/dist/8960.js +22 -0
  84. package/dist/8971.js +40 -0
  85. package/dist/8979.js +10 -0
  86. package/dist/8996.js +71 -0
  87. package/dist/904.js +121 -0
  88. package/dist/9048.js +52 -0
  89. package/dist/9087.js +256 -0
  90. package/dist/9189.js +158 -0
  91. package/dist/9255.js +136 -0
  92. package/dist/9352.js +148 -0
  93. package/dist/951.js +22 -0
  94. package/dist/9635.js +22 -0
  95. package/dist/9829.js +4 -0
  96. package/dist/9863.js +8 -0
  97. package/dist/Accordion/index.d.ts +569 -12
  98. package/dist/Accordion/index.js +423 -8
  99. package/dist/AlertDialog/index.d.ts +1417 -18
  100. package/dist/AlertDialog/index.js +34 -14
  101. package/dist/Autocomplete/index.d.ts +1861 -38
  102. package/dist/Autocomplete/index.js +98 -24
  103. package/dist/Avatar/index.d.ts +129 -7
  104. package/dist/Avatar/index.js +149 -6
  105. package/dist/Breadcrumbs/index.d.ts +960 -7
  106. package/dist/Breadcrumbs/index.js +5 -5
  107. package/dist/Button/index.d.ts +88 -6
  108. package/dist/Button/index.js +27 -3
  109. package/dist/Checkbox/index.d.ts +425 -5
  110. package/dist/Checkbox/index.js +45 -5
  111. package/dist/CheckboxGroup/index.d.ts +318 -3
  112. package/dist/CheckboxGroup/index.js +166 -3
  113. package/dist/Collapsible/index.d.ts +377 -7
  114. package/dist/Collapsible/index.js +160 -6
  115. package/dist/Combobox/index.d.ts +1984 -48
  116. package/dist/Combobox/index.js +352 -29
  117. package/dist/ContextMenu/index.d.ts +2340 -36
  118. package/dist/ContextMenu/index.js +197 -22
  119. package/dist/Dialog/index.d.ts +1355 -18
  120. package/dist/Dialog/index.js +16 -14
  121. package/dist/Drawer/index.d.ts +1653 -18
  122. package/dist/Drawer/index.js +2797 -20
  123. package/dist/Field/index.d.ts +655 -15
  124. package/dist/Field/index.js +677 -10
  125. package/dist/Fieldset/index.d.ts +94 -5
  126. package/dist/Fieldset/index.js +68 -5
  127. package/dist/Form/index.d.ts +331 -2
  128. package/dist/Form/index.js +106 -3
  129. package/dist/Input/index.d.ts +692 -3
  130. package/dist/Input/index.js +10 -3
  131. package/dist/Menu/index.d.ts +2301 -36
  132. package/dist/Menu/index.js +365 -26
  133. package/dist/Menubar/index.d.ts +2301 -3
  134. package/dist/Menubar/index.js +105 -3
  135. package/dist/Meter/index.d.ts +175 -11
  136. package/dist/Meter/index.js +129 -9
  137. package/dist/NavigationMenu/index.d.ts +978 -28
  138. package/dist/NavigationMenu/index.js +1034 -17
  139. package/dist/NumberField/index.d.ts +612 -15
  140. package/dist/NumberField/index.js +1409 -11
  141. package/dist/Popover/index.d.ts +1655 -20
  142. package/dist/Popover/index.js +792 -17
  143. package/dist/PreviewCard/index.d.ts +1523 -14
  144. package/dist/PreviewCard/index.js +679 -14
  145. package/dist/Progress/index.d.ts +183 -11
  146. package/dist/Progress/index.js +181 -9
  147. package/dist/Radio/index.d.ts +185 -6
  148. package/dist/Radio/index.js +253 -6
  149. package/dist/RadioGroup/index.d.ts +341 -2
  150. package/dist/RadioGroup/index.js +154 -3
  151. package/dist/ScrollArea/index.d.ts +265 -13
  152. package/dist/ScrollArea/index.js +892 -10
  153. package/dist/Select/index.d.ts +1493 -38
  154. package/dist/Select/index.js +1824 -23
  155. package/dist/Separator/index.d.ts +80 -6
  156. package/dist/Separator/index.js +3 -3
  157. package/dist/Slider/index.d.ts +678 -16
  158. package/dist/Slider/index.js +1199 -11
  159. package/dist/Switch/index.d.ts +393 -5
  160. package/dist/Switch/index.js +208 -6
  161. package/dist/Tabs/index.d.ts +523 -12
  162. package/dist/Tabs/index.js +685 -9
  163. package/dist/Toggle/index.d.ts +305 -2
  164. package/dist/Toggle/index.js +76 -3
  165. package/dist/ToggleGroup/index.d.ts +316 -2
  166. package/dist/ToggleGroup/index.js +102 -3
  167. package/dist/Toolbar/index.d.ts +282 -13
  168. package/dist/Toolbar/index.js +230 -9
  169. package/dist/Tooltip/index.d.ts +1572 -14
  170. package/dist/Tooltip/index.js +965 -14
  171. package/dist/index.d.ts +12749 -652
  172. package/dist/rslib-runtime.js +18 -0
  173. package/package.json +3 -3
@@ -1,7 +1,683 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Tabs } from "@base-ui/react/tabs";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import clsx from "clsx";
3
+ import { EMPTY_ARRAY, useRenderElement, esm_formatErrorMessage } from "../8272.js";
4
+ import { useControlled } from "../8527.js";
5
+ import { useIsoLayoutEffect } from "../6499.js";
6
+ import { useStableCallback } from "../7541.js";
7
+ import { createChangeEventDetails } from "../4768.js";
8
+ import { missing, initial, disabled as reason_parts_disabled } from "../2418.js";
9
+ import { CompositeList } from "../9255.js";
10
+ import { useBaseUiId } from "../6046.js";
11
+ import { useCompositeItem } from "../2274.js";
12
+ import { contains, activeElement } from "../4549.js";
13
+ import { ownerDocument } from "../9829.js";
14
+ import { useButton } from "../9189.js";
15
+ import { ACTIVE_COMPOSITE_ITEM } from "../4346.js";
16
+ import { useCSPContext } from "../6003.js";
17
+ import { useIsHydrating } from "../2287.js";
18
+ import { useForcedRerendering } from "../8935.js";
19
+ import { getCssDimensions } from "../7642.js";
20
+ import { stateAttributesMapping_TransitionStatusDataAttributes, useTransitionStatus, transitionStatusMapping, useOpenChangeComplete } from "../880.js";
21
+ import { useCompositeListItem } from "../3021.js";
22
+ import { inertValue } from "../167.js";
23
+ import { CompositeRoot } from "../9087.js";
4
24
  import * as __rspack_external_react from "react";
25
+ const TabsRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
26
+ if ("production" !== process.env.NODE_ENV) TabsRootContext.displayName = "TabsRootContext";
27
+ function useTabsRootContext() {
28
+ const context = __rspack_external_react.useContext(TabsRootContext);
29
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.' : esm_formatErrorMessage(64));
30
+ return context;
31
+ }
32
+ let TabsRootDataAttributes_TabsRootDataAttributes = /*#__PURE__*/ function(TabsRootDataAttributes) {
33
+ TabsRootDataAttributes["activationDirection"] = "data-activation-direction";
34
+ TabsRootDataAttributes["orientation"] = "data-orientation";
35
+ return TabsRootDataAttributes;
36
+ }({});
37
+ const tabsStateAttributesMapping = {
38
+ tabActivationDirection: (dir)=>({
39
+ [TabsRootDataAttributes_TabsRootDataAttributes.activationDirection]: dir
40
+ })
41
+ };
42
+ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
43
+ const { className, defaultValue: defaultValueProp = 0, onValueChange: onValueChangeProp, orientation = 'horizontal', render, value: valueProp, style, ...elementProps } = componentProps;
44
+ const hasExplicitDefaultValueProp = void 0 !== componentProps.defaultValue;
45
+ const tabPanelRefs = __rspack_external_react.useRef([]);
46
+ const [mountedTabPanels, setMountedTabPanels] = __rspack_external_react.useState(()=>new Map());
47
+ const [value, setValue] = useControlled({
48
+ controlled: valueProp,
49
+ default: defaultValueProp,
50
+ name: 'Tabs',
51
+ state: 'value'
52
+ });
53
+ const isControlled = void 0 !== valueProp;
54
+ const [tabMap, setTabMap] = __rspack_external_react.useState(()=>new Map());
55
+ const getTabElementBySelectedValue = __rspack_external_react.useCallback((selectedValue)=>{
56
+ if (void 0 === selectedValue) return null;
57
+ for (const [tabElement, tabMetadata] of tabMap.entries())if (null != tabMetadata && selectedValue === (tabMetadata.value ?? tabMetadata.index)) return tabElement;
58
+ return null;
59
+ }, [
60
+ tabMap
61
+ ]);
62
+ const [activationDirectionState, setActivationDirectionState] = __rspack_external_react.useState(()=>({
63
+ previousValue: value,
64
+ tabActivationDirection: 'none'
65
+ }));
66
+ const { previousValue, tabActivationDirection: committedTabActivationDirection } = activationDirectionState;
67
+ let tabActivationDirection = committedTabActivationDirection;
68
+ let directionComputationIncomplete = false;
69
+ if (previousValue !== value) {
70
+ tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
71
+ directionComputationIncomplete = null != previousValue && null != value && null == getTabElementBySelectedValue(value);
72
+ }
73
+ const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
74
+ const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
75
+ useIsoLayoutEffect(()=>{
76
+ if (!shouldSyncActivationDirectionState) return;
77
+ setActivationDirectionState({
78
+ previousValue: nextPreviousValue,
79
+ tabActivationDirection
80
+ });
81
+ }, [
82
+ nextPreviousValue,
83
+ shouldSyncActivationDirectionState,
84
+ tabActivationDirection
85
+ ]);
86
+ const onValueChange = useStableCallback((newValue, eventDetails)=>{
87
+ const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);
88
+ eventDetails.activationDirection = activationDirection;
89
+ onValueChangeProp?.(newValue, eventDetails);
90
+ if (eventDetails.isCanceled) return;
91
+ setValue(newValue);
92
+ });
93
+ const notifyAutomaticValueChange = useStableCallback((nextValue, reason)=>{
94
+ onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, {
95
+ activationDirection: 'none'
96
+ }));
97
+ });
98
+ const registerMountedTabPanel = useStableCallback((panelValue, panelId)=>{
99
+ setMountedTabPanels((prev)=>{
100
+ if (prev.get(panelValue) === panelId) return prev;
101
+ const next = new Map(prev);
102
+ next.set(panelValue, panelId);
103
+ return next;
104
+ });
105
+ });
106
+ const unregisterMountedTabPanel = useStableCallback((panelValue, panelId)=>{
107
+ setMountedTabPanels((prev)=>{
108
+ if (!prev.has(panelValue) || prev.get(panelValue) !== panelId) return prev;
109
+ const next = new Map(prev);
110
+ next.delete(panelValue);
111
+ return next;
112
+ });
113
+ });
114
+ const getTabPanelIdByValue = __rspack_external_react.useCallback((tabValue)=>mountedTabPanels.get(tabValue), [
115
+ mountedTabPanels
116
+ ]);
117
+ const getTabIdByPanelValue = __rspack_external_react.useCallback((tabPanelValue)=>{
118
+ for (const tabMetadata of tabMap.values())if (tabPanelValue === tabMetadata?.value) return tabMetadata?.id;
119
+ }, [
120
+ tabMap
121
+ ]);
122
+ const tabsContextValue = __rspack_external_react.useMemo(()=>({
123
+ getTabElementBySelectedValue,
124
+ getTabIdByPanelValue,
125
+ getTabPanelIdByValue,
126
+ onValueChange,
127
+ orientation,
128
+ registerMountedTabPanel,
129
+ setTabMap,
130
+ unregisterMountedTabPanel,
131
+ tabActivationDirection,
132
+ value
133
+ }), [
134
+ getTabElementBySelectedValue,
135
+ getTabIdByPanelValue,
136
+ getTabPanelIdByValue,
137
+ onValueChange,
138
+ orientation,
139
+ registerMountedTabPanel,
140
+ setTabMap,
141
+ unregisterMountedTabPanel,
142
+ tabActivationDirection,
143
+ value
144
+ ]);
145
+ const selectedTabMetadata = __rspack_external_react.useMemo(()=>{
146
+ for (const tabMetadata of tabMap.values())if (null != tabMetadata && tabMetadata.value === value) return tabMetadata;
147
+ }, [
148
+ tabMap,
149
+ value
150
+ ]);
151
+ const firstEnabledTabValue = __rspack_external_react.useMemo(()=>{
152
+ for (const tabMetadata of tabMap.values())if (null != tabMetadata && !tabMetadata.disabled) return tabMetadata.value;
153
+ }, [
154
+ tabMap
155
+ ]);
156
+ const shouldNotifyInitialValueChangeRef = __rspack_external_react.useRef(!hasExplicitDefaultValueProp);
157
+ const shouldHonorDisabledDefaultValueRef = __rspack_external_react.useRef(hasExplicitDefaultValueProp);
158
+ const didRegisterTabsRef = __rspack_external_react.useRef(false);
159
+ useIsoLayoutEffect(()=>{
160
+ if (isControlled) return;
161
+ function commitAutomaticValueChange(fallbackValue, fallbackReason) {
162
+ setValue(fallbackValue);
163
+ setActivationDirectionState((prev)=>{
164
+ if (prev.previousValue === fallbackValue && 'none' === prev.tabActivationDirection) return prev;
165
+ return {
166
+ previousValue: fallbackValue,
167
+ tabActivationDirection: 'none'
168
+ };
169
+ });
170
+ notifyAutomaticValueChange(fallbackValue, fallbackReason);
171
+ shouldNotifyInitialValueChangeRef.current = false;
172
+ }
173
+ if (0 === tabMap.size) {
174
+ if (!didRegisterTabsRef.current || null === value) return;
175
+ commitAutomaticValueChange(null, missing);
176
+ return;
177
+ }
178
+ didRegisterTabsRef.current = true;
179
+ const selectionIsDisabled = selectedTabMetadata?.disabled;
180
+ const selectionIsMissing = null == selectedTabMetadata && null !== value;
181
+ if (!selectionIsDisabled && value === defaultValueProp) shouldHonorDisabledDefaultValueRef.current = false;
182
+ if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === defaultValueProp) return;
183
+ const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
184
+ if (selectionIsDisabled || selectionIsMissing) {
185
+ const fallbackValue = firstEnabledTabValue ?? null;
186
+ if (value === fallbackValue) {
187
+ shouldNotifyInitialValueChangeRef.current = false;
188
+ return;
189
+ }
190
+ let fallbackReason = missing;
191
+ if (shouldNotifyInitialValueChange) fallbackReason = initial;
192
+ else if (selectionIsDisabled) fallbackReason = reason_parts_disabled;
193
+ commitAutomaticValueChange(fallbackValue, fallbackReason);
194
+ return;
195
+ }
196
+ if (shouldNotifyInitialValueChange && null != selectedTabMetadata) {
197
+ notifyAutomaticValueChange(value, initial);
198
+ shouldNotifyInitialValueChangeRef.current = false;
199
+ }
200
+ }, [
201
+ defaultValueProp,
202
+ firstEnabledTabValue,
203
+ isControlled,
204
+ notifyAutomaticValueChange,
205
+ selectedTabMetadata,
206
+ setValue,
207
+ tabMap,
208
+ value
209
+ ]);
210
+ const state = {
211
+ orientation,
212
+ tabActivationDirection
213
+ };
214
+ const element = useRenderElement('div', componentProps, {
215
+ state,
216
+ ref: forwardedRef,
217
+ props: elementProps,
218
+ stateAttributesMapping: tabsStateAttributesMapping
219
+ });
220
+ return /*#__PURE__*/ jsx(TabsRootContext.Provider, {
221
+ value: tabsContextValue,
222
+ children: /*#__PURE__*/ jsx(CompositeList, {
223
+ elementsRef: tabPanelRefs,
224
+ children: element
225
+ })
226
+ });
227
+ });
228
+ if ("production" !== process.env.NODE_ENV) TabsRoot_TabsRoot.displayName = "TabsRoot";
229
+ function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
230
+ if (null == oldValue || null == newValue) return 'none';
231
+ let oldTab = null;
232
+ let newTab = null;
233
+ for (const [tabElement, tabMetadata] of tabMap.entries()){
234
+ if (null == tabMetadata) continue;
235
+ const tabValue = tabMetadata.value ?? tabMetadata.index;
236
+ if (oldValue === tabValue) oldTab = tabElement;
237
+ if (newValue === tabValue) newTab = tabElement;
238
+ if (null != oldTab && null != newTab) break;
239
+ }
240
+ if (null == oldTab || null == newTab) {
241
+ if (oldTab !== newTab && ('number' == typeof oldValue || 'string' == typeof oldValue) && typeof oldValue === typeof newValue) {
242
+ if ('horizontal' === orientation) return newValue > oldValue ? 'right' : 'left';
243
+ return newValue > oldValue ? 'down' : 'up';
244
+ }
245
+ return 'none';
246
+ }
247
+ const oldRect = oldTab.getBoundingClientRect();
248
+ const newRect = newTab.getBoundingClientRect();
249
+ if ('horizontal' === orientation) {
250
+ if (newRect.left < oldRect.left) return 'left';
251
+ if (newRect.left > oldRect.left) return 'right';
252
+ } else {
253
+ if (newRect.top < oldRect.top) return 'up';
254
+ if (newRect.top > oldRect.top) return 'down';
255
+ }
256
+ return 'none';
257
+ }
258
+ const TabsListContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
259
+ if ("production" !== process.env.NODE_ENV) TabsListContext.displayName = "TabsListContext";
260
+ function useTabsListContext() {
261
+ const context = __rspack_external_react.useContext(TabsListContext);
262
+ if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.' : esm_formatErrorMessage(65));
263
+ return context;
264
+ }
265
+ const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
266
+ const { className, disabled = false, render, value, id: idProp, nativeButton = true, style, ...elementProps } = componentProps;
267
+ const { value: activeTabValue, getTabPanelIdByValue, orientation } = useTabsRootContext();
268
+ const { activateOnFocus, highlightedTabIndex, onTabActivation, registerTabResizeObserverElement, setHighlightedTabIndex, tabsListElement } = useTabsListContext();
269
+ const id = useBaseUiId(idProp);
270
+ const tabMetadata = __rspack_external_react.useMemo(()=>({
271
+ disabled,
272
+ id,
273
+ value
274
+ }), [
275
+ disabled,
276
+ id,
277
+ value
278
+ ]);
279
+ const { compositeProps, compositeRef, index } = useCompositeItem({
280
+ metadata: tabMetadata
281
+ });
282
+ const active = value === activeTabValue;
283
+ const isNavigatingRef = __rspack_external_react.useRef(false);
284
+ const tabElementRef = __rspack_external_react.useRef(null);
285
+ __rspack_external_react.useEffect(()=>{
286
+ const tabElement = tabElementRef.current;
287
+ if (!tabElement) return;
288
+ return registerTabResizeObserverElement(tabElement);
289
+ }, [
290
+ registerTabResizeObserverElement
291
+ ]);
292
+ useIsoLayoutEffect(()=>{
293
+ if (isNavigatingRef.current) {
294
+ isNavigatingRef.current = false;
295
+ return;
296
+ }
297
+ if (!(active && index > -1 && highlightedTabIndex !== index)) return;
298
+ const listElement = tabsListElement;
299
+ if (null != listElement) {
300
+ const activeEl = activeElement(ownerDocument(listElement));
301
+ if (activeEl && contains(listElement, activeEl)) return;
302
+ }
303
+ if (!disabled) setHighlightedTabIndex(index);
304
+ }, [
305
+ active,
306
+ index,
307
+ highlightedTabIndex,
308
+ setHighlightedTabIndex,
309
+ disabled,
310
+ tabsListElement
311
+ ]);
312
+ const { getButtonProps, buttonRef } = useButton({
313
+ disabled,
314
+ native: nativeButton,
315
+ focusableWhenDisabled: true
316
+ });
317
+ const tabPanelId = getTabPanelIdByValue(value);
318
+ const isPressingRef = __rspack_external_react.useRef(false);
319
+ const isMainButtonRef = __rspack_external_react.useRef(false);
320
+ function onClick(event) {
321
+ if (active || disabled) return;
322
+ onTabActivation(value, createChangeEventDetails("none", event.nativeEvent, void 0, {
323
+ activationDirection: 'none'
324
+ }));
325
+ }
326
+ function onFocus(event) {
327
+ if (active) return;
328
+ if (index > -1 && !disabled) setHighlightedTabIndex(index);
329
+ if (disabled) return;
330
+ if (activateOnFocus && (!isPressingRef.current || isPressingRef.current && isMainButtonRef.current)) onTabActivation(value, createChangeEventDetails("none", event.nativeEvent, void 0, {
331
+ activationDirection: 'none'
332
+ }));
333
+ }
334
+ function onPointerDown(event) {
335
+ if (active || disabled) return;
336
+ isPressingRef.current = true;
337
+ function handlePointerUp() {
338
+ isPressingRef.current = false;
339
+ isMainButtonRef.current = false;
340
+ }
341
+ if (!event.button || 0 === event.button) {
342
+ isMainButtonRef.current = true;
343
+ const doc = ownerDocument(event.currentTarget);
344
+ doc.addEventListener('pointerup', handlePointerUp, {
345
+ once: true
346
+ });
347
+ }
348
+ }
349
+ const state = {
350
+ disabled,
351
+ active,
352
+ orientation
353
+ };
354
+ const element = useRenderElement('button', componentProps, {
355
+ state,
356
+ ref: [
357
+ forwardedRef,
358
+ buttonRef,
359
+ compositeRef,
360
+ tabElementRef
361
+ ],
362
+ props: [
363
+ compositeProps,
364
+ {
365
+ role: 'tab',
366
+ 'aria-controls': tabPanelId,
367
+ 'aria-selected': active,
368
+ id,
369
+ onClick,
370
+ onFocus,
371
+ onPointerDown,
372
+ [ACTIVE_COMPOSITE_ITEM]: active ? '' : void 0,
373
+ onKeyDownCapture () {
374
+ isNavigatingRef.current = true;
375
+ }
376
+ },
377
+ elementProps,
378
+ getButtonProps
379
+ ]
380
+ });
381
+ return element;
382
+ });
383
+ if ("production" !== process.env.NODE_ENV) TabsTab_TabsTab.displayName = "TabsTab";
384
+ const script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';
385
+ let TabsIndicatorCssVars_TabsIndicatorCssVars = /*#__PURE__*/ function(TabsIndicatorCssVars) {
386
+ TabsIndicatorCssVars["activeTabLeft"] = "--active-tab-left";
387
+ TabsIndicatorCssVars["activeTabRight"] = "--active-tab-right";
388
+ TabsIndicatorCssVars["activeTabTop"] = "--active-tab-top";
389
+ TabsIndicatorCssVars["activeTabBottom"] = "--active-tab-bottom";
390
+ TabsIndicatorCssVars["activeTabWidth"] = "--active-tab-width";
391
+ TabsIndicatorCssVars["activeTabHeight"] = "--active-tab-height";
392
+ return TabsIndicatorCssVars;
393
+ }({});
394
+ const stateAttributesMapping = {
395
+ ...tabsStateAttributesMapping,
396
+ activeTabPosition: ()=>null,
397
+ activeTabSize: ()=>null
398
+ };
399
+ const TabsIndicator_TabsIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
400
+ const { className, render, renderBeforeHydration = false, style: styleProp, ...elementProps } = componentProps;
401
+ const { nonce } = useCSPContext();
402
+ const { getTabElementBySelectedValue, orientation, tabActivationDirection, value } = useTabsRootContext();
403
+ const { tabsListElement, registerIndicatorUpdateListener } = useTabsListContext();
404
+ const isHydrating = useIsHydrating();
405
+ const rerender = useForcedRerendering();
406
+ __rspack_external_react.useEffect(()=>registerIndicatorUpdateListener(rerender), [
407
+ registerIndicatorUpdateListener,
408
+ rerender
409
+ ]);
410
+ let left = 0;
411
+ let right = 0;
412
+ let top = 0;
413
+ let bottom = 0;
414
+ let width = 0;
415
+ let height = 0;
416
+ let isTabSelected = false;
417
+ if (null != value && null != tabsListElement) {
418
+ const activeTab = getTabElementBySelectedValue(value);
419
+ isTabSelected = true;
420
+ if (null != activeTab) {
421
+ const { width: computedWidth, height: computedHeight } = getCssDimensions(activeTab);
422
+ const { width: tabListWidth, height: tabListHeight } = getCssDimensions(tabsListElement);
423
+ const tabRect = activeTab.getBoundingClientRect();
424
+ const tabsListRect = tabsListElement.getBoundingClientRect();
425
+ const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1;
426
+ const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1;
427
+ const hasNonZeroScale = Math.abs(scaleX) > Number.EPSILON && Math.abs(scaleY) > Number.EPSILON;
428
+ if (hasNonZeroScale) {
429
+ const tabLeftDelta = tabRect.left - tabsListRect.left;
430
+ const tabTopDelta = tabRect.top - tabsListRect.top;
431
+ left = tabLeftDelta / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft;
432
+ top = tabTopDelta / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop;
433
+ } else {
434
+ left = activeTab.offsetLeft;
435
+ top = activeTab.offsetTop;
436
+ }
437
+ width = computedWidth;
438
+ height = computedHeight;
439
+ right = tabsListElement.scrollWidth - left - width;
440
+ bottom = tabsListElement.scrollHeight - top - height;
441
+ }
442
+ }
443
+ const activeTabPosition = isTabSelected ? {
444
+ left,
445
+ right,
446
+ top,
447
+ bottom
448
+ } : null;
449
+ const activeTabSize = isTabSelected ? {
450
+ width,
451
+ height
452
+ } : null;
453
+ const style = isTabSelected ? {
454
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabLeft]: `${left}px`,
455
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabRight]: `${right}px`,
456
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabTop]: `${top}px`,
457
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabBottom]: `${bottom}px`,
458
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabWidth]: `${width}px`,
459
+ [TabsIndicatorCssVars_TabsIndicatorCssVars.activeTabHeight]: `${height}px`
460
+ } : void 0;
461
+ const displayIndicator = isTabSelected && width > 0 && height > 0;
462
+ const state = {
463
+ orientation,
464
+ activeTabPosition,
465
+ activeTabSize,
466
+ tabActivationDirection
467
+ };
468
+ const element = useRenderElement('span', componentProps, {
469
+ state,
470
+ ref: forwardedRef,
471
+ props: [
472
+ {
473
+ role: 'presentation',
474
+ style,
475
+ hidden: !displayIndicator
476
+ },
477
+ elementProps,
478
+ {
479
+ suppressHydrationWarning: true
480
+ }
481
+ ],
482
+ stateAttributesMapping: stateAttributesMapping
483
+ });
484
+ if (null == value) return null;
485
+ return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
486
+ children: [
487
+ element,
488
+ isHydrating && renderBeforeHydration && /*#__PURE__*/ jsx("script", {
489
+ nonce: nonce,
490
+ dangerouslySetInnerHTML: {
491
+ __html: script
492
+ },
493
+ suppressHydrationWarning: true
494
+ })
495
+ ]
496
+ });
497
+ });
498
+ if ("production" !== process.env.NODE_ENV) TabsIndicator_TabsIndicator.displayName = "TabsIndicator";
499
+ let TabsPanelDataAttributes_TabsPanelDataAttributes = function(TabsPanelDataAttributes) {
500
+ TabsPanelDataAttributes["index"] = "data-index";
501
+ TabsPanelDataAttributes["activationDirection"] = "data-activation-direction";
502
+ TabsPanelDataAttributes["orientation"] = "data-orientation";
503
+ TabsPanelDataAttributes["hidden"] = "data-hidden";
504
+ TabsPanelDataAttributes[TabsPanelDataAttributes["startingStyle"] = stateAttributesMapping_TransitionStatusDataAttributes.startingStyle] = "startingStyle";
505
+ TabsPanelDataAttributes[TabsPanelDataAttributes["endingStyle"] = stateAttributesMapping_TransitionStatusDataAttributes.endingStyle] = "endingStyle";
506
+ return TabsPanelDataAttributes;
507
+ }({});
508
+ const TabsPanel_stateAttributesMapping = {
509
+ ...tabsStateAttributesMapping,
510
+ ...transitionStatusMapping
511
+ };
512
+ const TabsPanel_TabsPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
513
+ const { className, value, render, keepMounted = false, style, ...elementProps } = componentProps;
514
+ const { value: selectedValue, getTabIdByPanelValue, orientation, tabActivationDirection, registerMountedTabPanel, unregisterMountedTabPanel } = useTabsRootContext();
515
+ const id = useBaseUiId();
516
+ const metadata = __rspack_external_react.useMemo(()=>({
517
+ id,
518
+ value
519
+ }), [
520
+ id,
521
+ value
522
+ ]);
523
+ const { ref: listItemRef, index } = useCompositeListItem({
524
+ metadata
525
+ });
526
+ const open = value === selectedValue;
527
+ const { mounted, transitionStatus, setMounted } = useTransitionStatus(open);
528
+ const hidden = !mounted;
529
+ const correspondingTabId = getTabIdByPanelValue(value);
530
+ const state = {
531
+ hidden,
532
+ orientation,
533
+ tabActivationDirection,
534
+ transitionStatus
535
+ };
536
+ const panelRef = __rspack_external_react.useRef(null);
537
+ const element = useRenderElement('div', componentProps, {
538
+ state,
539
+ ref: [
540
+ forwardedRef,
541
+ listItemRef,
542
+ panelRef
543
+ ],
544
+ props: [
545
+ {
546
+ 'aria-labelledby': correspondingTabId,
547
+ hidden,
548
+ id,
549
+ role: 'tabpanel',
550
+ tabIndex: open ? 0 : -1,
551
+ inert: inertValue(!open),
552
+ [TabsPanelDataAttributes_TabsPanelDataAttributes.index]: index
553
+ },
554
+ elementProps
555
+ ],
556
+ stateAttributesMapping: TabsPanel_stateAttributesMapping
557
+ });
558
+ useOpenChangeComplete({
559
+ open,
560
+ ref: panelRef,
561
+ onComplete () {
562
+ if (!open) setMounted(false);
563
+ }
564
+ });
565
+ useIsoLayoutEffect(()=>{
566
+ if (hidden && !keepMounted) return;
567
+ if (null == id) return;
568
+ registerMountedTabPanel(value, id);
569
+ return ()=>{
570
+ unregisterMountedTabPanel(value, id);
571
+ };
572
+ }, [
573
+ hidden,
574
+ keepMounted,
575
+ value,
576
+ id,
577
+ registerMountedTabPanel,
578
+ unregisterMountedTabPanel
579
+ ]);
580
+ const shouldRender = keepMounted || mounted;
581
+ if (!shouldRender) return null;
582
+ return element;
583
+ });
584
+ if ("production" !== process.env.NODE_ENV) TabsPanel_TabsPanel.displayName = "TabsPanel";
585
+ const TabsList_TabsList = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
586
+ const { activateOnFocus = false, className, loopFocus = true, render, style, ...elementProps } = componentProps;
587
+ const { onValueChange, orientation, value, setTabMap, tabActivationDirection } = useTabsRootContext();
588
+ const [highlightedTabIndex, setHighlightedTabIndex] = __rspack_external_react.useState(0);
589
+ const [tabsListElement, setTabsListElement] = __rspack_external_react.useState(null);
590
+ const indicatorUpdateListenersRef = __rspack_external_react.useRef(new Set());
591
+ const tabResizeObserverElementsRef = __rspack_external_react.useRef(new Set());
592
+ const resizeObserverRef = __rspack_external_react.useRef(null);
593
+ __rspack_external_react.useEffect(()=>{
594
+ if ("u" < typeof ResizeObserver) return;
595
+ const resizeObserver = new ResizeObserver(()=>{
596
+ indicatorUpdateListenersRef.current.forEach((listener)=>{
597
+ listener();
598
+ });
599
+ });
600
+ resizeObserverRef.current = resizeObserver;
601
+ if (tabsListElement) resizeObserver.observe(tabsListElement);
602
+ tabResizeObserverElementsRef.current.forEach((element)=>{
603
+ resizeObserver.observe(element);
604
+ });
605
+ return ()=>{
606
+ resizeObserver.disconnect();
607
+ resizeObserverRef.current = null;
608
+ };
609
+ }, [
610
+ tabsListElement
611
+ ]);
612
+ const registerIndicatorUpdateListener = useStableCallback((listener)=>{
613
+ indicatorUpdateListenersRef.current.add(listener);
614
+ return ()=>{
615
+ indicatorUpdateListenersRef.current.delete(listener);
616
+ };
617
+ });
618
+ const registerTabResizeObserverElement = useStableCallback((element)=>{
619
+ tabResizeObserverElementsRef.current.add(element);
620
+ resizeObserverRef.current?.observe(element);
621
+ return ()=>{
622
+ tabResizeObserverElementsRef.current.delete(element);
623
+ resizeObserverRef.current?.unobserve(element);
624
+ };
625
+ });
626
+ const onTabActivation = useStableCallback((newValue, eventDetails)=>{
627
+ if (newValue !== value) onValueChange(newValue, eventDetails);
628
+ });
629
+ const state = {
630
+ orientation,
631
+ tabActivationDirection
632
+ };
633
+ const defaultProps = {
634
+ 'aria-orientation': 'vertical' === orientation ? 'vertical' : void 0,
635
+ role: 'tablist'
636
+ };
637
+ const tabsListContextValue = __rspack_external_react.useMemo(()=>({
638
+ activateOnFocus,
639
+ highlightedTabIndex,
640
+ registerIndicatorUpdateListener,
641
+ registerTabResizeObserverElement,
642
+ onTabActivation,
643
+ setHighlightedTabIndex,
644
+ tabsListElement
645
+ }), [
646
+ activateOnFocus,
647
+ highlightedTabIndex,
648
+ registerIndicatorUpdateListener,
649
+ registerTabResizeObserverElement,
650
+ onTabActivation,
651
+ setHighlightedTabIndex,
652
+ tabsListElement
653
+ ]);
654
+ return /*#__PURE__*/ jsx(TabsListContext.Provider, {
655
+ value: tabsListContextValue,
656
+ children: /*#__PURE__*/ jsx(CompositeRoot, {
657
+ render: render,
658
+ className: className,
659
+ style: style,
660
+ state: state,
661
+ refs: [
662
+ forwardedRef,
663
+ setTabsListElement
664
+ ],
665
+ props: [
666
+ defaultProps,
667
+ elementProps
668
+ ],
669
+ stateAttributesMapping: tabsStateAttributesMapping,
670
+ highlightedIndex: highlightedTabIndex,
671
+ enableHomeAndEndKeys: true,
672
+ loopFocus: loopFocus,
673
+ orientation: orientation,
674
+ onHighlightedIndexChange: setHighlightedTabIndex,
675
+ onMapChange: setTabMap,
676
+ disabledIndices: EMPTY_ARRAY
677
+ })
678
+ });
679
+ });
680
+ if ("production" !== process.env.NODE_ENV) TabsList_TabsList.displayName = "TabsList";
5
681
  const Tabs_module = {
6
682
  root: "root-Hb4MhN",
7
683
  list: "list-ZEK7AG",
@@ -14,22 +690,22 @@ const Tabs_module = {
14
690
  indicator: "indicator-a2Roef",
15
691
  panel: "panel-dMpxFc"
16
692
  };
17
- const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Tabs.Root, {
693
+ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(TabsRoot_TabsRoot, {
18
694
  ref: ref,
19
695
  className: clsx(Tabs_module.root, className),
20
696
  ...props
21
697
  }));
22
- const Tab = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Tabs.Tab, {
698
+ const Tab = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(TabsTab_TabsTab, {
23
699
  ref: ref,
24
700
  className: clsx(Tabs_module.tab, className, 'has-custom-focus'),
25
701
  ...props
26
702
  }));
27
- const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Tabs.Indicator, {
703
+ const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(TabsIndicator_TabsIndicator, {
28
704
  ref: ref,
29
705
  className: clsx(Tabs_module.indicator, className),
30
706
  ...props
31
707
  }));
32
- const Panel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Tabs.Panel, {
708
+ const Panel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(TabsPanel_TabsPanel, {
33
709
  ref: ref,
34
710
  className: clsx(Tabs_module.panel, className),
35
711
  ...props
@@ -54,16 +730,16 @@ const alignClassMap = {
54
730
  center: Tabs_module.alignCenter,
55
731
  end: Tabs_module.alignEnd
56
732
  };
57
- const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, underline = 'full', align = 'center', ...props }, ref)=>/*#__PURE__*/ jsx(Tabs.List, {
733
+ const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, underline = 'full', align = 'center', ...props }, ref)=>/*#__PURE__*/ jsx(TabsList_TabsList, {
58
734
  ref: ref,
59
735
  className: clsx(Tabs_module.list, alignClassMap[align], underlineClassMap[underline], className),
60
736
  ...props
61
737
  }));
62
- const Tabs_Tabs = {
738
+ const Tabs = {
63
739
  Root: Root,
64
740
  Tab: Tab,
65
741
  Indicator: Indicator,
66
742
  Panel: Panel,
67
743
  List: List
68
744
  };
69
- export { TabListAlign, TabListUnderline, Tabs_Tabs as Tabs };
745
+ export { TabListAlign, TabListUnderline, Tabs };