@foi/design-system 0.0.9 → 0.0.10

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.
@@ -1,13 +1,11 @@
1
1
  import { i as e, n as t, r as n } from "./emotion-react-jsx-runtime.browser.esm-BFNmScj4.js";
2
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";
3
+ import { a as i, i as a, n as o, o as s, r as c, t as l } from "./RadioGroup.context-DJLdImVO.js";
4
+ import u, { useEffect as d, useMemo as f, useRef as p } from "react";
5
+ import { css as m } from "@emotion/react";
6
+ import { useController as h } from "react-hook-form";
9
7
  //#region src/components/molecules/CheckboxGroup/CheckboxGroup.emotion.ts
10
- var _ = (e, t) => `
8
+ var g = (e, t) => `
11
9
  .--CHECKBOXGROUP-label {
12
10
  ${r(e, "color", `--CHECKBOXGROUP-EVENTS-${t}-COLOR-PRIMARY`)}
13
11
  }
@@ -15,7 +13,7 @@ var _ = (e, t) => `
15
13
  .--CHECKBOXGROUP-helperText {
16
14
  ${r(e, "color", `--CHECKBOXGROUP-EVENTS-${t}-COLOR-SECONDARY`)}
17
15
  }
18
- `, v = (e) => p`
16
+ `, _ = (e) => m`
19
17
  &.--CHECKBOXGROUP {
20
18
  display: flex;
21
19
  flex-direction: column;
@@ -23,16 +21,16 @@ var _ = (e, t) => `
23
21
  width: fit-content;
24
22
 
25
23
  // ENABLED
26
- ${_(e, "ENABLED")};
24
+ ${g(e, "ENABLED")};
27
25
 
28
26
  // ERROR
29
27
  &.--CHECKBOXGROUP-error {
30
- ${_(e, "ERROR")};
28
+ ${g(e, "ERROR")};
31
29
  }
32
30
 
33
31
  // DISABLED
34
32
  &.--CHECKBOXGROUP-disabled {
35
- ${_(e, "DISABLED")};
33
+ ${g(e, "DISABLED")};
36
34
  }
37
35
 
38
36
  .--CHECKBOXGROUP-items {
@@ -62,11 +60,11 @@ var _ = (e, t) => `
62
60
  margin-left: 14px;
63
61
  }
64
62
  }
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({
63
+ `, v = "--CHECKBOXGROUP", y = ({ name: e, control: r, children: i, label: o, helperText: s, showErrorText: c = !0, disabled: l, direction: u = "vertical", style: d, className: f }) => {
64
+ let { field: p, fieldState: m } = h({
67
65
  control: r,
68
66
  name: e
69
- }), g = Array.isArray(p.value) ? p.value : [], _ = h.error;
67
+ }), g = Array.isArray(p.value) ? p.value : [], y = m.error;
70
68
  return /* @__PURE__ */ t(a.Provider, {
71
69
  value: {
72
70
  checkedValues: g,
@@ -75,44 +73,44 @@ var _ = (e, t) => `
75
73
  p.onChange(n), p.onBlur();
76
74
  },
77
75
  disabled: l,
78
- error: _
76
+ error: y
79
77
  },
80
78
  children: /* @__PURE__ */ n("div", {
81
79
  className: [
82
- y,
83
- `${y}--${u}`,
84
- c && _?.message && `${y}-error`,
85
- l && `${y}-disabled`,
80
+ v,
81
+ `${v}--${u}`,
82
+ c && y?.message && `${v}-error`,
83
+ l && `${v}-disabled`,
86
84
  f || ""
87
85
  ].join(" "),
88
- css: v(d),
89
- "data-testid": y,
86
+ css: _(d),
87
+ "data-testid": v,
90
88
  children: [
91
89
  o && /* @__PURE__ */ t("span", {
92
- className: `${y}-label`,
93
- "data-testid": `${y}-label`,
90
+ className: `${v}-label`,
91
+ "data-testid": `${v}-label`,
94
92
  children: o
95
93
  }),
96
94
  /* @__PURE__ */ t("div", {
97
- className: `${y}-items`,
98
- "data-testid": `${y}-items`,
95
+ className: `${v}-items`,
96
+ "data-testid": `${v}-items`,
99
97
  children: i
100
98
  }),
101
99
  /* @__PURE__ */ n("span", {
102
- className: `${y}-helperText`,
103
- "data-testid": `${y}-helperText`,
104
- children: [s && (!_ || !c) && s, c && _ && _.message]
100
+ className: `${v}-helperText`,
101
+ "data-testid": `${v}-helperText`,
102
+ children: [s && (!y || !c) && s, c && y && y.message]
105
103
  })
106
104
  ]
107
105
  })
108
106
  });
109
- }, x = ({ theme: n, ...r }) => {
110
- let { componentStyles: a } = e([i.CHECKBOXGROUP], n);
111
- return /* @__PURE__ */ t(b, {
107
+ }, b = ({ theme: n, ...r }) => {
108
+ let { componentStyles: i } = e([s.CHECKBOXGROUP], n);
109
+ return /* @__PURE__ */ t(y, {
112
110
  ...r,
113
- style: a
111
+ style: i
114
112
  });
115
- }, S = (e) => p`
113
+ }, x = (e) => m`
116
114
  &.--CHECKBOXTREE {
117
115
  display: flex;
118
116
  flex-direction: column;
@@ -150,70 +148,70 @@ var _ = (e, t) => `
150
148
  }
151
149
  }
