@wix/site-ui 1.109.0 → 1.110.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/8027.js +4 -0
- package/dist/Checkbox/index.css +47 -55
- package/dist/Checkbox/index.d.ts +16 -1
- package/dist/Checkbox/index.js +25 -6
- package/dist/CheckboxField/index.css +93 -0
- package/dist/CheckboxField/index.d.ts +468 -0
- package/dist/CheckboxField/index.js +69 -0
- package/dist/CheckboxGroup/index.js +1 -6
- package/dist/CheckboxGroupField/index.css +60 -0
- package/dist/CheckboxGroupField/index.d.ts +37 -0
- package/dist/CheckboxGroupField/index.js +55 -0
- package/dist/index.d.ts +72 -7
- package/dist/index.js +2 -0
- package/package.json +2 -2
- package/dist/CheckboxGroup/index.css +0 -9
package/dist/8027.js
ADDED
package/dist/Checkbox/index.css
CHANGED
|
@@ -1,94 +1,86 @@
|
|
|
1
1
|
.root-OrOWpu {
|
|
2
|
+
--checkbox-size: 14px;
|
|
3
|
+
--checkbox-border-color: color-mix(in srgb,
|
|
4
|
+
var(--wst-system-line-1-color, black) 60%,
|
|
5
|
+
transparent);
|
|
6
|
+
--checkbox-icon-color: var(--wst-links-and-actions-color, #116dff);
|
|
2
7
|
box-sizing: border-box;
|
|
3
8
|
cursor: pointer;
|
|
4
|
-
font: var(--wst-paragraph-2-font);
|
|
5
|
-
color: var(--wst-paragraph-2-color, #000);
|
|
6
|
-
--indicator-bg: var(--wst-primary-background-color, #fff);
|
|
7
|
-
--indicator-border: color-mix(in srgb,
|
|
8
|
-
var(--wst-system-line-1-color, #000) 60%,
|
|
9
|
-
transparent);
|
|
10
9
|
align-items: center;
|
|
11
|
-
|
|
12
|
-
transition: color .2s linear;
|
|
10
|
+
transition: background-color .2s linear, border-color .2s linear, color .2s linear;
|
|
13
11
|
display: inline-flex;
|
|
12
|
+
position: relative;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.root-OrOWpu:hover, .root-OrOWpu:focus-within {
|
|
17
|
-
--
|
|
18
|
-
outline: none;
|
|
16
|
+
--checkbox-border-color: var(--wst-system-line-1-color, black);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
.root-OrOWpu
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.root-OrOWpu[data-checked]:hover {
|
|
27
|
-
--indicator-bg: color-mix(in srgb,
|
|
28
|
-
var(--wst-links-and-actions-color, #116dff) 85%,
|
|
29
|
-
#000);
|
|
30
|
-
--indicator-border: color-mix(in srgb,
|
|
31
|
-
var(--wst-links-and-actions-color, #116dff) 85%,
|
|
32
|
-
#000);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.root-OrOWpu[data-disabled] {
|
|
36
|
-
cursor: default;
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
color: var(--wst-system-disabled-color, #939393);
|
|
39
|
-
--indicator-bg: var(--wst-primary-background-color, #fff);
|
|
40
|
-
--indicator-border: color-mix(in srgb,
|
|
41
|
-
var(--wst-system-disabled-color, #939393) 60%,
|
|
42
|
-
transparent);
|
|
19
|
+
.root-OrOWpu:focus-visible {
|
|
20
|
+
z-index: 1;
|
|
21
|
+
box-shadow: var(--wst-primary-background-color, white) 0 0 0 1px,
|
|
22
|
+
var(--wst-links-and-actions-color, #116dff) 0 0 0 3px;
|
|
23
|
+
outline: none;
|
|
43
24
|
}
|
|
44
25
|
|
|
45
26
|
.root-OrOWpu[data-invalid]:not([data-checked]) {
|
|
46
|
-
--
|
|
27
|
+
--checkbox-border-color: var(--wst-system-error-color, #df3131);
|
|
47
28
|
}
|
|
48
29
|
|
|
49
|
-
.root-OrOWpu[data-invalid]
|
|
50
|
-
--
|
|
30
|
+
.root-OrOWpu[data-invalid][data-checked] {
|
|
31
|
+
--checkbox-icon-color: var(--wst-system-error-color, #df3131);
|
|
32
|
+
--checkbox-border-color: color-mix(in srgb,
|
|
51
33
|
var(--wst-system-error-color, #df3131) 70%,
|
|
52
34
|
transparent);
|
|
53
35
|
}
|
|
54
36
|
|
|
55
|
-
.root-OrOWpu[data-
|
|
56
|
-
--
|
|
57
|
-
|
|
37
|
+
.root-OrOWpu[data-disabled] {
|
|
38
|
+
--checkbox-border-color: color-mix(in srgb,
|
|
39
|
+
var(--wst-system-disabled-color, #939393) 60%,
|
|
40
|
+
transparent);
|
|
41
|
+
--checkbox-icon-color: var(--wst-system-disabled-color, #939393);
|
|
42
|
+
cursor: default;
|
|
43
|
+
pointer-events: none;
|
|
58
44
|
}
|
|
59
45
|
|
|
60
46
|
.indicator-g_8JYy {
|
|
61
47
|
box-sizing: content-box;
|
|
62
|
-
width: var(--checkbox-size,
|
|
63
|
-
height: var(--checkbox-size,
|
|
64
|
-
border: var(--wst-system-line-1-width, 1px) solid var(--
|
|
65
|
-
background-color: var(--
|
|
66
|
-
|
|
48
|
+
width: var(--checkbox-size, 14px);
|
|
49
|
+
height: var(--checkbox-size, 14px);
|
|
50
|
+
border: var(--wst-system-line-1-width, 1px) solid var(--checkbox-border-color);
|
|
51
|
+
background-color: var(--wst-primary-background-color, white);
|
|
52
|
+
color: #0000;
|
|
53
|
+
border-radius: 4px;
|
|
67
54
|
flex-shrink: 0;
|
|
68
55
|
justify-content: center;
|
|
69
56
|
align-items: center;
|
|
70
|
-
transition: background-color .2s linear, border-color .2s linear;
|
|
57
|
+
transition: background-color .2s linear, border-color .2s linear, color .2s linear;
|
|
71
58
|
display: inline-flex;
|
|
59
|
+
position: relative;
|
|
72
60
|
}
|
|
73
61
|
|
|
74
|
-
.indicator-g_8JYy
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
.indicator-g_8JYy svg {
|
|
63
|
+
width: calc(var(--checkbox-size, 14px) * .72);
|
|
64
|
+
height: auto;
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 50%;
|
|
67
|
+
left: 50%;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
77
69
|
}
|
|
78
70
|
|
|
79
|
-
.
|
|
80
|
-
fill:
|
|
71
|
+
.indicator-g_8JYy path {
|
|
72
|
+
fill: currentColor;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
|
-
.
|
|
84
|
-
|
|
75
|
+
.indicatorIcon-6oqHA9 {
|
|
76
|
+
opacity: 0;
|
|
85
77
|
}
|
|
86
78
|
|
|
87
|
-
.root-OrOWpu[data-
|
|
88
|
-
|
|
79
|
+
.root-OrOWpu[data-checked] .indicator-g_8JYy, .root-OrOWpu[data-indeterminate] .indicator-g_8JYy {
|
|
80
|
+
color: var(--checkbox-icon-color);
|
|
89
81
|
}
|
|
90
82
|
|
|
91
|
-
.root-OrOWpu[data-
|
|
92
|
-
|
|
83
|
+
.root-OrOWpu[data-checked]:not([data-indeterminate]) .checkmarkIcon-MX0Ccp, .root-OrOWpu[data-indeterminate] .indeterminateIcon-_b18QI {
|
|
84
|
+
opacity: 1;
|
|
93
85
|
}
|
|
94
86
|
|
package/dist/Checkbox/index.d.ts
CHANGED
|
@@ -80,6 +80,13 @@ export declare const Checkbox: {
|
|
|
80
80
|
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
export declare namespace Checkbox_2 {
|
|
84
|
+
export {
|
|
85
|
+
CheckboxRoot as Root,
|
|
86
|
+
CheckboxIndicator as Indicator
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
83
90
|
/**
|
|
84
91
|
* Indicates whether the checkbox is ticked.
|
|
85
92
|
* Renders a `<span>` element.
|
|
@@ -227,7 +234,7 @@ export declare interface CheckboxRootState extends FieldRootState {
|
|
|
227
234
|
|
|
228
235
|
export declare const CheckboxSize: {
|
|
229
236
|
readonly small: 12;
|
|
230
|
-
readonly medium:
|
|
237
|
+
readonly medium: 14;
|
|
231
238
|
readonly large: 20;
|
|
232
239
|
};
|
|
233
240
|
|
|
@@ -415,6 +422,10 @@ declare interface ReasonToEventMap {
|
|
|
415
422
|
[REASONS.windowResize]: UIEvent;
|
|
416
423
|
}
|
|
417
424
|
|
|
425
|
+
export declare type RootProps = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Checkbox_2.Root>> & {
|
|
426
|
+
size?: number;
|
|
427
|
+
};
|
|
428
|
+
|
|
418
429
|
declare const scrub: "scrub";
|
|
419
430
|
|
|
420
431
|
declare const siblingOpen: "sibling-open";
|
|
@@ -442,4 +453,8 @@ declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K
|
|
|
442
453
|
|
|
443
454
|
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;
|
|
444
455
|
|
|
456
|
+
declare type WithStringClassName<P> = Omit<P, 'className'> & {
|
|
457
|
+
className?: string;
|
|
458
|
+
};
|
|
459
|
+
|
|
445
460
|
export { }
|
package/dist/Checkbox/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CheckboxChecked, CheckboxIndeterminate } from "@wix/wix-ui-icons-common/system";
|
|
2
3
|
import clsx from "clsx";
|
|
3
4
|
import { CheckboxRoot_CheckboxRoot, useCheckboxRootContext, useStateAttributesMapping } from "../3248.js";
|
|
4
5
|
import { useOpenChangeComplete, transitionStatusMapping, useTransitionStatus } from "../880.js";
|
|
@@ -44,27 +45,45 @@ const CheckboxIndicator_CheckboxIndicator = /*#__PURE__*/ __rspack_external_reac
|
|
|
44
45
|
if ("production" !== process.env.NODE_ENV) CheckboxIndicator_CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
45
46
|
const Checkbox_module = {
|
|
46
47
|
root: "root-OrOWpu",
|
|
47
|
-
indicator: "indicator-g_8JYy"
|
|
48
|
+
indicator: "indicator-g_8JYy",
|
|
49
|
+
indicatorIcon: "indicatorIcon-6oqHA9",
|
|
50
|
+
checkmarkIcon: "checkmarkIcon-MX0Ccp",
|
|
51
|
+
indeterminateIcon: "indeterminateIcon-_b18QI"
|
|
48
52
|
};
|
|
49
53
|
const CheckboxSize = {
|
|
50
54
|
small: 12,
|
|
51
|
-
medium:
|
|
55
|
+
medium: 14,
|
|
52
56
|
large: 20
|
|
53
57
|
};
|
|
54
58
|
const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size = CheckboxSize.medium, style, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxRoot_CheckboxRoot, {
|
|
55
59
|
ref: ref,
|
|
56
|
-
className: clsx(Checkbox_module.root, className),
|
|
60
|
+
className: clsx(Checkbox_module.root, className, 'has-custom-focus'),
|
|
57
61
|
style: {
|
|
58
62
|
'--checkbox-size': `${size}px`,
|
|
59
63
|
...style
|
|
60
64
|
},
|
|
61
65
|
...props
|
|
62
66
|
}));
|
|
63
|
-
|
|
67
|
+
Root.displayName = 'Checkbox.Root';
|
|
68
|
+
const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxIndicator_CheckboxIndicator, {
|
|
64
69
|
ref: ref,
|
|
70
|
+
keepMounted: true,
|
|
65
71
|
className: clsx(Checkbox_module.indicator, className),
|
|
66
|
-
...props
|
|
72
|
+
...props,
|
|
73
|
+
children: children ?? /*#__PURE__*/ jsxs(Fragment, {
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsx(CheckboxChecked, {
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
className: clsx(Checkbox_module.indicatorIcon, Checkbox_module.checkmarkIcon)
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ jsx(CheckboxIndeterminate, {
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
className: clsx(Checkbox_module.indicatorIcon, Checkbox_module.indeterminateIcon)
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
67
85
|
}));
|
|
86
|
+
Indicator.displayName = 'Checkbox.Indicator';
|
|
68
87
|
const Checkbox = {
|
|
69
88
|
Root: Root,
|
|
70
89
|
Indicator: Indicator
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.option-o8pAcb {
|
|
2
|
+
width: var(--checkbox-option-width, auto);
|
|
3
|
+
gap: 8px;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.option-o8pAcb[data-variant="box"], .option-o8pAcb[data-has-error-message] {
|
|
9
|
+
width: var(--checkbox-option-width, 100%);
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root-tqmYsF {
|
|
14
|
+
--checkbox-box-border-color: color-mix(in srgb,
|
|
15
|
+
var(--wst-system-line-1-color, black) 60%,
|
|
16
|
+
transparent);
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
color: var(--wst-paragraph-2-color, black);
|
|
19
|
+
font: var(--wst-paragraph-2-font, normal normal 400 16px / 24px Madefor,
|
|
20
|
+
"Helvetica Neue",
|
|
21
|
+
Arial,
|
|
22
|
+
sans-serif);
|
|
23
|
+
user-select: none;
|
|
24
|
+
gap: 12px;
|
|
25
|
+
line-height: 24px;
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.root-tqmYsF[data-vertical-alignment="top"] {
|
|
30
|
+
align-items: flex-start;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.root-tqmYsF[data-vertical-alignment="top"] .indicator-_WzHbq {
|
|
34
|
+
margin-top: calc((
|
|
35
|
+
24px - var(--checkbox-size, 14px) - 2 *
|
|
36
|
+
var(--wst-system-line-1-width, 1px)
|
|
37
|
+
) /
|
|
38
|
+
2);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.root-tqmYsF[data-variant="box"] {
|
|
42
|
+
width: var(--checkbox-option-width, 100%);
|
|
43
|
+
border: var(--wst-system-line-1-width, 1px) solid
|
|
44
|
+
var(--checkbox-box-border-color);
|
|
45
|
+
background-color: var(--wst-primary-background-color, white);
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
padding: 15px 16px;
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.root-tqmYsF[data-variant="box"]:hover, .root-tqmYsF[data-variant="box"]:focus-within {
|
|
52
|
+
--checkbox-box-border-color: var(--wst-system-line-1-color, black);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.root-tqmYsF[data-variant="box"][data-checked]:not([data-disabled]) {
|
|
56
|
+
--checkbox-box-border-color: var(--wst-links-and-actions-color, #116dff);
|
|
57
|
+
background-color: color-mix(in srgb,
|
|
58
|
+
var(--wst-links-and-actions-color, #116dff) 10%,
|
|
59
|
+
transparent);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.root-tqmYsF[data-variant="box"][data-invalid]:not([data-checked]) {
|
|
63
|
+
--checkbox-box-border-color: var(--wst-system-error-color, #df3131);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.root-tqmYsF[data-variant="box"][data-disabled] {
|
|
67
|
+
--checkbox-box-border-color: var(--wst-system-disabled-color, #939393);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.root-tqmYsF[data-disabled] {
|
|
71
|
+
color: var(--wst-system-disabled-color, #939393);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.optionContent-inaJL9 {
|
|
75
|
+
flex: auto;
|
|
76
|
+
align-items: center;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
display: flex;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.optionLabel-fJWxkM {
|
|
82
|
+
overflow-wrap: anywhere;
|
|
83
|
+
flex: auto;
|
|
84
|
+
min-width: 0;
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.optionSuffix-AJytXe {
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
flex: none;
|
|
91
|
+
margin-inline-start: 5px;
|
|
92
|
+
}
|
|
93
|
+
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import * as React_2 from 'react';
|
|
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
|
+
export declare namespace Checkbox {
|
|
71
|
+
export {
|
|
72
|
+
CheckboxRoot as Root,
|
|
73
|
+
CheckboxIndicator as Indicator
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare const CheckboxField: React_2.ForwardRefExoticComponent<CheckboxFieldProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
|
|
79
|
+
export declare interface CheckboxFieldProps extends Omit<RootProps, 'children' | 'className' | 'style' | 'render' | 'nativeButton' | 'size'> {
|
|
80
|
+
/** Visible label rendered beside the checkbox. */
|
|
81
|
+
label: React_2.ReactNode;
|
|
82
|
+
/** Extra inline content rendered after the label (e.g. a price or badge). */
|
|
83
|
+
suffix?: React_2.ReactNode;
|
|
84
|
+
/** Visual style: a plain checkbox row or a selectable `box` tile. */
|
|
85
|
+
variant?: CheckboxFieldVariant;
|
|
86
|
+
/** Marks the field invalid, colouring the control and revealing `errorMessage`. */
|
|
87
|
+
error?: boolean;
|
|
88
|
+
/** Error message rendered below the option; also marks the field invalid. */
|
|
89
|
+
errorMessage?: React_2.ReactNode;
|
|
90
|
+
/** Aligns the control with the first line (`top`) or the label's centre. */
|
|
91
|
+
verticalAlignment?: CheckboxFieldVerticalAlignment;
|
|
92
|
+
/** Size of the checkbox control in pixels. */
|
|
93
|
+
size?: number;
|
|
94
|
+
/** Fixed width of the option; accepts a number (px) or any CSS length. */
|
|
95
|
+
width?: number | string;
|
|
96
|
+
/** Class applied to the field root. */
|
|
97
|
+
className?: string;
|
|
98
|
+
/** Inline styles applied to the field root. */
|
|
99
|
+
style?: React_2.CSSProperties;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export declare type CheckboxFieldVariant = 'default' | 'box';
|
|
103
|
+
|
|
104
|
+
export declare type CheckboxFieldVerticalAlignment = 'center' | 'top';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether the checkbox is ticked.
|
|
108
|
+
* Renders a `<span>` element.
|
|
109
|
+
*
|
|
110
|
+
* Documentation: [Base UI Checkbox](https://base-ui.com/react/components/checkbox)
|
|
111
|
+
*/
|
|
112
|
+
declare const CheckboxIndicator: React_2.ForwardRefExoticComponent<Omit<CheckboxIndicatorProps, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
|
|
113
|
+
|
|
114
|
+
declare namespace CheckboxIndicator {
|
|
115
|
+
type State = CheckboxIndicatorState;
|
|
116
|
+
type Props = CheckboxIndicatorProps;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare interface CheckboxIndicatorProps extends BaseUIComponentProps<'span', CheckboxIndicatorState> {
|
|
120
|
+
/**
|
|
121
|
+
* Whether to keep the element in the DOM when the checkbox is not checked.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
keepMounted?: boolean | undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare interface CheckboxIndicatorState extends CheckboxRootState {
|
|
128
|
+
/**
|
|
129
|
+
* The transition status of the component.
|
|
130
|
+
*/
|
|
131
|
+
transitionStatus: TransitionStatus;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Represents the checkbox itself.
|
|
136
|
+
* Renders a `<span>` element and a hidden `<input>` beside.
|
|
137
|
+
*
|
|
138
|
+
* Documentation: [Base UI Checkbox](https://base-ui.com/react/components/checkbox)
|
|
139
|
+
*/
|
|
140
|
+
declare const CheckboxRoot: React_2.ForwardRefExoticComponent<Omit<CheckboxRootProps, "ref"> & React_2.RefAttributes<HTMLElement>>;
|
|
141
|
+
|
|
142
|
+
declare namespace CheckboxRoot {
|
|
143
|
+
type State = CheckboxRootState;
|
|
144
|
+
type Props = CheckboxRootProps;
|
|
145
|
+
type ChangeEventReason = CheckboxRootChangeEventReason;
|
|
146
|
+
type ChangeEventDetails = CheckboxRootChangeEventDetails;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare type CheckboxRootChangeEventDetails = BaseUIChangeEventDetails<CheckboxRoot.ChangeEventReason>;
|
|
150
|
+
|
|
151
|
+
declare type CheckboxRootChangeEventReason = typeof REASONS.none;
|
|
152
|
+
|
|
153
|
+
declare interface CheckboxRootProps extends NonNativeButtonProps, Omit<BaseUIComponentProps<'span', CheckboxRootState>, 'onChange' | 'value'> {
|
|
154
|
+
/**
|
|
155
|
+
* The id of the input element.
|
|
156
|
+
*/
|
|
157
|
+
id?: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Identifies the field when a form is submitted.
|
|
160
|
+
* @default undefined
|
|
161
|
+
*/
|
|
162
|
+
name?: string | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Identifies the form that owns the hidden input.
|
|
165
|
+
* Useful when the checkbox is rendered outside the form.
|
|
166
|
+
*/
|
|
167
|
+
form?: string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the checkbox is currently ticked.
|
|
170
|
+
*
|
|
171
|
+
* To render an uncontrolled checkbox, use the `defaultChecked` prop instead.
|
|
172
|
+
* @default undefined
|
|
173
|
+
*/
|
|
174
|
+
checked?: boolean | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the checkbox is initially ticked.
|
|
177
|
+
*
|
|
178
|
+
* To render a controlled checkbox, use the `checked` prop instead.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
defaultChecked?: boolean | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Whether the component should ignore user interaction.
|
|
184
|
+
* @default false
|
|
185
|
+
*/
|
|
186
|
+
disabled?: boolean | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* Event handler called when the checkbox is ticked or unticked.
|
|
189
|
+
*/
|
|
190
|
+
onCheckedChange?: ((checked: boolean, eventDetails: CheckboxRootChangeEventDetails) => void) | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Whether the user should be unable to tick or untick the checkbox.
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
readOnly?: boolean | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Whether the user must tick the checkbox before submitting a form.
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
required?: boolean | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Whether the checkbox is in a mixed state: neither ticked, nor unticked.
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
indeterminate?: boolean | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* A ref to access the hidden `<input>` element.
|
|
208
|
+
*/
|
|
209
|
+
inputRef?: React_2.Ref<HTMLInputElement> | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* Whether the checkbox controls a group of child checkboxes.
|
|
212
|
+
*
|
|
213
|
+
* Must be used in a [Checkbox Group](https://base-ui.com/react/components/checkbox-group).
|
|
214
|
+
* @default false
|
|
215
|
+
*/
|
|
216
|
+
parent?: boolean | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* The value submitted with the form when the checkbox is unchecked.
|
|
219
|
+
* By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
|
|
220
|
+
*/
|
|
221
|
+
uncheckedValue?: string | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* The value of the selected checkbox.
|
|
224
|
+
*/
|
|
225
|
+
value?: string | undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare interface CheckboxRootState extends FieldRootState {
|
|
229
|
+
/**
|
|
230
|
+
* Whether the checkbox is currently ticked.
|
|
231
|
+
*/
|
|
232
|
+
checked: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Whether the component should ignore user interaction.
|
|
235
|
+
*/
|
|
236
|
+
disabled: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Whether the user should be unable to tick or untick the checkbox.
|
|
239
|
+
*/
|
|
240
|
+
readOnly: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Whether the user must tick the checkbox before submitting a form.
|
|
243
|
+
*/
|
|
244
|
+
required: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Whether the checkbox is in a mixed state: neither ticked, nor unticked.
|
|
247
|
+
*/
|
|
248
|
+
indeterminate: boolean;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare const chipRemovePress: "chip-remove-press";
|
|
252
|
+
|
|
253
|
+
declare const clearPress: "clear-press";
|
|
254
|
+
|
|
255
|
+
declare const closePress: "close-press";
|
|
256
|
+
|
|
257
|
+
declare const closeWatcher: "close-watcher";
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* 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.
|
|
261
|
+
*
|
|
262
|
+
* @template Props Props to be spread on the rendered element.
|
|
263
|
+
* @template State Component's internal state.
|
|
264
|
+
*/
|
|
265
|
+
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
266
|
+
|
|
267
|
+
declare const decrementPress: "decrement-press";
|
|
268
|
+
|
|
269
|
+
declare const disabled: "disabled";
|
|
270
|
+
|
|
271
|
+
declare const drag: "drag";
|
|
272
|
+
|
|
273
|
+
declare const escapeKey: "escape-key";
|
|
274
|
+
|
|
275
|
+
declare interface FieldRootState {
|
|
276
|
+
/**
|
|
277
|
+
* Whether the component should ignore user interaction.
|
|
278
|
+
*/
|
|
279
|
+
disabled: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Whether the field has been touched.
|
|
282
|
+
*/
|
|
283
|
+
touched: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Whether the field value has changed from its initial value.
|
|
286
|
+
*/
|
|
287
|
+
dirty: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Whether the field is valid.
|
|
290
|
+
*/
|
|
291
|
+
valid: boolean | null;
|
|
292
|
+
/**
|
|
293
|
+
* Whether the field has a value.
|
|
294
|
+
*/
|
|
295
|
+
filled: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Whether the field is focused.
|
|
298
|
+
*/
|
|
299
|
+
focused: boolean;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare const focusOut: "focus-out";
|
|
303
|
+
|
|
304
|
+
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
305
|
+
ref?: React_2.Ref<T> | undefined;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
declare const imperativeAction: "imperative-action";
|
|
309
|
+
|
|
310
|
+
declare const incrementPress: "increment-press";
|
|
311
|
+
|
|
312
|
+
declare const initial: "initial";
|
|
313
|
+
|
|
314
|
+
declare const inputBlur: "input-blur";
|
|
315
|
+
|
|
316
|
+
declare const inputChange: "input-change";
|
|
317
|
+
|
|
318
|
+
declare const inputClear: "input-clear";
|
|
319
|
+
|
|
320
|
+
declare const inputPaste: "input-paste";
|
|
321
|
+
|
|
322
|
+
declare const inputPress: "input-press";
|
|
323
|
+
|
|
324
|
+
declare const itemPress: "item-press";
|
|
325
|
+
|
|
326
|
+
declare const keyboard: "keyboard";
|
|
327
|
+
|
|
328
|
+
declare const linkPress: "link-press";
|
|
329
|
+
|
|
330
|
+
declare const listNavigation: "list-navigation";
|
|
331
|
+
|
|
332
|
+
declare const missing: "missing";
|
|
333
|
+
|
|
334
|
+
declare const none: "none";
|
|
335
|
+
|
|
336
|
+
declare interface NonNativeButtonProps {
|
|
337
|
+
/**
|
|
338
|
+
* Whether the component renders a native `<button>` element when replacing it
|
|
339
|
+
* via the `render` prop.
|
|
340
|
+
* Set to `true` if the rendered element is a native button.
|
|
341
|
+
* @default false
|
|
342
|
+
*/
|
|
343
|
+
nativeButton?: boolean | undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
declare const outsidePress: "outside-press";
|
|
347
|
+
|
|
348
|
+
declare const pointer: "pointer";
|
|
349
|
+
|
|
350
|
+
declare namespace REASONS {
|
|
351
|
+
export {
|
|
352
|
+
none,
|
|
353
|
+
triggerPress,
|
|
354
|
+
triggerHover,
|
|
355
|
+
triggerFocus,
|
|
356
|
+
outsidePress,
|
|
357
|
+
itemPress,
|
|
358
|
+
closePress,
|
|
359
|
+
linkPress,
|
|
360
|
+
clearPress,
|
|
361
|
+
chipRemovePress,
|
|
362
|
+
trackPress,
|
|
363
|
+
incrementPress,
|
|
364
|
+
decrementPress,
|
|
365
|
+
inputChange,
|
|
366
|
+
inputClear,
|
|
367
|
+
inputBlur,
|
|
368
|
+
inputPaste,
|
|
369
|
+
inputPress,
|
|
370
|
+
focusOut,
|
|
371
|
+
escapeKey,
|
|
372
|
+
closeWatcher,
|
|
373
|
+
listNavigation,
|
|
374
|
+
keyboard,
|
|
375
|
+
pointer,
|
|
376
|
+
drag,
|
|
377
|
+
wheel,
|
|
378
|
+
scrub,
|
|
379
|
+
cancelOpen,
|
|
380
|
+
siblingOpen,
|
|
381
|
+
disabled,
|
|
382
|
+
missing,
|
|
383
|
+
initial,
|
|
384
|
+
imperativeAction,
|
|
385
|
+
swipe,
|
|
386
|
+
windowResize
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Maps a change `reason` string to the corresponding native event type.
|
|
392
|
+
*/
|
|
393
|
+
declare type ReasonToEvent<Reason extends string> = Reason extends keyof ReasonToEventMap ? ReasonToEventMap[Reason] : Event;
|
|
394
|
+
|
|
395
|
+
declare interface ReasonToEventMap {
|
|
396
|
+
[REASONS.none]: Event;
|
|
397
|
+
[REASONS.triggerPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
398
|
+
[REASONS.triggerHover]: MouseEvent;
|
|
399
|
+
[REASONS.triggerFocus]: FocusEvent;
|
|
400
|
+
[REASONS.outsidePress]: MouseEvent | PointerEvent | TouchEvent;
|
|
401
|
+
[REASONS.itemPress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
402
|
+
[REASONS.closePress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
403
|
+
[REASONS.linkPress]: MouseEvent | PointerEvent;
|
|
404
|
+
[REASONS.clearPress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
405
|
+
[REASONS.chipRemovePress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
406
|
+
[REASONS.trackPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
407
|
+
[REASONS.incrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
408
|
+
[REASONS.decrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
409
|
+
[REASONS.inputChange]: InputEvent | Event;
|
|
410
|
+
[REASONS.inputClear]: InputEvent | FocusEvent | Event;
|
|
411
|
+
[REASONS.inputBlur]: FocusEvent;
|
|
412
|
+
[REASONS.inputPaste]: ClipboardEvent;
|
|
413
|
+
[REASONS.inputPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
414
|
+
[REASONS.focusOut]: FocusEvent | KeyboardEvent;
|
|
415
|
+
[REASONS.escapeKey]: KeyboardEvent;
|
|
416
|
+
[REASONS.closeWatcher]: Event;
|
|
417
|
+
[REASONS.listNavigation]: KeyboardEvent;
|
|
418
|
+
[REASONS.keyboard]: KeyboardEvent;
|
|
419
|
+
[REASONS.pointer]: PointerEvent;
|
|
420
|
+
[REASONS.drag]: PointerEvent | TouchEvent;
|
|
421
|
+
[REASONS.swipe]: PointerEvent | TouchEvent;
|
|
422
|
+
[REASONS.wheel]: WheelEvent;
|
|
423
|
+
[REASONS.scrub]: PointerEvent;
|
|
424
|
+
[REASONS.cancelOpen]: MouseEvent;
|
|
425
|
+
[REASONS.siblingOpen]: Event;
|
|
426
|
+
[REASONS.disabled]: Event;
|
|
427
|
+
[REASONS.missing]: Event;
|
|
428
|
+
[REASONS.initial]: Event;
|
|
429
|
+
[REASONS.imperativeAction]: Event;
|
|
430
|
+
[REASONS.windowResize]: UIEvent;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare type RootProps = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Checkbox.Root>> & {
|
|
434
|
+
size?: number;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
declare const scrub: "scrub";
|
|
438
|
+
|
|
439
|
+
declare const siblingOpen: "sibling-open";
|
|
440
|
+
|
|
441
|
+
declare const swipe: "swipe";
|
|
442
|
+
|
|
443
|
+
declare const trackPress: "track-press";
|
|
444
|
+
|
|
445
|
+
declare type TransitionStatus = 'starting' | 'ending' | 'idle' | undefined;
|
|
446
|
+
|
|
447
|
+
declare const triggerFocus: "trigger-focus";
|
|
448
|
+
|
|
449
|
+
declare const triggerHover: "trigger-hover";
|
|
450
|
+
|
|
451
|
+
declare const triggerPress: "trigger-press";
|
|
452
|
+
|
|
453
|
+
declare const wheel: "wheel";
|
|
454
|
+
|
|
455
|
+
declare const windowResize: "window-resize";
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
459
|
+
*/
|
|
460
|
+
declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
|
|
461
|
+
|
|
462
|
+
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;
|
|
463
|
+
|
|
464
|
+
declare type WithStringClassName<P> = Omit<P, 'className'> & {
|
|
465
|
+
className?: string;
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
export { }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { CheckboxSize, Checkbox } from "../Checkbox/index.js";
|
|
4
|
+
import { Field } from "../Field/index.js";
|
|
5
|
+
import { toCssLength } from "../8027.js";
|
|
6
|
+
import * as __rspack_external_react from "react";
|
|
7
|
+
const CheckboxField_module = {
|
|
8
|
+
option: "option-o8pAcb",
|
|
9
|
+
root: "root-tqmYsF",
|
|
10
|
+
indicator: "indicator-_WzHbq",
|
|
11
|
+
optionContent: "optionContent-inaJL9",
|
|
12
|
+
optionLabel: "optionLabel-fJWxkM",
|
|
13
|
+
optionSuffix: "optionSuffix-AJytXe"
|
|
14
|
+
};
|
|
15
|
+
const CheckboxField = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, style, label, suffix, variant = 'default', error = false, errorMessage, verticalAlignment = 'center', size = CheckboxSize.medium, width, indeterminate = false, disabled = false, ...props }, ref)=>{
|
|
16
|
+
const isError = error || Boolean(errorMessage);
|
|
17
|
+
const optionWidth = toCssLength(width);
|
|
18
|
+
const optionStyle = {
|
|
19
|
+
...style,
|
|
20
|
+
...optionWidth ? {
|
|
21
|
+
'--checkbox-option-width': optionWidth
|
|
22
|
+
} : null
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
25
|
+
ref: ref,
|
|
26
|
+
className: clsx(CheckboxField_module.option, className),
|
|
27
|
+
style: optionStyle,
|
|
28
|
+
invalid: isError,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
"data-variant": variant,
|
|
31
|
+
"data-has-error-message": errorMessage ? '' : void 0,
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsxs(Checkbox.Root, {
|
|
34
|
+
...props,
|
|
35
|
+
className: CheckboxField_module.root,
|
|
36
|
+
indeterminate: indeterminate,
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
"data-variant": variant,
|
|
39
|
+
"data-vertical-alignment": verticalAlignment,
|
|
40
|
+
render: /*#__PURE__*/ jsx("label", {}),
|
|
41
|
+
size: size,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(Checkbox.Indicator, {
|
|
44
|
+
className: CheckboxField_module.indicator
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsxs("span", {
|
|
47
|
+
className: CheckboxField_module.optionContent,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ jsx("span", {
|
|
50
|
+
className: CheckboxField_module.optionLabel,
|
|
51
|
+
children: label
|
|
52
|
+
}),
|
|
53
|
+
suffix ? /*#__PURE__*/ jsx("span", {
|
|
54
|
+
className: CheckboxField_module.optionSuffix,
|
|
55
|
+
children: suffix
|
|
56
|
+
}) : null
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}),
|
|
61
|
+
isError && errorMessage ? /*#__PURE__*/ jsx(Field.Error, {
|
|
62
|
+
match: true,
|
|
63
|
+
children: errorMessage
|
|
64
|
+
}) : null
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
CheckboxField.displayName = 'CheckboxField';
|
|
69
|
+
export { CheckboxField };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import { useBaseUiId } from "../6046.js";
|
|
4
3
|
import { useStableCallback } from "../7541.js";
|
|
5
4
|
import { useLabelableContext, useFieldRootContext, fieldValidityMapping } from "../1477.js";
|
|
@@ -165,12 +164,8 @@ const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
165
164
|
});
|
|
166
165
|
});
|
|
167
166
|
if ("production" !== process.env.NODE_ENV) CheckboxGroup_CheckboxGroup.displayName = "CheckboxGroup";
|
|
168
|
-
const
|
|
169
|
-
root: "root-ZCRH6j"
|
|
170
|
-
};
|
|
171
|
-
const CheckboxGroup_CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxGroup_CheckboxGroup, {
|
|
167
|
+
const CheckboxGroup_CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef((props, ref)=>/*#__PURE__*/ jsx(CheckboxGroup_CheckboxGroup, {
|
|
172
168
|
ref: ref,
|
|
173
|
-
className: clsx(CheckboxGroup_module.root, className),
|
|
174
169
|
...props
|
|
175
170
|
}));
|
|
176
171
|
export { CheckboxGroup_CheckboxGroup_CheckboxGroup as CheckboxGroup };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.field-Tx5eMP {
|
|
2
|
+
--checkbox-group-width: auto;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
width: var(--checkbox-group-width);
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
color: var(--wst-paragraph-2-color, black);
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.field-Tx5eMP[data-fluid] {
|
|
11
|
+
width: 100%;
|
|
12
|
+
display: flex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.label-E_rDm0 {
|
|
16
|
+
font: var(--wst-paragraph-3-font);
|
|
17
|
+
color: var(--wst-paragraph-2-color, black);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.field-Tx5eMP[data-disabled] .label-E_rDm0 {
|
|
21
|
+
color: var(--wst-system-disabled-color, #939393);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.items-lFFDGE {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.items-lFFDGE[data-layout="vertical"] {
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
gap: 12px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.items-lFFDGE[data-layout="vertical"]:not([data-fluid]) > * {
|
|
36
|
+
max-width: 328px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.items-lFFDGE[data-layout="horizontal"] {
|
|
40
|
+
flex-flow: wrap;
|
|
41
|
+
gap: 12px 30px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.items-lFFDGE[data-layout="horizontal"] > * {
|
|
45
|
+
flex: 0 auto;
|
|
46
|
+
width: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.items-lFFDGE[data-layout="horizontal"]:not([data-fluid]) {
|
|
50
|
+
max-width: 990px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.items-lFFDGE[data-layout="horizontal"]:not([data-fluid]) > * {
|
|
54
|
+
max-width: 300px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.items-lFFDGE[data-fluid] > * {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CheckboxGroupProps } from '@base-ui/react/checkbox-group';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
|
|
4
|
+
declare type BaseProps = React_2.ComponentPropsWithoutRef<typeof CheckboxGroup>;
|
|
5
|
+
|
|
6
|
+
declare const CheckboxGroup: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CheckboxGroupProps, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
|
|
10
|
+
export declare const CheckboxGroupField: React_2.ForwardRefExoticComponent<CheckboxGroupFieldProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
|
|
12
|
+
export declare type CheckboxGroupFieldLayout = 'vertical' | 'horizontal';
|
|
13
|
+
|
|
14
|
+
export declare interface CheckboxGroupFieldProps extends WithStringClassName<Omit<BaseProps, 'style'>> {
|
|
15
|
+
/** Accessible label rendered above the group. */
|
|
16
|
+
label?: React_2.ReactNode;
|
|
17
|
+
/** Arranges the options in a column (`vertical`) or wrapping row (`horizontal`). */
|
|
18
|
+
layout?: CheckboxGroupFieldLayout;
|
|
19
|
+
/** Stretches the group and its options to the available width. */
|
|
20
|
+
fluid?: boolean;
|
|
21
|
+
/** Marks the group invalid and reveals `errorMessage`. */
|
|
22
|
+
error?: boolean;
|
|
23
|
+
/** Error message rendered below the group; also marks it invalid. */
|
|
24
|
+
errorMessage?: React_2.ReactNode;
|
|
25
|
+
/** Sets `aria-required` on the group for assistive tech. */
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** Fixed width of the group; accepts a number (px) or any CSS length. */
|
|
28
|
+
width?: number | string;
|
|
29
|
+
/** Inline styles applied to the field root. */
|
|
30
|
+
style?: React_2.CSSProperties;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare type WithStringClassName<P> = Omit<P, 'className'> & {
|
|
34
|
+
className?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { }
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { CheckboxGroup as CheckboxGroup_CheckboxGroup_CheckboxGroup } from "../CheckboxGroup/index.js";
|
|
4
|
+
import { Field } from "../Field/index.js";
|
|
5
|
+
import { toCssLength } from "../8027.js";
|
|
6
|
+
import * as __rspack_external_react from "react";
|
|
7
|
+
const CheckboxGroupField_module = {
|
|
8
|
+
field: "field-Tx5eMP",
|
|
9
|
+
label: "label-E_rDm0",
|
|
10
|
+
items: "items-lFFDGE"
|
|
11
|
+
};
|
|
12
|
+
const CheckboxGroupField = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, style, children, label, layout = 'vertical', fluid = false, error = false, errorMessage, required = false, width, disabled = false, 'aria-labelledby': ariaLabelledBy, 'aria-required': ariaRequired, ...props }, ref)=>{
|
|
13
|
+
const generatedLabelId = __rspack_external_react.useId();
|
|
14
|
+
const isError = error || Boolean(errorMessage);
|
|
15
|
+
const labelId = label ? generatedLabelId : void 0;
|
|
16
|
+
const labelledBy = labelId && ariaLabelledBy ? `${ariaLabelledBy} ${labelId}` : labelId ?? ariaLabelledBy;
|
|
17
|
+
const groupWidth = toCssLength(width);
|
|
18
|
+
const groupStyle = {
|
|
19
|
+
...style,
|
|
20
|
+
...groupWidth ? {
|
|
21
|
+
'--checkbox-group-width': groupWidth
|
|
22
|
+
} : null
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
25
|
+
className: clsx(CheckboxGroupField_module.field, className),
|
|
26
|
+
style: groupStyle,
|
|
27
|
+
invalid: isError,
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
"data-fluid": fluid ? '' : void 0,
|
|
30
|
+
children: [
|
|
31
|
+
label ? /*#__PURE__*/ jsx("span", {
|
|
32
|
+
id: labelId,
|
|
33
|
+
className: CheckboxGroupField_module.label,
|
|
34
|
+
children: label
|
|
35
|
+
}) : null,
|
|
36
|
+
/*#__PURE__*/ jsx(CheckboxGroup_CheckboxGroup_CheckboxGroup, {
|
|
37
|
+
ref: ref,
|
|
38
|
+
className: CheckboxGroupField_module.items,
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
"data-layout": layout,
|
|
41
|
+
"data-fluid": fluid ? '' : void 0,
|
|
42
|
+
"aria-labelledby": labelledBy,
|
|
43
|
+
"aria-required": required ? true : ariaRequired,
|
|
44
|
+
...props,
|
|
45
|
+
children: children
|
|
46
|
+
}),
|
|
47
|
+
isError && errorMessage ? /*#__PURE__*/ jsx(Field.Error, {
|
|
48
|
+
match: true,
|
|
49
|
+
children: errorMessage
|
|
50
|
+
}) : null
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
CheckboxGroupField.displayName = 'CheckboxGroupField';
|
|
55
|
+
export { CheckboxGroupField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1149,7 +1149,9 @@ declare type BaseListProps = WithStringClassName<React_2.ComponentPropsWithoutRe
|
|
|
1149
1149
|
|
|
1150
1150
|
declare type BaseProps = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Button_2>>;
|
|
1151
1151
|
|
|
1152
|
-
declare type BaseProps_2 =
|
|
1152
|
+
declare type BaseProps_2 = React_2.ComponentPropsWithoutRef<typeof CheckboxGroup>;
|
|
1153
|
+
|
|
1154
|
+
declare type BaseProps_3 = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Separator_2>>;
|
|
1153
1155
|
|
|
1154
1156
|
declare type BaseUIChangeEventDetail<Reason extends string, CustomProperties extends object> = {
|
|
1155
1157
|
/**
|
|
@@ -1312,6 +1314,42 @@ export declare const Checkbox: {
|
|
|
1312
1314
|
} & React_2.RefAttributes<HTMLSpanElement>>;
|
|
1313
1315
|
};
|
|
1314
1316
|
|
|
1317
|
+
export declare namespace Checkbox_2 {
|
|
1318
|
+
export {
|
|
1319
|
+
CheckboxRoot as Root,
|
|
1320
|
+
CheckboxIndicator as Indicator
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
export declare const CheckboxField: React_2.ForwardRefExoticComponent<CheckboxFieldProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
1325
|
+
|
|
1326
|
+
export declare interface CheckboxFieldProps extends Omit<RootProps, 'children' | 'className' | 'style' | 'render' | 'nativeButton' | 'size'> {
|
|
1327
|
+
/** Visible label rendered beside the checkbox. */
|
|
1328
|
+
label: React_2.ReactNode;
|
|
1329
|
+
/** Extra inline content rendered after the label (e.g. a price or badge). */
|
|
1330
|
+
suffix?: React_2.ReactNode;
|
|
1331
|
+
/** Visual style: a plain checkbox row or a selectable `box` tile. */
|
|
1332
|
+
variant?: CheckboxFieldVariant;
|
|
1333
|
+
/** Marks the field invalid, colouring the control and revealing `errorMessage`. */
|
|
1334
|
+
error?: boolean;
|
|
1335
|
+
/** Error message rendered below the option; also marks the field invalid. */
|
|
1336
|
+
errorMessage?: React_2.ReactNode;
|
|
1337
|
+
/** Aligns the control with the first line (`top`) or the label's centre. */
|
|
1338
|
+
verticalAlignment?: CheckboxFieldVerticalAlignment;
|
|
1339
|
+
/** Size of the checkbox control in pixels. */
|
|
1340
|
+
size?: number;
|
|
1341
|
+
/** Fixed width of the option; accepts a number (px) or any CSS length. */
|
|
1342
|
+
width?: number | string;
|
|
1343
|
+
/** Class applied to the field root. */
|
|
1344
|
+
className?: string;
|
|
1345
|
+
/** Inline styles applied to the field root. */
|
|
1346
|
+
style?: React_2.CSSProperties;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
export declare type CheckboxFieldVariant = 'default' | 'box';
|
|
1350
|
+
|
|
1351
|
+
export declare type CheckboxFieldVerticalAlignment = 'center' | 'top';
|
|
1352
|
+
|
|
1315
1353
|
export declare const CheckboxGroup: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CheckboxGroupProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
1316
1354
|
className?: string | undefined;
|
|
1317
1355
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -1334,6 +1372,29 @@ export declare type CheckboxGroupChangeEventDetails = BaseUIChangeEventDetails<C
|
|
|
1334
1372
|
|
|
1335
1373
|
export declare type CheckboxGroupChangeEventReason = typeof REASONS.none;
|
|
1336
1374
|
|
|
1375
|
+
export declare const CheckboxGroupField: React_2.ForwardRefExoticComponent<CheckboxGroupFieldProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
1376
|
+
|
|
1377
|
+
export declare type CheckboxGroupFieldLayout = 'vertical' | 'horizontal';
|
|
1378
|
+
|
|
1379
|
+
export declare interface CheckboxGroupFieldProps extends WithStringClassName<Omit<BaseProps_2, 'style'>> {
|
|
1380
|
+
/** Accessible label rendered above the group. */
|
|
1381
|
+
label?: React_2.ReactNode;
|
|
1382
|
+
/** Arranges the options in a column (`vertical`) or wrapping row (`horizontal`). */
|
|
1383
|
+
layout?: CheckboxGroupFieldLayout;
|
|
1384
|
+
/** Stretches the group and its options to the available width. */
|
|
1385
|
+
fluid?: boolean;
|
|
1386
|
+
/** Marks the group invalid and reveals `errorMessage`. */
|
|
1387
|
+
error?: boolean;
|
|
1388
|
+
/** Error message rendered below the group; also marks it invalid. */
|
|
1389
|
+
errorMessage?: React_2.ReactNode;
|
|
1390
|
+
/** Sets `aria-required` on the group for assistive tech. */
|
|
1391
|
+
required?: boolean;
|
|
1392
|
+
/** Fixed width of the group; accepts a number (px) or any CSS length. */
|
|
1393
|
+
width?: number | string;
|
|
1394
|
+
/** Inline styles applied to the field root. */
|
|
1395
|
+
style?: React_2.CSSProperties;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1337
1398
|
export declare interface CheckboxGroupProps extends BaseUIComponentProps<'div', CheckboxGroupState> {
|
|
1338
1399
|
/**
|
|
1339
1400
|
* Names of the checkboxes in the group that should be ticked.
|
|
@@ -1517,7 +1578,7 @@ export declare interface CheckboxRootState extends FieldRootState {
|
|
|
1517
1578
|
|
|
1518
1579
|
export declare const CheckboxSize: {
|
|
1519
1580
|
readonly small: 12;
|
|
1520
|
-
readonly medium:
|
|
1581
|
+
readonly medium: 14;
|
|
1521
1582
|
readonly large: 20;
|
|
1522
1583
|
};
|
|
1523
1584
|
|
|
@@ -8734,17 +8795,21 @@ declare function Root_2<Value = any>({ className, dir, separator, 'aria-label':
|
|
|
8734
8795
|
|
|
8735
8796
|
declare function Root_3<Value = any>({ className, orientation, ...props }: WithStringClassName<NavigationMenu_2.Root.Props<Value>>): JSX_2.Element;
|
|
8736
8797
|
|
|
8737
|
-
declare function Root_4<Value>({ className, size, style, ...props }:
|
|
8798
|
+
declare function Root_4<Value>({ className, size, style, ...props }: RootProps_2<Value>): JSX_2.Element;
|
|
8738
8799
|
|
|
8739
|
-
declare function Root_5<Value extends number | ReadonlyArray<number>>({ className, size, style, ...props }:
|
|
8800
|
+
declare function Root_5<Value extends number | ReadonlyArray<number>>({ className, size, style, ...props }: RootProps_3<Value>): JSX_2.Element;
|
|
8740
8801
|
|
|
8741
8802
|
declare type RootOwnProps = Omit<React_2.ComponentProps<typeof Select.Root>, 'children'>;
|
|
8742
8803
|
|
|
8743
|
-
declare type RootProps
|
|
8804
|
+
export declare type RootProps = WithStringClassName<React_2.ComponentPropsWithoutRef<typeof Checkbox_2.Root>> & {
|
|
8805
|
+
size?: number;
|
|
8806
|
+
};
|
|
8807
|
+
|
|
8808
|
+
declare type RootProps_2<Value> = WithStringClassName<Radio_2.Root.Props<Value>> & {
|
|
8744
8809
|
size?: number;
|
|
8745
8810
|
};
|
|
8746
8811
|
|
|
8747
|
-
declare type
|
|
8812
|
+
declare type RootProps_3<Value extends number | ReadonlyArray<number>> = WithStringClassName<Slider_2.Root.Props<Value>> & {
|
|
8748
8813
|
size?: number;
|
|
8749
8814
|
};
|
|
8750
8815
|
|
|
@@ -11599,7 +11664,7 @@ export declare interface SeparatorProps extends BaseUIComponentProps<'div', Sepa
|
|
|
11599
11664
|
orientation?: Orientation | undefined;
|
|
11600
11665
|
}
|
|
11601
11666
|
|
|
11602
|
-
declare interface SeparatorProps_3 extends
|
|
11667
|
+
declare interface SeparatorProps_3 extends BaseProps_3 {
|
|
11603
11668
|
variant?: SeparatorVariant;
|
|
11604
11669
|
}
|
|
11605
11670
|
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export { Box } from "./Box/index.js";
|
|
|
7
7
|
export { Breadcrumbs } from "./Breadcrumbs/index.js";
|
|
8
8
|
export { Button } from "./Button/index.js";
|
|
9
9
|
export { Checkbox, CheckboxSize } from "./Checkbox/index.js";
|
|
10
|
+
export { CheckboxField } from "./CheckboxField/index.js";
|
|
10
11
|
export { CheckboxGroup } from "./CheckboxGroup/index.js";
|
|
12
|
+
export { CheckboxGroupField } from "./CheckboxGroupField/index.js";
|
|
11
13
|
export { Collapsible } from "./Collapsible/index.js";
|
|
12
14
|
export { Combobox } from "./Combobox/index.js";
|
|
13
15
|
export { ContextMenu } from "./ContextMenu/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/site-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.110.0",
|
|
4
4
|
"description": "Pure UI components for the Wix site builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"registry": "https://registry.npmjs.org/",
|
|
96
96
|
"access": "public"
|
|
97
97
|
},
|
|
98
|
-
"falconPackageHash": "
|
|
98
|
+
"falconPackageHash": "e915d0e03facd56b79682806f5724da5224732c987bb2cdce48058c8"
|
|
99
99
|
}
|