@arbor-education/design-system.components 0.24.3 → 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.
- package/.gather/instructions/changesets.md +12 -0
- package/.gather/instructions/read-contributing.md +14 -0
- package/.storybook/DocsTemplate.tsx +3 -1
- package/.storybook/preview.ts +6 -2
- package/CHANGELOG.md +12 -0
- package/CONTRIBUTING.md +20 -0
- package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/components/avatarGroup/AvatarGroup.stories.js +4 -2
- package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -1
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +2 -1
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.js +10 -5
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/combobox/Combobox.stories.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.stories.js +2 -1
- package/dist/components/combobox/Combobox.stories.js.map +1 -1
- package/dist/components/combobox/Combobox.test.js +18 -9
- package/dist/components/combobox/Combobox.test.js.map +1 -1
- package/dist/components/combobox/ComboboxButtonTrigger.d.ts.map +1 -1
- package/dist/components/combobox/ComboboxButtonTrigger.js +3 -1
- package/dist/components/combobox/ComboboxButtonTrigger.js.map +1 -1
- package/dist/components/combobox/ComboboxListbox.d.ts.map +1 -1
- package/dist/components/combobox/ComboboxListbox.js +8 -4
- package/dist/components/combobox/ComboboxListbox.js.map +1 -1
- package/dist/components/combobox/buildListboxDisplayOptions.d.ts.map +1 -1
- package/dist/components/combobox/buildListboxDisplayOptions.js +4 -2
- package/dist/components/combobox/buildListboxDisplayOptions.js.map +1 -1
- package/dist/components/combobox/highlightLabel.d.ts.map +1 -1
- package/dist/components/combobox/highlightLabel.js +2 -1
- package/dist/components/combobox/highlightLabel.js.map +1 -1
- package/dist/components/combobox/useChipSelection.d.ts.map +1 -1
- package/dist/components/combobox/useChipSelection.js +2 -1
- package/dist/components/combobox/useChipSelection.js.map +1 -1
- package/dist/components/combobox/useComboboxListboxKeyboard.d.ts.map +1 -1
- package/dist/components/combobox/useComboboxListboxKeyboard.js +8 -4
- package/dist/components/combobox/useComboboxListboxKeyboard.js.map +1 -1
- package/dist/components/combobox/useComboboxPopoverBehavior.d.ts.map +1 -1
- package/dist/components/combobox/useComboboxPopoverBehavior.js +16 -8
- package/dist/components/combobox/useComboboxPopoverBehavior.js.map +1 -1
- package/dist/components/combobox/useComboboxState.d.ts.map +1 -1
- package/dist/components/combobox/useComboboxState.js +22 -11
- package/dist/components/combobox/useComboboxState.js.map +1 -1
- package/dist/components/datePicker/DatePickerCalendarHeader.d.ts.map +1 -1
- package/dist/components/datePicker/DatePickerCalendarHeader.js +4 -2
- package/dist/components/datePicker/DatePickerCalendarHeader.js.map +1 -1
- package/dist/components/dateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/dateTimePicker/DateTimePicker.js +2 -1
- package/dist/components/dateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/dateTimePicker/DateTimePicker.test.js.map +1 -1
- package/dist/components/dropdown/Dropdown.stories.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.stories.js +10 -5
- package/dist/components/dropdown/Dropdown.stories.js.map +1 -1
- package/dist/components/filterBar/FilterBar.d.ts.map +1 -1
- package/dist/components/filterBar/FilterBar.js +4 -2
- package/dist/components/filterBar/FilterBar.js.map +1 -1
- package/dist/components/filterBar/FilterBar.stories.d.ts.map +1 -1
- package/dist/components/filterBar/FilterBar.stories.js +6 -3
- package/dist/components/filterBar/FilterBar.stories.js.map +1 -1
- package/dist/components/filterBar/FilterBar.test.js +6 -3
- package/dist/components/filterBar/FilterBar.test.js.map +1 -1
- package/dist/components/formField/fieldset/Fieldset.stories.d.ts.map +1 -1
- package/dist/components/formField/fieldset/Fieldset.stories.js.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.js +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.js.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js +2 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/formField/inputs/textArea/TextArea.stories.d.ts.map +1 -1
- package/dist/components/formField/inputs/textArea/TextArea.stories.js +10 -5
- package/dist/components/formField/inputs/textArea/TextArea.stories.js.map +1 -1
- package/dist/components/formField/inputs/time/TimeInput.js +3 -4
- package/dist/components/formField/inputs/time/TimeInput.js.map +1 -1
- package/dist/components/formField/inputs/time/TimeInput.test.js.map +1 -1
- package/dist/components/heading/Heading.stories.d.ts.map +1 -1
- package/dist/components/heading/Heading.stories.js.map +1 -1
- package/dist/components/modal/Modal.stories.d.ts.map +1 -1
- package/dist/components/modal/Modal.stories.js.map +1 -1
- package/dist/components/progress/Progress.stories.d.ts.map +1 -1
- package/dist/components/progress/Progress.stories.js +2 -1
- package/dist/components/progress/Progress.stories.js.map +1 -1
- package/dist/components/section/Section.d.ts +3 -6
- package/dist/components/section/Section.d.ts.map +1 -1
- package/dist/components/section/Section.js +2 -2
- package/dist/components/section/Section.js.map +1 -1
- package/dist/components/section/Section.stories.d.ts +1 -0
- package/dist/components/section/Section.stories.d.ts.map +1 -1
- package/dist/components/section/Section.stories.js +125 -52
- package/dist/components/section/Section.stories.js.map +1 -1
- package/dist/components/section/Section.test.js +13 -2
- package/dist/components/section/Section.test.js.map +1 -1
- package/dist/components/sidebarNav/SidebarNavItem.d.ts.map +1 -1
- package/dist/components/sidebarNav/SidebarNavItem.js +12 -11
- package/dist/components/sidebarNav/SidebarNavItem.js.map +1 -1
- package/dist/components/sidebarNav/SidebarNavRailItem.d.ts.map +1 -1
- package/dist/components/sidebarNav/SidebarNavRailItem.js +11 -10
- package/dist/components/sidebarNav/SidebarNavRailItem.js.map +1 -1
- package/dist/components/sidebarNav/useControllableBoolean.d.ts.map +1 -1
- package/dist/components/sidebarNav/useControllableBoolean.js +2 -1
- package/dist/components/sidebarNav/useControllableBoolean.js.map +1 -1
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +11 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.stories.d.ts.map +1 -1
- package/dist/components/table/Table.stories.js +6 -2
- package/dist/components/table/Table.stories.js.map +1 -1
- package/dist/components/table/Table.test.js +9 -3
- package/dist/components/table/Table.test.js.map +1 -1
- package/dist/components/table/cellRenderers/ComboboxCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/ComboboxCellRenderer.js +16 -8
- package/dist/components/table/cellRenderers/ComboboxCellRenderer.js.map +1 -1
- package/dist/components/table/columnFilters/TimeFilter/TimeFilter.d.ts.map +1 -1
- package/dist/components/table/columnFilters/TimeFilter/TimeFilter.js +2 -1
- package/dist/components/table/columnFilters/TimeFilter/TimeFilter.js.map +1 -1
- package/dist/components/table/tableControls/HideColumnsDropdown.d.ts.map +1 -1
- package/dist/components/table/tableControls/HideColumnsDropdown.js +2 -1
- package/dist/components/table/tableControls/HideColumnsDropdown.js.map +1 -1
- package/dist/components/table/tableControls/TableControls.d.ts.map +1 -1
- package/dist/components/table/tableControls/TableControls.js +2 -1
- package/dist/components/table/tableControls/TableControls.js.map +1 -1
- package/dist/components/tag/Tag.test.js.map +1 -1
- package/dist/components/tagList/TagList.d.ts.map +1 -1
- package/dist/components/tagList/TagList.js +8 -4
- package/dist/components/tagList/TagList.js.map +1 -1
- package/dist/components/tagList/TagList.test.js +6 -3
- package/dist/components/tagList/TagList.test.js.map +1 -1
- package/dist/components/treeRow/TreeRowSection.d.ts.map +1 -1
- package/dist/components/treeRow/TreeRowSection.js +2 -1
- package/dist/components/treeRow/TreeRowSection.js.map +1 -1
- package/dist/components/userDropdown/UserDropdown.stories.d.ts.map +1 -1
- package/dist/components/userDropdown/UserDropdown.stories.js +66 -22
- package/dist/components/userDropdown/UserDropdown.stories.js.map +1 -1
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.d.ts.map +1 -1
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js +3 -1
- package/dist/components/userDropdown/internal/UserDropdownCollapsibleSection.js.map +1 -1
- package/dist/utils/getTextContrast.d.ts.map +1 -1
- package/dist/utils/getTextContrast.js +4 -2
- package/dist/utils/getTextContrast.js.map +1 -1
- package/dist/utils/hooks/useElementWidth.d.ts.map +1 -1
- package/dist/utils/hooks/useElementWidth.js +2 -1
- package/dist/utils/hooks/useElementWidth.js.map +1 -1
- package/dist/utils/hooks/useMeasuredChildWidths.d.ts.map +1 -1
- package/dist/utils/hooks/useMeasuredChildWidths.js +4 -2
- package/dist/utils/hooks/useMeasuredChildWidths.js.map +1 -1
- package/dist/utils/hooks/useRovingFocus.d.ts.map +1 -1
- package/dist/utils/hooks/useRovingFocus.js +8 -4
- package/dist/utils/hooks/useRovingFocus.js.map +1 -1
- package/dist/utils/spacedWidths.d.ts.map +1 -1
- package/dist/utils/spacedWidths.js +6 -3
- package/dist/utils/spacedWidths.js.map +1 -1
- package/eslint.config.mts +32 -1
- package/package.json +1 -1
- package/src/components/avatarGroup/AvatarGroup.stories.tsx +6 -2
- package/src/components/card/Card.tsx +3 -1
- package/src/components/combobox/Combobox.stories.tsx +3 -1
- package/src/components/combobox/Combobox.test.tsx +39 -11
- package/src/components/combobox/Combobox.tsx +15 -5
- package/src/components/combobox/ComboboxButtonTrigger.tsx +3 -1
- package/src/components/combobox/ComboboxListbox.tsx +12 -4
- package/src/components/combobox/buildListboxDisplayOptions.ts +6 -2
- package/src/components/combobox/highlightLabel.tsx +2 -1
- package/src/components/combobox/useChipSelection.ts +3 -1
- package/src/components/combobox/useComboboxListboxKeyboard.ts +12 -4
- package/src/components/combobox/useComboboxPopoverBehavior.ts +24 -8
- package/src/components/combobox/useComboboxState.ts +28 -11
- package/src/components/datePicker/DatePickerCalendarHeader.tsx +6 -2
- package/src/components/dateTimePicker/DateTimePicker.test.tsx +2 -0
- package/src/components/dateTimePicker/DateTimePicker.tsx +3 -1
- package/src/components/dropdown/Dropdown.stories.tsx +19 -8
- package/src/components/filterBar/FilterBar.stories.tsx +9 -3
- package/src/components/filterBar/FilterBar.test.tsx +9 -3
- package/src/components/filterBar/FilterBar.tsx +6 -2
- package/src/components/formField/fieldset/Fieldset.stories.tsx +18 -3
- package/src/components/formField/inputs/radio/RadioButtonGroup.tsx +1 -1
- package/src/components/formField/inputs/selectDropdown/SelectDropdown.tsx +3 -1
- package/src/components/formField/inputs/textArea/TextArea.stories.tsx +10 -5
- package/src/components/formField/inputs/time/TimeInput.test.tsx +2 -0
- package/src/components/formField/inputs/time/TimeInput.tsx +4 -4
- package/src/components/heading/Heading.stories.tsx +12 -3
- package/src/components/modal/Modal.stories.tsx +15 -5
- package/src/components/progress/Progress.stories.tsx +3 -1
- package/src/components/section/Section.stories.tsx +198 -70
- package/src/components/section/Section.test.tsx +14 -8
- package/src/components/section/Section.tsx +7 -15
- package/src/components/sidebarNav/SidebarNavItem.tsx +27 -25
- package/src/components/sidebarNav/SidebarNavRailItem.tsx +34 -35
- package/src/components/sidebarNav/useControllableBoolean.ts +3 -1
- package/src/components/table/Table.stories.tsx +16 -12
- package/src/components/table/Table.test.tsx +10 -4
- package/src/components/table/Table.tsx +15 -5
- package/src/components/table/cellRenderers/ComboboxCellRenderer.tsx +19 -8
- package/src/components/table/columnFilters/TimeFilter/TimeFilter.tsx +3 -1
- package/src/components/table/tableControls/HideColumnsDropdown.tsx +3 -1
- package/src/components/table/tableControls/TableControls.tsx +3 -1
- package/src/components/tag/Tag.test.tsx +40 -8
- package/src/components/tagList/TagList.test.tsx +9 -3
- package/src/components/tagList/TagList.tsx +12 -4
- package/src/components/treeRow/TreeRowSection.tsx +3 -1
- package/src/components/userDropdown/UserDropdown.stories.tsx +66 -22
- package/src/components/userDropdown/internal/UserDropdownCollapsibleSection.tsx +3 -1
- package/src/utils/getTextContrast.ts +6 -2
- package/src/utils/hooks/useElementWidth.ts +3 -1
- package/src/utils/hooks/useMeasuredChildWidths.ts +6 -2
- package/src/utils/hooks/useRovingFocus.ts +12 -4
- package/src/utils/spacedWidths.ts +9 -3
|
@@ -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
|
-
:
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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)
|
|
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
|
-
|
|
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) => {
|
|
710
|
+
callback: (gridApi) => {
|
|
711
|
+
console.log('clicked on the foo action', gridApi);
|
|
712
|
+
},
|
|
711
713
|
},
|
|
712
714
|
{
|
|
713
715
|
displayName: 'bar',
|
|
714
|
-
callback: (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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) => {
|
|
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) => {
|
|
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) => {
|
|
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={() => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
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)
|
|
61
|
+
if (!hasStartGroup && !hasEndGroup) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
66
|
<div className={classNames('ds-table__controls', className)}>
|
|
@@ -53,13 +53,20 @@ describe('Tag', () => {
|
|
|
53
53
|
|
|
54
54
|
describe('onRemove', () => {
|
|
55
55
|
test('renders remove button when onRemove is provided', () => {
|
|
56
|
-
render(
|
|
56
|
+
render(
|
|
57
|
+
<Tag onRemove={() => {}}>
|
|
58
|
+
Removable
|
|
59
|
+
</Tag>,
|
|
60
|
+
);
|
|
57
61
|
expect(screen.getByRole('button', { name: 'Remove' })).toBeInTheDocument();
|
|
58
62
|
});
|
|
59
63
|
|
|
60
64
|
test('uses a custom remove label when provided', () => {
|
|
61
65
|
render(
|
|
62
|
-
<Tag
|
|
66
|
+
<Tag
|
|
67
|
+
onRemove={() => {}}
|
|
68
|
+
removeLabel="Remove Alice Johnson"
|
|
69
|
+
>
|
|
63
70
|
Removable
|
|
64
71
|
</Tag>,
|
|
65
72
|
);
|
|
@@ -67,13 +74,20 @@ describe('Tag', () => {
|
|
|
67
74
|
});
|
|
68
75
|
|
|
69
76
|
test('keeps the remove button in the tab order by default', () => {
|
|
70
|
-
render(
|
|
77
|
+
render(
|
|
78
|
+
<Tag onRemove={() => {}}>
|
|
79
|
+
Removable
|
|
80
|
+
</Tag>,
|
|
81
|
+
);
|
|
71
82
|
expect(screen.getByRole('button', { name: 'Remove' })).toHaveAttribute('tabindex', '0');
|
|
72
83
|
});
|
|
73
84
|
|
|
74
85
|
test('allows composite parents to remove the button from the tab order', () => {
|
|
75
86
|
render(
|
|
76
|
-
<Tag
|
|
87
|
+
<Tag
|
|
88
|
+
onRemove={() => {}}
|
|
89
|
+
removeButtonTabIndex={-1}
|
|
90
|
+
>
|
|
77
91
|
Removable
|
|
78
92
|
</Tag>,
|
|
79
93
|
);
|
|
@@ -110,18 +124,32 @@ describe('Tag', () => {
|
|
|
110
124
|
|
|
111
125
|
describe('onClick', () => {
|
|
112
126
|
test('renders a primary action button when onClick is provided', () => {
|
|
113
|
-
render(
|
|
127
|
+
render(
|
|
128
|
+
<Tag onClick={() => {}}>
|
|
129
|
+
Clickable
|
|
130
|
+
</Tag>,
|
|
131
|
+
);
|
|
114
132
|
expect(screen.getByRole('button', { name: 'Clickable' })).toBeInTheDocument();
|
|
115
133
|
});
|
|
116
134
|
|
|
117
135
|
test('uses a custom action label when provided', () => {
|
|
118
|
-
render(
|
|
136
|
+
render(
|
|
137
|
+
<Tag
|
|
138
|
+
onClick={() => {}}
|
|
139
|
+
actionLabel="Open filter for Alice Johnson"
|
|
140
|
+
>
|
|
141
|
+
Alice Johnson
|
|
142
|
+
</Tag>,
|
|
143
|
+
);
|
|
119
144
|
expect(screen.getByRole('button', { name: 'Open filter for Alice Johnson' })).toBeInTheDocument();
|
|
120
145
|
});
|
|
121
146
|
|
|
122
147
|
test('allows composite parents to remove the primary action from the tab order', () => {
|
|
123
148
|
render(
|
|
124
|
-
<Tag
|
|
149
|
+
<Tag
|
|
150
|
+
onClick={() => {}}
|
|
151
|
+
actionButtonTabIndex={-1}
|
|
152
|
+
>
|
|
125
153
|
Clickable
|
|
126
154
|
</Tag>,
|
|
127
155
|
);
|
|
@@ -138,7 +166,11 @@ describe('Tag', () => {
|
|
|
138
166
|
|
|
139
167
|
test('forwards aria-controls and aria-expanded to the primary action button', () => {
|
|
140
168
|
render(
|
|
141
|
-
<Tag
|
|
169
|
+
<Tag
|
|
170
|
+
onClick={() => {}}
|
|
171
|
+
ariaControls="filter-modal"
|
|
172
|
+
ariaExpanded={true}
|
|
173
|
+
>
|
|
142
174
|
Clickable
|
|
143
175
|
</Tag>,
|
|
144
176
|
);
|
|
@@ -10,9 +10,15 @@ const mockTagListCollapseRects = () =>
|
|
|
10
10
|
vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function mockRect(this: HTMLElement) {
|
|
11
11
|
let width = 0;
|
|
12
12
|
|
|
13
|
-
if (this.classList.contains('ds-tag-list__viewport'))
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (this.classList.contains('ds-tag-list__viewport')) {
|
|
14
|
+
width = 220;
|
|
15
|
+
}
|
|
16
|
+
else if (this.classList.contains('ds-tag-list__item')) {
|
|
17
|
+
width = 72;
|
|
18
|
+
}
|
|
19
|
+
else if (this.classList.contains('ds-tag-list__overflow')) {
|
|
20
|
+
width = 76;
|
|
21
|
+
}
|
|
16
22
|
|
|
17
23
|
return {
|
|
18
24
|
width,
|
|
@@ -99,7 +99,9 @@ export const TagList = ({
|
|
|
99
99
|
[
|
|
100
100
|
...visibleItemIndices.flatMap((index) => {
|
|
101
101
|
const item = items[index];
|
|
102
|
-
if (!item)
|
|
102
|
+
if (!item) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
103
105
|
|
|
104
106
|
const targets: TagListTarget[] = [];
|
|
105
107
|
if (item.onClick) {
|
|
@@ -117,7 +119,9 @@ export const TagList = ({
|
|
|
117
119
|
const hasInteractiveItems = visibleInteractiveTargets.length > 0;
|
|
118
120
|
|
|
119
121
|
const getHighlightedIndexForTarget = useCallback((target: TagListTarget | null): number | null => {
|
|
120
|
-
if (!target || target === 'overflow')
|
|
122
|
+
if (!target || target === 'overflow') {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
121
125
|
|
|
122
126
|
return itemIndexById.get(getTargetItemId(target)) ?? null;
|
|
123
127
|
}, [itemIndexById]);
|
|
@@ -127,7 +131,9 @@ export const TagList = ({
|
|
|
127
131
|
}, [getHighlightedIndexForTarget, onHighlightedItemIndexChange]);
|
|
128
132
|
|
|
129
133
|
const handleDeleteKey = useCallback((target: TagListTarget, event: React.KeyboardEvent<HTMLElement>): boolean => {
|
|
130
|
-
if (target === 'overflow')
|
|
134
|
+
if (target === 'overflow') {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
131
137
|
|
|
132
138
|
const item = items[getHighlightedIndexForTarget(target) ?? -1];
|
|
133
139
|
if (item?.onRemove) {
|
|
@@ -229,7 +235,9 @@ export const TagList = ({
|
|
|
229
235
|
: null;
|
|
230
236
|
|
|
231
237
|
if (items.length === 0) {
|
|
232
|
-
if (!emptyState)
|
|
238
|
+
if (!emptyState) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
233
241
|
return <div className={classNames('ds-tag-list', 'ds-tag-list--empty', className)}>{emptyState}</div>;
|
|
234
242
|
}
|
|
235
243
|
|
|
@@ -7,7 +7,9 @@ import { Icon } from 'Components/icon/Icon';
|
|
|
7
7
|
export const DepthContext = createContext(0);
|
|
8
8
|
|
|
9
9
|
export function getDepthPadding(depth: number): string {
|
|
10
|
-
if (depth === 0)
|
|
10
|
+
if (depth === 0) {
|
|
11
|
+
return 'var(--section-list-row-spacing-horizontal)';
|
|
12
|
+
}
|
|
11
13
|
return `calc(var(--spacing-xxlarge, 32px) * ${depth})`;
|
|
12
14
|
}
|
|
13
15
|
|