@arbor-education/design-system.components 0.15.0 → 0.16.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/skills/write-stories/SKILL.md +207 -271
- package/.storybook/preview.ts +5 -0
- package/CHANGELOG.md +23 -0
- package/README.md +8 -0
- package/component-library.md +144 -13
- package/dist/components/articleCard/ArticleCard.stories.d.ts +137 -11
- package/dist/components/articleCard/ArticleCard.stories.d.ts.map +1 -1
- package/dist/components/articleCard/ArticleCard.stories.js +358 -91
- package/dist/components/articleCard/ArticleCard.stories.js.map +1 -1
- package/dist/components/avatar/Avatar.stories.d.ts +6 -6
- package/dist/components/avatar/Avatar.stories.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.stories.js +393 -49
- package/dist/components/avatar/Avatar.stories.js.map +1 -1
- package/dist/components/avatarGroup/AvatarGroup.stories.d.ts +9 -7
- package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/components/avatarGroup/AvatarGroup.stories.js +688 -65
- package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -1
- package/dist/components/banner/Banner.stories.d.ts.map +1 -1
- package/dist/components/banner/Banner.stories.js +7 -3
- package/dist/components/banner/Banner.stories.js.map +1 -1
- package/dist/components/card/Card.stories.d.ts +105 -4
- package/dist/components/card/Card.stories.d.ts.map +1 -1
- package/dist/components/card/Card.stories.js +336 -18
- package/dist/components/card/Card.stories.js.map +1 -1
- package/dist/components/combobox/Combobox.stories.d.ts +134 -21
- package/dist/components/combobox/Combobox.stories.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.stories.js +676 -175
- package/dist/components/combobox/Combobox.stories.js.map +1 -1
- package/dist/components/datePicker/DatePicker.stories.d.ts +119 -27
- package/dist/components/datePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/datePicker/DatePicker.stories.js +575 -47
- package/dist/components/datePicker/DatePicker.stories.js.map +1 -1
- package/dist/components/dateTimePicker/DateTimePicker.stories.d.ts +155 -39
- package/dist/components/dateTimePicker/DateTimePicker.stories.d.ts.map +1 -1
- package/dist/components/dateTimePicker/DateTimePicker.stories.js +674 -103
- package/dist/components/dateTimePicker/DateTimePicker.stories.js.map +1 -1
- package/dist/components/editableText/EditableText.stories.d.ts +53 -12
- package/dist/components/editableText/EditableText.stories.d.ts.map +1 -1
- package/dist/components/editableText/EditableText.stories.js +401 -64
- package/dist/components/editableText/EditableText.stories.js.map +1 -1
- package/dist/components/formField/FormField.d.ts +4 -0
- package/dist/components/formField/FormField.d.ts.map +1 -1
- package/dist/components/formField/FormField.js +2 -1
- package/dist/components/formField/FormField.js.map +1 -1
- package/dist/components/formField/FormField.test.js +5 -0
- package/dist/components/formField/FormField.test.js.map +1 -1
- package/dist/components/formField/fieldset/Fieldset.stories.d.ts +56 -4
- package/dist/components/formField/fieldset/Fieldset.stories.d.ts.map +1 -1
- package/dist/components/formField/fieldset/Fieldset.stories.js +534 -28
- package/dist/components/formField/fieldset/Fieldset.stories.js.map +1 -1
- package/dist/components/formField/inputs/checkbox/CheckboxGroup.d.ts +3 -1
- package/dist/components/formField/inputs/checkbox/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/formField/inputs/checkbox/CheckboxInput.js +1 -1
- package/dist/components/formField/inputs/checkbox/CheckboxInput.js.map +1 -1
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts +95 -1
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.d.ts.map +1 -1
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.js +386 -9
- package/dist/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.js.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts +6 -2
- package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonGroup.js.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.d.ts.map +1 -1
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js +61 -49
- package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.d.ts +188 -166
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.d.ts.map +1 -1
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.js +821 -160
- package/dist/components/formField/inputs/selectDropdown/SelectDropdown.stories.js.map +1 -1
- package/dist/components/formField/inputs/time/TimeInput.stories.d.ts +176 -22
- package/dist/components/formField/inputs/time/TimeInput.stories.d.ts.map +1 -1
- package/dist/components/formField/inputs/time/TimeInput.stories.js +851 -92
- package/dist/components/formField/inputs/time/TimeInput.stories.js.map +1 -1
- package/dist/components/formField/label/Label.stories.d.ts +54 -5
- package/dist/components/formField/label/Label.stories.d.ts.map +1 -1
- package/dist/components/formField/label/Label.stories.js +238 -4
- package/dist/components/formField/label/Label.stories.js.map +1 -1
- package/dist/components/icoText/IcoText.stories.d.ts +32 -6
- package/dist/components/icoText/IcoText.stories.d.ts.map +1 -1
- package/dist/components/icoText/IcoText.stories.js +309 -14
- package/dist/components/icoText/IcoText.stories.js.map +1 -1
- package/dist/components/kpiCard/KPICard.stories.d.ts +100 -2
- package/dist/components/kpiCard/KPICard.stories.d.ts.map +1 -1
- package/dist/components/kpiCard/KPICard.stories.js +354 -10
- package/dist/components/kpiCard/KPICard.stories.js.map +1 -1
- package/dist/components/kvpList/KVPList.stories.d.ts +57 -4
- package/dist/components/kvpList/KVPList.stories.d.ts.map +1 -1
- package/dist/components/kvpList/KVPList.stories.js +403 -10
- package/dist/components/kvpList/KVPList.stories.js.map +1 -1
- package/dist/components/modal/Modal.stories.d.ts +113 -9
- package/dist/components/modal/Modal.stories.d.ts.map +1 -1
- package/dist/components/modal/Modal.stories.js +633 -13
- package/dist/components/modal/Modal.stories.js.map +1 -1
- package/dist/components/modal/modalManager/ModalManager.stories.d.ts +34 -10
- package/dist/components/modal/modalManager/ModalManager.stories.d.ts.map +1 -1
- package/dist/components/modal/modalManager/ModalManager.stories.js +463 -85
- package/dist/components/modal/modalManager/ModalManager.stories.js.map +1 -1
- package/dist/components/pill/Pill.d.ts.map +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/pill/Pill.js.map +1 -1
- package/dist/components/pill/Pill.stories.d.ts.map +1 -1
- package/dist/components/pill/Pill.stories.js +11 -13
- package/dist/components/pill/Pill.stories.js.map +1 -1
- package/dist/components/row/Row.stories.d.ts +1 -2
- package/dist/components/row/Row.stories.d.ts.map +1 -1
- package/dist/components/row/Row.stories.js +360 -50
- package/dist/components/row/Row.stories.js.map +1 -1
- package/dist/components/searchBar/SearchBar.stories.d.ts +52 -4
- package/dist/components/searchBar/SearchBar.stories.d.ts.map +1 -1
- package/dist/components/searchBar/SearchBar.stories.js +428 -36
- package/dist/components/searchBar/SearchBar.stories.js.map +1 -1
- package/dist/components/section/Section.stories.d.ts +11 -41
- package/dist/components/section/Section.stories.d.ts.map +1 -1
- package/dist/components/section/Section.stories.js +494 -56
- package/dist/components/section/Section.stories.js.map +1 -1
- package/dist/components/singleUser/SingleUser.stories.d.ts +5 -4
- package/dist/components/singleUser/SingleUser.stories.d.ts.map +1 -1
- package/dist/components/singleUser/SingleUser.stories.js +303 -31
- package/dist/components/singleUser/SingleUser.stories.js.map +1 -1
- package/dist/components/slideoverManager/SlideoverManager.stories.d.ts +32 -11
- package/dist/components/slideoverManager/SlideoverManager.stories.d.ts.map +1 -1
- package/dist/components/slideoverManager/SlideoverManager.stories.js +380 -84
- package/dist/components/slideoverManager/SlideoverManager.stories.js.map +1 -1
- package/dist/components/table/DSDefaultColDef.d.ts.map +1 -1
- package/dist/components/table/DSDefaultColDef.js +4 -3
- package/dist/components/table/DSDefaultColDef.js.map +1 -1
- package/dist/components/table/Table.d.ts +6 -1
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +8 -3
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.stories.d.ts +3 -0
- package/dist/components/table/Table.stories.d.ts.map +1 -1
- package/dist/components/table/Table.stories.js +384 -5
- package/dist/components/table/Table.stories.js.map +1 -1
- package/dist/components/table/Table.test.js +30 -0
- package/dist/components/table/Table.test.js.map +1 -1
- package/dist/components/table/TableFooter.stories.d.ts +49 -0
- package/dist/components/table/TableFooter.stories.d.ts.map +1 -0
- package/dist/components/table/TableFooter.stories.js +137 -0
- package/dist/components/table/TableFooter.stories.js.map +1 -0
- package/dist/components/table/TableHeader.stories.d.ts +93 -0
- package/dist/components/table/TableHeader.stories.d.ts.map +1 -0
- package/dist/components/table/TableHeader.stories.js +176 -0
- package/dist/components/table/TableHeader.stories.js.map +1 -0
- package/dist/components/table/cellEditors/DateCellEditor.stories.d.ts +44 -0
- package/dist/components/table/cellEditors/DateCellEditor.stories.d.ts.map +1 -0
- package/dist/components/table/cellEditors/DateCellEditor.stories.js +186 -0
- package/dist/components/table/cellEditors/DateCellEditor.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.d.ts +40 -0
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.js +209 -0
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.d.ts +48 -0
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.js +244 -0
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.js +3 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.js.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.d.ts +64 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js +241 -0
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/DefaultCellRenderer.stories.d.ts +55 -0
- package/dist/components/table/cellRenderers/DefaultCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/DefaultCellRenderer.stories.js +245 -0
- package/dist/components/table/cellRenderers/DefaultCellRenderer.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.d.ts +67 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js +221 -0
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js.map +1 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts +75 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts.map +1 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js +270 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js.map +1 -0
- package/dist/components/table/columnFilters/BooleanFilter.stories.d.ts +57 -0
- package/dist/components/table/columnFilters/BooleanFilter.stories.d.ts.map +1 -0
- package/dist/components/table/columnFilters/BooleanFilter.stories.js +198 -0
- package/dist/components/table/columnFilters/BooleanFilter.stories.js.map +1 -0
- package/dist/components/table/columnFilters/TimeFilter.stories.d.ts +58 -0
- package/dist/components/table/columnFilters/TimeFilter.stories.d.ts.map +1 -0
- package/dist/components/table/columnFilters/TimeFilter.stories.js +207 -0
- package/dist/components/table/columnFilters/TimeFilter.stories.js.map +1 -0
- package/dist/components/table/pagination/PaginationPanel.stories.d.ts +113 -0
- package/dist/components/table/pagination/PaginationPanel.stories.d.ts.map +1 -0
- package/dist/components/table/pagination/PaginationPanel.stories.js +272 -0
- package/dist/components/table/pagination/PaginationPanel.stories.js.map +1 -0
- package/dist/components/table/tableControls/HideColumnsDropdown.d.ts.map +1 -1
- package/dist/components/table/tableControls/HideColumnsDropdown.js +9 -3
- package/dist/components/table/tableControls/HideColumnsDropdown.js.map +1 -1
- package/dist/components/table/tableControls/TableControls.stories.d.ts +151 -0
- package/dist/components/table/tableControls/TableControls.stories.d.ts.map +1 -0
- package/dist/components/table/tableControls/TableControls.stories.js +356 -0
- package/dist/components/table/tableControls/TableControls.stories.js.map +1 -0
- package/dist/components/table/tableControls/TableSettingsDropdown.d.ts +27 -1
- package/dist/components/table/tableControls/TableSettingsDropdown.d.ts.map +1 -1
- package/dist/components/table/tableControls/TableSettingsDropdown.js +53 -26
- package/dist/components/table/tableControls/TableSettingsDropdown.js.map +1 -1
- package/dist/components/table/tableControls/TableSettingsDropdown.test.d.ts +2 -0
- package/dist/components/table/tableControls/TableSettingsDropdown.test.d.ts.map +1 -0
- package/dist/components/table/tableControls/TableSettingsDropdown.test.js +178 -0
- package/dist/components/table/tableControls/TableSettingsDropdown.test.js.map +1 -0
- package/dist/components/tabs/Tabs.stories.d.ts +22 -4
- package/dist/components/tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.stories.js +398 -22
- package/dist/components/tabs/Tabs.stories.js.map +1 -1
- package/dist/components/tabs/TabsItem.stories.d.ts +54 -1
- package/dist/components/tabs/TabsItem.stories.d.ts.map +1 -1
- package/dist/components/tabs/TabsItem.stories.js +61 -9
- package/dist/components/tabs/TabsItem.stories.js.map +1 -1
- package/dist/components/toast/Toast.stories.d.ts +103 -10
- package/dist/components/toast/Toast.stories.d.ts.map +1 -1
- package/dist/components/toast/Toast.stories.js +409 -47
- package/dist/components/toast/Toast.stories.js.map +1 -1
- package/dist/components/toggle/Toggle.stories.d.ts +61 -46
- package/dist/components/toggle/Toggle.stories.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.stories.js +311 -122
- package/dist/components/toggle/Toggle.stories.js.map +1 -1
- package/dist/components/tooltip/Tooltip.stories.d.ts +78 -6
- package/dist/components/tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.stories.js +413 -7
- package/dist/components/tooltip/Tooltip.stories.js.map +1 -1
- package/dist/components/tooltip/TooltipWrapper.stories.d.ts +71 -7
- package/dist/components/tooltip/TooltipWrapper.stories.d.ts.map +1 -1
- package/dist/components/tooltip/TooltipWrapper.stories.js +238 -10
- package/dist/components/tooltip/TooltipWrapper.stories.js.map +1 -1
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/utils/PopupParentContext.stories.d.ts +17 -0
- package/dist/utils/PopupParentContext.stories.d.ts.map +1 -0
- package/dist/utils/PopupParentContext.stories.js +266 -0
- package/dist/utils/PopupParentContext.stories.js.map +1 -0
- package/dist/utils/getDefaultPopupParent.d.ts.map +1 -1
- package/dist/utils/getDefaultPopupParent.js +6 -0
- package/dist/utils/getDefaultPopupParent.js.map +1 -1
- package/package.json +1 -1
- package/src/components/articleCard/ArticleCard.stories.tsx +524 -111
- package/src/components/avatar/Avatar.stories.tsx +504 -59
- package/src/components/avatarGroup/AvatarGroup.stories.tsx +977 -175
- package/src/components/banner/Banner.stories.tsx +7 -3
- package/src/components/card/Card.stories.tsx +466 -36
- package/src/components/combobox/Combobox.stories.tsx +867 -260
- package/src/components/datePicker/DatePicker.stories.tsx +777 -60
- package/src/components/dateTimePicker/DateTimePicker.stories.tsx +910 -132
- package/src/components/editableText/EditableText.stories.tsx +567 -91
- package/src/components/formField/FormField.test.tsx +6 -0
- package/src/components/formField/FormField.tsx +5 -0
- package/src/components/formField/fieldset/Fieldset.stories.tsx +761 -51
- package/src/components/formField/inputs/checkbox/CheckboxGroup.tsx +1 -1
- package/src/components/formField/inputs/checkbox/CheckboxInput.tsx +1 -1
- package/src/components/formField/inputs/colourPickerDropdown/ColourPickerDropdown.stories.tsx +504 -11
- package/src/components/formField/inputs/radio/RadioButtonGroup.tsx +17 -4
- package/src/components/formField/inputs/radio/RadioButtonInput.stories.tsx +71 -59
- package/src/components/formField/inputs/selectDropdown/SelectDropdown.stories.tsx +1079 -168
- package/src/components/formField/inputs/time/TimeInput.stories.tsx +1140 -104
- package/src/components/formField/label/Label.stories.tsx +317 -8
- package/src/components/icoText/IcoText.stories.tsx +442 -31
- package/src/components/kpiCard/KPICard.stories.tsx +475 -30
- package/src/components/kvpList/KVPList.stories.tsx +593 -26
- package/src/components/modal/Modal.stories.tsx +963 -26
- package/src/components/modal/modalManager/ModalManager.stories.tsx +612 -454
- package/src/components/pill/Pill.stories.tsx +11 -13
- package/src/components/pill/Pill.tsx +1 -0
- package/src/components/row/Row.stories.tsx +474 -58
- package/src/components/searchBar/SearchBar.stories.tsx +570 -38
- package/src/components/section/Section.stories.tsx +723 -70
- package/src/components/singleUser/SingleUser.stories.tsx +393 -34
- package/src/components/slideoverManager/SlideoverManager.stories.tsx +572 -342
- package/src/components/table/DSDefaultColDef.ts +25 -5
- package/src/components/table/Table.stories.tsx +460 -5
- package/src/components/table/Table.test.tsx +53 -0
- package/src/components/table/Table.tsx +9 -2
- package/src/components/table/TableFooter.stories.tsx +196 -0
- package/src/components/table/TableHeader.stories.tsx +251 -0
- package/src/components/table/cellEditors/DateCellEditor.stories.tsx +245 -0
- package/src/components/table/cellRenderers/BooleanCellRenderer.stories.tsx +278 -0
- package/src/components/table/cellRenderers/ButtonCellRenderer.stories.tsx +333 -0
- package/src/components/table/cellRenderers/CheckboxCellRenderer.stories.tsx +337 -0
- package/src/components/table/cellRenderers/CheckboxCellRenderer.tsx +5 -1
- package/src/components/table/cellRenderers/DefaultCellRenderer.stories.tsx +342 -0
- package/src/components/table/cellRenderers/InlineTextCellRenderer.stories.tsx +292 -0
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.stories.tsx +369 -0
- package/src/components/table/columnFilters/BooleanFilter.stories.tsx +268 -0
- package/src/components/table/columnFilters/TimeFilter.stories.tsx +281 -0
- package/src/components/table/pagination/PaginationPanel.stories.tsx +327 -0
- package/src/components/table/tableControls/HideColumnsDropdown.tsx +11 -2
- package/src/components/table/tableControls/TableControls.stories.tsx +415 -0
- package/src/components/table/tableControls/TableSettingsDropdown.test.tsx +207 -0
- package/src/components/table/tableControls/TableSettingsDropdown.tsx +103 -39
- package/src/components/tabs/Tabs.stories.tsx +540 -60
- package/src/components/tabs/TabsItem.stories.tsx +82 -8
- package/src/components/toast/Toast.stories.tsx +539 -77
- package/src/components/toggle/Toggle.stories.tsx +371 -135
- package/src/components/tooltip/Tooltip.stories.tsx +606 -15
- package/src/components/tooltip/TooltipWrapper.stories.tsx +348 -12
- package/src/docs/Contributing.mdx +241 -0
- package/src/docs/UsingComponents.mdx +93 -0
- package/src/docs/Welcome.mdx +68 -0
- package/src/global.scss +7 -0
- package/src/utils/PopupParentContext.stories.tsx +367 -0
- package/src/utils/getDefaultPopupParent.ts +6 -0
- package/.ralph/storybook-upgrade/knowledge.md +0 -308
- package/.ralph/storybook-upgrade/prd.json +0 -777
- package/.ralph/storybook-upgrade/progress.md +0 -342
- package/src/components/table/TableWIP.mdx +0 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Controls, Heading as DocHeading, Markdown, Primary as DocPrimary, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
import { TableFooter } from './TableFooter';
|
|
5
|
+
import { PaginationPanel } from './pagination/PaginationPanel';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Docs page content
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
const DESCRIPTION_INTRO = [
|
|
10
|
+
'`TableFooter` is the pre-composed footer slot for the Arbor data table.',
|
|
11
|
+
'It renders a `<footer>` element and accepts any `children` (typically a `<PaginationPanel />` element).',
|
|
12
|
+
'',
|
|
13
|
+
'Pass the entire `<TableFooter />` element as the `footerContent` prop of `<Table />`.',
|
|
14
|
+
].join('\n');
|
|
15
|
+
const USAGE_GUIDANCE = [
|
|
16
|
+
'### When to use',
|
|
17
|
+
'',
|
|
18
|
+
'- As the `footerContent` of a `<Table />` when you need a standard footer region',
|
|
19
|
+
'- When you want to wrap `<PaginationPanel />` in the footer slot',
|
|
20
|
+
'- When you need custom footer content beyond pagination controls',
|
|
21
|
+
'',
|
|
22
|
+
'---',
|
|
23
|
+
'',
|
|
24
|
+
'### When NOT to use',
|
|
25
|
+
'',
|
|
26
|
+
'| Situation | Alternative |',
|
|
27
|
+
'|---|---|',
|
|
28
|
+
'| You only need pagination | Pass `<PaginationPanel />` directly as `footerContent` |',
|
|
29
|
+
'| The table has no footer | Omit `footerContent` entirely |',
|
|
30
|
+
'',
|
|
31
|
+
'---',
|
|
32
|
+
'',
|
|
33
|
+
'### Props summary',
|
|
34
|
+
'',
|
|
35
|
+
'| Prop | Description |',
|
|
36
|
+
'|---|---|',
|
|
37
|
+
'| `children` | Content rendered inside the footer — typically `<PaginationPanel />` |',
|
|
38
|
+
'| `className` | Additional CSS class name(s) on the root `<footer>` element |',
|
|
39
|
+
].join('\n');
|
|
40
|
+
const DEVELOPER_NOTES = [
|
|
41
|
+
'### Wiring into `<Table />`',
|
|
42
|
+
'',
|
|
43
|
+
'```tsx',
|
|
44
|
+
"import { Table, TableFooter, PaginationPanel } from '@arbor-education/design-system.components';",
|
|
45
|
+
'',
|
|
46
|
+
'function MyTable() {',
|
|
47
|
+
' return (',
|
|
48
|
+
' <Table',
|
|
49
|
+
' rowData={rows}',
|
|
50
|
+
' columnDefs={colDefs}',
|
|
51
|
+
' footerContent={(',
|
|
52
|
+
' <TableFooter>',
|
|
53
|
+
' <PaginationPanel',
|
|
54
|
+
' availableSizes={[10, 25, 50, 100]}',
|
|
55
|
+
' initialPageSize={25}',
|
|
56
|
+
' onPageSizeChange={setPageSize}',
|
|
57
|
+
' />',
|
|
58
|
+
' </TableFooter>',
|
|
59
|
+
' )}',
|
|
60
|
+
' />',
|
|
61
|
+
' );',
|
|
62
|
+
'}',
|
|
63
|
+
'```',
|
|
64
|
+
'',
|
|
65
|
+
'---',
|
|
66
|
+
'',
|
|
67
|
+
'### `TableFooter` vs passing `<PaginationPanel />` directly',
|
|
68
|
+
'',
|
|
69
|
+
'`<TableFooter />` adds the `ds-table__footer` class and `<footer>` semantic element around its',
|
|
70
|
+
'children. If you only need pagination, passing `<PaginationPanel />` directly as `footerContent`',
|
|
71
|
+
'is also valid — `<Table />` renders `footerContent` inside its own footer region.',
|
|
72
|
+
].join('\n');
|
|
73
|
+
const RELATED_COMPONENTS = [
|
|
74
|
+
'## Related components',
|
|
75
|
+
'',
|
|
76
|
+
'[Table](?path=/docs/components-table--docs) · [PaginationPanel](?path=/docs/components-table-paginationpanel--docs) · [TableHeader](?path=/docs/components-table-tableheader--docs)',
|
|
77
|
+
].join('\n');
|
|
78
|
+
const PROPS_INTRO = 'The preview below is wired to the **Controls** panel. `TableFooter` is a thin layout wrapper — its main value is the semantic `<footer>` element and `ds-table__footer` class it applies around its children.';
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Custom DocsPage
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
function TableFooterDocsPage() {
|
|
83
|
+
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(Markdown, { children: PROPS_INTRO }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "Usage guidance" }), _jsx(Markdown, { children: USAGE_GUIDANCE }), _jsx(DocHeading, { children: "Developer notes" }), _jsx(Markdown, { children: DEVELOPER_NOTES }), _jsx(DocHeading, { children: "Examples" }), _jsx(Stories, { title: "" }), _jsx(Markdown, { children: RELATED_COMPONENTS })] }));
|
|
84
|
+
}
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// Meta
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
const meta = {
|
|
89
|
+
title: 'Components/Table/TableFooter',
|
|
90
|
+
component: TableFooter,
|
|
91
|
+
tags: ['autodocs'],
|
|
92
|
+
parameters: {
|
|
93
|
+
layout: 'padded',
|
|
94
|
+
docs: { page: TableFooterDocsPage },
|
|
95
|
+
},
|
|
96
|
+
argTypes: {
|
|
97
|
+
children: {
|
|
98
|
+
description: 'Content rendered inside the footer. Typically a `<PaginationPanel />` element.',
|
|
99
|
+
control: false,
|
|
100
|
+
table: { type: { summary: 'ReactNode' }, defaultValue: { summary: 'undefined' } },
|
|
101
|
+
},
|
|
102
|
+
className: {
|
|
103
|
+
description: 'Additional CSS class name(s) to apply to the root `<footer>` element.',
|
|
104
|
+
control: 'text',
|
|
105
|
+
table: { type: { summary: 'string' }, defaultValue: { summary: 'undefined' } },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
export default meta;
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// Helper
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
const withDescription = (story, description) => ({
|
|
114
|
+
...story,
|
|
115
|
+
parameters: {
|
|
116
|
+
...story.parameters,
|
|
117
|
+
docs: { ...story.parameters?.docs, description: { story: description } },
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Stories
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
export const Default = withDescription({
|
|
124
|
+
args: {
|
|
125
|
+
children: (_jsx(PaginationPanel, { totalPages: 10, onPageChange: fn(), availableSizes: [10, 25, 50, 100], initialPageSize: 25, onPageSizeChange: fn() })),
|
|
126
|
+
},
|
|
127
|
+
}, 'The canonical usage — `TableFooter` wrapping a `<PaginationPanel />`. '
|
|
128
|
+
+ '`RowCountInfo` (the row count text) is not visible in this standalone preview because it '
|
|
129
|
+
+ 'requires `GridApiContext` provided by a wrapping `<Table />`.');
|
|
130
|
+
export const WithCustomContent = withDescription({
|
|
131
|
+
parameters: { controls: { disable: true } },
|
|
132
|
+
args: {
|
|
133
|
+
children: (_jsx("span", { style: { padding: '8px 16px', fontSize: '14px', color: 'var(--color-neutral-500)' }, children: "Custom footer content \u2014 e.g. totals, status messages, or secondary actions" })),
|
|
134
|
+
},
|
|
135
|
+
}, '`TableFooter` accepts any `ReactNode` as `children` — not just `PaginationPanel`. '
|
|
136
|
+
+ 'Use it to add totals rows, status messages, or any other custom footer content.');
|
|
137
|
+
//# sourceMappingURL=TableFooter.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFooter.stories.js","sourceRoot":"","sources":["../../../src/components/table/TableFooter.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,OAAO,EACP,QAAQ,EACR,KAAK,GACN,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG;IACxB,yEAAyE;IACzE,yGAAyG;IACzG,EAAE;IACF,uFAAuF;CACxF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,EAAE;IACF,kFAAkF;IAClF,kEAAkE;IAClE,kEAAkE;IAClE,EAAE;IACF,KAAK;IACL,EAAE;IACF,qBAAqB;IACrB,EAAE;IACF,6BAA6B;IAC7B,WAAW;IACX,uFAAuF;IACvF,6DAA6D;IAC7D,EAAE;IACF,KAAK;IACL,EAAE;IACF,mBAAmB;IACnB,EAAE;IACF,wBAAwB;IACxB,WAAW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Ac,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EACjC,eAAe,EAAE,EAAE,EACnB,gBAAgB,EAAE,EAAE,EAAE,GACtB,CACH;KACF;CACF,EACD,wEAAwE;MACtE,2FAA2F;MAC3F,+DAA+D,CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAU,eAAe,CACrD;IACE,UAAU,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC3C,IAAI,EAAE;QACJ,QAAQ,EAAE,CACR,eAAM,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B,EAAE,gGAElF,CACR;KACF;CACF,EACD,oFAAoF;MAClF,iFAAiF,CACpF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
3
|
+
import { TableHeader } from './TableHeader';
|
|
4
|
+
declare function TableHeaderDocsPage(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: (props: {
|
|
8
|
+
className?: string;
|
|
9
|
+
hasSearch?: boolean;
|
|
10
|
+
searchValue?: string;
|
|
11
|
+
setSearchValue?: (searchValue: string) => void;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
'data-testid'?: string;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
tags: string[];
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: string;
|
|
18
|
+
docs: {
|
|
19
|
+
page: typeof TableHeaderDocsPage;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
argTypes: {
|
|
23
|
+
children: {
|
|
24
|
+
description: string;
|
|
25
|
+
control: false;
|
|
26
|
+
table: {
|
|
27
|
+
type: {
|
|
28
|
+
summary: string;
|
|
29
|
+
};
|
|
30
|
+
defaultValue: {
|
|
31
|
+
summary: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
hasSearch: {
|
|
36
|
+
description: string;
|
|
37
|
+
control: "boolean";
|
|
38
|
+
table: {
|
|
39
|
+
type: {
|
|
40
|
+
summary: string;
|
|
41
|
+
};
|
|
42
|
+
defaultValue: {
|
|
43
|
+
summary: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
searchValue: {
|
|
48
|
+
description: string;
|
|
49
|
+
control: "text";
|
|
50
|
+
table: {
|
|
51
|
+
type: {
|
|
52
|
+
summary: string;
|
|
53
|
+
};
|
|
54
|
+
defaultValue: {
|
|
55
|
+
summary: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
setSearchValue: {
|
|
60
|
+
description: string;
|
|
61
|
+
control: false;
|
|
62
|
+
table: {
|
|
63
|
+
type: {
|
|
64
|
+
summary: string;
|
|
65
|
+
};
|
|
66
|
+
defaultValue: {
|
|
67
|
+
summary: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
className: {
|
|
72
|
+
description: string;
|
|
73
|
+
control: "text";
|
|
74
|
+
table: {
|
|
75
|
+
type: {
|
|
76
|
+
summary: string;
|
|
77
|
+
};
|
|
78
|
+
defaultValue: {
|
|
79
|
+
summary: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
args: {
|
|
85
|
+
setSearchValue: import("@vitest/spy").Mock<(...args: any[]) => any>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export default meta;
|
|
89
|
+
type Story = StoryObj<typeof TableHeader>;
|
|
90
|
+
export declare const Default: Story;
|
|
91
|
+
export declare const WithSearch: Story;
|
|
92
|
+
export declare const ChildrenOnly: Story;
|
|
93
|
+
//# sourceMappingURL=TableHeader.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHeader.stories.d.ts","sourceRoot":"","sources":["../../../src/components/table/TableHeader.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA8F5C,iBAAS,mBAAmB,4CAmB3B;AAMD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC0B,CAAC;AAErC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAkB1C,eAAO,MAAM,OAAO,EAAE,KAkBrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAoBxB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAkB1B,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Controls, Heading as DocHeading, Markdown, Primary as DocPrimary, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
import { TableHeader } from './TableHeader';
|
|
6
|
+
import { TableControls } from './tableControls/TableControls';
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Docs page content
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
const DESCRIPTION_INTRO = [
|
|
11
|
+
'`TableHeader` is the pre-composed header slot for the Arbor data table.',
|
|
12
|
+
'It renders a `<header>` element and accepts any `children` (typically a `<TableControls />` element)',
|
|
13
|
+
'plus an optional built-in `<SearchBar />` via the `hasSearch` prop.',
|
|
14
|
+
'',
|
|
15
|
+
'Pass the entire `<TableHeader />` element as the `headerContent` prop of `<Table />`.',
|
|
16
|
+
].join('\n');
|
|
17
|
+
const USAGE_GUIDANCE = [
|
|
18
|
+
'### When to use',
|
|
19
|
+
'',
|
|
20
|
+
'- As the `headerContent` of a `<Table />` when you need a standard header region',
|
|
21
|
+
'- When you want to combine a toolbar (`<TableControls />`) with a search bar in one slot',
|
|
22
|
+
'- When you need custom header content that is not covered by `<TableControls />`',
|
|
23
|
+
'',
|
|
24
|
+
'---',
|
|
25
|
+
'',
|
|
26
|
+
'### When NOT to use',
|
|
27
|
+
'',
|
|
28
|
+
'| Situation | Alternative |',
|
|
29
|
+
'|---|---|',
|
|
30
|
+
'| You only need a toolbar | Pass `<TableControls />` directly as `headerContent` |',
|
|
31
|
+
'| You only need a search bar | Pass `<SearchBar />` directly as `headerContent` |',
|
|
32
|
+
'| The table has no header | Omit `headerContent` entirely |',
|
|
33
|
+
'',
|
|
34
|
+
'---',
|
|
35
|
+
'',
|
|
36
|
+
'### Props summary',
|
|
37
|
+
'',
|
|
38
|
+
'| Prop | Description |',
|
|
39
|
+
'|---|---|',
|
|
40
|
+
'| `children` | Content rendered before the `SearchBar` — typically `<TableControls />` |',
|
|
41
|
+
'| `hasSearch` | When `true`, renders a `<SearchBar />` at the end of the header |',
|
|
42
|
+
'| `searchValue` | Controlled value for the `SearchBar` |',
|
|
43
|
+
'| `setSearchValue` | Called with the new search string when the user types |',
|
|
44
|
+
].join('\n');
|
|
45
|
+
const DEVELOPER_NOTES = [
|
|
46
|
+
'### Wiring into `<Table />`',
|
|
47
|
+
'',
|
|
48
|
+
'```tsx',
|
|
49
|
+
"import { useState } from 'react';",
|
|
50
|
+
"import { Table, TableHeader, TableControls } from '@arbor-education/design-system.components';",
|
|
51
|
+
'',
|
|
52
|
+
'function MyTable() {',
|
|
53
|
+
" const [search, setSearch] = useState('');",
|
|
54
|
+
'',
|
|
55
|
+
' return (',
|
|
56
|
+
' <Table',
|
|
57
|
+
' rowData={rows}',
|
|
58
|
+
' columnDefs={colDefs}',
|
|
59
|
+
' quickFilterText={search}',
|
|
60
|
+
' headerContent={(',
|
|
61
|
+
' <TableHeader hasSearch searchValue={search} setSearchValue={setSearch}>',
|
|
62
|
+
' <TableControls',
|
|
63
|
+
' onUndo={handleUndo}',
|
|
64
|
+
' onDownload={handleDownload}',
|
|
65
|
+
' showSettings',
|
|
66
|
+
' />',
|
|
67
|
+
' </TableHeader>',
|
|
68
|
+
' )}',
|
|
69
|
+
' />',
|
|
70
|
+
' );',
|
|
71
|
+
'}',
|
|
72
|
+
'```',
|
|
73
|
+
'',
|
|
74
|
+
'---',
|
|
75
|
+
'',
|
|
76
|
+
'### `hasSearch` vs passing `<SearchBar />` directly',
|
|
77
|
+
'',
|
|
78
|
+
'Both approaches are equivalent. `TableHeader` with `hasSearch` is more concise when you already',
|
|
79
|
+
'have `TableHeader` for the `children` slot. If you only need a search bar and no other header',
|
|
80
|
+
'content, pass `<SearchBar />` directly as `headerContent` without wrapping it in `TableHeader`.',
|
|
81
|
+
].join('\n');
|
|
82
|
+
const RELATED_COMPONENTS = [
|
|
83
|
+
'## Related components',
|
|
84
|
+
'',
|
|
85
|
+
'[Table](?path=/docs/components-table--docs) · [TableControls](?path=/docs/components-table-tablecontrols--docs) · [TableFooter](?path=/docs/components-table-tablefooter--docs) · [SearchBar](?path=/docs/components-searchbar--docs)',
|
|
86
|
+
].join('\n');
|
|
87
|
+
const PROPS_INTRO = 'The preview below is wired to the **Controls** panel — toggle `hasSearch` to add or remove the search bar.';
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Custom DocsPage
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
function TableHeaderDocsPage() {
|
|
92
|
+
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(Markdown, { children: PROPS_INTRO }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "Usage guidance" }), _jsx(Markdown, { children: USAGE_GUIDANCE }), _jsx(DocHeading, { children: "Developer notes" }), _jsx(Markdown, { children: DEVELOPER_NOTES }), _jsx(DocHeading, { children: "Examples" }), _jsx(Stories, { title: "" }), _jsx(Markdown, { children: RELATED_COMPONENTS })] }));
|
|
93
|
+
}
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Meta
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
const meta = {
|
|
98
|
+
title: 'Components/Table/TableHeader',
|
|
99
|
+
component: TableHeader,
|
|
100
|
+
tags: ['autodocs'],
|
|
101
|
+
parameters: {
|
|
102
|
+
layout: 'padded',
|
|
103
|
+
docs: { page: TableHeaderDocsPage },
|
|
104
|
+
},
|
|
105
|
+
argTypes: {
|
|
106
|
+
children: {
|
|
107
|
+
description: 'Content rendered inside the header before the `SearchBar`. Typically a `<TableControls />` element.',
|
|
108
|
+
control: false,
|
|
109
|
+
table: { type: { summary: 'ReactNode' }, defaultValue: { summary: 'undefined' } },
|
|
110
|
+
},
|
|
111
|
+
hasSearch: {
|
|
112
|
+
description: 'When `true`, renders a `<SearchBar />` at the end of the header.',
|
|
113
|
+
control: 'boolean',
|
|
114
|
+
table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' } },
|
|
115
|
+
},
|
|
116
|
+
searchValue: {
|
|
117
|
+
description: 'Controlled value for the `SearchBar`. Only used when `hasSearch` is `true`.',
|
|
118
|
+
control: 'text',
|
|
119
|
+
table: { type: { summary: 'string' }, defaultValue: { summary: 'undefined' } },
|
|
120
|
+
},
|
|
121
|
+
setSearchValue: {
|
|
122
|
+
description: 'Called with the new search string when the user types. Only used when `hasSearch` is `true`.',
|
|
123
|
+
control: false,
|
|
124
|
+
table: { type: { summary: '(searchValue: string) => void' }, defaultValue: { summary: 'undefined' } },
|
|
125
|
+
},
|
|
126
|
+
className: {
|
|
127
|
+
description: 'Additional CSS class name(s) to apply to the root `<header>` element.',
|
|
128
|
+
control: 'text',
|
|
129
|
+
table: { type: { summary: 'string' }, defaultValue: { summary: 'undefined' } },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
args: {
|
|
133
|
+
setSearchValue: fn(),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
export default meta;
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// Helper
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
const withDescription = (story, description) => ({
|
|
141
|
+
...story,
|
|
142
|
+
parameters: {
|
|
143
|
+
...story.parameters,
|
|
144
|
+
docs: { ...story.parameters?.docs, description: { story: description } },
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// Stories
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
export const Default = withDescription({
|
|
151
|
+
args: {
|
|
152
|
+
hasSearch: false,
|
|
153
|
+
children: (_jsx(TableControls, { onUndo: fn(), onRedo: fn(), onDownload: fn(), showSettings: true, onHelp: fn(), onExpandToggle: fn() })),
|
|
154
|
+
},
|
|
155
|
+
}, 'The interactive canvas — `TableHeader` wrapping a `<TableControls />` element, which is the canonical usage. '
|
|
156
|
+
+ 'Toggle `hasSearch` in the Controls panel to add the built-in `SearchBar`.');
|
|
157
|
+
export const WithSearch = withDescription({
|
|
158
|
+
parameters: { controls: { disable: true } },
|
|
159
|
+
render: () => {
|
|
160
|
+
const [search, setSearch] = React.useState('');
|
|
161
|
+
return (_jsx(TableHeader, { hasSearch: true, searchValue: search, setSearchValue: setSearch, children: _jsx(TableControls, { onUndo: fn(), onRedo: fn(), onDownload: fn(), showSettings: true }) }));
|
|
162
|
+
},
|
|
163
|
+
}, '`hasSearch={true}` adds a `SearchBar` at the end of the header. '
|
|
164
|
+
+ '`searchValue` and `setSearchValue` give you controlled access to the search string — '
|
|
165
|
+
+ "pass it as `quickFilterText` to `<Table />` to drive AG Grid's built-in text filtering.");
|
|
166
|
+
export const ChildrenOnly = withDescription({
|
|
167
|
+
parameters: { controls: { disable: true } },
|
|
168
|
+
args: {
|
|
169
|
+
children: (_jsx(TableControls, { bulkActions: [
|
|
170
|
+
{ displayName: 'Export selected', callback: fn() },
|
|
171
|
+
{ displayName: 'Delete selected', callback: fn(), disabled: true },
|
|
172
|
+
], onUndo: fn(), onRedo: fn() })),
|
|
173
|
+
},
|
|
174
|
+
}, 'The header slot with only `children` — no built-in search bar. '
|
|
175
|
+
+ 'Any `ReactNode` is accepted as `children`; `<TableControls />` is the most common choice.');
|
|
176
|
+
//# sourceMappingURL=TableHeader.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHeader.stories.js","sourceRoot":"","sources":["../../../src/components/table/TableHeader.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,QAAQ,EACR,OAAO,IAAI,UAAU,EACrB,OAAO,EACP,QAAQ,EACR,KAAK,GACN,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,iBAAiB,GAAG;IACxB,yEAAyE;IACzE,sGAAsG;IACtG,qEAAqE;IACrE,EAAE;IACF,uFAAuF;CACxF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,EAAE;IACF,kFAAkF;IAClF,0FAA0F;IAC1F,kFAAkF;IAClF,EAAE;IACF,KAAK;IACL,EAAE;IACF,qBAAqB;IACrB,EAAE;IACF,6BAA6B;IA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SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC/C,OAAO,CACL,KAAC,WAAW,IAAC,SAAS,QAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,YACnE,KAAC,aAAa,IACZ,MAAM,EAAE,EAAE,EAAE,EACZ,MAAM,EAAE,EAAE,EAAE,EACZ,UAAU,EAAE,EAAE,EAAE,EAChB,YAAY,SACZ,GACU,CACf,CAAC;IACJ,CAAC;CACF,EACD,kEAAkE;MAChE,uFAAuF;MACvF,yFAAyF,CAC5F,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU,eAAe,CAChD;IACE,UAAU,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC3C,IAAI,EAAE;QACJ,QAAQ,EAAE,CACR,KAAC,aAAa,IACZ,WAAW,EAAE;gBACX,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;gBAClD,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;aACnE,EACD,MAAM,EAAE,EAAE,EAAE,EACZ,MAAM,EAAE,EAAE,EAAE,GACZ,CACH;KACF;CACF,EACD,iEAAiE;MAC/D,2FAA2F,CAC9F,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import type { CustomCellEditorProps } from 'ag-grid-react';
|
|
3
|
+
import { DateCellEditor } from './DateCellEditor';
|
|
4
|
+
declare function DateCellEditorDocsPage(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: (props: CustomCellEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
tags: string[];
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: string;
|
|
11
|
+
docs: {
|
|
12
|
+
page: typeof DateCellEditorDocsPage;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
argTypes: {
|
|
16
|
+
value: {
|
|
17
|
+
description: string;
|
|
18
|
+
control: false;
|
|
19
|
+
table: {
|
|
20
|
+
type: {
|
|
21
|
+
summary: string;
|
|
22
|
+
};
|
|
23
|
+
defaultValue: {
|
|
24
|
+
summary: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
onValueChange: {
|
|
29
|
+
description: string;
|
|
30
|
+
control: false;
|
|
31
|
+
table: {
|
|
32
|
+
type: {
|
|
33
|
+
summary: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof DateCellEditor>;
|
|
41
|
+
export declare const Default: Story;
|
|
42
|
+
export declare const WithExistingDate: Story;
|
|
43
|
+
export declare const InATable: Story;
|
|
44
|
+
//# sourceMappingURL=DateCellEditor.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateCellEditor.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/table/cellEditors/DateCellEditor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuElD,iBAAS,sBAAsB,4CAiB9B;AAgBD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB6B,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAc7C,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC;AASF,eAAO,MAAM,QAAQ,EAAE,KAqEtB,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Controls, Heading as DocHeading, Markdown, Primary as DocPrimary, Stories, Subtitle, Title, } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
import { DateCellEditor } from './DateCellEditor';
|
|
5
|
+
import { Table } from '../../table/Table';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Docs page content
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
const DESCRIPTION_INTRO = [
|
|
10
|
+
'`DateCellEditor` is an AG Grid cell editor component that renders an Arbor `DatePicker` inside a table cell.',
|
|
11
|
+
'It is invoked when a user begins editing a date column (e.g. by pressing Enter or double-clicking the cell).',
|
|
12
|
+
'',
|
|
13
|
+
'Register it via the AG Grid `cellEditor` column definition property.',
|
|
14
|
+
].join('\n');
|
|
15
|
+
const USAGE_GUIDANCE = [
|
|
16
|
+
'### When to use',
|
|
17
|
+
'',
|
|
18
|
+
'- On date columns that need an inline date-picker editor',
|
|
19
|
+
'- When users should be able to edit a date value directly in the table without leaving the row',
|
|
20
|
+
'',
|
|
21
|
+
'---',
|
|
22
|
+
'',
|
|
23
|
+
'### Registration',
|
|
24
|
+
'',
|
|
25
|
+
'```tsx',
|
|
26
|
+
"import { DateCellEditor } from '@arbor-education/design-system.components';",
|
|
27
|
+
'',
|
|
28
|
+
'const colDefs = [',
|
|
29
|
+
' {',
|
|
30
|
+
" field: 'dob',",
|
|
31
|
+
" headerName: 'Date of birth',",
|
|
32
|
+
' cellEditor: DateCellEditor,',
|
|
33
|
+
' // or via string key:',
|
|
34
|
+
" cellEditor: 'dsDateCellEditor',",
|
|
35
|
+
' },',
|
|
36
|
+
'];',
|
|
37
|
+
'```',
|
|
38
|
+
'',
|
|
39
|
+
'---',
|
|
40
|
+
'',
|
|
41
|
+
'### `cellEditorParams`',
|
|
42
|
+
'',
|
|
43
|
+
'Any additional props to pass to the underlying `DatePicker` can be provided via `cellEditorParams`:',
|
|
44
|
+
'',
|
|
45
|
+
'```tsx',
|
|
46
|
+
'cellEditorParams: {',
|
|
47
|
+
" placeholder: 'dd/mm/yyyy',",
|
|
48
|
+
' disabled: false,',
|
|
49
|
+
'},',
|
|
50
|
+
'```',
|
|
51
|
+
'',
|
|
52
|
+
'---',
|
|
53
|
+
'',
|
|
54
|
+
'### Value format',
|
|
55
|
+
'',
|
|
56
|
+
'The `value` and `onValueChange` use the same date format as the Arbor `DatePicker`.',
|
|
57
|
+
'Refer to the [DatePicker docs](?path=/docs/components-datepicker--docs) for format details.',
|
|
58
|
+
].join('\n');
|
|
59
|
+
const RELATED_COMPONENTS = [
|
|
60
|
+
'## Related components',
|
|
61
|
+
'',
|
|
62
|
+
'[Table](?path=/docs/components-table--docs) · [DatePicker](?path=/docs/components-datepicker--docs)',
|
|
63
|
+
].join('\n');
|
|
64
|
+
const PROPS_INTRO = 'The preview below shows `DateCellEditor` rendering the Arbor `DatePicker` with a pre-set date value. In a real table this component is mounted by AG Grid when the user begins editing a date cell.';
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Custom DocsPage
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
function DateCellEditorDocsPage() {
|
|
69
|
+
return (_jsxs(_Fragment, { children: [_jsx(Title, {}), _jsx(Subtitle, {}), _jsx(Markdown, { children: DESCRIPTION_INTRO }), _jsx(DocHeading, { children: "Interactive example" }), _jsx(Markdown, { children: PROPS_INTRO }), _jsx(DocPrimary, {}), _jsx(Controls, {}), _jsx(DocHeading, { children: "Usage guidance" }), _jsx(Markdown, { children: USAGE_GUIDANCE }), _jsx(DocHeading, { children: "Examples" }), _jsx(Stories, { title: "" }), _jsx(Markdown, { children: RELATED_COMPONENTS })] }));
|
|
70
|
+
}
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
// Helpers
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
const makeEditorProps = (value) => ({
|
|
75
|
+
value,
|
|
76
|
+
onValueChange: fn(),
|
|
77
|
+
colDef: { cellEditorParams: {} },
|
|
78
|
+
});
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Meta
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
const meta = {
|
|
83
|
+
title: 'Components/Table/CellEditors/DateCellEditor',
|
|
84
|
+
component: DateCellEditor,
|
|
85
|
+
tags: ['autodocs'],
|
|
86
|
+
parameters: {
|
|
87
|
+
layout: 'padded',
|
|
88
|
+
docs: { page: DateCellEditorDocsPage },
|
|
89
|
+
},
|
|
90
|
+
argTypes: {
|
|
91
|
+
value: {
|
|
92
|
+
description: 'The current date value of the cell being edited. Format matches the Arbor `DatePicker` value format.',
|
|
93
|
+
control: false,
|
|
94
|
+
table: { type: { summary: 'string' }, defaultValue: { summary: 'undefined' } },
|
|
95
|
+
},
|
|
96
|
+
onValueChange: {
|
|
97
|
+
description: 'Called by AG Grid when the editor value changes. Receives the new date value.',
|
|
98
|
+
control: false,
|
|
99
|
+
table: { type: { summary: '(value: string) => void' } },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export default meta;
|
|
104
|
+
const withDescription = (story, description) => ({
|
|
105
|
+
...story,
|
|
106
|
+
parameters: {
|
|
107
|
+
...story.parameters,
|
|
108
|
+
docs: { ...story.parameters?.docs, description: { story: description } },
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Stories
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
export const Default = withDescription({
|
|
115
|
+
render: () => _jsx(DateCellEditor, { ...makeEditorProps(undefined) }),
|
|
116
|
+
}, 'The `DateCellEditor` with no initial value — renders an empty `DatePicker` ready for input.');
|
|
117
|
+
export const WithExistingDate = withDescription({
|
|
118
|
+
parameters: { controls: { disable: true } },
|
|
119
|
+
render: () => _jsx(DateCellEditor, { ...makeEditorProps(new Date('2024-09-01')) }),
|
|
120
|
+
}, 'Pre-populated with an existing date value. In a table, AG Grid passes the cell\'s current value as `value` when the editor opens.');
|
|
121
|
+
const DATE_EDITOR_IN_TABLE_DATA = [
|
|
122
|
+
{ name: 'Alice Johnson', dateOfBirth: new Date(1990, 0, 15) },
|
|
123
|
+
{ name: 'Bob Smith', dateOfBirth: new Date(1985, 5, 20) },
|
|
124
|
+
{ name: 'Charlie Brown', dateOfBirth: new Date(1992, 10, 3) },
|
|
125
|
+
{ name: 'Diana Prince', dateOfBirth: new Date(1988, 3, 12) },
|
|
126
|
+
];
|
|
127
|
+
export const InATable = withDescription({
|
|
128
|
+
parameters: {
|
|
129
|
+
controls: { disable: true },
|
|
130
|
+
docs: {
|
|
131
|
+
source: {
|
|
132
|
+
language: 'tsx',
|
|
133
|
+
code: `
|
|
134
|
+
import { Table } from '@arbor-education/design-system.components';
|
|
135
|
+
|
|
136
|
+
const rowData = [
|
|
137
|
+
{ name: 'Alice Johnson', dateOfBirth: new Date(1990, 0, 15) },
|
|
138
|
+
{ name: 'Bob Smith', dateOfBirth: new Date(1985, 5, 20) },
|
|
139
|
+
{ name: 'Charlie Brown', dateOfBirth: new Date(1992, 10, 3) },
|
|
140
|
+
{ name: 'Diana Prince', dateOfBirth: new Date(1988, 3, 12) },
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
function DateCellEditorExample() {
|
|
144
|
+
return (
|
|
145
|
+
<Table
|
|
146
|
+
rowData={rowData}
|
|
147
|
+
columnDefs={[
|
|
148
|
+
{ field: 'name', headerName: 'Name', flex: 2, editable: false },
|
|
149
|
+
{
|
|
150
|
+
field: 'dateOfBirth',
|
|
151
|
+
headerName: 'Date of birth',
|
|
152
|
+
flex: 1,
|
|
153
|
+
editable: true,
|
|
154
|
+
cellEditor: 'dsDateCellEditor',
|
|
155
|
+
valueFormatter: (params) =>
|
|
156
|
+
params.value instanceof Date
|
|
157
|
+
? params.value.toLocaleDateString('en-GB')
|
|
158
|
+
: params.value,
|
|
159
|
+
},
|
|
160
|
+
]}
|
|
161
|
+
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
162
|
+
domLayout="autoHeight"
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export default DateCellEditorExample;
|
|
168
|
+
`.trim(),
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
render: () => (_jsx(Table, { rowData: DATE_EDITOR_IN_TABLE_DATA, columnDefs: [
|
|
173
|
+
{ field: 'name', headerName: 'Name', flex: 2, editable: false },
|
|
174
|
+
{
|
|
175
|
+
field: 'dateOfBirth',
|
|
176
|
+
headerName: 'Date of birth',
|
|
177
|
+
flex: 1,
|
|
178
|
+
editable: true,
|
|
179
|
+
cellEditor: 'dsDateCellEditor',
|
|
180
|
+
valueFormatter: params => params.value instanceof Date
|
|
181
|
+
? params.value.toLocaleDateString('en-GB')
|
|
182
|
+
: params.value,
|
|
183
|
+
},
|
|
184
|
+
], defaultColDef: { flex: 1, minWidth: 120 }, domLayout: "autoHeight" })),
|
|
185
|
+
}, '`dsDateCellEditor` wired up inside a full `Table`. Double-click (or press F2/Enter) on a Date of birth cell to open the `DatePicker` editor — AG Grid mounts the editor component and passes the current cell value as `value`. The `valueFormatter` formats the stored `Date` object as a localised string for display.');
|
|
186
|
+
//# sourceMappingURL=DateCellEditor.stories.js.map
|