@deriv-com/dds-marketing 0.1.0 → 1.0.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 +201 -0
- package/.llm/components/accordionitem.md +244 -0
- package/.llm/components/aspectratio.md +220 -0
- package/.llm/components/badge.md +239 -0
- package/.llm/components/bottomsheet.md +412 -0
- package/.llm/components/breadcrumb.md +205 -0
- package/.llm/components/breadcrumbitem.md +186 -0
- package/.llm/components/button.md +295 -0
- package/.llm/components/buttonicon.md +321 -0
- package/.llm/components/card.md +327 -0
- package/.llm/components/cardbody.md +435 -0
- package/.llm/components/cardbutton.md +273 -0
- package/.llm/components/checkbox.md +293 -0
- package/.llm/components/ctabanner.md +186 -0
- package/.llm/components/ctabannerslider.md +204 -0
- package/.llm/components/divider.md +238 -0
- package/.llm/components/dropdownmenu.md +461 -0
- package/.llm/components/faqaccordion.md +217 -0
- package/.llm/components/featurebullets.md +254 -0
- package/.llm/components/featurecards.md +313 -0
- package/.llm/components/featurescroll.md +284 -0
- package/.llm/components/featuresplit.md +249 -0
- package/.llm/components/filterchip.md +322 -0
- package/.llm/components/footer.md +416 -0
- package/.llm/components/footergroup.md +249 -0
- package/.llm/components/grid.md +667 -0
- package/.llm/components/icon.md +202 -0
- package/.llm/components/landinghero.md +254 -0
- package/.llm/components/link.md +362 -0
- package/.llm/components/logocolumns.md +235 -0
- package/.llm/components/logorows.md +212 -0
- package/.llm/components/menuitem.md +226 -0
- package/.llm/components/navbar.md +522 -0
- package/.llm/components/navbaritem.md +246 -0
- package/.llm/components/navbarmenu.md +327 -0
- package/.llm/components/navbarmenugroup.md +192 -0
- package/.llm/components/navbarpanel.md +263 -0
- package/.llm/components/navbarswitcher.md +351 -0
- package/.llm/components/navbarswitcheroption.md +164 -0
- package/.llm/components/option.md +276 -0
- package/.llm/components/pageheader.md +231 -0
- package/.llm/components/pagination.md +298 -0
- package/.llm/components/paginationdots.md +215 -0
- package/.llm/components/producthero.md +248 -0
- package/.llm/components/removablechip.md +255 -0
- package/.llm/components/row.md +389 -0
- package/.llm/components/scroller.md +478 -0
- package/.llm/components/searchinput.md +287 -0
- package/.llm/components/segmentedcontrol.md +366 -0
- package/.llm/components/segmentedcontrolitem.md +280 -0
- package/.llm/components/select.md +517 -0
- package/.llm/components/selectchip.md +375 -0
- package/.llm/components/spinner.md +230 -0
- package/.llm/components/stack.md +342 -0
- package/.llm/components/statusdot.md +213 -0
- package/.llm/components/subdomainnavbar.md +335 -0
- package/.llm/components/tab.md +299 -0
- package/.llm/components/table.md +668 -0
- package/.llm/components/tablebody.md +266 -0
- package/.llm/components/tablecell.md +256 -0
- package/.llm/components/tablehead.md +256 -0
- package/.llm/components/tableheadercell.md +306 -0
- package/.llm/components/tablerow.md +293 -0
- package/.llm/components/tablist.md +218 -0
- package/.llm/components/testimonialrow.md +235 -0
- package/.llm/components/testimonialslider.md +254 -0
- package/.llm/components/textarea.md +370 -0
- package/.llm/components/textinput.md +475 -0
- package/.llm/components/tooltip.md +275 -0
- package/.llm/components/typography.md +253 -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 +53 -0
- package/.llm/digest/buttonicon.md +61 -0
- package/.llm/digest/card.md +51 -0
- package/.llm/digest/cardbody.md +70 -0
- package/.llm/digest/cardbutton.md +50 -0
- package/.llm/digest/checkbox.md +63 -0
- package/.llm/digest/ctabanner.md +44 -0
- package/.llm/digest/ctabannerslider.md +45 -0
- package/.llm/digest/divider.md +52 -0
- package/.llm/digest/dropdownmenu.md +67 -0
- package/.llm/digest/faqaccordion.md +43 -0
- package/.llm/digest/featurebullets.md +52 -0
- package/.llm/digest/featurecards.md +49 -0
- package/.llm/digest/featurescroll.md +52 -0
- package/.llm/digest/featuresplit.md +54 -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/landinghero.md +53 -0
- package/.llm/digest/link.md +59 -0
- package/.llm/digest/logocolumns.md +55 -0
- package/.llm/digest/logorows.md +48 -0
- package/.llm/digest/menuitem.md +46 -0
- package/.llm/digest/navbar.md +75 -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/pageheader.md +49 -0
- package/.llm/digest/pagination.md +60 -0
- package/.llm/digest/paginationdots.md +43 -0
- package/.llm/digest/producthero.md +53 -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 +73 -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/testimonialrow.md +51 -0
- package/.llm/digest/testimonialslider.md +51 -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 +107 -0
- package/.llm/rules.md +146 -0
- package/.llm/tokens.md +385 -0
- package/AGENTS.md +189 -0
- package/LICENSE +21 -0
- package/README.md +78 -10
- package/dist/components/banner-data.d.ts +38 -0
- package/dist/components/banner-data.js +15 -0
- package/dist/components/blocks/block-reveal.css +90 -0
- package/dist/components/blocks/cta-banner/CtaBanner.css +66 -0
- package/dist/components/blocks/cta-banner/CtaBanner.d.ts +22 -0
- package/dist/components/blocks/cta-banner/CtaBanner.js +31 -0
- package/dist/components/blocks/cta-banner/CtaBanner.types.d.ts +29 -0
- package/dist/components/blocks/cta-banner/CtaBanner.types.js +13 -0
- package/dist/components/blocks/cta-banner/cta-banner-impl.css +29 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.css +90 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.d.ts +39 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.js +60 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.d.ts +41 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.js +15 -0
- package/dist/components/blocks/cta-banner-slider/cta-banner-slider-impl.css +73 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.css +54 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.d.ts +20 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.js +28 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.types.d.ts +25 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.types.js +10 -0
- package/dist/components/blocks/faq-accordion/faq-accordion-impl.css +54 -0
- package/dist/components/blocks/feature-bullets/FeatureBullets.css +139 -0
- package/dist/components/blocks/feature-bullets/FeatureBullets.d.ts +31 -0
- package/dist/components/blocks/feature-bullets/FeatureBullets.js +55 -0
- package/dist/components/blocks/feature-bullets/FeatureBullets.types.d.ts +39 -0
- package/dist/components/blocks/feature-bullets/FeatureBullets.types.js +16 -0
- package/dist/components/blocks/feature-bullets/feature-bullets-impl.css +104 -0
- package/dist/components/blocks/feature-cards/FeatureCards.css +84 -0
- package/dist/components/blocks/feature-cards/FeatureCards.d.ts +24 -0
- package/dist/components/blocks/feature-cards/FeatureCards.js +66 -0
- package/dist/components/blocks/feature-cards/FeatureCards.types.d.ts +33 -0
- package/dist/components/blocks/feature-cards/FeatureCards.types.js +14 -0
- package/dist/components/blocks/feature-cards/feature-cards-impl.css +245 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.css +137 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.d.ts +39 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.js +167 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.types.d.ts +40 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.types.js +17 -0
- package/dist/components/blocks/feature-scroll/feature-scroll-impl.css +292 -0
- package/dist/components/blocks/feature-split/FeatureSplit.css +95 -0
- package/dist/components/blocks/feature-split/FeatureSplit.d.ts +30 -0
- package/dist/components/blocks/feature-split/FeatureSplit.js +38 -0
- package/dist/components/blocks/feature-split/FeatureSplit.types.d.ts +39 -0
- package/dist/components/blocks/feature-split/FeatureSplit.types.js +14 -0
- package/dist/components/blocks/feature-split/feature-split-impl.css +83 -0
- package/dist/components/blocks/landing-hero/LandingHero.css +85 -0
- package/dist/components/blocks/landing-hero/LandingHero.d.ts +41 -0
- package/dist/components/blocks/landing-hero/LandingHero.js +54 -0
- package/dist/components/blocks/landing-hero/LandingHero.types.d.ts +37 -0
- package/dist/components/blocks/landing-hero/LandingHero.types.js +15 -0
- package/dist/components/blocks/landing-hero/landing-hero-impl.css +355 -0
- package/dist/components/blocks/logo-columns/LogoColumns.css +161 -0
- package/dist/components/blocks/logo-columns/LogoColumns.d.ts +23 -0
- package/dist/components/blocks/logo-columns/LogoColumns.js +46 -0
- package/dist/components/blocks/logo-columns/LogoColumns.types.d.ts +46 -0
- package/dist/components/blocks/logo-columns/LogoColumns.types.js +18 -0
- package/dist/components/blocks/logo-columns/logo-columns-impl.css +188 -0
- package/dist/components/blocks/logo-rows/LogoRows.css +122 -0
- package/dist/components/blocks/logo-rows/LogoRows.d.ts +20 -0
- package/dist/components/blocks/logo-rows/LogoRows.js +43 -0
- package/dist/components/blocks/logo-rows/LogoRows.types.d.ts +36 -0
- package/dist/components/blocks/logo-rows/LogoRows.types.js +16 -0
- package/dist/components/blocks/logo-rows/logo-rows-impl.css +179 -0
- package/dist/components/blocks/page-header/PageHeader.css +79 -0
- package/dist/components/blocks/page-header/PageHeader.d.ts +34 -0
- package/dist/components/blocks/page-header/PageHeader.js +43 -0
- package/dist/components/blocks/page-header/PageHeader.types.d.ts +32 -0
- package/dist/components/blocks/page-header/PageHeader.types.js +14 -0
- package/dist/components/blocks/page-header/page-header-impl.css +176 -0
- package/dist/components/blocks/product-hero/ProductHero.css +86 -0
- package/dist/components/blocks/product-hero/ProductHero.d.ts +35 -0
- package/dist/components/blocks/product-hero/ProductHero.js +48 -0
- package/dist/components/blocks/product-hero/ProductHero.types.d.ts +37 -0
- package/dist/components/blocks/product-hero/ProductHero.types.js +15 -0
- package/dist/components/blocks/product-hero/product-hero-impl.css +354 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.css +245 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.d.ts +20 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.js +128 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.d.ts +54 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.js +26 -0
- package/dist/components/blocks/testimonial-row/testimonial-row-impl.css +195 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.css +181 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.d.ts +22 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.js +36 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.d.ts +49 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.js +21 -0
- package/dist/components/blocks/testimonial-slider/testimonial-slider-impl.css +202 -0
- package/dist/components/blocks/use-reveal.d.ts +46 -0
- package/dist/components/blocks/use-reveal.js +120 -0
- package/dist/components/blocks/use-rotation.d.ts +62 -0
- package/dist/components/blocks/use-rotation.js +176 -0
- 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 +99 -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 +188 -0
- package/dist/components/core/button/Button.d.ts +27 -0
- package/dist/components/core/button/Button.js +57 -0
- package/dist/components/core/button/Button.types.d.ts +35 -0
- package/dist/components/core/button/Button.types.js +9 -0
- package/dist/components/core/button/button-impl.css +71 -0
- package/dist/components/core/button-icon/ButtonIcon.css +151 -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 +74 -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 +34 -0
- package/dist/components/core/card/Card.types.js +7 -0
- package/dist/components/core/card-body/CardBody.css +144 -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 +64 -0
- package/dist/components/core/card-body/CardBody.types.js +16 -0
- package/dist/components/core/card-body/card-body-impl.css +87 -0
- package/dist/components/core/card-button/CardButton.css +82 -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 +25 -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 +156 -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 +147 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.d.ts +24 -0
- package/dist/components/core/dropdown-menu/DropdownMenu.js +311 -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 +150 -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 +91 -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 +134 -0
- package/dist/components/core/navbar/Navbar.d.ts +52 -0
- package/dist/components/core/navbar/Navbar.js +498 -0
- package/dist/components/core/navbar/Navbar.types.d.ts +68 -0
- package/dist/components/core/navbar/Navbar.types.js +17 -0
- package/dist/components/core/navbar/navbar-impl.css +597 -0
- package/dist/components/core/navbar/navbar-material.css +96 -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 +130 -0
- package/dist/components/core/navbar-menu/NavbarMenu.d.ts +6 -0
- package/dist/components/core/navbar-menu/NavbarMenu.js +187 -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 +118 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.d.ts +21 -0
- package/dist/components/core/navbar-switcher/NavbarSwitcher.js +91 -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 +163 -0
- package/dist/components/core/pagination/Pagination.d.ts +30 -0
- package/dist/components/core/pagination/Pagination.js +366 -0
- package/dist/components/core/pagination/Pagination.types.d.ts +47 -0
- package/dist/components/core/pagination/Pagination.types.js +12 -0
- package/dist/components/core/pagination/pagination-impl.css +17 -0
- package/dist/components/core/pagination-dots/PaginationDots.css +60 -0
- package/dist/components/core/pagination-dots/PaginationDots.d.ts +25 -0
- package/dist/components/core/pagination-dots/PaginationDots.js +104 -0
- package/dist/components/core/pagination-dots/PaginationDots.types.d.ts +38 -0
- package/dist/components/core/pagination-dots/PaginationDots.types.js +9 -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 +401 -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 +162 -0
- package/dist/components/core/select-chip/SelectChip.d.ts +20 -0
- package/dist/components/core/select-chip/SelectChip.js +276 -0
- package/dist/components/core/select-chip/SelectChip.types.d.ts +62 -0
- package/dist/components/core/select-chip/SelectChip.types.js +14 -0
- package/dist/components/core/select-chip/select-chip-impl.css +49 -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 +97 -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 +149 -1
- package/dist/components/index.js +145 -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/logo-data.d.ts +24 -0
- package/dist/components/logo-data.js +11 -0
- package/dist/components/scroll-data.d.ts +64 -0
- package/dist/components/scroll-data.js +17 -0
- package/dist/components/testimonial-row-data.d.ts +51 -0
- package/dist/components/testimonial-row-data.js +11 -0
- package/dist/components/testimonial-slider-data.d.ts +26 -0
- package/dist/components/testimonial-slider-data.js +10 -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 +581 -162
- package/package.json +13 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { FocusEventHandler, PointerEventHandler } from 'react';
|
|
2
|
+
import type { TooltipProps } from './Tooltip.types.js';
|
|
3
|
+
export interface UseTooltipOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Revealed on mount, and dismissible from there like any other. Read once, when
|
|
6
|
+
* the hook first runs — changing it later is not a way to open a tooltip, because
|
|
7
|
+
* a default that keeps applying is not a default.
|
|
8
|
+
*/
|
|
9
|
+
isDefaultOpen?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the anchor answers the pointer and the keyboard at all. `false` also
|
|
12
|
+
* closes a tooltip that is already open: a description left on screen by a
|
|
13
|
+
* control that has stopped responding describes something no longer happening.
|
|
14
|
+
*/
|
|
15
|
+
isEnabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* How long a reveal waits, in milliseconds. This is what keeps a pointer crossing
|
|
18
|
+
* the anchor on its way somewhere else from flashing a description nobody asked
|
|
19
|
+
* for, and it applies to focus for the same reason — tabbing through a row of
|
|
20
|
+
* controls passes through each one.
|
|
21
|
+
*/
|
|
22
|
+
delay?: number;
|
|
23
|
+
/**
|
|
24
|
+
* How long a dismissal waits, in milliseconds. Zero is the useful default: the
|
|
25
|
+
* gap this protects against is the one between anchor and chip, and this system
|
|
26
|
+
* has no positioning layer to open one.
|
|
27
|
+
*/
|
|
28
|
+
hideDelay?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Which focus reveals the tooltip. `auto` is keyboard focus only, which is the
|
|
31
|
+
* one that needs it — a mouse that has just clicked the control has hover
|
|
32
|
+
* already. `always` includes focus a click caused, for an anchor that is
|
|
33
|
+
* programmatically focused and has no pointer behind it. `never` leaves the
|
|
34
|
+
* description to the pointer, and means a keyboard reaches it not at all.
|
|
35
|
+
*/
|
|
36
|
+
focusTrigger?: 'auto' | 'always' | 'never';
|
|
37
|
+
/** Called with the new visibility, once per change, after any delay has elapsed. */
|
|
38
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface UseTooltipResult {
|
|
41
|
+
/** Whether the chip is revealed. The inverse of what `tooltipProps.hidden` carries. */
|
|
42
|
+
isOpen: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Reveal now, ignoring `delay`. For an anchor whose trigger is neither pointer nor
|
|
45
|
+
* focus — a tooltip a validation result opens. `isEnabled: false` refuses it, for
|
|
46
|
+
* the same reason it refuses the pointer.
|
|
47
|
+
*/
|
|
48
|
+
show: () => void;
|
|
49
|
+
/** Dismiss now, ignoring `hideDelay`, and drop any reveal still waiting on `delay`. */
|
|
50
|
+
hide: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Spread onto the element the tooltip describes — which has to be something focus
|
|
53
|
+
* can rest on, or the description is one no keyboard ever reaches. The
|
|
54
|
+
* `aria-describedby` is here rather than applied conditionally because a
|
|
55
|
+
* reference that exists only while the chip is visible is one assistive
|
|
56
|
+
* technology never sees.
|
|
57
|
+
*/
|
|
58
|
+
anchorProps: {
|
|
59
|
+
'aria-describedby': string;
|
|
60
|
+
onPointerEnter: PointerEventHandler<HTMLElement>;
|
|
61
|
+
onPointerLeave: PointerEventHandler<HTMLElement>;
|
|
62
|
+
onFocus: FocusEventHandler<HTMLElement>;
|
|
63
|
+
onBlur: FocusEventHandler<HTMLElement>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Spread onto `Tooltip`. Typed off the component's own generated props, so a
|
|
67
|
+
* renamed prop fails here rather than spreading an attribute nothing reads.
|
|
68
|
+
*/
|
|
69
|
+
tooltipProps: Required<Pick<TooltipProps, 'id' | 'hidden'>>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What every option falls back to. The values match the ones a consumer would
|
|
73
|
+
* otherwise write out every time — 200ms to reveal, nothing to dismiss.
|
|
74
|
+
*
|
|
75
|
+
* A named object rather than five literals in the destructuring below, so anything
|
|
76
|
+
* that has to *show* a default reads the same one the hook falls back to. The preview
|
|
77
|
+
* panel is the caller that forced this: a harness holding its own 200 agrees with this
|
|
78
|
+
* file right up until one of them changes, which is a copy reveal.tsx records having
|
|
79
|
+
* already made once with the state machine itself. Same reason `Tooltip.tsx` takes its
|
|
80
|
+
* own defaults from the generated `tooltipDefaults` rather than repeating them.
|
|
81
|
+
*
|
|
82
|
+
* `onOpenChange` is absent because a callback has no default worth naming — its
|
|
83
|
+
* absence is the behaviour, not a value standing in for one.
|
|
84
|
+
*/
|
|
85
|
+
export declare const useTooltipDefaults: {
|
|
86
|
+
readonly isDefaultOpen: false;
|
|
87
|
+
readonly isEnabled: true;
|
|
88
|
+
readonly delay: 200;
|
|
89
|
+
readonly hideDelay: 0;
|
|
90
|
+
readonly focusTrigger: "auto";
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The reveal a tooltip does not do for itself.
|
|
94
|
+
*
|
|
95
|
+
* `Tooltip` is the chip and nothing else — it takes `hidden` and does not decide
|
|
96
|
+
* when to flip it, because a component that owned that would own a behaviour no
|
|
97
|
+
* other component could reuse. This is that behaviour, kept headless: it returns
|
|
98
|
+
* props rather than rendering anything, so the anchor stays whatever the consumer
|
|
99
|
+
* already had, and this hook never needs an opinion about what a trigger looks
|
|
100
|
+
* like.
|
|
101
|
+
*
|
|
102
|
+
* It positions nothing. Where the chip lands is still the anchor's own layout, and
|
|
103
|
+
* `placement` is still a value the consumer names rather than one measured from the
|
|
104
|
+
* anchor — the contract's `neverUseFor` says so, and this module does not retract
|
|
105
|
+
* it.
|
|
106
|
+
*
|
|
107
|
+
* Defaults live in `useTooltipDefaults` rather than in the contract because a
|
|
108
|
+
* contract carries no numbers: `api.props` is `enum | boolean | string | node`, which
|
|
109
|
+
* is the schema saying that a duration is not a design decision a variant can express.
|
|
110
|
+
*/
|
|
111
|
+
export declare function useTooltip({ isDefaultOpen, isEnabled, delay, hideDelay, focusTrigger, onOpenChange, }?: UseTooltipOptions): UseTooltipResult;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Whether this focus came from the keyboard, as far as the runtime will say.
|
|
5
|
+
*
|
|
6
|
+
* `:focus-visible` is the browser's own answer to the question `focusTrigger:
|
|
7
|
+
* "auto"` asks — it is what decides whether this particular focus draws a ring —
|
|
8
|
+
* so asking it is better than keeping a second opinion here in the shape of a
|
|
9
|
+
* global "was the last input a key" flag, which is what a hand-rolled version of
|
|
10
|
+
* this always becomes.
|
|
11
|
+
*
|
|
12
|
+
* A runtime that does not know the selector throws rather than answering, and the
|
|
13
|
+
* honest reading of a throw is not "this was a mouse". A description withheld is
|
|
14
|
+
* worse than one shown early, so an unanswerable question reveals the tooltip.
|
|
15
|
+
*/
|
|
16
|
+
function isKeyboardFocus(target) {
|
|
17
|
+
try {
|
|
18
|
+
return target.matches(':focus-visible');
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What every option falls back to. The values match the ones a consumer would
|
|
26
|
+
* otherwise write out every time — 200ms to reveal, nothing to dismiss.
|
|
27
|
+
*
|
|
28
|
+
* A named object rather than five literals in the destructuring below, so anything
|
|
29
|
+
* that has to *show* a default reads the same one the hook falls back to. The preview
|
|
30
|
+
* panel is the caller that forced this: a harness holding its own 200 agrees with this
|
|
31
|
+
* file right up until one of them changes, which is a copy reveal.tsx records having
|
|
32
|
+
* already made once with the state machine itself. Same reason `Tooltip.tsx` takes its
|
|
33
|
+
* own defaults from the generated `tooltipDefaults` rather than repeating them.
|
|
34
|
+
*
|
|
35
|
+
* `onOpenChange` is absent because a callback has no default worth naming — its
|
|
36
|
+
* absence is the behaviour, not a value standing in for one.
|
|
37
|
+
*/
|
|
38
|
+
export const useTooltipDefaults = {
|
|
39
|
+
isDefaultOpen: false,
|
|
40
|
+
isEnabled: true,
|
|
41
|
+
delay: 200,
|
|
42
|
+
hideDelay: 0,
|
|
43
|
+
focusTrigger: 'auto',
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The reveal a tooltip does not do for itself.
|
|
47
|
+
*
|
|
48
|
+
* `Tooltip` is the chip and nothing else — it takes `hidden` and does not decide
|
|
49
|
+
* when to flip it, because a component that owned that would own a behaviour no
|
|
50
|
+
* other component could reuse. This is that behaviour, kept headless: it returns
|
|
51
|
+
* props rather than rendering anything, so the anchor stays whatever the consumer
|
|
52
|
+
* already had, and this hook never needs an opinion about what a trigger looks
|
|
53
|
+
* like.
|
|
54
|
+
*
|
|
55
|
+
* It positions nothing. Where the chip lands is still the anchor's own layout, and
|
|
56
|
+
* `placement` is still a value the consumer names rather than one measured from the
|
|
57
|
+
* anchor — the contract's `neverUseFor` says so, and this module does not retract
|
|
58
|
+
* it.
|
|
59
|
+
*
|
|
60
|
+
* Defaults live in `useTooltipDefaults` rather than in the contract because a
|
|
61
|
+
* contract carries no numbers: `api.props` is `enum | boolean | string | node`, which
|
|
62
|
+
* is the schema saying that a duration is not a design decision a variant can express.
|
|
63
|
+
*/
|
|
64
|
+
export function useTooltip({ isDefaultOpen = useTooltipDefaults.isDefaultOpen, isEnabled = useTooltipDefaults.isEnabled, delay = useTooltipDefaults.delay, hideDelay = useTooltipDefaults.hideDelay, focusTrigger = useTooltipDefaults.focusTrigger, onOpenChange, } = {}) {
|
|
65
|
+
const id = useId();
|
|
66
|
+
// Disabled at mount means closed at mount, rather than open for one frame and
|
|
67
|
+
// then shut by the effect below.
|
|
68
|
+
const [isOpen, setIsOpen] = useState(isDefaultOpen && isEnabled);
|
|
69
|
+
// The same fact as `isOpen`, readable synchronously. Two events in one tick — a
|
|
70
|
+
// pointer leaving as focus lands — would both read a stale `isOpen` and both
|
|
71
|
+
// report a change that only happened once.
|
|
72
|
+
const open = useRef(isDefaultOpen && isEnabled);
|
|
73
|
+
// `onOpenChange` is the one option a consumer will pass as an inline arrow, so it
|
|
74
|
+
// is read through a ref: `show` and `hide` stay the same functions across renders
|
|
75
|
+
// and are safe in a consumer's own dependency list.
|
|
76
|
+
const notify = useRef(onOpenChange);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
notify.current = onOpenChange;
|
|
79
|
+
}, [onOpenChange]);
|
|
80
|
+
// One timer, because a pending reveal and a pending dismissal are never both
|
|
81
|
+
// wanted — whichever intent arrives last is the one that is true.
|
|
82
|
+
const timer = useRef(undefined);
|
|
83
|
+
const cancel = useCallback(() => {
|
|
84
|
+
if (timer.current === undefined)
|
|
85
|
+
return;
|
|
86
|
+
clearTimeout(timer.current);
|
|
87
|
+
timer.current = undefined;
|
|
88
|
+
}, []);
|
|
89
|
+
const commit = useCallback((next) => {
|
|
90
|
+
if (open.current === next)
|
|
91
|
+
return;
|
|
92
|
+
open.current = next;
|
|
93
|
+
setIsOpen(next);
|
|
94
|
+
notify.current?.(next);
|
|
95
|
+
}, []);
|
|
96
|
+
const schedule = useCallback((next, ms) => {
|
|
97
|
+
cancel();
|
|
98
|
+
// No delay means no timer. Routing zero through setTimeout would defer the
|
|
99
|
+
// change by a task, which is a different behaviour from the one asked for and
|
|
100
|
+
// one that shows up as a frame of the wrong state.
|
|
101
|
+
if (ms <= 0) {
|
|
102
|
+
commit(next);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
timer.current = setTimeout(() => {
|
|
106
|
+
timer.current = undefined;
|
|
107
|
+
commit(next);
|
|
108
|
+
}, ms);
|
|
109
|
+
}, [cancel, commit]);
|
|
110
|
+
const show = useCallback(() => {
|
|
111
|
+
cancel();
|
|
112
|
+
if (isEnabled)
|
|
113
|
+
commit(true);
|
|
114
|
+
}, [cancel, commit, isEnabled]);
|
|
115
|
+
const hide = useCallback(() => {
|
|
116
|
+
cancel();
|
|
117
|
+
commit(false);
|
|
118
|
+
}, [cancel, commit]);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (isEnabled)
|
|
121
|
+
return;
|
|
122
|
+
cancel();
|
|
123
|
+
commit(false);
|
|
124
|
+
}, [isEnabled, cancel, commit]);
|
|
125
|
+
// Escape dismisses, which is the one keyboard behaviour the WAI-ARIA tooltip
|
|
126
|
+
// pattern asks for. Listened for on the document rather than on the anchor
|
|
127
|
+
// because a tooltip the pointer revealed can be on screen while focus is
|
|
128
|
+
// somewhere else entirely, and a handler on the anchor would never hear the key.
|
|
129
|
+
//
|
|
130
|
+
// Nothing re-reveals it afterwards until the pointer leaves and returns, or focus
|
|
131
|
+
// does. That is the point: a description the user has dismissed stays dismissed
|
|
132
|
+
// while they are still pointing at the thing it describes.
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (!isOpen)
|
|
135
|
+
return;
|
|
136
|
+
const dismiss = (event) => {
|
|
137
|
+
if (event.key !== 'Escape')
|
|
138
|
+
return;
|
|
139
|
+
cancel();
|
|
140
|
+
commit(false);
|
|
141
|
+
};
|
|
142
|
+
document.addEventListener('keydown', dismiss);
|
|
143
|
+
return () => document.removeEventListener('keydown', dismiss);
|
|
144
|
+
}, [isOpen, cancel, commit]);
|
|
145
|
+
// A timer outliving the component would commit into a hook that renders nothing.
|
|
146
|
+
useEffect(() => cancel, [cancel]);
|
|
147
|
+
const onPointerEnter = (event) => {
|
|
148
|
+
// A tap is not a hover. Touch fires this with nothing that will ever undo it —
|
|
149
|
+
// no pointerleave, and no keyboard to press Escape on — so the chip would be
|
|
150
|
+
// stuck on screen, which is worse than the contract's own position that on
|
|
151
|
+
// touch there is no hover to reveal it. A pointer that does not name itself is
|
|
152
|
+
// treated as a mouse: a runtime that cannot say is not a reason to withhold a
|
|
153
|
+
// description.
|
|
154
|
+
if (event.pointerType === 'touch')
|
|
155
|
+
return;
|
|
156
|
+
if (!isEnabled)
|
|
157
|
+
return;
|
|
158
|
+
schedule(true, delay);
|
|
159
|
+
};
|
|
160
|
+
const onPointerLeave = (event) => {
|
|
161
|
+
if (event.pointerType === 'touch')
|
|
162
|
+
return;
|
|
163
|
+
schedule(false, hideDelay);
|
|
164
|
+
};
|
|
165
|
+
const onFocus = (event) => {
|
|
166
|
+
if (!isEnabled || focusTrigger === 'never')
|
|
167
|
+
return;
|
|
168
|
+
if (focusTrigger === 'auto' && !isKeyboardFocus(event.currentTarget))
|
|
169
|
+
return;
|
|
170
|
+
schedule(true, delay);
|
|
171
|
+
};
|
|
172
|
+
const onBlur = () => {
|
|
173
|
+
// Immediately, rather than through `hideDelay`. That delay exists so a pointer
|
|
174
|
+
// can cross the gap between anchor and chip without the description vanishing;
|
|
175
|
+
// focus has no gap to cross, and focus leaving is unambiguous.
|
|
176
|
+
cancel();
|
|
177
|
+
commit(false);
|
|
178
|
+
};
|
|
179
|
+
// A fresh object each render, and deliberately not memoised: these are spread
|
|
180
|
+
// onto an element that re-renders with its parent regardless, so a dependency
|
|
181
|
+
// list here would buy nothing and be one more thing to keep true.
|
|
182
|
+
return {
|
|
183
|
+
isOpen,
|
|
184
|
+
show,
|
|
185
|
+
hide,
|
|
186
|
+
anchorProps: { 'aria-describedby': id, onPointerEnter, onPointerLeave, onFocus, onBlur },
|
|
187
|
+
tooltipProps: { id, hidden: !isOpen },
|
|
188
|
+
};
|
|
189
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* GENERATED from typography.contract.json. Do not edit. */
|
|
2
|
+
|
|
3
|
+
:where([data-dds-context="marketing"]) .dds-typography {
|
|
4
|
+
margin: unset;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="eyebrow"] {
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
font-family: var(--font-eyebrow-sm-family);
|
|
10
|
+
font-size: var(--font-eyebrow-sm-size);
|
|
11
|
+
font-weight: var(--font-eyebrow-sm-weight);
|
|
12
|
+
letter-spacing: var(--font-eyebrow-sm-letter-spacing);
|
|
13
|
+
line-height: var(--font-eyebrow-sm-line-height);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="figure"] {
|
|
17
|
+
font-variant-numeric: tabular-nums;
|
|
18
|
+
font-family: var(--font-figure-family);
|
|
19
|
+
font-size: var(--font-figure-size);
|
|
20
|
+
font-weight: var(--font-figure-weight);
|
|
21
|
+
letter-spacing: var(--font-figure-letter-spacing);
|
|
22
|
+
line-height: var(--font-figure-line-height);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="body-lg"] {
|
|
26
|
+
font-family: var(--font-body-lg-family);
|
|
27
|
+
font-size: var(--font-body-lg-size);
|
|
28
|
+
font-weight: var(--font-body-lg-weight);
|
|
29
|
+
letter-spacing: var(--font-body-lg-letter-spacing);
|
|
30
|
+
line-height: var(--font-body-lg-line-height);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="body-md"] {
|
|
34
|
+
font-family: var(--font-body-md-family);
|
|
35
|
+
font-size: var(--font-body-md-size);
|
|
36
|
+
font-weight: var(--font-body-md-weight);
|
|
37
|
+
letter-spacing: var(--font-body-md-letter-spacing);
|
|
38
|
+
line-height: var(--font-body-md-line-height);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="body-sm"] {
|
|
42
|
+
font-family: var(--font-body-sm-family);
|
|
43
|
+
font-size: var(--font-body-sm-size);
|
|
44
|
+
font-weight: var(--font-body-sm-weight);
|
|
45
|
+
letter-spacing: var(--font-body-sm-letter-spacing);
|
|
46
|
+
line-height: var(--font-body-sm-line-height);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="h1"] {
|
|
50
|
+
font-family: var(--font-h1-family);
|
|
51
|
+
font-size: var(--font-h1-size);
|
|
52
|
+
font-weight: var(--font-h1-weight);
|
|
53
|
+
letter-spacing: var(--font-h1-letter-spacing);
|
|
54
|
+
line-height: var(--font-h1-line-height);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="h2"] {
|
|
58
|
+
font-family: var(--font-h2-family);
|
|
59
|
+
font-size: var(--font-h2-size);
|
|
60
|
+
font-weight: var(--font-h2-weight);
|
|
61
|
+
letter-spacing: var(--font-h2-letter-spacing);
|
|
62
|
+
line-height: var(--font-h2-line-height);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="h3"] {
|
|
66
|
+
font-family: var(--font-h3-family);
|
|
67
|
+
font-size: var(--font-h3-size);
|
|
68
|
+
font-weight: var(--font-h3-weight);
|
|
69
|
+
letter-spacing: var(--font-h3-letter-spacing);
|
|
70
|
+
line-height: var(--font-h3-line-height);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="h4"] {
|
|
74
|
+
font-family: var(--font-h4-family);
|
|
75
|
+
font-size: var(--font-h4-size);
|
|
76
|
+
font-weight: var(--font-h4-weight);
|
|
77
|
+
letter-spacing: var(--font-h4-letter-spacing);
|
|
78
|
+
line-height: var(--font-h4-line-height);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="h5"] {
|
|
82
|
+
font-family: var(--font-h5-family);
|
|
83
|
+
font-size: var(--font-h5-size);
|
|
84
|
+
font-weight: var(--font-h5-weight);
|
|
85
|
+
letter-spacing: var(--font-h5-letter-spacing);
|
|
86
|
+
line-height: var(--font-h5-line-height);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where([data-dds-context="marketing"]) .dds-typography[data-variant="subtitle"] {
|
|
90
|
+
font-family: var(--font-subtitle-family);
|
|
91
|
+
font-size: var(--font-subtitle-size);
|
|
92
|
+
font-weight: var(--font-subtitle-weight);
|
|
93
|
+
letter-spacing: var(--font-subtitle-letter-spacing);
|
|
94
|
+
line-height: var(--font-subtitle-line-height);
|
|
95
|
+
}
|
|
96
|
+
|