@appdirect/design-system 0.0.10 → 0.0.12

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.
Files changed (179) hide show
  1. package/README.md +85 -5
  2. package/dist/Buttons/ActionIcon.js +14 -0
  3. package/dist/Buttons/Button.js +66 -0
  4. package/dist/Buttons/CloseButton.js +48 -0
  5. package/dist/Buttons/index.js +13 -0
  6. package/dist/Combobox/AutocompleteClearable.js +36 -0
  7. package/dist/Combobox/Combobox.js +28 -0
  8. package/dist/Combobox/Multiselect.js +31 -0
  9. package/dist/Combobox/SearchableSelect.js +43 -0
  10. package/dist/Combobox/Select.js +72 -0
  11. package/dist/Combobox/index.js +10 -0
  12. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +96 -0
  13. package/dist/ComplexComponents/DashboardWidget/index.js +1 -0
  14. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +82 -0
  15. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +23 -0
  16. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +23 -0
  17. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +230 -0
  18. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +30 -0
  19. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.js +12 -0
  20. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.js +32 -0
  21. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.js +90 -0
  22. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.js +43 -0
  23. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.js +30 -0
  24. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.js +39 -0
  25. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.js +9 -0
  26. package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +31 -0
  27. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +42 -0
  28. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +21 -0
  29. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +410 -0
  30. package/dist/ComplexComponents/DataTable/DataTable.js +405 -0
  31. package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +9 -0
  32. package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +27 -0
  33. package/dist/ComplexComponents/DataTable/index.js +1 -0
  34. package/dist/ComplexComponents/DataTable/translations/en.js +99 -0
  35. package/dist/ComplexComponents/DataTable/translations/index.js +17 -0
  36. package/dist/ComplexComponents/KeyInsight/KeyInsights.js +176 -0
  37. package/dist/ComplexComponents/KeyInsight/index.js +1 -0
  38. package/dist/ComplexComponents/NameValue/NameValue.js +94 -0
  39. package/dist/ComplexComponents/NameValue/NameValueItem.js +59 -0
  40. package/dist/ComplexComponents/NameValue/index.js +2 -0
  41. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +92 -0
  42. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
  43. package/dist/ComplexComponents/PageContentHeader/index.js +1 -0
  44. package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
  45. package/dist/ComplexComponents/Placeholder/Placeholder.js +51 -0
  46. package/dist/ComplexComponents/Placeholder/index.js +1 -0
  47. package/dist/ComplexComponents/Slat/Slat.js +53 -0
  48. package/dist/ComplexComponents/Slat/index.js +1 -0
  49. package/dist/ComplexComponents/Utilities/CopyButton.js +45 -0
  50. package/dist/ComplexComponents/Utilities/index.js +1 -0
  51. package/dist/DataDisplay/Alert.js +77 -0
  52. package/dist/DataDisplay/Avatar.js +157 -0
  53. package/dist/DataDisplay/Badge.js +78 -0
  54. package/dist/DataDisplay/Card.js +100 -0
  55. package/dist/DataDisplay/Chip.js +36 -0
  56. package/dist/DataDisplay/Indicator.js +59 -0
  57. package/dist/DataDisplay/List.js +60 -0
  58. package/dist/DataDisplay/Pill.js +81 -0
  59. package/dist/DataDisplay/Progress.js +42 -0
  60. package/dist/DataDisplay/Table.js +38 -0
  61. package/dist/DataDisplay/ThemeIcon.js +31 -0
  62. package/dist/DataDisplay/index.js +18 -0
  63. package/dist/Inputs/Checkbox.js +62 -0
  64. package/dist/Inputs/ColorInput.js +48 -0
  65. package/dist/Inputs/DropZone.js +12 -0
  66. package/dist/Inputs/FileInput.js +77 -0
  67. package/dist/Inputs/NumberInput.js +49 -0
  68. package/dist/Inputs/Radio.js +55 -0
  69. package/dist/Inputs/RadioGroup.js +59 -0
  70. package/dist/Inputs/SegmentedControl.js +50 -0
  71. package/dist/Inputs/Slider.js +50 -0
  72. package/dist/Inputs/SliderWithLabel.js +32 -0
  73. package/dist/Inputs/Switch.js +47 -0
  74. package/dist/Inputs/TextArea.js +50 -0
  75. package/dist/Inputs/TextInput.js +87 -0
  76. package/dist/Inputs/index.js +27 -0
  77. package/dist/Layout/Box.js +39 -0
  78. package/dist/Layout/Center.js +11 -0
  79. package/dist/Layout/Container.js +11 -0
  80. package/dist/Layout/Flex.js +12 -0
  81. package/dist/Layout/Grid.js +13 -0
  82. package/dist/Layout/Group.js +14 -0
  83. package/dist/Layout/Inline.js +46 -0
  84. package/dist/Layout/SimpleGrid.js +14 -0
  85. package/dist/Layout/Stack.js +45 -0
  86. package/dist/Layout/index.js +10 -0
  87. package/dist/Misc/Divider.js +8 -0
  88. package/dist/Misc/Paper.js +24 -0
  89. package/dist/Misc/index.js +10 -0
  90. package/dist/Navigation/Breadcrumb.js +60 -0
  91. package/dist/Navigation/NavLink.js +28 -0
  92. package/dist/Navigation/Stepper.js +8 -0
  93. package/dist/Navigation/Tabs.js +22 -0
  94. package/dist/Navigation/index.js +9 -0
  95. package/dist/Overlays/Drawer.js +63 -0
  96. package/dist/Overlays/Menu.js +85 -0
  97. package/dist/Overlays/Modal.js +61 -0
  98. package/dist/Overlays/Popover.js +118 -0
  99. package/dist/Overlays/Tooltip.js +71 -0
  100. package/dist/Overlays/index.js +12 -0
  101. package/dist/Shell/AppShellLayout.js +13 -0
  102. package/dist/Shell/HeaderBar.js +8 -0
  103. package/dist/Shell/SidebarNav.js +9 -0
  104. package/dist/Shell/SidebarNavLink.js +17 -0
  105. package/dist/Shell/SingleColumnLayout.js +11 -0
  106. package/dist/Shell/TertiaryColumnLayout.js +12 -0
  107. package/dist/Shell/index.js +6 -0
  108. package/dist/Typography/Code.js +8 -0
  109. package/dist/Typography/Kbd.js +58 -0
  110. package/dist/Typography/Text.js +8 -0
  111. package/dist/Typography/Title.js +11 -0
  112. package/dist/Typography/index.js +12 -0
  113. package/dist/config.js +202 -0
  114. package/dist/contracts/PageContentHeader.json +10 -5
  115. package/dist/contracts/index.json +1 -1
  116. package/dist/hooks/useTableHandlers.js +136 -0
  117. package/dist/hooks/useTableRenderFunctions.js +164 -0
  118. package/dist/hooks/useTableState.js +70 -0
  119. package/dist/index.js +162 -0
  120. package/dist/index.ts +3 -4
  121. package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
  122. package/dist/stories/Buttons/Button.stories.tsx +145 -0
  123. package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
  124. package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
  125. package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
  126. package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
  127. package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
  128. package/dist/stories/Combobox/Select.stories.tsx +311 -0
  129. package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
  130. package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
  131. package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
  132. package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
  133. package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
  134. package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
  135. package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
  136. package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
  137. package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
  138. package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
  139. package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
  140. package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
  141. package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
  142. package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
  143. package/dist/stories/DataDisplay/List.stories.tsx +376 -0
  144. package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
  145. package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
  146. package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
  147. package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
  148. package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
  149. package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
  150. package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
  151. package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
  152. package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
  153. package/dist/stories/Inputs/Radio.stories.tsx +437 -0
  154. package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
  155. package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
  156. package/dist/stories/Inputs/Slider.stories.tsx +22 -0
  157. package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
  158. package/dist/stories/Inputs/Switch.stories.tsx +361 -0
  159. package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
  160. package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
  161. package/dist/stories/Misc/Divider.stories.tsx +581 -0
  162. package/dist/stories/Misc/Paper.stories.tsx +557 -0
  163. package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
  164. package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
  165. package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
  166. package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
  167. package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
  168. package/dist/stories/Overlays/Menu.stories.tsx +941 -0
  169. package/dist/stories/Overlays/Modal.stories.tsx +249 -0
  170. package/dist/stories/Overlays/Popover.stories.tsx +780 -0
  171. package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
  172. package/dist/stories/Typography/Code.stories.tsx +368 -0
  173. package/dist/stories/Typography/Kbd.stories.tsx +514 -0
  174. package/dist/stories/Typography/Text.stories.tsx +117 -0
  175. package/dist/stories/Typography/Title.stories.tsx +112 -0
  176. package/dist/stories/index.json +1435 -0
  177. package/dist/types.js +127 -0
  178. package/package.json +12 -7
  179. 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
+ };