@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,135 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Everything focusable, in document order.
|
|
5
|
+
*
|
|
6
|
+
* The disabled and hidden filters matter more than they look: a disabled control
|
|
7
|
+
* is in the DOM and is not a tab stop, so a trap that counted one would send the
|
|
8
|
+
* reader to an element the browser then skips — and the cycle would land
|
|
9
|
+
* somewhere other than where it claimed.
|
|
10
|
+
*/
|
|
11
|
+
const FOCUSABLE = [
|
|
12
|
+
'a[href]',
|
|
13
|
+
'button:not([disabled])',
|
|
14
|
+
'input:not([disabled])',
|
|
15
|
+
'select:not([disabled])',
|
|
16
|
+
'textarea:not([disabled])',
|
|
17
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
18
|
+
].join(',');
|
|
19
|
+
function focusableWithin(root) {
|
|
20
|
+
return Array.from(root.querySelectorAll(FOCUSABLE)).filter((el) => el.hidden === false && el.getAttribute('aria-hidden') !== 'true');
|
|
21
|
+
}
|
|
22
|
+
export function useNavbarPanel({ open, panelRef, triggerRef, onClose }) {
|
|
23
|
+
/*
|
|
24
|
+
The keys, which is both obligations that answer to one listener.
|
|
25
|
+
|
|
26
|
+
On the panel rather than on the document: a listener on the document would
|
|
27
|
+
answer for Escape pressed anywhere, including inside a menu the panel
|
|
28
|
+
contains that means to handle its own — and the panel would close out from
|
|
29
|
+
under a reader who was only dismissing a dropdown.
|
|
30
|
+
*/
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!open)
|
|
33
|
+
return;
|
|
34
|
+
const panel = panelRef.current;
|
|
35
|
+
if (panel === null)
|
|
36
|
+
return;
|
|
37
|
+
const onKeyDown = (event) => {
|
|
38
|
+
if (event.key === 'Escape') {
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
onClose();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (event.key !== 'Tab')
|
|
44
|
+
return;
|
|
45
|
+
const stops = focusableWithin(panel);
|
|
46
|
+
if (stops.length === 0) {
|
|
47
|
+
// Nothing to hold. Better to swallow the key than to let focus leave a
|
|
48
|
+
// surface the reader cannot see past — the exit is Escape either way.
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const first = stops[0];
|
|
53
|
+
const last = stops[stops.length - 1];
|
|
54
|
+
const active = document.activeElement;
|
|
55
|
+
// Only the two ends wrap. Everything between them is the browser's own tab
|
|
56
|
+
// order, which is the order the reader expects and which nothing here
|
|
57
|
+
// could reproduce more faithfully by reimplementing it.
|
|
58
|
+
if (event.shiftKey && (active === first || !panel.contains(active))) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
last.focus();
|
|
61
|
+
}
|
|
62
|
+
else if (!event.shiftKey && active === last) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
first.focus();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
panel.addEventListener('keydown', onKeyDown);
|
|
68
|
+
return () => panel.removeEventListener('keydown', onKeyDown);
|
|
69
|
+
}, [open, panelRef, onClose]);
|
|
70
|
+
/*
|
|
71
|
+
Focus in on open, and back to the trigger on close.
|
|
72
|
+
|
|
73
|
+
Read the trigger once, while the panel is opening. By the time this cleanup
|
|
74
|
+
runs the ref may point at nothing — a route change can unmount the whole bar
|
|
75
|
+
— and a cleanup reading it then would return focus to null, which is the
|
|
76
|
+
body, which is the top of a document the reader had scrolled away from.
|
|
77
|
+
*/
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!open)
|
|
80
|
+
return;
|
|
81
|
+
const panel = panelRef.current;
|
|
82
|
+
if (panel === null)
|
|
83
|
+
return;
|
|
84
|
+
const opener = triggerRef.current;
|
|
85
|
+
focusableWithin(panel)[0]?.focus();
|
|
86
|
+
return () => {
|
|
87
|
+
// Only if it is still there. A reader who has already moved on — by
|
|
88
|
+
// following a destination inside the panel, say — should not be dragged
|
|
89
|
+
// back to a control on a page they have left.
|
|
90
|
+
if (opener !== null && opener.isConnected)
|
|
91
|
+
opener.focus();
|
|
92
|
+
};
|
|
93
|
+
}, [open, panelRef, triggerRef]);
|
|
94
|
+
/*
|
|
95
|
+
The document holds still.
|
|
96
|
+
|
|
97
|
+
Restores what was there rather than clearing to a keyword: a site with its
|
|
98
|
+
own overflow rule on the body would have it silently replaced by `visible`,
|
|
99
|
+
and would find the page unable to scroll again after the first time anyone
|
|
100
|
+
opened this.
|
|
101
|
+
*/
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!open)
|
|
104
|
+
return;
|
|
105
|
+
if (typeof document === 'undefined')
|
|
106
|
+
return;
|
|
107
|
+
const { body } = document;
|
|
108
|
+
const overflow = body.style.overflow;
|
|
109
|
+
const inlineEnd = body.style.paddingInlineEnd;
|
|
110
|
+
/*
|
|
111
|
+
And it holds still sideways as well, which is the half this forgot.
|
|
112
|
+
|
|
113
|
+
Hiding the document's overflow takes its scrollbar with it, and on every platform that draws
|
|
114
|
+
one in the layout — which is most desktops — the page is suddenly wider by that much and
|
|
115
|
+
everything centred in it slides across. The mark in this panel's header and the mark in the
|
|
116
|
+
bar behind it are drawn at the same distance from the edge to the pixel, and the reader still
|
|
117
|
+
sees the logo jump, because what moved was not the logo.
|
|
118
|
+
|
|
119
|
+
Measured rather than assumed: the difference between the window and the element filling it is
|
|
120
|
+
the scrollbar's width where there is one and nought where there is not, so an overlay
|
|
121
|
+
scrollbar costs nothing and a classic one is paid for exactly.
|
|
122
|
+
|
|
123
|
+
Both values are put back rather than cleared, for the same reason the overflow is: a site with
|
|
124
|
+
its own padding on the body should get it back, not `0`.
|
|
125
|
+
*/
|
|
126
|
+
const scrollbar = window.innerWidth - document.documentElement.clientWidth;
|
|
127
|
+
body.style.overflow = 'hidden';
|
|
128
|
+
if (scrollbar > 0)
|
|
129
|
+
body.style.paddingInlineEnd = `${scrollbar}px`;
|
|
130
|
+
return () => {
|
|
131
|
+
body.style.overflow = overflow;
|
|
132
|
+
body.style.paddingInlineEnd = inlineEnd;
|
|
133
|
+
};
|
|
134
|
+
}, [open]);
|
|
135
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/* GENERATED from navbarswitcher.contract.json. Do not edit. */
|
|
2
|
+
|
|
3
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__trigger {
|
|
9
|
+
align-items: center;
|
|
10
|
+
appearance: none;
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
border-style: none;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
color: inherit;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
gap: inherit;
|
|
18
|
+
outline-style: solid;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
border-radius: var(--radius-pill);
|
|
21
|
+
font-family: var(--font-label-sm-family);
|
|
22
|
+
font-size: var(--font-label-sm-size);
|
|
23
|
+
font-weight: var(--font-label-sm-weight);
|
|
24
|
+
gap: var(--space-gap-xs);
|
|
25
|
+
letter-spacing: var(--font-label-sm-letter-spacing);
|
|
26
|
+
line-height: var(--font-label-sm-line-height);
|
|
27
|
+
min-block-size: var(--size-control-lg);
|
|
28
|
+
outline-width: var(--border-width-none);
|
|
29
|
+
padding-inline: var(--space-inset-md);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__icon {
|
|
33
|
+
align-items: center;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
block-size: var(--icon-size-xs);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__chevron {
|
|
40
|
+
align-items: center;
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
block-size: var(--icon-size-xs);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__surface {
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
color: var(--color-fg-default);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__back {
|
|
54
|
+
align-items: center;
|
|
55
|
+
appearance: none;
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
border-style: none;
|
|
58
|
+
color: inherit;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
outline-style: solid;
|
|
63
|
+
padding: 0;
|
|
64
|
+
border-radius: var(--radius-control-sm);
|
|
65
|
+
min-block-size: var(--size-target-min);
|
|
66
|
+
min-inline-size: var(--size-target-min);
|
|
67
|
+
outline-width: var(--border-width-none);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__list {
|
|
71
|
+
min-inline-size: 0;
|
|
72
|
+
column-gap: var(--space-gap-md);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__trigger:hover:where(:not(:disabled)) {
|
|
76
|
+
background-color: var(--color-bg-hover);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__back:focus-visible {
|
|
80
|
+
outline-color: var(--color-border-focus);
|
|
81
|
+
outline-width: var(--border-width-focus);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__trigger:focus-visible {
|
|
85
|
+
outline-color: var(--color-border-focus);
|
|
86
|
+
outline-width: var(--border-width-focus);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation="floating"] .dds-navbarswitcher__surface {
|
|
90
|
+
background-color: var(--color-bg-surface-raised);
|
|
91
|
+
border-radius: var(--radius-container);
|
|
92
|
+
box-shadow: var(--elevation-surface-floating);
|
|
93
|
+
inline-size: var(--size-switcher-panel-width);
|
|
94
|
+
margin-block-start: var(--space-gap-sm);
|
|
95
|
+
padding-block: var(--space-inset-md);
|
|
96
|
+
padding-inline: var(--space-inset-md);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation="panel"] .dds-navbarswitcher__surface {
|
|
100
|
+
background-color: var(--color-bg-page);
|
|
101
|
+
gap: var(--space-gap-sm);
|
|
102
|
+
padding-block: var(--space-inset-sm);
|
|
103
|
+
padding-inline: var(--space-inset-sm);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation="panel"] .dds-navbarswitcher__trigger {
|
|
107
|
+
padding-block: var(--space-inset-sm);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-tone="inverse"] .dds-navbarswitcher__trigger:hover:where(:not(:disabled)) {
|
|
111
|
+
background-color: var(--color-bg-hover-inverse);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-tone="inverse"] .dds-navbarswitcher__trigger:focus-visible {
|
|
115
|
+
outline-color: var(--color-border-focus-inverse);
|
|
116
|
+
}
|
|
117
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './NavbarSwitcher.css';
|
|
2
|
+
import './navbar-switcher-impl.css';
|
|
3
|
+
import { type NavbarSwitcherProps } from './NavbarSwitcher.types.js';
|
|
4
|
+
export type { NavbarSwitcherProps };
|
|
5
|
+
/**
|
|
6
|
+
* Something a reader sets, in whichever of its two forms the container asks for.
|
|
7
|
+
*
|
|
8
|
+
* In a bar it is a trigger and a panel hanging off it. In the collapsed panel it is a row that
|
|
9
|
+
* opens a page of its own with a way back — because a dropdown inside a surface already covering
|
|
10
|
+
* the screen is a surface inside a surface, and because sixteen languages fit on a phone only if
|
|
11
|
+
* everything else stops being drawn.
|
|
12
|
+
*
|
|
13
|
+
* Controlled when told, its own answer otherwise, exactly as NavbarMenu is: a bar holding which of
|
|
14
|
+
* several things is open needs to say so, and a switcher standing alone needs no such help.
|
|
15
|
+
*
|
|
16
|
+
* What opens is not a menu and takes no menu role. Its rows are states, one of which is already in
|
|
17
|
+
* force — `role="menu"` would promise arrow-key navigation over commands, and its first consequence
|
|
18
|
+
* is that a screen reader stops announcing the choices as the buttons they are.
|
|
19
|
+
*/
|
|
20
|
+
export declare function NavbarSwitcher({ presentation, tone, label, menuLabel, backLabel, icon, chevron, open, onOpenChange, children, ...rest }: NavbarSwitcherProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { ChevronDownRegularIcon, ChevronLeftRegularIcon, ChevronRightRegularIcon, } from '@deriv-com/quill-icons-web';
|
|
5
|
+
import './NavbarSwitcher.css';
|
|
6
|
+
import './navbar-switcher-impl.css';
|
|
7
|
+
import { useHoverOpen } from '../../hover-open.js';
|
|
8
|
+
import { Icon } from '../icon/Icon.js';
|
|
9
|
+
import { navbarSwitcherDefaults, navbarSwitcherParts, } from './NavbarSwitcher.types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Something a reader sets, in whichever of its two forms the container asks for.
|
|
12
|
+
*
|
|
13
|
+
* In a bar it is a trigger and a panel hanging off it. In the collapsed panel it is a row that
|
|
14
|
+
* opens a page of its own with a way back — because a dropdown inside a surface already covering
|
|
15
|
+
* the screen is a surface inside a surface, and because sixteen languages fit on a phone only if
|
|
16
|
+
* everything else stops being drawn.
|
|
17
|
+
*
|
|
18
|
+
* Controlled when told, its own answer otherwise, exactly as NavbarMenu is: a bar holding which of
|
|
19
|
+
* several things is open needs to say so, and a switcher standing alone needs no such help.
|
|
20
|
+
*
|
|
21
|
+
* What opens is not a menu and takes no menu role. Its rows are states, one of which is already in
|
|
22
|
+
* force — `role="menu"` would promise arrow-key navigation over commands, and its first consequence
|
|
23
|
+
* is that a screen reader stops announcing the choices as the buttons they are.
|
|
24
|
+
*/
|
|
25
|
+
export function NavbarSwitcher({ presentation = navbarSwitcherDefaults.presentation, tone = navbarSwitcherDefaults.tone, label, menuLabel, backLabel, icon, chevron = navbarSwitcherDefaults.chevron, open, onOpenChange, children, ...rest }) {
|
|
26
|
+
const rootRef = useRef(null);
|
|
27
|
+
const triggerRef = useRef(null);
|
|
28
|
+
const [held, setHeld] = useState(false);
|
|
29
|
+
const controlled = open !== undefined;
|
|
30
|
+
const expanded = controlled ? open : held;
|
|
31
|
+
const setOpen = useCallback((next) => {
|
|
32
|
+
if (!controlled)
|
|
33
|
+
setHeld(next);
|
|
34
|
+
onOpenChange?.(next);
|
|
35
|
+
}, [controlled, onOpenChange]);
|
|
36
|
+
const inPanel = presentation === 'panel';
|
|
37
|
+
/*
|
|
38
|
+
Opening on hover, in the bar only. There is no hovering a row in a panel read down with a
|
|
39
|
+
finger, and a row that opened as one passed over it would open on the way to the one below.
|
|
40
|
+
*/
|
|
41
|
+
const hover = useHoverOpen(!inPanel, expanded, setOpen);
|
|
42
|
+
/*
|
|
43
|
+
Escape, and a press outside.
|
|
44
|
+
|
|
45
|
+
On the document rather than the root, because both questions are about what happened elsewhere.
|
|
46
|
+
The set holds buttons rather than controls with a prior claim on Escape, so nothing inside it
|
|
47
|
+
wants the key first.
|
|
48
|
+
|
|
49
|
+
The outside press is for the floating form alone: the panel form covers everything a reader
|
|
50
|
+
could press instead, and the only ways out of it are the way back and this key.
|
|
51
|
+
*/
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!expanded)
|
|
54
|
+
return;
|
|
55
|
+
const onKeyDown = (event) => {
|
|
56
|
+
if (event.key !== 'Escape')
|
|
57
|
+
return;
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
hover.release();
|
|
60
|
+
setOpen(false);
|
|
61
|
+
// Back to the trigger. A reader who opened this from the keyboard is otherwise returned to
|
|
62
|
+
// the top of the document.
|
|
63
|
+
triggerRef.current?.focus();
|
|
64
|
+
};
|
|
65
|
+
const onPointerDown = (event) => {
|
|
66
|
+
if (inPanel)
|
|
67
|
+
return;
|
|
68
|
+
const root = rootRef.current;
|
|
69
|
+
if (root === null || root.contains(event.target))
|
|
70
|
+
return;
|
|
71
|
+
hover.release();
|
|
72
|
+
setOpen(false);
|
|
73
|
+
};
|
|
74
|
+
document.addEventListener('keydown', onKeyDown);
|
|
75
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
76
|
+
return () => {
|
|
77
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
78
|
+
document.removeEventListener('pointerdown', onPointerDown);
|
|
79
|
+
};
|
|
80
|
+
}, [expanded, inPanel, setOpen, hover]);
|
|
81
|
+
return (_jsxs("div", { ...rest, ref: rootRef, className: navbarSwitcherParts.root, "data-presentation": presentation, "data-tone": tone, onPointerEnter: hover.onPointerEnter, onPointerLeave: hover.onPointerLeave, children: [_jsxs("button", { ref: triggerRef, type: "button", className: navbarSwitcherParts.trigger, "aria-label": menuLabel, "aria-expanded": expanded, "data-expanded": String(expanded), onClick: () => {
|
|
82
|
+
// The press owns the state from here, or a set the pointer had opened and the reader
|
|
83
|
+
// then pressed shut would close a second time when the pointer left.
|
|
84
|
+
hover.release();
|
|
85
|
+
setOpen(!expanded);
|
|
86
|
+
}, children: [icon !== undefined && icon !== null && (_jsx("span", { className: navbarSwitcherParts.icon, "aria-hidden": "true", children: icon })), label, (inPanel || chevron) && (_jsx("span", { className: navbarSwitcherParts.chevron, "aria-hidden": "true", children: _jsx(Icon, { size: "xs", children: inPanel ? _jsx(ChevronRightRegularIcon, {}) : _jsx(ChevronDownRegularIcon, {}) }) }))] }), expanded && (_jsxs("div", { className: navbarSwitcherParts.surface, children: [_jsx("button", { type: "button", className: navbarSwitcherParts.back, "aria-label": backLabel, onClick: () => {
|
|
87
|
+
setOpen(false);
|
|
88
|
+
triggerRef.current?.focus();
|
|
89
|
+
}, children: _jsx(Icon, { size: "sm", children: _jsx(ChevronLeftRegularIcon, {}) }) }), _jsx("div", { className: navbarSwitcherParts.list, children: children })] }))] }));
|
|
90
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface NavbarSwitcherOwnProps {
|
|
3
|
+
/**
|
|
4
|
+
* `floating` — The switcher is in the bar, which is everywhere a page puts one. The choices hang off the trigger and float over what is beneath
|
|
5
|
+
* `panel` — NavbarPanel is rendering it, and it sets this itself — a page should not. Inside the collapsed panel the choices take the whole surface and offer a way back, because a dropdown inside something already covering the screen is a surface inside a surface
|
|
6
|
+
*/
|
|
7
|
+
presentation?: 'floating' | 'panel';
|
|
8
|
+
/**
|
|
9
|
+
* `default` — The bar has a light ground under it
|
|
10
|
+
* `inverse` — The bar sits on a dark ground and the ink runs light. Only the tints move — the words take the ink around them either way
|
|
11
|
+
*/
|
|
12
|
+
tone?: 'default' | 'inverse';
|
|
13
|
+
/** Always — the choice in force, short enough for a bar. "EN", not "English": a bar is read at a glance and a switcher showing the longest name in the set is a switcher that changes width when somebody picks one */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Always — what the set is, for a reader who meets the trigger without seeing the mark beside it. "Language", "Region". The trigger shows the answer; this says what the question was */
|
|
16
|
+
menuLabel: string;
|
|
17
|
+
/** Always. It names the way out of the page the panel form opens, and a glyph pointing left is not a name. Unused in the floating form, which has no page to leave */
|
|
18
|
+
backLabel: string;
|
|
19
|
+
/** A mark saying which question this answers. Nearly always on a bar, where the label is two letters and the glyph is what makes them mean a language */
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
/** The floating trigger should say it opens. Off by default because a switcher usually sits among destinations that each carry one. The panel form draws one whatever this says — a row in a list has nothing else to go on */
|
|
22
|
+
chevron?: boolean;
|
|
23
|
+
/** A container holds which of several things is open. Standing alone the switcher holds its own */
|
|
24
|
+
open?: boolean;
|
|
25
|
+
/** Whenever open is — together they are how a container holds it */
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
/** Allowed: NavbarSwitcherOption */
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export type NavbarSwitcherProps = NavbarSwitcherOwnProps;
|
|
31
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
32
|
+
export declare const navbarSwitcherParts: {
|
|
33
|
+
readonly root: "dds-navbarswitcher";
|
|
34
|
+
readonly trigger: "dds-navbarswitcher__trigger";
|
|
35
|
+
readonly icon: "dds-navbarswitcher__icon";
|
|
36
|
+
readonly chevron: "dds-navbarswitcher__chevron";
|
|
37
|
+
readonly surface: "dds-navbarswitcher__surface";
|
|
38
|
+
readonly back: "dds-navbarswitcher__back";
|
|
39
|
+
readonly list: "dds-navbarswitcher__list";
|
|
40
|
+
};
|
|
41
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
42
|
+
export declare const navbarSwitcherDefaults: {
|
|
43
|
+
readonly presentation: "floating";
|
|
44
|
+
readonly tone: "default";
|
|
45
|
+
readonly chevron: false;
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// GENERATED from navbar-switcher.contract.json. Do not edit.
|
|
2
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
3
|
+
export const navbarSwitcherParts = {
|
|
4
|
+
root: 'dds-navbarswitcher',
|
|
5
|
+
trigger: 'dds-navbarswitcher__trigger',
|
|
6
|
+
icon: 'dds-navbarswitcher__icon',
|
|
7
|
+
chevron: 'dds-navbarswitcher__chevron',
|
|
8
|
+
surface: 'dds-navbarswitcher__surface',
|
|
9
|
+
back: 'dds-navbarswitcher__back',
|
|
10
|
+
list: 'dds-navbarswitcher__list',
|
|
11
|
+
};
|
|
12
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
13
|
+
export const navbarSwitcherDefaults = { presentation: 'floating', tone: 'default', chevron: false };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Scoped to this package, like the generated sheet beside it.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* Implementation CSS that the contract's staticCss cannot express. */
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Where the floating set hangs, which is three offsets a contract cannot hold: two of them negate
|
|
9
|
+
* the trigger's own box and the third is a percentage of nothing.
|
|
10
|
+
*
|
|
11
|
+
* `inset-block-start: 100%` puts it under the trigger, and the inline half centres it on that
|
|
12
|
+
* trigger — the same way a section's panel is placed, and for the same reason. Hung from either
|
|
13
|
+
* corner, a panel this wide dropped from a two-letter trigger reads as belonging to whatever is
|
|
14
|
+
* beside it rather than to the thing above it; centred, it is obviously the switcher's.
|
|
15
|
+
*
|
|
16
|
+
* `translate` rather than a negative margin: it is the transform property, so it composes with
|
|
17
|
+
* anything else the panel is given instead of fighting a layout value for the same axis. The
|
|
18
|
+
* entrance adds to it rather than replacing it, which is a thing that has already been got wrong
|
|
19
|
+
* once here.
|
|
20
|
+
*
|
|
21
|
+
* Above what it floats over, which is the other thing no contract can hold: an integer with no
|
|
22
|
+
* unit. `layer.popup` is the role for what leaves the flow and floats over the page; it sits below
|
|
23
|
+
* anything that interrupts the reader, so a panel covering the page still covers this.
|
|
24
|
+
*/
|
|
25
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='floating'] .dds-navbarswitcher__surface {
|
|
26
|
+
inset-block-start: 100%;
|
|
27
|
+
inset-inline-start: 50%;
|
|
28
|
+
position: absolute;
|
|
29
|
+
translate: -50%;
|
|
30
|
+
z-index: var(--layer-popup);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* And in the panel it is a page rather than a panel.
|
|
35
|
+
*
|
|
36
|
+
* `position: absolute` with `inset: 0` against NavbarPanel's scrolling body, which declares itself
|
|
37
|
+
* the positioning context for exactly this. So the set covers the destinations and the switchers
|
|
38
|
+
* below them and stops at the header — the mark and the way out stay on screen while a reader is
|
|
39
|
+
* two levels in, which is what the back control is for and what a full-screen takeover would make
|
|
40
|
+
* a lie.
|
|
41
|
+
*
|
|
42
|
+
* It scrolls on its own. Sixteen languages at two columns fits a phone; twenty-six does not, and a
|
|
43
|
+
* set that overflowed a surface with no scroll of its own would simply lose the last of them.
|
|
44
|
+
*/
|
|
45
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='panel'] .dds-navbarswitcher__surface {
|
|
46
|
+
inset: 0;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
position: absolute;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* The row takes the width of the list it is in, and puts its ends at the ends.
|
|
53
|
+
*
|
|
54
|
+
* In a bar the trigger is as wide as its own words, which is what lets it sit among the
|
|
55
|
+
* destinations. In a panel it is a row: the choice at one end, the mark that says it opens at the
|
|
56
|
+
* other, and everything between them pressable — a target that stopped at its text would leave most
|
|
57
|
+
* of the row dead where a reader is already aiming.
|
|
58
|
+
*/
|
|
59
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='panel'] {
|
|
60
|
+
display: flex;
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
And it stops being the box the set is positioned against.
|
|
64
|
+
|
|
65
|
+
`position: relative` on the root is what the floating form hangs from, and in the panel it is
|
|
66
|
+
exactly wrong: `inset: 0` then resolves against the row rather than against the surface the row
|
|
67
|
+
is sitting in, so the set is drawn at the size of its own trigger — two columns of names in a
|
|
68
|
+
forty-pixel box, overlapping the destinations behind them.
|
|
69
|
+
|
|
70
|
+
Static, so the nearest positioned ancestor is NavbarPanel's body, which declares itself the
|
|
71
|
+
context for this and is the thing the set is meant to cover.
|
|
72
|
+
*/
|
|
73
|
+
position: static;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='panel'] .dds-navbarswitcher__trigger {
|
|
77
|
+
inline-size: 100%;
|
|
78
|
+
justify-content: flex-start;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* The choice reads as the mark's own word, and only the chevron goes to the far end.
|
|
83
|
+
*
|
|
84
|
+
* `space-between` was the first arrangement and spread all three: the globe at one edge, the
|
|
85
|
+
* chevron at the other, and "EN" stranded in the middle of the row belonging to neither. What the
|
|
86
|
+
* mark and the choice say is one thing — this is the language, and it is English — so they sit
|
|
87
|
+
* together at the start with the trigger's own gap between them, the way they do in the bar.
|
|
88
|
+
*
|
|
89
|
+
* An auto margin on the chevron takes everything left over, which is what puts it at the end
|
|
90
|
+
* without making the two before it share the row.
|
|
91
|
+
*/
|
|
92
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='panel'] .dds-navbarswitcher__chevron {
|
|
93
|
+
margin-inline-start: auto;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* Two columns in the panel, one in the bar.
|
|
98
|
+
*
|
|
99
|
+
* The bar's set is as wide as its longest word and no wider, where a second column would be two
|
|
100
|
+
* narrow lists side by side. The panel's is a whole screen: sixteen languages down one column is a
|
|
101
|
+
* scroll for something a reader should take in at a glance.
|
|
102
|
+
*
|
|
103
|
+
* `columns` rather than a grid track list, for the reason NavbarMenu's sets use it: a grid aligns
|
|
104
|
+
* its rows, so a short name beside a long one is stretched to the taller of the two and the next
|
|
105
|
+
* pair begins below both. Multi-column packs each column in turn.
|
|
106
|
+
*
|
|
107
|
+
* Not expressible in the contract — a count is an integer with no unit.
|
|
108
|
+
*/
|
|
109
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='panel'] .dds-navbarswitcher__list {
|
|
110
|
+
columns: 2;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* Three in the bar, where the panel is as wide as it declares itself rather than as wide as a
|
|
115
|
+
* phone. Eighteen languages down one column is a list taller than the window it hangs in; across
|
|
116
|
+
* three it is six rows, which is a set a reader takes in rather than scrolls.
|
|
117
|
+
*
|
|
118
|
+
* Two in the panel and three here is not an inconsistency: what changes is the width available, and
|
|
119
|
+
* the count is chosen for the width rather than being a property of the set.
|
|
120
|
+
*/
|
|
121
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='floating'] .dds-navbarswitcher__list {
|
|
122
|
+
columns: 3;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/*
|
|
126
|
+
* The way back sits at the start of its own line, which is where a reader's eye returns to.
|
|
127
|
+
*
|
|
128
|
+
* `align-self: flex-start` rather than a width: the control is a target, and one stretched to the
|
|
129
|
+
* width of the surface would be a strip of nothing that happens to be pressable along its whole
|
|
130
|
+
* length.
|
|
131
|
+
*/
|
|
132
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__back {
|
|
133
|
+
align-self: flex-start;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* A choice must not be broken across the fold of the two columns.
|
|
138
|
+
*
|
|
139
|
+
* Multi-column will split a box between columns given the chance, and a row of one line has nothing
|
|
140
|
+
* to split — until a language's own name wraps, at which point half of it appears at the top of the
|
|
141
|
+
* next column. `break-inside` is what says no; NavbarMenuGroup carries the same rule for the same
|
|
142
|
+
* reason.
|
|
143
|
+
*/
|
|
144
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcheroption {
|
|
145
|
+
break-inside: avoid;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/*
|
|
149
|
+
* And there is nothing to go back to in the bar.
|
|
150
|
+
*
|
|
151
|
+
* The control is rendered at both presentations and drawn at one. `display: none` rather than a
|
|
152
|
+
* gate in the markup, which is the same choice the bars make about their own trigger: a part that
|
|
153
|
+
* disappears from the DOM on an axis value is a part no generated assertion can reach, and this
|
|
154
|
+
* takes it out of the accessibility tree just as surely.
|
|
155
|
+
*/
|
|
156
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher[data-presentation='floating'] .dds-navbarswitcher__back {
|
|
157
|
+
display: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* And whatever the slot was handed fits the measure the row reserved for it.
|
|
162
|
+
*
|
|
163
|
+
* The part carries the size and the part is a wrapper, so on its own it constrains a box around a
|
|
164
|
+
* mark that goes on drawing itself at whatever size it arrived at. Every glyph in the icon package
|
|
165
|
+
* ships `width` and `height` attributes defaulting to twenty-four, and a presentation attribute is
|
|
166
|
+
* exactly what a CSS declaration outranks — which is the finding Button, ButtonIcon and DropdownMenu
|
|
167
|
+
* each record in their own words.
|
|
168
|
+
*
|
|
169
|
+
* `inline-size: auto` against a bound block size keeps the shape rather than squaring it, which
|
|
170
|
+
* matters for the one mark here that is not square.
|
|
171
|
+
*
|
|
172
|
+
* The contract says this slot takes an Icon, and an Icon sizes itself. This is for the bare glyph
|
|
173
|
+
* that arrives anyway: a row whose mark is a third larger than the measure it was given is a
|
|
174
|
+
* mistake worth drawing correctly rather than faithfully.
|
|
175
|
+
*/
|
|
176
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcher .dds-navbarswitcher__icon > * {
|
|
177
|
+
block-size: 100%;
|
|
178
|
+
inline-size: auto;
|
|
179
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* GENERATED from navbarswitcheroption.contract.json. Do not edit. */
|
|
2
|
+
|
|
3
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcheroption {
|
|
4
|
+
align-items: center;
|
|
5
|
+
appearance: none;
|
|
6
|
+
background-color: transparent;
|
|
7
|
+
border-style: none;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
color: inherit;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
display: flex;
|
|
12
|
+
inline-size: 100%;
|
|
13
|
+
outline-style: solid;
|
|
14
|
+
text-align: start;
|
|
15
|
+
border-radius: var(--radius-container-item);
|
|
16
|
+
font-family: var(--font-body-md-family);
|
|
17
|
+
font-size: var(--font-body-md-size);
|
|
18
|
+
font-weight: var(--font-body-md-weight);
|
|
19
|
+
letter-spacing: var(--font-body-md-letter-spacing);
|
|
20
|
+
line-height: var(--font-body-md-line-height);
|
|
21
|
+
min-block-size: var(--size-control-md);
|
|
22
|
+
outline-width: var(--border-width-none);
|
|
23
|
+
padding-block: var(--space-inset-2xs);
|
|
24
|
+
padding-inline: var(--space-inset-sm);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcheroption:hover:where(:not(:disabled)) {
|
|
28
|
+
background-color: var(--color-bg-hover);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcheroption:focus-visible {
|
|
32
|
+
outline-color: var(--color-border-focus);
|
|
33
|
+
outline-width: var(--border-width-focus);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:where([data-dds-context="marketing"]) .dds-navbarswitcheroption[data-current="true"] {
|
|
37
|
+
color: var(--color-fg-brand-accent);
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './NavbarSwitcherOption.css';
|
|
2
|
+
import { type NavbarSwitcherOptionProps } from './NavbarSwitcherOption.types.js';
|
|
3
|
+
export type { NavbarSwitcherOptionProps };
|
|
4
|
+
/**
|
|
5
|
+
* One choice inside a NavbarSwitcher.
|
|
6
|
+
*
|
|
7
|
+
* A `<button>`, not a link. Choosing a language changes how the page a reader is already on is
|
|
8
|
+
* drawn — no navigation, no history entry, nothing for the back button to undo — and a row that
|
|
9
|
+
* claimed to be a link would be wrong to the browser, the back button and every assistive
|
|
10
|
+
* technology at once.
|
|
11
|
+
*
|
|
12
|
+
* It takes the ink around it rather than naming one, except when it is the choice in force. A
|
|
13
|
+
* switcher's options are drawn on whatever surface holds them, and a row that named a colour would
|
|
14
|
+
* be the one thing on that surface not answering to it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function NavbarSwitcherOption({ current, onSelect, children, ...rest }: NavbarSwitcherOptionProps): import("react").JSX.Element;
|