@foi/design-system 0.0.9 → 0.0.11
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 +104 -51
- package/dist/{RadioGroup-D2s7AY6E.js → RadioGroup-BL2bdmZx.js} +98 -100
- package/dist/RadioGroup-BL2bdmZx.js.map +1 -0
- package/dist/{RadioGroup.context-zJGC5Sjc.js → RadioGroup.context-BdRgENJJ.js} +149 -99
- package/dist/RadioGroup.context-BdRgENJJ.js.map +1 -0
- package/dist/{Switch-CKpSiHQK.js → Switch-BS8iwAJ5.js} +630 -637
- package/dist/Switch-BS8iwAJ5.js.map +1 -0
- package/dist/ThemeProvider-JlN3U_r2.js +39 -0
- package/dist/ThemeProvider-JlN3U_r2.js.map +1 -0
- package/dist/atoms.d.ts +1 -0
- package/dist/atoms.mjs +3 -3
- package/dist/components/atoms/Checkbox/Checkbox.interface.d.ts +4 -0
- package/dist/components/atoms/Checkbox/index.d.ts +1 -1
- package/dist/components/atoms/Icon/Icon.d.ts +10 -0
- package/dist/components/atoms/Icon/Icon.emotion.d.ts +2 -0
- package/dist/components/atoms/Icon/Icon.interface.d.ts +17 -0
- package/dist/components/atoms/Icon/index.d.ts +1 -0
- package/dist/{emotion-react-jsx-runtime.browser.esm-BFNmScj4.js → emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js} +169 -167
- package/dist/emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js.map +1 -0
- package/dist/hocs/ThemeProvider/ThemeProvider.interface.d.ts +2 -2
- package/dist/hocs/ThemeProvider/components/Button.d.ts +17 -27
- package/dist/hocs/ThemeProvider/components/Checkbox.d.ts +23 -45
- package/dist/hocs/ThemeProvider/components/CheckboxGroup.d.ts +11 -14
- package/dist/hocs/ThemeProvider/components/CheckboxTree.d.ts +11 -14
- package/dist/hocs/ThemeProvider/components/DatePicker.d.ts +23 -45
- package/dist/hocs/ThemeProvider/components/DatePickerMenu.d.ts +17 -27
- package/dist/hocs/ThemeProvider/components/IconButton.d.ts +20 -28
- package/dist/hocs/ThemeProvider/components/Input.d.ts +23 -45
- package/dist/hocs/ThemeProvider/components/Radio.d.ts +23 -45
- package/dist/hocs/ThemeProvider/components/RadioGroup.d.ts +11 -14
- package/dist/hocs/ThemeProvider/components/Select.d.ts +23 -45
- package/dist/hocs/ThemeProvider/components/SelectMenu.d.ts +16 -24
- package/dist/hocs/ThemeProvider/components/Slider.d.ts +15 -26
- package/dist/hocs/ThemeProvider/components/Switch.d.ts +18 -30
- package/dist/hocs/ThemeProvider/createComponentStyles.d.ts +2 -1
- package/dist/hocs/ThemeProvider/useThemeProvider.hook.d.ts +1 -1
- package/dist/hocs.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +6 -6
- package/dist/molecules.mjs +1 -1
- package/dist/theme/dark/components/Button.d.ts +29 -27
- package/dist/theme/dark/components/Checkbox.d.ts +117 -54
- package/dist/theme/dark/components/CheckboxGroup.d.ts +13 -11
- package/dist/theme/dark/components/CheckboxTree.d.ts +12 -10
- package/dist/theme/dark/components/DatePicker.d.ts +53 -51
- package/dist/theme/dark/components/DatePickerMenu.d.ts +24 -22
- package/dist/theme/dark/components/IconButton.d.ts +24 -22
- package/dist/theme/dark/components/Input.d.ts +53 -51
- package/dist/theme/dark/components/Radio.d.ts +56 -54
- package/dist/theme/dark/components/RadioGroup.d.ts +13 -11
- package/dist/theme/dark/components/Select.d.ts +53 -51
- package/dist/theme/dark/components/SelectMenu.d.ts +23 -21
- package/dist/theme/dark/components/Slider.d.ts +41 -39
- package/dist/theme/dark/components/Switch.d.ts +49 -47
- package/dist/theme/dark/components/index.d.ts +567 -478
- package/dist/theme/dark/index.d.ts +567 -478
- package/dist/theme/index.d.ts +567 -478
- package/dist/{theme-DEqiATmv.js → theme-D18AZjTt.js} +112 -61
- package/dist/theme-D18AZjTt.js.map +1 -0
- package/dist/theme.mjs +1 -1
- package/package.json +1 -4
- package/dist/RadioGroup-D2s7AY6E.js.map +0 -1
- package/dist/RadioGroup.context-zJGC5Sjc.js.map +0 -1
- package/dist/Switch-CKpSiHQK.js.map +0 -1
- package/dist/ThemeProvider-oFEpvMxv.js +0 -37
- package/dist/ThemeProvider-oFEpvMxv.js.map +0 -1
- package/dist/emotion-react-jsx-runtime.browser.esm-BFNmScj4.js.map +0 -1
- package/dist/theme-DEqiATmv.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,17 +4,16 @@ A component library built with React 19 and TypeScript. Components are designed
|
|
|
4
4
|
|
|
5
5
|
## Tech stack
|
|
6
6
|
|
|
7
|
-
| Tool
|
|
8
|
-
|
|
9
|
-
| React
|
|
10
|
-
| TypeScript
|
|
11
|
-
| Vite
|
|
12
|
-
| Emotion
|
|
13
|
-
| React Hook Form | 7
|
|
14
|
-
| Zod
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
| Vitest | 4 | Unit tests |
|
|
7
|
+
| Tool | Version | Purpose |
|
|
8
|
+
| --------------- | ------- | ----------------------- |
|
|
9
|
+
| React | 19 | UI runtime |
|
|
10
|
+
| TypeScript | 6 | Type safety |
|
|
11
|
+
| Vite | 8 | Dev server & bundler |
|
|
12
|
+
| Emotion | 11 | CSS-in-JS styling |
|
|
13
|
+
| React Hook Form | 7 | Form state & validation |
|
|
14
|
+
| Zod | 4 | Schema validation |
|
|
15
|
+
| Storybook | 10 | Component explorer |
|
|
16
|
+
| Vitest | 4 | Unit tests |
|
|
18
17
|
|
|
19
18
|
## Commands
|
|
20
19
|
|
|
@@ -43,25 +42,26 @@ npm publish --access public
|
|
|
43
42
|
|
|
44
43
|
### Atoms
|
|
45
44
|
|
|
46
|
-
| Component
|
|
47
|
-
|
|
48
|
-
| `Button`
|
|
49
|
-
| `Checkbox`
|
|
50
|
-
| `DatePicker` | Date input with calendar menu, integrates with RHF
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
45
|
+
| Component | Description |
|
|
46
|
+
| ------------ | ------------------------------------------------------------------- |
|
|
47
|
+
| `Button` | Primary action button with variant/size/color support |
|
|
48
|
+
| `Checkbox` | Single checkbox — standalone, RHF, or inside a group |
|
|
49
|
+
| `DatePicker` | Date input with calendar menu, integrates with RHF |
|
|
50
|
+
| `Icon` | Font-based icon using Material Symbols Rounded — pass a `name` prop |
|
|
51
|
+
| `IconButton` | Clickable icon with button semantics |
|
|
52
|
+
| `Input` | Text input field with label, helper text, and error state |
|
|
53
|
+
| `Radio` | Single radio button — used inside `RadioGroup` |
|
|
54
|
+
| `Select` | Dropdown select with RHF integration |
|
|
55
|
+
| `Slider` | Range slider with RHF integration |
|
|
56
|
+
| `Switch` | Toggle switch — boolean RHF field |
|
|
57
57
|
|
|
58
58
|
### Molecules
|
|
59
59
|
|
|
60
|
-
| Component
|
|
61
|
-
|
|
60
|
+
| Component | Description |
|
|
61
|
+
| --------------- | -------------------------------------------------------------- |
|
|
62
62
|
| `CheckboxGroup` | Manages a set of `Checkbox` children as a `string[]` RHF field |
|
|
63
|
-
| `CheckboxTree`
|
|
64
|
-
| `RadioGroup`
|
|
63
|
+
| `CheckboxTree` | Hierarchical checkbox group with parent/child selection logic |
|
|
64
|
+
| `RadioGroup` | Manages a set of `Radio` children as a single RHF field |
|
|
65
65
|
|
|
66
66
|
## Usage with React Hook Form
|
|
67
67
|
|
|
@@ -76,7 +76,7 @@ import Button from '@components/atoms/Button';
|
|
|
76
76
|
|
|
77
77
|
const schema = z.object({
|
|
78
78
|
email: z.string().email('Invalid email'),
|
|
79
|
-
age:
|
|
79
|
+
age: z.number().min(18, 'Must be 18 or older'),
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
type FormValues = z.infer<typeof schema>;
|
|
@@ -88,9 +88,9 @@ const MyForm = () => {
|
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<form onSubmit={handleSubmit(console.log)}>
|
|
91
|
-
<Input name=
|
|
92
|
-
<Input name=
|
|
93
|
-
<Button type=
|
|
91
|
+
<Input name='email' control={control} label='Email' />
|
|
92
|
+
<Input name='age' control={control} label='Age' type='number' />
|
|
93
|
+
<Button type='submit' label='Submit' />
|
|
94
94
|
</form>
|
|
95
95
|
);
|
|
96
96
|
};
|
|
@@ -105,11 +105,11 @@ const schema = z.object({
|
|
|
105
105
|
skills: z.array(z.string()).min(1, 'Select at least one'),
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
<CheckboxGroup name=
|
|
109
|
-
<Checkbox value=
|
|
110
|
-
<Checkbox value=
|
|
111
|
-
<Checkbox value=
|
|
112
|
-
</CheckboxGroup
|
|
108
|
+
<CheckboxGroup name='skills' control={control} label='Skills'>
|
|
109
|
+
<Checkbox value='react' label='React' />
|
|
110
|
+
<Checkbox value='vue' label='Vue' />
|
|
111
|
+
<Checkbox value='svelte' label='Svelte' />
|
|
112
|
+
</CheckboxGroup>;
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
### Controlled mode (no RHF)
|
|
@@ -119,39 +119,92 @@ Pass `checked` + `onChecked` instead of `name`/`control`.
|
|
|
119
119
|
```tsx
|
|
120
120
|
const [agreed, setAgreed] = useState(false);
|
|
121
121
|
|
|
122
|
-
<Checkbox checked={agreed} onChecked={setAgreed} label=
|
|
122
|
+
<Checkbox checked={agreed} onChecked={setAgreed} label='I agree to the terms' />;
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
## Theming
|
|
126
126
|
|
|
127
|
-
Wrap your app in `ThemeProvider` and
|
|
127
|
+
Wrap your app in `ThemeProvider` and pass one or more named themes. The active theme is selected by the `theme` prop and its tokens are injected as CSS custom properties that every component consumes.
|
|
128
128
|
|
|
129
129
|
```tsx
|
|
130
130
|
import ThemeProvider from '@hocs/ThemeProvider';
|
|
131
|
-
import
|
|
131
|
+
import darkTheme from './themes/dark';
|
|
132
132
|
|
|
133
|
-
<ThemeProvider themes={[
|
|
133
|
+
<ThemeProvider themes={[darkTheme]} theme='dark'>
|
|
134
134
|
<App />
|
|
135
|
-
</ThemeProvider
|
|
135
|
+
</ThemeProvider>;
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
### Theme structure
|
|
139
|
+
|
|
140
|
+
A theme is a plain object with a `name`, an optional `fonts` map, and a `components` map. Each component key holds one or more **variants**. Every component must define at least a `DEFAULT` variant; additional variants are optional.
|
|
141
|
+
|
|
142
|
+
Each variant contains:
|
|
143
|
+
|
|
144
|
+
- `ROOT` — static styles applied unconditionally (e.g. `border-radius`)
|
|
145
|
+
- `EVENTS` — styles scoped to interaction states (`ENABLED`, `HOVER`, `FOCUS`, `ERROR`, `DISABLED`, etc.)
|
|
139
146
|
|
|
140
147
|
```ts
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
ROOT: {
|
|
147
|
-
|
|
148
|
+
import type { BUTTON } from '@hocs/ThemeProvider/components/Button';
|
|
149
|
+
|
|
150
|
+
const component = {
|
|
151
|
+
BUTTON: {
|
|
152
|
+
DEFAULT: {
|
|
153
|
+
ROOT: {
|
|
154
|
+
'border-radius': '8px',
|
|
155
|
+
},
|
|
156
|
+
EVENTS: {
|
|
157
|
+
ENABLED: {
|
|
158
|
+
'background-color': '#0070f3',
|
|
159
|
+
'color-primary': '#ffffff',
|
|
160
|
+
},
|
|
161
|
+
HOVER: {
|
|
162
|
+
'background-color': '#005bb5',
|
|
163
|
+
},
|
|
164
|
+
FOCUS: {
|
|
165
|
+
'outline-color': '#93c5fd',
|
|
166
|
+
'outline-width': '2px',
|
|
167
|
+
'outline-style': 'solid',
|
|
168
|
+
'outline-offset': '2px',
|
|
169
|
+
},
|
|
170
|
+
DISABLED: {
|
|
171
|
+
'background-color': '#e5e7eb',
|
|
172
|
+
'color-primary': '#9ca3af',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
DANGER: {
|
|
177
|
+
EVENTS: {
|
|
178
|
+
ENABLED: {
|
|
179
|
+
'background-color': '#dc2626',
|
|
180
|
+
'color-primary': '#ffffff',
|
|
181
|
+
},
|
|
182
|
+
HOVER: {
|
|
183
|
+
'background-color': '#b91c1c',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
148
186
|
},
|
|
149
|
-
// ...other components
|
|
150
187
|
},
|
|
151
|
-
} satisfies
|
|
188
|
+
} as const satisfies BUTTON;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The `satisfies BUTTON` check enforces that `DEFAULT` is present and that every token key is valid for that component. TypeScript reports an error at the theme file if a token is misspelled or if `DEFAULT` is missing.
|
|
192
|
+
|
|
193
|
+
### Selecting a variant
|
|
194
|
+
|
|
195
|
+
Pass the `variant` prop to a component to switch between the variants you defined in the theme. The default is always `'default'`.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
<Button label='Delete' variant='danger' />
|
|
152
199
|
```
|
|
153
200
|
|
|
154
|
-
|
|
201
|
+
### One-off theme override
|
|
202
|
+
|
|
203
|
+
Any component also accepts a `theme` prop — a partial `EVENTS` object — to override tokens for that single instance without touching the global theme.
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<Button label='Special' theme={{ ENABLED: { 'background-color': '#7c3aed' } }} />
|
|
207
|
+
```
|
|
155
208
|
|
|
156
209
|
## Project structure
|
|
157
210
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { i as e, n as t, r as n } from "./emotion-react-jsx-runtime.browser.esm-
|
|
2
|
-
import { r } from "./theme-
|
|
3
|
-
import { a as i, i as a, n as o,
|
|
4
|
-
import
|
|
5
|
-
import { css as
|
|
6
|
-
import { useController as
|
|
7
|
-
import h from "@mui/icons-material/CheckOutlined";
|
|
8
|
-
import g from "@mui/icons-material/RemoveOutlined";
|
|
1
|
+
import { i as e, n as t, r as n } from "./emotion-react-jsx-runtime.browser.esm-ClrpcFMG.js";
|
|
2
|
+
import { r } from "./theme-D18AZjTt.js";
|
|
3
|
+
import { a as i, i as a, n as o, o as s, r as c, t as l } from "./RadioGroup.context-BdRgENJJ.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
|
|
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
|
-
`,
|
|
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
|
-
${
|
|
24
|
+
${g(e, "ENABLED")};
|
|
27
25
|
|
|
28
26
|
// ERROR
|
|
29
27
|
&.--CHECKBOXGROUP-error {
|
|
30
|
-
${
|
|
28
|
+
${g(e, "ERROR")};
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
// DISABLED
|
|
34
32
|
&.--CHECKBOXGROUP-disabled {
|
|
35
|
-
${
|
|
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
|
-
`,
|
|
66
|
-
let { field: p, fieldState:
|
|
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 : [],
|
|
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
|
-
|
|
83
|
-
`${
|
|
84
|
-
c &&
|
|
85
|
-
l && `${
|
|
80
|
+
v,
|
|
81
|
+
`${v}--${u}`,
|
|
82
|
+
c && y?.message && `${v}-error`,
|
|
83
|
+
l && `${v}-disabled`,
|
|
86
84
|
f || ""
|
|
87
85
|
].join(" "),
|
|
88
|
-
css:
|
|
89
|
-
"data-testid":
|
|
86
|
+
css: _(d),
|
|
87
|
+
"data-testid": v,
|
|
90
88
|
children: [
|
|
91
89
|
o && /* @__PURE__ */ t("span", {
|
|
92
|
-
className: `${
|
|
93
|
-
"data-testid": `${
|
|
90
|
+
className: `${v}-label`,
|
|
91
|
+
"data-testid": `${v}-label`,
|
|
94
92
|
children: o
|
|
95
93
|
}),
|
|
96
94
|
/* @__PURE__ */ t("div", {
|
|
97
|
-
className: `${
|
|
98
|
-
"data-testid": `${
|
|
95
|
+
className: `${v}-items`,
|
|
96
|
+
"data-testid": `${v}-items`,
|
|
99
97
|
children: i
|
|
100
98
|
}),
|
|
101
99
|
/* @__PURE__ */ n("span", {
|
|
102
|
-
className: `${
|
|
103
|
-
"data-testid": `${
|
|
104
|
-
children: [s && (!
|
|
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
|
-
},
|
|
110
|
-
let { componentStyles:
|
|
111
|
-
return /* @__PURE__ */ t(
|
|
107
|
+
}, b = ({ theme: n, ...r }) => {
|
|
108
|
+
let { componentStyles: i } = e([s.CHECKBOXGROUP], n);
|
|
109
|
+
return /* @__PURE__ */ t(y, {
|
|
112
110
|
...r,
|
|
113
|
-
style:
|
|
111
|
+
style: i
|
|
114
112
|
});
|
|
115
|
-
},
|
|
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
|
-
`,
|
|
154
|
-
let { field:
|
|
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
|
-
}),
|
|
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), [
|
|
161
|
-
return
|
|
162
|
-
let e =
|
|
163
|
-
e && (e.indeterminate =
|
|
164
|
-
}, [
|
|
165
|
-
ref:
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
S,
|
|
166
|
+
_ && E?.message ? `${S}-error` : "",
|
|
167
|
+
v ? `${S}-disabled` : "",
|
|
168
|
+
b || ""
|
|
171
169
|
].join(" "),
|
|
172
|
-
css:
|
|
173
|
-
"data-testid":
|
|
170
|
+
css: x(y),
|
|
171
|
+
"data-testid": S,
|
|
174
172
|
children: [
|
|
175
173
|
/* @__PURE__ */ t(o, {
|
|
176
|
-
checked:
|
|
174
|
+
checked: O || k,
|
|
177
175
|
onChecked: (e) => {
|
|
178
|
-
let t = e ? [...
|
|
179
|
-
|
|
176
|
+
let t = e ? [...D] : [];
|
|
177
|
+
C.onChange(t), C.onBlur();
|
|
180
178
|
},
|
|
181
|
-
label:
|
|
182
|
-
icon:
|
|
183
|
-
disabled:
|
|
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(
|
|
185
|
+
/* @__PURE__ */ t(c.Provider, {
|
|
188
186
|
value: {
|
|
189
|
-
checkedValues:
|
|
187
|
+
checkedValues: T,
|
|
190
188
|
onChange: (e, t) => {
|
|
191
|
-
let n = t ? [...
|
|
192
|
-
|
|
189
|
+
let n = t ? [...T, e] : T.filter((t) => t !== e);
|
|
190
|
+
C.onChange(n), C.onBlur();
|
|
193
191
|
},
|
|
194
|
-
disabled:
|
|
195
|
-
error:
|
|
192
|
+
disabled: v,
|
|
193
|
+
error: E
|
|
196
194
|
},
|
|
197
195
|
children: /* @__PURE__ */ t("div", {
|
|
198
|
-
className: `${
|
|
199
|
-
"data-testid": `${
|
|
200
|
-
children:
|
|
196
|
+
className: `${S}-children`,
|
|
197
|
+
"data-testid": `${S}-children`,
|
|
198
|
+
children: a
|
|
201
199
|
})
|
|
202
200
|
}),
|
|
203
201
|
/* @__PURE__ */ n("span", {
|
|
204
|
-
className: `${
|
|
205
|
-
"data-testid": `${
|
|
206
|
-
children: [
|
|
202
|
+
className: `${S}-helperText`,
|
|
203
|
+
"data-testid": `${S}-helperText`,
|
|
204
|
+
children: [g && (!E || !_) && g, _ && E && E.message]
|
|
207
205
|
})
|
|
208
206
|
]
|
|
209
207
|
});
|
|
210
|
-
},
|
|
211
|
-
let { componentStyles:
|
|
212
|
-
return /* @__PURE__ */ t(
|
|
208
|
+
}, w = ({ theme: n, ...r }) => {
|
|
209
|
+
let { componentStyles: i } = e([s.CHECKBOXTREE], n);
|
|
210
|
+
return /* @__PURE__ */ t(C, {
|
|
213
211
|
...r,
|
|
214
|
-
style:
|
|
212
|
+
style: i
|
|
215
213
|
});
|
|
216
|
-
},
|
|
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
|
-
`,
|
|
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
|
-
${
|
|
230
|
+
${T(e, "ENABLED")};
|
|
233
231
|
|
|
234
232
|
// ERROR
|
|
235
233
|
&.--RADIOGROUP-error {
|
|
236
|
-
${
|
|
234
|
+
${T(e, "ERROR")};
|
|
237
235
|
}
|
|
238
236
|
|
|
239
237
|
// DISABLED
|
|
240
238
|
&.--RADIOGROUP-disabled {
|
|
241
|
-
${
|
|
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
|
-
`,
|
|
272
|
-
let { field: p, fieldState:
|
|
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 : "", _ =
|
|
276
|
-
return /* @__PURE__ */ t(
|
|
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:
|
|
281
|
+
disabled: c,
|
|
284
282
|
error: _
|
|
285
283
|
},
|
|
286
284
|
children: /* @__PURE__ */ n("div", {
|
|
287
285
|
className: [
|
|
288
|
-
|
|
289
|
-
`${
|
|
290
|
-
s && _?.message && `${
|
|
291
|
-
|
|
286
|
+
D,
|
|
287
|
+
`${D}--${u}`,
|
|
288
|
+
s && _?.message && `${D}-error`,
|
|
289
|
+
c && `${D}-disabled`,
|
|
292
290
|
f || ""
|
|
293
291
|
].join(" "),
|
|
294
|
-
css:
|
|
295
|
-
"data-testid":
|
|
292
|
+
css: E(d),
|
|
293
|
+
"data-testid": D,
|
|
296
294
|
children: [
|
|
297
295
|
a && /* @__PURE__ */ t("span", {
|
|
298
|
-
className: `${
|
|
299
|
-
"data-testid": `${
|
|
296
|
+
className: `${D}-label`,
|
|
297
|
+
"data-testid": `${D}-label`,
|
|
300
298
|
children: a
|
|
301
299
|
}),
|
|
302
300
|
/* @__PURE__ */ t("div", {
|
|
303
|
-
className: `${
|
|
304
|
-
"data-testid": `${
|
|
301
|
+
className: `${D}-items`,
|
|
302
|
+
"data-testid": `${D}-items`,
|
|
305
303
|
children: i
|
|
306
304
|
}),
|
|
307
305
|
/* @__PURE__ */ n("span", {
|
|
308
|
-
className: `${
|
|
309
|
-
"data-testid": `${
|
|
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
|
-
},
|
|
316
|
-
let { componentStyles:
|
|
317
|
-
return /* @__PURE__ */ t(
|
|
313
|
+
}, k = ({ theme: n, ...r }) => {
|
|
314
|
+
let { componentStyles: i } = e([s.RADIOGROUP], n);
|
|
315
|
+
return /* @__PURE__ */ t(O, {
|
|
318
316
|
...r,
|
|
319
|
-
style:
|
|
317
|
+
style: i
|
|
320
318
|
});
|
|
321
319
|
};
|
|
322
320
|
//#endregion
|
|
323
|
-
export {
|
|
321
|
+
export { w as n, b as r, k as t };
|
|
324
322
|
|
|
325
|
-
//# sourceMappingURL=RadioGroup-
|
|
323
|
+
//# sourceMappingURL=RadioGroup-BL2bdmZx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup-BL2bdmZx.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,wBA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