@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,309 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDownRegularIcon } from '@deriv-com/quill-icons-web';
|
|
4
|
+
import { Children, cloneElement, isValidElement, useEffect, useId, useRef, useState } from 'react';
|
|
5
|
+
import './DropdownMenu.css';
|
|
6
|
+
// Second, and it adds rather than corrects: the arrival, which a binding cannot express.
|
|
7
|
+
import './dropdown-menu-impl.css';
|
|
8
|
+
import { useHoverOpen } from '../../hover-open.js';
|
|
9
|
+
import { dropdownMenuDefaults, dropdownMenuParts } from './DropdownMenu.types.js';
|
|
10
|
+
/**
|
|
11
|
+
* A button that opens a short set of destinations.
|
|
12
|
+
*
|
|
13
|
+
* It is the host MenuItem was written against: a row whose role is `menuitem` announces wrong
|
|
14
|
+
* outside an element whose role is `menu`, so what this adds is everything a row cannot know about
|
|
15
|
+
* itself — that there is a set, how long it is, which one the visitor is on, and that Escape puts
|
|
16
|
+
* them back on the button they pressed.
|
|
17
|
+
*
|
|
18
|
+
* The trigger is drawn here rather than passed in, which is where this parts company with product's
|
|
19
|
+
* menu of the same name. That is forced rather than chosen: this package's Button is an anchor with
|
|
20
|
+
* a required `href`, so it is a link and a link that opens a menu does not navigate; ButtonIcon is a
|
|
21
|
+
* real button and takes no words. A set of destinations is chosen by reading it, so the trigger
|
|
22
|
+
* needs words, and nothing here draws a button with words.
|
|
23
|
+
*
|
|
24
|
+
* Focus moves to the rows themselves rather than being described from the trigger. A menu's rows are
|
|
25
|
+
* things to take, and a visitor pressing Enter should be pressing the thing they are on.
|
|
26
|
+
*/
|
|
27
|
+
export function DropdownMenu(props) {
|
|
28
|
+
const { size = dropdownMenuDefaults.size, label, icon, trigger, variant = dropdownMenuDefaults.variant, tone = dropdownMenuDefaults.tone, chevron = dropdownMenuDefaults.chevron, openOnHover = dropdownMenuDefaults.openOnHover, alignment = dropdownMenuDefaults.alignment, open, defaultOpen, onOpenChange, children, ...rest } = props;
|
|
29
|
+
// One id, two names derived from it — the shape product's menu uses. Two `useId` calls would
|
|
30
|
+
// work and mint two unrelated bases for a pair that belongs together.
|
|
31
|
+
const generated = useId();
|
|
32
|
+
const menuId = `${generated}-menu`;
|
|
33
|
+
const triggerId = `${generated}-trigger`;
|
|
34
|
+
const root = useRef(null);
|
|
35
|
+
/*
|
|
36
|
+
The trigger is held rather than looked up, which is the one place this is simpler than
|
|
37
|
+
product's. There the button is somebody else's element, so it has to be found in the DOM
|
|
38
|
+
afterwards — and `useId` returns a string a CSS selector cannot hold, so finding it by its own
|
|
39
|
+
id threw and took a whole page blank. Drawing the button means having it, and the id is left to
|
|
40
|
+
do the one job an id can always do: being pointed at by `aria-labelledby`.
|
|
41
|
+
*/
|
|
42
|
+
const triggerEl = useRef(null);
|
|
43
|
+
/*
|
|
44
|
+
What the passed trigger already carried, so this component can add to it rather than write over
|
|
45
|
+
it. Read here rather than inline, because `trigger` is typed as a node and narrowing it twice at
|
|
46
|
+
the call site reads as two different questions being asked.
|
|
47
|
+
*/
|
|
48
|
+
const triggerProps = (isValidElement(trigger) ? trigger.props : {});
|
|
49
|
+
const driven = 'open' in props;
|
|
50
|
+
const [showing, setShowing] = useState(defaultOpen ?? false);
|
|
51
|
+
const expanded = driven ? (open ?? false) : showing;
|
|
52
|
+
/**
|
|
53
|
+
* Which row focus is on, as an index into the ones that can be used.
|
|
54
|
+
*
|
|
55
|
+
* Held rather than read off the document, because it has to be known *before* the row exists: a
|
|
56
|
+
* menu opened with ArrowUp starts on the last destination, and the surface is not in the DOM
|
|
57
|
+
* until the render that opens it. So the index is set with the opening and the effect below puts
|
|
58
|
+
* focus where it says.
|
|
59
|
+
*/
|
|
60
|
+
const [at, setAt] = useState(0);
|
|
61
|
+
const rows = Children.toArray(children).filter((child) => isValidElement(child));
|
|
62
|
+
/**
|
|
63
|
+
* The rows a visitor can actually reach.
|
|
64
|
+
*
|
|
65
|
+
* A disabled one stays in the menu and is announced as unavailable — a set that changes shape
|
|
66
|
+
* between openings is one a visitor has to learn twice — but the arrow keys step over it, because
|
|
67
|
+
* stopping on a row that does nothing is a keystroke that reports nothing happened.
|
|
68
|
+
*/
|
|
69
|
+
const reachable = rows
|
|
70
|
+
.map((row, index) => ({ row, index }))
|
|
71
|
+
.filter(({ row }) => row.props.disabled !== true);
|
|
72
|
+
const setOpen = (next) => {
|
|
73
|
+
if (!driven)
|
|
74
|
+
setShowing(next);
|
|
75
|
+
onOpenChange?.(next);
|
|
76
|
+
};
|
|
77
|
+
/*
|
|
78
|
+
And the pointer, where the page asked for it. The behaviour is shared with NavbarMenu rather
|
|
79
|
+
than written twice: what is subtle about it — that a tap is not a hover, that only what hover
|
|
80
|
+
opened may be closed by hover, and that an armed close must be dropped the moment something
|
|
81
|
+
else shuts the menu — is subtle in both, and two copies would be two places to get it wrong.
|
|
82
|
+
*/
|
|
83
|
+
const hover = useHoverOpen(openOnHover, expanded, setOpen);
|
|
84
|
+
/**
|
|
85
|
+
* Shutting, and giving focus back to where the visitor was.
|
|
86
|
+
*
|
|
87
|
+
* A menu that shuts and leaves focus where the surface was drops a keyboard visitor at the top of
|
|
88
|
+
* the document, several tabs from the button they pressed. `focus()` on the trigger is the whole
|
|
89
|
+
* of the fix and the thing most menus forget.
|
|
90
|
+
*/
|
|
91
|
+
const shut = (returnFocus = true) => {
|
|
92
|
+
setOpen(false);
|
|
93
|
+
if (returnFocus)
|
|
94
|
+
triggerEl.current?.focus();
|
|
95
|
+
};
|
|
96
|
+
const run = (index) => {
|
|
97
|
+
// Shut first, then run. A destination that closed its own menu would be one every page closed
|
|
98
|
+
// differently — and running first means a handler that moves focus fights this one for it.
|
|
99
|
+
shut();
|
|
100
|
+
const row = rows[index];
|
|
101
|
+
if (row?.props.disabled !== true) {
|
|
102
|
+
const onSelect = row?.props?.onSelect;
|
|
103
|
+
onSelect?.();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* What the last render was, so focus moves on a change rather than on every render.
|
|
108
|
+
*
|
|
109
|
+
* Initialised to the first render's own values, which is what keeps a menu that opens *already*
|
|
110
|
+
* open from taking focus. `defaultOpen` is for a specimen — a documentation page, the preview's
|
|
111
|
+
* own stage — and a specimen that grabs focus on mount is worse than it sounds: the browser
|
|
112
|
+
* scrolls whatever gains focus into view, so a page of open menus ends up scrolled to the last of
|
|
113
|
+
* them with nothing having thrown.
|
|
114
|
+
*/
|
|
115
|
+
const before = useRef({ expanded, at });
|
|
116
|
+
/**
|
|
117
|
+
* Focus follows the index, once the row it names exists.
|
|
118
|
+
*
|
|
119
|
+
* No dependency array: the rows arrive and leave with the menu, so the effect has to run on the
|
|
120
|
+
* render that changed either the index or whether there is a menu at all — and the comparison
|
|
121
|
+
* above is what tells those renders from the rest.
|
|
122
|
+
*/
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const changed = before.current.expanded !== expanded || before.current.at !== at;
|
|
125
|
+
before.current = { expanded, at };
|
|
126
|
+
if (!expanded || !changed)
|
|
127
|
+
return;
|
|
128
|
+
const items = root.current?.querySelectorAll('[role="menuitem"]');
|
|
129
|
+
items?.[at]?.focus();
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* Shutting on a press elsewhere.
|
|
133
|
+
*
|
|
134
|
+
* `pointerdown` rather than `click`, so the menu is gone before whatever was underneath it has
|
|
135
|
+
* moved. Without returning focus: the visitor has pressed something else, and putting focus back
|
|
136
|
+
* on the trigger would take it from whatever they pressed.
|
|
137
|
+
*/
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!expanded)
|
|
140
|
+
return;
|
|
141
|
+
const onPointerDown = (event) => {
|
|
142
|
+
if (root.current?.contains(event.target) === true)
|
|
143
|
+
return;
|
|
144
|
+
shut(false);
|
|
145
|
+
};
|
|
146
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
147
|
+
return () => document.removeEventListener('pointerdown', onPointerDown);
|
|
148
|
+
});
|
|
149
|
+
const step = (by) => {
|
|
150
|
+
if (reachable.length === 0)
|
|
151
|
+
return;
|
|
152
|
+
const here = reachable.findIndex(({ index }) => index === at);
|
|
153
|
+
const next = (here + by + reachable.length) % reachable.length;
|
|
154
|
+
setAt(reachable[next].index);
|
|
155
|
+
};
|
|
156
|
+
const onTriggerKeyDown = (event) => {
|
|
157
|
+
const key = event.key;
|
|
158
|
+
if (key === 'ArrowDown' || key === 'Enter' || key === ' ') {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
setAt(reachable[0]?.index ?? 0);
|
|
161
|
+
setOpen(true);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
// Opening at the end, for a visitor reaching for the thing at the bottom.
|
|
165
|
+
if (key === 'ArrowUp') {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
setAt(reachable[reachable.length - 1]?.index ?? 0);
|
|
168
|
+
setOpen(true);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const onMenuKeyDown = (event) => {
|
|
172
|
+
const key = event.key;
|
|
173
|
+
if (key === 'ArrowDown') {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
step(1);
|
|
176
|
+
}
|
|
177
|
+
else if (key === 'ArrowUp') {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
step(-1);
|
|
180
|
+
}
|
|
181
|
+
else if (key === 'Home') {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
setAt(reachable[0]?.index ?? 0);
|
|
184
|
+
}
|
|
185
|
+
else if (key === 'End') {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
setAt(reachable[reachable.length - 1]?.index ?? 0);
|
|
188
|
+
}
|
|
189
|
+
else if (key === 'Enter' || key === ' ') {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
run(at);
|
|
192
|
+
}
|
|
193
|
+
else if (key === 'Escape') {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
shut();
|
|
196
|
+
}
|
|
197
|
+
else if (key === 'Tab') {
|
|
198
|
+
// Not prevented: the visitor asked to leave, and taking Tab would trap them in a menu. It
|
|
199
|
+
// shuts and lets the browser move on from the trigger, which is where focus goes back to.
|
|
200
|
+
shut();
|
|
201
|
+
}
|
|
202
|
+
else if (key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
203
|
+
// A letter jumps to the next destination beginning with it, for a set read by eye and reached
|
|
204
|
+
// by hand. From the one after the current row, so pressing the same letter walks the matches.
|
|
205
|
+
const from = reachable.findIndex(({ index }) => index === at);
|
|
206
|
+
const found = [...reachable.slice(from + 1), ...reachable.slice(0, from + 1)].find(({ row }) => String(row.props.children ?? '')
|
|
207
|
+
.trim()
|
|
208
|
+
.toLowerCase()
|
|
209
|
+
.startsWith(key.toLowerCase()));
|
|
210
|
+
if (found !== undefined)
|
|
211
|
+
setAt(found.index);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
/*
|
|
215
|
+
The consumer's mark, cloned rather than wrapped.
|
|
216
|
+
|
|
217
|
+
The class has to reach the `<svg>` itself: every glyph in the icon package ships `width` and
|
|
218
|
+
`height` attributes defaulting to 24, and the only thing that overrides a presentation attribute
|
|
219
|
+
is a CSS length on the element carrying it. A box around it would keep its own measure and leave
|
|
220
|
+
the mark at whatever size it was imported at — the finding Button and ButtonIcon both record.
|
|
221
|
+
|
|
222
|
+
The span is for anything that cannot be cloned. The preview hands every node slot a sample
|
|
223
|
+
string, and a class has to land on something or the part is not findable.
|
|
224
|
+
*/
|
|
225
|
+
const mark = icon === undefined || icon === null ? null : isValidElement(icon) ? (cloneElement(icon, {
|
|
226
|
+
className: [dropdownMenuParts.icon, icon.props.className].filter(Boolean).join(' '),
|
|
227
|
+
'aria-hidden': 'true',
|
|
228
|
+
})) : (_jsx("span", { className: dropdownMenuParts.icon, "aria-hidden": "true", children: icon }));
|
|
229
|
+
return (_jsxs("div", { className: dropdownMenuParts.root, "data-variant": variant, "data-tone": tone, "data-size": size, "data-alignment": alignment, ref: root, ...rest, onPointerEnter: (event) => {
|
|
230
|
+
rest.onPointerEnter?.(event);
|
|
231
|
+
hover.onPointerEnter(event);
|
|
232
|
+
}, onPointerLeave: (event) => {
|
|
233
|
+
rest.onPointerLeave?.(event);
|
|
234
|
+
hover.onPointerLeave(event);
|
|
235
|
+
}, children: [!isValidElement(trigger) ? (_jsxs("button", { type: "button",
|
|
236
|
+
/*
|
|
237
|
+
`type` above the element's own default of submit, which is what a language picker dropped
|
|
238
|
+
into a newsletter band would otherwise do on the way to opening.
|
|
239
|
+
*/
|
|
240
|
+
ref: triggerEl, id: triggerId, className: dropdownMenuParts.trigger, "aria-haspopup": "menu", "aria-expanded": expanded, "aria-controls": expanded ? menuId : undefined, onClick: () => {
|
|
241
|
+
if (expanded)
|
|
242
|
+
shut(false);
|
|
243
|
+
else {
|
|
244
|
+
setAt(reachable[0]?.index ?? 0);
|
|
245
|
+
setOpen(true);
|
|
246
|
+
}
|
|
247
|
+
}, onKeyDown: onTriggerKeyDown, children: [mark, _jsx("span", { className: dropdownMenuParts.label, children: label }), chevron && (_jsx(ChevronDownRegularIcon, { className: dropdownMenuParts.chevron, style: expanded ? { rotate: '180deg' } : undefined, "aria-hidden": "true" }))] })) : (
|
|
248
|
+
/*
|
|
249
|
+
The trigger somebody else drew, wired rather than replaced.
|
|
250
|
+
|
|
251
|
+
Everything below is what this component knows and the page cannot: that the control
|
|
252
|
+
announces a menu, whether that menu is open, which element it is, and that Escape and the
|
|
253
|
+
arrow keys reach the rows. The element itself — what it is, what it looks like, whether it
|
|
254
|
+
is a button at all — stays the caller's.
|
|
255
|
+
|
|
256
|
+
No chevron goes into it. Product injects one, having a Button with a trailing slot to put
|
|
257
|
+
it in; nothing here has that slot, and the case this arrived for is an icon-only control
|
|
258
|
+
that product's own guidance says should not carry one anyway. A passed trigger is drawn by
|
|
259
|
+
whoever passed it, chevron included if they want one.
|
|
260
|
+
*/
|
|
261
|
+
cloneElement(trigger, {
|
|
262
|
+
ref: triggerEl,
|
|
263
|
+
// The caller's id where they set one, so an aria-describedby or a label elsewhere on the
|
|
264
|
+
// page still points at something. Only the fallback is ours, and the surface is named by
|
|
265
|
+
// whichever it turns out to be.
|
|
266
|
+
id: triggerProps.id ?? triggerId,
|
|
267
|
+
'aria-haspopup': 'menu',
|
|
268
|
+
'aria-expanded': expanded,
|
|
269
|
+
'aria-controls': expanded ? menuId : undefined,
|
|
270
|
+
// Composed rather than replaced. A trigger that came with an analytics handler or a
|
|
271
|
+
// keyboard shortcut of its own keeps it: this component adds what only it knows — that a
|
|
272
|
+
// menu exists and whether it is open — and takes nothing away.
|
|
273
|
+
onClick: (event) => {
|
|
274
|
+
triggerProps.onClick?.(event);
|
|
275
|
+
if (event.defaultPrevented)
|
|
276
|
+
return;
|
|
277
|
+
if (expanded)
|
|
278
|
+
shut(false);
|
|
279
|
+
else {
|
|
280
|
+
setAt(reachable[0]?.index ?? 0);
|
|
281
|
+
setOpen(true);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
onKeyDown: (event) => {
|
|
285
|
+
triggerProps.onKeyDown?.(event);
|
|
286
|
+
if (event.defaultPrevented)
|
|
287
|
+
return;
|
|
288
|
+
onTriggerKeyDown(event);
|
|
289
|
+
},
|
|
290
|
+
})), expanded ? (_jsx("ul", { className: dropdownMenuParts.surface, id: menuId, role: "menu", "aria-labelledby": triggerProps.id ?? triggerId, onKeyDown: onMenuKeyDown, children: rows.map((row, index) => cloneElement(row, {
|
|
291
|
+
key: index,
|
|
292
|
+
/*
|
|
293
|
+
The menu sizes its rows, which is the only way a set stays one set. MenuItem takes
|
|
294
|
+
the axis and never sets it: a row written on its own cannot know what the rest of
|
|
295
|
+
the set is doing, and a menu whose rows disagree reads as two groups rather than one
|
|
296
|
+
list. Passed after the row's own props for that reason — this is not a default the
|
|
297
|
+
call site may override.
|
|
298
|
+
*/
|
|
299
|
+
size,
|
|
300
|
+
/*
|
|
301
|
+
Its `onSelect` rather than its `onClick`. A cloned `onClick` would run *beside* the
|
|
302
|
+
row's own handler rather than instead of it — the row calls whatever onClick it was
|
|
303
|
+
given and then calls its own onSelect, so the destination ran twice on one press,
|
|
304
|
+
and it ran ahead of the row's disabled guard. Taking over onSelect puts this behind
|
|
305
|
+
that guard and in place of the original, which `run` then calls itself.
|
|
306
|
+
*/
|
|
307
|
+
onSelect: () => run(index),
|
|
308
|
+
})) })) : null] }));
|
|
309
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface DropdownMenuOwnProps {
|
|
3
|
+
/**
|
|
4
|
+
* `outlined` — The control stands on its own — a switcher in a toolbar, a filter above a table, anywhere a reader has to find it before they can use it. The edge is what says there is something here to press
|
|
5
|
+
* `plain` — The control sits among others that have already said what they are — a locale beside a row of sections in a navigation bar, where every neighbour is words and a mark and an edge around one of them would make it the loudest thing in the set. It keeps the target, the ground it takes under a pointer and the ring it takes under focus, and gives up only the edge
|
|
6
|
+
*/
|
|
7
|
+
variant?: 'outlined' | 'plain';
|
|
8
|
+
/**
|
|
9
|
+
* `sm` — Beside body copy rather than above it — a language picker in a navigation bar or a footer, where the trigger is one item in a row of links and should not outweigh them
|
|
10
|
+
* `md` — The default, and nearly every other page. The same height as a default Button, so the two line up when they sit in the same band
|
|
11
|
+
*/
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
/**
|
|
14
|
+
* `start` — The menu's leading edge lines up with the trigger's. The default, because a visitor reads from that edge and the destinations begin where the button's own words began
|
|
15
|
+
* `end` — Its trailing edge lines up instead, which is what a trigger near the end of a row needs — a footer's language picker aligned to the start would run off the screen
|
|
16
|
+
*/
|
|
17
|
+
alignment?: 'start' | 'end';
|
|
18
|
+
/**
|
|
19
|
+
* `default` — The control is on a light ground, which is every surface this package paints by default
|
|
20
|
+
* `inverse` — The control is on a ground that runs against the mode — a navigation bar standing on a dark hero. Only the tints move: the ink is the surrounding ink already under `variant="plain"`, and the words and the mark were never this component's to colour. NavbarItem and NavbarMenu take the same tone for the same reason, and a switcher among them that did not would be the one item in the row whose hover disappeared
|
|
21
|
+
*/
|
|
22
|
+
tone?: 'default' | 'inverse';
|
|
23
|
+
/** Always — the words on the trigger, and the whole of what a visitor has to go on before they press it. "Language", "Region", "More pages". Required because a trigger drawn by this component has no children to fall back on, and a menu button reading nothing is a menu nobody opens.
|
|
24
|
+
|
|
25
|
+
It names the menu as well as the button. The surface points at the trigger for its own accessible name rather than taking a second string, so the two cannot drift — product needs a separate one only because its trigger is opaque to it, and this one is not. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** A mark before the trigger's words, where the set is read by shape as much as by reading — a globe beside "Language", a flag beside the region a visitor is already in */
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
/** A chevron in the trigger, pointing down while the menu is shut and up while it is open. On by default because it is the visual form of aria-expanded — the same fact the attribute carries, drawn — and this component is the only thing that knows it. Product's DropdownMenu names the same prop for the same reason */
|
|
30
|
+
chevron?: boolean;
|
|
31
|
+
/** The menu is one of several things on a bar that open, and the others open on hover — a switcher beside a row of navigation sections, where a reader who has learned that the sections open under the pointer meets one control that does not and reads it as broken. Off everywhere else: a filter above a table or a switcher in a toolbar is a deliberate act, and a menu that opened as the pointer crossed it on the way somewhere else is a menu in the way */
|
|
32
|
+
openOnHover?: boolean;
|
|
33
|
+
/** A control this component should open rather than draw — one whose mark is the whole of it, with no words to read. A ButtonIcon is the obvious candidate and not the only one: Pagination's break between two runs of page numbers passes a button of its own, because it has to match the numbered targets either side of it and this package's ButtonIcon has no transparent form to do that with. Given one, `icon` and `label`'s words go unused: what is drawn is what was passed. What this component still supplies is the half a page gets wrong — that the control announces a menu and whether it is open, that Escape returns focus to it, and that the arrow keys move through the rows. */
|
|
34
|
+
trigger?: ReactNode;
|
|
35
|
+
/** The page holds whether the menu is open, and this component stops holding it. For the case where something outside has to shut it — a navigation bar that closes its menu when another one opens. Pair it with onOpenChange, or the menu is open forever */
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/** A specimen — a documentation page, the preview's own stage — where the menu has to be on screen to be looked at. This component still holds the state afterwards */
|
|
38
|
+
defaultOpen?: boolean;
|
|
39
|
+
/** Something outside has to know — a navigation bar shutting its other menus, a page that dims behind an open one. Required in practice alongside open, which is the only way a driven menu ever closes */
|
|
40
|
+
onOpenChange?: (open: boolean) => void;
|
|
41
|
+
/** Allowed: MenuItem */
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export type DropdownMenuProps = DropdownMenuOwnProps & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'variant' | 'size' | 'alignment' | 'tone' | 'label' | 'icon' | 'chevron' | 'openOnHover' | 'trigger' | 'open' | 'defaultOpen' | 'onOpenChange'>;
|
|
45
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
46
|
+
export declare const dropdownMenuParts: {
|
|
47
|
+
readonly root: "dds-dropdownmenu";
|
|
48
|
+
readonly trigger: "dds-dropdownmenu__trigger";
|
|
49
|
+
readonly icon: "dds-dropdownmenu__icon";
|
|
50
|
+
readonly label: "dds-dropdownmenu__label";
|
|
51
|
+
readonly chevron: "dds-dropdownmenu__chevron";
|
|
52
|
+
readonly surface: "dds-dropdownmenu__surface";
|
|
53
|
+
};
|
|
54
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
55
|
+
export declare const dropdownMenuDefaults: {
|
|
56
|
+
readonly variant: "outlined";
|
|
57
|
+
readonly size: "md";
|
|
58
|
+
readonly alignment: "start";
|
|
59
|
+
readonly tone: "default";
|
|
60
|
+
readonly chevron: true;
|
|
61
|
+
readonly openOnHover: false;
|
|
62
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// GENERATED from dropdown-menu.contract.json. Do not edit.
|
|
2
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
3
|
+
export const dropdownMenuParts = {
|
|
4
|
+
root: 'dds-dropdownmenu',
|
|
5
|
+
trigger: 'dds-dropdownmenu__trigger',
|
|
6
|
+
icon: 'dds-dropdownmenu__icon',
|
|
7
|
+
label: 'dds-dropdownmenu__label',
|
|
8
|
+
chevron: 'dds-dropdownmenu__chevron',
|
|
9
|
+
surface: 'dds-dropdownmenu__surface',
|
|
10
|
+
};
|
|
11
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
12
|
+
export const dropdownMenuDefaults = { variant: 'outlined', size: 'md', alignment: 'start', tone: 'default', chevron: true, openOnHover: false };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Scoped to this package, like the generated sheet beside it.
|
|
3
|
+
*
|
|
4
|
+
* `:where([data-dds-context="marketing"])` confines these rules without contributing
|
|
5
|
+
* specificity, so the override below still ties or beats exactly what it did before —
|
|
6
|
+
* it is written a class deeper than it looks in order to match generated CSS, and a
|
|
7
|
+
* scope that carried weight would break it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Implementation CSS the contract cannot express.
|
|
12
|
+
*
|
|
13
|
+
* An animation is a keyframe and a name, and a token binding is one property with one
|
|
14
|
+
* value — so this cannot be a binding however much it wants to be. What it can do is
|
|
15
|
+
* take every measure from the same tokens the bindings use, which is what it does:
|
|
16
|
+
* nothing here is a number.
|
|
17
|
+
*/
|
|
18
|
+
@keyframes dds-dropdownmenu-surface-in {
|
|
19
|
+
from {
|
|
20
|
+
opacity: var(--opacity-hidden);
|
|
21
|
+
scale: var(--motion-scale-enter);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:where([data-dds-context='marketing']) .dds-dropdownmenu .dds-dropdownmenu__surface {
|
|
26
|
+
/* From the top, because that is the edge it is pinned to — it grows out of the trigger
|
|
27
|
+
rather than swelling from its own middle. Centred across, and not from the aligned
|
|
28
|
+
edge: there is no logical keyword for a corner, so naming one would be right in one
|
|
29
|
+
writing direction and the wrong corner in the other. At this scale the far edge moves
|
|
30
|
+
a pixel or two, which is less than the cost of a mirror-image mistake. */
|
|
31
|
+
transform-origin: top center;
|
|
32
|
+
animation: dds-dropdownmenu-surface-in var(--motion-duration-normal) var(--motion-easing-enter);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Above the page it floats over.
|
|
37
|
+
*
|
|
38
|
+
* `position: absolute` alone leaves the panel at `z-index: auto`, which paints in tree order
|
|
39
|
+
* among positioned elements — so any positioned sibling declared later covers it. Every
|
|
40
|
+
* DropdownMenu root is `position: relative`, which makes the next menu on the page exactly
|
|
41
|
+
* such a sibling: the first menu's panel opened *underneath* the second menu's trigger, which
|
|
42
|
+
* is how this was found. A navigation bar with a language picker and a region picker is the
|
|
43
|
+
* ordinary case, not a contrived one.
|
|
44
|
+
*
|
|
45
|
+
* A stacking order is an integer with no unit, so no token binding can carry it and no
|
|
46
|
+
* `staticCss` entry may — this is one of the handful of things that belong in a file like
|
|
47
|
+
* this. `layer.popup` rather than a number chosen here, which is the role Tooltip opened and
|
|
48
|
+
* whose own description reserves it for "a tooltip, and whatever menu or panel this package
|
|
49
|
+
* grows next". This is that panel.
|
|
50
|
+
*
|
|
51
|
+
* On the surface rather than the root, so it lasts exactly as long as the panel does: the
|
|
52
|
+
* surface is absent when the menu is shut, and a root left permanently raised would outrank
|
|
53
|
+
* its neighbours for nothing.
|
|
54
|
+
*
|
|
55
|
+
* It does not make the panel immune. A z-index only orders siblings within a stacking context,
|
|
56
|
+
* so an ancestor that creates one — a transform, a filter, an opacity below 1, an isolation —
|
|
57
|
+
* still traps the panel inside it however high this goes. The same caveat Tooltip records.
|
|
58
|
+
*/
|
|
59
|
+
:where([data-dds-context='marketing']) .dds-dropdownmenu .dds-dropdownmenu__surface {
|
|
60
|
+
z-index: var(--layer-popup);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* The reduce block the generated stylesheet writes covers transitions and not this, because
|
|
64
|
+
it is written from the bindings and this is not one. A visitor who has asked for less
|
|
65
|
+
movement has asked for this too. */
|
|
66
|
+
@media (prefers-reduced-motion: reduce) {
|
|
67
|
+
:where([data-dds-context='marketing']) .dds-dropdownmenu .dds-dropdownmenu__surface {
|
|
68
|
+
animation: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* GENERATED from filterchip.contract.json. Do not edit. */
|
|
2
|
+
|
|
3
|
+
:where([data-dds-context="marketing"]) .dds-filterchip {
|
|
4
|
+
transition-property: background-color, background-image, border-color, color, opacity, outline-color, outline-width;
|
|
5
|
+
align-items: center;
|
|
6
|
+
appearance: none;
|
|
7
|
+
border-style: solid;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
max-inline-size: 100%;
|
|
12
|
+
outline-style: solid;
|
|
13
|
+
border-radius: var(--radius-pill);
|
|
14
|
+
border-width: var(--border-width-default);
|
|
15
|
+
gap: var(--space-gap-xs);
|
|
16
|
+
min-inline-size: var(--size-target-min);
|
|
17
|
+
outline-width: var(--border-width-none);
|
|
18
|
+
transition-duration: var(--motion-duration-fast);
|
|
19
|
+
transition-timing-function: var(--motion-easing-standard);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:where([data-dds-context="marketing"]) .dds-filterchip .dds-filterchip__icon {
|
|
23
|
+
align-items: center;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex: none;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:where([data-dds-context="marketing"]) .dds-filterchip .dds-filterchip__label {
|
|
30
|
+
min-inline-size: 0;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:where([data-dds-context="marketing"]) .dds-filterchip .dds-filterchip__trailing {
|
|
37
|
+
align-items: center;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex: none;
|
|
40
|
+
transition-duration: var(--motion-duration-fast);
|
|
41
|
+
transition-timing-function: var(--motion-easing-standard);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:where([data-dds-context="marketing"]) .dds-filterchip:focus-visible {
|
|
45
|
+
outline-color: var(--color-border-focus);
|
|
46
|
+
outline-width: var(--border-width-focus);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:where([data-dds-context="marketing"]) .dds-filterchip:disabled:not(:where(:disabled *)) {
|
|
50
|
+
opacity: var(--opacity-disabled);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="false"] {
|
|
54
|
+
background-color: var(--color-bg-surface-raised);
|
|
55
|
+
border-color: var(--color-border-default);
|
|
56
|
+
color: var(--color-fg-default);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="true"] {
|
|
60
|
+
background-color: var(--color-bg-strong);
|
|
61
|
+
border-color: var(--color-bg-strong);
|
|
62
|
+
color: var(--color-fg-on-strong);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"] {
|
|
66
|
+
block-size: var(--size-control-md);
|
|
67
|
+
padding-inline-end: var(--space-inset-md);
|
|
68
|
+
padding-inline-start: var(--space-inset-md);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"] .dds-filterchip__icon {
|
|
72
|
+
block-size: var(--icon-size-sm);
|
|
73
|
+
inline-size: var(--icon-size-sm);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"] .dds-filterchip__label {
|
|
77
|
+
font-family: var(--font-label-md-family);
|
|
78
|
+
font-size: var(--font-label-md-size);
|
|
79
|
+
font-weight: var(--font-label-md-weight);
|
|
80
|
+
line-height: var(--font-label-md-line-height);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"] {
|
|
84
|
+
block-size: var(--size-control-sm);
|
|
85
|
+
padding-inline-end: var(--space-inset-sm);
|
|
86
|
+
padding-inline-start: var(--space-inset-sm);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"] .dds-filterchip__icon {
|
|
90
|
+
block-size: var(--icon-size-xs);
|
|
91
|
+
inline-size: var(--icon-size-xs);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"] .dds-filterchip__label {
|
|
95
|
+
font-family: var(--font-label-sm-family);
|
|
96
|
+
font-size: var(--font-label-sm-size);
|
|
97
|
+
font-weight: var(--font-label-sm-weight);
|
|
98
|
+
line-height: var(--font-label-sm-line-height);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="false"]:hover:where(:not(:disabled)) {
|
|
102
|
+
background-image: linear-gradient(var(--color-bg-hover), var(--color-bg-hover));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="true"]:hover:where(:not(:disabled)) {
|
|
106
|
+
background-image: linear-gradient(var(--color-bg-hover-inverse), var(--color-bg-hover-inverse));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="false"]:active {
|
|
110
|
+
background-image: linear-gradient(var(--color-bg-active), var(--color-bg-active));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-selected="true"]:active {
|
|
114
|
+
background-image: linear-gradient(var(--color-bg-active-inverse), var(--color-bg-active-inverse));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"][data-content="badge"] {
|
|
118
|
+
padding-inline-end: var(--space-inset-xs);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"][data-content="custom"] {
|
|
122
|
+
padding-inline-end: var(--space-inset-sm);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="md"][data-content="icon"] {
|
|
126
|
+
padding-inline-end: var(--space-inset-sm);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"][data-content="badge"] {
|
|
130
|
+
padding-inline-end: var(--space-inset-2xs);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"][data-content="custom"] {
|
|
134
|
+
padding-inline-end: var(--space-inset-xs);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:where([data-dds-context="marketing"]) .dds-filterchip[data-size="sm"][data-content="icon"] {
|
|
138
|
+
padding-inline-end: var(--space-inset-xs);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:where([data-dds-context="marketing"]) .dds-filterchip:disabled {
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media (prefers-reduced-motion: reduce) {
|
|
146
|
+
:where([data-dds-context="marketing"]) .dds-filterchip,
|
|
147
|
+
:where([data-dds-context="marketing"]) .dds-filterchip * { transition: none; }
|
|
148
|
+
}
|
|
149
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './FilterChip.css';
|
|
2
|
+
import { type FilterChipProps } from './FilterChip.types.js';
|
|
3
|
+
export type { FilterChipProps };
|
|
4
|
+
/**
|
|
5
|
+
* A token turned on and off in place.
|
|
6
|
+
*
|
|
7
|
+
* The chip is the button. That is the whole reason this is its own component rather
|
|
8
|
+
* than a mode of a shared one: a token pressed to toggle should be the thing that is
|
|
9
|
+
* pressed, so the state it reports sits on the element carrying the role instead of
|
|
10
|
+
* on a child of it. A wrapper that was not a control would put `aria-pressed`
|
|
11
|
+
* somewhere no check could reach.
|
|
12
|
+
*
|
|
13
|
+
* Unlike product's, this one has no `dot` content. That slot held a StatusDot, and
|
|
14
|
+
* this package has no StatusDot to put in it — a marketing index does not accumulate
|
|
15
|
+
* unread changes behind a filter the way an app view does. The escape hatch covers
|
|
16
|
+
* anyone who disagrees.
|
|
17
|
+
*
|
|
18
|
+
* It takes this package's control ramp rather than a chip scale of its own. There is
|
|
19
|
+
* one ramp here, its small step was written for a field in a filter row, and a second
|
|
20
|
+
* scale existing only for chips would be a distinction no marketing page is dense
|
|
21
|
+
* enough to need.
|
|
22
|
+
*/
|
|
23
|
+
export declare function FilterChip({ selected, size, content, label, leadingIcon, trailingIcon, badge, custom, onSelect, onClick, ...rest }: FilterChipProps): import("react").JSX.Element;
|