@webiny/admin-ui 6.2.0-beta.0 → 6.3.0-beta.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 (161) hide show
  1. package/Accordion/Accordion.d.ts +1 -1
  2. package/Accordion/Accordion.mdx +437 -463
  3. package/Accordion/components/AccordionContent.js.map +1 -1
  4. package/Alert/Alert.d.ts +1 -1
  5. package/Alert/Alert.js.map +1 -1
  6. package/Alert/Alert.mdx +80 -83
  7. package/AutoComplete/AutoComplete.mdx +63 -55
  8. package/Avatar/Avatar.d.ts +1 -1
  9. package/Avatar/Avatar.js.map +1 -1
  10. package/Avatar/Avatar.mdx +52 -43
  11. package/Button/Button.d.ts +1 -1
  12. package/Button/Button.js.map +1 -1
  13. package/Button/Button.mdx +50 -42
  14. package/Button/IconButton.d.ts +1 -1
  15. package/Button/IconButton.js.map +1 -1
  16. package/Card/components/CardContent.d.ts +1 -1
  17. package/Card/components/CardTitle.d.ts +1 -1
  18. package/Checkbox/Checkbox.mdx +51 -49
  19. package/Checkbox/primitives/CheckboxPrimitive.d.ts +1 -1
  20. package/CheckboxGroup/CheckboxGroup.mdx +51 -53
  21. package/CodeEditor/CodeEditor.mdx +44 -43
  22. package/ColorPicker/ColorPicker.mdx +41 -40
  23. package/Command/components/Item.d.ts +1 -1
  24. package/Command/components/Item.js.map +1 -1
  25. package/DataTable/DataTable.mdx +537 -542
  26. package/DataTable/components/ColumnSorter.d.ts +1 -1
  27. package/DataTable/components/ColumnSorter.js.map +1 -1
  28. package/Dialog/Dialog.js.map +1 -1
  29. package/Dialog/components/DialogContent.d.ts +1 -1
  30. package/Dialog/components/DialogContent.js +1 -1
  31. package/Dialog/components/DialogContent.js.map +1 -1
  32. package/Dialog/components/DialogFooter.d.ts +1 -1
  33. package/Dialog/components/DialogFooter.js.map +1 -1
  34. package/Dialog/components/DialogTitle.d.ts +1 -1
  35. package/Drawer/Drawer.js.map +1 -1
  36. package/Drawer/Drawer.mdx +73 -64
  37. package/Drawer/components/DrawerContent.d.ts +1 -1
  38. package/Drawer/components/DrawerContent.js.map +1 -1
  39. package/DropdownMenu/DropdownMenu.js.map +1 -1
  40. package/DropdownMenu/DropdownMenu.mdx +155 -256
  41. package/DropdownMenu/components/DropdownMenuCheckboxItem.js.map +1 -1
  42. package/DropdownMenu/components/DropdownMenuLabel.js.map +1 -1
  43. package/FilePicker/FilePicker.mdx +69 -69
  44. package/FilePicker/primitives/FilePickerPrimitive.d.ts +19 -19
  45. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  46. package/FilePicker/primitives/components/Trigger.d.ts +1 -1
  47. package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +1 -1
  48. package/FilePicker/primitives/components/previews/variants.d.ts +1 -1
  49. package/FilePicker/primitives/components/types.js.map +1 -1
  50. package/FormComponent/Description.d.ts +1 -1
  51. package/FormComponent/ErrorMessage.d.ts +1 -1
  52. package/FormComponent/Note.d.ts +1 -1
  53. package/Grid/Grid.d.ts +2 -2
  54. package/Grid/Grid.js.map +1 -1
  55. package/Grid/Grid.mdx +111 -121
  56. package/HeaderBar/HeaderBar.mdx +98 -99
  57. package/Heading/Heading.d.ts +1 -1
  58. package/Heading/Heading.js.map +1 -1
  59. package/Heading/Heading.mdx +63 -58
  60. package/Icon/Icon.d.ts +1 -1
  61. package/Icon/Icon.js.map +1 -1
  62. package/Icon/Icon.mdx +79 -147
  63. package/IconPicker/IconPicker.mdx +66 -64
  64. package/IconPicker/primitives/IconPickerPrimitive.d.ts +1 -1
  65. package/IconPicker/primitives/components/IconPickerTrigger.d.ts +1 -1
  66. package/Image/Image.js.map +1 -1
  67. package/Input/Input.mdx +67 -56
  68. package/Input/InputPrimitive.d.ts +1 -1
  69. package/Label/Label.d.ts +1 -1
  70. package/Label/Label.js.map +1 -1
  71. package/Label/Label.mdx +42 -42
  72. package/Label/components/LabelDescription.d.ts +1 -1
  73. package/Label/components/LabelRequired.d.ts +1 -1
  74. package/Label/components/LabelValue.d.ts +1 -1
  75. package/Link/Link.d.ts +1 -1
  76. package/Link/Link.mdx +129 -116
  77. package/List/List.d.ts +1 -1
  78. package/List/List.js.map +1 -1
  79. package/List/List.mdx +317 -329
  80. package/List/components/ListItem.d.ts +1 -1
  81. package/List/components/ListItem.js.map +1 -1
  82. package/Loader/Loader.d.ts +2 -2
  83. package/Loader/Loader.js.map +1 -1
  84. package/Loader/Loader.mdx +96 -91
  85. package/MultiAutoComplete/MultiAutoComplete.mdx +52 -51
  86. package/MultiAutoComplete/primitives/components/MultiAutoCompleteInput.d.ts +1 -1
  87. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenter.js.map +1 -1
  88. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenterWithUniqueValues.js.map +1 -1
  89. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.js.map +1 -1
  90. package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteTemporaryOptionPresenter.js.map +1 -1
  91. package/MultiFilePicker/MultiFilePicker.mdx +84 -80
  92. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.js.map +1 -1
  93. package/Popover/Popover.mdx +112 -118
  94. package/Popover/primitives/components/PopoverArrow.d.ts +1 -1
  95. package/Popover/primitives/components/PopoverContent.d.ts +1 -1
  96. package/RadioGroup/RadioGroup.mdx +62 -59
  97. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  98. package/RangeSlider/RangeSlider.mdx +48 -47
  99. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  100. package/RangeSlider/primitives/components/RangeSliderValue.d.ts +1 -1
  101. package/RangeSlider/primitives/components/RangeSliderValue.js.map +1 -1
  102. package/ScrollArea/ScrollArea.js.map +1 -1
  103. package/SegmentedControl/SegmentedControl.mdx +59 -59
  104. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +1 -1
  105. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  106. package/Select/Select.mdx +52 -43
  107. package/Select/primitives/components/SelectTrigger.d.ts +1 -1
  108. package/Select/primitives/components/SelectTrigger.js.map +1 -1
  109. package/Select/primitives/presenters/SelectPresenter.d.ts +1 -1
  110. package/Separator/Separator.d.ts +1 -1
  111. package/Separator/Separator.mdx +139 -150
  112. package/Sidebar/Sidebar.js.map +1 -1
  113. package/Sidebar/Sidebar.mdx +66 -88
  114. package/Sidebar/components/items/SidebarMenuSubItemIndentation.d.ts +1 -1
  115. package/Sidebar/components/items/SidebarMenuSubItemIndentation.js.map +1 -1
  116. package/Skeleton/Skeleton.d.ts +1 -1
  117. package/Skeleton/Skeleton.js.map +1 -1
  118. package/Skeleton/Skeleton.mdx +37 -37
  119. package/Slider/Slider.mdx +48 -47
  120. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  121. package/Slider/primitives/components/SliderSideValue.d.ts +1 -1
  122. package/Slider/primitives/components/SliderSideValue.js.map +1 -1
  123. package/Slider/primitives/components/SliderTooltip.d.ts +1 -1
  124. package/SteppedProgress/components/SteppedProgressIcon.d.ts +1 -1
  125. package/SteppedProgress/components/SteppedProgressIcon.js.map +1 -1
  126. package/SteppedProgress/components/SteppedProgressIndicator.d.ts +1 -1
  127. package/SteppedProgress/components/SteppedProgressIndicator.js.map +1 -1
  128. package/Switch/Switch.mdx +44 -42
  129. package/Switch/primitives/SwitchPrimitive.d.ts +1 -1
  130. package/Table/Table.d.ts +1 -1
  131. package/Table/Table.js.map +1 -1
  132. package/Table/components/Direction.d.ts +1 -1
  133. package/Table/components/Direction.js.map +1 -1
  134. package/Table/components/Header.d.ts +1 -1
  135. package/Table/components/Header.js.map +1 -1
  136. package/Table/components/Resizer.d.ts +1 -1
  137. package/Table/components/Resizer.js.map +1 -1
  138. package/Table/components/Row.d.ts +1 -1
  139. package/Table/components/Row.js.map +1 -1
  140. package/Tabs/Tabs.mdx +297 -292
  141. package/Tabs/components/Content.d.ts +1 -1
  142. package/Tabs/components/List.d.ts +1 -1
  143. package/Tabs/components/Trigger.d.ts +1 -1
  144. package/Tag/Tag.d.ts +1 -1
  145. package/Tag/Tag.js.map +1 -1
  146. package/Tag/Tag.mdx +68 -64
  147. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  148. package/Text/Text.d.ts +1 -1
  149. package/Text/Text.mdx +54 -48
  150. package/Textarea/Textarea.mdx +49 -39
  151. package/Textarea/TextareaPrimitive.d.ts +1 -1
  152. package/Textarea/TextareaPrimitive.js.map +1 -1
  153. package/Toast/Toast.mdx +63 -53
  154. package/Toast/components/ToastRoot.d.ts +1 -1
  155. package/Tooltip/Tooltip.mdx +197 -198
  156. package/Tooltip/components/TooltipArrow.d.ts +1 -1
  157. package/Tooltip/components/TooltipContent.d.ts +1 -1
  158. package/Tree/components/Item.d.ts +1 -1
  159. package/Tree/useTree.d.ts +1 -1
  160. package/Widget/components/WidgetContent.d.ts +1 -1
  161. package/package.json +15 -15
