@qoretechnologies/reqore 0.36.0 → 0.36.2

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 (211) hide show
  1. package/__tests__/collection.test.tsx +1 -22
  2. package/__tests__/table.test.tsx +1 -1
  3. package/__tests__/tree.test.tsx +0 -18
  4. package/dist/components/Breadcrumbs/index.js +1 -1
  5. package/dist/components/Breadcrumbs/index.js.map +1 -1
  6. package/dist/components/Button/index.d.ts +1 -4
  7. package/dist/components/Button/index.d.ts.map +1 -1
  8. package/dist/components/Button/index.js +11 -26
  9. package/dist/components/Button/index.js.map +1 -1
  10. package/dist/components/Collection/index.d.ts +2 -2
  11. package/dist/components/Collection/index.d.ts.map +1 -1
  12. package/dist/components/Collection/index.js +10 -10
  13. package/dist/components/Collection/index.js.map +1 -1
  14. package/dist/components/Collection/item.d.ts +3 -3
  15. package/dist/components/Collection/item.d.ts.map +1 -1
  16. package/dist/components/Collection/item.js.map +1 -1
  17. package/dist/components/Columns/index.d.ts +1 -1
  18. package/dist/components/Columns/index.d.ts.map +1 -1
  19. package/dist/components/Comment/index.d.ts +1 -1
  20. package/dist/components/Comment/index.d.ts.map +1 -1
  21. package/dist/components/CommentFeed/index.d.ts +1 -1
  22. package/dist/components/CommentFeed/index.d.ts.map +1 -1
  23. package/dist/components/ControlGroup/index.d.ts +1 -1
  24. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  25. package/dist/components/Dropdown/index.d.ts +1 -1
  26. package/dist/components/Dropdown/index.d.ts.map +1 -1
  27. package/dist/components/Dropdown/item.d.ts +2 -2
  28. package/dist/components/Dropdown/item.d.ts.map +1 -1
  29. package/dist/components/Dropdown/list.d.ts +1 -1
  30. package/dist/components/Dropdown/list.d.ts.map +1 -1
  31. package/dist/components/Effect/index.d.ts +2 -2
  32. package/dist/components/Effect/index.d.ts.map +1 -1
  33. package/dist/components/ExportModal/index.d.ts +11 -0
  34. package/dist/components/ExportModal/index.d.ts.map +1 -0
  35. package/dist/components/ExportModal/index.js +91 -0
  36. package/dist/components/ExportModal/index.js.map +1 -0
  37. package/dist/components/Header/index.d.ts +7 -7
  38. package/dist/components/Header/index.d.ts.map +1 -1
  39. package/dist/components/InputClearButton/index.d.ts +1 -0
  40. package/dist/components/InputClearButton/index.d.ts.map +1 -1
  41. package/dist/components/InternalPopover/index.js +2 -2
  42. package/dist/components/InternalPopover/index.js.map +1 -1
  43. package/dist/components/KeyValueTable/index.d.ts +7 -4
  44. package/dist/components/KeyValueTable/index.d.ts.map +1 -1
  45. package/dist/components/KeyValueTable/index.js +32 -2
  46. package/dist/components/KeyValueTable/index.js.map +1 -1
  47. package/dist/components/Layout/content.d.ts +1 -1
  48. package/dist/components/Layout/content.d.ts.map +1 -1
  49. package/dist/components/Layout/index.d.ts +1 -1
  50. package/dist/components/Layout/index.d.ts.map +1 -1
  51. package/dist/components/Menu/item.d.ts +1 -1
  52. package/dist/components/Menu/item.d.ts.map +1 -1
  53. package/dist/components/Menu/item.js +3 -3
  54. package/dist/components/Menu/item.js.map +1 -1
  55. package/dist/components/Message/index.d.ts +1 -0
  56. package/dist/components/Message/index.d.ts.map +1 -1
  57. package/dist/components/Message/index.js.map +1 -1
  58. package/dist/components/Modal/index.d.ts +1 -1
  59. package/dist/components/Modal/index.d.ts.map +1 -1
  60. package/dist/components/MultiSelect/index.d.ts +2 -2
  61. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  62. package/dist/components/Notifications/notification.d.ts +1 -0
  63. package/dist/components/Notifications/notification.d.ts.map +1 -1
  64. package/dist/components/Notifications/notification.js +23 -16
  65. package/dist/components/Notifications/notification.js.map +1 -1
  66. package/dist/components/Paging/index.d.ts +1 -1
  67. package/dist/components/Paging/index.d.ts.map +1 -1
  68. package/dist/components/Panel/NonResponsiveActions.d.ts +1 -1
  69. package/dist/components/Panel/NonResponsiveActions.d.ts.map +1 -1
  70. package/dist/components/Panel/index.js +1 -1
  71. package/dist/components/Panel/index.js.map +1 -1
  72. package/dist/components/Panel/panel.screenshot.d.ts +1 -1
  73. package/dist/components/Panel/panel.screenshot.d.ts.map +1 -1
  74. package/dist/components/Paragraph/index.d.ts +1 -1
  75. package/dist/components/Paragraph/index.d.ts.map +1 -1
  76. package/dist/components/Popover/index.d.ts +1 -1
  77. package/dist/components/Popover/index.d.ts.map +1 -1
  78. package/dist/components/Popover/index.js +2 -0
  79. package/dist/components/Popover/index.js.map +1 -1
  80. package/dist/components/RadioGroup/index.d.ts +1 -1
  81. package/dist/components/RadioGroup/index.d.ts.map +1 -1
  82. package/dist/components/Sidebar/item.d.ts +1 -1
  83. package/dist/components/Sidebar/item.d.ts.map +1 -1
  84. package/dist/components/Spacer/index.d.ts +3 -3
  85. package/dist/components/Spacer/index.d.ts.map +1 -1
  86. package/dist/components/Spinner/index.d.ts +1 -1
  87. package/dist/components/Spinner/index.d.ts.map +1 -1
  88. package/dist/components/Table/body.d.ts +1 -1
  89. package/dist/components/Table/body.d.ts.map +1 -1
  90. package/dist/components/Table/body.js +26 -21
  91. package/dist/components/Table/body.js.map +1 -1
  92. package/dist/components/Table/cell.d.ts +3 -2
  93. package/dist/components/Table/cell.d.ts.map +1 -1
  94. package/dist/components/Table/cell.js +8 -4
  95. package/dist/components/Table/cell.js.map +1 -1
  96. package/dist/components/Table/headerCell.d.ts +1 -1
  97. package/dist/components/Table/headerCell.d.ts.map +1 -1
  98. package/dist/components/Table/helpers.d.ts +8 -6
  99. package/dist/components/Table/helpers.d.ts.map +1 -1
  100. package/dist/components/Table/helpers.js +49 -16
  101. package/dist/components/Table/helpers.js.map +1 -1
  102. package/dist/components/Table/index.d.ts +5 -4
  103. package/dist/components/Table/index.d.ts.map +1 -1
  104. package/dist/components/Table/index.js +47 -38
  105. package/dist/components/Table/index.js.map +1 -1
  106. package/dist/components/Table/row.d.ts +7 -5
  107. package/dist/components/Table/row.d.ts.map +1 -1
  108. package/dist/components/Table/row.js +38 -36
  109. package/dist/components/Table/row.js.map +1 -1
  110. package/dist/components/Table/value.d.ts +1 -1
  111. package/dist/components/Table/value.d.ts.map +1 -1
  112. package/dist/components/Tabs/content.d.ts +1 -1
  113. package/dist/components/Tabs/content.d.ts.map +1 -1
  114. package/dist/components/Tabs/index.d.ts +1 -1
  115. package/dist/components/Tabs/index.d.ts.map +1 -1
  116. package/dist/components/Tabs/list.d.ts +1 -1
  117. package/dist/components/Tabs/list.d.ts.map +1 -1
  118. package/dist/components/Tabs/list.js +1 -1
  119. package/dist/components/Tabs/list.js.map +1 -1
  120. package/dist/components/Tag/group.d.ts +1 -1
  121. package/dist/components/Tag/group.d.ts.map +1 -1
  122. package/dist/components/Tree/index.d.ts +2 -1
  123. package/dist/components/Tree/index.d.ts.map +1 -1
  124. package/dist/components/Tree/index.js +35 -31
  125. package/dist/components/Tree/index.js.map +1 -1
  126. package/dist/constants/sizes.js +5 -5
  127. package/dist/containers/Paging.d.ts +1 -1
  128. package/dist/containers/Paging.d.ts.map +1 -1
  129. package/dist/containers/ThemeProvider.d.ts +1 -1
  130. package/dist/containers/ThemeProvider.d.ts.map +1 -1
  131. package/dist/helpers/utils.d.ts +2 -1
  132. package/dist/helpers/utils.d.ts.map +1 -1
  133. package/dist/helpers/utils.js +20 -2
  134. package/dist/helpers/utils.js.map +1 -1
  135. package/dist/hooks/useAutoFocus.d.ts +1 -1
  136. package/dist/hooks/useAutoFocus.d.ts.map +1 -1
  137. package/dist/hooks/usePopover.d.ts +1 -0
  138. package/dist/hooks/usePopover.d.ts.map +1 -1
  139. package/dist/index.d.ts +1 -1
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js.map +1 -1
  142. package/dist/styles.d.ts +3 -0
  143. package/dist/styles.d.ts.map +1 -1
  144. package/dist/styles.js +49 -11
  145. package/dist/styles.js.map +1 -1
  146. package/migration-storybook.log +88 -0
  147. package/package.json +26 -20
  148. package/src/components/Breadcrumbs/index.tsx +1 -1
  149. package/src/components/Button/index.tsx +3 -54
  150. package/src/components/Collection/index.tsx +18 -15
  151. package/src/components/Collection/item.tsx +2 -1
  152. package/src/components/ExportModal/index.tsx +98 -0
  153. package/src/components/InternalPopover/index.tsx +2 -2
  154. package/src/components/KeyValueTable/index.tsx +59 -11
  155. package/src/components/Menu/item.tsx +4 -4
  156. package/src/components/Message/index.tsx +1 -0
  157. package/src/components/Notifications/notification.tsx +14 -3
  158. package/src/components/Panel/index.tsx +2 -2
  159. package/src/components/Popover/index.tsx +3 -0
  160. package/src/components/Table/body.tsx +26 -20
  161. package/src/components/Table/cell.tsx +15 -4
  162. package/src/components/Table/helpers.ts +52 -21
  163. package/src/components/Table/index.tsx +119 -75
  164. package/src/components/Table/row.tsx +47 -46
  165. package/src/components/Tabs/list.tsx +1 -1
  166. package/src/components/Tree/index.tsx +82 -75
  167. package/src/constants/sizes.ts +5 -5
  168. package/src/helpers/utils.ts +10 -2
  169. package/src/hooks/useAutoFocus.ts +1 -1
  170. package/src/index.tsx +1 -1
  171. package/src/mock/tableData.ts +12 -0
  172. package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +11 -23
  173. package/src/stories/Button/Button.stories.tsx +83 -47
  174. package/src/stories/Checkbox/Checkbox.stories.tsx +19 -9
  175. package/src/stories/Collection/Collection.stories.tsx +195 -171
  176. package/src/stories/Columns/Columns.stories.tsx +38 -24
  177. package/src/stories/Comment/Comment.stories.tsx +15 -6
  178. package/src/stories/ControlGroup/ControlGroup.stories.tsx +102 -48
  179. package/src/stories/Drawer/Drawer.stories.tsx +52 -17
  180. package/src/stories/Dropdown/Dropdown.stories.tsx +184 -152
  181. package/src/stories/ExportModal/ExportModal.stories.tsx +18 -0
  182. package/src/stories/Header/Header.stories.tsx +65 -31
  183. package/src/stories/Icon/Icon.stories.tsx +139 -133
  184. package/src/stories/Input/Input.stories.tsx +68 -31
  185. package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +183 -117
  186. package/src/stories/Menu/Menu.stories.tsx +56 -20
  187. package/src/stories/Message/Message.stories.tsx +96 -37
  188. package/src/stories/Modal/Modal.stories.tsx +28 -8
  189. package/src/stories/MultiSelect/MultiSelect.stories.tsx +66 -35
  190. package/src/stories/Navbar/Navbar.stories.tsx +15 -5
  191. package/src/stories/Notifications/Interactive.stories.tsx +40 -28
  192. package/src/stories/Notifications/Notification.stories.tsx +55 -41
  193. package/src/stories/Notifications/Notifications.stories.tsx +45 -29
  194. package/src/stories/Paging/Paging.stories.tsx +206 -177
  195. package/src/stories/Panel/Panel.stories.tsx +238 -168
  196. package/src/stories/Paragraph/Paragraph.stories.tsx +66 -31
  197. package/src/stories/Popover/Popover.stories.tsx +62 -40
  198. package/src/stories/RadioGroup/RadioGroup.stories.tsx +41 -19
  199. package/src/stories/Sidebar/Sidebar.stories.tsx +29 -10
  200. package/src/stories/Spacer/Spacer.stories.tsx +13 -5
  201. package/src/stories/Spinner/Spinner.stories.tsx +26 -12
  202. package/src/stories/Table/Table.stories.tsx +200 -144
  203. package/src/stories/Table/Tests.stories.tsx +9 -0
  204. package/src/stories/Tabs/Tabs.stories.tsx +82 -46
  205. package/src/stories/Tag/Tag.stories.tsx +56 -37
  206. package/src/stories/Tag/TagGroup.stories.tsx +297 -0
  207. package/src/stories/TextArea/TextArea.stories.tsx +82 -40
  208. package/src/stories/Tree/Tree.stories.tsx +84 -22
  209. package/src/stories/utils.ts +22 -1
  210. package/src/styles.ts +55 -2
  211. package/tests.json +1 -1
