@vibe/core 4.2.5 → 4.3.0-alpha-9bd83.0
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/dist/metadata/accessibility/Accordion.md +10 -0
- package/dist/metadata/accessibility/AlertBanner.md +9 -0
- package/dist/metadata/accessibility/Avatar.md +12 -0
- package/dist/metadata/accessibility/AvatarGroup.md +6 -0
- package/dist/metadata/accessibility/BreadcrumbsBar.md +10 -0
- package/dist/metadata/accessibility/Button.md +13 -0
- package/dist/metadata/accessibility/ButtonGroup.md +9 -0
- package/dist/metadata/accessibility/Checkbox.md +13 -0
- package/dist/metadata/accessibility/Chips.md +10 -0
- package/dist/metadata/accessibility/Combobox.md +6 -0
- package/dist/metadata/accessibility/DropdownBasicDropdown.md +10 -0
- package/dist/metadata/accessibility/IconButton.md +26 -0
- package/dist/metadata/accessibility/Info.md +12 -0
- package/dist/metadata/accessibility/Link.md +8 -0
- package/dist/metadata/accessibility/List.md +11 -0
- package/dist/metadata/accessibility/Menu.md +10 -0
- package/dist/metadata/accessibility/MenuButton.md +6 -0
- package/dist/metadata/accessibility/MenuItem.md +8 -0
- package/dist/metadata/accessibility/Modal.md +35 -0
- package/dist/metadata/accessibility/NumberField.md +9 -0
- package/dist/metadata/accessibility/RadioButton.md +11 -0
- package/dist/metadata/accessibility/Search.md +10 -0
- package/dist/metadata/accessibility/Tabs.md +10 -0
- package/dist/metadata/accessibility/TextArea.md +17 -0
- package/dist/metadata/accessibility/TextField.md +16 -0
- package/dist/metadata/accessibility/Toast.md +4 -0
- package/dist/metadata/accessibility/Toggle.md +7 -0
- package/dist/metadata/accessibility/Tooltip.md +11 -0
- package/dist/metadata/components.json +20940 -0
- package/dist/metadata/examples/Accordion.md +136 -0
- package/dist/metadata/examples/AlertBanner.md +85 -0
- package/dist/metadata/examples/AttentionBox.md +267 -0
- package/dist/metadata/examples/Avatar.md +118 -0
- package/dist/metadata/examples/AvatarGroup.md +390 -0
- package/dist/metadata/examples/Badge.md +59 -0
- package/dist/metadata/examples/BaseInput.md +2 -0
- package/dist/metadata/examples/BaseList.md +342 -0
- package/dist/metadata/examples/Box.md +208 -0
- package/dist/metadata/examples/BreadcrumbItem.md +54 -0
- package/dist/metadata/examples/BreadcrumbsBar.md +64 -0
- package/dist/metadata/examples/Button.md +174 -0
- package/dist/metadata/examples/ButtonGroup.md +180 -0
- package/dist/metadata/examples/Checkbox.md +24 -0
- package/dist/metadata/examples/Chips.md +192 -0
- package/dist/metadata/examples/Clickable.md +31 -0
- package/dist/metadata/examples/ColorPicker.md +2 -0
- package/dist/metadata/examples/Combobox.md +438 -0
- package/dist/metadata/examples/Counter.md +188 -0
- package/dist/metadata/examples/DatePicker.md +43 -0
- package/dist/metadata/examples/Dialog.md +521 -0
- package/dist/metadata/examples/DialogContentContainer.md +18 -0
- package/dist/metadata/examples/Divider.md +50 -0
- package/dist/metadata/examples/DropdownBasicDropdown.md +479 -0
- package/dist/metadata/examples/DropdownBoxMode.md +218 -0
- package/dist/metadata/examples/EditableHeading.md +33 -0
- package/dist/metadata/examples/EditableText.md +36 -0
- package/dist/metadata/examples/EmptyState.md +192 -0
- package/dist/metadata/examples/ExpandCollapse.md +77 -0
- package/dist/metadata/examples/Flex.md +916 -0
- package/dist/metadata/examples/Heading.md +124 -0
- package/dist/metadata/examples/HiddenText.md +8 -0
- package/dist/metadata/examples/Icon.md +67 -0
- package/dist/metadata/examples/IconButton.md +141 -0
- package/dist/metadata/examples/Info.md +80 -0
- package/dist/metadata/examples/Label.md +109 -0
- package/dist/metadata/examples/Link.md +52 -0
- package/dist/metadata/examples/List.md +125 -0
- package/dist/metadata/examples/ListItem.md +42 -0
- package/dist/metadata/examples/Loader.md +148 -0
- package/dist/metadata/examples/Menu.md +141 -0
- package/dist/metadata/examples/MenuButton.md +127 -0
- package/dist/metadata/examples/MenuDivider.md +35 -0
- package/dist/metadata/examples/MenuGridItem.md +65 -0
- package/dist/metadata/examples/MenuItem.md +98 -0
- package/dist/metadata/examples/MenuItemButton.md +42 -0
- package/dist/metadata/examples/MenuTitle.md +25 -0
- package/dist/metadata/examples/ModalBasicLayout.md +400 -0
- package/dist/metadata/examples/ModalMediaLayout.md +240 -0
- package/dist/metadata/examples/ModalSideBySideLayout.md +313 -0
- package/dist/metadata/examples/MultiStepIndicator.md +189 -0
- package/dist/metadata/examples/NumberField.md +68 -0
- package/dist/metadata/examples/ProgressBar.md +152 -0
- package/dist/metadata/examples/RadioButton.md +41 -0
- package/dist/metadata/examples/Search.md +24 -0
- package/dist/metadata/examples/Skeleton.md +161 -0
- package/dist/metadata/examples/Slider.md +109 -0
- package/dist/metadata/examples/SplitButton.md +120 -0
- package/dist/metadata/examples/Steps.md +106 -0
- package/dist/metadata/examples/Table.md +449 -0
- package/dist/metadata/examples/Tabs.md +241 -0
- package/dist/metadata/examples/Text.md +188 -0
- package/dist/metadata/examples/TextArea.md +28 -0
- package/dist/metadata/examples/TextField.md +119 -0
- package/dist/metadata/examples/TextWithHighlight.md +2 -0
- package/dist/metadata/examples/ThemeProvider.md +47 -0
- package/dist/metadata/examples/Tipseen.md +111 -0
- package/dist/metadata/examples/Toast.md +127 -0
- package/dist/metadata/examples/Toggle.md +38 -0
- package/dist/metadata/examples/Tooltip.md +53 -0
- package/dist/metadata/examples/VirtualizedGrid.md +54 -0
- package/dist/metadata/examples/VirtualizedList.md +50 -0
- package/dist/metadata/examples/useGridKeyboardNavigationContext.md +61 -0
- package/dist/mocked_classnames/scripts/build-all-metadata.d.ts +1 -0
- package/dist/mocked_classnames/scripts/extract-accessibility.d.ts +4 -0
- package/dist/mocked_classnames/scripts/extract-examples.d.ts +3 -0
- package/dist/scripts/build-all-metadata.d.ts +1 -0
- package/dist/scripts/extract-accessibility.d.ts +4 -0
- package/dist/scripts/extract-examples.d.ts +3 -0
- package/package.json +12 -10
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const comboboxTemplate = (args: ComboboxProps) => {
|
|
7
|
+
return <DialogContentContainer>
|
|
8
|
+
<Combobox {...args} />
|
|
9
|
+
</DialogContentContainer>;
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Default
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
const options = useMemo(() => [{
|
|
17
|
+
id: "1",
|
|
18
|
+
label: "Option 1"
|
|
19
|
+
}, {
|
|
20
|
+
id: "2",
|
|
21
|
+
label: "Option 2"
|
|
22
|
+
}, {
|
|
23
|
+
id: "3",
|
|
24
|
+
label: "Option 3"
|
|
25
|
+
}], []);
|
|
26
|
+
return <Combobox placeholder="Placeholder text here" options={options} />;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Combobox inside a dialog
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
const options = useMemo(() => [{
|
|
33
|
+
id: "1",
|
|
34
|
+
label: "Option 1"
|
|
35
|
+
}, {
|
|
36
|
+
id: "2",
|
|
37
|
+
label: "Option 2"
|
|
38
|
+
}, {
|
|
39
|
+
id: "3",
|
|
40
|
+
label: "Option 3"
|
|
41
|
+
}, {
|
|
42
|
+
id: "4",
|
|
43
|
+
label: "Option 4"
|
|
44
|
+
}, {
|
|
45
|
+
id: "5",
|
|
46
|
+
label: "Option 5"
|
|
47
|
+
}], []);
|
|
48
|
+
return <DialogContentContainer>
|
|
49
|
+
<Combobox options={options} placeholder="Placeholder text here" />
|
|
50
|
+
</DialogContentContainer>;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Sizes
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
const options = useMemo(() => [{
|
|
57
|
+
id: "1",
|
|
58
|
+
label: "Option 1"
|
|
59
|
+
}, {
|
|
60
|
+
id: "2",
|
|
61
|
+
label: "Option 2"
|
|
62
|
+
}, {
|
|
63
|
+
id: "3",
|
|
64
|
+
label: "Option 3"
|
|
65
|
+
}, {
|
|
66
|
+
id: "4",
|
|
67
|
+
label: "Option 4"
|
|
68
|
+
}, {
|
|
69
|
+
id: "5",
|
|
70
|
+
label: "Option 5"
|
|
71
|
+
}], []);
|
|
72
|
+
return <Flex gap="large">
|
|
73
|
+
<DialogContentContainer>
|
|
74
|
+
<Combobox options={options} size="small" placeholder="Placeholder text here" />
|
|
75
|
+
</DialogContentContainer>
|
|
76
|
+
<DialogContentContainer>
|
|
77
|
+
<Combobox options={options} placeholder="Placeholder text here" />
|
|
78
|
+
</DialogContentContainer>
|
|
79
|
+
<DialogContentContainer>
|
|
80
|
+
<Combobox options={options} size="large" placeholder="Placeholder text here" />
|
|
81
|
+
</DialogContentContainer>
|
|
82
|
+
</Flex>;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## With categories
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
const options = useMemo(() => [{
|
|
89
|
+
id: "1",
|
|
90
|
+
label: "Favorites",
|
|
91
|
+
categoryId: "favorites"
|
|
92
|
+
}, {
|
|
93
|
+
id: "2",
|
|
94
|
+
label: "Main workspace",
|
|
95
|
+
categoryId: "workspace"
|
|
96
|
+
}, {
|
|
97
|
+
id: "3",
|
|
98
|
+
label: "Client Foundations",
|
|
99
|
+
categoryId: "workspace"
|
|
100
|
+
}, {
|
|
101
|
+
id: "4",
|
|
102
|
+
label: "Design",
|
|
103
|
+
categoryId: "workspace"
|
|
104
|
+
}, {
|
|
105
|
+
id: "5",
|
|
106
|
+
label: "Marketing Cluster",
|
|
107
|
+
categoryId: "workspace"
|
|
108
|
+
}, {
|
|
109
|
+
id: "6",
|
|
110
|
+
label: "Mobile",
|
|
111
|
+
categoryId: "workspace"
|
|
112
|
+
}], []);
|
|
113
|
+
const categories = useMemo(() => ({
|
|
114
|
+
favorites: {
|
|
115
|
+
id: "favorites",
|
|
116
|
+
label: "Favorites"
|
|
117
|
+
},
|
|
118
|
+
workspace: {
|
|
119
|
+
id: "Workspaces",
|
|
120
|
+
label: "Workspaces"
|
|
121
|
+
}
|
|
122
|
+
}), []);
|
|
123
|
+
return <Flex gap="large" justify="start" align="start">
|
|
124
|
+
<Flex direction="column" gap="medium" align="start">
|
|
125
|
+
Regular
|
|
126
|
+
<DialogContentContainer style={{
|
|
127
|
+
height: "200px"
|
|
128
|
+
}}>
|
|
129
|
+
<Combobox options={options} categories={categories} placeholder="Placeholder text here" />
|
|
130
|
+
</DialogContentContainer>
|
|
131
|
+
</Flex>
|
|
132
|
+
<Flex direction="column" gap="medium" align="start">
|
|
133
|
+
Sticky mode
|
|
134
|
+
<DialogContentContainer style={{
|
|
135
|
+
height: "200px"
|
|
136
|
+
}}>
|
|
137
|
+
<Combobox stickyCategories options={options} categories={categories} placeholder="Placeholder text here" />
|
|
138
|
+
</DialogContentContainer>
|
|
139
|
+
</Flex>
|
|
140
|
+
<Flex direction="column" gap="medium" align="start">
|
|
141
|
+
With divider
|
|
142
|
+
<DialogContentContainer style={{
|
|
143
|
+
height: "200px"
|
|
144
|
+
}}>
|
|
145
|
+
<Combobox stickyCategories options={options} categories={categories} withCategoriesDivider placeholder="Placeholder text here" />
|
|
146
|
+
</DialogContentContainer>
|
|
147
|
+
</Flex>
|
|
148
|
+
</Flex>;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## With icons
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
const options = useMemo(() => [{
|
|
155
|
+
id: "1",
|
|
156
|
+
label: "Option 1",
|
|
157
|
+
leftIcon: Wand
|
|
158
|
+
}, {
|
|
159
|
+
id: "2",
|
|
160
|
+
label: "Option 2",
|
|
161
|
+
leftIcon: ThumbsUp
|
|
162
|
+
}, {
|
|
163
|
+
id: "3",
|
|
164
|
+
label: "Option 3",
|
|
165
|
+
leftIcon: Time
|
|
166
|
+
}, {
|
|
167
|
+
id: "4",
|
|
168
|
+
label: "Option 4",
|
|
169
|
+
leftIcon: Update
|
|
170
|
+
}, {
|
|
171
|
+
id: "5",
|
|
172
|
+
label: "Option 5",
|
|
173
|
+
leftIcon: Upgrade
|
|
174
|
+
}], []);
|
|
175
|
+
return <DialogContentContainer>
|
|
176
|
+
<Combobox options={options} placeholder="Placeholder text here" />
|
|
177
|
+
</DialogContentContainer>;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## With optionRenderer
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
const options = useMemo(() => [{
|
|
184
|
+
id: "1",
|
|
185
|
+
label: "Option 1"
|
|
186
|
+
}, {
|
|
187
|
+
id: "2",
|
|
188
|
+
label: "Option 2"
|
|
189
|
+
}, {
|
|
190
|
+
id: "3",
|
|
191
|
+
label: "Option 3"
|
|
192
|
+
}, {
|
|
193
|
+
id: "4",
|
|
194
|
+
label: "Option 4"
|
|
195
|
+
}, {
|
|
196
|
+
id: "5",
|
|
197
|
+
label: "Option 5"
|
|
198
|
+
}, {
|
|
199
|
+
id: "6",
|
|
200
|
+
label: "Option 6"
|
|
201
|
+
}, {
|
|
202
|
+
id: "7",
|
|
203
|
+
label: "Option 7"
|
|
204
|
+
}, {
|
|
205
|
+
id: "8",
|
|
206
|
+
label: "Option 8"
|
|
207
|
+
}, {
|
|
208
|
+
id: "9",
|
|
209
|
+
label: "Option 9"
|
|
210
|
+
}], []);
|
|
211
|
+
const optionRenderer = (option: any) => <div>
|
|
212
|
+
<Icon icon={Person} /> I can render anything with {option.label}
|
|
213
|
+
</div>;
|
|
214
|
+
return <DialogContentContainer>
|
|
215
|
+
<Combobox options={options} optionRenderer={optionRenderer} placeholder="Placeholder text here" maxOptionsWithoutScroll={3} />
|
|
216
|
+
</DialogContentContainer>;
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## WithButton
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
const options = useMemo(() => [{
|
|
223
|
+
id: "1",
|
|
224
|
+
label: "Option 1",
|
|
225
|
+
leftIcon: Wand
|
|
226
|
+
}, {
|
|
227
|
+
id: "2",
|
|
228
|
+
label: "Option 2",
|
|
229
|
+
leftIcon: ThumbsUp
|
|
230
|
+
}, {
|
|
231
|
+
id: "3",
|
|
232
|
+
label: "Option 3",
|
|
233
|
+
leftIcon: Time
|
|
234
|
+
}, {
|
|
235
|
+
id: "4",
|
|
236
|
+
label: "Option 4",
|
|
237
|
+
leftIcon: Update
|
|
238
|
+
}, {
|
|
239
|
+
id: "5",
|
|
240
|
+
label: "Option 5",
|
|
241
|
+
leftIcon: Upgrade
|
|
242
|
+
}], []);
|
|
243
|
+
return <DialogContentContainer>
|
|
244
|
+
<Flex direction="column" align="stretch">
|
|
245
|
+
<Combobox options={options} placeholder="Placeholder text here" />
|
|
246
|
+
<Button kind="tertiary" leftIcon={Edit}>
|
|
247
|
+
Edit
|
|
248
|
+
</Button>
|
|
249
|
+
</Flex>
|
|
250
|
+
</DialogContentContainer>;
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## WithCreation
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
const [options, setOptions] = useState([]);
|
|
257
|
+
return <DialogContentContainer>
|
|
258
|
+
<Combobox options={options} placeholder="Type to create" addNewLabel="Create new item" onAddNew={() => setOptions([...options, {
|
|
259
|
+
id: options.length + 1,
|
|
260
|
+
label: `Option: ${options.length + 1}`
|
|
261
|
+
}])} />
|
|
262
|
+
</DialogContentContainer>;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## With virtualization optimization
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
const options = useMemo(() => [{
|
|
269
|
+
id: "1",
|
|
270
|
+
label: "Option 1",
|
|
271
|
+
categoryId: "Group1"
|
|
272
|
+
}, {
|
|
273
|
+
id: "2",
|
|
274
|
+
label: "Option 2",
|
|
275
|
+
categoryId: "Group1"
|
|
276
|
+
}, {
|
|
277
|
+
id: "3",
|
|
278
|
+
label: "Option 3",
|
|
279
|
+
categoryId: "Group1"
|
|
280
|
+
}, {
|
|
281
|
+
id: "4",
|
|
282
|
+
label: "Option 4",
|
|
283
|
+
categoryId: "Group1"
|
|
284
|
+
}, {
|
|
285
|
+
id: "5",
|
|
286
|
+
label: "Option 5",
|
|
287
|
+
categoryId: "Group1"
|
|
288
|
+
}, {
|
|
289
|
+
id: "6",
|
|
290
|
+
label: "Option 6",
|
|
291
|
+
categoryId: "Group1"
|
|
292
|
+
}, {
|
|
293
|
+
id: "7",
|
|
294
|
+
label: "Option 7",
|
|
295
|
+
categoryId: "Group1"
|
|
296
|
+
}, {
|
|
297
|
+
id: "8",
|
|
298
|
+
label: "Option 8",
|
|
299
|
+
categoryId: "Group1"
|
|
300
|
+
}, {
|
|
301
|
+
id: "9",
|
|
302
|
+
label: "Option 9",
|
|
303
|
+
categoryId: "Group1"
|
|
304
|
+
}, {
|
|
305
|
+
id: "10",
|
|
306
|
+
label: "Option 10",
|
|
307
|
+
categoryId: "Group2"
|
|
308
|
+
}, {
|
|
309
|
+
id: "11",
|
|
310
|
+
label: "Option 11",
|
|
311
|
+
categoryId: "Group2"
|
|
312
|
+
}, {
|
|
313
|
+
id: "12",
|
|
314
|
+
label: "Option 12",
|
|
315
|
+
categoryId: "Group2"
|
|
316
|
+
}, {
|
|
317
|
+
id: "13",
|
|
318
|
+
label: "Option 13",
|
|
319
|
+
categoryId: "Group2"
|
|
320
|
+
}, {
|
|
321
|
+
id: "14",
|
|
322
|
+
label: "Option 14",
|
|
323
|
+
categoryId: "Group2"
|
|
324
|
+
}, {
|
|
325
|
+
id: "15",
|
|
326
|
+
label: "Option 15",
|
|
327
|
+
categoryId: "Group2"
|
|
328
|
+
}, {
|
|
329
|
+
id: "16",
|
|
330
|
+
label: "Option 16",
|
|
331
|
+
categoryId: "Group2"
|
|
332
|
+
}, {
|
|
333
|
+
id: "17",
|
|
334
|
+
label: "Option 17",
|
|
335
|
+
categoryId: "Group2"
|
|
336
|
+
}, {
|
|
337
|
+
id: "18",
|
|
338
|
+
label: "Option 18",
|
|
339
|
+
categoryId: "Group2"
|
|
340
|
+
}, {
|
|
341
|
+
id: "19",
|
|
342
|
+
label: "Option 19",
|
|
343
|
+
categoryId: "Group2"
|
|
344
|
+
}, {
|
|
345
|
+
id: "20",
|
|
346
|
+
label: "Option 20",
|
|
347
|
+
categoryId: "Group2"
|
|
348
|
+
}], []);
|
|
349
|
+
const categories = useMemo(() => ({
|
|
350
|
+
Group1: {
|
|
351
|
+
id: "Group1",
|
|
352
|
+
label: "Group 1"
|
|
353
|
+
},
|
|
354
|
+
Group2: {
|
|
355
|
+
id: "Group2",
|
|
356
|
+
label: "Group 2"
|
|
357
|
+
}
|
|
358
|
+
}), []);
|
|
359
|
+
return <Flex gap="large" justify="center" align="start">
|
|
360
|
+
<Flex direction="column" gap="small" align="start">
|
|
361
|
+
Virtualization without categories
|
|
362
|
+
<DialogContentContainer>
|
|
363
|
+
<Combobox options={options} renderOnlyVisibleOptions placeholder="Placeholder text here" maxOptionsWithoutScroll={3} />
|
|
364
|
+
</DialogContentContainer>
|
|
365
|
+
</Flex>
|
|
366
|
+
<Flex direction="column" gap="small" align="start">
|
|
367
|
+
Virtualization with categories
|
|
368
|
+
<DialogContentContainer>
|
|
369
|
+
<Combobox options={options} renderOnlyVisibleOptions categories={categories} placeholder="Placeholder text here" maxOptionsWithoutScroll={3} />
|
|
370
|
+
</DialogContentContainer>
|
|
371
|
+
</Flex>
|
|
372
|
+
<Flex direction="column" gap="small" align="start">
|
|
373
|
+
Virtualization with sticky categories
|
|
374
|
+
<DialogContentContainer>
|
|
375
|
+
<Combobox stickyCategories options={options} renderOnlyVisibleOptions categories={categories} placeholder="Placeholder text here" maxOptionsWithoutScroll={3} />
|
|
376
|
+
</DialogContentContainer>
|
|
377
|
+
</Flex>
|
|
378
|
+
</Flex>;
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## Loading state
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
const options = useMemo(() => [], []);
|
|
385
|
+
return <DialogContentContainer>
|
|
386
|
+
<Combobox loading options={options} placeholder="Board name" />
|
|
387
|
+
</DialogContentContainer>;
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Combobox as person picker
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
const options = useMemo(() => [{
|
|
394
|
+
id: "1",
|
|
395
|
+
label: "Julia Martinez",
|
|
396
|
+
src: person1,
|
|
397
|
+
type: "img",
|
|
398
|
+
position: "(Frontend Developer)",
|
|
399
|
+
categoryId: "suggestedPeople"
|
|
400
|
+
}, {
|
|
401
|
+
id: "2",
|
|
402
|
+
label: "Marco DiAngelo",
|
|
403
|
+
src: person2,
|
|
404
|
+
type: "img",
|
|
405
|
+
position: "(Product Designer)",
|
|
406
|
+
categoryId: "suggestedPeople"
|
|
407
|
+
}, {
|
|
408
|
+
id: "3",
|
|
409
|
+
label: "Liam Caldwell",
|
|
410
|
+
src: person3,
|
|
411
|
+
type: "img",
|
|
412
|
+
position: "(Brand Designer)",
|
|
413
|
+
categoryId: "suggestedPeople"
|
|
414
|
+
}], []);
|
|
415
|
+
const categories = useMemo(() => ({
|
|
416
|
+
suggestedPeople: {
|
|
417
|
+
id: "suggestedPeople",
|
|
418
|
+
label: "Suggested people"
|
|
419
|
+
}
|
|
420
|
+
}), []);
|
|
421
|
+
const optionRenderer = (option: any) => <Flex gap="xs">
|
|
422
|
+
<Avatar customSize={22} src={option.src} type="img" key={option.id} />
|
|
423
|
+
<Text>{option.label}</Text>
|
|
424
|
+
<Text color="secondary">{option.position}</Text>
|
|
425
|
+
</Flex>;
|
|
426
|
+
return <Flex style={{
|
|
427
|
+
height: "270px"
|
|
428
|
+
}} flex="1" justify="center" align="start">
|
|
429
|
+
<Dialog content={() => <DialogContentContainer>
|
|
430
|
+
<Combobox options={options} categories={categories} optionRenderer={optionRenderer} size="small" placeholder="Search" />
|
|
431
|
+
</DialogContentContainer>} tooltip position="bottom" open>
|
|
432
|
+
<Button kind="secondary" size="small">
|
|
433
|
+
Select people
|
|
434
|
+
</Button>
|
|
435
|
+
</Dialog>
|
|
436
|
+
</Flex>;
|
|
437
|
+
```
|
|
438
|
+
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Counter id="overview-counter" aria-label="Count of 5 items" count={5} {...args} />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Sizes
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Flex gap={160}>
|
|
13
|
+
<Flex direction="column" gap="large" style={{
|
|
14
|
+
width: "100px"
|
|
15
|
+
}} align="start">
|
|
16
|
+
<Counter id="sizes-xs" aria-label="Extra small counter showing 5" count={5} size="xs" />
|
|
17
|
+
<Text>XS</Text>
|
|
18
|
+
</Flex>
|
|
19
|
+
<Flex direction="column" gap="large" style={{
|
|
20
|
+
width: "100px"
|
|
21
|
+
}} align="start">
|
|
22
|
+
<Counter id="sizes-small" aria-label="Small counter showing 5" count={5} size="small" />
|
|
23
|
+
<Text>Small</Text>
|
|
24
|
+
</Flex>
|
|
25
|
+
<Flex direction="column" gap="large" style={{
|
|
26
|
+
width: "100px"
|
|
27
|
+
}} align="start">
|
|
28
|
+
<Counter id="sizes-large" aria-label="Large counter showing 5" count={5} />
|
|
29
|
+
<Text>Large</Text>
|
|
30
|
+
</Flex>
|
|
31
|
+
</Flex>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Colors
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<Flex gap={160}>
|
|
38
|
+
<Flex direction="column" gap="large" style={{
|
|
39
|
+
width: "100px"
|
|
40
|
+
}} align="start">
|
|
41
|
+
<Counter id="colors-primary" aria-label="Primary counter showing 5" count={5} />
|
|
42
|
+
<Text>Primary</Text>
|
|
43
|
+
</Flex>
|
|
44
|
+
<Flex direction="column" gap="large" style={{
|
|
45
|
+
width: "100px"
|
|
46
|
+
}} align="start">
|
|
47
|
+
<Counter id="colors-negative" aria-label="Negative counter showing 5 notifications" count={5} color="negative" />
|
|
48
|
+
<Text>Negative or notification</Text>
|
|
49
|
+
</Flex>
|
|
50
|
+
<Flex direction="column" gap="large" style={{
|
|
51
|
+
width: "100px"
|
|
52
|
+
}} align="start">
|
|
53
|
+
<Counter id="colors-dark" aria-label="Dark counter showing 5" count={5} color="dark" />
|
|
54
|
+
<Text>Dark</Text>
|
|
55
|
+
</Flex>
|
|
56
|
+
<Flex direction="column" gap="large" style={{
|
|
57
|
+
width: "100px"
|
|
58
|
+
}} align="start">
|
|
59
|
+
<Counter id="colors-light" aria-label="Light counter showing 5" count={5} color="light" />
|
|
60
|
+
<Text>Light</Text>
|
|
61
|
+
</Flex>
|
|
62
|
+
</Flex>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Outline
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<Flex gap={160}>
|
|
69
|
+
<Flex direction="column" gap="large" style={{
|
|
70
|
+
width: "100px"
|
|
71
|
+
}} align="start">
|
|
72
|
+
<Counter id="outline-primary" aria-label="Primary outline counter showing 5" count={5} kind="line" />
|
|
73
|
+
<Text>Primary</Text>
|
|
74
|
+
</Flex>
|
|
75
|
+
<Flex direction="column" gap="large" style={{
|
|
76
|
+
width: "100px"
|
|
77
|
+
}} align="start">
|
|
78
|
+
<Counter id="outline-negative" aria-label="Negative outline counter showing 5 notifications" count={5} color="negative" kind="line" />
|
|
79
|
+
<Text>Negative or notification</Text>
|
|
80
|
+
</Flex>
|
|
81
|
+
<Flex direction="column" gap="large" style={{
|
|
82
|
+
width: "100px"
|
|
83
|
+
}} align="start">
|
|
84
|
+
<Counter id="outline-dark" aria-label="Dark outline counter showing 5" count={5} color="dark" kind="line" />
|
|
85
|
+
<Text>Dark</Text>
|
|
86
|
+
</Flex>
|
|
87
|
+
<Flex direction="column" gap="large" style={{
|
|
88
|
+
width: "100px"
|
|
89
|
+
}} align="start">
|
|
90
|
+
<Counter id="outline-light" aria-label="Light outline counter showing 5" count={5} color="light" kind="line" />
|
|
91
|
+
<Text>Light</Text>
|
|
92
|
+
</Flex>
|
|
93
|
+
</Flex>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Limits
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<Flex gap={160}>
|
|
100
|
+
<Flex direction="column" gap="large" style={{
|
|
101
|
+
width: "100px"
|
|
102
|
+
}} align="start">
|
|
103
|
+
<Counter id="limits-one-digit" aria-label="Counter showing 9+ items (10 with 1 digit limit)" count={10} maxDigits={1} />
|
|
104
|
+
<Text>One digit limit</Text>
|
|
105
|
+
</Flex>
|
|
106
|
+
<Flex direction="column" gap="large" style={{
|
|
107
|
+
width: "100px"
|
|
108
|
+
}} align="start">
|
|
109
|
+
<Counter id="limits-two-digit" aria-label="Counter showing 99+ items (100 with 2 digit limit)" count={100} maxDigits={2} />
|
|
110
|
+
<Text>Two digits limit</Text>
|
|
111
|
+
</Flex>
|
|
112
|
+
<Flex direction="column" gap="large" style={{
|
|
113
|
+
width: "100px"
|
|
114
|
+
}} align="start">
|
|
115
|
+
<Counter id="limits-three-digit" aria-label="Counter showing 1000 items" count={1000} />
|
|
116
|
+
<Text>Three digits limit</Text>
|
|
117
|
+
</Flex>
|
|
118
|
+
</Flex>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## NotificationCounter
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
return <div style={{
|
|
125
|
+
position: "relative"
|
|
126
|
+
}}>
|
|
127
|
+
<Avatar id="notification-avatar" type="icon" icon={Notifications} backgroundColor="royal" aria-label="Notifications" />
|
|
128
|
+
<div style={{
|
|
129
|
+
position: "absolute",
|
|
130
|
+
top: "-5px",
|
|
131
|
+
right: "-5px"
|
|
132
|
+
}}>
|
|
133
|
+
<Counter id="notification-counter" aria-label="5 unread notifications" count={5} maxDigits={1} color="negative" />
|
|
134
|
+
</div>
|
|
135
|
+
</div>;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## CounterOnInboxFilters
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<Flex gap={28}>
|
|
142
|
+
<Flex direction="column" gap="large" align="start">
|
|
143
|
+
<Text>UX Writing & microcopy Re...</Text>
|
|
144
|
+
<Text>Mobile Data- Iteration Plan...</Text>
|
|
145
|
+
<Text>Q Plans.</Text>
|
|
146
|
+
</Flex>
|
|
147
|
+
<Flex direction="column" gap="large" align="start">
|
|
148
|
+
<Counter id="inbox-counter-1" aria-label="195 items in UX Writing & microcopy" count={195} color="dark" />
|
|
149
|
+
<Counter id="inbox-counter-2" aria-label="141 items in Mobile Data Iteration Plan" count={141} color="dark" />
|
|
150
|
+
<Counter id="inbox-counter-3" aria-label="99 items in Q Plans" count={99} color="dark" />
|
|
151
|
+
</Flex>
|
|
152
|
+
</Flex>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## CountTheNumberOfUpdates
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<Flex gap={12} direction="column" align="start">
|
|
159
|
+
<Icon icon={AddUpdate} size="36" />
|
|
160
|
+
<Divider />
|
|
161
|
+
<div style={{
|
|
162
|
+
position: "relative"
|
|
163
|
+
}}>
|
|
164
|
+
<Icon icon={Update} size="36" />
|
|
165
|
+
<div style={{
|
|
166
|
+
position: "absolute",
|
|
167
|
+
bottom: 0,
|
|
168
|
+
right: -3
|
|
169
|
+
}}>
|
|
170
|
+
<Counter count={5} size="small" id="count-the-number-of-updates-1" aria-label="5 updates" />
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
<Divider />
|
|
174
|
+
<div style={{
|
|
175
|
+
position: "relative"
|
|
176
|
+
}}>
|
|
177
|
+
<Icon icon={Update} size="36" />
|
|
178
|
+
<div style={{
|
|
179
|
+
position: "absolute",
|
|
180
|
+
bottom: 0,
|
|
181
|
+
right: -3
|
|
182
|
+
}}>
|
|
183
|
+
<Counter count={5} color="dark" size="small" id="count-the-number-of-updates-2" aria-label="5 updates" />
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</Flex>
|
|
187
|
+
```
|
|
188
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Storybook Code Examples
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const DatePickerTemplate = (args: DatePickerProps) => {
|
|
7
|
+
const [date, setDate] = useState(new Date("2023-05-01"));
|
|
8
|
+
return <DatePicker id="overview-date-picker" date={date} onDateChange={setDate} {...args} />;
|
|
9
|
+
}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Single Day
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
const [date, setDate] = useState(new Date("2023-05-01"));
|
|
16
|
+
return <DialogContentContainer>
|
|
17
|
+
<DatePicker id="single-day-picker" date={date} onDateChange={setDate} />
|
|
18
|
+
</DialogContentContainer>;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Date Range
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
const [date, setDate] = useState({
|
|
25
|
+
start: new Date("2023-05-01"),
|
|
26
|
+
end: new Date("2023-05-03")
|
|
27
|
+
});
|
|
28
|
+
return <DialogContentContainer>
|
|
29
|
+
<DatePicker id="date-range-picker" mode="range" date={date.start} endDate={date.end} onDateChange={range => setDate({
|
|
30
|
+
start: range.date,
|
|
31
|
+
end: range.endDate
|
|
32
|
+
})} />
|
|
33
|
+
</DialogContentContainer>;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## With Locale
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
// import ja from 'date-fns/locale/ja';
|
|
40
|
+
const [date, setDate] = useState(new Date("2023-05-01"));
|
|
41
|
+
return <DatePicker id="ja-locale-picker" date={date} onDateChange={setDate} locale={ja} />;
|
|
42
|
+
```
|
|
43
|
+
|