@@ -1,6 +1,6 @@
1
- import { Canvas, Meta, Controls } from '@storybook/addon-docs/blocks';
1
+ import { Canvas, Meta, Controls } from "@storybook/addon-docs/blocks";
2
2
 
3
- import * as DataTableStories from './DataTable.stories';
3
+ import * as DataTableStories from "./DataTable.stories";
4
4
 
5
5
  <Meta of={DataTableStories} />
6
6
 
@@ -16,60 +16,60 @@ import { DataTable, DataTableColumns, DataTableSorting } from "@webiny/admin-ui"
16
16
 
17
17
  // Define the data structure
18
18
  interface Entry {
19
- id: string;
20
- name: string;
21
- createdBy: string;
22
- lastModified: string;
23
- status: string;
24
- $selectable?: boolean;
19
+ id: string;
20
+ name: string;
21
+ createdBy: string;
22
+ lastModified: string;
23
+ status: string;
24
+ $selectable?: boolean;
25
25
  }
26
26
 
27
27
  // Define the columns structure
28
28
  const columns: DataTableColumns\<Entry\> = {
29
- name: {
30
- header: "Title",
31
- enableSorting: true
32
- },
33
- createdBy: {
34
- header: "Author"
35
- },
36
- lastModified: {
37
- header: "Last Modified",
38
- enableSorting: true
39
- },
40
- status: {
41
- header: "Status"
42
- }
29
+ name: {
30
+ header: "Title",
31
+ enableSorting: true
32
+ },
33
+ createdBy: {
34
+ header: "Author"
35
+ },
36
+ lastModified: {
37
+ header: "Last Modified",
38
+ enableSorting: true
39
+ },
40
+ status: {
41
+ header: "Status"
42
+ }
43
43
  };
44
44
 
45
45
  // Sample data
