@arbor-education/design-system.components 0.25.0 → 0.25.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 (195) hide show
  1. package/.gather/instructions/changesets.md +12 -0
  2. package/.gather/instructions/read-contributing.md +14 -0
  3. package/.storybook/DocsTemplate.tsx +3 -1
  4. package/.storybook/preview.ts +6 -2
  5. package/CHANGELOG.md +6 -0
  6. package/CONTRIBUTING.md +20 -0
  7. package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -1
  8. package/dist/components/avatarGroup/AvatarGroup.stories.js +4 -2
  9. package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -1
  10. package/dist/components/card/Card.d.ts.map +1 -1
  11. package/dist/components/card/Card.js +2 -1
  12. package/dist/components/card/Card.js.map +1 -1
  13. package/dist/components/combobox/Combobox.d.ts.map +1 -1
  14. package/dist/components/combobox/Combobox.js +10 -5
  15. package/dist/components/combobox/Combobox.js.map +1 -1
  16. package/dist/components/combobox/Combobox.stories.d.ts.map +1 -1
  17. package/dist/components/combobox/Combobox.stories.js +2 -1
  18. package/dist/components/combobox/Combobox.stories.js.map +1 -1
  19. package/dist/components/combobox/Combobox.test.js +18 -9
  20. package/dist/components/combobox/Combobox.test.js.map +1 -1
  21. package/dist/components/combobox/ComboboxButtonTrigger.d.ts.map +1 -1
  22. package/dist/components/combobox/ComboboxButtonTrigger.js +3 -1
  23. package/dist/components/combobox/ComboboxButtonTrigger.js.map +1 -1
  24. package/dist/components/combobox/ComboboxListbox.d.ts.map +1 -1
  25. package/dist/components/combobox/ComboboxListbox.js +8 -4
  26. package/dist/components/combobox/ComboboxListbox.js.map +1 -1
  27. package/dist/components/combobox/buildListboxDisplayOptions.d.ts.map +1 -1
  28. package/dist/components/combobox/buildListboxDisplayOptions.js +4 -2
  29. package/dist/components/combobox/buildListboxDisplayOptions.js.map +1 -1
  30. package/dist/components/combobox/highlightLabel.d.ts.map +1 -1
  31. package/dist/components/combobox/highlightLabel.js +2 -1
  32. package/dist/components/combobox/highlightLabel.js.map +1 -1
  33. package/dist/components/combobox/useChipSelection.d.ts.map +1 -1
  34. package/dist/components/combobox/useChipSelection.js +2 -1
  35. package/dist/components/combobox/useChipSelection.js.map +1 -1
  36. package/dist/components/combobox/useComboboxListboxKeyboard.d.ts.map +1 -1
  37. package/dist/components/combobox/useComboboxListboxKeyboard.js +8 -4
  38. package/dist/components/combobox/useComboboxListboxKeyboard.js.map +1 -1
  39. package/dist/components/combobox/useComboboxPopoverBehavior.d.ts.map +1 -1
  40. package/dist/components/combobox/useComboboxPopoverBehavior.js +16 -8
  41. package/dist/components/combobox/useComboboxPopoverBehavior.js.map +1 -1
  42. package/dist/components/combobox/useComboboxState.d.ts.map +1 -1
  43. package/dist/components/combobox/useComboboxState.js +22 -11
  44. package/dist/components/combobox/useComboboxState.js.map +1 -1
  45. package/dist/components/datePicker/DatePickerCalendarHeader.d.ts.map +1 -1
  46. package/dist/components/datePicker/DatePickerCalendarHeader.js +4 -2
  47. package/dist/components/datePicker/DatePickerCalendarHeader.js.map +1 -1
  48. package/dist/components/dateTimePicker/DateTimePicker.d.ts.map +1 -1
  49. package/dist/components/dateTimePicker/DateTimePicker.js +2 -1
  50. package/dist/components/dateTimePicker/DateTimePicker.js.map +1 -1
  51. package/dist/components/dateTimePicker/DateTimePicker.test.js.map +1 -1
  52. package/dist/components/dropdown/Dropdown.stories.d.ts.map +1 -1
  53. package/dist/components/dropdown/Dropdown.stories.js +10 -5
  54. package/dist/components/dropdown/Dropdown.stories.js.map +1 -1
  55. package/dist/components/filterBar/FilterBar.d.ts.map +1 -1
  56. package/dist/components/filterBar/FilterBar.js +4 -2
  57. package/dist/components/filterBar/FilterBar.js.map +1 -1
  58. package/dist/components/filterBar/FilterBar.stories.d.ts.map +1 -1
  59. package/dist/components/filterBar/FilterBar.stories.js +6 -3
  60. package/dist/components/filterBar/FilterBar.stories.js.map +1 -1
  61. package/dist/components/filterBar/FilterBar.test.js +6 -3
  62. package/dist/components/filterBar/FilterBar.test.js.map +1 -1
  63. package/dist/components/formField/fieldset/Fieldset.stories.d.ts.map +1 -1
  64. package/dist/components/formField/fieldset/Fieldset.stories.js.map +1 -1
  65. package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts +1 -1
  66. package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts.map +1 -1
  67. package/dist/components/formField/inputs/radio/RadioButtonGroup.js +1 -1
  68. package/dist/components/formField/inputs/radio/RadioButtonGroup.js.map +1 -1
  69. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts.map +1 -1
  70. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js +2 -1
  71. package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js.map +1 -1
  72. package/dist/components/formField/inputs/textArea/TextArea.stories.d.ts.map +1 -1
  73. package/dist/components/formField/inputs/textArea/TextArea.stories.js +10 -5
  74. package/dist/components/formField/inputs/textArea/TextArea.stories.js.map +1 -1
  75. package/dist/components/formField/inputs/time/TimeInput.js +3 -4
  76. package/dist/components/formField/inputs/time/TimeInput.js.map +1 -1
  77. package/dist/components/formField/inputs/time/TimeInput.test.js.map +1 -1
  78. package/dist/components/heading/Heading.stories.d.ts.map +1 -1
  79. package/dist/components/heading/Heading.stories.js.map +1 -1
  80. package/dist/components/modal/Modal.stories.d.ts.map +1 -1
  81. package/dist/components/modal/Modal.stories.js.map +1 -1
  82. package/dist/components/progress/Progress.stories.d.ts.map +1 -1
  83. package/dist/components/progress/Progress.stories.js +2 -1
  84. package/dist/components/progress/Progress.stories.js.map +1 -1
  85. package/dist/components/sidebarNav/SidebarNavItem.d.ts.map +1 -1
  86. package/dist/components/sidebarNav/SidebarNavItem.js +12 -11
  87. package/dist/components/sidebarNav/SidebarNavItem.js.map +1 -1
  88. package/dist/components/sidebarNav/SidebarNavRailItem.d.ts.map +1 -1
  89. package/dist/components/sidebarNav/SidebarNavRailItem.js +11 -10
  90. package/dist/components/sidebarNav/SidebarNavRailItem.js.map +1 -1
  91. package/dist/components/sidebarNav/useControllableBoolean.d.ts.map +1 -1
  92. package/dist/components/sidebarNav/useControllableBoolean.js +2 -1
  93. package/dist/components/sidebarNav/useControllableBoolean.js.map +1 -1
  94. package/dist/components/table/Table.d.ts.map +1 -1
  95. package/dist/components/table/Table.js +11 -1
  96. package/dist/components/table/Table.js.map +1 -1
  97. package/dist/components/table/Table.stories.d.ts.map +1 -1
  98. package/dist/components/table/Table.stories.js +6 -2
  99. package/dist/components/table/Table.stories.js.map +1 -1
  100. package/dist/components/table/Table.test.js +9 -3
  101. package/dist/components/table/Table.test.js.map +1 -1
  102. package/dist/components/table/cellRenderers/ComboboxCellRenderer.d.ts.map +1 -1
  103. package/dist/components/table/cellRenderers/ComboboxCellRenderer.js +16 -8
  104. package/dist/components/table/cellRenderers/ComboboxCellRenderer.js.map +1 -1
  105. package/dist/components/table/columnFilters/TimeFilter/TimeFilter.d.ts.map +1 -1
  106. package/dist/components/table/columnFilters/TimeFilter/TimeFilter.js +2 -1
  107. package/dist/components/table/columnFilters/TimeFilter/TimeFilter.js.map +1 -1
  108. package/dist/components/table/tableControls/HideColumnsDropdown.d.ts.map +1 -1
  109. package/dist/components/table/tableControls/HideColumnsDropdown.js +2 -1
  110. package/dist/components/table/tableControls/HideColumnsDropdown.js.map +1 -1
  111. package/dist/components/table/tableControls/TableControls.d.ts.map +1 -1
  112. package/dist/components/table/tableControls/TableControls.js +2 -1
  113. package/dist/components/table/tableControls/TableControls.js.map +1 -1
  114. package/dist/components/tag/Tag.test.js.map +1 -1
  115. package/dist/components/tagList/TagList.d.ts.map +1 -1
  116. package/dist/components/tagList/TagList.js +8 -4
  117. package/dist/components/tagList/TagList.js.map +1 -1
  118. package/dist/components/tagList/TagList.test.js +6 -3
  119. package/dist/components/tagList/TagList.test.js.map +1 -1
  120. package/dist/components/treeRow/TreeRowSection.d.ts.map +1 -1
  121. package/dist/components/treeRow/TreeRowSection.js +2 -1
  122. package/dist/components/treeRow/TreeRowSection.js.map +1 -1
  123. package/dist/components/userDropdown/UserDropdown.stories.d.ts.map +1 -1
  124. package/dist/components/userDropdown/UserDropdown.stories.js +66 -22
  125. package/dist/components/userDropdown/UserDropdown.stories.js.map +1 -1
  126. package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.d.ts.map +1 -1
  127. package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js +3 -1
  128. package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js.map +1 -1
  129. package/dist/utils/getTextContrast.d.ts.map +1 -1
  130. package/dist/utils/getTextContrast.js +4 -2
  131. package/dist/utils/getTextContrast.js.map +1 -1
  132. package/dist/utils/hooks/useElementWidth.d.ts.map +1 -1
  133. package/dist/utils/hooks/useElementWidth.js +2 -1
  134. package/dist/utils/hooks/useElementWidth.js.map +1 -1
  135. package/dist/utils/hooks/useMeasuredChildWidths.d.ts.map +1 -1
  136. package/dist/utils/hooks/useMeasuredChildWidths.js +4 -2
  137. package/dist/utils/hooks/useMeasuredChildWidths.js.map +1 -1
  138. package/dist/utils/hooks/useRovingFocus.d.ts.map +1 -1
  139. package/dist/utils/hooks/useRovingFocus.js +8 -4
  140. package/dist/utils/hooks/useRovingFocus.js.map +1 -1
  141. package/dist/utils/spacedWidths.d.ts.map +1 -1
  142. package/dist/utils/spacedWidths.js +6 -3
  143. package/dist/utils/spacedWidths.js.map +1 -1
  144. package/eslint.config.mts +32 -1
  145. package/package.json +1 -1
  146. package/src/components/avatarGroup/AvatarGroup.stories.tsx +6 -2
  147. package/src/components/card/Card.tsx +3 -1
  148. package/src/components/combobox/Combobox.stories.tsx +3 -1
  149. package/src/components/combobox/Combobox.test.tsx +39 -11
  150. package/src/components/combobox/Combobox.tsx +15 -5
  151. package/src/components/combobox/ComboboxButtonTrigger.tsx +3 -1
  152. package/src/components/combobox/ComboboxListbox.tsx +12 -4
  153. package/src/components/combobox/buildListboxDisplayOptions.ts +6 -2
  154. package/src/components/combobox/highlightLabel.tsx +2 -1
  155. package/src/components/combobox/useChipSelection.ts +3 -1
  156. package/src/components/combobox/useComboboxListboxKeyboard.ts +12 -4
  157. package/src/components/combobox/useComboboxPopoverBehavior.ts +24 -8
  158. package/src/components/combobox/useComboboxState.ts +28 -11
  159. package/src/components/datePicker/DatePickerCalendarHeader.tsx +6 -2
  160. package/src/components/dateTimePicker/DateTimePicker.test.tsx +2 -0
  161. package/src/components/dateTimePicker/DateTimePicker.tsx +3 -1
  162. package/src/components/dropdown/Dropdown.stories.tsx +19 -8
  163. package/src/components/filterBar/FilterBar.stories.tsx +9 -3
  164. package/src/components/filterBar/FilterBar.test.tsx +9 -3
  165. package/src/components/filterBar/FilterBar.tsx +6 -2
  166. package/src/components/formField/fieldset/Fieldset.stories.tsx +18 -3
  167. package/src/components/formField/inputs/radio/RadioButtonGroup.tsx +1 -1
  168. package/src/components/formField/inputs/selectDropdown/SelectDropdown.tsx +3 -1
  169. package/src/components/formField/inputs/textArea/TextArea.stories.tsx +10 -5
  170. package/src/components/formField/inputs/time/TimeInput.test.tsx +2 -0
  171. package/src/components/formField/inputs/time/TimeInput.tsx +4 -4
  172. package/src/components/heading/Heading.stories.tsx +12 -3
  173. package/src/components/modal/Modal.stories.tsx +15 -5
  174. package/src/components/progress/Progress.stories.tsx +3 -1
  175. package/src/components/sidebarNav/SidebarNavItem.tsx +27 -25
  176. package/src/components/sidebarNav/SidebarNavRailItem.tsx +34 -35
  177. package/src/components/sidebarNav/useControllableBoolean.ts +3 -1
  178. package/src/components/table/Table.stories.tsx +16 -12
  179. package/src/components/table/Table.test.tsx +10 -4
  180. package/src/components/table/Table.tsx +15 -5
  181. package/src/components/table/cellRenderers/ComboboxCellRenderer.tsx +19 -8
  182. package/src/components/table/columnFilters/TimeFilter/TimeFilter.tsx +3 -1
  183. package/src/components/table/tableControls/HideColumnsDropdown.tsx +3 -1
  184. package/src/components/table/tableControls/TableControls.tsx +3 -1
  185. package/src/components/tag/Tag.test.tsx +40 -8
  186. package/src/components/tagList/TagList.test.tsx +9 -3
  187. package/src/components/tagList/TagList.tsx +12 -4
  188. package/src/components/treeRow/TreeRowSection.tsx +3 -1
  189. package/src/components/userDropdown/UserDropdown.stories.tsx +66 -22
  190. package/src/components/userDropdown/internal/UserDropdownCollapsibleSection.tsx +3 -1
  191. package/src/utils/getTextContrast.ts +6 -2
  192. package/src/utils/hooks/useElementWidth.ts +3 -1
  193. package/src/utils/hooks/useMeasuredChildWidths.ts +6 -2
  194. package/src/utils/hooks/useRovingFocus.ts +12 -4
  195. package/src/utils/spacedWidths.ts +9 -3
