@wix/site-ui 1.106.0 → 1.107.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/Radio/index.css +8 -5
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +47 -47
- package/dist/RadioField/index.css +87 -0
- package/dist/RadioField/index.d.ts +346 -0
- package/dist/RadioField/index.js +82 -0
- package/dist/RadioGroup/index.css +6 -1
- package/dist/RadioGroup/index.d.ts +4 -0
- package/dist/RadioGroup/index.js +3 -1
- package/dist/RadioGroupField/index.css +22 -0
- package/dist/RadioGroupField/index.d.ts +402 -0
- package/dist/RadioGroupField/index.js +55 -0
- package/dist/index.d.ts +155 -1
- package/dist/index.js +2 -0
- package/package.json +2 -2
package/dist/Radio/index.css
CHANGED
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
flex-shrink: 0;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
|
-
transition:
|
|
14
|
-
display: flex;
|
|
13
|
+
transition: border-color .2s linear;
|
|
14
|
+
display: inline-flex;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.root-Lal8hj:hover
|
|
17
|
+
.root-Lal8hj:hover {
|
|
18
|
+
border-color: var(--wst-paragraph-2-color, #000);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.root-Lal8hj:focus-visible {
|
|
18
22
|
border-color: var(--wst-paragraph-2-color, #000);
|
|
19
23
|
outline: 2px solid var(--wst-links-and-actions-color, #116dff);
|
|
20
24
|
outline-offset: 2px;
|
|
21
|
-
transition: background-color .2s linear, border-color .2s linear, border-width .2s linear, border-radius .2s linear;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
.root-Lal8hj[data-checked] {
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
opacity: 0;
|
|
42
45
|
background-color: #0000;
|
|
43
46
|
border-radius: 50%;
|
|
44
|
-
transition:
|
|
47
|
+
transition: transform .2s linear, opacity .2s linear, background-color .2s linear;
|
|
45
48
|
transform: scale(0);
|
|
46
49
|
}
|
|
47
50
|
|
package/dist/Radio/index.d.ts
CHANGED
|
@@ -81,10 +81,10 @@ declare interface NonNativeButtonProps {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export declare const Radio: {
|
|
84
|
+
Root: typeof Root;
|
|
84
85
|
Indicator: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<RadioIndicatorProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
|
|
85
86
|
className?: string | undefined;
|
|
86
87
|
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
87
|
-
Root: typeof Root;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export declare namespace Radio_2 {
|
package/dist/Radio/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { NOOP, EMPTY_OBJECT, useMergedRefs, useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
4
3
|
import { transitionStatusMapping, useOpenChangeComplete, useTransitionStatus } from "../880.js";
|
|
5
4
|
import { useLabelableContext, fieldValidityMapping, useFieldRootContext } from "../1477.js";
|
|
5
|
+
import { esm_formatErrorMessage, EMPTY_OBJECT, useMergedRefs, useRenderElement, NOOP } from "../8272.js";
|
|
6
6
|
import { useRadioGroupContext } from "../1279.js";
|
|
7
7
|
import { useFieldItemContext } from "../1457.js";
|
|
8
8
|
import { useStableCallback } from "../7541.js";
|
|
@@ -18,13 +18,6 @@ import { serializeValue } from "../5778.js";
|
|
|
18
18
|
import { createChangeEventDetails } from "../4768.js";
|
|
19
19
|
import { CompositeItem } from "../951.js";
|
|
20
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
21
|
let RadioRootDataAttributes_RadioRootDataAttributes = /*#__PURE__*/ function(RadioRootDataAttributes) {
|
|
29
22
|
RadioRootDataAttributes["checked"] = "data-checked";
|
|
30
23
|
RadioRootDataAttributes["unchecked"] = "data-unchecked";
|
|
@@ -51,37 +44,13 @@ const stateAttributesMapping = {
|
|
|
51
44
|
...transitionStatusMapping,
|
|
52
45
|
...fieldValidityMapping
|
|
53
46
|
};
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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";
|
|
47
|
+
const RadioRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
48
|
+
if ("production" !== process.env.NODE_ENV) RadioRootContext.displayName = "RadioRootContext";
|
|
49
|
+
function useRadioRootContext() {
|
|
50
|
+
const value = __rspack_external_react.useContext(RadioRootContext);
|
|
51
|
+
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));
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
85
54
|
const RadioRoot_RadioRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
86
55
|
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
56
|
const groupContext = useRadioGroupContext();
|
|
@@ -249,6 +218,37 @@ const RadioRoot_RadioRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
249
218
|
});
|
|
250
219
|
});
|
|
251
220
|
if ("production" !== process.env.NODE_ENV) RadioRoot_RadioRoot.displayName = "RadioRoot";
|
|
221
|
+
const RadioIndicator_RadioIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
222
|
+
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
223
|
+
const rootState = useRadioRootContext();
|
|
224
|
+
const rendered = rootState.checked;
|
|
225
|
+
const { mounted, transitionStatus, setMounted } = useTransitionStatus(rendered);
|
|
226
|
+
const state = {
|
|
227
|
+
...rootState,
|
|
228
|
+
transitionStatus
|
|
229
|
+
};
|
|
230
|
+
const indicatorRef = __rspack_external_react.useRef(null);
|
|
231
|
+
const shouldRender = keepMounted || mounted;
|
|
232
|
+
const element = useRenderElement('span', componentProps, {
|
|
233
|
+
ref: [
|
|
234
|
+
forwardedRef,
|
|
235
|
+
indicatorRef
|
|
236
|
+
],
|
|
237
|
+
state,
|
|
238
|
+
props: elementProps,
|
|
239
|
+
stateAttributesMapping: stateAttributesMapping
|
|
240
|
+
});
|
|
241
|
+
useOpenChangeComplete({
|
|
242
|
+
open: rendered,
|
|
243
|
+
ref: indicatorRef,
|
|
244
|
+
onComplete () {
|
|
245
|
+
if (!rendered) setMounted(false);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
if (!shouldRender) return null;
|
|
249
|
+
return element;
|
|
250
|
+
});
|
|
251
|
+
if ("production" !== process.env.NODE_ENV) RadioIndicator_RadioIndicator.displayName = "RadioIndicator";
|
|
252
252
|
const Radio_module = {
|
|
253
253
|
root: "root-Lal8hj",
|
|
254
254
|
indicator: "indicator-YyFvol"
|
|
@@ -258,23 +258,23 @@ const RadioSize = {
|
|
|
258
258
|
medium: 16,
|
|
259
259
|
large: 20
|
|
260
260
|
};
|
|
261
|
-
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(RadioIndicator_RadioIndicator, {
|
|
262
|
-
ref: ref,
|
|
263
|
-
className: clsx(Radio_module.indicator, className),
|
|
264
|
-
...props
|
|
265
|
-
}));
|
|
266
261
|
function Root({ className, size = RadioSize.medium, style, ...props }) {
|
|
267
262
|
return /*#__PURE__*/ jsx(RadioRoot_RadioRoot, {
|
|
268
263
|
...props,
|
|
269
|
-
className: clsx(Radio_module.root, className),
|
|
264
|
+
className: clsx(Radio_module.root, className, 'has-custom-focus'),
|
|
270
265
|
style: {
|
|
271
266
|
'--radio-size': `${size}px`,
|
|
272
267
|
...style
|
|
273
268
|
}
|
|
274
269
|
});
|
|
275
270
|
}
|
|
271
|
+
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(RadioIndicator_RadioIndicator, {
|
|
272
|
+
ref: ref,
|
|
273
|
+
className: clsx(Radio_module.indicator, className),
|
|
274
|
+
...props
|
|
275
|
+
}));
|
|
276
276
|
const Radio = {
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
Root: Root,
|
|
278
|
+
Indicator: Indicator
|
|
279
279
|
};
|
|
280
280
|
export { Radio, RadioSize };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
.fieldItem-RyE1Xd {
|
|
2
|
+
align-items: center;
|
|
3
|
+
gap: 12px;
|
|
4
|
+
min-height: 24px;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.fieldItem-RyE1Xd .fieldLabel-3Ws24V {
|
|
9
|
+
font: var(--wst-paragraph-2-font);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
margin-bottom: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.fieldItem-RyE1Xd:has( > [role="radio"][data-disabled]) .fieldLabel-3Ws24V {
|
|
15
|
+
color: var(--wst-system-disabled-color, #939393);
|
|
16
|
+
cursor: default;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fieldItem-RyE1Xd:has( > [role="radio"][data-readonly]) .fieldLabel-3Ws24V {
|
|
20
|
+
cursor: default;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.fieldItem-RyE1Xd[data-variant="box"] {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
border: 1px solid
|
|
26
|
+
color-mix(in srgb, var(--wst-paragraph-2-color, #000) 60%, transparent);
|
|
27
|
+
background-color: var(--wst-primary-background-color, #fff);
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
gap: 14px;
|
|
30
|
+
min-width: 164px;
|
|
31
|
+
min-height: 74px;
|
|
32
|
+
padding: 0 20px;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"]:not([data-disabled]):not([data-readonly])) {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"][data-checked]) {
|
|
41
|
+
z-index: 1;
|
|
42
|
+
border-color: var(--wst-links-and-actions-color, #116dff);
|
|
43
|
+
background-color: color-mix(in srgb,
|
|
44
|
+
var(--wst-links-and-actions-color, #116dff) 8%,
|
|
45
|
+
var(--wst-primary-background-color, #fff));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"][data-invalid]) {
|
|
49
|
+
border-color: var(--wst-system-error-color, #df3131);
|
|
50
|
+
background-color: color-mix(in srgb,
|
|
51
|
+
var(--wst-system-error-color, #df3131) 6%,
|
|
52
|
+
var(--wst-primary-background-color, #fff));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"][data-disabled]) {
|
|
56
|
+
border-color: color-mix(in srgb,
|
|
57
|
+
var(--wst-system-disabled-color, #939393) 60%,
|
|
58
|
+
transparent);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.fieldItem-RyE1Xd[data-variant="box"] .fieldLabel-3Ws24V:before {
|
|
62
|
+
content: "";
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
position: absolute;
|
|
65
|
+
inset: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"][data-disabled]) .fieldLabel-3Ws24V:before, .fieldItem-RyE1Xd[data-variant="box"]:has( > [role="radio"][data-readonly]) .fieldLabel-3Ws24V:before {
|
|
69
|
+
cursor: default;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fieldLabelStack-TwpByX {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 4px;
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.fieldLabelText-cfnyvw {
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 4px;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fieldSuffix-SKi6ny {
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { FieldControlProps } from '@base-ui/react/field';
|
|
2
|
+
import { FieldDescriptionProps } from '../Field';
|
|
3
|
+
import { FieldDescriptionProps as FieldDescriptionProps_2 } from '@base-ui/react/field';
|
|
4
|
+
import { FieldErrorProps } from '../Field';
|
|
5
|
+
import { FieldErrorProps as FieldErrorProps_2 } from '@base-ui/react/field';
|
|
6
|
+
import { FieldItemProps } from '../Field';
|
|
7
|
+
import { FieldItemProps as FieldItemProps_2 } from '@base-ui/react/field';
|
|
8
|
+
import { FieldLabelProps } from '../Field';
|
|
9
|
+
import { FieldLabelProps as FieldLabelProps_2 } from '@base-ui/react/field';
|
|
10
|
+
import { FieldRootProps } from '../Field';
|
|
11
|
+
import { FieldRootProps as FieldRootProps_3 } from '@base-ui/react/field';
|
|
12
|
+
import { FieldValidityProps } from '@base-ui/react/field';
|
|
13
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
14
|
+
import { LabelVariant } from '../Field/Field';
|
|
15
|
+
import { RadioIndicatorProps as RadioIndicatorProps_2 } from '@base-ui/react/radio';
|
|
16
|
+
import * as React_2 from 'react';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props shared by all Base UI components.
|
|
20
|
+
* Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
|
|
21
|
+
*/
|
|
22
|
+
declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
|
|
23
|
+
/**
|
|
24
|
+
* CSS class applied to the element, or a function that
|
|
25
|
+
* returns a class based on the component's state.
|
|
26
|
+
*/
|
|
27
|
+
className?: string | ((state: State) => string | undefined) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Allows you to replace the component's HTML element
|
|
30
|
+
* with a different tag, or compose it with another component.
|
|
31
|
+
*
|
|
32
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
33
|
+
*/
|
|
34
|
+
render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Style applied to the element, or a function that
|
|
37
|
+
* returns a style object based on the component's state.
|
|
38
|
+
*/
|
|
39
|
+
style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
|
|
43
|
+
preventBaseUIHandler: () => void;
|
|
44
|
+
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
*
|
|
50
|
+
* @template Props Props to be spread on the rendered element.
|
|
51
|
+
* @template State Component's internal state.
|
|
52
|
+
*/
|
|
53
|
+
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
54
|
+
|
|
55
|
+
declare type ControlVariant = 'box' | 'line';
|
|
56
|
+
|
|
57
|
+
declare const Field: {
|
|
58
|
+
Root: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldRootProps_3, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
59
|
+
className?: string | undefined;
|
|
60
|
+
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
Label: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldLabelProps_2, "ref"> & React_2.RefAttributes<HTMLElement>, "ref">, "className"> & {
|
|
62
|
+
className?: string | undefined;
|
|
63
|
+
} & {
|
|
64
|
+
/** `floating` lifts the label into the control until it is focused or filled. */
|
|
65
|
+
variant?: LabelVariant_2 | undefined;
|
|
66
|
+
} & React_2.RefAttributes<HTMLElement>>;
|
|
67
|
+
Error: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldErrorProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
68
|
+
className?: string | undefined;
|
|
69
|
+
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
Description: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldDescriptionProps_2, "ref"> & React_2.RefAttributes<HTMLParagraphElement>, "ref">, "className"> & {
|
|
71
|
+
className?: string | undefined;
|
|
72
|
+
} & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
73
|
+
Control: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldControlProps, "ref"> & React_2.RefAttributes<HTMLElement>, "ref">, "className"> & {
|
|
74
|
+
className?: string | undefined;
|
|
75
|
+
} & {
|
|
76
|
+
/** `line` swaps the boxed border for a single bottom border. */
|
|
77
|
+
variant?: ControlVariant | undefined;
|
|
78
|
+
} & React_2.RefAttributes<HTMLElement>>;
|
|
79
|
+
Item: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<FieldItemProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
80
|
+
className?: string | undefined;
|
|
81
|
+
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
82
|
+
Validity: React_2.FC<FieldValidityProps>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
declare type FieldDescriptionProps_3 = React_2.ComponentPropsWithoutRef<typeof Field.Description>;
|
|
86
|
+
|
|
87
|
+
declare type FieldErrorProps_3 = React_2.ComponentPropsWithoutRef<typeof Field.Error>;
|
|
88
|
+
|
|
89
|
+
declare type FieldItemProps_3 = React_2.ComponentPropsWithoutRef<typeof Field.Item>;
|
|
90
|
+
|
|
91
|
+
declare type FieldLabelProps_3 = React_2.ComponentPropsWithoutRef<typeof Field.Label>;
|
|
92
|
+
|
|
93
|
+
declare type FieldRootProps_2 = React_2.ComponentPropsWithoutRef<typeof Field.Root>;
|
|
94
|
+
|
|
95
|
+
declare interface FieldRootState {
|
|
96
|
+
/**
|
|
97
|
+
* Whether the component should ignore user interaction.
|
|
98
|
+
*/
|
|
99
|
+
disabled: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the field has been touched.
|
|
102
|
+
*/
|
|
103
|
+
touched: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the field value has changed from its initial value.
|
|
106
|
+
*/
|
|
107
|
+
dirty: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the field is valid.
|
|
110
|
+
*/
|
|
111
|
+
valid: boolean | null;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the field has a value.
|
|
114
|
+
*/
|
|
115
|
+
filled: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Whether the field is focused.
|
|
118
|
+
*/
|
|
119
|
+
focused: boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
123
|
+
ref?: React_2.Ref<T> | undefined;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
declare type IndicatorProps = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Radio_2.Indicator>>;
|
|
127
|
+
|
|
128
|
+
declare type LabelVariant_2 = 'default' | 'floating';
|
|
129
|
+
|
|
130
|
+
declare interface NonNativeButtonProps {
|
|
131
|
+
/**
|
|
132
|
+
* Whether the component renders a native `<button>` element when replacing it
|
|
133
|
+
* via the `render` prop.
|
|
134
|
+
* Set to `true` if the rendered element is a native button.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
nativeButton?: boolean | undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare namespace Radio {
|
|
141
|
+
export {
|
|
142
|
+
RadioRoot as Root,
|
|
143
|
+
RadioIndicator as Indicator
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
declare const Radio_2: {
|
|
148
|
+
Root: typeof Root;
|
|
149
|
+
Indicator: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<RadioIndicatorProps_2, "ref"> & React_2.RefAttributes<HTMLSpanElement>, "ref">, "className"> & {
|
|
150
|
+
className?: string | undefined;
|
|
151
|
+
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export declare const RadioField: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<FieldRootProps, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
155
|
+
className?: string | undefined;
|
|
156
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref">, "children"> & {
|
|
157
|
+
/** The unique value this option contributes to its `RadioGroup`. */
|
|
158
|
+
value: string;
|
|
159
|
+
/** Visible label rendered beside the radio. */
|
|
160
|
+
label: React_2.ReactNode;
|
|
161
|
+
/** Visual style: a plain radio row or a selectable `box` tile. */
|
|
162
|
+
variant?: RadioFieldVariant | undefined;
|
|
163
|
+
/** Renders the option selected (for standalone, controlled usage). */
|
|
164
|
+
checked?: boolean | undefined;
|
|
165
|
+
/** Supporting text rendered below the label. */
|
|
166
|
+
description?: React_2.ReactNode;
|
|
167
|
+
/** Error message rendered below the option; also marks the field invalid. */
|
|
168
|
+
error?: React_2.ReactNode;
|
|
169
|
+
/** Called with `value` when the option is chosen via click. */
|
|
170
|
+
onSelect?: ((value: string) => void) | undefined;
|
|
171
|
+
/** Size of the radio control in pixels. */
|
|
172
|
+
size?: number | undefined;
|
|
173
|
+
/** Extra inline content rendered after the label. */
|
|
174
|
+
suffix?: React_2.ReactNode;
|
|
175
|
+
/** Props forwarded to the `Field.Item` wrapping the radio and label. */
|
|
176
|
+
itemProps?: Omit<Omit<Omit<Omit<Omit<FieldItemProps, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
177
|
+
className?: string | undefined;
|
|
178
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref">, "children"> | undefined;
|
|
179
|
+
/** Props forwarded to the `Field.Label`. */
|
|
180
|
+
labelProps?: Omit<Omit<Omit<Omit<Omit<FieldLabelProps, "ref"> & React_2.RefAttributes<HTMLElement>, "ref">, "className"> & {
|
|
181
|
+
className?: string | undefined;
|
|
182
|
+
} & {
|
|
183
|
+
variant?: LabelVariant | undefined;
|
|
184
|
+
} & React_2.RefAttributes<HTMLElement>, "ref">, "children"> | undefined;
|
|
185
|
+
/** Props forwarded to the `Field.Description`. */
|
|
186
|
+
descriptionProps?: Omit<Omit<Omit<Omit<Omit<FieldDescriptionProps, "ref"> & React_2.RefAttributes<HTMLParagraphElement>, "ref">, "className"> & {
|
|
187
|
+
className?: string | undefined;
|
|
188
|
+
} & React_2.RefAttributes<HTMLParagraphElement>, "ref">, "children"> | undefined;
|
|
189
|
+
/** Props forwarded to the `Field.Error`. */
|
|
190
|
+
errorProps?: Omit<Omit<Omit<Omit<Omit<FieldErrorProps, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
191
|
+
className?: string | undefined;
|
|
192
|
+
} & React_2.RefAttributes<HTMLDivElement>, "ref">, "children"> | undefined;
|
|
193
|
+
/** Props forwarded to the underlying `Radio.Root`. */
|
|
194
|
+
radioProps?: RadioRootProps | undefined;
|
|
195
|
+
/** Props forwarded to the `Radio.Indicator`. */
|
|
196
|
+
indicatorProps?: IndicatorProps | undefined;
|
|
197
|
+
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
198
|
+
|
|
199
|
+
export declare type RadioFieldProps = Omit<FieldRootProps_2, 'children'> & {
|
|
200
|
+
/** The unique value this option contributes to its `RadioGroup`. */
|
|
201
|
+
value: string;
|
|
202
|
+
/** Visible label rendered beside the radio. */
|
|
203
|
+
label: React_2.ReactNode;
|
|
204
|
+
/** Visual style: a plain radio row or a selectable `box` tile. */
|
|
205
|
+
variant?: RadioFieldVariant;
|
|
206
|
+
/** Renders the option selected (for standalone, controlled usage). */
|
|
207
|
+
checked?: boolean;
|
|
208
|
+
/** Supporting text rendered below the label. */
|
|
209
|
+
description?: React_2.ReactNode;
|
|
210
|
+
/** Error message rendered below the option; also marks the field invalid. */
|
|
211
|
+
error?: React_2.ReactNode;
|
|
212
|
+
/** Called with `value` when the option is chosen via click. */
|
|
213
|
+
onSelect?: (value: string) => void;
|
|
214
|
+
/** Size of the radio control in pixels. */
|
|
215
|
+
size?: number;
|
|
216
|
+
/** Extra inline content rendered after the label. */
|
|
217
|
+
suffix?: React_2.ReactNode;
|
|
218
|
+
/** Props forwarded to the `Field.Item` wrapping the radio and label. */
|
|
219
|
+
itemProps?: Omit<FieldItemProps_3, 'children'>;
|
|
220
|
+
/** Props forwarded to the `Field.Label`. */
|
|
221
|
+
labelProps?: Omit<FieldLabelProps_3, 'children'>;
|
|
222
|
+
/** Props forwarded to the `Field.Description`. */
|
|
223
|
+
descriptionProps?: Omit<FieldDescriptionProps_3, 'children'>;
|
|
224
|
+
/** Props forwarded to the `Field.Error`. */
|
|
225
|
+
errorProps?: Omit<FieldErrorProps_3, 'children'>;
|
|
226
|
+
/** Props forwarded to the underlying `Radio.Root`. */
|
|
227
|
+
radioProps?: RadioRootProps;
|
|
228
|
+
/** Props forwarded to the `Radio.Indicator`. */
|
|
229
|
+
indicatorProps?: IndicatorProps;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export declare type RadioFieldVariant = 'default' | 'box';
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Indicates whether the radio button is selected.
|
|
236
|
+
* Renders a `<span>` element.
|
|
237
|
+
*
|
|
238
|
+
* Documentation: [Base UI Radio](https://base-ui.com/react/components/radio)
|
|
239
|
+
*/
|
|
240
|
+
declare const RadioIndicator: React_2.ForwardRefExoticComponent<Omit<RadioIndicatorProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
|
|
241
|
+
|
|
242
|
+
declare namespace RadioIndicator {
|
|
243
|
+
type Props = RadioIndicatorProps;
|
|
244
|
+
type State = RadioIndicatorState;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare interface RadioIndicatorProps extends BaseUIComponentProps<'span', RadioIndicatorState> {
|
|
248
|
+
/**
|
|
249
|
+
* Whether to keep the HTML element in the DOM when the radio button is inactive.
|
|
250
|
+
* @default false
|
|
251
|
+
*/
|
|
252
|
+
keepMounted?: boolean | undefined;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare interface RadioIndicatorState {
|
|
256
|
+
/**
|
|
257
|
+
* Whether the radio button is currently selected.
|
|
258
|
+
*/
|
|
259
|
+
checked: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* The transition status of the component.
|
|
262
|
+
*/
|
|
263
|
+
transitionStatus: TransitionStatus;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Represents the radio button itself.
|
|
268
|
+
* Renders a `<span>` element and a hidden `<input>` beside.
|
|
269
|
+
*
|
|
270
|
+
* Documentation: [Base UI Radio](https://base-ui.com/react/components/radio)
|
|
271
|
+
*/
|
|
272
|
+
declare const RadioRoot: {
|
|
273
|
+
<Value>(props: RadioRoot.Props<Value>): React_2.JSX.Element;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
declare namespace RadioRoot {
|
|
277
|
+
type State = RadioRootState;
|
|
278
|
+
type Props<TValue = any> = RadioRootProps_2<TValue>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
declare type RadioRootProps = Omit<WithStringClassName<Radio.Root.Props<string>> & {
|
|
282
|
+
size?: number;
|
|
283
|
+
}, 'children' | 'size' | 'value'>;
|
|
284
|
+
|
|
285
|
+
declare interface RadioRootProps_2<Value = any> extends NonNativeButtonProps, Omit<BaseUIComponentProps<'span', RadioRootState>, 'value'> {
|
|
286
|
+
/**
|
|
287
|
+
* The unique identifying value of the radio in a group.
|
|
288
|
+
*/
|
|
289
|
+
value: Value;
|
|
290
|
+
/**
|
|
291
|
+
* Whether the component should ignore user interaction.
|
|
292
|
+
*/
|
|
293
|
+
disabled?: boolean | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Whether the user must choose a value before submitting a form.
|
|
296
|
+
*/
|
|
297
|
+
required?: boolean | undefined;
|
|
298
|
+
/**
|
|
299
|
+
* Whether the user should be unable to select the radio button.
|
|
300
|
+
*/
|
|
301
|
+
readOnly?: boolean | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* A ref to access the hidden input element.
|
|
304
|
+
*/
|
|
305
|
+
inputRef?: React_2.Ref<HTMLInputElement> | undefined;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare interface RadioRootState extends FieldRootState {
|
|
309
|
+
/**
|
|
310
|
+
* Whether the radio button is currently selected.
|
|
311
|
+
*/
|
|
312
|
+
checked: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Whether the component should ignore user interaction.
|
|
315
|
+
*/
|
|
316
|
+
disabled: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether the user should be unable to select the radio button.
|
|
319
|
+
*/
|
|
320
|
+
readOnly: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Whether the user must choose a value before submitting a form.
|
|
323
|
+
*/
|
|
324
|
+
required: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
declare function Root<Value>({ className, size, style, ...props }: RootProps<Value>): JSX_2.Element;
|
|
328
|
+
|
|
329
|
+
declare type RootProps<Value> = WithStringClassName<Radio.Root.Props<Value>> & {
|
|
330
|
+
size?: number;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
337
|
+
*/
|
|
338
|
+
declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
|
|
339
|
+
|
|
340
|
+
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;
|
|
341
|
+
|
|
342
|
+
declare type WithStringClassName<P> = Omit<P, 'className'> & {
|
|
343
|
+
className?: string;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export { }
|