@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
|
@@ -483,14 +483,18 @@ const ContentGuidelinesTemplate = () => (
|
|
|
483
483
|
export const Default: Story = withDescription(
|
|
484
484
|
{
|
|
485
485
|
args: {
|
|
486
|
-
level: BANNER_LEVEL.
|
|
487
|
-
|
|
486
|
+
level: BANNER_LEVEL.WARNING,
|
|
487
|
+
title: 'Reporting period closing soon',
|
|
488
|
+
text: 'The census submission deadline is Friday 17 April at 5pm.',
|
|
489
|
+
buttonText: 'Review exclusions',
|
|
490
|
+
buttonOnClick: fn(),
|
|
488
491
|
},
|
|
489
492
|
render: args => <Banner {...args} />,
|
|
490
493
|
},
|
|
491
494
|
[
|
|
492
495
|
'The interactive canvas story — every prop is wired to the **Controls** panel below.',
|
|
493
|
-
'
|
|
496
|
+
'The canonical Banner structure: icon + title + body + CTA button.',
|
|
497
|
+
'Use the controls to explore all four levels, toggle `hideIcon`, change `title`, `text`, `buttonText`,',
|
|
494
498
|
'and override the default `icon`. Start by changing `level` to see the colour scheme shift.',
|
|
495
499
|
].join(' '),
|
|
496
500
|
);
|
|
@@ -1,55 +1,485 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
Controls,
|
|
4
|
+
Heading as DocHeading,
|
|
5
|
+
Markdown,
|
|
6
|
+
Primary as DocPrimary,
|
|
7
|
+
Stories,
|
|
8
|
+
Subtitle,
|
|
9
|
+
Title,
|
|
10
|
+
} from '@storybook/addon-docs/blocks';
|
|
2
11
|
import { fn } from 'storybook/test';
|
|
3
12
|
import { Card } from './Card';
|
|
4
13
|
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Docs page content
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
const DESCRIPTION_INTRO = [
|
|
19
|
+
'`Card` is a surface component for grouping related content into a visually distinct container.',
|
|
20
|
+
'It comes in two modes: **static** (read-only content display) and **interactive** (clickable, with',
|
|
21
|
+
'`role="button"` semantics, keyboard support, and a chevron/arrow icon).',
|
|
22
|
+
].join(' ');
|
|
23
|
+
|
|
24
|
+
const USAGE_GUIDANCE = [
|
|
25
|
+
'### When to use',
|
|
26
|
+
'',
|
|
27
|
+
'- Grouping a summary of related data that belongs together visually (attendance overview, pupil profile, KPI)',
|
|
28
|
+
'- As a navigational element that takes the user to a detail view — use the interactive variant with `onClick`',
|
|
29
|
+
'- When you need a consistent bordered surface that responds to the design system\'s spacing and colour tokens',
|
|
30
|
+
'',
|
|
31
|
+
'---',
|
|
32
|
+
'',
|
|
33
|
+
'### When NOT to use',
|
|
34
|
+
'',
|
|
35
|
+
'| Situation | Use instead |',
|
|
36
|
+
'|---|---|',
|
|
37
|
+
'| A simple key–value summary | [`Row`](?path=/docs/components-row--docs) inside a `Section` |',
|
|
38
|
+
'| A list of selectable items | `RadioGroup` or a selection list pattern |',
|
|
39
|
+
'| Full-page layout regions | Semantic HTML (`<section>`, `<article>`) with appropriate headings |',
|
|
40
|
+
'| Buttons or links inside a clickable card | Do not — nest no interactive elements inside an interactive card |',
|
|
41
|
+
].join('\n');
|
|
42
|
+
|
|
43
|
+
const DEVELOPER_NOTES = [
|
|
44
|
+
'### Critical usage patterns',
|
|
45
|
+
'',
|
|
46
|
+
'**Interactive cards require an accessible name.**',
|
|
47
|
+
'`onClick` makes the card a `role="button"` element. Without `aria-label` or `aria-labelledby`,',
|
|
48
|
+
'the component throws in development and logs an error in production. Always provide one.',
|
|
49
|
+
'',
|
|
50
|
+
'```tsx',
|
|
51
|
+
'// ✅ Correct — aria-label provided',
|
|
52
|
+
'<Card onClick={handleClick} aria-label="View Alice Johnson\'s attendance record">',
|
|
53
|
+
' ...',
|
|
54
|
+
'</Card>',
|
|
55
|
+
'',
|
|
56
|
+
'// ✅ Correct — aria-labelledby pointing to a heading inside the card',
|
|
57
|
+
'<Card onClick={handleClick} aria-labelledby="card-heading-alice">',
|
|
58
|
+
' <h3 id="card-heading-alice">Alice Johnson</h3>',
|
|
59
|
+
' ...',
|
|
60
|
+
'</Card>',
|
|
61
|
+
'',
|
|
62
|
+
'// ❌ Wrong — no accessible name on an interactive card',
|
|
63
|
+
'<Card onClick={handleClick}>...</Card>',
|
|
64
|
+
'```',
|
|
65
|
+
'',
|
|
66
|
+
'**`disabled` only has effect when `onClick` is also provided.**',
|
|
67
|
+
'Passing `disabled` to a static card (no `onClick`) is a no-op. The disabled state sets `aria-disabled={true}`',
|
|
68
|
+
'and suppresses click/keyboard handling — it does NOT remove the card from the tab order (use `tabIndex={-1}`',
|
|
69
|
+
'via `className` overrides if needed).',
|
|
70
|
+
'',
|
|
71
|
+
'**Never put interactive elements inside a clickable card.**',
|
|
72
|
+
'Nesting `<Button>`, `<a>`, `<input>` etc. inside an interactive card creates nested interactives — a WCAG 2.1',
|
|
73
|
+
'failure (1.3.1). If your card content needs buttons, use a static card.',
|
|
74
|
+
'',
|
|
75
|
+
'**The chevron/arrow icon is managed automatically.**',
|
|
76
|
+
'Clickable cards render a `chevron-right` icon that swaps to `arrow-right` on hover. Do not render your',
|
|
77
|
+
'own navigation icon inside the card — it will be duplicated.',
|
|
78
|
+
'',
|
|
79
|
+
'---',
|
|
80
|
+
'',
|
|
81
|
+
'### Accessibility',
|
|
82
|
+
'',
|
|
83
|
+
'- Interactive cards receive `role="button"` and `tabIndex={0}` automatically.',
|
|
84
|
+
'- Enter and Space trigger the `onClick` handler via keyboard.',
|
|
85
|
+
'- `aria-label` or `aria-labelledby` is **required** on interactive cards (throws in dev without it).',
|
|
86
|
+
'- For static cards, an accessible label is recommended for screen reader context but not enforced.',
|
|
87
|
+
'- `aria-disabled={true}` is set on disabled interactive cards — assistive technology announces the',
|
|
88
|
+
' disabled state while the element remains in the tab order.',
|
|
89
|
+
'',
|
|
90
|
+
'---',
|
|
91
|
+
'',
|
|
92
|
+
'### TypeScript types',
|
|
93
|
+
'',
|
|
94
|
+
'```ts',
|
|
95
|
+
"import { Card } from '@arbor-education/design-system.components';",
|
|
96
|
+
"import type { CardProps } from '@arbor-education/design-system.components';",
|
|
97
|
+
'',
|
|
98
|
+
'// Or via namespace:',
|
|
99
|
+
'type MyCardProps = Card.Props;',
|
|
100
|
+
'type MyInteractiveProps = Card.InteractiveProps;',
|
|
101
|
+
'type MyAccessibleNameProps = Card.AccessibleNameProps;',
|
|
102
|
+
'```',
|
|
103
|
+
].join('\n');
|
|
104
|
+
|
|
105
|
+
const RELATED_COMPONENTS = [
|
|
106
|
+
'## Related components',
|
|
107
|
+
'',
|
|
108
|
+
'[Section](?path=/docs/components-section--docs) · [Row](?path=/docs/components-row--docs) · [Button](?path=/docs/components-button--docs)',
|
|
109
|
+
].join('\n');
|
|
110
|
+
|
|
111
|
+
const PROPS_INTRO = 'The preview below is wired to the **Controls** panel — toggle `disabled` or switch `spacing` to see the card update in real time.';
|
|
112
|
+
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// Custom DocsPage
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
function CardDocsPage() {
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
<Title />
|
|
121
|
+
<Subtitle />
|
|
122
|
+
<Markdown>{DESCRIPTION_INTRO}</Markdown>
|
|
123
|
+
<DocHeading>Interactive example</DocHeading>
|
|
124
|
+
<Markdown>{PROPS_INTRO}</Markdown>
|
|
125
|
+
<DocPrimary />
|
|
126
|
+
<Controls />
|
|
127
|
+
<DocHeading>Usage guidance</DocHeading>
|
|
128
|
+
<Markdown>{USAGE_GUIDANCE}</Markdown>
|
|
129
|
+
<DocHeading>Developer notes</DocHeading>
|
|
130
|
+
<Markdown>{DEVELOPER_NOTES}</Markdown>
|
|
131
|
+
<DocHeading>Examples</DocHeading>
|
|
132
|
+
<Stories title="" />
|
|
133
|
+
<Markdown>{RELATED_COMPONENTS}</Markdown>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
// Meta
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
|
|
5
142
|
const meta = {
|
|
6
143
|
title: 'Components/Card',
|
|
7
144
|
component: Card,
|
|
145
|
+
tags: ['autodocs'],
|
|
146
|
+
parameters: {
|
|
147
|
+
layout: 'padded',
|
|
148
|
+
docs: { page: CardDocsPage },
|
|
149
|
+
},
|
|
150
|
+
argTypes: {
|
|
151
|
+
'spacing': {
|
|
152
|
+
control: { type: 'radio' },
|
|
153
|
+
options: ['default', 'dense'],
|
|
154
|
+
description: 'Padding variant. `"dense"` uses `--spacing-small` for compact layouts.',
|
|
155
|
+
table: {
|
|
156
|
+
type: { summary: "'default' | 'dense'" },
|
|
157
|
+
defaultValue: { summary: "'default'" },
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
'disabled': {
|
|
161
|
+
control: 'boolean',
|
|
162
|
+
description: 'Disables an interactive card — sets `aria-disabled={true}` and suppresses click/keyboard handling. Has no effect on static cards (no `onClick`).',
|
|
163
|
+
table: {
|
|
164
|
+
type: { summary: 'boolean' },
|
|
165
|
+
defaultValue: { summary: 'false' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
'aria-label': {
|
|
169
|
+
control: 'text',
|
|
170
|
+
description: '**Required on interactive cards** (unless `aria-labelledby` is provided). The accessible name announced by screen readers as the button label.',
|
|
171
|
+
table: {
|
|
172
|
+
type: { summary: 'string' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
'aria-labelledby': {
|
|
176
|
+
control: false,
|
|
177
|
+
description: 'ID of a visible element (typically a heading inside the card) whose text becomes the accessible name. Use as an alternative to `aria-label` when the card already contains a heading.',
|
|
178
|
+
table: {
|
|
179
|
+
type: { summary: 'string' },
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
'onClick': {
|
|
183
|
+
control: false,
|
|
184
|
+
description: 'Click handler. Providing this prop switches the card to **interactive mode** — it gains `role="button"`, `tabIndex={0}`, and a chevron/arrow icon. Requires `aria-label` or `aria-labelledby`.',
|
|
185
|
+
table: {
|
|
186
|
+
type: { summary: '(e: MouseEvent<HTMLElement>) => void' },
|
|
187
|
+
defaultValue: { summary: 'undefined' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
'onKeyDown': {
|
|
191
|
+
control: false,
|
|
192
|
+
description: 'Optional keydown handler called after the built-in Enter/Space handling. Only fires when the card is interactive and not disabled.',
|
|
193
|
+
table: {
|
|
194
|
+
type: { summary: '(e: KeyboardEvent<HTMLElement>) => void' },
|
|
195
|
+
defaultValue: { summary: 'undefined' },
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
'children': {
|
|
199
|
+
control: false,
|
|
200
|
+
description: 'Content rendered inside the card body.',
|
|
201
|
+
table: {
|
|
202
|
+
type: { summary: 'ReactNode' },
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
'className': {
|
|
206
|
+
control: false,
|
|
207
|
+
description: 'Additional CSS class names on the root `<figure>` element.',
|
|
208
|
+
table: {
|
|
209
|
+
type: { summary: 'string' },
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
8
213
|
} satisfies Meta<typeof Card>;
|
|
9
214
|
|
|
10
|
-
|
|
215
|
+
export default meta;
|
|
216
|
+
type Story = StoryObj<typeof Card>;
|
|
217
|
+
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
// Helper: attach a per-story description to docs
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
|
|
222
|
+
const withDescription = (story: Story, description: string): Story => ({
|
|
223
|
+
...story,
|
|
224
|
+
parameters: {
|
|
225
|
+
...story.parameters,
|
|
226
|
+
docs: { ...story.parameters?.docs, description: { story: description } },
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// Template components
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
|
|
234
|
+
const SampleContent = () => (
|
|
235
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xsmall)' }}>
|
|
236
|
+
<p className="ds-text ds-text--heading-small" style={{ margin: 0 }}>Attendance summary</p>
|
|
237
|
+
<p className="ds-text" style={{ margin: 0, color: 'var(--color-grey-600)' }}>
|
|
238
|
+
View the latest attendance and behaviour insights for this cohort.
|
|
239
|
+
</p>
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const WithAriaLabelledByTemplate = () => (
|
|
244
|
+
<div style={{ maxWidth: '400px' }}>
|
|
245
|
+
<Card
|
|
246
|
+
onClick={fn()}
|
|
247
|
+
aria-labelledby="card-story-heading"
|
|
248
|
+
>
|
|
249
|
+
<p
|
|
250
|
+
id="card-story-heading"
|
|
251
|
+
className="ds-text ds-text--heading-small"
|
|
252
|
+
style={{ margin: 0 }}
|
|
253
|
+
>
|
|
254
|
+
Pupil progress report
|
|
255
|
+
</p>
|
|
256
|
+
<p className="ds-text" style={{ margin: 0, color: 'var(--color-grey-600)' }}>
|
|
257
|
+
Summer term 2024 — 8 pupils flagged for review.
|
|
258
|
+
</p>
|
|
259
|
+
</Card>
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
// Stories
|
|
265
|
+
// ---------------------------------------------------------------------------
|
|
266
|
+
|
|
267
|
+
export const Default: Story = withDescription(
|
|
268
|
+
{
|
|
269
|
+
args: {
|
|
270
|
+
'aria-label': 'Attendance summary',
|
|
271
|
+
'onClick': fn(),
|
|
272
|
+
'spacing': 'default',
|
|
273
|
+
'disabled': false,
|
|
274
|
+
},
|
|
275
|
+
render: args => (
|
|
276
|
+
<div style={{ maxWidth: '400px' }}>
|
|
277
|
+
<Card {...args}>
|
|
278
|
+
<SampleContent />
|
|
279
|
+
</Card>
|
|
280
|
+
</div>
|
|
281
|
+
),
|
|
282
|
+
},
|
|
283
|
+
'An interactive card — `onClick` is provided so the card has `role="button"` and shows a chevron icon. Toggle `disabled` in the **Controls** panel to see the disabled state. Switch `spacing` to `"dense"` for the compact variant.',
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
export const Static: Story = withDescription(
|
|
287
|
+
{
|
|
288
|
+
parameters: {
|
|
289
|
+
controls: { disable: true },
|
|
290
|
+
docs: {
|
|
291
|
+
source: {
|
|
292
|
+
language: 'tsx',
|
|
293
|
+
code: `
|
|
294
|
+
import { Card } from '@arbor-education/design-system.components';
|
|
11
295
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
296
|
+
function StaticCardExample() {
|
|
297
|
+
return (
|
|
298
|
+
<Card aria-label="Attendance summary" style={{ maxWidth: '400px' }}>
|
|
299
|
+
<p>Attendance summary</p>
|
|
300
|
+
<p>View the latest attendance and behaviour insights for this cohort.</p>
|
|
301
|
+
</Card>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export default StaticCardExample;
|
|
306
|
+
`.trim(),
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
render: () => (
|
|
311
|
+
<div style={{ maxWidth: '400px' }}>
|
|
312
|
+
<Card aria-label="Attendance summary">
|
|
313
|
+
<SampleContent />
|
|
314
|
+
</Card>
|
|
315
|
+
</div>
|
|
316
|
+
),
|
|
317
|
+
},
|
|
318
|
+
'A static card — no `onClick` provided. No `role`, no `tabIndex`, no chevron icon. Use for displaying content that is not navigational.',
|
|
17
319
|
);
|
|
18
320
|
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
|
|
321
|
+
export const Interactive: Story = withDescription(
|
|
322
|
+
{
|
|
323
|
+
parameters: {
|
|
324
|
+
controls: { disable: true },
|
|
325
|
+
docs: {
|
|
326
|
+
source: {
|
|
327
|
+
language: 'tsx',
|
|
328
|
+
code: `
|
|
329
|
+
import { Card } from '@arbor-education/design-system.components';
|
|
330
|
+
|
|
331
|
+
function InteractiveCardExample() {
|
|
332
|
+
return (
|
|
333
|
+
<Card
|
|
334
|
+
onClick={() => console.log('card clicked')}
|
|
335
|
+
aria-label="View attendance summary"
|
|
336
|
+
style={{ maxWidth: '400px' }}
|
|
337
|
+
>
|
|
338
|
+
<p>Attendance summary</p>
|
|
339
|
+
<p>View the latest attendance and behaviour insights for this cohort.</p>
|
|
340
|
+
</Card>
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export default InteractiveCardExample;
|
|
345
|
+
`.trim(),
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
render: () => (
|
|
350
|
+
<div style={{ maxWidth: '400px' }}>
|
|
351
|
+
<Card
|
|
352
|
+
onClick={fn()}
|
|
353
|
+
aria-label="View attendance summary"
|
|
354
|
+
>
|
|
355
|
+
<SampleContent />
|
|
356
|
+
</Card>
|
|
357
|
+
</div>
|
|
358
|
+
),
|
|
22
359
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
360
|
+
'An interactive card with `onClick`. The card receives `role="button"` and `tabIndex={0}`. A `chevron-right` icon appears on the right; it swaps to `arrow-right` on hover. Keyboard: Enter or Space triggers the click.',
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
export const Disabled: Story = withDescription(
|
|
364
|
+
{
|
|
365
|
+
parameters: {
|
|
366
|
+
controls: { disable: true },
|
|
367
|
+
docs: {
|
|
368
|
+
source: {
|
|
369
|
+
language: 'tsx',
|
|
370
|
+
code: `
|
|
371
|
+
import { Card } from '@arbor-education/design-system.components';
|
|
372
|
+
|
|
373
|
+
function DisabledCardExample() {
|
|
374
|
+
return (
|
|
375
|
+
<Card
|
|
376
|
+
onClick={() => console.log('never fires')}
|
|
377
|
+
aria-label="View attendance summary"
|
|
378
|
+
disabled
|
|
379
|
+
style={{ maxWidth: '400px' }}
|
|
380
|
+
>
|
|
381
|
+
<p>Attendance summary</p>
|
|
382
|
+
<p>This card is temporarily unavailable.</p>
|
|
26
383
|
</Card>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export default DisabledCardExample;
|
|
388
|
+
`.trim(),
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
render: () => (
|
|
393
|
+
<div style={{ maxWidth: '400px' }}>
|
|
394
|
+
<Card
|
|
395
|
+
onClick={fn()}
|
|
396
|
+
aria-label="View attendance summary"
|
|
397
|
+
disabled
|
|
398
|
+
>
|
|
399
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xsmall)' }}>
|
|
400
|
+
<p className="ds-text ds-text--heading-small" style={{ margin: 0 }}>Attendance summary</p>
|
|
401
|
+
<p className="ds-text" style={{ margin: 0, color: 'var(--color-grey-600)' }}>
|
|
402
|
+
This card is temporarily unavailable.
|
|
403
|
+
</p>
|
|
404
|
+
</div>
|
|
405
|
+
</Card>
|
|
406
|
+
</div>
|
|
407
|
+
),
|
|
408
|
+
},
|
|
409
|
+
'`disabled` on an interactive card — `aria-disabled={true}` is set and click/keyboard handling is suppressed. `onClick` is still required to activate the disabled visual state. The card remains in the tab order.',
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
export const Dense: Story = withDescription(
|
|
413
|
+
{
|
|
414
|
+
parameters: {
|
|
415
|
+
controls: { disable: true },
|
|
416
|
+
docs: {
|
|
417
|
+
source: {
|
|
418
|
+
language: 'tsx',
|
|
419
|
+
code: `
|
|
420
|
+
import { Card } from '@arbor-education/design-system.components';
|
|
421
|
+
|
|
422
|
+
function DenseCardExample() {
|
|
423
|
+
return (
|
|
424
|
+
<Card
|
|
425
|
+
spacing="dense"
|
|
426
|
+
aria-label="Pupil count"
|
|
427
|
+
style={{ maxWidth: '280px' }}
|
|
428
|
+
>
|
|
429
|
+
<p>Total pupils</p>
|
|
430
|
+
<p>247</p>
|
|
39
431
|
</Card>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
432
|
+
);
|
|
433
|
+
}
|
|
42
434
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
435
|
+
export default DenseCardExample;
|
|
436
|
+
`.trim(),
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
render: () => (
|
|
441
|
+
<div style={{ maxWidth: '280px' }}>
|
|
442
|
+
<Card spacing="dense" aria-label="Pupil count">
|
|
443
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--spacing-xsmall)' }}>
|
|
444
|
+
<p className="ds-text" style={{ margin: 0, color: 'var(--color-grey-600)' }}>Total pupils</p>
|
|
445
|
+
<p className="ds-text ds-text--heading-large" style={{ margin: 0 }}>247</p>
|
|
446
|
+
</div>
|
|
447
|
+
</Card>
|
|
448
|
+
</div>
|
|
449
|
+
),
|
|
47
450
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
451
|
+
'`spacing="dense"` replaces the default padding with `--spacing-small`. Use for compact KPI tiles or data-dense layouts where the default padding feels too spacious.',
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
export const WithAriaLabelledBy: Story = withDescription(
|
|
455
|
+
{
|
|
456
|
+
parameters: {
|
|
457
|
+
controls: { disable: true },
|
|
458
|
+
docs: {
|
|
459
|
+
source: {
|
|
460
|
+
language: 'tsx',
|
|
461
|
+
code: `
|
|
462
|
+
import { Card } from '@arbor-education/design-system.components';
|
|
463
|
+
|
|
464
|
+
function WithAriaLabelledByExample() {
|
|
465
|
+
return (
|
|
466
|
+
<Card
|
|
467
|
+
onClick={() => console.log('card clicked')}
|
|
468
|
+
aria-labelledby="card-heading"
|
|
469
|
+
style={{ maxWidth: '400px' }}
|
|
470
|
+
>
|
|
471
|
+
<p id="card-heading">Pupil progress report</p>
|
|
472
|
+
<p>Summer term 2024 — 8 pupils flagged for review.</p>
|
|
51
473
|
</Card>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
474
|
+
);
|
|
475
|
+
}
|
|
54
476
|
|
|
55
|
-
export default
|
|
477
|
+
export default WithAriaLabelledByExample;
|
|
478
|
+
`.trim(),
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
render: WithAriaLabelledByTemplate,
|
|
483
|
+
},
|
|
484
|
+
'Using `aria-labelledby` instead of `aria-label` — the card\'s accessible name is derived from the heading already visible in the content. Prefer this pattern when the card has a heading, to avoid repeating the same text in both `aria-label` and the heading.',
|
|
485
|
+
);
|