46
46
  const data = [
47
- {
48
- id: "entry-1",
49
- name: "Getting Started Guide",
50
- createdBy: "John Doe",
51
- lastModified: "1 hour ago",
52
- status: "Published"
53
- },
54
- {
55
- id: "entry-2",
56
- name: "User Documentation",
57
- createdBy: "Jane Smith",
58
- lastModified: "3 days ago",
59
- status: "Draft"
60
- },
61
- {
62
- id: "entry-3",
63
- name: "API Reference",
64
- createdBy: "John Doe",
65
- lastModified: "1 week ago",
66
- status: "Published"
67
- }
47
+ {
48
+ id: "entry-1",
49
+ name: "Getting Started Guide",
50
+ createdBy: "John Doe",
51
+ lastModified: "1 hour ago",
52
+ status: "Published"
53
+ },
54
+ {
55
+ id: "entry-2",
56
+ name: "User Documentation",
57
+ createdBy: "Jane Smith",
58
+ lastModified: "3 days ago",
59
+ status: "Draft"
60
+ },
61
+ {
62
+ id: "entry-3",
63
+ name: "API Reference",
64
+ createdBy: "John Doe",
65
+ lastModified: "1 week ago",
66
+ status: "Published"
67
+ }
68
68
  ];
69
69
 
