@indico-data/design-system 2.2.0 → 2.3.1

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/.yarn/sdks/eslint/bin/eslint.js +8 -1
  2. package/.yarn/sdks/eslint/package.json +1 -1
  3. package/.yarn/sdks/prettier/bin/prettier.cjs +8 -1
  4. package/.yarn/sdks/prettier/index.cjs +8 -1
  5. package/.yarn/sdks/typescript/bin/tsc +8 -1
  6. package/.yarn/sdks/typescript/bin/tsserver +8 -1
  7. package/.yarn/sdks/typescript/package.json +1 -1
  8. package/.yarnrc.yml +1 -0
  9. package/lib/index.css +141 -101
  10. package/lib/index.d.ts +973 -14
  11. package/lib/index.esm.css +141 -101
  12. package/lib/index.esm.js +25974 -27484
  13. package/lib/index.esm.js.map +1 -1
  14. package/lib/index.js +26265 -27775
  15. package/lib/index.js.map +1 -1
  16. package/lib/src/components/button/Button.stories.d.ts +1 -1
  17. package/lib/src/components/button/types.d.ts +0 -1
  18. package/lib/src/components/grid/col/Col.stories.d.ts +1 -2
  19. package/lib/src/components/grid/container/Container.stories.d.ts +1 -1
  20. package/lib/src/components/grid/row/Row.stories.d.ts +1 -1
  21. package/lib/src/components/index.d.ts +1 -0
  22. package/lib/src/components/table/LoadingComponent.d.ts +1 -0
  23. package/lib/src/components/table/Table.d.ts +78 -0
  24. package/lib/src/components/table/Table.stories.d.ts +6 -0
  25. package/lib/src/components/table/index.d.ts +1 -0
  26. package/lib/src/components/table/sampleData.d.ts +8 -0
  27. package/lib/src/index.d.ts +2 -1
  28. package/lib/src/legacy/components/Accordion/Accordion.stories.d.ts +9 -9
  29. package/lib/src/legacy/components/Accordion/Accordion.styles.d.ts +1 -2
  30. package/lib/src/legacy/components/ListTable/Header/Header.styles.d.ts +1 -2
  31. package/lib/src/legacy/components/ListTable/ListTable.stories.d.ts +7 -7
  32. package/lib/src/legacy/components/ListTable/ListTable.styles.d.ts +1 -2
  33. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +2 -2
  34. package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +2 -3
  35. package/lib/src/legacy/components/Pagination/Pagination.styles.d.ts +1 -2
  36. package/lib/src/legacy/components/Toggle/Toggle.d.ts +1 -2
  37. package/lib/src/legacy/components/Toggle/Toggle.stories.d.ts +4 -4
  38. package/lib/src/legacy/components/Toggle/Toggle.styles.d.ts +1 -2
  39. package/lib/src/legacy/components/Tooltip/Tooltip.styles.d.ts +1 -2
  40. package/lib/src/legacy/components/basic-section/Section/Section.stories.d.ts +1 -2
  41. package/lib/src/legacy/components/basic-section/Section/Section.styles.d.ts +1 -2
  42. package/lib/src/legacy/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -2
  43. package/lib/src/legacy/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -2
  44. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
  45. package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -2
  46. package/lib/src/legacy/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -2
  47. package/lib/src/legacy/components/buttons/Button/Button.stories.d.ts +1 -1
  48. package/lib/src/legacy/components/buttons/Button/Button.styles.d.ts +1 -2
  49. package/lib/src/legacy/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
  50. package/lib/src/legacy/components/buttons/IconButton/IconButton.styles.d.ts +4 -3
  51. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +8 -9
  52. package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -3
  53. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.d.ts +5 -5
  54. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.stories.d.ts +7 -7
  55. package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.styles.d.ts +3 -2
  56. package/lib/src/legacy/components/dropdowns/Select/Select.stories.d.ts +6 -7
  57. package/lib/src/legacy/components/dropdowns/Select/Select.styles.d.ts +1 -2
  58. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.d.ts +5 -5
  59. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.stories.d.ts +5 -6
  60. package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.styles.d.ts +3 -2
  61. package/lib/src/legacy/components/index.d.ts +0 -1
  62. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.styles.d.ts +1 -2
  63. package/lib/src/legacy/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -2
  64. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.d.ts +1 -2
  65. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +1 -2
  66. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.stories.d.ts +2 -2
  67. package/lib/src/legacy/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -2
  68. package/lib/src/legacy/components/inputs/RadioButtons/RadioButtons.styles.d.ts +5 -6
  69. package/lib/src/legacy/components/inputs/RadioGroup/RadioGroup.styles.d.ts +1 -2
  70. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.stories.d.ts +8 -9
  71. package/lib/src/legacy/components/inputs/SearchInput/SearchInput.styles.d.ts +1 -2
  72. package/lib/src/legacy/components/inputs/TextInput/TextInput.stories.d.ts +9 -9
  73. package/lib/src/legacy/components/inputs/TextInput/TextInput.styles.d.ts +2 -3
  74. package/lib/src/legacy/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -2
  75. package/lib/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +4 -5
  76. package/lib/src/legacy/components/loading-indicators/CircleSpinner/CircleSpinner.d.ts +1 -2
  77. package/lib/src/legacy/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +4 -5
  78. package/lib/src/legacy/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -2
  79. package/lib/src/legacy/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -2
  80. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +5 -5
  81. package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +1 -2
  82. package/lib/src/legacy/components/modals/ModalBase/ModalBase.styles.d.ts +1 -1
  83. package/lib/src/legacy/components/text-truncate/TextTruncate.styles.d.ts +1 -2
  84. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.stories.d.ts +11 -11
  85. package/lib/src/legacy/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -2
  86. package/lib/src/legacy/styles/globals/buttons.d.ts +0 -1
  87. package/lib/src/legacy/styles/globals/forms.d.ts +0 -1
  88. package/lib/src/legacy/styles/globals/layout.d.ts +0 -1
  89. package/lib/src/legacy/styles/globals/lists.d.ts +0 -1
  90. package/lib/src/legacy/styles/globals/margin-padding.d.ts +0 -1
  91. package/lib/src/legacy/styles/globals/media.d.ts +0 -1
  92. package/lib/src/legacy/styles/globals/tables.d.ts +0 -1
  93. package/lib/src/legacy/styles/globals/typography.d.ts +0 -1
  94. package/lib/src/legacy/styles/globals/utility-classes.d.ts +0 -1
  95. package/lib/src/types.d.ts +2 -2
  96. package/package.json +4 -2
  97. package/rollup.config.mjs +1 -1
  98. package/src/components/button/Button.mdx +1 -1
  99. package/src/components/button/Button.stories.tsx +8 -8
  100. package/src/components/button/Button.tsx +1 -1
  101. package/src/components/grid/GridSystem.mdx +0 -1
  102. package/src/components/grid/col/Col.stories.tsx +1 -2
  103. package/src/components/grid/container/Container.mdx +0 -1
  104. package/src/components/grid/container/Container.stories.tsx +1 -3
  105. package/src/components/grid/row/Row.mdx +0 -1
  106. package/src/components/grid/row/Row.stories.tsx +1 -3
  107. package/src/components/icons/Icon.mdx +1 -1
  108. package/src/components/icons/Icon.stories.tsx +2 -3
  109. package/src/components/index.ts +1 -0
  110. package/src/components/table/LoadingComponent.tsx +5 -0
  111. package/src/components/table/Table.mdx +15 -0
  112. package/src/components/table/Table.stories.tsx +547 -0
  113. package/src/components/table/Table.tsx +112 -0
  114. package/src/components/table/index.ts +1 -0
  115. package/src/components/table/sampleData.ts +162 -0
  116. package/src/components/table/styles/Table.scss +79 -0
  117. package/src/components/table/styles/_variables.scss +19 -0
  118. package/src/index.ts +1 -1
  119. package/src/legacy/components/Accordion/Accordion.tsx +1 -1
  120. package/src/legacy/components/ListTable/Header/Header.tsx +2 -4
  121. package/src/legacy/components/ListTable/ListTable.stories.tsx +1 -1
  122. package/src/legacy/components/Toggle/Toggle.tsx +2 -3
  123. package/src/legacy/components/Tooltip/Tooltip.tsx +2 -1
  124. package/src/legacy/components/basic-section/SectionTable/SectionTable.tsx +1 -1
  125. package/src/legacy/components/buttons/IconButton/IconButton.tsx +1 -1
  126. package/src/legacy/components/dropdowns/BorderSelect/BorderSelect.tsx +1 -1
  127. package/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.tsx +1 -1
  128. package/src/legacy/components/dropdowns/Select/Select.tsx +1 -1
  129. package/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.tsx +1 -1
  130. package/src/legacy/components/index.ts +0 -1
  131. package/src/legacy/components/inputs/EditableInput/EditableInput.tsx +1 -1
  132. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +2 -3
  133. package/src/legacy/components/inputs/NumberInput/NumberInput.tsx +1 -1
  134. package/src/legacy/components/inputs/SearchInput/SearchInput.stories.tsx +3 -3
  135. package/src/legacy/components/inputs/SearchInput/SearchInput.tsx +1 -1
  136. package/src/legacy/components/loading-indicators/CircleSpinner/CircleSpinner.tsx +2 -3
  137. package/src/legacy/components/user-feedback/Shrug/Shrug.tsx +1 -1
  138. package/src/styles/index.scss +2 -2
  139. package/src/types.ts +3 -5
  140. package/webpack.config.js +13 -6
  141. package/lib/src/legacy/components/Navigation/Drawer/Drawer.d.ts +0 -16
  142. package/lib/src/legacy/components/Navigation/Drawer/Drawer.stories.d.ts +0 -6
  143. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.d.ts +0 -9
  144. package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +0 -2
  145. package/lib/src/legacy/components/Navigation/Drawer/__mocks__/mocks.d.ts +0 -3
  146. package/lib/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +0 -1
  147. package/lib/src/legacy/components/Navigation/Drawer/index.d.ts +0 -1
  148. package/lib/src/legacy/components/Navigation/Drawer/types.d.ts +0 -7
  149. package/lib/src/legacy/components/Navigation/index.d.ts +0 -1
  150. package/src/legacy/components/Navigation/Drawer/Drawer.scss +0 -61
  151. package/src/legacy/components/Navigation/Drawer/Drawer.stories.tsx +0 -43
  152. package/src/legacy/components/Navigation/Drawer/Drawer.tsx +0 -107
  153. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.ts +0 -65
  154. package/src/legacy/components/Navigation/Drawer/DrawerLinkList.tsx +0 -64
  155. package/src/legacy/components/Navigation/Drawer/__mocks__/mocks.ts +0 -49
  156. package/src/legacy/components/Navigation/Drawer/__tests__/Drawer.test.tsx +0 -180
  157. package/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +0 -66
  158. package/src/legacy/components/Navigation/Drawer/index.ts +0 -1
  159. package/src/legacy/components/Navigation/Drawer/types.ts +0 -8
  160. package/src/legacy/components/Navigation/index.ts +0 -1
  161. /package/src/components/grid/{Grid.scss → styles/Grid.scss} +0 -0
