@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,36 @@
|
|
|
1
|
+
import './Navbar.css';
|
|
2
|
+
import './navbar-impl.css';
|
|
3
|
+
import { type NavbarProps } from './Navbar.types.js';
|
|
4
|
+
export type { NavbarProps };
|
|
5
|
+
/**
|
|
6
|
+
* Whether the bar is gathered, given what it was and how far the page has moved.
|
|
7
|
+
*
|
|
8
|
+
* Lifted out of the listener and exported because it is the one part of the scroll behaviour that
|
|
9
|
+
* can be checked without a browser: jsdom has no scrolling, no layout and no pointer, so the hook
|
|
10
|
+
* around this can only be run, not observed. The rule it encodes — that the two thresholds differ,
|
|
11
|
+
* and which way round — is exactly the part that was wrong before and would be wrong again quietly.
|
|
12
|
+
*/
|
|
13
|
+
export declare function gathered(was: boolean, offset: number): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The bar across the top of a marketing page: the mark, the places the site has,
|
|
16
|
+
* and the things a reader reaches for rather than navigates to.
|
|
17
|
+
*
|
|
18
|
+
* It holds no destinations of its own — what goes in it is what the page
|
|
19
|
+
* composes. What this owns is the bar, and running out of room is the whole of
|
|
20
|
+
* its behaviour: below the width its three regions fit in, the destinations and
|
|
21
|
+
* the utilities stop being drawn and the trigger takes their place.
|
|
22
|
+
*
|
|
23
|
+
* Which section is open is the bar's, not each menu's. A menu cannot see its
|
|
24
|
+
* neighbours, so left to themselves two of them open at once and two surfaces
|
|
25
|
+
* overlap in front of the page. Injected the way TabList injects `selected`, and
|
|
26
|
+
* for the same reason.
|
|
27
|
+
*
|
|
28
|
+
* The rail paints nothing and the row inside it is the container a reader sees.
|
|
29
|
+
* That split is why there is no line under the bar: what separates it from the
|
|
30
|
+
* page is a surface of its own with air around it.
|
|
31
|
+
*
|
|
32
|
+
* No `role="banner"`. A `<header>` outside a sectioning element already is that
|
|
33
|
+
* landmark, and writing it as well says so a second time in a way that goes stale
|
|
34
|
+
* if the element is ever nested.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Navbar({ tone, label, menuLabel, closeLabel, brand, utilities, compactAction, preferences, menuOpen, onMenuOpenChange, children, ...rest }: NavbarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLayoutEffect, Children, cloneElement, isValidElement, useCallback, useEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { BarsRegularIcon, XmarkRegularIcon } from '@deriv-com/quill-icons-web';
|
|
5
|
+
import './Navbar.css';
|
|
6
|
+
import './navbar-impl.css';
|
|
7
|
+
import { ButtonIcon } from '../button-icon/ButtonIcon.js';
|
|
8
|
+
import { milliseconds } from '../../css-time.js';
|
|
9
|
+
import { DropdownMenu } from '../dropdown-menu/DropdownMenu.js';
|
|
10
|
+
import { Icon } from '../icon/Icon.js';
|
|
11
|
+
import { NavbarItem } from '../navbar-item/NavbarItem.js';
|
|
12
|
+
import { NavbarMenu } from '../navbar-menu/NavbarMenu.js';
|
|
13
|
+
import { NavbarPanel } from '../navbar-panel/NavbarPanel.js';
|
|
14
|
+
import { NavbarSwitcher } from '../navbar-switcher/NavbarSwitcher.js';
|
|
15
|
+
import { navbarDefaults, navbarParts } from './Navbar.types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Both handlers, the menu's own first.
|
|
18
|
+
*
|
|
19
|
+
* `cloneElement` replaces rather than merges, so a menu already reporting its own
|
|
20
|
+
* state would silently stop — and that is the handler a page is most likely to
|
|
21
|
+
* have written, since it is how they learn which section was opened.
|
|
22
|
+
*/
|
|
23
|
+
function chain(theirs, ours) {
|
|
24
|
+
if (theirs === undefined)
|
|
25
|
+
return ours;
|
|
26
|
+
return (open) => {
|
|
27
|
+
theirs(open);
|
|
28
|
+
ours(open);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether anything beneath the bar has been scrolled.
|
|
33
|
+
*
|
|
34
|
+
* The window is the usual answer and not the only one: a bar inside a box with
|
|
35
|
+
* its own `overflow` — a preview stage, a split layout, an embedded view —
|
|
36
|
+
* travels with that box, and the window beneath it never moves at all. So the
|
|
37
|
+
* question is asked of every ancestor rather than of one guessed node.
|
|
38
|
+
*
|
|
39
|
+
* Listened for in the capture phase on the document, because a scroll event
|
|
40
|
+
* does not bubble: a listener on the window hears the window and nothing else,
|
|
41
|
+
* which is precisely the case that was already broken.
|
|
42
|
+
*
|
|
43
|
+
* Absent outside a browser rather than fatal. The bar renders at rest on a
|
|
44
|
+
* server and in jsdom, which is where the generated behaviour test runs it, and
|
|
45
|
+
* at rest is the correct first frame either way.
|
|
46
|
+
*/
|
|
47
|
+
/** How far the page travels before the bar gathers, and how far back before it lets go. */
|
|
48
|
+
const CONDENSE_AT = 32;
|
|
49
|
+
const RESTORE_AT = 0;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the bar is gathered, given what it was and how far the page has moved.
|
|
52
|
+
*
|
|
53
|
+
* Lifted out of the listener and exported because it is the one part of the scroll behaviour that
|
|
54
|
+
* can be checked without a browser: jsdom has no scrolling, no layout and no pointer, so the hook
|
|
55
|
+
* around this can only be run, not observed. The rule it encodes — that the two thresholds differ,
|
|
56
|
+
* and which way round — is exactly the part that was wrong before and would be wrong again quietly.
|
|
57
|
+
*/
|
|
58
|
+
export function gathered(was, offset) {
|
|
59
|
+
return was ? offset > RESTORE_AT : offset > CONDENSE_AT;
|
|
60
|
+
}
|
|
61
|
+
function useScrolled(root) {
|
|
62
|
+
const [scrolled, setScrolled] = useState(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (typeof window === 'undefined')
|
|
65
|
+
return;
|
|
66
|
+
const read = () => {
|
|
67
|
+
let offset = window.scrollY;
|
|
68
|
+
for (let node = root.current?.parentElement ?? null; node !== null; node = node.parentElement) {
|
|
69
|
+
offset = Math.max(offset, node.scrollTop);
|
|
70
|
+
}
|
|
71
|
+
/*
|
|
72
|
+
Two thresholds, not one. A single boundary at nought meant one pixel of
|
|
73
|
+
travel rearranged the whole bar — and a trackpad resting against the top
|
|
74
|
+
of a page, or a rubber-band easing back, crosses that boundary repeatedly
|
|
75
|
+
in both directions: the bar flickered between its two arrangements while
|
|
76
|
+
the reader was not scrolling at all.
|
|
77
|
+
|
|
78
|
+
Gathering needs a deliberate scroll; returning needs the top of the page.
|
|
79
|
+
The gap between the two is what makes the state sticky in the ordinary
|
|
80
|
+
sense of the word — once it changes, small movements cannot change it
|
|
81
|
+
back.
|
|
82
|
+
*/
|
|
83
|
+
setScrolled((was) => gathered(was, offset));
|
|
84
|
+
};
|
|
85
|
+
// Once before listening. A reader arriving at an anchor deep in the page, or
|
|
86
|
+
// returning to one the browser has restored the scroll position of, is
|
|
87
|
+
// already past the top and never fires a scroll event to say so.
|
|
88
|
+
read();
|
|
89
|
+
// Passive: this only reads, and saying so lets the browser scroll without
|
|
90
|
+
// waiting to find out whether the handler means to cancel it.
|
|
91
|
+
document.addEventListener('scroll', read, { capture: true, passive: true });
|
|
92
|
+
return () => document.removeEventListener('scroll', read, { capture: true });
|
|
93
|
+
}, [root]);
|
|
94
|
+
return scrolled;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A box that comes and goes, by collapsing in place rather than leaving.
|
|
98
|
+
*
|
|
99
|
+
* The bar holds two copies of the mark and two of the actions — one pair at the row's ends, one
|
|
100
|
+
* pair inside the pill — and exactly one of each is showing. What makes the change between them
|
|
101
|
+
* smooth is not how the copies are hidden but that they are hidden *in the flow*: a box whose width
|
|
102
|
+
* travels to nothing takes the row with it, so the pill grows into the space as it is given up and
|
|
103
|
+
* the destinations slide along on their own. Nothing has to be measured afterwards and moved back.
|
|
104
|
+
*
|
|
105
|
+
* Everything this replaces was a workaround for having prevented that. Taking the copies out of the
|
|
106
|
+
* flow stopped the row reflowing, so the pill's growth had to be faked by drawing its shape in, and
|
|
107
|
+
* the words inside it had to be caught mid-jump and played backwards. Three mechanisms, each with
|
|
108
|
+
* its own bugs, standing in for the one the layout does by itself.
|
|
109
|
+
*
|
|
110
|
+
* The width has to be measured because CSS cannot travel between a length and `auto`, and the
|
|
111
|
+
* steady states are `0` and whatever the contents come to. The layout effect runs after React has
|
|
112
|
+
* written the change and before the browser paints it, so the element is already at its new size:
|
|
113
|
+
* expanding, that is the size to arrive at; collapsing, the size to leave from is the one held from
|
|
114
|
+
* last time.
|
|
115
|
+
*
|
|
116
|
+
* The gap goes with it. A flex container puts its gap either side of every item including one that
|
|
117
|
+
* is nought wide, so a collapsed copy would leave the space it used to occupy — the pill would sit
|
|
118
|
+
* a gap wider than its contents at rest. The margin against that gap travels to minus it, on the
|
|
119
|
+
* side the gap is on, which is the end the box is at.
|
|
120
|
+
*
|
|
121
|
+
* `overflow: hidden` only while it runs. Permanently, it would clip a focus ring on the button
|
|
122
|
+
* inside; for the four hundred milliseconds the box is narrower than what it holds, it is the
|
|
123
|
+
* difference between contents that are revealed and contents that spill.
|
|
124
|
+
*/
|
|
125
|
+
function useCollapse(element, collapsed, gapSide) {
|
|
126
|
+
const width = useRef(null);
|
|
127
|
+
const inset = useRef(null);
|
|
128
|
+
const settled = useRef(false);
|
|
129
|
+
const latest = useRef(null);
|
|
130
|
+
useLayoutEffect(() => {
|
|
131
|
+
const node = element.current;
|
|
132
|
+
if (node === null)
|
|
133
|
+
return;
|
|
134
|
+
const measured = node.getBoundingClientRect().width;
|
|
135
|
+
const previous = width.current;
|
|
136
|
+
const held = inset.current;
|
|
137
|
+
if (!collapsed) {
|
|
138
|
+
width.current = measured;
|
|
139
|
+
// Read while it is showing: collapsed, the stylesheet has already taken it to nothing, and a
|
|
140
|
+
// keyframe built from that would travel from nothing to nothing.
|
|
141
|
+
const shown = getComputedStyle(node);
|
|
142
|
+
inset.current = `${shown.paddingInlineStart} ${shown.paddingInlineEnd}`;
|
|
143
|
+
}
|
|
144
|
+
/*
|
|
145
|
+
The first pass is the page arriving, not the bar changing. Without this the copies that are
|
|
146
|
+
showing on load would travel in from nothing, which is an entrance nobody asked for and a
|
|
147
|
+
flash on every render.
|
|
148
|
+
*/
|
|
149
|
+
const first = !settled.current;
|
|
150
|
+
settled.current = true;
|
|
151
|
+
if (first)
|
|
152
|
+
return;
|
|
153
|
+
/*
|
|
154
|
+
And a width to leave from is only needed when leaving. Expanding, the size to arrive at is the
|
|
155
|
+
one just measured — the element is already at it, because CSS has stopped collapsing it and
|
|
156
|
+
the browser has not painted yet.
|
|
157
|
+
|
|
158
|
+
That distinction is the whole of a glitch that showed once per page. The pill's pair is
|
|
159
|
+
collapsed when the bar first renders, so nothing measured it, so the guard that waits for a
|
|
160
|
+
previous width caught them on the first gather and they appeared in one frame while the row's
|
|
161
|
+
pair collapsed smoothly beside them. Only once, and only ever on the way out.
|
|
162
|
+
*/
|
|
163
|
+
if (collapsed && previous === null)
|
|
164
|
+
return;
|
|
165
|
+
/*
|
|
166
|
+
Absent outside a browser that draws: jsdom implements neither, and the generated tests render
|
|
167
|
+
this component. Asking for the feature rather than for an environment.
|
|
168
|
+
*/
|
|
169
|
+
if (typeof window === 'undefined')
|
|
170
|
+
return;
|
|
171
|
+
if (typeof window.matchMedia !== 'function')
|
|
172
|
+
return;
|
|
173
|
+
if (typeof node.animate !== 'function')
|
|
174
|
+
return;
|
|
175
|
+
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches)
|
|
176
|
+
return;
|
|
177
|
+
const style = getComputedStyle(node);
|
|
178
|
+
const duration = milliseconds(style.getPropertyValue('--motion-duration-shift')) ?? 400;
|
|
179
|
+
const easing = style.getPropertyValue('--motion-easing-shift').trim() || 'ease';
|
|
180
|
+
const gap = style.getPropertyValue('--space-gap-md').trim() || '0';
|
|
181
|
+
const margin = gapSide === 'start' ? 'marginInlineStart' : 'marginInlineEnd';
|
|
182
|
+
/*
|
|
183
|
+
The inset travels with the width, because `box-sizing: border-box` will not take a box below
|
|
184
|
+
its own padding: a mark collapsed to nothing still held the twelve pixels it insets itself by,
|
|
185
|
+
and left them standing at the pill's leading edge.
|
|
186
|
+
*/
|
|
187
|
+
const padding = (collapsed ? held : inset.current) ?? '0';
|
|
188
|
+
const open = {
|
|
189
|
+
inlineSize: `${collapsed ? (previous ?? measured) : measured}px`,
|
|
190
|
+
[margin]: '0',
|
|
191
|
+
opacity: 1,
|
|
192
|
+
paddingInline: padding,
|
|
193
|
+
};
|
|
194
|
+
const shut = { inlineSize: '0', [margin]: `calc(${gap} * -1)`, opacity: 0, paddingInline: '0' };
|
|
195
|
+
node.style.overflow = 'hidden';
|
|
196
|
+
/*
|
|
197
|
+
`fill: backwards` is what stops the flicker, and it is one frame long.
|
|
198
|
+
|
|
199
|
+
The effect below runs before the browser paints, but an animation does not take hold until the
|
|
200
|
+
frame after it is started — so for exactly one frame the element is drawn at whatever the
|
|
201
|
+
stylesheet says, which is the state it is travelling *to*. Expanding, that is a mark at full
|
|
202
|
+
width appearing for a frame and then starting again from nothing. Backwards fill applies the
|
|
203
|
+
first keyframe from the moment the animation exists rather than from the moment it starts.
|
|
204
|
+
*/
|
|
205
|
+
const running = node.animate(collapsed ? [open, shut] : [shut, open], {
|
|
206
|
+
duration,
|
|
207
|
+
easing,
|
|
208
|
+
fill: 'backwards',
|
|
209
|
+
});
|
|
210
|
+
/*
|
|
211
|
+
Put the overflow back whether it finished or was cut short — a second scroll cancels the first
|
|
212
|
+
animation, which rejects `finished`, and a box left clipped would clip the focus ring on the
|
|
213
|
+
button inside it for the rest of the session.
|
|
214
|
+
|
|
215
|
+
Only if this is still the animation in force, though. Scrolling up and down quickly starts a
|
|
216
|
+
second before the first has resolved, and the first one's cleanup would otherwise unclip a box
|
|
217
|
+
that the second is still narrowing — which is the content spilling out of it and back in, once
|
|
218
|
+
per change of mind.
|
|
219
|
+
*/
|
|
220
|
+
latest.current = running;
|
|
221
|
+
const restore = () => {
|
|
222
|
+
if (latest.current !== running)
|
|
223
|
+
return;
|
|
224
|
+
node.style.overflow = '';
|
|
225
|
+
};
|
|
226
|
+
running.finished.then(restore).catch(restore);
|
|
227
|
+
}, [element, collapsed, gapSide]);
|
|
228
|
+
}
|
|
229
|
+
/** The two of this package's own components a page is likely to put in a switcher slot. */
|
|
230
|
+
const TONED = [DropdownMenu, ButtonIcon, NavbarSwitcher];
|
|
231
|
+
/**
|
|
232
|
+
* The tone, pressed on a switcher the page passed in.
|
|
233
|
+
*
|
|
234
|
+
* A slot is the page's and this component does not dress what goes in one — that rule is why the
|
|
235
|
+
* mark and the actions are the page's to make legible. This is the exception, and it earns it: what
|
|
236
|
+
* the tone has to answer is the ground *this* component painted, and it changes on scroll, which no
|
|
237
|
+
* page can see without writing a second scroll listener against the bar it is already inside.
|
|
238
|
+
*
|
|
239
|
+
* Matched by type rather than hoped for. Anything else the slot is handed goes through untouched,
|
|
240
|
+
* because pressing the prop on a component that does not declare it would put an unknown attribute
|
|
241
|
+
* on a DOM node, which React says out loud and a reader then has to go and disprove.
|
|
242
|
+
*/
|
|
243
|
+
function toned(node, { tone, openOnHover }) {
|
|
244
|
+
if (!isValidElement(node) || !TONED.includes(node.type))
|
|
245
|
+
return node;
|
|
246
|
+
return cloneElement(node, node.type === DropdownMenu ? { tone, openOnHover } : { tone });
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The bar across the top of a marketing page: the mark, the places the site has,
|
|
250
|
+
* and the things a reader reaches for rather than navigates to.
|
|
251
|
+
*
|
|
252
|
+
* It holds no destinations of its own — what goes in it is what the page
|
|
253
|
+
* composes. What this owns is the bar, and running out of room is the whole of
|
|
254
|
+
* its behaviour: below the width its three regions fit in, the destinations and
|
|
255
|
+
* the utilities stop being drawn and the trigger takes their place.
|
|
256
|
+
*
|
|
257
|
+
* Which section is open is the bar's, not each menu's. A menu cannot see its
|
|
258
|
+
* neighbours, so left to themselves two of them open at once and two surfaces
|
|
259
|
+
* overlap in front of the page. Injected the way TabList injects `selected`, and
|
|
260
|
+
* for the same reason.
|
|
261
|
+
*
|
|
262
|
+
* The rail paints nothing and the row inside it is the container a reader sees.
|
|
263
|
+
* That split is why there is no line under the bar: what separates it from the
|
|
264
|
+
* page is a surface of its own with air around it.
|
|
265
|
+
*
|
|
266
|
+
* No `role="banner"`. A `<header>` outside a sectioning element already is that
|
|
267
|
+
* landmark, and writing it as well says so a second time in a way that goes stale
|
|
268
|
+
* if the element is ever nested.
|
|
269
|
+
*/
|
|
270
|
+
export function Navbar({ tone = navbarDefaults.tone, label, menuLabel, closeLabel, brand, utilities, compactAction, preferences, menuOpen, onMenuOpenChange, children, ...rest }) {
|
|
271
|
+
const rootRef = useRef(null);
|
|
272
|
+
const condensed = useScrolled(rootRef);
|
|
273
|
+
const gathered = condensed ? 'true' : undefined;
|
|
274
|
+
/*
|
|
275
|
+
The tone the bar is actually wearing, which is not always the one it was given.
|
|
276
|
+
|
|
277
|
+
`inverse` describes a ground: it is set because the first section of the page painted itself
|
|
278
|
+
dark and the bar is standing on it. Scrolling takes the bar off that section, so it gathers
|
|
279
|
+
into the same white pill a light bar does — and everything on it has to agree, at once.
|
|
280
|
+
|
|
281
|
+
Derived here rather than in the stylesheet, which is where it was and where it could only ever
|
|
282
|
+
be half a fix. A rule can repaint this component's own parts; it cannot reach the `tone` a
|
|
283
|
+
destination was handed, because that is a prop. So the bar went white while the items on it
|
|
284
|
+
went on tinting their hovers for a dark ground — a hover nobody could see, which is exactly
|
|
285
|
+
what a light-ground hover looks like on light ground.
|
|
286
|
+
|
|
287
|
+
One value, read by the attribute the stylesheet matches and by every child that is told a tone.
|
|
288
|
+
*/
|
|
289
|
+
const worn = condensed ? 'default' : tone;
|
|
290
|
+
const triggerRef = useRef(null);
|
|
291
|
+
/*
|
|
292
|
+
The pill's pair, which is the half of this that JavaScript has to do.
|
|
293
|
+
|
|
294
|
+
The row's pair is a share of the row, so it collapses by taking that share to nothing — a number,
|
|
295
|
+
which CSS can transition, so the stylesheet owns it. These two are sized by what they hold, and
|
|
296
|
+
a width cannot travel between a length and `auto`, so their measure has to be taken. Each
|
|
297
|
+
collapses against the gap on the side it is at: the mark at a leading edge, the actions at a
|
|
298
|
+
trailing one.
|
|
299
|
+
*/
|
|
300
|
+
const pillBrandRef = useRef(null);
|
|
301
|
+
const pillActionsRef = useRef(null);
|
|
302
|
+
useCollapse(pillBrandRef, !condensed, 'end');
|
|
303
|
+
useCollapse(pillActionsRef, !condensed, 'start');
|
|
304
|
+
/*
|
|
305
|
+
Controlled when told, its own answer otherwise. A private copy alongside a
|
|
306
|
+
passed one would be two answers to a question with one truth, and would show
|
|
307
|
+
the stale one for a frame the first time a page set it from anywhere else.
|
|
308
|
+
*/
|
|
309
|
+
const [held, setHeld] = useState(false);
|
|
310
|
+
const controlled = menuOpen !== undefined;
|
|
311
|
+
const open = controlled ? menuOpen : held;
|
|
312
|
+
const setOpen = useCallback((next) => {
|
|
313
|
+
if (!controlled)
|
|
314
|
+
setHeld(next);
|
|
315
|
+
onMenuOpenChange?.(next);
|
|
316
|
+
}, [controlled, onMenuOpenChange]);
|
|
317
|
+
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
318
|
+
// Which section is showing, by position in the row. Positions rather than
|
|
319
|
+
// labels: two sections can share a name in a way nothing here should have an
|
|
320
|
+
// opinion about, and an index is stable for as long as the row is.
|
|
321
|
+
const [section, setSection] = useState(null);
|
|
322
|
+
/*
|
|
323
|
+
Which section was open before this render, so a menu can be told whether it is arriving or
|
|
324
|
+
taking another's place. Written in an effect rather than during render, so what it holds is the
|
|
325
|
+
value the last committed render was drawn with — which is exactly the question being asked.
|
|
326
|
+
*/
|
|
327
|
+
const previous = useRef(null);
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
previous.current = section;
|
|
330
|
+
}, [section]);
|
|
331
|
+
const items = Children.toArray(children);
|
|
332
|
+
const governed = items.map((child, index) => {
|
|
333
|
+
if (!isValidElement(child) || child.type !== NavbarMenu) {
|
|
334
|
+
// A destination takes the tone as well. It is not governed — nothing about it
|
|
335
|
+
// opens — so it is cloned for this alone rather than passed through untouched.
|
|
336
|
+
return isValidElement(child) && child.type === NavbarItem
|
|
337
|
+
? cloneElement(child, { tone: worn })
|
|
338
|
+
: child;
|
|
339
|
+
}
|
|
340
|
+
return cloneElement(child, {
|
|
341
|
+
/*
|
|
342
|
+
The tone travels with the open state, and for the same reason: a row
|
|
343
|
+
where one trigger is inverse and its neighbours are not is a row whose
|
|
344
|
+
hovers half disappear. The bar is the only thing that knows what it is
|
|
345
|
+
standing on, so it tells them rather than asking the page to tell each.
|
|
346
|
+
*/
|
|
347
|
+
tone: worn,
|
|
348
|
+
open: section === index,
|
|
349
|
+
replacing: section === index && previous.current !== null && previous.current !== index,
|
|
350
|
+
onOpenChange: chain(child.props.onOpenChange, (next) => {
|
|
351
|
+
setSection(next ? index : null);
|
|
352
|
+
}),
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
return (_jsxs("header", { ...rest, ref: rootRef, className: navbarParts.root, "data-tone": worn, "data-condensed": gathered, "data-dds-pinned-surface": open ? 'open' : undefined, children: [_jsxs("div", { className: navbarParts.inner, "data-condensed": gathered, children: [_jsx("div", { className: navbarParts.ground, "data-condensed": gathered }), brand !== undefined && brand !== null && (_jsx("div", { className: navbarParts.brand, "data-condensed": gathered, children: brand })), _jsxs("div", { className: navbarParts.cluster, "data-condensed": gathered, children: [brand !== undefined && brand !== null && (_jsx("div", { ref: pillBrandRef, className: navbarParts.brand, children: brand })), _jsx("nav", { className: navbarParts.nav, "aria-label": label, children: governed }), preferences !== undefined && preferences !== null && (_jsx("div", { className: navbarParts.preferences, children: toned(preferences, { tone: worn, openOnHover: true }) })), utilities !== undefined && utilities !== null && (_jsx("div", { ref: pillActionsRef, className: navbarParts.utilities, children: utilities }))] }), utilities !== undefined && utilities !== null && (_jsx("div", { className: navbarParts.utilities, "data-condensed": gathered, children: utilities })), compactAction !== undefined && compactAction !== null && (_jsx("div", { className: navbarParts['compact-action'], children: compactAction })), _jsx("button", { ref: triggerRef, type: "button", className: navbarParts.trigger, "aria-label": menuLabel, "aria-expanded": open, onClick: () => setOpen(!open), children: _jsx(Icon, { size: "md", children: open ? _jsx(XmarkRegularIcon, {}) : _jsx(BarsRegularIcon, {}) }) })] }), open && (_jsx("div", { className: navbarParts['panel-host'], children: _jsx(NavbarPanel, { label: label, closeLabel: closeLabel, onClose: close, brand: brand,
|
|
356
|
+
/*
|
|
357
|
+
Both, because the pill they were drawn in is not drawn at this width and
|
|
358
|
+
the foot is where everything that was in the bar has gone. What a reader
|
|
359
|
+
sets comes first: the actions are the last thing the panel offers, and a
|
|
360
|
+
switcher underneath them would be a preference hidden below a conversion.
|
|
361
|
+
*/
|
|
362
|
+
/*
|
|
363
|
+
At the panel's tone, not the bar's. The panel is paper whatever the bar is standing
|
|
364
|
+
on, and this is the same element drawn in the pill — told `inverse` there and wrong
|
|
365
|
+
here, where a hover tinted for a dark ground lands on white and disappears.
|
|
366
|
+
|
|
367
|
+
And not told to open on hover: in a panel a switcher is a row read down with a
|
|
368
|
+
finger, and the panel is the thing that turns it into one.
|
|
369
|
+
*/
|
|
370
|
+
preferences: toned(preferences, { tone: 'default' }), footer: utilities, openerRef: triggerRef, children: children }) }))] }));
|
|
371
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface NavbarOwnProps {
|
|
3
|
+
/**
|
|
4
|
+
* `default` — The page begins on a light ground, which is most marketing pages. The bar paints in ink and the pill is paper
|
|
5
|
+
* `inverse` — The first section of the page paints its own dark ground and the bar stands on it — a dark hero, a photograph, a brand-coloured takeover. The bar's ink runs light, the pill becomes a veil of white rather than a sheet of it, and the collapsed bar takes a solid dark ground of its own
|
|
6
|
+
*/
|
|
7
|
+
tone?: 'default' | 'inverse';
|
|
8
|
+
/** Always — it names the navigation landmark, and a page with an unnamed one tells a screen-reader user there is navigation here without saying which navigation. Name the set rather than the act: 'Main', not 'Main navigation' — the role already supplies the word, and a name carrying it is announced as 'main navigation navigation' */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Always — the trigger is an icon-only button and this is the only name it has, at the width where it is the only way through the site. Name what it reveals rather than its state: 'Menu', not 'Open menu', because aria-expanded already says which way it is and a name that also said so would contradict itself every other press */
|
|
11
|
+
menuLabel: string;
|
|
12
|
+
/** Always — it names the panel's close button, which is the only visible way out of a surface covering the whole page. 'Close' is enough; the panel it closes is the only thing open */
|
|
13
|
+
closeLabel: string;
|
|
14
|
+
/** Effectively always on a real site — the mark, and usually an anchor to the home page wrapped around it. It is drawn twice: in the bar, and again in the panel's header, where it is the only thing left saying whose site this is */
|
|
15
|
+
brand?: ReactNode;
|
|
16
|
+
/** The bar's trailing end has something in it — a language switcher, a theme switcher, a conversion action, or some combination. A switcher is a DropdownMenu with the current choice on its trigger, which is what DropdownMenu's own guidance describes and why it is accepted here alongside the two controls. They are drawn in the row at wide widths and across the foot of the panel once it collapses */
|
|
17
|
+
utilities?: ReactNode;
|
|
18
|
+
/** The one thing a reader should still be able to do once the bar has collapsed and everything else has gone into the panel — a sign-up, usually. Drawn beside the control that opens the panel, and only at the widths where that control is drawn */
|
|
19
|
+
compactAction?: ReactNode;
|
|
20
|
+
/** A switcher that belongs with the destinations rather than with the conversion — a language picker, a theme toggle. It is drawn inside the pill, beside the sections, at every scroll position. A NavbarSwitcher is the one built for it: in the pill it is a trigger and a menu, and in the collapsed panel the same element becomes a row that opens a page of its own with a way back, because a dropdown inside a surface already covering the screen is a surface inside a surface */
|
|
21
|
+
preferences?: ReactNode;
|
|
22
|
+
/** The page is holding whether the panel is open, because something else depends on it — a route change that should close it, a surface of its own that must not open at the same time. Passing it makes the bar controlled: it shows what it is told and reports presses through onMenuOpenChange.
|
|
23
|
+
|
|
24
|
+
Leave it off and the bar holds its own answer, which is the ordinary case: a narrow-width navigation panel is opened and closed by the reader and by nothing else */
|
|
25
|
+
menuOpen?: boolean;
|
|
26
|
+
/** Whenever menuOpen is — together they are how a page holds the panel. It is called with the state being moved to, by the trigger, by the close button and by Escape, so a page listening to it hears every way the panel can change */
|
|
27
|
+
onMenuOpenChange?: (open: boolean) => void;
|
|
28
|
+
/** Allowed: NavbarItem, NavbarMenu */
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export type NavbarProps = NavbarOwnProps & Omit<HTMLAttributes<HTMLElement>, 'className' | 'tone' | 'label' | 'menuLabel' | 'closeLabel' | 'brand' | 'utilities' | 'compactAction' | 'preferences' | 'menuOpen' | 'onMenuOpenChange'>;
|
|
32
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
33
|
+
export declare const navbarParts: {
|
|
34
|
+
readonly root: "dds-navbar";
|
|
35
|
+
readonly inner: "dds-navbar__inner";
|
|
36
|
+
readonly ground: "dds-navbar__ground";
|
|
37
|
+
readonly brand: "dds-navbar__brand";
|
|
38
|
+
readonly nav: "dds-navbar__nav";
|
|
39
|
+
readonly preferences: "dds-navbar__preferences";
|
|
40
|
+
readonly utilities: "dds-navbar__utilities";
|
|
41
|
+
readonly 'compact-action': "dds-navbar__compact-action";
|
|
42
|
+
readonly trigger: "dds-navbar__trigger";
|
|
43
|
+
readonly 'panel-host': "dds-navbar__panel-host";
|
|
44
|
+
readonly cluster: "dds-navbar__cluster";
|
|
45
|
+
};
|
|
46
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
47
|
+
export declare const navbarDefaults: {
|
|
48
|
+
readonly tone: "default";
|
|
49
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// GENERATED from navbar.contract.json. Do not edit.
|
|
2
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
3
|
+
export const navbarParts = {
|
|
4
|
+
root: 'dds-navbar',
|
|
5
|
+
inner: 'dds-navbar__inner',
|
|
6
|
+
ground: 'dds-navbar__ground',
|
|
7
|
+
brand: 'dds-navbar__brand',
|
|
8
|
+
nav: 'dds-navbar__nav',
|
|
9
|
+
preferences: 'dds-navbar__preferences',
|
|
10
|
+
utilities: 'dds-navbar__utilities',
|
|
11
|
+
'compact-action': 'dds-navbar__compact-action',
|
|
12
|
+
trigger: 'dds-navbar__trigger',
|
|
13
|
+
'panel-host': 'dds-navbar__panel-host',
|
|
14
|
+
cluster: 'dds-navbar__cluster',
|
|
15
|
+
};
|
|
16
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
17
|
+
export const navbarDefaults = { tone: 'default' };
|