@arbor-education/design-system.components 0.25.1 → 0.25.2
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/CHANGELOG.md +8 -0
- package/dist/components/row/Row.d.ts +4 -4
- package/dist/components/row/Row.d.ts.map +1 -1
- package/dist/components/row/Row.stories.d.ts +3 -0
- package/dist/components/row/Row.stories.d.ts.map +1 -1
- package/dist/components/row/Row.stories.js +96 -6
- package/dist/components/row/Row.stories.js.map +1 -1
- package/dist/components/row/Row.test.js +20 -0
- package/dist/components/row/Row.test.js.map +1 -1
- package/dist/components/toggleGroup/ToggleGroup.d.ts +29 -0
- package/dist/components/toggleGroup/ToggleGroup.d.ts.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.js +26 -0
- package/dist/components/toggleGroup/ToggleGroup.js.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.stories.d.ts +86 -0
- package/dist/components/toggleGroup/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.stories.js +342 -0
- package/dist/components/toggleGroup/ToggleGroup.stories.js.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.test.d.ts +2 -0
- package/dist/components/toggleGroup/ToggleGroup.test.d.ts.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.test.js +123 -0
- package/dist/components/toggleGroup/ToggleGroup.test.js.map +1 -0
- package/dist/components/toggleGroup/ToggleGroupItem.d.ts +10 -0
- package/dist/components/toggleGroup/ToggleGroupItem.d.ts.map +1 -0
- package/dist/components/toggleGroup/ToggleGroupItem.js +5 -0
- package/dist/components/toggleGroup/ToggleGroupItem.js.map +1 -0
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/row/Row.stories.tsx +141 -6
- package/src/components/row/Row.test.tsx +23 -0
- package/src/components/row/Row.tsx +4 -4
- package/src/components/toggleGroup/ToggleGroup.stories.tsx +429 -0
- package/src/components/toggleGroup/ToggleGroup.test.tsx +155 -0
- package/src/components/toggleGroup/ToggleGroup.tsx +74 -0
- package/src/components/toggleGroup/ToggleGroupItem.tsx +24 -0
- package/src/components/toggleGroup/toggleGroup.scss +43 -0
- package/src/index.scss +1 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
import { Controls, Heading as DocHeading, Markdown, Primary as DocPrimary, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
5
|
+
import { Icon } from '../icon/Icon.js';
|
|
6
|
+
import { ToggleGroup } from './ToggleGroup.js';
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Docs page content
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
const DESCRIPTION_INTRO = [
|
|
11
|
+
'ToggleGroup renders a set of mutually exclusive toggle options built on',
|
|
12
|
+
'[Radix UI Toggle Group](https://www.radix-ui.com/primitives/docs/components/toggle-group).',
|
|
13
|
+
'Each option can carry a semantic `color` (`"red"`, `"yellow"`, or `"green"`) that applies',
|
|
14
|
+
'a background and text colour from the design token palette when the item is active.',
|
|
15
|
+
'It behaves as a radio group — only one option can be selected at a time.',
|
|
16
|
+
'Typical use cases include attendance status pickers (Present / Late / Absent) and any',
|
|
17
|
+
'single-select choice set where each option has a semantic colour meaning.',
|
|
18
|
+
].join(' ');
|
|
19
|
+
const USAGE_GUIDANCE = [
|
|
20
|
+
'### When to use',
|
|
21
|
+
'',
|
|
22
|
+
'- **Categorised single-select** — when each option has a distinct semantic colour (attendance, priority, status)',
|
|
23
|
+
'- **Compact radio replacement** — when a traditional radio group would take too much vertical space',
|
|
24
|
+
'- **Immediate selection** — when choosing an option takes effect right away without a form submission',
|
|
25
|
+
'',
|
|
26
|
+
'---',
|
|
27
|
+
'',
|
|
28
|
+
'### When NOT to use',
|
|
29
|
+
'',
|
|
30
|
+
'| Situation | Use instead |',
|
|
31
|
+
'|---|---|',
|
|
32
|
+
'| Multiple options can be selected | `CheckboxGroup` |',
|
|
33
|
+
'| Options are part of a larger form submission | `RadioButtonGroup` — communicates deferred action |',
|
|
34
|
+
'| More than ~6 options | `SelectDropdown` — toggle groups become unwieldy at scale |',
|
|
35
|
+
].join('\n');
|
|
36
|
+
const DEVELOPER_NOTES = [
|
|
37
|
+
'### Controlled vs uncontrolled',
|
|
38
|
+
'',
|
|
39
|
+
'Use `defaultValue` for uncontrolled mode — the component manages its own selection state.',
|
|
40
|
+
'Use `value` + `onValueChange` for controlled mode when you need to read or sync the value externally.',
|
|
41
|
+
'',
|
|
42
|
+
'**`onValueChange` receives the new value string directly**, not a React event.',
|
|
43
|
+
'',
|
|
44
|
+
'---',
|
|
45
|
+
'',
|
|
46
|
+
'### Option colour',
|
|
47
|
+
'',
|
|
48
|
+
'The `color` prop accepts `"red"`, `"yellow"`, or `"green"` and is optional.',
|
|
49
|
+
'When set, the colour is applied as background and text colour using semantic design tokens on the active item.',
|
|
50
|
+
'When omitted, the primary button style is used for the selected state.',
|
|
51
|
+
'Options within the same group can mix coloured and uncoloured items.',
|
|
52
|
+
'',
|
|
53
|
+
'---',
|
|
54
|
+
'',
|
|
55
|
+
'### Accessibility',
|
|
56
|
+
'',
|
|
57
|
+
'- Rendered as `role="group"` containing `role="radio"` items',
|
|
58
|
+
'- Keyboard navigation: `Tab` focuses the group, arrow keys move between items, `Space`/`Enter` select',
|
|
59
|
+
'- Each item uses its `text` value as the accessible label',
|
|
60
|
+
'- The `disabled` prop on the root or individual options correctly sets the `disabled` attribute',
|
|
61
|
+
].join('\n');
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Docs page
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
function ToggleGroupDocsPage() {
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "Usage guidance" }), _jsx(Markdown, { children: USAGE_GUIDANCE }), _jsx(DocHeading, { children: "Developer notes" }), _jsx(Markdown, { children: DEVELOPER_NOTES }), _jsx(DocHeading, { children: "Examples" }), _jsx(Stories, { title: "" })] }));
|
|
67
|
+
}
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Meta
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
const attendanceOptions = [
|
|
72
|
+
{ value: 'present', text: 'Present' },
|
|
73
|
+
{ value: 'late', text: 'Late' },
|
|
74
|
+
{ value: 'absent', text: 'Absent' },
|
|
75
|
+
];
|
|
76
|
+
const meta = {
|
|
77
|
+
title: 'Components/ToggleGroup',
|
|
78
|
+
component: ToggleGroup,
|
|
79
|
+
parameters: {
|
|
80
|
+
layout: 'centered',
|
|
81
|
+
docs: {
|
|
82
|
+
page: ToggleGroupDocsPage,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
tags: ['autodocs'],
|
|
86
|
+
args: {
|
|
87
|
+
options: attendanceOptions,
|
|
88
|
+
onValueChange: fn(),
|
|
89
|
+
},
|
|
90
|
+
argTypes: {
|
|
91
|
+
value: {
|
|
92
|
+
control: 'text',
|
|
93
|
+
description: 'The controlled selected value. Pair with `onValueChange`.',
|
|
94
|
+
table: { type: { summary: 'string' } },
|
|
95
|
+
},
|
|
96
|
+
defaultValue: {
|
|
97
|
+
control: 'text',
|
|
98
|
+
description: 'The initial selected value for uncontrolled usage.',
|
|
99
|
+
table: { type: { summary: 'string' } },
|
|
100
|
+
},
|
|
101
|
+
disabled: {
|
|
102
|
+
control: 'boolean',
|
|
103
|
+
description: 'Disables all options in the group.',
|
|
104
|
+
table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' } },
|
|
105
|
+
},
|
|
106
|
+
onValueChange: {
|
|
107
|
+
action: 'valueChange',
|
|
108
|
+
control: false,
|
|
109
|
+
description: 'Callback fired when the selection changes. Receives the new value string.',
|
|
110
|
+
table: { type: { summary: '(value: string) => void' } },
|
|
111
|
+
},
|
|
112
|
+
options: {
|
|
113
|
+
control: false,
|
|
114
|
+
description: 'Array of option configs. Each accepts `value`, `text`, `color` (`"red" | "yellow" | "green"`), `icon`, and `disabled`.',
|
|
115
|
+
table: { type: { summary: 'ToggleGroupOption[]' } },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
export default meta;
|
|
120
|
+
const withDescription = (story, description) => ({
|
|
121
|
+
...story,
|
|
122
|
+
parameters: {
|
|
123
|
+
...story.parameters,
|
|
124
|
+
docs: { ...story.parameters?.docs, description: { story: description } },
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Stories
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
export const Default = withDescription({
|
|
131
|
+
args: {
|
|
132
|
+
options: attendanceOptions,
|
|
133
|
+
value: undefined,
|
|
134
|
+
onValueChange: fn(),
|
|
135
|
+
},
|
|
136
|
+
}, 'No option selected. Click an option to see the selected state.');
|
|
137
|
+
export const WithDefaultValue = withDescription({
|
|
138
|
+
args: {
|
|
139
|
+
options: attendanceOptions,
|
|
140
|
+
defaultValue: 'present',
|
|
141
|
+
onValueChange: undefined,
|
|
142
|
+
},
|
|
143
|
+
parameters: {
|
|
144
|
+
controls: { disable: true },
|
|
145
|
+
docs: {
|
|
146
|
+
source: {
|
|
147
|
+
language: 'tsx',
|
|
148
|
+
code: `
|
|
149
|
+
import { ToggleGroup } from '@arbor-education/design-system.components';
|
|
150
|
+
|
|
151
|
+
const options = [
|
|
152
|
+
{ value: 'present', text: 'Present' },
|
|
153
|
+
{ value: 'late', text: 'Late' },
|
|
154
|
+
{ value: 'absent', text: 'Absent' },
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
<ToggleGroup options={options} defaultValue="present" />
|
|
158
|
+
`.trim(),
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}, 'Uncontrolled mode — `defaultValue` sets the initial selection and the component manages state internally.');
|
|
163
|
+
export const Controlled = withDescription({
|
|
164
|
+
render: (args) => {
|
|
165
|
+
const [value, setValue] = useState('present');
|
|
166
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 'var(--spacing-small)' }, children: [_jsx(ToggleGroup, { options: args.options, disabled: args.disabled, className: args.className, value: value, onValueChange: (v) => {
|
|
167
|
+
setValue(v);
|
|
168
|
+
args.onValueChange?.(v);
|
|
169
|
+
} }), _jsxs("p", { style: { margin: 0, fontSize: 'var(--font-size-2-13)', color: 'var(--color-grey-600)' }, children: ["Selected:", ' ', _jsx("strong", { children: value || '—' })] })] }));
|
|
170
|
+
},
|
|
171
|
+
parameters: {
|
|
172
|
+
controls: { disable: true },
|
|
173
|
+
docs: {
|
|
174
|
+
source: {
|
|
175
|
+
language: 'tsx',
|
|
176
|
+
code: `
|
|
177
|
+
import { useState } from 'react';
|
|
178
|
+
import { ToggleGroup } from '@arbor-education/design-system.components';
|
|
179
|
+
|
|
180
|
+
const options = [
|
|
181
|
+
{ value: 'present', text: 'Present' },
|
|
182
|
+
{ value: 'late', text: 'Late' },
|
|
183
|
+
{ value: 'absent', text: 'Absent' },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
function AttendancePicker() {
|
|
187
|
+
const [status, setStatus] = useState('present');
|
|
188
|
+
return <ToggleGroup options={options} value={status} onValueChange={setStatus} />;
|
|
189
|
+
}
|
|
190
|
+
`.trim(),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
}, 'Controlled mode — `value` and `onValueChange` manage selection externally. The label below reflects the current value.');
|
|
195
|
+
export const WithColours = withDescription({
|
|
196
|
+
args: {
|
|
197
|
+
options: [
|
|
198
|
+
{ value: 'present', text: 'Present', color: 'green' },
|
|
199
|
+
{ value: 'late', text: 'Late', color: 'yellow' },
|
|
200
|
+
{ value: 'absent', text: 'Absent', color: 'red' },
|
|
201
|
+
],
|
|
202
|
+
defaultValue: 'present',
|
|
203
|
+
onValueChange: undefined,
|
|
204
|
+
},
|
|
205
|
+
parameters: {
|
|
206
|
+
controls: { disable: true },
|
|
207
|
+
docs: {
|
|
208
|
+
source: {
|
|
209
|
+
language: 'tsx',
|
|
210
|
+
code: `
|
|
211
|
+
import { ToggleGroup } from '@arbor-education/design-system.components';
|
|
212
|
+
|
|
213
|
+
const options = [
|
|
214
|
+
{ value: 'present', text: 'Present', color: 'green' },
|
|
215
|
+
{ value: 'late', text: 'Late', color: 'yellow' },
|
|
216
|
+
{ value: 'absent', text: 'Absent', color: 'red' },
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
<ToggleGroup options={options} defaultValue="present" />
|
|
220
|
+
`.trim(),
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
}, 'Each option accepts an optional `color` prop (`"green"`, `"yellow"`, or `"red"`). The colour is applied using semantic design tokens when the item is selected.');
|
|
225
|
+
export const WithMixedColours = withDescription({
|
|
226
|
+
args: {
|
|
227
|
+
options: [
|
|
228
|
+
{ value: 'present', text: 'Present', color: 'green' },
|
|
229
|
+
{ value: 'late', text: 'Late', color: 'yellow' },
|
|
230
|
+
{ value: 'absent', text: 'Absent', color: 'red' },
|
|
231
|
+
{ value: 'not-required', text: 'Not required' },
|
|
232
|
+
],
|
|
233
|
+
defaultValue: 'not-required',
|
|
234
|
+
onValueChange: undefined,
|
|
235
|
+
},
|
|
236
|
+
parameters: {
|
|
237
|
+
controls: { disable: true },
|
|
238
|
+
docs: {
|
|
239
|
+
source: {
|
|
240
|
+
language: 'tsx',
|
|
241
|
+
code: `
|
|
242
|
+
import { ToggleGroup } from '@arbor-education/design-system.components';
|
|
243
|
+
|
|
244
|
+
const options = [
|
|
245
|
+
{ value: 'present', text: 'Present', color: 'green' },
|
|
246
|
+
{ value: 'late', text: 'Late', color: 'yellow' },
|
|
247
|
+
{ value: 'absent', text: 'Absent', color: 'red' },
|
|
248
|
+
{ value: 'not-required', text: 'Not required' },
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
<ToggleGroup options={options} defaultValue="not-required" />
|
|
252
|
+
`.trim(),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
}, 'Options within the same group can mix coloured and uncoloured items. Uncoloured items use the primary button style when selected.');
|
|
257
|
+
export const WithColoursAndIcons = withDescription({
|
|
258
|
+
args: {
|
|
259
|
+
options: [
|
|
260
|
+
{ value: 'present', text: 'Present', color: 'green', icon: _jsx(Icon, { name: "check", size: 16 }) },
|
|
261
|
+
{ value: 'late', text: 'Late', color: 'yellow', icon: _jsx(Icon, { name: "clock-3", size: 16 }) },
|
|
262
|
+
{ value: 'absent', text: 'Absent', color: 'red', icon: _jsx(Icon, { name: "x", size: 16 }) },
|
|
263
|
+
],
|
|
264
|
+
defaultValue: 'present',
|
|
265
|
+
onValueChange: undefined,
|
|
266
|
+
},
|
|
267
|
+
parameters: {
|
|
268
|
+
controls: { disable: true },
|
|
269
|
+
docs: {
|
|
270
|
+
source: {
|
|
271
|
+
language: 'tsx',
|
|
272
|
+
code: `
|
|
273
|
+
import { Icon, ToggleGroup } from '@arbor-education/design-system.components';
|
|
274
|
+
|
|
275
|
+
const options = [
|
|
276
|
+
{ value: 'present', text: 'Present', color: 'green', icon: <Icon name="check" size={16} /> },
|
|
277
|
+
{ value: 'late', text: 'Late', color: 'yellow', icon: <Icon name="clock-3" size={16} /> },
|
|
278
|
+
{ value: 'absent', text: 'Absent', color: 'red', icon: <Icon name="x" size={16} /> },
|
|
279
|
+
];
|
|
280
|
+
|
|
281
|
+
<ToggleGroup options={options} defaultValue="present" />
|
|
282
|
+
`.trim(),
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
}, 'Options can combine a semantic colour with an icon.');
|
|
287
|
+
export const WithIcons = withDescription({
|
|
288
|
+
args: {
|
|
289
|
+
options: [
|
|
290
|
+
{ value: 'present', text: 'Present', icon: _jsx(Icon, { name: "check", size: 16 }) },
|
|
291
|
+
{ value: 'late', text: 'Late', icon: _jsx(Icon, { name: "clock-3", size: 16 }) },
|
|
292
|
+
{ value: 'absent', text: 'Absent', icon: _jsx(Icon, { name: "x", size: 16 }) },
|
|
293
|
+
],
|
|
294
|
+
defaultValue: 'present',
|
|
295
|
+
onValueChange: undefined,
|
|
296
|
+
},
|
|
297
|
+
parameters: {
|
|
298
|
+
controls: { disable: true },
|
|
299
|
+
docs: {
|
|
300
|
+
source: {
|
|
301
|
+
language: 'tsx',
|
|
302
|
+
code: `
|
|
303
|
+
import { Icon, ToggleGroup } from '@arbor-education/design-system.components';
|
|
304
|
+
|
|
305
|
+
const options = [
|
|
306
|
+
{ value: 'present', text: 'Present', icon: <Icon name="check" size={16} /> },
|
|
307
|
+
{ value: 'late', text: 'Late', icon: <Icon name="clock-3" size={16} /> },
|
|
308
|
+
{ value: 'absent', text: 'Absent', icon: <Icon name="x" size={16} /> },
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
<ToggleGroup options={options} defaultValue="present" />
|
|
312
|
+
`.trim(),
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
}, 'Each option can include an `icon`. The icon renders to the left of the label text.');
|
|
317
|
+
export const Disabled = withDescription({
|
|
318
|
+
args: {
|
|
319
|
+
options: attendanceOptions,
|
|
320
|
+
defaultValue: 'late',
|
|
321
|
+
disabled: true,
|
|
322
|
+
onValueChange: undefined,
|
|
323
|
+
},
|
|
324
|
+
parameters: {
|
|
325
|
+
controls: { disable: true },
|
|
326
|
+
},
|
|
327
|
+
}, 'The entire group can be disabled with the `disabled` prop. Use when the field exists but cannot currently be changed.');
|
|
328
|
+
export const PartiallyDisabled = withDescription({
|
|
329
|
+
args: {
|
|
330
|
+
options: [
|
|
331
|
+
{ value: 'present', text: 'Present' },
|
|
332
|
+
{ value: 'late', text: 'Late', disabled: true },
|
|
333
|
+
{ value: 'absent', text: 'Absent' },
|
|
334
|
+
],
|
|
335
|
+
defaultValue: 'present',
|
|
336
|
+
onValueChange: undefined,
|
|
337
|
+
},
|
|
338
|
+
parameters: {
|
|
339
|
+
controls: { disable: true },
|
|
340
|
+
},
|
|
341
|
+
}, 'Individual options can be disabled by setting `disabled: true` on the option config.');
|
|
342
|
+
//# sourceMappingURL=ToggleGroup.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroup.stories.js","sourceRoot":"","sources":["../../../src/components/toggleGroup/ToggleGroup.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,OAAO,EACP,QAAQ,EACR,KAAK,GACN,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG;IACxB,yEAAyE;IACzE,4FAA4F;IAC5F,2FAA2F;IAC3F,qFAAqF;IACrF,0EAA0E;IAC1E,uFAAuF;IACvF,2EAA2E;CAC5E,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,EAAE;IACF,kHAAkH;IAClH,qGAAqG;IACrG,uGAAuG;IACvG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,eAAe,CAC5C;IACE,IAAI,EAAE;QACJ,OAAO,EAAE,iBAAiB;QAC1B,YAAY,EAAE,MAAM;QACpB,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,SAAS;KACzB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;CACF,EACD,uHAAuH,CACxH,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAU,eAAe,CACrD;IACE,IAAI,EAAE;QACJ,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/C,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;SACpC;QACD,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,SAAS;KACzB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;CACF,EACD,sFAAsF,CACvF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroup.test.d.ts","sourceRoot":"","sources":["../../../src/components/toggleGroup/ToggleGroup.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
import { ToggleGroup } from './ToggleGroup.js';
|
|
7
|
+
const options = [
|
|
8
|
+
{ value: 'present', text: 'Present', color: 'green' },
|
|
9
|
+
{ value: 'late', text: 'Late', color: 'yellow' },
|
|
10
|
+
{ value: 'absent', text: 'Absent', color: 'red' },
|
|
11
|
+
];
|
|
12
|
+
describe('ToggleGroup component', () => {
|
|
13
|
+
test('renders all options', () => {
|
|
14
|
+
render(_jsx(ToggleGroup, { options: options }));
|
|
15
|
+
expect(screen.getByRole('group')).toBeInTheDocument();
|
|
16
|
+
expect(screen.getAllByRole('radio')).toHaveLength(3);
|
|
17
|
+
});
|
|
18
|
+
test('renders option text', () => {
|
|
19
|
+
render(_jsx(ToggleGroup, { options: options }));
|
|
20
|
+
expect(screen.getByText('Present')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('Late')).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText('Absent')).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
test('applies ds-toggle-group base class', () => {
|
|
25
|
+
render(_jsx(ToggleGroup, { options: options }));
|
|
26
|
+
expect(screen.getByRole('group')).toHaveClass('ds-toggle-group');
|
|
27
|
+
});
|
|
28
|
+
test('applies additional className alongside base class', () => {
|
|
29
|
+
render(_jsx(ToggleGroup, { options: options, className: "custom-class" }));
|
|
30
|
+
const group = screen.getByRole('group');
|
|
31
|
+
expect(group).toHaveClass('ds-toggle-group');
|
|
32
|
+
expect(group).toHaveClass('custom-class');
|
|
33
|
+
});
|
|
34
|
+
test('no option is selected by default', () => {
|
|
35
|
+
render(_jsx(ToggleGroup, { options: options }));
|
|
36
|
+
screen.getAllByRole('radio').forEach((radio) => {
|
|
37
|
+
expect(radio).toHaveAttribute('data-state', 'off');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
test('selects the option matching defaultValue in uncontrolled mode', () => {
|
|
41
|
+
render(_jsx(ToggleGroup, { options: options, defaultValue: "late" }));
|
|
42
|
+
expect(screen.getByRole('radio', { name: 'Late' })).toHaveAttribute('data-state', 'on');
|
|
43
|
+
expect(screen.getByRole('radio', { name: 'Present' })).toHaveAttribute('data-state', 'off');
|
|
44
|
+
});
|
|
45
|
+
test('selects the option matching value in controlled mode', () => {
|
|
46
|
+
render(_jsx(ToggleGroup, { options: options, value: "absent", onValueChange: vi.fn() }));
|
|
47
|
+
expect(screen.getByRole('radio', { name: 'Absent' })).toHaveAttribute('data-state', 'on');
|
|
48
|
+
});
|
|
49
|
+
test('calls onValueChange with the clicked option value', () => {
|
|
50
|
+
const handleChange = vi.fn();
|
|
51
|
+
render(_jsx(ToggleGroup, { options: options, value: "", onValueChange: handleChange }));
|
|
52
|
+
fireEvent.click(screen.getByRole('radio', { name: 'Present' }));
|
|
53
|
+
expect(handleChange).toHaveBeenCalledTimes(1);
|
|
54
|
+
expect(handleChange).toHaveBeenCalledWith('present');
|
|
55
|
+
});
|
|
56
|
+
test('applies color class for green option when selected', () => {
|
|
57
|
+
render(_jsx(ToggleGroup, { options: options, value: "present", onValueChange: vi.fn() }));
|
|
58
|
+
expect(screen.getByRole('radio', { name: 'Present' })).toHaveClass('ds-toggle-group__item--green');
|
|
59
|
+
});
|
|
60
|
+
test('applies color class for yellow option when selected', () => {
|
|
61
|
+
render(_jsx(ToggleGroup, { options: options, value: "late", onValueChange: vi.fn() }));
|
|
62
|
+
expect(screen.getByRole('radio', { name: 'Late' })).toHaveClass('ds-toggle-group__item--yellow');
|
|
63
|
+
});
|
|
64
|
+
test('applies color class for red option when selected', () => {
|
|
65
|
+
render(_jsx(ToggleGroup, { options: options, value: "absent", onValueChange: vi.fn() }));
|
|
66
|
+
expect(screen.getByRole('radio', { name: 'Absent' })).toHaveClass('ds-toggle-group__item--red');
|
|
67
|
+
});
|
|
68
|
+
test('does not apply a color class when the option is not selected', () => {
|
|
69
|
+
render(_jsx(ToggleGroup, { options: options, value: "absent", onValueChange: vi.fn() }));
|
|
70
|
+
const present = screen.getByRole('radio', { name: 'Present' });
|
|
71
|
+
expect(present).not.toHaveClass('ds-toggle-group__item--green');
|
|
72
|
+
});
|
|
73
|
+
test('does not apply a color class when no color is provided', () => {
|
|
74
|
+
const noColorOptions = [{ value: 'yes', text: 'Yes' }, { value: 'no', text: 'No' }];
|
|
75
|
+
render(_jsx(ToggleGroup, { options: noColorOptions, value: "yes", onValueChange: vi.fn() }));
|
|
76
|
+
const yes = screen.getByRole('radio', { name: 'Yes' });
|
|
77
|
+
expect(yes).not.toHaveClass('ds-toggle-group__item--green');
|
|
78
|
+
expect(yes).not.toHaveClass('ds-toggle-group__item--yellow');
|
|
79
|
+
expect(yes).not.toHaveClass('ds-toggle-group__item--red');
|
|
80
|
+
});
|
|
81
|
+
test('disables the whole group when disabled prop is set', () => {
|
|
82
|
+
render(_jsx(ToggleGroup, { options: options, disabled: true }));
|
|
83
|
+
screen.getAllByRole('radio').forEach((radio) => {
|
|
84
|
+
expect(radio).toBeDisabled();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
test('disables a single option when its disabled prop is set', () => {
|
|
88
|
+
const mixedOptions = [
|
|
89
|
+
{ value: 'a', text: 'A', color: 'green' },
|
|
90
|
+
{ value: 'b', text: 'B', color: 'red', disabled: true },
|
|
91
|
+
];
|
|
92
|
+
render(_jsx(ToggleGroup, { options: mixedOptions }));
|
|
93
|
+
expect(screen.getByRole('radio', { name: 'B' })).toBeDisabled();
|
|
94
|
+
expect(screen.getByRole('radio', { name: 'A' })).not.toBeDisabled();
|
|
95
|
+
});
|
|
96
|
+
test('does not deselect an active option when clicked again', () => {
|
|
97
|
+
const handleChange = vi.fn();
|
|
98
|
+
render(_jsx(ToggleGroup, { options: options, value: "present", onValueChange: handleChange }));
|
|
99
|
+
fireEvent.click(screen.getByRole('radio', { name: 'Present' }));
|
|
100
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
101
|
+
expect(screen.getByRole('radio', { name: 'Present' })).toHaveAttribute('data-state', 'on');
|
|
102
|
+
});
|
|
103
|
+
test('renders an icon when provided', () => {
|
|
104
|
+
const withIcon = [{ value: 'x', text: 'X', icon: _jsx("svg", { "data-testid": "test-icon" }) }];
|
|
105
|
+
render(_jsx(ToggleGroup, { options: withIcon }));
|
|
106
|
+
expect(screen.getByTestId('test-icon')).toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
describe('keyboard navigation', () => {
|
|
109
|
+
test('all items are individually reachable via Tab', async () => {
|
|
110
|
+
const user = userEvent.setup();
|
|
111
|
+
render(_jsxs("div", { children: [_jsx("button", { children: "Before" }), _jsx(ToggleGroup, { options: options, value: "late", onValueChange: vi.fn() })] }));
|
|
112
|
+
await user.tab();
|
|
113
|
+
expect(document.activeElement).toHaveTextContent('Before');
|
|
114
|
+
await user.tab();
|
|
115
|
+
expect(document.activeElement).toBe(screen.getByRole('radio', { name: 'Present' }));
|
|
116
|
+
await user.tab();
|
|
117
|
+
expect(document.activeElement).toBe(screen.getByRole('radio', { name: 'Late' }));
|
|
118
|
+
await user.tab();
|
|
119
|
+
expect(document.activeElement).toBe(screen.getByRole('radio', { name: 'Absent' }));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=ToggleGroup.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroup.test.js","sourceRoot":"","sources":["../../../src/components/toggleGroup/ToggleGroup.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,OAAO,GAAG;IACd,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAgB,EAAE;IAC9D,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAiB,EAAE;IACzD,EAAE,KAAK,EAAE,QAAQ,EAAE,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C,EAAE,EAAE,GAAI,IAClE,CACP,CAAC;YAEF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAE3D,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAEpF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEjF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ToggleGroupItemProps as RadixToggleGroupItemProps } from '@radix-ui/react-toggle-group';
|
|
2
|
+
export type ToggleGroupItemColor = 'red' | 'yellow' | 'green';
|
|
3
|
+
export type ToggleGroupItemProps = {
|
|
4
|
+
text: string;
|
|
5
|
+
color?: ToggleGroupItemColor;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
} & RadixToggleGroupItemProps;
|
|
9
|
+
export declare const ToggleGroupItem: ({ text, color, icon, isActive, ...radixProps }: ToggleGroupItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=ToggleGroupItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/toggleGroup/ToggleGroupItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,oBAAoB,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAG5G,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,yBAAyB,CAAC;AAE9B,eAAO,MAAM,eAAe,GAAI,gDAAwD,oBAAoB,4CAW3G,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Item } from '@radix-ui/react-toggle-group';
|
|
3
|
+
import { Button } from '../button/Button.js';
|
|
4
|
+
export const ToggleGroupItem = ({ text, color, icon, isActive = false, ...radixProps }) => (_jsx(Item, { ...radixProps, asChild: true, children: _jsxs(Button, { className: isActive && color ? `ds-toggle-group__item--${color}` : undefined, borderless: true, variant: isActive ? 'primary' : 'secondary', children: [icon, text] }) }));
|
|
5
|
+
//# sourceMappingURL=ToggleGroupItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroupItem.js","sourceRoot":"","sources":["../../../src/components/toggleGroup/ToggleGroupItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAA0D,MAAM,8BAA8B,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAWlD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,UAAU,EAAwB,EAAE,EAAE,CAAC,CAC/G,KAAC,IAAI,OAAK,UAAU,EAAE,OAAO,kBAC3B,MAAC,MAAM,IACL,SAAS,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,EAC5E,UAAU,QACV,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,aAE1C,IAAI,EACJ,IAAI,IACE,GACJ,CACR,CAAC"}
|
package/dist/index.css
CHANGED
|
@@ -5304,6 +5304,39 @@ li.ds-combobox__option--disabled {
|
|
|
5304
5304
|
background-color: var(--toggle-on-disabled-color-dot);
|
|
5305
5305
|
}
|
|
5306
5306
|
|
|
5307
|
+
.ds-toggle-group {
|
|
5308
|
+
display: inline-flex;
|
|
5309
|
+
border-radius: var(--border-radius-round);
|
|
5310
|
+
border: var(--toggle-weight-border) solid var(--color-grey-100);
|
|
5311
|
+
padding: var(--border-radius-small);
|
|
5312
|
+
gap: 8px;
|
|
5313
|
+
align-items: center;
|
|
5314
|
+
}
|
|
5315
|
+
.ds-toggle-group .ds-toggle-group__item--red {
|
|
5316
|
+
background-color: var(--color-semantic-destructive-100);
|
|
5317
|
+
color: var(--color-semantic-destructive-700);
|
|
5318
|
+
}
|
|
5319
|
+
.ds-toggle-group .ds-toggle-group__item--red:focus, .ds-toggle-group .ds-toggle-group__item--red:hover {
|
|
5320
|
+
background-color: var(--color-semantic-destructive-100);
|
|
5321
|
+
color: var(--color-semantic-destructive-700);
|
|
5322
|
+
}
|
|
5323
|
+
.ds-toggle-group .ds-toggle-group__item--yellow {
|
|
5324
|
+
background-color: var(--color-semantic-caution-100);
|
|
5325
|
+
color: var(--color-semantic-caution-700);
|
|
5326
|
+
}
|
|
5327
|
+
.ds-toggle-group .ds-toggle-group__item--yellow:focus, .ds-toggle-group .ds-toggle-group__item--yellow:hover {
|
|
5328
|
+
background-color: var(--color-semantic-caution-100);
|
|
5329
|
+
color: var(--color-semantic-caution-700);
|
|
5330
|
+
}
|
|
5331
|
+
.ds-toggle-group .ds-toggle-group__item--green {
|
|
5332
|
+
background-color: var(--color-semantic-success-100);
|
|
5333
|
+
color: var(--color-semantic-success-700);
|
|
5334
|
+
}
|
|
5335
|
+
.ds-toggle-group .ds-toggle-group__item--green:focus, .ds-toggle-group .ds-toggle-group__item--green:hover {
|
|
5336
|
+
background-color: var(--color-semantic-success-100);
|
|
5337
|
+
color: var(--color-semantic-success-700);
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5307
5340
|
.ds-data-view-card {
|
|
5308
5341
|
display: flex;
|
|
5309
5342
|
flex-direction: row;
|