@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.
Files changed (109) hide show
  1. package/dist/metadata/accessibility/Accordion.md +10 -0
  2. package/dist/metadata/accessibility/AlertBanner.md +9 -0
  3. package/dist/metadata/accessibility/Avatar.md +12 -0
  4. package/dist/metadata/accessibility/AvatarGroup.md +6 -0
  5. package/dist/metadata/accessibility/BreadcrumbsBar.md +10 -0
  6. package/dist/metadata/accessibility/Button.md +13 -0
  7. package/dist/metadata/accessibility/ButtonGroup.md +9 -0
  8. package/dist/metadata/accessibility/Checkbox.md +13 -0
  9. package/dist/metadata/accessibility/Chips.md +10 -0
  10. package/dist/metadata/accessibility/Combobox.md +6 -0
  11. package/dist/metadata/accessibility/DropdownBasicDropdown.md +10 -0
  12. package/dist/metadata/accessibility/IconButton.md +26 -0
  13. package/dist/metadata/accessibility/Info.md +12 -0
  14. package/dist/metadata/accessibility/Link.md +8 -0
  15. package/dist/metadata/accessibility/List.md +11 -0
  16. package/dist/metadata/accessibility/Menu.md +10 -0
  17. package/dist/metadata/accessibility/MenuButton.md +6 -0
  18. package/dist/metadata/accessibility/MenuItem.md +8 -0
  19. package/dist/metadata/accessibility/Modal.md +35 -0
  20. package/dist/metadata/accessibility/NumberField.md +9 -0
  21. package/dist/metadata/accessibility/RadioButton.md +11 -0
  22. package/dist/metadata/accessibility/Search.md +10 -0
  23. package/dist/metadata/accessibility/Tabs.md +10 -0
  24. package/dist/metadata/accessibility/TextArea.md +17 -0
  25. package/dist/metadata/accessibility/TextField.md +16 -0
  26. package/dist/metadata/accessibility/Toast.md +4 -0
  27. package/dist/metadata/accessibility/Toggle.md +7 -0
  28. package/dist/metadata/accessibility/Tooltip.md +11 -0
  29. package/dist/metadata/components.json +20940 -0
  30. package/dist/metadata/examples/Accordion.md +136 -0
  31. package/dist/metadata/examples/AlertBanner.md +85 -0
  32. package/dist/metadata/examples/AttentionBox.md +267 -0
  33. package/dist/metadata/examples/Avatar.md +118 -0
  34. package/dist/metadata/examples/AvatarGroup.md +390 -0
  35. package/dist/metadata/examples/Badge.md +59 -0
  36. package/dist/metadata/examples/BaseInput.md +2 -0
  37. package/dist/metadata/examples/BaseList.md +342 -0
  38. package/dist/metadata/examples/Box.md +208 -0
  39. package/dist/metadata/examples/BreadcrumbItem.md +54 -0
  40. package/dist/metadata/examples/BreadcrumbsBar.md +64 -0
  41. package/dist/metadata/examples/Button.md +174 -0
  42. package/dist/metadata/examples/ButtonGroup.md +180 -0
  43. package/dist/metadata/examples/Checkbox.md +24 -0
  44. package/dist/metadata/examples/Chips.md +192 -0
  45. package/dist/metadata/examples/Clickable.md +31 -0
  46. package/dist/metadata/examples/ColorPicker.md +2 -0
  47. package/dist/metadata/examples/Combobox.md +438 -0
  48. package/dist/metadata/examples/Counter.md +188 -0
  49. package/dist/metadata/examples/DatePicker.md +43 -0
  50. package/dist/metadata/examples/Dialog.md +521 -0
  51. package/dist/metadata/examples/DialogContentContainer.md +18 -0
  52. package/dist/metadata/examples/Divider.md +50 -0
  53. package/dist/metadata/examples/DropdownBasicDropdown.md +479 -0
  54. package/dist/metadata/examples/DropdownBoxMode.md +218 -0
  55. package/dist/metadata/examples/EditableHeading.md +33 -0
  56. package/dist/metadata/examples/EditableText.md +36 -0
  57. package/dist/metadata/examples/EmptyState.md +192 -0
  58. package/dist/metadata/examples/ExpandCollapse.md +77 -0
  59. package/dist/metadata/examples/Flex.md +916 -0
  60. package/dist/metadata/examples/Heading.md +124 -0
  61. package/dist/metadata/examples/HiddenText.md +8 -0
  62. package/dist/metadata/examples/Icon.md +67 -0
  63. package/dist/metadata/examples/IconButton.md +141 -0
  64. package/dist/metadata/examples/Info.md +80 -0
  65. package/dist/metadata/examples/Label.md +109 -0
  66. package/dist/metadata/examples/Link.md +52 -0
  67. package/dist/metadata/examples/List.md +125 -0
  68. package/dist/metadata/examples/ListItem.md +42 -0
  69. package/dist/metadata/examples/Loader.md +148 -0
  70. package/dist/metadata/examples/Menu.md +141 -0
  71. package/dist/metadata/examples/MenuButton.md +127 -0
  72. package/dist/metadata/examples/MenuDivider.md +35 -0
  73. package/dist/metadata/examples/MenuGridItem.md +65 -0
  74. package/dist/metadata/examples/MenuItem.md +98 -0
  75. package/dist/metadata/examples/MenuItemButton.md +42 -0
  76. package/dist/metadata/examples/MenuTitle.md +25 -0
  77. package/dist/metadata/examples/ModalBasicLayout.md +400 -0
  78. package/dist/metadata/examples/ModalMediaLayout.md +240 -0
  79. package/dist/metadata/examples/ModalSideBySideLayout.md +313 -0
  80. package/dist/metadata/examples/MultiStepIndicator.md +189 -0
  81. package/dist/metadata/examples/NumberField.md +68 -0
  82. package/dist/metadata/examples/ProgressBar.md +152 -0
  83. package/dist/metadata/examples/RadioButton.md +41 -0
  84. package/dist/metadata/examples/Search.md +24 -0
  85. package/dist/metadata/examples/Skeleton.md +161 -0
  86. package/dist/metadata/examples/Slider.md +109 -0
  87. package/dist/metadata/examples/SplitButton.md +120 -0
  88. package/dist/metadata/examples/Steps.md +106 -0
  89. package/dist/metadata/examples/Table.md +449 -0
  90. package/dist/metadata/examples/Tabs.md +241 -0
  91. package/dist/metadata/examples/Text.md +188 -0
  92. package/dist/metadata/examples/TextArea.md +28 -0
  93. package/dist/metadata/examples/TextField.md +119 -0
  94. package/dist/metadata/examples/TextWithHighlight.md +2 -0
  95. package/dist/metadata/examples/ThemeProvider.md +47 -0
  96. package/dist/metadata/examples/Tipseen.md +111 -0
  97. package/dist/metadata/examples/Toast.md +127 -0
  98. package/dist/metadata/examples/Toggle.md +38 -0
  99. package/dist/metadata/examples/Tooltip.md +53 -0
  100. package/dist/metadata/examples/VirtualizedGrid.md +54 -0
  101. package/dist/metadata/examples/VirtualizedList.md +50 -0
  102. package/dist/metadata/examples/useGridKeyboardNavigationContext.md +61 -0
  103. package/dist/mocked_classnames/scripts/build-all-metadata.d.ts +1 -0
  104. package/dist/mocked_classnames/scripts/extract-accessibility.d.ts +4 -0
  105. package/dist/mocked_classnames/scripts/extract-examples.d.ts +3 -0
  106. package/dist/scripts/build-all-metadata.d.ts +1 -0
  107. package/dist/scripts/extract-accessibility.d.ts +4 -0
  108. package/dist/scripts/extract-examples.d.ts +3 -0
  109. package/package.json +12 -10
