@deriv-com/dds-marketing 0.1.0 → 0.2.0
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/.llm/components/accordion.md +193 -0
- package/.llm/components/accordionitem.md +236 -0
- package/.llm/components/aspectratio.md +212 -0
- package/.llm/components/badge.md +231 -0
- package/.llm/components/bottomsheet.md +404 -0
- package/.llm/components/breadcrumb.md +197 -0
- package/.llm/components/breadcrumbitem.md +178 -0
- package/.llm/components/button.md +271 -0
- package/.llm/components/buttonicon.md +313 -0
- package/.llm/components/card.md +313 -0
- package/.llm/components/cardbody.md +409 -0
- package/.llm/components/cardbutton.md +259 -0
- package/.llm/components/checkbox.md +285 -0
- package/.llm/components/divider.md +230 -0
- package/.llm/components/dropdownmenu.md +453 -0
- package/.llm/components/filterchip.md +314 -0
- package/.llm/components/footer.md +408 -0
- package/.llm/components/footergroup.md +241 -0
- package/.llm/components/grid.md +659 -0
- package/.llm/components/icon.md +194 -0
- package/.llm/components/link.md +354 -0
- package/.llm/components/menuitem.md +218 -0
- package/.llm/components/navbar.md +458 -0
- package/.llm/components/navbaritem.md +238 -0
- package/.llm/components/navbarmenu.md +319 -0
- package/.llm/components/navbarmenugroup.md +184 -0
- package/.llm/components/navbarpanel.md +255 -0
- package/.llm/components/navbarswitcher.md +343 -0
- package/.llm/components/navbarswitcheroption.md +156 -0
- package/.llm/components/option.md +268 -0
- package/.llm/components/pagination.md +361 -0
- package/.llm/components/removablechip.md +247 -0
- package/.llm/components/row.md +381 -0
- package/.llm/components/scroller.md +470 -0
- package/.llm/components/searchinput.md +279 -0
- package/.llm/components/segmentedcontrol.md +358 -0
- package/.llm/components/segmentedcontrolitem.md +272 -0
- package/.llm/components/select.md +509 -0
- package/.llm/components/selectchip.md +334 -0
- package/.llm/components/spinner.md +222 -0
- package/.llm/components/stack.md +334 -0
- package/.llm/components/statusdot.md +205 -0
- package/.llm/components/subdomainnavbar.md +327 -0
- package/.llm/components/tab.md +291 -0
- package/.llm/components/table.md +660 -0
- package/.llm/components/tablebody.md +258 -0
- package/.llm/components/tablecell.md +248 -0
- package/.llm/components/tablehead.md +248 -0
- package/.llm/components/tableheadercell.md +298 -0
- package/.llm/components/tablerow.md +285 -0
- package/.llm/components/tablist.md +210 -0
- package/.llm/components/textarea.md +362 -0
- package/.llm/components/textinput.md +467 -0
- package/.llm/components/tooltip.md +267 -0
- package/.llm/components/typography.md +245 -0
- package/.llm/digest/accordion.md +43 -0
- package/.llm/digest/accordionitem.md +47 -0
- package/.llm/digest/aspectratio.md +47 -0
- package/.llm/digest/badge.md +45 -0
- package/.llm/digest/bottomsheet.md +69 -0
- package/.llm/digest/breadcrumb.md +38 -0
- package/.llm/digest/breadcrumbitem.md +43 -0
- package/.llm/digest/button.md +48 -0
- package/.llm/digest/buttonicon.md +61 -0
- package/.llm/digest/card.md +50 -0
- package/.llm/digest/cardbody.md +68 -0
- package/.llm/digest/cardbutton.md +49 -0
- package/.llm/digest/checkbox.md +63 -0
- package/.llm/digest/divider.md +52 -0
- package/.llm/digest/dropdownmenu.md +67 -0
- package/.llm/digest/filterchip.md +68 -0
- package/.llm/digest/footer.md +57 -0
- package/.llm/digest/footergroup.md +42 -0
- package/.llm/digest/grid.md +62 -0
- package/.llm/digest/icon.md +45 -0
- package/.llm/digest/link.md +59 -0
- package/.llm/digest/menuitem.md +46 -0
- package/.llm/digest/navbar.md +60 -0
- package/.llm/digest/navbaritem.md +54 -0
- package/.llm/digest/navbarmenu.md +54 -0
- package/.llm/digest/navbarmenugroup.md +40 -0
- package/.llm/digest/navbarpanel.md +53 -0
- package/.llm/digest/navbarswitcher.md +51 -0
- package/.llm/digest/navbarswitcheroption.md +37 -0
- package/.llm/digest/option.md +54 -0
- package/.llm/digest/pagination.md +71 -0
- package/.llm/digest/removablechip.md +51 -0
- package/.llm/digest/row.md +60 -0
- package/.llm/digest/scroller.md +59 -0
- package/.llm/digest/searchinput.md +56 -0
- package/.llm/digest/segmentedcontrol.md +59 -0
- package/.llm/digest/segmentedcontrolitem.md +59 -0
- package/.llm/digest/select.md +92 -0
- package/.llm/digest/selectchip.md +68 -0
- package/.llm/digest/spinner.md +52 -0
- package/.llm/digest/stack.md +56 -0
- package/.llm/digest/statusdot.md +46 -0
- package/.llm/digest/subdomainnavbar.md +54 -0
- package/.llm/digest/tab.md +60 -0
- package/.llm/digest/table.md +71 -0
- package/.llm/digest/tablebody.md +49 -0
- package/.llm/digest/tablecell.md +55 -0
- package/.llm/digest/tablehead.md +50 -0
- package/.llm/digest/tableheadercell.md +65 -0
- package/.llm/digest/tablerow.md +56 -0
- package/.llm/digest/tablist.md +46 -0
- package/.llm/digest/textarea.md +78 -0
- package/.llm/digest/textinput.md +95 -0
- package/.llm/digest/tooltip.md +58 -0
- package/.llm/digest/typography.md +59 -0
- package/.llm/index.md +86 -0
- package/.llm/rules.md +122 -0
- package/.llm/tokens.md +341 -0
- package/AGENTS.md +164 -0
- package/LICENSE +21 -0
- package/README.md +63 -15
- package/dist/components/core/accordion/Accordion.css +10 -0
- package/dist/components/core/accordion/Accordion.d.ts +20 -0
- package/dist/components/core/accordion/Accordion.js +69 -0
- package/dist/components/core/accordion/Accordion.types.d.ts +20 -0
- package/dist/components/core/accordion/Accordion.types.js +7 -0
- package/dist/components/core/accordion-item/AccordionItem.css +98 -0
- package/dist/components/core/accordion-item/AccordionItem.d.ts +44 -0
- package/dist/components/core/accordion-item/AccordionItem.js +63 -0
- package/dist/components/core/accordion-item/AccordionItem.types.d.ts +32 -0
- package/dist/components/core/accordion-item/AccordionItem.types.js +13 -0
- package/dist/components/core/accordion-item/accordion-item-impl.css +107 -0
- package/dist/components/core/badge/Badge.css +37 -0
- package/dist/components/core/badge/Badge.d.ts +37 -0
- package/dist/components/core/badge/Badge.js +40 -0
- package/dist/components/core/badge/Badge.types.d.ts +24 -0
- package/dist/components/core/badge/Badge.types.js +8 -0
- package/dist/components/core/badge/badge-impl.css +32 -0
- package/dist/components/core/bottom-sheet/BottomSheet.css +178 -0
- package/dist/components/core/bottom-sheet/BottomSheet.d.ts +22 -0
- package/dist/components/core/bottom-sheet/BottomSheet.js +359 -0
- package/dist/components/core/bottom-sheet/BottomSheet.types.d.ts +67 -0
- package/dist/components/core/bottom-sheet/BottomSheet.types.js +18 -0
- package/dist/components/core/bottom-sheet/bottom-sheet-impl.css +57 -0
- package/dist/components/core/breadcrumb/Breadcrumb.css +19 -0
- package/dist/components/core/breadcrumb/Breadcrumb.d.ts +16 -0
- package/dist/components/core/breadcrumb/Breadcrumb.js +22 -0
- package/dist/components/core/breadcrumb/Breadcrumb.types.d.ts +18 -0
- package/dist/components/core/breadcrumb/Breadcrumb.types.js +9 -0
- package/dist/components/core/breadcrumb-item/BreadcrumbItem.css +34 -0
- package/dist/components/core/breadcrumb-item/BreadcrumbItem.d.ts +12 -0
- package/dist/components/core/breadcrumb-item/BreadcrumbItem.js +15 -0
- package/dist/components/core/breadcrumb-item/BreadcrumbItem.types.d.ts +22 -0
- package/dist/components/core/breadcrumb-item/BreadcrumbItem.types.js +9 -0
- package/dist/components/core/button/Button.css +141 -0
- package/dist/components/core/button/Button.d.ts +25 -0
- package/dist/components/core/button/Button.js +28 -0
- package/dist/components/core/button/Button.types.d.ts +40 -0
- package/dist/components/core/button/Button.types.js +9 -0
- package/dist/components/core/button/button-impl.css +46 -0
- package/dist/components/core/button-icon/ButtonIcon.css +135 -0
- package/dist/components/core/button-icon/ButtonIcon.d.ts +34 -0
- package/dist/components/core/button-icon/ButtonIcon.js +117 -0
- package/dist/components/core/button-icon/ButtonIcon.types.d.ts +41 -0
- package/dist/components/core/button-icon/ButtonIcon.types.js +8 -0
- package/dist/components/core/card/Card.css +65 -0
- package/dist/components/core/card/Card.d.ts +24 -0
- package/dist/components/core/card/Card.js +26 -0
- package/dist/components/core/card/Card.types.d.ts +33 -0
- package/dist/components/core/card/Card.types.js +7 -0
- package/dist/components/core/card-body/CardBody.css +139 -0
- package/dist/components/core/card-body/CardBody.d.ts +62 -0
- package/dist/components/core/card-body/CardBody.js +97 -0
- package/dist/components/core/card-body/CardBody.types.d.ts +61 -0
- package/dist/components/core/card-body/CardBody.types.js +15 -0
- package/dist/components/core/card-body/card-body-impl.css +87 -0
- package/dist/components/core/card-button/CardButton.css +73 -0
- package/dist/components/core/card-button/CardButton.d.ts +27 -0
- package/dist/components/core/card-button/CardButton.js +37 -0
- package/dist/components/core/card-button/CardButton.types.d.ts +24 -0
- package/dist/components/core/card-button/CardButton.types.js +7 -0
- package/dist/components/core/card-button/card-button-impl.css +39 -0
- package/dist/components/core/checkbox/Checkbox.css +149 -0
- package/dist/components/core/checkbox/Checkbox.d.ts +21 -0
- package/dist/components/core/checkbox/Checkbox.js +97 -0
- package/dist/components/core/checkbox/Checkbox.types.d.ts +46 -0
- package/dist/components/core/checkbox/Checkbox.types.js +15 -0
- package/dist/components/core/checkbox/checkbox-impl.css +90 -0
- package/dist/components/core/divider/Divider.css +41 -0
- package/dist/components/core/divider/Divider.d.ts +46 -0
- package/dist/components/core/divider/Divider.js +51 -0
- package/dist/components/core/divider/Divider.types.d.ts +25 -0
- package/dist/components/core/divider/Divider.types.js +9 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.css +146 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.d.ts +22 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.js +309 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.types.d.ts +62 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.types.js +12 -0
- package/dist/components/core/dropdown-menu/dropdown-menu-impl.css +70 -0
- package/dist/components/core/filter-chip/FilterChip.css +149 -0
- package/dist/components/core/filter-chip/FilterChip.d.ts +23 -0
- package/dist/components/core/filter-chip/FilterChip.js +37 -0
- package/dist/components/core/filter-chip/FilterChip.types.d.ts +53 -0
- package/dist/components/core/filter-chip/FilterChip.types.js +12 -0
- package/dist/components/core/footer/Footer.css +104 -0
- package/dist/components/core/footer/Footer.d.ts +43 -0
- package/dist/components/core/footer/Footer.js +53 -0
- package/dist/components/core/footer/Footer.types.d.ts +47 -0
- package/dist/components/core/footer/Footer.types.js +18 -0
- package/dist/components/core/footer/footer-impl.css +218 -0
- package/dist/components/core/footer-group/FooterGroup.css +90 -0
- package/dist/components/core/footer-group/FooterGroup.d.ts +32 -0
- package/dist/components/core/footer-group/FooterGroup.js +64 -0
- package/dist/components/core/footer-group/FooterGroup.types.d.ts +25 -0
- package/dist/components/core/footer-group/FooterGroup.types.js +12 -0
- package/dist/components/core/footer-group/footer-group-impl.css +78 -0
- package/dist/components/core/icon/Icon.css +40 -0
- package/dist/components/core/icon/Icon.d.ts +23 -0
- package/dist/components/core/icon/Icon.js +79 -0
- package/dist/components/core/icon/Icon.types.d.ts +24 -0
- package/dist/components/core/icon/Icon.types.js +7 -0
- package/dist/components/core/link/Link.css +89 -0
- package/dist/components/core/link/Link.d.ts +37 -0
- package/dist/components/core/link/Link.js +141 -0
- package/dist/components/core/link/Link.types.d.ts +41 -0
- package/dist/components/core/link/Link.types.js +9 -0
- package/dist/components/core/link/link-impl.css +168 -0
- package/dist/components/core/menu-item/MenuItem.css +70 -0
- package/dist/components/core/menu-item/MenuItem.d.ts +11 -0
- package/dist/components/core/menu-item/MenuItem.js +26 -0
- package/dist/components/core/menu-item/MenuItem.types.d.ts +28 -0
- package/dist/components/core/menu-item/MenuItem.types.js +9 -0
- package/dist/components/core/navbar/Navbar.css +135 -0
- package/dist/components/core/navbar/Navbar.d.ts +36 -0
- package/dist/components/core/navbar/Navbar.js +371 -0
- package/dist/components/core/navbar/Navbar.types.d.ts +49 -0
- package/dist/components/core/navbar/Navbar.types.js +17 -0
- package/dist/components/core/navbar/navbar-impl.css +590 -0
- package/dist/components/core/navbar-item/NavbarItem.css +75 -0
- package/dist/components/core/navbar-item/NavbarItem.d.ts +22 -0
- package/dist/components/core/navbar-item/NavbarItem.js +40 -0
- package/dist/components/core/navbar-item/NavbarItem.types.d.ts +34 -0
- package/dist/components/core/navbar-item/NavbarItem.types.js +10 -0
- package/dist/components/core/navbar-menu/NavbarMenu.css +128 -0
- package/dist/components/core/navbar-menu/NavbarMenu.d.ts +5 -0
- package/dist/components/core/navbar-menu/NavbarMenu.js +186 -0
- package/dist/components/core/navbar-menu/NavbarMenu.types.d.ts +45 -0
- package/dist/components/core/navbar-menu/NavbarMenu.types.js +12 -0
- package/dist/components/core/navbar-menu/navbar-menu-impl.css +186 -0
- package/dist/components/core/navbar-menu-group/NavbarMenuGroup.css +26 -0
- package/dist/components/core/navbar-menu-group/NavbarMenuGroup.d.ts +17 -0
- package/dist/components/core/navbar-menu-group/NavbarMenuGroup.js +22 -0
- package/dist/components/core/navbar-menu-group/NavbarMenuGroup.types.d.ts +14 -0
- package/dist/components/core/navbar-menu-group/NavbarMenuGroup.types.js +7 -0
- package/dist/components/core/navbar-panel/NavbarPanel.css +87 -0
- package/dist/components/core/navbar-panel/NavbarPanel.d.ts +34 -0
- package/dist/components/core/navbar-panel/NavbarPanel.js +46 -0
- package/dist/components/core/navbar-panel/NavbarPanel.types.d.ts +29 -0
- package/dist/components/core/navbar-panel/NavbarPanel.types.js +12 -0
- package/dist/components/core/navbar-panel/navbar-panel-impl.css +104 -0
- package/dist/components/core/navbar-panel/use-navbar-panel.d.ts +26 -0
- package/dist/components/core/navbar-panel/use-navbar-panel.js +135 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.css +117 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.d.ts +20 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.js +90 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.types.d.ts +46 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.types.js +13 -0
- package/dist/components/core/navbar-switcher/navbar-switcher-impl.css +179 -0
- package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.css +39 -0
- package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.d.ts +16 -0
- package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.js +19 -0
- package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.types.d.ts +18 -0
- package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.types.js +7 -0
- package/dist/components/core/option/Option.css +133 -0
- package/dist/components/core/option/Option.d.ts +25 -0
- package/dist/components/core/option/Option.js +31 -0
- package/dist/components/core/option/Option.types.d.ts +44 -0
- package/dist/components/core/option/Option.types.js +14 -0
- package/dist/components/core/pagination/Pagination.css +237 -0
- package/dist/components/core/pagination/Pagination.d.ts +30 -0
- package/dist/components/core/pagination/Pagination.js +406 -0
- package/dist/components/core/pagination/Pagination.types.d.ts +59 -0
- package/dist/components/core/pagination/Pagination.types.js +14 -0
- package/dist/components/core/pagination/pagination-impl.css +17 -0
- package/dist/components/core/removable-chip/RemovableChip.css +125 -0
- package/dist/components/core/removable-chip/RemovableChip.d.ts +25 -0
- package/dist/components/core/removable-chip/RemovableChip.js +36 -0
- package/dist/components/core/removable-chip/RemovableChip.types.d.ts +38 -0
- package/dist/components/core/removable-chip/RemovableChip.types.js +13 -0
- package/dist/components/core/search-input/SearchInput.css +205 -0
- package/dist/components/core/search-input/SearchInput.d.ts +5 -0
- package/dist/components/core/search-input/SearchInput.js +81 -0
- package/dist/components/core/search-input/SearchInput.types.d.ts +43 -0
- package/dist/components/core/search-input/SearchInput.types.js +13 -0
- package/dist/components/core/search-input/search-input-impl.css +20 -0
- package/dist/components/core/segmented-control/SegmentedControl.css +57 -0
- package/dist/components/core/segmented-control/SegmentedControl.d.ts +37 -0
- package/dist/components/core/segmented-control/SegmentedControl.js +269 -0
- package/dist/components/core/segmented-control/SegmentedControl.types.d.ts +38 -0
- package/dist/components/core/segmented-control/SegmentedControl.types.js +8 -0
- package/dist/components/core/segmented-control/segmented-control-impl.css +57 -0
- package/dist/components/core/segmented-control-item/SegmentedControlItem.css +151 -0
- package/dist/components/core/segmented-control-item/SegmentedControlItem.d.ts +50 -0
- package/dist/components/core/segmented-control-item/SegmentedControlItem.js +101 -0
- package/dist/components/core/segmented-control-item/SegmentedControlItem.types.d.ts +37 -0
- package/dist/components/core/segmented-control-item/SegmentedControlItem.types.js +10 -0
- package/dist/components/core/segmented-control-item/segmented-control-item-impl.css +69 -0
- package/dist/components/core/select/Select.css +400 -0
- package/dist/components/core/select/Select.d.ts +29 -0
- package/dist/components/core/select/Select.js +524 -0
- package/dist/components/core/select/Select.types.d.ts +96 -0
- package/dist/components/core/select/Select.types.js +26 -0
- package/dist/components/core/select/select-impl.css +114 -0
- package/dist/components/core/select-chip/SelectChip.css +155 -0
- package/dist/components/core/select-chip/SelectChip.d.ts +20 -0
- package/dist/components/core/select-chip/SelectChip.js +273 -0
- package/dist/components/core/select-chip/SelectChip.types.d.ts +56 -0
- package/dist/components/core/select-chip/SelectChip.types.js +14 -0
- package/dist/components/core/select-chip/select-chip-impl.css +38 -0
- package/dist/components/core/spinner/Spinner.css +76 -0
- package/dist/components/core/spinner/Spinner.d.ts +5 -0
- package/dist/components/core/spinner/Spinner.js +29 -0
- package/dist/components/core/spinner/Spinner.types.d.ts +37 -0
- package/dist/components/core/spinner/Spinner.types.js +10 -0
- package/dist/components/core/spinner/spinner-impl.css +27 -0
- package/dist/components/core/status-dot/StatusDot.css +43 -0
- package/dist/components/core/status-dot/StatusDot.d.ts +35 -0
- package/dist/components/core/status-dot/StatusDot.js +46 -0
- package/dist/components/core/status-dot/StatusDot.types.d.ts +29 -0
- package/dist/components/core/status-dot/StatusDot.types.js +7 -0
- package/dist/components/core/status-dot/status-dot-impl.css +42 -0
- package/dist/components/core/subdomain-navbar/SubdomainNavbar.css +89 -0
- package/dist/components/core/subdomain-navbar/SubdomainNavbar.d.ts +21 -0
- package/dist/components/core/subdomain-navbar/SubdomainNavbar.js +127 -0
- package/dist/components/core/subdomain-navbar/SubdomainNavbar.types.d.ts +43 -0
- package/dist/components/core/subdomain-navbar/SubdomainNavbar.types.js +13 -0
- package/dist/components/core/subdomain-navbar/subdomain-navbar-impl.css +147 -0
- package/dist/components/core/tab/Tab.css +113 -0
- package/dist/components/core/tab/Tab.d.ts +36 -0
- package/dist/components/core/tab/Tab.js +53 -0
- package/dist/components/core/tab/Tab.types.d.ts +42 -0
- package/dist/components/core/tab/Tab.types.js +13 -0
- package/dist/components/core/tab/tab-impl.css +49 -0
- package/dist/components/core/tab-list/TabList.css +40 -0
- package/dist/components/core/tab-list/TabList.d.ts +26 -0
- package/dist/components/core/tab-list/TabList.js +124 -0
- package/dist/components/core/tab-list/TabList.types.d.ts +20 -0
- package/dist/components/core/tab-list/TabList.types.js +7 -0
- package/dist/components/core/tab-list/tab-list-impl.css +56 -0
- package/dist/components/core/table/Table.css +40 -0
- package/dist/components/core/table/Table.d.ts +19 -0
- package/dist/components/core/table/Table.js +55 -0
- package/dist/components/core/table/Table.types.d.ts +59 -0
- package/dist/components/core/table/Table.types.js +9 -0
- package/dist/components/core/table/table-impl.css +75 -0
- package/dist/components/core/table/use-table-sort.d.ts +43 -0
- package/dist/components/core/table/use-table-sort.js +51 -0
- package/dist/components/core/table-body/TableBody.css +6 -0
- package/dist/components/core/table-body/TableBody.d.ts +12 -0
- package/dist/components/core/table-body/TableBody.js +26 -0
- package/dist/components/core/table-body/TableBody.types.d.ts +36 -0
- package/dist/components/core/table-body/TableBody.types.js +7 -0
- package/dist/components/core/table-cell/TableCell.css +76 -0
- package/dist/components/core/table-cell/TableCell.d.ts +21 -0
- package/dist/components/core/table-cell/TableCell.js +31 -0
- package/dist/components/core/table-cell/TableCell.types.d.ts +43 -0
- package/dist/components/core/table-cell/TableCell.types.js +7 -0
- package/dist/components/core/table-head/TableHead.css +6 -0
- package/dist/components/core/table-head/TableHead.d.ts +22 -0
- package/dist/components/core/table-head/TableHead.js +52 -0
- package/dist/components/core/table-head/TableHead.types.d.ts +39 -0
- package/dist/components/core/table-head/TableHead.types.js +7 -0
- package/dist/components/core/table-head/table-head-impl.css +51 -0
- package/dist/components/core/table-header-cell/TableHeaderCell.css +126 -0
- package/dist/components/core/table-header-cell/TableHeaderCell.d.ts +21 -0
- package/dist/components/core/table-header-cell/TableHeaderCell.js +34 -0
- package/dist/components/core/table-header-cell/TableHeaderCell.types.d.ts +56 -0
- package/dist/components/core/table-header-cell/TableHeaderCell.types.js +9 -0
- package/dist/components/core/table-header-cell/table-header-cell-impl.css +74 -0
- package/dist/components/core/table-row/TableRow.css +18 -0
- package/dist/components/core/table-row/TableRow.d.ts +17 -0
- package/dist/components/core/table-row/TableRow.js +32 -0
- package/dist/components/core/table-row/TableRow.types.d.ts +45 -0
- package/dist/components/core/table-row/TableRow.types.js +7 -0
- package/dist/components/core/table-row/table-row-impl.css +31 -0
- package/dist/components/core/text-area/TextArea.css +325 -0
- package/dist/components/core/text-area/TextArea.d.ts +13 -0
- package/dist/components/core/text-area/TextArea.js +133 -0
- package/dist/components/core/text-area/TextArea.types.d.ts +67 -0
- package/dist/components/core/text-area/TextArea.types.js +19 -0
- package/dist/components/core/text-area/text-area-impl.css +36 -0
- package/dist/components/core/text-input/TextInput.css +400 -0
- package/dist/components/core/text-input/TextInput.d.ts +5 -0
- package/dist/components/core/text-input/TextInput.js +130 -0
- package/dist/components/core/text-input/TextInput.types.d.ts +96 -0
- package/dist/components/core/text-input/TextInput.types.js +24 -0
- package/dist/components/core/text-input/text-input-impl.css +36 -0
- package/dist/components/core/tooltip/Tooltip.css +101 -0
- package/dist/components/core/tooltip/Tooltip.d.ts +51 -0
- package/dist/components/core/tooltip/Tooltip.js +87 -0
- package/dist/components/core/tooltip/Tooltip.types.d.ts +38 -0
- package/dist/components/core/tooltip/Tooltip.types.js +9 -0
- package/dist/components/core/tooltip/TooltipAnchor.d.ts +52 -0
- package/dist/components/core/tooltip/TooltipAnchor.js +69 -0
- package/dist/components/core/tooltip/tooltip-anchor.css +145 -0
- package/dist/components/core/tooltip/tooltip-impl.css +54 -0
- package/dist/components/core/tooltip/use-tooltip.d.ts +111 -0
- package/dist/components/core/tooltip/use-tooltip.js +189 -0
- package/dist/components/core/typography/Typography.css +96 -0
- package/dist/components/core/typography/Typography.d.ts +297 -0
- package/dist/components/core/typography/Typography.js +28 -0
- package/dist/components/core/typography/Typography.types.d.ts +40 -0
- package/dist/components/core/typography/Typography.types.js +7 -0
- package/dist/components/css-time.d.ts +20 -0
- package/dist/components/css-time.js +30 -0
- package/dist/components/given.d.ts +7 -0
- package/dist/components/given.js +9 -0
- package/dist/components/hover-open.d.ts +34 -0
- package/dist/components/hover-open.js +90 -0
- package/dist/components/index.d.ts +114 -1
- package/dist/components/index.js +115 -2
- package/dist/components/layout/aspect-ratio/AspectRatio.css +29 -0
- package/dist/components/layout/aspect-ratio/AspectRatio.d.ts +24 -0
- package/dist/components/layout/aspect-ratio/AspectRatio.js +26 -0
- package/dist/components/layout/aspect-ratio/AspectRatio.types.d.ts +22 -0
- package/dist/components/layout/aspect-ratio/AspectRatio.types.js +7 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio-impl.css +44 -0
- package/dist/components/layout/grid/Grid.css +76 -0
- package/dist/components/layout/grid/Grid.d.ts +31 -0
- package/dist/components/layout/grid/Grid.js +33 -0
- package/dist/components/layout/grid/Grid.types.d.ts +48 -0
- package/dist/components/layout/grid/Grid.types.js +7 -0
- package/dist/components/layout/grid/grid-impl.css +62 -0
- package/dist/components/layout/row/Row.css +85 -0
- package/dist/components/layout/row/Row.d.ts +32 -0
- package/dist/components/layout/row/Row.js +34 -0
- package/dist/components/layout/row/Row.types.d.ts +45 -0
- package/dist/components/layout/row/Row.types.js +7 -0
- package/dist/components/layout/scroller/Scroller.css +59 -0
- package/dist/components/layout/scroller/Scroller.d.ts +34 -0
- package/dist/components/layout/scroller/Scroller.js +36 -0
- package/dist/components/layout/scroller/Scroller.types.d.ts +38 -0
- package/dist/components/layout/scroller/Scroller.types.js +7 -0
- package/dist/components/layout/scroller/scroller-impl.css +45 -0
- package/dist/components/layout/stack/Stack.css +73 -0
- package/dist/components/layout/stack/Stack.d.ts +28 -0
- package/dist/components/layout/stack/Stack.js +30 -0
- package/dist/components/layout/stack/Stack.types.d.ts +41 -0
- package/dist/components/layout/stack/Stack.types.js +7 -0
- package/dist/components/visually-hidden.d.ts +22 -0
- package/dist/components/visually-hidden.js +31 -0
- package/dist/fonts/LICENSE-inter.txt +93 -0
- package/dist/fonts/LICENSE-red-hat-mono.txt +93 -0
- package/dist/fonts/fonts.css +111 -0
- package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts/red-hat-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/red-hat-mono-latin-wght-normal.woff2 +0 -0
- package/dist/marketing.css +289 -241
- package/package.json +18 -4
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<!-- GENERATED from accordion.contract.json. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# Accordion
|
|
4
|
+
|
|
5
|
+
A stack of rows whose headings stay and whose detail is put away until the reader asks for it. It exists so a long page can be read as a short one: the headings are the page, and each row is something the reader may or may not want. Two rows at least — a set is what makes it work, because a heading earns its place by being scanned against the ones around it. One row is open at a time and that is not configurable here: a marketing page is read by scrolling, and a set that could hold every row open is the long page the accordion was put there to shorten.
|
|
6
|
+
|
|
7
|
+
## Use when
|
|
8
|
+
|
|
9
|
+
- Questions a reader asks near a decision — what it costs, whether their money is safe, how long a withdrawal takes. Most go unread, which is the point: the ones that matter are found by scanning the headings
|
|
10
|
+
- The long version of something the page has already said shortly — specifications, trading hours, the full terms. The heading is the topic and the panel is the detail nobody needs until they need it
|
|
11
|
+
- A run of rows at one depth in the page's outline, sitting under a section heading of their own
|
|
12
|
+
|
|
13
|
+
## Do not use
|
|
14
|
+
|
|
15
|
+
- There is one thing to disclose rather than a set → `AccordionItem`
|
|
16
|
+
- The reader is meant to read all of it → `Card`
|
|
17
|
+
- Hiding what a reader has to know before deciding — a fee, a restriction, a condition on an offer. Disclosure a page is obliged to make is disclosure that stays on the page
|
|
18
|
+
- Navigation. A row that goes somewhere when pressed is a link wearing a chevron, and a reader who opens it expecting words gets a page instead
|
|
19
|
+
- A single row on its own. Two at least, because a heading is scanned against its neighbours and one heading has none
|
|
20
|
+
- Steps in a sequence. Rows here are independent and in no order — a reader may open the third without the first, and nothing about the set says otherwise
|
|
21
|
+
|
|
22
|
+
## Anatomy
|
|
23
|
+
|
|
24
|
+
Accordion renders one element.
|
|
25
|
+
|
|
26
|
+
- `root` — `<div>`, class `dds-accordion`. The set, and the rule that closes it. It draws no fill and no corner: a marketing page is white and an accordion on it is a list rather than a panel, so what separates the rows is a hairline and what ends the set is one more. A set that wants a surface under it goes inside a Card, which is the component that owns fills and corners — drawing one here would be a second card nobody could tell apart from the first.
|
|
27
|
+
|
|
28
|
+
It draws no edge at all, and says so rather than staying silent: `border.width.none` is bound so that a set closing itself with a hairline is a change somebody has to make on purpose. Every rule here belongs to a row and sits above it, so the lines fall between the rows and nowhere else. A list ruled top and bottom as well reads as a box drawn around it, which is a panel — and a panel is a Card, which this is not.
|
|
29
|
+
|
|
30
|
+
It holds which row is open, and it is the only thing that can: a row cannot see its siblings, so left to themselves they would all open. That is why `expanded` is injected rather than asked for — the set decides, and a row reports the press back so the set can move the answer.
|
|
31
|
+
|
|
32
|
+
No role and no ARIA of its own. A run of headings each followed by a region is already a structure a screen reader can navigate; naming it a widget would put a reader inside something they have to learn their way out of.
|
|
33
|
+
|
|
34
|
+
Apply these classes from the generated `accordionParts` constant rather than writing the strings by hand.
|
|
35
|
+
|
|
36
|
+
## Composition
|
|
37
|
+
|
|
38
|
+
- Can contain: `AccordionItem`
|
|
39
|
+
- Never contains: `Accordion`, `Card`, `CardButton` — in children or in any prop that takes a node
|
|
40
|
+
- Holds at least 2
|
|
41
|
+
|
|
42
|
+
## Props
|
|
43
|
+
|
|
44
|
+
### headingLevel — `2` | `3` | `4` (default `3`)
|
|
45
|
+
|
|
46
|
+
- `2` — The rows are the page's own sections, sitting directly under its title — a page that is nothing but questions is the case
|
|
47
|
+
- `3` — The default. The set sits under a section heading of its own, which is where an accordion usually is
|
|
48
|
+
- `4` — The set is inside a subsection that already carries a heading above it
|
|
49
|
+
|
|
50
|
+
Use when: Where the rows sit in the page's outline. It belongs to the set rather than to a row because every row of one accordion is at one depth by definition, and a set whose rows disagreed would describe a hierarchy the design does not have — which a reader navigating by heading would be told exists
|
|
51
|
+
Never for: Making a row's words larger or smaller. The level is the outline, not the type: every row takes the same step whatever depth it sits at, because a question is a question wherever the set is on the page
|
|
52
|
+
|
|
53
|
+
Also accepts everything from `HTMLAttributes<HTMLDivElement>`.
|
|
54
|
+
|
|
55
|
+
## Accessibility
|
|
56
|
+
|
|
57
|
+
Guaranteed by the component. Write none of it by hand: the ids these attributes point at are generated per instance, so an attribute set from outside either says the same thing twice or points at nothing.
|
|
58
|
+
|
|
59
|
+
- `Tab` — Reaches each row's own control in turn. A run of headings is not a composite widget, so there are no arrow keys to learn and nothing traps the reader inside the set
|
|
60
|
+
- The set carries no role of its own. A run of headings each followed by a region is a structure a screen reader already navigates, and naming it a widget would ask a reader to learn a way out of something they walked into.
|
|
61
|
+
- Every row sits at the same heading level, pushed down from the set. Rows that disagreed would describe a depth the page does not have to anyone moving through it by heading.
|
|
62
|
+
|
|
63
|
+
## Rules
|
|
64
|
+
|
|
65
|
+
- **On a phone a section's actions stack and each fills the width, including when there is only one** — On a phone a page's actions stack, and each one fills the width. Not most of it, and not the width its label happens to need — the whole column.
|
|
66
|
+
|
|
67
|
+
Two side by side is what this replaces. On the narrowest screen each gets half a column minus the gap, which is rarely enough for a real label: the words wrap inside the pills, the two buttons come out different heights, and the pair reads as a broken row rather than as a choice. Stacked, each has the whole width and neither has to shorten its words to fit.
|
|
68
|
+
|
|
69
|
+
A single action fills too, and that is the part worth saying, because it is the one that looks unnecessary. A lone button has the room to sit at its natural width and still should not: a full-width control is the phone's convention for the thing the screen is asking you to do, and a pill hugging its label reads as one option among others that are not there. It also makes the target predictable — the whole width, wherever the thumb lands — which a centred pill does not.
|
|
70
|
+
|
|
71
|
+
Filling is the row's job rather than the button's. A button has no width of its own and is not given one; the row it sits in becomes a column and stretches its children, so nothing about the control changes and the same button is full width here and its own size on a desktop.
|
|
72
|
+
|
|
73
|
+
This is the phone's breakpoint, size.breakpoint.md, and not the wider one that decides whether a heading is centred. Those are different questions and they break at different widths: a heading stops being centred when the measure is the screen, while a button stops being full width much sooner than that — stretched across a tablet it is a long way from its own label, and a label centred in a metre of pill is harder to hit than one in a pill the size of the words.
|
|
74
|
+
|
|
75
|
+
What this is not about is every row of controls. A set of filter chips, a pagination strip, a toolbar, a link sitting after a sentence — none of these is the page asking for something, and stacking them to full width would turn a strip the eye skims into a list it has to read. The test is whether the row is the call to action the section was written for.
|
|
76
|
+
Guidance only — cannot be checked automatically.
|
|
77
|
+
- **Never nest one interactive element inside another** — Nested interactive elements produce ambiguous hit targets and an unreachable inner control for keyboard and screen-reader users. This is why the rule cannot live on any single component — it constrains Button, Link, Input and Switch simultaneously.
|
|
78
|
+
Guidance only — cannot be checked automatically.
|
|
79
|
+
- **A section that paints a ground sets the ink to go with it** — A page sits on color.bg.page, and a section that separates itself from it takes one of three grounds. color.bg.subtle is the light one and needs nothing further — the page's own ink still reads on it. The other two are dark and do not: color.bg.brand-strong takes color.fg.on-brand-strong, and color.bg.brand takes color.fg.on-solid. Both are white, and both are written as the role rather than the white they resolve to. Set one of those backgrounds without its ink and the text inherits whatever the page was already using, which is near-black on a dark band — legible to nobody, and invisible to every check here, because each pair passes contrast on its own and nothing can tell whether a section used both.
|
|
80
|
+
|
|
81
|
+
color.bg.brand carries a second limit that is not about forgetting. Its ink measures 3.39:1, which clears the 3:1 a heading needs and misses the 4.5:1 running copy needs. A coral band may carry a headline and a call to action; a paragraph on one is text the reader has to work through at a ratio the waiver on that role does not cover — the waiver says so itself. A section with copy in it takes color.bg.brand-strong, which is near-black and carries white at full contrast.
|
|
82
|
+
|
|
83
|
+
color.bg.strong is not a section ground. It is the inverted fill for an action that has to outrank what surrounds it, and the components that paint it — Button and ButtonIcon in their inverse form — already set both halves in one rule, which is the pattern a hand-painted section has to copy.
|
|
84
|
+
Guidance only — cannot be checked automatically.
|
|
85
|
+
- **Every gap inside a section names the relationship it expresses, and the same relationship keeps its measure when it turns on its side** — A section's spacing is named by the relationship it expresses, not chosen by size. Every gap in a section has a role token, and reaching for a step off the generic scale because it happens to be the right number is how two sections written by two people stop lining up: the numbers agree today and drift the first time one of them is tuned.
|
|
86
|
+
|
|
87
|
+
The heading group is three steps, not one gap. An eyebrow sits nearer its title than the title sits to its description, and the actions sit further from the description than either — space.heading.eyebrow-title, space.heading.title-description, space.heading.description-actions, in that order. A single `gap` on the group cannot say this; it sets all three the same and the block reads as evenly spaced lines rather than as a mark, a name and a paragraph. The eyebrow has to identify itself for this to work, because a group that opens with a title must not give its description the eyebrow's tighter step.
|
|
88
|
+
|
|
89
|
+
The step between a title and its description follows the size of the title, which is why there are two of it. What a reader sees is not the gap but the gap plus the leading above it, and leading scales with the type: under a display title the leading is most of the space, under a card's title it is half as deep. One value for both makes a card look loose at the size that made a section look right. So space.heading.title-description is the display step and space.heading.title-description-compact is the step at a card's size, and the choice is made by how big the title is rather than by what kind of block it sits in.
|
|
90
|
+
|
|
91
|
+
Every one of those steps is smaller than the gap below the group, and that ordering is what holds the group together as one thing. space.heading.content is the step between a heading group and the content it introduces, and it is the widest measure inside a section: the one gap the eye reads as a change of subject rather than as a continuation.
|
|
92
|
+
|
|
93
|
+
That step is the same whether the content is under the heading or beside it. A split is the same relationship turned on its side — a heading group and the content it introduces — so the space between the two halves is space.heading.content, not a gutter. When the split collapses to one column on a phone the gap becomes vertical again, which is where it started, and nothing has to change for that to be right.
|
|
94
|
+
|
|
95
|
+
space.grid.gutter is between two things of the same kind. Two cards in a row are the same kind; the two halves of a split are not, which is why the gutter is the wrong measure there even when the number would have looked acceptable. The gutter runs on both axes, so a grid reads as an even field rather than as rows with a seam down them.
|
|
96
|
+
|
|
97
|
+
space.inset.card is the card's, not the page's. A row of cards padded differently is a row of different cards, and the fill is the only edge they have. A page composing a row does not get to choose it.
|
|
98
|
+
|
|
99
|
+
Column count is not a breakpoint decision. A row holds as many columns as fit before a column would be narrower than size.grid.column-min, and drops one when they would not. Written as a fixed count that collapses at a breakpoint, a four-up row keeps four columns at every width above the phone and sets its copy two or three words to a line through the whole of the tablet range — and on a narrow desktop, which no breakpoint sits on at all. The threshold is a property of the row rather than of a card: a card fills whatever cell it is given.
|
|
100
|
+
|
|
101
|
+
What this does not cover is the space above and below a section, which is space.section.default and space.section.compact, and the page's own side margin, which is space.inset.page. Those are the section's outside; everything here is its inside.
|
|
102
|
+
Guidance only — cannot be checked automatically.
|
|
103
|
+
- **A section's title is centred over stacked content, starts beside content in columns, and starts on a phone** — Two arrangements, and the title's alignment is decided by which one it is introducing rather than chosen per section.
|
|
104
|
+
|
|
105
|
+
Content stacked under the title — a row of cards, an accordion, a set of steps — takes a centred title. The heading group and the block below it share one axis, so a centred title is symmetric with the thing it names, and the eye drops from the middle of the words to the middle of the set. A title starting at the left over a centred or full-width block reads as belonging to the first column rather than to all of them.
|
|
106
|
+
|
|
107
|
+
Content beside the title — a split, a picture in the other half, anything laid out in columns — takes a title that starts where its content starts. The two share a left edge, and that edge is what says they are one thing read across rather than two stacked. Centring the title there breaks the only alignment the reader has to hold the halves together, and it drifts further from its content the wider the page gets.
|
|
108
|
+
|
|
109
|
+
The heading group is what carries this, not the heading alone. An eyebrow, a title and a description are read as one block and align together; aligning the title without them leaves a centred heading over start-aligned copy, which reads as a mistake rather than as a choice.
|
|
110
|
+
|
|
111
|
+
Centred means all of it, not just the words. A badge, a row of actions, a picture — these are flex children, and a flex child is placed by align-items rather than by text-align, so a block that only sets the text leaves everything that is not text at the start. A hero is the case that shows it: its title and copy centred while its badge and its buttons did not.
|
|
112
|
+
|
|
113
|
+
A capped block centres itself as well as its words. A heading group takes size.heading-group.max, and a cap that is not centred leaves the measure at the start of the column with the words centred inside it — composed, and a long way left of the middle it appears to be in.
|
|
114
|
+
|
|
115
|
+
Both arrangements go to the start on a phone. A centred block reverts below the breakpoint, and the reason is the measure: on a phone the measure is the screen, so a centred title wraps to three or four ragged lines and the eye loses the left edge it was tracking — the same symmetry that reads as composure on a desktop is what makes it hard to scan on a phone. Centring there has to be asked for twice, and a section title is not one of the things that asks: it is centred because there is room for it, and on a phone there is not. Going back to the start means all of it too, and a capped block is the one that hides a leftover: its words go to the start while its measure stays in the middle of the column, which reads as a title still centred over a badge and buttons that are not — the box in the middle and the line inside it at the edge.
|
|
116
|
+
|
|
117
|
+
A hero is a section like any other: its badge, title, copy and actions are one stacked block, so it is centred on a desktop and starts on a phone with everything else.
|
|
118
|
+
|
|
119
|
+
What this is not about is a page whose body is a form or a document. A title over a sign-up form or a guide is not introducing a set of content — it is the first line of the thing itself, and it keeps the alignment the body has, which for running text is the start. The distinction is whether the block below is content the title names or content the title is part of.
|
|
120
|
+
Guidance only — cannot be checked automatically.
|
|
121
|
+
- **Anything a pointer has to hit is at least 24px in both directions** — A control sized by its contents is as big as its contents, and a glyph is chosen for how it reads rather than for how easily it is hit. An icon-only button with no padding is a 16px target — smaller than the pad of a finger, and smaller than the tremor of a hand using a mouse.
|
|
122
|
+
|
|
123
|
+
WCAG 2.2 asks for 24 by 24 CSS pixels at AA. The exceptions are narrower than they look: inline targets inside a sentence are exempt, and so is a small target with 24px of clear space around it — but a clear button sits against the field it empties, and a field is itself a target, so the spacing exemption does not apply to the case that keeps arising.
|
|
124
|
+
|
|
125
|
+
The target and the mark are separate decisions, and conflating them is what produces both faults. Growing the glyph to 24px makes it shout; leaving the button at 16px makes it hard to hit. So the glyph keeps the size that reads correctly beside its text, and the box around it declares a minimum of its own — which is what size.target.min is for.
|
|
126
|
+
|
|
127
|
+
Declared rather than emergent. Padding plus contents does clear 24px in several components today, and it is the weaker statement: it is a size nobody wrote down, so it moves when the type scale or the glyph does, and nothing says it was meant to be a target at all.
|
|
128
|
+
Guidance only — cannot be checked automatically.
|
|
129
|
+
|
|
130
|
+
## Anti-examples
|
|
131
|
+
|
|
132
|
+
❌ Accordion for: There is one thing to disclose rather than a set
|
|
133
|
+
A single row is a disclosure, not an accordion: there is nothing to scan it against and nothing for opening it to close. The row works on its own — it owns its heading, its control and its panel — and a set of one is a wrapper that only says the row is alone
|
|
134
|
+
→ use `AccordionItem` instead.
|
|
135
|
+
|
|
136
|
+
❌ Accordion for: The reader is meant to read all of it
|
|
137
|
+
Copy behind a control is copy most readers will not open, and a page that hides what it needs the reader to know has shortened itself by losing the argument. An accordion is for what a reader goes looking for, not for what the page wants to say
|
|
138
|
+
→ use `Card` instead.
|
|
139
|
+
|
|
140
|
+
## Example
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { Accordion, AccordionItem } from '@deriv-com/dds-marketing'
|
|
144
|
+
|
|
145
|
+
<Accordion>
|
|
146
|
+
<AccordionItem title="Is there a minimum deposit?" onExpandedChange={(expanded) => { /* your handler */ }}>There is no minimum on any account. Fund it with whatever you plan to trade.</AccordionItem>
|
|
147
|
+
<AccordionItem title="How long do withdrawals take?" onExpandedChange={(expanded) => { /* your handler */ }}>Card refunds can take up to five working days. Everything else is usually one.</AccordionItem>
|
|
148
|
+
<AccordionItem title="Which markets can I trade?" onExpandedChange={(expanded) => { /* your handler */ }}>Forex, indices, commodities and stocks, on one account.</AccordionItem>
|
|
149
|
+
</Accordion>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## In use
|
|
153
|
+
|
|
154
|
+
### One row open at a time
|
|
155
|
+
|
|
156
|
+
Opening a row shuts the one before it. Not a setting: a marketing page is read by scrolling, and a set that could hold every row open is the long page the accordion was put there to shorten.
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import { Accordion, AccordionItem } from '@deriv-com/dds-marketing'
|
|
160
|
+
|
|
161
|
+
// Press one, and the last one closes
|
|
162
|
+
<Accordion>
|
|
163
|
+
<AccordionItem title="Is there a minimum deposit?" onExpandedChange={(expanded) => { /* your handler */ }}>There is no minimum on any account. Fund it with whatever you plan to trade.</AccordionItem>
|
|
164
|
+
<AccordionItem title="How long do withdrawals take?" onExpandedChange={(expanded) => { /* your handler */ }}>Card refunds can take up to five working days. Everything else is usually one.</AccordionItem>
|
|
165
|
+
<AccordionItem title="Which markets can I trade?" onExpandedChange={(expanded) => { /* your handler */ }}>Forex, indices, commodities and stocks, on one account.</AccordionItem>
|
|
166
|
+
</Accordion>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Where the rows sit in the outline
|
|
170
|
+
|
|
171
|
+
The level belongs to the set, not to a row: every row of one accordion is at one depth by definition. A reader moving through the page by heading finds all of them at the same step.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { Accordion, AccordionItem } from '@deriv-com/dds-marketing'
|
|
175
|
+
|
|
176
|
+
// Under a section heading of its own — the default
|
|
177
|
+
<Accordion headingLevel="3">
|
|
178
|
+
<AccordionItem title="Is there a minimum deposit?" onExpandedChange={(expanded) => { /* your handler */ }}>There is no minimum on any account. Fund it with whatever you plan to trade.</AccordionItem>
|
|
179
|
+
<AccordionItem title="How long do withdrawals take?" onExpandedChange={(expanded) => { /* your handler */ }}>Card refunds can take up to five working days. Everything else is usually one.</AccordionItem>
|
|
180
|
+
</Accordion>
|
|
181
|
+
|
|
182
|
+
// A page that is nothing but questions
|
|
183
|
+
<Accordion headingLevel="2">
|
|
184
|
+
<AccordionItem title="Is there a minimum deposit?" onExpandedChange={(expanded) => { /* your handler */ }}>There is no minimum on any account. Fund it with whatever you plan to trade.</AccordionItem>
|
|
185
|
+
<AccordionItem title="How long do withdrawals take?" onExpandedChange={(expanded) => { /* your handler */ }}>Card refunds can take up to five working days. Everything else is usually one.</AccordionItem>
|
|
186
|
+
</Accordion>
|
|
187
|
+
|
|
188
|
+
// Inside a subsection that already has a heading
|
|
189
|
+
<Accordion headingLevel="4">
|
|
190
|
+
<AccordionItem title="Is there a minimum deposit?" onExpandedChange={(expanded) => { /* your handler */ }}>There is no minimum on any account.</AccordionItem>
|
|
191
|
+
<AccordionItem title="How long do withdrawals take?" onExpandedChange={(expanded) => { /* your handler */ }}>Card refunds can take up to five working days.</AccordionItem>
|
|
192
|
+
</Accordion>
|
|
193
|
+
```
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<!-- GENERATED from accordion-item.contract.json. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# AccordionItem
|
|
4
|
+
|
|
5
|
+
One row of an Accordion: a heading that is always there, and the detail under it that is not. The heading is the whole of the target — the words and the chevron are one control, because a reader aiming at a row is aiming at the row rather than at the mark on the end of it. The chevron says which way the row is about to move rather than which way it just moved, so it is a promise rather than a report.
|
|
6
|
+
|
|
7
|
+
## Use when
|
|
8
|
+
|
|
9
|
+
- One row inside an Accordion — every row of a set is one of these
|
|
10
|
+
- A single disclosure with no set around it: one topic whose detail is worth offering and not worth showing. The row is whole on its own, and it keeps its own open state when nothing is injecting one
|
|
11
|
+
|
|
12
|
+
## Do not use
|
|
13
|
+
|
|
14
|
+
- The heading goes somewhere rather than opening something → `CardButton`
|
|
15
|
+
- A control inside the heading. The whole heading is one button, so a second one inside it is unreachable to a keyboard and ambiguous to a pointer — the rule about it is the one rule in this system that cannot live on any single component
|
|
16
|
+
- A heading that is a sentence. It is scanned against the rows above and below it, and a row nobody can scan is a row nobody opens
|
|
17
|
+
- Copy the reader is obliged to see. What is behind the control is what a reader goes looking for, not what the page needs them to have read
|
|
18
|
+
- A panel that holds another Accordion. Rows inside rows put a reader two folds deep with no way to see where they are, and the outline they navigate by stops describing the page
|
|
19
|
+
|
|
20
|
+
## Anatomy
|
|
21
|
+
|
|
22
|
+
AccordionItem renders 7 elements. A token binding names the part it applies to.
|
|
23
|
+
|
|
24
|
+
- `root` — `<div>`, class `dds-accordionitem`. The row, and the rule above it. It draws no fill: a row is a line of the page rather than a surface, and the hairline over it is the whole of what separates it from the row before.
|
|
25
|
+
|
|
26
|
+
The rule is a `border-width` and a `border-color` with only the block-start edge given a style, which is how one side is drawn when a width binds all four at once.
|
|
27
|
+
|
|
28
|
+
It is declared on every row and taken off the first, which makes the first row the exception rather than every other row the rule — the same way round Product's does it. A separator is between two things, so the row with nothing above it has none, and the set draws no rule beneath the last. What is left is lines between the rows and no box around them.
|
|
29
|
+
- `heading` — `<div>`, class `dds-accordionitem__heading`. The heading, which is a real one: it takes `role="heading"` and the level the set pushed down, so a reader moving through the page by heading finds every row. A <div> wearing the role rather than an <h3> written out, because the level is a prop and an element cannot be chosen at runtime without six branches saying the same thing.
|
|
30
|
+
|
|
31
|
+
It holds the control rather than being it. A heading that was itself a button would announce two things at once, and the pattern every screen reader expects is a heading with a button inside it.
|
|
32
|
+
- `trigger` — `<button>`, class `dds-accordionitem__trigger`. The target, and all of it. The words and the chevron are one control because a reader aiming at a row aims at the row — a chevron-sized target on the end of a full-width heading is a mark most people miss and everyone on a phone misses.
|
|
33
|
+
|
|
34
|
+
It carries `aria-expanded` and `aria-controls`, which is what makes the fold audible: the state is on the control the reader pressed rather than on the panel they cannot see.
|
|
35
|
+
|
|
36
|
+
Full width and text-aligned to the start, which a button does not do by itself. A `<button>` centres its contents and shrinks to them, so without both it would be a short centred label floating in the middle of a row.
|
|
37
|
+
|
|
38
|
+
And a floor in both directions, declared rather than left to emerge. A row is always taller than a fingertip once its padding is counted, but that is a size nobody wrote down: it moves the moment the inset scale does, and nothing says it was ever meant to be a target.
|
|
39
|
+
|
|
40
|
+
`padding-inline: 0`, which is a reset rather than a measure. A browser gives a button its own horizontal padding — six pixels of it — and binding only the block axis left that in place, so the question sat six pixels right of the answer underneath it. Two things in a column that are supposed to line up, not lining up, for a reason nothing in the contract mentioned.
|
|
41
|
+
|
|
42
|
+
Nothing insets the row from the sides at all, and that is the decision rather than the oversight. This is a ruled list on the page, not a panel: the rules run the width they are given and the words start where the page's own column starts. A set that wants an inset is one a page has put inside something that insets it.
|
|
43
|
+
|
|
44
|
+
It opens at `space.inset.md`, which is the step the scale gained for exactly this. At the old twenty-four a shut row stood forty-nine pixels of air between one question and the next — the padding counts twice, once under the row above and once over the row below, so a measure that looks generous on its own doubles down the set. Twelve was the other way: that is a control's inset, and a row set like a form field reads as something to fill in rather than something to read.
|
|
45
|
+
- `title` — `<span>`, class `dds-accordionitem__title`. The row's words. A <span> rather than an element of its own, because the heading above it already carries the role and the level — a second heading inside the first would put two in the outline where the page has one.
|
|
46
|
+
|
|
47
|
+
It takes `font.label.md`, and the reason is the role rather than the size. This text is the control: the whole heading is one button, and `label.md` is the step named for interactive text — the default one, "one size for every control". `label.lg` is the step above it, for interactive text given prominence, which is a hero's call to action rather than a row of a list.
|
|
48
|
+
|
|
49
|
+
`subtitle` was here first and was wrong twice over: it is for sub-section headers and secondary titles, a pricing plan's name, and a row of an accordion is neither however much it looks like one.
|
|
50
|
+
|
|
51
|
+
`h5` is the near miss on the other side. These *are* headings — but the level is already carried by the role above, and a set of eight questions set at the heading step reads as eight sections of the page rather than one list of them. The outline and the type are separate decisions here, which is the same split `headingLevel` makes.
|
|
52
|
+
|
|
53
|
+
It lands at the size the answer takes, and only its weight tells the two apart: `label.md` is medium where `body.md` is regular. That is a fine distinction for a heading to rest on, and what carries the rest of it is position — a question sits above its answer, alone on its row, with the chevron at the far end.
|
|
54
|
+
- `marker` — `<svg>`, class `dds-accordionitem__marker`. The chevron, pointing the way the row is about to move rather than the way it went. One glyph turned over rather than two swapped: a swap replaces the mark between frames and there is nothing to watch, where the turn is itself the movement that says which way the fold went. The angle is applied in the implementation, because a rotation is not a property the contract can bind.
|
|
55
|
+
|
|
56
|
+
Drawn by `Icon`, which is what owns a glyph's measure. The class stays on it — Icon clones onto the SVG it is handed and keeps whatever class was already there — so this part still names the two things that are the row's rather than the glyph's: its colour, and a duration that matches the fold.
|
|
57
|
+
|
|
58
|
+
What moved out is everything about being a glyph. The width and the height are `Icon`'s, and so is the knowledge that a Quill glyph ships its own width and height attributes and a box around it changes nothing — which is a fact three components here were each carrying separately.
|
|
59
|
+
|
|
60
|
+
The timing stays, and has to: Icon carries one duration for every mark of this kind, and this one is not turning on its own account. It turns with the panel, so it takes the panel's pair per side of the axis, and those rules outrank Icon's by a class.
|
|
61
|
+
|
|
62
|
+
It is presentation and carries no name. What it says is already in `aria-expanded` on the control around it, and a mark announcing "expanded" beside a button that has just announced the same thing says it twice.
|
|
63
|
+
|
|
64
|
+
It is timed with the fold rather than on its own. One duration for both directions left the chevron finishing its turn while the panel was still travelling, which reads as two things happening near each other rather than one thing opening — so it takes the panel's pair, on the same axis.
|
|
65
|
+
- `panel` — `<div>`, class `dds-accordionitem__panel`. What the row was hiding. It stays in the document whether or not it is open, because a panel that unmounted would take its own height with it and there would be nothing to animate between — and a reader searching the page in the browser would not find words the page is holding.
|
|
66
|
+
|
|
67
|
+
It is a grid of one track, and the track is what moves. A height cannot be animated from nothing to auto, and a number here would be a guess at how long an answer is — the one thing a panel's height cannot be is known.
|
|
68
|
+
|
|
69
|
+
Its `display` varies by the axis rather than being declared once, and that distinction is the whole of whether a shut row takes space. `hidden` on the element carries `display: none` from the browser's own sheet, which any author rule outranks — so a panel told `display: grid` unconditionally is a grid box in the layout whether or not it is hidden, and the content's bottom inset shows through as a band under every shut row. Declared per value, `none` and `grid` agree with the attribute instead of overruling it.
|
|
70
|
+
|
|
71
|
+
Opening takes `motion.duration.slow`, which the scale names for accordions in as many words, and `easing.enter` to settle rather than stop. Shutting is quicker and eased the other way, and that asymmetry is not tidiness: the collapse ends with `display` flipping to `none`, so a curve with a long tail leaves the last sliver crawling and then vanishing. `easing.exit` accelerates away and reaches nothing exactly as the duration runs out. The same tail on the way open sits at ninety-nine percent of the height, where nobody can see it — which is why one curve for both directions cannot be right however tidy it looks.
|
|
72
|
+
- `content` — `<div>`, class `dds-accordionitem__content`. The words themselves, inside the track that moves. A second box is not redundant: the grid track collapses to no height and its contents have to be clipped by something that is not also the thing being measured, or the text spills out of a row that is closed.
|
|
73
|
+
|
|
74
|
+
It closes at `space.inset.md`, the same step the trigger opens at, so an answer sits the same distance from its own question as from the rule beneath it. That is a squarer rhythm than the asymmetry it replaces and it gives up something: at equal gaps nothing but the rule says which heading an open answer belongs to. The rule is doing that work now. The gap above an answer is the trigger's own bottom padding; the gap below it is this. Equal, the answer sits as near the next question as its own, and a reader scanning an open set cannot tell which heading it belongs to.
|
|
75
|
+
|
|
76
|
+
It takes no colour of its own, which is how it comes out the same ink as the question above it. The trigger binds no default colour either — it inherits — so leaving this one unbound is what makes the pair agree rather than a second binding that happens to name the same role, and it keeps them agreeing on a ground neither of them chose. An answer set a step lighter than its question reads as an aside, and an answer is not an aside: it is the thing the question was asked for, and the question is already doing the work of being the heading.
|
|
77
|
+
|
|
78
|
+
Apply these classes from the generated `accordionItemParts` constant rather than writing the strings by hand.
|
|
79
|
+
|
|
80
|
+
## Composition
|
|
81
|
+
|
|
82
|
+
- Can contain: any content
|
|
83
|
+
- Never contains: `Accordion`, `AccordionItem`, `CardButton` — in children or in any prop that takes a node
|
|
84
|
+
- Holds at least 1
|
|
85
|
+
|
|
86
|
+
## Props
|
|
87
|
+
|
|
88
|
+
### expanded — `boolean`
|
|
89
|
+
|
|
90
|
+
Use when: Whether the panel is showing. Inside an Accordion this is injected on every render and the set owns it — a row cannot see its siblings, so it cannot know it is the one that should close. Left off, the row owns itself: absent is not the same as false here, and that difference is the whole of how one component is both. `false` is a set saying the row is shut; absent is nobody saying anything, and the row answers its own presses from there
|
|
91
|
+
Never for: Forcing a row open so its words are always visible. A panel that never shuts is copy behind a control that lies about what it does, and the reader who closes it once will not open it again. Note that passing it at all takes the row over: `expanded={false}` with no `onExpandedChange` to move it is a row that can never open, the same way a value with no handler is a field that cannot be typed in
|
|
92
|
+
|
|
93
|
+
### onExpandedChange — `callback`
|
|
94
|
+
|
|
95
|
+
Use when: The page needs to know the row was pressed — to record which question was asked, or to hold the answer itself. Inside an Accordion the set chains its own handler after this one, so a page keeps its report whether or not it is also controlling the row
|
|
96
|
+
Never for: Doing something other than opening the row. It fires because a reader asked to see the words; navigating or submitting from it makes the chevron a lie
|
|
97
|
+
|
|
98
|
+
### title — `string` **Required.**
|
|
99
|
+
|
|
100
|
+
Use when: Always — it is the half of the row that is always on screen. A question in the reader's own words, or the name of the thing the panel details. A string rather than a node, for the reason CardBody's title is one: a node prop cannot be given text in an examples row, and a row nobody can show is worse than a heading that cannot hold a link
|
|
101
|
+
Never for: The answer, shortened. A heading that summarises the panel gives the reader no reason to open it, and a set of them is the long page again in smaller type
|
|
102
|
+
|
|
103
|
+
### headingLevel — `2` | `3` | `4` (default `3`)
|
|
104
|
+
|
|
105
|
+
- `2` — The rows are the page's own sections. Set on the Accordion rather than here, which pushes it down
|
|
106
|
+
- `3` — The default, and where an accordion usually sits — under a section heading of its own
|
|
107
|
+
- `4` — The set is inside a subsection that already carries a heading
|
|
108
|
+
|
|
109
|
+
Use when: Where this row sits in the page's outline. Inside an Accordion it is injected, because every row of one set is at one depth by definition. Set it here only on a row standing alone
|
|
110
|
+
Never for: Changing how large the words are. The level is the outline and the type is `font.subtitle` either way — a row at h2 is not a bigger question than a row at h4
|
|
111
|
+
|
|
112
|
+
Also accepts everything from `HTMLAttributes<HTMLDivElement>`.
|
|
113
|
+
|
|
114
|
+
## Accessibility
|
|
115
|
+
|
|
116
|
+
Guaranteed by the component. Write none of it by hand: the ids these attributes point at are generated per instance, so an attribute set from outside either says the same thing twice or points at nothing.
|
|
117
|
+
|
|
118
|
+
- Announced as: `button`
|
|
119
|
+
- `Tab` — Moves to the row's control. One stop per row, on the heading's button — there is nothing else in a row that takes focus
|
|
120
|
+
- `Enter` — Opens the row, or shuts it
|
|
121
|
+
- `Space` — The same. A button answers both, and a reader who learned one does not have to learn the other
|
|
122
|
+
- The control carries aria-expanded, and it is on the control rather than on the panel. A reader learns whether the row is open from the thing they are about to press, not from a region they cannot see until it opens.
|
|
123
|
+
- The control names the panel with aria-controls, and the panel's id is stable across renders. An id that changed on every keystroke elsewhere on the page would point the control at nothing.
|
|
124
|
+
- The panel is a named region, named by the control that opened it. A region is a landmark, and one without a name fills a screen reader's landmark list with anonymous entries — worse than declaring no role at all. Only one row is ever open, so exactly one such landmark exists at a time.
|
|
125
|
+
- The panel stays in the document when the row is shut. Unmounting it takes its height away, so there is nothing to move between — and it takes the words out of the browser's own find-on-page, which is how a reader looks for an answer they half remember.
|
|
126
|
+
|
|
127
|
+
## Rules
|
|
128
|
+
|
|
129
|
+
- **On a phone a section's actions stack and each fills the width, including when there is only one** — On a phone a page's actions stack, and each one fills the width. Not most of it, and not the width its label happens to need — the whole column.
|
|
130
|
+
|
|
131
|
+
Two side by side is what this replaces. On the narrowest screen each gets half a column minus the gap, which is rarely enough for a real label: the words wrap inside the pills, the two buttons come out different heights, and the pair reads as a broken row rather than as a choice. Stacked, each has the whole width and neither has to shorten its words to fit.
|
|
132
|
+
|
|
133
|
+
A single action fills too, and that is the part worth saying, because it is the one that looks unnecessary. A lone button has the room to sit at its natural width and still should not: a full-width control is the phone's convention for the thing the screen is asking you to do, and a pill hugging its label reads as one option among others that are not there. It also makes the target predictable — the whole width, wherever the thumb lands — which a centred pill does not.
|
|
134
|
+
|
|
135
|
+
Filling is the row's job rather than the button's. A button has no width of its own and is not given one; the row it sits in becomes a column and stretches its children, so nothing about the control changes and the same button is full width here and its own size on a desktop.
|
|
136
|
+
|
|
137
|
+
This is the phone's breakpoint, size.breakpoint.md, and not the wider one that decides whether a heading is centred. Those are different questions and they break at different widths: a heading stops being centred when the measure is the screen, while a button stops being full width much sooner than that — stretched across a tablet it is a long way from its own label, and a label centred in a metre of pill is harder to hit than one in a pill the size of the words.
|
|
138
|
+
|
|
139
|
+
What this is not about is every row of controls. A set of filter chips, a pagination strip, a toolbar, a link sitting after a sentence — none of these is the page asking for something, and stacking them to full width would turn a strip the eye skims into a list it has to read. The test is whether the row is the call to action the section was written for.
|
|
140
|
+
Guidance only — cannot be checked automatically.
|
|
141
|
+
- **Never nest one interactive element inside another** — Nested interactive elements produce ambiguous hit targets and an unreachable inner control for keyboard and screen-reader users. This is why the rule cannot live on any single component — it constrains Button, Link, Input and Switch simultaneously.
|
|
142
|
+
Guidance only — cannot be checked automatically.
|
|
143
|
+
- **A section that paints a ground sets the ink to go with it** — A page sits on color.bg.page, and a section that separates itself from it takes one of three grounds. color.bg.subtle is the light one and needs nothing further — the page's own ink still reads on it. The other two are dark and do not: color.bg.brand-strong takes color.fg.on-brand-strong, and color.bg.brand takes color.fg.on-solid. Both are white, and both are written as the role rather than the white they resolve to. Set one of those backgrounds without its ink and the text inherits whatever the page was already using, which is near-black on a dark band — legible to nobody, and invisible to every check here, because each pair passes contrast on its own and nothing can tell whether a section used both.
|
|
144
|
+
|
|
145
|
+
color.bg.brand carries a second limit that is not about forgetting. Its ink measures 3.39:1, which clears the 3:1 a heading needs and misses the 4.5:1 running copy needs. A coral band may carry a headline and a call to action; a paragraph on one is text the reader has to work through at a ratio the waiver on that role does not cover — the waiver says so itself. A section with copy in it takes color.bg.brand-strong, which is near-black and carries white at full contrast.
|
|
146
|
+
|
|
147
|
+
color.bg.strong is not a section ground. It is the inverted fill for an action that has to outrank what surrounds it, and the components that paint it — Button and ButtonIcon in their inverse form — already set both halves in one rule, which is the pattern a hand-painted section has to copy.
|
|
148
|
+
Guidance only — cannot be checked automatically.
|
|
149
|
+
- **Every gap inside a section names the relationship it expresses, and the same relationship keeps its measure when it turns on its side** — A section's spacing is named by the relationship it expresses, not chosen by size. Every gap in a section has a role token, and reaching for a step off the generic scale because it happens to be the right number is how two sections written by two people stop lining up: the numbers agree today and drift the first time one of them is tuned.
|
|
150
|
+
|
|
151
|
+
The heading group is three steps, not one gap. An eyebrow sits nearer its title than the title sits to its description, and the actions sit further from the description than either — space.heading.eyebrow-title, space.heading.title-description, space.heading.description-actions, in that order. A single `gap` on the group cannot say this; it sets all three the same and the block reads as evenly spaced lines rather than as a mark, a name and a paragraph. The eyebrow has to identify itself for this to work, because a group that opens with a title must not give its description the eyebrow's tighter step.
|
|
152
|
+
|
|
153
|
+
The step between a title and its description follows the size of the title, which is why there are two of it. What a reader sees is not the gap but the gap plus the leading above it, and leading scales with the type: under a display title the leading is most of the space, under a card's title it is half as deep. One value for both makes a card look loose at the size that made a section look right. So space.heading.title-description is the display step and space.heading.title-description-compact is the step at a card's size, and the choice is made by how big the title is rather than by what kind of block it sits in.
|
|
154
|
+
|
|
155
|
+
Every one of those steps is smaller than the gap below the group, and that ordering is what holds the group together as one thing. space.heading.content is the step between a heading group and the content it introduces, and it is the widest measure inside a section: the one gap the eye reads as a change of subject rather than as a continuation.
|
|
156
|
+
|
|
157
|
+
That step is the same whether the content is under the heading or beside it. A split is the same relationship turned on its side — a heading group and the content it introduces — so the space between the two halves is space.heading.content, not a gutter. When the split collapses to one column on a phone the gap becomes vertical again, which is where it started, and nothing has to change for that to be right.
|
|
158
|
+
|
|
159
|
+
space.grid.gutter is between two things of the same kind. Two cards in a row are the same kind; the two halves of a split are not, which is why the gutter is the wrong measure there even when the number would have looked acceptable. The gutter runs on both axes, so a grid reads as an even field rather than as rows with a seam down them.
|
|
160
|
+
|
|
161
|
+
space.inset.card is the card's, not the page's. A row of cards padded differently is a row of different cards, and the fill is the only edge they have. A page composing a row does not get to choose it.
|
|
162
|
+
|
|
163
|
+
Column count is not a breakpoint decision. A row holds as many columns as fit before a column would be narrower than size.grid.column-min, and drops one when they would not. Written as a fixed count that collapses at a breakpoint, a four-up row keeps four columns at every width above the phone and sets its copy two or three words to a line through the whole of the tablet range — and on a narrow desktop, which no breakpoint sits on at all. The threshold is a property of the row rather than of a card: a card fills whatever cell it is given.
|
|
164
|
+
|
|
165
|
+
What this does not cover is the space above and below a section, which is space.section.default and space.section.compact, and the page's own side margin, which is space.inset.page. Those are the section's outside; everything here is its inside.
|
|
166
|
+
Guidance only — cannot be checked automatically.
|
|
167
|
+
- **A section's title is centred over stacked content, starts beside content in columns, and starts on a phone** — Two arrangements, and the title's alignment is decided by which one it is introducing rather than chosen per section.
|
|
168
|
+
|
|
169
|
+
Content stacked under the title — a row of cards, an accordion, a set of steps — takes a centred title. The heading group and the block below it share one axis, so a centred title is symmetric with the thing it names, and the eye drops from the middle of the words to the middle of the set. A title starting at the left over a centred or full-width block reads as belonging to the first column rather than to all of them.
|
|
170
|
+
|
|
171
|
+
Content beside the title — a split, a picture in the other half, anything laid out in columns — takes a title that starts where its content starts. The two share a left edge, and that edge is what says they are one thing read across rather than two stacked. Centring the title there breaks the only alignment the reader has to hold the halves together, and it drifts further from its content the wider the page gets.
|
|
172
|
+
|
|
173
|
+
The heading group is what carries this, not the heading alone. An eyebrow, a title and a description are read as one block and align together; aligning the title without them leaves a centred heading over start-aligned copy, which reads as a mistake rather than as a choice.
|
|
174
|
+
|
|
175
|
+
Centred means all of it, not just the words. A badge, a row of actions, a picture — these are flex children, and a flex child is placed by align-items rather than by text-align, so a block that only sets the text leaves everything that is not text at the start. A hero is the case that shows it: its title and copy centred while its badge and its buttons did not.
|
|
176
|
+
|
|
177
|
+
A capped block centres itself as well as its words. A heading group takes size.heading-group.max, and a cap that is not centred leaves the measure at the start of the column with the words centred inside it — composed, and a long way left of the middle it appears to be in.
|
|
178
|
+
|
|
179
|
+
Both arrangements go to the start on a phone. A centred block reverts below the breakpoint, and the reason is the measure: on a phone the measure is the screen, so a centred title wraps to three or four ragged lines and the eye loses the left edge it was tracking — the same symmetry that reads as composure on a desktop is what makes it hard to scan on a phone. Centring there has to be asked for twice, and a section title is not one of the things that asks: it is centred because there is room for it, and on a phone there is not. Going back to the start means all of it too, and a capped block is the one that hides a leftover: its words go to the start while its measure stays in the middle of the column, which reads as a title still centred over a badge and buttons that are not — the box in the middle and the line inside it at the edge.
|
|
180
|
+
|
|
181
|
+
A hero is a section like any other: its badge, title, copy and actions are one stacked block, so it is centred on a desktop and starts on a phone with everything else.
|
|
182
|
+
|
|
183
|
+
What this is not about is a page whose body is a form or a document. A title over a sign-up form or a guide is not introducing a set of content — it is the first line of the thing itself, and it keeps the alignment the body has, which for running text is the start. The distinction is whether the block below is content the title names or content the title is part of.
|
|
184
|
+
Guidance only — cannot be checked automatically.
|
|
185
|
+
- **Anything a pointer has to hit is at least 24px in both directions** — A control sized by its contents is as big as its contents, and a glyph is chosen for how it reads rather than for how easily it is hit. An icon-only button with no padding is a 16px target — smaller than the pad of a finger, and smaller than the tremor of a hand using a mouse.
|
|
186
|
+
|
|
187
|
+
WCAG 2.2 asks for 24 by 24 CSS pixels at AA. The exceptions are narrower than they look: inline targets inside a sentence are exempt, and so is a small target with 24px of clear space around it — but a clear button sits against the field it empties, and a field is itself a target, so the spacing exemption does not apply to the case that keeps arising.
|
|
188
|
+
|
|
189
|
+
The target and the mark are separate decisions, and conflating them is what produces both faults. Growing the glyph to 24px makes it shout; leaving the button at 16px makes it hard to hit. So the glyph keeps the size that reads correctly beside its text, and the box around it declares a minimum of its own — which is what size.target.min is for.
|
|
190
|
+
|
|
191
|
+
Declared rather than emergent. Padding plus contents does clear 24px in several components today, and it is the weaker statement: it is a size nobody wrote down, so it moves when the type scale or the glyph does, and nothing says it was meant to be a target at all.
|
|
192
|
+
Guidance only — cannot be checked automatically.
|
|
193
|
+
|
|
194
|
+
## Anti-examples
|
|
195
|
+
|
|
196
|
+
❌ AccordionItem for: The heading goes somewhere rather than opening something
|
|
197
|
+
A chevron that turns and a chevron that leads are different promises. This opens a panel below itself and stays on the page; a row that navigated would take the reader away from a control that told them it was about to unfold
|
|
198
|
+
→ use `CardButton` instead.
|
|
199
|
+
|
|
200
|
+
## Example
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { AccordionItem } from '@deriv-com/dds-marketing'
|
|
204
|
+
|
|
205
|
+
<AccordionItem title="Is there a minimum deposit?">There is no minimum on any account.</AccordionItem>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## In use
|
|
209
|
+
|
|
210
|
+
### Shut, and open
|
|
211
|
+
|
|
212
|
+
The heading is always there and the detail is not. A row keeps its own state when nothing is injecting one, so it works on its own as well as inside a set.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import { AccordionItem } from '@deriv-com/dds-marketing'
|
|
216
|
+
|
|
217
|
+
// Shut — the panel is in the document, out of reach
|
|
218
|
+
<AccordionItem title="How long do withdrawals take?">Card refunds can take up to five working days.</AccordionItem>
|
|
219
|
+
|
|
220
|
+
// Open
|
|
221
|
+
<AccordionItem expanded title="Is there a minimum deposit?">There is no minimum on any account.</AccordionItem>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### A row standing on its own
|
|
225
|
+
|
|
226
|
+
Inside a set the level is injected and every row shares it. Set it here only on a row with no set around it, where nothing else can say how deep the page runs.
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
import { AccordionItem } from '@deriv-com/dds-marketing'
|
|
230
|
+
|
|
231
|
+
// h2 — the row is one of the page’s own sections
|
|
232
|
+
<AccordionItem headingLevel="2" title="Security and your funds">We hold client money in segregated accounts.</AccordionItem>
|
|
233
|
+
|
|
234
|
+
// h4 — inside a subsection that already has a heading
|
|
235
|
+
<AccordionItem headingLevel="4" title="Segregated accounts">Client money is held apart from company money.</AccordionItem>
|
|
236
|
+
```
|