@arbor-education/design-system.components 0.5.5 → 0.6.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 (68) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/avatarGroup/AvatarGroup.d.ts +32 -0
  3. package/dist/components/avatarGroup/AvatarGroup.d.ts.map +1 -0
  4. package/dist/components/avatarGroup/AvatarGroup.js +37 -0
  5. package/dist/components/avatarGroup/AvatarGroup.js.map +1 -0
  6. package/dist/components/avatarGroup/AvatarGroup.stories.d.ts +14 -0
  7. package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -0
  8. package/dist/components/avatarGroup/AvatarGroup.stories.js +91 -0
  9. package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -0
  10. package/dist/components/avatarGroup/AvatarGroup.test.d.ts +2 -0
  11. package/dist/components/avatarGroup/AvatarGroup.test.d.ts.map +1 -0
  12. package/dist/components/avatarGroup/AvatarGroup.test.js +155 -0
  13. package/dist/components/avatarGroup/AvatarGroup.test.js.map +1 -0
  14. package/dist/components/avatarGroup/avatarGroupOverflow.d.ts +8 -0
  15. package/dist/components/avatarGroup/avatarGroupOverflow.d.ts.map +1 -0
  16. package/dist/components/avatarGroup/avatarGroupOverflow.js +14 -0
  17. package/dist/components/avatarGroup/avatarGroupOverflow.js.map +1 -0
  18. package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts +4 -0
  19. package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts.map +1 -0
  20. package/dist/components/avatarGroup/collectAvatarGroupChildren.js +26 -0
  21. package/dist/components/avatarGroup/collectAvatarGroupChildren.js.map +1 -0
  22. package/dist/components/avatarGroup/useAvatarGroupItems.d.ts +9 -0
  23. package/dist/components/avatarGroup/useAvatarGroupItems.d.ts.map +1 -0
  24. package/dist/components/avatarGroup/useAvatarGroupItems.js +24 -0
  25. package/dist/components/avatarGroup/useAvatarGroupItems.js.map +1 -0
  26. package/dist/components/table/Table.d.ts +1 -0
  27. package/dist/components/table/Table.d.ts.map +1 -1
  28. package/dist/components/table/Table.js +2 -0
  29. package/dist/components/table/Table.js.map +1 -1
  30. package/dist/components/table/Table.stories.d.ts.map +1 -1
  31. package/dist/components/table/Table.stories.js +447 -77
  32. package/dist/components/table/Table.stories.js.map +1 -1
  33. package/dist/components/table/Table.test.js +1 -1
  34. package/dist/components/table/Table.test.js.map +1 -1
  35. package/dist/components/table/TableSettingsDropdown.d.ts.map +1 -0
  36. package/dist/components/table/{pagination/TableSettingsDropdown.js → TableSettingsDropdown.js} +6 -6
  37. package/dist/components/table/TableSettingsDropdown.js.map +1 -0
  38. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts +2 -5
  39. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts.map +1 -1
  40. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js +7 -5
  41. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js.map +1 -1
  42. package/dist/index.css +33 -0
  43. package/dist/index.css.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -0
  47. package/dist/index.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/components/avatarGroup/AvatarGroup.stories.tsx +218 -0
  50. package/src/components/avatarGroup/AvatarGroup.test.tsx +298 -0
  51. package/src/components/avatarGroup/AvatarGroup.tsx +127 -0
  52. package/src/components/avatarGroup/avatarGroup.scss +31 -0
  53. package/src/components/avatarGroup/avatarGroupOverflow.ts +29 -0
  54. package/src/components/avatarGroup/collectAvatarGroupChildren.ts +30 -0
  55. package/src/components/avatarGroup/useAvatarGroupItems.ts +39 -0
  56. package/src/components/table/Table.stories.tsx +678 -265
  57. package/src/components/table/Table.test.tsx +1 -1
  58. package/src/components/table/Table.tsx +2 -0
  59. package/src/components/table/{pagination/TableSettingsDropdown.tsx → TableSettingsDropdown.tsx} +1 -1
  60. package/src/components/table/cellRenderers/SelectDropdownCellRenderer.tsx +42 -12
  61. package/src/global.scss +1 -1
  62. package/src/index.scss +1 -0
  63. package/src/index.ts +7 -0
  64. package/src/tokens.scss +2 -0
  65. package/tokens/json/Arbor.json +13 -1
  66. package/dist/components/table/pagination/TableSettingsDropdown.d.ts.map +0 -1
  67. package/dist/components/table/pagination/TableSettingsDropdown.js.map +0 -1
  68. /package/dist/components/table/{pagination/TableSettingsDropdown.d.ts → TableSettingsDropdown.d.ts} +0 -0
@@ -8,12 +8,12 @@ import { useState } from 'react';
8
8
  import { RowCountInfo } from './pagination/RowCountInfo';
9
9
  import { PaginationPanel } from './pagination/PaginationPanel';
10
10
  import { HideColumnsDropdown } from './HideColumnsDropdown';
11
- import { TableSettingsDropdown } from './pagination/TableSettingsDropdown';
11
+ import { TableSettingsDropdown } from './TableSettingsDropdown';
12
12
  import { ModalManager } from '../modal/modalManager/ModalManager';
