@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,311 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Select, Stack, Text } from '@appdirect/design-system';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Select> = {
|
|
6
|
+
title: 'Design System/Combobox/Select',
|
|
7
|
+
component: Select,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
A flexible select component built on Mantine's Select with design system defaults.
|
|
14
|
+
|
|
15
|
+
**Features:**
|
|
16
|
+
- **Regular mode**: Standard select with borders, labels, and validation
|
|
17
|
+
- **Borderless mode**: Clean, minimal appearance for dashboard widgets
|
|
18
|
+
- **Searchable / Clearable**: Optional search and clear functionality
|
|
19
|
+
- **Help icon**: Tooltip-based contextual help in the right section
|
|
20
|
+
- **Optional label**: Shows "(Optional)" text next to the label
|
|
21
|
+
- **Error caption**: Separate error message prop for controlled error display
|
|
22
|
+
`,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
tags: ['autodocs', 'code-connected'],
|
|
27
|
+
argTypes: {
|
|
28
|
+
data: {
|
|
29
|
+
control: 'object',
|
|
30
|
+
description: 'Select options — strings or objects with value/label',
|
|
31
|
+
},
|
|
32
|
+
placeholder: { control: 'text' },
|
|
33
|
+
label: { control: 'text' },
|
|
34
|
+
description: { control: 'text' },
|
|
35
|
+
borderless: { control: 'boolean' },
|
|
36
|
+
searchable: { control: 'boolean' },
|
|
37
|
+
clearable: { control: 'boolean' },
|
|
38
|
+
disabled: { control: 'boolean' },
|
|
39
|
+
required: { control: 'boolean' },
|
|
40
|
+
showOptional: { control: 'boolean' },
|
|
41
|
+
hasHelpIcon: { control: 'boolean' },
|
|
42
|
+
helpIconLabel: { control: 'text' },
|
|
43
|
+
size: {
|
|
44
|
+
control: 'select',
|
|
45
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
type Story = StoryObj<typeof Select>;
|
|
52
|
+
|
|
53
|
+
const stringData = ['React', 'Vue', 'Angular', 'Svelte', 'Solid'];
|
|
54
|
+
|
|
55
|
+
const objectData = [
|
|
56
|
+
{ value: 'react', label: 'React' },
|
|
57
|
+
{ value: 'vue', label: 'Vue.js' },
|
|
58
|
+
{ value: 'angular', label: 'Angular' },
|
|
59
|
+
{ value: 'svelte', label: 'Svelte' },
|
|
60
|
+
{ value: 'solid', label: 'SolidJS' },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const timePeriodsData = [
|
|
64
|
+
{ value: 'today', label: 'Today' },
|
|
65
|
+
{ value: 'week', label: 'This Week' },
|
|
66
|
+
{ value: 'month', label: 'This Month' },
|
|
67
|
+
{ value: 'quarter', label: 'This Quarter' },
|
|
68
|
+
{ value: 'year', label: 'This Year' },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
// ========================== BASIC ==========================
|
|
72
|
+
|
|
73
|
+
export const Default: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
data: stringData,
|
|
76
|
+
placeholder: 'Select a framework',
|
|
77
|
+
label: 'Frontend Framework',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const WithObjectData: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
data: objectData,
|
|
84
|
+
placeholder: 'Choose framework',
|
|
85
|
+
label: 'Technology Stack',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Searchable: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
data: objectData,
|
|
92
|
+
placeholder: 'Search frameworks...',
|
|
93
|
+
label: 'Framework (Searchable)',
|
|
94
|
+
searchable: true,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Clearable: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
data: objectData,
|
|
101
|
+
placeholder: 'Select framework',
|
|
102
|
+
label: 'Framework (Clearable)',
|
|
103
|
+
clearable: true,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const SearchableAndClearable: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
data: objectData,
|
|
110
|
+
placeholder: 'Search and select...',
|
|
111
|
+
label: 'Framework',
|
|
112
|
+
searchable: true,
|
|
113
|
+
clearable: true,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const Disabled: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
data: stringData,
|
|
120
|
+
placeholder: 'Disabled select',
|
|
121
|
+
label: 'Framework',
|
|
122
|
+
disabled: true,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// ========================== LABEL VARIANTS ==========================
|
|
127
|
+
|
|
128
|
+
export const Required: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
data: objectData,
|
|
131
|
+
placeholder: 'Select framework',
|
|
132
|
+
label: 'Framework',
|
|
133
|
+
required: true,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const Optional: Story = {
|
|
138
|
+
args: {
|
|
139
|
+
data: objectData,
|
|
140
|
+
placeholder: 'Select framework',
|
|
141
|
+
label: 'Framework',
|
|
142
|
+
showOptional: true,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const WithDescription: Story = {
|
|
147
|
+
args: {
|
|
148
|
+
data: objectData,
|
|
149
|
+
placeholder: 'Select framework',
|
|
150
|
+
label: 'Framework',
|
|
151
|
+
description: 'Choose the primary framework for this project',
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// ========================== HELP ICON ==========================
|
|
156
|
+
|
|
157
|
+
export const WithHelpIcon: Story = {
|
|
158
|
+
args: {
|
|
159
|
+
data: objectData,
|
|
160
|
+
placeholder: 'Select framework',
|
|
161
|
+
label: 'Framework',
|
|
162
|
+
hasHelpIcon: true,
|
|
163
|
+
helpIconLabel: 'Select the framework used for the frontend',
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// ========================== ERROR STATES ==========================
|
|
168
|
+
|
|
169
|
+
export const WithError: Story = {
|
|
170
|
+
args: {
|
|
171
|
+
data: objectData,
|
|
172
|
+
placeholder: 'Select framework',
|
|
173
|
+
label: 'Framework',
|
|
174
|
+
error: 'Please select a framework',
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const WithErrorCaption: Story = {
|
|
179
|
+
args: {
|
|
180
|
+
data: objectData,
|
|
181
|
+
placeholder: 'Select framework',
|
|
182
|
+
label: 'Framework',
|
|
183
|
+
error: true,
|
|
184
|
+
errorCaption: 'A framework is required for this project',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// ========================== BORDERLESS ==========================
|
|
189
|
+
|
|
190
|
+
export const Borderless: Story = {
|
|
191
|
+
args: {
|
|
192
|
+
data: timePeriodsData,
|
|
193
|
+
placeholder: 'This Month',
|
|
194
|
+
borderless: true,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const BorderlessSearchable: Story = {
|
|
199
|
+
args: {
|
|
200
|
+
data: timePeriodsData,
|
|
201
|
+
placeholder: 'Select period',
|
|
202
|
+
borderless: true,
|
|
203
|
+
searchable: true,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const BorderlessClearable: Story = {
|
|
208
|
+
args: {
|
|
209
|
+
data: timePeriodsData,
|
|
210
|
+
placeholder: 'This Month',
|
|
211
|
+
borderless: true,
|
|
212
|
+
clearable: true,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// ========================== CONTROLLED ==========================
|
|
217
|
+
|
|
218
|
+
export const ControlledRegular: Story = {
|
|
219
|
+
render: () => {
|
|
220
|
+
const [value, setValue] = useState<string | null>('react');
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<Stack gap="md">
|
|
224
|
+
<Select
|
|
225
|
+
data={objectData}
|
|
226
|
+
value={value}
|
|
227
|
+
onChange={setValue}
|
|
228
|
+
placeholder="Select framework"
|
|
229
|
+
label="Controlled Select"
|
|
230
|
+
clearable
|
|
231
|
+
/>
|
|
232
|
+
<Text size="sm" c="dimmed">
|
|
233
|
+
Selected value: <Text span fw={600}>{value || 'None'}</Text>
|
|
234
|
+
</Text>
|
|
235
|
+
</Stack>
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const ControlledBorderless: Story = {
|
|
241
|
+
render: () => {
|
|
242
|
+
const [value, setValue] = useState<string | null>('month');
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<Stack gap="md">
|
|
246
|
+
<Select
|
|
247
|
+
data={timePeriodsData}
|
|
248
|
+
value={value}
|
|
249
|
+
onChange={setValue}
|
|
250
|
+
placeholder="Select period"
|
|
251
|
+
borderless
|
|
252
|
+
searchable
|
|
253
|
+
clearable
|
|
254
|
+
/>
|
|
255
|
+
<Text size="sm" c="dimmed">
|
|
256
|
+
Period: <Text span fw={600}>{value || 'No period selected'}</Text>
|
|
257
|
+
</Text>
|
|
258
|
+
</Stack>
|
|
259
|
+
);
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// ========================== SIZE VARIATIONS ==========================
|
|
264
|
+
|
|
265
|
+
export const Sizes: Story = {
|
|
266
|
+
render: () => (
|
|
267
|
+
<Stack gap="md">
|
|
268
|
+
{(['xs', 'sm', 'md', 'lg', 'xl'] as const).map((s) => (
|
|
269
|
+
<Select
|
|
270
|
+
key={s}
|
|
271
|
+
data={stringData}
|
|
272
|
+
placeholder={`Size: ${s}`}
|
|
273
|
+
label={`Size: ${s}`}
|
|
274
|
+
size={s}
|
|
275
|
+
/>
|
|
276
|
+
))}
|
|
277
|
+
</Stack>
|
|
278
|
+
),
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// ========================== COMPARISON ==========================
|
|
282
|
+
|
|
283
|
+
export const RegularVsBorderless: Story = {
|
|
284
|
+
render: () => (
|
|
285
|
+
<Stack gap="xl">
|
|
286
|
+
<Stack gap="xs">
|
|
287
|
+
<Text fw={600}>Regular Select</Text>
|
|
288
|
+
<Select
|
|
289
|
+
data={objectData}
|
|
290
|
+
placeholder="Select framework"
|
|
291
|
+
label="Frontend Framework"
|
|
292
|
+
searchable
|
|
293
|
+
clearable
|
|
294
|
+
/>
|
|
295
|
+
<Text size="sm" c="dimmed">Best for forms and structured inputs</Text>
|
|
296
|
+
</Stack>
|
|
297
|
+
|
|
298
|
+
<Stack gap="xs">
|
|
299
|
+
<Text fw={600}>Borderless Select</Text>
|
|
300
|
+
<Select
|
|
301
|
+
data={timePeriodsData}
|
|
302
|
+
placeholder="This Month"
|
|
303
|
+
borderless
|
|
304
|
+
searchable
|
|
305
|
+
clearable
|
|
306
|
+
/>
|
|
307
|
+
<Text size="sm" c="dimmed">Best for dashboard widgets and inline selections</Text>
|
|
308
|
+
</Stack>
|
|
309
|
+
</Stack>
|
|
310
|
+
),
|
|
311
|
+
};
|