@foi/design-system 0.0.3 → 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/dist/DatePicker.utils-ytCEcs6T.js +2680 -0
- package/dist/DatePicker.utils-ytCEcs6T.js.map +1 -0
- package/dist/RadioGroup-D2s7AY6E.js +325 -0
- package/dist/RadioGroup-D2s7AY6E.js.map +1 -0
- package/dist/RadioGroup.context-zJGC5Sjc.js +395 -0
- package/dist/RadioGroup.context-zJGC5Sjc.js.map +1 -0
- package/dist/Switch-BKf-QVlX.js +3824 -0
- package/dist/Switch-BKf-QVlX.js.map +1 -0
- package/dist/ThemeProvider-CYWZJzSU.js +37 -0
- package/dist/ThemeProvider-CYWZJzSU.js.map +1 -0
- package/dist/atoms.d.ts +18 -0
- package/dist/atoms.mjs +3 -0
- package/dist/emotion-react-jsx-runtime.browser.esm-BFNmScj4.js +992 -0
- package/dist/emotion-react-jsx-runtime.browser.esm-BFNmScj4.js.map +1 -0
- package/dist/hocs/ThemeProvider/fonts/loadFonts.d.ts +1 -0
- package/dist/hocs.d.ts +2 -0
- package/dist/hocs.mjs +2 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.mjs +2 -0
- package/dist/index.mjs +6 -8626
- package/dist/molecules.d.ts +6 -0
- package/dist/molecules.mjs +2 -0
- package/dist/theme-DEqiATmv.js +436 -0
- package/dist/theme-DEqiATmv.js.map +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.mjs +2 -0
- package/dist/useStateCallback-D9fqdxiO.js +26 -0
- package/dist/useStateCallback-D9fqdxiO.js.map +1 -0
- package/dist/utilities/cleaner/input.d.ts +1 -0
- package/dist/utilities/formatter/date.d.ts +3 -0
- package/dist/utilities/formatter/input.d.ts +1 -0
- package/dist/utilities/formatter/number.d.ts +2 -0
- package/dist/utilities/formatter/strings.d.ts +2 -0
- package/dist/utilities/regex/input.d.ts +4 -0
- package/dist/utilities/validator/input.d.ts +1 -0
- package/dist/utilities.d.ts +7 -0
- package/dist/utilities.mjs +23 -0
- package/dist/utilities.mjs.map +1 -0
- package/package.json +25 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { i as e, n as t, r as n } from "./emotion-react-jsx-runtime.browser.esm-BFNmScj4.js";
|
|
2
|
+
import { r } from "./theme-DEqiATmv.js";
|
|
3
|
+
import { a as i, i as a, n as o, r as s, t as c } from "./RadioGroup.context-zJGC5Sjc.js";
|
|
4
|
+
import l, { useEffect as u, useMemo as d, useRef as f } from "react";
|
|
5
|
+
import { css as p } from "@emotion/react";
|
|
6
|
+
import { useController as m } from "react-hook-form";
|
|
7
|
+
import h from "@mui/icons-material/CheckOutlined";
|
|
8
|
+
import g from "@mui/icons-material/RemoveOutlined";
|
|
9
|
+
//#region src/components/molecules/CheckboxGroup/CheckboxGroup.emotion.ts
|
|
10
|
+
var _ = (e, t) => `
|
|
11
|
+
.--CHECKBOXGROUP-label {
|
|
12
|
+
${r(e, "color", `--CHECKBOXGROUP-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.--CHECKBOXGROUP-helperText {
|
|
16
|
+
${r(e, "color", `--CHECKBOXGROUP-EVENTS-${t}-COLOR-SECONDARY`)}
|
|
17
|
+
}
|
|
18
|
+
`, v = (e) => p`
|
|
19
|
+
&.--CHECKBOXGROUP {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
width: fit-content;
|
|
24
|
+
|
|
25
|
+
// ENABLED
|
|
26
|
+
${_(e, "ENABLED")};
|
|
27
|
+
|
|
28
|
+
// ERROR
|
|
29
|
+
&.--CHECKBOXGROUP-error {
|
|
30
|
+
${_(e, "ERROR")};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// DISABLED
|
|
34
|
+
&.--CHECKBOXGROUP-disabled {
|
|
35
|
+
${_(e, "DISABLED")};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.--CHECKBOXGROUP-items {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 16px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.--CHECKBOXGROUP--horizontal .--CHECKBOXGROUP-items {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.--CHECKBOXGROUP-label {
|
|
50
|
+
// FONT
|
|
51
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
52
|
+
font-size: 0.875rem;
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
line-height: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.--CHECKBOXGROUP-helperText {
|
|
58
|
+
// FONT
|
|
59
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
line-height: 16px;
|
|
62
|
+
margin-left: 14px;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`, y = "--CHECKBOXGROUP", b = ({ name: e, control: r, children: i, label: o, helperText: s, showErrorText: c = !0, disabled: l, direction: u = "vertical", style: d, className: f }) => {
|
|
66
|
+
let { field: p, fieldState: h } = m({
|
|
67
|
+
control: r,
|
|
68
|
+
name: e
|
|
69
|
+
}), g = Array.isArray(p.value) ? p.value : [], _ = h.error;
|
|
70
|
+
return /* @__PURE__ */ t(a.Provider, {
|
|
71
|
+
value: {
|
|
72
|
+
checkedValues: g,
|
|
73
|
+
onChange: (e, t) => {
|
|
74
|
+
let n = t ? [...g, e] : g.filter((t) => t !== e);
|
|
75
|
+
p.onChange(n), p.onBlur();
|
|
76
|
+
},
|
|
77
|
+
disabled: l,
|
|
78
|
+
error: _
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ n("div", {
|
|
81
|
+
className: [
|
|
82
|
+
y,
|
|
83
|
+
`${y}--${u}`,
|
|
84
|
+
c && _?.message && `${y}-error`,
|
|
85
|
+
l && `${y}-disabled`,
|
|
86
|
+
f || ""
|
|
87
|
+
].join(" "),
|
|
88
|
+
css: v(d),
|
|
89
|
+
"data-testid": y,
|
|
90
|
+
children: [
|
|
91
|
+
o && /* @__PURE__ */ t("span", {
|
|
92
|
+
className: `${y}-label`,
|
|
93
|
+
"data-testid": `${y}-label`,
|
|
94
|
+
children: o
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ t("div", {
|
|
97
|
+
className: `${y}-items`,
|
|
98
|
+
"data-testid": `${y}-items`,
|
|
99
|
+
children: i
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ n("span", {
|
|
102
|
+
className: `${y}-helperText`,
|
|
103
|
+
"data-testid": `${y}-helperText`,
|
|
104
|
+
children: [s && (!_ || !c) && s, c && _ && _.message]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}, x = ({ theme: n, ...r }) => {
|
|
110
|
+
let { componentStyles: a } = e([i.CHECKBOXGROUP], n);
|
|
111
|
+
return /* @__PURE__ */ t(b, {
|
|
112
|
+
...r,
|
|
113
|
+
style: a
|
|
114
|
+
});
|
|
115
|
+
}, S = (e) => p`
|
|
116
|
+
&.--CHECKBOXTREE {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
width: fit-content;
|
|
121
|
+
|
|
122
|
+
.--CHECKBOXTREE-children {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
padding-left: 36px;
|
|
126
|
+
gap: 16px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.--CHECKBOXTREE-helperText {
|
|
130
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
131
|
+
font-size: 13px;
|
|
132
|
+
line-height: 16px;
|
|
133
|
+
margin-left: 14px;
|
|
134
|
+
${r(e, "color", "--CHECKBOXTREE-EVENTS-ENABLED-COLOR-SECONDARY")}
|
|
135
|
+
|
|
136
|
+
&:empty {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.--CHECKBOXTREE-error {
|
|
142
|
+
.--CHECKBOXTREE-helperText {
|
|
143
|
+
${r(e, "color", "--CHECKBOXTREE-EVENTS-ERROR-COLOR-SECONDARY")}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&.--CHECKBOXTREE-disabled {
|
|
148
|
+
.--CHECKBOXTREE-helperText {
|
|
149
|
+
${r(e, "color", "--CHECKBOXTREE-EVENTS-DISABLED-COLOR-SECONDARY")}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`, C = "--CHECKBOXTREE", w = ({ name: e, control: r, children: i, label: a, iconChecked: c = /* @__PURE__ */ t(h, {}), iconIndeterminate: p = /* @__PURE__ */ t(g, {}), helperText: _, showErrorText: v = !0, disabled: y, style: b, className: x }) => {
|
|
154
|
+
let { field: w, fieldState: T } = m({
|
|
155
|
+
control: r,
|
|
156
|
+
name: e
|
|
157
|
+
}), E = Array.isArray(w.value) ? w.value : [], D = T.error, O = d(() => l.Children.toArray(i).map((e) => {
|
|
158
|
+
let t = e;
|
|
159
|
+
return t.props?.value ?? t.props?.name ?? "";
|
|
160
|
+
}).filter(Boolean), [i]), k = O.length > 0 && O.every((e) => E.includes(e)), A = !k && O.some((e) => E.includes(e)), j = f(null);
|
|
161
|
+
return u(() => {
|
|
162
|
+
let e = j.current?.querySelectorAll("input[type=\"checkbox\"]")[0];
|
|
163
|
+
e && (e.indeterminate = A);
|
|
164
|
+
}, [A]), /* @__PURE__ */ n("div", {
|
|
165
|
+
ref: j,
|
|
166
|
+
className: [
|
|
167
|
+
C,
|
|
168
|
+
v && D?.message ? `${C}-error` : "",
|
|
169
|
+
y ? `${C}-disabled` : "",
|
|
170
|
+
x || ""
|
|
171
|
+
].join(" "),
|
|
172
|
+
css: S(b),
|
|
173
|
+
"data-testid": C,
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ t(o, {
|
|
176
|
+
checked: k || A,
|
|
177
|
+
onChecked: (e) => {
|
|
178
|
+
let t = e ? [...O] : [];
|
|
179
|
+
w.onChange(t), w.onBlur();
|
|
180
|
+
},
|
|
181
|
+
label: a,
|
|
182
|
+
icon: A ? p : c,
|
|
183
|
+
disabled: y,
|
|
184
|
+
showErrorText: !1,
|
|
185
|
+
helperText: void 0
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ t(s.Provider, {
|
|
188
|
+
value: {
|
|
189
|
+
checkedValues: E,
|
|
190
|
+
onChange: (e, t) => {
|
|
191
|
+
let n = t ? [...E, e] : E.filter((t) => t !== e);
|
|
192
|
+
w.onChange(n), w.onBlur();
|
|
193
|
+
},
|
|
194
|
+
disabled: y,
|
|
195
|
+
error: D
|
|
196
|
+
},
|
|
197
|
+
children: /* @__PURE__ */ t("div", {
|
|
198
|
+
className: `${C}-children`,
|
|
199
|
+
"data-testid": `${C}-children`,
|
|
200
|
+
children: i
|
|
201
|
+
})
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ n("span", {
|
|
204
|
+
className: `${C}-helperText`,
|
|
205
|
+
"data-testid": `${C}-helperText`,
|
|
206
|
+
children: [_ && (!D || !v) && _, v && D && D.message]
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
}, T = ({ theme: n, ...r }) => {
|
|
211
|
+
let { componentStyles: a } = e([i.CHECKBOXTREE], n);
|
|
212
|
+
return /* @__PURE__ */ t(w, {
|
|
213
|
+
...r,
|
|
214
|
+
style: a
|
|
215
|
+
});
|
|
216
|
+
}, E = (e, t) => `
|
|
217
|
+
.--RADIOGROUP-label {
|
|
218
|
+
${r(e, "color", `--RADIOGROUP-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.--RADIOGROUP-helperText {
|
|
222
|
+
${r(e, "color", `--RADIOGROUP-EVENTS-${t}-COLOR-SECONDARY`)}
|
|
223
|
+
}
|
|
224
|
+
`, D = (e) => p`
|
|
225
|
+
&.--RADIOGROUP {
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
gap: 8px;
|
|
229
|
+
width: fit-content;
|
|
230
|
+
|
|
231
|
+
// ENABLED
|
|
232
|
+
${E(e, "ENABLED")};
|
|
233
|
+
|
|
234
|
+
// ERROR
|
|
235
|
+
&.--RADIOGROUP-error {
|
|
236
|
+
${E(e, "ERROR")};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// DISABLED
|
|
240
|
+
&.--RADIOGROUP-disabled {
|
|
241
|
+
${E(e, "DISABLED")};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.--RADIOGROUP-items {
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
gap: 16px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&.--RADIOGROUP--horizontal .--RADIOGROUP-items {
|
|
251
|
+
flex-direction: row;
|
|
252
|
+
flex-wrap: wrap;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.--RADIOGROUP-label {
|
|
256
|
+
// FONT
|
|
257
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
258
|
+
font-size: 0.875rem;
|
|
259
|
+
font-weight: 500;
|
|
260
|
+
line-height: 1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.--RADIOGROUP-helperText {
|
|
264
|
+
// FONT
|
|
265
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
266
|
+
font-size: 13px;
|
|
267
|
+
line-height: 16px;
|
|
268
|
+
margin-left: 14px;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
`, O = "--RADIOGROUP", k = ({ name: e, control: r, children: i, label: a, helperText: o, showErrorText: s = !0, disabled: l, direction: u = "vertical", style: d, className: f }) => {
|
|
272
|
+
let { field: p, fieldState: h } = m({
|
|
273
|
+
control: r,
|
|
274
|
+
name: e
|
|
275
|
+
}), g = typeof p.value == "string" ? p.value : "", _ = h.error;
|
|
276
|
+
return /* @__PURE__ */ t(c.Provider, {
|
|
277
|
+
value: {
|
|
278
|
+
name: e,
|
|
279
|
+
selectedValue: g,
|
|
280
|
+
onChange: (e) => {
|
|
281
|
+
p.onChange(e), p.onBlur();
|
|
282
|
+
},
|
|
283
|
+
disabled: l,
|
|
284
|
+
error: _
|
|
285
|
+
},
|
|
286
|
+
children: /* @__PURE__ */ n("div", {
|
|
287
|
+
className: [
|
|
288
|
+
O,
|
|
289
|
+
`${O}--${u}`,
|
|
290
|
+
s && _?.message && `${O}-error`,
|
|
291
|
+
l && `${O}-disabled`,
|
|
292
|
+
f || ""
|
|
293
|
+
].join(" "),
|
|
294
|
+
css: D(d),
|
|
295
|
+
"data-testid": O,
|
|
296
|
+
children: [
|
|
297
|
+
a && /* @__PURE__ */ t("span", {
|
|
298
|
+
className: `${O}-label`,
|
|
299
|
+
"data-testid": `${O}-label`,
|
|
300
|
+
children: a
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ t("div", {
|
|
303
|
+
className: `${O}-items`,
|
|
304
|
+
"data-testid": `${O}-items`,
|
|
305
|
+
children: i
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ n("span", {
|
|
308
|
+
className: `${O}-helperText`,
|
|
309
|
+
"data-testid": `${O}-helperText`,
|
|
310
|
+
children: [o && (!_ || !s) && o, s && _ && _.message]
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
})
|
|
314
|
+
});
|
|
315
|
+
}, A = ({ theme: n, ...r }) => {
|
|
316
|
+
let { componentStyles: a } = e([i.RADIOGROUP], n);
|
|
317
|
+
return /* @__PURE__ */ t(k, {
|
|
318
|
+
...r,
|
|
319
|
+
style: a
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
//#endregion
|
|
323
|
+
export { T as n, x as r, A as t };
|
|
324
|
+
|
|
325
|
+
//# sourceMappingURL=RadioGroup-D2s7AY6E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup-D2s7AY6E.js","names":[],"sources":["../src/components/molecules/CheckboxGroup/CheckboxGroup.emotion.ts","../src/components/molecules/CheckboxGroup/CheckboxGroup.tsx","../src/components/molecules/CheckboxGroup/index.tsx","../src/components/molecules/CheckboxTree/CheckboxTree.emotion.ts","../src/components/molecules/CheckboxTree/CheckboxTree.tsx","../src/components/molecules/CheckboxTree/index.tsx","../src/components/molecules/RadioGroup/RadioGroup.emotion.ts","../src/components/molecules/RadioGroup/RadioGroup.tsx","../src/components/molecules/RadioGroup/index.tsx"],"sourcesContent":["import { css } from '@emotion/react';\nimport { getStyle } from '@utilities/emotion/styles';\n\nconst labelColor = (theme: Record<string, string>, event: string): string => `\n .--CHECKBOXGROUP-label {\n ${getStyle(theme, 'color', `--CHECKBOXGROUP-EVENTS-${event}-COLOR-PRIMARY`)}\n }\n\n .--CHECKBOXGROUP-helperText {\n ${getStyle(theme, 'color', `--CHECKBOXGROUP-EVENTS-${event}-COLOR-SECONDARY`)}\n }\n`;\n\nconst Style = (theme: Record<string, string>) => css`\n &.--CHECKBOXGROUP {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: fit-content;\n\n // ENABLED\n ${labelColor(theme, 'ENABLED')};\n\n // ERROR\n &.--CHECKBOXGROUP-error {\n ${labelColor(theme, 'ERROR')};\n }\n\n // DISABLED\n &.--CHECKBOXGROUP-disabled {\n ${labelColor(theme, 'DISABLED')};\n }\n\n .--CHECKBOXGROUP-items {\n display: flex;\n flex-direction: column;\n gap: 16px;\n }\n\n &.--CHECKBOXGROUP--horizontal .--CHECKBOXGROUP-items {\n flex-direction: row;\n flex-wrap: wrap;\n }\n\n .--CHECKBOXGROUP-label {\n // FONT\n font-family: ${theme['--FONTFAMILY-PRIMARY']};\n font-size: 0.875rem;\n font-weight: 500;\n line-height: 1;\n }\n\n .--CHECKBOXGROUP-helperText {\n // FONT\n font-family: ${theme['--FONTFAMILY-PRIMARY']};\n font-size: 13px;\n line-height: 16px;\n margin-left: 14px;\n }\n }\n`;\n\nexport default Style;\n","// Component Base\nimport emotion from './CheckboxGroup.emotion';\nimport type { CheckboxGroupProps } from './CheckboxGroup.interface';\nimport { CheckboxGroupContext } from './CheckboxGroup.context';\n// External libraries\nimport { useController, type FieldValues, type FieldPath } from 'react-hook-form';\n\nconst CLASS = '--CHECKBOXGROUP';\n\n/**\n * CheckboxGroup manages a set of `<Checkbox>` children as a single RHF field.\n * The form value is `string[]` — the `value` props of every checked child.\n *\n * Validation (min, max, custom) is declared on the Zod schema:\n * ```ts\n * z.object({\n * options: z.array(z.string()).min(1, 'Select at least one').max(3, 'Select at most 3'),\n * })\n * ```\n *\n * @example\n * ```tsx\n * <CheckboxGroup name=\"options\" control={control} label=\"Skills\">\n * <Checkbox value=\"react\" label=\"React\" />\n * <Checkbox value=\"vue\" label=\"Vue\" />\n * </CheckboxGroup>\n * ```\n */\nconst CheckboxGroup = <TFieldValues extends FieldValues = FieldValues>({\n name,\n control,\n children,\n label,\n helperText,\n showErrorText = true,\n disabled,\n direction = 'vertical',\n style,\n className,\n}: CheckboxGroupProps<TFieldValues>) => {\n const { field, fieldState } = useController({ control, name: name as FieldPath<TFieldValues> });\n\n const checkedValues: string[] = Array.isArray(field.value) ? field.value : [];\n const errorText = fieldState.error;\n\n const onChange = (value: string, checked: boolean) => {\n const next = checked ? [...checkedValues, value] : checkedValues.filter(v => v !== value);\n field.onChange(next);\n field.onBlur();\n };\n\n return (\n <CheckboxGroupContext.Provider value={{ checkedValues, onChange, disabled, error: errorText }}>\n <div\n className={[\n CLASS,\n `${CLASS}--${direction}`,\n showErrorText && errorText?.message && `${CLASS}-error`,\n disabled && `${CLASS}-disabled`,\n className || '',\n ].join(' ')}\n css={emotion(style)}\n data-testid={CLASS}\n >\n {label && (\n <span className={`${CLASS}-label`} data-testid={`${CLASS}-label`}>\n {label}\n </span>\n )}\n\n <div className={`${CLASS}-items`} data-testid={`${CLASS}-items`}>\n {children}\n </div>\n\n <span className={`${CLASS}-helperText`} data-testid={`${CLASS}-helperText`}>\n {helperText && (!errorText || !showErrorText) && helperText}\n {showErrorText && errorText && errorText.message}\n </span>\n </div>\n </CheckboxGroupContext.Provider>\n );\n};\n\nexport default CheckboxGroup;\n","import { useCreateComponentStyles } from '@hocs/ThemeProvider/useThemeProvider.hook';\nimport { Component } from '@hocs/ThemeProvider/interfaces';\nimport type { CheckboxGroupStyleProps } from './CheckboxGroup.interface';\nimport type { FieldValues } from 'react-hook-form';\nimport CheckboxGroupBase from './CheckboxGroup';\n\nconst CheckboxGroup = <TFieldValues extends FieldValues = FieldValues>({\n theme,\n ...rest\n}: CheckboxGroupStyleProps<TFieldValues>) => {\n const { componentStyles } = useCreateComponentStyles([Component.CHECKBOXGROUP], theme);\n\n return <CheckboxGroupBase {...rest} style={componentStyles} />;\n};\n\nexport default CheckboxGroup;\n","import { css } from '@emotion/react';\nimport { getStyle } from '@utilities/emotion/styles';\n\nconst Style = (theme: Record<string, string>) => css`\n &.--CHECKBOXTREE {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: fit-content;\n\n .--CHECKBOXTREE-children {\n display: flex;\n flex-direction: column;\n padding-left: 36px;\n gap: 16px;\n }\n\n .--CHECKBOXTREE-helperText {\n font-family: ${theme['--FONTFAMILY-PRIMARY']};\n font-size: 13px;\n line-height: 16px;\n margin-left: 14px;\n ${getStyle(theme, 'color', '--CHECKBOXTREE-EVENTS-ENABLED-COLOR-SECONDARY')}\n\n &:empty {\n display: none;\n }\n }\n\n &.--CHECKBOXTREE-error {\n .--CHECKBOXTREE-helperText {\n ${getStyle(theme, 'color', '--CHECKBOXTREE-EVENTS-ERROR-COLOR-SECONDARY')}\n }\n }\n\n &.--CHECKBOXTREE-disabled {\n .--CHECKBOXTREE-helperText {\n ${getStyle(theme, 'color', '--CHECKBOXTREE-EVENTS-DISABLED-COLOR-SECONDARY')}\n }\n }\n }\n`;\n\nexport default Style;\n","import React, { useRef, useEffect, useMemo } from 'react';\n// External libraries\nimport { useController, type FieldValues, type FieldPath } from 'react-hook-form';\nimport CheckOutlinedIcon from '@mui/icons-material/CheckOutlined';\nimport RemoveOutlinedIcon from '@mui/icons-material/RemoveOutlined';\n// Component Base\nimport emotion from './CheckboxTree.emotion';\nimport type { CheckboxTreeProps } from './CheckboxTree.interface';\nimport Checkbox from '@components/atoms/Checkbox';\nimport { CheckboxTreeContext } from './CheckboxTree.context';\n\nconst CLASS = '--CHECKBOXTREE';\n\n/**\n * CheckboxTree renders a parent `<Checkbox>` that controls all of its `<Checkbox>` children.\n *\n * Parent states:\n * - **Checked** — all children are checked.\n * - **Unchecked** — no children are checked.\n * - **Indeterminate** — some (but not all) children are checked.\n *\n * The form value is `string[]` — the `value` props of every checked child.\n * Validation is declared on the Zod schema, the same way as CheckboxGroup.\n *\n * @example\n * ```tsx\n * <CheckboxTree name=\"options\" control={control} label=\"Select all\">\n * <Checkbox value=\"a\" label=\"Option A\" />\n * <Checkbox value=\"b\" label=\"Option B\" />\n * </CheckboxTree>\n * ```\n */\nconst CheckboxTree = <TFieldValues extends FieldValues = FieldValues>({\n name,\n control,\n children,\n label,\n iconChecked = <CheckOutlinedIcon />,\n iconIndeterminate = <RemoveOutlinedIcon />,\n helperText,\n showErrorText = true,\n disabled,\n style,\n className,\n}: CheckboxTreeProps<TFieldValues>) => {\n const { field, fieldState } = useController({ control, name: name as FieldPath<TFieldValues> });\n\n const checkedValues: string[] = Array.isArray(field.value) ? field.value : [];\n const errorText = fieldState.error;\n\n const childValues = useMemo(\n () =>\n React.Children.toArray(children)\n .map(child => {\n const el = child as React.ReactElement<{ value?: string; name?: string }>;\n return el.props?.value ?? el.props?.name ?? '';\n })\n .filter(Boolean),\n [children],\n );\n\n const allChecked = childValues.length > 0 && childValues.every(v => checkedValues.includes(v));\n const someChecked = !allChecked && childValues.some(v => checkedValues.includes(v));\n const rootRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const input = rootRef.current?.querySelectorAll<HTMLInputElement>('input[type=\"checkbox\"]')[0];\n if (input) input.indeterminate = someChecked;\n }, [someChecked]);\n\n const onParentChange = (checked: boolean) => {\n const next = checked ? [...childValues] : [];\n field.onChange(next);\n field.onBlur();\n };\n\n const onChange = (value: string, checked: boolean) => {\n const next = checked ? [...checkedValues, value] : checkedValues.filter(v => v !== value);\n field.onChange(next);\n field.onBlur();\n };\n\n return (\n <div\n ref={rootRef}\n className={[\n CLASS,\n showErrorText && errorText?.message ? `${CLASS}-error` : '',\n disabled ? `${CLASS}-disabled` : '',\n className || '',\n ].join(' ')}\n css={emotion(style)}\n data-testid={CLASS}\n >\n <Checkbox\n checked={allChecked || someChecked}\n onChecked={onParentChange}\n label={label}\n icon={someChecked ? iconIndeterminate : iconChecked}\n disabled={disabled}\n showErrorText={false}\n helperText={undefined}\n />\n\n <CheckboxTreeContext.Provider value={{ checkedValues, onChange, disabled, error: errorText }}>\n <div className={`${CLASS}-children`} data-testid={`${CLASS}-children`}>\n {children}\n </div>\n </CheckboxTreeContext.Provider>\n\n <span className={`${CLASS}-helperText`} data-testid={`${CLASS}-helperText`}>\n {helperText && (!errorText || !showErrorText) && helperText}\n {showErrorText && errorText && errorText.message}\n </span>\n </div>\n );\n};\n\nexport default CheckboxTree;\n","import { useCreateComponentStyles } from '@hocs/ThemeProvider/useThemeProvider.hook';\nimport { Component } from '@hocs/ThemeProvider/interfaces';\nimport type { CheckboxTreeStyleProps } from './CheckboxTree.interface';\nimport type { FieldValues } from 'react-hook-form';\nimport CheckboxTreeBase from './CheckboxTree';\n\nconst CheckboxTree = <TFieldValues extends FieldValues = FieldValues>({\n theme,\n ...rest\n}: CheckboxTreeStyleProps<TFieldValues>) => {\n const { componentStyles } = useCreateComponentStyles([Component.CHECKBOXTREE], theme);\n\n return <CheckboxTreeBase {...rest} style={componentStyles} />;\n};\n\nexport default CheckboxTree;\n","import { css } from '@emotion/react';\nimport { getStyle } from '@utilities/emotion/styles';\n\nconst labelColor = (theme: Record<string, string>, event: string): string => `\n .--RADIOGROUP-label {\n ${getStyle(theme, 'color', `--RADIOGROUP-EVENTS-${event}-COLOR-PRIMARY`)}\n }\n\n .--RADIOGROUP-helperText {\n ${getStyle(theme, 'color', `--RADIOGROUP-EVENTS-${event}-COLOR-SECONDARY`)}\n }\n`;\n\nconst Style = (theme: Record<string, string>) => css`\n &.--RADIOGROUP {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: fit-content;\n\n // ENABLED\n ${labelColor(theme, 'ENABLED')};\n\n // ERROR\n &.--RADIOGROUP-error {\n ${labelColor(theme, 'ERROR')};\n }\n\n // DISABLED\n &.--RADIOGROUP-disabled {\n ${labelColor(theme, 'DISABLED')};\n }\n\n .--RADIOGROUP-items {\n display: flex;\n flex-direction: column;\n gap: 16px;\n }\n\n &.--RADIOGROUP--horizontal .--RADIOGROUP-items {\n flex-direction: row;\n flex-wrap: wrap;\n }\n\n .--RADIOGROUP-label {\n // FONT\n font-family: ${theme['--FONTFAMILY-PRIMARY']};\n font-size: 0.875rem;\n font-weight: 500;\n line-height: 1;\n }\n\n .--RADIOGROUP-helperText {\n // FONT\n font-family: ${theme['--FONTFAMILY-PRIMARY']};\n font-size: 13px;\n line-height: 16px;\n margin-left: 14px;\n }\n }\n`;\n\nexport default Style;\n","// Component Base\nimport emotion from './RadioGroup.emotion';\nimport type { RadioGroupProps } from './RadioGroup.interface';\nimport { RadioGroupContext } from '@components/atoms/Radio/RadioGroup.context';\n// External libraries\nimport { useController, type FieldValues, type FieldPath } from 'react-hook-form';\n\nconst CLASS = '--RADIOGROUP';\n\n/**\n * RadioGroup manages a set of `<Radio>` children as a single RHF field.\n * The form value is a `string` — the `value` prop of the selected Radio.\n *\n * Provides a `RadioGroupContext` that every child `<Radio>` reads its selected state from.\n * Rendering a `<Radio>` outside a RadioGroup throws an error.\n *\n * @example\n * ```tsx\n * <RadioGroup name=\"option\" control={control} label=\"Pick one\">\n * <Radio value=\"a\" label=\"Option A\" />\n * <Radio value=\"b\" label=\"Option B\" />\n * </RadioGroup>\n * ```\n */\nconst RadioGroup = <TFieldValues extends FieldValues = FieldValues>({\n name,\n control,\n children,\n label,\n helperText,\n showErrorText = true,\n disabled,\n direction = 'vertical',\n style,\n className,\n}: RadioGroupProps<TFieldValues>) => {\n const { field, fieldState } = useController({ control, name: name as FieldPath<TFieldValues> });\n\n const selectedValue: string = typeof field.value === 'string' ? field.value : '';\n const errorText = fieldState.error;\n\n const onChange = (value: string) => {\n field.onChange(value);\n field.onBlur();\n };\n\n return (\n <RadioGroupContext.Provider value={{ name, selectedValue, onChange, disabled, error: errorText }}>\n <div\n className={[\n CLASS,\n `${CLASS}--${direction}`,\n showErrorText && errorText?.message && `${CLASS}-error`,\n disabled && `${CLASS}-disabled`,\n className || '',\n ].join(' ')}\n css={emotion(style)}\n data-testid={CLASS}\n >\n {label && (\n <span className={`${CLASS}-label`} data-testid={`${CLASS}-label`}>\n {label}\n </span>\n )}\n\n <div className={`${CLASS}-items`} data-testid={`${CLASS}-items`}>\n {children}\n </div>\n\n <span className={`${CLASS}-helperText`} data-testid={`${CLASS}-helperText`}>\n {helperText && (!errorText || !showErrorText) && helperText}\n {showErrorText && errorText && errorText.message}\n </span>\n </div>\n </RadioGroupContext.Provider>\n );\n};\n\nexport default RadioGroup;\n","import { useCreateComponentStyles } from '@hocs/ThemeProvider/useThemeProvider.hook';\nimport { Component } from '@hocs/ThemeProvider/interfaces';\nimport type { RadioGroupStyleProps } from './RadioGroup.interface';\nimport type { FieldValues } from 'react-hook-form';\nimport RadioGroupBase from './RadioGroup';\n\nconst RadioGroup = <TFieldValues extends FieldValues = FieldValues>({\n theme,\n ...rest\n}: RadioGroupStyleProps<TFieldValues>) => {\n const { componentStyles } = useCreateComponentStyles([Component.RADIOGROUP], theme);\n\n return <RadioGroupBase {...rest} style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