@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":"Stack.mjs","names":["gapMap","alignMap","justifyMap","Stack","orientationProp","rest","props","Component","as","orientation","resolveDeprecatedProp","direction","cn","inline","gap","align","justify","wrap","className"],"sources":["../../../src/components/layout/Stack.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Orientation } from '../../lib/types';\n\nconst gapMap = {\n none: 'gap-0',\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6',\n} as const;\n\nconst alignMap = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n} as const;\n\nconst justifyMap = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const;\n\n/**\n * The Stack's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`).\n */\nexport interface StackOwnProps {\n /**\n * Layout axis of the stack.\n * @default 'vertical'\n */\n orientation?: Orientation;\n /**\n * @deprecated Use `orientation` (same values). Still works, warns once in development, and\n * `orientation` wins when both are given.\n */\n direction?: Orientation;\n /**\n * Gap size between stack items.\n * @default 'md'\n */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Cross-axis alignment of items. */\n align?: 'start' | 'center' | 'end' | 'stretch';\n /** Main-axis justification of items. */\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n /** Whether items should wrap to the next line. */\n wrap?: boolean;\n /** Whether to use inline-flex instead of flex. */\n inline?: boolean;\n}\n\n/**\n * Props of {@link Stack} rendered as `C` (default `'div'`). `StackProps` without a type argument\n * is the 0.4 name: the props of a Stack rendered as a `<div>`, including `ref`.\n */\nexport type StackProps<C extends React.ElementType = 'div'> = PolymorphicProps<C, StackOwnProps>;\n\ntype StackImplProps = StackOwnProps &\n React.HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * A one-dimensional layout: items stacked vertically (default) or horizontally with a token gap.\n *\n * @example\n * <Stack orientation=\"horizontal\" gap=\"sm\" align=\"center\">\n * <Avatar name=\"Ada\" />\n * <Text>Ada Lovelace</Text>\n * </Stack>\n */\nexport const Stack: PolymorphicComponent<'div', StackOwnProps> = (props) => {\n const {\n as,\n orientation: orientationProp,\n direction,\n gap = 'md',\n align,\n justify,\n wrap,\n inline,\n className,\n children,\n ref,\n ...rest\n } = props as StackImplProps;\n const Component: React.ElementType = as ?? 'div';\n const orientation =\n resolveDeprecatedProp('Stack', orientationProp, direction, 'direction', 'orientation') ??\n 'vertical';\n\n return (\n <Component\n ref={ref}\n className={cn(\n inline ? 'inline-flex' : 'flex',\n orientation === 'horizontal' ? 'flex-row' : 'flex-col',\n gapMap[gap],\n align && alignMap[align],\n justify && justifyMap[justify],\n wrap && 'flex-wrap',\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\nStack.displayName = 'Stack';\n"],"mappings":";;;;;;AAMA,IAAMA,IAAS;CACb,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAEMC,IAAW;CACf,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;AACX,GAEMC,IAAa;CACjB,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,QAAQ;CACR,QAAQ;AACV,GAqDaC,KAAqD,MAAU;CAC1E,IAAM,EACJ,OACA,aAAaC,GACb,cACA,SAAM,MACN,UACA,YACA,SACA,WACA,cACA,aACA,QACA,GAAGC,MACDC,GACEC,IAA+BC,KAAM,OACrCC,IACJC,EAAsB,SAASN,GAAiBO,GAAW,aAAa,aAAa,KACrF;CAEF,OACE,kBAACJ,GAAD;EACO;EACL,WAAWK,EACTC,IAAS,gBAAgB,QACzBJ,MAAgB,eAAe,aAAa,YAC5CT,EAAOc,IACPC,KAASd,EAASc,IAClBC,KAAWd,EAAWc,IACtBC,KAAQ,aACRC,CACF;EACA,GAAIb;EAEH;CACQ,CAAA;AAEf;AACA,EAAM,cAAc"}
1
+ {"version":3,"file":"Stack.mjs","names":["gapMap","alignMap","justifyMap","Stack","orientationProp","rest","props","Component","as","orientation","resolveDeprecatedProp","direction","cn","stackClassNames","inline","gap","align","justify","wrap","className"],"sources":["../../../src/components/layout/Stack.tsx"],"sourcesContent":["import * as React from 'react';\nimport { stackClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { PolymorphicComponent, PolymorphicProps } from '../../lib/polymorphic';\nimport type { Orientation } from '../../lib/types';\n\nconst gapMap = {\n none: 'gap-0',\n xs: 'gap-1',\n sm: 'gap-2',\n md: 'gap-3',\n lg: 'gap-4',\n xl: 'gap-6',\n} as const;\n\nconst alignMap = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n} as const;\n\nconst justifyMap = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n} as const;\n\n/**\n * The Stack's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).\n * Every other prop comes from the rendered element (`as`).\n */\nexport interface StackOwnProps {\n /**\n * Layout axis of the stack.\n * @default 'vertical'\n */\n orientation?: Orientation;\n /**\n * @deprecated Use `orientation` (same values). Still works, warns once in development, and\n * `orientation` wins when both are given.\n */\n direction?: Orientation;\n /**\n * Gap size between stack items.\n * @default 'md'\n */\n gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Cross-axis alignment of items. */\n align?: 'start' | 'center' | 'end' | 'stretch';\n /** Main-axis justification of items. */\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n /** Whether items should wrap to the next line. */\n wrap?: boolean;\n /** Whether to use inline-flex instead of flex. */\n inline?: boolean;\n}\n\n/**\n * Props of {@link Stack} rendered as `C` (default `'div'`). `StackProps` without a type argument\n * is the 0.4 name: the props of a Stack rendered as a `<div>`, including `ref`.\n */\nexport type StackProps<C extends React.ElementType = 'div'> = PolymorphicProps<C, StackOwnProps>;\n\ntype StackImplProps = StackOwnProps &\n React.HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n ref?: React.Ref<HTMLElement>;\n };\n\n/**\n * A one-dimensional layout: items stacked vertically (default) or horizontally with a token gap.\n *\n * @example\n * <Stack orientation=\"horizontal\" gap=\"sm\" align=\"center\">\n * <Avatar name=\"Ada\" />\n * <Text>Ada Lovelace</Text>\n * </Stack>\n */\nexport const Stack: PolymorphicComponent<'div', StackOwnProps> = (props) => {\n const {\n as,\n orientation: orientationProp,\n direction,\n gap = 'md',\n align,\n justify,\n wrap,\n inline,\n className,\n children,\n ref,\n ...rest\n } = props as StackImplProps;\n const Component: React.ElementType = as ?? 'div';\n const orientation =\n resolveDeprecatedProp('Stack', orientationProp, direction, 'direction', 'orientation') ??\n 'vertical';\n\n return (\n <Component\n ref={ref}\n className={cn(\n stackClassNames.root,\n inline ? 'inline-flex' : 'flex',\n orientation === 'horizontal' ? 'flex-row' : 'flex-col',\n gapMap[gap],\n align && alignMap[align],\n justify && justifyMap[justify],\n wrap && 'flex-wrap',\n className,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n};\nStack.displayName = 'Stack';\n"],"mappings":";;;;;;;AAOA,IAAMA,IAAS;CACb,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAEMC,IAAW;CACf,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;AACX,GAEMC,IAAa;CACjB,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,QAAQ;CACR,QAAQ;AACV,GAqDaC,KAAqD,MAAU;CAC1E,IAAM,EACJ,OACA,aAAaC,GACb,cACA,SAAM,MACN,UACA,YACA,SACA,WACA,cACA,aACA,QACA,GAAGC,MACDC,GACEC,IAA+BC,KAAM,OACrCC,IACJC,EAAsB,SAASN,GAAiBO,GAAW,aAAa,aAAa,KACrF;CAEF,OACE,kBAACJ,GAAD;EACO;EACL,WAAWK,EACTC,EAAgB,MAChBC,IAAS,gBAAgB,QACzBL,MAAgB,eAAe,aAAa,YAC5CT,EAAOe,IACPC,KAASf,EAASe,IAClBC,KAAWf,EAAWe,IACtBC,KAAQ,aACRC,CACF;EACA,GAAId;EAEH;CACQ,CAAA;AAEf;AACA,EAAM,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("../../lib/composeEventHandlers.cjs"),a=require("../../hooks/useEventCallback.cjs"),o=require("../../hooks/useControllable.cjs"),s=require("../../hooks/useId.cjs"),c=require("../../hooks/useRovingTabIndex.cjs"),l=require("../../hooks/useMergedRefs.cjs"),u=require("../../lib/styles.cjs"),d=require("./disclosureIds.cjs");let f=require("react");f=e.__toESM(f,1);let p=require("react/jsx-runtime");function m(e){r.warnOnce(`TabList:duplicate:${e}`,`TabList: several tabs share the value "${e}". Tab values must be unique within a TabList; tabs with the same value share one id and are selected (and tab stops) together.`)}function h(){let e={tab:new Map,panel:new Map},t=new Set,n=!1,r=()=>{t.forEach(e=>e())};return{register(t,n,i){let a=e[t],o=a.get(n)??[];return t===`tab`&&o.length>0&&m(n),a.set(n,[...o,i]),r(),()=>{let e=[...a.get(n)??[]],t=e.indexOf(i);t!==-1&&e.splice(t,1),e.length>0?a.set(n,e):a.delete(n),r()}},get:(t,r)=>n?e[t].get(r)?.[0]??null:void 0,markReady(){n||(n=!0,r())},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}var g={register:()=>()=>{},get:()=>void 0,markReady:()=>{},subscribe:()=>()=>{}},_=f.createContext(null),v={orientation:`horizontal`,isSelected:()=>!1,select:()=>{},getTabIndex:()=>-1,getGeneratedId:(e,t)=>`wave-tablist-inert-${e}-${t}`,getStaticTabId:e=>`wave-tablist-inert-tab-${e}`,getStaticPanelId:()=>void 0,registry:g};function y(e){return f.useContext(_)||(r.reportMissingContext(e,`<TabList>`),v)}function b(e){let t=e[`aria-disabled`];return e.disabled===!0||t===!0||t===`true`}function x(e){return typeof e==`string`&&e!==``?e:null}function S(e,t){if(Array.isArray(e))return e.forEach(e=>S(e,t)),t;if(!f.isValidElement(e))return t;let{props:r}=e,i=n.getElementType(e,{suspend:!1}),a=typeof r.value==`string`?r.value:void 0;if(i===O){if(a!==void 0){t.firstEnabled===void 0&&!b(r)&&(t.firstEnabled=a);let e=x(r.id);e!==null&&t.tabIds.push([a,e])}return t}return i===k?(a!==void 0&&t.panels.push([a,x(r.id)]),t):i===D?t:S(r.children,t)}function C(e,t){if(Array.isArray(e))return e.some(e=>C(e,t));if(!f.isValidElement(e))return!1;let r=n.getElementType(e,{suspend:!1});return r===O?t===`tab`:r===k||r===A?t===`panel`:r!==D&&C(e.props.children,t)}function w(e){return C(e,`panel`)&&!C(e,`tab`)}var T=f.createContext(null),E=`TabList.Panel was rendered inside the role="tablist" element, where only tabs belong (axe aria-required-children). The TabList moves a Panel after the tablist when it is its child, or in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which renders after the tablist.`,D=({value:e,defaultValue:u,onValueChange:m,orientation:g,selectTabOnFocus:v=!0,selectedValue:y,defaultSelectedValue:b,onTabSelect:x,vertical:C,className:E,children:D,onKeyDown:O,onFocus:k,ref:A,...j})=>{let M=r.resolveDeprecatedProp(`TabList`,e,y,`selectedValue`,`value`),N=r.resolveDeprecatedProp(`TabList`,u,b,`defaultSelectedValue`,`defaultValue`),P=r.resolveDeprecatedProp(`TabList`,g,C===void 0?void 0:C?`vertical`:`horizontal`,`vertical`,`orientation`)??`horizontal`;x&&r.warnDeprecated(`TabList`,`onTabSelect`,`onValueChange`,"`onValueChange` is called only when the selected tab changes.");let[F,I,L]=o.useControllable(M,N??``,m),R=JSON.stringify(S(D,{tabIds:[],panels:[]})),z=f.useMemo(()=>{let e=JSON.parse(R);return{firstEnabled:e.firstEnabled,tabIds:new Map(e.tabIds),panels:new Map(e.panels)}},[R]),B=!L&&F===``,{containerProps:V,getTabIndex:H}=c.useRovingTabIndex({activeValue:B?z.firstEnabled??null:F,orientation:P,loop:!0,onFocusMove:v?e=>W(e):void 0}),U=f.useCallback(e=>B?H(e)===0:F===e,[B,H,F]),W=a.useEventCallback(e=>{x?.(e),U(e)||I(e)}),G=s.useId(`tablist`),[K]=f.useState(h);f.useLayoutEffect(()=>K.markReady(),[K]);let q=f.useMemo(()=>({orientation:P,isSelected:U,select:W,getTabIndex:H,getGeneratedId:(e,t)=>d.getPartId(G,e,t),getStaticTabId:e=>z.tabIds.get(e)??d.getPartId(G,`tab`,e),getStaticPanelId:e=>{let t=z.panels.get(e);if(t!==void 0)return t??d.getPartId(G,`panel`,e)},registry:K}),[P,U,W,H,G,z,K]),J=l.useMergedRefs(A,V.ref),Y=[],X=[];n.flattenChildren(D).forEach(({key:e,node:t})=>{let n=(0,p.jsx)(f.Fragment,{children:t},e);(w(t)?X:Y).push(n)});let Z=P===`vertical`;return(0,p.jsx)(_.Provider,{value:q,children:(0,p.jsxs)(`div`,{className:t.cn(Z&&`flex`),children:[(0,p.jsx)(`div`,{role:`tablist`,"aria-orientation":P,className:t.cn(Z?`flex w-40 flex-col border-e border-border`:`flex border-b border-border`,E),...j,"data-roving-container":``,onKeyDown:i.composeEventHandlers(O,V.onKeyDown),onFocus:i.composeEventHandlers(k,V.onFocus,{checkDefaultPrevented:!1}),ref:J,children:(0,p.jsx)(T.Provider,{value:`tabs`,children:Y})}),(0,p.jsx)(T.Provider,{value:`panels`,children:X})]})})};D.displayName=`TabList`;var O=({value:e,id:n,className:r,children:a,onClick:o,ref:s,...c})=>{let l=y(`TabList.Tab`),d=l.isSelected(e),m=l.orientation===`vertical`,h=b(c),{registry:g}=l,_=x(n)??l.getGeneratedId(`tab`,e);f.useLayoutEffect(()=>g.register(`tab`,e,_),[g,e,_]);let v=f.useSyncExternalStore(g.subscribe,()=>g.get(`panel`,e),()=>void 0),S=v===void 0?l.getStaticPanelId(e):v??void 0;return(0,p.jsx)(`button`,{type:`button`,role:`tab`,className:t.cn(`px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none`,m&&`text-start`,d?t.cn(`text-primary`,m?`border-s-2 border-s-primary`:`border-b-2 border-b-primary`):`text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground`,u.disabledStyles,u.focusRingInset,r),...c,id:_,"aria-selected":d,"aria-controls":d?S:void 0,tabIndex:l.getTabIndex(e),"data-roving-value":e,"data-selected":d?``:void 0,onClick:i.composeEventHandlers(o,()=>{h||l.select(e)}),ref:s,children:a})};O.displayName=`Tab`;var k=({value:e,id:n,children:i,className:a,ref:o,...s})=>{let c=y(`TabList.Panel`),l=f.useContext(T)===`tabs`;f.useEffect(()=>{l&&r.warnOnce(`TabList.Panel:inside-tablist`,E)},[l]);let{registry:d}=c,m=x(n)??c.getGeneratedId(`panel`,e);f.useLayoutEffect(()=>d.register(`panel`,e,m),[d,e,m]);let h=f.useSyncExternalStore(d.subscribe,()=>d.get(`tab`,e),()=>void 0);if(!c.isSelected(e))return null;let g=h===void 0?c.getStaticTabId(e):h??void 0;return(0,p.jsx)(`div`,{role:`tabpanel`,tabIndex:0,className:t.cn(`p-4`,u.focusRing,a),...s,id:m,"aria-labelledby":g,ref:o,children:i})};k.displayName=`TabPanel`;var A=({className:e,children:n,ref:r,...i})=>(0,p.jsx)(`div`,{ref:r,className:t.cn(`min-w-0 flex-1`,e),...i,children:n});A.displayName=`TabPanels`;var j=Object.assign(D,{Tab:O,Panel:k,Panels:A});exports.TabList=j,exports.TabListPanel=k,exports.TabListPanels=A,exports.TabListTab=O;
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/composeEventHandlers.cjs"),a=require("../../lib/classNames.cjs"),o=require("../../hooks/useEventCallback.cjs"),s=require("../../hooks/useControllable.cjs"),c=require("../../hooks/useId.cjs"),l=require("../../hooks/useRovingTabIndex.cjs"),u=require("../../hooks/useMergedRefs.cjs"),d=require("../../lib/styles.cjs"),f=require("./disclosureIds.cjs");let p=require("react");p=e.__toESM(p,1);let m=require("react/jsx-runtime");function h(e){r.warnOnce(`TabList:duplicate:${e}`,`TabList: several tabs share the value "${e}". Tab values must be unique within a TabList; tabs with the same value share one id and are selected (and tab stops) together.`)}function g(){let e={tab:new Map,panel:new Map},t=new Set,n=!1,r=()=>{t.forEach(e=>e())};return{register(t,n,i){let a=e[t],o=a.get(n)??[];return t===`tab`&&o.length>0&&h(n),a.set(n,[...o,i]),r(),()=>{let e=[...a.get(n)??[]],t=e.indexOf(i);t!==-1&&e.splice(t,1),e.length>0?a.set(n,e):a.delete(n),r()}},get:(t,r)=>n?e[t].get(r)?.[0]??null:void 0,markReady(){n||(n=!0,r())},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}var _={register:()=>()=>{},get:()=>void 0,markReady:()=>{},subscribe:()=>()=>{}},v=p.createContext(null),y={orientation:`horizontal`,isSelected:()=>!1,select:()=>{},getTabIndex:()=>-1,getGeneratedId:(e,t)=>`wave-tablist-inert-${e}-${t}`,getStaticTabId:e=>`wave-tablist-inert-tab-${e}`,getStaticPanelId:()=>void 0,registry:_};function b(e){return p.useContext(v)||(r.reportMissingContext(e,`<TabList>`),y)}function x(e){let t=e[`aria-disabled`];return e.disabled===!0||t===!0||t===`true`}function S(e){return typeof e==`string`&&e!==``?e:null}function C(e,t){if(Array.isArray(e))return e.forEach(e=>C(e,t)),t;if(!p.isValidElement(e))return t;let{props:r}=e,i=n.getElementType(e,{suspend:!1}),a=typeof r.value==`string`?r.value:void 0;if(i===k){if(a!==void 0){t.firstEnabled===void 0&&!x(r)&&(t.firstEnabled=a);let e=S(r.id);e!==null&&t.tabIds.push([a,e])}return t}return i===A?(a!==void 0&&t.panels.push([a,S(r.id)]),t):i===O?t:C(r.children,t)}function w(e,t){if(Array.isArray(e))return e.some(e=>w(e,t));if(!p.isValidElement(e))return!1;let r=n.getElementType(e,{suspend:!1});return r===k?t===`tab`:r===A||r===j?t===`panel`:r!==O&&w(e.props.children,t)}function T(e){return w(e,`panel`)&&!w(e,`tab`)}var E=p.createContext(null),D=`TabList.Panel was rendered inside the role="tablist" element, where only tabs belong (axe aria-required-children). The TabList moves a Panel after the tablist when it is its child, or in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which renders after the tablist.`,O=({value:e,defaultValue:d,onValueChange:h,orientation:_,selectTabOnFocus:y=!0,selectedValue:b,defaultSelectedValue:x,onTabSelect:S,vertical:w,className:D,children:O,onKeyDown:k,onFocus:A,ref:j,...M})=>{let N=r.resolveDeprecatedProp(`TabList`,e,b,`selectedValue`,`value`),P=r.resolveDeprecatedProp(`TabList`,d,x,`defaultSelectedValue`,`defaultValue`),F=r.resolveDeprecatedProp(`TabList`,_,w===void 0?void 0:w?`vertical`:`horizontal`,`vertical`,`orientation`)??`horizontal`;S&&r.warnDeprecated(`TabList`,`onTabSelect`,`onValueChange`,"`onValueChange` is called only when the selected tab changes.");let[I,L,R]=s.useControllable(N,P??``,h),z=JSON.stringify(C(O,{tabIds:[],panels:[]})),B=p.useMemo(()=>{let e=JSON.parse(z);return{firstEnabled:e.firstEnabled,tabIds:new Map(e.tabIds),panels:new Map(e.panels)}},[z]),V=!R&&I===``,{containerProps:H,getTabIndex:U}=l.useRovingTabIndex({activeValue:V?B.firstEnabled??null:I,orientation:F,loop:!0,onFocusMove:y?e=>G(e):void 0}),W=p.useCallback(e=>V?U(e)===0:I===e,[V,U,I]),G=o.useEventCallback(e=>{S?.(e),W(e)||L(e)}),K=c.useId(`tablist`),[q]=p.useState(g);p.useLayoutEffect(()=>q.markReady(),[q]);let J=p.useMemo(()=>({orientation:F,isSelected:W,select:G,getTabIndex:U,getGeneratedId:(e,t)=>f.getPartId(K,e,t),getStaticTabId:e=>B.tabIds.get(e)??f.getPartId(K,`tab`,e),getStaticPanelId:e=>{let t=B.panels.get(e);if(t!==void 0)return t??f.getPartId(K,`panel`,e)},registry:q}),[F,W,G,U,K,B,q]),Y=u.useMergedRefs(j,H.ref),X=[],Z=[];n.flattenChildren(O).forEach(({key:e,node:t})=>{let n=(0,m.jsx)(p.Fragment,{children:t},e);(T(t)?Z:X).push(n)});let Q=F===`vertical`;return(0,m.jsx)(v.Provider,{value:J,children:(0,m.jsxs)(`div`,{className:t.cn(Q&&`flex`),children:[(0,m.jsx)(`div`,{role:`tablist`,"aria-orientation":F,className:t.cn(a.tabListClassNames.root,Q?`flex w-40 flex-col border-e border-border`:`flex border-b border-border`,D),...M,"data-roving-container":``,onKeyDown:i.composeEventHandlers(k,H.onKeyDown),onFocus:i.composeEventHandlers(A,H.onFocus,{checkDefaultPrevented:!1}),ref:Y,children:(0,m.jsx)(E.Provider,{value:`tabs`,children:X})}),(0,m.jsx)(E.Provider,{value:`panels`,children:Z})]})})};O.displayName=`TabList`;var k=({value:e,id:n,className:r,children:o,onClick:s,ref:c,...l})=>{let u=b(`TabList.Tab`),f=u.isSelected(e),h=u.orientation===`vertical`,g=x(l),{registry:_}=u,v=S(n)??u.getGeneratedId(`tab`,e);p.useLayoutEffect(()=>_.register(`tab`,e,v),[_,e,v]);let y=p.useSyncExternalStore(_.subscribe,()=>_.get(`panel`,e),()=>void 0),C=y===void 0?u.getStaticPanelId(e):y??void 0;return(0,m.jsx)(`button`,{type:`button`,role:`tab`,className:t.cn(a.tabListTabClassNames.root,`px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none`,h&&`text-start`,f?t.cn(`text-primary`,h?`border-s-2 border-s-primary`:`border-b-2 border-b-primary`):`text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground`,d.disabledStyles,d.focusRingInset,r),...l,id:v,"aria-selected":f,"aria-controls":f?C:void 0,tabIndex:u.getTabIndex(e),"data-roving-value":e,"data-selected":f?``:void 0,onClick:i.composeEventHandlers(s,()=>{g||u.select(e)}),ref:c,children:o})};k.displayName=`Tab`;var A=({value:e,id:n,children:i,className:o,ref:s,...c})=>{let l=b(`TabList.Panel`),u=p.useContext(E)===`tabs`;p.useEffect(()=>{u&&r.warnOnce(`TabList.Panel:inside-tablist`,D)},[u]);let{registry:f}=l,h=S(n)??l.getGeneratedId(`panel`,e);p.useLayoutEffect(()=>f.register(`panel`,e,h),[f,e,h]);let g=p.useSyncExternalStore(f.subscribe,()=>f.get(`tab`,e),()=>void 0);if(!l.isSelected(e))return null;let _=g===void 0?l.getStaticTabId(e):g??void 0;return(0,m.jsx)(`div`,{role:`tabpanel`,tabIndex:0,className:t.cn(a.tabListPanelClassNames.root,`p-4`,d.focusRing,o),...c,id:h,"aria-labelledby":_,ref:s,children:i})};A.displayName=`TabPanel`;var j=({className:e,children:n,ref:r,...i})=>(0,m.jsx)(`div`,{ref:r,className:t.cn(a.tabListPanelsClassNames.root,`min-w-0 flex-1`,e),...i,children:n});j.displayName=`TabPanels`;var M=Object.assign(O,{Tab:k,Panel:A,Panels:j});exports.TabList=M,exports.TabListPanel=A,exports.TabListPanels=j,exports.TabListTab=k;
2
2
  //# sourceMappingURL=TabList.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TabList.cjs","names":["React","getElementType","resolveDeprecatedProp","useControllable","useRovingTabIndex","useEventCallback","useId","getPartId","useMergedRefs","cn","composeEventHandlers","disabledStyles","focusRingInset","focusRing","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_useEventCallback","require_useControllable","require_useId","require_useRovingTabIndex","require_useMergedRefs","require_styles","require_disclosureIds","react","react_jsx_runtime","warnDuplicateTabValue","value","createRegistry","entries","listeners","ready","emit","listener","map","part","ids","id","index","INERT_REGISTRY","TabListContext","INERT_CONTEXT","useTabListContext","component","isUnavailable","ariaDisabled","props","consumerId","collectStructure","node","child","into","type","Tab","TabPanel","TabListRoot","containsPart","TabPanels","rendersAfterTablist","TabListAreaContext","PANEL_IN_TABLIST_MESSAGE","valueProp","defaultValueProp","orientationProp","rest","selectedValue","defaultValue","defaultSelectedValue","orientation","vertical","onTabSelect","selected","setSelected","isControlled","onValueChange","structureKey","children","structure","parsed","derivesSelection","selectTabOnFocus","select","next","isSelected","getTabIndex","tabValue","baseId","registry","context","itemValue","panel","mergedRef","ref","containerProps","tabs","panels","keyed","key","isVertical","className","onKeyDown","onFocus","idProp","ctx","unavailable","mountedPanelId","panelId","onClick","insideTablist","mountedTabId","tabId","TabList"],"sources":["../../../src/components/layout/TabList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { disabledStyles, focusRing, focusRingInset } from '../../lib/styles';\nimport type { Orientation } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { getPartId } from './disclosureIds';\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\ntype TabListPart = 'tab' | 'panel';\n\n/**\n * The ids of the mounted Tabs and Panels by value. A Tab references a panel only while one with\n * its value is mounted (a TabList used as a filter bar has none), and each side references the\n * other's actual id, a consumer `id` included. Read with `useSyncExternalStore`.\n *\n * Before the TabList has mounted (server HTML, hydration and the first client render) the\n * registry is not ready and the static structure of the children stands in for it; once it is\n * ready, it alone decides, so a Panel that is in the element tree but never mounts (inside a\n * wrapper that renders nothing) is not referenced.\n */\ninterface TabListRegistry {\n /** Registers a mounted Tab or Panel; returns the unregister function. */\n register: (part: TabListPart, value: string, id: string) => () => void;\n /**\n * Id of the first mounted Tab or Panel with this value, `null` when none is mounted, or\n * `undefined` while the registry is not ready (use the static structure then).\n */\n get: (part: TabListPart, value: string) => string | null | undefined;\n /** Called by the TabList once it (and so every Tab and Panel mounted with it) has mounted. */\n markReady: () => void;\n subscribe: (listener: () => void) => () => void;\n}\n\n/** Tabs that share a value share one id, and are selected and tab stops together. */\nfunction warnDuplicateTabValue(value: string): void {\n warnOnce(\n `TabList:duplicate:${value}`,\n `TabList: several tabs share the value \"${value}\". Tab values must be unique within a ` +\n 'TabList; tabs with the same value share one id and are selected (and tab stops) together.',\n );\n}\n\nfunction createRegistry(): TabListRegistry {\n const entries: Record<TabListPart, Map<string, string[]>> = { tab: new Map(), panel: new Map() };\n const listeners = new Set<() => void>();\n let ready = false;\n const emit = () => {\n listeners.forEach((listener) => listener());\n };\n return {\n register(part, value, id) {\n const map = entries[part];\n const ids = map.get(value) ?? [];\n // Called from the part's layout effect (C-DEV). Two Panels may share a value (the Tab links\n // to the first mounted one); two Tabs may not.\n if (part === 'tab' && ids.length > 0) warnDuplicateTabValue(value);\n map.set(value, [...ids, id]);\n emit();\n return () => {\n const ids = [...(map.get(value) ?? [])];\n const index = ids.indexOf(id);\n if (index !== -1) ids.splice(index, 1);\n if (ids.length > 0) map.set(value, ids);\n else map.delete(value);\n emit();\n };\n },\n get: (part, value) => (ready ? (entries[part].get(value)?.[0] ?? null) : undefined),\n markReady() {\n if (ready) return;\n ready = true;\n emit();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst INERT_REGISTRY: TabListRegistry = {\n register: () => () => {},\n get: () => undefined,\n markReady: () => {},\n subscribe: () => () => {},\n};\n\n/**\n * What the TabList's children show before anything mounts (server HTML and the first render):\n * found in the element tree through Fragments and the `children` of wrapper elements, but not\n * inside a component that renders a Tab or Panel itself (the registry covers those once mounted).\n */\ninterface TabListStructure {\n /** Value of the first Tab without `disabled`/`aria-disabled`: the uncontrolled default. */\n firstEnabled?: string;\n /** Consumer `id`s of Tabs, by value. */\n tabIds: Array<[string, string]>;\n /** Values of the Panels, each with its consumer `id` or `null`. */\n panels: Array<[string, string | null]>;\n}\n\ninterface TabListContextValue {\n orientation: Orientation;\n /** Whether the tab with this value is the selected one (explicit value, else the tab stop). */\n isSelected: (value: string) => boolean;\n /**\n * Activates a tab: a click (Enter and Space click the tab button), or with automatic activation\n * focus moved by the keys.\n */\n select: (value: string) => void;\n getTabIndex: (value: string) => 0 | -1;\n /** The generated id of a Tab or Panel (used when it has no consumer `id`). */\n getGeneratedId: (part: TabListPart, value: string) => string;\n /**\n * Id of the Tab with this value before the TabList mounts: its consumer `id`, else the\n * generated one.\n */\n getStaticTabId: (value: string) => string;\n /**\n * Id of the Panel with this value before the TabList mounts, or `undefined` when the children\n * have none.\n */\n getStaticPanelId: (value: string) => string | undefined;\n registry: TabListRegistry;\n}\n\nconst TabListContext = React.createContext<TabListContextValue | null>(null);\n\nconst INERT_CONTEXT: TabListContextValue = {\n orientation: 'horizontal',\n isSelected: () => false,\n select: () => {},\n getTabIndex: () => -1,\n getGeneratedId: (part, value) => `wave-tablist-inert-${part}-${value}`,\n getStaticTabId: (value) => `wave-tablist-inert-tab-${value}`,\n getStaticPanelId: () => undefined,\n registry: INERT_REGISTRY,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useTabListContext(component: string): TabListContextValue {\n const context = React.useContext(TabListContext);\n if (context) return context;\n reportMissingContext(component, '<TabList>');\n return INERT_CONTEXT;\n}\n\ninterface StructureProps {\n value?: unknown;\n id?: unknown;\n disabled?: unknown;\n 'aria-disabled'?: unknown;\n children?: unknown;\n}\n\n/** Whether a Tab's props make it unavailable (it cannot be selected and is skipped by keys). */\nfunction isUnavailable(props: StructureProps): boolean {\n const ariaDisabled = props['aria-disabled'];\n return props.disabled === true || ariaDisabled === true || ariaDisabled === 'true';\n}\n\n/** A consumer `id` that replaces the generated one: a non-empty string (`''` counts as none). */\nfunction consumerId(id: unknown): string | null {\n return typeof id === 'string' && id !== '' ? id : null;\n}\n\n/**\n * Walks the element tree of the TabList's children (see {@link TabListStructure}). Parts are\n * identified through their element type, so parts written in a Server Component (lazy\n * references) count too. A `React.lazy` still loading (inside the consumer's own `<Suspense>`,\n * such as code-split panels in `TabList.Panels`) is no part and never suspends the TabList: its\n * children are walked instead. Runs during render only.\n */\nfunction collectStructure(node: unknown, into: TabListStructure): TabListStructure {\n if (Array.isArray(node)) {\n node.forEach((child) => collectStructure(child, into));\n return into;\n }\n if (!React.isValidElement<StructureProps>(node)) return into;\n const { props } = node;\n const type = getElementType(node, { suspend: false });\n const value = typeof props.value === 'string' ? props.value : undefined;\n if (type === Tab) {\n if (value !== undefined) {\n if (into.firstEnabled === undefined && !isUnavailable(props)) into.firstEnabled = value;\n const id = consumerId(props.id);\n if (id !== null) into.tabIds.push([value, id]);\n }\n return into;\n }\n if (type === TabPanel) {\n if (value !== undefined) into.panels.push([value, consumerId(props.id)]);\n return into;\n }\n if (type === TabListRoot) return into;\n return collectStructure(props.children, into);\n}\n\n/**\n * Whether an element tree shows a Tab, or a Panel (`TabList.Panel` or `TabList.Panels`), found as\n * in {@link collectStructure}: through Fragments and the `children` of wrapper elements, not inside\n * a nested TabList or a component that renders the part itself.\n */\nfunction containsPart(node: unknown, part: TabListPart): boolean {\n if (Array.isArray(node)) return node.some((child) => containsPart(child, part));\n if (!React.isValidElement<StructureProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (type === Tab) return part === 'tab';\n if (type === TabPanel || type === TabPanels) return part === 'panel';\n if (type === TabListRoot) return false;\n return containsPart(node.props.children, part);\n}\n\n/**\n * Whether a child of the TabList renders after the tablist: a Panel, `TabList.Panels`, or a\n * wrapper (an element, `Suspense`, an error boundary) that holds panels and no tab.\n */\nfunction rendersAfterTablist(child: React.ReactNode): boolean {\n return containsPart(child, 'panel') && !containsPart(child, 'tab');\n}\n\n/**\n * Where the TabList renders its children: inside the `role=\"tablist\"` element (`'tabs'`) or after\n * it (`'panels'`). A Panel that ends up inside the tablist warns in development.\n */\nconst TabListAreaContext = React.createContext<'tabs' | 'panels' | null>(null);\n\nconst PANEL_IN_TABLIST_MESSAGE =\n 'TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe ' +\n 'aria-required-children). The TabList moves a Panel after the tablist when it is its child, or ' +\n 'in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or ' +\n \"separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which \" +\n 'renders after the tablist.';\n\n/* ------------------------------------------------------------------ */\n/* TabList */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabList component. */\nexport interface TabListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * Controlled value of the selected tab (`''`: no tab selected). A controlled value that becomes\n * `undefined` also selects no tab: the TabList stays controlled.\n */\n value?: string;\n /**\n * Selected tab for uncontrolled usage. When it is omitted (or `''`), the first enabled tab\n * written in the TabList's children is selected, from the first render (and in server-rendered\n * HTML) on. Tabs written directly in the children, in Fragments or in wrapper elements that\n * pass them as `children` (such as a Tooltip) count; a tab rendered by a custom component that\n * renders `TabList.Tab` itself does not, even when it comes first in the DOM, so that server\n * and client pick the same tab. When every tab comes from such a component, the first enabled\n * tab in the DOM is selected once the tabs mount. To select a tab that a custom component\n * renders, pass `defaultValue`.\n */\n defaultValue?: string;\n /** Called with the new value when the selected tab changes (not when it is activated again). */\n onValueChange?: (value: string) => void;\n /**\n * Layout and arrow-key axis: `'horizontal'` (Left/Right, mirrored in RTL) or `'vertical'`\n * (Up/Down).\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * Whether moving focus with the arrow keys, Home and End also selects the tab (automatic\n * activation, as in 0.5). With `false`, the keys only move focus and Enter, Space or a click\n * selects the focused tab (manual activation, for panels that are slow to show). Fluent's\n * default is `false`.\n * @default true\n */\n selectTabOnFocus?: boolean;\n /** @deprecated Use `value`. */\n selectedValue?: string;\n /** @deprecated Use `defaultValue`. */\n defaultSelectedValue?: string;\n /**\n * @deprecated Use `onValueChange`. Unlike `onValueChange`, it is called on every activation,\n * including a click on the tab that is already selected.\n */\n onTabSelect?: (value: string) => void;\n /** @deprecated Use `orientation=\"vertical\"`. */\n vertical?: boolean;\n /** Ref to the `role=\"tablist\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst TabListRoot = ({\n value: valueProp,\n defaultValue: defaultValueProp,\n onValueChange,\n orientation: orientationProp,\n selectTabOnFocus = true,\n selectedValue,\n defaultSelectedValue,\n onTabSelect,\n vertical,\n className,\n children,\n onKeyDown,\n onFocus,\n ref,\n ...rest\n}: TabListProps) => {\n const value = resolveDeprecatedProp(\n 'TabList',\n valueProp,\n selectedValue,\n 'selectedValue',\n 'value',\n );\n const defaultValue = resolveDeprecatedProp(\n 'TabList',\n defaultValueProp,\n defaultSelectedValue,\n 'defaultSelectedValue',\n 'defaultValue',\n );\n const orientation =\n resolveDeprecatedProp<Orientation>(\n 'TabList',\n orientationProp,\n vertical === undefined ? undefined : vertical ? 'vertical' : 'horizontal',\n 'vertical',\n 'orientation',\n ) ?? 'horizontal';\n if (onTabSelect) {\n warnDeprecated(\n 'TabList',\n 'onTabSelect',\n 'onValueChange',\n '`onValueChange` is called only when the selected tab changes.',\n );\n }\n\n // The sticky mode: a controlled value that becomes `undefined` clears the selection (`''`).\n const [selected, setSelected, isControlled] = useControllable(\n value,\n defaultValue ?? '',\n onValueChange,\n );\n\n // The children are a new element tree on every parent render: memoized by content, so the\n // context value stays stable while the tabs and panels stay the same.\n const structureKey = JSON.stringify(collectStructure(children, { tabIds: [], panels: [] }));\n const structure = React.useMemo(() => {\n const parsed = JSON.parse(structureKey) as TabListStructure;\n return {\n firstEnabled: parsed.firstEnabled,\n tabIds: new Map(parsed.tabIds),\n panels: new Map(parsed.panels),\n };\n }, [structureKey]);\n\n // Uncontrolled without a selection: the first enabled tab is selected. It is the tab stop the\n // roving store resolves from `activeValue` (the first enabled tab of the children, replaced by\n // the first enabled tab in the DOM once the store sees it disabled), so the selection is\n // derived during render, present from the first render on, and follows tabs that disable\n // themselves.\n const derivesSelection = !isControlled && selected === '';\n\n const { containerProps, getTabIndex } = useRovingTabIndex({\n activeValue: derivesSelection ? (structure.firstEnabled ?? null) : selected,\n orientation,\n loop: true,\n // Automatic activation (APG Tabs): moving focus selects the tab. With manual activation the\n // keys only move focus; the tab stop stays on the selected tab (`tabStop: 'active'`), and Enter\n // or Space selects the focused tab through its native click.\n onFocusMove: selectTabOnFocus ? (next) => select(next) : undefined,\n });\n\n const isSelected = React.useCallback(\n (tabValue: string) => (derivesSelection ? getTabIndex(tabValue) === 0 : selected === tabValue),\n [derivesSelection, getTabIndex, selected],\n );\n\n const select = useEventCallback((next: string) => {\n onTabSelect?.(next);\n if (!isSelected(next)) setSelected(next);\n });\n\n const baseId = useId('tablist');\n const [registry] = React.useState(createRegistry);\n // Runs after the layout effects of the Tabs and Panels mounted with the TabList, which have\n // registered by then: from here on the registry, not the static structure, decides the links.\n React.useLayoutEffect(() => registry.markReady(), [registry]);\n const context = React.useMemo<TabListContextValue>(\n () => ({\n orientation,\n isSelected,\n select,\n getTabIndex,\n getGeneratedId: (part, itemValue) => getPartId(baseId, part, itemValue),\n getStaticTabId: (tabValue) =>\n structure.tabIds.get(tabValue) ?? getPartId(baseId, 'tab', tabValue),\n getStaticPanelId: (tabValue) => {\n const panel = structure.panels.get(tabValue);\n if (panel === undefined) return undefined;\n return panel ?? getPartId(baseId, 'panel', tabValue);\n },\n registry,\n }),\n [orientation, isSelected, select, getTabIndex, baseId, structure, registry],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const tabs: React.ReactNode[] = [];\n const panels: React.ReactNode[] = [];\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n (rendersAfterTablist(child) ? panels : tabs).push(keyed);\n });\n\n const isVertical = orientation === 'vertical';\n return (\n <TabListContext.Provider value={context}>\n <div className={cn(isVertical && 'flex')}>\n <div\n role=\"tablist\"\n aria-orientation={orientation}\n className={cn(\n isVertical\n ? 'flex w-40 flex-col border-e border-border'\n : 'flex border-b border-border',\n className,\n )}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, containerProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n ref={mergedRef}\n >\n <TabListAreaContext.Provider value=\"tabs\">{tabs}</TabListAreaContext.Provider>\n </div>\n <TabListAreaContext.Provider value=\"panels\">{panels}</TabListAreaContext.Provider>\n </div>\n </TabListContext.Provider>\n );\n};\nTabListRoot.displayName = 'TabList';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Tab */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Tab sub-component. */\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique value identifying this tab (and its panel). */\n value: string;\n /** Ref to the tab `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * A tab button. `onClick` runs before the selection (call `event.preventDefault()` to keep the\n * current tab). A `disabled` (or `aria-disabled=\"true\"`) tab is skipped by the keyboard and cannot\n * be selected. A non-empty `id` replaces the generated one (its panel's `aria-labelledby` follows\n * it). The selected tab references its panel with `aria-controls` only while a `TabList.Panel`\n * with its value is mounted.\n */\nconst Tab = ({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps) => {\n const ctx = useTabListContext('TabList.Tab');\n const selected = ctx.isSelected(value);\n const isVertical = ctx.orientation === 'vertical';\n const unavailable = isUnavailable(rest);\n\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('tab', value);\n React.useLayoutEffect(() => registry.register('tab', value, id), [registry, value, id]);\n const mountedPanelId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('panel', value),\n () => undefined,\n );\n // Before the TabList mounts the static structure stands in; after that only a mounted panel is\n // referenced (`null`: none).\n const panelId =\n mountedPanelId === undefined ? ctx.getStaticPanelId(value) : (mountedPanelId ?? undefined);\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n className={cn(\n 'px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none',\n isVertical && 'text-start',\n selected\n ? cn(\n 'text-primary',\n isVertical ? 'border-s-2 border-s-primary' : 'border-b-2 border-b-primary',\n )\n : 'text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n id={id}\n aria-selected={selected}\n aria-controls={selected ? panelId : undefined}\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={selected ? '' : undefined}\n onClick={composeEventHandlers(onClick, () => {\n if (!unavailable) ctx.select(value);\n })}\n ref={ref}\n >\n {children}\n </button>\n );\n};\nTab.displayName = 'Tab';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanel sub-component. */\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value of the Tab that shows this panel. */\n value: string;\n /** Ref to the `role=\"tabpanel\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content of one tab, rendered only while its tab is selected and labelled by it (while a Tab\n * with its value is mounted). A non-empty `id` replaces the generated one (the tab's\n * `aria-controls` follows it).\n */\nconst TabPanel = ({ value, id: idProp, children, className, ref, ...rest }: TabPanelProps) => {\n const ctx = useTabListContext('TabList.Panel');\n const insideTablist = React.useContext(TabListAreaContext) === 'tabs';\n React.useEffect(() => {\n if (insideTablist) warnOnce('TabList.Panel:inside-tablist', PANEL_IN_TABLIST_MESSAGE);\n }, [insideTablist]);\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('panel', value);\n // Registered while mounted, also while hidden: the tab that selects it links to it.\n React.useLayoutEffect(() => registry.register('panel', value, id), [registry, value, id]);\n const mountedTabId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('tab', value),\n () => undefined,\n );\n if (!ctx.isSelected(value)) return null;\n // As for the Tab's aria-controls: the static structure only before the TabList mounts.\n const tabId =\n mountedTabId === undefined ? ctx.getStaticTabId(value) : (mountedTabId ?? undefined);\n return (\n <div\n role=\"tabpanel\"\n tabIndex={0}\n className={cn('p-4', focusRing, className)}\n {...rest}\n id={id}\n aria-labelledby={tabId}\n ref={ref}\n >\n {children}\n </div>\n );\n};\nTabPanel.displayName = 'TabPanel';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panels */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanels sub-component. */\nexport interface TabPanelsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the container `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Optional container for the panels, rendered after the tablist. Use it to style the panel area,\n * and for panels that components render themselves: the TabList finds a Panel in its children, in\n * a Fragment or in a wrapper that holds no Tab, but a component that renders a Panel itself\n * renders inside the tablist unless it is placed in `TabList.Panels`.\n */\nconst TabPanels = ({ className, children, ref, ...rest }: TabPanelsProps) => (\n <div ref={ref} className={cn('min-w-0 flex-1', className)} {...rest}>\n {children}\n </div>\n);\nTabPanels.displayName = 'TabPanels';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A set of tabs with their panels (WAI-ARIA Tabs pattern): the arrow keys (Left/Right, mirrored\n * in RTL; Up/Down when vertical), Home and End move focus and select (automatic activation); with\n * `selectTabOnFocus={false}` they only move focus, and Enter, Space or a click selects the focused\n * tab (manual activation). The selected tab is the only tab stop; disabled tabs are skipped. Every\n * tab needs a `value` that is unique within the TabList (a development warning names a value that\n * several tabs share).\n *\n * Tabs register through context and are found in DOM order, so they may be wrapped (a Fragment,\n * a Tooltip). The children render inside the `role=\"tablist\"` element, except panels, which render\n * after it: a `TabList.Panel` or `TabList.Panels` child, or a wrapper (an element, `Suspense`, an\n * error boundary) that holds panels and no Tab. A Panel that a component renders itself cannot be\n * seen from the children: put that component inside `TabList.Panels` (a development warning names\n * a Panel that ends up inside the tablist). Content that is not a tab, such as a button next to\n * the tabs, does not belong in a tablist either: render it outside the TabList.\n *\n * Sub-components are also exported under flat names (`TabListTab`, `TabListPanel`,\n * `TabListPanels`) for React Server Components, which cannot use the dotted form.\n */\nexport const TabList = /* @__PURE__ */ Object.assign(TabListRoot, {\n Tab,\n Panel: TabPanel,\n Panels: TabPanels,\n});\n\nexport { Tab as TabListTab, TabPanel as TabListPanel, TabPanels as TabListPanels };\n"],"mappings":"4jBAiDA,SAAS4B,EAAsB,EAAqB,CAClDX,EAAA,SACE,qBAAqBY,IACrB,0CAA0CA,EAAM,gIAElD,CACF,CAEA,SAASC,GAAkC,CACzC,IAAMC,EAAsD,CAAE,IAAK,IAAI,IAAO,MAAO,IAAI,GAAM,EACzFC,EAAY,IAAI,IAClBC,EAAQ,GACNC,MAAa,CACjBF,EAAU,QAAS,GAAaG,EAAS,CAAC,CAC5C,EACA,MAAO,CACL,SAAS,EAAM,EAAO,EAAI,CACxB,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,EAAAA,GAAG,MAAOI,EAAAA,UAAWwF,CAAS,EACzC,GAAInC,EACA,KACJ,kBAAiB8C,EACZ,MAEJ,UACE,CAAA,CAET,EACA,EAAS,YAAc,WAkBvB,IAAMrD,GAAa,CAAE,YAAW,WAAU,MAAK,GAAGO,MAChD,EAAAvC,EAAA,IAAA,CAAC,MAAD,CAAU,MAAK,UAAWlB,EAAAA,GAAG,iBAAkB4F,CAAS,EAAG,GAAInC,EAC5D,UACE,CAAA,EAEP,EAAU,YAAc,YAyBxB,IAAa+C,EAA0B,OAAO,OAAOxD,EAAa,CAChE,MACA,MAAOD,EACP,OAAQG,CACV,CAAC"}
