@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,554 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { Inline, AutocompleteClearable, Title, Text } from '@appdirect/design-system';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof AutocompleteClearable> = {
|
|
6
|
+
title: 'Design System/Combobox/AutocompleteClearable',
|
|
7
|
+
component: AutocompleteClearable,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'Autocomplete input with clearable functionality and filtering capabilities.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs', 'needs-connect'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
label: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Label for the input',
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'Placeholder text',
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Description text displayed below the input',
|
|
29
|
+
},
|
|
30
|
+
error: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'Error message',
|
|
33
|
+
},
|
|
34
|
+
required: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
description: 'Whether the field is required',
|
|
37
|
+
},
|
|
38
|
+
showOptional: {
|
|
39
|
+
control: 'boolean',
|
|
40
|
+
description: 'Whether to show "(optional)" next to the label',
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description: 'Whether the input is disabled',
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
control: 'select',
|
|
48
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
49
|
+
description: 'Input size',
|
|
50
|
+
},
|
|
51
|
+
data: {
|
|
52
|
+
control: 'object',
|
|
53
|
+
description: 'Data array for options',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
type Story = StoryObj<typeof meta>;
|
|
60
|
+
|
|
61
|
+
const countries = [
|
|
62
|
+
'United States',
|
|
63
|
+
'Canada',
|
|
64
|
+
'United Kingdom',
|
|
65
|
+
'Germany',
|
|
66
|
+
'France',
|
|
67
|
+
'Australia',
|
|
68
|
+
'Japan',
|
|
69
|
+
'Singapore',
|
|
70
|
+
'Brazil',
|
|
71
|
+
'Mexico',
|
|
72
|
+
'India',
|
|
73
|
+
'China',
|
|
74
|
+
'South Korea',
|
|
75
|
+
'Netherlands',
|
|
76
|
+
'Sweden',
|
|
77
|
+
'Norway',
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const cities = [
|
|
81
|
+
{ value: 'nyc', label: 'New York City' },
|
|
82
|
+
{ value: 'london', label: 'London' },
|
|
83
|
+
{ value: 'paris', label: 'Paris' },
|
|
84
|
+
{ value: 'tokyo', label: 'Tokyo' },
|
|
85
|
+
{ value: 'sydney', label: 'Sydney' },
|
|
86
|
+
{ value: 'toronto', label: 'Toronto' },
|
|
87
|
+
{ value: 'berlin', label: 'Berlin' },
|
|
88
|
+
{ value: 'amsterdam', label: 'Amsterdam' },
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
export const Default: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
label: 'Country',
|
|
94
|
+
placeholder: 'Pick a country or type anything',
|
|
95
|
+
data: countries,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Sizes: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<Stack gap="lg" w={300}>
|
|
102
|
+
<div>
|
|
103
|
+
<Text size="sm" fw={500} mb="xs">Extra Small (xs):</Text>
|
|
104
|
+
<AutocompleteClearable
|
|
105
|
+
label="Country"
|
|
106
|
+
placeholder="Pick a country"
|
|
107
|
+
data={countries.slice(0, 5)}
|
|
108
|
+
size="xs"
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div>
|
|
113
|
+
<Text size="sm" fw={500} mb="xs">Small (sm):</Text>
|
|
114
|
+
<AutocompleteClearable
|
|
115
|
+
label="Country"
|
|
116
|
+
placeholder="Pick a country"
|
|
117
|
+
data={countries.slice(0, 5)}
|
|
118
|
+
size="sm"
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div>
|
|
123
|
+
<Text size="sm" fw={500} mb="xs">Medium (md):</Text>
|
|
124
|
+
<AutocompleteClearable
|
|
125
|
+
label="Country"
|
|
126
|
+
placeholder="Pick a country"
|
|
127
|
+
data={countries.slice(0, 5)}
|
|
128
|
+
size="md"
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div>
|
|
133
|
+
<Text size="sm" fw={500} mb="xs">Large (lg):</Text>
|
|
134
|
+
<AutocompleteClearable
|
|
135
|
+
label="Country"
|
|
136
|
+
placeholder="Pick a country"
|
|
137
|
+
data={countries.slice(0, 5)}
|
|
138
|
+
size="lg"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div>
|
|
143
|
+
<Text size="sm" fw={500} mb="xs">Extra Large (xl):</Text>
|
|
144
|
+
<AutocompleteClearable
|
|
145
|
+
label="Country"
|
|
146
|
+
placeholder="Pick a country"
|
|
147
|
+
data={countries.slice(0, 5)}
|
|
148
|
+
size="xl"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</Stack>
|
|
152
|
+
),
|
|
153
|
+
parameters: {
|
|
154
|
+
docs: {
|
|
155
|
+
description: {
|
|
156
|
+
story: 'AutocompleteClearable component in different sizes.',
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const WithDescription: Story = {
|
|
163
|
+
render: () => (
|
|
164
|
+
<Stack gap="lg" w={350}>
|
|
165
|
+
<AutocompleteClearable
|
|
166
|
+
label="Preferred Country"
|
|
167
|
+
description="Select your preferred country for shipping"
|
|
168
|
+
placeholder="Start typing or select from list"
|
|
169
|
+
data={countries}
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<AutocompleteClearable
|
|
173
|
+
label="City"
|
|
174
|
+
description="Choose a major city or type a custom location"
|
|
175
|
+
placeholder="Enter city name"
|
|
176
|
+
data={cities}
|
|
177
|
+
/>
|
|
178
|
+
</Stack>
|
|
179
|
+
),
|
|
180
|
+
parameters: {
|
|
181
|
+
docs: {
|
|
182
|
+
description: {
|
|
183
|
+
story: 'AutocompleteClearable with helpful description text.',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const RequiredAndOptional: Story = {
|
|
190
|
+
render: () => (
|
|
191
|
+
<Stack gap="lg" w={350}>
|
|
192
|
+
<AutocompleteClearable
|
|
193
|
+
label="Country"
|
|
194
|
+
placeholder="Select your country"
|
|
195
|
+
data={countries}
|
|
196
|
+
required
|
|
197
|
+
description="This field is required"
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
<AutocompleteClearable
|
|
201
|
+
label="Secondary Country"
|
|
202
|
+
placeholder="Optional secondary choice"
|
|
203
|
+
data={countries}
|
|
204
|
+
showOptional
|
|
205
|
+
description="You can leave this blank if not applicable"
|
|
206
|
+
/>
|
|
207
|
+
</Stack>
|
|
208
|
+
),
|
|
209
|
+
parameters: {
|
|
210
|
+
docs: {
|
|
211
|
+
description: {
|
|
212
|
+
story: 'Required field with asterisk and optional field with "(optional)" label.',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export const WithError: Story = {
|
|
219
|
+
render: () => (
|
|
220
|
+
<Stack gap="lg" w={350}>
|
|
221
|
+
<AutocompleteClearable
|
|
222
|
+
label="Country"
|
|
223
|
+
placeholder="Select your country"
|
|
224
|
+
data={countries}
|
|
225
|
+
error="Please select a valid country"
|
|
226
|
+
required
|
|
227
|
+
/>
|
|
228
|
+
|
|
229
|
+
<AutocompleteClearable
|
|
230
|
+
label="City"
|
|
231
|
+
placeholder="Enter city name"
|
|
232
|
+
data={cities}
|
|
233
|
+
error="This city is not available for delivery"
|
|
234
|
+
/>
|
|
235
|
+
</Stack>
|
|
236
|
+
),
|
|
237
|
+
parameters: {
|
|
238
|
+
docs: {
|
|
239
|
+
description: {
|
|
240
|
+
story: 'AutocompleteClearable with error states and validation messages.',
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export const DisabledState: Story = {
|
|
247
|
+
render: () => (
|
|
248
|
+
<Stack gap="lg" w={350}>
|
|
249
|
+
<AutocompleteClearable
|
|
250
|
+
label="Country"
|
|
251
|
+
placeholder="Not available"
|
|
252
|
+
data={countries}
|
|
253
|
+
disabled
|
|
254
|
+
description="This field is currently disabled"
|
|
255
|
+
/>
|
|
256
|
+
|
|
257
|
+
<AutocompleteClearable
|
|
258
|
+
label="City"
|
|
259
|
+
placeholder="Select city"
|
|
260
|
+
data={cities}
|
|
261
|
+
disabled
|
|
262
|
+
/>
|
|
263
|
+
</Stack>
|
|
264
|
+
),
|
|
265
|
+
parameters: {
|
|
266
|
+
docs: {
|
|
267
|
+
description: {
|
|
268
|
+
story: 'Disabled AutocompleteClearable inputs.',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export const DifferentDataTypes: Story = {
|
|
275
|
+
render: () => (
|
|
276
|
+
<Stack gap="lg" w={400}>
|
|
277
|
+
<div>
|
|
278
|
+
<Text size="sm" fw={500} mb="sm">String Array Data:</Text>
|
|
279
|
+
<AutocompleteClearable
|
|
280
|
+
label="Programming Languages"
|
|
281
|
+
placeholder="Select or type a language"
|
|
282
|
+
data={['JavaScript', 'TypeScript', 'Python', 'Java', 'C++', 'Go', 'Rust', 'Swift']}
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div>
|
|
287
|
+
<Text size="sm" fw={500} mb="sm">Object Array Data (value/label):</Text>
|
|
288
|
+
<AutocompleteClearable
|
|
289
|
+
label="Framework"
|
|
290
|
+
placeholder="Choose a framework"
|
|
291
|
+
data={[
|
|
292
|
+
{ value: 'react', label: 'React' },
|
|
293
|
+
{ value: 'vue', label: 'Vue.js' },
|
|
294
|
+
{ value: 'angular', label: 'Angular' },
|
|
295
|
+
{ value: 'svelte', label: 'Svelte' },
|
|
296
|
+
{ value: 'nextjs', label: 'Next.js' },
|
|
297
|
+
{ value: 'nuxt', label: 'Nuxt.js' },
|
|
298
|
+
]}
|
|
299
|
+
/>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div>
|
|
303
|
+
<Text size="sm" fw={500} mb="sm">Large Dataset:</Text>
|
|
304
|
+
<AutocompleteClearable
|
|
305
|
+
label="Country"
|
|
306
|
+
placeholder="Type to filter from 16 countries"
|
|
307
|
+
data={countries}
|
|
308
|
+
description="Start typing to see filtered results"
|
|
309
|
+
/>
|
|
310
|
+
</div>
|
|
311
|
+
</Stack>
|
|
312
|
+
),
|
|
313
|
+
parameters: {
|
|
314
|
+
docs: {
|
|
315
|
+
description: {
|
|
316
|
+
story: 'AutocompleteClearable with different data formats and sizes.',
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export const FormIntegration: Story = {
|
|
323
|
+
render: () => (
|
|
324
|
+
<Stack gap="lg" w={400}>
|
|
325
|
+
<Title order={3} size="md" fw={500}>User Registration Form</Title>
|
|
326
|
+
|
|
327
|
+
<AutocompleteClearable
|
|
328
|
+
label="Country"
|
|
329
|
+
placeholder="Select your country"
|
|
330
|
+
data={countries}
|
|
331
|
+
required
|
|
332
|
+
description="We need this for tax and shipping purposes"
|
|
333
|
+
/>
|
|
334
|
+
|
|
335
|
+
<AutocompleteClearable
|
|
336
|
+
label="Preferred Language"
|
|
337
|
+
placeholder="Choose your language"
|
|
338
|
+
data={[
|
|
339
|
+
'English',
|
|
340
|
+
'Spanish',
|
|
341
|
+
'French',
|
|
342
|
+
'German',
|
|
343
|
+
'Italian',
|
|
344
|
+
'Portuguese',
|
|
345
|
+
'Japanese',
|
|
346
|
+
'Chinese',
|
|
347
|
+
'Korean',
|
|
348
|
+
'Arabic'
|
|
349
|
+
]}
|
|
350
|
+
showOptional
|
|
351
|
+
description="This helps us provide better support"
|
|
352
|
+
/>
|
|
353
|
+
|
|
354
|
+
<AutocompleteClearable
|
|
355
|
+
label="Industry"
|
|
356
|
+
placeholder="Type or select your industry"
|
|
357
|
+
data={[
|
|
358
|
+
{ value: 'tech', label: 'Technology' },
|
|
359
|
+
{ value: 'finance', label: 'Finance & Banking' },
|
|
360
|
+
{ value: 'healthcare', label: 'Healthcare' },
|
|
361
|
+
{ value: 'education', label: 'Education' },
|
|
362
|
+
{ value: 'retail', label: 'Retail & E-commerce' },
|
|
363
|
+
{ value: 'manufacturing', label: 'Manufacturing' },
|
|
364
|
+
{ value: 'consulting', label: 'Consulting' },
|
|
365
|
+
{ value: 'other', label: 'Other' },
|
|
366
|
+
]}
|
|
367
|
+
required
|
|
368
|
+
/>
|
|
369
|
+
</Stack>
|
|
370
|
+
),
|
|
371
|
+
parameters: {
|
|
372
|
+
docs: {
|
|
373
|
+
description: {
|
|
374
|
+
story: 'AutocompleteClearable components integrated in a form context.',
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export const SearchAndFilter: Story = {
|
|
381
|
+
render: () => (
|
|
382
|
+
<Stack gap="lg" w={400}>
|
|
383
|
+
<div>
|
|
384
|
+
<Text size="sm" fw={500} mb="sm">Product Search:</Text>
|
|
385
|
+
<AutocompleteClearable
|
|
386
|
+
label="Product"
|
|
387
|
+
placeholder="Search products..."
|
|
388
|
+
data={[
|
|
389
|
+
'MacBook Pro',
|
|
390
|
+
'MacBook Air',
|
|
391
|
+
'iPad Pro',
|
|
392
|
+
'iPad Air',
|
|
393
|
+
'iPhone 15 Pro',
|
|
394
|
+
'iPhone 15',
|
|
395
|
+
'Apple Watch',
|
|
396
|
+
'AirPods Pro',
|
|
397
|
+
'AirPods Max',
|
|
398
|
+
'Mac Studio',
|
|
399
|
+
'Mac Mini',
|
|
400
|
+
'iMac'
|
|
401
|
+
]}
|
|
402
|
+
description="Type to filter products or select from dropdown"
|
|
403
|
+
/>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<div>
|
|
407
|
+
<Text size="sm" fw={500} mb="sm">Tag Search:</Text>
|
|
408
|
+
<AutocompleteClearable
|
|
409
|
+
label="Tags"
|
|
410
|
+
placeholder="Add tags..."
|
|
411
|
+
data={[
|
|
412
|
+
'react',
|
|
413
|
+
'typescript',
|
|
414
|
+
'javascript',
|
|
415
|
+
'frontend',
|
|
416
|
+
'backend',
|
|
417
|
+
'fullstack',
|
|
418
|
+
'mobile',
|
|
419
|
+
'web',
|
|
420
|
+
'api',
|
|
421
|
+
'database',
|
|
422
|
+
'ui/ux',
|
|
423
|
+
'design'
|
|
424
|
+
]}
|
|
425
|
+
description="Search existing tags or create new ones"
|
|
426
|
+
/>
|
|
427
|
+
</div>
|
|
428
|
+
|
|
429
|
+
<div>
|
|
430
|
+
<Text size="sm" fw={500} mb="sm">Location Search:</Text>
|
|
431
|
+
<AutocompleteClearable
|
|
432
|
+
label="Location"
|
|
433
|
+
placeholder="Enter city or address..."
|
|
434
|
+
data={[
|
|
435
|
+
'New York, NY',
|
|
436
|
+
'Los Angeles, CA',
|
|
437
|
+
'Chicago, IL',
|
|
438
|
+
'Houston, TX',
|
|
439
|
+
'Phoenix, AZ',
|
|
440
|
+
'Philadelphia, PA',
|
|
441
|
+
'San Antonio, TX',
|
|
442
|
+
'San Diego, CA',
|
|
443
|
+
'Dallas, TX',
|
|
444
|
+
'San Jose, CA'
|
|
445
|
+
]}
|
|
446
|
+
description="Start typing to find locations"
|
|
447
|
+
/>
|
|
448
|
+
</div>
|
|
449
|
+
</Stack>
|
|
450
|
+
),
|
|
451
|
+
parameters: {
|
|
452
|
+
docs: {
|
|
453
|
+
description: {
|
|
454
|
+
story: 'AutocompleteClearable used for search and filtering scenarios.',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export const UseCases: Story = {
|
|
461
|
+
render: () => (
|
|
462
|
+
<Stack gap="xl" w={500}>
|
|
463
|
+
<Title order={3} size="md" fw={500} mb="xs">Common Use Cases</Title>
|
|
464
|
+
|
|
465
|
+
<div>
|
|
466
|
+
<Text size="sm" fw={500} mb="sm">1. Address Autocomplete:</Text>
|
|
467
|
+
<AutocompleteClearable
|
|
468
|
+
label="Shipping Address"
|
|
469
|
+
placeholder="Start typing your address..."
|
|
470
|
+
data={[
|
|
471
|
+
'123 Main St, New York, NY 10001',
|
|
472
|
+
'456 Oak Ave, Los Angeles, CA 90210',
|
|
473
|
+
'789 Pine Rd, Chicago, IL 60601',
|
|
474
|
+
'321 Elm St, Houston, TX 77001',
|
|
475
|
+
]}
|
|
476
|
+
description="We'll help complete your address"
|
|
477
|
+
/>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
<div>
|
|
481
|
+
<Text size="sm" fw={500} mb="sm">2. Skill Selection:</Text>
|
|
482
|
+
<AutocompleteClearable
|
|
483
|
+
label="Skills"
|
|
484
|
+
placeholder="Add your skills..."
|
|
485
|
+
data={[
|
|
486
|
+
'JavaScript', 'TypeScript', 'React', 'Vue.js', 'Angular',
|
|
487
|
+
'Node.js', 'Python', 'Java', 'C#', 'PHP',
|
|
488
|
+
'SQL', 'MongoDB', 'PostgreSQL', 'Redis',
|
|
489
|
+
'AWS', 'Docker', 'Kubernetes', 'Git'
|
|
490
|
+
]}
|
|
491
|
+
description="Type to find skills or add custom ones"
|
|
492
|
+
/>
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
<div>
|
|
496
|
+
<Text size="sm" fw={500} mb="sm">3. Company Search:</Text>
|
|
497
|
+
<AutocompleteClearable
|
|
498
|
+
label="Company"
|
|
499
|
+
placeholder="Search companies..."
|
|
500
|
+
data={[
|
|
501
|
+
{ value: 'apple', label: 'Apple Inc.' },
|
|
502
|
+
{ value: 'google', label: 'Google LLC' },
|
|
503
|
+
{ value: 'microsoft', label: 'Microsoft Corporation' },
|
|
504
|
+
{ value: 'amazon', label: 'Amazon.com Inc.' },
|
|
505
|
+
{ value: 'meta', label: 'Meta Platforms Inc.' },
|
|
506
|
+
{ value: 'tesla', label: 'Tesla Inc.' },
|
|
507
|
+
]}
|
|
508
|
+
description="Find your company or add a new one"
|
|
509
|
+
/>
|
|
510
|
+
</div>
|
|
511
|
+
|
|
512
|
+
<div>
|
|
513
|
+
<Text size="sm" fw={500} mb="sm">4. Category Filter:</Text>
|
|
514
|
+
<AutocompleteClearable
|
|
515
|
+
label="Category"
|
|
516
|
+
placeholder="Filter by category..."
|
|
517
|
+
data={[
|
|
518
|
+
'Electronics', 'Clothing', 'Books', 'Home & Garden',
|
|
519
|
+
'Sports', 'Toys', 'Automotive', 'Health & Beauty',
|
|
520
|
+
'Food & Beverages', 'Office Supplies'
|
|
521
|
+
]}
|
|
522
|
+
showOptional
|
|
523
|
+
description="Leave empty to show all categories"
|
|
524
|
+
/>
|
|
525
|
+
</div>
|
|
526
|
+
</Stack>
|
|
527
|
+
),
|
|
528
|
+
parameters: {
|
|
529
|
+
docs: {
|
|
530
|
+
description: {
|
|
531
|
+
story: 'Real-world examples of AutocompleteClearable usage in different application contexts.',
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
export const Interactive: Story = {
|
|
538
|
+
args: {
|
|
539
|
+
label: 'Country',
|
|
540
|
+
placeholder: 'Pick a country or type anything',
|
|
541
|
+
data: countries,
|
|
542
|
+
size: 'md',
|
|
543
|
+
required: false,
|
|
544
|
+
showOptional: false,
|
|
545
|
+
disabled: false,
|
|
546
|
+
},
|
|
547
|
+
parameters: {
|
|
548
|
+
docs: {
|
|
549
|
+
description: {
|
|
550
|
+
story: 'Use the controls below to interact with the AutocompleteClearable and see different combinations.',
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Combobox, Stack, Text } from '@appdirect/design-system';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Combobox> = {
|
|
6
|
+
title: 'Design System/Combobox/Combobox',
|
|
7
|
+
component: Combobox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
A single-selection dropdown identical to Select. This component exists as a
|
|
14
|
+
separate identity for Figma Code Connect, where the Combobox Figma component
|
|
15
|
+
maps to this wrapper.
|
|
16
|
+
|
|
17
|
+
Same API and behavior as Select — see Select stories for full coverage.
|
|
18
|
+
`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
tags: ['autodocs', 'code-connected'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
data: {
|
|
25
|
+
control: 'object',
|
|
26
|
+
description: 'Options — strings or objects with value/label',
|
|
27
|
+
},
|
|
28
|
+
placeholder: { control: 'text' },
|
|
29
|
+
label: { control: 'text' },
|
|
30
|
+
description: { control: 'text' },
|
|
31
|
+
borderless: { control: 'boolean' },
|
|
32
|
+
searchable: { control: 'boolean' },
|
|
33
|
+
clearable: { control: 'boolean' },
|
|
34
|
+
disabled: { control: 'boolean' },
|
|
35
|
+
required: { control: 'boolean' },
|
|
36
|
+
showOptional: { control: 'boolean' },
|
|
37
|
+
hasHelpIcon: { control: 'boolean' },
|
|
38
|
+
helpIconLabel: { control: 'text' },
|
|
39
|
+
size: {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
type Story = StoryObj<typeof Combobox>;
|
|
48
|
+
|
|
49
|
+
const objectData = [
|
|
50
|
+
{ value: 'react', label: 'React' },
|
|
51
|
+
{ value: 'vue', label: 'Vue.js' },
|
|
52
|
+
{ value: 'angular', label: 'Angular' },
|
|
53
|
+
{ value: 'svelte', label: 'Svelte' },
|
|
54
|
+
{ value: 'solid', label: 'SolidJS' },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
data: objectData,
|
|
60
|
+
placeholder: 'Select a framework',
|
|
61
|
+
label: 'Frontend Framework',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Searchable: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
data: objectData,
|
|
68
|
+
placeholder: 'Search frameworks...',
|
|
69
|
+
label: 'Framework',
|
|
70
|
+
searchable: true,
|
|
71
|
+
clearable: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const WithHelpIcon: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
data: objectData,
|
|
78
|
+
placeholder: 'Select framework',
|
|
79
|
+
label: 'Framework',
|
|
80
|
+
hasHelpIcon: true,
|
|
81
|
+
helpIconLabel: 'Select the framework used for the frontend',
|
|
82
|
+
showOptional: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Controlled: Story = {
|
|
87
|
+
render: () => {
|
|
88
|
+
const [value, setValue] = useState<string | null>('react');
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Stack gap="md">
|
|
92
|
+
<Combobox
|
|
93
|
+
data={objectData}
|
|
94
|
+
value={value}
|
|
95
|
+
onChange={setValue}
|
|
96
|
+
placeholder="Select framework"
|
|
97
|
+
label="Controlled Combobox"
|
|
98
|
+
clearable
|
|
99
|
+
/>
|
|
100
|
+
<Text size="sm" c="dimmed">
|
|
101
|
+
Selected value: <Text span fw={600}>{value || 'None'}</Text>
|
|
102
|
+
</Text>
|
|
103
|
+
</Stack>
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
};
|