13
13
  import { Modal } from '../modal/Modal';
14
14
  import { ModalUtils } from '../../utils/ModalUtils';
15
- import { BooleanFilter, doesBooleanFilterPass } from './columnFilters/BooleanFilter/BooleanFilter';
16
- import { doesTimeFilterPass, TimeFilter } from './columnFilters/TimeFilter/TimeFilter';
15
+ import { BooleanFilter, doesBooleanFilterPass, } from './columnFilters/BooleanFilter/BooleanFilter';
16
+ import { doesTimeFilterPass, TimeFilter, } from './columnFilters/TimeFilter/TimeFilter';
17
17
  const meta = {
18
18
  title: 'Components/Table',
19
19
  component: Table,
@@ -27,11 +27,56 @@ const meta = {
27
27
  },
28
28
  };
29
29
  const sampleData = [
30
- { id: 1, name: { value: 'Alice Johnson' }, email: { value: 'alice.johnson@example.com' }, role: { value: 'Developer' }, status: { value: 'Active' }, active: true, time: '2026-01-28 12:00:00', dateOfBirth: new Date(1990, 0, 1) },
31
- { id: 2, name: { value: 'Bob Smith' }, email: { value: 'bob.smith@example.com' }, role: { value: 'Designer' }, status: { value: 'Active' }, active: false, time: '2026-01-28 13:00:00', dateOfBirth: new Date(1991, 1, 2) },
32
- { id: 3, name: { value: 'Charlie Brown' }, email: { value: 'charlie.brown@example.com' }, role: { value: 'Manager' }, status: { value: 'Inactive' }, active: true, time: '2026-01-28 14:00:00', dateOfBirth: new Date(1992, 2, 3) },
33
- { id: 4, name: { value: 'Diana Prince' }, email: { value: 'diana.prince@example.com' }, role: { value: 'Developer' }, status: { value: 'Active' }, active: false, time: '2026-01-28 15:00:00', dateOfBirth: new Date(1993, 3, 4) },
34
- { id: 5, name: { value: 'Ethan Hunt' }, email: { value: 'ethan.hunt@example.com' }, role: { value: 'Analyst' }, status: { value: 'Active' }, active: false, time: '2026-01-28 16:00:00', dateOfBirth: new Date(1994, 4, 5) },
30
+ {
31
+ id: 1,
32
+ name: { value: 'Alice Johnson' },
33
+ email: { value: 'alice.johnson@example.com' },
34
+ role: { value: 'Developer' },
35
+ status: { value: 'Active' },
36
+ active: true,
37
+ time: '2026-01-28 12:00:00',
38
+ dateOfBirth: new Date(1990, 0, 1),
39
+ },
40
+ {
41
+ id: 2,
42
+ name: { value: 'Bob Smith' },
43
+ email: { value: 'bob.smith@example.com' },
44
+ role: { value: 'Designer' },
45
+ status: { value: 'Active' },
46
+ active: false,
47
+ time: '2026-01-28 13:00:00',
48
+ dateOfBirth: new Date(1991, 1, 2),
49
+ },
50
+ {
51
+ id: 3,
52
+ name: { value: 'Charlie Brown' },
53
+ email: { value: 'charlie.brown@example.com' },
54
+ role: { value: 'Manager' },
55
+ status: { value: 'Inactive' },
56
+ active: true,
57
+ time: '2026-01-28 14:00:00',
58
+ dateOfBirth: new Date(1992, 2, 3),
59
+ },
60
+ {
61
+ id: 4,
62
+ name: { value: 'Diana Prince' },
63
+ email: { value: 'diana.prince@example.com' },
64
+ role: { value: 'Developer' },
65
+ status: { value: 'Active' },
66
+ active: false,
67
+ time: '2026-01-28 15:00:00',
68
+ dateOfBirth: new Date(1993, 3, 4),
69
+ },
70
+ {
71
+ id: 5,
72
+ name: { value: 'Ethan Hunt' },
73
+ email: { value: 'ethan.hunt@example.com' },
74
+ role: { value: 'Analyst' },
75
+ status: { value: 'Active' },
76
+ active: false,
77
+ time: '2026-01-28 16:00:00',
78
+ dateOfBirth: new Date(1994, 4, 5),
79
+ },
35
80
  ];
