@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.
- package/dist/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Accordion/index.js
CHANGED
|
@@ -1,9 +1,424 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Accordion } from "@base-ui/react/accordion";
|
|
3
2
|
import { ChevronDown } from "@wix/wix-ui-icons-common";
|
|
4
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 "../880.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";
|
|
5
19
|
import { Typography } from "../Typography/index.js";
|
|
6
20
|
import * as __rspack_external_react from "react";
|
|
21
|
+
const AccordionRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
22
|
+
if ("production" !== process.env.NODE_ENV) AccordionRootContext.displayName = "AccordionRootContext";
|
|
23
|
+
function useAccordionRootContext() {
|
|
24
|
+
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));
|
|
26
|
+
return context;
|
|
27
|
+
}
|
|
28
|
+
const AccordionItemContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
29
|
+
if ("production" !== process.env.NODE_ENV) AccordionItemContext.displayName = "AccordionItemContext";
|
|
30
|
+
function useAccordionItemContext() {
|
|
31
|
+
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));
|
|
33
|
+
return context;
|
|
34
|
+
}
|
|
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
|
+
}({});
|
|
41
|
+
const accordionStateAttributesMapping = {
|
|
42
|
+
...collapsibleOpenStateMapping,
|
|
43
|
+
index: (value)=>Number.isInteger(value) ? {
|
|
44
|
+
[AccordionItemDataAttributes_AccordionItemDataAttributes.index]: String(value)
|
|
45
|
+
} : null,
|
|
46
|
+
...transitionStatusMapping,
|
|
47
|
+
value: ()=>null
|
|
48
|
+
};
|
|
49
|
+
const AccordionItem_AccordionItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
50
|
+
const { className, disabled: disabledProp = false, onOpenChange: onOpenChangeProp, render, value: valueProp, style, ...elementProps } = componentProps;
|
|
51
|
+
const { ref: listItemRef, index } = useCompositeListItem();
|
|
52
|
+
const mergedRef = useMergedRefs(forwardedRef, listItemRef);
|
|
53
|
+
const { disabled: contextDisabled, handleValueChange, state: rootState, value: openValues } = useAccordionRootContext();
|
|
54
|
+
const fallbackValue = useBaseUiId();
|
|
55
|
+
const value = valueProp ?? fallbackValue;
|
|
56
|
+
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
|
+
]);
|
|
65
|
+
const onOpenChange = useStableCallback((nextOpen, eventDetails)=>{
|
|
66
|
+
onOpenChangeProp?.(nextOpen, eventDetails);
|
|
67
|
+
if (eventDetails.isCanceled) return;
|
|
68
|
+
handleValueChange(value, nextOpen);
|
|
69
|
+
});
|
|
70
|
+
const collapsible = useCollapsibleRoot({
|
|
71
|
+
open: isOpen,
|
|
72
|
+
onOpenChange,
|
|
73
|
+
disabled
|
|
74
|
+
});
|
|
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
|
+
const collapsibleContext = __rspack_external_react.useMemo(()=>({
|
|
85
|
+
...collapsible,
|
|
86
|
+
onOpenChange,
|
|
87
|
+
state: collapsibleState
|
|
88
|
+
}), [
|
|
89
|
+
collapsible,
|
|
90
|
+
collapsibleState,
|
|
91
|
+
onOpenChange
|
|
92
|
+
]);
|
|
93
|
+
const state = __rspack_external_react.useMemo(()=>({
|
|
94
|
+
...rootState,
|
|
95
|
+
hidden: !isOpen && !collapsible.mounted,
|
|
96
|
+
index,
|
|
97
|
+
disabled,
|
|
98
|
+
open: isOpen
|
|
99
|
+
}), [
|
|
100
|
+
collapsible.mounted,
|
|
101
|
+
disabled,
|
|
102
|
+
index,
|
|
103
|
+
isOpen,
|
|
104
|
+
rootState
|
|
105
|
+
]);
|
|
106
|
+
const defaultTriggerId = useBaseUiId();
|
|
107
|
+
const [triggerId, setTriggerId] = __rspack_external_react.useState(defaultTriggerId);
|
|
108
|
+
const accordionItemContext = __rspack_external_react.useMemo(()=>({
|
|
109
|
+
open: isOpen,
|
|
110
|
+
state,
|
|
111
|
+
setTriggerId,
|
|
112
|
+
triggerId
|
|
113
|
+
}), [
|
|
114
|
+
isOpen,
|
|
115
|
+
state,
|
|
116
|
+
setTriggerId,
|
|
117
|
+
triggerId
|
|
118
|
+
]);
|
|
119
|
+
const element = useRenderElement('div', componentProps, {
|
|
120
|
+
state,
|
|
121
|
+
ref: mergedRef,
|
|
122
|
+
props: elementProps,
|
|
123
|
+
stateAttributesMapping: accordionStateAttributesMapping
|
|
124
|
+
});
|
|
125
|
+
return /*#__PURE__*/ jsx(CollapsibleRootContext.Provider, {
|
|
126
|
+
value: collapsibleContext,
|
|
127
|
+
children: /*#__PURE__*/ jsx(AccordionItemContext.Provider, {
|
|
128
|
+
value: accordionItemContext,
|
|
129
|
+
children: element
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
if ("production" !== process.env.NODE_ENV) AccordionItem_AccordionItem.displayName = "AccordionItem";
|
|
134
|
+
const AccordionHeader_AccordionHeader = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
135
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
136
|
+
const { state } = useAccordionItemContext();
|
|
137
|
+
const element = useRenderElement('h3', componentProps, {
|
|
138
|
+
state,
|
|
139
|
+
ref: forwardedRef,
|
|
140
|
+
props: elementProps,
|
|
141
|
+
stateAttributesMapping: accordionStateAttributesMapping
|
|
142
|
+
});
|
|
143
|
+
return element;
|
|
144
|
+
});
|
|
145
|
+
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
|
+
}
|
|
158
|
+
const AccordionTrigger_AccordionTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
159
|
+
const { disabled: disabledProp, className, id: idProp, render, nativeButton = true, style, ...elementProps } = componentProps;
|
|
160
|
+
const { panelId, open, handleTrigger, disabled: contextDisabled } = useCollapsibleRootContext();
|
|
161
|
+
const disabled = disabledProp ?? contextDisabled;
|
|
162
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
163
|
+
disabled,
|
|
164
|
+
focusableWhenDisabled: true,
|
|
165
|
+
native: nativeButton,
|
|
166
|
+
composite: true
|
|
167
|
+
});
|
|
168
|
+
const { accordionItemRefs, direction, loopFocus, orientation } = useAccordionRootContext();
|
|
169
|
+
const isRtl = 'rtl' === direction;
|
|
170
|
+
const isHorizontal = 'horizontal' === orientation;
|
|
171
|
+
const { state, setTriggerId, triggerId: id } = useAccordionItemContext();
|
|
172
|
+
useIsoLayoutEffect(()=>{
|
|
173
|
+
if (idProp) setTriggerId(idProp);
|
|
174
|
+
return ()=>{
|
|
175
|
+
setTriggerId(void 0);
|
|
176
|
+
};
|
|
177
|
+
}, [
|
|
178
|
+
idProp,
|
|
179
|
+
setTriggerId
|
|
180
|
+
]);
|
|
181
|
+
const props = {
|
|
182
|
+
'aria-controls': open ? panelId : void 0,
|
|
183
|
+
'aria-expanded': open,
|
|
184
|
+
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
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const element = useRenderElement('button', componentProps, {
|
|
229
|
+
state,
|
|
230
|
+
ref: [
|
|
231
|
+
forwardedRef,
|
|
232
|
+
buttonRef
|
|
233
|
+
],
|
|
234
|
+
props: [
|
|
235
|
+
props,
|
|
236
|
+
elementProps,
|
|
237
|
+
getButtonProps
|
|
238
|
+
],
|
|
239
|
+
stateAttributesMapping: triggerOpenStateMapping
|
|
240
|
+
});
|
|
241
|
+
return element;
|
|
242
|
+
});
|
|
243
|
+
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
|
+
}({});
|
|
249
|
+
const AccordionPanel_AccordionPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
250
|
+
const { className, hiddenUntilFound: hiddenUntilFoundProp, keepMounted: keepMountedProp, id: idProp, render, style, ...elementProps } = componentProps;
|
|
251
|
+
const { hiddenUntilFound: contextHiddenUntilFound, keepMounted: contextKeepMounted } = useAccordionRootContext();
|
|
252
|
+
const { mounted, onOpenChange, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus } = useCollapsibleRootContext();
|
|
253
|
+
const hiddenUntilFound = hiddenUntilFoundProp ?? contextHiddenUntilFound;
|
|
254
|
+
const keepMounted = keepMountedProp ?? contextKeepMounted;
|
|
255
|
+
if ('production' !== process.env.NODE_ENV) useIsoLayoutEffect(()=>{
|
|
256
|
+
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
|
+
}, [
|
|
258
|
+
hiddenUntilFound,
|
|
259
|
+
keepMountedProp
|
|
260
|
+
]);
|
|
261
|
+
useIsoLayoutEffect(()=>{
|
|
262
|
+
if (idProp) {
|
|
263
|
+
setPanelIdState(idProp);
|
|
264
|
+
return ()=>{
|
|
265
|
+
setPanelIdState(void 0);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}, [
|
|
269
|
+
idProp,
|
|
270
|
+
setPanelIdState
|
|
271
|
+
]);
|
|
272
|
+
const { height, props, ref, shouldPreventOpenAnimation, shouldRender, transitionStatus: panelTransitionStatus, width } = useCollapsiblePanel({
|
|
273
|
+
externalRef: forwardedRef,
|
|
274
|
+
hiddenUntilFound,
|
|
275
|
+
id: idProp ?? panelId,
|
|
276
|
+
keepMounted,
|
|
277
|
+
mounted,
|
|
278
|
+
onOpenChange,
|
|
279
|
+
open,
|
|
280
|
+
setMounted,
|
|
281
|
+
setOpen,
|
|
282
|
+
transitionStatus
|
|
283
|
+
});
|
|
284
|
+
const { state, triggerId } = useAccordionItemContext();
|
|
285
|
+
const panelState = {
|
|
286
|
+
...state,
|
|
287
|
+
transitionStatus: panelTransitionStatus
|
|
288
|
+
};
|
|
289
|
+
const resolvedStyle = resolveStyle(style, panelState);
|
|
290
|
+
const element = useRenderElement('div', {
|
|
291
|
+
...componentProps,
|
|
292
|
+
style: void 0
|
|
293
|
+
}, {
|
|
294
|
+
state: panelState,
|
|
295
|
+
ref,
|
|
296
|
+
props: [
|
|
297
|
+
props,
|
|
298
|
+
{
|
|
299
|
+
'aria-labelledby': triggerId,
|
|
300
|
+
role: 'region',
|
|
301
|
+
style: {
|
|
302
|
+
[AccordionPanelCssVars_AccordionPanelCssVars.accordionPanelHeight]: void 0 === height ? 'auto' : `${height}px`,
|
|
303
|
+
[AccordionPanelCssVars_AccordionPanelCssVars.accordionPanelWidth]: void 0 === width ? 'auto' : `${width}px`
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
elementProps,
|
|
307
|
+
resolvedStyle ? {
|
|
308
|
+
style: resolvedStyle
|
|
309
|
+
} : void 0,
|
|
310
|
+
shouldPreventOpenAnimation ? {
|
|
311
|
+
style: {
|
|
312
|
+
animationName: 'none'
|
|
313
|
+
}
|
|
314
|
+
} : void 0
|
|
315
|
+
],
|
|
316
|
+
stateAttributesMapping: accordionStateAttributesMapping
|
|
317
|
+
});
|
|
318
|
+
if (!shouldRender) return null;
|
|
319
|
+
return element;
|
|
320
|
+
});
|
|
321
|
+
if ("production" !== process.env.NODE_ENV) AccordionPanel_AccordionPanel.displayName = "AccordionPanel";
|
|
322
|
+
const rootStateAttributesMapping = {
|
|
323
|
+
value: ()=>null
|
|
324
|
+
};
|
|
325
|
+
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(()=>{
|
|
329
|
+
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
|
+
}, [
|
|
331
|
+
hiddenUntilFoundProp,
|
|
332
|
+
keepMountedProp
|
|
333
|
+
]);
|
|
334
|
+
const defaultValue = __rspack_external_react.useMemo(()=>{
|
|
335
|
+
if (void 0 === valueProp) return defaultValueProp ?? [];
|
|
336
|
+
}, [
|
|
337
|
+
valueProp,
|
|
338
|
+
defaultValueProp
|
|
339
|
+
]);
|
|
340
|
+
const accordionItemRefs = __rspack_external_react.useRef([]);
|
|
341
|
+
const [value, setValue] = useControlled({
|
|
342
|
+
controlled: valueProp,
|
|
343
|
+
default: defaultValue,
|
|
344
|
+
name: 'Accordion',
|
|
345
|
+
state: 'value'
|
|
346
|
+
});
|
|
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
|
+
}
|
|
369
|
+
});
|
|
370
|
+
const state = __rspack_external_react.useMemo(()=>({
|
|
371
|
+
value,
|
|
372
|
+
disabled,
|
|
373
|
+
orientation
|
|
374
|
+
}), [
|
|
375
|
+
value,
|
|
376
|
+
disabled,
|
|
377
|
+
orientation
|
|
378
|
+
]);
|
|
379
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
380
|
+
accordionItemRefs,
|
|
381
|
+
direction,
|
|
382
|
+
disabled,
|
|
383
|
+
handleValueChange,
|
|
384
|
+
hiddenUntilFound: hiddenUntilFoundProp ?? false,
|
|
385
|
+
keepMounted: keepMountedProp ?? false,
|
|
386
|
+
loopFocus,
|
|
387
|
+
orientation,
|
|
388
|
+
state,
|
|
389
|
+
value
|
|
390
|
+
}), [
|
|
391
|
+
direction,
|
|
392
|
+
disabled,
|
|
393
|
+
handleValueChange,
|
|
394
|
+
hiddenUntilFoundProp,
|
|
395
|
+
keepMountedProp,
|
|
396
|
+
loopFocus,
|
|
397
|
+
orientation,
|
|
398
|
+
state,
|
|
399
|
+
value
|
|
400
|
+
]);
|
|
401
|
+
const element = useRenderElement('div', componentProps, {
|
|
402
|
+
state,
|
|
403
|
+
ref: forwardedRef,
|
|
404
|
+
props: [
|
|
405
|
+
{
|
|
406
|
+
dir: direction,
|
|
407
|
+
role: 'region'
|
|
408
|
+
},
|
|
409
|
+
elementProps
|
|
410
|
+
],
|
|
411
|
+
stateAttributesMapping: rootStateAttributesMapping
|
|
412
|
+
});
|
|
413
|
+
return /*#__PURE__*/ jsx(AccordionRootContext.Provider, {
|
|
414
|
+
value: contextValue,
|
|
415
|
+
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
416
|
+
elementsRef: accordionItemRefs,
|
|
417
|
+
children: element
|
|
418
|
+
})
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
if ("production" !== process.env.NODE_ENV) AccordionRoot_AccordionRoot.displayName = "AccordionRoot";
|
|
7
422
|
const Accordion_module = {
|
|
8
423
|
root: "root-jseiNO",
|
|
9
424
|
line: "line-t3NkfO",
|
|
@@ -27,28 +442,28 @@ const AccordionVariant = {
|
|
|
27
442
|
line: 'line',
|
|
28
443
|
box: 'box'
|
|
29
444
|
};
|
|
30
|
-
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
445
|
+
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AccordionItem_AccordionItem, {
|
|
31
446
|
ref: ref,
|
|
32
447
|
className: clsx(Accordion_module.item, className),
|
|
33
448
|
...props
|
|
34
449
|
}));
|
|
35
|
-
const Header = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
450
|
+
const Header = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AccordionHeader_AccordionHeader, {
|
|
36
451
|
ref: ref,
|
|
37
452
|
className: clsx(Accordion_module.header, className),
|
|
38
453
|
...props
|
|
39
454
|
}));
|
|
40
|
-
const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
455
|
+
const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AccordionTrigger_AccordionTrigger, {
|
|
41
456
|
ref: ref,
|
|
42
457
|
className: clsx(Accordion_module.trigger, className),
|
|
43
458
|
...props
|
|
44
459
|
}));
|
|
45
|
-
const Panel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
460
|
+
const Panel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(AccordionPanel_AccordionPanel, {
|
|
46
461
|
ref: ref,
|
|
47
462
|
className: clsx(Accordion_module.panel, className),
|
|
48
463
|
...props
|
|
49
464
|
}));
|
|
50
465
|
function Root({ className, size = AccordionSize.small, variant = AccordionVariant.line, ...props }) {
|
|
51
|
-
return /*#__PURE__*/ jsx(
|
|
466
|
+
return /*#__PURE__*/ jsx(AccordionRoot_AccordionRoot, {
|
|
52
467
|
...props,
|
|
53
468
|
className: clsx(Accordion_module.root, Accordion_module[size], Accordion_module[variant], className)
|
|
54
469
|
});
|
|
@@ -75,7 +490,7 @@ const Suffix = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ..
|
|
|
75
490
|
className: clsx(Accordion_module.suffix, className),
|
|
76
491
|
...props
|
|
77
492
|
}));
|
|
78
|
-
const
|
|
493
|
+
const Accordion = {
|
|
79
494
|
Item: Item,
|
|
80
495
|
Header: Header,
|
|
81
496
|
Trigger: Trigger,
|
|
@@ -86,4 +501,4 @@ const Accordion_Accordion = {
|
|
|
86
501
|
Subtitle: Subtitle,
|
|
87
502
|
Suffix: Suffix
|
|
88
503
|
};
|
|
89
|
-
export { AccordionSize, AccordionVariant
|
|
504
|
+
export { Accordion, AccordionSize, AccordionVariant };
|