152
150
  }
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({
151
+ `, S = "--CHECKBOXTREE", C = ({ name: e, control: r, children: a, label: s, iconChecked: l = /* @__PURE__ */ t(i, { name: "check" }), iconIndeterminate: m = /* @__PURE__ */ t(i, { name: "remove" }), helperText: g, showErrorText: _ = !0, disabled: v, style: y, className: b }) => {
152
+ let { field: C, fieldState: w } = h({
155
153
  control: r,
156
154
  name: e
157
- }), E = Array.isArray(w.value) ? w.value : [], D = T.error, O = d(() => l.Children.toArray(i).map((e) => {
155
+ }), T = Array.isArray(C.value) ? C.value : [], E = w.error, D = f(() => u.Children.toArray(a).map((e) => {
158
156
  let t = e;
159
157
  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,
158
+ }).filter(Boolean), [a]), O = D.length > 0 && D.every((e) => T.includes(e)), k = !O && D.some((e) => T.includes(e)), A = p(null);
159
+ return d(() => {
160
+ let e = A.current?.querySelectorAll("input[type=\"checkbox\"]")[0];
161
+ e && (e.indeterminate = k);
162
+ }, [k]), /* @__PURE__ */ n("div", {
163
+ ref: A,
166
164
  className: [
167
- C,
168
- v && D?.message ? `${C}-error` : "",
169
- y ? `${C}-disabled` : "",
170
- x || ""
165
+ S,
166
+ _ && E?.message ? `${S}-error` : "",
167
+ v ? `${S}-disabled` : "",
168
+ b || ""
171
169
  ].join(" "),
172
- css: S(b),
173
- "data-testid": C,
170
+ css: x(y),
171
+ "data-testid": S,
174
172
  children: [
175
173
  /* @__PURE__ */ t(o, {
176
- checked: k || A,
174
+ checked: O || k,
177
175
  onChecked: (e) => {
178
- let t = e ? [...O] : [];
179
- w.onChange(t), w.onBlur();
176
+ let t = e ? [...D] : [];
177
+ C.onChange(t), C.onBlur();
180
178
  },
181
- label: a,
182
- icon: A ? p : c,
183
- disabled: y,
179
+ label: s,
180
+ icon: k ? m : l,
181
+ disabled: v,
184
182
  showErrorText: !1,
185
183
  helperText: void 0
186
184
  }),
187
- /* @__PURE__ */ t(s.Provider, {
185
+ /* @__PURE__ */ t(c.Provider, {
188
186
  value: {
189
- checkedValues: E,
187
+ checkedValues: T,
190
188
  onChange: (e, t) => {
191
- let n = t ? [...E, e] : E.filter((t) => t !== e);
192
- w.onChange(n), w.onBlur();
189
+ let n = t ? [...T, e] : T.filter((t) => t !== e);
190
+ C.onChange(n), C.onBlur();
193
191
  },
194
- disabled: y,
195
- error: D
192
+ disabled: v,
193
+ error: E
196
194
  },
197
195
  children: /* @__PURE__ */ t("div", {
198
- className: `${C}-children`,
199
- "data-testid": `${C}-children`,
200
- children: i
196
+ className: `${S}-children`,
197
+ "data-testid": `${S}-children`,
198
+ children: a
201
199
  })
202
200
  }),
203
201
  /* @__PURE__ */ n("span", {
204
- className: `${C}-helperText`,
205
- "data-testid": `${C}-helperText`,
206
- children: [_ && (!D || !v) && _, v && D && D.message]
202
+ className: `${S}-helperText`,
203
+ "data-testid": `${S}-helperText`,
204
+ children: [g && (!E || !_) && g, _ && E && E.message]
207
205
  })
208
206
  ]
209
207
  });
210
- }, T = ({ theme: n, ...r }) => {
211
- let { componentStyles: a } = e([i.CHECKBOXTREE], n);
212
- return /* @__PURE__ */ t(w, {
208
+ }, w = ({ theme: n, ...r }) => {
209
+ let { componentStyles: i } = e([s.CHECKBOXTREE], n);
210
+ return /* @__PURE__ */ t(C, {
213
211
  ...r,
214
- style: a
212
+ style: i
215
213
  });
216
- }, E = (e, t) => `
214
+ }, T = (e, t) => `
217
215
  .--RADIOGROUP-label {
218
216
  ${r(e, "color", `--RADIOGROUP-EVENTS-${t}-COLOR-PRIMARY`)}
219
217
  }
@@ -221,7 +219,7 @@ var _ = (e, t) => `
221
219
  .--RADIOGROUP-helperText {
222
220
  ${r(e, "color", `--RADIOGROUP-EVENTS-${t}-COLOR-SECONDARY`)}
223
221
  }
224
- `, D = (e) => p`
222
+ `, E = (e) => m`
225
223
  &.--RADIOGROUP {
226
224
  display: flex;
227
225
  flex-direction: column;
@@ -229,16 +227,16 @@ var _ = (e, t) => `
229
227
  width: fit-content;
230
228
 
231
229
  // ENABLED
232
- ${E(e, "ENABLED")};
230
+ ${T(e, "ENABLED")};
233
231
 
234
232
  // ERROR
235
233
  &.--RADIOGROUP-error {
236
- ${E(e, "ERROR")};
234
+ ${T(e, "ERROR")};
237
235
  }
238
236
 
239
237
  // DISABLED
240
238
  &.--RADIOGROUP-disabled {
241
- ${E(e, "DISABLED")};
239
+ ${T(e, "DISABLED")};
242
240
  }
243
241
 
244
242
  .--RADIOGROUP-items {
@@ -268,58 +266,58 @@ var _ = (e, t) => `
268
266
  margin-left: 14px;
269
267
  }
270
268
  }
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({
269
+ `, D = "--RADIOGROUP", O = ({ name: e, control: r, children: i, label: a, helperText: o, showErrorText: s = !0, disabled: c, direction: u = "vertical", style: d, className: f }) => {
270
+ let { field: p, fieldState: m } = h({
273
271
  control: r,
274
272
  name: e
275
- }), g = typeof p.value == "string" ? p.value : "", _ = h.error;
276
- return /* @__PURE__ */ t(c.Provider, {
273
+ }), g = typeof p.value == "string" ? p.value : "", _ = m.error;
274
+ return /* @__PURE__ */ t(l.Provider, {
277
275
  value: {
278
276
  name: e,
279
277
  selectedValue: g,
280
278
  onChange: (e) => {
281
279
  p.onChange(e), p.onBlur();
282
280
  },
283
- disabled: l,
281
+ disabled: c,
284
282
  error: _
285
283
  },
286
284
  children: /* @__PURE__ */ n("div", {
287
285
  className: [
288
- O,
289
- `${O}--${u}`,
290
- s && _?.message && `${O}-error`,
291
- l && `${O}-disabled`,
286
+ D,
287
+ `${D}--${u}`,
288
+ s && _?.message && `${D}-error`,
289
+ c && `${D}-disabled`,
292
290
  f || ""
293
291
  ].join(" "),
294
- css: D(d),
295
- "data-testid": O,
292
+ css: E(d),
293
+ "data-testid": D,
296
294
  children: [
297
295
  a && /* @__PURE__ */ t("span", {
298
- className: `${O}-label`,
299
- "data-testid": `${O}-label`,
296
+ className: `${D}-label`,
297
+ "data-testid": `${D}-label`,
300
298
  children: a
301
299
  }),
302
300
  /* @__PURE__ */ t("div", {
303
- className: `${O}-items`,
304
- "data-testid": `${O}-items`,
301
+ className: `${D}-items`,
302
+ "data-testid": `${D}-items`,
305
303
  children: i
306
304
  }),
307
305
  /* @__PURE__ */ n("span", {
308
- className: `${O}-helperText`,
309
- "data-testid": `${O}-helperText`,
306
+ className: `${D}-helperText`,
307
+ "data-testid": `${D}-helperText`,
310
308
  children: [o && (!_ || !s) && o, s && _ && _.message]
311
309
  })
312
310
  ]
313
311
  })
314
312
  });
315
- }, A = ({ theme: n, ...r }) => {
316
- let { componentStyles: a } = e([i.RADIOGROUP], n);
317
- return /* @__PURE__ */ t(k, {
313
+ }, k = ({ theme: n, ...r }) => {
314
+ let { componentStyles: i } = e([s.RADIOGROUP], n);
315
+ return /* @__PURE__ */ t(O, {
318
316
  ...r,
319
- style: a
317
+ style: i
320
318
  });
321
319
  };
322
320
  //#endregion
323
- export { T as n, x as r, A as t };
321
+ export { w as n, b as r, k as t };
324
322
 
325
- //# sourceMappingURL=RadioGroup-D2s7AY6E.js.map
323
+ //# sourceMappingURL=RadioGroup-BGdJ2fTN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioGroup-BGdJ2fTN.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 Icon from '@components/atoms/Icon';\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 = <Icon name='check' />,\n iconIndeterminate = <Icon name='remove' />,\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={componentStyles} />;\n};\n\nexport default RadioGroup;\n"],"mappings":";;;;;;;AAGA,IAAM,KAAc,GAA+B,MAA0B;;MAEvE,EAAS,GAAO,SAAS,0BAA0B,EAAM,gBAAgB,CAAC;;;;MAI1E,EAAS,GAAO,SAAS,0BAA0B,EAAM,kBAAkB,CAAC;;GAI5E,KAAS,MAAkC,CAAG;;;;;;;;MAQ9C,EAAW,GAAO,UAAU,CAAC;;;;QAI3B,EAAW,GAAO,QAAQ,CAAC;;;;;QAK3B,EAAW,GAAO,WAAW,CAAC;;;;;;;;;;;;;;;;qBAgBjB,EAAM,wBAAwB;;;;;;;;qBAQ9B,EAAM,wBAAwB;;;;;;GC/C7C,IAAQ,mBAqBR,KAAiE,EACrE,SACA,YACA,aACA,UACA,eACA,mBAAgB,IAChB,aACA,eAAY,YACZ,UACA,mBACsC;CACtC,IAAM,EAAE,UAAO,kBAAe,EAAc;EAAE;EAAe;EAAiC,CAAC,EAEzF,IAA0B,MAAM,QAAQ,EAAM,MAAM,GAAG,EAAM,QAAQ,EAAE,EACvE,IAAY,EAAW;CAQ7B,OACE,kBAAC,EAAqB,UAAtB;EAA+B,OAAO;GAAE;GAAe,WAPvC,GAAe,MAAqB;IACpD,IAAM,IAAO,IAAU,CAAC,GAAG,GAAe,EAAM,GAAG,EAAc,QAAO,MAAK,MAAM,EAAM;IAEzF,AADA,EAAM,SAAS,EAAK,EACpB,EAAM,QAAQ;;GAImD;GAAU,OAAO;GAAW;YAC3F,kBAAC,OAAD;GACE,WAAW;IACT;IACA,GAAG,EA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