@krelborn/stylesui 0.0.0-stage → 0.9.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 (526) hide show
  1. package/LICENSE +74 -0
  2. package/README.md +129 -2
  3. package/dist/accessibility/RequiredAccessibleName.d.ts +26 -0
  4. package/dist/accessibility/idSegment.d.ts +7 -0
  5. package/dist/accessibility/idSegment.js +5 -0
  6. package/dist/accessibility/index.d.ts +2 -0
  7. package/dist/collections/index.d.ts +7 -0
  8. package/dist/collections/optionId.d.ts +8 -0
  9. package/dist/collections/optionId.js +6 -0
  10. package/dist/collections/renderedOptions.d.ts +37 -0
  11. package/dist/collections/renderedOptions.js +17 -0
  12. package/dist/collections/targetIndexForKey.d.ts +45 -0
  13. package/dist/collections/targetIndexForKey.js +16 -0
  14. package/dist/collections/typeAhead.d.ts +43 -0
  15. package/dist/collections/typeAhead.js +18 -0
  16. package/dist/components/Accordion/Accordion.css +1 -0
  17. package/dist/components/Accordion/Accordion.d.ts +90 -0
  18. package/dist/components/Accordion/Accordion.js +47 -0
  19. package/dist/components/Accordion/Accordion.module.js +19 -0
  20. package/dist/components/Accordion/AccordionContext.d.ts +40 -0
  21. package/dist/components/Accordion/AccordionContext.js +4 -0
  22. package/dist/components/Accordion/AccordionItem.d.ts +51 -0
  23. package/dist/components/Accordion/AccordionItem.js +69 -0
  24. package/dist/components/Accordion/AccordionToggleContent.d.ts +30 -0
  25. package/dist/components/Accordion/AccordionToggleContent.js +44 -0
  26. package/dist/components/Accordion/accordionIds.d.ts +24 -0
  27. package/dist/components/Accordion/accordionIds.js +12 -0
  28. package/dist/components/Accordion/index.d.ts +4 -0
  29. package/dist/components/Accordion/useAccordionContext.d.ts +9 -0
  30. package/dist/components/Accordion/useAccordionContext.js +10 -0
  31. package/dist/components/Accordion/useFindablePanel.d.ts +25 -0
  32. package/dist/components/Accordion/useFindablePanel.js +36 -0
  33. package/dist/components/Accordion/useFragmentTargetReveal.d.ts +27 -0
  34. package/dist/components/Accordion/useFragmentTargetReveal.js +36 -0
  35. package/dist/components/Accordion/useHasOpened.d.ts +7 -0
  36. package/dist/components/Accordion/useHasOpened.js +7 -0
  37. package/dist/components/Alert/Alert.css +1 -0
  38. package/dist/components/Alert/Alert.d.ts +47 -0
  39. package/dist/components/Alert/Alert.js +27 -0
  40. package/dist/components/Alert/Alert.module.js +8 -0
  41. package/dist/components/Alert/AlertIcon.d.ts +14 -0
  42. package/dist/components/Alert/AlertIcon.js +42 -0
  43. package/dist/components/Alert/index.d.ts +2 -0
  44. package/dist/components/Avatar/Avatar.css +1 -0
  45. package/dist/components/Avatar/Avatar.d.ts +33 -0
  46. package/dist/components/Avatar/Avatar.js +26 -0
  47. package/dist/components/Avatar/Avatar.module.js +6 -0
  48. package/dist/components/Avatar/index.d.ts +2 -0
  49. package/dist/components/Avatar/initialsOf.d.ts +9 -0
  50. package/dist/components/Avatar/initialsOf.js +9 -0
  51. package/dist/components/AvatarGroup/AvatarGroup.css +1 -0
  52. package/dist/components/AvatarGroup/AvatarGroup.d.ts +30 -0
  53. package/dist/components/AvatarGroup/AvatarGroup.js +33 -0
  54. package/dist/components/AvatarGroup/AvatarGroup.module.js +6 -0
  55. package/dist/components/AvatarGroup/index.d.ts +2 -0
  56. package/dist/components/Badge/Badge.css +1 -0
  57. package/dist/components/Badge/Badge.d.ts +36 -0
  58. package/dist/components/Badge/Badge.js +15 -0
  59. package/dist/components/Badge/Badge.module.js +3 -0
  60. package/dist/components/Badge/index.d.ts +2 -0
  61. package/dist/components/Box/Box.css +1 -0
  62. package/dist/components/Box/Box.d.ts +31 -0
  63. package/dist/components/Box/Box.js +17 -0
  64. package/dist/components/Box/Box.module.js +3 -0
  65. package/dist/components/Box/index.d.ts +2 -0
  66. package/dist/components/Button/Button.css +1 -0
  67. package/dist/components/Button/Button.d.ts +42 -0
  68. package/dist/components/Button/Button.js +24 -0
  69. package/dist/components/Button/Button.module.js +6 -0
  70. package/dist/components/Button/index.d.ts +2 -0
  71. package/dist/components/Card/Card.css +1 -0
  72. package/dist/components/Card/Card.d.ts +24 -0
  73. package/dist/components/Card/Card.js +14 -0
  74. package/dist/components/Card/Card.module.js +3 -0
  75. package/dist/components/Card/index.d.ts +2 -0
  76. package/dist/components/Center/Center.css +1 -0
  77. package/dist/components/Center/Center.d.ts +34 -0
  78. package/dist/components/Center/Center.js +19 -0
  79. package/dist/components/Center/Center.module.js +3 -0
  80. package/dist/components/Center/index.d.ts +2 -0
  81. package/dist/components/Checkbox/Checkbox.d.ts +23 -0
  82. package/dist/components/Checkbox/Checkbox.js +12 -0
  83. package/dist/components/Checkbox/index.d.ts +2 -0
  84. package/dist/components/ChoiceControl/ChoiceControl.css +1 -0
  85. package/dist/components/ChoiceControl/ChoiceControl.d.ts +21 -0
  86. package/dist/components/ChoiceControl/ChoiceControl.js +39 -0
  87. package/dist/components/ChoiceControl/ChoiceControl.module.js +8 -0
  88. package/dist/components/ChoiceControl/index.d.ts +1 -0
  89. package/dist/components/Cluster/Cluster.d.ts +29 -0
  90. package/dist/components/Cluster/Cluster.js +13 -0
  91. package/dist/components/Cluster/index.d.ts +2 -0
  92. package/dist/components/Code/Code.css +1 -0
  93. package/dist/components/Code/Code.d.ts +13 -0
  94. package/dist/components/Code/Code.js +19 -0
  95. package/dist/components/Code/Code.module.js +3 -0
  96. package/dist/components/Code/index.d.ts +2 -0
  97. package/dist/components/Combobox/Autocomplete.d.ts +83 -0
  98. package/dist/components/Combobox/Autocomplete.js +102 -0
  99. package/dist/components/Combobox/Combobox.css +1 -0
  100. package/dist/components/Combobox/Combobox.d.ts +59 -0
  101. package/dist/components/Combobox/Combobox.js +82 -0
  102. package/dist/components/Combobox/Combobox.module.js +17 -0
  103. package/dist/components/Combobox/ComboboxContext.d.ts +88 -0
  104. package/dist/components/Combobox/ComboboxContext.js +4 -0
  105. package/dist/components/Combobox/ComboboxFieldValue.d.ts +17 -0
  106. package/dist/components/Combobox/ComboboxFieldValue.js +33 -0
  107. package/dist/components/Combobox/ComboboxOption.d.ts +51 -0
  108. package/dist/components/Combobox/ComboboxOption.js +74 -0
  109. package/dist/components/Combobox/ComboboxOptionContent.d.ts +32 -0
  110. package/dist/components/Combobox/ComboboxOptionContent.js +51 -0
  111. package/dist/components/Combobox/ComboboxPopup.d.ts +50 -0
  112. package/dist/components/Combobox/ComboboxPopup.js +59 -0
  113. package/dist/components/Combobox/autocompleteKeys.d.ts +31 -0
  114. package/dist/components/Combobox/autocompleteKeys.js +25 -0
  115. package/dist/components/Combobox/comboboxKeys.d.ts +10 -0
  116. package/dist/components/Combobox/comboboxKeys.js +22 -0
  117. package/dist/components/Combobox/containsText.d.ts +9 -0
  118. package/dist/components/Combobox/containsText.js +8 -0
  119. package/dist/components/Combobox/index.d.ts +6 -0
  120. package/dist/components/Combobox/isAltArrow.d.ts +9 -0
  121. package/dist/components/Combobox/isAltArrow.js +5 -0
  122. package/dist/components/Combobox/isOptionShown.d.ts +10 -0
  123. package/dist/components/Combobox/isOptionShown.js +5 -0
  124. package/dist/components/Combobox/useAutocompleteText.d.ts +56 -0
  125. package/dist/components/Combobox/useAutocompleteText.js +27 -0
  126. package/dist/components/Combobox/useComboboxContext.d.ts +9 -0
  127. package/dist/components/Combobox/useComboboxContext.js +10 -0
  128. package/dist/components/Combobox/useComboboxList.d.ts +129 -0
  129. package/dist/components/Combobox/useComboboxList.js +138 -0
  130. package/dist/components/Combobox/useComboboxOption.d.ts +35 -0
  131. package/dist/components/Combobox/useComboboxOption.js +46 -0
  132. package/dist/components/Combobox/useComboboxSelection.d.ts +45 -0
  133. package/dist/components/Combobox/useComboboxSelection.js +17 -0
  134. package/dist/components/Combobox/useResultsAnnouncement.d.ts +23 -0
  135. package/dist/components/Combobox/useResultsAnnouncement.js +24 -0
  136. package/dist/components/ContextMenu/index.d.ts +2 -0
  137. package/dist/components/ContextMenu/useContextMenu.d.ts +112 -0
  138. package/dist/components/ContextMenu/useContextMenu.js +202 -0
  139. package/dist/components/ContextMenu/watchLongPress.d.ts +35 -0
  140. package/dist/components/ContextMenu/watchLongPress.js +38 -0
  141. package/dist/components/Counter/Counter.css +1 -0
  142. package/dist/components/Counter/Counter.d.ts +39 -0
  143. package/dist/components/Counter/Counter.js +18 -0
  144. package/dist/components/Counter/Counter.module.js +3 -0
  145. package/dist/components/Counter/index.d.ts +2 -0
  146. package/dist/components/Cover/Cover.css +1 -0
  147. package/dist/components/Cover/Cover.d.ts +40 -0
  148. package/dist/components/Cover/Cover.js +29 -0
  149. package/dist/components/Cover/Cover.module.js +6 -0
  150. package/dist/components/Cover/index.d.ts +2 -0
  151. package/dist/components/Divider/Divider.css +1 -0
  152. package/dist/components/Divider/Divider.d.ts +25 -0
  153. package/dist/components/Divider/Divider.js +15 -0
  154. package/dist/components/Divider/Divider.module.js +3 -0
  155. package/dist/components/Divider/index.d.ts +2 -0
  156. package/dist/components/Field/Field.css +1 -0
  157. package/dist/components/Field/Field.d.ts +49 -0
  158. package/dist/components/Field/Field.js +49 -0
  159. package/dist/components/Field/Field.module.js +8 -0
  160. package/dist/components/Field/index.d.ts +2 -0
  161. package/dist/components/Fieldset/Fieldset.css +1 -0
  162. package/dist/components/Fieldset/Fieldset.d.ts +35 -0
  163. package/dist/components/Fieldset/Fieldset.js +64 -0
  164. package/dist/components/Fieldset/Fieldset.module.js +8 -0
  165. package/dist/components/Fieldset/index.d.ts +2 -0
  166. package/dist/components/Frame/Frame.css +1 -0
  167. package/dist/components/Frame/Frame.d.ts +23 -0
  168. package/dist/components/Frame/Frame.js +16 -0
  169. package/dist/components/Frame/Frame.module.js +3 -0
  170. package/dist/components/Frame/index.d.ts +2 -0
  171. package/dist/components/Grid/Grid.css +1 -0
  172. package/dist/components/Grid/Grid.d.ts +25 -0
  173. package/dist/components/Grid/Grid.js +22 -0
  174. package/dist/components/Grid/Grid.module.js +3 -0
  175. package/dist/components/Grid/index.d.ts +2 -0
  176. package/dist/components/Heading/Heading.css +1 -0
  177. package/dist/components/Heading/Heading.d.ts +39 -0
  178. package/dist/components/Heading/Heading.js +23 -0
  179. package/dist/components/Heading/Heading.module.js +3 -0
  180. package/dist/components/Heading/index.d.ts +2 -0
  181. package/dist/components/HorizontalFlow/HorizontalFlow.css +1 -0
  182. package/dist/components/HorizontalFlow/HorizontalFlow.d.ts +30 -0
  183. package/dist/components/HorizontalFlow/HorizontalFlow.js +30 -0
  184. package/dist/components/HorizontalFlow/HorizontalFlow.module.js +3 -0
  185. package/dist/components/HorizontalFlow/index.d.ts +2 -0
  186. package/dist/components/Icon/AddIcon.d.ts +11 -0
  187. package/dist/components/Icon/AddIcon.js +21 -0
  188. package/dist/components/Icon/CheckIcon.d.ts +11 -0
  189. package/dist/components/Icon/CheckIcon.js +18 -0
  190. package/dist/components/Icon/ChevronDownIcon.d.ts +11 -0
  191. package/dist/components/Icon/ChevronDownIcon.js +18 -0
  192. package/dist/components/Icon/ChevronRightIcon.d.ts +11 -0
  193. package/dist/components/Icon/ChevronRightIcon.js +19 -0
  194. package/dist/components/Icon/CloseIcon.d.ts +12 -0
  195. package/dist/components/Icon/CloseIcon.js +21 -0
  196. package/dist/components/Icon/ColorModeIcon.d.ts +12 -0
  197. package/dist/components/Icon/ColorModeIcon.js +36 -0
  198. package/dist/components/Icon/DeleteIcon.d.ts +11 -0
  199. package/dist/components/Icon/DeleteIcon.js +36 -0
  200. package/dist/components/Icon/Icon.css +1 -0
  201. package/dist/components/Icon/Icon.d.ts +40 -0
  202. package/dist/components/Icon/Icon.js +27 -0
  203. package/dist/components/Icon/Icon.module.js +6 -0
  204. package/dist/components/Icon/InfoIcon.d.ts +11 -0
  205. package/dist/components/Icon/InfoIcon.js +30 -0
  206. package/dist/components/Icon/MenuIcon.d.ts +12 -0
  207. package/dist/components/Icon/MenuIcon.js +28 -0
  208. package/dist/components/Icon/MoreHorizontalIcon.d.ts +11 -0
  209. package/dist/components/Icon/MoreHorizontalIcon.js +34 -0
  210. package/dist/components/Icon/MoreVerticalIcon.d.ts +11 -0
  211. package/dist/components/Icon/MoreVerticalIcon.js +34 -0
  212. package/dist/components/Icon/PaletteIcon.d.ts +12 -0
  213. package/dist/components/Icon/PaletteIcon.js +48 -0
  214. package/dist/components/Icon/RefreshIcon.d.ts +13 -0
  215. package/dist/components/Icon/RefreshIcon.js +32 -0
  216. package/dist/components/Icon/RemoveIcon.d.ts +11 -0
  217. package/dist/components/Icon/RemoveIcon.js +18 -0
  218. package/dist/components/Icon/SendIcon.d.ts +11 -0
  219. package/dist/components/Icon/SendIcon.js +22 -0
  220. package/dist/components/Icon/index.d.ts +16 -0
  221. package/dist/components/IconButton/IconButton.css +1 -0
  222. package/dist/components/IconButton/IconButton.d.ts +45 -0
  223. package/dist/components/IconButton/IconButton.js +40 -0
  224. package/dist/components/IconButton/IconButton.module.js +7 -0
  225. package/dist/components/IconButton/index.d.ts +2 -0
  226. package/dist/components/Kbd/Kbd.css +1 -0
  227. package/dist/components/Kbd/Kbd.d.ts +13 -0
  228. package/dist/components/Kbd/Kbd.js +19 -0
  229. package/dist/components/Kbd/Kbd.module.js +3 -0
  230. package/dist/components/Kbd/index.d.ts +2 -0
  231. package/dist/components/Link/Link.css +1 -0
  232. package/dist/components/Link/Link.d.ts +52 -0
  233. package/dist/components/Link/Link.js +26 -0
  234. package/dist/components/Link/Link.module.js +3 -0
  235. package/dist/components/Link/index.d.ts +2 -0
  236. package/dist/components/Listbox/Listbox.css +1 -0
  237. package/dist/components/Listbox/Listbox.d.ts +46 -0
  238. package/dist/components/Listbox/Listbox.js +55 -0
  239. package/dist/components/Listbox/Listbox.module.js +6 -0
  240. package/dist/components/Listbox/ListboxContext.d.ts +38 -0
  241. package/dist/components/Listbox/ListboxContext.js +4 -0
  242. package/dist/components/Listbox/ListboxOption.d.ts +31 -0
  243. package/dist/components/Listbox/ListboxOption.js +42 -0
  244. package/dist/components/Listbox/index.d.ts +4 -0
  245. package/dist/components/Listbox/useListbox.d.ts +54 -0
  246. package/dist/components/Listbox/useListbox.js +103 -0
  247. package/dist/components/Listbox/useListboxContext.d.ts +9 -0
  248. package/dist/components/Listbox/useListboxContext.js +10 -0
  249. package/dist/components/Menu/Menu.d.ts +70 -0
  250. package/dist/components/Menu/Menu.js +76 -0
  251. package/dist/components/Menu/MenuContext.d.ts +29 -0
  252. package/dist/components/Menu/MenuContext.js +4 -0
  253. package/dist/components/Menu/MenuGroup.d.ts +22 -0
  254. package/dist/components/Menu/MenuGroup.js +32 -0
  255. package/dist/components/Menu/MenuItem.d.ts +77 -0
  256. package/dist/components/Menu/MenuItem.js +54 -0
  257. package/dist/components/Menu/MenuItemCheckbox.d.ts +61 -0
  258. package/dist/components/Menu/MenuItemCheckbox.js +37 -0
  259. package/dist/components/Menu/MenuItemRadio.d.ts +47 -0
  260. package/dist/components/Menu/MenuItemRadio.js +39 -0
  261. package/dist/components/Menu/MenuRadioGroup.d.ts +34 -0
  262. package/dist/components/Menu/MenuRadioGroup.js +27 -0
  263. package/dist/components/Menu/MenuRadioGroupContext.d.ts +17 -0
  264. package/dist/components/Menu/MenuRadioGroupContext.js +4 -0
  265. package/dist/components/Menu/MenuSeparator.d.ts +16 -0
  266. package/dist/components/Menu/MenuSeparator.js +20 -0
  267. package/dist/components/Menu/Submenu.d.ts +36 -0
  268. package/dist/components/Menu/Submenu.js +122 -0
  269. package/dist/components/Menu/index.d.ts +18 -0
  270. package/dist/components/Menu/useMenu.d.ts +18 -0
  271. package/dist/components/Menu/useMenu.js +20 -0
  272. package/dist/components/Menu/useMenuButton.d.ts +124 -0
  273. package/dist/components/Menu/useMenuButton.js +92 -0
  274. package/dist/components/Menu/useMenuContext.d.ts +9 -0
  275. package/dist/components/Menu/useMenuContext.js +10 -0
  276. package/dist/components/Menu/useMenuItemContent.d.ts +55 -0
  277. package/dist/components/Menu/useMenuItemContent.js +66 -0
  278. package/dist/components/Menu/useMenuPointer.d.ts +27 -0
  279. package/dist/components/Menu/useMenuPointer.js +56 -0
  280. package/dist/components/Menu/useMenuRadioGroupContext.d.ts +9 -0
  281. package/dist/components/Menu/useMenuRadioGroupContext.js +10 -0
  282. package/dist/components/MenuSurface/MenuSurface.css +1 -0
  283. package/dist/components/MenuSurface/MenuSurface.module.js +16 -0
  284. package/dist/components/Menubar/Menubar.css +1 -0
  285. package/dist/components/Menubar/Menubar.d.ts +23 -0
  286. package/dist/components/Menubar/Menubar.js +67 -0
  287. package/dist/components/Menubar/Menubar.module.js +7 -0
  288. package/dist/components/Menubar/MenubarContext.d.ts +29 -0
  289. package/dist/components/Menubar/MenubarContext.js +4 -0
  290. package/dist/components/Menubar/MenubarMenu.d.ts +26 -0
  291. package/dist/components/Menubar/MenubarMenu.js +88 -0
  292. package/dist/components/Menubar/findOpenMenubarItem.d.ts +7 -0
  293. package/dist/components/Menubar/findOpenMenubarItem.js +6 -0
  294. package/dist/components/Menubar/index.d.ts +4 -0
  295. package/dist/components/Menubar/menubarItems.d.ts +7 -0
  296. package/dist/components/Menubar/menubarItems.js +5 -0
  297. package/dist/components/Menubar/useMenubarContext.d.ts +9 -0
  298. package/dist/components/Menubar/useMenubarContext.js +10 -0
  299. package/dist/components/NavBar/NavBar.css +1 -0
  300. package/dist/components/NavBar/NavBar.d.ts +53 -0
  301. package/dist/components/NavBar/NavBar.js +97 -0
  302. package/dist/components/NavBar/NavBar.module.js +22 -0
  303. package/dist/components/NavBar/NavBarContext.d.ts +21 -0
  304. package/dist/components/NavBar/NavBarContext.js +4 -0
  305. package/dist/components/NavBar/NavBarItem.d.ts +32 -0
  306. package/dist/components/NavBar/NavBarItem.js +18 -0
  307. package/dist/components/NavBar/NavBarMenu.d.ts +32 -0
  308. package/dist/components/NavBar/NavBarMenu.js +84 -0
  309. package/dist/components/NavBar/NavBarMenuGroup.d.ts +25 -0
  310. package/dist/components/NavBar/NavBarMenuGroup.js +40 -0
  311. package/dist/components/NavBar/NavBarMenuItem.d.ts +36 -0
  312. package/dist/components/NavBar/NavBarMenuItem.js +49 -0
  313. package/dist/components/NavBar/index.d.ts +10 -0
  314. package/dist/components/NavBar/isNavBarCollapsed.d.ts +8 -0
  315. package/dist/components/NavBar/isNavBarCollapsed.js +5 -0
  316. package/dist/components/NavBar/leavesPageInPlace.d.ts +12 -0
  317. package/dist/components/NavBar/leavesPageInPlace.js +29 -0
  318. package/dist/components/NavBar/renderNavBarLink.d.ts +12 -0
  319. package/dist/components/NavBar/renderNavBarLink.js +16 -0
  320. package/dist/components/NavBar/useLayoutSwitch.d.ts +26 -0
  321. package/dist/components/NavBar/useLayoutSwitch.js +25 -0
  322. package/dist/components/NavBar/useNavBarContext.d.ts +9 -0
  323. package/dist/components/NavBar/useNavBarContext.js +10 -0
  324. package/dist/components/NavList/NavList.css +1 -0
  325. package/dist/components/NavList/NavList.d.ts +20 -0
  326. package/dist/components/NavList/NavList.js +27 -0
  327. package/dist/components/NavList/NavList.module.js +11 -0
  328. package/dist/components/NavList/NavListGroup.d.ts +25 -0
  329. package/dist/components/NavList/NavListGroup.js +39 -0
  330. package/dist/components/NavList/NavListItem.d.ts +49 -0
  331. package/dist/components/NavList/NavListItem.js +56 -0
  332. package/dist/components/NavList/index.d.ts +6 -0
  333. package/dist/components/Overlay/Overlay.css +1 -0
  334. package/dist/components/Overlay/Overlay.d.ts +33 -0
  335. package/dist/components/Overlay/Overlay.js +35 -0
  336. package/dist/components/Overlay/Overlay.module.js +3 -0
  337. package/dist/components/Overlay/index.d.ts +1 -0
  338. package/dist/components/PageLayout/PageLayout.css +1 -0
  339. package/dist/components/PageLayout/PageLayout.d.ts +26 -0
  340. package/dist/components/PageLayout/PageLayout.js +17 -0
  341. package/dist/components/PageLayout/PageLayout.module.js +3 -0
  342. package/dist/components/PageLayout/index.d.ts +2 -0
  343. package/dist/components/Popover/Popover.css +1 -0
  344. package/dist/components/Popover/Popover.d.ts +52 -0
  345. package/dist/components/Popover/Popover.js +20 -0
  346. package/dist/components/Popover/Popover.module.js +3 -0
  347. package/dist/components/Popover/index.d.ts +4 -0
  348. package/dist/components/Popover/usePopover.d.ts +96 -0
  349. package/dist/components/Popover/usePopover.js +71 -0
  350. package/dist/components/Prose/Prose.css +1 -0
  351. package/dist/components/Prose/Prose.d.ts +50 -0
  352. package/dist/components/Prose/Prose.js +15 -0
  353. package/dist/components/Prose/Prose.module.js +3 -0
  354. package/dist/components/Prose/index.d.ts +2 -0
  355. package/dist/components/Radio/Radio.d.ts +29 -0
  356. package/dist/components/Radio/Radio.js +23 -0
  357. package/dist/components/Radio/index.d.ts +2 -0
  358. package/dist/components/RadioGroup/RadioGroup.css +1 -0
  359. package/dist/components/RadioGroup/RadioGroup.d.ts +58 -0
  360. package/dist/components/RadioGroup/RadioGroup.js +36 -0
  361. package/dist/components/RadioGroup/RadioGroup.module.js +3 -0
  362. package/dist/components/RadioGroup/index.d.ts +2 -0
  363. package/dist/components/RequiredIndicator/RequiredIndicator.css +1 -0
  364. package/dist/components/RequiredIndicator/RequiredIndicator.d.ts +6 -0
  365. package/dist/components/RequiredIndicator/RequiredIndicator.js +15 -0
  366. package/dist/components/RequiredIndicator/RequiredIndicator.module.js +3 -0
  367. package/dist/components/RequiredIndicator/index.d.ts +1 -0
  368. package/dist/components/Row/Row.d.ts +29 -0
  369. package/dist/components/Row/Row.js +13 -0
  370. package/dist/components/Row/index.d.ts +2 -0
  371. package/dist/components/SegmentedControl/Segment.d.ts +24 -0
  372. package/dist/components/SegmentedControl/Segment.js +41 -0
  373. package/dist/components/SegmentedControl/SegmentedControl.css +1 -0
  374. package/dist/components/SegmentedControl/SegmentedControl.d.ts +25 -0
  375. package/dist/components/SegmentedControl/SegmentedControl.js +19 -0
  376. package/dist/components/SegmentedControl/SegmentedControl.module.js +9 -0
  377. package/dist/components/SegmentedControl/index.d.ts +4 -0
  378. package/dist/components/Select/Select.d.ts +27 -0
  379. package/dist/components/Select/Select.js +11 -0
  380. package/dist/components/Select/index.d.ts +2 -0
  381. package/dist/components/Sidebar/Sidebar.css +1 -0
  382. package/dist/components/Sidebar/Sidebar.d.ts +42 -0
  383. package/dist/components/Sidebar/Sidebar.js +23 -0
  384. package/dist/components/Sidebar/Sidebar.module.js +3 -0
  385. package/dist/components/Sidebar/index.d.ts +2 -0
  386. package/dist/components/SkipLink/SkipLink.css +1 -0
  387. package/dist/components/SkipLink/SkipLink.d.ts +20 -0
  388. package/dist/components/SkipLink/SkipLink.js +20 -0
  389. package/dist/components/SkipLink/SkipLink.module.js +3 -0
  390. package/dist/components/SkipLink/index.d.ts +2 -0
  391. package/dist/components/Spinner/Spinner.css +1 -0
  392. package/dist/components/Spinner/Spinner.d.ts +13 -0
  393. package/dist/components/Spinner/Spinner.js +32 -0
  394. package/dist/components/Spinner/Spinner.module.js +7 -0
  395. package/dist/components/Spinner/index.d.ts +1 -0
  396. package/dist/components/Stack/Stack.css +1 -0
  397. package/dist/components/Stack/Stack.d.ts +25 -0
  398. package/dist/components/Stack/Stack.js +20 -0
  399. package/dist/components/Stack/Stack.module.js +3 -0
  400. package/dist/components/Stack/index.d.ts +2 -0
  401. package/dist/components/StatusDot/StatusDot.css +1 -0
  402. package/dist/components/StatusDot/StatusDot.d.ts +57 -0
  403. package/dist/components/StatusDot/StatusDot.js +20 -0
  404. package/dist/components/StatusDot/StatusDot.module.js +3 -0
  405. package/dist/components/StatusDot/index.d.ts +2 -0
  406. package/dist/components/Switch/Switch.d.ts +24 -0
  407. package/dist/components/Switch/Switch.js +12 -0
  408. package/dist/components/Switch/index.d.ts +2 -0
  409. package/dist/components/Switcher/Switcher.css +1 -0
  410. package/dist/components/Switcher/Switcher.d.ts +27 -0
  411. package/dist/components/Switcher/Switcher.js +22 -0
  412. package/dist/components/Switcher/Switcher.module.js +3 -0
  413. package/dist/components/Switcher/index.d.ts +2 -0
  414. package/dist/components/Tabs/Tab.d.ts +26 -0
  415. package/dist/components/Tabs/Tab.js +60 -0
  416. package/dist/components/Tabs/TabList.d.ts +16 -0
  417. package/dist/components/Tabs/TabList.js +22 -0
  418. package/dist/components/Tabs/TabPanel.d.ts +24 -0
  419. package/dist/components/Tabs/TabPanel.js +21 -0
  420. package/dist/components/Tabs/Tabs.css +1 -0
  421. package/dist/components/Tabs/Tabs.d.ts +81 -0
  422. package/dist/components/Tabs/Tabs.js +30 -0
  423. package/dist/components/Tabs/Tabs.module.js +8 -0
  424. package/dist/components/Tabs/TabsContext.d.ts +39 -0
  425. package/dist/components/Tabs/TabsContext.js +4 -0
  426. package/dist/components/Tabs/index.d.ts +8 -0
  427. package/dist/components/Tabs/tabIds.d.ts +16 -0
  428. package/dist/components/Tabs/tabIds.js +9 -0
  429. package/dist/components/Tabs/useTabsContext.d.ts +9 -0
  430. package/dist/components/Tabs/useTabsContext.js +10 -0
  431. package/dist/components/Text/Text.css +1 -0
  432. package/dist/components/Text/Text.d.ts +40 -0
  433. package/dist/components/Text/Text.js +16 -0
  434. package/dist/components/Text/Text.module.js +3 -0
  435. package/dist/components/Text/index.d.ts +2 -0
  436. package/dist/components/TextControl/TextControl.css +1 -0
  437. package/dist/components/TextControl/TextControl.d.ts +22 -0
  438. package/dist/components/TextControl/TextControl.js +27 -0
  439. package/dist/components/TextControl/TextControl.module.js +3 -0
  440. package/dist/components/TextControl/index.d.ts +1 -0
  441. package/dist/components/TextInput/TextInput.d.ts +31 -0
  442. package/dist/components/TextInput/TextInput.js +12 -0
  443. package/dist/components/TextInput/index.d.ts +2 -0
  444. package/dist/components/Textarea/Textarea.d.ts +24 -0
  445. package/dist/components/Textarea/Textarea.js +11 -0
  446. package/dist/components/Textarea/index.d.ts +2 -0
  447. package/dist/components/Theme/Theme.d.ts +46 -0
  448. package/dist/components/Theme/Theme.js +17 -0
  449. package/dist/components/Theme/index.d.ts +2 -0
  450. package/dist/components/Tooltip/Tooltip.css +1 -0
  451. package/dist/components/Tooltip/Tooltip.d.ts +49 -0
  452. package/dist/components/Tooltip/Tooltip.js +21 -0
  453. package/dist/components/Tooltip/Tooltip.module.js +3 -0
  454. package/dist/components/Tooltip/index.d.ts +4 -0
  455. package/dist/components/Tooltip/tooltipCoordinator.d.ts +14 -0
  456. package/dist/components/Tooltip/tooltipCoordinator.js +16 -0
  457. package/dist/components/Tooltip/useTooltip.d.ts +119 -0
  458. package/dist/components/Tooltip/useTooltip.js +73 -0
  459. package/dist/components/VisuallyHidden/VisuallyHidden.css +1 -0
  460. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +14 -0
  461. package/dist/components/VisuallyHidden/VisuallyHidden.js +19 -0
  462. package/dist/components/VisuallyHidden/VisuallyHidden.module.js +3 -0
  463. package/dist/components/VisuallyHidden/index.d.ts +2 -0
  464. package/dist/errors/MissingContextError.d.ts +11 -0
  465. package/dist/errors/MissingContextError.js +8 -0
  466. package/dist/errors/PopoverRefusedError.d.ts +12 -0
  467. package/dist/errors/PopoverRefusedError.js +8 -0
  468. package/dist/errors/index.d.ts +2 -0
  469. package/dist/forms/ControlSize.d.ts +4 -0
  470. package/dist/forms/FieldContext.d.ts +34 -0
  471. package/dist/forms/FieldContext.js +4 -0
  472. package/dist/forms/RadioGroupContext.d.ts +34 -0
  473. package/dist/forms/RadioGroupContext.js +4 -0
  474. package/dist/forms/hasContent.d.ts +10 -0
  475. package/dist/forms/hasContent.js +6 -0
  476. package/dist/forms/index.d.ts +8 -0
  477. package/dist/forms/useFieldControl.d.ts +36 -0
  478. package/dist/forms/useFieldControl.js +28 -0
  479. package/dist/forms/useRadioGroupItem.d.ts +50 -0
  480. package/dist/forms/useRadioGroupItem.js +26 -0
  481. package/dist/index.d.ts +107 -0
  482. package/dist/index.js +92 -0
  483. package/dist/layout/Space.d.ts +4 -0
  484. package/dist/layout/alignment.d.ts +8 -0
  485. package/dist/layout/index.d.ts +5 -0
  486. package/dist/layout/listRole.d.ts +11 -0
  487. package/dist/layout/listRole.js +5 -0
  488. package/dist/layout/spaceValue.d.ts +8 -0
  489. package/dist/layout/spaceValue.js +5 -0
  490. package/dist/layout/withCustomProperties.d.ts +9 -0
  491. package/dist/layout/withCustomProperties.js +8 -0
  492. package/dist/links/LinkOrButtonProps.d.ts +17 -0
  493. package/dist/links/index.d.ts +1 -0
  494. package/dist/menus/closeWhenFocusLeaves.d.ts +9 -0
  495. package/dist/menus/closeWhenFocusLeaves.js +11 -0
  496. package/dist/menus/focusItem.d.ts +6 -0
  497. package/dist/menus/focusItem.js +9 -0
  498. package/dist/menus/focusOnOpening.d.ts +11 -0
  499. package/dist/menus/focusOnOpening.js +11 -0
  500. package/dist/menus/hasModifier.d.ts +7 -0
  501. package/dist/menus/hasModifier.js +5 -0
  502. package/dist/menus/index.d.ts +11 -0
  503. package/dist/menus/itemText.d.ts +8 -0
  504. package/dist/menus/itemText.js +6 -0
  505. package/dist/menus/leaveMenuOnTab.d.ts +9 -0
  506. package/dist/menus/leaveMenuOnTab.js +6 -0
  507. package/dist/menus/pointerIntent.d.ts +36 -0
  508. package/dist/menus/pointerIntent.js +68 -0
  509. package/dist/menus/renderedItems.d.ts +8 -0
  510. package/dist/menus/renderedItems.js +4 -0
  511. package/dist/menus/watchRemovals.d.ts +8 -0
  512. package/dist/menus/watchRemovals.js +23 -0
  513. package/dist/overlays/OverlayDelay.d.ts +13 -0
  514. package/dist/overlays/OverlayPlacement.d.ts +6 -0
  515. package/dist/overlays/anchorNameFor.d.ts +7 -0
  516. package/dist/overlays/anchorNameFor.js +5 -0
  517. package/dist/overlays/index.d.ts +6 -0
  518. package/dist/overlays/mergeProps.d.ts +13 -0
  519. package/dist/overlays/mergeProps.js +29 -0
  520. package/dist/overlays/syncPopover.d.ts +11 -0
  521. package/dist/overlays/syncPopover.js +24 -0
  522. package/dist/overlays/useOverlay.d.ts +71 -0
  523. package/dist/overlays/useOverlay.js +49 -0
  524. package/dist/styles.css +1 -0
  525. package/fonts/playful.css +3 -0
  526. package/package.json +103 -3
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reads the items a menubar renders
3
+ *
4
+ * @param menubar the menubar element
5
+ * @returns its own items in document order, leaving out the items of the menus they open
6
+ */
7
+ export declare function menubarItems(menubar: Element): HTMLElement[];
@@ -0,0 +1,5 @@
1
+ // src/components/Menubar/menubarItems.ts
2
+ function e(e) {
3
+ return Array.from(e.querySelectorAll("[role=\"menuitem\"]")).filter((t) => t.parentElement?.closest("[role=\"menu\"], [role=\"menubar\"]") === e);
4
+ }
5
+ export { e as menubarItems };
@@ -0,0 +1,9 @@
1
+ import type { MenubarContextValue } from "./MenubarContext";
2
+ /**
3
+ * Reads the state of the surrounding `Menubar`
4
+ *
5
+ * @param part the name of the part reading it, for the error message
6
+ * @returns the surrounding `Menubar`'s state
7
+ * @throws MissingContextError when the part is not inside a `Menubar`
8
+ */
9
+ export declare function useMenubarContext(part: string): MenubarContextValue;
@@ -0,0 +1,10 @@
1
+ import { MissingContextError as e } from "../../errors/MissingContextError.js";
2
+ import { MenubarContext as t } from "./MenubarContext.js";
3
+ import { useContext as n } from "react";
4
+ // src/components/Menubar/useMenubarContext.ts
5
+ function r(r) {
6
+ let i = n(t);
7
+ if (i === null) throw new e(r, "Menubar");
8
+ return i;
9
+ }
10
+ export { r as useMenubarContext };
@@ -0,0 +1 @@
1
+ .sui-bar-YKJoe{color:var(--sui-color-text,#111827);font-family:var(--sui-font-body,system-ui, sans-serif);line-height:var(--sui-line-height-tight,1.25);flex:1;container:sui-nav-bar/inline-size}.sui-layout-h4XLw{--_sui-nav-bar-below-collapse-width:0;align-items:center;gap:var(--sui-space-2,.5rem);flex-wrap:wrap;display:flex}.sui-bar-YKJoe[data-collapse=always]>.sui-layout-h4XLw{--_sui-nav-bar-below-collapse-width:1}@container sui-nav-bar (width<30rem){.sui-bar-YKJoe[data-collapse=sm]>.sui-layout-h4XLw{--_sui-nav-bar-below-collapse-width:1}}@container sui-nav-bar (width<48rem){.sui-bar-YKJoe[data-collapse=md]>.sui-layout-h4XLw{--_sui-nav-bar-below-collapse-width:1}}@container sui-nav-bar (width<64rem){.sui-bar-YKJoe[data-collapse=lg]>.sui-layout-h4XLw{--_sui-nav-bar-below-collapse-width:1}}.sui-start-7Cofw,.sui-end-KbxmI{align-items:center;gap:var(--sui-space-2,.5rem);flex:none;display:flex}.sui-navigation-CUxrs{--_sui-nav-bar-collapsed:0;flex:1;min-inline-size:0}.sui-list-pjBUp{align-items:center;gap:var(--sui-space-1,.25rem);flex-wrap:wrap;margin:0;padding:0;list-style:none;display:flex}.sui-control-ORmQT{box-sizing:border-box;align-items:center;gap:var(--sui-space-1,.25rem);min-block-size:2rem;padding:var(--sui-space-1,.25rem) var(--sui-space-2,.5rem);border-radius:var(--sui-radius-md,4px);color:var(--sui-color-text,#111827);font:inherit;font-size:var(--sui-font-size-sm,.875rem);font-weight:var(--sui-font-weight-medium,500);text-align:start;cursor:pointer;background-color:#0000;border:0;text-decoration:none;transition:background-color .12s;display:inline-flex;position:relative}.sui-control-ORmQT:hover,.sui-control-ORmQT[aria-expanded=true]{background-color:var(--sui-color-secondary-subtle,#f3f4f6)}.sui-control-ORmQT:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}.sui-control-ORmQT:after{inset-block-end:0;inset-inline:var(--sui-space-2,.5rem);block-size:calc(var(--sui-border-width,1px) * 2);border-radius:var(--sui-radius-full,9999px);background-color:var(--sui-color-primary,#2563eb);content:"";display:none;position:absolute}.sui-control-ORmQT[aria-current]:not([aria-current=false]):after{display:block}.sui-section-P9Rex:has(.sui-panel-LFMyY [aria-current]:not([aria-current=false]))>.sui-control-ORmQT:after{display:block}.sui-toggle-4poR7{display:none}.sui-chevron-PDy4f{transition:rotate .12s ease-out}.sui-control-ORmQT[aria-expanded=true]>.sui-chevron-PDy4f{rotate:180deg}.sui-panel-LFMyY{z-index:1;position-area:self-block-end span-self-inline-end;position-try-fallbacks:flip-inline, --sui-nav-bar-panel-shrink;box-sizing:border-box;inline-size:max-content;max-inline-size:calc(100vw - var(--sui-space-2,.5rem) * 2);max-block-size:100%;max-block-size:stretch;overscroll-behavior:contain;padding:var(--sui-space-2,.5rem);border:var(--sui-border-width,1px) solid var(--sui-color-border,#d1d5db);border-radius:var(--sui-radius-lg,8px);background-color:var(--sui-color-overlay,#fff);box-shadow:var(--sui-shadow-sm,0 1px 3px #0000001f);transition:opacity .12s ease-out, translate var(--sui-motion-spring,.12s ease-out);margin-block-start:var(--sui-space-1,.25rem);position:fixed;overflow-y:auto}@position-try --sui-nav-bar-panel-shrink{inline-size:auto;margin-inline-end:var(--sui-space-2,.5rem)}@starting-style{.sui-panel-LFMyY{opacity:0;translate:0 calc(var(--sui-popover-offset,4px) * -1)}}.sui-panelList-o--Wi,.sui-groupList-BACy0{margin:0;padding:0;list-style:none}.sui-panelList-o--Wi{--_sui-nav-bar-columns:1;grid-template-columns:repeat(var(--_sui-nav-bar-columns), minmax(0, 18rem));gap:1px var(--sui-space-2,.5rem);display:grid}.sui-panel-LFMyY[data-columns="2"]>.sui-panelList-o--Wi{--_sui-nav-bar-columns:2}.sui-panel-LFMyY[data-columns="3"]>.sui-panelList-o--Wi{--_sui-nav-bar-columns:3}.sui-group-nS46Z,.sui-groupList-BACy0{flex-direction:column;gap:1px;display:flex}.sui-groupTitle-e3Nhq{padding:var(--sui-space-2,.5rem) var(--sui-space-2,.5rem) var(--sui-space-1,.25rem)}.sui-panelLink-PFMpf{box-sizing:border-box;min-block-size:2rem;padding:var(--sui-space-1,.25rem) var(--sui-space-2,.5rem);border-radius:var(--sui-radius-md,4px);color:var(--sui-color-text,#111827);font-size:var(--sui-font-size-sm,.875rem);flex-direction:column;justify-content:center;gap:2px;text-decoration:none;transition:background-color .12s;display:flex;position:relative}.sui-panelLink-PFMpf:hover{background-color:var(--sui-color-secondary-subtle,#f3f4f6)}.sui-panelLink-PFMpf:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:calc(var(--sui-focus-ring-width,2px) * -1)}.sui-title-db-od{font-weight:var(--sui-font-weight-medium,500);overflow-wrap:anywhere}.sui-panelLink-PFMpf[aria-current]:not([aria-current=false])>.sui-title-db-od{text-decoration-line:underline;-webkit-text-decoration-color:var(--sui-color-primary,#2563eb);text-decoration-color:var(--sui-color-primary,#2563eb);text-decoration-thickness:calc(var(--sui-border-width,1px) * 2);text-underline-offset:4px}.sui-description-FOS-6{color:var(--sui-color-text-muted,#4b5563);font-size:var(--sui-font-size-xs,.75rem);overflow-wrap:anywhere}.sui-control-ORmQT:before,.sui-panelLink-PFMpf:before{inset-block:var(--sui-space-1,.25rem);inline-size:calc(var(--sui-border-width,1px) * 2);border-radius:var(--sui-radius-full,9999px);background-color:var(--sui-color-primary,#2563eb);content:"";display:none;position:absolute;inset-inline-start:0}@media (prefers-reduced-motion:reduce){.sui-panel-LFMyY{transition:opacity .12s ease-out}.sui-chevron-PDy4f{transition:none}}@container style(--_sui-nav-bar-below-collapse-width:1){.sui-navigation-CUxrs{--_sui-nav-bar-collapsed:1}.sui-toggle-4poR7{gap:var(--sui-space-2,.5rem);margin-inline-start:auto;display:inline-flex}.sui-navigation-CUxrs{flex-basis:100%;order:1}.sui-navigation-CUxrs:not([data-open]){display:none}.sui-list-pjBUp{align-items:stretch;gap:var(--sui-space-1,.25rem);flex-direction:column}.sui-control-ORmQT,.sui-panelLink-PFMpf{min-block-size:2.75rem;inline-size:100%;font-size:var(--sui-font-size-md,1rem);display:flex}.sui-chevron-PDy4f{margin-inline-start:auto}.sui-toggle-4poR7.sui-control-ORmQT{inline-size:auto}.sui-panel-LFMyY{max-block-size:none;inline-size:auto;max-inline-size:none;padding:0;box-shadow:none;background-color:#0000;border:0;border-radius:0;margin:0;padding-inline-start:var(--sui-space-4,1rem);transition:none;position:static;overflow:visible}.sui-panelList-o--Wi{gap:var(--sui-space-1,.25rem);grid-template-columns:minmax(0,1fr)}.sui-panelLink-PFMpf:focus-visible{outline-offset:2px}.sui-description-FOS-6{font-size:var(--sui-font-size-sm,.875rem)}.sui-control-ORmQT[aria-current]:not([aria-current=false]),.sui-panelLink-PFMpf[aria-current]:not([aria-current=false]){background-color:var(--sui-color-primary-subtle,#edf5ff);color:var(--sui-color-primary,#2563eb);font-weight:var(--sui-font-weight-bold,700)}.sui-panelLink-PFMpf[aria-current]:not([aria-current=false])>.sui-title-db-od{font-weight:inherit;text-decoration-line:none}.sui-control-ORmQT[aria-current]:not([aria-current=false]):after{display:none}.sui-section-P9Rex:has(.sui-panel-LFMyY [aria-current]:not([aria-current=false]))>.sui-control-ORmQT:after{display:none}.sui-control-ORmQT[aria-current]:not([aria-current=false]):before,.sui-panelLink-PFMpf[aria-current]:not([aria-current=false]):before{display:block}}@media (forced-colors:active){.sui-control-ORmQT:before,.sui-control-ORmQT:after,.sui-panelLink-PFMpf:before{forced-color-adjust:none;background-color:highlight}.sui-panel-LFMyY{border-color:canvastext}}
@@ -0,0 +1,53 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { RequiredAccessibleName } from "../../accessibility";
3
+ import type { BoxProps } from "../Box";
4
+ /**
5
+ * Below which width of the bar its navigation collapses behind its "Menu" toggle: `sm` 30rem, `md` 48rem and `lg`
6
+ * 64rem, or `always` and `never`
7
+ */
8
+ export type NavBarCollapse = "always" | "lg" | "md" | "never" | "sm";
9
+ interface NavBarOwnProps {
10
+ /**
11
+ * The entries: `NavBarItem`s and `NavBarMenu`s
12
+ */
13
+ children: ReactNode;
14
+ /**
15
+ * Below which width of the bar the navigation collapses behind "Menu": `sm` 30rem, `md` 48rem, `lg` 64rem. Defaults
16
+ * to `md`.
17
+ */
18
+ collapse?: NavBarCollapse;
19
+ /**
20
+ * Content after the navigation in the bar, such as a search button. Stays in the first row when collapsed.
21
+ */
22
+ end?: ReactNode;
23
+ /**
24
+ * The toggle's visible label. Defaults to "Menu".
25
+ */
26
+ menuLabel?: string;
27
+ /**
28
+ * Content before the navigation in the bar, such as the site's name. Stays in the first row when collapsed.
29
+ */
30
+ start?: ReactNode;
31
+ }
32
+ /**
33
+ * Props for `NavBar`: its own props, a required `aria-label` or `aria-labelledby` for its `nav`, and every other `div`
34
+ * prop except `dangerouslySetInnerHTML`, which go to the bar
35
+ */
36
+ export type NavBarProps = NavBarOwnProps & RequiredAccessibleName & Omit<BoxProps<"div">, "aria-label" | "aria-labelledby" | "as" | "children" | "dangerouslySetInnerHTML">;
37
+ /**
38
+ * A site's header navigation, for blogs, docs and marketing sites: a row of `NavBarItem` links and `NavBarMenu`
39
+ * sections, each opening a panel of links. Below its `collapse` width, measured on the bar, the navigation hides behind
40
+ * a "Menu" toggle and opens below the bar's first row, pushing the page down. Choosing a link closes it. Name the
41
+ * navigation with `aria-label` or `aria-labelledby`. For an app's sidebar, use `NavList`; for commands, `Menu`.
42
+ *
43
+ * @example
44
+ * <NavBar aria-label="Main" start={<Link href="/" underline="hover">The Long Read</Link>}>
45
+ * <NavBarItem href="/articles" aria-current="page">Articles</NavBarItem>
46
+ * <NavBarMenu label="Topics">
47
+ * <NavBarMenuItem href="/topics/design">Design</NavBarMenuItem>
48
+ * </NavBarMenu>
49
+ * <NavBarItem href="/about">About</NavBarItem>
50
+ * </NavBar>
51
+ */
52
+ export declare function NavBar({ "aria-label": label, "aria-labelledby": labelledBy, children, className, collapse, end, menuLabel, start, ...rest }: NavBarProps): JSX.Element;
53
+ export {};
@@ -0,0 +1,97 @@
1
+ import { hasContent as e } from "../../forms/hasContent.js";
2
+ import { Box as t } from "../Box/Box.js";
3
+ import { CloseIcon as n } from "../Icon/CloseIcon.js";
4
+ import { MenuIcon as r } from "../Icon/MenuIcon.js";
5
+ import { isNavBarCollapsed as i } from "./isNavBarCollapsed.js";
6
+ import { leavesPageInPlace as a } from "./leavesPageInPlace.js";
7
+ import o from "./NavBar.module.js";
8
+ import { NavBarContext as s } from "./NavBarContext.js";
9
+ import { useLayoutSwitch as c } from "./useLayoutSwitch.js";
10
+ import { clsx as l } from "clsx";
11
+ import { useId as u, useRef as d, useState as f } from "react";
12
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
13
+ // src/components/NavBar/NavBar.tsx
14
+ function h({ "aria-label": h, "aria-labelledby": g, children: _, className: v, collapse: y = "md", end: b, menuLabel: x = "Menu", start: S, ...C }) {
15
+ let w = u(), T = d(null), E = d(null), D = d(null), [O, k] = f(!1), [A, j] = f([]);
16
+ function M() {
17
+ k(!1), j([]);
18
+ }
19
+ c({
20
+ collapse: y,
21
+ layoutRef: T,
22
+ navigationRef: E,
23
+ onSwitch: M
24
+ });
25
+ function N(e) {
26
+ j((t) => t.filter((t) => t !== e));
27
+ }
28
+ function P(e, t) {
29
+ let n = i(t);
30
+ j((t) => t.includes(e) ? t.filter((t) => t !== e) : n ? [...t, e] : [e]);
31
+ }
32
+ function F() {
33
+ O ? M() : k(!0);
34
+ }
35
+ function I(e) {
36
+ let t = e.target.closest("a");
37
+ t !== null && !a(e, t) && M();
38
+ }
39
+ function L(e) {
40
+ let t = D.current, n = E.current, r = e.target, a = r === t || n?.contains(r) === !0;
41
+ e.key === "Escape" && !e.defaultPrevented && O && n !== null && a && i(n) && (e.preventDefault(), M(), t?.focus());
42
+ }
43
+ return /* @__PURE__ */ p(s.Provider, {
44
+ value: {
45
+ closeSection: N,
46
+ openSections: A,
47
+ toggleSection: P
48
+ },
49
+ children: /* @__PURE__ */ p(t, {
50
+ ...C,
51
+ className: l(o.bar, v),
52
+ "data-collapse": y,
53
+ children: /* @__PURE__ */ m(t, {
54
+ className: o.layout,
55
+ onClick: I,
56
+ onKeyDown: L,
57
+ ref: T,
58
+ children: [
59
+ e(S) && /* @__PURE__ */ p(t, {
60
+ className: o.start,
61
+ children: S
62
+ }),
63
+ /* @__PURE__ */ m(t, {
64
+ as: "button",
65
+ className: l(o.control, o.toggle),
66
+ onClick: F,
67
+ ref: D,
68
+ type: "button",
69
+ "aria-controls": w,
70
+ "aria-expanded": O,
71
+ children: [p(O ? n : r, {}), x]
72
+ }),
73
+ /* @__PURE__ */ p(t, {
74
+ as: "nav",
75
+ className: o.navigation,
76
+ id: w,
77
+ ref: E,
78
+ "aria-label": h,
79
+ "aria-labelledby": g,
80
+ "data-open": O ? !0 : void 0,
81
+ children: /* @__PURE__ */ p(t, {
82
+ as: "ul",
83
+ className: o.list,
84
+ role: "list",
85
+ children: _
86
+ })
87
+ }),
88
+ e(b) && /* @__PURE__ */ p(t, {
89
+ className: o.end,
90
+ children: b
91
+ })
92
+ ]
93
+ })
94
+ })
95
+ });
96
+ }
97
+ export { h as NavBar };
@@ -0,0 +1,22 @@
1
+ import './NavBar.css';// src/components/NavBar/NavBar.module.css
2
+ var e = "sui-bar-YKJoe", t = "sui-layout-h4XLw", n = "sui-start-7Cofw", r = "sui-end-KbxmI", i = "sui-navigation-CUxrs", a = "sui-list-pjBUp", o = "sui-control-ORmQT", s = "sui-section-P9Rex", c = "sui-panel-LFMyY", l = "sui-toggle-4poR7", u = "sui-chevron-PDy4f", d = "sui-panelList-o--Wi", f = "sui-groupList-BACy0", p = "sui-group-nS46Z", m = "sui-groupTitle-e3Nhq", h = "sui-panelLink-PFMpf", g = "sui-title-db-od", _ = "sui-description-FOS-6", v = {
3
+ bar: e,
4
+ layout: t,
5
+ start: n,
6
+ end: r,
7
+ navigation: i,
8
+ list: a,
9
+ control: o,
10
+ section: s,
11
+ panel: c,
12
+ toggle: l,
13
+ chevron: u,
14
+ panelList: d,
15
+ groupList: f,
16
+ group: p,
17
+ groupTitle: m,
18
+ panelLink: h,
19
+ title: g,
20
+ description: _
21
+ };
22
+ export { e as bar, u as chevron, o as control, v as default, _ as description, r as end, p as group, f as groupList, m as groupTitle, t as layout, a as list, i as navigation, c as panel, h as panelLink, d as panelList, s as section, n as start, g as title, l as toggle };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * State a `NavBar` shares with its entries
3
+ */
4
+ export interface NavBarContextValue {
5
+ /**
6
+ * Closes the section with the given id
7
+ */
8
+ closeSection: (id: string) => void;
9
+ /**
10
+ * Ids of the open sections
11
+ */
12
+ openSections: readonly string[];
13
+ /**
14
+ * Opens or closes the section with the given id. On a wide bar, opening it closes any other.
15
+ */
16
+ toggleSection: (id: string, button: Element) => void;
17
+ }
18
+ /**
19
+ * Carries a `NavBar`'s state to its entries; null outside a `NavBar`
20
+ */
21
+ export declare const NavBarContext: import("react").Context<NavBarContextValue | null>;
@@ -0,0 +1,4 @@
1
+ import { createContext as e } from "react";
2
+ // src/components/NavBar/NavBarContext.ts
3
+ var t = e(null);
4
+ export { t as NavBarContext };
@@ -0,0 +1,32 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { LinkOrButtonProps } from "../../links";
3
+ import type { LinkElement } from "../Link";
4
+ interface NavBarItemOwnProps<E extends LinkElement> {
5
+ /**
6
+ * What to render: `a`, or a component that renders an anchor, such as a router's link. Defaults to `a`.
7
+ */
8
+ as?: E;
9
+ /**
10
+ * The label
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Class names merged with the link's base class
15
+ */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Props for `NavBarItem`: its own props plus every other prop of the anchor or component given in `as`, except
20
+ * `dangerouslySetInnerHTML`
21
+ */
22
+ export type NavBarItemProps<E extends LinkElement = "a"> = E extends LinkElement ? NavBarItemOwnProps<E> & LinkOrButtonProps<E, "dangerouslySetInnerHTML" | keyof NavBarItemOwnProps<E>> : never;
23
+ /**
24
+ * A top-level link in a `NavBar`. Every prop but `children` goes to the link, not the list item around it, and a
25
+ * component given in `as` must pass the `className` it is given on to its anchor. Mark the current page with
26
+ * `aria-current="page"`.
27
+ *
28
+ * @example
29
+ * <NavBarItem href="/articles" aria-current="page">Articles</NavBarItem>
30
+ */
31
+ export declare function NavBarItem<E extends LinkElement = "a">({ as, children, className, ...rest }: NavBarItemProps<E>): JSX.Element;
32
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Box as e } from "../Box/Box.js";
2
+ import t from "./NavBar.module.js";
3
+ import { renderNavBarLink as n } from "./renderNavBarLink.js";
4
+ import { useNavBarContext as r } from "./useNavBarContext.js";
5
+ import { clsx as i } from "clsx";
6
+ import { c as a } from "react/compiler-runtime";
7
+ import { jsx as o } from "react/jsx-runtime";
8
+ // src/components/NavBar/NavBarItem.tsx
9
+ function s(s) {
10
+ let c = a(3), { as: l, children: u, className: d, ...f } = s;
11
+ r("NavBarItem");
12
+ let p = e, m = n(l, i(t.control, d), u, f), h;
13
+ return c[0] !== p || c[1] !== m ? (h = /* @__PURE__ */ o(p, {
14
+ as: "li",
15
+ children: m
16
+ }), c[0] = p, c[1] = m, c[2] = h) : h = c[2], h;
17
+ }
18
+ export { s as NavBarItem };
@@ -0,0 +1,32 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { BoxProps } from "../Box";
3
+ /**
4
+ * Props for `NavBarMenu`: its own props plus every `li` prop except `dangerouslySetInnerHTML`
5
+ */
6
+ export interface NavBarMenuProps extends Omit<BoxProps<"li">, "as" | "children" | "dangerouslySetInnerHTML"> {
7
+ /**
8
+ * The panel's links: `NavBarMenuItem`s, or `NavBarMenuGroup`s holding them
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * How many columns the panel lays its links or groups out in on a wide bar. Defaults to 1.
13
+ */
14
+ columns?: 1 | 2 | 3;
15
+ /**
16
+ * The text of the button that opens the panel
17
+ */
18
+ label: ReactNode;
19
+ }
20
+ /**
21
+ * A section of a `NavBar`: a button that opens a panel of links below it. A click, Enter or Space opens and closes
22
+ * it. On a wide bar one section is open at a time, and Escape, a click outside or focus leaving closes it. On a
23
+ * collapsed bar the panel opens in place, pushing what follows down, and Escape closes it. Choosing a link closes it.
24
+ * Escape returns focus to the button.
25
+ *
26
+ * @example
27
+ * <NavBarMenu columns={2} label="Topics">
28
+ * <NavBarMenuItem description="Typography, colour, systems" href="/topics/design">Design</NavBarMenuItem>
29
+ * <NavBarMenuItem description="Front-end, performance, tooling" href="/topics/engineering">Engineering</NavBarMenuItem>
30
+ * </NavBarMenu>
31
+ */
32
+ export declare function NavBarMenu({ children, className, columns, label, onBlur, onKeyDown, onPointerDown, ...rest }: NavBarMenuProps): JSX.Element;
@@ -0,0 +1,84 @@
1
+ import { anchorNameFor as e } from "../../overlays/anchorNameFor.js";
2
+ import { Box as t } from "../Box/Box.js";
3
+ import { ChevronDownIcon as n } from "../Icon/ChevronDownIcon.js";
4
+ import { isNavBarCollapsed as r } from "./isNavBarCollapsed.js";
5
+ import i from "./NavBar.module.js";
6
+ import { useNavBarContext as a } from "./useNavBarContext.js";
7
+ import { clsx as o } from "clsx";
8
+ import { useEffect as s, useId as c, useRef as l } from "react";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ // src/components/NavBar/NavBarMenu.tsx
11
+ function f({ children: f, className: m, columns: h = 1, label: g, onBlur: _, onKeyDown: v, onPointerDown: y, ...b }) {
12
+ let { closeSection: x, openSections: S, toggleSection: C } = a("NavBarMenu"), w = c(), T = e(w), E = l(null), D = l(!1), O = S.includes(w);
13
+ s(() => {
14
+ let e = E.current?.parentElement;
15
+ if (!O || e == null) return;
16
+ let t = (t) => {
17
+ let n = t.target;
18
+ !e.contains(n) && !r(e) && x(w);
19
+ }, n = (t) => {
20
+ p(e, t.target, D.current) && !r(e) && x(w);
21
+ }, i = () => {
22
+ D.current = !1;
23
+ }, a = e.ownerDocument;
24
+ return a.addEventListener("focusin", n, !0), a.addEventListener("keydown", i, !0), a.addEventListener("pointerdown", t, !0), () => {
25
+ a.removeEventListener("focusin", n, !0), a.removeEventListener("keydown", i, !0), a.removeEventListener("pointerdown", t, !0);
26
+ };
27
+ }, [
28
+ x,
29
+ O,
30
+ w
31
+ ]);
32
+ function k(e) {
33
+ C(w, e.currentTarget);
34
+ }
35
+ function A(e) {
36
+ _?.(e);
37
+ let t = e.currentTarget;
38
+ e.relatedTarget === null && setTimeout(() => {
39
+ O && p(t, t.ownerDocument.activeElement, D.current) && !r(t) && x(w);
40
+ }, 0);
41
+ }
42
+ function j(e) {
43
+ y?.(e), D.current = !0;
44
+ }
45
+ function M(e) {
46
+ v?.(e), D.current = !1, e.key === "Escape" && O && !e.defaultPrevented && (e.preventDefault(), x(w), E.current?.focus());
47
+ }
48
+ return /* @__PURE__ */ d(t, {
49
+ ...b,
50
+ as: "li",
51
+ className: o(i.section, m),
52
+ onBlur: A,
53
+ onKeyDown: M,
54
+ onPointerDown: j,
55
+ children: [/* @__PURE__ */ d(t, {
56
+ as: "button",
57
+ className: i.control,
58
+ onClick: k,
59
+ ref: E,
60
+ style: { anchorName: T },
61
+ type: "button",
62
+ "aria-controls": w,
63
+ "aria-expanded": O,
64
+ children: [g, /* @__PURE__ */ u(n, { className: i.chevron })]
65
+ }), /* @__PURE__ */ u(t, {
66
+ className: i.panel,
67
+ hidden: !O,
68
+ id: w,
69
+ style: { positionAnchor: T },
70
+ "data-columns": h,
71
+ children: /* @__PURE__ */ u(t, {
72
+ as: "ul",
73
+ className: i.panelList,
74
+ role: "list",
75
+ children: f
76
+ })
77
+ })]
78
+ });
79
+ }
80
+ function p(e, t, n) {
81
+ let r = n && t?.contains(e) === !0;
82
+ return t !== null && !e.contains(t) && !r;
83
+ }
84
+ export { f as NavBarMenu };
@@ -0,0 +1,25 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { BoxProps } from "../Box";
3
+ import type { HeadingLevel } from "../Heading";
4
+ /**
5
+ * Props for `NavBarMenuGroup`: its own props plus every `li` prop except `dangerouslySetInnerHTML` and `title`
6
+ */
7
+ export interface NavBarMenuGroupProps extends Omit<BoxProps<"li">, "as" | "dangerouslySetInnerHTML" | "title"> {
8
+ /**
9
+ * The group's heading level, which the page outline decides: in a site's header before the page's `h1`, usually 2
10
+ */
11
+ headingLevel: HeadingLevel;
12
+ /**
13
+ * The group's heading, which also names its list
14
+ */
15
+ title: ReactNode;
16
+ }
17
+ /**
18
+ * A headed column of `NavBarMenuItem`s in a `NavBarMenu`'s panel
19
+ *
20
+ * @example
21
+ * <NavBarMenuGroup headingLevel={2} title="Topics">
22
+ * <NavBarMenuItem href="/topics/design">Design</NavBarMenuItem>
23
+ * </NavBarMenuGroup>
24
+ */
25
+ export declare function NavBarMenuGroup({ children, className, headingLevel, title, ...rest }: NavBarMenuGroupProps): JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { Box as e } from "../Box/Box.js";
2
+ import { Heading as t } from "../Heading/Heading.js";
3
+ import n from "./NavBar.module.js";
4
+ import { useNavBarContext as r } from "./useNavBarContext.js";
5
+ import { clsx as i } from "clsx";
6
+ import { useId as a } from "react";
7
+ import { c as o } from "react/compiler-runtime";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ // src/components/NavBar/NavBarMenuGroup.tsx
10
+ function l(l) {
11
+ let u = o(20), d, f, p, m, h;
12
+ u[0] === l ? (d = u[1], f = u[2], p = u[3], m = u[4], h = u[5]) : ({children: d, className: f, headingLevel: p, title: h, ...m} = l, u[0] = l, u[1] = d, u[2] = f, u[3] = p, u[4] = m, u[5] = h), r("NavBarMenuGroup");
13
+ let g = a(), _;
14
+ u[6] === f ? _ = u[7] : (_ = i(n.group, f), u[6] = f, u[7] = _);
15
+ let v;
16
+ u[8] !== g || u[9] !== p || u[10] !== h ? (v = /* @__PURE__ */ s(t, {
17
+ className: n.groupTitle,
18
+ id: g,
19
+ level: p,
20
+ size: "xs",
21
+ tone: "muted",
22
+ children: h
23
+ }), u[8] = g, u[9] = p, u[10] = h, u[11] = v) : v = u[11];
24
+ let y;
25
+ u[12] !== d || u[13] !== g ? (y = /* @__PURE__ */ s(e, {
26
+ as: "ul",
27
+ className: n.groupList,
28
+ role: "list",
29
+ "aria-labelledby": g,
30
+ children: d
31
+ }), u[12] = d, u[13] = g, u[14] = y) : y = u[14];
32
+ let b;
33
+ return u[15] !== m || u[16] !== _ || u[17] !== v || u[18] !== y ? (b = /* @__PURE__ */ c(e, {
34
+ ...m,
35
+ as: "li",
36
+ className: _,
37
+ children: [v, y]
38
+ }), u[15] = m, u[16] = _, u[17] = v, u[18] = y, u[19] = b) : b = u[19], b;
39
+ }
40
+ export { l as NavBarMenuGroup };
@@ -0,0 +1,36 @@
1
+ import type { JSX, ReactNode } from "react";
2
+ import type { LinkOrButtonProps } from "../../links";
3
+ import type { LinkElement } from "../Link";
4
+ interface NavBarMenuItemOwnProps<E extends LinkElement> {
5
+ /**
6
+ * What to render: `a`, or a component that renders an anchor, such as a router's link. Defaults to `a`.
7
+ */
8
+ as?: E;
9
+ /**
10
+ * The title, which names the link
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Class names merged with the link's base class
15
+ */
16
+ className?: string;
17
+ /**
18
+ * A line of muted text below the title, which describes the link
19
+ */
20
+ description?: ReactNode;
21
+ }
22
+ /**
23
+ * Props for `NavBarMenuItem`: its own props plus every other prop of the anchor or component given in `as`, except
24
+ * `dangerouslySetInnerHTML`
25
+ */
26
+ export type NavBarMenuItemProps<E extends LinkElement = "a"> = E extends LinkElement ? NavBarMenuItemOwnProps<E> & LinkOrButtonProps<E, "dangerouslySetInnerHTML" | keyof NavBarMenuItemOwnProps<E>> : never;
27
+ /**
28
+ * A link in a `NavBarMenu`'s panel, with an optional description below its title. Every prop but `children` and
29
+ * `description` goes to the link, and a component given in `as` must pass the `className` and ARIA attributes it is
30
+ * given on to its anchor. Mark the current page with `aria-current="page"`.
31
+ *
32
+ * @example
33
+ * <NavBarMenuItem description="Typography, colour, systems" href="/topics/design">Design</NavBarMenuItem>
34
+ */
35
+ export declare function NavBarMenuItem<E extends LinkElement = "a">({ as, children, className, description, ...rest }: NavBarMenuItemProps<E>): JSX.Element;
36
+ export {};
@@ -0,0 +1,49 @@
1
+ import { hasContent as e } from "../../forms/hasContent.js";
2
+ import { Box as t } from "../Box/Box.js";
3
+ import n from "./NavBar.module.js";
4
+ import { renderNavBarLink as r } from "./renderNavBarLink.js";
5
+ import { useNavBarContext as i } from "./useNavBarContext.js";
6
+ import { clsx as a } from "clsx";
7
+ import { useId as o } from "react";
8
+ import { c as s } from "react/compiler-runtime";
9
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
10
+ // src/components/NavBar/NavBarMenuItem.tsx
11
+ function d(d) {
12
+ let f = s(15), { as: p, children: m, className: h, description: g, ..._ } = d;
13
+ i("NavBarMenuItem");
14
+ let v = o(), y = o(), { "aria-describedby": b, "aria-label": x, "aria-labelledby": S, ...C } = _, w;
15
+ f[0] === g ? w = f[1] : (w = e(g), f[0] = g, f[1] = w);
16
+ let T = w, E;
17
+ f[2] !== m || f[3] !== v ? (E = /* @__PURE__ */ l(t, {
18
+ as: "span",
19
+ className: n.title,
20
+ id: v,
21
+ children: m
22
+ }), f[2] = m, f[3] = v, f[4] = E) : E = f[4];
23
+ let D;
24
+ f[5] !== g || f[6] !== y || f[7] !== T ? (D = T && /* @__PURE__ */ l(t, {
25
+ as: "span",
26
+ className: n.description,
27
+ id: y,
28
+ children: g
29
+ }), f[5] = g, f[6] = y, f[7] = T, f[8] = D) : D = f[8];
30
+ let O;
31
+ f[9] !== E || f[10] !== D ? (O = /* @__PURE__ */ u(c, { children: [E, D] }), f[9] = E, f[10] = D, f[11] = O) : O = f[11];
32
+ let k = O, A = T ? {
33
+ "aria-describedby": b === void 0 ? y : `${y} ${b}`,
34
+ "aria-label": x,
35
+ "aria-labelledby": S ?? (x === void 0 ? v : void 0)
36
+ } : {
37
+ "aria-describedby": b,
38
+ "aria-label": x,
39
+ "aria-labelledby": S
40
+ }, j = t, M = r(p, a(n.panelLink, h), k, {
41
+ ...C,
42
+ ...A
43
+ }), N;
44
+ return f[12] !== j || f[13] !== M ? (N = /* @__PURE__ */ l(j, {
45
+ as: "li",
46
+ children: M
47
+ }), f[12] = j, f[13] = M, f[14] = N) : N = f[14], N;
48
+ }
49
+ export { d as NavBarMenuItem };
@@ -0,0 +1,10 @@
1
+ export { NavBar } from "./NavBar";
2
+ export type { NavBarCollapse, NavBarProps } from "./NavBar";
3
+ export { NavBarItem } from "./NavBarItem";
4
+ export type { NavBarItemProps } from "./NavBarItem";
5
+ export { NavBarMenu } from "./NavBarMenu";
6
+ export type { NavBarMenuProps } from "./NavBarMenu";
7
+ export { NavBarMenuGroup } from "./NavBarMenuGroup";
8
+ export type { NavBarMenuGroupProps } from "./NavBarMenuGroup";
9
+ export { NavBarMenuItem } from "./NavBarMenuItem";
10
+ export type { NavBarMenuItemProps } from "./NavBarMenuItem";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tells whether the `NavBar` around an element shows its collapsed layout, behind its "Menu" toggle
3
+ *
4
+ * @param element the bar's navigation or an element inside it
5
+ * @returns true while the bar is narrower than its collapse width, or always collapses, and the browser lays it out
6
+ * collapsed
7
+ */
8
+ export declare function isNavBarCollapsed(element: Element): boolean;
@@ -0,0 +1,5 @@
1
+ // src/components/NavBar/isNavBarCollapsed.ts
2
+ function e(e) {
3
+ return e.ownerDocument.defaultView?.getComputedStyle(e).getPropertyValue("--_sui-nav-bar-collapsed").trim() === "1";
4
+ }
5
+ export { e as isNavBarCollapsed };
@@ -0,0 +1,12 @@
1
+ type ModifierKeys = Pick<MouseEvent, "altKey" | "ctrlKey" | "metaKey" | "shiftKey">;
2
+ /**
3
+ * Tells whether a click on a link leaves this page where it was, opening the link in another tab or window or
4
+ * downloading it
5
+ *
6
+ * @param event the click, for the modifier keys held
7
+ * @param link the link clicked
8
+ * @returns true for a click with Alt, Ctrl, Meta or Shift held, on a link that opens in another browsing context, or
9
+ * on one that downloads its URL; false whenever that can't be established
10
+ */
11
+ export declare function leavesPageInPlace(event: ModifierKeys, link: HTMLAnchorElement): boolean;
12
+ export {};
@@ -0,0 +1,29 @@
1
+ // src/components/NavBar/leavesPageInPlace.ts
2
+ function e(e, r) {
3
+ return e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || t(r) || n(r);
4
+ }
5
+ function t(e) {
6
+ let t = e.hasAttribute("target") ? e.target : e.ownerDocument.querySelector("base[target]")?.getAttribute("target") ?? "", n = t.toLowerCase(), r = e.ownerDocument.defaultView;
7
+ if (r === null || [
8
+ "",
9
+ "_parent",
10
+ "_self",
11
+ "_top"
12
+ ].includes(n)) return !1;
13
+ let i = r;
14
+ for (;;) {
15
+ try {
16
+ if (i.name === t) return !1;
17
+ } catch {
18
+ return !1;
19
+ }
20
+ if (i.parent === i) return !0;
21
+ i = i.parent;
22
+ }
23
+ }
24
+ function n(e) {
25
+ if (!e.hasAttribute("download") || !URL.canParse(e.href)) return !1;
26
+ let t = new URL(e.href);
27
+ return t.protocol === "blob:" || t.protocol === "data:" || t.origin === e.ownerDocument.location.origin;
28
+ }
29
+ export { e as leavesPageInPlace };