daleui 0.0.2 → 0.0.5
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 +43 -0
- package/dist/check-DEVerfH5.js +72 -0
- package/dist/components/Box/Box.d.ts +34 -0
- package/dist/components/Box/Box.js +34 -0
- package/dist/components/Button/Button.d.ts +37 -0
- package/dist/components/Button/Button.js +367 -0
- package/dist/components/Card/Card.d.ts +68 -0
- package/dist/components/Card/Card.js +132 -0
- package/dist/components/Checkbox/Checkbox.d.ts +34 -0
- package/dist/components/Checkbox/Checkbox.js +657 -0
- package/dist/components/Flex/Flex.d.ts +361 -0
- package/dist/components/Flex/Flex.js +65 -0
- package/dist/components/HStack/HStack.d.ts +23 -0
- package/dist/components/HStack/HStack.js +35 -0
- package/dist/components/Heading/Heading.d.ts +33 -0
- package/dist/components/Heading/Heading.js +67 -0
- package/dist/components/Icon/Icon.d.ts +20 -0
- package/dist/components/Icon/Icon.js +325 -0
- package/dist/components/Label/Label.d.ts +35 -0
- package/dist/components/Label/Label.js +74 -0
- package/dist/components/Link/Link.d.ts +33 -0
- package/dist/components/Link/Link.js +176 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +17 -0
- package/dist/components/PasswordInput/PasswordInput.js +151 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +82 -0
- package/dist/components/RadioGroup/RadioGroup.js +713 -0
- package/dist/components/Select/Select.d.ts +39 -0
- package/dist/components/Select/Select.js +222 -0
- package/dist/components/Tag/Tag.d.ts +26 -0
- package/dist/components/Tag/Tag.js +189 -0
- package/dist/components/Text/Text.d.ts +22 -0
- package/dist/components/Text/Text.js +115 -0
- package/dist/components/TextInput/TextInput.d.ts +21 -0
- package/dist/components/TextInput/TextInput.js +106 -0
- package/dist/components/VStack/VStack.d.ts +23 -0
- package/dist/components/VStack/VStack.js +35 -0
- package/dist/css-QiVVeZaw.js +212 -0
- package/dist/cva-BrKodHDH.js +57 -0
- package/dist/cx-DN21T1EH.js +9 -0
- package/dist/hstack-cCrHxysi.js +43 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +37 -0
- package/dist/tokens/colors.d.ts +4 -0
- package/dist/tokens/iconography.d.ts +45 -0
- package/dist/tokens/spacing.d.ts +42 -0
- package/dist/tokens/typography.d.ts +312 -0
- package/dist/use-locale-context-DYXE7B4r.js +775 -0
- package/package.json +62 -39
- package/styled-system/css/conditions.mjs +36 -0
- package/styled-system/css/css.d.ts +22 -0
- package/styled-system/css/css.mjs +45 -0
- package/styled-system/css/cva.d.ts +6 -0
- package/styled-system/css/cva.mjs +87 -0
- package/styled-system/css/cx.d.ts +5 -0
- package/styled-system/css/cx.mjs +15 -0
- package/styled-system/css/index.d.ts +5 -0
- package/styled-system/css/index.mjs +4 -0
- package/styled-system/css/sva.d.ts +4 -0
- package/styled-system/css/sva.mjs +46 -0
- package/styled-system/helpers.mjs +316 -0
- package/styled-system/patterns/aspect-ratio.d.ts +20 -0
- package/styled-system/patterns/aspect-ratio.mjs +38 -0
- package/styled-system/patterns/bleed.d.ts +21 -0
- package/styled-system/patterns/bleed.mjs +24 -0
- package/styled-system/patterns/box.d.ts +20 -0
- package/styled-system/patterns/box.mjs +15 -0
- package/styled-system/patterns/center.d.ts +20 -0
- package/styled-system/patterns/center.mjs +21 -0
- package/styled-system/patterns/circle.d.ts +20 -0
- package/styled-system/patterns/circle.mjs +25 -0
- package/styled-system/patterns/container.d.ts +20 -0
- package/styled-system/patterns/container.mjs +21 -0
- package/styled-system/patterns/cq.d.ts +21 -0
- package/styled-system/patterns/cq.mjs +21 -0
- package/styled-system/patterns/divider.d.ts +22 -0
- package/styled-system/patterns/divider.mjs +25 -0
- package/styled-system/patterns/flex.d.ts +26 -0
- package/styled-system/patterns/flex.mjs +26 -0
- package/styled-system/patterns/float.d.ts +23 -0
- package/styled-system/patterns/float.mjs +52 -0
- package/styled-system/patterns/grid-item.d.ts +25 -0
- package/styled-system/patterns/grid-item.mjs +25 -0
- package/styled-system/patterns/grid.d.ts +24 -0
- package/styled-system/patterns/grid.mjs +27 -0
- package/styled-system/patterns/hstack.d.ts +21 -0
- package/styled-system/patterns/hstack.mjs +24 -0
- package/styled-system/patterns/index.d.ts +21 -0
- package/styled-system/patterns/index.mjs +20 -0
- package/styled-system/patterns/link-overlay.d.ts +20 -0
- package/styled-system/patterns/link-overlay.mjs +24 -0
- package/styled-system/patterns/spacer.d.ts +20 -0
- package/styled-system/patterns/spacer.mjs +21 -0
- package/styled-system/patterns/square.d.ts +20 -0
- package/styled-system/patterns/square.mjs +24 -0
- package/styled-system/patterns/stack.d.ts +23 -0
- package/styled-system/patterns/stack.mjs +24 -0
- package/styled-system/patterns/visually-hidden.d.ts +20 -0
- package/styled-system/patterns/visually-hidden.mjs +18 -0
- package/styled-system/patterns/vstack.d.ts +21 -0
- package/styled-system/patterns/vstack.mjs +24 -0
- package/styled-system/patterns/wrap.d.ts +24 -0
- package/styled-system/patterns/wrap.mjs +25 -0
- package/styled-system/tokens/index.d.ts +9 -0
- package/styled-system/tokens/index.mjs +3176 -0
- package/styled-system/tokens/tokens.d.ts +63 -0
- package/styled-system/types/composition.d.ts +224 -0
- package/styled-system/types/conditions.d.ts +310 -0
- package/styled-system/types/csstype.d.ts +21298 -0
- package/styled-system/types/global.d.ts +20 -0
- package/styled-system/types/index.d.ts +7 -0
- package/styled-system/types/parts.d.ts +8 -0
- package/styled-system/types/pattern.d.ts +78 -0
- package/styled-system/types/prop-type.d.ts +265 -0
- package/styled-system/types/recipe.d.ts +181 -0
- package/styled-system/types/selectors.d.ts +59 -0
- package/styled-system/types/static-css.d.ts +56 -0
- package/styled-system/types/style-props.d.ts +7504 -0
- package/styled-system/types/system-types.d.ts +269 -0
- package/.github/CODEOWNERS +0 -1
- package/.github/FUNDING.yml +0 -1
- package/.github/workflows/automation.yml +0 -13
- package/.github/workflows/chromatic.yml +0 -19
- package/.github/workflows/deployment.yml +0 -32
- package/.github/workflows/integration.yml +0 -15
- package/.github/workflows/storybook-tests.yml +0 -17
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -29
- package/.storybook/test-runner.ts +0 -33
- package/bun.lock +0 -2099
- package/chromatic.config.json +0 -5
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/panda.config.ts +0 -61
- package/postcss.config.cjs +0 -5
- package/public/logo.svg +0 -9
- package/src/App.tsx +0 -67
- package/src/assets/Discord.svg +0 -1
- package/src/assets/GitHub.svg +0 -1
- package/src/assets/LinkedIn.svg +0 -1
- package/src/assets/Medium.svg +0 -1
- package/src/assets/YouTube.svg +0 -1
- package/src/components/Button/Button.stories.tsx +0 -115
- package/src/components/Button/Button.test.tsx +0 -108
- package/src/components/Button/Button.tsx +0 -245
- package/src/components/Button/index.tsx +0 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -129
- package/src/components/Checkbox/Checkbox.test.tsx +0 -169
- package/src/components/Checkbox/Checkbox.tsx +0 -190
- package/src/components/Heading/Heading.stories.tsx +0 -72
- package/src/components/Heading/Heading.test.tsx +0 -55
- package/src/components/Heading/Heading.tsx +0 -73
- package/src/components/Heading/index.tsx +0 -1
- package/src/components/Icon/Icon.stories.tsx +0 -106
- package/src/components/Icon/Icon.test.tsx +0 -44
- package/src/components/Icon/Icon.tsx +0 -116
- package/src/components/Icon/index.tsx +0 -1
- package/src/components/Text/Text.stories.tsx +0 -65
- package/src/components/Text/Text.test.tsx +0 -54
- package/src/components/Text/Text.tsx +0 -93
- package/src/components/Text/index.tsx +0 -1
- package/src/index.css +0 -2
- package/src/main.tsx +0 -10
- package/src/setupTests.tsx +0 -5
- package/src/styles/globalCss.ts +0 -43
- package/src/tokens/colors.mdx +0 -100
- package/src/tokens/colors.ts +0 -288
- package/src/tokens/iconography.mdx +0 -15
- package/src/tokens/iconography.tsx +0 -54
- package/src/tokens/typography.mdx +0 -38
- package/src/tokens/typography.ts +0 -132
- package/src/vite-env.d.ts +0 -2
- package/tsconfig.app.json +0 -25
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -22
- package/vite.config.ts +0 -16
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { jsx as i, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, useMemo as K, useId as j, useState as M } from "react";
|
|
3
|
+
import { c as X } from "../../css-QiVVeZaw.js";
|
|
4
|
+
import { c as P } from "../../cva-BrKodHDH.js";
|
|
5
|
+
import { C as $ } from "../../check-DEVerfH5.js";
|
|
6
|
+
import { c as R, m as f, a as C, d as u, v as A, i as B, b as J, g as Q, e as U, f as Y, h as Z, j as _, s as ee, t as te, k as oe, l as re, u as ae, n as ne, o as se, p as de, q as ie } from "../../use-locale-context-DYXE7B4r.js";
|
|
7
|
+
const [ce, T] = R({
|
|
8
|
+
name: "CheckboxContext",
|
|
9
|
+
hookName: "useCheckboxContext",
|
|
10
|
+
providerName: "<CheckboxProvider />"
|
|
11
|
+
}), H = k((e, t) => {
|
|
12
|
+
const o = T(), a = f(o.getControlProps(), e);
|
|
13
|
+
return /* @__PURE__ */ i(C.div, { ...a, ref: t });
|
|
14
|
+
});
|
|
15
|
+
H.displayName = "CheckboxControl";
|
|
16
|
+
var le = J("checkbox").parts("root", "label", "control", "indicator"), E = le.build(), q = (e) => e.ids?.root ?? `checkbox:${e.id}`, F = (e) => e.ids?.label ?? `checkbox:${e.id}:label`, ue = (e) => e.ids?.control ?? `checkbox:${e.id}:control`, S = (e) => e.ids?.hiddenInput ?? `checkbox:${e.id}:input`, he = (e) => e.getById(q(e)), g = (e) => e.getById(S(e));
|
|
17
|
+
function fe(e, t) {
|
|
18
|
+
const { send: o, context: a, prop: r, computed: d, scope: n } = e, s = !!r("disabled"), l = !!r("readOnly"), p = !!r("required"), v = !!r("invalid"), m = !s && a.get("focused"), O = !s && a.get("focusVisible"), h = d("checked"), b = d("indeterminate"), x = a.get("checked"), y = {
|
|
19
|
+
"data-active": u(a.get("active")),
|
|
20
|
+
"data-focus": u(m),
|
|
21
|
+
"data-focus-visible": u(O),
|
|
22
|
+
"data-readonly": u(l),
|
|
23
|
+
"data-hover": u(a.get("hovered")),
|
|
24
|
+
"data-disabled": u(s),
|
|
25
|
+
"data-state": b ? "indeterminate" : h ? "checked" : "unchecked",
|
|
26
|
+
"data-invalid": u(v),
|
|
27
|
+
"data-required": u(p)
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
checked: h,
|
|
31
|
+
disabled: s,
|
|
32
|
+
indeterminate: b,
|
|
33
|
+
focused: m,
|
|
34
|
+
checkedState: x,
|
|
35
|
+
setChecked(c) {
|
|
36
|
+
o({ type: "CHECKED.SET", checked: c, isTrusted: !1 });
|
|
37
|
+
},
|
|
38
|
+
toggleChecked() {
|
|
39
|
+
o({ type: "CHECKED.TOGGLE", checked: h, isTrusted: !1 });
|
|
40
|
+
},
|
|
41
|
+
getRootProps() {
|
|
42
|
+
return t.label({
|
|
43
|
+
...E.root.attrs,
|
|
44
|
+
...y,
|
|
45
|
+
dir: r("dir"),
|
|
46
|
+
id: q(n),
|
|
47
|
+
htmlFor: S(n),
|
|
48
|
+
onPointerMove() {
|
|
49
|
+
s || o({ type: "CONTEXT.SET", context: { hovered: !0 } });
|
|
50
|
+
},
|
|
51
|
+
onPointerLeave() {
|
|
52
|
+
s || o({ type: "CONTEXT.SET", context: { hovered: !1 } });
|
|
53
|
+
},
|
|
54
|
+
onClick(c) {
|
|
55
|
+
Q(c) === g(n) && c.stopPropagation();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
getLabelProps() {
|
|
60
|
+
return t.element({
|
|
61
|
+
...E.label.attrs,
|
|
62
|
+
...y,
|
|
63
|
+
dir: r("dir"),
|
|
64
|
+
id: F(n)
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
getControlProps() {
|
|
68
|
+
return t.element({
|
|
69
|
+
...E.control.attrs,
|
|
70
|
+
...y,
|
|
71
|
+
dir: r("dir"),
|
|
72
|
+
id: ue(n),
|
|
73
|
+
"aria-hidden": !0
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
getIndicatorProps() {
|
|
77
|
+
return t.element({
|
|
78
|
+
...E.indicator.attrs,
|
|
79
|
+
...y,
|
|
80
|
+
dir: r("dir"),
|
|
81
|
+
hidden: !b && !h
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
getHiddenInputProps() {
|
|
85
|
+
return t.input({
|
|
86
|
+
id: S(n),
|
|
87
|
+
type: "checkbox",
|
|
88
|
+
required: r("required"),
|
|
89
|
+
defaultChecked: h,
|
|
90
|
+
disabled: s,
|
|
91
|
+
"aria-labelledby": F(n),
|
|
92
|
+
"aria-invalid": v,
|
|
93
|
+
name: r("name"),
|
|
94
|
+
form: r("form"),
|
|
95
|
+
value: r("value"),
|
|
96
|
+
style: A,
|
|
97
|
+
onFocus() {
|
|
98
|
+
const c = B();
|
|
99
|
+
o({ type: "CONTEXT.SET", context: { focused: !0, focusVisible: c } });
|
|
100
|
+
},
|
|
101
|
+
onBlur() {
|
|
102
|
+
o({ type: "CONTEXT.SET", context: { focused: !1, focusVisible: !1 } });
|
|
103
|
+
},
|
|
104
|
+
onClick(c) {
|
|
105
|
+
if (l) {
|
|
106
|
+
c.preventDefault();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const V = c.currentTarget.checked;
|
|
110
|
+
o({ type: "CHECKED.SET", checked: V, isTrusted: !0 });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
var { not: w } = Z(), pe = Y({
|
|
117
|
+
props({ props: e }) {
|
|
118
|
+
return {
|
|
119
|
+
value: "on",
|
|
120
|
+
...e,
|
|
121
|
+
defaultChecked: e.defaultChecked ?? !1
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
initialState() {
|
|
125
|
+
return "ready";
|
|
126
|
+
},
|
|
127
|
+
context({ prop: e, bindable: t }) {
|
|
128
|
+
return {
|
|
129
|
+
checked: t(() => ({
|
|
130
|
+
defaultValue: e("defaultChecked"),
|
|
131
|
+
value: e("checked"),
|
|
132
|
+
onChange(o) {
|
|
133
|
+
e("onCheckedChange")?.({ checked: o });
|
|
134
|
+
}
|
|
135
|
+
})),
|
|
136
|
+
fieldsetDisabled: t(() => ({ defaultValue: !1 })),
|
|
137
|
+
focusVisible: t(() => ({ defaultValue: !1 })),
|
|
138
|
+
active: t(() => ({ defaultValue: !1 })),
|
|
139
|
+
focused: t(() => ({ defaultValue: !1 })),
|
|
140
|
+
hovered: t(() => ({ defaultValue: !1 }))
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
watch({ track: e, context: t, prop: o, action: a }) {
|
|
144
|
+
e([() => o("disabled")], () => {
|
|
145
|
+
a(["removeFocusIfNeeded"]);
|
|
146
|
+
}), e([() => t.get("checked")], () => {
|
|
147
|
+
a(["syncInputElement"]);
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
effects: ["trackFormControlState", "trackPressEvent", "trackFocusVisible"],
|
|
151
|
+
on: {
|
|
152
|
+
"CHECKED.TOGGLE": [
|
|
153
|
+
{
|
|
154
|
+
guard: w("isTrusted"),
|
|
155
|
+
actions: ["toggleChecked", "dispatchChangeEvent"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
actions: ["toggleChecked"]
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"CHECKED.SET": [
|
|
162
|
+
{
|
|
163
|
+
guard: w("isTrusted"),
|
|
164
|
+
actions: ["setChecked", "dispatchChangeEvent"]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
actions: ["setChecked"]
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"CONTEXT.SET": {
|
|
171
|
+
actions: ["setContext"]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
computed: {
|
|
175
|
+
indeterminate: ({ context: e }) => I(e.get("checked")),
|
|
176
|
+
checked: ({ context: e }) => be(e.get("checked")),
|
|
177
|
+
disabled: ({ context: e, prop: t }) => !!t("disabled") || e.get("fieldsetDisabled")
|
|
178
|
+
},
|
|
179
|
+
states: {
|
|
180
|
+
ready: {}
|
|
181
|
+
},
|
|
182
|
+
implementations: {
|
|
183
|
+
guards: {
|
|
184
|
+
isTrusted: ({ event: e }) => !!e.isTrusted
|
|
185
|
+
},
|
|
186
|
+
effects: {
|
|
187
|
+
trackPressEvent({ context: e, computed: t, scope: o }) {
|
|
188
|
+
if (!t("disabled"))
|
|
189
|
+
return re({
|
|
190
|
+
pointerNode: he(o),
|
|
191
|
+
keyboardNode: g(o),
|
|
192
|
+
isValidKey: (a) => a.key === " ",
|
|
193
|
+
onPress: () => e.set("active", !1),
|
|
194
|
+
onPressStart: () => e.set("active", !0),
|
|
195
|
+
onPressEnd: () => e.set("active", !1)
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
trackFocusVisible({ computed: e, scope: t }) {
|
|
199
|
+
if (!e("disabled"))
|
|
200
|
+
return oe({ root: t.getRootNode?.() });
|
|
201
|
+
},
|
|
202
|
+
trackFormControlState({ context: e, scope: t }) {
|
|
203
|
+
return te(g(t), {
|
|
204
|
+
onFieldsetDisabledChange(o) {
|
|
205
|
+
e.set("fieldsetDisabled", o);
|
|
206
|
+
},
|
|
207
|
+
onFormReset() {
|
|
208
|
+
e.set("checked", e.initial("checked"));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
actions: {
|
|
214
|
+
setContext({ context: e, event: t }) {
|
|
215
|
+
for (const o in t.context)
|
|
216
|
+
e.set(o, t.context[o]);
|
|
217
|
+
},
|
|
218
|
+
syncInputElement({ context: e, computed: t, scope: o }) {
|
|
219
|
+
const a = g(o);
|
|
220
|
+
a && (ee(a, t("checked")), a.indeterminate = I(e.get("checked")));
|
|
221
|
+
},
|
|
222
|
+
removeFocusIfNeeded({ context: e, prop: t }) {
|
|
223
|
+
t("disabled") && e.get("focused") && (e.set("focused", !1), e.set("focusVisible", !1));
|
|
224
|
+
},
|
|
225
|
+
setChecked({ context: e, event: t }) {
|
|
226
|
+
e.set("checked", t.checked);
|
|
227
|
+
},
|
|
228
|
+
toggleChecked({ context: e, computed: t }) {
|
|
229
|
+
const o = I(t("checked")) ? !0 : !t("checked");
|
|
230
|
+
e.set("checked", o);
|
|
231
|
+
},
|
|
232
|
+
dispatchChangeEvent({ computed: e, scope: t }) {
|
|
233
|
+
queueMicrotask(() => {
|
|
234
|
+
const o = g(t);
|
|
235
|
+
_(o, { checked: e("checked") });
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
function I(e) {
|
|
242
|
+
return e === "indeterminate";
|
|
243
|
+
}
|
|
244
|
+
function be(e) {
|
|
245
|
+
return I(e) ? !1 : !!e;
|
|
246
|
+
}
|
|
247
|
+
U()([
|
|
248
|
+
"defaultChecked",
|
|
249
|
+
"checked",
|
|
250
|
+
"dir",
|
|
251
|
+
"disabled",
|
|
252
|
+
"form",
|
|
253
|
+
"getRootNode",
|
|
254
|
+
"id",
|
|
255
|
+
"ids",
|
|
256
|
+
"invalid",
|
|
257
|
+
"name",
|
|
258
|
+
"onCheckedChange",
|
|
259
|
+
"readOnly",
|
|
260
|
+
"required",
|
|
261
|
+
"value"
|
|
262
|
+
]);
|
|
263
|
+
const [Re, ge] = R({
|
|
264
|
+
name: "CheckboxGroupContext",
|
|
265
|
+
hookName: "useCheckboxGroupContext",
|
|
266
|
+
providerName: "<CheckboxGroupProvider />",
|
|
267
|
+
strict: !1
|
|
268
|
+
}), [Oe, D] = R({
|
|
269
|
+
name: "FieldContext",
|
|
270
|
+
hookName: "useFieldContext",
|
|
271
|
+
providerName: "<FieldProvider />",
|
|
272
|
+
strict: !1
|
|
273
|
+
}), G = k((e, t) => {
|
|
274
|
+
const o = T(), a = f(o.getHiddenInputProps(), e), r = D();
|
|
275
|
+
return /* @__PURE__ */ i(C.input, { "aria-describedby": r?.ariaDescribedby, ...a, ref: t });
|
|
276
|
+
});
|
|
277
|
+
G.displayName = "CheckboxHiddenInput";
|
|
278
|
+
const W = k((e, t) => {
|
|
279
|
+
const { indeterminate: o, ...a } = e, r = T(), d = f(r.getIndicatorProps(), a), n = o ? r.indeterminate : r.checked;
|
|
280
|
+
return /* @__PURE__ */ i(C.div, { ...d, hidden: !n, ref: t });
|
|
281
|
+
});
|
|
282
|
+
W.displayName = "CheckboxIndicator";
|
|
283
|
+
const L = k((e, t) => {
|
|
284
|
+
const o = T(), a = f(o.getLabelProps(), e);
|
|
285
|
+
return /* @__PURE__ */ i(C.span, { ...a, ref: t });
|
|
286
|
+
});
|
|
287
|
+
L.displayName = "CheckboxLabel";
|
|
288
|
+
const ke = (e = {}) => {
|
|
289
|
+
const t = ge(), o = D(), a = K(() => f(e, t?.getItemProps({ value: e.value }) ?? {}), [e, t]), r = j(), { getRootNode: d } = ae(), { dir: n } = ne(), s = {
|
|
290
|
+
id: r,
|
|
291
|
+
ids: {
|
|
292
|
+
label: o?.ids.label,
|
|
293
|
+
hiddenInput: o?.ids.control
|
|
294
|
+
},
|
|
295
|
+
dir: n,
|
|
296
|
+
disabled: o?.disabled,
|
|
297
|
+
readOnly: o?.readOnly,
|
|
298
|
+
invalid: o?.invalid,
|
|
299
|
+
required: o?.required,
|
|
300
|
+
getRootNode: d,
|
|
301
|
+
...a
|
|
302
|
+
}, l = se(pe, s);
|
|
303
|
+
return fe(l, de);
|
|
304
|
+
}, Ce = ie(), z = k((e, t) => {
|
|
305
|
+
const [o, a] = Ce(e, [
|
|
306
|
+
"checked",
|
|
307
|
+
"defaultChecked",
|
|
308
|
+
"disabled",
|
|
309
|
+
"form",
|
|
310
|
+
"id",
|
|
311
|
+
"ids",
|
|
312
|
+
"invalid",
|
|
313
|
+
"name",
|
|
314
|
+
"onCheckedChange",
|
|
315
|
+
"readOnly",
|
|
316
|
+
"required",
|
|
317
|
+
"value"
|
|
318
|
+
]), r = ke(o), d = f(r.getRootProps(), a);
|
|
319
|
+
return /* @__PURE__ */ i(ce, { value: r, children: /* @__PURE__ */ i(C.label, { ...d, ref: t }) });
|
|
320
|
+
});
|
|
321
|
+
z.displayName = "CheckboxRoot";
|
|
322
|
+
const Ve = ({
|
|
323
|
+
label: e,
|
|
324
|
+
name: t,
|
|
325
|
+
checked: o,
|
|
326
|
+
defaultChecked: a,
|
|
327
|
+
disabled: r,
|
|
328
|
+
invalid: d,
|
|
329
|
+
tone: n = "brand",
|
|
330
|
+
required: s = !1,
|
|
331
|
+
onChange: l
|
|
332
|
+
}) => {
|
|
333
|
+
const p = o !== void 0, [v, m] = M(
|
|
334
|
+
a ?? !1
|
|
335
|
+
);
|
|
336
|
+
return /* @__PURE__ */ N(
|
|
337
|
+
z,
|
|
338
|
+
{
|
|
339
|
+
name: t,
|
|
340
|
+
checked: p ? o : v,
|
|
341
|
+
defaultChecked: p ? void 0 : a,
|
|
342
|
+
disabled: r,
|
|
343
|
+
invalid: d,
|
|
344
|
+
required: s,
|
|
345
|
+
onCheckedChange: (b) => {
|
|
346
|
+
const x = b.checked === !0;
|
|
347
|
+
p || m(x), l && typeof l == "function" && l(x);
|
|
348
|
+
},
|
|
349
|
+
className: `group ${ve({ disabled: r })}`,
|
|
350
|
+
children: [
|
|
351
|
+
/* @__PURE__ */ i(
|
|
352
|
+
H,
|
|
353
|
+
{
|
|
354
|
+
className: me({
|
|
355
|
+
tone: n,
|
|
356
|
+
disabled: r,
|
|
357
|
+
invalid: !r && d
|
|
358
|
+
}),
|
|
359
|
+
children: /* @__PURE__ */ i(W, { className: xe(), children: /* @__PURE__ */ i($, { size: 10, absoluteStrokeWidth: !0 }) })
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
e && /* @__PURE__ */ N(
|
|
363
|
+
L,
|
|
364
|
+
{
|
|
365
|
+
className: ye({ disabled: r, invalid: !r && d }),
|
|
366
|
+
children: [
|
|
367
|
+
e,
|
|
368
|
+
s && /* @__PURE__ */ N(
|
|
369
|
+
"span",
|
|
370
|
+
{
|
|
371
|
+
"data-testid": "checkbox-required-indicator",
|
|
372
|
+
className: X({
|
|
373
|
+
color: r ? "fg.neutral.disabled" : "fg.danger"
|
|
374
|
+
}),
|
|
375
|
+
children: [
|
|
376
|
+
" ",
|
|
377
|
+
"*"
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ i(
|
|
385
|
+
G,
|
|
386
|
+
{
|
|
387
|
+
"data-test-tone": n,
|
|
388
|
+
"aria-required": s ? !0 : void 0
|
|
389
|
+
}
|
|
390
|
+
)
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}, ve = P({
|
|
395
|
+
base: {
|
|
396
|
+
display: "flex",
|
|
397
|
+
alignItems: "center",
|
|
398
|
+
gap: "8",
|
|
399
|
+
cursor: "pointer",
|
|
400
|
+
padding: "4"
|
|
401
|
+
},
|
|
402
|
+
variants: {
|
|
403
|
+
disabled: {
|
|
404
|
+
true: {
|
|
405
|
+
cursor: "not-allowed"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}), me = P({
|
|
410
|
+
base: {
|
|
411
|
+
position: "relative",
|
|
412
|
+
flexShrink: 0,
|
|
413
|
+
width: "16px",
|
|
414
|
+
height: "16px",
|
|
415
|
+
display: "flex",
|
|
416
|
+
alignItems: "center",
|
|
417
|
+
justifyContent: "center",
|
|
418
|
+
backgroundColor: "transparent",
|
|
419
|
+
borderWidth: "2px",
|
|
420
|
+
borderStyle: "solid",
|
|
421
|
+
borderColor: "fg.neutral",
|
|
422
|
+
borderRadius: "sm",
|
|
423
|
+
transition: "all 0.2s",
|
|
424
|
+
color: "transparent",
|
|
425
|
+
'&[data-state="checked"]': {
|
|
426
|
+
color: "fg.neutral"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
variants: {
|
|
430
|
+
tone: {
|
|
431
|
+
brand: {
|
|
432
|
+
".group:hover &::before": {
|
|
433
|
+
content: '""',
|
|
434
|
+
position: "absolute",
|
|
435
|
+
width: "26px",
|
|
436
|
+
height: "26px",
|
|
437
|
+
borderRadius: "8",
|
|
438
|
+
backgroundColor: "fg.brand.hover",
|
|
439
|
+
opacity: 0.2,
|
|
440
|
+
left: "50%",
|
|
441
|
+
top: "50%",
|
|
442
|
+
transform: "translate(-50%, -50%)",
|
|
443
|
+
zIndex: -1
|
|
444
|
+
},
|
|
445
|
+
".group:active &::before": {
|
|
446
|
+
content: '""',
|
|
447
|
+
position: "absolute",
|
|
448
|
+
width: "26px",
|
|
449
|
+
height: "26px",
|
|
450
|
+
borderRadius: "8",
|
|
451
|
+
backgroundColor: "fg.brand.active",
|
|
452
|
+
opacity: 0.2,
|
|
453
|
+
left: "50%",
|
|
454
|
+
top: "50%",
|
|
455
|
+
transform: "translate(-50%, -50%)",
|
|
456
|
+
zIndex: -1
|
|
457
|
+
},
|
|
458
|
+
"&[data-focus-visible]": {
|
|
459
|
+
outline: "solid",
|
|
460
|
+
outlineWidth: "lg",
|
|
461
|
+
outlineColor: "border.brand.focus",
|
|
462
|
+
outlineOffset: "2"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
success: {
|
|
466
|
+
".group:hover &::before, .group:active &::before": {
|
|
467
|
+
content: '""',
|
|
468
|
+
position: "absolute",
|
|
469
|
+
width: "26px",
|
|
470
|
+
height: "26px",
|
|
471
|
+
borderRadius: "8",
|
|
472
|
+
backgroundColor: "fg.success",
|
|
473
|
+
opacity: 0.2,
|
|
474
|
+
left: "50%",
|
|
475
|
+
top: "50%",
|
|
476
|
+
transform: "translate(-50%, -50%)",
|
|
477
|
+
zIndex: -1
|
|
478
|
+
},
|
|
479
|
+
"&[data-focus-visible]": {
|
|
480
|
+
outline: "solid",
|
|
481
|
+
outlineWidth: "lg",
|
|
482
|
+
outlineColor: "border.success",
|
|
483
|
+
outlineOffset: "2"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
warning: {
|
|
487
|
+
".group:hover &::before, .group:active &::before": {
|
|
488
|
+
content: '""',
|
|
489
|
+
position: "absolute",
|
|
490
|
+
width: "26px",
|
|
491
|
+
height: "26px",
|
|
492
|
+
borderRadius: "8",
|
|
493
|
+
backgroundColor: "fg.warning",
|
|
494
|
+
opacity: 0.2,
|
|
495
|
+
left: "50%",
|
|
496
|
+
top: "50%",
|
|
497
|
+
transform: "translate(-50%, -50%)",
|
|
498
|
+
zIndex: -1
|
|
499
|
+
},
|
|
500
|
+
"&[data-focus-visible]": {
|
|
501
|
+
outline: "solid",
|
|
502
|
+
outlineWidth: "lg",
|
|
503
|
+
outlineColor: "border.warning",
|
|
504
|
+
outlineOffset: "2"
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
info: {
|
|
508
|
+
".group:hover &::before, .group:active &::before": {
|
|
509
|
+
content: '""',
|
|
510
|
+
position: "absolute",
|
|
511
|
+
width: "26px",
|
|
512
|
+
height: "26px",
|
|
513
|
+
borderRadius: "8",
|
|
514
|
+
backgroundColor: "fg.info",
|
|
515
|
+
opacity: 0.2,
|
|
516
|
+
left: "50%",
|
|
517
|
+
top: "50%",
|
|
518
|
+
transform: "translate(-50%, -50%)",
|
|
519
|
+
zIndex: -1
|
|
520
|
+
},
|
|
521
|
+
"&[data-focus-visible]": {
|
|
522
|
+
outline: "solid",
|
|
523
|
+
outlineWidth: "lg",
|
|
524
|
+
outlineColor: "border.info",
|
|
525
|
+
outlineOffset: "2"
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
danger: {
|
|
529
|
+
borderColor: "fg.danger",
|
|
530
|
+
".group:hover &::before, .group:active &::before": {
|
|
531
|
+
content: '""',
|
|
532
|
+
position: "absolute",
|
|
533
|
+
width: "26px",
|
|
534
|
+
height: "26px",
|
|
535
|
+
borderRadius: "8",
|
|
536
|
+
backgroundColor: "fg.danger",
|
|
537
|
+
opacity: 0.2,
|
|
538
|
+
left: "50%",
|
|
539
|
+
top: "50%",
|
|
540
|
+
transform: "translate(-50%, -50%)",
|
|
541
|
+
zIndex: -1
|
|
542
|
+
},
|
|
543
|
+
"&[data-focus-visible]": {
|
|
544
|
+
outline: "solid",
|
|
545
|
+
outlineWidth: "lg",
|
|
546
|
+
outlineColor: "border.danger",
|
|
547
|
+
outlineOffset: "2"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
neutral: {
|
|
551
|
+
".group:hover &::before": {
|
|
552
|
+
content: '""',
|
|
553
|
+
position: "absolute",
|
|
554
|
+
width: "26px",
|
|
555
|
+
height: "26px",
|
|
556
|
+
borderRadius: "8",
|
|
557
|
+
backgroundColor: "fg.neutral.hover",
|
|
558
|
+
opacity: 0.2,
|
|
559
|
+
left: "50%",
|
|
560
|
+
top: "50%",
|
|
561
|
+
transform: "translate(-50%, -50%)",
|
|
562
|
+
zIndex: -1
|
|
563
|
+
},
|
|
564
|
+
".group:active &::before": {
|
|
565
|
+
content: '""',
|
|
566
|
+
position: "absolute",
|
|
567
|
+
width: "26px",
|
|
568
|
+
height: "26px",
|
|
569
|
+
borderRadius: "8",
|
|
570
|
+
backgroundColor: "fg.neutral.active",
|
|
571
|
+
opacity: 0.2,
|
|
572
|
+
left: "50%",
|
|
573
|
+
top: "50%",
|
|
574
|
+
transform: "translate(-50%, -50%)",
|
|
575
|
+
zIndex: -1
|
|
576
|
+
},
|
|
577
|
+
"&[data-focus-visible]": {
|
|
578
|
+
outline: "solid",
|
|
579
|
+
outlineWidth: "lg",
|
|
580
|
+
outlineColor: "border.neutral.active",
|
|
581
|
+
outlineOffset: "2"
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
disabled: {
|
|
586
|
+
true: {
|
|
587
|
+
cursor: "not-allowed",
|
|
588
|
+
borderColor: "fg.neutral.disabled",
|
|
589
|
+
backgroundColor: "bg.neutral.disabled!",
|
|
590
|
+
".group:hover &::before": {
|
|
591
|
+
display: "none"
|
|
592
|
+
},
|
|
593
|
+
'&[data-state="checked"]': {
|
|
594
|
+
color: "fg.neutral.disabled!"
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
invalid: {
|
|
599
|
+
true: {
|
|
600
|
+
borderColor: "fg.danger",
|
|
601
|
+
".group:hover &::before": {
|
|
602
|
+
content: '""',
|
|
603
|
+
position: "absolute",
|
|
604
|
+
width: "26px",
|
|
605
|
+
height: "26px",
|
|
606
|
+
borderRadius: "8",
|
|
607
|
+
backgroundColor: "fg.danger",
|
|
608
|
+
opacity: 0.2,
|
|
609
|
+
left: "50%",
|
|
610
|
+
top: "50%",
|
|
611
|
+
transform: "translate(-50%, -50%)",
|
|
612
|
+
zIndex: -1
|
|
613
|
+
},
|
|
614
|
+
"&[data-focus-visible]": {
|
|
615
|
+
outline: "solid",
|
|
616
|
+
outlineWidth: "lg",
|
|
617
|
+
outlineColor: "border.danger",
|
|
618
|
+
outlineOffset: "2"
|
|
619
|
+
},
|
|
620
|
+
'&[data-state="checked"]': {
|
|
621
|
+
color: "fg.danger"
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}), xe = P({
|
|
627
|
+
base: {
|
|
628
|
+
width: "100%",
|
|
629
|
+
height: "100%",
|
|
630
|
+
display: "flex",
|
|
631
|
+
alignItems: "center",
|
|
632
|
+
justifyContent: "center"
|
|
633
|
+
}
|
|
634
|
+
}), ye = P({
|
|
635
|
+
base: {
|
|
636
|
+
fontSize: "md",
|
|
637
|
+
fontWeight: "semibold",
|
|
638
|
+
lineHeight: "1.2",
|
|
639
|
+
color: "fg.neutral",
|
|
640
|
+
userSelect: "none"
|
|
641
|
+
},
|
|
642
|
+
variants: {
|
|
643
|
+
disabled: {
|
|
644
|
+
true: {
|
|
645
|
+
color: "fg.neutral.disabled"
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
invalid: {
|
|
649
|
+
true: {
|
|
650
|
+
color: "fg.danger"
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
export {
|
|
656
|
+
Ve as Checkbox
|
|
657
|
+
};
|