70
70
  const DataTableExample = () => {
71
- const [selectedRows, setSelectedRows] = useState\<Entry[]\>([]);
72
- const [sorting, setSorting] = useState\<DataTableSorting\>([]);
71
+ const [selectedRows, setSelectedRows] = useState\<Entry[]\>([]);
72
+ const [sorting, setSorting] = useState\<DataTableSorting\>([]);
73
73
 
74
74
  return (
75
75
  <DataTable
@@ -83,22 +83,23 @@ const DataTableExample = () => {
83
83
  onSortingChange={setSorting}
84
84
  />
85
85
  );
86
+
86
87
  };
87
88
 
88
89
  export default DataTableExample;
89
90
 
90
91
  ` } }
91
- additionalActions={[
92
- {
93
- title: 'Open in GitHub',
94
- onClick: () => {
95
- window.open(
96
- 'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/DataTable/DataTable.tsx',
97
- '_blank'
98
- );
99
- },
100
- }
101
- ]}
92
+ additionalActions={[
93
+ {
94
+ title: 'Open in GitHub',
95
+ onClick: () => {
96
+ window.open(
97
+ 'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/DataTable/DataTable.tsx',
98
+ '_blank'
99
+ );
100
+ },
101
+ }
102
+ ]}
102
103
  />
103
104
 
104
105
  <Controls of={DataTableStories.Documentation} />
@@ -109,73 +110,73 @@ import { DataTable, DataTableColumns, DataTableSorting } from "@webiny/admin-ui"
109
110
 
110
111
  // Define the data structure
111
112
  interface Entry {
112
- id: string;
113
- name: string;
114
- createdBy: string;
115
- lastModified: string;
116
- status: string;
117
- $selectable?: boolean;
113
+ id: string;
114
+ name: string;
115
+ createdBy: string;
116
+ lastModified: string;
117
+ status: string;
118
+ $selectable?: boolean;
118
119
  }
119
120
 
120
121
  // Define the columns structure
121
122
  const columns: DataTableColumns<Entry> = {
122
- name: {
123
- header: "Title",
124
- enableSorting: true
125
- },
126
- createdBy: {
127
- header: "Author"
128
- },
129
- lastModified: {
130
- header: "Last Modified",
131
- enableSorting: true
132
- },
133
- status: {
134
- header: "Status"
135
- }
123
+ name: {
124
+ header: "Title",
125
+ enableSorting: true
126
+ },
127
+ createdBy: {
128
+ header: "Author"
129
+ },
130
+ lastModified: {
131
+ header: "Last Modified",
132
+ enableSorting: true
133
+ },
134
+ status: {
135
+ header: "Status"
136
+ }
136
137
  };
137
138
 
138
139
  // Sample data
139
140
  const data = [
140
- {
141
- id: "entry-1",
142
- name: "Getting Started Guide",
143
- createdBy: "John Doe",
144
- lastModified: "1 hour ago",
145
- status: "Published"
146
- },
147
- {
148
- id: "entry-2",
149
- name: "User Documentation",
150
- createdBy: "Jane Smith",
151
- lastModified: "3 days ago",
152
- status: "Draft"
153
- },
154
- {
155
- id: "entry-3",
156
- name: "API Reference",
157
- createdBy: "John Doe",
158
- lastModified: "1 week ago",
159
- status: "Published"
160
- }
141
+ {
142
+ id: "entry-1",
143
+ name: "Getting Started Guide",
144
+ createdBy: "John Doe",
145
+ lastModified: "1 hour ago",
146
+ status: "Published"
147
+ },
148
+ {
149
+ id: "entry-2",
150
+ name: "User Documentation",
151
+ createdBy: "Jane Smith",
152
+ lastModified: "3 days ago",
153
+ status: "Draft"
154
+ },
155
+ {
156
+ id: "entry-3",
157
+ name: "API Reference",
158
+ createdBy: "John Doe",
159
+ lastModified: "1 week ago",
160
+ status: "Published"
161
+ }
161
162
  ];
162
163
 
163
164
  const DataTableExample = () => {
164
- const [selectedRows, setSelectedRows] = useState<Entry[]>([]);
165
- const [sorting, setSorting] = useState<DataTableSorting>([]);
166
-
167
- return (
168
- <DataTable
169
- columns={columns}
170
- data={data}
171
- bordered={true}
172
- stickyHeader={true}
173
- selectedRows={selectedRows}
174
- onSelectRow={rows => setSelectedRows(rows)}
175
- sorting={sorting}
176
- onSortingChange={setSorting}
177
- />
178
- );
165
+ const [selectedRows, setSelectedRows] = useState<Entry[]>([]);
166
+ const [sorting, setSorting] = useState<DataTableSorting>([]);
167
+
168
+ return (
169
+ <DataTable
170
+ columns={columns}
171
+ data={data}
172
+ bordered={true}
173
+ stickyHeader={true}
174
+ selectedRows={selectedRows}
175
+ onSelectRow={rows => setSelectedRows(rows)}
176
+ sorting={sorting}
177
+ onSortingChange={setSorting}
178
+ />
179
+ );
179
180
  };
180
181
 
181
182
  export default DataTableExample;
@@ -192,54 +193,54 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
192
193
 
193
194
  // Define the data structure
194
195
  interface Entry {
195
- id: string;
196
- name: string;
197
- createdBy: string;
198
- lastModified: string;
199
- status: string;
196
+ id: string;
197
+ name: string;
198
+ createdBy: string;
199
+ lastModified: string;
200
+ status: string;
200
201
  }
201
202
 
202
203
  // Define the columns structure
203
204
  const columns: DataTableColumns\<Entry\> = {
204
- name: {
205
- header: "Title",
206
- enableSorting: true
207
- },
208
- createdBy: {
209
- header: "Author"
210
- },
211
- lastModified: {
212
- header: "Last Modified",
213
- enableSorting: true
214
- },
215
- status: {
216
- header: "Status"
217
- }
205
+ name: {
206
+ header: "Title",
207
+ enableSorting: true
208
+ },
209
+ createdBy: {
210
+ header: "Author"
211
+ },
212
+ lastModified: {
213
+ header: "Last Modified",
214
+ enableSorting: true
215
+ },
216
+ status: {
217
+ header: "Status"
218
+ }
218
219
  };
219
220
 
220
221
  // Sample data
221
222
  const data = [
222
- {
223
- id: "entry-1",
224
- name: "Getting Started Guide",
225
- createdBy: "John Doe",
226
- lastModified: "1 hour ago",
227
- status: "Published"
228
- },
229
- {
230
- id: "entry-2",
231
- name: "User Documentation",
232
- createdBy: "Jane Smith",
233
- lastModified: "3 days ago",
234
- status: "Draft"
235
- },
236
- {
237
- id: "entry-3",
238
- name: "API Reference",
239
- createdBy: "John Doe",
240
- lastModified: "1 week ago",
241
- status: "Published"
242
- }
223
+ {
224
+ id: "entry-1",
225
+ name: "Getting Started Guide",
226
+ createdBy: "John Doe",
227
+ lastModified: "1 hour ago",
228
+ status: "Published"
229
+ },
230
+ {
231
+ id: "entry-2",
232
+ name: "User Documentation",
233
+ createdBy: "Jane Smith",
234
+ lastModified: "3 days ago",
235
+ status: "Draft"
236
+ },
237
+ {
238
+ id: "entry-3",
239
+ name: "API Reference",
240
+ createdBy: "John Doe",
241
+ lastModified: "1 week ago",
242
+ status: "Published"
243
+ }
243
244
  ];
244
245
 
245
246
  const DataTableExample = () => {
@@ -250,6 +251,7 @@ const DataTableExample = () => {
250
251
  data={data}
251
252
  />
252
253
  );
254
+
253
255
  };
254
256
 
255
257
  export default DataTableExample;
@@ -264,54 +266,54 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
264
266
 
265
267
  // Define the data structure
266
268
  interface Entry {
267
- id: string;
268
- name: string;
269
- createdBy: string;
270
- lastModified: string;
271
- status: string;
269
+ id: string;
270
+ name: string;
271
+ createdBy: string;
272
+ lastModified: string;
273
+ status: string;
272
274
  }
273
275
 
274
276
  // Define the columns structure
275
277
  const columns: DataTableColumns\<Entry\> = {
276
- name: {
277
- header: "Title",
278
- enableSorting: true
279
- },
280
- createdBy: {
281
- header: "Author"
282
- },
283
- lastModified: {
284
- header: "Last Modified",
285
- enableSorting: true
286
- },
287
- status: {
288
- header: "Status"
289
- }
278
+ name: {
279
+ header: "Title",
280
+ enableSorting: true
281
+ },
282
+ createdBy: {
283
+ header: "Author"
284
+ },
285
+ lastModified: {
286
+ header: "Last Modified",
287
+ enableSorting: true
288
+ },
289
+ status: {
290
+ header: "Status"
291
+ }
290
292
  };
291
293
 
292
294
  // Sample data
293
295
  const data = [
294
- {
295
- id: "entry-1",
296
- name: "Getting Started Guide",
297
- createdBy: "John Doe",
298
- lastModified: "1 hour ago",
299
- status: "Published"
300
- },
301
- {
302
- id: "entry-2",
303
- name: "User Documentation",
304
- createdBy: "Jane Smith",
305
- lastModified: "3 days ago",
306
- status: "Draft"
307
- },
308
- {
309
- id: "entry-3",
310
- name: "API Reference",
311
- createdBy: "John Doe",
312
- lastModified: "1 week ago",
313
- status: "Published"
314
- }
296
+ {
297
+ id: "entry-1",
298
+ name: "Getting Started Guide",
299
+ createdBy: "John Doe",
300
+ lastModified: "1 hour ago",
301
+ status: "Published"
302
+ },
303
+ {
304
+ id: "entry-2",
305
+ name: "User Documentation",
306
+ createdBy: "Jane Smith",
307
+ lastModified: "3 days ago",
308
+ status: "Draft"
309
+ },
310
+ {
311
+ id: "entry-3",
312
+ name: "API Reference",
313
+ createdBy: "John Doe",
314
+ lastModified: "1 week ago",
315
+ status: "Published"
316
+ }
315
317
  ];
316
318
 
317
319
  const BorderedDataTableExample = () => {
@@ -323,6 +325,7 @@ const BorderedDataTableExample = () => {
323
325
  bordered={true}
324
326
  />
325
327
  );
328
+
326
329
  };
327
330
 
328
331
  export default BorderedDataTableExample;
@@ -337,54 +340,54 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
337
340
 
338
341
  // Define the data structure
339
342
  interface Entry {
340
- id: string;
341
- name: string;
342
- createdBy: string;
343
- lastModified: string;
344
- status: string;
343
+ id: string;
344
+ name: string;
345
+ createdBy: string;
346
+ lastModified: string;
347
+ status: string;
345
348
  }
346
349
 
347
350
  // Define the columns structure
348
351
  const columns: DataTableColumns\<Entry\> = {
349
- name: {
350
- header: "Title",
351
- enableSorting: true
352
- },
353
- createdBy: {
354
- header: "Author"
355
- },
356
- lastModified: {
357
- header: "Last Modified",
358
- enableSorting: true
359
- },
360
- status: {
361
- header: "Status"
362
- }
352
+ name: {
353
+ header: "Title",
354
+ enableSorting: true
355
+ },
356
+ createdBy: {
357
+ header: "Author"
358
+ },
359
+ lastModified: {
360
+ header: "Last Modified",
361
+ enableSorting: true
362
+ },
363
+ status: {
364
+ header: "Status"
365
+ }
363
366
  };
364
367
 
365
368
  // Sample data
366
369
  const data = [
367
- {
368
- id: "entry-1",
369
- name: "Getting Started Guide",
370
- createdBy: "John Doe",
371
- lastModified: "1 hour ago",
372
- status: "Published"
373
- },
374
- {
375
- id: "entry-2",
376
- name: "User Documentation",
377
- createdBy: "Jane Smith",
378
- lastModified: "3 days ago",
379
- status: "Draft"
380
- },
381
- {
382
- id: "entry-3",
383
- name: "API Reference",
384
- createdBy: "John Doe",
385
- lastModified: "1 week ago",
386
- status: "Published"
387
- }
370
+ {
371
+ id: "entry-1",
372
+ name: "Getting Started Guide",
373
+ createdBy: "John Doe",
374
+ lastModified: "1 hour ago",
375
+ status: "Published"
376
+ },
377
+ {
378
+ id: "entry-2",
379
+ name: "User Documentation",
380
+ createdBy: "Jane Smith",
381
+ lastModified: "3 days ago",
382
+ status: "Draft"
383
+ },
384
+ {
385
+ id: "entry-3",
386
+ name: "API Reference",
387
+ createdBy: "John Doe",
388
+ lastModified: "1 week ago",
389
+ status: "Published"
390
+ }
388
391
  ];
389
392
 
390
393
  const WithStickyHeaderDataTableExample = () => {
@@ -396,6 +399,7 @@ const WithStickyHeaderDataTableExample = () => {
396
399
  stickyHeader={true}
397
400
  />
398
401
  );
402
+
399
403
  };
400
404
 
401
405
  export default WithStickyHeaderDataTableExample;
@@ -410,60 +414,60 @@ import { DataTable, DataTableColumns, DataTableSorting } from "@webiny/admin-ui"
410
414
 
411
415
  // Define the data structure
412
416
  interface Entry {
413
- id: string;
414
- name: string;
415
- createdBy: string;
416
- lastModified: string;
417
- status: string;
418
- $selectable?: boolean;
417
+ id: string;
418
+ name: string;
419
+ createdBy: string;
420
+ lastModified: string;
421
+ status: string;
422
+ $selectable?: boolean;
419
423
  }
420
424
 
421
425
  // Define the columns structure
422
426
  const columns: DataTableColumns\<Entry\> = {
423
- name: {
424
- header: "Title",
425
- enableSorting: true
426
- },
427
- createdBy: {
428
- header: "Author"
429
- },
430
- lastModified: {
431
- header: "Last Modified",
432
- enableSorting: true
433
- },
434
- status: {
435
- header: "Status"
436
- }
427
+ name: {
428
+ header: "Title",
429
+ enableSorting: true
430
+ },
431
+ createdBy: {
432
+ header: "Author"
433
+ },
434
+ lastModified: {
435
+ header: "Last Modified",
436
+ enableSorting: true
437
+ },
438
+ status: {
439
+ header: "Status"
440
+ }
437
441
  };
438
442
 
439
443
  // Sample data
440
444
  const data = [
441
- {
442
- id: "entry-1",
443
- name: "Getting Started Guide",
444
- createdBy: "John Doe",
445
- lastModified: "1 hour ago",
446
- status: "Published"
447
- },
448
- {
449
- id: "entry-2",
450
- name: "User Documentation",
451
- createdBy: "Jane Smith",
452
- lastModified: "3 days ago",
453
- status: "Draft"
454
- },
455
- {
456
- id: "entry-3",
457
- name: "API Reference",
458
- createdBy: "John Doe",
459
- lastModified: "1 week ago",
460
- status: "Published"
461
- }
445
+ {
446
+ id: "entry-1",
447
+ name: "Getting Started Guide",
448
+ createdBy: "John Doe",
449
+ lastModified: "1 hour ago",
450
+ status: "Published"
451
+ },
452
+ {
453
+ id: "entry-2",
454
+ name: "User Documentation",
455
+ createdBy: "Jane Smith",
456
+ lastModified: "3 days ago",
457
+ status: "Draft"
458
+ },
459
+ {
460
+ id: "entry-3",
461
+ name: "API Reference",
462
+ createdBy: "John Doe",
463
+ lastModified: "1 week ago",
464
+ status: "Published"
465
+ }
462
466
  ];
463
467
 
464
468
  const WithSelectableRowsDataTableExample = () => {
465
- const [selectedRows, setSelectedRows] = useState\<Entry[]\>([]);
466
- const [sorting, setSorting] = useState\<DataTableSorting\>([]);
469
+ const [selectedRows, setSelectedRows] = useState\<Entry[]\>([]);
470
+ const [sorting, setSorting] = useState\<DataTableSorting\>([]);
467
471
 
468
472
  return (
469
473
  <DataTable
@@ -473,6 +477,7 @@ const WithSelectableRowsDataTableExample = () => {
473
477
  onSelectRow={rows => setSelectedRows(rows)}
474
478
  />
475
479
  );
480
+
476
481
  };
477
482
 
478
483
  export default WithSelectableRowsDataTableExample;
@@ -489,59 +494,59 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
489
494
 
490
495
  // Define the data structure
491
496
  interface Entry {
492
- id: string;
493
- name: string;
494
- createdBy: string;
495
- lastModified: string;
496
- status: string;
497
+ id: string;
498
+ name: string;
499
+ createdBy: string;
500
+ lastModified: string;
501
+ status: string;
497
502
  }
498
503
 
499
504
  // Define the columns structure
500
505
  const columns: DataTableColumns\<Entry\> = {
501
- name: {
502
- header: "Title",
503
- enableSorting: true
504
- },
505
- createdBy: {
506
- header: "Author"
507
- },
508
- lastModified: {
509
- header: "Last Modified",
510
- enableSorting: true
511
- },
512
- status: {
513
- header: "Status"
514
- }
506
+ name: {
507
+ header: "Title",
508
+ enableSorting: true
509
+ },
510
+ createdBy: {
511
+ header: "Author"
512
+ },
513
+ lastModified: {
514
+ header: "Last Modified",
515
+ enableSorting: true
516
+ },
517
+ status: {
518
+ header: "Status"
519
+ }
515
520
  };
516
521
 
517
522
  // Sample data
518
523
  const data: Entry[] = [
519
- {
520
- id: "entry-1",
521
- name: "Getting Started Guide",
522
- createdBy: "John Doe",
523
- lastModified: "1 hour ago",
524
- status: "Published"
525
- },
526
- {
527
- id: "entry-2",
528
- name: "User Documentation",
529
- createdBy: "Jane Smith",
530
- lastModified: "3 days ago",
531
- status: "Draft"
532
- },
533
- {
534
- id: "entry-3",
535
- name: "API Reference",
536
- createdBy: "John Doe",
537
- lastModified: "1 week ago",
538
- status: "Published"
539
- }
524
+ {
525
+ id: "entry-1",
526
+ name: "Getting Started Guide",
527
+ createdBy: "John Doe",
528
+ lastModified: "1 hour ago",
529
+ status: "Published"
530
+ },
531
+ {
532
+ id: "entry-2",
533
+ name: "User Documentation",
534
+ createdBy: "Jane Smith",
535
+ lastModified: "3 days ago",
536
+ status: "Draft"
537
+ },
538
+ {
539
+ id: "entry-3",
540
+ name: "API Reference",
541
+ createdBy: "John Doe",
542
+ lastModified: "1 week ago",
543
+ status: "Published"
544
+ }
540
545
  ];
541
546
 
542
547
  const WithLoadingDataTableExample = () => {
543
- const [data, setData] = useState\<Entry[]\>([]);
544
- const [loading, setLoading] = useState(true);
548
+ const [data, setData] = useState\<Entry[]\>([]);
549
+ const [loading, setLoading] = useState(true);
545
550
 
546
551
  useEffect(() => {
547
552
  const timer = setTimeout(() => {
@@ -559,6 +564,7 @@ const WithLoadingDataTableExample = () => {
559
564
  loading={loading}
560
565
  />
561
566
  );
567
+
562
568
  };
563
569
 
564
570
  export default WithLoadingDataTableExample;
@@ -570,108 +576,95 @@ export default WithLoadingDataTableExample;
570
576
  <Canvas of={DataTableStories.WithCustomCellRenderer} source={ { code: `
571
577
 
572
578
  import React, { useEffect, useState } from "react";
573
- import { DataTable, DataTableColumns, Avatar, Text } from "@webiny/admin-ui";
579
+ import { DataTable, DataTableColumns, Avatar, Text } from "@webiny/admin-ui";
574
580
 
575
581
  // Define the data structure
576
582
  interface Entry {
577
- id: string;
578
- name: string;
579
- createdBy: string;
580
- lastModified: string;
581
- status: string;
583
+ id: string;
584
+ name: string;
585
+ createdBy: string;
586
+ lastModified: string;
587
+ status: string;
582
588
  }
583
589
 
584
590
  // Define the columns structure
585
591
  const columns: DataTableColumns\<Entry\> = {
586
- name: {
587
- header: "Title",
588
- enableSorting: true
589
- },
590
- createdBy: {
591
- header: "Author"
592
- },
593
- lastModified: {
594
- header: "Last Modified",
595
- enableSorting: true
596
- },
597
- status: {
598
- header: "Status"
599
- }
592
+ name: {
593
+ header: "Title",
594
+ enableSorting: true
595
+ },
596
+ createdBy: {
597
+ header: "Author"
598
+ },
599
+ lastModified: {
600
+ header: "Last Modified",
601
+ enableSorting: true
602
+ },
603
+ status: {
604
+ header: "Status"
605
+ }
600
606
  };
601
607
 
602
608
  // Sample data
603
609
  const data: Entry[] = [
604
- {
605
- id: "entry-1",
606
- name: "Getting Started Guide",
607
- createdBy: "John Doe",
608
- lastModified: "1 hour ago",
609
- status: "Published"
610
- },
611
- {
612
- id: "entry-2",
613
- name: "User Documentation",
614
- createdBy: "Jane Smith",
615
- lastModified: "3 days ago",
616
- status: "Draft"
617
- },
618
- {
619
- id: "entry-3",
620
- name: "API Reference",
621
- createdBy: "John Doe",
622
- lastModified: "1 week ago",
623
- status: "Published"
624
- }
610
+ {
611
+ id: "entry-1",
612
+ name: "Getting Started Guide",
613
+ createdBy: "John Doe",
614
+ lastModified: "1 hour ago",
615
+ status: "Published"
616
+ },
617
+ {
618
+ id: "entry-2",
619
+ name: "User Documentation",
620
+ createdBy: "Jane Smith",
621
+ lastModified: "3 days ago",
622
+ status: "Draft"
623
+ },
624
+ {
625
+ id: "entry-3",
626
+ name: "API Reference",
627
+ createdBy: "John Doe",
628
+ lastModified: "1 week ago",
629
+ status: "Published"
630
+ }
625
631
  ];
626
632
 
627
633
  const WithCustomCellRendererDataTableExample = () => {
628
- return (
629
- <DataTable
630
- columns={{
631
- ...columns,
632
- name: {
633
- ...columns.name,
634
- cell: (entry) => {
635
- return (
636
- <div className={"flex items-center gap-sm-extra"}>
637
- <Avatar
638
- image={
639
- <Avatar.Image
640
- src="https://github.com/webiny-bot.png"
641
- alt="@webiny"
642
- />
643
- }
644
- fallback={<Avatar.Fallback>{entry.name.charAt(0)}</Avatar.Fallback>}
645
- size={"xl"}
646
- />
647
- <div>
648
- <Text
649
- className={"text-neutral-primary font-semibold"}
650
- as={"div"}
651
- >
652
- {entry.name}
653
- </Text>
654
- <Text
655
- size={"sm"}
656
- className={"text-neutral-strong"}
657
- as={"div"}
658
- >Last updated: {entry.lastModified}</Text>
659
- </div>
660
- </div>
661
- );
662
- }
663
- }
664
- }}
665
- data={data}
666
- />
667
- );
668
- };
634
+ return (
669
635
 
636
+ <DataTable
637
+ columns={{
638
+ ...columns,
639
+ name: {
640
+ ...columns.name,
641
+ cell: entry => {
642
+ return (
643
+ <div className={"flex items-center gap-sm-extra"}>
644
+ <Avatar
645
+ image={<Avatar.Image src="https://github.com/webiny-bot.png" alt="@webiny" />}
646
+ fallback={<Avatar.Fallback>{entry.name.charAt(0)}</Avatar.Fallback>}
647
+ size={"xl"}
648
+ />
649
+ <div>
650
+ <Text className={"text-neutral-primary font-semibold"} as={"div"}>
651
+ {entry.name}
652
+ </Text>
653
+ <Text size={"sm"} className={"text-neutral-strong"} as={"div"}>
654
+ Last updated: {entry.lastModified}
655
+ </Text>
656
+ </div>
657
+ </div>
658
+ );
659
+ }
660
+ }
661
+ }}
662
+ data={data}
663
+ />
664
+ ); };
670
665
 
