@wix/site-ui 1.347.0 → 1.349.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
package/dist/Checkbox/index.js
CHANGED
|
@@ -1,11 +1,295 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useLabelableContext, fieldValidityMapping, useFieldRootContext } from "../201.js";
|
|
4
|
+
import { utils_formatErrorMessage } from "../5473.js";
|
|
5
|
+
import { useFormContext } from "../9880.js";
|
|
6
|
+
import { useFieldItemContext } from "../1068.js";
|
|
7
|
+
import { useCheckboxGroupContext } from "../4226.js";
|
|
8
|
+
import { useBaseUiId } from "../5969.js";
|
|
9
|
+
import { useLabelableId } from "../6551.js";
|
|
10
|
+
import { useSetFieldFocused } from "../5890.js";
|
|
11
|
+
import { dispatchClickWithModifiers, useButton } from "../9248.js";
|
|
12
|
+
import { useControlled } from "../6006.js";
|
|
13
|
+
import { useRegisterFieldControl } from "../6140.js";
|
|
14
|
+
import { EMPTY_OBJECT, mergeProps, useMergedRefs, useRenderElement } from "../9591.js";
|
|
15
|
+
import { useAriaLabelledBy } from "../6373.js";
|
|
16
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
17
|
+
import { useValueChanged } from "../9252.js";
|
|
18
|
+
import { visuallyHiddenInput, visuallyHidden } from "../6540.js";
|
|
19
|
+
import { createChangeEventDetails } from "../8495.js";
|
|
20
|
+
import { getWindow } from "../3829.js";
|
|
21
|
+
import { useTransitionStatus } from "../7542.js";
|
|
22
|
+
import { useOpenChangeComplete } from "../6620.js";
|
|
23
|
+
import { transitionStatusMapping } from "../8488.js";
|
|
8
24
|
import * as __rspack_external_react from "react";
|
|
25
|
+
function getDefaultFormSubmitter(form) {
|
|
26
|
+
if (!form) return null;
|
|
27
|
+
for (const candidate of form.elements){
|
|
28
|
+
const tagName = candidate.tagName;
|
|
29
|
+
if ('BUTTON' === tagName || 'INPUT' === tagName) {
|
|
30
|
+
const button = candidate;
|
|
31
|
+
if ('submit' === button.type) return button;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const CheckboxRootDataAttributes_checked = 'data-checked';
|
|
37
|
+
const unchecked = 'data-unchecked';
|
|
38
|
+
function getCheckboxStateAttributesMapping(state) {
|
|
39
|
+
return {
|
|
40
|
+
checked (value) {
|
|
41
|
+
if (state.indeterminate) return {};
|
|
42
|
+
if (value) return {
|
|
43
|
+
[CheckboxRootDataAttributes_checked]: ''
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
[unchecked]: ''
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
...fieldValidityMapping
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const CheckboxRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
53
|
+
if ("production" !== process.env.NODE_ENV) CheckboxRootContext.displayName = "CheckboxRootContext";
|
|
54
|
+
function useCheckboxRootContext() {
|
|
55
|
+
const context = __rspack_external_react.useContext(CheckboxRootContext);
|
|
56
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.' : utils_formatErrorMessage(14));
|
|
57
|
+
return context;
|
|
58
|
+
}
|
|
59
|
+
const PARENT_CHECKBOX = 'data-parent';
|
|
60
|
+
const CheckboxRoot_CheckboxRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
61
|
+
const { checked: checkedProp, className, defaultChecked = false, 'aria-labelledby': ariaLabelledByProp, disabled: disabledProp = false, form, id: idProp, indeterminate = false, inputRef: inputRefProp, name: nameProp, onCheckedChange, parent = false, readOnly = false, render, required = false, uncheckedValue, value: valueProp, nativeButton = false, style, ...elementProps } = componentProps;
|
|
62
|
+
const { clearErrors } = useFormContext();
|
|
63
|
+
const { disabled: rootDisabled, name: fieldName, setDirty, setFilled, setTouched, state: fieldState, validationMode, validityData, validation: localValidation } = useFieldRootContext();
|
|
64
|
+
const fieldItemContext = useFieldItemContext();
|
|
65
|
+
const { labelId, registerControlId, getDescriptionProps } = useLabelableContext();
|
|
66
|
+
const groupContext = useCheckboxGroupContext();
|
|
67
|
+
const parentContext = groupContext?.allValues === void 0 ? void 0 : groupContext.parent;
|
|
68
|
+
const isGroupedWithParent = void 0 !== parentContext;
|
|
69
|
+
const disabled = rootDisabled || fieldItemContext.disabled || groupContext?.disabled || disabledProp;
|
|
70
|
+
const name = fieldName ?? nameProp;
|
|
71
|
+
const value = valueProp ?? name;
|
|
72
|
+
const id = useBaseUiId();
|
|
73
|
+
const ownsControlId = groupContext?.registerControlId !== registerControlId;
|
|
74
|
+
const controlId = useLabelableId({
|
|
75
|
+
id: idProp || void 0,
|
|
76
|
+
enabled: ownsControlId
|
|
77
|
+
});
|
|
78
|
+
const rootId = nativeButton ? controlId : id;
|
|
79
|
+
let groupProps = {};
|
|
80
|
+
if (isGroupedWithParent) {
|
|
81
|
+
if (parent) groupProps = parentContext.getParentProps();
|
|
82
|
+
else if (void 0 !== value) groupProps = parentContext.getChildProps(value);
|
|
83
|
+
}
|
|
84
|
+
const { checked: groupChecked = checkedProp, indeterminate: groupIndeterminate = indeterminate, onCheckedChange: groupOnChange, ...otherGroupProps } = groupProps;
|
|
85
|
+
const groupValue = groupContext?.value;
|
|
86
|
+
const controlRef = __rspack_external_react.useRef(null);
|
|
87
|
+
const setFocused = useSetFieldFocused(disabled, controlRef);
|
|
88
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
89
|
+
disabled,
|
|
90
|
+
native: nativeButton
|
|
91
|
+
});
|
|
92
|
+
const validation = groupContext?.validation ?? localValidation;
|
|
93
|
+
const [checked, setCheckedState] = useControlled({
|
|
94
|
+
controlled: void 0 === value || void 0 === groupValue || parent ? groupChecked : groupValue.includes(value),
|
|
95
|
+
default: defaultChecked,
|
|
96
|
+
name: 'Checkbox',
|
|
97
|
+
state: 'checked'
|
|
98
|
+
});
|
|
99
|
+
const computedChecked = isGroupedWithParent ? Boolean(groupChecked) : checked;
|
|
100
|
+
const computedIndeterminate = isGroupedWithParent ? groupIndeterminate || indeterminate : indeterminate;
|
|
101
|
+
useRegisterFieldControl(controlRef, id, checked, void 0, !groupContext && !disabled, nameProp);
|
|
102
|
+
const registerChildId = parentContext?.registerChildId;
|
|
103
|
+
const inputRef = __rspack_external_react.useRef(null);
|
|
104
|
+
const registerFieldInput = validation.registerInput;
|
|
105
|
+
const registeredInputValue = groupContext ? value : void 0;
|
|
106
|
+
const registerInput = __rspack_external_react.useCallback((element)=>registerFieldInput(element, {
|
|
107
|
+
controlRef,
|
|
108
|
+
value: registeredInputValue
|
|
109
|
+
}), [
|
|
110
|
+
registerFieldInput,
|
|
111
|
+
registeredInputValue
|
|
112
|
+
]);
|
|
113
|
+
const mergedInputRef = useMergedRefs(inputRefProp, inputRef, parent ? void 0 : registerInput);
|
|
114
|
+
const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, controlId, elementProps['aria-label']);
|
|
115
|
+
useIsoLayoutEffect(()=>{
|
|
116
|
+
if (inputRef.current) inputRef.current.indeterminate = computedIndeterminate;
|
|
117
|
+
if (!groupContext) setFilled(checked);
|
|
118
|
+
}, [
|
|
119
|
+
checked,
|
|
120
|
+
computedIndeterminate,
|
|
121
|
+
groupContext,
|
|
122
|
+
setFilled
|
|
123
|
+
]);
|
|
124
|
+
useValueChanged(checked, ()=>{
|
|
125
|
+
if (groupContext) return;
|
|
126
|
+
clearErrors(name);
|
|
127
|
+
setDirty(checked !== validityData.initialValue);
|
|
128
|
+
validation.change(checked);
|
|
129
|
+
});
|
|
130
|
+
const inputProps = mergeProps({
|
|
131
|
+
checked,
|
|
132
|
+
disabled,
|
|
133
|
+
form,
|
|
134
|
+
name: parent ? void 0 : name,
|
|
135
|
+
id: nativeButton ? void 0 : controlId,
|
|
136
|
+
required,
|
|
137
|
+
ref: mergedInputRef,
|
|
138
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
139
|
+
tabIndex: -1,
|
|
140
|
+
type: 'checkbox',
|
|
141
|
+
'aria-hidden': true,
|
|
142
|
+
onChange (event) {
|
|
143
|
+
if (event.nativeEvent.defaultPrevented) return;
|
|
144
|
+
if (readOnly) return void event.preventDefault();
|
|
145
|
+
const nextChecked = event.currentTarget.checked;
|
|
146
|
+
const details = createChangeEventDetails("none", event.nativeEvent);
|
|
147
|
+
onCheckedChange?.(nextChecked, details);
|
|
148
|
+
if (details.isCanceled) return;
|
|
149
|
+
groupOnChange?.(nextChecked, details);
|
|
150
|
+
if (details.isCanceled) return;
|
|
151
|
+
setCheckedState(nextChecked);
|
|
152
|
+
if (void 0 !== value && void 0 !== groupContext && !parent && !isGroupedWithParent) {
|
|
153
|
+
const nextGroupValue = nextChecked ? [
|
|
154
|
+
...groupContext.value,
|
|
155
|
+
value
|
|
156
|
+
] : groupContext.value.filter((item)=>item !== value);
|
|
157
|
+
groupContext.setValue(nextGroupValue, details);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
onClick (event) {
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
},
|
|
163
|
+
onFocus () {
|
|
164
|
+
controlRef.current?.focus();
|
|
165
|
+
}
|
|
166
|
+
}, void 0 !== valueProp ? {
|
|
167
|
+
value: (groupContext ? checked && valueProp : valueProp) || ''
|
|
168
|
+
} : EMPTY_OBJECT, getDescriptionProps, (props)=>validation.getValidationProps(disabled, props));
|
|
169
|
+
__rspack_external_react.useEffect(()=>{
|
|
170
|
+
if (!parentContext || void 0 === value) return;
|
|
171
|
+
const disabledStates = parentContext.disabledStatesRef.current;
|
|
172
|
+
disabledStates.set(value, disabled);
|
|
173
|
+
return ()=>{
|
|
174
|
+
disabledStates.delete(value);
|
|
175
|
+
};
|
|
176
|
+
}, [
|
|
177
|
+
parentContext,
|
|
178
|
+
disabled,
|
|
179
|
+
value
|
|
180
|
+
]);
|
|
181
|
+
const state = __rspack_external_react.useMemo(()=>({
|
|
182
|
+
...fieldState,
|
|
183
|
+
checked: computedChecked,
|
|
184
|
+
disabled,
|
|
185
|
+
readOnly,
|
|
186
|
+
required,
|
|
187
|
+
indeterminate: computedIndeterminate
|
|
188
|
+
}), [
|
|
189
|
+
fieldState,
|
|
190
|
+
computedChecked,
|
|
191
|
+
disabled,
|
|
192
|
+
readOnly,
|
|
193
|
+
required,
|
|
194
|
+
computedIndeterminate
|
|
195
|
+
]);
|
|
196
|
+
const stateAttributesMapping = getCheckboxStateAttributesMapping(state);
|
|
197
|
+
const element = useRenderElement('span', componentProps, {
|
|
198
|
+
state,
|
|
199
|
+
ref: [
|
|
200
|
+
buttonRef,
|
|
201
|
+
controlRef,
|
|
202
|
+
forwardedRef
|
|
203
|
+
],
|
|
204
|
+
props: [
|
|
205
|
+
{
|
|
206
|
+
id: rootId,
|
|
207
|
+
role: 'checkbox',
|
|
208
|
+
'aria-checked': computedIndeterminate ? 'mixed' : computedChecked,
|
|
209
|
+
'aria-readonly': readOnly || void 0,
|
|
210
|
+
'aria-required': required || void 0,
|
|
211
|
+
'aria-labelledby': ariaLabelledBy,
|
|
212
|
+
[PARENT_CHECKBOX]: parent ? '' : void 0,
|
|
213
|
+
onFocus () {
|
|
214
|
+
setFocused(true);
|
|
215
|
+
},
|
|
216
|
+
onBlur () {
|
|
217
|
+
const inputEl = inputRef.current;
|
|
218
|
+
if (!inputEl) return;
|
|
219
|
+
setTouched(true);
|
|
220
|
+
setFocused(false);
|
|
221
|
+
if ('onBlur' === validationMode) validation.commit(groupContext ? groupValue : inputEl.checked);
|
|
222
|
+
},
|
|
223
|
+
onKeyDown (event) {
|
|
224
|
+
if ('Enter' !== event.key) return;
|
|
225
|
+
event.preventBaseUIHandler();
|
|
226
|
+
if (event.defaultPrevented) return;
|
|
227
|
+
const formToSubmit = inputRef.current?.form ?? null;
|
|
228
|
+
const currentTarget = event.currentTarget;
|
|
229
|
+
const nativeEvent = event.nativeEvent;
|
|
230
|
+
const originalPreventDefault = event.preventDefault;
|
|
231
|
+
const originalNativePreventDefault = nativeEvent.preventDefault;
|
|
232
|
+
let preventDefaultCalledAfterPropagation = false;
|
|
233
|
+
event.preventDefault = ()=>{
|
|
234
|
+
preventDefaultCalledAfterPropagation = true;
|
|
235
|
+
originalPreventDefault.call(event);
|
|
236
|
+
};
|
|
237
|
+
nativeEvent.preventDefault = ()=>{
|
|
238
|
+
preventDefaultCalledAfterPropagation = true;
|
|
239
|
+
originalNativePreventDefault.call(nativeEvent);
|
|
240
|
+
};
|
|
241
|
+
originalNativePreventDefault.call(nativeEvent);
|
|
242
|
+
getWindow(currentTarget).queueMicrotask(()=>{
|
|
243
|
+
event.preventDefault = originalPreventDefault;
|
|
244
|
+
nativeEvent.preventDefault = originalNativePreventDefault;
|
|
245
|
+
if (!preventDefaultCalledAfterPropagation) getDefaultFormSubmitter(formToSubmit)?.click();
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
onClick (event) {
|
|
249
|
+
if (readOnly || disabled) return;
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
const input = inputRef.current;
|
|
252
|
+
if (!input) return;
|
|
253
|
+
dispatchClickWithModifiers(input, event);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
elementProps,
|
|
257
|
+
otherGroupProps,
|
|
258
|
+
getButtonProps,
|
|
259
|
+
getDescriptionProps,
|
|
260
|
+
(props)=>validation.getValidationProps(disabled, props)
|
|
261
|
+
],
|
|
262
|
+
stateAttributesMapping
|
|
263
|
+
});
|
|
264
|
+
const renderedId = element.props.id;
|
|
265
|
+
useIsoLayoutEffect(()=>{
|
|
266
|
+
if (!registerChildId || parent || void 0 === value || void 0 === renderedId) return;
|
|
267
|
+
return registerChildId(value, renderedId);
|
|
268
|
+
}, [
|
|
269
|
+
registerChildId,
|
|
270
|
+
parent,
|
|
271
|
+
value,
|
|
272
|
+
renderedId
|
|
273
|
+
]);
|
|
274
|
+
return /*#__PURE__*/ jsxs(CheckboxRootContext.Provider, {
|
|
275
|
+
value: state,
|
|
276
|
+
children: [
|
|
277
|
+
element,
|
|
278
|
+
!checked && !groupContext && name && !parent && void 0 !== uncheckedValue && /*#__PURE__*/ jsx("input", {
|
|
279
|
+
type: "hidden",
|
|
280
|
+
form: form,
|
|
281
|
+
name: name,
|
|
282
|
+
value: uncheckedValue,
|
|
283
|
+
disabled: disabled
|
|
284
|
+
}),
|
|
285
|
+
/*#__PURE__*/ jsx("input", {
|
|
286
|
+
...inputProps,
|
|
287
|
+
suppressHydrationWarning: true
|
|
288
|
+
})
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
if ("production" !== process.env.NODE_ENV) CheckboxRoot_CheckboxRoot.displayName = "CheckboxRoot";
|
|
9
293
|
const CheckboxIndicator_CheckboxIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
10
294
|
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
11
295
|
const rootState = useCheckboxRootContext();
|
|
@@ -17,17 +301,18 @@ const CheckboxIndicator_CheckboxIndicator = /*#__PURE__*/ __rspack_external_reac
|
|
|
17
301
|
transitionStatus
|
|
18
302
|
};
|
|
19
303
|
useOpenChangeComplete({
|
|
304
|
+
batch: true,
|
|
305
|
+
enabled: !rendered,
|
|
20
306
|
open: rendered,
|
|
21
307
|
ref: indicatorRef,
|
|
22
308
|
onComplete () {
|
|
23
309
|
if (!rendered) setMounted(false);
|
|
24
310
|
}
|
|
25
311
|
});
|
|
26
|
-
const baseStateAttributesMapping =
|
|
312
|
+
const baseStateAttributesMapping = getCheckboxStateAttributesMapping(rootState);
|
|
27
313
|
const stateAttributesMapping = {
|
|
28
314
|
...baseStateAttributesMapping,
|
|
29
|
-
...transitionStatusMapping
|
|
30
|
-
...fieldValidityMapping
|
|
315
|
+
...transitionStatusMapping
|
|
31
316
|
};
|
|
32
317
|
const shouldRender = keepMounted || mounted;
|
|
33
318
|
const element = useRenderElement('span', componentProps, {
|
|
@@ -65,7 +65,7 @@ declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E &
|
|
|
65
65
|
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
declare const cancelOpen:
|
|
68
|
+
declare const cancelOpen: 'cancel-open';
|
|
69
69
|
|
|
70
70
|
export declare namespace Checkbox {
|
|
71
71
|
export {
|
|
@@ -220,7 +220,8 @@ declare interface CheckboxRootProps extends NonNativeButtonProps, Omit<BaseUICom
|
|
|
220
220
|
*/
|
|
221
221
|
uncheckedValue?: string | undefined;
|
|
222
222
|
/**
|
|
223
|
-
* The value
|
|
223
|
+
* The checkbox's value. Identifies it within a [Checkbox Group](https://base-ui.com/react/components/checkbox-group), falling back to `name` when omitted.
|
|
224
|
+
* When submitting a form, a checked box submits `value`; with no `value`, it submits the native "on".
|
|
224
225
|
*/
|
|
225
226
|
value?: string | undefined;
|
|
226
227
|
}
|
|
@@ -248,13 +249,13 @@ declare interface CheckboxRootState extends FieldRootState {
|
|
|
248
249
|
indeterminate: boolean;
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
declare const chipRemovePress:
|
|
252
|
+
declare const chipRemovePress: 'chip-remove-press';
|
|
252
253
|
|
|
253
|
-
declare const clearPress:
|
|
254
|
+
declare const clearPress: 'clear-press';
|
|
254
255
|
|
|
255
|
-
declare const closePress:
|
|
256
|
+
declare const closePress: 'close-press';
|
|
256
257
|
|
|
257
|
-
declare const closeWatcher:
|
|
258
|
+
declare const closeWatcher: 'close-watcher';
|
|
258
259
|
|
|
259
260
|
/**
|
|
260
261
|
* Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
|
|
@@ -264,13 +265,13 @@ declare const closeWatcher: "close-watcher";
|
|
|
264
265
|
*/
|
|
265
266
|
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
266
267
|
|
|
267
|
-
declare const decrementPress:
|
|
268
|
+
declare const decrementPress: 'decrement-press';
|
|
268
269
|
|
|
269
|
-
declare const disabled:
|
|
270
|
+
declare const disabled: 'disabled';
|
|
270
271
|
|
|
271
|
-
declare const drag:
|
|
272
|
+
declare const drag: 'drag';
|
|
272
273
|
|
|
273
|
-
declare const escapeKey:
|
|
274
|
+
declare const escapeKey: 'escape-key';
|
|
274
275
|
|
|
275
276
|
declare interface FieldRootState {
|
|
276
277
|
/**
|
|
@@ -299,39 +300,39 @@ declare interface FieldRootState {
|
|
|
299
300
|
focused: boolean;
|
|
300
301
|
}
|
|
301
302
|
|
|
302
|
-
declare const focusOut:
|
|
303
|
+
declare const focusOut: 'focus-out';
|
|
303
304
|
|
|
304
305
|
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
305
306
|
ref?: React_2.Ref<T> | undefined;
|
|
306
307
|
};
|
|
307
308
|
|
|
308
|
-
declare const imperativeAction:
|
|
309
|
+
declare const imperativeAction: 'imperative-action';
|
|
309
310
|
|
|
310
|
-
declare const incrementPress:
|
|
311
|
+
declare const incrementPress: 'increment-press';
|
|
311
312
|
|
|
312
|
-
declare const initial:
|
|
313
|
+
declare const initial: 'initial';
|
|
313
314
|
|
|
314
|
-
declare const inputBlur:
|
|
315
|
+
declare const inputBlur: 'input-blur';
|
|
315
316
|
|
|
316
|
-
declare const inputChange:
|
|
317
|
+
declare const inputChange: 'input-change';
|
|
317
318
|
|
|
318
|
-
declare const inputClear:
|
|
319
|
+
declare const inputClear: 'input-clear';
|
|
319
320
|
|
|
320
|
-
declare const inputPaste:
|
|
321
|
+
declare const inputPaste: 'input-paste';
|
|
321
322
|
|
|
322
|
-
declare const inputPress:
|
|
323
|
+
declare const inputPress: 'input-press';
|
|
323
324
|
|
|
324
|
-
declare const itemPress:
|
|
325
|
+
declare const itemPress: 'item-press';
|
|
325
326
|
|
|
326
|
-
declare const keyboard:
|
|
327
|
+
declare const keyboard: 'keyboard';
|
|
327
328
|
|
|
328
|
-
declare const linkPress:
|
|
329
|
+
declare const linkPress: 'link-press';
|
|
329
330
|
|
|
330
|
-
declare const listNavigation:
|
|
331
|
+
declare const listNavigation: 'list-navigation';
|
|
331
332
|
|
|
332
|
-
declare const missing:
|
|
333
|
+
declare const missing: 'missing';
|
|
333
334
|
|
|
334
|
-
declare const none:
|
|
335
|
+
declare const none: 'none';
|
|
335
336
|
|
|
336
337
|
declare interface NonNativeButtonProps {
|
|
337
338
|
/**
|
|
@@ -343,9 +344,11 @@ declare interface NonNativeButtonProps {
|
|
|
343
344
|
nativeButton?: boolean | undefined;
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
declare const outsidePress:
|
|
347
|
+
declare const outsidePress: 'outside-press';
|
|
347
348
|
|
|
348
|
-
declare const pointer:
|
|
349
|
+
declare const pointer: 'pointer';
|
|
350
|
+
|
|
351
|
+
declare const popupClose: 'popup-close';
|
|
349
352
|
|
|
350
353
|
declare namespace REASONS {
|
|
351
354
|
export {
|
|
@@ -376,6 +379,7 @@ declare namespace REASONS {
|
|
|
376
379
|
drag,
|
|
377
380
|
wheel,
|
|
378
381
|
scrub,
|
|
382
|
+
popupClose,
|
|
379
383
|
cancelOpen,
|
|
380
384
|
siblingOpen,
|
|
381
385
|
disabled,
|
|
@@ -434,25 +438,25 @@ declare type RootProps = WithStringClassName<React_2.ComponentPropsWithoutRef<ty
|
|
|
434
438
|
size?: number;
|
|
435
439
|
};
|
|
436
440
|
|
|
437
|
-
declare const scrub:
|
|
441
|
+
declare const scrub: 'scrub';
|
|
438
442
|
|
|
439
|
-
declare const siblingOpen:
|
|
443
|
+
declare const siblingOpen: 'sibling-open';
|
|
440
444
|
|
|
441
|
-
declare const swipe:
|
|
445
|
+
declare const swipe: 'swipe';
|
|
442
446
|
|
|
443
|
-
declare const trackPress:
|
|
447
|
+
declare const trackPress: 'track-press';
|
|
444
448
|
|
|
445
449
|
declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
|
|
446
450
|
|
|
447
|
-
declare const triggerFocus:
|
|
451
|
+
declare const triggerFocus: 'trigger-focus';
|
|
448
452
|
|
|
449
|
-
declare const triggerHover:
|
|
453
|
+
declare const triggerHover: 'trigger-hover';
|
|
450
454
|
|
|
451
|
-
declare const triggerPress:
|
|
455
|
+
declare const triggerPress: 'trigger-press';
|
|
452
456
|
|
|
453
|
-
declare const wheel:
|
|
457
|
+
declare const wheel: 'wheel';
|
|
454
458
|
|
|
455
|
-
declare const windowResize:
|
|
459
|
+
declare const windowResize: 'window-resize';
|
|
456
460
|
|
|
457
461
|
/**
|
|
458
462
|
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
@@ -66,7 +66,7 @@ declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E &
|
|
|
66
66
|
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
declare const cancelOpen:
|
|
69
|
+
declare const cancelOpen: 'cancel-open';
|
|
70
70
|
|
|
71
71
|
export declare const CheckboxGroup: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CheckboxGroupProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
72
72
|
className?: string;
|
|
@@ -90,6 +90,12 @@ export declare type CheckboxGroupChangeEventDetails = BaseUIChangeEventDetails<C
|
|
|
90
90
|
|
|
91
91
|
export declare type CheckboxGroupChangeEventReason = typeof REASONS.none;
|
|
92
92
|
|
|
93
|
+
export declare namespace CheckboxGroupDataAttributes {
|
|
94
|
+
export {
|
|
95
|
+
disabled
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
export declare interface CheckboxGroupProps extends BaseUIComponentProps<'div', CheckboxGroupState> {
|
|
94
100
|
/**
|
|
95
101
|
* Names of the checkboxes in the group that should be ticked.
|
|
@@ -126,13 +132,13 @@ export declare interface CheckboxGroupState extends FieldRootState {
|
|
|
126
132
|
disabled: boolean;
|
|
127
133
|
}
|
|
128
134
|
|
|
129
|
-
declare const chipRemovePress:
|
|
135
|
+
declare const chipRemovePress: 'chip-remove-press';
|
|
130
136
|
|
|
131
|
-
declare const clearPress:
|
|
137
|
+
declare const clearPress: 'clear-press';
|
|
132
138
|
|
|
133
|
-
declare const closePress:
|
|
139
|
+
declare const closePress: 'close-press';
|
|
134
140
|
|
|
135
|
-
declare const closeWatcher:
|
|
141
|
+
declare const closeWatcher: 'close-watcher';
|
|
136
142
|
|
|
137
143
|
/**
|
|
138
144
|
* Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
|
|
@@ -142,13 +148,18 @@ declare const closeWatcher: "close-watcher";
|
|
|
142
148
|
*/
|
|
143
149
|
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
144
150
|
|
|
145
|
-
declare const decrementPress:
|
|
151
|
+
declare const decrementPress: 'decrement-press';
|
|
146
152
|
|
|
147
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Present when the checkbox group is disabled.
|
|
155
|
+
*/
|
|
156
|
+
declare const disabled = "data-disabled";
|
|
148
157
|
|
|
149
|
-
declare const
|
|
158
|
+
declare const disabled_2: 'disabled';
|
|
150
159
|
|
|
151
|
-
declare const
|
|
160
|
+
declare const drag: 'drag';
|
|
161
|
+
|
|
162
|
+
declare const escapeKey: 'escape-key';
|
|
152
163
|
|
|
153
164
|
declare interface FieldRootState {
|
|
154
165
|
/**
|
|
@@ -177,43 +188,45 @@ declare interface FieldRootState {
|
|
|
177
188
|
focused: boolean;
|
|
178
189
|
}
|
|
179
190
|
|
|
180
|
-
declare const focusOut:
|
|
191
|
+
declare const focusOut: 'focus-out';
|
|
181
192
|
|
|
182
193
|
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
183
194
|
ref?: React_2.Ref<T> | undefined;
|
|
184
195
|
};
|
|
185
196
|
|
|
186
|
-
declare const imperativeAction:
|
|
197
|
+
declare const imperativeAction: 'imperative-action';
|
|
198
|
+
|
|
199
|
+
declare const incrementPress: 'increment-press';
|
|
187
200
|
|
|
188
|
-
declare const
|
|
201
|
+
declare const initial: 'initial';
|
|
189
202
|
|
|
190
|
-
declare const
|
|
203
|
+
declare const inputBlur: 'input-blur';
|
|
191
204
|
|
|
192
|
-
declare const
|
|
205
|
+
declare const inputChange: 'input-change';
|
|
193
206
|
|
|
194
|
-
declare const
|
|
207
|
+
declare const inputClear: 'input-clear';
|
|
195
208
|
|
|
196
|
-
declare const
|
|
209
|
+
declare const inputPaste: 'input-paste';
|
|
197
210
|
|
|
198
|
-
declare const
|
|
211
|
+
declare const inputPress: 'input-press';
|
|
199
212
|
|
|
200
|
-
declare const
|
|
213
|
+
declare const itemPress: 'item-press';
|
|
201
214
|
|
|
202
|
-
declare const
|
|
215
|
+
declare const keyboard: 'keyboard';
|
|
203
216
|
|
|
204
|
-
declare const
|
|
217
|
+
declare const linkPress: 'link-press';
|
|
205
218
|
|
|
206
|
-
declare const
|
|
219
|
+
declare const listNavigation: 'list-navigation';
|
|
207
220
|
|
|
208
|
-
declare const
|
|
221
|
+
declare const missing: 'missing';
|
|
209
222
|
|
|
210
|
-
declare const
|
|
223
|
+
declare const none: 'none';
|
|
211
224
|
|
|
212
|
-
declare const
|
|
225
|
+
declare const outsidePress: 'outside-press';
|
|
213
226
|
|
|
214
|
-
declare const
|
|
227
|
+
declare const pointer: 'pointer';
|
|
215
228
|
|
|
216
|
-
declare const
|
|
229
|
+
declare const popupClose: 'popup-close';
|
|
217
230
|
|
|
218
231
|
declare namespace REASONS {
|
|
219
232
|
export {
|
|
@@ -244,9 +257,10 @@ declare namespace REASONS {
|
|
|
244
257
|
drag,
|
|
245
258
|
wheel,
|
|
246
259
|
scrub,
|
|
260
|
+
popupClose,
|
|
247
261
|
cancelOpen,
|
|
248
262
|
siblingOpen,
|
|
249
|
-
disabled,
|
|
263
|
+
disabled_2 as disabled,
|
|
250
264
|
missing,
|
|
251
265
|
initial,
|
|
252
266
|
imperativeAction,
|
|
@@ -298,23 +312,23 @@ declare interface ReasonToEventMap {
|
|
|
298
312
|
[REASONS.windowResize]: UIEvent;
|
|
299
313
|
}
|
|
300
314
|
|
|
301
|
-
declare const scrub:
|
|
315
|
+
declare const scrub: 'scrub';
|
|
302
316
|
|
|
303
|
-
declare const siblingOpen:
|
|
317
|
+
declare const siblingOpen: 'sibling-open';
|
|
304
318
|
|
|
305
|
-
declare const swipe:
|
|
319
|
+
declare const swipe: 'swipe';
|
|
306
320
|
|
|
307
|
-
declare const trackPress:
|
|
321
|
+
declare const trackPress: 'track-press';
|
|
308
322
|
|
|
309
|
-
declare const triggerFocus:
|
|
323
|
+
declare const triggerFocus: 'trigger-focus';
|
|
310
324
|
|
|
311
|
-
declare const triggerHover:
|
|
325
|
+
declare const triggerHover: 'trigger-hover';
|
|
312
326
|
|
|
313
|
-
declare const triggerPress:
|
|
327
|
+
declare const triggerPress: 'trigger-press';
|
|
314
328
|
|
|
315
|
-
declare const wheel:
|
|
329
|
+
declare const wheel: 'wheel';
|
|
316
330
|
|
|
317
|
-
declare const windowResize:
|
|
331
|
+
declare const windowResize: 'window-resize';
|
|
318
332
|
|
|
319
333
|
/**
|
|
320
334
|
* Adds a `preventBaseUIHandler` method to all event handlers.
|