@arbor-education/design-system.components 3.2.0 → 3.3.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 (90) hide show
  1. package/.gather/skills/write-stories/README.md +8 -4
  2. package/.gather/skills/write-stories/SKILL.md +59 -5
  3. package/CHANGELOG.md +24 -0
  4. package/dist/components/breadcrumbs/Breadcrumbs.stories.d.ts +1 -0
  5. package/dist/components/breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
  6. package/dist/components/breadcrumbs/Breadcrumbs.stories.js +103 -21
  7. package/dist/components/breadcrumbs/Breadcrumbs.stories.js.map +1 -1
  8. package/dist/components/card/Card.stories.d.ts.map +1 -1
  9. package/dist/components/card/Card.stories.js +46 -41
  10. package/dist/components/card/Card.stories.js.map +1 -1
  11. package/dist/components/editableText/EditableText.stories.d.ts.map +1 -1
  12. package/dist/components/editableText/EditableText.stories.js +19 -6
  13. package/dist/components/editableText/EditableText.stories.js.map +1 -1
  14. package/dist/components/filterBar/FilterBar.d.ts +2 -2
  15. package/dist/components/filterBar/FilterBar.d.ts.map +1 -1
  16. package/dist/components/filterBar/FilterBar.js +7 -3
  17. package/dist/components/filterBar/FilterBar.js.map +1 -1
  18. package/dist/components/filterBar/FilterBar.stories.d.ts +16 -0
  19. package/dist/components/filterBar/FilterBar.stories.d.ts.map +1 -1
  20. package/dist/components/filterBar/FilterBar.stories.js +101 -7
  21. package/dist/components/filterBar/FilterBar.stories.js.map +1 -1
  22. package/dist/components/filterBar/FilterBar.test.js +30 -0
  23. package/dist/components/filterBar/FilterBar.test.js.map +1 -1
  24. package/dist/components/formField/fieldset/Fieldset.stories.d.ts.map +1 -1
  25. package/dist/components/formField/fieldset/Fieldset.stories.js +5 -3
  26. package/dist/components/formField/fieldset/Fieldset.stories.js.map +1 -1
  27. package/dist/components/row/Row.stories.d.ts.map +1 -1
  28. package/dist/components/row/Row.stories.js +22 -13
  29. package/dist/components/row/Row.stories.js.map +1 -1
  30. package/dist/components/sidebar/Sidebar.stories.d.ts.map +1 -1
  31. package/dist/components/sidebar/Sidebar.stories.js +19 -24
  32. package/dist/components/sidebar/Sidebar.stories.js.map +1 -1
  33. package/dist/components/table/Table.d.ts.map +1 -1
  34. package/dist/components/table/Table.js +2 -1
  35. package/dist/components/table/Table.js.map +1 -1
  36. package/dist/components/table/Table.stories.d.ts +7 -0
  37. package/dist/components/table/Table.stories.d.ts.map +1 -1
  38. package/dist/components/table/Table.stories.js +60 -10
  39. package/dist/components/table/Table.stories.js.map +1 -1
  40. package/dist/components/table/Table.test.js +23 -0
  41. package/dist/components/table/Table.test.js.map +1 -1
  42. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts.map +1 -1
  43. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js +8 -5
  44. package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js.map +1 -1
  45. package/dist/components/table/tableControls/TableControls.d.ts +2 -0
  46. package/dist/components/table/tableControls/TableControls.d.ts.map +1 -1
  47. package/dist/components/table/tableControls/TableControls.js +2 -2
  48. package/dist/components/table/tableControls/TableControls.js.map +1 -1
  49. package/dist/components/table/tableControls/TableControls.stories.d.ts +26 -1
  50. package/dist/components/table/tableControls/TableControls.stories.d.ts.map +1 -1
  51. package/dist/components/table/tableControls/TableControls.stories.js +50 -21
  52. package/dist/components/table/tableControls/TableControls.stories.js.map +1 -1
  53. package/dist/components/table/tableControls/TableControls.test.js +16 -0
  54. package/dist/components/table/tableControls/TableControls.test.js.map +1 -1
  55. package/dist/components/table/useTableSettings.d.ts +2 -0
  56. package/dist/components/table/useTableSettings.d.ts.map +1 -1
  57. package/dist/components/table/useTableSettings.js +12 -7
  58. package/dist/components/table/useTableSettings.js.map +1 -1
  59. package/dist/components/widget/Widget.stories.d.ts +13 -0
  60. package/dist/components/widget/Widget.stories.d.ts.map +1 -1
  61. package/dist/components/widget/Widget.stories.js +45 -6
  62. package/dist/components/widget/Widget.stories.js.map +1 -1
  63. package/dist/components/widgetCalendar/WidgetCalendar.stories.d.ts +88 -16
  64. package/dist/components/widgetCalendar/WidgetCalendar.stories.d.ts.map +1 -1
  65. package/dist/components/widgetCalendar/WidgetCalendar.stories.js +443 -30
  66. package/dist/components/widgetCalendar/WidgetCalendar.stories.js.map +1 -1
  67. package/dist/index.css +1 -4
  68. package/dist/index.css.map +1 -1
  69. package/package.json +1 -1
  70. package/src/components/breadcrumbs/Breadcrumbs.stories.tsx +112 -21
  71. package/src/components/card/Card.stories.tsx +46 -41
  72. package/src/components/datePicker/datePicker.scss +0 -5
  73. package/src/components/editableText/EditableText.stories.tsx +26 -29
  74. package/src/components/filterBar/FilterBar.stories.tsx +126 -4
  75. package/src/components/filterBar/FilterBar.test.tsx +51 -0
  76. package/src/components/filterBar/FilterBar.tsx +18 -12
  77. package/src/components/formField/fieldset/Fieldset.stories.tsx +5 -3
  78. package/src/components/row/Row.stories.tsx +20 -14
  79. package/src/components/sidebar/Sidebar.stories.tsx +61 -112
  80. package/src/components/table/Table.stories.tsx +82 -10
  81. package/src/components/table/Table.test.tsx +42 -0
  82. package/src/components/table/Table.tsx +2 -0
  83. package/src/components/table/cellRenderers/SelectDropdownCellRenderer.stories.tsx +8 -5
  84. package/src/components/table/tableControls/TableControls.stories.tsx +54 -21
  85. package/src/components/table/tableControls/TableControls.test.tsx +20 -0
  86. package/src/components/table/tableControls/TableControls.tsx +6 -0
  87. package/src/components/table/useTableSettings.ts +20 -6
  88. package/src/components/widget/Widget.stories.tsx +61 -6
  89. package/src/components/widgetCalendar/WidgetCalendar.stories.tsx +547 -74
  90. package/src/tokens.scss +1 -0
