@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,93 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Getting Started/Using the Components" />
|
|
4
|
+
|
|
5
|
+
# Using the Components
|
|
6
|
+
|
|
7
|
+
← [Back to Welcome](/?path=/docs/getting-started-welcome--docs)
|
|
8
|
+
|
|
9
|
+
This guide covers how to get Arbor Design System components into your project. If you're looking to contribute to the design system itself, head over to [Contributing](/?path=/docs/getting-started-contributing--docs).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Already using `arbor-fe-library`?
|
|
14
|
+
|
|
15
|
+
The package and stylesheet are already installed and configured in `arbor-fe-library` — you can skip straight to [importing components](#using-the-components) below.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installing the package
|
|
20
|
+
|
|
21
|
+
The design system is published as a public NPM package. Add it to your project with:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @arbor-education/design-system.components
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or with npm:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @arbor-education/design-system.components
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Importing the stylesheet
|
|
36
|
+
|
|
37
|
+
Once the package is installed, import the base component styles once at the root of your app. The stylesheet lives at:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
@arbor-education/design-system.components/dist/index.css
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**In a Sass file** (recommended — this is how `arbor-fe-library` does it):
|
|
44
|
+
|
|
45
|
+
```scss
|
|
46
|
+
@import '@arbor-education/design-system.components/dist/index.css';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**In a TypeScript/JavaScript entry point:**
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import '@arbor-education/design-system.components/dist/index.css';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Without this stylesheet, components will render without their styles — so don't skip this step!
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Using the components
|
|
60
|
+
|
|
61
|
+
All components are exported as named exports from the package. Browse the sidebar to find the component you need, then import it by name:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button } from '@arbor-education/design-system.components';
|
|
65
|
+
|
|
66
|
+
function SaveButton() {
|
|
67
|
+
return <Button variant="primary">Save changes</Button>;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Every component page in this Storybook has:
|
|
72
|
+
|
|
73
|
+
- A **live interactive preview** — tweak props with the Controls panel and see changes in real time
|
|
74
|
+
- **Full prop documentation** — every prop, its type, and its default
|
|
75
|
+
- **Usage examples** — real-world scenarios with copy-pasteable code
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Finding the right component
|
|
80
|
+
|
|
81
|
+
Not sure which component to reach for? A few tips:
|
|
82
|
+
|
|
83
|
+
- Browse the sidebar — components are listed alphabetically under **Components**, with complex ones (Table, FormField, Modals) having nested sub-sections
|
|
84
|
+
- Check the **When to use** and **When not to use** sections on each component's Docs page — they'll point you in the right direction
|
|
85
|
+
- If nothing fits, drop a message in [#frontend-support](https://arbor-education.slack.com/archives/C08AZT15KH7) first — the team can point you in the right direction or help scope a new component
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Useful links
|
|
90
|
+
|
|
91
|
+
- [NPM package](https://www.npmjs.com/package/@arbor-education/design-system.components)
|
|
92
|
+
- [GitHub repository](https://github.com/arbor-education/design-system.components)
|
|
93
|
+
- [Confluence consuming guide](https://orchard.atlassian.net/wiki/spaces/SATD/pages/2500591662/Consuming+the+design+system+NPM+package)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Getting Started/Welcome" />
|
|
4
|
+
|
|
5
|
+
# Welcome to the Arbor Design System
|
|
6
|
+
|
|
7
|
+
The Arbor Design System is a shared component library that helps teams across Arbor ship consistent, accessible, and well-crafted UI — without reinventing the wheel every time. Whether you're here to use components in a product, contribute new ones, or just explore what's available, you're in the right place.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What is the design system?
|
|
12
|
+
|
|
13
|
+
The design system is the single source of truth for Arbor's UI. It brings together:
|
|
14
|
+
|
|
15
|
+
- **Components** — reusable React components with consistent styling, behaviour, and accessibility baked in
|
|
16
|
+
- **Design tokens** — a shared set of colours, spacing, and typography values that keep everything visually cohesive
|
|
17
|
+
- **Documentation** — guidance on when and how to use each component (that's this Storybook!)
|
|
18
|
+
- **Figma** — the design counterpart, where designers and PMs work
|
|
19
|
+
|
|
20
|
+
Rather than every team solving the same UI problems from scratch, the design system gives everyone a shared foundation to build on. Developers can focus on product logic; designers can focus on user experience and flows.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Our philosophy
|
|
25
|
+
|
|
26
|
+
Arbor's design system components are intentionally **simple and flexible**. A few principles guide everything:
|
|
27
|
+
|
|
28
|
+
- **Dumb components** — components have no business logic and no opinion about your data. They render what you give them, nothing more.
|
|
29
|
+
- **Brand agnostic** — components are built around structure and behaviour, not Arbor-specific product context. They could work in any product.
|
|
30
|
+
- **Delegate to the consumer (DTC)** — rather than dictating how a component should be used, we aim to empower consumers to bend components to their own needs. If you need custom behaviour, you should be able to get there without fighting the component.
|
|
31
|
+
- **Thin wrappers over great tools** — where a best-in-class library already solves a problem well, we wrap it rather than reinvent it. The Table component is a good example: it's a thin layer over AG Grid, giving you all of AG Grid's power with Arbor's defaults applied on top. Consumers always have access to the full API of whatever we're wrapping — we never get in the way.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## What is Storybook?
|
|
36
|
+
|
|
37
|
+
Storybook is a tool for browsing, interacting with, and learning about UI components in isolation — completely outside of any real product page. Think of it as a living catalogue for the design system.
|
|
38
|
+
|
|
39
|
+
Here's how to get the most out of it:
|
|
40
|
+
|
|
41
|
+
- **Browse components** using the sidebar on the left, organised by category
|
|
42
|
+
- **Interact with props** via the Controls panel at the bottom of the screen — change a value and watch the component update live
|
|
43
|
+
- **Read the docs** on each component's Docs page — you'll find when to use it, when *not* to use it, accessibility notes, and the full prop API
|
|
44
|
+
- **Copy code snippets** from any story — every example shows production-ready import and usage code, ready to paste
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Where to go next
|
|
49
|
+
|
|
50
|
+
<table>
|
|
51
|
+
<thead>
|
|
52
|
+
<tr><th>I want to...</th><th>Go here</th></tr>
|
|
53
|
+
</thead>
|
|
54
|
+
<tbody>
|
|
55
|
+
<tr><td>Use Arbor components in a project</td><td><a href="/?path=/docs/getting-started-using-the-components--docs">Using the Components</a></td></tr>
|
|
56
|
+
<tr><td>Work on the design system itself</td><td><a href="/?path=/docs/getting-started-contributing--docs">Contributing</a></td></tr>
|
|
57
|
+
<tr><td>Browse all components</td><td>Use the sidebar on the left</td></tr>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Useful links
|
|
64
|
+
|
|
65
|
+
- [NPM package](https://www.npmjs.com/package/@arbor-education/design-system.components) — `@arbor-education/design-system.components`
|
|
66
|
+
- [GitHub repository](https://github.com/arbor-education/design-system.components)
|
|
67
|
+
- [Figma design system](https://www.figma.com/file/2GNa44f89PatHEF49n5DaO/Arbor-DSM?node-id=1%3A2)
|
|
68
|
+
- [Confluence docs](https://orchard.atlassian.net/wiki/spaces/SATD/pages/2500591662/Consuming+the+design+system+NPM+package)
|
package/src/global.scss
CHANGED
|
@@ -34,3 +34,10 @@
|
|
|
34
34
|
font-weight: var(--font-weight-regular);
|
|
35
35
|
box-sizing: border-box;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
// The wrapper covers the viewport so ag grid's outside-click detection sees
|
|
39
|
+
// it as the click target instead of <html> (whose null parentElement trips
|
|
40
|
+
// ag grid's isElementWithinCustomPopup check). Only intercept clicks while a
|
|
41
|
+
// popup is actually mounted; otherwise let clicks pass through.
|
|
42
|
+
#ds-popup-parent { pointer-events: auto; }
|
|
43
|
+
#ds-popup-parent:empty { pointer-events: none; }
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
import {
|
|
4
|
+
Heading as DocHeading,
|
|
5
|
+
Markdown,
|
|
6
|
+
Stories,
|
|
7
|
+
Subtitle,
|
|
8
|
+
Title,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
import { PopupParentContext } from 'Utils/PopupParentContext';
|
|
11
|
+
import { Button } from 'Components/button/Button';
|
|
12
|
+
import { Dropdown } from 'Components/dropdown/Dropdown';
|
|
13
|
+
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Docs page content
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
const DESCRIPTION_INTRO = [
|
|
19
|
+
'`PopupParentContext` is a React context that controls where portalled floating elements',
|
|
20
|
+
'— dropdowns, tooltips, date pickers, comboboxes — are rendered in the DOM.',
|
|
21
|
+
'In most applications you do **not** need to configure this: the default behaviour portals all floating',
|
|
22
|
+
'content to a shared `<div id="ds-popup-parent">` appended to `document.body`.',
|
|
23
|
+
].join(' ');
|
|
24
|
+
|
|
25
|
+
const USAGE_GUIDANCE = [
|
|
26
|
+
'### When you need PopupParentContext',
|
|
27
|
+
'',
|
|
28
|
+
'- **Custom virtualised panels** — when your layout clips content with `overflow: hidden` AND you need',
|
|
29
|
+
' popups to appear inside that container (not body), provide a ref to a container element inside the',
|
|
30
|
+
' clip boundary',
|
|
31
|
+
'- **Non-Arbor modals and drawers** — if you wrap Arbor components inside a third-party modal, floating',
|
|
32
|
+
' elements may render beneath the modal overlay due to z-index stacking. Provide a container inside the',
|
|
33
|
+
' modal to keep popups on top',
|
|
34
|
+
'- **Custom stacking contexts** — when `transform`, `isolation`, or `will-change` creates a stacking',
|
|
35
|
+
' context above `z-index: 1` (the default popup parent z-index), popups may appear beneath fixed UI',
|
|
36
|
+
' chrome. Move the container inside the stacking context',
|
|
37
|
+
'',
|
|
38
|
+
'---',
|
|
39
|
+
'',
|
|
40
|
+
'### When you do NOT need PopupParentContext',
|
|
41
|
+
'',
|
|
42
|
+
'| Situation | Why you are safe |',
|
|
43
|
+
'|---|---|',
|
|
44
|
+
'| `Dropdown`, `Tooltip`, `Combobox` in a standard page layout | Default context portals to `document.body` — no clipping |',
|
|
45
|
+
'| Floating elements inside Arbor `Modal` | Modal provides its overlay as the popup parent automatically |',
|
|
46
|
+
'| `Table` column filters | `BooleanFilter` and `TimeFilter` wrap their children in a provider automatically |',
|
|
47
|
+
].join('\n');
|
|
48
|
+
|
|
49
|
+
const DEVELOPER_NOTES = [
|
|
50
|
+
'### Components that consume PopupParentContext',
|
|
51
|
+
'',
|
|
52
|
+
'| Component | What gets portalled |',
|
|
53
|
+
'|---|---|',
|
|
54
|
+
'| `Dropdown` | `Dropdown.Content` panel |',
|
|
55
|
+
'| `Tooltip` | Tooltip bubble |',
|
|
56
|
+
'| `Combobox` | Options listbox |',
|
|
57
|
+
'| `DatePicker` | Calendar popup |',
|
|
58
|
+
'| `DateTimePicker` | Calendar + time popup |',
|
|
59
|
+
'| `Modal` | Modal overlay (also provides itself as parent for any floating elements inside) |',
|
|
60
|
+
'| `SlideoverManager` | Slideover panel |',
|
|
61
|
+
'| `Table` column filters | `BooleanFilter`, `TimeFilter` (wraps automatically) |',
|
|
62
|
+
'',
|
|
63
|
+
'---',
|
|
64
|
+
'',
|
|
65
|
+
'### Usage',
|
|
66
|
+
'',
|
|
67
|
+
'```tsx',
|
|
68
|
+
'import { useRef } from \'react\';',
|
|
69
|
+
'import { PopupParentContext, Dropdown } from \'@arbor-education/design-system.components\';',
|
|
70
|
+
'',
|
|
71
|
+
'function ClippedPanel() {',
|
|
72
|
+
' // ref points to the container that should receive portalled content',
|
|
73
|
+
' const popupContainerRef = useRef<HTMLDivElement>(null);',
|
|
74
|
+
'',
|
|
75
|
+
' return (',
|
|
76
|
+
' <div style={{ position: \'relative\', overflow: \'hidden\', maxHeight: 300 }}>',
|
|
77
|
+
' {/*',
|
|
78
|
+
' This div sits OUTSIDE the overflow:hidden clip boundary.',
|
|
79
|
+
' Floating elements portal here instead of document.body.',
|
|
80
|
+
' */}',
|
|
81
|
+
' <div ref={popupContainerRef} style={{ position: \'fixed\', zIndex: 100 }} />',
|
|
82
|
+
'',
|
|
83
|
+
' <PopupParentContext.Provider value={popupContainerRef}>',
|
|
84
|
+
' <Dropdown>',
|
|
85
|
+
' <Dropdown.Trigger>',
|
|
86
|
+
' <Button variant="dropdown">Actions</Button>',
|
|
87
|
+
' </Dropdown.Trigger>',
|
|
88
|
+
' <Dropdown.Content>',
|
|
89
|
+
' <Dropdown.Item>Edit record</Dropdown.Item>',
|
|
90
|
+
' <Dropdown.Item>Delete record</Dropdown.Item>',
|
|
91
|
+
' </Dropdown.Content>',
|
|
92
|
+
' </Dropdown>',
|
|
93
|
+
' </PopupParentContext.Provider>',
|
|
94
|
+
' </div>',
|
|
95
|
+
' );',
|
|
96
|
+
'}',
|
|
97
|
+
'```',
|
|
98
|
+
'',
|
|
99
|
+
'---',
|
|
100
|
+
'',
|
|
101
|
+
'### Default behaviour',
|
|
102
|
+
'',
|
|
103
|
+
'When no provider wraps your component tree, `PopupParentContext` falls back to a ref pointing to',
|
|
104
|
+
'`div#ds-popup-parent`. This element is created once and appended to `document.body` with',
|
|
105
|
+
'`position: fixed; z-index: 1`. All floating elements on the page share it.',
|
|
106
|
+
'',
|
|
107
|
+
'You can pre-create this element for SSR environments:',
|
|
108
|
+
'```html',
|
|
109
|
+
'<div id="ds-popup-parent" style="position: fixed; z-index: 1;"></div>',
|
|
110
|
+
'```',
|
|
111
|
+
'',
|
|
112
|
+
'---',
|
|
113
|
+
'',
|
|
114
|
+
'### Accessibility',
|
|
115
|
+
'',
|
|
116
|
+
'- Portalling to `document.body` or a fixed container does not break focus management — Radix UI',
|
|
117
|
+
' and the DS components handle focus trapping and restoration internally',
|
|
118
|
+
'- Ensure the portal container has no `aria-hidden` ancestor — this would hide portalled content from',
|
|
119
|
+
' assistive technology even if it is visible on screen',
|
|
120
|
+
].join('\n');
|
|
121
|
+
|
|
122
|
+
const RELATED_COMPONENTS = [
|
|
123
|
+
'## Related components',
|
|
124
|
+
'',
|
|
125
|
+
'[Dropdown](?path=/docs/components-dropdown--docs) · [Tooltip](?path=/docs/components-tooltip--docs) · [Combobox](?path=/docs/components-combobox--docs) · [DatePicker](?path=/docs/components-datepicker--docs) · [Modal](?path=/docs/components-modal--docs)',
|
|
126
|
+
].join('\n');
|
|
127
|
+
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// Docs page
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
function PopupParentContextDocsPage() {
|
|
133
|
+
return (
|
|
134
|
+
<>
|
|
135
|
+
<Title />
|
|
136
|
+
<Subtitle />
|
|
137
|
+
<Markdown>{DESCRIPTION_INTRO}</Markdown>
|
|
138
|
+
<DocHeading>Usage guidance</DocHeading>
|
|
139
|
+
<Markdown>{USAGE_GUIDANCE}</Markdown>
|
|
140
|
+
<DocHeading>Developer notes</DocHeading>
|
|
141
|
+
<Markdown>{DEVELOPER_NOTES}</Markdown>
|
|
142
|
+
<DocHeading>Examples</DocHeading>
|
|
143
|
+
<Stories title="" />
|
|
144
|
+
<Markdown>{RELATED_COMPONENTS}</Markdown>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Meta
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
|
|
153
|
+
const meta = {
|
|
154
|
+
title: 'Utils/PopupParentContext',
|
|
155
|
+
parameters: {
|
|
156
|
+
layout: 'padded',
|
|
157
|
+
docs: {
|
|
158
|
+
page: PopupParentContextDocsPage,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
tags: ['autodocs'],
|
|
162
|
+
} satisfies Meta;
|
|
163
|
+
|
|
164
|
+
export default meta;
|
|
165
|
+
type Story = StoryObj;
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// Helper
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
const withDescription = (story: Story, description: string): Story => ({
|
|
172
|
+
...story,
|
|
173
|
+
parameters: {
|
|
174
|
+
...story.parameters,
|
|
175
|
+
docs: {
|
|
176
|
+
...story.parameters?.docs,
|
|
177
|
+
description: {
|
|
178
|
+
story: description,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
// Templates
|
|
186
|
+
// ---------------------------------------------------------------------------
|
|
187
|
+
|
|
188
|
+
const DefaultTemplate = () => (
|
|
189
|
+
<div
|
|
190
|
+
style={{
|
|
191
|
+
border: 'var(--border-weight) solid var(--color-grey-200)',
|
|
192
|
+
borderRadius: 'var(--border-radius-small)',
|
|
193
|
+
padding: 'var(--spacing-medium)',
|
|
194
|
+
overflow: 'hidden',
|
|
195
|
+
maxHeight: '120px',
|
|
196
|
+
display: 'flex',
|
|
197
|
+
flexDirection: 'column',
|
|
198
|
+
gap: 'var(--spacing-small)',
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
<p style={{ margin: 0, fontSize: 'var(--font-size-2-13)', color: 'var(--color-grey-700)' }}>
|
|
202
|
+
This panel has
|
|
203
|
+
{' '}
|
|
204
|
+
<code>overflow: hidden</code>
|
|
205
|
+
{' '}
|
|
206
|
+
— yet the dropdown opens correctly.
|
|
207
|
+
</p>
|
|
208
|
+
<Dropdown>
|
|
209
|
+
<Dropdown.Trigger>
|
|
210
|
+
<Button variant="dropdown">Actions</Button>
|
|
211
|
+
</Dropdown.Trigger>
|
|
212
|
+
<Dropdown.Content>
|
|
213
|
+
<Dropdown.Item>View pupil profile</Dropdown.Item>
|
|
214
|
+
<Dropdown.Item>Edit enrolment</Dropdown.Item>
|
|
215
|
+
<Dropdown.Separator />
|
|
216
|
+
<Dropdown.Item>Remove from group</Dropdown.Item>
|
|
217
|
+
</Dropdown.Content>
|
|
218
|
+
</Dropdown>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const WithCustomContainerTemplate = () => {
|
|
223
|
+
const popupContainerRef = useRef<HTMLDivElement>(null);
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<div style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 'var(--spacing-small)' }}>
|
|
227
|
+
<p style={{ margin: 0, fontSize: 'var(--font-size-2-13)', color: 'var(--color-grey-700)' }}>
|
|
228
|
+
The dropdown portals into
|
|
229
|
+
{' '}
|
|
230
|
+
<code>popupContainerRef</code>
|
|
231
|
+
{' '}
|
|
232
|
+
(the pink border below) instead of
|
|
233
|
+
{' '}
|
|
234
|
+
<code>document.body</code>
|
|
235
|
+
.
|
|
236
|
+
</p>
|
|
237
|
+
|
|
238
|
+
{/* This element receives portalled content */}
|
|
239
|
+
<div
|
|
240
|
+
ref={popupContainerRef}
|
|
241
|
+
style={{
|
|
242
|
+
position: 'relative',
|
|
243
|
+
zIndex: 10,
|
|
244
|
+
border: '2px dashed var(--color-semantic-destructive-300)',
|
|
245
|
+
borderRadius: 'var(--border-radius-small)',
|
|
246
|
+
padding: 'var(--spacing-xsmall)',
|
|
247
|
+
minHeight: '2rem',
|
|
248
|
+
}}
|
|
249
|
+
aria-label="Custom popup container"
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
<PopupParentContext.Provider value={popupContainerRef}>
|
|
253
|
+
<Dropdown>
|
|
254
|
+
<Dropdown.Trigger>
|
|
255
|
+
<Button variant="dropdown">Actions</Button>
|
|
256
|
+
</Dropdown.Trigger>
|
|
257
|
+
<Dropdown.Content>
|
|
258
|
+
<Dropdown.Item>View pupil profile</Dropdown.Item>
|
|
259
|
+
<Dropdown.Item>Edit enrolment</Dropdown.Item>
|
|
260
|
+
<Dropdown.Separator />
|
|
261
|
+
<Dropdown.Item>Remove from group</Dropdown.Item>
|
|
262
|
+
</Dropdown.Content>
|
|
263
|
+
</Dropdown>
|
|
264
|
+
</PopupParentContext.Provider>
|
|
265
|
+
</div>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// ---------------------------------------------------------------------------
|
|
270
|
+
// Stories
|
|
271
|
+
// ---------------------------------------------------------------------------
|
|
272
|
+
|
|
273
|
+
export const Default: Story = withDescription(
|
|
274
|
+
{
|
|
275
|
+
render: DefaultTemplate,
|
|
276
|
+
parameters: {
|
|
277
|
+
controls: { disable: true },
|
|
278
|
+
docs: {
|
|
279
|
+
source: {
|
|
280
|
+
language: 'tsx',
|
|
281
|
+
code: `
|
|
282
|
+
import { Dropdown, Button } from '@arbor-education/design-system.components';
|
|
283
|
+
|
|
284
|
+
// No PopupParentContext setup needed — the dropdown portals to document.body automatically.
|
|
285
|
+
function PupilActionsDropdown() {
|
|
286
|
+
return (
|
|
287
|
+
<Dropdown>
|
|
288
|
+
<Dropdown.Trigger>
|
|
289
|
+
<Button variant="dropdown">Actions</Button>
|
|
290
|
+
</Dropdown.Trigger>
|
|
291
|
+
<Dropdown.Content>
|
|
292
|
+
<Dropdown.Item>View pupil profile</Dropdown.Item>
|
|
293
|
+
<Dropdown.Item>Edit enrolment</Dropdown.Item>
|
|
294
|
+
<Dropdown.Separator />
|
|
295
|
+
<Dropdown.Item>Remove from group</Dropdown.Item>
|
|
296
|
+
</Dropdown.Content>
|
|
297
|
+
</Dropdown>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
export default PupilActionsDropdown;
|
|
301
|
+
`.trim(),
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
[
|
|
307
|
+
'The default behaviour — no `PopupParentContext` setup required.',
|
|
308
|
+
'The dropdown portals its content to `div#ds-popup-parent` in `document.body` via the context default.',
|
|
309
|
+
'Even inside an `overflow: hidden` container, the popup appears correctly because it exits the clip',
|
|
310
|
+
'boundary by rendering in the body.',
|
|
311
|
+
].join(' '),
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
export const WithCustomContainer: Story = withDescription(
|
|
315
|
+
{
|
|
316
|
+
render: WithCustomContainerTemplate,
|
|
317
|
+
parameters: {
|
|
318
|
+
controls: { disable: true },
|
|
319
|
+
docs: {
|
|
320
|
+
source: {
|
|
321
|
+
language: 'tsx',
|
|
322
|
+
code: `
|
|
323
|
+
import { useRef } from 'react';
|
|
324
|
+
import { PopupParentContext, Dropdown, Button } from '@arbor-education/design-system.components';
|
|
325
|
+
|
|
326
|
+
function ClippedPanel() {
|
|
327
|
+
const popupContainerRef = useRef<HTMLDivElement>(null);
|
|
328
|
+
|
|
329
|
+
return (
|
|
330
|
+
<div style={{ position: 'relative' }}>
|
|
331
|
+
{/*
|
|
332
|
+
This container receives portalled popups.
|
|
333
|
+
Place it outside any overflow:hidden ancestor,
|
|
334
|
+
with a z-index high enough to appear above surrounding content.
|
|
335
|
+
*/}
|
|
336
|
+
<div ref={popupContainerRef} style={{ position: 'fixed', zIndex: 100 }} />
|
|
337
|
+
|
|
338
|
+
<PopupParentContext.Provider value={popupContainerRef}>
|
|
339
|
+
<Dropdown>
|
|
340
|
+
<Dropdown.Trigger>
|
|
341
|
+
<Button variant="dropdown">Actions</Button>
|
|
342
|
+
</Dropdown.Trigger>
|
|
343
|
+
<Dropdown.Content>
|
|
344
|
+
<Dropdown.Item>View pupil profile</Dropdown.Item>
|
|
345
|
+
<Dropdown.Item>Edit enrolment</Dropdown.Item>
|
|
346
|
+
<Dropdown.Separator />
|
|
347
|
+
<Dropdown.Item>Remove from group</Dropdown.Item>
|
|
348
|
+
</Dropdown.Content>
|
|
349
|
+
</Dropdown>
|
|
350
|
+
</PopupParentContext.Provider>
|
|
351
|
+
</div>
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
export default ClippedPanel;
|
|
355
|
+
`.trim(),
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
[
|
|
361
|
+
'Override the popup container with `PopupParentContext.Provider`. The `value` prop accepts a',
|
|
362
|
+
'`RefObject<HTMLElement | null>` pointing to the element that should receive portalled content.',
|
|
363
|
+
'Open the dropdown to see it appear inside the dashed container (highlighted in pink) instead of',
|
|
364
|
+
'`document.body`. In production you would omit the visual indicator and size/position the container',
|
|
365
|
+
'as needed for your layout.',
|
|
366
|
+
].join(' '),
|
|
367
|
+
);
|
|
@@ -8,6 +8,12 @@ export const getDefaultPopupParent = () => {
|
|
|
8
8
|
newContainer.id = 'ds-popup-parent';
|
|
9
9
|
newContainer.style.zIndex = '1';
|
|
10
10
|
newContainer.style.position = 'fixed';
|
|
11
|
+
// ag grid has clamping behaviour for floating elements - it clamps the area
|
|
12
|
+
// to whichever has the largest boundingRect between its own main container
|
|
13
|
+
// and whatever is passed to the popupParent prop. without this inset here
|
|
14
|
+
// the container ends up with a height and width of zero so they get clamped
|
|
15
|
+
// to the ag container instead of the viewport (most heinous).
|
|
16
|
+
newContainer.style.inset = '0';
|
|
11
17
|
document.body.appendChild(newContainer);
|
|
12
18
|
|
|
13
19
|
return newContainer as HTMLElement;
|