36
81
  const defaultColDef = {
37
82
  editable: true,
@@ -45,18 +90,48 @@ const sampleColumnDefs = [
45
90
  {
46
91
  headerName: 'Details',
47
92
  children: [
48
- { field: 'name', headerTooltip: 'The name of the user', filter: 'agSetColumnFilter' },
49
- { field: 'email', headerTooltip: 'The email of the user', filter: 'agSetColumnFilter' },
50
- { field: 'role', headerTooltip: 'The role of the user', filter: 'agSetColumnFilter' },
51
- { field: 'dateOfBirth', filter: 'agDateColumnFilter', filterParams: { buttons: ['clear', 'apply'] }, headerTooltip: 'The date of birth of the user', valueFormatter: params => params.value instanceof Date ? params.value.toLocaleDateString() : params.value },
93
+ {
94
+ field: 'name',
95
+ headerTooltip: 'The name of the user',
96
+ filter: 'agSetColumnFilter',
97
+ },
98
+ {
99
+ field: 'email',
100
+ headerTooltip: 'The email of the user',
101
+ filter: 'agSetColumnFilter',
102
+ },
103
+ {
104
+ field: 'role',
105
+ headerTooltip: 'The role of the user',
106
+ filter: 'agSetColumnFilter',
107
+ },
108
+ {
109
+ field: 'dateOfBirth',
110
+ filter: 'agDateColumnFilter',
111
+ filterParams: { buttons: ['clear', 'apply'] },
112
+ headerTooltip: 'The date of birth of the user',
113
+ valueFormatter: params => params.value instanceof Date
114
+ ? params.value.toLocaleDateString()
115
+ : params.value,
116
+ },
52
117
  ],
53
118
  // Value formatters from the defaultColDef are not respected for non-string value
54
119
  // so until AG Grid fixes it we have to do it explicitly on each colDef
55
120
  valueFormatter: Table.DefaultValueFormatter,
56
121
  },
57
122
  { field: 'status', valueFormatter: Table.DefaultValueFormatter },
58
- { field: 'active', filter: { component: BooleanFilter, doesFilterPass: doesBooleanFilterPass }, cellDataType: 'boolean', editable: false },
59
- { field: 'time', filter: { component: TimeFilter, doesFilterPass: doesTimeFilterPass }, cellDataType: 'string', editable: false },
123
+ {
124
+ field: 'active',
125
+ filter: { component: BooleanFilter, doesFilterPass: doesBooleanFilterPass },
126
+ cellDataType: 'boolean',
127
+ editable: false,
128
+ },
129
+ {
130
+ field: 'time',
131
+ filter: { component: TimeFilter, doesFilterPass: doesTimeFilterPass },
132
+ cellDataType: 'string',
133
+ editable: false,
134
+ },
60
135
  ];
61
136
  const footerContent = [
62
137
  _jsx(Button, { variant: "primary", children: "Button 1" }, 0),
@@ -135,7 +210,7 @@ export const WithBulkActions = {
135
210
  parameters: {
136
211
  docs: {
137
212
  description: {
138
- story: 'The BulkActionsDropdown component is used to add bulk actions to the table. We don\'t provide any bulk actions by default, you need to pass the actions prop to the BulkActionsDropdown component.',
213
+ story: "The BulkActionsDropdown component is used to add bulk actions to the table. We don't provide any bulk actions by default, you need to pass the actions prop to the BulkActionsDropdown component.",
139
214
  },
140
215
  },
141
216
  },
@@ -147,14 +222,17 @@ export const WithBulkActions = {
147
222
  headerContent: [
148
223
  _jsx(BulkActionsDropdown, { actions: [
149
224
  {
150
- displayName: 'foo', callback: (gridApi) => {
225
+ displayName: 'foo',
226
+ callback: (gridApi) => {
151
227
  console.log('clicked on the foo action', gridApi);
152
228
  },
153
229
  },
154
230
  {
155
- displayName: 'bar', callback: (gridApi) => {
231
+ displayName: 'bar',
232
+ callback: (gridApi) => {
156
233
  console.log('clicked on the bar action', gridApi);
157
- }, disabled: true,
234
+ },
235
+ disabled: true,
158
236
  },
159
237
  ] }, 0),
160
238
  ],
@@ -228,7 +306,7 @@ export const WithClientSidePagination = {
228
306
  defaultColDef,
229
307
  domLayout: 'autoHeight',
230
308
  pagination: true,
231
- footerContent: _jsx(PaginationPanel, { availableSizes: [1, 2, 3, 4, 'All'], initialPageSize: 2 }),
309
+ footerContent: (_jsx(PaginationPanel, { availableSizes: [1, 2, 3, 4, 'All'], initialPageSize: 2 })),
232
310
  },
233
311
  };
234
312
  export const WithServerSidePagination = {
@@ -252,7 +330,10 @@ export const WithServerSidePagination = {
252
330
  const [currentPage, setCurrentPage] = useState(0);
253
331
  const [currentPageSize, setCurrentPageSize] = useState(initialPageSize);
254
332
  const splitRowDataBasedOnPageSize = (arr) => arr.length > currentPageSize
255
- ? [arr.slice(0, currentPageSize), ...splitRowDataBasedOnPageSize(arr.slice(currentPageSize))]
333
+ ? [
334
+ arr.slice(0, currentPageSize),
335
+ ...splitRowDataBasedOnPageSize(arr.slice(currentPageSize)),
336
+ ]
256
337
  : [arr];
257
338
  const pageData = splitRowDataBasedOnPageSize(sampleData);
258
339
  const data = pageData[currentPage];
@@ -262,7 +343,8 @@ export const WithServerSidePagination = {
262
343
  const sampleColumnDefsWithButtonCellRenderer = [
263
344
  {
264
345
  headerName: 'Details',
265
- children: [{
346
+ children: [
347
+ {
266
348
  field: 'name',
267
349
  headerTooltip: 'The name of the user',
268
350
  cellRenderer: 'dsButtonCellRenderer',
@@ -270,23 +352,80 @@ const sampleColumnDefsWithButtonCellRenderer = [
270
352
  supressCellFocusAndFocusFirstElement: true,
271
353
  },
272
354
  editable: false,
273
- }, {
355
+ },
356
+ {
274
357
  field: 'email',
275
358
  headerTooltip: 'The email of the user',
276
- }, {
359
+ },
360
+ {
277
361
  field: 'role',
278
362
  headerTooltip: 'The role of the user',
279
- }],
363
+ },
364
+ ],
280
365
  },
281
366
  { field: 'status' },
282
367
  ];
283
368
  const handleClick = (e) => alert(`clicked on the button ${e.currentTarget.value}`);
284
369
  const sampleDataWithButtonCellRenderer = [
285
- { id: 1, name: { children: 'Alice Johnson', value: 'Alice Johnson', onClick: handleClick }, email: 'alice.johnson@example.com', role: 'Developer', status: 'Active' },
286
- { id: 2, name: { children: 'Bob Smith', variant: 'secondary', value: 'Bob Smith', onClick: handleClick }, email: 'bob.smith@example.com', role: 'Designer', status: 'Active' },
287
- { id: 3, name: { children: 'Charlie Brown', size: 'S', value: 'Charlie Brown', onClick: handleClick }, email: 'charlie.brown@example.com', role: 'Manager', status: 'Inactive' },
288
- { id: 4, name: { children: 'Diana Prince', disabled: true, value: 'Diana Prince', onClick: handleClick }, email: 'diana.prince@example.com', role: 'Developer', status: 'Active' },
289
- { id: 5, name: { children: 'Ethan Hunt', iconLeftName: 'download', value: 'Ethan Hunt', onClick: handleClick }, email: 'ethan.hunt@example.com', role: 'Analyst', status: 'Active' },
370
+ {
371
+ id: 1,
372
+ name: {
373
+ children: 'Alice Johnson',
374
+ value: 'Alice Johnson',
375
+ onClick: handleClick,
376
+ },
377
+ email: 'alice.johnson@example.com',
378
+ role: 'Developer',
379
+ status: 'Active',
380
+ },
381
+ {
382
+ id: 2,
383
+ name: {
384
+ children: 'Bob Smith',
385
+ variant: 'secondary',
386
+ value: 'Bob Smith',
387
+ onClick: handleClick,
388
+ },
389
+ email: 'bob.smith@example.com',
390
+ role: 'Designer',
391
+ status: 'Active',
392
+ },
393
+ {
394
+ id: 3,
395
+ name: {
396
+ children: 'Charlie Brown',
397
+ size: 'S',
398
+ value: 'Charlie Brown',
399
+ onClick: handleClick,
400
+ },
401
+ email: 'charlie.brown@example.com',
402
+ role: 'Manager',
403
+ status: 'Inactive',
404
+ },
405
+ {
406
+ id: 4,
407
+ name: {
408
+ children: 'Diana Prince',
409
+ disabled: true,
410
+ value: 'Diana Prince',
411
+ onClick: handleClick,
412
+ },
413
+ email: 'diana.prince@example.com',
414
+ role: 'Developer',
415
+ status: 'Active',
416
+ },
417
+ {
418
+ id: 5,
419
+ name: {
420
+ children: 'Ethan Hunt',
421
+ iconLeftName: 'download',
422
+ value: 'Ethan Hunt',
423
+ onClick: handleClick,
424
+ },
425
+ email: 'ethan.hunt@example.com',
426
+ role: 'Analyst',
427
+ status: 'Active',
428
+ },
290
429
  ];
291
430
  export const WithButtonCellRenderer = {
292
431
  args: {
@@ -306,13 +445,67 @@ export const WithButtonCellRendererThatOpensAModalWithModalManager = {
306
445
  domLayout: 'autoHeight',
307
446
  },
308
447
  render: () => {
309
- const ModalContent = (name) => (_jsxs(_Fragment, { children: [_jsx(Modal.Header, { children: _jsxs(Modal.Title, { children: ["You've clicked on", ' ', name] }) }), _jsx(Modal.Body, { children: _jsx("p", { children: "Look at you go." }) })] }));
448
+ const ModalContent = (name) => (_jsxs(_Fragment, { children: [_jsx(Modal.Header, { children: _jsxs(Modal.Title, { children: ["You've clicked on", name] }) }), _jsx(Modal.Body, { children: _jsx("p", { children: "Look at you go." }) })] }));
310
449
  const sampleData = [
311
- { id: 1, name: { children: 'Alice Johnson', value: 'Alice Johnson', onClick: () => ModalUtils.addModal({ children: ModalContent('Alice Johnson') }) }, email: 'alice.johnson@example.com', role: 'Developer', status: 'Active' },
312
- { id: 2, name: { children: 'Bob Smith', variant: 'secondary', value: 'Bob Smith', onClick: () => ModalUtils.addModal({ children: ModalContent('Bob Smith') }) }, email: 'bob.smith@example.com', role: 'Designer', status: 'Active' },
313
- { id: 3, name: { children: 'Charlie Brown', size: 'S', value: 'Charlie Brown', onClick: () => ModalUtils.addModal({ children: ModalContent('Charlie Brown') }) }, email: 'charlie.brown@example.com', role: 'Manager', status: 'Inactive' },
314
- { id: 4, name: { children: 'Diana Prince', disabled: true, value: 'Diana Prince', onClick: () => ModalUtils.addModal({ children: ModalContent('Diana Prince') }) }, email: 'diana.prince@example.com', role: 'Developer', status: 'Active' },
315
- { id: 5, name: { children: 'Ethan Hunt', iconLeftName: 'download', value: 'Ethan Hunt', onClick: () => ModalUtils.addModal({ children: ModalContent('Ethan Hunt') }) }, email: 'ethan.hunt@example.com', role: 'Analyst', status: 'Active' },
450
+ {
451
+ id: 1,
452
+ name: {
453
+ children: 'Alice Johnson',
454
+ value: 'Alice Johnson',
455
+ onClick: () => ModalUtils.addModal({ children: ModalContent('Alice Johnson') }),
456
+ },
457
+ email: 'alice.johnson@example.com',
458
+ role: 'Developer',
459
+ status: 'Active',
460
+ },
461
+ {
462
+ id: 2,
463
+ name: {
464
+ children: 'Bob Smith',
465
+ variant: 'secondary',
466
+ value: 'Bob Smith',
467
+ onClick: () => ModalUtils.addModal({ children: ModalContent('Bob Smith') }),
468
+ },
469
+ email: 'bob.smith@example.com',
470
+ role: 'Designer',
471
+ status: 'Active',
472
+ },
473
+ {
474
+ id: 3,
475
+ name: {
476
+ children: 'Charlie Brown',
477
+ size: 'S',
478
+ value: 'Charlie Brown',
479
+ onClick: () => ModalUtils.addModal({ children: ModalContent('Charlie Brown') }),
480
+ },
481
+ email: 'charlie.brown@example.com',
482
+ role: 'Manager',
483
+ status: 'Inactive',
484
+ },
485
+ {
486
+ id: 4,
487
+ name: {
488
+ children: 'Diana Prince',
489
+ disabled: true,
490
+ value: 'Diana Prince',
491
+ onClick: () => ModalUtils.addModal({ children: ModalContent('Diana Prince') }),
492
+ },
493
+ email: 'diana.prince@example.com',
494
+ role: 'Developer',
495
+ status: 'Active',
496
+ },
497
+ {
498
+ id: 5,
499
+ name: {
500
+ children: 'Ethan Hunt',
501
+ iconLeftName: 'download',
502
+ value: 'Ethan Hunt',
503
+ onClick: () => ModalUtils.addModal({ children: ModalContent('Ethan Hunt') }),
504
+ },
505
+ email: 'ethan.hunt@example.com',
506
+ role: 'Analyst',
507
+ status: 'Active',
508
+ },
316
509
  ];
317
510
  return (_jsxs(_Fragment, { children: [_jsx(Table, { rowData: sampleData, columnDefs: sampleColumnDefsWithButtonCellRenderer, defaultColDef: defaultColDef, domLayout: "autoHeight" }), _jsx(ModalManager, {})] }));
318
511
  },
@@ -403,18 +596,25 @@ export const WithButtonCellRendererThatOpensAModalWithComposableModal = {
403
596
  status: 'Active',
404
597
  },
405
598
  ];
406
- return (_jsxs(_Fragment, { children: [_jsx(Table, { rowData: sampleData, columnDefs: sampleColumnDefsWithButtonCellRenderer, defaultColDef: defaultColDef, domLayout: "autoHeight" }), _jsxs(Modal, { open: showModal, closeHandler: () => setShowModal(false), children: [_jsx(Modal.Header, { children: _jsxs(Modal.Title, { children: ["You've clicked on", ' ', sampleData.find(person => person.id === activePersonId)?.name.children] }) }), _jsx(Modal.Body, { children: _jsx("p", { children: "Look at you go." }) }), _jsxs(Modal.Footer, { children: [_jsx(Button, { variant: "tertiary", onClick: () => setShowModal(false), children: "Close" }), _jsx(Button, { variant: "primary", onClick: () => setShowModal(false), children: "Primary Action" })] })] })] }));
599
+ return (_jsxs(_Fragment, { children: [_jsx(Table, { rowData: sampleData, columnDefs: sampleColumnDefsWithButtonCellRenderer, defaultColDef: defaultColDef, domLayout: "autoHeight" }), _jsxs(Modal, { open: showModal, closeHandler: () => setShowModal(false), children: [_jsx(Modal.Header, { children: _jsxs(Modal.Title, { children: ["You've clicked on", ' ', sampleData.find(person => person.id === activePersonId)
600
+ ?.name.children] }) }), _jsx(Modal.Body, { children: _jsx("p", { children: "Look at you go." }) }), _jsxs(Modal.Footer, { children: [_jsx(Button, { variant: "tertiary", onClick: () => setShowModal(false), children: "Close" }), _jsx(Button, { variant: "primary", onClick: () => setShowModal(false), children: "Primary Action" })] })] })] }));
407
601
  },
408
602
  };
409
603
  export const WithInlineTextCellRenderer = {
410
604
  args: {
411
605
  rowData: sampleData,
412
- columnDefs: [{ field: 'name', cellRenderer: 'dsInlineTextCellRenderer', cellRendererParams: {
606
+ columnDefs: [
607
+ {
608
+ field: 'name',
609
+ cellRenderer: 'dsInlineTextCellRenderer',
610
+ cellRendererParams: {
413
611
  supressCellFocusAndFocusFirstElement: true,
414
612
  suppressCount: true,
415
613
  suppressDoubleClickExpand: true,
416
614
  suppressEnterExpand: true,
417
- } }],
615
+ },
616
+ },
617
+ ],
418
618
  defaultColDef,
419
619
  domLayout: 'autoHeight',
420
620
  },
@@ -424,7 +624,10 @@ export const WithTreeData = {
424
624
  columnDefs: [
425
625
  {
426
626
  headerName: 'Details',
427
- children: [{ field: 'email', headerTooltip: 'The email of the user' }, { field: 'role', headerTooltip: 'The role of the user' }],
627
+ children: [
628
+ { field: 'email', headerTooltip: 'The email of the user' },
629
+ { field: 'role', headerTooltip: 'The role of the user' },
630
+ ],
428
631
  },
429
632
  { field: 'status' },
430
633
  ],
@@ -445,17 +648,47 @@ export const WithTreeData = {
445
648
  id: 1,
446
649
  name: 'Group 1',
447
650
  children: [
448
- { id: 2, name: 'Alice Johnson', email: 'alice.johnson@example.com', role: 'Developer', status: 'Active' },
449
- { id: 3, name: 'Bob Smith', email: 'bob.smith@example.com', role: 'Designer', status: 'Active' },
651
+ {
652
+ id: 2,
653
+ name: 'Alice Johnson',
654
+ email: 'alice.johnson@example.com',
655
+ role: 'Developer',
656
+ status: 'Active',
657
+ },
658
+ {
659
+ id: 3,
660
+ name: 'Bob Smith',
661
+ email: 'bob.smith@example.com',
662
+ role: 'Designer',
663
+ status: 'Active',
664
+ },
450
665
  ],
451
666
  },
452
667
  {
453
668
  id: 4,
454
669
  name: 'Group 2',
455
670
  children: [
456
- { id: 5, name: 'Charlie Brown', email: 'charlie.brown@example.com', role: 'Manager', status: 'Inactive' },
457
- { id: 6, name: 'Diana Prince', email: 'diana.prince@example.com', role: 'Developer', status: 'Active' },
458
- { id: 7, name: 'Ethan Hunt', email: 'ethan.hunt@example.com', role: 'Analyst', status: 'Active' },
671
+ {
672
+ id: 5,
673
+ name: 'Charlie Brown',
674
+ email: 'charlie.brown@example.com',
675
+ role: 'Manager',
676
+ status: 'Inactive',
677
+ },
678
+ {
679
+ id: 6,
680
+ name: 'Diana Prince',
681
+ email: 'diana.prince@example.com',
682
+ role: 'Developer',
683
+ status: 'Active',
684
+ },
685
+ {
686
+ id: 7,
687
+ name: 'Ethan Hunt',
688
+ email: 'ethan.hunt@example.com',
689
+ role: 'Analyst',
690
+ status: 'Active',
691
+ },
459
692
  ],
460
693
  },
461
694
  ],
@@ -464,19 +697,23 @@ export const WithTreeData = {
464
697
  const colDefsWithValidation = [
465
698
  {
466
699
  headerName: 'Details',
467
- children: [{
700
+ children: [
701
+ {
468
702
  field: 'name',
469
703
  headerTooltip: 'The name of the user',
470
704
  cellEditorParams: {
471
705
  maxLength: 10,
472
706
  },
473
- }, {
707
+ },
708
+ {
474
709
  field: 'email',
475
710
  headerTooltip: 'The email of the user',
476
- }, {
711
+ },
712
+ {
477
713
  field: 'role',
478
714
  headerTooltip: 'The role of the user',
479
- }],
715
+ },
716
+ ],
480
717
  },
481
718
  { field: 'status' },
482
719
  ];
@@ -500,7 +737,8 @@ export const WithValidation = {
500
737
  const colDefsWithValidationClasses = [
501
738
  {
502
739
  headerName: 'Details',
503
- children: [{
740
+ children: [
741
+ {
504
742
  field: 'name',
505
743
  headerTooltip: 'The name of the user',
506
744
  cellEditorParams: {
@@ -509,13 +747,16 @@ const colDefsWithValidationClasses = [
509
747
  cellClassRules: {
510
748
  'ds-table__cell--invalid': params => params.value?.value?.length > 10,
511
749
  },
512
- }, {
750
+ },
751
+ {
513
752
  field: 'email',
514
753
  headerTooltip: 'The email of the user',
515
- }, {
754
+ },
755
+ {
516
756
  field: 'role',
517
757
  headerTooltip: 'The role of the user',
518
- }],
758
+ },
759
+ ],
519
760
  },
520
761
  { field: 'status' },
521
762
  ];
@@ -556,7 +797,13 @@ const marksheetTidyTableColumnDefs = [
556
797
  headerName: 'Assessment Component',
557
798
  field: 'assessmentComponent',
558
799
  cellRenderer: 'dsSelectDropdownCellRenderer',
559
- cellRendererParams: { options: assessmentComponentOptions, placeholder: 'Select' },
800
+ cellRendererParams: (params) => {
801
+ return {
802
+ options: assessmentComponentOptions,
803
+ placeholder: 'Select',
804
+ hasError: params.node.data.assessmentComponent === 'comp-maths',
805
+ };
806
+ },
560
807
  editable: false,
561
808
  },
562
809
  {
@@ -588,27 +835,90 @@ const marksheetTidyTableData = [
588
835
  id: 2,
589
836
  name: 'Autumn',
590
837
  children: [
591
- { id: 3, name: 'English Language', assessmentComponent: 'comp-english-lang', visibility: 'auto-visible', editable: true, formatting: undefined },
592
- { id: 4, name: 'English Literature', assessmentComponent: 'comp-english-lit', visibility: 'auto-visible', editable: true, formatting: undefined },
593
- { id: 5, name: 'Maths', assessmentComponent: 'comp-maths', visibility: 'auto-visible', editable: true, formatting: undefined },
838
+ {
839
+ id: 3,
840
+ name: 'English Language',
841
+ assessmentComponent: 'comp-english-lang',
842
+ visibility: 'auto-visible',
843
+ editable: true,
844
+ formatting: undefined,
845
+ },
846
+ {
847
+ id: 4,
848
+ name: 'English Literature',
849
+ assessmentComponent: 'comp-english-lit',
850
+ visibility: 'auto-visible',
851
+ editable: true,
852
+ formatting: undefined,
853
+ },
854
+ {
855
+ id: 5,
856
+ name: 'Maths',
857
+ assessmentComponent: 'comp-maths',
858
+ visibility: 'auto-visible',
859
+ editable: true,
860
+ formatting: undefined,
861
+ },
594
862
  ],
595
863
  },
596
864
  {
597
865
  id: 6,
598
866
  name: 'Spring',
599
867
  children: [
600
- { id: 7, name: 'English Language', assessmentComponent: 'comp-english-lang', visibility: 'auto-visible', editable: true, formatting: undefined },
601
- { id: 8, name: 'English Literature', assessmentComponent: 'comp-english-lit', visibility: 'auto-visible', editable: true, formatting: undefined },
602
- { id: 9, name: 'Maths', assessmentComponent: 'comp-maths', visibility: 'auto-visible', editable: true, formatting: undefined },
868
+ {
869
+ id: 7,
870
+ name: 'English Language',
871
+ assessmentComponent: 'comp-english-lang',
872
+ visibility: 'auto-visible',
873
+ editable: true,
874
+ formatting: undefined,
875
+ },
876
+ {
877
+ id: 8,
878
+ name: 'English Literature',
879
+ assessmentComponent: 'comp-english-lit',
880
+ visibility: 'auto-visible',
881
+ editable: true,
882
+ formatting: undefined,
883
+ },
884
+ {
885
+ id: 9,
886
+ name: 'Maths',
887
+ assessmentComponent: 'comp-maths',
888
+ visibility: 'auto-visible',
889
+ editable: true,
890
+ formatting: undefined,
891
+ },
603
892
  ],
604
893
  },
605
894
  {
606
895
  id: 10,
607
896
  name: 'Summer',
608
897
  children: [
609
- { id: 11, name: 'English Language', assessmentComponent: 'comp-english-lang', visibility: 'auto-visible', editable: true, formatting: undefined },
610
- { id: 12, name: 'English Literature', assessmentComponent: 'comp-english-lit', visibility: 'auto-visible', editable: true, formatting: undefined },
611
- { id: 13, name: 'Maths', assessmentComponent: 'comp-maths', visibility: 'auto-visible', editable: true, formatting: undefined },
898
+ {
899
+ id: 11,
900
+ name: 'English Language',
901
+ assessmentComponent: 'comp-english-lang',
902
+ visibility: 'auto-visible',
903
+ editable: true,
904
+ formatting: undefined,
905
+ },
906
+ {
907
+ id: 12,
908
+ name: 'English Literature',
909
+ assessmentComponent: 'comp-english-lit',
910
+ visibility: 'auto-visible',
911
+ editable: true,
912
+ formatting: undefined,
913
+ },
914
+ {
915
+ id: 13,
916
+ name: 'Maths',
917
+ assessmentComponent: 'comp-maths',
918
+ visibility: 'auto-visible',
919
+ editable: true,
920
+ formatting: undefined,
921
+ },
612
922
  ],
613
923
  },
614
924
  ];
@@ -651,38 +961,98 @@ export const TableWithExplicitColours = {
651
961
  rowData: [
652
962
  {
653
963
  id: 1,
654
- name: { value: 'Alice Johnson', backgroundColor: '#e3f2fd', foregroundColor: '#0d47a1' },
964
+ name: {
965
+ value: 'Alice Johnson',
966
+ backgroundColor: '#e3f2fd',
967
+ foregroundColor: '#0d47a1',
968
+ },
655
969
  email: { value: 'alice.johnson@example.com' },
656
- role: { value: 'Developer', backgroundColor: '#c8e6c9', foregroundColor: '#1b5e20' },
657
- status: { value: 'Active', backgroundColor: '#a5d6a7', foregroundColor: '#2e7d32' },
970
+ role: {
971
+ value: 'Developer',
972
+ backgroundColor: '#c8e6c9',
973
+ foregroundColor: '#1b5e20',
974
+ },
975
+ status: {
976
+ value: 'Active',
977
+ backgroundColor: '#a5d6a7',
978
+ foregroundColor: '#2e7d32',
979
+ },
658
980
  },
659
981
  {
660
982
  id: 2,
661
- name: { value: 'Bob Smith', backgroundColor: '#fff3e0', foregroundColor: '#e65100' },
983
+ name: {
984
+ value: 'Bob Smith',
985
+ backgroundColor: '#fff3e0',
986
+ foregroundColor: '#e65100',
987
+ },
662
988
  email: { value: 'bob.smith@example.com' },
663
- role: { value: 'Designer', backgroundColor: '#f3e5f5', foregroundColor: '#4a148c' },
664
- status: { value: 'Active', backgroundColor: '#a5d6a7', foregroundColor: '#2e7d32' },
989
+ role: {
990
+ value: 'Designer',
991
+ backgroundColor: '#f3e5f5',
992
+ foregroundColor: '#4a148c',
993
+ },
994
+ status: {
995
+ value: 'Active',
996
+ backgroundColor: '#a5d6a7',
997
+ foregroundColor: '#2e7d32',
998
+ },
665
999
  },
666
1000
  {
667
1001
  id: 3,
668
- name: { value: 'Charlie Brown', backgroundColor: '#fce4ec', foregroundColor: '#880e4f' },
1002
+ name: {
1003
+ value: 'Charlie Brown',
1004
+ backgroundColor: '#fce4ec',
1005
+ foregroundColor: '#880e4f',
1006
+ },
669
1007
  email: { value: 'charlie.brown@example.com' },
670
- role: { value: 'Manager', backgroundColor: '#fff9c4', foregroundColor: '#f57f17' },
671
- status: { value: 'Inactive', backgroundColor: '#ffcdd2', foregroundColor: '#b71c1c' },
1008
+ role: {
1009
+ value: 'Manager',
1010
+ backgroundColor: '#fff9c4',
1011
+ foregroundColor: '#f57f17',
1012
+ },
1013
+ status: {
1014
+ value: 'Inactive',
1015
+ backgroundColor: '#ffcdd2',
1016
+ foregroundColor: '#b71c1c',
1017
+ },
672
1018
  },
673
1019
  {
674
1020
  id: 4,
675
- name: { value: 'Diana Prince', backgroundColor: '#e1bee7', foregroundColor: '#6a1b9a' },
1021
+ name: {
1022
+ value: 'Diana Prince',
1023
+ backgroundColor: '#e1bee7',
1024
+ foregroundColor: '#6a1b9a',
1025
+ },
676
1026
  email: { value: 'diana.prince@example.com' },
677
- role: { value: 'Developer', backgroundColor: '#c8e6c9', foregroundColor: '#1b5e20' },
678
- status: { value: 'Active', backgroundColor: '#a5d6a7', foregroundColor: '#2e7d32' },
1027
+ role: {
1028
+ value: 'Developer',
1029
+ backgroundColor: '#c8e6c9',
1030
+ foregroundColor: '#1b5e20',
1031
+ },
1032
+ status: {
1033
+ value: 'Active',
1034
+ backgroundColor: '#a5d6a7',
1035
+ foregroundColor: '#2e7d32',
1036
+ },
679
1037
  },
680
1038
  {
681
1039
  id: 5,
682
- name: { value: 'Ethan Hunt', backgroundColor: '#b2ebf2', foregroundColor: '#006064' },
1040
+ name: {
1041
+ value: 'Ethan Hunt',
1042
+ backgroundColor: '#b2ebf2',
1043
+ foregroundColor: '#006064',
1044
+ },
683
1045
  email: { value: 'ethan.hunt@example.com' },
684
- role: { value: 'Analyst', backgroundColor: '#ffccbc', foregroundColor: '#bf360c' },
685
- status: { value: 'Active', backgroundColor: '#a5d6a7', foregroundColor: '#2e7d32' },
1046
+ role: {
1047
+ value: 'Analyst',
1048
+ backgroundColor: '#ffccbc',
1049
+ foregroundColor: '#bf360c',
1050
+ },
1051
+ status: {
1052
+ value: 'Active',
1053
+ backgroundColor: '#a5d6a7',
1054
+ foregroundColor: '#2e7d32',
1055
+ },
686
1056
  },
687
1057
  ],
688
1058
  columnDefs: sampleColumnDefs,