@@ -330,98 +330,53 @@ const DefaultTemplate = () => {
330
330
  );
331
331
  };
332
332
 
333
- const WithSeparatorsTemplate = () => {
334
- const [active, setActive] = useState<string>('favourites');
335
-
336
- return (
337
- <div style={storyWrapperStyle}>
338
- <Sidebar ariaLabel="App navigation">
339
- <SidebarItem
340
- aria-label="Favourites"
341
- selected={active === 'favourites'}
342
- onClick={() => setActive('favourites')}
343
- >
344
- <Icon name="favourite-outline" size={24} />
345
- </SidebarItem>
346
- <SidebarItem
347
- aria-label="Notifications"
348
- selected={active === 'notifications'}
349
- onClick={() => setActive('notifications')}
350
- >
351
- <Icon name="message-square-more" size={24} />
352
- </SidebarItem>
353
- <SidebarItem
354
- aria-label="My Calendar"
355
- selected={active === 'calendar'}
356
- onClick={() => setActive('calendar')}
357
- >
358
- <Icon name="date" size={24} />
359
- </SidebarItem>
360
- <Separator orientation="horizontal" decorative />
361
- <SidebarItem
362
- aria-label="Emergency Alerts"
363
- selected={active === 'emergency'}
364
- onClick={() => setActive('emergency')}
365
- >
366
- <Icon name="triangle-alert" size={24} />
367
- </SidebarItem>
368
- <Separator orientation="horizontal" decorative />
369
- <SidebarItem
370
- aria-label="Help & Learn with Arbor"
371
- selected={active === 'help'}
372
- onClick={() => setActive('help')}
373
- >
374
- <Icon name="circle-help" size={24} />
375
- </SidebarItem>
376
- </Sidebar>
377
- </div>
378
- );
379
- };
380
-
381
- const WithBadgeTemplate = () => {
382
- const [active, setActive] = useState<string>('favourites');
333
+ const WithSeparatorsTemplate = () => (
334
+ <div style={storyWrapperStyle}>
335
+ <Sidebar ariaLabel="App navigation">
336
+ <SidebarItem aria-label="Favourites">
337
+ <Icon name="favourite-outline" size={24} />
338
+ </SidebarItem>
339
+ <SidebarItem aria-label="Notifications">
340
+ <Icon name="message-square-more" size={24} />
341
+ </SidebarItem>
342
+ <SidebarItem aria-label="My Calendar">
343
+ <Icon name="date" size={24} />
344
+ </SidebarItem>
345
+ <Separator orientation="horizontal" decorative />
346
+ <SidebarItem aria-label="Emergency Alerts">
347
+ <Icon name="triangle-alert" size={24} />
348
+ </SidebarItem>
349
+ <Separator orientation="horizontal" decorative />
350
+ <SidebarItem aria-label="Help & Learn with Arbor">
351
+ <Icon name="circle-help" size={24} />
352
+ </SidebarItem>
353
+ </Sidebar>
354
+ </div>
355
+ );
383
356
 
384
- return (
385
- <div style={storyWrapperStyle}>
386
- <Sidebar ariaLabel="App navigation">
387
- <SidebarItem
388
- aria-label="Favourites"
389
- selected={active === 'favourites'}
390
- onClick={() => setActive('favourites')}
391
- >
392
- <Icon name="favourite-outline" size={24} />
393
- </SidebarItem>
394
- <SidebarItem
395
- aria-label="Notifications — 6 unread"
396
- selected={active === 'notifications'}
397
- onClick={() => setActive('notifications')}
398
- >
399
- <Icon name="message-square-more" size={24} />
400
- <Badge size="sm" colour="salmon">6</Badge>
401
- </SidebarItem>
402
- <SidebarItem
403
- aria-label="Emergency Alerts — 2 active"
404
- selected={active === 'emergency'}
405
- onClick={() => setActive('emergency')}
406
- >
407
- <Icon name="triangle-alert" size={24} />
408
- <Badge size="sm" colour="yellow">2</Badge>
409
- </SidebarItem>
410
- <SidebarItem
411
- aria-label="My Calendar"
412
- selected={active === 'calendar'}
413
- onClick={() => setActive('calendar')}
414
- >
415
- <Icon name="date" size={24} />
416
- </SidebarItem>
417
- </Sidebar>
418
- </div>
419
- );
420
- };
357
+ const WithBadgeTemplate = () => (
358
+ <div style={storyWrapperStyle}>
359
+ <Sidebar ariaLabel="App navigation">
360
+ <SidebarItem aria-label="Favourites">
361
+ <Icon name="favourite-outline" size={24} />
362
+ </SidebarItem>
363
+ <SidebarItem aria-label="Notifications — 6 unread">
364
+ <Icon name="message-square-more" size={24} />
365
+ <Badge size="sm" colour="salmon">6</Badge>
366
+ </SidebarItem>
367
+ <SidebarItem aria-label="Emergency Alerts — 2 active">
368
+ <Icon name="triangle-alert" size={24} />
369
+ <Badge size="sm" colour="yellow">2</Badge>
370
+ </SidebarItem>
371
+ <SidebarItem aria-label="My Calendar">
372
+ <Icon name="date" size={24} />
373
+ </SidebarItem>
374
+ </Sidebar>
375
+ </div>
376
+ );
421
377
 