1
+ {"version":3,"file":"TabList.cjs","names":["React","getElementType","resolveDeprecatedProp","useControllable","useRovingTabIndex","useEventCallback","useId","getPartId","useMergedRefs","cn","tabListClassNames","composeEventHandlers","tabListTabClassNames","disabledStyles","focusRingInset","tabListPanelClassNames","focusRing","tabListPanelsClassNames","require_runtime","require_cn","require_children","require_dev","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_useRovingTabIndex","require_useMergedRefs","require_styles","require_disclosureIds","react","react_jsx_runtime","warnDuplicateTabValue","value","createRegistry","entries","listeners","ready","emit","listener","map","part","ids","id","index","INERT_REGISTRY","TabListContext","INERT_CONTEXT","useTabListContext","component","isUnavailable","ariaDisabled","props","consumerId","collectStructure","node","child","into","type","Tab","TabPanel","TabListRoot","containsPart","TabPanels","rendersAfterTablist","TabListAreaContext","PANEL_IN_TABLIST_MESSAGE","valueProp","defaultValueProp","orientationProp","rest","selectedValue","defaultValue","defaultSelectedValue","orientation","vertical","onTabSelect","selected","setSelected","isControlled","onValueChange","structureKey","children","structure","parsed","derivesSelection","selectTabOnFocus","select","next","isSelected","getTabIndex","tabValue","baseId","registry","context","itemValue","panel","mergedRef","ref","containerProps","tabs","panels","keyed","key","isVertical","className","onKeyDown","onFocus","idProp","ctx","unavailable","mountedPanelId","panelId","onClick","insideTablist","mountedTabId","tabId","TabList"],"sources":["../../../src/components/layout/TabList.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n tabListClassNames,\n tabListPanelClassNames,\n tabListPanelsClassNames,\n tabListTabClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, getElementType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { disabledStyles, focusRing, focusRingInset } from '../../lib/styles';\nimport type { Orientation } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport { getPartId } from './disclosureIds';\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\ntype TabListPart = 'tab' | 'panel';\n\n/**\n * The ids of the mounted Tabs and Panels by value. A Tab references a panel only while one with\n * its value is mounted (a TabList used as a filter bar has none), and each side references the\n * other's actual id, a consumer `id` included. Read with `useSyncExternalStore`.\n *\n * Before the TabList has mounted (server HTML, hydration and the first client render) the\n * registry is not ready and the static structure of the children stands in for it; once it is\n * ready, it alone decides, so a Panel that is in the element tree but never mounts (inside a\n * wrapper that renders nothing) is not referenced.\n */\ninterface TabListRegistry {\n /** Registers a mounted Tab or Panel; returns the unregister function. */\n register: (part: TabListPart, value: string, id: string) => () => void;\n /**\n * Id of the first mounted Tab or Panel with this value, `null` when none is mounted, or\n * `undefined` while the registry is not ready (use the static structure then).\n */\n get: (part: TabListPart, value: string) => string | null | undefined;\n /** Called by the TabList once it (and so every Tab and Panel mounted with it) has mounted. */\n markReady: () => void;\n subscribe: (listener: () => void) => () => void;\n}\n\n/** Tabs that share a value share one id, and are selected and tab stops together. */\nfunction warnDuplicateTabValue(value: string): void {\n warnOnce(\n `TabList:duplicate:${value}`,\n `TabList: several tabs share the value \"${value}\". Tab values must be unique within a ` +\n 'TabList; tabs with the same value share one id and are selected (and tab stops) together.',\n );\n}\n\nfunction createRegistry(): TabListRegistry {\n const entries: Record<TabListPart, Map<string, string[]>> = { tab: new Map(), panel: new Map() };\n const listeners = new Set<() => void>();\n let ready = false;\n const emit = () => {\n listeners.forEach((listener) => listener());\n };\n return {\n register(part, value, id) {\n const map = entries[part];\n const ids = map.get(value) ?? [];\n // Called from the part's layout effect (C-DEV). Two Panels may share a value (the Tab links\n // to the first mounted one); two Tabs may not.\n if (part === 'tab' && ids.length > 0) warnDuplicateTabValue(value);\n map.set(value, [...ids, id]);\n emit();\n return () => {\n const ids = [...(map.get(value) ?? [])];\n const index = ids.indexOf(id);\n if (index !== -1) ids.splice(index, 1);\n if (ids.length > 0) map.set(value, ids);\n else map.delete(value);\n emit();\n };\n },\n get: (part, value) => (ready ? (entries[part].get(value)?.[0] ?? null) : undefined),\n markReady() {\n if (ready) return;\n ready = true;\n emit();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst INERT_REGISTRY: TabListRegistry = {\n register: () => () => {},\n get: () => undefined,\n markReady: () => {},\n subscribe: () => () => {},\n};\n\n/**\n * What the TabList's children show before anything mounts (server HTML and the first render):\n * found in the element tree through Fragments and the `children` of wrapper elements, but not\n * inside a component that renders a Tab or Panel itself (the registry covers those once mounted).\n */\ninterface TabListStructure {\n /** Value of the first Tab without `disabled`/`aria-disabled`: the uncontrolled default. */\n firstEnabled?: string;\n /** Consumer `id`s of Tabs, by value. */\n tabIds: Array<[string, string]>;\n /** Values of the Panels, each with its consumer `id` or `null`. */\n panels: Array<[string, string | null]>;\n}\n\ninterface TabListContextValue {\n orientation: Orientation;\n /** Whether the tab with this value is the selected one (explicit value, else the tab stop). */\n isSelected: (value: string) => boolean;\n /**\n * Activates a tab: a click (Enter and Space click the tab button), or with automatic activation\n * focus moved by the keys.\n */\n select: (value: string) => void;\n getTabIndex: (value: string) => 0 | -1;\n /** The generated id of a Tab or Panel (used when it has no consumer `id`). */\n getGeneratedId: (part: TabListPart, value: string) => string;\n /**\n * Id of the Tab with this value before the TabList mounts: its consumer `id`, else the\n * generated one.\n */\n getStaticTabId: (value: string) => string;\n /**\n * Id of the Panel with this value before the TabList mounts, or `undefined` when the children\n * have none.\n */\n getStaticPanelId: (value: string) => string | undefined;\n registry: TabListRegistry;\n}\n\nconst TabListContext = React.createContext<TabListContextValue | null>(null);\n\nconst INERT_CONTEXT: TabListContextValue = {\n orientation: 'horizontal',\n isSelected: () => false,\n select: () => {},\n getTabIndex: () => -1,\n getGeneratedId: (part, value) => `wave-tablist-inert-${part}-${value}`,\n getStaticTabId: (value) => `wave-tablist-inert-tab-${value}`,\n getStaticPanelId: () => undefined,\n registry: INERT_REGISTRY,\n};\n\n/** C-CONTEXT: throws in development, logs once and returns an inert value in production. */\nfunction useTabListContext(component: string): TabListContextValue {\n const context = React.useContext(TabListContext);\n if (context) return context;\n reportMissingContext(component, '<TabList>');\n return INERT_CONTEXT;\n}\n\ninterface StructureProps {\n value?: unknown;\n id?: unknown;\n disabled?: unknown;\n 'aria-disabled'?: unknown;\n children?: unknown;\n}\n\n/** Whether a Tab's props make it unavailable (it cannot be selected and is skipped by keys). */\nfunction isUnavailable(props: StructureProps): boolean {\n const ariaDisabled = props['aria-disabled'];\n return props.disabled === true || ariaDisabled === true || ariaDisabled === 'true';\n}\n\n/** A consumer `id` that replaces the generated one: a non-empty string (`''` counts as none). */\nfunction consumerId(id: unknown): string | null {\n return typeof id === 'string' && id !== '' ? id : null;\n}\n\n/**\n * Walks the element tree of the TabList's children (see {@link TabListStructure}). Parts are\n * identified through their element type, so parts written in a Server Component (lazy\n * references) count too. A `React.lazy` still loading (inside the consumer's own `<Suspense>`,\n * such as code-split panels in `TabList.Panels`) is no part and never suspends the TabList: its\n * children are walked instead. Runs during render only.\n */\nfunction collectStructure(node: unknown, into: TabListStructure): TabListStructure {\n if (Array.isArray(node)) {\n node.forEach((child) => collectStructure(child, into));\n return into;\n }\n if (!React.isValidElement<StructureProps>(node)) return into;\n const { props } = node;\n const type = getElementType(node, { suspend: false });\n const value = typeof props.value === 'string' ? props.value : undefined;\n if (type === Tab) {\n if (value !== undefined) {\n if (into.firstEnabled === undefined && !isUnavailable(props)) into.firstEnabled = value;\n const id = consumerId(props.id);\n if (id !== null) into.tabIds.push([value, id]);\n }\n return into;\n }\n if (type === TabPanel) {\n if (value !== undefined) into.panels.push([value, consumerId(props.id)]);\n return into;\n }\n if (type === TabListRoot) return into;\n return collectStructure(props.children, into);\n}\n\n/**\n * Whether an element tree shows a Tab, or a Panel (`TabList.Panel` or `TabList.Panels`), found as\n * in {@link collectStructure}: through Fragments and the `children` of wrapper elements, not inside\n * a nested TabList or a component that renders the part itself.\n */\nfunction containsPart(node: unknown, part: TabListPart): boolean {\n if (Array.isArray(node)) return node.some((child) => containsPart(child, part));\n if (!React.isValidElement<StructureProps>(node)) return false;\n const type = getElementType(node, { suspend: false });\n if (type === Tab) return part === 'tab';\n if (type === TabPanel || type === TabPanels) return part === 'panel';\n if (type === TabListRoot) return false;\n return containsPart(node.props.children, part);\n}\n\n/**\n * Whether a child of the TabList renders after the tablist: a Panel, `TabList.Panels`, or a\n * wrapper (an element, `Suspense`, an error boundary) that holds panels and no tab.\n */\nfunction rendersAfterTablist(child: React.ReactNode): boolean {\n return containsPart(child, 'panel') && !containsPart(child, 'tab');\n}\n\n/**\n * Where the TabList renders its children: inside the `role=\"tablist\"` element (`'tabs'`) or after\n * it (`'panels'`). A Panel that ends up inside the tablist warns in development.\n */\nconst TabListAreaContext = React.createContext<'tabs' | 'panels' | null>(null);\n\nconst PANEL_IN_TABLIST_MESSAGE =\n 'TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe ' +\n 'aria-required-children). The TabList moves a Panel after the tablist when it is its child, or ' +\n 'in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or ' +\n \"separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which \" +\n 'renders after the tablist.';\n\n/* ------------------------------------------------------------------ */\n/* TabList */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabList component. */\nexport interface TabListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * Controlled value of the selected tab (`''`: no tab selected). A controlled value that becomes\n * `undefined` also selects no tab: the TabList stays controlled.\n */\n value?: string;\n /**\n * Selected tab for uncontrolled usage. When it is omitted (or `''`), the first enabled tab\n * written in the TabList's children is selected, from the first render (and in server-rendered\n * HTML) on. Tabs written directly in the children, in Fragments or in wrapper elements that\n * pass them as `children` (such as a Tooltip) count; a tab rendered by a custom component that\n * renders `TabList.Tab` itself does not, even when it comes first in the DOM, so that server\n * and client pick the same tab. When every tab comes from such a component, the first enabled\n * tab in the DOM is selected once the tabs mount. To select a tab that a custom component\n * renders, pass `defaultValue`.\n */\n defaultValue?: string;\n /** Called with the new value when the selected tab changes (not when it is activated again). */\n onValueChange?: (value: string) => void;\n /**\n * Layout and arrow-key axis: `'horizontal'` (Left/Right, mirrored in RTL) or `'vertical'`\n * (Up/Down).\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * Whether moving focus with the arrow keys, Home and End also selects the tab (automatic\n * activation, as in 0.5). With `false`, the keys only move focus and Enter, Space or a click\n * selects the focused tab (manual activation, for panels that are slow to show). Fluent's\n * default is `false`.\n * @default true\n */\n selectTabOnFocus?: boolean;\n /** @deprecated Use `value`. */\n selectedValue?: string;\n /** @deprecated Use `defaultValue`. */\n defaultSelectedValue?: string;\n /**\n * @deprecated Use `onValueChange`. Unlike `onValueChange`, it is called on every activation,\n * including a click on the tab that is already selected.\n */\n onTabSelect?: (value: string) => void;\n /** @deprecated Use `orientation=\"vertical\"`. */\n vertical?: boolean;\n /** Ref to the `role=\"tablist\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst TabListRoot = ({\n value: valueProp,\n defaultValue: defaultValueProp,\n onValueChange,\n orientation: orientationProp,\n selectTabOnFocus = true,\n selectedValue,\n defaultSelectedValue,\n onTabSelect,\n vertical,\n className,\n children,\n onKeyDown,\n onFocus,\n ref,\n ...rest\n}: TabListProps) => {\n const value = resolveDeprecatedProp(\n 'TabList',\n valueProp,\n selectedValue,\n 'selectedValue',\n 'value',\n );\n const defaultValue = resolveDeprecatedProp(\n 'TabList',\n defaultValueProp,\n defaultSelectedValue,\n 'defaultSelectedValue',\n 'defaultValue',\n );\n const orientation =\n resolveDeprecatedProp<Orientation>(\n 'TabList',\n orientationProp,\n vertical === undefined ? undefined : vertical ? 'vertical' : 'horizontal',\n 'vertical',\n 'orientation',\n ) ?? 'horizontal';\n if (onTabSelect) {\n warnDeprecated(\n 'TabList',\n 'onTabSelect',\n 'onValueChange',\n '`onValueChange` is called only when the selected tab changes.',\n );\n }\n\n // The sticky mode: a controlled value that becomes `undefined` clears the selection (`''`).\n const [selected, setSelected, isControlled] = useControllable(\n value,\n defaultValue ?? '',\n onValueChange,\n );\n\n // The children are a new element tree on every parent render: memoized by content, so the\n // context value stays stable while the tabs and panels stay the same.\n const structureKey = JSON.stringify(collectStructure(children, { tabIds: [], panels: [] }));\n const structure = React.useMemo(() => {\n const parsed = JSON.parse(structureKey) as TabListStructure;\n return {\n firstEnabled: parsed.firstEnabled,\n tabIds: new Map(parsed.tabIds),\n panels: new Map(parsed.panels),\n };\n }, [structureKey]);\n\n // Uncontrolled without a selection: the first enabled tab is selected. It is the tab stop the\n // roving store resolves from `activeValue` (the first enabled tab of the children, replaced by\n // the first enabled tab in the DOM once the store sees it disabled), so the selection is\n // derived during render, present from the first render on, and follows tabs that disable\n // themselves.\n const derivesSelection = !isControlled && selected === '';\n\n const { containerProps, getTabIndex } = useRovingTabIndex({\n activeValue: derivesSelection ? (structure.firstEnabled ?? null) : selected,\n orientation,\n loop: true,\n // Automatic activation (APG Tabs): moving focus selects the tab. With manual activation the\n // keys only move focus; the tab stop stays on the selected tab (`tabStop: 'active'`), and Enter\n // or Space selects the focused tab through its native click.\n onFocusMove: selectTabOnFocus ? (next) => select(next) : undefined,\n });\n\n const isSelected = React.useCallback(\n (tabValue: string) => (derivesSelection ? getTabIndex(tabValue) === 0 : selected === tabValue),\n [derivesSelection, getTabIndex, selected],\n );\n\n const select = useEventCallback((next: string) => {\n onTabSelect?.(next);\n if (!isSelected(next)) setSelected(next);\n });\n\n const baseId = useId('tablist');\n const [registry] = React.useState(createRegistry);\n // Runs after the layout effects of the Tabs and Panels mounted with the TabList, which have\n // registered by then: from here on the registry, not the static structure, decides the links.\n React.useLayoutEffect(() => registry.markReady(), [registry]);\n const context = React.useMemo<TabListContextValue>(\n () => ({\n orientation,\n isSelected,\n select,\n getTabIndex,\n getGeneratedId: (part, itemValue) => getPartId(baseId, part, itemValue),\n getStaticTabId: (tabValue) =>\n structure.tabIds.get(tabValue) ?? getPartId(baseId, 'tab', tabValue),\n getStaticPanelId: (tabValue) => {\n const panel = structure.panels.get(tabValue);\n if (panel === undefined) return undefined;\n return panel ?? getPartId(baseId, 'panel', tabValue);\n },\n registry,\n }),\n [orientation, isSelected, select, getTabIndex, baseId, structure, registry],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const tabs: React.ReactNode[] = [];\n const panels: React.ReactNode[] = [];\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n (rendersAfterTablist(child) ? panels : tabs).push(keyed);\n });\n\n const isVertical = orientation === 'vertical';\n return (\n <TabListContext.Provider value={context}>\n <div className={cn(isVertical && 'flex')}>\n <div\n role=\"tablist\"\n aria-orientation={orientation}\n className={cn(\n tabListClassNames.root,\n isVertical\n ? 'flex w-40 flex-col border-e border-border'\n : 'flex border-b border-border',\n className,\n )}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, containerProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n ref={mergedRef}\n >\n <TabListAreaContext.Provider value=\"tabs\">{tabs}</TabListAreaContext.Provider>\n </div>\n <TabListAreaContext.Provider value=\"panels\">{panels}</TabListAreaContext.Provider>\n </div>\n </TabListContext.Provider>\n );\n};\nTabListRoot.displayName = 'TabList';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Tab */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Tab sub-component. */\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique value identifying this tab (and its panel). */\n value: string;\n /** Ref to the tab `<button>`. */\n ref?: React.Ref<HTMLButtonElement>;\n}\n\n/**\n * A tab button. `onClick` runs before the selection (call `event.preventDefault()` to keep the\n * current tab). A `disabled` (or `aria-disabled=\"true\"`) tab is skipped by the keyboard and cannot\n * be selected. A non-empty `id` replaces the generated one (its panel's `aria-labelledby` follows\n * it). The selected tab references its panel with `aria-controls` only while a `TabList.Panel`\n * with its value is mounted.\n */\nconst Tab = ({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps) => {\n const ctx = useTabListContext('TabList.Tab');\n const selected = ctx.isSelected(value);\n const isVertical = ctx.orientation === 'vertical';\n const unavailable = isUnavailable(rest);\n\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('tab', value);\n React.useLayoutEffect(() => registry.register('tab', value, id), [registry, value, id]);\n const mountedPanelId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('panel', value),\n () => undefined,\n );\n // Before the TabList mounts the static structure stands in; after that only a mounted panel is\n // referenced (`null`: none).\n const panelId =\n mountedPanelId === undefined ? ctx.getStaticPanelId(value) : (mountedPanelId ?? undefined);\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n className={cn(\n tabListTabClassNames.root,\n 'px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none',\n isVertical && 'text-start',\n selected\n ? cn(\n 'text-primary',\n isVertical ? 'border-s-2 border-s-primary' : 'border-b-2 border-b-primary',\n )\n : 'text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground',\n disabledStyles,\n focusRingInset,\n className,\n )}\n {...rest}\n id={id}\n aria-selected={selected}\n aria-controls={selected ? panelId : undefined}\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={selected ? '' : undefined}\n onClick={composeEventHandlers(onClick, () => {\n if (!unavailable) ctx.select(value);\n })}\n ref={ref}\n >\n {children}\n </button>\n );\n};\nTab.displayName = 'Tab';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panel */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanel sub-component. */\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value of the Tab that shows this panel. */\n value: string;\n /** Ref to the `role=\"tabpanel\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The content of one tab, rendered only while its tab is selected and labelled by it (while a Tab\n * with its value is mounted). A non-empty `id` replaces the generated one (the tab's\n * `aria-controls` follows it).\n */\nconst TabPanel = ({ value, id: idProp, children, className, ref, ...rest }: TabPanelProps) => {\n const ctx = useTabListContext('TabList.Panel');\n const insideTablist = React.useContext(TabListAreaContext) === 'tabs';\n React.useEffect(() => {\n if (insideTablist) warnOnce('TabList.Panel:inside-tablist', PANEL_IN_TABLIST_MESSAGE);\n }, [insideTablist]);\n const { registry } = ctx;\n const id = consumerId(idProp) ?? ctx.getGeneratedId('panel', value);\n // Registered while mounted, also while hidden: the tab that selects it links to it.\n React.useLayoutEffect(() => registry.register('panel', value, id), [registry, value, id]);\n const mountedTabId = React.useSyncExternalStore(\n registry.subscribe,\n () => registry.get('tab', value),\n () => undefined,\n );\n if (!ctx.isSelected(value)) return null;\n // As for the Tab's aria-controls: the static structure only before the TabList mounts.\n const tabId =\n mountedTabId === undefined ? ctx.getStaticTabId(value) : (mountedTabId ?? undefined);\n return (\n <div\n role=\"tabpanel\"\n tabIndex={0}\n className={cn(tabListPanelClassNames.root, 'p-4', focusRing, className)}\n {...rest}\n id={id}\n aria-labelledby={tabId}\n ref={ref}\n >\n {children}\n </div>\n );\n};\nTabPanel.displayName = 'TabPanel';\n\n/* ------------------------------------------------------------------ */\n/* TabList.Panels */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TabPanels sub-component. */\nexport interface TabPanelsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Ref to the container `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Optional container for the panels, rendered after the tablist. Use it to style the panel area,\n * and for panels that components render themselves: the TabList finds a Panel in its children, in\n * a Fragment or in a wrapper that holds no Tab, but a component that renders a Panel itself\n * renders inside the tablist unless it is placed in `TabList.Panels`.\n */\nconst TabPanels = ({ className, children, ref, ...rest }: TabPanelsProps) => (\n <div\n ref={ref}\n className={cn(tabListPanelsClassNames.root, 'min-w-0 flex-1', className)}\n {...rest}\n >\n {children}\n </div>\n);\nTabPanels.displayName = 'TabPanels';\n\n/* ------------------------------------------------------------------ */\n/* Export */\n/* ------------------------------------------------------------------ */\n\n/**\n * A set of tabs with their panels (WAI-ARIA Tabs pattern): the arrow keys (Left/Right, mirrored\n * in RTL; Up/Down when vertical), Home and End move focus and select (automatic activation); with\n * `selectTabOnFocus={false}` they only move focus, and Enter, Space or a click selects the focused\n * tab (manual activation). The selected tab is the only tab stop; disabled tabs are skipped. Every\n * tab needs a `value` that is unique within the TabList (a development warning names a value that\n * several tabs share).\n *\n * Tabs register through context and are found in DOM order, so they may be wrapped (a Fragment,\n * a Tooltip). The children render inside the `role=\"tablist\"` element, except panels, which render\n * after it: a `TabList.Panel` or `TabList.Panels` child, or a wrapper (an element, `Suspense`, an\n * error boundary) that holds panels and no Tab. A Panel that a component renders itself cannot be\n * seen from the children: put that component inside `TabList.Panels` (a development warning names\n * a Panel that ends up inside the tablist). Content that is not a tab, such as a button next to\n * the tabs, does not belong in a tablist either: render it outside the TabList.\n *\n * Sub-components are also exported under flat names (`TabListTab`, `TabListPanel`,\n * `TabListPanels`) for React Server Components, which cannot use the dotted form.\n */\nexport const TabList = /* @__PURE__ */ Object.assign(TabListRoot, {\n Tab,\n Panel: TabPanel,\n Panels: TabPanels,\n});\n\nexport { Tab as TabListTab, TabPanel as TabListPanel, TabPanels as TabListPanels };\n"],"mappings":"kmBAuDA,SAASiC,EAAsB,EAAqB,CAClDZ,EAAA,SACE,qBAAqBa,IACrB,0CAA0CA,EAAM,gIAElD,CACF,CAEA,SAASC,GAAkC,CACzC,IAAMC,EAAsD,CAAE,IAAK,IAAI,IAAO,MAAO,IAAI,GAAM,EACzFC,EAAY,IAAI,IAClBC,EAAQ,GACNC,MAAa,CACjBF,EAAU,QAAS,GAAaG,EAAS,CAAC,CAC5C,EACA,MAAO,CACL,SAAS,EAAM,EAAO,EAAI,CACxB,IAAMC,EAAML,EAAQM,GACdC,EAAMF,EAAI,IAAIP,CAAK,GAAK,CAAC,EAM/B,OAHIQ,IAAS,OAASC,EAAI,OAAS,GAAGV,EAAsBC,CAAK,EACjEO,EAAI,IAAIP,EAAO,CAAC,GAAGS,EAAKC,CAAE,CAAC,EAC3BL,EAAK,MACQ,CACX,IAAMI,EAAM,CAAC,GAAIF,EAAI,IAAIP,CAAK,GAAK,CAAC,CAAE,EAChCW,EAAQF,EAAI,QAAQC,CAAE,EACxBC,IAAU,IAAIF,EAAI,OAAOE,EAAO,CAAC,EACjCF,EAAI,OAAS,EAAGF,EAAI,IAAIP,EAAOS,CAAG,EACjCF,EAAI,OAAOP,CAAK,EACrBK,EAAK,CACP,CACF,EACA,KAAM,EAAM,IAAWD,EAASF,EAAQM,EAAK,CAAC,IAAIR,CAAK,CAAC,GAAG,IAAM,KAAQ,IAAA,GACzE,WAAY,CACNI,IACJ,EAAQ,GACRC,EAAK,EACP,EACA,UAAU,EAAU,CAElB,OADAF,EAAU,IAAIG,CAAQ,MACT,CACXH,EAAU,OAAOG,CAAQ,CAC3B,CACF,CACF,CACF,CAEA,IAAMM,EAAkC,CACtC,iBAA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,SAAS,+BAAgC8C,CAAwB,CACtF,EAAG,CAACgD,CAAa,CAAC,EAClB,GAAM,CAAE,YAAaL,EACflE,EAAKU,EAAWuD,CAAM,GAAKC,EAAI,eAAe,QAAS5E,CAAK,EAElEH,EAAM,oBAAsB+D,EAAS,SAAS,QAAS5D,EAAOU,CAAE,EAAG,CAACkD,EAAU5D,EAAOU,CAAE,CAAC,EACxF,IAAMwE,EAAepH,EAAM,qBACzB8F,EAAS,cACHA,EAAS,IAAI,MAAO5D,CAAK,MACzB,IAAA,EACR,EACA,GAAI,CAAC4E,EAAI,WAAW5E,CAAK,EAAG,OAAO,KAEnC,IAAMmF,EACJD,IAAiB,IAAA,GAAYN,EAAI,eAAe5E,CAAK,EAAKkF,GAAgB,IAAA,GAC5E,OACE,EAAApF,EAAA,IAAA,CAAC,MAAD,CACE,KAAK,WACL,SAAU,EACV,UAAWvB,EAAAA,GAAGM,EAAAA,uBAAuB,KAAM,MAAOC,EAAAA,UAAW0F,CAAS,EACtE,GAAInC,EACA,KACJ,kBAAiB8C,EACZ,MAEJ,UACE,CAAA,CAET,EACA,EAAS,YAAc,WAkBvB,IAAMrD,GAAa,CAAE,YAAW,WAAU,MAAK,GAAGO,MAChD,EAAAvC,EAAA,IAAA,CAAC,MAAD,CACO,MACL,UAAWvB,EAAAA,GAAGQ,EAAAA,wBAAwB,KAAM,iBAAkByF,CAAS,EACvE,GAAInC,EAEH,UACE,CAAA,EAEP,EAAU,YAAc,YAyBxB,IAAa+C,EAA0B,OAAO,OAAOxD,EAAa,CAChE,MACA,MAAOD,EACP,OAAQG,CACV,CAAC"}
@@ -3,20 +3,21 @@ import { cn as e } from "../../lib/cn.mjs";
3
3
  import { flattenChildren as t, getElementType as n } from "../../lib/children.mjs";
