@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.
Files changed (460) hide show
  1. package/.llm/components/accordion.md +193 -0
  2. package/.llm/components/accordionitem.md +236 -0
  3. package/.llm/components/aspectratio.md +212 -0
  4. package/.llm/components/badge.md +231 -0
  5. package/.llm/components/bottomsheet.md +404 -0
  6. package/.llm/components/breadcrumb.md +197 -0
  7. package/.llm/components/breadcrumbitem.md +178 -0
  8. package/.llm/components/button.md +271 -0
  9. package/.llm/components/buttonicon.md +313 -0
  10. package/.llm/components/card.md +313 -0
  11. package/.llm/components/cardbody.md +409 -0
  12. package/.llm/components/cardbutton.md +259 -0
  13. package/.llm/components/checkbox.md +285 -0
  14. package/.llm/components/divider.md +230 -0
  15. package/.llm/components/dropdownmenu.md +453 -0
  16. package/.llm/components/filterchip.md +314 -0
  17. package/.llm/components/footer.md +408 -0
  18. package/.llm/components/footergroup.md +241 -0
  19. package/.llm/components/grid.md +659 -0
  20. package/.llm/components/icon.md +194 -0
  21. package/.llm/components/link.md +354 -0
  22. package/.llm/components/menuitem.md +218 -0
  23. package/.llm/components/navbar.md +458 -0
  24. package/.llm/components/navbaritem.md +238 -0
  25. package/.llm/components/navbarmenu.md +319 -0
  26. package/.llm/components/navbarmenugroup.md +184 -0
  27. package/.llm/components/navbarpanel.md +255 -0
  28. package/.llm/components/navbarswitcher.md +343 -0
  29. package/.llm/components/navbarswitcheroption.md +156 -0
  30. package/.llm/components/option.md +268 -0
  31. package/.llm/components/pagination.md +361 -0
  32. package/.llm/components/removablechip.md +247 -0
  33. package/.llm/components/row.md +381 -0
  34. package/.llm/components/scroller.md +470 -0
  35. package/.llm/components/searchinput.md +279 -0
  36. package/.llm/components/segmentedcontrol.md +358 -0
  37. package/.llm/components/segmentedcontrolitem.md +272 -0
  38. package/.llm/components/select.md +509 -0
  39. package/.llm/components/selectchip.md +334 -0
  40. package/.llm/components/spinner.md +222 -0
  41. package/.llm/components/stack.md +334 -0
  42. package/.llm/components/statusdot.md +205 -0
  43. package/.llm/components/subdomainnavbar.md +327 -0
  44. package/.llm/components/tab.md +291 -0
  45. package/.llm/components/table.md +660 -0
  46. package/.llm/components/tablebody.md +258 -0
  47. package/.llm/components/tablecell.md +248 -0
  48. package/.llm/components/tablehead.md +248 -0
  49. package/.llm/components/tableheadercell.md +298 -0
  50. package/.llm/components/tablerow.md +285 -0
  51. package/.llm/components/tablist.md +210 -0
  52. package/.llm/components/textarea.md +362 -0
  53. package/.llm/components/textinput.md +467 -0
  54. package/.llm/components/tooltip.md +267 -0
  55. package/.llm/components/typography.md +245 -0
  56. package/.llm/digest/accordion.md +43 -0
  57. package/.llm/digest/accordionitem.md +47 -0
  58. package/.llm/digest/aspectratio.md +47 -0
  59. package/.llm/digest/badge.md +45 -0
  60. package/.llm/digest/bottomsheet.md +69 -0
  61. package/.llm/digest/breadcrumb.md +38 -0
  62. package/.llm/digest/breadcrumbitem.md +43 -0
  63. package/.llm/digest/button.md +48 -0
  64. package/.llm/digest/buttonicon.md +61 -0
  65. package/.llm/digest/card.md +50 -0
  66. package/.llm/digest/cardbody.md +68 -0
  67. package/.llm/digest/cardbutton.md +49 -0
  68. package/.llm/digest/checkbox.md +63 -0
  69. package/.llm/digest/divider.md +52 -0
  70. package/.llm/digest/dropdownmenu.md +67 -0
  71. package/.llm/digest/filterchip.md +68 -0
  72. package/.llm/digest/footer.md +57 -0
  73. package/.llm/digest/footergroup.md +42 -0
  74. package/.llm/digest/grid.md +62 -0
  75. package/.llm/digest/icon.md +45 -0
  76. package/.llm/digest/link.md +59 -0
  77. package/.llm/digest/menuitem.md +46 -0
  78. package/.llm/digest/navbar.md +60 -0
  79. package/.llm/digest/navbaritem.md +54 -0
  80. package/.llm/digest/navbarmenu.md +54 -0
  81. package/.llm/digest/navbarmenugroup.md +40 -0
  82. package/.llm/digest/navbarpanel.md +53 -0
  83. package/.llm/digest/navbarswitcher.md +51 -0
  84. package/.llm/digest/navbarswitcheroption.md +37 -0
  85. package/.llm/digest/option.md +54 -0
  86. package/.llm/digest/pagination.md +71 -0
  87. package/.llm/digest/removablechip.md +51 -0
  88. package/.llm/digest/row.md +60 -0
  89. package/.llm/digest/scroller.md +59 -0
  90. package/.llm/digest/searchinput.md +56 -0
  91. package/.llm/digest/segmentedcontrol.md +59 -0
  92. package/.llm/digest/segmentedcontrolitem.md +59 -0
  93. package/.llm/digest/select.md +92 -0
  94. package/.llm/digest/selectchip.md +68 -0
  95. package/.llm/digest/spinner.md +52 -0
  96. package/.llm/digest/stack.md +56 -0
  97. package/.llm/digest/statusdot.md +46 -0
  98. package/.llm/digest/subdomainnavbar.md +54 -0
  99. package/.llm/digest/tab.md +60 -0
  100. package/.llm/digest/table.md +71 -0
  101. package/.llm/digest/tablebody.md +49 -0
  102. package/.llm/digest/tablecell.md +55 -0
  103. package/.llm/digest/tablehead.md +50 -0
  104. package/.llm/digest/tableheadercell.md +65 -0
  105. package/.llm/digest/tablerow.md +56 -0
  106. package/.llm/digest/tablist.md +46 -0
  107. package/.llm/digest/textarea.md +78 -0
  108. package/.llm/digest/textinput.md +95 -0
  109. package/.llm/digest/tooltip.md +58 -0
  110. package/.llm/digest/typography.md +59 -0
  111. package/.llm/index.md +86 -0
  112. package/.llm/rules.md +122 -0
  113. package/.llm/tokens.md +341 -0
  114. package/AGENTS.md +164 -0
  115. package/LICENSE +21 -0
  116. package/README.md +63 -15
  117. package/dist/components/core/accordion/Accordion.css +10 -0
  118. package/dist/components/core/accordion/Accordion.d.ts +20 -0
  119. package/dist/components/core/accordion/Accordion.js +69 -0
  120. package/dist/components/core/accordion/Accordion.types.d.ts +20 -0
  121. package/dist/components/core/accordion/Accordion.types.js +7 -0
  122. package/dist/components/core/accordion-item/AccordionItem.css +98 -0
  123. package/dist/components/core/accordion-item/AccordionItem.d.ts +44 -0
  124. package/dist/components/core/accordion-item/AccordionItem.js +63 -0
  125. package/dist/components/core/accordion-item/AccordionItem.types.d.ts +32 -0
  126. package/dist/components/core/accordion-item/AccordionItem.types.js +13 -0
  127. package/dist/components/core/accordion-item/accordion-item-impl.css +107 -0
  128. package/dist/components/core/badge/Badge.css +37 -0
  129. package/dist/components/core/badge/Badge.d.ts +37 -0
  130. package/dist/components/core/badge/Badge.js +40 -0
  131. package/dist/components/core/badge/Badge.types.d.ts +24 -0
  132. package/dist/components/core/badge/Badge.types.js +8 -0
  133. package/dist/components/core/badge/badge-impl.css +32 -0
  134. package/dist/components/core/bottom-sheet/BottomSheet.css +178 -0
  135. package/dist/components/core/bottom-sheet/BottomSheet.d.ts +22 -0
  136. package/dist/components/core/bottom-sheet/BottomSheet.js +359 -0
  137. package/dist/components/core/bottom-sheet/BottomSheet.types.d.ts +67 -0
  138. package/dist/components/core/bottom-sheet/BottomSheet.types.js +18 -0
  139. package/dist/components/core/bottom-sheet/bottom-sheet-impl.css +57 -0
  140. package/dist/components/core/breadcrumb/Breadcrumb.css +19 -0
  141. package/dist/components/core/breadcrumb/Breadcrumb.d.ts +16 -0
  142. package/dist/components/core/breadcrumb/Breadcrumb.js +22 -0
  143. package/dist/components/core/breadcrumb/Breadcrumb.types.d.ts +18 -0
  144. package/dist/components/core/breadcrumb/Breadcrumb.types.js +9 -0
  145. package/dist/components/core/breadcrumb-item/BreadcrumbItem.css +34 -0
  146. package/dist/components/core/breadcrumb-item/BreadcrumbItem.d.ts +12 -0
  147. package/dist/components/core/breadcrumb-item/BreadcrumbItem.js +15 -0
  148. package/dist/components/core/breadcrumb-item/BreadcrumbItem.types.d.ts +22 -0
  149. package/dist/components/core/breadcrumb-item/BreadcrumbItem.types.js +9 -0
  150. package/dist/components/core/button/Button.css +141 -0
  151. package/dist/components/core/button/Button.d.ts +25 -0
  152. package/dist/components/core/button/Button.js +28 -0
  153. package/dist/components/core/button/Button.types.d.ts +40 -0
  154. package/dist/components/core/button/Button.types.js +9 -0
  155. package/dist/components/core/button/button-impl.css +46 -0
  156. package/dist/components/core/button-icon/ButtonIcon.css +135 -0
  157. package/dist/components/core/button-icon/ButtonIcon.d.ts +34 -0
  158. package/dist/components/core/button-icon/ButtonIcon.js +117 -0
  159. package/dist/components/core/button-icon/ButtonIcon.types.d.ts +41 -0
  160. package/dist/components/core/button-icon/ButtonIcon.types.js +8 -0
  161. package/dist/components/core/card/Card.css +65 -0
  162. package/dist/components/core/card/Card.d.ts +24 -0
  163. package/dist/components/core/card/Card.js +26 -0
  164. package/dist/components/core/card/Card.types.d.ts +33 -0
  165. package/dist/components/core/card/Card.types.js +7 -0
  166. package/dist/components/core/card-body/CardBody.css +139 -0
  167. package/dist/components/core/card-body/CardBody.d.ts +62 -0
  168. package/dist/components/core/card-body/CardBody.js +97 -0
  169. package/dist/components/core/card-body/CardBody.types.d.ts +61 -0
  170. package/dist/components/core/card-body/CardBody.types.js +15 -0
  171. package/dist/components/core/card-body/card-body-impl.css +87 -0
  172. package/dist/components/core/card-button/CardButton.css +73 -0
  173. package/dist/components/core/card-button/CardButton.d.ts +27 -0
  174. package/dist/components/core/card-button/CardButton.js +37 -0
  175. package/dist/components/core/card-button/CardButton.types.d.ts +24 -0
  176. package/dist/components/core/card-button/CardButton.types.js +7 -0
  177. package/dist/components/core/card-button/card-button-impl.css +39 -0
  178. package/dist/components/core/checkbox/Checkbox.css +149 -0
  179. package/dist/components/core/checkbox/Checkbox.d.ts +21 -0
  180. package/dist/components/core/checkbox/Checkbox.js +97 -0
  181. package/dist/components/core/checkbox/Checkbox.types.d.ts +46 -0
  182. package/dist/components/core/checkbox/Checkbox.types.js +15 -0
  183. package/dist/components/core/checkbox/checkbox-impl.css +90 -0
  184. package/dist/components/core/divider/Divider.css +41 -0
  185. package/dist/components/core/divider/Divider.d.ts +46 -0
  186. package/dist/components/core/divider/Divider.js +51 -0
  187. package/dist/components/core/divider/Divider.types.d.ts +25 -0
  188. package/dist/components/core/divider/Divider.types.js +9 -0
  189. package/dist/components/core/dropdown-menu/DropdownMenu.css +146 -0
  190. package/dist/components/core/dropdown-menu/DropdownMenu.d.ts +22 -0
  191. package/dist/components/core/dropdown-menu/DropdownMenu.js +309 -0
  192. package/dist/components/core/dropdown-menu/DropdownMenu.types.d.ts +62 -0
  193. package/dist/components/core/dropdown-menu/DropdownMenu.types.js +12 -0
  194. package/dist/components/core/dropdown-menu/dropdown-menu-impl.css +70 -0
  195. package/dist/components/core/filter-chip/FilterChip.css +149 -0
  196. package/dist/components/core/filter-chip/FilterChip.d.ts +23 -0
  197. package/dist/components/core/filter-chip/FilterChip.js +37 -0
  198. package/dist/components/core/filter-chip/FilterChip.types.d.ts +53 -0
  199. package/dist/components/core/filter-chip/FilterChip.types.js +12 -0
  200. package/dist/components/core/footer/Footer.css +104 -0
  201. package/dist/components/core/footer/Footer.d.ts +43 -0
  202. package/dist/components/core/footer/Footer.js +53 -0
  203. package/dist/components/core/footer/Footer.types.d.ts +47 -0
  204. package/dist/components/core/footer/Footer.types.js +18 -0
  205. package/dist/components/core/footer/footer-impl.css +218 -0
  206. package/dist/components/core/footer-group/FooterGroup.css +90 -0
  207. package/dist/components/core/footer-group/FooterGroup.d.ts +32 -0
  208. package/dist/components/core/footer-group/FooterGroup.js +64 -0
  209. package/dist/components/core/footer-group/FooterGroup.types.d.ts +25 -0
  210. package/dist/components/core/footer-group/FooterGroup.types.js +12 -0
  211. package/dist/components/core/footer-group/footer-group-impl.css +78 -0
  212. package/dist/components/core/icon/Icon.css +40 -0
  213. package/dist/components/core/icon/Icon.d.ts +23 -0
  214. package/dist/components/core/icon/Icon.js +79 -0
  215. package/dist/components/core/icon/Icon.types.d.ts +24 -0
  216. package/dist/components/core/icon/Icon.types.js +7 -0
  217. package/dist/components/core/link/Link.css +89 -0
  218. package/dist/components/core/link/Link.d.ts +37 -0
  219. package/dist/components/core/link/Link.js +141 -0
  220. package/dist/components/core/link/Link.types.d.ts +41 -0
  221. package/dist/components/core/link/Link.types.js +9 -0
  222. package/dist/components/core/link/link-impl.css +168 -0
  223. package/dist/components/core/menu-item/MenuItem.css +70 -0
  224. package/dist/components/core/menu-item/MenuItem.d.ts +11 -0
  225. package/dist/components/core/menu-item/MenuItem.js +26 -0
  226. package/dist/components/core/menu-item/MenuItem.types.d.ts +28 -0
  227. package/dist/components/core/menu-item/MenuItem.types.js +9 -0
  228. package/dist/components/core/navbar/Navbar.css +135 -0
  229. package/dist/components/core/navbar/Navbar.d.ts +36 -0
  230. package/dist/components/core/navbar/Navbar.js +371 -0
  231. package/dist/components/core/navbar/Navbar.types.d.ts +49 -0
  232. package/dist/components/core/navbar/Navbar.types.js +17 -0
  233. package/dist/components/core/navbar/navbar-impl.css +590 -0
  234. package/dist/components/core/navbar-item/NavbarItem.css +75 -0
  235. package/dist/components/core/navbar-item/NavbarItem.d.ts +22 -0
  236. package/dist/components/core/navbar-item/NavbarItem.js +40 -0
  237. package/dist/components/core/navbar-item/NavbarItem.types.d.ts +34 -0
  238. package/dist/components/core/navbar-item/NavbarItem.types.js +10 -0
  239. package/dist/components/core/navbar-menu/NavbarMenu.css +128 -0
  240. package/dist/components/core/navbar-menu/NavbarMenu.d.ts +5 -0
  241. package/dist/components/core/navbar-menu/NavbarMenu.js +186 -0
  242. package/dist/components/core/navbar-menu/NavbarMenu.types.d.ts +45 -0
  243. package/dist/components/core/navbar-menu/NavbarMenu.types.js +12 -0
  244. package/dist/components/core/navbar-menu/navbar-menu-impl.css +186 -0
  245. package/dist/components/core/navbar-menu-group/NavbarMenuGroup.css +26 -0
  246. package/dist/components/core/navbar-menu-group/NavbarMenuGroup.d.ts +17 -0
  247. package/dist/components/core/navbar-menu-group/NavbarMenuGroup.js +22 -0
  248. package/dist/components/core/navbar-menu-group/NavbarMenuGroup.types.d.ts +14 -0
  249. package/dist/components/core/navbar-menu-group/NavbarMenuGroup.types.js +7 -0
  250. package/dist/components/core/navbar-panel/NavbarPanel.css +87 -0
  251. package/dist/components/core/navbar-panel/NavbarPanel.d.ts +34 -0
  252. package/dist/components/core/navbar-panel/NavbarPanel.js +46 -0
  253. package/dist/components/core/navbar-panel/NavbarPanel.types.d.ts +29 -0
  254. package/dist/components/core/navbar-panel/NavbarPanel.types.js +12 -0
  255. package/dist/components/core/navbar-panel/navbar-panel-impl.css +104 -0
  256. package/dist/components/core/navbar-panel/use-navbar-panel.d.ts +26 -0
  257. package/dist/components/core/navbar-panel/use-navbar-panel.js +135 -0
  258. package/dist/components/core/navbar-switcher/NavbarSwitcher.css +117 -0
  259. package/dist/components/core/navbar-switcher/NavbarSwitcher.d.ts +20 -0
  260. package/dist/components/core/navbar-switcher/NavbarSwitcher.js +90 -0
  261. package/dist/components/core/navbar-switcher/NavbarSwitcher.types.d.ts +46 -0
  262. package/dist/components/core/navbar-switcher/NavbarSwitcher.types.js +13 -0
  263. package/dist/components/core/navbar-switcher/navbar-switcher-impl.css +179 -0
  264. package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.css +39 -0
  265. package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.d.ts +16 -0
  266. package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.js +19 -0
  267. package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.types.d.ts +18 -0
  268. package/dist/components/core/navbar-switcher-option/NavbarSwitcherOption.types.js +7 -0
  269. package/dist/components/core/option/Option.css +133 -0
  270. package/dist/components/core/option/Option.d.ts +25 -0
  271. package/dist/components/core/option/Option.js +31 -0
  272. package/dist/components/core/option/Option.types.d.ts +44 -0
  273. package/dist/components/core/option/Option.types.js +14 -0
  274. package/dist/components/core/pagination/Pagination.css +237 -0
  275. package/dist/components/core/pagination/Pagination.d.ts +30 -0
  276. package/dist/components/core/pagination/Pagination.js +406 -0
  277. package/dist/components/core/pagination/Pagination.types.d.ts +59 -0
  278. package/dist/components/core/pagination/Pagination.types.js +14 -0
  279. package/dist/components/core/pagination/pagination-impl.css +17 -0
  280. package/dist/components/core/removable-chip/RemovableChip.css +125 -0
  281. package/dist/components/core/removable-chip/RemovableChip.d.ts +25 -0
  282. package/dist/components/core/removable-chip/RemovableChip.js +36 -0
  283. package/dist/components/core/removable-chip/RemovableChip.types.d.ts +38 -0
  284. package/dist/components/core/removable-chip/RemovableChip.types.js +13 -0
  285. package/dist/components/core/search-input/SearchInput.css +205 -0
  286. package/dist/components/core/search-input/SearchInput.d.ts +5 -0
  287. package/dist/components/core/search-input/SearchInput.js +81 -0
  288. package/dist/components/core/search-input/SearchInput.types.d.ts +43 -0
  289. package/dist/components/core/search-input/SearchInput.types.js +13 -0
  290. package/dist/components/core/search-input/search-input-impl.css +20 -0
  291. package/dist/components/core/segmented-control/SegmentedControl.css +57 -0
  292. package/dist/components/core/segmented-control/SegmentedControl.d.ts +37 -0
  293. package/dist/components/core/segmented-control/SegmentedControl.js +269 -0
  294. package/dist/components/core/segmented-control/SegmentedControl.types.d.ts +38 -0
  295. package/dist/components/core/segmented-control/SegmentedControl.types.js +8 -0
  296. package/dist/components/core/segmented-control/segmented-control-impl.css +57 -0
  297. package/dist/components/core/segmented-control-item/SegmentedControlItem.css +151 -0
  298. package/dist/components/core/segmented-control-item/SegmentedControlItem.d.ts +50 -0
  299. package/dist/components/core/segmented-control-item/SegmentedControlItem.js +101 -0
  300. package/dist/components/core/segmented-control-item/SegmentedControlItem.types.d.ts +37 -0
  301. package/dist/components/core/segmented-control-item/SegmentedControlItem.types.js +10 -0
  302. package/dist/components/core/segmented-control-item/segmented-control-item-impl.css +69 -0
  303. package/dist/components/core/select/Select.css +400 -0
  304. package/dist/components/core/select/Select.d.ts +29 -0
  305. package/dist/components/core/select/Select.js +524 -0
  306. package/dist/components/core/select/Select.types.d.ts +96 -0
  307. package/dist/components/core/select/Select.types.js +26 -0
  308. package/dist/components/core/select/select-impl.css +114 -0
  309. package/dist/components/core/select-chip/SelectChip.css +155 -0
  310. package/dist/components/core/select-chip/SelectChip.d.ts +20 -0
  311. package/dist/components/core/select-chip/SelectChip.js +273 -0
  312. package/dist/components/core/select-chip/SelectChip.types.d.ts +56 -0
  313. package/dist/components/core/select-chip/SelectChip.types.js +14 -0
  314. package/dist/components/core/select-chip/select-chip-impl.css +38 -0
  315. package/dist/components/core/spinner/Spinner.css +76 -0
  316. package/dist/components/core/spinner/Spinner.d.ts +5 -0
  317. package/dist/components/core/spinner/Spinner.js +29 -0
  318. package/dist/components/core/spinner/Spinner.types.d.ts +37 -0
  319. package/dist/components/core/spinner/Spinner.types.js +10 -0
  320. package/dist/components/core/spinner/spinner-impl.css +27 -0
  321. package/dist/components/core/status-dot/StatusDot.css +43 -0
  322. package/dist/components/core/status-dot/StatusDot.d.ts +35 -0
  323. package/dist/components/core/status-dot/StatusDot.js +46 -0
  324. package/dist/components/core/status-dot/StatusDot.types.d.ts +29 -0
  325. package/dist/components/core/status-dot/StatusDot.types.js +7 -0
  326. package/dist/components/core/status-dot/status-dot-impl.css +42 -0
  327. package/dist/components/core/subdomain-navbar/SubdomainNavbar.css +89 -0
  328. package/dist/components/core/subdomain-navbar/SubdomainNavbar.d.ts +21 -0
  329. package/dist/components/core/subdomain-navbar/SubdomainNavbar.js +127 -0
  330. package/dist/components/core/subdomain-navbar/SubdomainNavbar.types.d.ts +43 -0
  331. package/dist/components/core/subdomain-navbar/SubdomainNavbar.types.js +13 -0
  332. package/dist/components/core/subdomain-navbar/subdomain-navbar-impl.css +147 -0
  333. package/dist/components/core/tab/Tab.css +113 -0
  334. package/dist/components/core/tab/Tab.d.ts +36 -0
  335. package/dist/components/core/tab/Tab.js +53 -0
  336. package/dist/components/core/tab/Tab.types.d.ts +42 -0
  337. package/dist/components/core/tab/Tab.types.js +13 -0
  338. package/dist/components/core/tab/tab-impl.css +49 -0
  339. package/dist/components/core/tab-list/TabList.css +40 -0
  340. package/dist/components/core/tab-list/TabList.d.ts +26 -0
  341. package/dist/components/core/tab-list/TabList.js +124 -0
  342. package/dist/components/core/tab-list/TabList.types.d.ts +20 -0
  343. package/dist/components/core/tab-list/TabList.types.js +7 -0
  344. package/dist/components/core/tab-list/tab-list-impl.css +56 -0
  345. package/dist/components/core/table/Table.css +40 -0
  346. package/dist/components/core/table/Table.d.ts +19 -0
  347. package/dist/components/core/table/Table.js +55 -0
  348. package/dist/components/core/table/Table.types.d.ts +59 -0
  349. package/dist/components/core/table/Table.types.js +9 -0
  350. package/dist/components/core/table/table-impl.css +75 -0
  351. package/dist/components/core/table/use-table-sort.d.ts +43 -0
  352. package/dist/components/core/table/use-table-sort.js +51 -0
  353. package/dist/components/core/table-body/TableBody.css +6 -0
  354. package/dist/components/core/table-body/TableBody.d.ts +12 -0
  355. package/dist/components/core/table-body/TableBody.js +26 -0
  356. package/dist/components/core/table-body/TableBody.types.d.ts +36 -0
  357. package/dist/components/core/table-body/TableBody.types.js +7 -0
  358. package/dist/components/core/table-cell/TableCell.css +76 -0
  359. package/dist/components/core/table-cell/TableCell.d.ts +21 -0
  360. package/dist/components/core/table-cell/TableCell.js +31 -0
  361. package/dist/components/core/table-cell/TableCell.types.d.ts +43 -0
  362. package/dist/components/core/table-cell/TableCell.types.js +7 -0
  363. package/dist/components/core/table-head/TableHead.css +6 -0
  364. package/dist/components/core/table-head/TableHead.d.ts +22 -0
  365. package/dist/components/core/table-head/TableHead.js +52 -0
  366. package/dist/components/core/table-head/TableHead.types.d.ts +39 -0
  367. package/dist/components/core/table-head/TableHead.types.js +7 -0
  368. package/dist/components/core/table-head/table-head-impl.css +51 -0
  369. package/dist/components/core/table-header-cell/TableHeaderCell.css +126 -0
  370. package/dist/components/core/table-header-cell/TableHeaderCell.d.ts +21 -0
  371. package/dist/components/core/table-header-cell/TableHeaderCell.js +34 -0
  372. package/dist/components/core/table-header-cell/TableHeaderCell.types.d.ts +56 -0
  373. package/dist/components/core/table-header-cell/TableHeaderCell.types.js +9 -0
  374. package/dist/components/core/table-header-cell/table-header-cell-impl.css +74 -0
  375. package/dist/components/core/table-row/TableRow.css +18 -0
  376. package/dist/components/core/table-row/TableRow.d.ts +17 -0
  377. package/dist/components/core/table-row/TableRow.js +32 -0
  378. package/dist/components/core/table-row/TableRow.types.d.ts +45 -0
  379. package/dist/components/core/table-row/TableRow.types.js +7 -0
  380. package/dist/components/core/table-row/table-row-impl.css +31 -0
  381. package/dist/components/core/text-area/TextArea.css +325 -0
  382. package/dist/components/core/text-area/TextArea.d.ts +13 -0
  383. package/dist/components/core/text-area/TextArea.js +133 -0
  384. package/dist/components/core/text-area/TextArea.types.d.ts +67 -0
  385. package/dist/components/core/text-area/TextArea.types.js +19 -0
  386. package/dist/components/core/text-area/text-area-impl.css +36 -0
  387. package/dist/components/core/text-input/TextInput.css +400 -0
  388. package/dist/components/core/text-input/TextInput.d.ts +5 -0
  389. package/dist/components/core/text-input/TextInput.js +130 -0
  390. package/dist/components/core/text-input/TextInput.types.d.ts +96 -0
  391. package/dist/components/core/text-input/TextInput.types.js +24 -0
  392. package/dist/components/core/text-input/text-input-impl.css +36 -0
  393. package/dist/components/core/tooltip/Tooltip.css +101 -0
  394. package/dist/components/core/tooltip/Tooltip.d.ts +51 -0
  395. package/dist/components/core/tooltip/Tooltip.js +87 -0
  396. package/dist/components/core/tooltip/Tooltip.types.d.ts +38 -0
  397. package/dist/components/core/tooltip/Tooltip.types.js +9 -0
  398. package/dist/components/core/tooltip/TooltipAnchor.d.ts +52 -0
  399. package/dist/components/core/tooltip/TooltipAnchor.js +69 -0
  400. package/dist/components/core/tooltip/tooltip-anchor.css +145 -0
  401. package/dist/components/core/tooltip/tooltip-impl.css +54 -0
  402. package/dist/components/core/tooltip/use-tooltip.d.ts +111 -0
  403. package/dist/components/core/tooltip/use-tooltip.js +189 -0
  404. package/dist/components/core/typography/Typography.css +96 -0
  405. package/dist/components/core/typography/Typography.d.ts +297 -0
  406. package/dist/components/core/typography/Typography.js +28 -0
  407. package/dist/components/core/typography/Typography.types.d.ts +40 -0
  408. package/dist/components/core/typography/Typography.types.js +7 -0
  409. package/dist/components/css-time.d.ts +20 -0
  410. package/dist/components/css-time.js +30 -0
  411. package/dist/components/given.d.ts +7 -0
  412. package/dist/components/given.js +9 -0
  413. package/dist/components/hover-open.d.ts +34 -0
  414. package/dist/components/hover-open.js +90 -0
  415. package/dist/components/index.d.ts +114 -1
  416. package/dist/components/index.js +115 -2
  417. package/dist/components/layout/aspect-ratio/AspectRatio.css +29 -0
  418. package/dist/components/layout/aspect-ratio/AspectRatio.d.ts +24 -0
  419. package/dist/components/layout/aspect-ratio/AspectRatio.js +26 -0
  420. package/dist/components/layout/aspect-ratio/AspectRatio.types.d.ts +22 -0
  421. package/dist/components/layout/aspect-ratio/AspectRatio.types.js +7 -0
  422. package/dist/components/layout/aspect-ratio/aspect-ratio-impl.css +44 -0
  423. package/dist/components/layout/grid/Grid.css +76 -0
  424. package/dist/components/layout/grid/Grid.d.ts +31 -0
  425. package/dist/components/layout/grid/Grid.js +33 -0
  426. package/dist/components/layout/grid/Grid.types.d.ts +48 -0
  427. package/dist/components/layout/grid/Grid.types.js +7 -0
  428. package/dist/components/layout/grid/grid-impl.css +62 -0
  429. package/dist/components/layout/row/Row.css +85 -0
  430. package/dist/components/layout/row/Row.d.ts +32 -0
  431. package/dist/components/layout/row/Row.js +34 -0
  432. package/dist/components/layout/row/Row.types.d.ts +45 -0
  433. package/dist/components/layout/row/Row.types.js +7 -0
  434. package/dist/components/layout/scroller/Scroller.css +59 -0
  435. package/dist/components/layout/scroller/Scroller.d.ts +34 -0
  436. package/dist/components/layout/scroller/Scroller.js +36 -0
  437. package/dist/components/layout/scroller/Scroller.types.d.ts +38 -0
  438. package/dist/components/layout/scroller/Scroller.types.js +7 -0
  439. package/dist/components/layout/scroller/scroller-impl.css +45 -0
  440. package/dist/components/layout/stack/Stack.css +73 -0
  441. package/dist/components/layout/stack/Stack.d.ts +28 -0
  442. package/dist/components/layout/stack/Stack.js +30 -0
  443. package/dist/components/layout/stack/Stack.types.d.ts +41 -0
  444. package/dist/components/layout/stack/Stack.types.js +7 -0
  445. package/dist/components/visually-hidden.d.ts +22 -0
  446. package/dist/components/visually-hidden.js +31 -0
  447. package/dist/fonts/LICENSE-inter.txt +93 -0
  448. package/dist/fonts/LICENSE-red-hat-mono.txt +93 -0
  449. package/dist/fonts/fonts.css +111 -0
  450. package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
  451. package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
  452. package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
  453. package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
  454. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  455. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  456. package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
  457. package/dist/fonts/red-hat-mono-latin-ext-wght-normal.woff2 +0 -0
  458. package/dist/fonts/red-hat-mono-latin-wght-normal.woff2 +0 -0
  459. package/dist/marketing.css +289 -241
  460. package/package.json +18 -4
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import './tooltip-anchor.css';
4
+ import { cloneElement } from 'react';
5
+ import { Tooltip } from './Tooltip.js';
6
+ import { tooltipDefaults } from './Tooltip.types.js';
7
+ import { useTooltip } from './use-tooltip.js';
8
+ /**
9
+ * The two boxes this renders. Written here and in tooltip-anchor.css, and nowhere
10
+ * else — there is no generated constant for them, because they are this module's own
11
+ * DOM rather than parts the contract declares. A part declared in the contract has to
12
+ * appear in Tooltip's own markup, and keeping a positioning wrapper out of Tooltip is
13
+ * what this module is for.
14
+ */
15
+ const parts = {
16
+ root: 'dds-tooltip-anchor',
17
+ tip: 'dds-tooltip-anchor__tip',
18
+ };
19
+ /**
20
+ * Both handlers, the trigger's own first.
21
+ *
22
+ * cloneElement replaces rather than merges, so a trigger that already listened for the
23
+ * pointer would silently stop doing so — the kind of loss that shows up as a bug in
24
+ * the consumer's own code, nowhere near here.
25
+ */
26
+ function chain(theirs, ours) {
27
+ if (theirs === undefined)
28
+ return ours;
29
+ return (event) => {
30
+ theirs(event);
31
+ ours(event);
32
+ };
33
+ }
34
+ /**
35
+ * A trigger and its tooltip, placed against each other.
36
+ *
37
+ * `Tooltip` is the chip and nothing else, and `useTooltip` is when it arrives. This is
38
+ * the third thing neither of them does: where it lands. It is a wrapper rather than
39
+ * anything cleverer because the placement is pure CSS — one positioning context around
40
+ * both boxes, and `placement` read by a stylesheet — so there is nothing to measure,
41
+ * nothing to watch for resizes, and no layout pass to be one frame behind.
42
+ *
43
+ * What that buys is that the caret now lands on the point it names. What it does not
44
+ * buy is flipping: a chip whose named side has no room overflows rather than moving to
45
+ * the side that does, because knowing there is no room means measuring the viewport.
46
+ * The contract says as much in its own guidance, and this module does not retract it.
47
+ *
48
+ * Reach past this to `useTooltip` when the trigger is not something this can wrap —
49
+ * one already inside another component, or one that is not an element at all. That is
50
+ * the whole of what an external anchor needs: the hook's `anchorProps` go on whatever
51
+ * the trigger turns out to be, and `tooltipProps` on a chip rendered wherever suits.
52
+ */
53
+ export function TooltipAnchor({ children, content, placement = tooltipDefaults.placement, alignment = tooltipDefaults.alignment, showCaret = tooltipDefaults.showCaret, ...options }) {
54
+ const { anchorProps, tooltipProps } = useTooltip(options);
55
+ const own = children.props;
56
+ const described = own['aria-describedby'];
57
+ const trigger = cloneElement(children, {
58
+ // Appended rather than replaced. A trigger that already carries a description has
59
+ // two of them, and a reader is meant to hear both.
60
+ 'aria-describedby': described === undefined
61
+ ? anchorProps['aria-describedby']
62
+ : `${described} ${anchorProps['aria-describedby']}`,
63
+ onPointerEnter: chain(own.onPointerEnter, anchorProps.onPointerEnter),
64
+ onPointerLeave: chain(own.onPointerLeave, anchorProps.onPointerLeave),
65
+ onFocus: chain(own.onFocus, anchorProps.onFocus),
66
+ onBlur: chain(own.onBlur, anchorProps.onBlur),
67
+ });
68
+ return (_jsxs("span", { className: parts.root, children: [trigger, _jsx("span", { className: parts.tip, "data-placement": placement, "data-alignment": alignment, children: _jsx(Tooltip, { ...tooltipProps, placement: placement, alignment: alignment, showCaret: showCaret, children: content }) })] }));
69
+ }
@@ -0,0 +1,145 @@
1
+ /*
2
+ * Placement for TooltipAnchor, which no contract describes.
3
+ *
4
+ * These two boxes are a behaviour module's own DOM rather than parts of the
5
+ * component's anatomy, and the difference is load-bearing: a part declared in the
6
+ * contract has to appear in Tooltip's own markup — the generated behaviour test
7
+ * asserts exactly that — and keeping a positioning wrapper out of Tooltip is the
8
+ * whole reason this module exists. So the classes are written here and in
9
+ * TooltipAnchor.tsx, and nowhere else.
10
+ *
11
+ * Every value is a token, read through the same custom properties the chip's own
12
+ * generated stylesheet reads. Nothing here is a raw dimension: `100%`, `50%`, `0`
13
+ * and `max-content` are the geometry of "beside the anchor", not sizes anyone would
14
+ * want to tune per brand.
15
+ */
16
+
17
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor {
18
+ /* The positioning context. Inline-block so it hugs the trigger rather than
19
+ whatever column the trigger sits in — otherwise a chip centred on the anchor
20
+ centres on the column, and lands nowhere near the thing it describes. */
21
+ position: relative;
22
+ display: inline-block;
23
+ }
24
+
25
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip {
26
+ position: absolute;
27
+
28
+ /* Out of the flow means shrink-to-fit, and shrink-to-fit against a single inset is
29
+ measured from that inset to the containing block's edge — so a wide chip on a
30
+ narrow trigger would wrap at whatever that distance happened to be. max-content
31
+ puts the measure back on the text, and the chip's own max-inline-size still caps
32
+ it. This is the one thing the preview harness that prototyped this never hit,
33
+ because its trigger was always wider than its sample sentence. */
34
+ width: max-content;
35
+
36
+ /* Never a target. The chip already refuses the pointer, but this box is larger than
37
+ the chip's ink and sits over content the pointer does need. */
38
+ pointer-events: none;
39
+
40
+ /* How far the chip clears the anchor: the caret's own height, so that the gap and
41
+ the thing crossing it scale together. It stays the same with showCaret false —
42
+ a description touching the control it describes reads as part of it. */
43
+ --dds-tooltip-anchor-gap: var(--space-gap-xs);
44
+
45
+ /*
46
+ Above the page it floats over.
47
+ `position: absolute` alone leaves this at `z-index: auto`, which paints in tree
48
+ order among positioned elements — so any positioned sibling declared later covers
49
+ the chip, and a tooltip on the first of two cards loses to the second. Measured
50
+ before this line existed: `tipZ: auto`.
51
+ `layer.popup` rather than a number chosen here. The primitive ramp has carried
52
+ 0/100/200/300/400/800/1600 all along, and the reason components reach for bare
53
+ integers is that no semantic role pointed at it — so this is the first consumer of
54
+ the role rather than the eighth hand-picked value.
55
+ It does not make the chip immune. A z-index only orders siblings within a stacking
56
+ context, so an ancestor that creates one — a transform, a filter, an opacity below
57
+ 1, an isolation — still traps the chip inside it however high this goes. The only
58
+ thing that escapes that is the top layer, which means the popover API and a
59
+ different positioning story. Worth knowing before this is trusted absolutely. */
60
+ z-index: var(--layer-popup);
61
+ }
62
+
63
+ /*
64
+ * Which side the chip sits on, read from `placement` directly rather than through a
65
+ * vocabulary of its own — that prop already names where the tooltip is, which is why
66
+ * it names the placement and not the caret's edge. A lookup translating one name into
67
+ * another is a second opinion waiting to disagree with the contract.
68
+ *
69
+ * Logical insets, because `left` and `right` name the leading and trailing side rather
70
+ * than two points of the compass: a leading-side tooltip is on the right in Arabic, and
71
+ * `inset-inline-end` puts it there with nothing here to help it. The block axis is not
72
+ * mirrored by direction, so `top` and `bottom` mean what they say.
73
+ */
74
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='top'] {
75
+ inset-block-end: 100%;
76
+ margin-block-end: var(--dds-tooltip-anchor-gap);
77
+ }
78
+
79
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='bottom'] {
80
+ inset-block-start: 100%;
81
+ margin-block-start: var(--dds-tooltip-anchor-gap);
82
+ }
83
+
84
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='left'] {
85
+ inset-inline-end: 100%;
86
+ margin-inline-end: var(--dds-tooltip-anchor-gap);
87
+ }
88
+
89
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='right'] {
90
+ inset-inline-start: 100%;
91
+ margin-inline-start: var(--dds-tooltip-anchor-gap);
92
+ }
93
+
94
+ /*
95
+ * Where along that side, which is the axis the placement did not use: the inline axis
96
+ * for a chip above or below, the block axis for one beside. Twelve arrangements in all,
97
+ * which is the number the contract's own guidance names.
98
+ *
99
+ * Centring is the one place a physical inset is correct. `left: 50%` puts the chip's
100
+ * left edge on the anchor's middle and the shift takes back half the chip's width, and
101
+ * those two cancel in either direction — a logical inset would need the shift to change
102
+ * sign with the direction, which is two rules to say what one says here.
103
+ *
104
+ * `start` and `end` share an edge with the anchor instead: the chip's leading edge on
105
+ * the anchor's leading edge, its trailing on the trailing. What they did before was hold
106
+ * the caret's point over the anchor's middle, which is what `center` is already for —
107
+ * two of the three values agreed about the caret and disagreed about the chip, and the
108
+ * chip wider than its anchor hung back across the layout it came from. An inset of zero
109
+ * is the whole rule now, and the caret lands wherever its own inset from that edge puts
110
+ * it: inside any anchor wider than the corner it clears.
111
+ */
112
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='top'][data-alignment='center'],
113
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='bottom'][data-alignment='center'] {
114
+ left: 50%;
115
+ translate: -50% 0;
116
+ }
117
+
118
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='top'][data-alignment='start'],
119
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='bottom'][data-alignment='start'] {
120
+ inset-inline-start: 0;
121
+ }
122
+
123
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='top'][data-alignment='end'],
124
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='bottom'][data-alignment='end'] {
125
+ inset-inline-end: 0;
126
+ }
127
+
128
+ /* The same three arrangements on the block axis, for a chip beside its anchor. The
129
+ harness that prototyped this placed those centred whatever the alignment said, which
130
+ left four of the twelve points unreachable. */
131
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='left'][data-alignment='center'],
132
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='right'][data-alignment='center'] {
133
+ inset-block-start: 50%;
134
+ translate: 0 -50%;
135
+ }
136
+
137
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='left'][data-alignment='start'],
138
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='right'][data-alignment='start'] {
139
+ inset-block-start: 0;
140
+ }
141
+
142
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='left'][data-alignment='end'],
143
+ :where([data-dds-context="marketing"]) .dds-tooltip-anchor__tip[data-placement='right'][data-alignment='end'] {
144
+ inset-block-end: 0;
145
+ }
@@ -0,0 +1,54 @@
1
+ /* Implementation CSS that the contract's staticCss cannot express. */
2
+
3
+ /*
4
+ * The caret's drawing, mirrored for right-to-left.
5
+ *
6
+ * `placement` left and right name the leading and trailing side, not two fixed
7
+ * points of the compass, and the chip's own `flex-direction` is already logical —
8
+ * `row` and `row-reverse` follow the inline direction. So the caret's *box* moves to
9
+ * the correct edge under RTL with nothing here to help it: a tooltip on the leading
10
+ * side is on the right in Arabic, and its caret lands on the left, which is the edge
11
+ * facing the anchor.
12
+ *
13
+ * What cannot follow is the triangle. It is one of four fixed paths in Tooltip.tsx,
14
+ * drawn rather than rotated because an angle is not something a contract can carry,
15
+ * and a path has no way to flip itself. Without this rule the box arrives on the
16
+ * correct edge with the point aimed away from the anchor — the one arrangement worse
17
+ * than having no caret at all.
18
+ *
19
+ * The inline axis only. `top` and `bottom` sit on the block axis, which right-to-left
20
+ * does not mirror; scaling those would take a caret that already points at its anchor
21
+ * and turn it around.
22
+ *
23
+ * `scale` rather than `transform`, so that a consumer's own transform on the part is
24
+ * not silently replaced by this one.
25
+ */
26
+ :where([data-dds-context="marketing"]) .dds-tooltip:dir(rtl)[data-placement='left'] .dds-tooltip__caret,
27
+ :where([data-dds-context="marketing"]) .dds-tooltip:dir(rtl)[data-placement='right'] .dds-tooltip__caret {
28
+ scale: -1 1;
29
+ }
30
+
31
+ /*
32
+ * The transform origin's inline half, mirrored for right-to-left.
33
+ *
34
+ * The chip scales up out of the edge nearest its anchor, and the contract names that
35
+ * edge per placement — `left` places the chip on the leading side, so the edge facing
36
+ * the anchor is its `right`. That holds in English and inverts in Arabic: the leading
37
+ * side is the right, the chip sits there, and the edge facing the anchor is its `left`.
38
+ *
39
+ * `transform-origin` has no logical keyword to say this with. It takes `left` and
40
+ * `right`, never `inline-start` — so unlike `flex-direction` and the logical insets in
41
+ * tooltip-anchor.css, the generated rule cannot follow the direction on its own, and
42
+ * this is the same gap the caret's path above falls into.
43
+ *
44
+ * The inline axis only, for the same reason: `top` and `bottom` sit on the block axis,
45
+ * which right-to-left does not mirror. Without this the chip grows out of the edge
46
+ * facing away from its anchor, which reads as retreating from the control it describes.
47
+ */
48
+ :where([data-dds-context="marketing"]) .dds-tooltip:dir(rtl)[data-placement='left'] {
49
+ transform-origin: left;
50
+ }
51
+
52
+ :where([data-dds-context="marketing"]) .dds-tooltip:dir(rtl)[data-placement='right'] {
53
+ transform-origin: right;
54
+ }
@@ -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-family);
10
+ font-size: var(--font-eyebrow-size);
11
+ font-weight: var(--font-eyebrow-weight);
12
+ letter-spacing: var(--font-eyebrow-letter-spacing);
13
+ line-height: var(--font-eyebrow-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
+