422
378
  const WithPanelTemplate = () => {
423
379
  const [open, setOpen] = useState(true);
424
- const [active, setActive] = useState<string>('favourites');
425
380
 
426
381
  return (
427
382
  <div style={storyWrapperStyle}>
@@ -436,18 +391,10 @@ const WithPanelTemplate = () => {
436
391
  <Icon name="menu" size={24} />
437
392
  </SidebarItem>
438
393
  <Separator orientation="horizontal" decorative />
439
- <SidebarItem
440
- aria-label="Favourites"
441
- selected={active === 'favourites'}
442
- onClick={() => setActive('favourites')}
443
- >
394
+ <SidebarItem aria-label="Favourites">
444
395
  <Icon name="favourite-outline" size={24} />
445
396
  </SidebarItem>
446
- <SidebarItem
447
- aria-label="My Calendar"
448
- selected={active === 'calendar'}
449
- onClick={() => setActive('calendar')}
450
- >
397
+ <SidebarItem aria-label="My Calendar">
451
398
  <Icon name="date" size={24} />
452
399
  </SidebarItem>
453
400
  </Sidebar>
@@ -497,30 +444,28 @@ export const WithSeparators: Story = withDescription(
497
444
  language: 'tsx',
498
445
  code: `
499
446
  import { Sidebar, SidebarItem, Separator, Icon } from '@arbor-education/design-system.components';
500
- import { useState } from 'react';
501
447
 
502
448
  function WithSeparatorsExample() {
503
- const [active, setActive] = useState('favourites');
504
449
  return (
505
450
  <Sidebar ariaLabel="App navigation">
506
451
  {/* Primary nav group */}
507
- <SidebarItem aria-label="Favourites" selected={active === 'favourites'} onClick={() => setActive('favourites')}>
452
+ <SidebarItem aria-label="Favourites">
508
453
  <Icon name="favourite-outline" size={24} />
509
454
  </SidebarItem>
510
- <SidebarItem aria-label="Notifications" selected={active === 'notifications'} onClick={() => setActive('notifications')}>
455
+ <SidebarItem aria-label="Notifications">
511
456
  <Icon name="message-square-more" size={24} />
512
457
  </SidebarItem>
513
- <SidebarItem aria-label="My Calendar" selected={active === 'calendar'} onClick={() => setActive('calendar')}>
458
+ <SidebarItem aria-label="My Calendar">
514
459
  <Icon name="date" size={24} />
515
460
  </SidebarItem>
516
461
  <Separator orientation="horizontal" decorative />
517
462
  {/* Alert group */}
518
- <SidebarItem aria-label="Emergency Alerts" selected={active === 'emergency'} onClick={() => setActive('emergency')}>
463
+ <SidebarItem aria-label="Emergency Alerts">
519
464
  <Icon name="triangle-alert" size={24} />
520
465
  </SidebarItem>
521
466
  <Separator orientation="horizontal" decorative />
522
467
  {/* Utility group */}
523
- <SidebarItem aria-label="Help & Learn with Arbor" selected={active === 'help'} onClick={() => setActive('help')}>
468
+ <SidebarItem aria-label="Help & Learn with Arbor">
524
469
  <Icon name="circle-help" size={24} />
525
470
  </SidebarItem>
526
471
  </Sidebar>
@@ -532,7 +477,7 @@ export default WithSeparatorsExample;
532
477
  },
533
478
  },
534
479
  },
535
- 'Three groups divided by `<Separator orientation="horizontal" decorative />`. A common layout: primary nav / alerts / utility items. Click any item to see the active state.',
480
+ 'Three groups divided by `<Separator orientation="horizontal" decorative />`: primary nav (Favourites, Notifications, My Calendar), alerts (Emergency Alerts), and utility (Help & Learn with Arbor).',
536
481
  );
537
482
 
538
483
  export const WithBadge: Story = withDescription(
@@ -545,27 +490,28 @@ export const WithBadge: Story = withDescription(
545
490
  language: 'tsx',
546
491
  code: `
547
492
  import { Sidebar, SidebarItem, Badge, Icon } from '@arbor-education/design-system.components';
548
- import { useState } from 'react';
549
493
 
550
494
  function WithBadgeExample() {
551
- const [active, setActive] = useState('favourites');
552
495
  return (
553
496
  <Sidebar ariaLabel="App navigation">
554
- <SidebarItem aria-label="Favourites" selected={active === 'favourites'} onClick={() => setActive('favourites')}>
497
+ <SidebarItem aria-label="Favourites">
555
498
  <Icon name="favourite-outline" size={24} />
556
499
  </SidebarItem>
557
500
  {/*
558
501
  Badge is automatically positioned top-right by sidebar.scss — no extra styling needed.
559
502
  Include the count in aria-label so screen reader users also receive the total.
560
503
  */}
561
- <SidebarItem aria-label="Notifications — 6 unread" selected={active === 'notifications'} onClick={() => setActive('notifications')}>
504
+ <SidebarItem aria-label="Notifications — 6 unread">
562
505
  <Icon name="message-square-more" size={24} />
563
506
  <Badge size="sm" colour="salmon">6</Badge>
564
507
  </SidebarItem>
565
- <SidebarItem aria-label="Emergency Alerts — 2 active" selected={active === 'emergency'} onClick={() => setActive('emergency')}>
508
+ <SidebarItem aria-label="Emergency Alerts — 2 active">
566
509
  <Icon name="triangle-alert" size={24} />
567
510
  <Badge size="sm" colour="yellow">2</Badge>
568
511
  </SidebarItem>
512
+ <SidebarItem aria-label="My Calendar">
513
+ <Icon name="date" size={24} />
514
+ </SidebarItem>
569
515
  </Sidebar>
570
516
  );
571
517
  }
@@ -607,9 +553,12 @@ function WithPanelExample() {
607
553
  <Icon name="menu" size={24} />
608
554
  </SidebarItem>
609
555
  <Separator orientation="horizontal" decorative />
610
- <SidebarItem aria-label="Favourites" selected={false}>
556
+ <SidebarItem aria-label="Favourites">
611
557
  <Icon name="favourite-outline" size={24} />
612
558
  </SidebarItem>
559
+ <SidebarItem aria-label="My Calendar">
560
+ <Icon name="date" size={24} />
561
+ </SidebarItem>
613
562
  </Sidebar>
614
563
 
615
564
  {/* SideNavigation is a separate companion component — not a sub-component of Sidebar. */}
@@ -11,6 +11,7 @@ import {
11
11
  } from '@storybook/addon-docs/blocks';
12
12
  import { type Column, type ColDef, type ColGroupDef } from 'ag-grid-enterprise';
13
13
  import { Table } from './Table.js';
14
+ import { TABLE_SPACING } from './tableConsts.js';
14
15
  import { Button } from 'Components/button/Button';
15
16
  import { Icon } from 'Components/icon/Icon';
16
17
 
@@ -348,6 +349,14 @@ const meta: Meta<TableProps> = {
348
349
  defaultValue: { summary: 'false' },
349
350
  },
350
351
  },
352
+ initialSettings: {
353
+ description: 'Seeds the table settings (column borders, spacing, cell colours) on mount, e.g. to restore a user\'s previously persisted preferences. Only affects the initial render — `resetSettings` still falls back to the DS defaults, not these values.',
354
+ control: false,
355
+ table: {
356
+ type: { summary: 'Partial<TableSettings>' },
357
+ defaultValue: { summary: 'undefined' },
358
+ },
359
+ },
351
360
  onTableSettingsChanged: {
352
361
  description: 'Fired when the user changes table settings (column borders, spacing, cell colours) via the settings dropdown.',
353
362
  control: false,
@@ -614,6 +623,31 @@ export const Default: Story = {
614
623
  rowSelection: ['2', '3'],
615
624
  },
616
625
  cellSelection: true,
626
+ headerContent: (
627
+ <TableControls
628
+ bulkActions={[
629
+ {
630
+ displayName: 'foo',
631
+ callback: (gridApi) => {
632
+ console.log('clicked on the foo action', gridApi);
633
+ },
634
+ },
635
+ {
636
+ displayName: 'bar',
637
+ callback: (gridApi) => {
638
+ console.log('clicked on the bar action', gridApi);
639
+ },
640
+ disabled: true,
641
+ },
642
+ ]}
643
+ showHideColumns
644
+ onDownload={() => console.log('download')}
645
+ showSettings
646
+ onHelp={() => console.log('help')}
647
+ onExpandToggle={expanded => console.log('expand', expanded)}
648
+ />
649
+ ),
650
+ footerContent,
617
651
  },
618
652
  };
619
653
 
@@ -1505,8 +1539,6 @@ export const WithValidation: Story = {
1505
1539
  columnDefs: colDefsWithValidation,
1506
1540
  defaultColDef: defaultColDef,
1507
1541
  domLayout: 'autoHeight',
1508
- rowSelection: { mode: 'multiRow', checkboxes: true },
1509
- cellSelection: true,
1510
1542
  },
1511
1543
  };
1512
1544
 
@@ -1552,8 +1584,6 @@ export const WithValidationClassesAdded: Story = {
1552
1584
  columnDefs: colDefsWithValidationClasses,
1553
1585
  defaultColDef: defaultColDef,
1554
1586
  domLayout: 'autoHeight',
1555
- rowSelection: { mode: 'multiRow', checkboxes: true },
1556
- cellSelection: true,
1557
1587
  },
1558
1588
  };
1559
1589
 
@@ -1719,10 +1749,6 @@ export const TidyTable: Story = {
1719
1749
  groupExpanded: '',
1720
1750
  groupContracted: '',
1721
1751
  },
1722
- rowSelection: {
1723
- mode: 'multiRow',
1724
- groupSelects: 'filteredDescendants',
1725
- },
1726
1752
  autoGroupColumnDef: {
1727
1753
  field: 'name',
1728
1754
  headerName: 'Marksheet Columns',
@@ -1841,7 +1867,6 @@ export const TableWithExplicitColours: Story = {
1841
1867
  ],
1842
1868
  columnDefs: sampleColumnDefs,
1843
1869
  defaultColDef,
1844
- headerContent,
1845
1870
  onCellValueChanged: (e) => {
1846
1871
  const { node, column, oldValue, newValue } = e;
1847
1872
  if (typeof oldValue === 'object' && 'value' in oldValue) {
@@ -1901,7 +1926,6 @@ export const TableWithSemanticColors: Story = {
1901
1926
  ],
1902
1927
  columnDefs: sampleColumnDefs,
1903
1928
  defaultColDef,
1904
- headerContent,
1905
1929
  domLayout: 'autoHeight',
1906
1930
  onCellValueChanged: (e) => {
1907
1931
  const { node, column, oldValue, newValue } = e;
@@ -2197,6 +2221,54 @@ export const WithTableSettingsDropdownCustomItems: Story = {
2197
2221
  },
2198
2222
  };
2199
2223
 
2224
+ type WithInitialSettingsArgs = TableProps & {
2225
+ hasColumnBorders?: boolean;
2226
+ tableSpacing?: TABLE_SPACING;
2227
+ areCellColorsEnabled?: boolean;
2228
+ };
2229
+
2230
+ export const WithInitialSettings: StoryObj<WithInitialSettingsArgs> = {
2231
+ parameters: {
2232
+ docs: {
2233
+ description: {
2234
+ story:
2235
+ '`initialSettings` seeds column borders, spacing and cell colours on mount — useful for restoring a user\'s previously persisted preferences without a flash of the DS defaults. Resetting via the settings dropdown still falls back to the DS defaults, not these values. Use the Controls panel below to try different combinations.',
2236
+ },
2237
+ },
2238
+ },
2239
+ argTypes: {
2240
+ hasColumnBorders: {
2241
+ description: 'Seeds `initialSettings.hasColumnBorders`.',
2242
+ control: 'boolean',
2243
+ },
2244
+ tableSpacing: {
2245
+ description: 'Seeds `initialSettings.tableSpacing`.',
2246
+ control: 'select',
2247
+ options: Object.values(TABLE_SPACING),
2248
+ },
2249
+ areCellColorsEnabled: {
2250
+ description: 'Seeds `initialSettings.areCellColorsEnabled`.',
2251
+ control: 'boolean',
2252
+ },
2253
+ },
2254
+ args: {
2255
+ rowData: sampleData,
2256
+ columnDefs: sampleColumnDefs,
2257
+ defaultColDef,
2258
+ domLayout: 'autoHeight',
2259
+ headerContent: <Table.TableSettingsDropdown />,
2260
+ hasColumnBorders: true,
2261
+ tableSpacing: Table.Spacing.L,
2262
+ areCellColorsEnabled: false,
2263
+ },
2264
+ render: ({ hasColumnBorders, tableSpacing, areCellColorsEnabled, ...rest }) => (
2265
+ <Table
2266
+ {...rest}
2267
+ initialSettings={{ hasColumnBorders, tableSpacing, areCellColorsEnabled }}
2268
+ />
2269
+ ),
2270
+ };
2271
+
2200
2272
  export const WithCheckboxCellRenderer: Story = {
2201
2273
  parameters: {
2202
2274
  docs: {
@@ -894,6 +894,48 @@ describe('Table', () => {
894
894
  expect(onTableSettingsChanged).toHaveBeenNthCalledWith(2, expect.objectContaining({ hasColumnBorders: true }));
895
895
  });
896
896
 
897
+ test('renders with initialSettings applied instead of the hardcoded defaults', async () => {
898
+ render(
899
+ <Table
900
+ headerContent={<TableSettingsDropdown />}
901
+ initialSettings={{
902
+ hasColumnBorders: true,
903
+ tableSpacing: Table.Spacing.L,
904
+ areCellColorsEnabled: false,
905
+ }}
906
+ />,
907
+ );
908
+
909
+ await userEvent.click(screen.getByRole('button', { name: /Table settings/i }));
910
+
911
+ expect((screen.getByLabelText('Large') as HTMLInputElement).checked).toBe(true);
912
+ expect((screen.getByLabelText('Column borders') as HTMLInputElement).checked).toBe(true);
913
+ expect((screen.getByLabelText('Cell colours') as HTMLInputElement).checked).toBe(false);
914
+ });
915
+
916
+ test('resetSettings falls back to the DS defaults, not initialSettings', async () => {
917
+ const onTableSettingsReset = vi.fn();
918
+
919
+ render(
920
+ <Table
921
+ headerContent={<TableSettingsDropdown />}
922
+ initialSettings={{ hasColumnBorders: true, tableSpacing: Table.Spacing.L }}
923
+ onTableSettingsReset={onTableSettingsReset}
924
+ />,
925
+ );
926
+
927
+ await userEvent.click(screen.getByRole('button', { name: /Table settings/i }));
928
+
929
+ const resetButton = screen.getByRole('button', { name: /Reset Table Settings/i });
930
+ await userEvent.click(resetButton);
931
+
932
+ expect(onTableSettingsReset).toHaveBeenCalledOnce();
933
+ await waitFor(() => {
934
+ expect((screen.getByLabelText('Medium') as HTMLInputElement).checked).toBe(true);
935
+ expect((screen.getByLabelText('Column borders') as HTMLInputElement).checked).toBe(false);
936
+ });
937
+ });
938
+
897
939
  test('resetSettings is called appropriately', async () => {
898
940
  const onTableSettingsReset = vi.fn();
899
941
 
@@ -69,6 +69,7 @@ export const Table = (props: TableProps) => {
69
69
  footerContent,
70
70
  footerTestId,
71
71
  onGridReady,
72
+ initialSettings,
72
73
  onTableSettingsChanged,
73
74
  onTableSettingsReset,
74
75
  onColumnBordersChanged,
@@ -100,6 +101,7 @@ export const Table = (props: TableProps) => {
100
101
  setTableSpacing,
101
102
  setAreCellColorsEnabled,
102
103
  } = useTableSettings({
104
+ initialSettings,
103
105
  onTableSettingsChanged,
104
106
  onTableSettingsReset,
105
107
  onColumnBordersChanged,
@@ -24,7 +24,7 @@ const DESCRIPTION_INTRO = [
24
24
  'to update the row data in-place.',
25
25
  '',
26
26
  'Register it via `type: \'dsSelectDropdownColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
27
- 'via the string key `dsSelectDropdownCellRenderer`, or by importing the component directly.',
27
+ 'via the string key `dsSelectDropdownCellRenderer`, or via `Table.SelectDropdownCellRenderer`.',
28
28
  ].join('\n');
29
29
 
30
30
  const USAGE_GUIDANCE = [
@@ -49,8 +49,9 @@ const DEVELOPER_NOTES = [
49
49
  '',
50
50
  '**`api` is required.**',
51
51
  'The renderer attaches a `cellKeyDown` listener to the Grid API on mount so that pressing Enter',
52
- 'in the focused cell opens the dropdown. Without `api`, the keyboard shortcut is silently skipped',
53
- 'but the dropdown still renders and is clickable.',
52
+ 'in the focused cell opens the dropdown. `api` is used unconditionally with no fallback — rendering',
53
+ 'this component without a live `api` throws on mount. AG Grid always supplies `api` to cell renderers,',
54
+ 'so this only matters if you render `SelectDropdownCellRenderer` outside of `AgGridReact` yourself.',
54
55
  '',
55
56
  '**`options` must be passed via `cellRendererParams`.**',
56
57
  'Options are not part of the cell `value` — configure them in `cellRendererParams`.',
@@ -89,7 +90,9 @@ const DEVELOPER_NOTES = [
89
90
  '### TypeScript types',
90
91
  '',
91
92
  '```ts',
92
- "import { SelectDropdownCellRenderer } from '@arbor-education/design-system.components';",
93
+ "import { Table } from '@arbor-education/design-system.components';",
94
+ '',
95
+ 'type SelectDropdownCellRendererProps = React.ComponentProps<typeof Table.SelectDropdownCellRenderer>;',
93
96
  '```',
94
97
  '',
95
98
  '`SelectDropdownCellRenderer` extends `CustomCellRendererProps` with `SelectDropdownInputProps`.',
@@ -715,7 +718,7 @@ const columnDefs = [
715
718
  />
716
719
  ),
717
720
  },
718
- '(fillCell + colored) Marksheet with grade-driven cell colours. Each cell uses `backgroundColor` (derived per-row from the current grade) and `fillCell: true` so the colour spans the cell edge-to-edge, plus `cellStyle: { padding: 0 }` to strip ag-grid\'s default cell padding. `iconClickOnly: true` is set so cell selection works — click anywhere in a cell to select it (or shift/drag for a range), and only the chevron icon opens the grade picker. Text colour auto-switches between dark and white for legibility against each background.',
721
+ 'Marksheet with grade-driven cell colours. Each cell uses `backgroundColor` (derived per-row from the current grade) and `fillCell: true` so the colour spans the cell edge-to-edge, plus `cellStyle: { padding: 0 }` to strip ag-grid\'s default cell padding. `iconClickOnly: true` is set so cell selection works — click anywhere in a cell to select it (or shift/drag for a range), and only the chevron icon opens the grade picker. Text colour auto-switches between dark and white for legibility against each background.',
719
722
  );
720
723
 
721
724
  export const CustomCloseFocus: Story = withDescription(