@arbor-education/design-system.components 0.25.6 → 0.25.7
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/CHANGELOG.md +10 -0
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts +1 -0
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.d.ts.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js +2 -2
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/row/Row.d.ts +2 -0
- package/dist/components/row/Row.d.ts.map +1 -1
- package/dist/components/row/Row.js +14 -5
- package/dist/components/row/Row.js.map +1 -1
- package/dist/components/row/Row.stories.d.ts +27 -0
- package/dist/components/row/Row.stories.d.ts.map +1 -1
- package/dist/components/row/Row.stories.js +101 -0
- package/dist/components/row/Row.stories.js.map +1 -1
- package/dist/components/row/Row.test.d.ts.map +1 -1
- package/dist/components/row/Row.test.js +39 -1
- package/dist/components/row/Row.test.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js +2 -2
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts +13 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js +56 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js.map +1 -1
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/formField/inputs/selectDropdown/SelectDropdown.tsx +3 -1
- package/src/components/row/Row.stories.tsx +141 -0
- package/src/components/row/Row.test.tsx +54 -1
- package/src/components/row/Row.tsx +29 -10
- package/src/components/row/row.scss +10 -0
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.stories.tsx +67 -0
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.tsx +2 -0
|
@@ -211,6 +211,14 @@ const meta = {
|
|
|
211
211
|
defaultValue: { summary: 'false' },
|
|
212
212
|
},
|
|
213
213
|
},
|
|
214
|
+
onCloseAutoFocus: {
|
|
215
|
+
control: false,
|
|
216
|
+
description: 'Called when focus is about to return to the ag-grid cell after the dropdown closes (e.g. after selecting an option). Call `event.preventDefault()` to stop radix\'s default restore-to-cell behaviour and move focus elsewhere yourself.',
|
|
217
|
+
table: {
|
|
218
|
+
type: { summary: '(event: Event) => void' },
|
|
219
|
+
defaultValue: { summary: 'undefined' },
|
|
220
|
+
},
|
|
221
|
+
},
|
|
214
222
|
},
|
|
215
223
|
} satisfies Meta<typeof SelectDropdownCellRenderer>;
|
|
216
224
|
|
|
@@ -718,3 +726,62 @@ const columnDefs = [
|
|
|
718
726
|
},
|
|
719
727
|
'(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.',
|
|
720
728
|
);
|
|
729
|
+
|
|
730
|
+
export const CustomCloseFocus: Story = withDescription(
|
|
731
|
+
{
|
|
732
|
+
parameters: {
|
|
733
|
+
controls: { disable: true },
|
|
734
|
+
docs: {
|
|
735
|
+
source: {
|
|
736
|
+
language: 'tsx',
|
|
737
|
+
code: `
|
|
738
|
+
import { Table } from '@arbor-education/design-system.components';
|
|
739
|
+
|
|
740
|
+
const columnDefs = [
|
|
741
|
+
{ field: 'name', headerName: 'Name', flex: 2 },
|
|
742
|
+
{
|
|
743
|
+
field: 'status',
|
|
744
|
+
headerName: 'Status',
|
|
745
|
+
cellRenderer: 'dsSelectDropdownCellRenderer',
|
|
746
|
+
cellRendererParams: {
|
|
747
|
+
options: statusOptions,
|
|
748
|
+
onCloseAutoFocus: (event) => {
|
|
749
|
+
event.preventDefault();
|
|
750
|
+
window.alert('Dropdown closed — running custom focus handler');
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
},
|
|
754
|
+
];
|
|
755
|
+
|
|
756
|
+
<Table rowData={rowData} columnDefs={columnDefs} domLayout="autoHeight" />
|
|
757
|
+
`.trim(),
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
render: () => (
|
|
762
|
+
<Table
|
|
763
|
+
rowData={SELECT_IN_TABLE_DATA}
|
|
764
|
+
columnDefs={[
|
|
765
|
+
{ field: 'name', headerName: 'Name', flex: 2 },
|
|
766
|
+
{
|
|
767
|
+
field: 'status',
|
|
768
|
+
headerName: 'Status',
|
|
769
|
+
flex: 1,
|
|
770
|
+
editable: false,
|
|
771
|
+
cellRenderer: 'dsSelectDropdownCellRenderer',
|
|
772
|
+
cellRendererParams: {
|
|
773
|
+
options: STATUS_OPTIONS,
|
|
774
|
+
onCloseAutoFocus: (event: Event) => {
|
|
775
|
+
event.preventDefault();
|
|
776
|
+
window.alert('Dropdown closed — running custom focus handler');
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
]}
|
|
781
|
+
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
782
|
+
domLayout="autoHeight"
|
|
783
|
+
/>
|
|
784
|
+
),
|
|
785
|
+
},
|
|
786
|
+
'Passes `onCloseAutoFocus` via `cellRendererParams` to override what happens to focus when the dropdown closes. Open a Status dropdown and pick an option (or press Escape) — instead of radix restoring focus to the cell, the handler calls `event.preventDefault()` and fires a `window.alert`. In a real app you would move focus to a specific element here rather than alert.',
|
|
787
|
+
);
|
|
@@ -52,6 +52,7 @@ export const SelectDropdownCellRenderer = (
|
|
|
52
52
|
backgroundColor,
|
|
53
53
|
fillCell = false,
|
|
54
54
|
iconClickOnly = false,
|
|
55
|
+
onCloseAutoFocus,
|
|
55
56
|
} = props;
|
|
56
57
|
|
|
57
58
|
const textContrast = backgroundColor ? getTextContrast(backgroundColor) : null;
|
|
@@ -113,6 +114,7 @@ export const SelectDropdownCellRenderer = (
|
|
|
113
114
|
onOpenChange={setIsOpen}
|
|
114
115
|
multiple={false}
|
|
115
116
|
iconClickOnly={iconClickOnly}
|
|
117
|
+
onCloseAutoFocus={onCloseAutoFocus}
|
|
116
118
|
onSelectionChange={(newValue) => {
|
|
117
119
|
if (column && newValue[0] != null) {
|
|
118
120
|
const selectedOption = rawOptions.find(
|