@@ -1,9 +1,12 @@
1
- import { Meta, Story } from '@storybook/react/types-6-0';
1
+ import { StoryObj } from '@storybook/react';
2
+ import { fireEvent, waitFor, within } from '@storybook/testing-library';
2
3
  import { StyledEffect } from '../../components/Effect';
3
4
  import { IReqoreTableColumn, IReqoreTableProps, IReqoreTableRowData } from '../../components/Table';
4
5
  import { IReqoreCustomTableBodyCellProps } from '../../components/Table/cell';
5
6
  import { IReqoreCustomHeaderCellProps } from '../../components/Table/header';
7
+ import { IReqoreCustomTableRowProps } from '../../components/Table/row';
6
8
  import { TReqorePaginationType } from '../../constants/paging';
9
+ import { sleep } from '../../helpers/utils';
7
10
  import {
8
11
  ReqoreH3,
9
12
  ReqoreH4,
@@ -14,6 +17,7 @@ import {
14
17
  ReqoreTag,
15
18
  } from '../../index';
16
19
  import tableData from '../../mock/tableData';
20
+ import { StoryMeta } from '../utils';
17
21
  import { CustomIntentArg, FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
18
22
 
19
23
  const { createArg } = argManager<IReqoreTableProps>();
@@ -191,7 +195,7 @@ const defaultColumns: IReqoreTableColumn[] = [
191
195
  },
192
196
  ];
193
197
 
194
- const defaultColumnsWithFilters = defaultColumns.map((column, index) => {
198
+ const defaultColumnsWithFilters: IReqoreTableColumn[] = defaultColumns.map((column, index) => {
195
199
  if (index === 4) {
196
200
  return {
197
201
  ...column,
@@ -215,71 +219,85 @@ const defaultColumnsWithFilters = defaultColumns.map((column, index) => {
215
219
  return column;
216
220
  });
217
221
 
218
- const defaultColumnsWithHiddenColumns = defaultColumns.map((column, index) => {
219
- if (index === 4) {
220
- return {
221
- ...column,
222
- header: {
223
- ...column.header,
224
- columns: column.header.columns.map((subColumn, subIndex) =>
225
- subIndex === 0
226
- ? {
227
- ...subColumn,
228
- show: false,
229
- }
230
- : subColumn
231
- ),
232
- },
233
- };
234
- }
235
-
236
- if (index === 2) {
237
- return {
238
- ...column,
239
- show: false,
240
- };
241
- }
222
+ const defaultColumnsWithHiddenColumns: IReqoreTableColumn[] = defaultColumns.map(
223
+ (column, index) => {
224
+ if (index === 4) {
225
+ return {
226
+ ...column,
227
+ header: {
228
+ ...column.header,
229
+ columns: column.header.columns.map((subColumn, subIndex) =>
230
+ subIndex === 0
231
+ ? {
232
+ ...subColumn,
233
+ show: false,
234
+ }
235
+ : subColumn
236
+ ),
237
+ },
238
+ };
239
+ }
242
240
 
243
- return column;
244
- });
241
+ if (index === 2) {
242
+ return {
243
+ ...column,
244
+ show: false,
245
+ };
246
+ }
245
247
 
246
- const defaultColumnsWithPinnedColumns = defaultColumns.map((column, index) => {
247
- if (index === 0) {
248
- return {
249
- ...column,
250
- pin: 'left',
251
- };
248
+ return column;
252
249
  }
250
+ );
251
+
252
+ const defaultColumnsWithPinnedColumns: IReqoreTableColumn[] = defaultColumns.map(
253
+ (column, index) => {
254
+ if (index === 0) {
255
+ return {
256
+ ...column,
257
+ pin: 'left',
258
+ };
259
+ }
260
+
261
+ if (index === 1) {
262
+ return {
263
+ ...column,
264
+ header: {
265
+ ...column.header,
266
+ columns: column.header.columns.map((subColumn, subIndex) =>
267
+ subIndex === 1
268
+ ? {
269
+ ...subColumn,
270
+ pin: 'left',
271
+ }
272
+ : subColumn
273
+ ),
274
+ },
275
+ };
276
+ }
253
277
 
254
- if (index === 1) {
255
- return {
256
- ...column,
257
- header: {
258
- ...column.header,
259
- columns: column.header.columns.map((subColumn, subIndex) =>
260
- subIndex === 1
261
- ? {
262
- ...subColumn,
263
- pin: 'left',
264
- }
265
- : subColumn
266
- ),
267
- },
268
- };
269
- }
278
+ if (index === 3) {
279
+ return {
280
+ ...column,
281
+ pin: 'right',
282
+ };
283
+ }
270
284
 
271
- if (index === 3) {
272
- return {
273
- ...column,
274
- pin: 'right',
275
- };
285
+ return column;
276
286
  }
287
+ );
277
288
 
278
- return column;
279
- });
280
-
281
- export default {
289
+ const meta = {
282
290
  title: 'Collections/Table/Stories',
291
+ component: ReqoreTable,
292
+ args: {
293
+ columns: defaultColumns,
294
+ data: tableData.data,
295
+ height: 600,
296
+ selectToggleTooltip: 'Select this row',
297
+ fill: false,
298
+ sort: { by: 'lastName', direction: 'desc' },
299
+ label: 'Table',
300
+ },
283
301
  argTypes: {
284
302
  ...createArg('rounded', {
285
303
  type: 'boolean',
@@ -298,23 +316,19 @@ export default {
298
316
  }),
299
317
  ...createArg('columns', {
300
318
  name: 'Columns',
301
- defaultValue: defaultColumns,
302
319
  }),
303
320
  ...createArg('width', {
304
321
  type: 'number',
305
- defaultValue: undefined,
306
322
  name: 'Width',
307
323
  description: 'The width of the table',
308
324
  }),
309
325
  ...createArg('height', {
310
326
  type: 'number',
311
- defaultValue: 600,
312
327
  name: 'Height',
313
328
  description: 'The height of the table',
314
329
  }),
315
330
  ...createArg('data', {
316
331
  type: 'array',
317
- defaultValue: tableData.data as any,
318
332
  name: 'Data',
319
333
  description: 'The data to be displayed in the table',
320
334
  table: {
@@ -323,13 +337,11 @@ export default {
323
337
  }),
324
338
  ...createArg('selectToggleTooltip', {
325
339
  type: 'string',
326
- defaultValue: 'Select This Row',
327
340
  name: 'Select Toggle Tooltip',
328
341
  description: 'The tooltip of the select toggle',
329
342
  }),
330
343
  ...createArg('fill', {
331
344
  type: 'boolean',
332
- defaultValue: false,
333
345
  name: 'Fill',
334
346
  description: 'Whether the table should fill the parent',
335
347
  }),
@@ -338,113 +350,156 @@ export default {
338
350
  ...IntentArg,
339
351
  ...CustomIntentArg('selectedRowIntent'),
340
352
  },
341
- } as Meta<IReqoreTableProps>;
353
+ } as StoryMeta<typeof ReqoreTable>;
354
+
355
+ export default meta;
356
+ type Story = StoryObj<typeof meta>;
357
+
358
+ export const Basic: Story = {};
342
359
 
343
- const Template: Story<IReqoreTableProps> = (args) => {
344
- return <ReqoreTable label='Table' {...args} sort={{ by: 'lastName', direction: 'desc' }} />;
360
+ export const NoLabel: Story = {
361
+ args: {
362
+ label: undefined,
363
+ },
345
364
  };
346
365
 
347
- export const Basic = Template.bind({});
348
- export const NoLabel = Template.bind({});
349
- NoLabel.args = {
350
- label: undefined,
366
+ export const CustomWidth: Story = {
367
+ args: {
368
+ width: 400,
369
+ },
351
370
  };
352
371
 
353
- export const CustomWidth = Template.bind({});
354
- CustomWidth.args = {
355
- width: 400,
372
+ export const NotFlat: Story = {
373
+ args: {
374
+ flat: false,
375
+ },
356
376
  };
357
377
 
358
- export const NotFlat = Template.bind({});
359
- NotFlat.args = {
360
- flat: false,
378
+ export const Striped: Story = {
379
+ args: {
380
+ striped: true,
381
+ },
361
382
  };
362
- export const Striped = Template.bind({});
363
- Striped.args = {
364
- striped: true,
383
+
384
+ export const Filterable: Story = {
385
+ args: {
386
+ filterable: true,
387
+ },
365
388
  };
366
- export const Filterable = Template.bind({});
367
- Filterable.args = {
368
- filterable: true,
389
+
390
+ export const DefaultFilter: Story = {
391
+ args: {
392
+ filterable: true,
393
+ filter: 'Village',
394
+ },
369
395
  };
370
- export const DefaultFilter = Template.bind({});
371
- DefaultFilter.args = {
372
- filterable: true,
373
- filter: 'Village',
396
+
397
+ export const NoDataMessage: Story = {
398
+ args: {
399
+ filterable: true,
400
+ filter: 'asjkghakshgjkashg',
401
+ },
374
402
  };
375
403
 
376
- export const NoDataMessage = Template.bind({});
377
- NoDataMessage.args = {
378
- filterable: true,
379
- filter: 'asjkghakshgjkashg',
404
+ export const FilterableColumns: Story = {
405
+ args: {
406
+ columns: defaultColumnsWithFilters,
407
+ },
380
408
  };
381
409
 
382
- export const FilterableColumns = Template.bind({});
383
- FilterableColumns.args = {
384
- columns: defaultColumnsWithFilters,
410
+ export const AllFiltersActive: Story = {
411
+ args: {
412
+ filterable: true,
413
+ filter: 'Road',
414
+ columns: defaultColumnsWithFilters,
415
+ },
385
416
  };
386
417
 
387
- export const AllFiltersActive = Template.bind({});
388
- AllFiltersActive.args = {
389
- filterable: true,
390
- filter: 'Road',
391
- columns: defaultColumnsWithFilters,
418
+ export const HiddenColumns: Story = {
419
+ args: {
420
+ columns: defaultColumnsWithHiddenColumns,
421
+ },
392
422
  };
393
423
 
394
- export const HiddenColumns = Template.bind({});
395
- HiddenColumns.args = {
396
- columns: defaultColumnsWithHiddenColumns,
424
+ export const PinnedColumns: Story = {
425
+ args: {
426
+ columns: defaultColumnsWithPinnedColumns,
427
+ zoomable: true,
428
+ filterable: true,
429
+ },
397
430
  };
398
431
 
399
- export const PinnedColumns = Template.bind({});
400
- PinnedColumns.args = {
401
- columns: defaultColumnsWithPinnedColumns,
402
- zoomable: true,
403
- filterable: true,
432
+ export const Selectable: Story = {
433
+ args: {
434
+ selectable: true,
435
+ },
404
436
  };
405
437
 
406
- export const Selectable = Template.bind({});
407
- Selectable.args = {
408
- selectable: true,
438
+ export const PreselectedRows: Story = {
439
+ args: {
440
+ selected: ['274', '280'],
441
+ selectable: true,
442
+ },
409
443
  };
410
444
 
411
- export const PreselectedRows = Template.bind({});
412
- PreselectedRows.args = {
413
- selected: [274, 280],
414
- selectable: true,
445
+ export const Zoomable: Story = {
446
+ args: {
447
+ zoomable: true,
448
+ },
449
+ play: async ({ canvasElement }) => {
450
+ const canvas = within(canvasElement);
451
+
452
+ await sleep(1000);
453
+ await fireEvent.click(document.querySelector('.reqore-table-more'));
454
+ await waitFor(() => canvas.findAllByText('Zoom in'), { timeout: 5000 });
455
+ },
415
456
  };
416
457
 
417
- export const Zoomable = Template.bind({});
418
- Zoomable.args = {
419
- zoomable: true,
458
+ export const Exportable: Story = {
459
+ args: {
460
+ exportable: true,
461
+ filterable: true,
462
+ paging: 'buttons',
463
+ },
464
+ play: async ({ canvasElement }) => {
465
+ const canvas = within(canvasElement);
466
+
467
+ await sleep(1000);
468
+ await fireEvent.click(document.querySelector('.reqore-table-more'));
469
+ await waitFor(() => canvas.findAllByText('Export current view'), { timeout: 5000 });
470
+ },
420
471
  };
421
472
 
422
- export const FillParent = Template.bind({});
423
- FillParent.args = {
424
- fill: true,
473
+ export const FillParent: Story = {
474
+ args: {
475
+ fill: true,
476
+ },
425
477
  };
426
478
 
427
- export const Sizes = Template.bind({});
428
- Sizes.args = {
429
- size: 'small',
430
- filterable: true,
431
- wrapperSize: 'big',
479
+ export const Sizes: Story = {
480
+ args: {
481
+ size: 'small',
482
+ filterable: true,
483
+ wrapperSize: 'big',
484
+ },
432
485
  };
433
486
 
434
- export const DefaultPaging = Template.bind({});
435
- DefaultPaging.args = {
436
- paging: 'buttons',
487
+ export const DefaultPaging: Story = {
488
+ args: {
489
+ paging: 'buttons',
490
+ },
437
491
  };
438
492
 
439
- export const CustomPaging = Template.bind({});
440
- CustomPaging.args = {
441
- paging: {
442
- fluid: true,
443
- loadMoreLabel: 'Load more rows...',
444
- showLabels: true,
445
- infinite: true,
446
- itemsPerPage: 100,
447
- } as TReqorePaginationType<IReqoreTableRowData>,
493
+ export const CustomPaging: Story = {
494
+ args: {
495
+ paging: {
496
+ fluid: true,
497
+ loadMoreLabel: 'Load more rows...',
498
+ showLabels: true,
499
+ infinite: true,
500
+ itemsPerPage: 100,
501
+ } as TReqorePaginationType<IReqoreTableRowData>,
502
+ },
448
503
  };
449
504
 
450
505
  const CustomHeaderCell = (props: IReqoreCustomHeaderCellProps) => {
@@ -464,13 +519,14 @@ const CustomCell = (props: IReqoreCustomTableBodyCellProps) => {
464
519
  return <ReqoreP style={{ width: props.width, flexGrow: props.grow }}>{props.children}</ReqoreP>;
465
520
  };
466
521
 
467
- const CustomRow = (props: IReqoreCustomTableBodyCellProps) => {
522
+ const CustomRow = (props: IReqoreCustomTableRowProps) => {
468
523
  return <StyledEffect style={props.style}>{props.children}</StyledEffect>;
469
524
  };
470
525
 
471
- export const CustomCellsAndRows = Template.bind({});
472
- CustomCellsAndRows.args = {
473
- headerCellComponent: CustomHeaderCell,
474
- bodyCellComponent: CustomCell,
475
- rowComponent: CustomRow,
526
+ export const CustomCellsAndRows: Story = {
527
+ args: {
528
+ headerCellComponent: CustomHeaderCell,
529
+ bodyCellComponent: CustomCell,
530
+ rowComponent: CustomRow,
531
+ },
476
532
  };
@@ -0,0 +1,9 @@
1
+ import ReqoreTable from '../../components/Table';
2
+ import { StoryMeta } from '../utils';
3
+
4
+ const meta = {
5
+ title: 'Collections/Table/Tests',
6
+ component: ReqoreTable,
7
+ } as StoryMeta<typeof ReqoreTable>;
8
+
9
+ export default meta;
@@ -1,7 +1,7 @@
1
- import { Meta, Story } from '@storybook/react/types-6-0';
1
+ import { StoryFn, StoryObj } from '@storybook/react';
2
2
  import { IReqoreTabsProps } from '../../components/Tabs';
3
- import { TReqoreTabsContentPadding } from '../../components/Tabs/content';
4
3
  import { ReqoreH3, ReqoreTabs, ReqoreTabsContent } from '../../index';
4
+ import { StoryMeta } from '../utils';
5
5
  import { IntentArg, SizeArg, argManager } from '../utils/args';
6
6
 
7
7
  const tabs = [
@@ -100,47 +100,53 @@ const tabs = [
100
100
  },
101
101
  ] as IReqoreTabsProps['tabs'];
102
102
 
103
- const { createArg } = argManager<IReqoreTabsProps & { tabPadding: TReqoreTabsContentPadding }>();
103
+ const { createArg } = argManager<IReqoreTabsProps>();
104
104
 
105
- export default {
105
+ const meta = {
106
106
  title: 'Navigation/Tabs/Stories',
107
+ component: ReqoreTabs,
108
+ args: {
109
+ flat: true,
110
+ fill: false,
111
+ fillParent: false,
112
+ wrapTabNames: false,
113
+ vertical: false,
114
+ },
107
115
  argTypes: {
108
116
  ...SizeArg,
109
117
  ...IntentArg,
110
118
  ...createArg('flat', {
111
119
  type: 'boolean',
112
- defaultValue: true,
113
120
  name: 'Flat',
114
121
  description: 'Whether the tabs should be flat or not',
115
122
  }),
116
123
  ...createArg('fill', {
117
124
  type: 'boolean',
118
- defaultValue: false,
119
125
  name: 'Fill',
120
126
  description: 'If the tabs should fill the container',
121
127
  }),
122
128
  ...createArg('fillParent', {
123
129
  type: 'boolean',
124
- defaultValue: false,
125
130
  name: 'Fill Parent',
126
131
  description: 'If the tabs should fill the parent container',
127
132
  }),
128
133
  ...createArg('wrapTabNames', {
129
134
  type: 'boolean',
130
- defaultValue: false,
131
135
  name: 'Wrap Tab Names',
132
136
  description: 'If the tab names should wrap',
133
137
  }),
134
138
  ...createArg('vertical', {
135
139
  type: 'boolean',
136
- defaultValue: false,
137
140
  name: 'Vertical',
138
141
  description: 'If the tabs should be vertical',
139
142
  }),
140
143
  },
141
- } as Meta<IReqoreTabsProps & { tabPadding: TReqoreTabsContentPadding }>;
144
+ } as StoryMeta<typeof ReqoreTabs>;
145
+
146
+ export default meta;
147
+ type Story = StoryObj<typeof meta>;
142
148
 
143
- const Template: Story<IReqoreTabsProps & { tabPadding: TReqoreTabsContentPadding }> = (args) => {
149
+ const Template: StoryFn<IReqoreTabsProps> = (args) => {
144
150
  return (
145
151
  <ReqoreTabs {...args} tabs={tabs}>
146
152
  <ReqoreTabsContent tabId='tab1'>
@@ -229,55 +235,85 @@ const Template: Story<IReqoreTabsProps & { tabPadding: TReqoreTabsContentPadding
229
235
  );
230
236
  };
231
237
 
232
- export const Basic = Template.bind({});
233
- export const Fill = Template.bind({});
234
- Fill.args = {
235
- fill: true,
238
+ export const Basic: Story = {
239
+ render: Template,
236
240
  };
237
241
 
238
- export const CustomActiveIntent = Template.bind({});
239
- CustomActiveIntent.args = {
240
- activeTabIntent: 'warning',
241
- activeTab: 'tab8',
242
+ export const Fill: Story = {
243
+ render: Template,
244
+
245
+ args: {
246
+ fill: true,
247
+ },
242
248
  };
243
249
 
244
- export const NotFlat = Template.bind({});
245
- NotFlat.args = {
246
- flat: false,
250
+ export const CustomActiveIntent: Story = {
251
+ render: Template,
252
+
253
+ args: {
254
+ activeTabIntent: 'warning',
255
+ activeTab: 'tab8',
256
+ },
247
257
  };
248
258
 
249
- export const NoTabsPadding = Template.bind({});
250
- NoTabsPadding.args = {
251
- padded: false,
259
+ export const NotFlat: Story = {
260
+ render: Template,
261
+
262
+ args: {
263
+ flat: false,
264
+ },
252
265
  };
253
266
 
254
- export const Vertical = Template.bind({});
255
- Vertical.args = {
256
- vertical: true,
257
- fillParent: true,
267
+ export const NoTabsPadding: Story = {
268
+ render: Template,
269
+
270
+ args: {
271
+ padded: false,
272
+ },
258
273
  };
259
274
 
260
- export const VerticalNoTabsPadding = Template.bind({});
261
- VerticalNoTabsPadding.args = {
262
- padded: false,
263
- vertical: true,
275
+ export const Vertical: Story = {
276
+ render: Template,
277
+
278
+ args: {
279
+ vertical: true,
280
+ fillParent: true,
281
+ },
264
282
  };
265
283
 
266
- export const VerticalWithWrapping = Template.bind({});
267
- VerticalWithWrapping.args = {
268
- vertical: true,
269
- fillParent: true,
270
- wrapTabNames: true,
284
+ export const VerticalNoTabsPadding: Story = {
285
+ render: Template,
286
+
287
+ args: {
288
+ padded: false,
289
+ vertical: true,
290
+ },
271
291
  };
272
292
 
273
- export const VerticalCustomWidth = Template.bind({});
274
- VerticalCustomWidth.args = {
275
- vertical: true,
276
- fillParent: true,
277
- width: '300px',
293
+ export const VerticalWithWrapping: Story = {
294
+ render: Template,
295
+
296
+ args: {
297
+ vertical: true,
298
+ fillParent: true,
299
+ wrapTabNames: true,
300
+ },
278
301
  };
279
302
 
280
- export const CustomTabsPadding = Template.bind({});
281
- CustomTabsPadding.args = {
282
- tabsPadding: 'none',
303
+ export const VerticalCustomWidth: Story = {
304
+ render: Template,
305
+
306
+ args: {
307
+ vertical: true,
308
+ fillParent: true,
309
+ width: '300px',
310
+ },
311
+ };
312
+
313
+ export const CustomTabsPadding: Story = {
314
+ render: Template,
315
+
316
+ args: {
317
+ tabsPadding: 'none',
318
+ },
283
319
  };