@wix/site-ui 1.347.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.
- package/dist/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
|
@@ -1,52 +1,70 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useStableCallback } from "../
|
|
4
|
-
import { useLabelableContext, useFieldRootContext, fieldValidityMapping } from "../
|
|
5
|
-
import { useFormContext } from "../
|
|
6
|
-
import { useControlled } from "../
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { EMPTY_ARRAY, useRenderElement } from "../9591.js";
|
|
3
|
+
import { useStableCallback } from "../7488.js";
|
|
4
|
+
import { useLabelableContext, useFieldRootContext, fieldValidityMapping } from "../201.js";
|
|
5
|
+
import { useFormContext } from "../9880.js";
|
|
6
|
+
import { useControlled } from "../6006.js";
|
|
7
|
+
import { useLabelableId } from "../6551.js";
|
|
8
|
+
import { useBaseUiId } from "../5969.js";
|
|
9
|
+
import { isEligibleInput } from "../4605.js";
|
|
10
|
+
import { useRegisterFieldControl } from "../6140.js";
|
|
11
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
12
|
+
import { useValueChanged } from "../9252.js";
|
|
13
|
+
import { areArraysEqual } from "../2387.js";
|
|
14
|
+
import { CheckboxGroupContext } from "../4226.js";
|
|
13
15
|
import * as __rspack_external_react from "react";
|
|
14
|
-
const EMPTY = [];
|
|
15
16
|
function useCheckboxGroupParent(params) {
|
|
16
|
-
const { allValues =
|
|
17
|
+
const { allValues = EMPTY_ARRAY, value, onValueChange: onValueChangeProp } = params;
|
|
17
18
|
const uncontrolledStateRef = __rspack_external_react.useRef(value);
|
|
18
19
|
const disabledStatesRef = __rspack_external_react.useRef(new Map());
|
|
19
20
|
const [status, setStatus] = __rspack_external_react.useState('mixed');
|
|
20
|
-
const
|
|
21
|
+
const [childIdsState, setChildIdsState] = __rspack_external_react.useState(()=>({
|
|
22
|
+
registry: new Map()
|
|
23
|
+
}));
|
|
21
24
|
const checked = value.length === allValues.length;
|
|
22
25
|
const indeterminate = value.length !== allValues.length && value.length > 0;
|
|
23
26
|
const onValueChange = useStableCallback(onValueChangeProp);
|
|
27
|
+
const registerChildId = useStableCallback((childValue, childId)=>{
|
|
28
|
+
const childIds = childIdsState.registry;
|
|
29
|
+
childIds.set(childValue, (childIds.get(childValue) ?? EMPTY_ARRAY).concat(childId));
|
|
30
|
+
setChildIdsState({
|
|
31
|
+
registry: childIds
|
|
32
|
+
});
|
|
33
|
+
return ()=>{
|
|
34
|
+
const nextIds = (childIds.get(childValue) ?? EMPTY_ARRAY).filter((id)=>id !== childId);
|
|
35
|
+
if (0 === nextIds.length) childIds.delete(childValue);
|
|
36
|
+
else childIds.set(childValue, nextIds);
|
|
37
|
+
setChildIdsState({
|
|
38
|
+
registry: childIds
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
});
|
|
24
42
|
const getParentProps = __rspack_external_react.useCallback(()=>({
|
|
25
|
-
id,
|
|
26
43
|
indeterminate,
|
|
27
44
|
checked,
|
|
28
|
-
'aria-controls': allValues.
|
|
45
|
+
'aria-controls': allValues.flatMap((v)=>childIdsState.registry.get(v) ?? EMPTY_ARRAY).join(' ') || void 0,
|
|
29
46
|
onCheckedChange (_, eventDetails) {
|
|
30
47
|
const uncontrolledState = uncontrolledStateRef.current;
|
|
31
48
|
const none = allValues.filter((v)=>disabledStatesRef.current.get(v) && uncontrolledState.includes(v));
|
|
32
|
-
const all = allValues.filter((v)=>!disabledStatesRef.current.get(v) ||
|
|
49
|
+
const all = allValues.filter((v)=>!disabledStatesRef.current.get(v) || uncontrolledState.includes(v));
|
|
33
50
|
const allOnOrOff = uncontrolledState.length === all.length || 0 === uncontrolledState.length;
|
|
34
51
|
if (allOnOrOff) return void (value.length === all.length ? onValueChange(none, eventDetails) : onValueChange(all, eventDetails));
|
|
52
|
+
let nextStatus = 'mixed';
|
|
53
|
+
let nextValue = uncontrolledState;
|
|
35
54
|
if ('mixed' === status) {
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
nextStatus = 'on';
|
|
56
|
+
nextValue = all;
|
|
38
57
|
} else if ('on' === status) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else if ('off' === status) {
|
|
42
|
-
onValueChange(uncontrolledState, eventDetails);
|
|
43
|
-
setStatus('mixed');
|
|
58
|
+
nextStatus = 'off';
|
|
59
|
+
nextValue = none;
|
|
44
60
|
}
|
|
61
|
+
onValueChange(nextValue, eventDetails);
|
|
62
|
+
if (!eventDetails.isCanceled) setStatus(nextStatus);
|
|
45
63
|
}
|
|
46
64
|
}), [
|
|
47
65
|
allValues,
|
|
48
66
|
checked,
|
|
49
|
-
|
|
67
|
+
childIdsState,
|
|
50
68
|
indeterminate,
|
|
51
69
|
onValueChange,
|
|
52
70
|
status,
|
|
@@ -58,39 +76,34 @@ function useCheckboxGroupParent(params) {
|
|
|
58
76
|
const newValue = value.slice();
|
|
59
77
|
if (nextChecked) newValue.push(childValue);
|
|
60
78
|
else newValue.splice(newValue.indexOf(childValue), 1);
|
|
61
|
-
uncontrolledStateRef.current = newValue;
|
|
62
79
|
onValueChange(newValue, eventDetails);
|
|
63
|
-
|
|
80
|
+
if (!eventDetails.isCanceled) {
|
|
81
|
+
uncontrolledStateRef.current = newValue;
|
|
82
|
+
setStatus('mixed');
|
|
83
|
+
}
|
|
64
84
|
}
|
|
65
85
|
}), [
|
|
66
86
|
onValueChange,
|
|
67
87
|
value
|
|
68
88
|
]);
|
|
69
89
|
return __rspack_external_react.useMemo(()=>({
|
|
70
|
-
id,
|
|
71
|
-
indeterminate,
|
|
72
90
|
getParentProps,
|
|
73
91
|
getChildProps,
|
|
92
|
+
registerChildId,
|
|
74
93
|
disabledStatesRef
|
|
75
94
|
}), [
|
|
76
|
-
id,
|
|
77
|
-
indeterminate,
|
|
78
95
|
getParentProps,
|
|
79
|
-
getChildProps
|
|
96
|
+
getChildProps,
|
|
97
|
+
registerChildId
|
|
80
98
|
]);
|
|
81
99
|
}
|
|
82
100
|
const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
83
101
|
const { allValues, className, defaultValue: defaultValueProp, disabled: disabledProp = false, id: idProp, onValueChange, render, value: externalValue, style, ...elementProps } = componentProps;
|
|
84
|
-
const { disabled: fieldDisabled, name: fieldName, state: fieldState, validation, setFilled, setDirty,
|
|
85
|
-
const { labelId, getDescriptionProps } = useLabelableContext();
|
|
86
|
-
const { clearErrors } = useFormContext();
|
|
102
|
+
const { disabled: fieldDisabled, name: fieldName, state: fieldState, validation, setFilled, setDirty, validityData } = useFieldRootContext();
|
|
103
|
+
const { labelId, registerControlId, getDescriptionProps } = useLabelableContext();
|
|
104
|
+
const { clearErrors, elementRef } = useFormContext();
|
|
87
105
|
const disabled = fieldDisabled || disabledProp;
|
|
88
|
-
const defaultValue =
|
|
89
|
-
if (void 0 === externalValue) return defaultValueProp ?? [];
|
|
90
|
-
}, [
|
|
91
|
-
externalValue,
|
|
92
|
-
defaultValueProp
|
|
93
|
-
]);
|
|
106
|
+
const defaultValue = defaultValueProp ?? EMPTY_ARRAY;
|
|
94
107
|
const [value, setValueUnwrapped] = useControlled({
|
|
95
108
|
controlled: externalValue,
|
|
96
109
|
default: defaultValue,
|
|
@@ -107,20 +120,37 @@ const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
107
120
|
value,
|
|
108
121
|
onValueChange: setValue
|
|
109
122
|
});
|
|
123
|
+
useLabelableId({
|
|
124
|
+
id: null
|
|
125
|
+
});
|
|
110
126
|
const id = useBaseUiId(idProp);
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
const getInputControl = validation.getInputControl;
|
|
128
|
+
const controlRef = __rspack_external_react.useMemo(()=>({
|
|
129
|
+
get current () {
|
|
130
|
+
return getInputControl();
|
|
131
|
+
}
|
|
132
|
+
}), [
|
|
133
|
+
getInputControl
|
|
134
|
+
]);
|
|
135
|
+
const getFormValue = useStableCallback(()=>{
|
|
136
|
+
const formElement = elementRef.current;
|
|
137
|
+
if (!formElement) return value;
|
|
138
|
+
const successfulValues = new Set();
|
|
139
|
+
for (const [input, registration] of validation.registeredInputs)if (void 0 !== registration.value && input.checked && isEligibleInput(input, formElement)) successfulValues.add(registration.value);
|
|
140
|
+
return value.filter((inputValue)=>successfulValues.has(inputValue));
|
|
141
|
+
});
|
|
142
|
+
useRegisterFieldControl(controlRef, id, value, getFormValue, !!fieldName && !disabled, fieldName);
|
|
143
|
+
useIsoLayoutEffect(()=>{
|
|
144
|
+
setFilled(value.length > 0);
|
|
145
|
+
}, [
|
|
146
|
+
value,
|
|
147
|
+
setFilled
|
|
148
|
+
]);
|
|
149
|
+
useValueChanged(value, ()=>{
|
|
118
150
|
if (fieldName) clearErrors(fieldName);
|
|
119
151
|
const initialValue = Array.isArray(validityData.initialValue) ? validityData.initialValue : EMPTY_ARRAY;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (shouldValidateOnChange()) validation.commit(resolvedValue);
|
|
123
|
-
else validation.commit(resolvedValue, true);
|
|
152
|
+
setDirty(!areArraysEqual(value, initialValue));
|
|
153
|
+
validation.change(value);
|
|
124
154
|
});
|
|
125
155
|
const state = {
|
|
126
156
|
...fieldState,
|
|
@@ -129,32 +159,31 @@ const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
129
159
|
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
130
160
|
allValues,
|
|
131
161
|
value,
|
|
132
|
-
defaultValue,
|
|
133
162
|
setValue,
|
|
134
163
|
parent,
|
|
135
164
|
disabled,
|
|
136
165
|
validation,
|
|
137
|
-
|
|
166
|
+
registerControlId
|
|
138
167
|
}), [
|
|
139
168
|
allValues,
|
|
140
169
|
value,
|
|
141
|
-
defaultValue,
|
|
142
170
|
setValue,
|
|
143
171
|
parent,
|
|
144
172
|
disabled,
|
|
145
173
|
validation,
|
|
146
|
-
|
|
174
|
+
registerControlId
|
|
147
175
|
]);
|
|
148
176
|
const element = useRenderElement('div', componentProps, {
|
|
149
177
|
state,
|
|
150
178
|
ref: forwardedRef,
|
|
151
179
|
props: [
|
|
152
180
|
{
|
|
181
|
+
id: idProp,
|
|
153
182
|
role: 'group',
|
|
154
183
|
'aria-labelledby': labelId
|
|
155
184
|
},
|
|
156
|
-
|
|
157
|
-
|
|
185
|
+
elementProps,
|
|
186
|
+
getDescriptionProps
|
|
158
187
|
],
|
|
159
188
|
stateAttributesMapping: fieldValidityMapping
|
|
160
189
|
});
|
|
@@ -68,15 +68,25 @@ declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E &
|
|
|
68
68
|
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
declare const cancelOpen:
|
|
71
|
+
declare const cancelOpen: 'cancel-open';
|
|
72
72
|
|
|
73
|
-
declare const chipRemovePress:
|
|
73
|
+
declare const chipRemovePress: 'chip-remove-press';
|
|
74
74
|
|
|
75
|
-
declare const clearPress:
|
|
75
|
+
declare const clearPress: 'clear-press';
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Present when the collapsible is closed.
|
|
79
|
+
*/
|
|
80
|
+
declare const closed_2 = "data-closed";
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Present when the collapsible panel is closed.
|
|
84
|
+
*/
|
|
85
|
+
declare const closed_3 = "data-closed";
|
|
86
|
+
|
|
87
|
+
declare const closePress: 'close-press';
|
|
88
|
+
|
|
89
|
+
declare const closeWatcher: 'close-watcher';
|
|
80
90
|
|
|
81
91
|
export declare const Collapsible: {
|
|
82
92
|
Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CollapsibleRootProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
@@ -103,6 +113,28 @@ export declare namespace CollapsiblePanel {
|
|
|
103
113
|
export type Props = CollapsiblePanelProps;
|
|
104
114
|
}
|
|
105
115
|
|
|
116
|
+
export declare namespace CollapsiblePanelCssVariables {
|
|
117
|
+
export {
|
|
118
|
+
collapsiblePanelHeight,
|
|
119
|
+
collapsiblePanelWidth
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export declare namespace CollapsiblePanelDataAttributes {
|
|
124
|
+
export {
|
|
125
|
+
open_3 as open,
|
|
126
|
+
closed_3 as closed,
|
|
127
|
+
startingStyle_2 as startingStyle,
|
|
128
|
+
endingStyle_2 as endingStyle
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The collapsible panel's height.
|
|
134
|
+
* @type {number}
|
|
135
|
+
*/
|
|
136
|
+
declare const collapsiblePanelHeight = "--collapsible-panel-height";
|
|
137
|
+
|
|
106
138
|
export declare interface CollapsiblePanelProps extends BaseUIComponentProps<'div', CollapsiblePanelState> {
|
|
107
139
|
/**
|
|
108
140
|
* Allows the browser's built-in page search to find and expand the panel contents.
|
|
@@ -128,6 +160,12 @@ export declare interface CollapsiblePanelState extends CollapsibleRootState {
|
|
|
128
160
|
transitionStatus: TransitionStatus;
|
|
129
161
|
}
|
|
130
162
|
|
|
163
|
+
/**
|
|
164
|
+
* The collapsible panel's width.
|
|
165
|
+
* @type {number}
|
|
166
|
+
*/
|
|
167
|
+
declare const collapsiblePanelWidth = "--collapsible-panel-width";
|
|
168
|
+
|
|
131
169
|
/**
|
|
132
170
|
* Groups all parts of the collapsible.
|
|
133
171
|
* Renders a `<div>` element.
|
|
@@ -147,6 +185,15 @@ export declare type CollapsibleRootChangeEventDetails = BaseUIChangeEventDetails
|
|
|
147
185
|
|
|
148
186
|
export declare type CollapsibleRootChangeEventReason = typeof REASONS.triggerPress | typeof REASONS.none;
|
|
149
187
|
|
|
188
|
+
export declare namespace CollapsibleRootDataAttributes {
|
|
189
|
+
export {
|
|
190
|
+
open_2 as open,
|
|
191
|
+
closed_2 as closed,
|
|
192
|
+
startingStyle,
|
|
193
|
+
endingStyle
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
150
197
|
export declare interface CollapsibleRootProps extends BaseUIComponentProps<'div', CollapsibleRootState> {
|
|
151
198
|
/**
|
|
152
199
|
* Whether the collapsible panel is currently open.
|
|
@@ -187,6 +234,12 @@ export declare namespace CollapsibleTrigger {
|
|
|
187
234
|
export type Props = CollapsibleTriggerProps;
|
|
188
235
|
}
|
|
189
236
|
|
|
237
|
+
export declare namespace CollapsibleTriggerDataAttributes {
|
|
238
|
+
export {
|
|
239
|
+
panelOpen
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
190
243
|
export declare interface CollapsibleTriggerProps extends NativeButtonProps, BaseUIComponentProps<'button', CollapsibleTriggerState> {}
|
|
191
244
|
|
|
192
245
|
export declare interface CollapsibleTriggerState extends CollapsibleRootState {}
|
|
@@ -199,45 +252,55 @@ export declare interface CollapsibleTriggerState extends CollapsibleRootState {}
|
|
|
199
252
|
*/
|
|
200
253
|
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
201
254
|
|
|
202
|
-
declare const decrementPress:
|
|
255
|
+
declare const decrementPress: 'decrement-press';
|
|
203
256
|
|
|
204
|
-
declare const disabled:
|
|
257
|
+
declare const disabled: 'disabled';
|
|
205
258
|
|
|
206
|
-
declare const drag:
|
|
259
|
+
declare const drag: 'drag';
|
|
207
260
|
|
|
208
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Present when the collapsible is animating out.
|
|
263
|
+
*/
|
|
264
|
+
declare const endingStyle = "data-ending-style";
|
|
209
265
|
|
|
210
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Present when the panel is animating out.
|
|
268
|
+
*/
|
|
269
|
+
declare const endingStyle_2 = "data-ending-style";
|
|
270
|
+
|
|
271
|
+
declare const escapeKey: 'escape-key';
|
|
272
|
+
|
|
273
|
+
declare const focusOut: 'focus-out';
|
|
211
274
|
|
|
212
275
|
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
213
276
|
ref?: React_2.Ref<T> | undefined;
|
|
214
277
|
};
|
|
215
278
|
|
|
216
|
-
declare const imperativeAction:
|
|
279
|
+
declare const imperativeAction: 'imperative-action';
|
|
217
280
|
|
|
218
|
-
declare const incrementPress:
|
|
281
|
+
declare const incrementPress: 'increment-press';
|
|
219
282
|
|
|
220
|
-
declare const initial:
|
|
283
|
+
declare const initial: 'initial';
|
|
221
284
|
|
|
222
|
-
declare const inputBlur:
|
|
285
|
+
declare const inputBlur: 'input-blur';
|
|
223
286
|
|
|
224
|
-
declare const inputChange:
|
|
287
|
+
declare const inputChange: 'input-change';
|
|
225
288
|
|
|
226
|
-
declare const inputClear:
|
|
289
|
+
declare const inputClear: 'input-clear';
|
|
227
290
|
|
|
228
|
-
declare const inputPaste:
|
|
291
|
+
declare const inputPaste: 'input-paste';
|
|
229
292
|
|
|
230
|
-
declare const inputPress:
|
|
293
|
+
declare const inputPress: 'input-press';
|
|
231
294
|
|
|
232
|
-
declare const itemPress:
|
|
295
|
+
declare const itemPress: 'item-press';
|
|
233
296
|
|
|
234
|
-
declare const keyboard:
|
|
297
|
+
declare const keyboard: 'keyboard';
|
|
235
298
|
|
|
236
|
-
declare const linkPress:
|
|
299
|
+
declare const linkPress: 'link-press';
|
|
237
300
|
|
|
238
|
-
declare const listNavigation:
|
|
301
|
+
declare const listNavigation: 'list-navigation';
|
|
239
302
|
|
|
240
|
-
declare const missing:
|
|
303
|
+
declare const missing: 'missing';
|
|
241
304
|
|
|
242
305
|
declare interface NativeButtonProps {
|
|
243
306
|
/**
|
|
@@ -249,11 +312,28 @@ declare interface NativeButtonProps {
|
|
|
249
312
|
nativeButton?: boolean | undefined;
|
|
250
313
|
}
|
|
251
314
|
|
|
252
|
-
declare const none:
|
|
315
|
+
declare const none: 'none';
|
|
253
316
|
|
|
254
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Present when the collapsible is open.
|
|
319
|
+
*/
|
|
320
|
+
declare const open_2 = "data-open";
|
|
255
321
|
|
|
256
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Present when the collapsible panel is open.
|
|
324
|
+
*/
|
|
325
|
+
declare const open_3 = "data-open";
|
|
326
|
+
|
|
327
|
+
declare const outsidePress: 'outside-press';
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Present when the collapsible panel is open.
|
|
331
|
+
*/
|
|
332
|
+
declare const panelOpen = "data-panel-open";
|
|
333
|
+
|
|
334
|
+
declare const pointer: 'pointer';
|
|
335
|
+
|
|
336
|
+
declare const popupClose: 'popup-close';
|
|
257
337
|
|
|
258
338
|
declare namespace REASONS {
|
|
259
339
|
export {
|
|
@@ -284,6 +364,7 @@ declare namespace REASONS {
|
|
|
284
364
|
drag,
|
|
285
365
|
wheel,
|
|
286
366
|
scrub,
|
|
367
|
+
popupClose,
|
|
287
368
|
cancelOpen,
|
|
288
369
|
siblingOpen,
|
|
289
370
|
disabled,
|
|
@@ -338,23 +419,34 @@ declare interface ReasonToEventMap {
|
|
|
338
419
|
[REASONS.windowResize]: UIEvent;
|
|
339
420
|
}
|
|
340
421
|
|
|
341
|
-
declare const scrub:
|
|
422
|
+
declare const scrub: 'scrub';
|
|
342
423
|
|
|
343
|
-
declare const siblingOpen:
|
|
424
|
+
declare const siblingOpen: 'sibling-open';
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Present when the collapsible begins animating in.
|
|
428
|
+
*/
|
|
429
|
+
declare const startingStyle = "data-starting-style";
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Present when the panel begins animating in.
|
|
433
|
+
*/
|
|
434
|
+
declare const startingStyle_2 = "data-starting-style";
|
|
344
435
|
|
|
345
|
-
declare const swipe:
|
|
436
|
+
declare const swipe: 'swipe';
|
|
346
437
|
|
|
347
|
-
declare const trackPress:
|
|
438
|
+
declare const trackPress: 'track-press';
|
|
348
439
|
|
|
349
440
|
declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
|
|
350
441
|
|
|
351
|
-
declare const triggerFocus:
|
|
442
|
+
declare const triggerFocus: 'trigger-focus';
|
|
352
443
|
|
|
353
|
-
declare const triggerHover:
|
|
444
|
+
declare const triggerHover: 'trigger-hover';
|
|
354
445
|
|
|
355
|
-
declare const triggerPress:
|
|
446
|
+
declare const triggerPress: 'trigger-press';
|
|
356
447
|
|
|
357
448
|
declare interface UseCollapsibleRootReturnValue {
|
|
449
|
+
defaultPanelId: React_2.HTMLAttributes<Element>['id'];
|
|
358
450
|
/**
|
|
359
451
|
* Whether the component should ignore user interaction.
|
|
360
452
|
*/
|
|
@@ -373,13 +465,13 @@ declare interface UseCollapsibleRootReturnValue {
|
|
|
373
465
|
panelId: React_2.HTMLAttributes<Element>['id'];
|
|
374
466
|
setMounted: (nextMounted: boolean) => void;
|
|
375
467
|
setOpen: (open: boolean) => void;
|
|
376
|
-
setPanelIdState:
|
|
468
|
+
setPanelIdState: React_2.Dispatch<React_2.SetStateAction<string | null | undefined>>;
|
|
377
469
|
transitionStatus: TransitionStatus;
|
|
378
470
|
}
|
|
379
471
|
|
|
380
|
-
declare const wheel:
|
|
472
|
+
declare const wheel: 'wheel';
|
|
381
473
|
|
|
382
|
-
declare const windowResize:
|
|
474
|
+
declare const windowResize: 'window-resize';
|
|
383
475
|
|
|
384
476
|
/**
|
|
385
477
|
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CollapsibleRootContext, useCollapsibleRootContext, collapsibleOpenStateMapping, triggerOpenStateMapping, useCollapsiblePanel, useCollapsibleRoot } from "../
|
|
3
|
-
import { transitionStatusMapping } from "../
|
|
4
|
-
import { useStableCallback } from "../
|
|
5
|
-
import { resolveStyle, useRenderElement, warn } from "../
|
|
6
|
-
import { useButton } from "../
|
|
7
|
-
import { useIsoLayoutEffect } from "../
|
|
2
|
+
import { CollapsibleRootContext, useCollapsibleRootContext, collapsibleOpenStateMapping, triggerOpenStateMapping, useCollapsiblePanel, useCollapsibleRoot } from "../8.js";
|
|
3
|
+
import { transitionStatusMapping } from "../8488.js";
|
|
4
|
+
import { useStableCallback } from "../7488.js";
|
|
5
|
+
import { resolveStyle, useRenderElement, warn } from "../9591.js";
|
|
6
|
+
import { useButton } from "../9248.js";
|
|
7
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
8
8
|
import * as __rspack_external_react from "react";
|
|
9
9
|
const collapsibleStateAttributesMapping = {
|
|
10
10
|
...collapsibleOpenStateMapping,
|
|
@@ -55,10 +55,9 @@ const stateAttributesMapping = {
|
|
|
55
55
|
};
|
|
56
56
|
const CollapsibleTrigger_CollapsibleTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
57
57
|
const { panelId, open, handleTrigger, state, disabled: contextDisabled } = useCollapsibleRootContext();
|
|
58
|
-
const { className, disabled = contextDisabled,
|
|
58
|
+
const { className, disabled = contextDisabled, render, nativeButton = true, style, ...elementProps } = componentProps;
|
|
59
59
|
const { getButtonProps, buttonRef } = useButton({
|
|
60
60
|
disabled,
|
|
61
|
-
focusableWhenDisabled: true,
|
|
62
61
|
native: nativeButton
|
|
63
62
|
});
|
|
64
63
|
const element = useRenderElement('button', componentProps, {
|
|
@@ -81,37 +80,34 @@ const CollapsibleTrigger_CollapsibleTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
81
80
|
return element;
|
|
82
81
|
});
|
|
83
82
|
if ("production" !== process.env.NODE_ENV) CollapsibleTrigger_CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
CollapsiblePanelCssVars["collapsiblePanelWidth"] = "--collapsible-panel-width";
|
|
87
|
-
return CollapsiblePanelCssVars;
|
|
88
|
-
}({});
|
|
83
|
+
const collapsiblePanelHeight = '--collapsible-panel-height';
|
|
84
|
+
const collapsiblePanelWidth = '--collapsible-panel-width';
|
|
89
85
|
const CollapsiblePanel_CollapsiblePanel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
90
86
|
const { className, hiddenUntilFound: hiddenUntilFoundProp, keepMounted: keepMountedProp, render, id: idProp, style, ...elementProps } = componentProps;
|
|
91
|
-
if ('production' !== process.env.NODE_ENV)
|
|
87
|
+
if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
|
|
92
88
|
if (hiddenUntilFoundProp && false === keepMountedProp) warn('The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.');
|
|
93
89
|
}, [
|
|
94
90
|
hiddenUntilFoundProp,
|
|
95
91
|
keepMountedProp
|
|
96
92
|
]);
|
|
97
|
-
const { mounted, onOpenChange, open,
|
|
93
|
+
const { defaultPanelId, mounted, onOpenChange, open, setMounted, setPanelIdState, setOpen, state, transitionStatus } = useCollapsibleRootContext();
|
|
98
94
|
const hiddenUntilFound = hiddenUntilFoundProp ?? false;
|
|
99
95
|
const keepMounted = keepMountedProp ?? false;
|
|
96
|
+
const registeredId = idProp || void 0;
|
|
97
|
+
const id = registeredId ?? defaultPanelId;
|
|
100
98
|
useIsoLayoutEffect(()=>{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
106
|
-
}
|
|
99
|
+
setPanelIdState((currentId)=>registeredId ?? (null === currentId ? void 0 : currentId));
|
|
100
|
+
return ()=>{
|
|
101
|
+
setPanelIdState((currentId)=>currentId === registeredId ? null : currentId);
|
|
102
|
+
};
|
|
107
103
|
}, [
|
|
108
|
-
|
|
104
|
+
registeredId,
|
|
109
105
|
setPanelIdState
|
|
110
106
|
]);
|
|
111
107
|
const { height, props, ref, shouldPreventOpenAnimation, shouldRender, transitionStatus: panelTransitionStatus, width } = useCollapsiblePanel({
|
|
112
108
|
externalRef: forwardedRef,
|
|
113
109
|
hiddenUntilFound,
|
|
114
|
-
id
|
|
110
|
+
id,
|
|
115
111
|
keepMounted,
|
|
116
112
|
mounted,
|
|
117
113
|
onOpenChange,
|
|
@@ -135,8 +131,8 @@ const CollapsiblePanel_CollapsiblePanel = /*#__PURE__*/ __rspack_external_react.
|
|
|
135
131
|
props,
|
|
136
132
|
{
|
|
137
133
|
style: {
|
|
138
|
-
[
|
|
139
|
-
[
|
|
134
|
+
[collapsiblePanelHeight]: void 0 === height ? 'auto' : `${height}px`,
|
|
135
|
+
[collapsiblePanelWidth]: void 0 === width ? 'auto' : `${width}px`
|
|
140
136
|
}
|
|
141
137
|
},
|
|
142
138
|
elementProps,
|