671
666
  export default WithCustomCellRendererDataTableExample;
672
667
 
673
-
674
-
675
668
  ` } } />
676
669
 
677
670
  ### With Custom Column Size
@@ -682,70 +675,70 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
682
675
 
683
676
  // Define the data structure
684
677
  interface Entry {
685
- id: string;
686
- name: string;
687
- createdBy: string;
688
- lastModified: string;
689
- status: string;
678
+ id: string;
679
+ name: string;
680
+ createdBy: string;
681
+ lastModified: string;
682
+ status: string;
690
683
  }
691
684
 
692
685
  // Define the columns structure
693
686
  const columns: DataTableColumns\<Entry\> = {
694
- name: {
695
- header: "Title",
696
- enableSorting: true
697
- },
698
- createdBy: {
699
- header: "Author"
700
- },
701
- lastModified: {
702
- header: "Last Modified",
703
- enableSorting: true
704
- },
705
- status: {
706
- header: "Status"
707
- }
687
+ name: {
688
+ header: "Title",
689
+ enableSorting: true
690
+ },
691
+ createdBy: {
692
+ header: "Author"
693
+ },
694
+ lastModified: {
695
+ header: "Last Modified",
696
+ enableSorting: true
697
+ },
698
+ status: {
699
+ header: "Status"
700
+ }
708
701
  };
709
702
 
710
703
  // Sample data
711
704
  const data = [
712
- {
713
- id: "entry-1",
714
- name: "Getting Started Guide",
715
- createdBy: "John Doe",
716
- lastModified: "1 hour ago",
717
- status: "Published"
718
- },
719
- {
720
- id: "entry-2",
721
- name: "User Documentation",
722
- createdBy: "Jane Smith",
723
- lastModified: "3 days ago",
724
- status: "Draft"
725
- },
726
- {
727
- id: "entry-3",
728
- name: "API Reference",
729
- createdBy: "John Doe",
730
- lastModified: "1 week ago",
731
- status: "Published"
732
- }
705
+ {
706
+ id: "entry-1",
707
+ name: "Getting Started Guide",
708
+ createdBy: "John Doe",
709
+ lastModified: "1 hour ago",
710
+ status: "Published"
711
+ },
712
+ {
713
+ id: "entry-2",
714
+ name: "User Documentation",
715
+ createdBy: "Jane Smith",
716
+ lastModified: "3 days ago",
717
+ status: "Draft"
718
+ },
719
+ {
720
+ id: "entry-3",
721
+ name: "API Reference",
722
+ createdBy: "John Doe",
723
+ lastModified: "1 week ago",
724
+ status: "Published"
725
+ }
733
726
  ];
734
727
 
735
728
  const WithCustomColumnSizeDataTableExample = () => {
736
- return (
737
- <DataTable
738
- columns={{
739
- ...columns,
740
- name: {
741
- ...columns.name,
742
- size: 200
743
- }
744
- }}
745
- data={data}
746
- />
747
- );
748
- };
729
+ return (
730
+
731
+ <DataTable
732
+ columns={{
733
+ ...columns,
734
+ name: {
735
+ ...columns.name,
736
+ size: 200
737
+ }
738
+ }}
739
+ data={data}
740
+ />
741
+ ); };
749
742
 
750
743
  export default WithCustomColumnSize;
751
744
  ` } } />