@@ -0,0 +1,547 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Table } from './Table';
3
+ import { sampleData } from './sampleData';
4
+ import React from 'react';
5
+
6
+ const meta: Meta = {
7
+ title: 'Layout/Table',
8
+ component: Table,
9
+ argTypes: {
10
+ columns: {
11
+ control: false,
12
+ description: 'The columns to display in the table',
13
+ table: {
14
+ category: 'Data',
15
+ type: { summary: 'array' },
16
+ defaultValue: { summary: '[]' },
17
+ },
18
+ },
19
+ data: {
20
+ control: false,
21
+ description:
22
+ 'Its highly recommended that your data have a unique identifier (keyField). The default keyField is id. If you need to override this value then use the keyField proeprty below',
23
+ table: {
24
+ category: 'Data',
25
+ type: { summary: 'array' },
26
+ defaultValue: { summary: '[]' },
27
+ },
28
+ },
29
+ isDisabled: {
30
+ control: 'boolean',
31
+ description: 'Disables the Table section',
32
+ table: {
33
+ category: 'Styling',
34
+ type: {
35
+ summary: 'boolean',
36
+ },
37
+ defaultValue: { summary: 'false' },
38
+ },
39
+ },
40
+ isLoading: {
41
+ control: 'boolean',
42
+ description: 'It sets the loading of the table',
43
+ table: {
44
+ category: 'Styling',
45
+ type: {
46
+ summary: 'boolean',
47
+ },
48
+ defaultValue: { summary: 'false' },
49
+ },
50
+ },
51
+ direction: {
52
+ control: 'select',
53
+ options: ['auto', 'ltr', 'rtl'],
54
+ description:
55
+ 'Accepts: ltr, rtl, or auto. When set to auto (default), RDT will attempt to detect direction by checking the HTML and DIV tags. For cases where you need to force rtl, or ltr just set this option manually (i.e. SSR).',
56
+ table: {
57
+ category: 'Accessibility',
58
+ defaultValue: { summary: 'auto' },
59
+ },
60
+ },
61
+
62
+ title: {
63
+ control: 'text',
64
+ description:
65
+ 'The title displayed in the Table Header. If you do not provide the title property the Table Header will not be rendered',
66
+ table: {
67
+ category: 'Styling',
68
+ type: {
69
+ summary: 'string | React Component',
70
+ },
71
+ defaultValue: { summary: '' },
72
+ },
73
+ },
74
+ responsive: {
75
+ control: 'boolean',
76
+ description: 'Makes the table horizontally scrollable on smaller screen widths',
77
+ table: {
78
+ category: 'Accessibility',
79
+ type: {
80
+ summary: 'boolean',
81
+ },
82
+ defaultValue: { summary: 'true' },
83
+ },
84
+ },
85
+ dense: {
86
+ control: 'boolean',
87
+ description:
88
+ 'Compacts the row height. can be overridden via theming rows.denseHeight. Note: If any custom elements exceed the dense height then the row will only compact to the tallest element any of your cells',
89
+ table: {
90
+ category: 'Accessibility',
91
+ type: {
92
+ summary: 'boolean',
93
+ },
94
+ defaultValue: { summary: 'false' },
95
+ },
96
+ },
97
+ noHeader: {
98
+ control: 'boolean',
99
+ description:
100
+ 'Removes the table header. title, contextTitle and contextActions will be ignored',
101
+ table: {
102
+ category: 'Styling',
103
+ type: {
104
+ summary: 'boolean',
105
+ },
106
+ defaultValue: { summary: 'false' },
107
+ },
108
+ },
109
+ onSort: {
110
+ control: false,
111
+ description: 'Callback to access the sort state when a column is clicked. Returns',
112
+ table: {
113
+ category: 'Callbacks',
114
+ type: {
115
+ summary: '(selectedColumn, sortDirection, sortedRows) => {}',
116
+ },
117
+ defaultValue: { summary: 'false' },
118
+ },
119
+ },
120
+ subHeader: {
121
+ control: 'boolean',
122
+ description: 'Show a sub header between the table and table header',
123
+ table: {
124
+ category: 'Styling',
125
+ type: {
126
+ summary: 'boolean',
127
+ },
128
+ defaultValue: { summary: 'false' },
129
+ },
130
+ },
131
+ subHeaderComponent: {
132
+ control: false,
133
+ description: 'A component you want to render',
134
+ table: {
135
+ category: 'Components',
136
+ type: {
137
+ summary: 'React Component',
138
+ },
139
+ defaultValue: { summary: 'null' },
140
+ },
141
+ },
142
+ paginationPerPage: {
143
+ control: 'number',
144
+ description: 'The default rows per page to use when the table initially loads',
145
+ table: {
146
+ category: 'Add-Ons',
147
+ type: {
148
+ summary: 'number',
149
+ },
150
+ defaultValue: { summary: '10' },
151
+ },
152
+ },
153
+ noDataComponent: {
154
+ control: false,
155
+ description: 'A custom component to display when there are no records to display',
156
+ table: {
157
+ category: 'Components',
158
+ type: {
159
+ summary: 'string | React Component',
160
+ },
161
+ defaultValue: { summary: 'built-in' },
162
+ },
163
+ },
164
+ expandableRows: {
165
+ control: 'boolean',
166
+ description:
167
+ 'Whether to make a row expandable, if true it requires an expandableRowsComponent. It is highly recommended your data set have a unique identifier defined as the keyField for row expansion to work properly.',
168
+ table: {
169
+ category: 'Add-Ons',
170
+ type: {
171
+ summary: 'boolean',
172
+ },
173
+ defaultValue: { summary: 'false' },
174
+ },
175
+ },
176
+ clearSelectedRows: {
177
+ control: 'boolean',
178
+ description:
179
+ 'Toggling this property clears the selectedRows. If you use redux or react state you need to make sure that you pass a toggled value or the component will not update',
180
+ table: {
181
+ category: 'Styling',
182
+ type: {
183
+ summary: 'boolean',
184
+ },
185
+ defaultValue: { summary: 'false' },
186
+ },
187
+ },
188
+ pagination: {
189
+ control: 'boolean',
190
+ description:
191
+ 'Enable pagination with defaults. by default the total record set will be sliced depending on the page, rows per page. if you wish to use server side pagination then use the paginationServer property',
192
+ table: {
193
+ category: 'Add-Ons',
194
+ type: {
195
+ summary: 'boolean',
196
+ },
197
+ defaultValue: { summary: 'true' },
198
+ },
199
+ },
200
+ selectableRows: {
201
+ control: 'boolean',
202
+ description: 'Whether to show selectable checkboxes',
203
+ table: {
204
+ category: 'Add-Ons',
205
+ type: {
206
+ summary: 'boolean',
207
+ },
208
+ defaultValue: { summary: 'true' },
209
+ },
210
+ },
211
+
212
+ striped: {
213
+ control: 'boolean',
214
+ description: 'Stripe/band color the odd rows',
215
+ table: {
216
+ category: 'Accessibility',
217
+ type: {
218
+ summary: 'boolean',
219
+ },
220
+ defaultValue: { summary: 'true' },
221
+ },
222
+ },
223
+ // hidden props
224
+ onRowDoubleClicked: {
225
+ table: {
226
+ disable: true,
227
+ },
228
+ },
229
+ onRowMouseEnter: {
230
+ table: {
231
+ disable: true,
232
+ },
233
+ },
234
+ onRowMouseLeave: {
235
+ table: {
236
+ disable: true,
237
+ },
238
+ },
239
+ defaultSortFieldId: {
240
+ table: {
241
+ disable: true,
242
+ },
243
+ },
244
+ defaultSortAsc: {
245
+ table: {
246
+ disable: true,
247
+ },
248
+ },
249
+ sortIcon: {
250
+ table: {
251
+ disable: true,
252
+ },
253
+ },
254
+ sortServer: {
255
+ table: {
256
+ disable: true,
257
+ },
258
+ },
259
+ sortFunction: {
260
+ table: {
261
+ disable: true,
262
+ },
263
+ },
264
+ selectableRowsVisibleOnly: {
265
+ table: {
266
+ disable: true,
267
+ },
268
+ },
269
+ selectableRowsHighlight: {
270
+ table: {
271
+ disable: true,
272
+ },
273
+ },
274
+ selectableRowsSingle: {
275
+ table: {
276
+ disable: true,
277
+ },
278
+ },
279
+ selectableRowsNoSelectAll: {
280
+ table: {
281
+ disable: true,
282
+ },
283
+ },
284
+ selectableRowsComponent: {
285
+ table: {
286
+ disable: true,
287
+ },
288
+ },
289
+ selectableRowsComponentProps: {
290
+ table: {
291
+ disable: true,
292
+ },
293
+ },
294
+ selectableRowSelected: {
295
+ table: {
296
+ disable: true,
297
+ },
298
+ },
299
+ selectableRowDisabled: {
300
+ table: {
301
+ disable: true,
302
+ },
303
+ },
304
+ expandableIcon: {
305
+ table: {
306
+ disable: true,
307
+ },
308
+ },
309
+ expandableRowsComponent: {
310
+ table: {
311
+ disable: true,
312
+ },
313
+ },
314
+ expandableRowDisabled: {
315
+ table: {
316
+ disable: true,
317
+ },
318
+ },
319
+ expandableRowExpanded: {
320
+ table: {
321
+ disable: true,
322
+ },
323
+ },
324
+ expandableRowsComponentProps: {
325
+ table: {
326
+ disable: true,
327
+ },
328
+ },
329
+ expandOnRowClicked: {
330
+ table: {
331
+ disable: true,
332
+ },
333
+ },
334
+ expandOnRowDoubleClicked: {
335
+ table: {
336
+ disable: true,
337
+ },
338
+ },
339
+ expandableRowsHideExpander: {
340
+ table: {
341
+ disable: true,
342
+ },
343
+ },
344
+ expandableInheritConditionalStyles: {
345
+ table: {
346
+ disable: true,
347
+ },
348
+ },
349
+ paginationServer: {
350
+ table: {
351
+ disable: true,
352
+ },
353
+ },
354
+ paginationServerOptions: {
355
+ table: {
356
+ disable: true,
357
+ },
358
+ },
359
+ paginationDefaultPage: {
360
+ table: {
361
+ disable: true,
362
+ },
363
+ },
364
+ paginationComponent: {
365
+ table: {
366
+ disable: true,
367
+ },
368
+ },
369
+ paginationComponentOptions: {
370
+ table: {
371
+ disable: true,
372
+ },
373
+ },
374
+ paginationIconFirstPage: {
375
+ table: {
376
+ disable: true,
377
+ },
378
+ },
379
+ paginationIconLastPage: {
380
+ table: {
381
+ disable: true,
382
+ },
383
+ },
384
+ paginationIconNext: {
385
+ table: {
386
+ disable: true,
387
+ },
388
+ },
389
+ paginationIconPrevious: {
390
+ table: {
391
+ disable: true,
392
+ },
393
+ },
394
+ fixedHeader: {
395
+ table: {
396
+ disable: true,
397
+ },
398
+ },
399
+ fixedHeaderScrollHeight: {
400
+ table: {
401
+ disable: true,
402
+ },
403
+ },
404
+ actions: {
405
+ table: {
406
+ disable: true,
407
+ },
408
+ },
409
+ onChangeRowsPerPage: {
410
+ table: {
411
+ disable: true,
412
+ },
413
+ },
414
+ onChangePage: {
415
+ table: {
416
+ disable: true,
417
+ },
418
+ },
419
+ onSelectedRowsChange: {
420
+ table: {
421
+ disable: true,
422
+ },
423
+ },
424
+ paginationResetDefaultPage: {
425
+ table: {
426
+ disable: true,
427
+ },
428
+ },
429
+ onRowExpandToggled: {
430
+ table: {
431
+ disable: true,
432
+ },
433
+ },
434
+ paginationTotalRows: {
435
+ table: {
436
+ disable: true,
437
+ },
438
+ },
439
+ persistTableHead: {
440
+ table: {
441
+ disable: true,
442
+ },
443
+ },
444
+ highlightOnHover: {
445
+ table: {
446
+ disable: true,
447
+ },
448
+ },
449
+ pointerOnHover: {
450
+ table: {
451
+ disable: true,
452
+ },
453
+ },
454
+ keyField: {
455
+ table: {
456
+ disable: true,
457
+ },
458
+ },
459
+ paginationRowsPerPageOptions: {
460
+ table: {
461
+ disable: true,
462
+ },
463
+ },
464
+ onRowClicked: {
465
+ table: {
466
+ disable: true,
467
+ },
468
+ },
469
+ subHeaderAlign: {
470
+ table: {
471
+ disable: true,
472
+ },
473
+ },
474
+ subHeaderWrap: {
475
+ table: {
476
+ disable: true,
477
+ },
478
+ },
479
+ },
480
+ };
481
+
482
+ export default meta;
483
+
484
+ type Story = StoryObj<typeof Table>;
485
+
486
+ interface DataRow {
487
+ name: string;
488
+ class: string;
489
+ age: number;
490
+ weapon: string;
491
+ backstory: string;
492
+ favoriteMeal: string;
493
+ }
494
+
495
+ export const Default: Story = {
496
+ args: {
497
+ pagination: true,
498
+ selectableRows: true,
499
+ isDisabled: false,
500
+ isLoading: false,
501
+ direction: 'ltr',
502
+ striped: true,
503
+ subHeaderAlign: 'center',
504
+ subHeaderWrap: true,
505
+ paginationRowsPerPageOptions: [5, 10, 15, 20],
506
+ responsive: true,
507
+ title: 'Character List',
508
+ dense: true,
509
+ noHeader: false,
510
+ noDataComponent: null,
511
+ expandableRows: false,
512
+ clearSelectedRows: false,
513
+ onSort: false,
514
+ subHeader: false,
515
+ subHeaderComponent: null,
516
+ paginationPerPage: 10,
517
+ columns: [
518
+ {
519
+ name: 'Name',
520
+ selector: (row) => row.name,
521
+ },
522
+ {
523
+ name: 'Class',
524
+ selector: (row) => row.class,
525
+ },
526
+ {
527
+ name: 'Age',
528
+ selector: (row) => row.age,
529
+ sortable: true,
530
+ },
531
+ {
532
+ name: 'Weapon',
533
+ selector: (row) => row.weapon,
534
+ },
535
+ {
536
+ name: 'Backstory',
537
+ selector: (row) => row.backstory,
538
+ },
539
+ {
540
+ name: 'Favorite Meal',
541
+ selector: (row) => row.favoriteMeal,
542
+ },
543
+ ],
544
+ data: sampleData as DataRow[],
545
+ },
546
+ render: ({ ...args }) => <Table {...args} />,
547
+ };
@@ -0,0 +1,112 @@
1
+ import React from 'react';
2
+ import DataTable, { TableColumn, Direction, Alignment } from 'react-data-table-component';
3
+ import { LoadingComponent } from './LoadingComponent';
4
+
5
+ type LocalDirection = 'auto' | 'ltr' | 'rtl';
6
+ type LocalAlignment = 'left' | 'right' | 'center';
7
+ interface TableProps {
8
+ columns: TableColumn<any>[];
9
+ data: Record<string, any>[];
10
+ responsive?: boolean;
11
+ direction?: LocalDirection;
12
+ subHeaderAlign?: LocalAlignment;
13
+ subHeaderWrap?: boolean;
14
+ pagination?: boolean;
15
+ selectableRows?: boolean;
16
+ keyField?: string;
17
+ title?: string | React.ReactNode;
18
+ striped?: boolean;
19
+ highlightOnHover?: boolean;
20
+ pointerOnHover?: boolean;
21
+ dense?: boolean;
22
+ persistTableHead?: boolean;
23
+ noDataComponent?: string | React.ReactNode;
24
+ isDisabled?: boolean;
25
+ onRowClicked?: (row: Record<string, any>, event: React.MouseEvent) => void;
26
+ onRowDoubleClicked?: (row: Record<string, any>, event: React.MouseEvent) => void;
27
+ onRowMouseEnter?: (row: Record<string, any>, event: React.MouseEvent) => void;
28
+ onRowMouseLeave?: (row: Record<string, any>, event: React.MouseEvent) => void;
29
+ defaultSortFieldId?: string | number;
30
+ defaultSortAsc?: boolean;
31
+ sortIcon?: React.ReactNode;
32
+ sortServer?: boolean;
33
+ sortFunction?: any;
34
+ onSort?: any;
35
+ selectableRowsVisibleOnly?: boolean;
36
+ selectableRowsHighlight?: boolean;
37
+ selectableRowsSingle?: boolean;
38
+ selectableRowsNoSelectAll?: boolean;
39
+ selectableRowsComponent?: any;
40
+ selectableRowsComponentProps?: Record<string, any>;
41
+ clearSelectedRows?: boolean;
42
+ selectableRowSelected?: (row: Record<string, any>) => boolean;
43
+ selectableRowDisabled?: (row: Record<string, any>) => boolean;
44
+ onSelectedRowsChange?: any;
45
+ expandableRows?: boolean;
46
+ expandableIcon?: any;
47
+ expandableRowsComponent?: any;
48
+ expandableRowDisabled?: any;
49
+ expandableRowExpanded?: any;
50
+ expandableRowsComponentProps?: Record<string, any>;
51
+ expandOnRowClicked?: boolean;
52
+ expandOnRowDoubleClicked?: boolean;
53
+ expandableRowsHideExpander?: boolean;
54
+ expandableInheritConditionalStyles?: boolean;
55
+ onRowExpandToggled?: any;
56
+
57
+ paginationServer?: boolean;
58
+ paginationServerOptions?: Record<string, any>;
59
+ paginationDefaultPage?: number;
60
+ paginationResetDefaultPage?: boolean;
61
+ paginationTotalRows?: number;
62
+ paginationPerPage?: number;
63
+ paginationRowsPerPageOptions?: number[];
64
+ paginationComponent?: any;
65
+ paginationComponentOptions?: Record<string, any>;
66
+ paginationIconFirstPage?: any;
67
+ paginationIconLastPage?: any;
68
+ paginationIconNext?: any;
69
+ paginationIconPrevious?: any;
70
+ onChangePage?: any;
71
+ onChangeRowsPerPage?: any;
72
+
73
+ actions?: any;
74
+ noHeader?: boolean;
75
+ fixedHeader?: boolean;
76
+ fixedHeaderScrollHeight?: string;
77
+ subHeader?: boolean;
78
+ subHeaderComponent?: any;
79
+
80
+ isLoading?: boolean;
81
+ }
82
+
83
+ export const Table = (props: TableProps) => {
84
+ const {
85
+ responsive = true,
86
+ direction = 'auto',
87
+ keyField = 'id',
88
+ striped = true,
89
+ noDataComponent = 'built-in',
90
+ isDisabled,
91
+ isLoading,
92
+ subHeaderAlign = 'left',
93
+ ...rest
94
+ } = props;
95
+ return (
96
+ <div className="table-wrapper">
97
+ <DataTable
98
+ responsive={responsive}
99
+ direction={direction as Direction}
100
+ subHeaderAlign={subHeaderAlign as Alignment}
101
+ keyField={keyField}
102
+ striped={striped}
103
+ className={`${striped ? 'pf__table--striped' : ''}`}
104
+ disabled={isDisabled}
105
+ noDataComponent={noDataComponent}
106
+ progressPending={isLoading}
107
+ progressComponent={<LoadingComponent />}
108
+ {...rest}
109
+ />
110
+ </div>
111
+ );
112
+ };
@@ -0,0 +1 @@
1
+ export { Table } from './Table';