@mortenbrudvik/waveui 0.7.0 → 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 (439) hide show
  1. package/README.md +564 -155
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoButton.cjs +2 -0
  63. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  64. package/dist/components/data-display/InfoButton.mjs +173 -0
  65. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  66. package/dist/components/data-display/InfoLabel.cjs +1 -1
  67. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  68. package/dist/components/data-display/InfoLabel.mjs +36 -92
  69. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  70. package/dist/components/data-display/List.cjs +1 -1
  71. package/dist/components/data-display/List.cjs.map +1 -1
  72. package/dist/components/data-display/List.mjs +175 -174
  73. package/dist/components/data-display/List.mjs.map +1 -1
  74. package/dist/components/data-display/Persona.cjs +1 -1
  75. package/dist/components/data-display/Persona.cjs.map +1 -1
  76. package/dist/components/data-display/Persona.mjs +31 -29
  77. package/dist/components/data-display/Persona.mjs.map +1 -1
  78. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  79. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  80. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  81. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  82. package/dist/components/data-display/Tag.cjs +1 -1
  83. package/dist/components/data-display/Tag.cjs.map +1 -1
  84. package/dist/components/data-display/Tag.mjs +87 -82
  85. package/dist/components/data-display/Tag.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.cjs +1 -1
  87. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  88. package/dist/components/feedback/MessageBar.mjs +129 -71
  89. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  90. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  93. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  95. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  96. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  97. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  98. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  99. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  100. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  101. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  102. package/dist/components/feedback/ProgressBar.cjs +1 -1
  103. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  104. package/dist/components/feedback/ProgressBar.mjs +44 -43
  105. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  106. package/dist/components/feedback/Skeleton.cjs +1 -1
  107. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  108. package/dist/components/feedback/Skeleton.mjs +26 -24
  109. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  110. package/dist/components/feedback/Spinner.cjs +1 -1
  111. package/dist/components/feedback/Spinner.cjs.map +1 -1
  112. package/dist/components/feedback/Spinner.mjs +32 -31
  113. package/dist/components/feedback/Spinner.mjs.map +1 -1
  114. package/dist/components/feedback/Toast.cjs +1 -1
  115. package/dist/components/feedback/Toast.cjs.map +1 -1
  116. package/dist/components/feedback/Toast.context.cjs +2 -0
  117. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  118. package/dist/components/feedback/Toast.context.mjs +23 -0
  119. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  120. package/dist/components/feedback/Toast.mjs +10 -342
  121. package/dist/components/feedback/Toast.mjs.map +1 -1
  122. package/dist/components/feedback/Toast.parts.cjs +2 -0
  123. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.parts.mjs +98 -0
  125. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  126. package/dist/components/feedback/Toast.root.cjs +2 -0
  127. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  128. package/dist/components/feedback/Toast.root.mjs +109 -0
  129. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  130. package/dist/components/feedback/Toaster.cjs +2 -0
  131. package/dist/components/feedback/Toaster.cjs.map +1 -0
  132. package/dist/components/feedback/Toaster.mjs +564 -0
  133. package/dist/components/feedback/Toaster.mjs.map +1 -0
  134. package/dist/components/input/AlphaSlider.cjs +2 -0
  135. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  136. package/dist/components/input/AlphaSlider.mjs +115 -0
  137. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  138. package/dist/components/input/Checkbox.cjs +1 -1
  139. package/dist/components/input/Checkbox.cjs.map +1 -1
  140. package/dist/components/input/Checkbox.mjs +87 -70
  141. package/dist/components/input/Checkbox.mjs.map +1 -1
  142. package/dist/components/input/ColorArea.cjs +2 -0
  143. package/dist/components/input/ColorArea.cjs.map +1 -0
  144. package/dist/components/input/ColorArea.mjs +204 -0
  145. package/dist/components/input/ColorArea.mjs.map +1 -0
  146. package/dist/components/input/ColorPicker.cjs +5 -5
  147. package/dist/components/input/ColorPicker.cjs.map +1 -1
  148. package/dist/components/input/ColorPicker.mjs +142 -165
  149. package/dist/components/input/ColorPicker.mjs.map +1 -1
  150. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  151. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  152. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  153. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  154. package/dist/components/input/ColorSlider.cjs +2 -0
  155. package/dist/components/input/ColorSlider.cjs.map +1 -0
  156. package/dist/components/input/ColorSlider.mjs +138 -0
  157. package/dist/components/input/ColorSlider.mjs.map +1 -0
  158. package/dist/components/input/Combobox.cjs +1 -1
  159. package/dist/components/input/Combobox.cjs.map +1 -1
  160. package/dist/components/input/Combobox.expand.cjs +1 -1
  161. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  162. package/dist/components/input/Combobox.expand.mjs +22 -22
  163. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  164. package/dist/components/input/Combobox.mjs +151 -141
  165. package/dist/components/input/Combobox.mjs.map +1 -1
  166. package/dist/components/input/DatePicker.cjs +1 -1
  167. package/dist/components/input/DatePicker.cjs.map +1 -1
  168. package/dist/components/input/DatePicker.mjs +239 -234
  169. package/dist/components/input/DatePicker.mjs.map +1 -1
  170. package/dist/components/input/Dropdown.cjs +1 -1
  171. package/dist/components/input/Dropdown.cjs.map +1 -1
  172. package/dist/components/input/Dropdown.mjs +109 -100
  173. package/dist/components/input/Dropdown.mjs.map +1 -1
  174. package/dist/components/input/Field.cjs +1 -1
  175. package/dist/components/input/Field.cjs.map +1 -1
  176. package/dist/components/input/Field.mjs +139 -105
  177. package/dist/components/input/Field.mjs.map +1 -1
  178. package/dist/components/input/Input.cjs +1 -1
  179. package/dist/components/input/Input.cjs.map +1 -1
  180. package/dist/components/input/Input.mjs +80 -55
  181. package/dist/components/input/Input.mjs.map +1 -1
  182. package/dist/components/input/Label.cjs +1 -1
  183. package/dist/components/input/Label.cjs.map +1 -1
  184. package/dist/components/input/Label.mjs +19 -12
  185. package/dist/components/input/Label.mjs.map +1 -1
  186. package/dist/components/input/Option.cjs +1 -1
  187. package/dist/components/input/Option.cjs.map +1 -1
  188. package/dist/components/input/Option.mjs +100 -98
  189. package/dist/components/input/Option.mjs.map +1 -1
  190. package/dist/components/input/RadioGroup.cjs +1 -1
  191. package/dist/components/input/RadioGroup.cjs.map +1 -1
  192. package/dist/components/input/RadioGroup.mjs +89 -88
  193. package/dist/components/input/RadioGroup.mjs.map +1 -1
  194. package/dist/components/input/Rating.cjs +1 -1
  195. package/dist/components/input/Rating.cjs.map +1 -1
  196. package/dist/components/input/Rating.item.cjs +2 -0
  197. package/dist/components/input/Rating.item.cjs.map +1 -0
  198. package/dist/components/input/Rating.item.mjs +255 -0
  199. package/dist/components/input/Rating.item.mjs.map +1 -0
  200. package/dist/components/input/Rating.mjs +152 -152
  201. package/dist/components/input/Rating.mjs.map +1 -1
  202. package/dist/components/input/SearchBox.cjs +1 -1
  203. package/dist/components/input/SearchBox.cjs.map +1 -1
  204. package/dist/components/input/SearchBox.mjs +162 -132
  205. package/dist/components/input/SearchBox.mjs.map +1 -1
  206. package/dist/components/input/Select.cjs +1 -1
  207. package/dist/components/input/Select.cjs.map +1 -1
  208. package/dist/components/input/Select.mjs +34 -24
  209. package/dist/components/input/Select.mjs.map +1 -1
  210. package/dist/components/input/Slider.cjs +1 -1
  211. package/dist/components/input/Slider.cjs.map +1 -1
  212. package/dist/components/input/Slider.mjs +78 -54
  213. package/dist/components/input/Slider.mjs.map +1 -1
  214. package/dist/components/input/SpinButton.cjs +1 -1
  215. package/dist/components/input/SpinButton.cjs.map +1 -1
  216. package/dist/components/input/SpinButton.mjs +202 -99
  217. package/dist/components/input/SpinButton.mjs.map +1 -1
  218. package/dist/components/input/SwatchPicker.cjs +1 -1
  219. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  220. package/dist/components/input/SwatchPicker.mjs +38 -37
  221. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  222. package/dist/components/input/Switch.cjs +1 -1
  223. package/dist/components/input/Switch.cjs.map +1 -1
  224. package/dist/components/input/Switch.mjs +75 -58
  225. package/dist/components/input/Switch.mjs.map +1 -1
  226. package/dist/components/input/TagPicker.cjs +1 -1
  227. package/dist/components/input/TagPicker.cjs.map +1 -1
  228. package/dist/components/input/TagPicker.mjs +199 -169
  229. package/dist/components/input/TagPicker.mjs.map +1 -1
  230. package/dist/components/input/Textarea.cjs +1 -1
  231. package/dist/components/input/Textarea.cjs.map +1 -1
  232. package/dist/components/input/Textarea.mjs +31 -23
  233. package/dist/components/input/Textarea.mjs.map +1 -1
  234. package/dist/components/input/TimePicker.cjs +1 -1
  235. package/dist/components/input/TimePicker.cjs.map +1 -1
  236. package/dist/components/input/TimePicker.mjs +185 -177
  237. package/dist/components/input/TimePicker.mjs.map +1 -1
  238. package/dist/components/input/colorName.cjs +2 -0
  239. package/dist/components/input/colorName.cjs.map +1 -0
  240. package/dist/components/input/colorName.mjs +30 -0
  241. package/dist/components/input/colorName.mjs.map +1 -0
  242. package/dist/components/input/colorUtils.cjs +1 -1
  243. package/dist/components/input/colorUtils.cjs.map +1 -1
  244. package/dist/components/input/colorUtils.mjs +154 -56
  245. package/dist/components/input/colorUtils.mjs.map +1 -1
  246. package/dist/components/input/fieldLabel.cjs +2 -0
  247. package/dist/components/input/fieldLabel.cjs.map +1 -0
  248. package/dist/components/input/fieldLabel.mjs +17 -0
  249. package/dist/components/input/fieldLabel.mjs.map +1 -0
  250. package/dist/components/input/inputLook.cjs +2 -0
  251. package/dist/components/input/inputLook.cjs.map +1 -0
  252. package/dist/components/input/inputLook.mjs +28 -0
  253. package/dist/components/input/inputLook.mjs.map +1 -0
  254. package/dist/components/input/pickerStyles.cjs +1 -1
  255. package/dist/components/input/pickerStyles.cjs.map +1 -1
  256. package/dist/components/input/pickerStyles.mjs +42 -4
  257. package/dist/components/input/pickerStyles.mjs.map +1 -1
  258. package/dist/components/layout/Accordion.cjs +1 -1
  259. package/dist/components/layout/Accordion.cjs.map +1 -1
  260. package/dist/components/layout/Accordion.mjs +130 -129
  261. package/dist/components/layout/Accordion.mjs.map +1 -1
  262. package/dist/components/layout/Card.cjs +1 -1
  263. package/dist/components/layout/Card.cjs.map +1 -1
  264. package/dist/components/layout/Card.mjs +78 -77
  265. package/dist/components/layout/Card.mjs.map +1 -1
  266. package/dist/components/layout/Carousel.cjs +1 -1
  267. package/dist/components/layout/Carousel.cjs.map +1 -1
  268. package/dist/components/layout/Carousel.mjs +111 -110
  269. package/dist/components/layout/Carousel.mjs.map +1 -1
  270. package/dist/components/layout/Flex.cjs +1 -1
  271. package/dist/components/layout/Flex.cjs.map +1 -1
  272. package/dist/components/layout/Flex.mjs +22 -21
  273. package/dist/components/layout/Flex.mjs.map +1 -1
  274. package/dist/components/layout/Grid.cjs +1 -1
  275. package/dist/components/layout/Grid.cjs.map +1 -1
  276. package/dist/components/layout/Grid.mjs +19 -18
  277. package/dist/components/layout/Grid.mjs.map +1 -1
  278. package/dist/components/layout/Overflow.cjs +1 -1
  279. package/dist/components/layout/Overflow.cjs.map +1 -1
  280. package/dist/components/layout/Overflow.mjs +92 -91
  281. package/dist/components/layout/Overflow.mjs.map +1 -1
  282. package/dist/components/layout/Stack.cjs +1 -1
  283. package/dist/components/layout/Stack.cjs.map +1 -1
  284. package/dist/components/layout/Stack.mjs +14 -13
  285. package/dist/components/layout/Stack.mjs.map +1 -1
  286. package/dist/components/layout/TabList.cjs +1 -1
  287. package/dist/components/layout/TabList.cjs.map +1 -1
  288. package/dist/components/layout/TabList.mjs +118 -117
  289. package/dist/components/layout/TabList.mjs.map +1 -1
  290. package/dist/components/layout/Tree.cjs +1 -1
  291. package/dist/components/layout/Tree.cjs.map +1 -1
  292. package/dist/components/layout/Tree.context.cjs +2 -0
  293. package/dist/components/layout/Tree.context.cjs.map +1 -0
  294. package/dist/components/layout/Tree.context.mjs +33 -0
  295. package/dist/components/layout/Tree.context.mjs.map +1 -0
  296. package/dist/components/layout/Tree.core.cjs +2 -0
  297. package/dist/components/layout/Tree.core.cjs.map +1 -0
  298. package/dist/components/layout/Tree.core.mjs +416 -0
  299. package/dist/components/layout/Tree.core.mjs.map +1 -0
  300. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  301. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  302. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  303. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  304. package/dist/components/layout/Tree.mjs +7 -215
  305. package/dist/components/layout/Tree.mjs.map +1 -1
  306. package/dist/components/layout/Tree.selection.cjs +2 -0
  307. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  308. package/dist/components/layout/Tree.selection.mjs +73 -0
  309. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  310. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  311. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  312. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  313. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.group.cjs +1 -1
  315. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.group.mjs +39 -37
  317. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.items.cjs +1 -1
  319. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.items.mjs +67 -61
  321. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.link.cjs +1 -1
  323. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.link.mjs +34 -28
  325. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  326. package/dist/components/navigation/Menu.popover.cjs +1 -1
  327. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  328. package/dist/components/navigation/Menu.popover.mjs +114 -113
  329. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  330. package/dist/components/navigation/Menu.root.cjs +1 -1
  331. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  332. package/dist/components/navigation/Menu.root.mjs +171 -170
  333. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  334. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  335. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  336. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  337. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  338. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  339. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  340. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  341. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  342. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  343. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  344. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  345. package/dist/components/navigation/Nav.cjs +1 -1
  346. package/dist/components/navigation/Nav.cjs.map +1 -1
  347. package/dist/components/navigation/Nav.mjs +170 -155
  348. package/dist/components/navigation/Nav.mjs.map +1 -1
  349. package/dist/components/navigation/Pagination.cjs +1 -1
  350. package/dist/components/navigation/Pagination.cjs.map +1 -1
  351. package/dist/components/navigation/Pagination.mjs +73 -65
  352. package/dist/components/navigation/Pagination.mjs.map +1 -1
  353. package/dist/components/navigation/Stepper.cjs +1 -1
  354. package/dist/components/navigation/Stepper.cjs.map +1 -1
  355. package/dist/components/navigation/Stepper.mjs +110 -109
  356. package/dist/components/navigation/Stepper.mjs.map +1 -1
  357. package/dist/components/overlays/Dialog.cjs +1 -1
  358. package/dist/components/overlays/Dialog.cjs.map +1 -1
  359. package/dist/components/overlays/Dialog.mjs +109 -108
  360. package/dist/components/overlays/Dialog.mjs.map +1 -1
  361. package/dist/components/overlays/Drawer.cjs +1 -1
  362. package/dist/components/overlays/Drawer.cjs.map +1 -1
  363. package/dist/components/overlays/Drawer.mjs +110 -109
  364. package/dist/components/overlays/Drawer.mjs.map +1 -1
  365. package/dist/components/overlays/Popover.cjs +1 -1
  366. package/dist/components/overlays/Popover.cjs.map +1 -1
  367. package/dist/components/overlays/Popover.mjs +148 -151
  368. package/dist/components/overlays/Popover.mjs.map +1 -1
  369. package/dist/components/overlays/Popover.shared.cjs +1 -1
  370. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  371. package/dist/components/overlays/Popover.shared.mjs +82 -77
  372. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  373. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  374. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  375. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  376. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  377. package/dist/components/overlays/Tooltip.cjs +1 -1
  378. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  379. package/dist/components/overlays/Tooltip.mjs +87 -86
  380. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  381. package/dist/components/portal/Portal.cjs +1 -1
  382. package/dist/components/portal/Portal.cjs.map +1 -1
  383. package/dist/components/portal/Portal.mjs +33 -32
  384. package/dist/components/portal/Portal.mjs.map +1 -1
  385. package/dist/components/provider/WaveProvider.cjs +1 -1
  386. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  387. package/dist/components/provider/WaveProvider.mjs +36 -29
  388. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  389. package/dist/components/table/DataGrid.cjs +1 -1
  390. package/dist/components/table/DataGrid.cjs.map +1 -1
  391. package/dist/components/table/DataGrid.mjs +228 -227
  392. package/dist/components/table/DataGrid.mjs.map +1 -1
  393. package/dist/components/table/Table.cjs +1 -1
  394. package/dist/components/table/Table.cjs.map +1 -1
  395. package/dist/components/table/Table.mjs +60 -59
  396. package/dist/components/table/Table.mjs.map +1 -1
  397. package/dist/components/typography/Text.cjs +1 -1
  398. package/dist/components/typography/Text.cjs.map +1 -1
  399. package/dist/components/typography/Text.mjs +12 -11
  400. package/dist/components/typography/Text.mjs.map +1 -1
  401. package/dist/hooks/useFieldControl.cjs.map +1 -1
  402. package/dist/hooks/useFieldControl.mjs.map +1 -1
  403. package/dist/hooks/useMediaQuery.cjs +2 -0
  404. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  405. package/dist/hooks/useMediaQuery.mjs +20 -0
  406. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  407. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  408. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  409. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  410. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  411. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  412. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  413. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  414. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  415. package/dist/index.cjs +1 -1
  416. package/dist/index.d.cts +2890 -197
  417. package/dist/index.d.ts +2890 -197
  418. package/dist/index.mjs +101 -87
  419. package/dist/lib/classNames.cjs +2 -0
  420. package/dist/lib/classNames.cjs.map +1 -0
  421. package/dist/lib/classNames.mjs +423 -0
  422. package/dist/lib/classNames.mjs.map +1 -0
  423. package/dist/lib/color.cjs +2 -0
  424. package/dist/lib/color.cjs.map +1 -0
  425. package/dist/lib/color.mjs +86 -0
  426. package/dist/lib/color.mjs.map +1 -0
  427. package/dist/lib/globalRegistry.cjs.map +1 -1
  428. package/dist/lib/globalRegistry.mjs.map +1 -1
  429. package/dist/lib/styles.cjs +1 -1
  430. package/dist/lib/styles.cjs.map +1 -1
  431. package/dist/lib/styles.mjs +21 -4
  432. package/dist/lib/styles.mjs.map +1 -1
  433. package/dist/lib/toaster.cjs +2 -0
  434. package/dist/lib/toaster.cjs.map +1 -0
  435. package/dist/lib/toaster.mjs +77 -0
  436. package/dist/lib/toaster.mjs.map +1 -0
  437. package/dist/styles.css +1 -1
  438. package/package.json +1 -1
  439. package/src/styles/tokens.css +13 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.cjs","names":["cn","focusRing","disabledStyles","flattenChildren","ChevronRightIcon","isElementOfType","React","useTriggerElement","_Fragment","slotRendersContent","renderSlot","preventIfDisabled","require_runtime","require_cn","require_children","require_dev","require_slot","require_aria","require_styles","require_icons","require_useTriggerElement","react","react_jsx_runtime","linkClasses","currentClasses","currentChildClasses","textClasses","controlOnlyAttributes","spanAttributes","attributes","key","rest","BreadcrumbRoot","items","children","child","index","disableLinkChild","anchor","BreadcrumbItemChild","itemProps","target","icon","node","BreadcrumbItem","props","renderedIcon","asChild","kind","current","href","onClick","invalidAsChild","ignoredDisabled","ariaDisabled","childProps","linkDisabled","value","_disabled","childRest","childHref","className","anchorRest","buttonRest","Breadcrumb"],"sources":["../../../src/components/navigation/Breadcrumb.tsx"],"sourcesContent":["import * as React from 'react';\nimport { preventIfDisabled } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport type { Slot } from '../../lib/types';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport { warnOnce } from '../../lib/dev';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport { useTriggerElement } from '../../hooks/useTriggerElement';\n\n/** Properties for the Breadcrumb component. */\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Breadcrumb items to render; each one is placed in its own list item. Fragments are opened, so\n * the items of a conditional group (`{isAdmin && <>…</>}`) each get their own list item too.\n */\n children: React.ReactNode;\n /** Ref to the `<nav>` element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * The props of Breadcrumb.Item that every branch shares ({@link BreadcrumbItemAnchorProps},\n * {@link BreadcrumbItemButtonProps}, {@link BreadcrumbItemDynamicProps}).\n */\nexport interface BreadcrumbItemOwnProps {\n /**\n * Whether this item represents the current page (`aria-current=\"page\"`, rendered as text).\n * @default false\n */\n current?: boolean;\n /**\n * Slot for an icon displayed before the item text. Rendered with `aria-hidden=\"true\"`. A falsy\n * icon (`''`, `0`) or a list of nothing renders no icon span.\n */\n icon?: Slot<'span'>;\n /**\n * Merge the item's props (classes, `aria-current`, handlers, ref) onto its single child element\n * instead of rendering an element — for router links:\n * `<Breadcrumb.Item asChild><RouterLink to=\"/docs\">Docs</RouterLink></Breadcrumb.Item>`.\n * The icon is rendered inside the child. The item's `href` is passed on as a default (the\n * element's own `href` wins); with a router link, give the link its destination (`to`) instead.\n * `disabled` or `aria-disabled=\"true\"`, on the item or on the element, makes it an unavailable\n * link: `aria-disabled`, out of the tab order, its own `onClick` dropped and the click cancelled\n * (a router link does not navigate); an `<a>` also loses its `href`.\n * @default false\n */\n asChild?: boolean;\n /** Label content of the breadcrumb item (with `asChild`: the link element). */\n children: React.ReactNode;\n}\n\n/**\n * The attributes only a link has (`target`, `download`, `hrefLang`, `ping`, …). Items without\n * `href` declare them as `undefined`, so they are a type error instead of landing on a `<button>`\n * or `<span>`. `rel` cannot be listed (React types it on every element, RDFa); every non-link item\n * drops it at run time instead.\n */\ntype NoAnchorOnlyAttributes = {\n [\n K in Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>\n >\n ]?: undefined;\n};\n\n/** Breadcrumb.Item rendered as a link (`href` given): anchor attributes. */\nexport interface BreadcrumbItemAnchorProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof BreadcrumbItemOwnProps> {\n /**\n * URL the breadcrumb item links to; renders an `<a>` (unless `current`). With `asChild` it is a\n * default for the element, whose own `href` wins. Required in this branch, so `href`\n * discriminates the union and handlers without `href` are typed as button handlers.\n */\n href: string;\n /**\n * Makes the link unavailable, as Link's `disabled` does: no `href`, `role=\"link\"`,\n * `aria-disabled=\"true\"`, out of the tab order, and the click is cancelled (`onClick` is not\n * called). `aria-disabled=\"true\"` does the same.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element (`<a>`, or `<span>` for the current item). */\n ref?: React.Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\n/**\n * Breadcrumb.Item without `href`: a `<button type=\"button\">` when `onClick` is given (button\n * attributes; `disabled` gives it the disabled look), plain text otherwise. A `rel` is not\n * rendered on either.\n */\nexport interface BreadcrumbItemButtonProps\n extends\n BreadcrumbItemOwnProps,\n NoAnchorOnlyAttributes,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof BreadcrumbItemOwnProps> {\n /** Items without a link have no `href`. */\n href?: undefined;\n /** Ref to the rendered element (`<button>`, or `<span>` for text and the current item). */\n ref?: React.Ref<HTMLButtonElement | HTMLSpanElement>;\n}\n\n/**\n * Properties for the BreadcrumbItem sub-component: link props with `href`, button props without.\n *\n * A union type (0.4 had an interface): an interface cannot extend it, so extend one branch\n * (`interface X extends BreadcrumbItemAnchorProps`) or intersect\n * (`type X = BreadcrumbItemProps & { … }`). `React.ComponentProps<typeof Breadcrumb.Item>`\n * resolves to the last overload, {@link BreadcrumbItemDynamicProps}.\n */\nexport type BreadcrumbItemProps = BreadcrumbItemAnchorProps | BreadcrumbItemButtonProps;\n\n/**\n * Breadcrumb.Item with an `href` known only at run time (`string | undefined`): a link when it is\n * a string, otherwise a button (with `onClick`) or text. Handlers receive `HTMLElement` events and\n * only the attributes all kinds share are accepted (the 0.4 prop shape). Resolved after the button\n * and link signatures.\n */\nexport interface BreadcrumbItemDynamicProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps> {\n /** URL the breadcrumb item links to when defined. */\n href?: string;\n /**\n * Makes a link or button item unavailable (see {@link BreadcrumbItemAnchorProps} and\n * {@link BreadcrumbItemButtonProps}); ignored, with a development warning, on a text or current\n * item.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** The props every item kind shares at runtime (the union narrowed by `href`). */\ntype BreadcrumbEntryProps = BreadcrumbItemOwnProps &\n Omit<React.AllHTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps | 'ref'> & {\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * Links, buttons and `asChild` elements. The hover underline is gated (C-TOKENS), and the\n * disabled look covers a `disabled` button and an `aria-disabled` link.\n */\nconst linkClasses = cn(\n 'inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline',\n focusRing,\n disabledStyles,\n);\nconst currentClasses = 'inline-flex items-center font-semibold text-foreground';\n/** A current `asChild` element is the consumer's link: it takes focus and can be disabled. */\nconst currentChildClasses = cn(currentClasses, focusRing, disabledStyles);\nconst textClasses = 'inline-flex items-center text-foreground';\n\n/**\n * The attributes only a `<button>` or an `<a>` has (`disabled`, `type`, `form*`, `name`, `value`;\n * `target`, `download`, `hrefLang`, `ping`, `media`, `referrerPolicy`). The button props allow\n * `disabled` without `onClick`, and a current item keeps its link attributes, so the `<span>` of\n * the text and current items drops them instead of rendering invalid markup\n * (`<span disabled>`, `<span target=\"_blank\">`). Typed as a record so a key React adds to either\n * element's attributes is a compile error until it is listed here. `rel` is dropped as well: React\n * types it on every element (RDFa), but on a breadcrumb it comes with a link.\n */\ntype ControlOnlyAttribute =\n | Exclude<\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>,\n keyof React.HTMLAttributes<HTMLElement>\n >\n | Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.HTMLAttributes<HTMLElement> | 'href'\n >;\n\nconst controlOnlyAttributes: ReadonlySet<string> = /* @__PURE__ */ new Set([\n 'rel',\n ...Object.keys({\n disabled: true,\n type: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: true,\n formTarget: true,\n name: true,\n value: true,\n target: true,\n download: true,\n hrefLang: true,\n ping: true,\n media: true,\n referrerPolicy: true,\n } satisfies Record<ControlOnlyAttribute, true>),\n]);\n\n/** The props that are valid on the `<span>` of a text or current item. */\nfunction spanAttributes(rest: Record<string, unknown>): React.HTMLAttributes<HTMLSpanElement> {\n const attributes: Record<string, unknown> = {};\n for (const key of Object.keys(rest)) {\n if (!controlOnlyAttributes.has(key)) attributes[key] = rest[key];\n }\n return attributes as React.HTMLAttributes<HTMLSpanElement>;\n}\n\nconst BreadcrumbRoot = ({ children, className, ref, ...rest }: BreadcrumbProps) => {\n // Fragments are opened (`{isAdmin && <>…</>}`), so every crumb gets its own list item and separator.\n const items = flattenChildren(children);\n\n return (\n <nav ref={ref} aria-label=\"Breadcrumb\" {...rest} className={className}>\n <ol className=\"m-0 flex list-none items-center gap-1 p-0 text-body-1\">\n {items.map(({ key, node: child }, index) => (\n <li key={key} className=\"flex items-center gap-1\">\n {index > 0 && (\n <ChevronRightIcon\n data-wave-breadcrumb-separator=\"\"\n className=\"shrink-0 text-muted-foreground wave-rtl:-scale-x-100\"\n />\n )}\n {child}\n </li>\n ))}\n </ol>\n </nav>\n );\n};\nBreadcrumbRoot.displayName = 'Breadcrumb';\n\ninterface BreadcrumbItemChildProps extends React.HTMLAttributes<HTMLElement> {\n /** The item's `href`, a default for the element (the element's own `href` wins). */\n href?: string;\n child: React.ReactElement<{ children?: React.ReactNode }>;\n icon: React.ReactNode;\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * Link's disabled contract for an `asChild` element: an `<a>` drops its `href` (it is still\n * announced as a link); any element gets `aria-disabled`, leaves the tab order and loses its own\n * `onClick`. The item's click handler cancels the click, so a router link does not navigate.\n */\nfunction disableLinkChild(\n child: React.ReactElement<{ children?: React.ReactNode }>,\n): React.ReactElement<{ children?: React.ReactNode }> {\n const anchor = isElementOfType(child, 'a')\n ? { href: undefined, role: 'link', disabled: undefined }\n : undefined;\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ...anchor,\n 'aria-disabled': true,\n tabIndex: -1,\n onClick: undefined,\n }) as React.ReactElement<{ children?: React.ReactNode }>;\n}\n\n/**\n * `asChild` rendering: the item's props are merged onto the consumer's element with\n * `useTriggerElement` (the element's own handlers run first and its classes win conflicts; its\n * ref and the item's ref are both attached). The icon is placed inside the element.\n */\nfunction BreadcrumbItemChild({ child, icon, ...itemProps }: BreadcrumbItemChildProps) {\n const target = icon ? React.cloneElement(child, undefined, icon, child.props.children) : child;\n const node = useTriggerElement(target, itemProps, { componentName: 'Breadcrumb.Item' });\n return <>{node}</>;\n}\n\n/**\n * One step of a breadcrumb trail:\n * - `href` → a link (`<a>`, anchor attributes);\n * - `current` → the current page as text (`<span aria-current=\"page\">`);\n * - no `href` with `onClick` → a `<button type=\"button\">` styled as a link;\n * - no `href` and no `onClick` → plain text (`<span>`; development warning for a non-current item);\n * - `asChild` → the props are merged onto the single child element (router links).\n *\n * Typed by overloads, resolved in order: without `href` (button props, button events), with a\n * string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time\n * ({@link BreadcrumbItemDynamicProps}: `HTMLElement` events).\n *\n * Also exported as `BreadcrumbItem` (import the flat name from React Server Components).\n */\nfunction BreadcrumbItem(props: BreadcrumbItemButtonProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemAnchorProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemDynamicProps): React.ReactElement;\nfunction BreadcrumbItem(\n props: BreadcrumbItemProps | BreadcrumbItemDynamicProps,\n): React.ReactElement {\n const {\n href,\n current = false,\n icon,\n asChild = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n } = props as BreadcrumbEntryProps;\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in Nav,\n // Tree and Avatar, and so is a collection whose items render nothing: no empty span and no stray\n // `me-1` margin. The check does not consume a generator: renderSlot still renders its items.\n const renderedIcon =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', 'me-1 inline-flex shrink-0', { 'aria-hidden': true })\n : null;\n const child =\n asChild && React.isValidElement<{ children?: React.ReactNode }>(children) ? children : null;\n const kind = child\n ? 'child'\n : current\n ? 'current'\n : href !== undefined\n ? 'link'\n : onClick\n ? 'button'\n : 'text';\n\n const invalidAsChild = asChild && child === null;\n const ignoredDisabled = rest.disabled === true && (kind === 'text' || kind === 'current');\n // Link and asChild items follow Link's disabled contract. `<a disabled>` does not block\n // navigation, and an `aria-disabled` link only looks disabled unless the click is cancelled.\n // With asChild the element is the link, so its own `disabled`/`aria-disabled` count too.\n const ariaDisabled = rest['aria-disabled'];\n const childProps = (child?.props ?? {}) as Record<string, unknown>;\n const linkDisabled = [\n rest.disabled,\n ariaDisabled,\n childProps.disabled,\n childProps['aria-disabled'],\n ].some((value) => value === true || value === 'true');\n React.useEffect(() => {\n if (invalidAsChild) {\n warnOnce(\n 'Breadcrumb.Item:asChild',\n 'Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead.',\n );\n }\n if (kind === 'text') {\n warnOnce(\n 'Breadcrumb.Item:no-href',\n 'Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable.',\n );\n }\n if (ignoredDisabled) {\n warnOnce(\n 'Breadcrumb.Item:disabled',\n 'Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.',\n );\n }\n }, [invalidAsChild, kind, ignoredDisabled]);\n\n if (child) {\n const { disabled: _disabled, ...childRest } = rest;\n // Like the other item props, `href` is a default for the element (its own `href` wins). A\n // disabled link has no destination, so it is not passed then.\n const childHref = href !== undefined && !linkDisabled ? { href } : undefined;\n return (\n <BreadcrumbItemChild\n {...(childRest as React.HTMLAttributes<HTMLElement>)}\n {...childHref}\n ref={ref}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n aria-current={current ? 'page' : undefined}\n className={cn(current ? currentChildClasses : linkClasses, className)}\n icon={renderedIcon}\n child={linkDisabled ? disableLinkChild(child) : child}\n />\n );\n }\n\n if (kind === 'current') {\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n aria-current=\"page\"\n onClick={onClick}\n className={cn(currentClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n }\n\n if (kind === 'link') {\n const { disabled: _disabled, ...anchorRest } = rest;\n return (\n <a\n {...(anchorRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={linkDisabled ? undefined : href}\n role={linkDisabled ? 'link' : anchorRest.role}\n aria-disabled={linkDisabled ? true : ariaDisabled}\n tabIndex={linkDisabled ? -1 : anchorRest.tabIndex}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n className={cn(linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </a>\n );\n }\n\n if (kind === 'button') {\n // `rel` only belongs on a link: a button item drops it, like the text and current items.\n const { rel, ...buttonRest } = rest;\n return (\n <button\n type=\"button\"\n {...(buttonRest as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n ref={ref as React.Ref<HTMLButtonElement>}\n onClick={onClick}\n className={cn(linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </button>\n );\n }\n\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(textClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n}\nBreadcrumbItem.displayName = 'BreadcrumbItem';\n\n/**\n * A breadcrumb trail: a `<nav aria-label=\"Breadcrumb\">` landmark with an ordered list. Each child\n * is placed in its own list item (Fragments are opened, so each of their items gets one too); from\n * the second one on, the item begins with a decorative separator chevron that is mirrored in\n * right-to-left layouts.\n *\n * `Breadcrumb.Item` is also exported as `BreadcrumbItem`: React Server Components import the flat\n * name, because dotted access needs a client file.\n *\n * @example\n * <Breadcrumb>\n * <Breadcrumb.Item href=\"/\">Home</Breadcrumb.Item>\n * <Breadcrumb.Item current>Settings</Breadcrumb.Item>\n * </Breadcrumb>\n */\nexport const Breadcrumb = /* @__PURE__ */ Object.assign(BreadcrumbRoot, {\n Item: BreadcrumbItem,\n});\n\nexport { BreadcrumbItem };\n"],"mappings":"maAqJA,IAAMuB,EAAcvB,EAAAA,GAClB,mHACAC,EAAAA,UACAC,EAAAA,cACF,EACMsB,EAAiB,yDAEjBC,EAAsBzB,EAAAA,GAAGwB,EAAgBvB,EAAAA,UAAWC,EAAAA,cAAc,EAClEwB,EAAc,2CAqBdC,EAA6D,IAAI,IAAI,CACzE,MACA,GAAG,OAAO,KAAK,CACb,SAAU,GACV,KAAM,GACN,KAAM,GACN,WAAY,GACZ,YAAa,GACb,WAAY,GACZ,eAAgB,GAChB,WAAY,GACZ,KAAM,GACN,MAAO,GACP,OAAQ,GACR,SAAU,GACV,SAAU,GACV,KAAM,GACN,MAAO,GACP,eAAgB,EAClB,CAA8C,CAChD,CAAC,EAGD,SAASC,EAAe,EAAsE,CAC5F,IAAMC,EAAsC,CAAC,EAC7C,IAAK,IAAMC,KAAO,OAAO,KAAKC,CAAI,EAC3BJ,EAAsB,IAAIG,CAAG,IAAG,EAAWA,GAAOC,EAAKD,IAE9D,OAAOD,CACT,CAEA,IAAMG,GAAkB,CAAE,WAAU,YAAW,MAAK,GAAGD,KAA4B,CAEjF,IAAME,EAAQ9B,EAAAA,gBAAgB+B,CAAQ,EAEtC,OACE,EAAAZ,EAAA,IAAA,CAAC,MAAD,CAAU,MAAK,aAAW,aAAa,GAAIS,EAAiB,Y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ACL,KAAMN,EAAe,IAAA,GAAYN,EACjC,KAAMM,EAAe,OAASM,EAAW,KACzC,gBAAeN,EAAe,GAAOF,EACrC,SAAUE,EAAe,GAAKM,EAAW,SACzC,QAASnD,EAAAA,kBAAkB6C,EAAcL,CAAO,EAChD,UAAWnD,EAAAA,GAAGuB,EAAasC,CAAS,EARtC,SAAA,CAUGf,EACAZ,CACA,GAEP,CAEA,GAAIc,IAAS,SAAU,CAErB,GAAM,CAAE,MAAK,GAAGe,GAAehC,EAC/B,OACE,EAAAT,EAAA,KAAA,CAAC,SAAD,CACE,KAAK,SACL,GAAKyC,EACA,MACI,UACT,UAAW/D,EAAAA,GAAGuB,EAAasC,CAAS,EALtC,SAAA,CAOGf,EACAZ,CACK,GAEZ,CAEA,OACE,EAAAZ,EAAA,KAAA,CAAC,OAAD,CACE,GAAIM,EAAeG,CAAI,EAClB,MACL,UAAW/B,EAAAA,GAAG0B,EAAamC,CAAS,EAHtC,SAAA,CAKGf,EACAZ,CACG,GAEV,CACA,EAAe,YAAc,iBAiB7B,IAAa8B,EAA6B,OAAO,OAAOhC,EAAgB,CACtE,KAAMY,CACR,CAAC"}
1
+ {"version":3,"file":"Breadcrumb.cjs","names":["cn","focusRing","disabledStyles","flattenChildren","breadcrumbClassNames","ChevronRightIcon","isElementOfType","React","useTriggerElement","_Fragment","slotRendersContent","renderSlot","breadcrumbItemClassNames","preventIfDisabled","require_runtime","require_cn","require_children","require_dev","require_slot","require_classNames","require_aria","require_styles","require_icons","require_useTriggerElement","react","react_jsx_runtime","linkClasses","currentClasses","currentChildClasses","textClasses","controlOnlyAttributes","spanAttributes","attributes","key","rest","BreadcrumbRoot","items","children","className","child","index","disableLinkChild","anchor","BreadcrumbItemChild","itemProps","target","icon","node","BreadcrumbItem","props","renderedIcon","asChild","kind","current","href","onClick","invalidAsChild","ignoredDisabled","ariaDisabled","childProps","linkDisabled","value","_disabled","childRest","childHref","anchorRest","buttonRest","Breadcrumb"],"sources":["../../../src/components/navigation/Breadcrumb.tsx"],"sourcesContent":["import * as React from 'react';\nimport { preventIfDisabled } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { breadcrumbClassNames, breadcrumbItemClassNames } from '../../lib/classNames';\nimport type { Slot } from '../../lib/types';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport { warnOnce } from '../../lib/dev';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport { useTriggerElement } from '../../hooks/useTriggerElement';\n\n/** Properties for the Breadcrumb component. */\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Breadcrumb items to render; each one is placed in its own list item. Fragments are opened, so\n * the items of a conditional group (`{isAdmin && <>…</>}`) each get their own list item too.\n */\n children: React.ReactNode;\n /** Ref to the `<nav>` element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * The props of Breadcrumb.Item that every branch shares ({@link BreadcrumbItemAnchorProps},\n * {@link BreadcrumbItemButtonProps}, {@link BreadcrumbItemDynamicProps}).\n */\nexport interface BreadcrumbItemOwnProps {\n /**\n * Whether this item represents the current page (`aria-current=\"page\"`, rendered as text).\n * @default false\n */\n current?: boolean;\n /**\n * Slot for an icon displayed before the item text. Rendered with `aria-hidden=\"true\"`. A falsy\n * icon (`''`, `0`) or a list of nothing renders no icon span.\n */\n icon?: Slot<'span'>;\n /**\n * Merge the item's props (classes, `aria-current`, handlers, ref) onto its single child element\n * instead of rendering an element — for router links:\n * `<Breadcrumb.Item asChild><RouterLink to=\"/docs\">Docs</RouterLink></Breadcrumb.Item>`.\n * The icon is rendered inside the child. The item's `href` is passed on as a default (the\n * element's own `href` wins); with a router link, give the link its destination (`to`) instead.\n * `disabled` or `aria-disabled=\"true\"`, on the item or on the element, makes it an unavailable\n * link: `aria-disabled`, out of the tab order, its own `onClick` dropped and the click cancelled\n * (a router link does not navigate); an `<a>` also loses its `href`.\n * @default false\n */\n asChild?: boolean;\n /** Label content of the breadcrumb item (with `asChild`: the link element). */\n children: React.ReactNode;\n}\n\n/**\n * The attributes only a link has (`target`, `download`, `hrefLang`, `ping`, …). Items without\n * `href` declare them as `undefined`, so they are a type error instead of landing on a `<button>`\n * or `<span>`. `rel` cannot be listed (React types it on every element, RDFa); every non-link item\n * drops it at run time instead.\n */\ntype NoAnchorOnlyAttributes = {\n [\n K in Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>\n >\n ]?: undefined;\n};\n\n/** Breadcrumb.Item rendered as a link (`href` given): anchor attributes. */\nexport interface BreadcrumbItemAnchorProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof BreadcrumbItemOwnProps> {\n /**\n * URL the breadcrumb item links to; renders an `<a>` (unless `current`). With `asChild` it is a\n * default for the element, whose own `href` wins. Required in this branch, so `href`\n * discriminates the union and handlers without `href` are typed as button handlers.\n */\n href: string;\n /**\n * Makes the link unavailable, as Link's `disabled` does: no `href`, `role=\"link\"`,\n * `aria-disabled=\"true\"`, out of the tab order, and the click is cancelled (`onClick` is not\n * called). `aria-disabled=\"true\"` does the same.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element (`<a>`, or `<span>` for the current item). */\n ref?: React.Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\n/**\n * Breadcrumb.Item without `href`: a `<button type=\"button\">` when `onClick` is given (button\n * attributes; `disabled` gives it the disabled look), plain text otherwise. A `rel` is not\n * rendered on either.\n */\nexport interface BreadcrumbItemButtonProps\n extends\n BreadcrumbItemOwnProps,\n NoAnchorOnlyAttributes,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof BreadcrumbItemOwnProps> {\n /** Items without a link have no `href`. */\n href?: undefined;\n /** Ref to the rendered element (`<button>`, or `<span>` for text and the current item). */\n ref?: React.Ref<HTMLButtonElement | HTMLSpanElement>;\n}\n\n/**\n * Properties for the BreadcrumbItem sub-component: link props with `href`, button props without.\n *\n * A union type (0.4 had an interface): an interface cannot extend it, so extend one branch\n * (`interface X extends BreadcrumbItemAnchorProps`) or intersect\n * (`type X = BreadcrumbItemProps & { … }`). `React.ComponentProps<typeof Breadcrumb.Item>`\n * resolves to the last overload, {@link BreadcrumbItemDynamicProps}.\n */\nexport type BreadcrumbItemProps = BreadcrumbItemAnchorProps | BreadcrumbItemButtonProps;\n\n/**\n * Breadcrumb.Item with an `href` known only at run time (`string | undefined`): a link when it is\n * a string, otherwise a button (with `onClick`) or text. Handlers receive `HTMLElement` events and\n * only the attributes all kinds share are accepted (the 0.4 prop shape). Resolved after the button\n * and link signatures.\n */\nexport interface BreadcrumbItemDynamicProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps> {\n /** URL the breadcrumb item links to when defined. */\n href?: string;\n /**\n * Makes a link or button item unavailable (see {@link BreadcrumbItemAnchorProps} and\n * {@link BreadcrumbItemButtonProps}); ignored, with a development warning, on a text or current\n * item.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** The props every item kind shares at runtime (the union narrowed by `href`). */\ntype BreadcrumbEntryProps = BreadcrumbItemOwnProps &\n Omit<React.AllHTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps | 'ref'> & {\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * Links, buttons and `asChild` elements. The hover underline is gated (C-TOKENS), and the\n * disabled look covers a `disabled` button and an `aria-disabled` link.\n */\nconst linkClasses = cn(\n 'inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline',\n focusRing,\n disabledStyles,\n);\nconst currentClasses = 'inline-flex items-center font-semibold text-foreground';\n/** A current `asChild` element is the consumer's link: it takes focus and can be disabled. */\nconst currentChildClasses = cn(currentClasses, focusRing, disabledStyles);\nconst textClasses = 'inline-flex items-center text-foreground';\n\n/**\n * The attributes only a `<button>` or an `<a>` has (`disabled`, `type`, `form*`, `name`, `value`;\n * `target`, `download`, `hrefLang`, `ping`, `media`, `referrerPolicy`). The button props allow\n * `disabled` without `onClick`, and a current item keeps its link attributes, so the `<span>` of\n * the text and current items drops them instead of rendering invalid markup\n * (`<span disabled>`, `<span target=\"_blank\">`). Typed as a record so a key React adds to either\n * element's attributes is a compile error until it is listed here. `rel` is dropped as well: React\n * types it on every element (RDFa), but on a breadcrumb it comes with a link.\n */\ntype ControlOnlyAttribute =\n | Exclude<\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>,\n keyof React.HTMLAttributes<HTMLElement>\n >\n | Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.HTMLAttributes<HTMLElement> | 'href'\n >;\n\nconst controlOnlyAttributes: ReadonlySet<string> = /* @__PURE__ */ new Set([\n 'rel',\n ...Object.keys({\n disabled: true,\n type: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: true,\n formTarget: true,\n name: true,\n value: true,\n target: true,\n download: true,\n hrefLang: true,\n ping: true,\n media: true,\n referrerPolicy: true,\n } satisfies Record<ControlOnlyAttribute, true>),\n]);\n\n/** The props that are valid on the `<span>` of a text or current item. */\nfunction spanAttributes(rest: Record<string, unknown>): React.HTMLAttributes<HTMLSpanElement> {\n const attributes: Record<string, unknown> = {};\n for (const key of Object.keys(rest)) {\n if (!controlOnlyAttributes.has(key)) attributes[key] = rest[key];\n }\n return attributes as React.HTMLAttributes<HTMLSpanElement>;\n}\n\nconst BreadcrumbRoot = ({ children, className, ref, ...rest }: BreadcrumbProps) => {\n // Fragments are opened (`{isAdmin && <>…</>}`), so every crumb gets its own list item and separator.\n const items = flattenChildren(children);\n\n return (\n <nav\n ref={ref}\n aria-label=\"Breadcrumb\"\n {...rest}\n className={cn(breadcrumbClassNames.root, className)}\n >\n <ol\n className={cn(\n breadcrumbClassNames.list,\n 'm-0 flex list-none items-center gap-1 p-0 text-body-1',\n )}\n >\n {items.map(({ key, node: child }, index) => (\n <li key={key} className={cn(breadcrumbClassNames.listItem, 'flex items-center gap-1')}>\n {index > 0 && (\n <ChevronRightIcon\n data-wave-breadcrumb-separator=\"\"\n className={cn(\n breadcrumbClassNames.divider,\n 'shrink-0 text-muted-foreground wave-rtl:-scale-x-100',\n )}\n />\n )}\n {child}\n </li>\n ))}\n </ol>\n </nav>\n );\n};\nBreadcrumbRoot.displayName = 'Breadcrumb';\n\ninterface BreadcrumbItemChildProps extends React.HTMLAttributes<HTMLElement> {\n /** The item's `href`, a default for the element (the element's own `href` wins). */\n href?: string;\n child: React.ReactElement<{ children?: React.ReactNode }>;\n icon: React.ReactNode;\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * Link's disabled contract for an `asChild` element: an `<a>` drops its `href` (it is still\n * announced as a link); any element gets `aria-disabled`, leaves the tab order and loses its own\n * `onClick`. The item's click handler cancels the click, so a router link does not navigate.\n */\nfunction disableLinkChild(\n child: React.ReactElement<{ children?: React.ReactNode }>,\n): React.ReactElement<{ children?: React.ReactNode }> {\n const anchor = isElementOfType(child, 'a')\n ? { href: undefined, role: 'link', disabled: undefined }\n : undefined;\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ...anchor,\n 'aria-disabled': true,\n tabIndex: -1,\n onClick: undefined,\n }) as React.ReactElement<{ children?: React.ReactNode }>;\n}\n\n/**\n * `asChild` rendering: the item's props are merged onto the consumer's element with\n * `useTriggerElement` (the element's own handlers run first and its classes win conflicts; its\n * ref and the item's ref are both attached). The icon is placed inside the element.\n */\nfunction BreadcrumbItemChild({ child, icon, ...itemProps }: BreadcrumbItemChildProps) {\n const target = icon ? React.cloneElement(child, undefined, icon, child.props.children) : child;\n const node = useTriggerElement(target, itemProps, { componentName: 'Breadcrumb.Item' });\n return <>{node}</>;\n}\n\n/**\n * One step of a breadcrumb trail:\n * - `href` → a link (`<a>`, anchor attributes);\n * - `current` → the current page as text (`<span aria-current=\"page\">`);\n * - no `href` with `onClick` → a `<button type=\"button\">` styled as a link;\n * - no `href` and no `onClick` → plain text (`<span>`; development warning for a non-current item);\n * - `asChild` → the props are merged onto the single child element (router links).\n *\n * Typed by overloads, resolved in order: without `href` (button props, button events), with a\n * string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time\n * ({@link BreadcrumbItemDynamicProps}: `HTMLElement` events).\n *\n * Also exported as `BreadcrumbItem` (import the flat name from React Server Components).\n */\nfunction BreadcrumbItem(props: BreadcrumbItemButtonProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemAnchorProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemDynamicProps): React.ReactElement;\nfunction BreadcrumbItem(\n props: BreadcrumbItemProps | BreadcrumbItemDynamicProps,\n): React.ReactElement {\n const {\n href,\n current = false,\n icon,\n asChild = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n } = props as BreadcrumbEntryProps;\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in Nav,\n // Tree and Avatar, and so is a collection whose items render nothing: no empty span and no stray\n // `me-1` margin. The check does not consume a generator: renderSlot still renders its items.\n const renderedIcon =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(breadcrumbItemClassNames.icon, 'me-1 inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n const child =\n asChild && React.isValidElement<{ children?: React.ReactNode }>(children) ? children : null;\n const kind = child\n ? 'child'\n : current\n ? 'current'\n : href !== undefined\n ? 'link'\n : onClick\n ? 'button'\n : 'text';\n\n const invalidAsChild = asChild && child === null;\n const ignoredDisabled = rest.disabled === true && (kind === 'text' || kind === 'current');\n // Link and asChild items follow Link's disabled contract. `<a disabled>` does not block\n // navigation, and an `aria-disabled` link only looks disabled unless the click is cancelled.\n // With asChild the element is the link, so its own `disabled`/`aria-disabled` count too.\n const ariaDisabled = rest['aria-disabled'];\n const childProps = (child?.props ?? {}) as Record<string, unknown>;\n const linkDisabled = [\n rest.disabled,\n ariaDisabled,\n childProps.disabled,\n childProps['aria-disabled'],\n ].some((value) => value === true || value === 'true');\n React.useEffect(() => {\n if (invalidAsChild) {\n warnOnce(\n 'Breadcrumb.Item:asChild',\n 'Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead.',\n );\n }\n if (kind === 'text') {\n warnOnce(\n 'Breadcrumb.Item:no-href',\n 'Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable.',\n );\n }\n if (ignoredDisabled) {\n warnOnce(\n 'Breadcrumb.Item:disabled',\n 'Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.',\n );\n }\n }, [invalidAsChild, kind, ignoredDisabled]);\n\n if (child) {\n const { disabled: _disabled, ...childRest } = rest;\n // Like the other item props, `href` is a default for the element (its own `href` wins). A\n // disabled link has no destination, so it is not passed then.\n const childHref = href !== undefined && !linkDisabled ? { href } : undefined;\n return (\n <BreadcrumbItemChild\n {...(childRest as React.HTMLAttributes<HTMLElement>)}\n {...childHref}\n ref={ref}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n aria-current={current ? 'page' : undefined}\n className={cn(\n breadcrumbItemClassNames.root,\n current ? currentChildClasses : linkClasses,\n className,\n )}\n icon={renderedIcon}\n child={linkDisabled ? disableLinkChild(child) : child}\n />\n );\n }\n\n if (kind === 'current') {\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n aria-current=\"page\"\n onClick={onClick}\n className={cn(breadcrumbItemClassNames.root, currentClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n }\n\n if (kind === 'link') {\n const { disabled: _disabled, ...anchorRest } = rest;\n return (\n <a\n {...(anchorRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={linkDisabled ? undefined : href}\n role={linkDisabled ? 'link' : anchorRest.role}\n aria-disabled={linkDisabled ? true : ariaDisabled}\n tabIndex={linkDisabled ? -1 : anchorRest.tabIndex}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n className={cn(breadcrumbItemClassNames.root, linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </a>\n );\n }\n\n if (kind === 'button') {\n // `rel` only belongs on a link: a button item drops it, like the text and current items.\n const { rel, ...buttonRest } = rest;\n return (\n <button\n type=\"button\"\n {...(buttonRest as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n ref={ref as React.Ref<HTMLButtonElement>}\n onClick={onClick}\n className={cn(breadcrumbItemClassNames.root, linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </button>\n );\n }\n\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(breadcrumbItemClassNames.root, textClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n}\nBreadcrumbItem.displayName = 'BreadcrumbItem';\n\n/**\n * A breadcrumb trail: a `<nav aria-label=\"Breadcrumb\">` landmark with an ordered list. Each child\n * is placed in its own list item (Fragments are opened, so each of their items gets one too); from\n * the second one on, the item begins with a decorative separator chevron that is mirrored in\n * right-to-left layouts.\n *\n * `Breadcrumb.Item` is also exported as `BreadcrumbItem`: React Server Components import the flat\n * name, because dotted access needs a client file.\n *\n * @example\n * <Breadcrumb>\n * <Breadcrumb.Item href=\"/\">Home</Breadcrumb.Item>\n * <Breadcrumb.Item current>Settings</Breadcrumb.Item>\n * </Breadcrumb>\n */\nexport const Breadcrumb = /* @__PURE__ */ Object.assign(BreadcrumbRoot, {\n Item: BreadcrumbItem,\n});\n\nexport { BreadcrumbItem };\n"],"mappings":"ycAsJA,IAAM0B,EAAc1B,EAAAA,GAClB,mHACAC,EAAAA,UACAC,EAAAA,cACF,EACMyB,EAAiB,yDAEjBC,EAAsB5B,EAAAA,GAAG2B,EAAgB1B,EAAAA,UAAWC,EAAAA,cAAc,EAClE2B,EA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E,EAAAT,EAAA,KAAA,CAAC,SAAD,CACE,KAAK,SACL,GAAKyC,EACA,MACI,UACT,UAAWlE,EAAAA,GAAGY,EAAAA,yBAAyB,KAAMc,EAAaY,CAAS,EALrE,SAAA,CAOGY,EACAb,CACK,GAEZ,CAEA,OACE,EAAAZ,EAAA,KAAA,CAAC,OAAD,CACE,GAAIM,EAAeG,CAAI,EAClB,MACL,UAAWlC,EAAAA,GAAGY,EAAAA,yBAAyB,KAAMiB,EAAaS,CAAS,EAHrE,SAAA,CAKGY,EACAb,CACG,GAEV,CACA,EAAe,YAAc,iBAiB7B,IAAa8B,EAA6B,OAAO,OAAOhC,EAAgB,CACtE,KAAMa,CACR,CAAC"}
@@ -3,14 +3,15 @@ import { cn as e } from "../../lib/cn.mjs";
3
3
  import { flattenChildren as t, isElementOfType as n } from "../../lib/children.mjs";
4
4
  import { warnOnce as r } from "../../lib/dev.mjs";
5
5
  import { renderSlot as i, slotRendersContent as a } from "../../lib/slot.mjs";
6
- import { preventIfDisabled as o } from "../../lib/aria.mjs";
7
- import { disabledStyles as s, focusRing as c } from "../../lib/styles.mjs";
8
- import { ChevronRightIcon as l } from "../../lib/icons.mjs";
9
- import { useTriggerElement as u } from "../../hooks/useTriggerElement.mjs";
10
- import * as d from "react";
11
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
6
+ import { breadcrumbClassNames as o, breadcrumbItemClassNames as s } from "../../lib/classNames.mjs";
7
+ import { preventIfDisabled as c } from "../../lib/aria.mjs";
8
+ import { disabledStyles as l, focusRing as u } from "../../lib/styles.mjs";
9
+ import { ChevronRightIcon as d } from "../../lib/icons.mjs";
10
+ import { useTriggerElement as f } from "../../hooks/useTriggerElement.mjs";
11
+ import * as p from "react";
12
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
12
13
  //#region src/components/navigation/Breadcrumb.tsx
13
- var h = e("inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline", c, s), g = "inline-flex items-center font-semibold text-foreground", _ = e(g, c, s), v = "inline-flex items-center text-foreground", y = /* @__PURE__ */ new Set(["rel", ...Object.keys({
14
+ var _ = e("inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline", u, l), v = "inline-flex items-center font-semibold text-foreground", y = e(v, u, l), b = "inline-flex items-center text-foreground", x = /* @__PURE__ */ new Set(["rel", ...Object.keys({
14
15
  disabled: !0,
15
16
  type: !0,
16
17
  form: !0,
@@ -28,117 +29,117 @@ var h = e("inline-flex cursor-pointer items-center text-primary no-underline not
28
29
  media: !0,
29
30
  referrerPolicy: !0
30
31
  })]);
31
- function b(e) {
32
+ function S(e) {
32
33
  let t = {};
33
- for (let n of Object.keys(e)) y.has(n) || (t[n] = e[n]);
34
+ for (let n of Object.keys(e)) x.has(n) || (t[n] = e[n]);
34
35
  return t;
35
36
  }
36
- var x = ({ children: e, className: n, ref: r, ...i }) => {
37
- let a = t(e);
38
- return /* @__PURE__ */ p("nav", {
39
- ref: r,
37
+ var C = ({ children: n, className: r, ref: i, ...a }) => {
38
+ let s = t(n);
39
+ return /* @__PURE__ */ h("nav", {
40
+ ref: i,
40
41
  "aria-label": "Breadcrumb",
41
- ...i,
42
- className: n,
43
- children: /* @__PURE__ */ p("ol", {
44
- className: "m-0 flex list-none items-center gap-1 p-0 text-body-1",
45
- children: a.map(({ key: e, node: t }, n) => /* @__PURE__ */ m("li", {
46
- className: "flex items-center gap-1",
47
- children: [n > 0 && /* @__PURE__ */ p(l, {
42
+ ...a,
43
+ className: e(o.root, r),
44
+ children: /* @__PURE__ */ h("ol", {
45
+ className: e(o.list, "m-0 flex list-none items-center gap-1 p-0 text-body-1"),
46
+ children: s.map(({ key: t, node: n }, r) => /* @__PURE__ */ g("li", {
47
+ className: e(o.listItem, "flex items-center gap-1"),
48
+ children: [r > 0 && /* @__PURE__ */ h(d, {
48
49
  "data-wave-breadcrumb-separator": "",
49
- className: "shrink-0 text-muted-foreground wave-rtl:-scale-x-100"
50
- }), t]
51
- }, e))
50
+ className: e(o.divider, "shrink-0 text-muted-foreground wave-rtl:-scale-x-100")
51
+ }), n]
52
+ }, t))
52
53
  })
53
54
  });
54
55
  };
55
- x.displayName = "Breadcrumb";
56
- function S(e) {
56
+ C.displayName = "Breadcrumb";
57
+ function w(e) {
57
58
  let t = n(e, "a") ? {
58
59
  href: void 0,
59
60
  role: "link",
60
61
  disabled: void 0
61
62
  } : void 0;
62
- return d.cloneElement(e, {
63
+ return p.cloneElement(e, {
63
64
  ...t,
64
65
  "aria-disabled": !0,
65
66
  tabIndex: -1,
66
67
  onClick: void 0
67
68
  });
68
69
  }
69
- function C({ child: e, icon: t, ...n }) {
70
- let r = t ? d.cloneElement(e, void 0, t, e.props.children) : e, i = u(r, n, { componentName: "Breadcrumb.Item" });
71
- return /* @__PURE__ */ p(f, { children: i });
70
+ function T({ child: e, icon: t, ...n }) {
71
+ let r = t ? p.cloneElement(e, void 0, t, e.props.children) : e, i = f(r, n, { componentName: "Breadcrumb.Item" });
72
+ return /* @__PURE__ */ h(m, { children: i });
72
73
  }
73
- function w(t) {
74
- let { href: n, current: s = !1, icon: c, asChild: l = !1, children: u, className: f, onClick: y, ref: x, ...w } = t, T = c && a(c) ? i(c, "span", "me-1 inline-flex shrink-0", { "aria-hidden": !0 }) : null, E = l && d.isValidElement(u) ? u : null, D = E ? "child" : s ? "current" : n === void 0 ? y ? "button" : "text" : "link", O = l && E === null, k = w.disabled === !0 && (D === "text" || D === "current"), A = w["aria-disabled"], j = E?.props ?? {}, M = [
75
- w.disabled,
76
- A,
77
- j.disabled,
78
- j["aria-disabled"]
74
+ function E(t) {
75
+ let { href: n, current: o = !1, icon: l, asChild: u = !1, children: d, className: f, onClick: m, ref: x, ...C } = t, E = l && a(l) ? i(l, "span", e(s.icon, "me-1 inline-flex shrink-0"), { "aria-hidden": !0 }) : null, D = u && p.isValidElement(d) ? d : null, O = D ? "child" : o ? "current" : n === void 0 ? m ? "button" : "text" : "link", k = u && D === null, A = C.disabled === !0 && (O === "text" || O === "current"), j = C["aria-disabled"], M = D?.props ?? {}, N = [
76
+ C.disabled,
77
+ j,
78
+ M.disabled,
79
+ M["aria-disabled"]
79
80
  ].some((e) => e === !0 || e === "true");
80
- if (d.useEffect(() => {
81
- O && r("Breadcrumb.Item:asChild", "Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead."), D === "text" && r("Breadcrumb.Item:no-href", "Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable."), k && r("Breadcrumb.Item:disabled", "Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.");
81
+ if (p.useEffect(() => {
82
+ k && r("Breadcrumb.Item:asChild", "Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead."), O === "text" && r("Breadcrumb.Item:no-href", "Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable."), A && r("Breadcrumb.Item:disabled", "Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.");
82
83
  }, [
84
+ k,
83
85
  O,
84
- D,
85
- k
86
- ]), E) {
87
- let { disabled: t, ...r } = w, i = n !== void 0 && !M ? { href: n } : void 0;
88
- return /* @__PURE__ */ p(C, {
86
+ A
87
+ ]), D) {
88
+ let { disabled: t, ...r } = C, i = n !== void 0 && !N ? { href: n } : void 0;
89
+ return /* @__PURE__ */ h(T, {
89
90
  ...r,
90
91
  ...i,
91
92
  ref: x,
92
- onClick: o(M, y),
93
- "aria-current": s ? "page" : void 0,
94
- className: e(s ? _ : h, f),
95
- icon: T,
96
- child: M ? S(E) : E
93
+ onClick: c(N, m),
94
+ "aria-current": o ? "page" : void 0,
95
+ className: e(s.root, o ? y : _, f),
96
+ icon: E,
97
+ child: N ? w(D) : D
97
98
  });
98
99
  }
99
- if (D === "current") return /* @__PURE__ */ m("span", {
100
- ...b(w),
100
+ if (O === "current") return /* @__PURE__ */ g("span", {
101
+ ...S(C),
101
102
  ref: x,
102
103
  "aria-current": "page",
103
- onClick: y,
104
- className: e(g, f),
105
- children: [T, u]
104
+ onClick: m,
105
+ className: e(s.root, v, f),
106
+ children: [E, d]
106
107
  });
107
- if (D === "link") {
108
- let { disabled: t, ...r } = w;
109
- return /* @__PURE__ */ m("a", {
108
+ if (O === "link") {
109
+ let { disabled: t, ...r } = C;
110
+ return /* @__PURE__ */ g("a", {
110
111
  ...r,
111
112
  ref: x,
112
- href: M ? void 0 : n,
113
- role: M ? "link" : r.role,
114
- "aria-disabled": M ? !0 : A,
115
- tabIndex: M ? -1 : r.tabIndex,
116
- onClick: o(M, y),
117
- className: e(h, f),
118
- children: [T, u]
113
+ href: N ? void 0 : n,
114
+ role: N ? "link" : r.role,
115
+ "aria-disabled": N ? !0 : j,
116
+ tabIndex: N ? -1 : r.tabIndex,
117
+ onClick: c(N, m),
118
+ className: e(s.root, _, f),
119
+ children: [E, d]
119
120
  });
120
121
  }
121
- if (D === "button") {
122
- let { rel: t, ...n } = w;
123
- return /* @__PURE__ */ m("button", {
122
+ if (O === "button") {
123
+ let { rel: t, ...n } = C;
124
+ return /* @__PURE__ */ g("button", {
124
125
  type: "button",
125
126
  ...n,
126
127
  ref: x,
127
- onClick: y,
128
- className: e(h, f),
129
- children: [T, u]
128
+ onClick: m,
129
+ className: e(s.root, _, f),
130
+ children: [E, d]
130
131
  });
131
132
  }
132
- return /* @__PURE__ */ m("span", {
133
- ...b(w),
133
+ return /* @__PURE__ */ g("span", {
134
+ ...S(C),
134
135
  ref: x,
135
- className: e(v, f),
136
- children: [T, u]
136
+ className: e(s.root, b, f),
137
+ children: [E, d]
137
138
  });
138
139
  }
139
- w.displayName = "BreadcrumbItem";
140
- var T = /* @__PURE__ */ Object.assign(x, { Item: w });
140
+ E.displayName = "BreadcrumbItem";
141
+ var D = /* @__PURE__ */ Object.assign(C, { Item: E });
141
142
  //#endregion
142
- export { T as Breadcrumb, w as BreadcrumbItem };
143
+ export { D as Breadcrumb, E as BreadcrumbItem };
143
144
 
144
145
  //# sourceMappingURL=Breadcrumb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.mjs","names":["_Fragment","React","linkClasses","cn","focusRing","disabledStyles","currentClasses","currentChildClasses","textClasses","controlOnlyAttributes","spanAttributes","attributes","key","rest","BreadcrumbRoot","items","flattenChildren","children","child","index","ChevronRightIcon","disableLinkChild","anchor","isElementOfType","BreadcrumbItemChild","itemProps","target","icon","node","useTriggerElement","Fragment","BreadcrumbItem","props","renderedIcon","slotRendersContent","renderSlot","asChild","kind","current","href","onClick","invalidAsChild","ignoredDisabled","ariaDisabled","childProps","linkDisabled","value","warnOnce","_disabled","childRest","childHref","preventIfDisabled","className","anchorRest","buttonRest","Breadcrumb"],"sources":["../../../src/components/navigation/Breadcrumb.tsx"],"sourcesContent":["import * as React from 'react';\nimport { preventIfDisabled } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport type { Slot } from '../../lib/types';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport { warnOnce } from '../../lib/dev';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport { useTriggerElement } from '../../hooks/useTriggerElement';\n\n/** Properties for the Breadcrumb component. */\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Breadcrumb items to render; each one is placed in its own list item. Fragments are opened, so\n * the items of a conditional group (`{isAdmin && <>…</>}`) each get their own list item too.\n */\n children: React.ReactNode;\n /** Ref to the `<nav>` element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * The props of Breadcrumb.Item that every branch shares ({@link BreadcrumbItemAnchorProps},\n * {@link BreadcrumbItemButtonProps}, {@link BreadcrumbItemDynamicProps}).\n */\nexport interface BreadcrumbItemOwnProps {\n /**\n * Whether this item represents the current page (`aria-current=\"page\"`, rendered as text).\n * @default false\n */\n current?: boolean;\n /**\n * Slot for an icon displayed before the item text. Rendered with `aria-hidden=\"true\"`. A falsy\n * icon (`''`, `0`) or a list of nothing renders no icon span.\n */\n icon?: Slot<'span'>;\n /**\n * Merge the item's props (classes, `aria-current`, handlers, ref) onto its single child element\n * instead of rendering an element — for router links:\n * `<Breadcrumb.Item asChild><RouterLink to=\"/docs\">Docs</RouterLink></Breadcrumb.Item>`.\n * The icon is rendered inside the child. The item's `href` is passed on as a default (the\n * element's own `href` wins); with a router link, give the link its destination (`to`) instead.\n * `disabled` or `aria-disabled=\"true\"`, on the item or on the element, makes it an unavailable\n * link: `aria-disabled`, out of the tab order, its own `onClick` dropped and the click cancelled\n * (a router link does not navigate); an `<a>` also loses its `href`.\n * @default false\n */\n asChild?: boolean;\n /** Label content of the breadcrumb item (with `asChild`: the link element). */\n children: React.ReactNode;\n}\n\n/**\n * The attributes only a link has (`target`, `download`, `hrefLang`, `ping`, …). Items without\n * `href` declare them as `undefined`, so they are a type error instead of landing on a `<button>`\n * or `<span>`. `rel` cannot be listed (React types it on every element, RDFa); every non-link item\n * drops it at run time instead.\n */\ntype NoAnchorOnlyAttributes = {\n [\n K in Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>\n >\n ]?: undefined;\n};\n\n/** Breadcrumb.Item rendered as a link (`href` given): anchor attributes. */\nexport interface BreadcrumbItemAnchorProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof BreadcrumbItemOwnProps> {\n /**\n * URL the breadcrumb item links to; renders an `<a>` (unless `current`). With `asChild` it is a\n * default for the element, whose own `href` wins. Required in this branch, so `href`\n * discriminates the union and handlers without `href` are typed as button handlers.\n */\n href: string;\n /**\n * Makes the link unavailable, as Link's `disabled` does: no `href`, `role=\"link\"`,\n * `aria-disabled=\"true\"`, out of the tab order, and the click is cancelled (`onClick` is not\n * called). `aria-disabled=\"true\"` does the same.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element (`<a>`, or `<span>` for the current item). */\n ref?: React.Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\n/**\n * Breadcrumb.Item without `href`: a `<button type=\"button\">` when `onClick` is given (button\n * attributes; `disabled` gives it the disabled look), plain text otherwise. A `rel` is not\n * rendered on either.\n */\nexport interface BreadcrumbItemButtonProps\n extends\n BreadcrumbItemOwnProps,\n NoAnchorOnlyAttributes,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof BreadcrumbItemOwnProps> {\n /** Items without a link have no `href`. */\n href?: undefined;\n /** Ref to the rendered element (`<button>`, or `<span>` for text and the current item). */\n ref?: React.Ref<HTMLButtonElement | HTMLSpanElement>;\n}\n\n/**\n * Properties for the BreadcrumbItem sub-component: link props with `href`, button props without.\n *\n * A union type (0.4 had an interface): an interface cannot extend it, so extend one branch\n * (`interface X extends BreadcrumbItemAnchorProps`) or intersect\n * (`type X = BreadcrumbItemProps & { … }`). `React.ComponentProps<typeof Breadcrumb.Item>`\n * resolves to the last overload, {@link BreadcrumbItemDynamicProps}.\n */\nexport type BreadcrumbItemProps = BreadcrumbItemAnchorProps | BreadcrumbItemButtonProps;\n\n/**\n * Breadcrumb.Item with an `href` known only at run time (`string | undefined`): a link when it is\n * a string, otherwise a button (with `onClick`) or text. Handlers receive `HTMLElement` events and\n * only the attributes all kinds share are accepted (the 0.4 prop shape). Resolved after the button\n * and link signatures.\n */\nexport interface BreadcrumbItemDynamicProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps> {\n /** URL the breadcrumb item links to when defined. */\n href?: string;\n /**\n * Makes a link or button item unavailable (see {@link BreadcrumbItemAnchorProps} and\n * {@link BreadcrumbItemButtonProps}); ignored, with a development warning, on a text or current\n * item.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** The props every item kind shares at runtime (the union narrowed by `href`). */\ntype BreadcrumbEntryProps = BreadcrumbItemOwnProps &\n Omit<React.AllHTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps | 'ref'> & {\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * Links, buttons and `asChild` elements. The hover underline is gated (C-TOKENS), and the\n * disabled look covers a `disabled` button and an `aria-disabled` link.\n */\nconst linkClasses = cn(\n 'inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline',\n focusRing,\n disabledStyles,\n);\nconst currentClasses = 'inline-flex items-center font-semibold text-foreground';\n/** A current `asChild` element is the consumer's link: it takes focus and can be disabled. */\nconst currentChildClasses = cn(currentClasses, focusRing, disabledStyles);\nconst textClasses = 'inline-flex items-center text-foreground';\n\n/**\n * The attributes only a `<button>` or an `<a>` has (`disabled`, `type`, `form*`, `name`, `value`;\n * `target`, `download`, `hrefLang`, `ping`, `media`, `referrerPolicy`). The button props allow\n * `disabled` without `onClick`, and a current item keeps its link attributes, so the `<span>` of\n * the text and current items drops them instead of rendering invalid markup\n * (`<span disabled>`, `<span target=\"_blank\">`). Typed as a record so a key React adds to either\n * element's attributes is a compile error until it is listed here. `rel` is dropped as well: React\n * types it on every element (RDFa), but on a breadcrumb it comes with a link.\n */\ntype ControlOnlyAttribute =\n | Exclude<\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>,\n keyof React.HTMLAttributes<HTMLElement>\n >\n | Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.HTMLAttributes<HTMLElement> | 'href'\n >;\n\nconst controlOnlyAttributes: ReadonlySet<string> = /* @__PURE__ */ new Set([\n 'rel',\n ...Object.keys({\n disabled: true,\n type: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: true,\n formTarget: true,\n name: true,\n value: true,\n target: true,\n download: true,\n hrefLang: true,\n ping: true,\n media: true,\n referrerPolicy: true,\n } satisfies Record<ControlOnlyAttribute, true>),\n]);\n\n/** The props that are valid on the `<span>` of a text or current item. */\nfunction spanAttributes(rest: Record<string, unknown>): React.HTMLAttributes<HTMLSpanElement> {\n const attributes: Record<string, unknown> = {};\n for (const key of Object.keys(rest)) {\n if (!controlOnlyAttributes.has(key)) attributes[key] = rest[key];\n }\n return attributes as React.HTMLAttributes<HTMLSpanElement>;\n}\n\nconst BreadcrumbRoot = ({ children, className, ref, ...rest }: BreadcrumbProps) => {\n // Fragments are opened (`{isAdmin && <>…</>}`), so every crumb gets its own list item and separator.\n const items = flattenChildren(children);\n\n return (\n <nav ref={ref} aria-label=\"Breadcrumb\" {...rest} className={className}>\n <ol className=\"m-0 flex list-none items-center gap-1 p-0 text-body-1\">\n {items.map(({ key, node: child }, index) => (\n <li key={key} className=\"flex items-center gap-1\">\n {index > 0 && (\n <ChevronRightIcon\n data-wave-breadcrumb-separator=\"\"\n className=\"shrink-0 text-muted-foreground wave-rtl:-scale-x-100\"\n />\n )}\n {child}\n </li>\n ))}\n </ol>\n </nav>\n );\n};\nBreadcrumbRoot.displayName = 'Breadcrumb';\n\ninterface BreadcrumbItemChildProps extends React.HTMLAttributes<HTMLElement> {\n /** The item's `href`, a default for the element (the element's own `href` wins). */\n href?: string;\n child: React.ReactElement<{ children?: React.ReactNode }>;\n icon: React.ReactNode;\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * Link's disabled contract for an `asChild` element: an `<a>` drops its `href` (it is still\n * announced as a link); any element gets `aria-disabled`, leaves the tab order and loses its own\n * `onClick`. The item's click handler cancels the click, so a router link does not navigate.\n */\nfunction disableLinkChild(\n child: React.ReactElement<{ children?: React.ReactNode }>,\n): React.ReactElement<{ children?: React.ReactNode }> {\n const anchor = isElementOfType(child, 'a')\n ? { href: undefined, role: 'link', disabled: undefined }\n : undefined;\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ...anchor,\n 'aria-disabled': true,\n tabIndex: -1,\n onClick: undefined,\n }) as React.ReactElement<{ children?: React.ReactNode }>;\n}\n\n/**\n * `asChild` rendering: the item's props are merged onto the consumer's element with\n * `useTriggerElement` (the element's own handlers run first and its classes win conflicts; its\n * ref and the item's ref are both attached). The icon is placed inside the element.\n */\nfunction BreadcrumbItemChild({ child, icon, ...itemProps }: BreadcrumbItemChildProps) {\n const target = icon ? React.cloneElement(child, undefined, icon, child.props.children) : child;\n const node = useTriggerElement(target, itemProps, { componentName: 'Breadcrumb.Item' });\n return <>{node}</>;\n}\n\n/**\n * One step of a breadcrumb trail:\n * - `href` → a link (`<a>`, anchor attributes);\n * - `current` → the current page as text (`<span aria-current=\"page\">`);\n * - no `href` with `onClick` → a `<button type=\"button\">` styled as a link;\n * - no `href` and no `onClick` → plain text (`<span>`; development warning for a non-current item);\n * - `asChild` → the props are merged onto the single child element (router links).\n *\n * Typed by overloads, resolved in order: without `href` (button props, button events), with a\n * string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time\n * ({@link BreadcrumbItemDynamicProps}: `HTMLElement` events).\n *\n * Also exported as `BreadcrumbItem` (import the flat name from React Server Components).\n */\nfunction BreadcrumbItem(props: BreadcrumbItemButtonProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemAnchorProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemDynamicProps): React.ReactElement;\nfunction BreadcrumbItem(\n props: BreadcrumbItemProps | BreadcrumbItemDynamicProps,\n): React.ReactElement {\n const {\n href,\n current = false,\n icon,\n asChild = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n } = props as BreadcrumbEntryProps;\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in Nav,\n // Tree and Avatar, and so is a collection whose items render nothing: no empty span and no stray\n // `me-1` margin. The check does not consume a generator: renderSlot still renders its items.\n const renderedIcon =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', 'me-1 inline-flex shrink-0', { 'aria-hidden': true })\n : null;\n const child =\n asChild && React.isValidElement<{ children?: React.ReactNode }>(children) ? children : null;\n const kind = child\n ? 'child'\n : current\n ? 'current'\n : href !== undefined\n ? 'link'\n : onClick\n ? 'button'\n : 'text';\n\n const invalidAsChild = asChild && child === null;\n const ignoredDisabled = rest.disabled === true && (kind === 'text' || kind === 'current');\n // Link and asChild items follow Link's disabled contract. `<a disabled>` does not block\n // navigation, and an `aria-disabled` link only looks disabled unless the click is cancelled.\n // With asChild the element is the link, so its own `disabled`/`aria-disabled` count too.\n const ariaDisabled = rest['aria-disabled'];\n const childProps = (child?.props ?? {}) as Record<string, unknown>;\n const linkDisabled = [\n rest.disabled,\n ariaDisabled,\n childProps.disabled,\n childProps['aria-disabled'],\n ].some((value) => value === true || value === 'true');\n React.useEffect(() => {\n if (invalidAsChild) {\n warnOnce(\n 'Breadcrumb.Item:asChild',\n 'Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead.',\n );\n }\n if (kind === 'text') {\n warnOnce(\n 'Breadcrumb.Item:no-href',\n 'Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable.',\n );\n }\n if (ignoredDisabled) {\n warnOnce(\n 'Breadcrumb.Item:disabled',\n 'Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.',\n );\n }\n }, [invalidAsChild, kind, ignoredDisabled]);\n\n if (child) {\n const { disabled: _disabled, ...childRest } = rest;\n // Like the other item props, `href` is a default for the element (its own `href` wins). A\n // disabled link has no destination, so it is not passed then.\n const childHref = href !== undefined && !linkDisabled ? { href } : undefined;\n return (\n <BreadcrumbItemChild\n {...(childRest as React.HTMLAttributes<HTMLElement>)}\n {...childHref}\n ref={ref}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n aria-current={current ? 'page' : undefined}\n className={cn(current ? currentChildClasses : linkClasses, className)}\n icon={renderedIcon}\n child={linkDisabled ? disableLinkChild(child) : child}\n />\n );\n }\n\n if (kind === 'current') {\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n aria-current=\"page\"\n onClick={onClick}\n className={cn(currentClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n }\n\n if (kind === 'link') {\n const { disabled: _disabled, ...anchorRest } = rest;\n return (\n <a\n {...(anchorRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={linkDisabled ? undefined : href}\n role={linkDisabled ? 'link' : anchorRest.role}\n aria-disabled={linkDisabled ? true : ariaDisabled}\n tabIndex={linkDisabled ? -1 : anchorRest.tabIndex}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n className={cn(linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </a>\n );\n }\n\n if (kind === 'button') {\n // `rel` only belongs on a link: a button item drops it, like the text and current items.\n const { rel, ...buttonRest } = rest;\n return (\n <button\n type=\"button\"\n {...(buttonRest as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n ref={ref as React.Ref<HTMLButtonElement>}\n onClick={onClick}\n className={cn(linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </button>\n );\n }\n\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(textClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n}\nBreadcrumbItem.displayName = 'BreadcrumbItem';\n\n/**\n * A breadcrumb trail: a `<nav aria-label=\"Breadcrumb\">` landmark with an ordered list. Each child\n * is placed in its own list item (Fragments are opened, so each of their items gets one too); from\n * the second one on, the item begins with a decorative separator chevron that is mirrored in\n * right-to-left layouts.\n *\n * `Breadcrumb.Item` is also exported as `BreadcrumbItem`: React Server Components import the flat\n * name, because dotted access needs a client file.\n *\n * @example\n * <Breadcrumb>\n * <Breadcrumb.Item href=\"/\">Home</Breadcrumb.Item>\n * <Breadcrumb.Item current>Settings</Breadcrumb.Item>\n * </Breadcrumb>\n */\nexport const Breadcrumb = /* @__PURE__ */ Object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,EACR,CAAC"}
1
+ {"version":3,"file":"Breadcrumb.mjs","names":["_Fragment","React","linkClasses","cn","focusRing","disabledStyles","currentClasses","currentChildClasses","textClasses","controlOnlyAttributes","spanAttributes","attributes","key","rest","BreadcrumbRoot","items","flattenChildren","children","breadcrumbClassNames","className","child","index","ChevronRightIcon","disableLinkChild","anchor","isElementOfType","BreadcrumbItemChild","itemProps","target","icon","node","useTriggerElement","Fragment","BreadcrumbItem","props","renderedIcon","slotRendersContent","renderSlot","breadcrumbItemClassNames","asChild","kind","current","href","onClick","invalidAsChild","ignoredDisabled","ariaDisabled","childProps","linkDisabled","value","warnOnce","_disabled","childRest","childHref","preventIfDisabled","anchorRest","buttonRest","Breadcrumb"],"sources":["../../../src/components/navigation/Breadcrumb.tsx"],"sourcesContent":["import * as React from 'react';\nimport { preventIfDisabled } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { breadcrumbClassNames, breadcrumbItemClassNames } from '../../lib/classNames';\nimport type { Slot } from '../../lib/types';\nimport { renderSlot, slotRendersContent } from '../../lib/slot';\nimport { warnOnce } from '../../lib/dev';\nimport { ChevronRightIcon } from '../../lib/icons';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport { useTriggerElement } from '../../hooks/useTriggerElement';\n\n/** Properties for the Breadcrumb component. */\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Breadcrumb items to render; each one is placed in its own list item. Fragments are opened, so\n * the items of a conditional group (`{isAdmin && <>…</>}`) each get their own list item too.\n */\n children: React.ReactNode;\n /** Ref to the `<nav>` element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * The props of Breadcrumb.Item that every branch shares ({@link BreadcrumbItemAnchorProps},\n * {@link BreadcrumbItemButtonProps}, {@link BreadcrumbItemDynamicProps}).\n */\nexport interface BreadcrumbItemOwnProps {\n /**\n * Whether this item represents the current page (`aria-current=\"page\"`, rendered as text).\n * @default false\n */\n current?: boolean;\n /**\n * Slot for an icon displayed before the item text. Rendered with `aria-hidden=\"true\"`. A falsy\n * icon (`''`, `0`) or a list of nothing renders no icon span.\n */\n icon?: Slot<'span'>;\n /**\n * Merge the item's props (classes, `aria-current`, handlers, ref) onto its single child element\n * instead of rendering an element — for router links:\n * `<Breadcrumb.Item asChild><RouterLink to=\"/docs\">Docs</RouterLink></Breadcrumb.Item>`.\n * The icon is rendered inside the child. The item's `href` is passed on as a default (the\n * element's own `href` wins); with a router link, give the link its destination (`to`) instead.\n * `disabled` or `aria-disabled=\"true\"`, on the item or on the element, makes it an unavailable\n * link: `aria-disabled`, out of the tab order, its own `onClick` dropped and the click cancelled\n * (a router link does not navigate); an `<a>` also loses its `href`.\n * @default false\n */\n asChild?: boolean;\n /** Label content of the breadcrumb item (with `asChild`: the link element). */\n children: React.ReactNode;\n}\n\n/**\n * The attributes only a link has (`target`, `download`, `hrefLang`, `ping`, …). Items without\n * `href` declare them as `undefined`, so they are a type error instead of landing on a `<button>`\n * or `<span>`. `rel` cannot be listed (React types it on every element, RDFa); every non-link item\n * drops it at run time instead.\n */\ntype NoAnchorOnlyAttributes = {\n [\n K in Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>\n >\n ]?: undefined;\n};\n\n/** Breadcrumb.Item rendered as a link (`href` given): anchor attributes. */\nexport interface BreadcrumbItemAnchorProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof BreadcrumbItemOwnProps> {\n /**\n * URL the breadcrumb item links to; renders an `<a>` (unless `current`). With `asChild` it is a\n * default for the element, whose own `href` wins. Required in this branch, so `href`\n * discriminates the union and handlers without `href` are typed as button handlers.\n */\n href: string;\n /**\n * Makes the link unavailable, as Link's `disabled` does: no `href`, `role=\"link\"`,\n * `aria-disabled=\"true\"`, out of the tab order, and the click is cancelled (`onClick` is not\n * called). `aria-disabled=\"true\"` does the same.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element (`<a>`, or `<span>` for the current item). */\n ref?: React.Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\n/**\n * Breadcrumb.Item without `href`: a `<button type=\"button\">` when `onClick` is given (button\n * attributes; `disabled` gives it the disabled look), plain text otherwise. A `rel` is not\n * rendered on either.\n */\nexport interface BreadcrumbItemButtonProps\n extends\n BreadcrumbItemOwnProps,\n NoAnchorOnlyAttributes,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof BreadcrumbItemOwnProps> {\n /** Items without a link have no `href`. */\n href?: undefined;\n /** Ref to the rendered element (`<button>`, or `<span>` for text and the current item). */\n ref?: React.Ref<HTMLButtonElement | HTMLSpanElement>;\n}\n\n/**\n * Properties for the BreadcrumbItem sub-component: link props with `href`, button props without.\n *\n * A union type (0.4 had an interface): an interface cannot extend it, so extend one branch\n * (`interface X extends BreadcrumbItemAnchorProps`) or intersect\n * (`type X = BreadcrumbItemProps & { … }`). `React.ComponentProps<typeof Breadcrumb.Item>`\n * resolves to the last overload, {@link BreadcrumbItemDynamicProps}.\n */\nexport type BreadcrumbItemProps = BreadcrumbItemAnchorProps | BreadcrumbItemButtonProps;\n\n/**\n * Breadcrumb.Item with an `href` known only at run time (`string | undefined`): a link when it is\n * a string, otherwise a button (with `onClick`) or text. Handlers receive `HTMLElement` events and\n * only the attributes all kinds share are accepted (the 0.4 prop shape). Resolved after the button\n * and link signatures.\n */\nexport interface BreadcrumbItemDynamicProps\n extends\n BreadcrumbItemOwnProps,\n Omit<React.HTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps> {\n /** URL the breadcrumb item links to when defined. */\n href?: string;\n /**\n * Makes a link or button item unavailable (see {@link BreadcrumbItemAnchorProps} and\n * {@link BreadcrumbItemButtonProps}); ignored, with a development warning, on a text or current\n * item.\n * @default false\n */\n disabled?: boolean;\n /** Ref to the rendered element. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** The props every item kind shares at runtime (the union narrowed by `href`). */\ntype BreadcrumbEntryProps = BreadcrumbItemOwnProps &\n Omit<React.AllHTMLAttributes<HTMLElement>, keyof BreadcrumbItemOwnProps | 'ref'> & {\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * Links, buttons and `asChild` elements. The hover underline is gated (C-TOKENS), and the\n * disabled look covers a `disabled` button and an `aria-disabled` link.\n */\nconst linkClasses = cn(\n 'inline-flex cursor-pointer items-center text-primary no-underline not-disabled:not-aria-disabled:hover:underline',\n focusRing,\n disabledStyles,\n);\nconst currentClasses = 'inline-flex items-center font-semibold text-foreground';\n/** A current `asChild` element is the consumer's link: it takes focus and can be disabled. */\nconst currentChildClasses = cn(currentClasses, focusRing, disabledStyles);\nconst textClasses = 'inline-flex items-center text-foreground';\n\n/**\n * The attributes only a `<button>` or an `<a>` has (`disabled`, `type`, `form*`, `name`, `value`;\n * `target`, `download`, `hrefLang`, `ping`, `media`, `referrerPolicy`). The button props allow\n * `disabled` without `onClick`, and a current item keeps its link attributes, so the `<span>` of\n * the text and current items drops them instead of rendering invalid markup\n * (`<span disabled>`, `<span target=\"_blank\">`). Typed as a record so a key React adds to either\n * element's attributes is a compile error until it is listed here. `rel` is dropped as well: React\n * types it on every element (RDFa), but on a breadcrumb it comes with a link.\n */\ntype ControlOnlyAttribute =\n | Exclude<\n keyof React.ButtonHTMLAttributes<HTMLButtonElement>,\n keyof React.HTMLAttributes<HTMLElement>\n >\n | Exclude<\n keyof React.AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof React.HTMLAttributes<HTMLElement> | 'href'\n >;\n\nconst controlOnlyAttributes: ReadonlySet<string> = /* @__PURE__ */ new Set([\n 'rel',\n ...Object.keys({\n disabled: true,\n type: true,\n form: true,\n formAction: true,\n formEncType: true,\n formMethod: true,\n formNoValidate: true,\n formTarget: true,\n name: true,\n value: true,\n target: true,\n download: true,\n hrefLang: true,\n ping: true,\n media: true,\n referrerPolicy: true,\n } satisfies Record<ControlOnlyAttribute, true>),\n]);\n\n/** The props that are valid on the `<span>` of a text or current item. */\nfunction spanAttributes(rest: Record<string, unknown>): React.HTMLAttributes<HTMLSpanElement> {\n const attributes: Record<string, unknown> = {};\n for (const key of Object.keys(rest)) {\n if (!controlOnlyAttributes.has(key)) attributes[key] = rest[key];\n }\n return attributes as React.HTMLAttributes<HTMLSpanElement>;\n}\n\nconst BreadcrumbRoot = ({ children, className, ref, ...rest }: BreadcrumbProps) => {\n // Fragments are opened (`{isAdmin && <>…</>}`), so every crumb gets its own list item and separator.\n const items = flattenChildren(children);\n\n return (\n <nav\n ref={ref}\n aria-label=\"Breadcrumb\"\n {...rest}\n className={cn(breadcrumbClassNames.root, className)}\n >\n <ol\n className={cn(\n breadcrumbClassNames.list,\n 'm-0 flex list-none items-center gap-1 p-0 text-body-1',\n )}\n >\n {items.map(({ key, node: child }, index) => (\n <li key={key} className={cn(breadcrumbClassNames.listItem, 'flex items-center gap-1')}>\n {index > 0 && (\n <ChevronRightIcon\n data-wave-breadcrumb-separator=\"\"\n className={cn(\n breadcrumbClassNames.divider,\n 'shrink-0 text-muted-foreground wave-rtl:-scale-x-100',\n )}\n />\n )}\n {child}\n </li>\n ))}\n </ol>\n </nav>\n );\n};\nBreadcrumbRoot.displayName = 'Breadcrumb';\n\ninterface BreadcrumbItemChildProps extends React.HTMLAttributes<HTMLElement> {\n /** The item's `href`, a default for the element (the element's own `href` wins). */\n href?: string;\n child: React.ReactElement<{ children?: React.ReactNode }>;\n icon: React.ReactNode;\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * Link's disabled contract for an `asChild` element: an `<a>` drops its `href` (it is still\n * announced as a link); any element gets `aria-disabled`, leaves the tab order and loses its own\n * `onClick`. The item's click handler cancels the click, so a router link does not navigate.\n */\nfunction disableLinkChild(\n child: React.ReactElement<{ children?: React.ReactNode }>,\n): React.ReactElement<{ children?: React.ReactNode }> {\n const anchor = isElementOfType(child, 'a')\n ? { href: undefined, role: 'link', disabled: undefined }\n : undefined;\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ...anchor,\n 'aria-disabled': true,\n tabIndex: -1,\n onClick: undefined,\n }) as React.ReactElement<{ children?: React.ReactNode }>;\n}\n\n/**\n * `asChild` rendering: the item's props are merged onto the consumer's element with\n * `useTriggerElement` (the element's own handlers run first and its classes win conflicts; its\n * ref and the item's ref are both attached). The icon is placed inside the element.\n */\nfunction BreadcrumbItemChild({ child, icon, ...itemProps }: BreadcrumbItemChildProps) {\n const target = icon ? React.cloneElement(child, undefined, icon, child.props.children) : child;\n const node = useTriggerElement(target, itemProps, { componentName: 'Breadcrumb.Item' });\n return <>{node}</>;\n}\n\n/**\n * One step of a breadcrumb trail:\n * - `href` → a link (`<a>`, anchor attributes);\n * - `current` → the current page as text (`<span aria-current=\"page\">`);\n * - no `href` with `onClick` → a `<button type=\"button\">` styled as a link;\n * - no `href` and no `onClick` → plain text (`<span>`; development warning for a non-current item);\n * - `asChild` → the props are merged onto the single child element (router links).\n *\n * Typed by overloads, resolved in order: without `href` (button props, button events), with a\n * string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time\n * ({@link BreadcrumbItemDynamicProps}: `HTMLElement` events).\n *\n * Also exported as `BreadcrumbItem` (import the flat name from React Server Components).\n */\nfunction BreadcrumbItem(props: BreadcrumbItemButtonProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemAnchorProps): React.ReactElement;\nfunction BreadcrumbItem(props: BreadcrumbItemDynamicProps): React.ReactElement;\nfunction BreadcrumbItem(\n props: BreadcrumbItemProps | BreadcrumbItemDynamicProps,\n): React.ReactElement {\n const {\n href,\n current = false,\n icon,\n asChild = false,\n children,\n className,\n onClick,\n ref,\n ...rest\n } = props as BreadcrumbEntryProps;\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in Nav,\n // Tree and Avatar, and so is a collection whose items render nothing: no empty span and no stray\n // `me-1` margin. The check does not consume a generator: renderSlot still renders its items.\n const renderedIcon =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(breadcrumbItemClassNames.icon, 'me-1 inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n const child =\n asChild && React.isValidElement<{ children?: React.ReactNode }>(children) ? children : null;\n const kind = child\n ? 'child'\n : current\n ? 'current'\n : href !== undefined\n ? 'link'\n : onClick\n ? 'button'\n : 'text';\n\n const invalidAsChild = asChild && child === null;\n const ignoredDisabled = rest.disabled === true && (kind === 'text' || kind === 'current');\n // Link and asChild items follow Link's disabled contract. `<a disabled>` does not block\n // navigation, and an `aria-disabled` link only looks disabled unless the click is cancelled.\n // With asChild the element is the link, so its own `disabled`/`aria-disabled` count too.\n const ariaDisabled = rest['aria-disabled'];\n const childProps = (child?.props ?? {}) as Record<string, unknown>;\n const linkDisabled = [\n rest.disabled,\n ariaDisabled,\n childProps.disabled,\n childProps['aria-disabled'],\n ].some((value) => value === true || value === 'true');\n React.useEffect(() => {\n if (invalidAsChild) {\n warnOnce(\n 'Breadcrumb.Item:asChild',\n 'Breadcrumb.Item: `asChild` expects a single element child (e.g. a router link); the item was rendered normally instead.',\n );\n }\n if (kind === 'text') {\n warnOnce(\n 'Breadcrumb.Item:no-href',\n 'Breadcrumb.Item: a non-current item without `href` or `onClick` renders as plain text, not a link. Pass `href` (or `onClick`, which renders a button) to make it navigable.',\n );\n }\n if (ignoredDisabled) {\n warnOnce(\n 'Breadcrumb.Item:disabled',\n 'Breadcrumb.Item: `disabled` applies to link, button and asChild items; it is ignored on a text or current item.',\n );\n }\n }, [invalidAsChild, kind, ignoredDisabled]);\n\n if (child) {\n const { disabled: _disabled, ...childRest } = rest;\n // Like the other item props, `href` is a default for the element (its own `href` wins). A\n // disabled link has no destination, so it is not passed then.\n const childHref = href !== undefined && !linkDisabled ? { href } : undefined;\n return (\n <BreadcrumbItemChild\n {...(childRest as React.HTMLAttributes<HTMLElement>)}\n {...childHref}\n ref={ref}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n aria-current={current ? 'page' : undefined}\n className={cn(\n breadcrumbItemClassNames.root,\n current ? currentChildClasses : linkClasses,\n className,\n )}\n icon={renderedIcon}\n child={linkDisabled ? disableLinkChild(child) : child}\n />\n );\n }\n\n if (kind === 'current') {\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n aria-current=\"page\"\n onClick={onClick}\n className={cn(breadcrumbItemClassNames.root, currentClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n }\n\n if (kind === 'link') {\n const { disabled: _disabled, ...anchorRest } = rest;\n return (\n <a\n {...(anchorRest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={linkDisabled ? undefined : href}\n role={linkDisabled ? 'link' : anchorRest.role}\n aria-disabled={linkDisabled ? true : ariaDisabled}\n tabIndex={linkDisabled ? -1 : anchorRest.tabIndex}\n onClick={preventIfDisabled(linkDisabled, onClick)}\n className={cn(breadcrumbItemClassNames.root, linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </a>\n );\n }\n\n if (kind === 'button') {\n // `rel` only belongs on a link: a button item drops it, like the text and current items.\n const { rel, ...buttonRest } = rest;\n return (\n <button\n type=\"button\"\n {...(buttonRest as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n ref={ref as React.Ref<HTMLButtonElement>}\n onClick={onClick}\n className={cn(breadcrumbItemClassNames.root, linkClasses, className)}\n >\n {renderedIcon}\n {children}\n </button>\n );\n }\n\n return (\n <span\n {...spanAttributes(rest)}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(breadcrumbItemClassNames.root, textClasses, className)}\n >\n {renderedIcon}\n {children}\n </span>\n );\n}\nBreadcrumbItem.displayName = 'BreadcrumbItem';\n\n/**\n * A breadcrumb trail: a `<nav aria-label=\"Breadcrumb\">` landmark with an ordered list. Each child\n * is placed in its own list item (Fragments are opened, so each of their items gets one too); from\n * the second one on, the item begins with a decorative separator chevron that is mirrored in\n * right-to-left layouts.\n *\n * `Breadcrumb.Item` is also exported as `BreadcrumbItem`: React Server Components import the flat\n * name, because dotted access needs a client file.\n *\n * @example\n * <Breadcrumb>\n * <Breadcrumb.Item href=\"/\">Home</Breadcrumb.Item>\n * <Breadcrumb.Item current>Settings</Breadcrumb.Item>\n * </Breadcrumb>\n */\nexport const Breadcrumb = /* @__PURE__ */ Object.assign(BreadcrumbRoot, {\n Item: BreadcrumbItem,\n});\n\nexport { BreadcrumbItem };\n"],"mappings":";;;;;;;;;;;;;AAsJA,IAAME,IAAcC,EAClB,oHACAC,GACAC,CACF,GACMC,IAAiB,0DAEjBC,IAAsBJ,EAAGG,GAAgBF,GAAWC,CAAc,GAClEG,IAAc,4CAqBdC,oBAA6D,IAAI,IAAI,CACzE,OACA,GAAG,OAAO,KAAK;CACb,UAAU;CACV,MAAM;CACN,MAAM;CACN,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,MAAM;CACN,OAAO;CACP,QAAQ;CACR,UAAU;CACV,UAAU;CACV,MAAM;CACN,OAAO;CACP,gBAAgB;AAClB,CAA8C,CAChD,CAAC;AAGD,SAASC,EAAe,GAAsE;CAC5F,IAAMC,IAAsC,CAAC;CAC7C,KAAK,IAAMC,KAAO,OAAO,KAAKC,CAAI,GAChC,AAAKJ,EAAsB,IAAIG,CAAG,MAAG,EAAWA,KAAOC,EAAKD;CAE9D,OAAOD;AACT;AAEA,IAAMG,KAAkB,EAAE,aAAU,cAAW,QAAK,GAAGD,QAA4B;CAEjF,IAAME,IAAQC,EAAgBC,CAAQ;CAEtC,OACE,kBAAC,OAAD;EACO;EACL,cAAW;EACX,GAAIJ;EACJ,WAAWV,EAAGe,EAAqB,MAAMC,CAAS;EAElD,UAAA,kBAAC,MAAD;GACE,WAAWhB,EACTe,EAAqB,MACrB,uDACF;GAEC,UAAAH,EAAM,KAAK,EAAE,QAAK,MAAMK,KAAS,MAChC,kBAAC,MAAD;IAAc,WAAWjB,EAAGe,EAAqB,U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CAEP;CAEA,IAAIuB,MAAS,UAAU;EAErB,IAAM,EAAE,QAAK,GAAGgB,MAAe3C;EAC/B,OACE,kBAAC,UAAD;GACE,MAAK;GACL,GAAK2C;GACA;GACI;GACT,WAAWrD,EAAGmC,EAAyB,MAAMpC,GAAaiB,CAAS;GALrE,UAAA,CAOGgB,GACAlB,CACK;;CAEZ;CAEA,OACE,kBAAC,QAAD;EACE,GAAIP,EAAeG,CAAI;EAClB;EACL,WAAWV,EAAGmC,EAAyB,MAAM9B,GAAaW,CAAS;EAHrE,UAAA,CAKGgB,GACAlB,CACG;;AAEV;AACA,EAAe,cAAc;AAiB7B,IAAawC,IAA6B,uBAAO,OAAO3C,GAAgB,EACtE,MAAMmB,EACR,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../hooks/useId.cjs"),a=require("./Menu.items.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=o.createContext(null);c.displayName=`MenuGroupContext`;var l={headerId:``,headerProps:void 0,labelled:!0};function u(e){return o.useContext(c)||(r.reportMissingContext(e,`Menu.Group`),l)}var d=({children:e,ref:t,...r})=>{let a=i.useId(`menu-group-header`),l=n.flattenChildren(e).find(({node:e})=>n.isElementOfType(e,f))?.node,u=l?.props,d=u?.id||a,p=r[`aria-label`]!==void 0||r[`aria-labelledby`]!==void 0,m=l!==void 0||p,h=p?r[`aria-labelledby`]:l===void 0?void 0:d,g=o.useMemo(()=>({headerId:d,headerProps:u,labelled:m}),[d,u,m]);return(0,s.jsx)(c.Provider,{value:g,children:(0,s.jsx)(`div`,{role:`group`,...r,ref:t,"aria-labelledby":h,children:e})})};d.displayName=`MenuGroup`;var f=e=>{let{id:n,className:i,children:c,ref:l,...d}=e,f=u(`Menu.GroupHeader`),p=f.headerProps===e,m=null;return!p&&f.headerProps!==void 0?m=`extra-header`:!p&&!f.labelled&&(m=`unlabelled`),o.useEffect(()=>{m===`unlabelled`?r.warnOnce(`Menu.GroupHeader:unlabelled`,`Menu.GroupHeader: this header is not a direct child of Menu.Group (or of a Fragment in it), so it does not label the group. Make it a direct child, or pass aria-label to Menu.Group.`):m===`extra-header`&&r.warnOnce(`Menu.GroupHeader:extra-header`,`Menu.GroupHeader: this Menu.Group already has a header (its first direct child header), so this one does not label the group. Give a group one header, or put this one in a Menu.Group of its own.`)},[m]),(0,s.jsxs)(`div`,{...d,ref:l,id:(p?f.headerId:n)||void 0,className:t.cn(`flex items-center gap-2 px-3 pb-1 pt-2 text-caption-1 font-semibold text-muted-foreground`,i),children:[(0,s.jsx)(a.MenuColumnSpacers,{}),c]})};f.displayName=`MenuGroupHeader`,exports.MenuGroup=d,exports.MenuGroupHeader=f;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/children.cjs"),r=require("../../lib/dev.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useId.cjs"),o=require("./Menu.items.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=s.createContext(null);l.displayName=`MenuGroupContext`;var u={headerId:``,headerProps:void 0,labelled:!0};function d(e){return s.useContext(l)||(r.reportMissingContext(e,`Menu.Group`),u)}var f=({children:e,className:r,ref:o,...u})=>{let d=a.useId(`menu-group-header`),f=n.flattenChildren(e).find(({node:e})=>n.isElementOfType(e,p))?.node,m=f?.props,h=m?.id||d,g=u[`aria-label`]!==void 0||u[`aria-labelledby`]!==void 0,_=f!==void 0||g,v=g?u[`aria-labelledby`]:f===void 0?void 0:h,y=s.useMemo(()=>({headerId:h,headerProps:m,labelled:_}),[h,m,_]);return(0,c.jsx)(l.Provider,{value:y,children:(0,c.jsx)(`div`,{role:`group`,...u,ref:o,"aria-labelledby":v,className:t.cn(i.menuGroupClassNames.root,r),children:e})})};f.displayName=`MenuGroup`;var p=e=>{let{id:n,className:a,children:l,ref:u,...f}=e,p=d(`Menu.GroupHeader`),m=p.headerProps===e,h=null;return!m&&p.headerProps!==void 0?h=`extra-header`:!m&&!p.labelled&&(h=`unlabelled`),s.useEffect(()=>{h===`unlabelled`?r.warnOnce(`Menu.GroupHeader:unlabelled`,`Menu.GroupHeader: this header is not a direct child of Menu.Group (or of a Fragment in it), so it does not label the group. Make it a direct child, or pass aria-label to Menu.Group.`):h===`extra-header`&&r.warnOnce(`Menu.GroupHeader:extra-header`,`Menu.GroupHeader: this Menu.Group already has a header (its first direct child header), so this one does not label the group. Give a group one header, or put this one in a Menu.Group of its own.`)},[h]),(0,c.jsxs)(`div`,{...f,ref:u,id:(m?p.headerId:n)||void 0,className:t.cn(i.menuGroupHeaderClassNames.root,`flex items-center gap-2 px-3 pb-1 pt-2 text-caption-1 font-semibold text-muted-foreground`,a),children:[(0,c.jsx)(o.MenuColumnSpacers,{}),l]})};p.displayName=`MenuGroupHeader`,exports.MenuGroup=f,exports.MenuGroupHeader=p;
2
2
  //# sourceMappingURL=Menu.group.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.group.cjs","names":["React","useId","flattenChildren","isElementOfType","cn","MenuColumnSpacers","require_runtime","require_cn","require_children","require_dev","require_useId","require_Menu_items","react","react_jsx_runtime","MenuGroupContext","INERT_GROUP_CONTEXT","useMenuGroupContext","componentName","MenuGroup","rest","generatedId","header","children","node","MenuGroupHeader","headerProps","headerId","ownName","labelled","labelledBy","context","props","group","scanned","problem","id","className"],"sources":["../../../src/components/navigation/Menu.group.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { useId } from '../../hooks/useId';\nimport { MenuColumnSpacers } from './Menu.items';\n\n/** Properties for the MenuGroup sub-component. */\nexport interface MenuGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the `role=\"group\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the MenuGroupHeader sub-component. */\nexport interface MenuGroupHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the header element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface MenuGroupContextValue {\n /** The id the group's header renders (its own `id`, else a generated one). */\n headerId: string;\n /**\n * The props object of the header the group's scan found (the first one among its direct\n * children or Fragments), or `undefined`. React renders an element with that same object, so\n * the header whose props are these is the scanned one: only it renders `headerId`.\n */\n headerProps: MenuGroupHeaderProps | undefined;\n /**\n * Whether the group has a name: a header among its direct children (or Fragments), or the\n * consumer's `aria-label`/`aria-labelledby`. A header the scan did not find, in a group whose\n * scan found none, warns only without.\n */\n labelled: boolean;\n}\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | null>(null);\nMenuGroupContext.displayName = 'MenuGroupContext';\n\n/** What a misplaced header renders with in production (C-CONTEXT): its own id only, no warning. */\nconst INERT_GROUP_CONTEXT: MenuGroupContextValue = {\n headerId: '',\n headerProps: undefined,\n labelled: true,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useMenuGroupContext(componentName: string): MenuGroupContextValue {\n const context = React.useContext(MenuGroupContext);\n if (context) return context;\n reportMissingContext(componentName, 'Menu.Group');\n return INERT_GROUP_CONTEXT;\n}\n\n/**\n * A labelled group of menu items (`role=\"group\"`), for example the radio items of one choice.\n * Labelled by its `Menu.GroupHeader` when the header is a direct child (or inside a Fragment; a\n * header written in a Server Component counts too); a header nested deeper does not label it\n * (development warning). Pass `aria-label` for a group without a visible header; a consumer\n * `aria-label` or `aria-labelledby` wins over the header (one that holds `undefined` does not).\n * Give a group one header: only the first header among its direct children labels it, and any\n * other header renders only its own `id` (development warning). The group changes nothing about\n * the keyboard: its items stay items of the menu. Separate groups with `Menu.Divider`.\n *\n * Also exported as `MenuGroup` (import the flat name from React Server Components).\n */\nexport const MenuGroup = ({ children, ref, ...rest }: MenuGroupProps) => {\n const generatedId = useId('menu-group-header');\n // A static scan, so the reference is in the server HTML and never points at a missing id.\n const header = flattenChildren(children).find(({ node }) =>\n isElementOfType<MenuGroupHeaderProps>(node, MenuGroupHeader),\n )?.node as React.ReactElement<MenuGroupHeaderProps> | undefined;\n const headerProps = header?.props;\n const headerId = headerProps?.id || generatedId;\n // A prop that holds `undefined` (a wrapper forwarding it) is no name of the consumer's.\n const ownName = rest['aria-label'] !== undefined || rest['aria-labelledby'] !== undefined;\n const labelled = header !== undefined || ownName;\n // Written after the spread, so a forwarded `aria-labelledby={undefined}` cannot remove it.\n const labelledBy = ownName\n ? rest['aria-labelledby']\n : header !== undefined\n ? headerId\n : undefined;\n\n const context = React.useMemo<MenuGroupContextValue>(\n () => ({ headerId, headerProps, labelled }),\n [headerId, headerProps, labelled],\n );\n\n return (\n <MenuGroupContext.Provider value={context}>\n <div role=\"group\" {...rest} ref={ref} aria-labelledby={labelledBy}>\n {children}\n </div>\n </MenuGroupContext.Provider>\n );\n};\nMenuGroup.displayName = 'MenuGroup';\n\n/**\n * The visible heading of a `Menu.Group`. It is not a menu item: arrow keys and typeahead skip it.\n * Its text lines up with the item labels (it keeps the menu's check and icon columns). It labels\n * the group when it is the group's first header among its direct children (or inside a Fragment\n * there); any other header labels nothing and renders only its own `id` (development warning).\n * Must be used inside `Menu.Group`.\n *\n * Also exported as `MenuGroupHeader` (import the flat name from React Server Components).\n */\nexport const MenuGroupHeader = (props: MenuGroupHeaderProps) => {\n const { id, className, children, ref, ...rest } = props;\n const group = useMenuGroupContext('Menu.GroupHeader');\n\n // The header the group's scan found is the one rendered with the scanned element's props object.\n // Only it renders the id the group points at: any other header (inside a custom component or an\n // element, or a second one) keeps only its own id, so no two headers share one. This relies on\n // React passing an element's own props object to its component (the client, Fizz, a lazy client\n // reference and `Children.toArray` clones all do in React 19, though React does not document it).\n // If a React upgrade breaks it, the scanned header loses its id: Menu.group.test.tsx's \"the header\n // its scan found keeps labelling the group in StrictMode, after a re-render and as a Server\n // Component reference\" and the server-HTML dangling-reference test fail.\n const scanned = group.headerProps === props;\n // C-DEV: any other header labels nothing and warns, except in a group that has no header its\n // scan found and is named by the consumer's label (that label is the unlabelled warning's remedy).\n let problem: 'unlabelled' | 'extra-header' | null = null;\n if (!scanned && group.headerProps !== undefined) problem = 'extra-header';\n else if (!scanned && !group.labelled) problem = 'unlabelled';\n React.useEffect(() => {\n if (problem === 'unlabelled') {\n warnOnce(\n 'Menu.GroupHeader:unlabelled',\n 'Menu.GroupHeader: this header is not a direct child of Menu.Group (or of a Fragment in it), so it does not label the group. Make it a direct child, or pass aria-label to Menu.Group.',\n );\n } else if (problem === 'extra-header') {\n warnOnce(\n 'Menu.GroupHeader:extra-header',\n 'Menu.GroupHeader: this Menu.Group already has a header (its first direct child header), so this one does not label the group. Give a group one header, or put this one in a Menu.Group of its own.',\n );\n }\n }, [problem]);\n\n return (\n <div\n {...rest}\n ref={ref}\n id={(scanned ? group.headerId : id) || undefined}\n className={cn(\n 'flex items-center gap-2 px-3 pb-1 pt-2 text-caption-1 font-semibold text-muted-foreground',\n className,\n )}\n >\n <MenuColumnSpacers />\n {children}\n </div>\n );\n};\nMenuGroupHeader.displayName = 'MenuGroupHeader';\n"],"mappings":"kTAoCA,IAAMc,EAAmBd,EAAM,cAA4C,IAAI,EAC/E,EAAiB,YAAc,mBAG/B,IAAMe,EAA6C,CACjD,SAAU,GACV,YAAa,IAAA,GACb,SAAU,EACZ,EAGA,SAASC,EAAoB,EAA8C,CAIzE,OAHgBhB,EAAM,WAAWc,CAC7B,IACJL,EAAA,qBAAqBQ,EAAe,YAAY,EACzCF,EACT,CAcA,IAAaG,GAAa,CAAE,WAAU,MAAK,GAAGC,KAA2B,CACvE,IAAMC,EAAcnB,EAAAA,MAAM,mBAAmB,EAEvCoB,EAASnB,EAAAA,gBAAgBoB,CAAQ,CAAC,CAAC,MAAM,CAAE,UAC/CnB,EAAAA,gBAAsCoB,EAAMC,CAAe,CAC7D,CAAC,EAAE,KACGC,EAAcJ,GAAQ,MACtBK,EAAWD,GAAa,IAAML,EAE9BO,EAAUR,EAAK,gBAAkB,IAAA,IAAaA,EAAK,qBAAuB,IAAA,GAC1ES,EAAWP,IAAW,IAAA,IAAaM,EAEnCE,EAAaF,EACfR,EAAK,mBACLE,IAAW,IAAA,GAET,IAAA,GADAK,EAGAI,EAAU9B,EAAM,aACb,CAAE,WAAU,cAAa,UAAS,GACzC,CAAC0B,EAAUD,EAAaG,CAAQ,CAClC,EAEA,OACE,EAAAf,EAAA,IAAA,CAACC,EAAiB,SAAlB,CAA2B,MAAOgB,EAChC,UAAA,EAAAjB,EAAA,IAAA,CAAC,MAAD,CAAK,KAAK,QAAQ,GAAIM,EAAW,MAAK,kBAAiBU,EACpD,UACE,CAAA,CACoB,CAAA,CAE/B,EACA,EAAU,YAAc,YAWxB,IAAaL,EAAmB,GAAgC,CAC9D,GAAM,CAAE,KAAI,YAAW,WAAU,MAAK,GAAGL,GAASY,EAC5CC,EAAQhB,EAAoB,kBAAkB,EAU9CiB,EAAUD,EAAM,cAAgBD,EAGlCG,EAAgD,KAiBpD,MAhBI,CAACD,GAAWD,EAAM,cAAgB,IAAA,GAAW,EAAU,eAClD,CAACC,GAAW,CAACD,EAAM,WAAU,EAAU,cAChDpB,EAAM,cAAgB,CAChBsB,IAAY,aACdzB,EAAA,SACE,8BACA,uLACF,EACSyB,IAAY,gBACrBzB,EAAA,SACE,gCACA,oMACF,CAEJ,EAAG,CAACyB,CAAO,CAAC,GAGV,EAAArB,EAAA,KAAA,CAAC,MAAD,CACE,GAAIM,EACC,MACL,IAAKc,EAAUD,EAAM,SAAWG,IAAO,IAAA,GACvC,UAAW/B,EAAAA,GACT,4FACAgC,CACF,EAPF,SAAA,EASE,EAAAvB,EAAA,IAAA,CAACR,EAAAA,kBAAD,CAAoB,CAAA,EACnBiB,CACE,GAET,EACA,EAAgB,YAAc"}
1
+ {"version":3,"file":"Menu.group.cjs","names":["React","useId","flattenChildren","isElementOfType","cn","menuGroupClassNames","menuGroupHeaderClassNames","MenuColumnSpacers","require_runtime","require_cn","require_children","require_dev","require_classNames","require_useId","require_Menu_items","react","react_jsx_runtime","MenuGroupContext","INERT_GROUP_CONTEXT","useMenuGroupContext","componentName","MenuGroup","rest","generatedId","header","children","node","MenuGroupHeader","headerProps","headerId","ownName","labelled","labelledBy","context","className","props","group","scanned","problem","id"],"sources":["../../../src/components/navigation/Menu.group.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { menuGroupClassNames, menuGroupHeaderClassNames } from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { useId } from '../../hooks/useId';\nimport { MenuColumnSpacers } from './Menu.items';\n\n/** Properties for the MenuGroup sub-component. */\nexport interface MenuGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the `role=\"group\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the MenuGroupHeader sub-component. */\nexport interface MenuGroupHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the header element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\ninterface MenuGroupContextValue {\n /** The id the group's header renders (its own `id`, else a generated one). */\n headerId: string;\n /**\n * The props object of the header the group's scan found (the first one among its direct\n * children or Fragments), or `undefined`. React renders an element with that same object, so\n * the header whose props are these is the scanned one: only it renders `headerId`.\n */\n headerProps: MenuGroupHeaderProps | undefined;\n /**\n * Whether the group has a name: a header among its direct children (or Fragments), or the\n * consumer's `aria-label`/`aria-labelledby`. A header the scan did not find, in a group whose\n * scan found none, warns only without.\n */\n labelled: boolean;\n}\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | null>(null);\nMenuGroupContext.displayName = 'MenuGroupContext';\n\n/** What a misplaced header renders with in production (C-CONTEXT): its own id only, no warning. */\nconst INERT_GROUP_CONTEXT: MenuGroupContextValue = {\n headerId: '',\n headerProps: undefined,\n labelled: true,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useMenuGroupContext(componentName: string): MenuGroupContextValue {\n const context = React.useContext(MenuGroupContext);\n if (context) return context;\n reportMissingContext(componentName, 'Menu.Group');\n return INERT_GROUP_CONTEXT;\n}\n\n/**\n * A labelled group of menu items (`role=\"group\"`), for example the radio items of one choice.\n * Labelled by its `Menu.GroupHeader` when the header is a direct child (or inside a Fragment; a\n * header written in a Server Component counts too); a header nested deeper does not label it\n * (development warning). Pass `aria-label` for a group without a visible header; a consumer\n * `aria-label` or `aria-labelledby` wins over the header (one that holds `undefined` does not).\n * Give a group one header: only the first header among its direct children labels it, and any\n * other header renders only its own `id` (development warning). The group changes nothing about\n * the keyboard: its items stay items of the menu. Separate groups with `Menu.Divider`.\n *\n * Also exported as `MenuGroup` (import the flat name from React Server Components).\n */\nexport const MenuGroup = ({ children, className, ref, ...rest }: MenuGroupProps) => {\n const generatedId = useId('menu-group-header');\n // A static scan, so the reference is in the server HTML and never points at a missing id.\n const header = flattenChildren(children).find(({ node }) =>\n isElementOfType<MenuGroupHeaderProps>(node, MenuGroupHeader),\n )?.node as React.ReactElement<MenuGroupHeaderProps> | undefined;\n const headerProps = header?.props;\n const headerId = headerProps?.id || generatedId;\n // A prop that holds `undefined` (a wrapper forwarding it) is no name of the consumer's.\n const ownName = rest['aria-label'] !== undefined || rest['aria-labelledby'] !== undefined;\n const labelled = header !== undefined || ownName;\n // Written after the spread, so a forwarded `aria-labelledby={undefined}` cannot remove it.\n const labelledBy = ownName\n ? rest['aria-labelledby']\n : header !== undefined\n ? headerId\n : undefined;\n\n const context = React.useMemo<MenuGroupContextValue>(\n () => ({ headerId, headerProps, labelled }),\n [headerId, headerProps, labelled],\n );\n\n return (\n <MenuGroupContext.Provider value={context}>\n <div\n role=\"group\"\n {...rest}\n ref={ref}\n aria-labelledby={labelledBy}\n className={cn(menuGroupClassNames.root, className)}\n >\n {children}\n </div>\n </MenuGroupContext.Provider>\n );\n};\nMenuGroup.displayName = 'MenuGroup';\n\n/**\n * The visible heading of a `Menu.Group`. It is not a menu item: arrow keys and typeahead skip it.\n * Its text lines up with the item labels (it keeps the menu's check and icon columns). It labels\n * the group when it is the group's first header among its direct children (or inside a Fragment\n * there); any other header labels nothing and renders only its own `id` (development warning).\n * Must be used inside `Menu.Group`.\n *\n * Also exported as `MenuGroupHeader` (import the flat name from React Server Components).\n */\nexport const MenuGroupHeader = (props: MenuGroupHeaderProps) => {\n const { id, className, children, ref, ...rest } = props;\n const group = useMenuGroupContext('Menu.GroupHeader');\n\n // The header the group's scan found is the one rendered with the scanned element's props object.\n // Only it renders the id the group points at: any other header (inside a custom component or an\n // element, or a second one) keeps only its own id, so no two headers share one. This relies on\n // React passing an element's own props object to its component (the client, Fizz, a lazy client\n // reference and `Children.toArray` clones all do in React 19, though React does not document it).\n // If a React upgrade breaks it, the scanned header loses its id: Menu.group.test.tsx's \"the header\n // its scan found keeps labelling the group in StrictMode, after a re-render and as a Server\n // Component reference\" and the server-HTML dangling-reference test fail.\n const scanned = group.headerProps === props;\n // C-DEV: any other header labels nothing and warns, except in a group that has no header its\n // scan found and is named by the consumer's label (that label is the unlabelled warning's remedy).\n let problem: 'unlabelled' | 'extra-header' | null = null;\n if (!scanned && group.headerProps !== undefined) problem = 'extra-header';\n else if (!scanned && !group.labelled) problem = 'unlabelled';\n React.useEffect(() => {\n if (problem === 'unlabelled') {\n warnOnce(\n 'Menu.GroupHeader:unlabelled',\n 'Menu.GroupHeader: this header is not a direct child of Menu.Group (or of a Fragment in it), so it does not label the group. Make it a direct child, or pass aria-label to Menu.Group.',\n );\n } else if (problem === 'extra-header') {\n warnOnce(\n 'Menu.GroupHeader:extra-header',\n 'Menu.GroupHeader: this Menu.Group already has a header (its first direct child header), so this one does not label the group. Give a group one header, or put this one in a Menu.Group of its own.',\n );\n }\n }, [problem]);\n\n return (\n <div\n {...rest}\n ref={ref}\n id={(scanned ? group.headerId : id) || undefined}\n className={cn(\n menuGroupHeaderClassNames.root,\n 'flex items-center gap-2 px-3 pb-1 pt-2 text-caption-1 font-semibold text-muted-foreground',\n className,\n )}\n >\n <MenuColumnSpacers />\n {children}\n </div>\n );\n};\nMenuGroupHeader.displayName = 'MenuGroupHeader';\n"],"mappings":"wVAqCA,IAAMiB,EAAmBjB,EAAM,cAA4C,IAAI,EAC/E,EAAiB,YAAc,mBAG/B,IAAMkB,EAA6C,CACjD,SAAU,GACV,YAAa,IAAA,GACb,SAAU,EACZ,EAGA,SAASC,EAAoB,EAA8C,CAIzE,OAHgBnB,EAAM,WAAWiB,CAC7B,IACJN,EAAA,qBAAqBS,EAAe,YAAY,EACzCF,EACT,CAcA,IAAaG,GAAa,CAAE,WAAU,YAAW,MAAK,GAAGC,KAA2B,CAClF,IAAMC,EAActB,EAAAA,MAAM,mBAAmB,EAEvCuB,EAAStB,EAAAA,gBAAgBuB,CAAQ,CAAC,CAAC,MAAM,CAAE,UAC/CtB,EAAAA,gBAAsCuB,EAAMC,CAAe,CAC7D,CAAC,EAAE,KACGC,EAAcJ,GAAQ,MACtBK,EAAWD,GAAa,IAAML,EAE9BO,EAAUR,EAAK,gBAAkB,IAAA,IAAaA,EAAK,qBAAuB,IAAA,GAC1ES,EAAWP,IAAW,IAAA,IAAaM,EAEnCE,EAAaF,EACfR,EAAK,mBACLE,IAAW,IAAA,GAET,IAAA,GADAK,EAGAI,EAAUjC,EAAM,aACb,CAAE,WAAU,cAAa,UAAS,GACzC,CAAC6B,EAAUD,EAAaG,CAAQ,CAClC,EAEA,OACE,EAAAf,EAAA,IAAA,CAACC,EAAiB,SAAlB,CAA2B,MAAOgB,EAChC,UAAA,EAAAjB,EAAA,IAAA,CAAC,MAAD,CACE,KAAK,QACL,GAAIM,EACC,MACL,kBAAiBU,EACjB,UAAW5B,EAAAA,GAAGC,EAAAA,oBAAoB,KAAM6B,CAAS,EAEhD,UACE,CAAA,CACoB,CAAA,CAE/B,EACA,EAAU,YAAc,YAWxB,IAAaP,EAAmB,GAAgC,CAC9D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