@@ -0,0 +1,449 @@
1
+ # Storybook Code Examples
2
+
3
+ ## Overview
4
+
5
+ ```tsx
6
+ const columns: TableColumn[] = [{
7
+ id: "sentOn",
8
+ title: "Sent on",
9
+ width: 150,
10
+ loadingStateType: "medium-text"
11
+ }, {
12
+ id: "subject",
13
+ title: "Subject",
14
+ loadingStateType: "long-text"
15
+ }, {
16
+ id: "sentBy",
17
+ title: "Sent by",
18
+ width: {
19
+ min: 120,
20
+ max: 200
21
+ },
22
+ infoContent: "This is the sender",
23
+ loadingStateType: "circle"
24
+ }, {
25
+ id: "status",
26
+ title: "Status",
27
+ width: 150,
28
+ infoContent: "Info content for the status column",
29
+ loadingStateType: "medium-text"
30
+ }, {
31
+ id: "emailsSent",
32
+ title: "Emails sent",
33
+ width: 150,
34
+ loadingStateType: "medium-text"
35
+ }];
36
+ const data = [{
37
+ id: "1",
38
+ sentOn: "2020-01-01",
39
+ sentBy: "John Doe",
40
+ subject: "Lorem ipsum dolor",
41
+ status: "Sent",
42
+ emailsSent: 100
43
+ }, {
44
+ id: "3",
45
+ sentOn: "2023-03-03",
46
+ sentBy: "Some Person",
47
+ subject: "This is the subject This is the subject This is the subject This is the subject This is the subject This is the subject",
48
+ status: "Sent",
49
+ emailsSent: 999
50
+ }, {
51
+ id: "2",
52
+ sentOn: "2022-02-02",
53
+ sentBy: "Other Name",
54
+ subject: "This is the subject",
55
+ status: "Sent",
56
+ emailsSent: 99
57
+ }];
58
+ return <Table id="overview-table" {...args} errorState={<h1 style={{
59
+ textAlign: "center"
60
+ }}>Error State</h1>} emptyState={<h1 style={{
61
+ textAlign: "center"
62
+ }}>Empty State</h1>} columns={columns}>
63
+ <TableHeader>
64
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
65
+ </TableHeader>
66
+ <TableBody>
67
+ {data.map(rowItem => <TableRow key={rowItem.id}>
68
+ <TableCell>{rowItem.sentOn}</TableCell>
69
+ <TableCell>{rowItem.subject}</TableCell>
70
+ <TableCell>
71
+ <TableAvatar text={rowItem.sentBy} />
72
+ </TableCell>
73
+ <TableCell>
74
+ <Label text={rowItem.status} color="positive" />
75
+ </TableCell>
76
+ <TableCell>{rowItem.emailsSent}</TableCell>
77
+ </TableRow>)}
78
+ </TableBody>
79
+ </Table>;
80
+ ```
81
+
82
+ ## Sizes
83
+
84
+ ```tsx
85
+ const columns: TableColumn[] = [{
86
+ id: "sentOn",
87
+ title: "Sent on",
88
+ loadingStateType: "medium-text"
89
+ }, {
90
+ id: "subject",
91
+ title: "Subject",
92
+ loadingStateType: "long-text"
93
+ }];
94
+ const data = [{
95
+ id: 1,
96
+ sentOn: "2020-01-01",
97
+ subject: "Lorem ipsum dolor"
98
+ }, {
99
+ id: 2,
100
+ sentOn: "2022-02-02",
101
+ subject: "This is the subject"
102
+ }];
103
+ return <>
104
+ <Table id="sizes-small-table" style={{
105
+ width: "auto"
106
+ }} size="small" errorState={<h1 style={{
107
+ textAlign: "center"
108
+ }}>Error State</h1>} emptyState={<h1 style={{
109
+ textAlign: "center"
110
+ }}>Empty State</h1>} columns={columns}>
111
+ <TableHeader>
112
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} icon={headerCell.icon} infoContent={headerCell.infoContent} />)}
113
+ </TableHeader>
114
+ <TableBody>
115
+ {data.map(rowItem => <TableRow key={rowItem.id}>
116
+ <TableCell>{rowItem.sentOn}</TableCell>
117
+ <TableCell>{rowItem.subject}</TableCell>
118
+ </TableRow>)}
119
+ </TableBody>
120
+ </Table>
121
+ <Table style={{
122
+ width: "auto"
123
+ }} size="medium" errorState={<h1 style={{
124
+ textAlign: "center"
125
+ }}>Error State</h1>} emptyState={<h1 style={{
126
+ textAlign: "center"
127
+ }}>Empty State</h1>} columns={columns}>
128
+ <TableHeader>
129
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} icon={headerCell.icon} infoContent={headerCell.infoContent} />)}
130
+ </TableHeader>
131
+ <TableBody>
132
+ {data.map(rowItem => <TableRow key={rowItem.id}>
133
+ <TableCell>{rowItem.sentOn}</TableCell>
134
+ <TableCell>{rowItem.subject}</TableCell>
135
+ </TableRow>)}
136
+ </TableBody>
137
+ </Table>
138
+ <Table style={{
139
+ width: "auto"
140
+ }} size="large" errorState={<h1 style={{
141
+ textAlign: "center"
142
+ }}>Error State</h1>} emptyState={<h1 style={{
143
+ textAlign: "center"
144
+ }}>Empty State</h1>} columns={columns}>
145
+ <TableHeader>
146
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} icon={headerCell.icon} infoContent={headerCell.infoContent} />)}
147
+ </TableHeader>
148
+ <TableBody>
149
+ {data.map(rowItem => <TableRow key={rowItem.id}>
150
+ <TableCell>{rowItem.sentOn}</TableCell>
151
+ <TableCell>{rowItem.subject}</TableCell>
152
+ </TableRow>)}
153
+ </TableBody>
154
+ </Table>
155
+ </>;
156
+ ```
157
+
158
+ ## Borders
159
+
160
+ ```tsx
161
+ const columns: TableColumn[] = [{
162
+ id: "sentOn",
163
+ title: "Sent on",
164
+ width: 150,
165
+ loadingStateType: "medium-text"
166
+ }, {
167
+ id: "subject",
168
+ title: "Subject",
169
+ loadingStateType: "long-text"
170
+ }, {
171
+ id: "sentBy",
172
+ title: "Sent by",
173
+ width: {
174
+ min: 120,
175
+ max: 200
176
+ },
177
+ infoContent: "This is the sender",
178
+ loadingStateType: "circle"
179
+ }, {
180
+ id: "status",
181
+ title: "Status",
182
+ width: 150,
183
+ infoContent: "Info content for the status column",
184
+ loadingStateType: "medium-text"
185
+ }, {
186
+ id: "emailsSent",
187
+ title: "Emails sent",
188
+ width: 150,
189
+ loadingStateType: "medium-text"
190
+ }];
191
+ const data = [{
192
+ id: "1",
193
+ sentOn: "2020-01-01",
194
+ sentBy: "John Doe",
195
+ subject: "Lorem ipsum dolor",
196
+ status: "Sent",
197
+ emailsSent: 100
198
+ }, {
199
+ id: "3",
200
+ sentOn: "2023-03-03",
201
+ sentBy: "Some Person",
202
+ subject: "This is the subject This is the subject This is the subject This is the subject This is the subject This is the subject",
203
+ status: "Sent",
204
+ emailsSent: 999
205
+ }, {
206
+ id: "2",
207
+ sentOn: "2022-02-02",
208
+ sentBy: "Other Name",
209
+ subject: "This is the subject",
210
+ status: "Sent",
211
+ emailsSent: 99
212
+ }];
213
+ return <>
214
+ <Table errorState={<h1 style={{
215
+ textAlign: "center"
216
+ }}>Error State</h1>} emptyState={<h1 style={{
217
+ textAlign: "center"
218
+ }}>Empty State</h1>} columns={columns}>
219
+ <TableHeader>
220
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
221
+ </TableHeader>
222
+ <TableBody>
223
+ {data.map(rowItem => <TableRow key={rowItem.id}>
224
+ <TableCell>{rowItem.sentOn}</TableCell>
225
+ <TableCell>{rowItem.subject}</TableCell>
226
+ <TableCell>
227
+ <TableAvatar text={rowItem.sentBy} />
228
+ </TableCell>
229
+ <TableCell>
230
+ <Label text={rowItem.status} color="positive" />
231
+ </TableCell>
232
+ <TableCell>{rowItem.emailsSent}</TableCell>
233
+ </TableRow>)}
234
+ </TableBody>
235
+ </Table>
236
+ <Table errorState={<h1 style={{
237
+ textAlign: "center"
238
+ }}>Error State</h1>} emptyState={<h1 style={{
239
+ textAlign: "center"
240
+ }}>Empty State</h1>} columns={columns} withoutBorder>
241
+ <TableHeader>
242
+ {columns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
243
+ </TableHeader>
244
+ <TableBody>
245
+ {data.map(rowItem => <TableRow key={rowItem.id}>
246
+ <TableCell>{rowItem.sentOn}</TableCell>
247
+ <TableCell>{rowItem.subject}</TableCell>
248
+ <TableCell>
249
+ <TableAvatar text={rowItem.sentBy} />
250
+ </TableCell>
251
+ <TableCell>
252
+ <Label text={rowItem.status} color="positive" />
253
+ </TableCell>
254
+ <TableCell>{rowItem.emailsSent}</TableCell>
255
+ </TableRow>)}
256
+ </TableBody>
257
+ </Table>
258
+ </>;
259
+ ```
260
+
261
+ ## Table Header Functionality
262
+
263
+ ```tsx
264
+ const [tableData, setTableData] = useState(emailTableData);
265
+ const [sorting, setSorting] = useState<{
266
+ [key: string]: "asc" | "desc" | "none";
267
+ }>({});
268
+ const onSort = (columnId: string, sortState: "asc" | "desc" | "none") => {
269
+ setSorting({
270
+ [columnId]: sortState
271
+ });
272
+ setTableData(sort(columnId as keyof (typeof tableData)[number], sortState, tableData));
273
+ };
274
+ return <Table errorState={<h1 style={{
275
+ textAlign: "center"
276
+ }}>Error State</h1>} emptyState={<h1 style={{
277
+ textAlign: "center"
278
+ }}>Empty State</h1>} columns={emailColumns}>
279
+ <TableHeader>
280
+ {emailColumns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} icon={headerCell.icon} infoContent={headerCell.infoContent} onSortClicked={sortState => onSort(headerCell.id, sortState)} sortState={sorting[headerCell.id]} />)}
281
+ </TableHeader>
282
+ <TableBody>
283
+ {tableData.map(rowItem => <TableRow key={rowItem.id}>
284
+ <TableCell>{rowItem.sentOn}</TableCell>
285
+ <TableCell>{rowItem.subject}</TableCell>
286
+ <TableCell>
287
+ <TableAvatar text={rowItem.sentBy} />
288
+ </TableCell>
289
+ <TableCell>
290
+ <Label text={rowItem.status} color="positive" />
291
+ </TableCell>
292
+ <TableCell>{rowItem.emailsSent}</TableCell>
293
+ </TableRow>)}
294
+ </TableBody>
295
+ </Table>;
296
+ ```
297
+
298
+ ## Loading
299
+
300
+ ```tsx
301
+ <Table dataState={{
302
+ isLoading: true
303
+ }} errorState={<h1 style={{
304
+ textAlign: "center"
305
+ }}>Error State</h1>} emptyState={<h1 style={{
306
+ textAlign: "center"
307
+ }}>Empty State</h1>} columns={emailColumns}>
308
+ <TableHeader>
309
+ {emailColumns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
310
+ </TableHeader>
311
+ <TableBody>
312
+ {emailTableData.map(rowItem => <TableRow key={rowItem.id}>
313
+ <TableCell>{rowItem.sentOn}</TableCell>
314
+ <TableCell>{rowItem.subject}</TableCell>
315
+ <TableCell>
316
+ <TableAvatar text={rowItem.sentBy} />
317
+ </TableCell>
318
+ <TableCell>
319
+ <Label text={rowItem.status} color="positive" />
320
+ </TableCell>
321
+ <TableCell>{rowItem.emailsSent}</TableCell>
322
+ </TableRow>)}
323
+ </TableBody>
324
+ </Table>
325
+ ```
326
+
327
+ ## Scroll
328
+
329
+ ```tsx
330
+ <div style={{
331
+ height: 220,
332
+ width: "100%"
333
+ }}>
334
+ <Table errorState={<h1 style={{
335
+ textAlign: "center"
336
+ }}>Error State</h1>} emptyState={<h1 style={{
337
+ textAlign: "center"
338
+ }}>Empty State</h1>} columns={scrollTableColumns}>
339
+ <TableHeader>
340
+ {scrollTableColumns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
341
+ </TableHeader>
342
+ <TableBody>
343
+ {scrollTableData.map(rowItem => <TableRow key={rowItem.id}>
344
+ <TableCell>{rowItem.sentOn}</TableCell>
345
+ <TableCell>
346
+ <Label text={rowItem.priority} color={priorityColumnToLabelColor[rowItem.priority]} />
347
+ </TableCell>
348
+ <TableCell>{rowItem.subject}</TableCell>
349
+ <TableCell>
350
+ <TableAvatar text={rowItem.sentBy} />
351
+ </TableCell>
352
+ <TableCell>
353
+ <Label text={rowItem.status} color={statusColumnToLabelColor[rowItem.status]} />
354
+ </TableCell>
355
+ <TableCell>{rowItem.emailsSent}</TableCell>
356
+ </TableRow>)}
357
+ </TableBody>
358
+ </Table>
359
+ </div>
360
+ ```
361
+
362
+ ## Virtualized Scroll
363
+
364
+ ```tsx
365
+ const Row = (data: (typeof virtualizedScrollTableData)[number]) => {
366
+ return <TableRow>
367
+ {virtualizedScrollTableColumns.map(column => {
368
+ return <TableCell sticky={column.id === "id"} key={column.id}>
369
+ {data[column.id as keyof typeof data]}
370
+ </TableCell>;
371
+ })}
372
+ </TableRow>;
373
+ };
374
+ const Header = React.useCallback((columns: TableColumn[]) => {
375
+ return <TableHeader>
376
+ {columns.map((cell, index) => <TableHeaderCell sticky={index === 0} key={index} {...cell} />)}
377
+ </TableHeader>;
378
+ }, []);
379
+ return <Table errorState={<h1 style={{
380
+ textAlign: "center"
381
+ }}>Error State</h1>} emptyState={<h1 style={{
382
+ textAlign: "center"
383
+ }}>Empty State</h1>} columns={virtualizedScrollTableColumns} style={{
384
+ height: 250
385
+ }}>
386
+ <TableVirtualizedBody rowRenderer={Row} items={virtualizedScrollTableData} columns={virtualizedScrollTableColumns} headerRenderer={Header} />
387
+ </Table>;
388
+ ```
389
+
390
+ ## Sticky column
391
+
392
+ ```tsx
393
+ return <Table errorState={<h1 style={{
394
+ textAlign: "center"
395
+ }}>Error State</h1>} emptyState={<h1 style={{
396
+ textAlign: "center"
397
+ }}>Empty State</h1>} columns={stickyColumns}>
398
+ <TableHeader>
399
+ {stickyColumns.map((headerCell, index) => <TableHeaderCell sticky={index === 0} key={index} title={headerCell.title} />)}
400
+ </TableHeader>
401
+ <TableBody>
402
+ {stickyTableData.map(rowItem => <TableRow key={rowItem.id}>
403
+ <TableCell sticky>{rowItem.projectName}</TableCell>
404
+ <TableCell>
405
+ <Label text={rowItem.status} color={statusColumnToLabelColor[rowItem.status]} />
406
+ </TableCell>
407
+ <TableCell>{rowItem.description}</TableCell>
408
+ <TableCell>{rowItem.createdOn}</TableCell>
409
+ <TableCell>{rowItem.emailsSent}</TableCell>
410
+ <TableCell>{rowItem.owner}</TableCell>
411
+ <TableCell>{rowItem.priority}</TableCell>
412
+ <TableCell>{rowItem.category}</TableCell>
413
+ <TableCell>{rowItem.dueDate}</TableCell>
414
+ <TableCell>{rowItem.comments}</TableCell>
415
+ </TableRow>)}
416
+ </TableBody>
417
+ </Table>;
418
+ ```
419
+
420
+ ## Highlighted row
421
+
422
+ ```tsx
423
+ const shouldRowBeHighlighted = (rowItem: (typeof emailTableData)[number]) => {
424
+ return rowItem.id === "2";
425
+ };
426
+ return <Table errorState={<h1 style={{
427
+ textAlign: "center"
428
+ }}>Error State</h1>} emptyState={<h1 style={{
429
+ textAlign: "center"
430
+ }}>Empty State</h1>} columns={emailColumns}>
431
+ <TableHeader>
432
+ {emailColumns.map((headerCell, index) => <TableHeaderCell key={index} title={headerCell.title} />)}
433
+ </TableHeader>
434
+ <TableBody>
435
+ {emailTableData.map(rowItem => <TableRow key={rowItem.id} highlighted={shouldRowBeHighlighted(rowItem)}>
436
+ <TableCell>{rowItem.sentOn}</TableCell>
437
+ <TableCell>{rowItem.subject}</TableCell>
438
+ <TableCell>
439
+ <TableAvatar text={rowItem.sentBy} />
440
+ </TableCell>
441
+ <TableCell>
442
+ <Label text={rowItem.status} color="positive" />
443
+ </TableCell>
444
+ <TableCell>{rowItem.emailsSent}</TableCell>
445
+ </TableRow>)}
446
+ </TableBody>
447
+ </Table>;
448
+ ```
449
+
@@ -0,0 +1,241 @@
1
+ # Storybook Code Examples
2
+
3
+ ## Overview
4
+
5
+ ```tsx
6
+ <TabsContext id="overview-tabs" {...args}>
7
+ <TabList id="overview-tab-list">
8
+ <Tab id="overview-tab-first">First</Tab>
9
+ <Tab id="overview-tab-second">Second</Tab>
10
+ <Tab id="overview-tab-third">Third</Tab>
11
+ </TabList>
12
+ <TabPanels id="overview-tab-panels">
13
+ <TabPanel id="overview-panel-first">
14
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
15
+ width: "480px",
16
+ height: "111px"
17
+ }}>
18
+ First slide
19
+ </Box>
20
+ </TabPanel>
21
+ <TabPanel id="overview-panel-second">
22
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
23
+ width: "480px",
24
+ height: "111px"
25
+ }}>
26
+ Second slide
27
+ </Box>
28
+ </TabPanel>
29
+ <TabPanel id="overview-panel-third">
30
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
31
+ width: "480px",
32
+ height: "111px"
33
+ }}>
34
+ Third slide
35
+ </Box>
36
+ </TabPanel>
37
+ </TabPanels>
38
+ </TabsContext>
39
+ ```
40
+
41
+ ## Default
42
+
43
+ ```tsx
44
+ <TabsContext id="default-tabs">
45
+ <TabList id="default-tab-list">
46
+ <Tab id="default-tab-first">First</Tab>
47
+ <Tab id="default-tab-second">Second</Tab>
48
+ <Tab id="default-tab-third">Third</Tab>
49
+ <Tab id="default-tab-disabled" disabled>
50
+ Disabled
51
+ </Tab>
52
+ </TabList>
53
+ <TabPanels id="default-tab-panels">
54
+ <TabPanel id="default-panel-first">
55
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
56
+ width: "480px",
57
+ height: "111px"
58
+ }}>
59
+ First slide
60
+ </Box>
61
+ </TabPanel>
62
+ <TabPanel id="default-panel-second">
63
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
64
+ width: "480px",
65
+ height: "111px"
66
+ }}>
67
+ Second slide
68
+ </Box>
69
+ </TabPanel>
70
+ <TabPanel id="default-panel-third">
71
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
72
+ width: "480px",
73
+ height: "111px"
74
+ }}>
75
+ Third slide
76
+ </Box>
77
+ </TabPanel>
78
+ <TabPanel id="default-panel-fourth">
79
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
80
+ width: "480px",
81
+ height: "111px"
82
+ }}>
83
+ Fourth slide
84
+ </Box>
85
+ </TabPanel>
86
+ </TabPanels>
87
+ </TabsContext>
88
+ ```
89
+
90
+ ## Stretched
91
+
92
+ ```tsx
93
+ <div style={{
94
+ width: "100%"
95
+ }}>
96
+ <TabList tabType="stretched">
97
+ <Tab>First</Tab>
98
+ <Tab>Second</Tab>
99
+ <Tab>Third</Tab>
100
+ <Tab disabled>Disabled</Tab>
101
+ </TabList>
102
+ </div>
103
+ ```
104
+
105
+ ## StretchedUnderline
106
+
107
+ ```tsx
108
+ <div style={{
109
+ width: "100%"
110
+ }}>
111
+ <TabList stretchedUnderline>
112
+ <Tab>First</Tab>
113
+ <Tab>Second</Tab>
114
+ <Tab>Third</Tab>
115
+ <Tab disabled>Disabled</Tab>
116
+ </TabList>
117
+ </div>
118
+ ```
119
+
120
+ ## Motion
121
+
122
+ ```tsx
123
+ <Flex direction="column" gap="medium">
124
+ <TabsContext>
125
+ <TabList>
126
+ <Tab>First</Tab>
127
+ <Tab>Second</Tab>
128
+ <Tab>Third</Tab>
129
+ <Tab disabled>Disabled</Tab>
130
+ </TabList>
131
+ <TabPanels animationDirection="ltr">
132
+ <TabPanel>
133
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
134
+ width: "480px",
135
+ height: "111px"
136
+ }}>
137
+ First slide
138
+ </Box>
139
+ </TabPanel>
140
+ <TabPanel>
141
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
142
+ width: "480px",
143
+ height: "111px"
144
+ }}>
145
+ Second slide
146
+ </Box>
147
+ </TabPanel>
148
+ <TabPanel>
149
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
150
+ width: "480px",
151
+ height: "111px"
152
+ }}>
153
+ Third slide
154
+ </Box>
155
+ </TabPanel>
156
+ <TabPanel>
157
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
158
+ width: "480px",
159
+ height: "111px"
160
+ }}>
161
+ Fourth slide
162
+ </Box>
163
+ </TabPanel>
164
+ </TabPanels>
165
+ </TabsContext>
166
+ <TabsContext>
167
+ <TabList>
168
+ <Tab>First</Tab>
169
+ <Tab>Second</Tab>
170
+ <Tab>Third</Tab>
171
+ <Tab disabled>Disabled</Tab>
172
+ </TabList>
173
+ <TabPanels animationDirection="rtl">
174
+ <TabPanel>
175
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
176
+ width: "480px",
177
+ height: "111px"
178
+ }}>
179
+ First slide
180
+ </Box>
181
+ </TabPanel>
182
+ <TabPanel>
183
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
184
+ width: "480px",
185
+ height: "111px"
186
+ }}>
187
+ Second slide
188
+ </Box>
189
+ </TabPanel>
190
+ <TabPanel>
191
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
192
+ width: "480px",
193
+ height: "111px"
194
+ }}>
195
+ Third slide
196
+ </Box>
197
+ </TabPanel>
198
+ <TabPanel>
199
+ <Box backgroundColor="greyBackgroundColor" padding="medium" style={{
200
+ width: "480px",
201
+ height: "111px"
202
+ }}>
203
+ Fourth slide
204
+ </Box>
205
+ </TabPanel>
206
+ </TabPanels>
207
+ </TabsContext>
208
+ </Flex>
209
+ ```
210
+
211
+ ## BoardViewsTabs
212
+
213
+ ```tsx
214
+ <TabList>
215
+ <Tab icon={Table}>Main Table</Tab>
216
+ <Tab icon={Chart}>Chart</Tab>
217
+ <Tab icon={Calendar}>Calendar</Tab>
218
+ </TabList>
219
+ ```
220
+
221
+ ## AdminSectionTabs
222
+
223
+ ```tsx
224
+ <TabsContext>
225
+ <TabList>
226
+ <Tab>Profile</Tab>
227
+ <Tab>Account</Tab>
228
+ </TabList>
229
+ <TabPanels>
230
+ <TabPanel>
231
+ <h2>Login Details</h2>
232
+ <TextField title="Profile Name" size="medium" placeholder="Profile Name" />
233
+ </TabPanel>
234
+ <TabPanel>
235
+ <h2>Account Details</h2>
236
+ <TextField title="Account Name" size="medium" placeholder="Account Name" />
237
+ </TabPanel>
238
+ </TabPanels>
239
+ </TabsContext>
240
+ ```
241
+