@appdirect/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 +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
- package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
- package/dist/contracts/PageContentHeader.json +10 -5
- package/dist/contracts/index.json +1 -1
- package/dist/index.ts +3 -4
- package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
- package/dist/stories/Buttons/Button.stories.tsx +145 -0
- package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
- package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
- package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
- package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
- package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
- package/dist/stories/Combobox/Select.stories.tsx +311 -0
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
- package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
- package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
- package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
- package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
- package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
- package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
- package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
- package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
- package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
- package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
- package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
- package/dist/stories/DataDisplay/List.stories.tsx +376 -0
- package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
- package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
- package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
- package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
- package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
- package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
- package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
- package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
- package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
- package/dist/stories/Inputs/Radio.stories.tsx +437 -0
- package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
- package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
- package/dist/stories/Inputs/Slider.stories.tsx +22 -0
- package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
- package/dist/stories/Inputs/Switch.stories.tsx +361 -0
- package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
- package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
- package/dist/stories/Misc/Divider.stories.tsx +581 -0
- package/dist/stories/Misc/Paper.stories.tsx +557 -0
- package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
- package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
- package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
- package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
- package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
- package/dist/stories/Overlays/Menu.stories.tsx +941 -0
- package/dist/stories/Overlays/Modal.stories.tsx +249 -0
- package/dist/stories/Overlays/Popover.stories.tsx +780 -0
- package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
- package/dist/stories/Typography/Code.stories.tsx +368 -0
- package/dist/stories/Typography/Kbd.stories.tsx +514 -0
- package/dist/stories/Typography/Text.stories.tsx +117 -0
- package/dist/stories/Typography/Title.stories.tsx +112 -0
- package/dist/stories/index.json +1435 -0
- package/package.json +5 -3
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { Inline, RadioGroup, Radio, Title, Text, Button } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof RadioGroup> = {
|
|
7
|
+
title: 'Design System/Inputs/RadioGroup',
|
|
8
|
+
component: RadioGroup,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'RadioGroup component for selecting a single option from multiple choices with consistent styling and validation.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs', 'needs-connect'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
size: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
22
|
+
description: 'RadioGroup size',
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Group label',
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'Group description',
|
|
31
|
+
},
|
|
32
|
+
error: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'Error message',
|
|
35
|
+
},
|
|
36
|
+
required: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Whether the group is required',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: () => {
|
|
48
|
+
const [value, setValue] = useState<string>('');
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<RadioGroup label="Choose an option" value={value} onChange={(v) => setValue(String(v))}>
|
|
52
|
+
<Radio value="option1" label="First option" />
|
|
53
|
+
<Radio value="option2" label="Second option" />
|
|
54
|
+
<Radio value="option3" label="Third option" />
|
|
55
|
+
</RadioGroup>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Sizes: Story = {
|
|
61
|
+
render: () => {
|
|
62
|
+
const [values, setValues] = useState({
|
|
63
|
+
xs: '',
|
|
64
|
+
sm: '',
|
|
65
|
+
md: '',
|
|
66
|
+
lg: '',
|
|
67
|
+
xl: '',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Stack gap="lg">
|
|
74
|
+
{sizes.map(size => (
|
|
75
|
+
<div key={size}>
|
|
76
|
+
<Text size="sm" fw={500} mb="xs">{size.toUpperCase()}:</Text>
|
|
77
|
+
<RadioGroup
|
|
78
|
+
size={size}
|
|
79
|
+
label={`${size.toUpperCase()} Radio Group`}
|
|
80
|
+
value={values[size]}
|
|
81
|
+
onChange={(val) => setValues(prev => ({ ...prev, [size]: String(val) }))}
|
|
82
|
+
>
|
|
83
|
+
<Radio value="option1" label="First option" />
|
|
84
|
+
<Radio value="option2" label="Second option" />
|
|
85
|
+
<Radio value="option3" label="Third option" />
|
|
86
|
+
</RadioGroup>
|
|
87
|
+
</div>
|
|
88
|
+
))}
|
|
89
|
+
</Stack>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
parameters: {
|
|
93
|
+
docs: {
|
|
94
|
+
description: {
|
|
95
|
+
story: 'Different sizes for the RadioGroup component.',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const WithDescription: Story = {
|
|
102
|
+
render: () => {
|
|
103
|
+
const [value, setValue] = useState<string>('');
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<RadioGroup
|
|
107
|
+
label="Subscription Plan"
|
|
108
|
+
description="Choose the plan that best fits your needs"
|
|
109
|
+
value={value}
|
|
110
|
+
onChange={(v) => setValue(String(v))}
|
|
111
|
+
>
|
|
112
|
+
<Radio value="basic" label="Basic - $9/month" />
|
|
113
|
+
<Radio value="pro" label="Pro - $29/month" />
|
|
114
|
+
<Radio value="enterprise" label="Enterprise - $99/month" />
|
|
115
|
+
</RadioGroup>
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
parameters: {
|
|
119
|
+
docs: {
|
|
120
|
+
description: {
|
|
121
|
+
story: 'RadioGroup with descriptive text.',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const Required: Story = {
|
|
128
|
+
render: () => {
|
|
129
|
+
const [value, setValue] = useState<string>('');
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<RadioGroup
|
|
133
|
+
label="Payment Method"
|
|
134
|
+
description="Please select your preferred payment method"
|
|
135
|
+
required
|
|
136
|
+
value={value}
|
|
137
|
+
onChange={(v) => setValue(String(v))}
|
|
138
|
+
>
|
|
139
|
+
<Radio value="card" label="Credit Card" />
|
|
140
|
+
<Radio value="paypal" label="PayPal" />
|
|
141
|
+
<Radio value="bank" label="Bank Transfer" />
|
|
142
|
+
<Radio value="crypto" label="Cryptocurrency" />
|
|
143
|
+
</RadioGroup>
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
parameters: {
|
|
147
|
+
docs: {
|
|
148
|
+
description: {
|
|
149
|
+
story: 'Required RadioGroup with asterisk indicator.',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const WithError: Story = {
|
|
156
|
+
render: () => {
|
|
157
|
+
const [value, setValue] = useState<string>('');
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<RadioGroup
|
|
161
|
+
label="Delivery Option"
|
|
162
|
+
description="Choose how you'd like to receive your order"
|
|
163
|
+
error={!value ? "Please select a delivery option" : ""}
|
|
164
|
+
required
|
|
165
|
+
value={value}
|
|
166
|
+
onChange={(v) => setValue(String(v))}
|
|
167
|
+
>
|
|
168
|
+
<Radio value="standard" label="Standard Delivery (5-7 days)" />
|
|
169
|
+
<Radio value="express" label="Express Delivery (2-3 days)" />
|
|
170
|
+
<Radio value="overnight" label="Overnight Delivery" />
|
|
171
|
+
<Radio value="pickup" label="Store Pickup" />
|
|
172
|
+
</RadioGroup>
|
|
173
|
+
);
|
|
174
|
+
},
|
|
175
|
+
parameters: {
|
|
176
|
+
docs: {
|
|
177
|
+
description: {
|
|
178
|
+
story: 'RadioGroup with error validation.',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const DisabledStates: Story = {
|
|
185
|
+
render: () => {
|
|
186
|
+
const [value, setValue] = useState<string>('option2');
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<Stack gap="lg">
|
|
190
|
+
<div>
|
|
191
|
+
<Text size="sm" fw={500} mb="sm">Individual Options Disabled:</Text>
|
|
192
|
+
<RadioGroup
|
|
193
|
+
label="Mixed States"
|
|
194
|
+
description="Some options are disabled"
|
|
195
|
+
value={value}
|
|
196
|
+
onChange={(v) => setValue(String(v))}
|
|
197
|
+
>
|
|
198
|
+
<Radio value="option1" label="Available option" />
|
|
199
|
+
<Radio value="option2" label="Selected option" />
|
|
200
|
+
<Radio value="option3" label="Disabled option" disabled />
|
|
201
|
+
<Radio value="option4" label="Another disabled option" disabled />
|
|
202
|
+
</RadioGroup>
|
|
203
|
+
</div>
|
|
204
|
+
</Stack>
|
|
205
|
+
);
|
|
206
|
+
},
|
|
207
|
+
parameters: {
|
|
208
|
+
docs: {
|
|
209
|
+
description: {
|
|
210
|
+
story: 'RadioGroup with disabled individual options.',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const FormIntegration: Story = {
|
|
217
|
+
render: () => {
|
|
218
|
+
const [formData, setFormData] = useState({
|
|
219
|
+
priority: '',
|
|
220
|
+
category: '',
|
|
221
|
+
visibility: '',
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
225
|
+
|
|
226
|
+
const handleSubmit = () => {
|
|
227
|
+
const newErrors: Record<string, string> = {};
|
|
228
|
+
|
|
229
|
+
if (!formData.priority) newErrors.priority = 'Priority is required';
|
|
230
|
+
if (!formData.category) newErrors.category = 'Category is required';
|
|
231
|
+
if (!formData.visibility) newErrors.visibility = 'Visibility is required';
|
|
232
|
+
|
|
233
|
+
setErrors(newErrors);
|
|
234
|
+
|
|
235
|
+
if (Object.keys(newErrors).length === 0) {
|
|
236
|
+
console.log('Form submitted:', formData);
|
|
237
|
+
alert('Form submitted successfully!');
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<Stack gap="lg" w={400}>
|
|
243
|
+
<Title order={4} size="sm" fw={500}>Create New Task</Title>
|
|
244
|
+
|
|
245
|
+
<RadioGroup
|
|
246
|
+
label="Priority Level"
|
|
247
|
+
description="Set the priority for this task"
|
|
248
|
+
required
|
|
249
|
+
error={errors.priority}
|
|
250
|
+
value={formData.priority}
|
|
251
|
+
onChange={(val) => setFormData(prev => ({ ...prev, priority: String(val) }))}
|
|
252
|
+
>
|
|
253
|
+
<Radio value="low" label="🟢 Low Priority" />
|
|
254
|
+
<Radio value="medium" label="🟡 Medium Priority" />
|
|
255
|
+
<Radio value="high" label="🟠 High Priority" />
|
|
256
|
+
<Radio value="urgent" label="🔴 Urgent" />
|
|
257
|
+
</RadioGroup>
|
|
258
|
+
|
|
259
|
+
<RadioGroup
|
|
260
|
+
label="Category"
|
|
261
|
+
description="Choose the task category"
|
|
262
|
+
required
|
|
263
|
+
error={errors.category}
|
|
264
|
+
value={formData.category}
|
|
265
|
+
onChange={(val) => setFormData(prev => ({ ...prev, category: String(val) }))}
|
|
266
|
+
>
|
|
267
|
+
<Radio value="development" label="Development" />
|
|
268
|
+
<Radio value="design" label="Design" />
|
|
269
|
+
<Radio value="testing" label="Testing" />
|
|
270
|
+
<Radio value="documentation" label="Documentation" />
|
|
271
|
+
</RadioGroup>
|
|
272
|
+
|
|
273
|
+
<RadioGroup
|
|
274
|
+
label="Visibility"
|
|
275
|
+
description="Who can see this task"
|
|
276
|
+
required
|
|
277
|
+
error={errors.visibility}
|
|
278
|
+
value={formData.visibility}
|
|
279
|
+
onChange={(val) => setFormData(prev => ({ ...prev, visibility: String(val) }))}
|
|
280
|
+
>
|
|
281
|
+
<Radio value="private" label="Private (Only me)" />
|
|
282
|
+
<Radio value="team" label="Team members" />
|
|
283
|
+
<Radio value="public" label="Everyone" />
|
|
284
|
+
</RadioGroup>
|
|
285
|
+
|
|
286
|
+
<Button variant="primary" onClick={handleSubmit}>
|
|
287
|
+
Create Task
|
|
288
|
+
</Button>
|
|
289
|
+
</Stack>
|
|
290
|
+
);
|
|
291
|
+
},
|
|
292
|
+
parameters: {
|
|
293
|
+
docs: {
|
|
294
|
+
description: {
|
|
295
|
+
story: 'RadioGroup integrated in a form with validation.',
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export const SettingsConfiguration: Story = {
|
|
302
|
+
render: () => {
|
|
303
|
+
const [settings, setSettings] = useState({
|
|
304
|
+
theme: 'light',
|
|
305
|
+
notifications: 'all',
|
|
306
|
+
privacy: 'friends',
|
|
307
|
+
language: 'en',
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<Stack gap="xl" w={500}>
|
|
312
|
+
<Title order={3} size="md" fw={500}>Settings</Title>
|
|
313
|
+
|
|
314
|
+
<RadioGroup
|
|
315
|
+
label="Theme Preference"
|
|
316
|
+
description="Choose your preferred theme"
|
|
317
|
+
value={settings.theme}
|
|
318
|
+
onChange={(val) => setSettings(prev => ({ ...prev, theme: String(val) }))}
|
|
319
|
+
>
|
|
320
|
+
<Radio value="light" label="☀️ Light Theme" />
|
|
321
|
+
<Radio value="dark" label="🌙 Dark Theme" />
|
|
322
|
+
<Radio value="auto" label="🔄 Auto (System)" />
|
|
323
|
+
</RadioGroup>
|
|
324
|
+
|
|
325
|
+
<RadioGroup
|
|
326
|
+
label="Email Notifications"
|
|
327
|
+
description="Control what notifications you receive"
|
|
328
|
+
value={settings.notifications}
|
|
329
|
+
onChange={(val) => setSettings(prev => ({ ...prev, notifications: String(val) }))}
|
|
330
|
+
>
|
|
331
|
+
<Radio value="all" label="All notifications" />
|
|
332
|
+
<Radio value="important" label="Important only" />
|
|
333
|
+
<Radio value="mentions" label="Mentions and replies" />
|
|
334
|
+
<Radio value="none" label="No notifications" />
|
|
335
|
+
</RadioGroup>
|
|
336
|
+
|
|
337
|
+
<RadioGroup
|
|
338
|
+
label="Profile Visibility"
|
|
339
|
+
description="Who can see your profile"
|
|
340
|
+
value={settings.privacy}
|
|
341
|
+
onChange={(val) => setSettings(prev => ({ ...prev, privacy: String(val) }))}
|
|
342
|
+
>
|
|
343
|
+
<Radio value="public" label="🌍 Public" />
|
|
344
|
+
<Radio value="friends" label="👥 Friends only" />
|
|
345
|
+
<Radio value="private" label="🔒 Private" />
|
|
346
|
+
</RadioGroup>
|
|
347
|
+
|
|
348
|
+
<RadioGroup
|
|
349
|
+
label="Language"
|
|
350
|
+
description="Choose your preferred language"
|
|
351
|
+
value={settings.language}
|
|
352
|
+
onChange={(val) => setSettings(prev => ({ ...prev, language: String(val) }))}
|
|
353
|
+
>
|
|
354
|
+
<Radio value="en" label="🇺🇸 English" />
|
|
355
|
+
<Radio value="es" label="🇪🇸 Spanish" />
|
|
356
|
+
<Radio value="fr" label="🇫🇷 French" />
|
|
357
|
+
<Radio value="de" label="🇩🇪 German" />
|
|
358
|
+
</RadioGroup>
|
|
359
|
+
</Stack>
|
|
360
|
+
);
|
|
361
|
+
},
|
|
362
|
+
parameters: {
|
|
363
|
+
docs: {
|
|
364
|
+
description: {
|
|
365
|
+
story: 'RadioGroup used for settings and configuration options.',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
export const SurveyQuestions: Story = {
|
|
372
|
+
render: () => {
|
|
373
|
+
const [answers, setAnswers] = useState({
|
|
374
|
+
satisfaction: '',
|
|
375
|
+
recommendation: '',
|
|
376
|
+
frequency: '',
|
|
377
|
+
improvement: '',
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<Stack gap="xl" w={600}>
|
|
382
|
+
<Title order={3} size="md" fw={500}>Customer Satisfaction Survey</Title>
|
|
383
|
+
|
|
384
|
+
<RadioGroup
|
|
385
|
+
label="How satisfied are you with our service?"
|
|
386
|
+
required
|
|
387
|
+
value={answers.satisfaction}
|
|
388
|
+
onChange={(val) => setAnswers(prev => ({ ...prev, satisfaction: String(val) }))}
|
|
389
|
+
>
|
|
390
|
+
<Radio value="very-satisfied" label="😊 Very Satisfied" />
|
|
391
|
+
<Radio value="satisfied" label="🙂 Satisfied" />
|
|
392
|
+
<Radio value="neutral" label="😐 Neutral" />
|
|
393
|
+
<Radio value="dissatisfied" label="🙁 Dissatisfied" />
|
|
394
|
+
<Radio value="very-dissatisfied" label="😞 Very Dissatisfied" />
|
|
395
|
+
</RadioGroup>
|
|
396
|
+
|
|
397
|
+
<RadioGroup
|
|
398
|
+
label="How likely are you to recommend us to a friend?"
|
|
399
|
+
description="Scale from 0 (not likely) to 10 (very likely)"
|
|
400
|
+
required
|
|
401
|
+
value={answers.recommendation}
|
|
402
|
+
onChange={(val) => setAnswers(prev => ({ ...prev, recommendation: String(val) }))}
|
|
403
|
+
>
|
|
404
|
+
<Inline gap="sm">
|
|
405
|
+
{Array.from({ length: 11 }, (_, i) => (
|
|
406
|
+
<Radio key={i} value={i.toString()} label={i.toString()} />
|
|
407
|
+
))}
|
|
408
|
+
</Inline>
|
|
409
|
+
</RadioGroup>
|
|
410
|
+
|
|
411
|
+
<RadioGroup
|
|
412
|
+
label="How often do you use our service?"
|
|
413
|
+
required
|
|
414
|
+
value={answers.frequency}
|
|
415
|
+
onChange={(val) => setAnswers(prev => ({ ...prev, frequency: String(val) }))}
|
|
416
|
+
>
|
|
417
|
+
<Radio value="daily" label="Daily" />
|
|
418
|
+
<Radio value="weekly" label="Weekly" />
|
|
419
|
+
<Radio value="monthly" label="Monthly" />
|
|
420
|
+
<Radio value="rarely" label="Rarely" />
|
|
421
|
+
<Radio value="first-time" label="This is my first time" />
|
|
422
|
+
</RadioGroup>
|
|
423
|
+
|
|
424
|
+
<RadioGroup
|
|
425
|
+
label="What area needs the most improvement?"
|
|
426
|
+
value={answers.improvement}
|
|
427
|
+
onChange={(val) => setAnswers(prev => ({ ...prev, improvement: String(val) }))}
|
|
428
|
+
>
|
|
429
|
+
<Radio value="speed" label="Speed and performance" />
|
|
430
|
+
<Radio value="features" label="Features and functionality" />
|
|
431
|
+
<Radio value="design" label="User interface design" />
|
|
432
|
+
<Radio value="support" label="Customer support" />
|
|
433
|
+
<Radio value="pricing" label="Pricing" />
|
|
434
|
+
<Radio value="other" label="Other" />
|
|
435
|
+
</RadioGroup>
|
|
436
|
+
</Stack>
|
|
437
|
+
);
|
|
438
|
+
},
|
|
439
|
+
parameters: {
|
|
440
|
+
docs: {
|
|
441
|
+
description: {
|
|
442
|
+
story: 'RadioGroup used in survey and questionnaire forms.',
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
export const UseCases: Story = {
|
|
449
|
+
render: () => (
|
|
450
|
+
<Stack gap="xl" w={700}>
|
|
451
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
452
|
+
|
|
453
|
+
<div>
|
|
454
|
+
<Text size="sm" fw={500} mb="sm">1. Payment Methods:</Text>
|
|
455
|
+
<RadioGroup label="Payment Method" defaultValue="card">
|
|
456
|
+
<Radio value="card" label="💳 Credit/Debit Card" />
|
|
457
|
+
<Radio value="paypal" label="🅿️ PayPal" />
|
|
458
|
+
<Radio value="apple" label="🍎 Apple Pay" />
|
|
459
|
+
<Radio value="google" label="🔵 Google Pay" />
|
|
460
|
+
</RadioGroup>
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
<div>
|
|
464
|
+
<Text size="sm" fw={500} mb="sm">2. Shipping Options:</Text>
|
|
465
|
+
<RadioGroup label="Delivery Speed" defaultValue="standard">
|
|
466
|
+
<Radio value="standard" label="📦 Standard (5-7 days) - Free" />
|
|
467
|
+
<Radio value="express" label="⚡ Express (2-3 days) - $9.99" />
|
|
468
|
+
<Radio value="overnight" label="🚀 Overnight - $24.99" />
|
|
469
|
+
</RadioGroup>
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
<div>
|
|
473
|
+
<Text size="sm" fw={500} mb="sm">3. Account Types:</Text>
|
|
474
|
+
<RadioGroup label="Account Type" defaultValue="personal">
|
|
475
|
+
<Radio value="personal" label="👤 Personal Account" />
|
|
476
|
+
<Radio value="business" label="🏢 Business Account" />
|
|
477
|
+
<Radio value="enterprise" label="🏭 Enterprise Account" />
|
|
478
|
+
</RadioGroup>
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
<div>
|
|
482
|
+
<Text size="sm" fw={500} mb="sm">4. Contact Preferences:</Text>
|
|
483
|
+
<RadioGroup label="Preferred Contact Method" defaultValue="email">
|
|
484
|
+
<Radio value="email" label="📧 Email" />
|
|
485
|
+
<Radio value="phone" label="📞 Phone" />
|
|
486
|
+
<Radio value="sms" label="💬 SMS" />
|
|
487
|
+
<Radio value="none" label="🚫 Do not contact" />
|
|
488
|
+
</RadioGroup>
|
|
489
|
+
</div>
|
|
490
|
+
</Stack>
|
|
491
|
+
),
|
|
492
|
+
parameters: {
|
|
493
|
+
docs: {
|
|
494
|
+
description: {
|
|
495
|
+
story: 'Real-world examples of RadioGroup usage in different application contexts.',
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
export const Interactive: Story = {
|
|
502
|
+
args: {
|
|
503
|
+
label: 'Interactive RadioGroup',
|
|
504
|
+
description: 'Use the controls to modify this RadioGroup',
|
|
505
|
+
required: false,
|
|
506
|
+
size: 'md',
|
|
507
|
+
},
|
|
508
|
+
render: (args) => {
|
|
509
|
+
const [value, setValue] = useState<string>('');
|
|
510
|
+
|
|
511
|
+
return (
|
|
512
|
+
<RadioGroup {...args} value={value} onChange={(v) => setValue(String(v))}>
|
|
513
|
+
<Radio value="option1" label="First option" />
|
|
514
|
+
<Radio value="option2" label="Second option" />
|
|
515
|
+
<Radio value="option3" label="Third option" />
|
|
516
|
+
</RadioGroup>
|
|
517
|
+
);
|
|
518
|
+
},
|
|
519
|
+
parameters: {
|
|
520
|
+
docs: {
|
|
521
|
+
description: {
|
|
522
|
+
story: 'Use the controls below to interact with the RadioGroup and see different combinations.',
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { SegmentedControl, Stack } from '@appdirect/design-system';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SegmentedControl> = {
|
|
5
|
+
title: 'Design System/Inputs/SegmentedControl',
|
|
6
|
+
component: SegmentedControl,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs', 'code-connected'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
15
|
+
},
|
|
16
|
+
data: {
|
|
17
|
+
control: 'object',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
data: ['Segment 1', 'Segment 2', 'Segment 3'],
|
|
28
|
+
defaultValue: 'Segment 1',
|
|
29
|
+
size: 'md',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const TwoSegments: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
data: ['Segment 1', 'Segment 2'],
|
|
36
|
+
defaultValue: 'Segment 1',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const FiveSegments: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
data: ['Segment 1', 'Segment 2', 'Segment 3', 'Segment 4', 'Segment 5'],
|
|
43
|
+
defaultValue: 'Segment 1',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Sizes: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<Stack gap="lg" align="center">
|
|
50
|
+
{(['xs', 'sm', 'md', 'lg', 'xl'] as const).map((size) => (
|
|
51
|
+
<SegmentedControl
|
|
52
|
+
key={size}
|
|
53
|
+
size={size}
|
|
54
|
+
data={['Segment 1', 'Segment 2', 'Segment 3']}
|
|
55
|
+
defaultValue="Segment 1"
|
|
56
|
+
/>
|
|
57
|
+
))}
|
|
58
|
+
</Stack>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Slider } from '@appdirect/design-system';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Slider> = {
|
|
5
|
+
title: 'Design System/Inputs/Slider',
|
|
6
|
+
component: Slider,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs', 'code-connected'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<div style={{ width: 300 }}>
|
|
19
|
+
<Slider thumbSize={16} defaultValue={40} />
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { SliderWithLabel } from '@appdirect/design-system';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof SliderWithLabel> = {
|
|
5
|
+
title: 'Design System/Inputs/SliderWithLabel',
|
|
6
|
+
component: SliderWithLabel,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs', 'code-connected'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<div style={{ width: 300 }}>
|
|
19
|
+
<SliderWithLabel fieldLabel="Label" required defaultValue={40} />
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const WithDescriptionAndError: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<div style={{ width: 300 }}>
|
|
27
|
+
<SliderWithLabel
|
|
28
|
+
fieldLabel="Price Range"
|
|
29
|
+
description="Set your budget"
|
|
30
|
+
error="This is the error message"
|
|
31
|
+
min={0}
|
|
32
|
+
max={1000}
|
|
33
|
+
defaultValue={[200, 800]}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
};
|