@@ -758,54 +751,54 @@ import { DataTable, DataTableColumns } from "@webiny/admin-ui";
758
751
 
759
752
  // Define the data structure
760
753
  interface Entry {
761
- id: string;
762
- name: string;
763
- createdBy: string;
764
- lastModified: string;
765
- status: string;
754
+ id: string;
755
+ name: string;
756
+ createdBy: string;
757
+ lastModified: string;
758
+ status: string;
766
759
  }
767
760
 
768
761
  // Define the columns structure
769
762
  const columns: DataTableColumns\<Entry\> = {
770
- name: {
771
- header: "Title",
772
- enableSorting: true
773
- },
774
- createdBy: {
775
- header: "Author"
776
- },
777
- lastModified: {
778
- header: "Last Modified",
779
- enableSorting: true
780
- },
781
- status: {
782
- header: "Status"
783
- }
763
+ name: {
764
+ header: "Title",
765
+ enableSorting: true
766
+ },
767
+ createdBy: {
768
+ header: "Author"
769
+ },
770
+ lastModified: {
771
+ header: "Last Modified",
772
+ enableSorting: true
773
+ },
774
+ status: {
775
+ header: "Status"
776
+ }
784
777
  };
785
778
 
786
779
  // Sample data
787
780
  const data = [
788
- {
789
- id: "entry-1",
790
- name: "Getting Started Guide",
791
- createdBy: "John Doe",
792
- lastModified: "1 hour ago",
793
- status: "Published"
794
- },
795
- {
796
- id: "entry-2",
797
- name: "User Documentation",
798
- createdBy: "Jane Smith",
799
- lastModified: "3 days ago",
800
- status: "Draft"
801
- },
802
- {
803
- id: "entry-3",
804
- name: "API Reference",
805
- createdBy: "John Doe",
806
- lastModified: "1 week ago",
807
- status: "Published"
808
- }
781
+ {
782
+ id: "entry-1",
783
+ name: "Getting Started Guide",
784
+ createdBy: "John Doe",
785
+ lastModified: "1 hour ago",
786
+ status: "Published"
787
+ },
788
+ {
789
+ id: "entry-2",
790
+ name: "User Documentation",
791
+ createdBy: "Jane Smith",
792
+ lastModified: "3 days ago",
793
+ status: "Draft"
794
+ },
795
+ {
796
+ id: "entry-3",
797
+ name: "API Reference",
798
+ createdBy: "John Doe",
799
+ lastModified: "1 week ago",
800
+ status: "Published"
801
+ }
809
802
  ];