4
4
  import { reportMissingContext as r, resolveDeprecatedProp as i, warnDeprecated as a, warnOnce as o } from "../../lib/dev.mjs";
5
5
  import { composeEventHandlers as s } from "../../lib/composeEventHandlers.mjs";
6
- import { useEventCallback as c } from "../../hooks/useEventCallback.mjs";
7
- import { useControllable as l } from "../../hooks/useControllable.mjs";
8
- import { useId as u } from "../../hooks/useId.mjs";
9
- import { useRovingTabIndex as d } from "../../hooks/useRovingTabIndex.mjs";
10
- import { useMergedRefs as f } from "../../hooks/useMergedRefs.mjs";
11
- import { disabledStyles as p, focusRing as m, focusRingInset as h } from "../../lib/styles.mjs";
12
- import { getPartId as g } from "./disclosureIds.mjs";
13
- import * as _ from "react";
14
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
6
+ import { tabListClassNames as c, tabListPanelClassNames as l, tabListPanelsClassNames as u, tabListTabClassNames as d } from "../../lib/classNames.mjs";
7
+ import { useEventCallback as f } from "../../hooks/useEventCallback.mjs";
8
+ import { useControllable as p } from "../../hooks/useControllable.mjs";
9
+ import { useId as m } from "../../hooks/useId.mjs";
10
+ import { useRovingTabIndex as h } from "../../hooks/useRovingTabIndex.mjs";
11
+ import { useMergedRefs as g } from "../../hooks/useMergedRefs.mjs";
12
+ import { disabledStyles as _, focusRing as v, focusRingInset as y } from "../../lib/styles.mjs";
13
+ import { getPartId as b } from "./disclosureIds.mjs";
14
+ import * as x from "react";
15
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
15
16
  //#region src/components/layout/TabList.tsx
