@vjdesigns/vjdesigns-ui 3.2.0 → 3.4.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/README.md +9 -0
- package/dist/ai/llms-full.txt +3 -1
- package/dist/ai/registry.json +11 -1
- package/dist/components/forms/CheckBox/CheckBox.cjs.js +1 -1
- package/dist/components/forms/CheckBox/CheckBox.d.ts +9 -1
- package/dist/components/forms/CheckBox/CheckBox.mjs +171 -135
- package/dist/components/forms/CheckBox/CheckBox.module.css.cjs.js +1 -1
- package/dist/components/forms/CheckBox/CheckBox.module.css.mjs +5 -3
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -753,6 +753,15 @@ To manage several options as one `string[]` value, use `CheckBoxGroup`:
|
|
|
753
753
|
</CheckBoxGroup>
|
|
754
754
|
```
|
|
755
755
|
|
|
756
|
+
For a "select all" box, pass its label as `selectAll`. The group adds the parent box, keeps its checked and mixed states in sync, and links the options to it, so screen readers announce them as belonging to it. Disabled options keep their state.
|
|
757
|
+
|
|
758
|
+
```tsx
|
|
759
|
+
<CheckBoxGroup label="Pizza order" selectAll="All toppings" name="toppings">
|
|
760
|
+
<CheckBox value="cheese" label="Cheese" />
|
|
761
|
+
<CheckBox value="peppers" label="Peppers" />
|
|
762
|
+
</CheckBoxGroup>
|
|
763
|
+
```
|
|
764
|
+
|
|
756
765
|
---
|
|
757
766
|
|
|
758
767
|
## Pro
|
package/dist/ai/llms-full.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @vjdesigns/vjdesigns-ui 3.
|
|
1
|
+
# @vjdesigns/vjdesigns-ui 3.3.0: full reference
|
|
2
2
|
|
|
3
3
|
> Accessible React 19 component library: WCAG 2.2 AA verified (axe on every story, a contrast check on every color pair), 31 languages with right-to-left support, themeable with any brand color (auto-adjusted to stay accessible), tree-shakable, no runtime dependencies besides React.
|
|
4
4
|
|
|
@@ -2704,6 +2704,7 @@ Works standalone, inside `Field`, and as an option in `CheckBoxGroup`.
|
|
|
2704
2704
|
- Label Position
|
|
2705
2705
|
- Group
|
|
2706
2706
|
- Select all (indeterminate parent)
|
|
2707
|
+
- Select all with a disabled option
|
|
2707
2708
|
- Controlled
|
|
2708
2709
|
- Composition: terms acceptance
|
|
2709
2710
|
|
|
@@ -2731,6 +2732,7 @@ legend, or by `aria-label`/`aria-labelledby`.
|
|
|
2731
2732
|
- `invalid`: `boolean`. Danger styling and `aria-invalid` on every option. Inherits from `Field`.
|
|
2732
2733
|
- `label`: `ReactNode`. Visible group label for standalone use. Inside a `Fieldset`, the legend labels the group instead.
|
|
2733
2734
|
- `description`: `ReactNode`. Supporting text below the group label, linked with `aria-describedby`.
|
|
2735
|
+
- `selectAll`: `ReactNode`. Label of a parent "select all" box above the options (for example "All toppings"). It checks or clears every enabled option and shows a mixed state when only some are checked. The options are wrapped in a nested group named by this label, and the box lists them in `aria-controls`, so screen readers announce that they belong to it.
|
|
2734
2736
|
- `children`: `ReactNode`. `CheckBox` options, each with a unique `value`.
|
|
2735
2737
|
- Plus every native `<div>` attribute (className, style, id, aria-*, data-*, event handlers), spread onto the root.
|
|
2736
2738
|
|
package/dist/ai/registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vjdesigns/vjdesigns-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"summary": "Accessible React 19 component library: WCAG 2.2 AA verified (axe on every story, a contrast check on every color pair), 31 languages with right-to-left support, themeable with any brand color (auto-adjusted to stay accessible), tree-shakable, no runtime dependencies besides React.",
|
|
5
5
|
"install": "npm install @vjdesigns/vjdesigns-ui",
|
|
6
6
|
"stylesheet": "@vjdesigns/vjdesigns-ui/dist/vjdesigns-ui.css",
|
|
@@ -6371,6 +6371,10 @@
|
|
|
6371
6371
|
"name": "Select all (indeterminate parent)",
|
|
6372
6372
|
"description": ""
|
|
6373
6373
|
},
|
|
6374
|
+
{
|
|
6375
|
+
"name": "Select all with a disabled option",
|
|
6376
|
+
"description": ""
|
|
6377
|
+
},
|
|
6374
6378
|
{
|
|
6375
6379
|
"name": "Controlled",
|
|
6376
6380
|
"description": ""
|
|
@@ -6461,6 +6465,12 @@
|
|
|
6461
6465
|
"required": false,
|
|
6462
6466
|
"description": "Supporting text below the group label, linked with `aria-describedby`."
|
|
6463
6467
|
},
|
|
6468
|
+
{
|
|
6469
|
+
"name": "selectAll",
|
|
6470
|
+
"type": "ReactNode",
|
|
6471
|
+
"required": false,
|
|
6472
|
+
"description": "Label of a parent \"select all\" box above the options (for example\r\n\"All toppings\"). It checks or clears every enabled option and shows a\r\nmixed state when only some are checked. The options are wrapped in a\r\nnested group named by this label, and the box lists them in\r\n`aria-controls`, so screen readers announce that they belong to it."
|
|
6473
|
+
},
|
|
6464
6474
|
{
|
|
6465
6475
|
"name": "children",
|
|
6466
6476
|
"type": "ReactNode",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../Field/FieldContext.cjs.js"),a=require("./CheckBox.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c={sm:a.default.sm,md:a.default.md,lg:a.default.lg},l={neutral:a.default.toneNeutral,primary:a.default.tonePrimary,accent:a.default.toneAccent,success:a.default.toneSuccess,warning:a.default.toneWarning,danger:a.default.toneDanger,info:a.default.toneInfo},u={end:a.default.labelEnd,start:a.default.labelStart},d={vertical:a.default.vertical,horizontal:a.default.horizontal},f=(0,o.createContext)(null);function p({checked:d,defaultChecked:p=!1,onCheckedChange:m,indeterminate:h=!1,label:g,description:_,size:v,tone:y,invalid:b,disabled:x,required:S,readOnly:C,labelPosition:w=`end`,value:T,name:E,id:D,className:O,style:k,ref:A,onChange:j,onClick:M,"aria-describedby":N,...P}){let F=(0,o.useContext)(f),I=(0,o.useId)(),L=(0,o.useId)(),R=i.useFieldControl({id:D??(F?I:void 0),invalid:b??F?.invalid,required:S,disabled:x??(F?.disabled||void 0),readOnly:C??(F?.readOnly||void 0),size:v??F?.size,"aria-describedby":[_?L:void 0,N].filter(Boolean).join(` `)||void 0}),z=R.id??I,B=R.size??`md`,V=y??F?.tone??`primary`,{disabled:H,readOnly:U,invalid:W}=R,G=F?[_?L:void 0,F.itemDescribedBy,N].filter(Boolean).join(` `)||void 0:R.ariaProps[`aria-describedby`],[K,q]=e.useControllableState({value:d,defaultValue:p,onChange:m});t.useFormReset(()=>
|
|
1
|
+
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../Field/FieldContext.cjs.js"),a=require("./CheckBox.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c={sm:a.default.sm,md:a.default.md,lg:a.default.lg},l={neutral:a.default.toneNeutral,primary:a.default.tonePrimary,accent:a.default.toneAccent,success:a.default.toneSuccess,warning:a.default.toneWarning,danger:a.default.toneDanger,info:a.default.toneInfo},u={end:a.default.labelEnd,start:a.default.labelStart},d={vertical:a.default.vertical,horizontal:a.default.horizontal},f=(0,o.createContext)(null);function p({checked:d,defaultChecked:p=!1,onCheckedChange:m,indeterminate:h=!1,label:g,description:_,size:v,tone:y,invalid:b,disabled:x,required:S,readOnly:C,labelPosition:w=`end`,value:T,name:E,id:D,className:O,style:k,ref:A,onChange:j,onClick:M,"aria-describedby":N,...P}){let F=(0,o.useContext)(f),I=(0,o.useId)(),L=(0,o.useId)(),R=i.useFieldControl({id:D??(F?I:void 0),invalid:b??F?.invalid,required:S,disabled:x??(F?.disabled||void 0),readOnly:C??(F?.readOnly||void 0),size:v??F?.size,"aria-describedby":[_?L:void 0,N].filter(Boolean).join(` `)||void 0}),z=R.id??I,B=R.size??`md`,V=y??F?.tone??`primary`,{disabled:H,readOnly:U,invalid:W}=R,G=F?[_?L:void 0,F.itemDescribedBy,N].filter(Boolean).join(` `)||void 0:R.ariaProps[`aria-describedby`],[K,q]=e.useControllableState({value:d,defaultValue:p,onChange:m});t.useFormReset(()=>Z.current,()=>F?F.reset():q(p??!1),F?!0:d===void 0);let J=T??`on`,Y=F?F.value.includes(J):K,X=F?.register;(0,o.useLayoutEffect)(()=>X?.(J,z,!!H),[X,J,z,H]);let Z=(0,o.useRef)(null);(0,o.useLayoutEffect)(()=>{Z.current&&(Z.current.indeterminate=h)});let Q=(0,o.useCallback)(e=>{if(Z.current=e,typeof A==`function`)return A(e);A&&(A.current=e)},[A]),$=e=>{M?.(e),U&&e.preventDefault()},ee=e=>{if(j?.(e),U)return;let t=e.target.checked;F?(F.toggle(J,t),m?.(t)):q(t)};return(0,s.jsxs)(`div`,{className:n.cx(a.default.root,c[B],l[V],u[w],O),style:k,"data-disabled":H||void 0,"data-invalid":W||void 0,"data-readonly":U||void 0,children:[(0,s.jsxs)(`span`,{className:a.default.controlWrap,children:[(0,s.jsx)(`input`,{...P,ref:Q,type:`checkbox`,id:z,name:E??F?.name,value:J,checked:Y,disabled:H,required:F?void 0:R.required,"aria-describedby":G,"aria-invalid":R.ariaProps[`aria-invalid`],"aria-errormessage":F?void 0:R.ariaProps[`aria-errormessage`],"aria-readonly":U||void 0,className:a.default.input,onClick:$,onChange:ee}),(0,s.jsxs)(`span`,{className:a.default.control,"aria-hidden":`true`,children:[(0,s.jsx)(r.CheckIcon,{className:n.cx(a.default.mark,a.default.check),strokeWidth:3.5}),(0,s.jsx)(r.MinusIcon,{className:n.cx(a.default.mark,a.default.minus),strokeWidth:3.5})]})]}),(g||_)&&(0,s.jsxs)(`span`,{className:a.default.text,children:[g&&(0,s.jsx)(`label`,{id:`${z}-label`,htmlFor:z,className:a.default.label,children:g}),_&&(0,s.jsx)(`span`,{id:L,className:a.default.description,children:_})]})]})}function m({value:t,defaultValue:r=[],onValueChange:l,name:u,orientation:m=`vertical`,size:h,tone:g,disabled:_,readOnly:v,invalid:y,label:b,description:x,selectAll:S,className:C,children:w,"aria-labelledby":T,"aria-describedby":E,...D}){let O=i.useFieldContext(),k=(0,o.useId)(),A=(0,o.useId)(),j=(0,o.useId)(),M=i.useFieldControl({invalid:y,disabled:_,readOnly:v,size:h,"aria-describedby":[x?A:void 0,E].filter(Boolean).join(` `)||void 0}),[N,P]=e.useControllableState({value:t,defaultValue:r,onChange:l}),F=(0,o.useCallback)((e,t)=>{P(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e))},[P]),[I,L]=(0,o.useState)(()=>new Map),R=S!=null&&S!==!1,z=(0,o.useCallback)((e,t,n)=>(L(r=>new Map(r).set(e,{id:t,disabled:n})),()=>L(n=>{if(n.get(e)?.id!==t)return n;let r=new Map(n);return r.delete(e),r})),[]),B=[...I].filter(([,e])=>!e.disabled).map(([e])=>e),V=B.length>0&&B.every(e=>N.includes(e)),H=[...I.keys()].some(e=>N.includes(e)),U=e=>P(t=>e?[...t,...B.filter(e=>!t.includes(e))]:t.filter(e=>!B.includes(e))),W=O?.isGroup===!0&&!T&&!b,G=[T,b?k:void 0].filter(Boolean).join(` `)||void 0,K=[x?A:void 0,E].filter(Boolean).join(` `)||void 0,q={name:u,value:N,toggle:F,size:M.size,tone:g,disabled:M.disabled,readOnly:M.readOnly,invalid:M.invalid,reset:()=>{t===void 0&&P(r??[])},itemDescribedBy:W?K:void 0,register:R?z:void 0},J=(0,s.jsx)(`div`,{className:n.cx(a.default.options,d[m],R&&a.default.selectAllOptions),role:R?`group`:void 0,"aria-labelledby":R?`${j}-label`:void 0,children:(0,s.jsx)(f.Provider,{value:q,children:w})});return(0,s.jsxs)(`div`,{...D,role:W?void 0:`group`,"aria-labelledby":W?void 0:G,"aria-describedby":W?K:M.ariaProps[`aria-describedby`],className:n.cx(a.default.group,c[M.size??`md`],C),"data-disabled":M.disabled||void 0,"aria-disabled":M.disabled||void 0,children:[(b||x)&&(0,s.jsxs)(`div`,{className:a.default.groupHeader,children:[b&&(0,s.jsx)(`span`,{id:k,className:a.default.groupLabel,children:b}),x&&(0,s.jsx)(`span`,{id:A,className:a.default.description,children:x})]}),R?(0,s.jsxs)(`div`,{className:a.default.selectAll,children:[(0,s.jsx)(i.FieldContext.Provider,{value:null,children:(0,s.jsx)(p,{id:j,label:S,checked:V,indeterminate:H&&!V,onCheckedChange:U,"aria-controls":[...I.values()].map(e=>e.id).join(` `)||void 0,size:M.size,tone:g,disabled:M.disabled||B.length===0,readOnly:M.readOnly,invalid:M.invalid})}),J]}):J]})}exports.CheckBox=p,exports.CheckBoxGroup=m;
|
|
@@ -68,6 +68,14 @@ export interface CheckBoxGroupProps extends Omit<ComponentPropsWithRef<"div">, "
|
|
|
68
68
|
label?: ReactNode;
|
|
69
69
|
/** Supporting text below the group label, linked with `aria-describedby`. */
|
|
70
70
|
description?: ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Label of a parent "select all" box above the options (for example
|
|
73
|
+
* "All toppings"). It checks or clears every enabled option and shows a
|
|
74
|
+
* mixed state when only some are checked. The options are wrapped in a
|
|
75
|
+
* nested group named by this label, and the box lists them in
|
|
76
|
+
* `aria-controls`, so screen readers announce that they belong to it.
|
|
77
|
+
*/
|
|
78
|
+
selectAll?: ReactNode;
|
|
71
79
|
/** `CheckBox` options, each with a unique `value`. */
|
|
72
80
|
children?: ReactNode;
|
|
73
81
|
}
|
|
@@ -76,4 +84,4 @@ export interface CheckBoxGroupProps extends Omit<ComponentPropsWithRef<"div">, "
|
|
|
76
84
|
* `role="group"` labelled by its own `label`, by a surrounding `Fieldset`'s
|
|
77
85
|
* legend, or by `aria-label`/`aria-labelledby`.
|
|
78
86
|
*/
|
|
79
|
-
export declare function CheckBoxGroup({ value: valueProp, defaultValue, onValueChange, name, orientation, size: sizeProp, tone, disabled: disabledProp, readOnly: readOnlyProp, invalid: invalidProp, label, description, className, children, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...rest }: CheckBoxGroupProps): import("react").JSX.Element;
|
|
87
|
+
export declare function CheckBoxGroup({ value: valueProp, defaultValue, onValueChange, name, orientation, size: sizeProp, tone, disabled: disabledProp, readOnly: readOnlyProp, invalid: invalidProp, label, description, selectAll, className, children, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...rest }: CheckBoxGroupProps): import("react").JSX.Element;
|
|
@@ -3,166 +3,202 @@ import { useControllableState as e } from "../../../hooks/useControllableState.m
|
|
|
3
3
|
import { useFormReset as t } from "../../../hooks/useFormReset.mjs";
|
|
4
4
|
import { cx as n } from "../../../utils/cx.mjs";
|
|
5
5
|
import { CheckIcon as r, MinusIcon as i } from "../../primitives/Icon/icons.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { createContext as
|
|
9
|
-
import { jsx as
|
|
6
|
+
import { FieldContext as a, useFieldContext as o, useFieldControl as s } from "../Field/FieldContext.mjs";
|
|
7
|
+
import c from "./CheckBox.module.css.mjs";
|
|
8
|
+
import { createContext as l, useCallback as u, useContext as d, useId as f, useLayoutEffect as p, useRef as m, useState as h } from "react";
|
|
9
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
10
|
// src/components/forms/CheckBox/CheckBox.tsx
|
|
11
|
-
var
|
|
12
|
-
sm:
|
|
13
|
-
md:
|
|
14
|
-
lg:
|
|
15
|
-
}, _ = {
|
|
16
|
-
neutral: s.toneNeutral,
|
|
17
|
-
primary: s.tonePrimary,
|
|
18
|
-
accent: s.toneAccent,
|
|
19
|
-
success: s.toneSuccess,
|
|
20
|
-
warning: s.toneWarning,
|
|
21
|
-
danger: s.toneDanger,
|
|
22
|
-
info: s.toneInfo
|
|
23
|
-
}, v = {
|
|
24
|
-
end: s.labelEnd,
|
|
25
|
-
start: s.labelStart
|
|
11
|
+
var v = {
|
|
12
|
+
sm: c.sm,
|
|
13
|
+
md: c.md,
|
|
14
|
+
lg: c.lg
|
|
26
15
|
}, y = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
neutral: c.toneNeutral,
|
|
17
|
+
primary: c.tonePrimary,
|
|
18
|
+
accent: c.toneAccent,
|
|
19
|
+
success: c.toneSuccess,
|
|
20
|
+
warning: c.toneWarning,
|
|
21
|
+
danger: c.toneDanger,
|
|
22
|
+
info: c.toneInfo
|
|
23
|
+
}, b = {
|
|
24
|
+
end: c.labelEnd,
|
|
25
|
+
start: c.labelStart
|
|
26
|
+
}, x = {
|
|
27
|
+
vertical: c.vertical,
|
|
28
|
+
horizontal: c.horizontal
|
|
29
|
+
}, S = l(null);
|
|
30
|
+
function C({ checked: a, defaultChecked: o = !1, onCheckedChange: l, indeterminate: h = !1, label: x, description: C, size: w, tone: T, invalid: E, disabled: D, required: ee, readOnly: te, labelPosition: O = "end", value: k, name: A, id: j, className: M, style: N, ref: P, onChange: F, onClick: I, "aria-describedby": L, ...R }) {
|
|
31
|
+
let z = d(S), B = f(), V = f(), H = s({
|
|
32
|
+
id: j ?? (z ? B : void 0),
|
|
33
|
+
invalid: E ?? z?.invalid,
|
|
34
|
+
required: ee,
|
|
35
|
+
disabled: D ?? (z?.disabled || void 0),
|
|
36
|
+
readOnly: te ?? (z?.readOnly || void 0),
|
|
37
|
+
size: w ?? z?.size,
|
|
38
|
+
"aria-describedby": [C ? V : void 0, L].filter(Boolean).join(" ") || void 0
|
|
39
|
+
}), U = H.id ?? B, W = H.size ?? "md", G = T ?? z?.tone ?? "primary", { disabled: K, readOnly: q, invalid: J } = H, Y = z ? [
|
|
40
|
+
C ? V : void 0,
|
|
41
|
+
z.itemDescribedBy,
|
|
42
|
+
L
|
|
43
|
+
].filter(Boolean).join(" ") || void 0 : H.ariaProps["aria-describedby"], [X, Z] = e({
|
|
44
44
|
value: a,
|
|
45
|
-
defaultValue:
|
|
46
|
-
onChange:
|
|
45
|
+
defaultValue: o,
|
|
46
|
+
onChange: l
|
|
47
47
|
});
|
|
48
|
-
t(() => $.current, () =>
|
|
49
|
-
let Q =
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
t(() => $.current, () => z ? z.reset() : Z(o ?? !1), z ? !0 : a === void 0);
|
|
49
|
+
let Q = k ?? "on", ne = z ? z.value.includes(Q) : X, re = z?.register;
|
|
50
|
+
p(() => re?.(Q, U, !!K), [
|
|
51
|
+
re,
|
|
52
|
+
Q,
|
|
53
|
+
U,
|
|
54
|
+
K
|
|
55
|
+
]);
|
|
56
|
+
let $ = m(null);
|
|
57
|
+
p(() => {
|
|
58
|
+
$.current && ($.current.indeterminate = h);
|
|
52
59
|
});
|
|
53
|
-
let
|
|
54
|
-
if ($.current = e, typeof
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
60
|
+
let ie = u((e) => {
|
|
61
|
+
if ($.current = e, typeof P == "function") return P(e);
|
|
62
|
+
P && (P.current = e);
|
|
63
|
+
}, [P]), ae = (e) => {
|
|
64
|
+
I?.(e), q && e.preventDefault();
|
|
65
|
+
}, oe = (e) => {
|
|
66
|
+
if (F?.(e), q) return;
|
|
60
67
|
let t = e.target.checked;
|
|
61
|
-
|
|
68
|
+
z ? (z.toggle(Q, t), l?.(t)) : Z(t);
|
|
62
69
|
};
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
className: n(
|
|
65
|
-
style:
|
|
66
|
-
"data-disabled":
|
|
67
|
-
"data-invalid":
|
|
68
|
-
"data-readonly":
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
-
className:
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
-
...
|
|
73
|
-
ref:
|
|
70
|
+
return /* @__PURE__ */ _("div", {
|
|
71
|
+
className: n(c.root, v[W], y[G], b[O], M),
|
|
72
|
+
style: N,
|
|
73
|
+
"data-disabled": K || void 0,
|
|
74
|
+
"data-invalid": J || void 0,
|
|
75
|
+
"data-readonly": q || void 0,
|
|
76
|
+
children: [/* @__PURE__ */ _("span", {
|
|
77
|
+
className: c.controlWrap,
|
|
78
|
+
children: [/* @__PURE__ */ g("input", {
|
|
79
|
+
...R,
|
|
80
|
+
ref: ie,
|
|
74
81
|
type: "checkbox",
|
|
75
|
-
id:
|
|
76
|
-
name:
|
|
82
|
+
id: U,
|
|
83
|
+
name: A ?? z?.name,
|
|
77
84
|
value: Q,
|
|
78
85
|
checked: ne,
|
|
79
|
-
disabled:
|
|
80
|
-
required:
|
|
81
|
-
"aria-describedby":
|
|
82
|
-
"aria-invalid":
|
|
83
|
-
"aria-errormessage":
|
|
84
|
-
"aria-readonly":
|
|
85
|
-
className:
|
|
86
|
-
onClick:
|
|
87
|
-
onChange:
|
|
88
|
-
}), /* @__PURE__ */
|
|
89
|
-
className:
|
|
86
|
+
disabled: K,
|
|
87
|
+
required: z ? void 0 : H.required,
|
|
88
|
+
"aria-describedby": Y,
|
|
89
|
+
"aria-invalid": H.ariaProps["aria-invalid"],
|
|
90
|
+
"aria-errormessage": z ? void 0 : H.ariaProps["aria-errormessage"],
|
|
91
|
+
"aria-readonly": q || void 0,
|
|
92
|
+
className: c.input,
|
|
93
|
+
onClick: ae,
|
|
94
|
+
onChange: oe
|
|
95
|
+
}), /* @__PURE__ */ _("span", {
|
|
96
|
+
className: c.control,
|
|
90
97
|
"aria-hidden": "true",
|
|
91
|
-
children: [/* @__PURE__ */
|
|
92
|
-
className: n(
|
|
98
|
+
children: [/* @__PURE__ */ g(r, {
|
|
99
|
+
className: n(c.mark, c.check),
|
|
93
100
|
strokeWidth: 3.5
|
|
94
|
-
}), /* @__PURE__ */
|
|
95
|
-
className: n(
|
|
101
|
+
}), /* @__PURE__ */ g(i, {
|
|
102
|
+
className: n(c.mark, c.minus),
|
|
96
103
|
strokeWidth: 3.5
|
|
97
104
|
})]
|
|
98
105
|
})]
|
|
99
|
-
}), (
|
|
100
|
-
className:
|
|
101
|
-
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
}), (x || C) && /* @__PURE__ */ _("span", {
|
|
107
|
+
className: c.text,
|
|
108
|
+
children: [x && /* @__PURE__ */ g("label", {
|
|
109
|
+
id: `${U}-label`,
|
|
110
|
+
htmlFor: U,
|
|
111
|
+
className: c.label,
|
|
112
|
+
children: x
|
|
113
|
+
}), C && /* @__PURE__ */ g("span", {
|
|
114
|
+
id: V,
|
|
115
|
+
className: c.description,
|
|
108
116
|
children: C
|
|
109
117
|
})]
|
|
110
118
|
})]
|
|
111
119
|
});
|
|
112
120
|
}
|
|
113
|
-
function
|
|
114
|
-
let
|
|
115
|
-
invalid:
|
|
116
|
-
disabled:
|
|
117
|
-
readOnly:
|
|
118
|
-
size:
|
|
119
|
-
"aria-describedby": [
|
|
120
|
-
}), [
|
|
121
|
+
function w({ value: t, defaultValue: r = [], onValueChange: i, name: l, orientation: d = "vertical", size: p, tone: m, disabled: y, readOnly: b, invalid: w, label: T, description: E, selectAll: D, className: ee, children: te, "aria-labelledby": O, "aria-describedby": k, ...A }) {
|
|
122
|
+
let j = o(), M = f(), N = f(), P = f(), F = s({
|
|
123
|
+
invalid: w,
|
|
124
|
+
disabled: y,
|
|
125
|
+
readOnly: b,
|
|
126
|
+
size: p,
|
|
127
|
+
"aria-describedby": [E ? N : void 0, k].filter(Boolean).join(" ") || void 0
|
|
128
|
+
}), [I, L] = e({
|
|
121
129
|
value: t,
|
|
122
130
|
defaultValue: r,
|
|
123
131
|
onChange: i
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
}, [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
}), R = u((e, t) => {
|
|
133
|
+
L((n) => t ? n.includes(e) ? n : [...n, e] : n.filter((t) => t !== e));
|
|
134
|
+
}, [L]), [z, B] = h(() => /* @__PURE__ */ new Map()), V = D != null && D !== !1, H = u((e, t, n) => (B((r) => new Map(r).set(e, {
|
|
135
|
+
id: t,
|
|
136
|
+
disabled: n
|
|
137
|
+
})), () => B((n) => {
|
|
138
|
+
if (n.get(e)?.id !== t) return n;
|
|
139
|
+
let r = new Map(n);
|
|
140
|
+
return r.delete(e), r;
|
|
141
|
+
})), []), U = [...z].filter(([, e]) => !e.disabled).map(([e]) => e), W = U.length > 0 && U.every((e) => I.includes(e)), G = [...z.keys()].some((e) => I.includes(e)), K = (e) => L((t) => e ? [...t, ...U.filter((e) => !t.includes(e))] : t.filter((e) => !U.includes(e))), q = j?.isGroup === !0 && !O && !T, J = [O, T ? M : void 0].filter(Boolean).join(" ") || void 0, Y = [E ? N : void 0, k].filter(Boolean).join(" ") || void 0, X = {
|
|
142
|
+
name: l,
|
|
143
|
+
value: I,
|
|
144
|
+
toggle: R,
|
|
145
|
+
size: F.size,
|
|
146
|
+
tone: m,
|
|
147
|
+
disabled: F.disabled,
|
|
148
|
+
readOnly: F.readOnly,
|
|
149
|
+
invalid: F.invalid,
|
|
135
150
|
reset: () => {
|
|
136
|
-
t === void 0 &&
|
|
151
|
+
t === void 0 && L(r ?? []);
|
|
137
152
|
},
|
|
138
|
-
itemDescribedBy:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
role:
|
|
143
|
-
"aria-labelledby":
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
value: z,
|
|
153
|
+
itemDescribedBy: q ? Y : void 0,
|
|
154
|
+
register: V ? H : void 0
|
|
155
|
+
}, Z = /* @__PURE__ */ g("div", {
|
|
156
|
+
className: n(c.options, x[d], V && c.selectAllOptions),
|
|
157
|
+
role: V ? "group" : void 0,
|
|
158
|
+
"aria-labelledby": V ? `${P}-label` : void 0,
|
|
159
|
+
children: /* @__PURE__ */ g(S.Provider, {
|
|
160
|
+
value: X,
|
|
161
|
+
children: te
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
return /* @__PURE__ */ _("div", {
|
|
165
|
+
...A,
|
|
166
|
+
role: q ? void 0 : "group",
|
|
167
|
+
"aria-labelledby": q ? void 0 : J,
|
|
168
|
+
"aria-describedby": q ? Y : F.ariaProps["aria-describedby"],
|
|
169
|
+
className: n(c.group, v[F.size ?? "md"], ee),
|
|
170
|
+
"data-disabled": F.disabled || void 0,
|
|
171
|
+
"aria-disabled": F.disabled || void 0,
|
|
172
|
+
children: [(T || E) && /* @__PURE__ */ _("div", {
|
|
173
|
+
className: c.groupHeader,
|
|
174
|
+
children: [T && /* @__PURE__ */ g("span", {
|
|
175
|
+
id: M,
|
|
176
|
+
className: c.groupLabel,
|
|
163
177
|
children: T
|
|
164
|
-
})
|
|
165
|
-
|
|
178
|
+
}), E && /* @__PURE__ */ g("span", {
|
|
179
|
+
id: N,
|
|
180
|
+
className: c.description,
|
|
181
|
+
children: E
|
|
182
|
+
})]
|
|
183
|
+
}), V ? /* @__PURE__ */ _("div", {
|
|
184
|
+
className: c.selectAll,
|
|
185
|
+
children: [/* @__PURE__ */ g(a.Provider, {
|
|
186
|
+
value: null,
|
|
187
|
+
children: /* @__PURE__ */ g(C, {
|
|
188
|
+
id: P,
|
|
189
|
+
label: D,
|
|
190
|
+
checked: W,
|
|
191
|
+
indeterminate: G && !W,
|
|
192
|
+
onCheckedChange: K,
|
|
193
|
+
"aria-controls": [...z.values()].map((e) => e.id).join(" ") || void 0,
|
|
194
|
+
size: F.size,
|
|
195
|
+
tone: m,
|
|
196
|
+
disabled: F.disabled || U.length === 0,
|
|
197
|
+
readOnly: F.readOnly,
|
|
198
|
+
invalid: F.invalid
|
|
199
|
+
})
|
|
200
|
+
}), Z]
|
|
201
|
+
}) : Z]
|
|
166
202
|
});
|
|
167
203
|
}
|
|
168
|
-
export {
|
|
204
|
+
export { C as CheckBox, w as CheckBoxGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`
|
|
1
|
+
var e=`_root_ovzx7_35`,t=`_sm_ovzx7_59`,n=`_md_ovzx7_73`,r=`_lg_ovzx7_87`,i=`_tonePrimary_ovzx7_105`,a=`_toneNeutral_ovzx7_117`,o=`_toneAccent_ovzx7_129`,s=`_toneSuccess_ovzx7_141`,c=`_toneWarning_ovzx7_153`,l=`_toneDanger_ovzx7_165`,u=`_toneInfo_ovzx7_177`,d=`_labelEnd_ovzx7_193`,f=`_labelStart_ovzx7_199`,p=`_controlWrap_ovzx7_211`,m=`_input_ovzx7_239`,h=`_control_ovzx7_211`,g=`_mark_ovzx7_299`,_=`_check_ovzx7_363`,v=`_minus_ovzx7_365`,y=`_label_ovzx7_193`,b=`_description_ovzx7_441`,x=`_text_ovzx7_451`,S=`_group_ovzx7_489`,C=`_groupHeader_ovzx7_505`,w=`_groupLabel_ovzx7_517`,T=`_options_ovzx7_539`,E=`_vertical_ovzx7_545`,D=`_horizontal_ovzx7_553`,O=`_selectAll_ovzx7_569`,k=`_selectAllOptions_ovzx7_579`,A={root:e,sm:t,md:n,lg:r,tonePrimary:i,toneNeutral:a,toneAccent:o,toneSuccess:s,toneWarning:c,toneDanger:l,toneInfo:u,labelEnd:d,labelStart:f,controlWrap:p,input:m,control:h,mark:g,check:_,minus:v,label:y,description:b,text:x,group:S,groupHeader:C,groupLabel:w,options:T,vertical:E,horizontal:D,selectAll:O,selectAllOptions:k};exports.check=_,exports.control=h,exports.controlWrap=p,exports.default=A,exports.description=b,exports.group=S,exports.groupHeader=C,exports.groupLabel=w,exports.horizontal=D,exports.input=m,exports.label=y,exports.labelEnd=d,exports.labelStart=f,exports.lg=r,exports.mark=g,exports.md=n,exports.minus=v,exports.options=T,exports.root=e,exports.selectAll=O,exports.selectAllOptions=k,exports.sm=t,exports.text=x,exports.toneAccent=o,exports.toneDanger=l,exports.toneInfo=u,exports.toneNeutral=a,exports.tonePrimary=i,exports.toneSuccess=s,exports.toneWarning=c,exports.vertical=E;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/forms/CheckBox/CheckBox.module.css
|
|
2
|
-
var e = "
|
|
2
|
+
var e = "_root_ovzx7_35", t = "_sm_ovzx7_59", n = "_md_ovzx7_73", r = "_lg_ovzx7_87", i = "_tonePrimary_ovzx7_105", a = "_toneNeutral_ovzx7_117", o = "_toneAccent_ovzx7_129", s = "_toneSuccess_ovzx7_141", c = "_toneWarning_ovzx7_153", l = "_toneDanger_ovzx7_165", u = "_toneInfo_ovzx7_177", d = "_labelEnd_ovzx7_193", f = "_labelStart_ovzx7_199", p = "_controlWrap_ovzx7_211", m = "_input_ovzx7_239", h = "_control_ovzx7_211", g = "_mark_ovzx7_299", _ = "_check_ovzx7_363", v = "_minus_ovzx7_365", y = "_label_ovzx7_193", b = "_description_ovzx7_441", x = "_text_ovzx7_451", S = "_group_ovzx7_489", C = "_groupHeader_ovzx7_505", w = "_groupLabel_ovzx7_517", T = "_options_ovzx7_539", E = "_vertical_ovzx7_545", D = "_horizontal_ovzx7_553", O = "_selectAll_ovzx7_569", k = "_selectAllOptions_ovzx7_579", A = {
|
|
3
3
|
root: e,
|
|
4
4
|
sm: t,
|
|
5
5
|
md: n,
|
|
@@ -27,6 +27,8 @@ var e = "_root_1f9i5_35", t = "_sm_1f9i5_59", n = "_md_1f9i5_73", r = "_lg_1f9i5
|
|
|
27
27
|
groupLabel: w,
|
|
28
28
|
options: T,
|
|
29
29
|
vertical: E,
|
|
30
|
-
horizontal: D
|
|
30
|
+
horizontal: D,
|
|
31
|
+
selectAll: O,
|
|
32
|
+
selectAllOptions: k
|
|
31
33
|
};
|
|
32
|
-
export { _ as check, h as control, p as controlWrap,
|
|
34
|
+
export { _ as check, h as control, p as controlWrap, A as default, b as description, S as group, C as groupHeader, w as groupLabel, D as horizontal, m as input, y as label, d as labelEnd, f as labelStart, r as lg, g as mark, n as md, v as minus, T as options, e as root, O as selectAll, k as selectAllOptions, t as sm, x as text, o as toneAccent, l as toneDanger, u as toneInfo, a as toneNeutral, i as tonePrimary, s as toneSuccess, c as toneWarning, E as vertical };
|