810
803
 
811
804
  const WithCustomColumnClassNameDataTableExample = () => {
@@ -826,6 +819,7 @@ const WithCustomColumnClassNameDataTableExample = () => {
826
819
  data={data}
827
820
  />
828
821
  );
822
+
829
823
  };
830
824
 
831
825
  export default WithCustomColumnClassNameDataTableExample;
@@ -834,8 +828,8 @@ export default WithCustomColumnClassNameDataTableExample;
834
828
  ### With Sorting
835
829
 
836
830
  > ⚠️ Webiny’s DataTable component doesn’t perform sorting for you.
837
- It only provides UI state (like sort indicators, sort direction, column clicked).
838
- You need to sort the data manually based on the sorting state.
831
+ > It only provides UI state (like sort indicators, sort direction, column clicked).
832
+ > You need to sort the data manually based on the sorting state.
839
833
 
840
834
  <Canvas of={DataTableStories.WithSorting} source={ { code: `
841
835
 
@@ -844,63 +838,63 @@ import { DataTable, DataTableColumns, DataTableSorting } from "@webiny/admin-ui"
844
838
 
845
839
  // Define the data structure
846
840
  interface Entry {
847
- id: string;
848
- name: string;
849
- createdBy: string;
850
- lastModified: string;
851
- status: string;
841
+ id: string;
842
+ name: string;
843
+ createdBy: string;
844
+ lastModified: string;
845
+ status: string;
852
846
  }
853
847
 
854
848
  // Define the columns structure
855
849
  const columns: DataTableColumns<Entry> = {
856
- name: {
857
- header: "Title",
858
- enableSorting: true
859
- },
860
- createdBy: {
861
- header: "Author"
862
- },
863
- lastModified: {
864
- header: "Last Modified",
865
- enableSorting: true
866
- },
867
- status: {
868
- header: "Status"
869
- }
850
+ name: {
851
+ header: "Title",
852
+ enableSorting: true
853
+ },
854
+ createdBy: {
855
+ header: "Author"
856
+ },
857
+ lastModified: {
858
+ header: "Last Modified",
859
+ enableSorting: true
860
+ },
861
+ status: {
862
+ header: "Status"
863
+ }
870
864
  };
871
865
 
872
866
  // Sample data
873
867
  const data: Entry[] = [
874
- {
875
- id: "entry-1",
876
- name: "Getting Started Guide",
877
- createdBy: "John Doe",
878
- lastModified: "1 hour ago",
879
- status: "Published"
880
- },
881
- {
882
- id: "entry-2",
883
- name: "User Documentation",
884
- createdBy: "Jane Smith",
885
- lastModified: "3 days ago",
886
- status: "Draft"
887
- },
888
- {
889
- id: "entry-3",
890
- name: "API Reference",
891
- createdBy: "John Doe",
892
- lastModified: "1 week ago",
893
- status: "Published"
894
- }
868
+ {
869
+ id: "entry-1",
870
+ name: "Getting Started Guide",
871
+ createdBy: "John Doe",
872
+ lastModified: "1 hour ago",
873
+ status: "Published"
874
+ },
875
+ {
876
+ id: "entry-2",
877
+ name: "User Documentation",
878
+ createdBy: "Jane Smith",
879
+ lastModified: "3 days ago",
880
+ status: "Draft"
881
+ },
882
+ {
883
+ id: "entry-3",
884
+ name: "API Reference",
885
+ createdBy: "John Doe",
886
+ lastModified: "1 week ago",
887
+ status: "Published"
888
+ }
895
889
  ];
896
890
 
897
891
  const WithSortingDataTableExample = () => {
898
- const [sorting, setSorting] = useState<DataTableSorting>([
899
- {
900
- id: "lastModified",
901
- desc: true
902
- }
903
- ]);
892
+ const [sorting, setSorting] = useState<DataTableSorting>([
893
+ {
894
+ id: "lastModified",
895
+ desc: true
896
+ }
897
+ ]);
904
898
 
905
899
  return (
906
900
  <DataTable
@@ -910,6 +904,7 @@ const WithSortingDataTableExample = () => {
910
904
  onSortingChange={setSorting}
911
905
  />
912
906
  );
907
+
913
908
  };
914
909
 
915
910
  export default WithSortingDataTableExample;