@wix/site-ui 1.29.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/Badge/index.css +44 -0
- package/dist/Badge/index.d.ts +22 -0
- package/dist/Badge/index.js +23 -0
- 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 +12758 -646
- package/dist/index.js +1 -0
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Radio/index.js
CHANGED
|
@@ -1,7 +1,254 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Radio } from "@base-ui/react/radio";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { NOOP, EMPTY_OBJECT, useMergedRefs, useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
4
|
+
import { transitionStatusMapping, useOpenChangeComplete, useTransitionStatus } from "../880.js";
|
|
5
|
+
import { useLabelableContext, fieldValidityMapping, useFieldRootContext } from "../1477.js";
|
|
6
|
+
import { useRadioGroupContext } from "../1279.js";
|
|
7
|
+
import { useFieldItemContext } from "../1457.js";
|
|
8
|
+
import { useStableCallback } from "../7541.js";
|
|
9
|
+
import { useIsoLayoutEffect } from "../6499.js";
|
|
10
|
+
import { useBaseUiId } from "../6046.js";
|
|
11
|
+
import { useLabelableId } from "../9048.js";
|
|
12
|
+
import { useAriaLabelledBy } from "../4490.js";
|
|
13
|
+
import { ACTIVE_COMPOSITE_ITEM } from "../4346.js";
|
|
14
|
+
import { getWindow } from "../3829.js";
|
|
15
|
+
import { useButton } from "../9189.js";
|
|
16
|
+
import { visuallyHiddenInput, visuallyHidden } from "../8225.js";
|
|
17
|
+
import { serializeValue } from "../5778.js";
|
|
18
|
+
import { createChangeEventDetails } from "../4768.js";
|
|
19
|
+
import { CompositeItem } from "../951.js";
|
|
4
20
|
import * as __rspack_external_react from "react";
|
|
21
|
+
const RadioRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
22
|
+
if ("production" !== process.env.NODE_ENV) RadioRootContext.displayName = "RadioRootContext";
|
|
23
|
+
function useRadioRootContext() {
|
|
24
|
+
const value = __rspack_external_react.useContext(RadioRootContext);
|
|
25
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: RadioRootContext is missing. Radio parts must be placed within <Radio.Root>.' : esm_formatErrorMessage(52));
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
let RadioRootDataAttributes_RadioRootDataAttributes = /*#__PURE__*/ function(RadioRootDataAttributes) {
|
|
29
|
+
RadioRootDataAttributes["checked"] = "data-checked";
|
|
30
|
+
RadioRootDataAttributes["unchecked"] = "data-unchecked";
|
|
31
|
+
RadioRootDataAttributes["disabled"] = "data-disabled";
|
|
32
|
+
RadioRootDataAttributes["readonly"] = "data-readonly";
|
|
33
|
+
RadioRootDataAttributes["required"] = "data-required";
|
|
34
|
+
RadioRootDataAttributes["valid"] = "data-valid";
|
|
35
|
+
RadioRootDataAttributes["invalid"] = "data-invalid";
|
|
36
|
+
RadioRootDataAttributes["touched"] = "data-touched";
|
|
37
|
+
RadioRootDataAttributes["dirty"] = "data-dirty";
|
|
38
|
+
RadioRootDataAttributes["filled"] = "data-filled";
|
|
39
|
+
RadioRootDataAttributes["focused"] = "data-focused";
|
|
40
|
+
return RadioRootDataAttributes;
|
|
41
|
+
}({});
|
|
42
|
+
const stateAttributesMapping = {
|
|
43
|
+
checked (value) {
|
|
44
|
+
if (value) return {
|
|
45
|
+
[RadioRootDataAttributes_RadioRootDataAttributes.checked]: ''
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
[RadioRootDataAttributes_RadioRootDataAttributes.unchecked]: ''
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
...transitionStatusMapping,
|
|
52
|
+
...fieldValidityMapping
|
|
53
|
+
};
|
|
54
|
+
const RadioIndicator_RadioIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
55
|
+
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
56
|
+
const rootState = useRadioRootContext();
|
|
57
|
+
const rendered = rootState.checked;
|
|
58
|
+
const { mounted, transitionStatus, setMounted } = useTransitionStatus(rendered);
|
|
59
|
+
const state = {
|
|
60
|
+
...rootState,
|
|
61
|
+
transitionStatus
|
|
62
|
+
};
|
|
63
|
+
const indicatorRef = __rspack_external_react.useRef(null);
|
|
64
|
+
const shouldRender = keepMounted || mounted;
|
|
65
|
+
const element = useRenderElement('span', componentProps, {
|
|
66
|
+
ref: [
|
|
67
|
+
forwardedRef,
|
|
68
|
+
indicatorRef
|
|
69
|
+
],
|
|
70
|
+
state,
|
|
71
|
+
props: elementProps,
|
|
72
|
+
stateAttributesMapping: stateAttributesMapping
|
|
73
|
+
});
|
|
74
|
+
useOpenChangeComplete({
|
|
75
|
+
open: rendered,
|
|
76
|
+
ref: indicatorRef,
|
|
77
|
+
onComplete () {
|
|
78
|
+
if (!rendered) setMounted(false);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
if (!shouldRender) return null;
|
|
82
|
+
return element;
|
|
83
|
+
});
|
|
84
|
+
if ("production" !== process.env.NODE_ENV) RadioIndicator_RadioIndicator.displayName = "RadioIndicator";
|
|
85
|
+
const RadioRoot_RadioRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
86
|
+
const { render, className, disabled: disabledProp = false, readOnly: readOnlyProp = false, required: requiredProp = false, 'aria-labelledby': ariaLabelledByProp, value, inputRef: inputRefProp, nativeButton = false, id: idProp, style, ...elementProps } = componentProps;
|
|
87
|
+
const groupContext = useRadioGroupContext();
|
|
88
|
+
const { disabled: disabledGroup, readOnly: readOnlyGroup, required: requiredGroup, form: formGroup, checkedValue, touched = false, validation, name } = groupContext ?? {};
|
|
89
|
+
const setCheckedValue = groupContext?.setCheckedValue ?? NOOP;
|
|
90
|
+
const setTouched = groupContext?.setTouched ?? NOOP;
|
|
91
|
+
const registerControlRef = groupContext?.registerControlRef ?? NOOP;
|
|
92
|
+
const registerInputRef = groupContext?.registerInputRef ?? NOOP;
|
|
93
|
+
const { setDirty, validityData, setTouched: setFieldTouched, setFilled, state: fieldState, disabled: fieldDisabled } = useFieldRootContext();
|
|
94
|
+
const fieldItemContext = useFieldItemContext();
|
|
95
|
+
const { labelId, getDescriptionProps } = useLabelableContext();
|
|
96
|
+
const disabled = fieldDisabled || fieldItemContext.disabled || disabledGroup || disabledProp;
|
|
97
|
+
const readOnly = readOnlyGroup || readOnlyProp;
|
|
98
|
+
const required = requiredGroup || requiredProp;
|
|
99
|
+
const form = formGroup;
|
|
100
|
+
const checked = groupContext ? checkedValue === value : '' === value;
|
|
101
|
+
const radioRef = __rspack_external_react.useRef(null);
|
|
102
|
+
const inputRef = __rspack_external_react.useRef(null);
|
|
103
|
+
const handleControlRef = useStableCallback((element)=>{
|
|
104
|
+
if (!element) return;
|
|
105
|
+
registerControlRef(element, disabled);
|
|
106
|
+
});
|
|
107
|
+
const mergedInputRef = useMergedRefs(inputRefProp, inputRef, registerInputRef);
|
|
108
|
+
useIsoLayoutEffect(()=>{
|
|
109
|
+
if (inputRef.current?.checked) setFilled(true);
|
|
110
|
+
}, [
|
|
111
|
+
setFilled
|
|
112
|
+
]);
|
|
113
|
+
useIsoLayoutEffect(()=>{
|
|
114
|
+
if (!inputRef.current) return;
|
|
115
|
+
if (disabled && checked) return void registerInputRef(null);
|
|
116
|
+
if (radioRef.current) registerControlRef(radioRef.current, disabled);
|
|
117
|
+
registerInputRef(inputRef.current);
|
|
118
|
+
}, [
|
|
119
|
+
checked,
|
|
120
|
+
disabled,
|
|
121
|
+
registerControlRef,
|
|
122
|
+
registerInputRef
|
|
123
|
+
]);
|
|
124
|
+
const id = useBaseUiId();
|
|
125
|
+
const inputId = useLabelableId({
|
|
126
|
+
id: idProp,
|
|
127
|
+
implicit: false,
|
|
128
|
+
controlRef: radioRef
|
|
129
|
+
});
|
|
130
|
+
const hiddenInputId = nativeButton ? void 0 : inputId;
|
|
131
|
+
const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId);
|
|
132
|
+
const rootProps = {
|
|
133
|
+
role: 'radio',
|
|
134
|
+
'aria-checked': checked,
|
|
135
|
+
'aria-required': required || void 0,
|
|
136
|
+
'aria-readonly': readOnly || void 0,
|
|
137
|
+
'aria-labelledby': ariaLabelledBy,
|
|
138
|
+
[ACTIVE_COMPOSITE_ITEM]: checked ? '' : void 0,
|
|
139
|
+
id: nativeButton ? inputId : id,
|
|
140
|
+
onKeyDown (event) {
|
|
141
|
+
if ('Enter' === event.key) event.preventDefault();
|
|
142
|
+
},
|
|
143
|
+
onClick (event) {
|
|
144
|
+
if (event.defaultPrevented || disabled || readOnly) return;
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
const input = inputRef.current;
|
|
147
|
+
if (!input) return;
|
|
148
|
+
input.dispatchEvent(new (getWindow(input)).PointerEvent('click', {
|
|
149
|
+
bubbles: true,
|
|
150
|
+
shiftKey: event.shiftKey,
|
|
151
|
+
ctrlKey: event.ctrlKey,
|
|
152
|
+
altKey: event.altKey,
|
|
153
|
+
metaKey: event.metaKey
|
|
154
|
+
}));
|
|
155
|
+
},
|
|
156
|
+
onFocus (event) {
|
|
157
|
+
if (event.defaultPrevented || disabled || readOnly || !touched) return;
|
|
158
|
+
inputRef.current?.click();
|
|
159
|
+
setTouched(false);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
163
|
+
disabled,
|
|
164
|
+
native: nativeButton
|
|
165
|
+
});
|
|
166
|
+
const inputProps = {
|
|
167
|
+
type: 'radio',
|
|
168
|
+
ref: mergedInputRef,
|
|
169
|
+
form,
|
|
170
|
+
id: hiddenInputId,
|
|
171
|
+
name,
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
174
|
+
'aria-hidden': true,
|
|
175
|
+
...void 0 !== value ? {
|
|
176
|
+
value: serializeValue(value)
|
|
177
|
+
} : EMPTY_OBJECT,
|
|
178
|
+
disabled,
|
|
179
|
+
checked,
|
|
180
|
+
required,
|
|
181
|
+
readOnly,
|
|
182
|
+
onChange (event) {
|
|
183
|
+
if (event.nativeEvent.defaultPrevented) return;
|
|
184
|
+
if (disabled || readOnly || void 0 === value) return;
|
|
185
|
+
const details = createChangeEventDetails("none", event.nativeEvent);
|
|
186
|
+
if (details.isCanceled) return;
|
|
187
|
+
setFieldTouched(true);
|
|
188
|
+
setDirty(value !== validityData.initialValue);
|
|
189
|
+
setFilled(true);
|
|
190
|
+
setCheckedValue(value, details);
|
|
191
|
+
},
|
|
192
|
+
onFocus () {
|
|
193
|
+
radioRef.current?.focus();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const state = __rspack_external_react.useMemo(()=>({
|
|
197
|
+
...fieldState,
|
|
198
|
+
required,
|
|
199
|
+
disabled,
|
|
200
|
+
readOnly,
|
|
201
|
+
checked
|
|
202
|
+
}), [
|
|
203
|
+
fieldState,
|
|
204
|
+
disabled,
|
|
205
|
+
readOnly,
|
|
206
|
+
checked,
|
|
207
|
+
required
|
|
208
|
+
]);
|
|
209
|
+
const contextValue = state;
|
|
210
|
+
const isRadioGroup = void 0 !== groupContext;
|
|
211
|
+
const refs = [
|
|
212
|
+
forwardedRef,
|
|
213
|
+
radioRef,
|
|
214
|
+
buttonRef,
|
|
215
|
+
handleControlRef
|
|
216
|
+
];
|
|
217
|
+
const props = [
|
|
218
|
+
rootProps,
|
|
219
|
+
getDescriptionProps,
|
|
220
|
+
validation?.getValidationProps ?? EMPTY_OBJECT,
|
|
221
|
+
elementProps,
|
|
222
|
+
getButtonProps
|
|
223
|
+
];
|
|
224
|
+
const element = useRenderElement('span', componentProps, {
|
|
225
|
+
enabled: !isRadioGroup,
|
|
226
|
+
state,
|
|
227
|
+
ref: refs,
|
|
228
|
+
props,
|
|
229
|
+
stateAttributesMapping: stateAttributesMapping
|
|
230
|
+
});
|
|
231
|
+
return /*#__PURE__*/ jsxs(RadioRootContext.Provider, {
|
|
232
|
+
value: contextValue,
|
|
233
|
+
children: [
|
|
234
|
+
isRadioGroup ? /*#__PURE__*/ jsx(CompositeItem, {
|
|
235
|
+
tag: "span",
|
|
236
|
+
render: render,
|
|
237
|
+
className: className,
|
|
238
|
+
style: style,
|
|
239
|
+
state: state,
|
|
240
|
+
refs: refs,
|
|
241
|
+
props: props,
|
|
242
|
+
stateAttributesMapping: stateAttributesMapping
|
|
243
|
+
}) : element,
|
|
244
|
+
/*#__PURE__*/ jsx("input", {
|
|
245
|
+
...inputProps,
|
|
246
|
+
suppressHydrationWarning: true
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
if ("production" !== process.env.NODE_ENV) RadioRoot_RadioRoot.displayName = "RadioRoot";
|
|
5
252
|
const Radio_module = {
|
|
6
253
|
root: "root-Lal8hj",
|
|
7
254
|
indicator: "indicator-YyFvol"
|
|
@@ -11,13 +258,13 @@ const RadioSize = {
|
|
|
11
258
|
medium: 16,
|
|
12
259
|
large: 20
|
|
13
260
|
};
|
|
14
|
-
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
261
|
+
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(RadioIndicator_RadioIndicator, {
|
|
15
262
|
ref: ref,
|
|
16
263
|
className: clsx(Radio_module.indicator, className),
|
|
17
264
|
...props
|
|
18
265
|
}));
|
|
19
266
|
function Root({ className, size = RadioSize.medium, style, ...props }) {
|
|
20
|
-
return /*#__PURE__*/ jsx(
|
|
267
|
+
return /*#__PURE__*/ jsx(RadioRoot_RadioRoot, {
|
|
21
268
|
...props,
|
|
22
269
|
className: clsx(Radio_module.root, className),
|
|
23
270
|
style: {
|
|
@@ -26,8 +273,8 @@ function Root({ className, size = RadioSize.medium, style, ...props }) {
|
|
|
26
273
|
}
|
|
27
274
|
});
|
|
28
275
|
}
|
|
29
|
-
const
|
|
276
|
+
const Radio = {
|
|
30
277
|
Indicator: Indicator,
|
|
31
278
|
Root: Root
|
|
32
279
|
};
|
|
33
|
-
export {
|
|
280
|
+
export { Radio, RadioSize };
|
|
@@ -1,11 +1,350 @@
|
|
|
1
|
-
import { RadioGroup as RadioGroup_2 } from '@base-ui/react/radio-group';
|
|
2
1
|
import * as React_2 from 'react';
|
|
3
2
|
|
|
3
|
+
declare type BaseUIChangeEventDetail<Reason extends string, CustomProperties extends object> = {
|
|
4
|
+
/**
|
|
5
|
+
* The reason for the event.
|
|
6
|
+
*/
|
|
7
|
+
reason: Reason;
|
|
8
|
+
/**
|
|
9
|
+
* The native event associated with the custom event.
|
|
10
|
+
*/
|
|
11
|
+
event: ReasonToEvent<Reason>;
|
|
12
|
+
/**
|
|
13
|
+
* Cancels Base UI from handling the event.
|
|
14
|
+
*/
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Allows the event to propagate in cases where Base UI will stop the propagation.
|
|
18
|
+
*/
|
|
19
|
+
allowPropagation: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the event has been canceled.
|
|
22
|
+
*/
|
|
23
|
+
isCanceled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Indicates whether the event is allowed to propagate.
|
|
26
|
+
*/
|
|
27
|
+
isPropagationAllowed: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The element that triggered the event, if applicable.
|
|
30
|
+
*/
|
|
31
|
+
trigger: Element | undefined;
|
|
32
|
+
} & CustomProperties;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Details of custom change events emitted by Base UI components.
|
|
36
|
+
*/
|
|
37
|
+
declare type BaseUIChangeEventDetails<Reason extends string, CustomProperties extends object = {}> = Reason extends string ? BaseUIChangeEventDetail<Reason, CustomProperties> & {} : never;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props shared by all Base UI components.
|
|
41
|
+
* Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
|
|
42
|
+
*/
|
|
43
|
+
declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
|
|
44
|
+
/**
|
|
45
|
+
* CSS class applied to the element, or a function that
|
|
46
|
+
* returns a class based on the component's state.
|
|
47
|
+
*/
|
|
48
|
+
className?: string | ((state: State) => string | undefined) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Allows you to replace the component's HTML element
|
|
51
|
+
* with a different tag, or compose it with another component.
|
|
52
|
+
*
|
|
53
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
54
|
+
*/
|
|
55
|
+
render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Style applied to the element, or a function that
|
|
58
|
+
* returns a style object based on the component's state.
|
|
59
|
+
*/
|
|
60
|
+
style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
|
|
64
|
+
preventBaseUIHandler: () => void;
|
|
65
|
+
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
declare const cancelOpen: "cancel-open";
|
|
69
|
+
|
|
70
|
+
declare const chipRemovePress: "chip-remove-press";
|
|
71
|
+
|
|
72
|
+
declare const clearPress: "clear-press";
|
|
73
|
+
|
|
74
|
+
declare const closePress: "close-press";
|
|
75
|
+
|
|
76
|
+
declare const closeWatcher: "close-watcher";
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 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.
|
|
80
|
+
*
|
|
81
|
+
* @template Props Props to be spread on the rendered element.
|
|
82
|
+
* @template State Component's internal state.
|
|
83
|
+
*/
|
|
84
|
+
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
85
|
+
|
|
86
|
+
declare const decrementPress: "decrement-press";
|
|
87
|
+
|
|
88
|
+
declare const disabled: "disabled";
|
|
89
|
+
|
|
90
|
+
declare const drag: "drag";
|
|
91
|
+
|
|
92
|
+
declare const escapeKey: "escape-key";
|
|
93
|
+
|
|
94
|
+
declare interface FieldRootState {
|
|
95
|
+
/**
|
|
96
|
+
* Whether the component should ignore user interaction.
|
|
97
|
+
*/
|
|
98
|
+
disabled: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the field has been touched.
|
|
101
|
+
*/
|
|
102
|
+
touched: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Whether the field value has changed from its initial value.
|
|
105
|
+
*/
|
|
106
|
+
dirty: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Whether the field is valid.
|
|
109
|
+
*/
|
|
110
|
+
valid: boolean | null;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the field has a value.
|
|
113
|
+
*/
|
|
114
|
+
filled: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the field is focused.
|
|
117
|
+
*/
|
|
118
|
+
focused: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare const focusOut: "focus-out";
|
|
122
|
+
|
|
123
|
+
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
124
|
+
ref?: React_2.Ref<T> | undefined;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare const imperativeAction: "imperative-action";
|
|
128
|
+
|
|
129
|
+
declare const incrementPress: "increment-press";
|
|
130
|
+
|
|
131
|
+
declare const initial: "initial";
|
|
132
|
+
|
|
133
|
+
declare const inputBlur: "input-blur";
|
|
134
|
+
|
|
135
|
+
declare const inputChange: "input-change";
|
|
136
|
+
|
|
137
|
+
declare const inputClear: "input-clear";
|
|
138
|
+
|
|
139
|
+
declare const inputPaste: "input-paste";
|
|
140
|
+
|
|
141
|
+
declare const inputPress: "input-press";
|
|
142
|
+
|
|
143
|
+
declare const itemPress: "item-press";
|
|
144
|
+
|
|
145
|
+
declare const keyboard: "keyboard";
|
|
146
|
+
|
|
147
|
+
declare const linkPress: "link-press";
|
|
148
|
+
|
|
149
|
+
declare const listNavigation: "list-navigation";
|
|
150
|
+
|
|
151
|
+
declare const missing: "missing";
|
|
152
|
+
|
|
153
|
+
declare const none: "none";
|
|
154
|
+
|
|
155
|
+
declare const outsidePress: "outside-press";
|
|
156
|
+
|
|
157
|
+
declare const pointer: "pointer";
|
|
158
|
+
|
|
4
159
|
export declare const RadioGroup: React_2.ForwardRefExoticComponent<Omit<Omit<RadioGroup_2.Props<unknown>, "ref">, "className"> & {
|
|
5
160
|
className?: string | undefined;
|
|
6
161
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
7
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Provides a shared state to a series of radio buttons.
|
|
165
|
+
* Renders a `<div>` element.
|
|
166
|
+
*
|
|
167
|
+
* Documentation: [Base UI Radio Group](https://base-ui.com/react/components/radio)
|
|
168
|
+
*/
|
|
169
|
+
declare const RadioGroup_2: {
|
|
170
|
+
<Value>(props: RadioGroup_2.Props<Value>): React_2.JSX.Element;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
declare namespace RadioGroup_2 {
|
|
174
|
+
type State = RadioGroupState;
|
|
175
|
+
type Props<TValue = any> = RadioGroupProps<TValue>;
|
|
176
|
+
type ChangeEventReason = RadioGroupChangeEventReason;
|
|
177
|
+
type ChangeEventDetails = RadioGroupChangeEventDetails;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export declare type RadioGroupChangeEventDetails = BaseUIChangeEventDetails<RadioGroup_2.ChangeEventReason>;
|
|
181
|
+
|
|
182
|
+
export declare type RadioGroupChangeEventReason = typeof REASONS.none;
|
|
183
|
+
|
|
184
|
+
export declare interface RadioGroupProps<Value = any> extends Omit<BaseUIComponentProps<'div', RadioGroupState>, 'value'> {
|
|
185
|
+
/**
|
|
186
|
+
* Whether the component should ignore user interaction.
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
disabled?: boolean | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Whether the user should be unable to select a different radio button in the group.
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
readOnly?: boolean | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Whether the user must choose a value before submitting a form.
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
199
|
+
required?: boolean | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Identifies the field when a form is submitted.
|
|
202
|
+
*/
|
|
203
|
+
name?: string | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Identifies the form that owns the radio inputs.
|
|
206
|
+
* Useful when the radio group is rendered outside the form.
|
|
207
|
+
*/
|
|
208
|
+
form?: string | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* The controlled value of the radio item that should be currently selected.
|
|
211
|
+
*
|
|
212
|
+
* To render an uncontrolled radio group, use the `defaultValue` prop instead.
|
|
213
|
+
*/
|
|
214
|
+
value?: Value | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* The uncontrolled value of the radio button that should be initially selected.
|
|
217
|
+
*
|
|
218
|
+
* To render a controlled radio group, use the `value` prop instead.
|
|
219
|
+
*/
|
|
220
|
+
defaultValue?: Value | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Callback fired when the value changes.
|
|
223
|
+
*/
|
|
224
|
+
onValueChange?: ((value: Value, eventDetails: RadioGroup_2.ChangeEventDetails) => void) | undefined;
|
|
225
|
+
/**
|
|
226
|
+
* A ref to access the hidden input element.
|
|
227
|
+
*/
|
|
228
|
+
inputRef?: React_2.Ref<HTMLInputElement> | undefined;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare interface RadioGroupState extends FieldRootState {
|
|
232
|
+
/**
|
|
233
|
+
* Whether the user should be unable to select a different radio button in the group.
|
|
234
|
+
*/
|
|
235
|
+
readOnly: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the user must tick a radio button within the group before submitting a form.
|
|
238
|
+
*/
|
|
239
|
+
required: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare namespace REASONS {
|
|
243
|
+
export {
|
|
244
|
+
none,
|
|
245
|
+
triggerPress,
|
|
246
|
+
triggerHover,
|
|
247
|
+
triggerFocus,
|
|
248
|
+
outsidePress,
|
|
249
|
+
itemPress,
|
|
250
|
+
closePress,
|
|
251
|
+
linkPress,
|
|
252
|
+
clearPress,
|
|
253
|
+
chipRemovePress,
|
|
254
|
+
trackPress,
|
|
255
|
+
incrementPress,
|
|
256
|
+
decrementPress,
|
|
257
|
+
inputChange,
|
|
258
|
+
inputClear,
|
|
259
|
+
inputBlur,
|
|
260
|
+
inputPaste,
|
|
261
|
+
inputPress,
|
|
262
|
+
focusOut,
|
|
263
|
+
escapeKey,
|
|
264
|
+
closeWatcher,
|
|
265
|
+
listNavigation,
|
|
266
|
+
keyboard,
|
|
267
|
+
pointer,
|
|
268
|
+
drag,
|
|
269
|
+
wheel,
|
|
270
|
+
scrub,
|
|
271
|
+
cancelOpen,
|
|
272
|
+
siblingOpen,
|
|
273
|
+
disabled,
|
|
274
|
+
missing,
|
|
275
|
+
initial,
|
|
276
|
+
imperativeAction,
|
|
277
|
+
swipe,
|
|
278
|
+
windowResize
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Maps a change `reason` string to the corresponding native event type.
|
|
284
|
+
*/
|
|
285
|
+
declare type ReasonToEvent<Reason extends string> = Reason extends keyof ReasonToEventMap ? ReasonToEventMap[Reason] : Event;
|
|
286
|
+
|
|
287
|
+
declare interface ReasonToEventMap {
|
|
288
|
+
[REASONS.none]: Event;
|
|
289
|
+
[REASONS.triggerPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
290
|
+
[REASONS.triggerHover]: MouseEvent;
|
|
291
|
+
[REASONS.triggerFocus]: FocusEvent;
|
|
292
|
+
[REASONS.outsidePress]: MouseEvent | PointerEvent | TouchEvent;
|
|
293
|
+
[REASONS.itemPress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
294
|
+
[REASONS.closePress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
295
|
+
[REASONS.linkPress]: MouseEvent | PointerEvent;
|
|
296
|
+
[REASONS.clearPress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
297
|
+
[REASONS.chipRemovePress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
298
|
+
[REASONS.trackPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
299
|
+
[REASONS.incrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
300
|
+
[REASONS.decrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
301
|
+
[REASONS.inputChange]: InputEvent | Event;
|
|
302
|
+
[REASONS.inputClear]: InputEvent | FocusEvent | Event;
|
|
303
|
+
[REASONS.inputBlur]: FocusEvent;
|
|
304
|
+
[REASONS.inputPaste]: ClipboardEvent;
|
|
305
|
+
[REASONS.inputPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
306
|
+
[REASONS.focusOut]: FocusEvent | KeyboardEvent;
|
|
307
|
+
[REASONS.escapeKey]: KeyboardEvent;
|
|
308
|
+
[REASONS.closeWatcher]: Event;
|
|
309
|
+
[REASONS.listNavigation]: KeyboardEvent;
|
|
310
|
+
[REASONS.keyboard]: KeyboardEvent;
|
|
311
|
+
[REASONS.pointer]: PointerEvent;
|
|
312
|
+
[REASONS.drag]: PointerEvent | TouchEvent;
|
|
313
|
+
[REASONS.swipe]: PointerEvent | TouchEvent;
|
|
314
|
+
[REASONS.wheel]: WheelEvent;
|
|
315
|
+
[REASONS.scrub]: PointerEvent;
|
|
316
|
+
[REASONS.cancelOpen]: MouseEvent;
|
|
317
|
+
[REASONS.siblingOpen]: Event;
|
|
318
|
+
[REASONS.disabled]: Event;
|
|
319
|
+
[REASONS.missing]: Event;
|
|
320
|
+
[REASONS.initial]: Event;
|
|
321
|
+
[REASONS.imperativeAction]: Event;
|
|
322
|
+
[REASONS.windowResize]: UIEvent;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare const scrub: "scrub";
|
|
326
|
+
|
|
327
|
+
declare const siblingOpen: "sibling-open";
|
|
328
|
+
|
|
329
|
+
declare const swipe: "swipe";
|
|
330
|
+
|
|
331
|
+
declare const trackPress: "track-press";
|
|
332
|
+
|
|
333
|
+
declare const triggerFocus: "trigger-focus";
|
|
334
|
+
|
|
335
|
+
declare const triggerHover: "trigger-hover";
|
|
336
|
+
|
|
337
|
+
declare const triggerPress: "trigger-press";
|
|
338
|
+
|
|
339
|
+
declare const wheel: "wheel";
|
|
340
|
+
|
|
341
|
+
declare const windowResize: "window-resize";
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
345
|
+
*/
|
|
346
|
+
declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
|
|
8
347
|
|
|
9
|
-
|
|
348
|
+
declare type WithPreventBaseUIHandler<T> = T extends ((event: infer E) => any) ? E extends React_2.SyntheticEvent<Element, Event> ? (event: BaseUIEvent<E>) => ReturnType<T> : T : T extends undefined ? undefined : T;
|
|
10
349
|
|
|
11
350
|
export { }
|