16
- function b(e) {
17
+ function w(e) {
17
18
  o(`TabList:duplicate:${e}`, `TabList: several tabs share the value "${e}". Tab values must be unique within a TabList; tabs with the same value share one id and are selected (and tab stops) together.`);
18
19
  }
19
- function x() {
20
+ function T() {
20
21
  let e = {
21
22
  tab: /* @__PURE__ */ new Map(),
22
23
  panel: /* @__PURE__ */ new Map()
@@ -26,7 +27,7 @@ function x() {
26
27
  return {
27
28
  register(t, n, i) {
28
29
  let a = e[t], o = a.get(n) ?? [];
29
- return t === "tab" && o.length > 0 && b(n), a.set(n, [...o, i]), r(), () => {
30
+ return t === "tab" && o.length > 0 && w(n), a.set(n, [...o, i]), r(), () => {
30
31
  let e = [...a.get(n) ?? []], t = e.indexOf(i);
31
32
  t !== -1 && e.splice(t, 1), e.length > 0 ? a.set(n, e) : a.delete(n), r();
32
33
  };
@@ -42,12 +43,12 @@ function x() {
42
43
  }
43
44
  };
44
45
  }
45
- var S = {
46
+ var E = {
46
47
  register: () => () => {},
47
48
  get: () => void 0,
48
49
  markReady: () => {},
49
50
  subscribe: () => () => {}
50
- }, C = _.createContext(null), w = {
51
+ }, D = x.createContext(null), O = {
51
52
  orientation: "horizontal",
52
53
  isSelected: () => !1,
53
54
  select: () => {},
@@ -55,184 +56,184 @@ var S = {
55
56
  getGeneratedId: (e, t) => `wave-tablist-inert-${e}-${t}`,
56
57
  getStaticTabId: (e) => `wave-tablist-inert-tab-${e}`,
57
58
  getStaticPanelId: () => void 0,
58
- registry: S
59
+ registry: E
59
60
  };
60
- function T(e) {
61
- return _.useContext(C) || (r(e, "<TabList>"), w);
61
+ function k(e) {
62
+ return x.useContext(D) || (r(e, "<TabList>"), O);
62
63
  }
63
- function E(e) {
64
+ function A(e) {
64
65
  let t = e["aria-disabled"];
65
66
  return e.disabled === !0 || t === !0 || t === "true";
66
67
  }
67
- function D(e) {
68
+ function j(e) {
68
69
  return typeof e == "string" && e !== "" ? e : null;
69
70
  }
70
- function O(e, t) {
71
- if (Array.isArray(e)) return e.forEach((e) => O(e, t)), t;
72
- if (!_.isValidElement(e)) return t;
71
+ function M(e, t) {
72
+ if (Array.isArray(e)) return e.forEach((e) => M(e, t)), t;
73
+ if (!x.isValidElement(e)) return t;
73
74
  let { props: r } = e, i = n(e, { suspend: !1 }), a = typeof r.value == "string" ? r.value : void 0;
74
- if (i === P) {
75
+ if (i === R) {
75
76
  if (a !== void 0) {
76
- t.firstEnabled === void 0 && !E(r) && (t.firstEnabled = a);
77
- let e = D(r.id);
77
+ t.firstEnabled === void 0 && !A(r) && (t.firstEnabled = a);
78
+ let e = j(r.id);
78
79
  e !== null && t.tabIds.push([a, e]);
79
80
  }
80
81
  return t;
81
82
  }
82
- return i === F ? (a !== void 0 && t.panels.push([a, D(r.id)]), t) : i === N ? t : O(r.children, t);
83
+ return i === z ? (a !== void 0 && t.panels.push([a, j(r.id)]), t) : i === L ? t : M(r.children, t);
83
84
  }
84
- function k(e, t) {
85
- if (Array.isArray(e)) return e.some((e) => k(e, t));
86
- if (!_.isValidElement(e)) return !1;
85
+ function N(e, t) {
86
+ if (Array.isArray(e)) return e.some((e) => N(e, t));
87
+ if (!x.isValidElement(e)) return !1;
87
88
  let r = n(e, { suspend: !1 });
88
- return r === P ? t === "tab" : r === F || r === I ? t === "panel" : r !== N && k(e.props.children, t);
89
+ return r === R ? t === "tab" : r === z || r === B ? t === "panel" : r !== L && N(e.props.children, t);
89
90
  }
90
- function A(e) {
91
- return k(e, "panel") && !k(e, "tab");
91
+ function P(e) {
92
+ return N(e, "panel") && !N(e, "tab");
92
93
  }
93
- var j = _.createContext(null), M = "TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe aria-required-children). The TabList moves a Panel after the tablist when it is its child, or in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which renders after the tablist.", N = ({ value: n, defaultValue: r, onValueChange: o, orientation: p, selectTabOnFocus: m = !0, selectedValue: h, defaultSelectedValue: b, onTabSelect: S, vertical: w, className: T, children: E, onKeyDown: D, onFocus: k, ref: M, ...N }) => {
94
- let P = i("TabList", n, h, "selectedValue", "value"), F = i("TabList", r, b, "defaultSelectedValue", "defaultValue"), I = i("TabList", p, w === void 0 ? void 0 : w ? "vertical" : "horizontal", "vertical", "orientation") ?? "horizontal";
95
- S && a("TabList", "onTabSelect", "onValueChange", "`onValueChange` is called only when the selected tab changes.");
96
- let [L, R, z] = l(P, F ?? "", o), B = JSON.stringify(O(E, {
94
+ var F = x.createContext(null), I = "TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe aria-required-children). The TabList moves a Panel after the tablist when it is its child, or in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which renders after the tablist.", L = ({ value: n, defaultValue: r, onValueChange: o, orientation: l, selectTabOnFocus: u = !0, selectedValue: d, defaultSelectedValue: _, onTabSelect: v, vertical: y, className: w, children: E, onKeyDown: O, onFocus: k, ref: A, ...j }) => {
95
+ let N = i("TabList", n, d, "selectedValue", "value"), I = i("TabList", r, _, "defaultSelectedValue", "defaultValue"), L = i("TabList", l, y === void 0 ? void 0 : y ? "vertical" : "horizontal", "vertical", "orientation") ?? "horizontal";
96
+ v && a("TabList", "onTabSelect", "onValueChange", "`onValueChange` is called only when the selected tab changes.");
97
+ let [R, z, B] = p(N, I ?? "", o), V = JSON.stringify(M(E, {
97
98
  tabIds: [],
98
99
  panels: []
99
- })), V = _.useMemo(() => {
100
- let e = JSON.parse(B);
100
+ })), H = x.useMemo(() => {
101
+ let e = JSON.parse(V);
101
102
  return {
102
103
  firstEnabled: e.firstEnabled,
103
104
  tabIds: new Map(e.tabIds),
104
105
  panels: new Map(e.panels)
105
106
  };
106
- }, [B]), H = !z && L === "", { containerProps: U, getTabIndex: W } = d({
107
- activeValue: H ? V.firstEnabled ?? null : L,
108
- orientation: I,
107
+ }, [V]), U = !B && R === "", { containerProps: W, getTabIndex: G } = h({
108
+ activeValue: U ? H.firstEnabled ?? null : R,
109
+ orientation: L,
109
110
  loop: !0,
110
- onFocusMove: m ? (e) => K(e) : void 0
111
- }), G = _.useCallback((e) => H ? W(e) === 0 : L === e, [
112
- H,
113
- W,
114
- L
115
- ]), K = c((e) => {
116
- S?.(e), G(e) || R(e);
117
- }), q = u("tablist"), [J] = _.useState(x);
118
- _.useLayoutEffect(() => J.markReady(), [J]);
119
- let Y = _.useMemo(() => ({
120
- orientation: I,
121
- isSelected: G,
122
- select: K,
123
- getTabIndex: W,
124
- getGeneratedId: (e, t) => g(q, e, t),
125
- getStaticTabId: (e) => V.tabIds.get(e) ?? g(q, "tab", e),
111
+ onFocusMove: u ? (e) => q(e) : void 0
112
+ }), K = x.useCallback((e) => U ? G(e) === 0 : R === e, [
113
+ U,
114
+ G,
115
+ R
116
+ ]), q = f((e) => {
117
+ v?.(e), K(e) || z(e);
118
+ }), J = m("tablist"), [Y] = x.useState(T);
119
+ x.useLayoutEffect(() => Y.markReady(), [Y]);
120
+ let X = x.useMemo(() => ({
121
+ orientation: L,
122
+ isSelected: K,
123
+ select: q,
124
+ getTabIndex: G,
125
+ getGeneratedId: (e, t) => b(J, e, t),
126
+ getStaticTabId: (e) => H.tabIds.get(e) ?? b(J, "tab", e),
126
127
  getStaticPanelId: (e) => {
127
- let t = V.panels.get(e);
128
- if (t !== void 0) return t ?? g(q, "panel", e);
128
+ let t = H.panels.get(e);
129
+ if (t !== void 0) return t ?? b(J, "panel", e);
129
130
  },
130
- registry: J
131
+ registry: Y
131
132
  }), [
132
- I,
133
- G,
133
+ L,
134
134
  K,
135
- W,
136
135
  q,
137
- V,
138
- J
139
- ]), X = f(M, U.ref), Z = [], Q = [];
136
+ G,
137
+ J,
138
+ H,
139
+ Y
140
+ ]), ee = g(A, W.ref), Z = [], Q = [];
140
141
  t(E).forEach(({ key: e, node: t }) => {
141
- let n = /* @__PURE__ */ v(_.Fragment, { children: t }, e);
142
- (A(t) ? Q : Z).push(n);
142
+ let n = /* @__PURE__ */ S(x.Fragment, { children: t }, e);
143
+ (P(t) ? Q : Z).push(n);
143
144
  });
144
- let $ = I === "vertical";
145
- return /* @__PURE__ */ v(C.Provider, {
146
- value: Y,
147
- children: /* @__PURE__ */ y("div", {
145
+ let $ = L === "vertical";
146
+ return /* @__PURE__ */ S(D.Provider, {
147
+ value: X,
148
+ children: /* @__PURE__ */ C("div", {
148
149
  className: e($ && "flex"),
149
- children: [/* @__PURE__ */ v("div", {
150
+ children: [/* @__PURE__ */ S("div", {
150
151
  role: "tablist",
151
- "aria-orientation": I,
152
- className: e($ ? "flex w-40 flex-col border-e border-border" : "flex border-b border-border", T),
153
- ...N,
152
+ "aria-orientation": L,
153
+ className: e(c.root, $ ? "flex w-40 flex-col border-e border-border" : "flex border-b border-border", w),
154
+ ...j,
154
155
  "data-roving-container": "",
155
- onKeyDown: s(D, U.onKeyDown),
156
- onFocus: s(k, U.onFocus, { checkDefaultPrevented: !1 }),
157
- ref: X,
158
- children: /* @__PURE__ */ v(j.Provider, {
156
+ onKeyDown: s(O, W.onKeyDown),
157
+ onFocus: s(k, W.onFocus, { checkDefaultPrevented: !1 }),
158
+ ref: ee,
159
+ children: /* @__PURE__ */ S(F.Provider, {
159
160
  value: "tabs",
160
161
  children: Z
161
162
  })
162
- }), /* @__PURE__ */ v(j.Provider, {
163
+ }), /* @__PURE__ */ S(F.Provider, {
163
164
  value: "panels",
164
165
  children: Q
165
166
  })]
166
167
  })
167
168
  });
168
169
  };
169
- N.displayName = "TabList";
170
- var P = ({ value: t, id: n, className: r, children: i, onClick: a, ref: o, ...c }) => {
171
- let l = T("TabList.Tab"), u = l.isSelected(t), d = l.orientation === "vertical", f = E(c), { registry: m } = l, g = D(n) ?? l.getGeneratedId("tab", t);
172
- _.useLayoutEffect(() => m.register("tab", t, g), [
170
+ L.displayName = "TabList";
171
+ var R = ({ value: t, id: n, className: r, children: i, onClick: a, ref: o, ...c }) => {
172
+ let l = k("TabList.Tab"), u = l.isSelected(t), f = l.orientation === "vertical", p = A(c), { registry: m } = l, h = j(n) ?? l.getGeneratedId("tab", t);
173
+ x.useLayoutEffect(() => m.register("tab", t, h), [
173
174
  m,
174
175
  t,
175
- g
176
+ h
176
177
  ]);
177
- let y = _.useSyncExternalStore(m.subscribe, () => m.get("panel", t), () => void 0), b = y === void 0 ? l.getStaticPanelId(t) : y ?? void 0;
178
- return /* @__PURE__ */ v("button", {
178
+ let g = x.useSyncExternalStore(m.subscribe, () => m.get("panel", t), () => void 0), v = g === void 0 ? l.getStaticPanelId(t) : g ?? void 0;
179
+ return /* @__PURE__ */ S("button", {
179
180
  type: "button",
180
181
  role: "tab",
181
- className: e("px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none", d && "text-start", u ? e("text-primary", d ? "border-s-2 border-s-primary" : "border-b-2 border-b-primary") : "text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground", p, h, r),
182
+ className: e(d.root, "px-4 py-2 text-body-1 font-semibold transition-colors motion-reduce:transition-none", f && "text-start", u ? e("text-primary", f ? "border-s-2 border-s-primary" : "border-b-2 border-b-primary") : "text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground", _, y, r),
182
183
  ...c,
183
- id: g,
184
+ id: h,
184
185
  "aria-selected": u,
185
- "aria-controls": u ? b : void 0,
186
+ "aria-controls": u ? v : void 0,
186
187
  tabIndex: l.getTabIndex(t),
187
188
  "data-roving-value": t,
188
189
  "data-selected": u ? "" : void 0,
189
190
  onClick: s(a, () => {
190
- f || l.select(t);
191
+ p || l.select(t);
191
192
  }),
192
193
  ref: o,
193
194
  children: i
194
195
  });
195
196
  };
196
- P.displayName = "Tab";
197
- var F = ({ value: t, id: n, children: r, className: i, ref: a, ...s }) => {
198
- let c = T("TabList.Panel"), l = _.useContext(j) === "tabs";
199
- _.useEffect(() => {
200
- l && o("TabList.Panel:inside-tablist", M);
201
- }, [l]);
202
- let { registry: u } = c, d = D(n) ?? c.getGeneratedId("panel", t);
203
- _.useLayoutEffect(() => u.register("panel", t, d), [
204
- u,
197
+ R.displayName = "Tab";
198
+ var z = ({ value: t, id: n, children: r, className: i, ref: a, ...s }) => {
199
+ let c = k("TabList.Panel"), u = x.useContext(F) === "tabs";
200
+ x.useEffect(() => {
201
+ u && o("TabList.Panel:inside-tablist", I);
202
+ }, [u]);
203
+ let { registry: d } = c, f = j(n) ?? c.getGeneratedId("panel", t);
204
+ x.useLayoutEffect(() => d.register("panel", t, f), [
205
+ d,
205
206
  t,
206
- d
207
+ f
207
208
  ]);
208
- let f = _.useSyncExternalStore(u.subscribe, () => u.get("tab", t), () => void 0);
209
+ let p = x.useSyncExternalStore(d.subscribe, () => d.get("tab", t), () => void 0);
209
210
  if (!c.isSelected(t)) return null;
210
- let p = f === void 0 ? c.getStaticTabId(t) : f ?? void 0;
211
- return /* @__PURE__ */ v("div", {
211
+ let m = p === void 0 ? c.getStaticTabId(t) : p ?? void 0;
212
+ return /* @__PURE__ */ S("div", {
212
213
  role: "tabpanel",
213
214
  tabIndex: 0,
214
- className: e("p-4", m, i),
215
+ className: e(l.root, "p-4", v, i),
215
216
  ...s,
216
- id: d,
217
- "aria-labelledby": p,
217
+ id: f,
218
+ "aria-labelledby": m,
218
219
  ref: a,
219
220
  children: r
220
221
  });
221
222
  };
222
- F.displayName = "TabPanel";
223
- var I = ({ className: t, children: n, ref: r, ...i }) => /* @__PURE__ */ v("div", {
223
+ z.displayName = "TabPanel";
224
+ var B = ({ className: t, children: n, ref: r, ...i }) => /* @__PURE__ */ S("div", {
224
225
  ref: r,
225
- className: e("min-w-0 flex-1", t),
226
+ className: e(u.root, "min-w-0 flex-1", t),
226
227
  ...i,
227
228
  children: n
228
229
  });
229
- I.displayName = "TabPanels";
230
- var L = /* @__PURE__ */ Object.assign(N, {
231
- Tab: P,
232
- Panel: F,
233
- Panels: I
230
+ B.displayName = "TabPanels";
231
+ var V = /* @__PURE__ */ Object.assign(L, {
232
+ Tab: R,
233
+ Panel: z,
234
+ Panels: B
234
235
  });
235
236
  //#endregion
236
- export { L as TabList, F as TabListPanel, I as TabListPanels, P as TabListTab };
237
+ export { V as TabList, z as TabListPanel, B as TabListPanels, R as TabListTab };
237
238
 
238
239
  //# sourceMappingURL=TabList.mjs.map