@@ -122,9 +122,15 @@ describe('FilterBar', () => {
122
122
  const rectSpy = vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function mockRect(this: HTMLElement) {
123
123
  let width = 0;
124
124
 
125
- if (this.classList.contains('ds-tag-list__viewport')) width = 220;
126
- else if (this.classList.contains('ds-tag-list__item')) width = 84;
127
- else if (this.classList.contains('ds-tag-list__overflow')) width = 76;
125
+ if (this.classList.contains('ds-tag-list__viewport')) {
126
+ width = 220;
127
+ }
128
+ else if (this.classList.contains('ds-tag-list__item')) {
129
+ width = 84;
130
+ }
131
+ else if (this.classList.contains('ds-tag-list__overflow')) {
132
+ width = 76;
133
+ }
128
134
 
129
135
  return {
130
136
  width,
@@ -73,7 +73,9 @@ const FILTER_BAR_TYPE_ICONS: Record<FilterBarType, IconName> = {
73
73
  };
74
74
 
75
75
  const getVisibleCount = (count?: number | null): string | null => {
76
- if (typeof count !== 'number' || count <= 0) return null;
76
+ if (typeof count !== 'number' || count <= 0) {
77
+ return null;
78
+ }
77
79
  return count > 99 ? '99+' : `${count}`;
78
80
  };
79
81
 
@@ -267,7 +269,9 @@ const FilterBarActiveList = ({
267
269
  }
268
270
 
269
271
  if (!children) {
270
- if (!emptyState) return null;
272
+ if (!emptyState) {
273
+ return null;
274
+ }
271
275
  return <div className={classNames('ds-filter-bar__empty-state', className)}>{emptyState}</div>;
272
276
  }
273
277
 
@@ -320,9 +320,24 @@ export const Default: Story = {
320
320
  },
321
321
  render: args => (
322
322
  <Fieldset {...args}>
323
- <CheckboxInput id="consent-trips" name="consent" label="Consent for school trips" onChange={() => {}} />
324
- <CheckboxInput id="consent-photos" name="consent" label="Consent for photographs" onChange={() => {}} />
325
- <CheckboxInput id="consent-data" name="consent" label="Consent for data sharing with partner schools" onChange={() => {}} />
323
+ <CheckboxInput
324
+ id="consent-trips"
325
+ name="consent"
326
+ label="Consent for school trips"
327
+ onChange={() => {}}
328
+ />
329
+ <CheckboxInput
330
+ id="consent-photos"
331
+ name="consent"
332
+ label="Consent for photographs"
333
+ onChange={() => {}}
334
+ />
335
+ <CheckboxInput
336
+ id="consent-data"
337
+ name="consent"
338
+ label="Consent for data sharing with partner schools"
339
+ onChange={() => {}}
340
+ />
326
341
  </Fieldset>
327
342
  ),
328
343
  };
@@ -1,6 +1,6 @@
1
1
  import type { ChangeEvent } from 'react';
2
2
  import { RadioButtonInput } from './RadioButtonInput.js';
3
- import { Fieldset, type FieldsetProps } from '../../fieldset/Fieldset.js';
3
+ import { Fieldset, type FieldsetProps } from 'Components/formField/fieldset/Fieldset.js';
4
4
 
5
5
  export type RadioGroupOption = {
6
6
  id: string;
@@ -72,7 +72,9 @@ export const SelectDropdown = (props: SelectDropdownInputProps) => {
72
72
  const UNGROUPED_KEY = 'Ungrouped';
73
73
  const groupedOptions = options.reduce((acc, option) => {
74
74
  const key = option.group ?? UNGROUPED_KEY;
75
- if (!acc[key]) acc[key] = [];
75
+ if (!acc[key]) {
76
+ acc[key] = [];
77
+ }
76
78
  acc[key].push(option);
77
79
  return acc;
78
80
  }, {} as Record<string, SelectDropdownItemProps[]>);
@@ -353,11 +353,16 @@ const ControlledWithCharacterCountTemplate = () => {
353
353
  const isApproaching = remaining <= 100 && remaining > 0;
354
354
  const isAtLimit = remaining <= 0;
355
355
 
356
- const countColour = isAtLimit
357
- ? 'var(--color-semantic-destructive-600)'
358
- : isApproaching
359
- ? 'var(--color-semantic-caution-600)'
360
- : 'var(--color-grey-600)';
356
+ let countColour: string;
357
+ if (isAtLimit) {
358
+ countColour = 'var(--color-semantic-destructive-600)';
359
+ }
360
+ else if (isApproaching) {
361
+ countColour = 'var(--color-semantic-caution-600)';
362
+ }
363
+ else {
364
+ countColour = 'var(--color-grey-600)';
365
+ }
361
366
 
362
367
  return (
363
368
  <div style={{ maxWidth: '28rem', padding: 'var(--spacing-xlarge)', display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xsmall)' }}>
@@ -8,7 +8,9 @@ describe('TimeInput', () => {
8
8
  beforeEach(() => {
9
9
  globalThis.ResizeObserver = class {
10
10
  observe() {}
11
+
11
12
  unobserve() {}
13
+
12
14
  disconnect() {}
13
15
  } as unknown as typeof ResizeObserver;
14
16
  });
@@ -82,16 +82,16 @@ export const TimeInput = forwardRef<HTMLInputElement, TimeInputProps>((props, re
82
82
 
83
83
  const focusAndSelectHours = useCallback(() => {
84
84
  const input = inputRef.current;
85
- if (!input) return;
85
+ if (!input) {
86
+ return;
87
+ }
86
88
 
87
89
  input.focus();
88
90
 
89
91
  try {
90
92
  input.setSelectionRange(0, 2);
91
93
  }
92
- catch {
93
- // Some browsers do not expose selection APIs on time inputs.
94
- }
94
+ catch { /* Some browsers do not expose selection APIs on time inputs. */ }
95
95
  }, []);
96
96
 
97
97
  const timeOptions = useMemo<ComboboxOption[]>(
@@ -368,7 +368,10 @@ const WithBackControlLegacyTemplate = () => (
368
368
  const WithEditableTitleTemplate = () => (
369
369
  <div style={{ padding: 'var(--spacing-xlarge)' }}>
370
370
  <Heading level={1}>
371
- <EditableText text="Form 7B Registration" onEditSave={() => {}} />
371
+ <EditableText
372
+ text="Form 7B Registration"
373
+ onEditSave={() => {}}
374
+ />
372
375
  </Heading>
373
376
  </div>
374
377
  );
@@ -377,7 +380,10 @@ const WithEditableTitleAndActionTemplate = () => (
377
380
  <div style={{ padding: 'var(--spacing-xlarge)' }}>
378
381
  <Heading level={1}>
379
382
  <Heading.InnerContainer>
380
- <EditableText text="Form 7B Registration" onEditSave={() => {}} />
383
+ <EditableText
384
+ text="Form 7B Registration"
385
+ onEditSave={() => {}}
386
+ />
381
387
  </Heading.InnerContainer>
382
388
  <Heading.InnerContainer>
383
389
  <Button variant="primary" type="button">Save changes</Button>
@@ -393,7 +399,10 @@ const WithEditableTitleAndMultipleActionsTemplate = () => (
393
399
  <Button variant="tertiary" type="button" iconLeftName="chevron-left" iconLeftScreenReaderText="Go back">
394
400
  Back
395
401
  </Button>
396
- <EditableText text="Autumn term report" onEditSave={() => {}} />
402
+ <EditableText
403
+ text="Autumn term report"
404
+ onEditSave={() => {}}
405
+ />
397
406
  </Heading.InnerContainer>
398
407
  <Heading.InnerContainer className="medium-spacing-gap">
399
408
  <Button variant="secondary" type="button">Export to CSV</Button>
@@ -548,11 +548,21 @@ const WithDropdownInsideModalTemplate = () => {
548
548
  <Button variant="dropdown">Select a teacher</Button>
549
549
  </Dropdown.Trigger>
550
550
  <Dropdown.Content>
551
- <Dropdown.Item onSelect={() => {}}>Ms A. Johnson — English</Dropdown.Item>
552
- <Dropdown.Item onSelect={() => {}}>Mr B. PatelMathematics</Dropdown.Item>
553
- <Dropdown.Item onSelect={() => {}}>Mrs C. Williams — Science</Dropdown.Item>
554
- <Dropdown.Item onSelect={() => {}}>Mr D. Thompson — History</Dropdown.Item>
555
- <Dropdown.Item onSelect={() => {}}>Ms E. OkonkwoArt</Dropdown.Item>
551
+ <Dropdown.Item onSelect={() => {}}>
552
+ Ms A. JohnsonEnglish
553
+ </Dropdown.Item>
554
+ <Dropdown.Item onSelect={() => {}}>
555
+ Mr B. PatelMathematics
556
+ </Dropdown.Item>
557
+ <Dropdown.Item onSelect={() => {}}>
558
+ Mrs C. Williams — Science
559
+ </Dropdown.Item>
560
+ <Dropdown.Item onSelect={() => {}}>
561
+ Mr D. Thompson — History
562
+ </Dropdown.Item>
563
+ <Dropdown.Item onSelect={() => {}}>
564
+ Ms E. Okonkwo — Art
565
+ </Dropdown.Item>
556
566
  </Dropdown.Content>
557
567
  </Dropdown>
558
568
  </Modal.Body>
@@ -274,7 +274,9 @@ const InteractiveLoadingTemplate = (args: React.ComponentProps<typeof Progress>)
274
274
  const [running, setRunning] = useState(true);
275
275
 
276
276
  useEffect(() => {
277
- if (!running) return;
277
+ if (!running) {
278
+ return;
279
+ }
278
280
  if (progress >= 100) {
279
281
  setRunning(false);
280
282
  return;
@@ -97,6 +97,32 @@ export const SidebarNavItem = (props: SidebarNavItemProps) => {
97
97
  linkElementProps as AnchorHTMLAttributes<HTMLAnchorElement> | undefined,
98
98
  );
99
99
 
100
+ const renderAnchorElement = () => renderLink
101
+ ? renderLink({
102
+ href: href!,
103
+ className: linkClassName,
104
+ ariaCurrent: current ? 'page' : undefined,
105
+ linkProps,
106
+ linkElementProps: anchorLinkElementProps as Omit<
107
+ AnchorHTMLAttributes<HTMLAnchorElement>,
108
+ 'href' | 'className' | 'children'
109
+ > | undefined,
110
+ onClick: handleClick,
111
+ children: linkChildren,
112
+ })
113
+ : (
114
+ <a
115
+ href={href}
116
+ className={linkClassName}
117
+ aria-current={current ? 'page' : undefined}
118
+ {...linkProps}
119
+ {...anchorLinkElementProps}
120
+ onClick={handleClick as MouseEventHandler<HTMLAnchorElement>}
121
+ >
122
+ {linkChildren}
123
+ </a>
124
+ );
125
+
100
126
  const linkElementNode = linkElement === 'button'
101
127
  ? (
102
128
  <button
@@ -109,31 +135,7 @@ export const SidebarNavItem = (props: SidebarNavItemProps) => {
109
135
  {linkChildren}
110
136
  </button>
111
137
  )
112
- : renderLink
113
- ? renderLink({
114
- href: href!,
115
- className: linkClassName,
116
- ariaCurrent: current ? 'page' : undefined,
117
- linkProps,
118
- linkElementProps: anchorLinkElementProps as Omit<
119
- AnchorHTMLAttributes<HTMLAnchorElement>,
120
- 'href' | 'className' | 'children'
121
- > | undefined,
122
- onClick: handleClick,
123
- children: linkChildren,
124
- })
125
- : (
126
- <a
127
- href={href}
128
- className={linkClassName}
129
- aria-current={current ? 'page' : undefined}
130
- {...linkProps}
131
- {...anchorLinkElementProps}
132
- onClick={handleClick as MouseEventHandler<HTMLAnchorElement>}
133
- >
134
- {linkChildren}
135
- </a>
136
- );
138
+ : renderAnchorElement();
137
139
 
138
140
  return (
139
141
  <li
@@ -34,41 +34,40 @@ export const SidebarNavRailItem = (props: SidebarNavRailItemProps) => {
34
34
  <span className="ds-sidebar-nav__rail-badge-anchor">{children}</span>
35
35
  );
36
36
 
37
- const trigger
38
- = href
39
- ? (
40
- renderLink
41
- ? renderLink({
42
- href,
43
- className: itemClassName,
44
- ariaCurrent: current ? 'page' : undefined,
45
- ariaLabel,
46
- onClick,
47
- children: content,
48
- })
49
- : (
50
- <a
51
- href={href}
52
- className={itemClassName}
53
- aria-current={current ? 'page' : undefined}
54
- aria-label={ariaLabel}
55
- onClick={onClick}
56
- >
57
- {content}
58
- </a>
59
- )
60
- )
61
- : (
62
- <button
63
- type="button"
64
- className={itemClassName}
65
- aria-current={current ? 'page' : undefined}
66
- aria-label={ariaLabel}
67
- onClick={onClick}
68
- >
69
- {content}
70
- </button>
71
- );
37
+ const renderLinkNode = () => renderLink
38
+ ? renderLink({
39
+ href: href!,
40
+ className: itemClassName,
41
+ ariaCurrent: current ? 'page' : undefined,
42
+ ariaLabel,
43
+ onClick,
44
+ children: content,
45
+ })
46
+ : (
47
+ <a
48
+ href={href}
49
+ className={itemClassName}
50
+ aria-current={current ? 'page' : undefined}
51
+ aria-label={ariaLabel}
52
+ onClick={onClick}
53
+ >
54
+ {content}
55
+ </a>
56
+ );
57
+
58
+ const trigger = href
59
+ ? renderLinkNode()
60
+ : (
61
+ <button
62
+ type="button"
63
+ className={itemClassName}
64
+ aria-current={current ? 'page' : undefined}
65
+ aria-label={ariaLabel}
66
+ onClick={onClick}
67
+ >
68
+ {content}
69
+ </button>
70
+ );
72
71
 
73
72
  return (
74
73
  <li
@@ -12,7 +12,9 @@ export function useControllableBoolean(args: {
12
12
  const current = isControlled ? (value as boolean) : uncontrolled;
13
13
 
14
14
  const set = useCallback((next: boolean) => {
15
- if (!isControlled) setUncontrolled(next);
15
+ if (!isControlled) {
16
+ setUncontrolled(next);
17
+ }
16
18
  onChange?.(next);
17
19
  }, [isControlled, onChange]);
18
20
 
@@ -385,7 +385,7 @@ type CellColors = {
385
385
  semanticColor?: SemanticColorKey;
386
386
  };
387
387
 
388
- interface RowData {
388
+ type RowData = {
389
389
  id: number;
390
390
  name: { value: string } & CellColors;
391
391
  email: { value: string } & CellColors;
@@ -395,7 +395,7 @@ interface RowData {
395
395
  active: boolean;
396
396
  time: string;
397
397
  dateOfBirth: Date;
398
- }
398
+ };
399
399
 
400
400
  const sampleData: RowData[] = [
401
401
  {
@@ -707,11 +707,15 @@ export const WithBulkActions: Story = {
707
707
  bulkActions={[
708
708
  {
709
709
  displayName: 'foo',
710
- callback: (gridApi) => { console.log('clicked on the foo action', gridApi); },
710
+ callback: (gridApi) => {
711
+ console.log('clicked on the foo action', gridApi);
712
+ },
711
713
  },
712
714
  {
713
715
  displayName: 'bar',
714
- callback: (gridApi) => { console.log('clicked on the bar action', gridApi); },
716
+ callback: (gridApi) => {
717
+ console.log('clicked on the bar action', gridApi);
718
+ },
715
719
  disabled: true,
716
720
  },
717
721
  ]}
@@ -1912,13 +1916,13 @@ export const TableWithSemanticColors: Story = {
1912
1916
  },
1913
1917
  };
1914
1918
 
1915
- interface DateEditorRowData {
1919
+ type DateEditorRowData = {
1916
1920
  id: number;
1917
1921
  name: { value: string };
1918
1922
  dateOfBirth: Date;
1919
1923
  enrollmentDate: Date;
1920
1924
  graduationDate: Date | null;
1921
- }
1925
+ };
1922
1926
 
1923
1927
  const dateEditorSampleData: DateEditorRowData[] = [
1924
1928
  {
@@ -2014,12 +2018,12 @@ export const WithDateCellEditor: Story = {
2014
2018
  },
2015
2019
  };
2016
2020
 
2017
- interface BooleanRowData {
2021
+ type BooleanRowData = {
2018
2022
  id: number;
2019
2023
  name: string;
2020
2024
  hasPet: boolean | null | undefined;
2021
2025
  isEnrolled: boolean | null | undefined;
2022
- }
2026
+ };
2023
2027
 
2024
2028
  const booleanCellRendererData: BooleanRowData[] = [
2025
2029
  { id: 1, name: 'Alice Johnson', hasPet: true, isEnrolled: true },
@@ -2228,13 +2232,13 @@ export const WithCheckboxCellRenderer: Story = {
2228
2232
  },
2229
2233
  };
2230
2234
 
2231
- interface SelectDropdownRowData {
2235
+ type SelectDropdownRowData = {
2232
2236
  id: number;
2233
2237
  name: string;
2234
2238
  status: string | null;
2235
2239
  priority: string | null;
2236
2240
  category: string | null;
2237
- }
2241
+ };
2238
2242
 
2239
2243
  const statusOptions = [
2240
2244
  { value: 'active', label: 'Active' },
@@ -2305,14 +2309,14 @@ export const WithSelectDropdownCellRenderer: Story = {
2305
2309
  },
2306
2310
  };
2307
2311
 
2308
- interface ComboboxRowData {
2312
+ type ComboboxRowData = {
2309
2313
  id: number;
2310
2314
  name: string;
2311
2315
  subject: string | null;
2312
2316
  level: string | null;
2313
2317
  tags: string[];
2314
2318
  skills: string[];
2315
- }
2319
+ };
2316
2320
 
2317
2321
  const subjectOptions = [
2318
2322
  { value: 'english-language', label: 'English Language' },
@@ -820,7 +820,7 @@ describe('Table', () => {
820
820
  actions={[
821
821
  {
822
822
  displayName: 'Test Action',
823
- callback: () => { },
823
+ callback: () => {},
824
824
  },
825
825
  ]}
826
826
  />
@@ -1810,7 +1810,9 @@ describe('Table', () => {
1810
1810
  <Table
1811
1811
  columnDefs={columnDefs}
1812
1812
  rowData={rowData}
1813
- onGridReady={(event) => { gridApi = event.api; }}
1813
+ onGridReady={(event) => {
1814
+ gridApi = event.api;
1815
+ }}
1814
1816
  />,
1815
1817
  );
1816
1818
  await waitFor(() => expect(screen.getByRole('grid')).toBeInTheDocument());
@@ -1828,7 +1830,9 @@ describe('Table', () => {
1828
1830
  <Table
1829
1831
  columnDefs={columnDefs}
1830
1832
  rowData={rowData}
1831
- onGridReady={(event) => { gridApi = event.api; }}
1833
+ onGridReady={(event) => {
1834
+ gridApi = event.api;
1835
+ }}
1832
1836
  onCellValueChanged={onCellValueChanged}
1833
1837
  />,
1834
1838
  );
@@ -1860,7 +1864,9 @@ describe('Table', () => {
1860
1864
  <Table
1861
1865
  columnDefs={columnDefs}
1862
1866
  rowData={rowData}
1863
- onGridReady={(event) => { gridApi = event.api; }}
1867
+ onGridReady={(event) => {
1868
+ gridApi = event.api;
1869
+ }}
1864
1870
  />,
1865
1871
  );
1866
1872
  await waitFor(() => expect(screen.getByRole('grid')).toBeInTheDocument());
@@ -141,11 +141,21 @@ export const Table = (props: TableProps) => {
141
141
  <section
142
142
  data-testid={testId}
143
143
  className={classNames('ds-table__container', wrapperClassName)}
144
- onMouseDown={() => { isUsingKeyboardRef.current = false; }}
145
- onMouseUp={() => { isUsingKeyboardRef.current = false; }}
146
- onMouseMove={() => { isUsingKeyboardRef.current = false; }}
147
- onKeyDown={() => { isUsingKeyboardRef.current = true; }}
148
- onKeyUp={() => { isUsingKeyboardRef.current = true; }}
144
+ onMouseDown={() => {
145
+ isUsingKeyboardRef.current = false;
146
+ }}
147
+ onMouseUp={() => {
148
+ isUsingKeyboardRef.current = false;
149
+ }}
150
+ onMouseMove={() => {
151
+ isUsingKeyboardRef.current = false;
152
+ }}
153
+ onKeyDown={() => {
154
+ isUsingKeyboardRef.current = true;
155
+ }}
156
+ onKeyUp={() => {
157
+ isUsingKeyboardRef.current = true;
158
+ }}
149
159
  >
150
160
  {headerContent && (
151
161
  <TableHeader data-testid={headerTestId} hasSearch={hasSearch} searchValue={searchValue} setSearchValue={setSearchValue}>
@@ -35,11 +35,16 @@ export const ComboboxCellRenderer = (props: ComboboxCellRendererProps) => {
35
35
 
36
36
  const containerRef = useRef<HTMLDivElement>(null);
37
37
 
38
- const normalizedValue: string[] = Array.isArray(value)
39
- ? value.map(String)
40
- : value != null && value !== ''
41
- ? [String(value)]
42
- : [];
38
+ let normalizedValue: string[];
39
+ if (Array.isArray(value)) {
40
+ normalizedValue = value.map(String);
41
+ }
42
+ else if (value != null && value !== '') {
43
+ normalizedValue = [String(value)];
44
+ }
45
+ else {
46
+ normalizedValue = [];
47
+ }
43
48
 
44
49
  useComponentDidMount(() => {
45
50
  // open the combobox when the user presses Enter on the ag-grid cell
@@ -56,7 +61,9 @@ export const ComboboxCellRenderer = (props: ComboboxCellRendererProps) => {
56
61
  const trigger = containerRef.current?.querySelector<HTMLElement>(
57
62
  '[role="combobox"], [role="button"][aria-haspopup="listbox"]',
58
63
  );
59
- if (!trigger) return;
64
+ if (!trigger) {
65
+ return;
66
+ }
60
67
  trigger.focus();
61
68
  // button-style triggers (single-select) need an explicit click to open the popover
62
69
  if (trigger.getAttribute('role') === 'button') {
@@ -77,7 +84,9 @@ export const ComboboxCellRenderer = (props: ComboboxCellRendererProps) => {
77
84
  if (trigger) {
78
85
  observer = new MutationObserver(() => {
79
86
  const isOpen = trigger.getAttribute('aria-expanded') === 'true';
80
- if (isOpen || column == null || node.rowIndex == null) return;
87
+ if (isOpen || column == null || node.rowIndex == null) {
88
+ return;
89
+ }
81
90
  const active = document.activeElement;
82
91
  const focusIsStillInCell = active == null || active === document.body || container.contains(active);
83
92
  if (focusIsStillInCell) {
@@ -126,7 +135,9 @@ ComboboxCellRenderer.colDefDefaults = {
126
135
  autoHeight: true,
127
136
  suppressKeyboardEvent: (params: SuppressKeyboardEventParams) => {
128
137
  const cell = (params.event.target as HTMLElement)?.closest('.ag-cell');
129
- if (!cell) return false;
138
+ if (!cell) {
139
+ return false;
140
+ }
130
141
  const openTrigger = cell.querySelector(
131
142
  '[role="combobox"][aria-expanded="true"], [role="button"][aria-expanded="true"]',
132
143
  );
@@ -44,7 +44,9 @@ function cellValueToDate(value: unknown): Date | null {
44
44
  }
45
45
  if (typeof value === 'string') {
46
46
  const fromTime = transformTimeStringToDate(value);
47
- if (fromTime !== null) return fromTime;
47
+ if (fromTime !== null) {
48
+ return fromTime;
49
+ }
48
50
  const parsed = new Date(value);
49
51
  return Number.isNaN(parsed.getTime()) ? null : parsed;
50
52
  }
@@ -28,7 +28,9 @@ export const HideColumnsDropdown = (props: HideColumnsDropdownProps) => {
28
28
  setHiddenColumns(getHiddenColumnIds(currentColumns));
29
29
  }, [currentColumns]);
30
30
 
31
- if (!currentColumns || currentColumns.length === 0) return null;
31
+ if (!currentColumns || currentColumns.length === 0) {
32
+ return null;
33
+ }
32
34
 
33
35
  const options = currentColumns.map(column => ({
34
36
  label: column.getColDef().headerName,
@@ -58,7 +58,9 @@ export const TableControls = (props: TableControlsProps) => {
58
58
  || onHelp
59
59
  || onExpandToggle !== undefined;
60
60
 
61
- if (!hasStartGroup && !hasEndGroup) return null;
61
+ if (!hasStartGroup && !hasEndGroup) {
62
+ return null;
63
+ }
62
64
 
63
65
  return (
64
66
  <div className={classNames('ds-table__controls', className)}>