@mortenbrudvik/waveui 0.4.0 → 0.7.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 (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBar.cjs","names":["DismissIcon","Button","isElementOfType","BUTTON_OWN_PROP_KEYS","materialiseSlotContent","slotRendersContent","renderSlot","placeButtonIcon","hasTextLabel","resolveSlot","cn","slotWrapsDefaultContent","React","STATUS_ICON_COLOR","StatusIcon","observeTextLabel","hasRenderedTextLabel","useMergedRefs","mergeProps","focusRing","mergedAriaDisabledClasses","MERGED_DISABLED_FOCUSABLE_PROPS","STATUS_BORDER","StatusText","getStatusLabel","require_runtime","require_cn","require_children","require_dev","require_slot","require_useMergedRefs","require_styles","require_Button","require_icons","require_mergeProps","require_Button_slots","require_labelInName","require_MessageBar_status","react","react_jsx_runtime","tintClasses","DEFAULT_DISMISS_LABEL","BUTTON_ONLY_KEYS","NAMING_KEYS","HANDLER_KEY","dismissContentClassName","noop","defaultDismissContent","isButtonType","type","defaultDismiss","resolveDismiss","dismiss","element","buttonProps","key","value","isWaveButton","markup","children","icon","iconNode","resolved","asButton","Component","isButtonObject","props","contentProps","ContentTag","elementProps","inner","MessageBar","rest","iconClassName","status","renderedIcon","dismissParts","onDismiss","dismissWarning","slotRef","slotButtonProps","hasOwnName","checksContent","literalTextLabel","labelTarget","setLabelTarget","subscribeToContent","onChange","contentHasTextLabel","namedByContent","dismissRef","renderedDismiss","className","statusLabel"],"sources":["../../../src/components/feedback/MessageBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Status, Slot, SlotObject } from '../../lib/types';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport {\n STATUS_BORDER,\n STATUS_ICON_COLOR,\n StatusIcon,\n StatusText,\n getStatusLabel,\n} from './MessageBar.status';\n\n/** Properties for the MessageBar component. */\nexport interface MessageBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Status level controlling the color, icon, status text and role of the message bar.\n * `warning` and `error` render `role=\"alert\"`, `info` and `success` `role=\"status\"` (a consumer\n * `role` wins).\n * @default 'info'\n */\n status?: Status;\n /**\n * Visually hidden text read before the message so screen-reader users hear the severity\n * (`'Info:'`, `'Success:'`, `'Warning:'`, `'Error:'` by default). Pass a translation for other\n * languages, or `''` when the message text already states the severity.\n */\n statusLabel?: string;\n /**\n * Called when the dismiss button is activated. Passing it renders the dismiss button (unless\n * `dismiss` is `null`).\n */\n onDismiss?: () => void;\n /**\n * Custom status icon, rendered decoratively (`aria-hidden=\"true\"`, a slot object can override\n * it) in the status color. `null` renders no icon.\n */\n icon?: Slot<'span'>;\n /**\n * Content of the dismiss button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Dismiss\">`, which calls `onDismiss`; passing\n * content shows the dismiss button even without `onDismiss`. `null` is the only value that hides\n * the button. A boolean counts as no slot, so the conditional idiom\n * `dismiss={useBrandIcon && <BrandCloseIcon />}` keeps the default button: the default icon with\n * `onDismiss`, no button without it. Content that renders nothing (`''`, or an array or Fragment\n * of only `null`, `false`, `true` and `''`, also as the children of a slot object or a merged\n * button) keeps the default icon, so the button is never empty; a slot object that renders a\n * component or a void element (`{ as: CloseIcon }`, `{ as: 'img', src, alt: '' }`) or sets\n * `dangerouslySetInnerHTML` is the icon itself. The content is\n * decorative (`aria-hidden`), so the button keeps the name \"Dismiss\": when the content is\n * visible text, pass a slot object whose `aria-label` matches it\n * (`{ children: 'Close', 'aria-label': 'Close' }`) so the name contains the visible label. An\n * `aria-label`, `aria-labelledby` or `title` on a slot object names the button instead of\n * \"Dismiss\".\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first and can call `preventDefault()` to cancel\n * `onDismiss`; its `aria-label` and an explicit `type` win over the defaults) and its content\n * (children, or `dangerouslySetInnerHTML` markup) is used as is, with a development warning.\n * A Wave `Button`'s own props are not attributes: its `icon` becomes decorative content before\n * its children (after them with `iconPosition=\"after\"`), `disabledFocusable` makes the dismiss\n * button unavailable but focusable as on the Button (`onDismiss` is not called), and\n * `appearance` and `size` are ignored.\n * When the rendered content has a text label (at least two letters or digits:\n * `<button>Close</button>`, or text rendered by a component such as a translation), that text\n * names the button, as in 0.4. An icon, a lone character (`X`, `×`,\n * `+`: a symbol, not a label) and text that is `aria-hidden` or `hidden` keep the name\n * \"Dismiss\". Text hidden only with CSS still counts as the label: a responsive label such as\n * `<span className=\"hidden sm:inline\">Close</span>` drops the default name, so the button has\n * no name wherever that text is not displayed. Give such a button an explicit `aria-label`\n * (`<button aria-label=\"Close\">…</button>`). An `aria-label`, `aria-labelledby` or `title` on\n * the element names the button.\n *\n * The 0.4 button-object form (`{ as: 'button', onClick, … }`, `{ as: Button, … }` or an object\n * with button props) is **deprecated**: its button props (`type` included), `className` and\n * `style` are merged the same way, and a Wave Button's own props apply as for the element form.\n * Pass icon content instead, e.g. `dismiss={<CloseIcon />}`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /** Message content to display. */\n children: React.ReactNode;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst tintClasses: Record<Status, string> = {\n info: 'bg-info-tint',\n success: 'bg-success-tint',\n warning: 'bg-warning-tint',\n error: 'bg-error-tint',\n};\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Name of the dismiss button when nothing else names it. */\nconst DEFAULT_DISMISS_LABEL = 'Dismiss';\n\n/** Attributes that only make sense on the dismiss `<button>` itself. */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'autoFocus',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\n\n/**\n * Attributes that name the dismiss button. On a slot object they go to the button (its content is\n * decorative); on the merged button, any of them replaces the default `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\nconst HANDLER_KEY = /^on[A-Z]/;\n\nconst dismissContentClassName = 'inline-flex items-center justify-center';\n\ninterface DismissParts {\n /** Props merged onto the wired dismiss button. */\n buttonProps: UnknownProps;\n /** What renders inside the dismiss button. */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button`), so a text label in it\n * names the button (C-SLOTS naming, WCAG 2.5.3 Label in Name); `false` when the content is\n * decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the content's literal children contain a text label. Used for the server render and\n * the first client render; after mount, the rendered button's text decides (see\n * {@link hasRenderedTextLabel}).\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the dismiss button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n /** Which development warning the slot needs. */\n warning: 'button-element' | 'button-object' | null;\n}\n\nconst noop = () => {};\n\n/** The decorative default dismiss glyph. */\nfunction defaultDismissContent(): React.ReactNode {\n return <DismissIcon />;\n}\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/** The dismiss button without a slot: the default icon and name. */\nfunction defaultDismiss(): DismissParts {\n return {\n buttonProps: {},\n content: defaultDismissContent(),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n warning: null,\n };\n}\n\n/**\n * Splits the `dismiss` slot into props for the wired dismiss button and the content rendered\n * inside it (C-SLOTS dismiss semantics). `null` means: no dismiss button. A boolean is no slot\n * (the default dismiss button), and content that renders nothing keeps the default icon.\n */\nfunction resolveDismiss(dismiss: MessageBarProps['dismiss']): DismissParts | null {\n if (dismiss === null) return null;\n if (dismiss === undefined || typeof dismiss === 'boolean') return defaultDismiss();\n\n // A merged `<button>`/`Button` keeps its content accessible (as in 0.4): a text label names the\n // button, anything else (an icon, a lone character such as `X` or `×`) gets the default name.\n // The type is compared through `isElementOfType`, so a Button written in a Server Component\n // (a lazy client reference) is merged too.\n const element = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(element, 'button', Button)) {\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(element.props)) {\n if (\n key !== 'children' &&\n key !== 'dangerouslySetInnerHTML' &&\n !BUTTON_OWN_PROP_KEYS.has(key)\n ) {\n buttonProps[key] = value;\n }\n }\n const isWaveButton = isElementOfType(element, Button);\n // A generator is read once by the check; its items are what renders (and names the button).\n // Markup of the merged button (`dangerouslySetInnerHTML`) is its content as well, rendered in\n // a span inside the dismiss button (the button itself also holds the icon).\n const markup = element.props.dangerouslySetInnerHTML as\n React.HTMLAttributes<HTMLElement>['dangerouslySetInnerHTML'] | undefined;\n const children =\n markup != null ? (\n <span className={dismissContentClassName} dangerouslySetInnerHTML={markup} />\n ) : (\n materialiseSlotContent(element.props.children)\n );\n // Wave Button's icon becomes decorative content before its children (after them with\n // `iconPosition=\"after\"`).\n const icon = element.props.icon as Slot<'span'>;\n const iconNode =\n isWaveButton && slotRendersContent(icon)\n ? renderSlot(icon, 'span', dismissContentClassName, { 'aria-hidden': true })\n : null;\n const content =\n iconNode || slotRendersContent(children)\n ? placeButtonIcon(iconNode, children, element.props.iconPosition)\n : defaultDismissContent();\n return {\n buttonProps,\n content,\n contentMayName: true,\n literalTextLabel: hasTextLabel(children),\n disabledFocusable: isWaveButton && Boolean(element.props.disabledFocusable),\n warning: 'button-element',\n };\n }\n\n // Everything else is classified by the slot system (F2): shorthand content resolves to the\n // default `span` with no attributes; a slot object resolves to its element and attributes.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return defaultDismiss();\n const { Component, props, children } = resolved;\n const asButton = isButtonType(Component);\n const isButtonObject =\n asButton ||\n Object.keys(props).some((key) => BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key));\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let iconNode: React.ReactNode = null;\n for (const [key, value] of Object.entries(props)) {\n if (Component === Button && BUTTON_OWN_PROP_KEYS.has(key)) {\n // Wave Button's own props are not attributes: `icon`, `iconPosition` and\n // `disabledFocusable` are applied below, the others (`appearance`, `size`) are dropped.\n if (key === 'icon' && slotRendersContent(value)) {\n iconNode = renderSlot(value as Slot<'span'>, 'span', dismissContentClassName, {\n 'aria-hidden': true,\n });\n }\n } else if (\n BUTTON_ONLY_KEYS.has(key) ||\n HANDLER_KEY.test(key) ||\n NAMING_KEYS.has(key) ||\n // 0.4 rendered the object as the button itself: its className, style and ref stay there.\n (isButtonObject && (key === 'className' || key === 'style' || key === 'ref'))\n ) {\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n\n // The content element: the object's own element, or a span for the button-object form. An\n // object whose children render nothing styles the default icon\n // (e.g. `{ className: 'text-error' }`), unless its element is the icon itself.\n const ContentTag: React.ElementType = asButton ? 'span' : Component;\n const elementProps = {\n 'aria-hidden': true,\n ...contentProps,\n className: cn(dismissContentClassName, contentProps.className as string | undefined),\n };\n let inner: React.ReactNode = null;\n if (iconNode || slotRendersContent(children)) {\n inner = placeButtonIcon(iconNode, children, Component === Button && props.iconPosition);\n } else if (slotWrapsDefaultContent(ContentTag, { ...contentProps, children })) {\n inner = defaultDismissContent();\n }\n return {\n buttonProps,\n content:\n inner === null\n ? React.createElement(ContentTag, elementProps)\n : React.createElement(ContentTag, elementProps, inner),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: Component === Button && Boolean(props.disabledFocusable),\n warning: isButtonObject ? 'button-object' : null,\n };\n}\n\n/**\n * An inline message that tells the user about the state of a page or task: a status icon, a\n * visually hidden status label (\"Warning:\"), the message and an optional dismiss button.\n *\n * - The status sets the tint, the logical start border, the icon and the role (`alert` for\n * `warning`/`error`, `status` otherwise). Screen readers hear the severity through `statusLabel`.\n * - The dismiss button is always the MessageBar's own `<button>` wired to `onDismiss`\n * (`type=\"button\"` unless a merged button slot sets its own `type`); the `dismiss` slot only\n * replaces its content (see {@link MessageBarProps.dismiss}).\n *\n * @example\n * <MessageBar status=\"warning\" onDismiss={() => setVisible(false)}>\n * Your subscription expires in 3 days.\n * </MessageBar>\n */\nexport const MessageBar = ({\n status = 'info',\n statusLabel,\n onDismiss,\n icon,\n dismiss,\n children,\n className,\n ref,\n ...rest\n}: MessageBarProps) => {\n const iconClassName = cn('mt-0.5 inline-flex shrink-0', STATUS_ICON_COLOR[status]);\n const renderedIcon =\n icon !== undefined ? (\n renderSlot(icon, 'span', iconClassName, { 'aria-hidden': true })\n ) : (\n <span aria-hidden=\"true\" className={iconClassName}>\n <StatusIcon status={status} size={20} />\n </span>\n );\n\n // A boolean `dismiss` is no slot (`dismiss={cond && <CloseIcon />}`): only `onDismiss` shows it.\n const showDismiss =\n onDismiss !== undefined || (dismiss !== undefined && typeof dismiss !== 'boolean');\n const dismissParts = showDismiss ? resolveDismiss(dismiss) : null;\n const dismissWarning = dismissParts?.warning ?? null;\n React.useEffect(() => {\n if (dismissWarning === 'button-element') {\n warnOnce(\n 'MessageBar:dismiss-button-element',\n 'MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n } else if (dismissWarning === 'button-object') {\n warnOnce(\n 'MessageBar:dismiss-button-object',\n 'MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n }\n }, [dismissWarning]);\n\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const { ref: slotRef, ...slotButtonProps } = dismissParts?.buttonProps ?? {};\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a merged button's content names it when it renders\n // a text label (at least two letters or digits; a lone `X` or `×` is a glyph), and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, e.g. translations,\n // and later changes).\n const checksContent = dismissParts !== null && dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts?.literalTextLabel ?? false;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const dismissRef = useMergedRefs<HTMLButtonElement>(\n slotRef as React.Ref<HTMLButtonElement> | undefined,\n checksContent ? setLabelTarget : undefined,\n );\n\n let renderedDismiss: React.ReactNode = null;\n if (dismissParts) {\n const buttonProps = mergeProps(\n {\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_DISMISS_LABEL,\n onClick: () => onDismiss?.(),\n className: cn(\n 'ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground',\n 'not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n focusRing,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n renderedDismiss = (\n // `type` is \"button\" unless the slot sets one (`null`, from JavaScript callers, means the\n // default too, so the button never submits an enclosing form by accident). A merged\n // `disabledFocusable` Button makes it unavailable but focusable (spread last: it wins).\n <button\n {...buttonProps}\n ref={dismissRef}\n type={buttonProps.type ?? 'button'}\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {dismissParts.content}\n </button>\n );\n }\n\n return (\n <div\n ref={ref}\n role={status === 'error' || status === 'warning' ? 'alert' : 'status'}\n {...rest}\n className={cn(\n 'flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground',\n tintClasses[status],\n STATUS_BORDER[status],\n className,\n )}\n >\n {renderedIcon}\n <div className=\"min-w-0 flex-1 text-body-1\">\n <StatusText label={getStatusLabel(status, statusLabel)} />\n {children}\n </div>\n {renderedDismiss}\n </div>\n );\n};\n\nMessageBar.displayName = 'MessageBar';\n"],"mappings":"2jBAuGA,IAAMwC,EAAsC,CAC1C,KAAM,eACN,QAAS,kBACT,QAAS,kBACT,MAAO,eACT,EAKMC,EAAwB,UAGxBC,EAAwC,IAAI,IAAI,CACpD,OACA,WACA,YACA,OACA,aACA,cACA,aACA,iBACA,aACA,OACA,QACA,gBACA,qBACF,CAAC,EAMKC,EAAmC,IAAI,IAAI,CAAC,aAAc,kBAAmB,OAAO,CAAC,EAErFC,EAAc,WAEdC,EAA0B,0CA4B1BC,MAAa,CAAC,EAGpB,SAASC,GAAyC,CAChD,OAAO,EAAAR,EAAA,IAAA,CAACvC,EAAAA,YAAD,CAAc,CAAA,CACvB,CAEA,SAASgD,EAAa,EAAwB,CAC5C,OAAOC,IAAS,UAAYA,IAAShD,EAAAA,MACvC,CAGA,SAASiD,GAA+B,CACtC,MAAO,CACL,YAAa,CAAC,EACd,QAASH,EAAsB,EAC/B,eAAgB,GAChB,iBAAkB,GAClB,kBAAmB,GACnB,QAAS,IACX,CACF,CAOA,SAASI,EAAe,EAA0D,CAChF,GAAIC,IAAY,KAAM,OAAO,KAC7B,GAAIA,IAAY,IAAA,IAAa,OAAOA,GAAY,UAAW,OAAOF,EAAe,EAMjF,IAAMG,EAAUD,EAChB,GAAIlD,EAAAA,gBAA8BmD,EAAS,SAAUpD,EAAAA,MAAM,EAAG,CAC5D,IAAMqD,EAA4B,CAAC,EACnC,IAAK,GAAM,CAACC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IAAKoC,EACL,KAAMpC,EAAY,MAAQ,SAC1B,GAAKsB,EAAa,kBAAoBvD,EAAAA,gCAAkC,IAAA,GAEvE,SAAAuD,EAAa,OACR,CAAA,CAEZ,CAEA,OACE,EAAArC,EAAA,KAAA,CAAC,MAAD,CACO,MACL,KAAMmC,IAAW,SAAWA,IAAW,UAAY,QAAU,SAC7D,GAAIF,EACJ,UAAW9D,EAAAA,GACT,sEACA8B,EAAYkC,GACZpD,EAAAA,cAAcoD,GACdkB,CACF,EATF,SAAA,CAWGjB,GACD,EAAApC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,6BAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAChB,EAAAA,WAAD,CAAY,MAAOC,EAAAA,eAAekD,EAAQmB,CAAW,CAAI,CAAA,EACxDlC,CACE,IACJgC,CACE,GAET,EAEA,EAAW,YAAc"}
@@ -0,0 +1,144 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { isElementOfType as t } from "../../lib/children.mjs";
4
+ import { warnOnce as n } from "../../lib/dev.mjs";
5
+ import { materialiseSlotContent as r, renderSlot as i, resolveSlot as a, slotRendersContent as o, slotWrapsDefaultContent as s } from "../../lib/slot.mjs";
6
+ import { useMergedRefs as c } from "../../hooks/useMergedRefs.mjs";
7
+ import { focusRing as l } from "../../lib/styles.mjs";
8
+ import { Button as u } from "../button/Button.mjs";
9
+ import { DismissIcon as d } from "../../lib/icons.mjs";
10
+ import { mergeProps as f } from "../../lib/mergeProps.mjs";
11
+ import { BUTTON_OWN_PROP_KEYS as p, MERGED_DISABLED_FOCUSABLE_PROPS as m, mergedAriaDisabledClasses as h, placeButtonIcon as g } from "../button/Button.slots.mjs";
12
+ import { hasRenderedTextLabel as _, hasTextLabel as v, observeTextLabel as y } from "../../lib/labelInName.mjs";
13
+ import { STATUS_BORDER as b, STATUS_ICON_COLOR as x, StatusIcon as S, StatusText as C, getStatusLabel as w } from "./MessageBar.status.mjs";
14
+ import * as T from "react";
15
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
16
+ //#region src/components/feedback/MessageBar.tsx
17
+ var O = {
18
+ info: "bg-info-tint",
19
+ success: "bg-success-tint",
20
+ warning: "bg-warning-tint",
21
+ error: "bg-error-tint"
22
+ }, k = "Dismiss", A = /* @__PURE__ */ new Set([
23
+ "type",
24
+ "disabled",
25
+ "autoFocus",
26
+ "form",
27
+ "formAction",
28
+ "formEncType",
29
+ "formMethod",
30
+ "formNoValidate",
31
+ "formTarget",
32
+ "name",
33
+ "value",
34
+ "popoverTarget",
35
+ "popoverTargetAction"
36
+ ]), j = /* @__PURE__ */ new Set([
37
+ "aria-label",
38
+ "aria-labelledby",
39
+ "title"
40
+ ]), M = /^on[A-Z]/, N = "inline-flex items-center justify-center", P = () => {};
41
+ function F() {
42
+ return /* @__PURE__ */ E(d, {});
43
+ }
44
+ function I(e) {
45
+ return e === "button" || e === u;
46
+ }
47
+ function L() {
48
+ return {
49
+ buttonProps: {},
50
+ content: F(),
51
+ contentMayName: !1,
52
+ literalTextLabel: !1,
53
+ disabledFocusable: !1,
54
+ warning: null
55
+ };
56
+ }
57
+ function R(n) {
58
+ if (n === null) return null;
59
+ if (n === void 0 || typeof n == "boolean") return L();
60
+ let c = n;
61
+ if (t(c, "button", u)) {
62
+ let e = {};
63
+ for (let [t, n] of Object.entries(c.props)) t !== "children" && t !== "dangerouslySetInnerHTML" && !p.has(t) && (e[t] = n);
64
+ let n = t(c, u), a = c.props.dangerouslySetInnerHTML, s = a == null ? r(c.props.children) : /* @__PURE__ */ E("span", {
65
+ className: N,
66
+ dangerouslySetInnerHTML: a
67
+ }), l = c.props.icon, d = n && o(l) ? i(l, "span", N, { "aria-hidden": !0 }) : null;
68
+ return {
69
+ buttonProps: e,
70
+ content: d || o(s) ? g(d, s, c.props.iconPosition) : F(),
71
+ contentMayName: !0,
72
+ literalTextLabel: v(s),
73
+ disabledFocusable: n && !!c.props.disabledFocusable,
74
+ warning: "button-element"
75
+ };
76
+ }
77
+ let l = a(n, "span");
78
+ if (!l) return L();
79
+ let { Component: d, props: f, children: m } = l, h = I(d), _ = h || Object.keys(f).some((e) => A.has(e) || M.test(e)), y = {}, b = {}, x = null;
80
+ for (let [e, t] of Object.entries(f)) d === u && p.has(e) ? e === "icon" && o(t) && (x = i(t, "span", N, { "aria-hidden": !0 })) : A.has(e) || M.test(e) || j.has(e) || _ && (e === "className" || e === "style" || e === "ref") ? y[e] = t : b[e] = t;
81
+ let S = h ? "span" : d, C = {
82
+ "aria-hidden": !0,
83
+ ...b,
84
+ className: e(N, b.className)
85
+ }, w = null;
86
+ return x || o(m) ? w = g(x, m, d === u && f.iconPosition) : s(S, {
87
+ ...b,
88
+ children: m
89
+ }) && (w = F()), {
90
+ buttonProps: y,
91
+ content: w === null ? T.createElement(S, C) : T.createElement(S, C, w),
92
+ contentMayName: !1,
93
+ literalTextLabel: !1,
94
+ disabledFocusable: d === u && !!f.disabledFocusable,
95
+ warning: _ ? "button-object" : null
96
+ };
97
+ }
98
+ var z = ({ status: t = "info", statusLabel: r, onDismiss: a, icon: o, dismiss: s, children: u, className: d, ref: p, ...g }) => {
99
+ let v = e("mt-0.5 inline-flex shrink-0", x[t]), A = o === void 0 ? /* @__PURE__ */ E("span", {
100
+ "aria-hidden": "true",
101
+ className: v,
102
+ children: /* @__PURE__ */ E(S, {
103
+ status: t,
104
+ size: 20
105
+ })
106
+ }) : i(o, "span", v, { "aria-hidden": !0 }), M = a !== void 0 || s !== void 0 && typeof s != "boolean" ? R(s) : null, N = M?.warning ?? null;
107
+ T.useEffect(() => {
108
+ N === "button-element" ? n("MessageBar:dismiss-button-element", "MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.") : N === "button-object" && n("MessageBar:dismiss-button-object", "MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.");
109
+ }, [N]);
110
+ let { ref: F, ...I } = M?.buttonProps ?? {}, L = Object.keys(I).some((e) => j.has(e) && I[e] != null), z = M !== null && M.contentMayName && !L, B = M?.literalTextLabel ?? !1, [V, H] = T.useState(null), U = T.useCallback((e) => V ? y(V, e) : P, [V]), W = T.useSyncExternalStore(U, () => V ? _(V) : B, () => B), G = z && W, K = c(F, z ? H : void 0), q = null;
111
+ if (M) {
112
+ let t = f({
113
+ "aria-label": L || G ? void 0 : k,
114
+ onClick: () => a?.(),
115
+ className: e("ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground", "not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", "not-disabled:not-aria-disabled:active:bg-subtle-pressed", l, "disabled:cursor-not-allowed disabled:opacity-50", h)
116
+ }, I);
117
+ q = /* @__PURE__ */ E("button", {
118
+ ...t,
119
+ ref: K,
120
+ type: t.type ?? "button",
121
+ ...M.disabledFocusable ? m : void 0,
122
+ children: M.content
123
+ });
124
+ }
125
+ return /* @__PURE__ */ D("div", {
126
+ ref: p,
127
+ role: t === "error" || t === "warning" ? "alert" : "status",
128
+ ...g,
129
+ className: e("flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground", O[t], b[t], d),
130
+ children: [
131
+ A,
132
+ /* @__PURE__ */ D("div", {
133
+ className: "min-w-0 flex-1 text-body-1",
134
+ children: [/* @__PURE__ */ E(C, { label: w(t, r) }), u]
135
+ }),
136
+ q
137
+ ]
138
+ });
139
+ };
140
+ z.displayName = "MessageBar";
141
+ //#endregion
142
+ export { z as MessageBar };
143
+
144
+ //# sourceMappingURL=MessageBar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBar.mjs","names":["React","tintClasses","DEFAULT_DISMISS_LABEL","BUTTON_ONLY_KEYS","NAMING_KEYS","HANDLER_KEY","dismissContentClassName","noop","defaultDismissContent","DismissIcon","isButtonType","type","Button","defaultDismiss","resolveDismiss","dismiss","element","isElementOfType","buttonProps","key","value","BUTTON_OWN_PROP_KEYS","isWaveButton","markup","children","materialiseSlotContent","icon","iconNode","slotRendersContent","renderSlot","placeButtonIcon","hasTextLabel","resolved","resolveSlot","asButton","Component","isButtonObject","props","contentProps","ContentTag","elementProps","cn","inner","slotWrapsDefaultContent","MessageBar","rest","iconClassName","STATUS_ICON_COLOR","status","renderedIcon","StatusIcon","dismissParts","onDismiss","dismissWarning","warnOnce","slotRef","slotButtonProps","hasOwnName","checksContent","literalTextLabel","labelTarget","setLabelTarget","subscribeToContent","observeTextLabel","onChange","contentHasTextLabel","hasRenderedTextLabel","namedByContent","dismissRef","useMergedRefs","renderedDismiss","mergeProps","focusRing","mergedAriaDisabledClasses","MERGED_DISABLED_FOCUSABLE_PROPS","STATUS_BORDER","className","StatusText","getStatusLabel","statusLabel"],"sources":["../../../src/components/feedback/MessageBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Status, Slot, SlotObject } from '../../lib/types';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport {\n STATUS_BORDER,\n STATUS_ICON_COLOR,\n StatusIcon,\n StatusText,\n getStatusLabel,\n} from './MessageBar.status';\n\n/** Properties for the MessageBar component. */\nexport interface MessageBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Status level controlling the color, icon, status text and role of the message bar.\n * `warning` and `error` render `role=\"alert\"`, `info` and `success` `role=\"status\"` (a consumer\n * `role` wins).\n * @default 'info'\n */\n status?: Status;\n /**\n * Visually hidden text read before the message so screen-reader users hear the severity\n * (`'Info:'`, `'Success:'`, `'Warning:'`, `'Error:'` by default). Pass a translation for other\n * languages, or `''` when the message text already states the severity.\n */\n statusLabel?: string;\n /**\n * Called when the dismiss button is activated. Passing it renders the dismiss button (unless\n * `dismiss` is `null`).\n */\n onDismiss?: () => void;\n /**\n * Custom status icon, rendered decoratively (`aria-hidden=\"true\"`, a slot object can override\n * it) in the status color. `null` renders no icon.\n */\n icon?: Slot<'span'>;\n /**\n * Content of the dismiss button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Dismiss\">`, which calls `onDismiss`; passing\n * content shows the dismiss button even without `onDismiss`. `null` is the only value that hides\n * the button. A boolean counts as no slot, so the conditional idiom\n * `dismiss={useBrandIcon && <BrandCloseIcon />}` keeps the default button: the default icon with\n * `onDismiss`, no button without it. Content that renders nothing (`''`, or an array or Fragment\n * of only `null`, `false`, `true` and `''`, also as the children of a slot object or a merged\n * button) keeps the default icon, so the button is never empty; a slot object that renders a\n * component or a void element (`{ as: CloseIcon }`, `{ as: 'img', src, alt: '' }`) or sets\n * `dangerouslySetInnerHTML` is the icon itself. The content is\n * decorative (`aria-hidden`), so the button keeps the name \"Dismiss\": when the content is\n * visible text, pass a slot object whose `aria-label` matches it\n * (`{ children: 'Close', 'aria-label': 'Close' }`) so the name contains the visible label. An\n * `aria-label`, `aria-labelledby` or `title` on a slot object names the button instead of\n * \"Dismiss\".\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first and can call `preventDefault()` to cancel\n * `onDismiss`; its `aria-label` and an explicit `type` win over the defaults) and its content\n * (children, or `dangerouslySetInnerHTML` markup) is used as is, with a development warning.\n * A Wave `Button`'s own props are not attributes: its `icon` becomes decorative content before\n * its children (after them with `iconPosition=\"after\"`), `disabledFocusable` makes the dismiss\n * button unavailable but focusable as on the Button (`onDismiss` is not called), and\n * `appearance` and `size` are ignored.\n * When the rendered content has a text label (at least two letters or digits:\n * `<button>Close</button>`, or text rendered by a component such as a translation), that text\n * names the button, as in 0.4. An icon, a lone character (`X`, `×`,\n * `+`: a symbol, not a label) and text that is `aria-hidden` or `hidden` keep the name\n * \"Dismiss\". Text hidden only with CSS still counts as the label: a responsive label such as\n * `<span className=\"hidden sm:inline\">Close</span>` drops the default name, so the button has\n * no name wherever that text is not displayed. Give such a button an explicit `aria-label`\n * (`<button aria-label=\"Close\">…</button>`). An `aria-label`, `aria-labelledby` or `title` on\n * the element names the button.\n *\n * The 0.4 button-object form (`{ as: 'button', onClick, … }`, `{ as: Button, … }` or an object\n * with button props) is **deprecated**: its button props (`type` included), `className` and\n * `style` are merged the same way, and a Wave Button's own props apply as for the element form.\n * Pass icon content instead, e.g. `dismiss={<CloseIcon />}`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /** Message content to display. */\n children: React.ReactNode;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst tintClasses: Record<Status, string> = {\n info: 'bg-info-tint',\n success: 'bg-success-tint',\n warning: 'bg-warning-tint',\n error: 'bg-error-tint',\n};\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Name of the dismiss button when nothing else names it. */\nconst DEFAULT_DISMISS_LABEL = 'Dismiss';\n\n/** Attributes that only make sense on the dismiss `<button>` itself. */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'autoFocus',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\n\n/**\n * Attributes that name the dismiss button. On a slot object they go to the button (its content is\n * decorative); on the merged button, any of them replaces the default `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\nconst HANDLER_KEY = /^on[A-Z]/;\n\nconst dismissContentClassName = 'inline-flex items-center justify-center';\n\ninterface DismissParts {\n /** Props merged onto the wired dismiss button. */\n buttonProps: UnknownProps;\n /** What renders inside the dismiss button. */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button`), so a text label in it\n * names the button (C-SLOTS naming, WCAG 2.5.3 Label in Name); `false` when the content is\n * decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the content's literal children contain a text label. Used for the server render and\n * the first client render; after mount, the rendered button's text decides (see\n * {@link hasRenderedTextLabel}).\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the dismiss button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n /** Which development warning the slot needs. */\n warning: 'button-element' | 'button-object' | null;\n}\n\nconst noop = () => {};\n\n/** The decorative default dismiss glyph. */\nfunction defaultDismissContent(): React.ReactNode {\n return <DismissIcon />;\n}\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/** The dismiss button without a slot: the default icon and name. */\nfunction defaultDismiss(): DismissParts {\n return {\n buttonProps: {},\n content: defaultDismissContent(),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n warning: null,\n };\n}\n\n/**\n * Splits the `dismiss` slot into props for the wired dismiss button and the content rendered\n * inside it (C-SLOTS dismiss semantics). `null` means: no dismiss button. A boolean is no slot\n * (the default dismiss button), and content that renders nothing keeps the default icon.\n */\nfunction resolveDismiss(dismiss: MessageBarProps['dismiss']): DismissParts | null {\n if (dismiss === null) return null;\n if (dismiss === undefined || typeof dismiss === 'boolean') return defaultDismiss();\n\n // A merged `<button>`/`Button` keeps its content accessible (as in 0.4): a text label names the\n // button, anything else (an icon, a lone character such as `X` or `×`) gets the default name.\n // The type is compared through `isElementOfType`, so a Button written in a Server Component\n // (a lazy client reference) is merged too.\n const element = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(element, 'button', Button)) {\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(element.props)) {\n if (\n key !== 'children' &&\n key !== 'dangerouslySetInnerHTML' &&\n !BUTTON_OWN_PROP_KEYS.has(key)\n ) {\n buttonProps[key] = value;\n }\n }\n const isWaveButton = isElementOfType(element, Button);\n // A generator is read once by the check; its items are what renders (and names the button).\n // Markup of the merged button (`dangerouslySetInnerHTML`) is its content as well, rendered in\n // a span inside the dismiss button (the button itself also holds the icon).\n const markup = element.props.dangerouslySetInnerHTML as\n React.HTMLAttributes<HTMLElement>['dangerouslySetInnerHTML'] | undefined;\n const children =\n markup != null ? (\n <span className={dismissContentClassName} dangerouslySetInnerHTML={markup} />\n ) : (\n materialiseSlotContent(element.props.children)\n );\n // Wave Button's icon becomes decorative content before its children (after them with\n // `iconPosition=\"after\"`).\n const icon = element.props.icon as Slot<'span'>;\n const iconNode =\n isWaveButton && slotRendersContent(icon)\n ? renderSlot(icon, 'span', dismissContentClassName, { 'aria-hidden': true })\n : null;\n const content =\n iconNode || slotRendersContent(children)\n ? placeButtonIcon(iconNode, children, element.props.iconPosition)\n : defaultDismissContent();\n return {\n buttonProps,\n content,\n contentMayName: true,\n literalTextLabel: hasTextLabel(children),\n disabledFocusable: isWaveButton && Boolean(element.props.disabledFocusable),\n warning: 'button-element',\n };\n }\n\n // Everything else is classified by the slot system (F2): shorthand content resolves to the\n // default `span` with no attributes; a slot object resolves to its element and attributes.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return defaultDismiss();\n const { Component, props, children } = resolved;\n const asButton = isButtonType(Component);\n const isButtonObject =\n asButton ||\n Object.keys(props).some((key) => BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key));\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let iconNode: React.ReactNode = null;\n for (const [key, value] of Object.entries(props)) {\n if (Component === Button && BUTTON_OWN_PROP_KEYS.has(key)) {\n // Wave Button's own props are not attributes: `icon`, `iconPosition` and\n // `disabledFocusable` are applied below, the others (`appearance`, `size`) are dropped.\n if (key === 'icon' && slotRendersContent(value)) {\n iconNode = renderSlot(value as Slot<'span'>, 'span', dismissContentClassName, {\n 'aria-hidden': true,\n });\n }\n } else if (\n BUTTON_ONLY_KEYS.has(key) ||\n HANDLER_KEY.test(key) ||\n NAMING_KEYS.has(key) ||\n // 0.4 rendered the object as the button itself: its className, style and ref stay there.\n (isButtonObject && (key === 'className' || key === 'style' || key === 'ref'))\n ) {\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n\n // The content element: the object's own element, or a span for the button-object form. An\n // object whose children render nothing styles the default icon\n // (e.g. `{ className: 'text-error' }`), unless its element is the icon itself.\n const ContentTag: React.ElementType = asButton ? 'span' : Component;\n const elementProps = {\n 'aria-hidden': true,\n ...contentProps,\n className: cn(dismissContentClassName, contentProps.className as string | undefined),\n };\n let inner: React.ReactNode = null;\n if (iconNode || slotRendersContent(children)) {\n inner = placeButtonIcon(iconNode, children, Component === Button && props.iconPosition);\n } else if (slotWrapsDefaultContent(ContentTag, { ...contentProps, children })) {\n inner = defaultDismissContent();\n }\n return {\n buttonProps,\n content:\n inner === null\n ? React.createElement(ContentTag, elementProps)\n : React.createElement(ContentTag, elementProps, inner),\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: Component === Button && Boolean(props.disabledFocusable),\n warning: isButtonObject ? 'button-object' : null,\n };\n}\n\n/**\n * An inline message that tells the user about the state of a page or task: a status icon, a\n * visually hidden status label (\"Warning:\"), the message and an optional dismiss button.\n *\n * - The status sets the tint, the logical start border, the icon and the role (`alert` for\n * `warning`/`error`, `status` otherwise). Screen readers hear the severity through `statusLabel`.\n * - The dismiss button is always the MessageBar's own `<button>` wired to `onDismiss`\n * (`type=\"button\"` unless a merged button slot sets its own `type`); the `dismiss` slot only\n * replaces its content (see {@link MessageBarProps.dismiss}).\n *\n * @example\n * <MessageBar status=\"warning\" onDismiss={() => setVisible(false)}>\n * Your subscription expires in 3 days.\n * </MessageBar>\n */\nexport const MessageBar = ({\n status = 'info',\n statusLabel,\n onDismiss,\n icon,\n dismiss,\n children,\n className,\n ref,\n ...rest\n}: MessageBarProps) => {\n const iconClassName = cn('mt-0.5 inline-flex shrink-0', STATUS_ICON_COLOR[status]);\n const renderedIcon =\n icon !== undefined ? (\n renderSlot(icon, 'span', iconClassName, { 'aria-hidden': true })\n ) : (\n <span aria-hidden=\"true\" className={iconClassName}>\n <StatusIcon status={status} size={20} />\n </span>\n );\n\n // A boolean `dismiss` is no slot (`dismiss={cond && <CloseIcon />}`): only `onDismiss` shows it.\n const showDismiss =\n onDismiss !== undefined || (dismiss !== undefined && typeof dismiss !== 'boolean');\n const dismissParts = showDismiss ? resolveDismiss(dismiss) : null;\n const dismissWarning = dismissParts?.warning ?? null;\n React.useEffect(() => {\n if (dismissWarning === 'button-element') {\n warnOnce(\n 'MessageBar:dismiss-button-element',\n 'MessageBar: `dismiss` received a button element; its props were merged into the built-in dismiss button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n } else if (dismissWarning === 'button-object') {\n warnOnce(\n 'MessageBar:dismiss-button-object',\n 'MessageBar: the button-object form of `dismiss` is deprecated and will be removed in 1.0; its button props were merged into the built-in dismiss button. Pass icon content instead, e.g. `dismiss={<CloseIcon />}`, and use `onDismiss`.',\n );\n }\n }, [dismissWarning]);\n\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const { ref: slotRef, ...slotButtonProps } = dismissParts?.buttonProps ?? {};\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a merged button's content names it when it renders\n // a text label (at least two letters or digits; a lone `X` or `×` is a glyph), and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, e.g. translations,\n // and later changes).\n const checksContent = dismissParts !== null && dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts?.literalTextLabel ?? false;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const dismissRef = useMergedRefs<HTMLButtonElement>(\n slotRef as React.Ref<HTMLButtonElement> | undefined,\n checksContent ? setLabelTarget : undefined,\n );\n\n let renderedDismiss: React.ReactNode = null;\n if (dismissParts) {\n const buttonProps = mergeProps(\n {\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_DISMISS_LABEL,\n onClick: () => onDismiss?.(),\n className: cn(\n 'ms-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground',\n 'not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n focusRing,\n 'disabled:cursor-not-allowed disabled:opacity-50',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n renderedDismiss = (\n // `type` is \"button\" unless the slot sets one (`null`, from JavaScript callers, means the\n // default too, so the button never submits an enclosing form by accident). A merged\n // `disabledFocusable` Button makes it unavailable but focusable (spread last: it wins).\n <button\n {...buttonProps}\n ref={dismissRef}\n type={buttonProps.type ?? 'button'}\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {dismissParts.content}\n </button>\n );\n }\n\n return (\n <div\n ref={ref}\n role={status === 'error' || status === 'warning' ? 'alert' : 'status'}\n {...rest}\n className={cn(\n 'flex items-start gap-3 rounded border-s-4 px-4 py-3 text-foreground',\n tintClasses[status],\n STATUS_BORDER[status],\n className,\n )}\n >\n {renderedIcon}\n <div className=\"min-w-0 flex-1 text-body-1\">\n <StatusText label={getStatusLabel(status, statusLabel)} />\n {children}\n </div>\n {renderedDismiss}\n </div>\n );\n};\n\nMessageBar.displayName = 'MessageBar';\n"],"mappings":";;;;;;;;;;;;;;;;AAuGA,IAAMC,IAAsC;CAC1C,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAKMC,IAAwB,WAGxBC,oBAAwC,IAAI,IAAI;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GAMKC,oBAAmC,IAAI,IAAI;CAAC;CAAc;CAAmB;AAAO,CAAC,GAErFC,IAAc,YAEdC,IAA0B,2CA4B1BC,UAAa,CAAC;AAGpB,SAASC,IAAyC;CAChD,OAAO,kBAACC,GAAD,CAAc,CAAA;AACvB;AAEA,SAASC,EAAa,GAAwB;CAC5C,OAAOC,MAAS,YAAYA,MAASC;AACvC;AAGA,SAASC,IAA+B;CACtC,OAAO;EACL,aAAa,CAAC;EACd,SAASL,EAAsB;EAC/B,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,SAAS;CACX;AACF;AAOA,SAASM,EAAe,GAA0D;CAChF,IAAIC,MAAY,MAAM,OAAO;CAC7B,IAAIA,MAAY,KAAA,KAAa,OAAOA,KAAY,WAAW,OAAOF,EAAe;CAMjF,IAAMG,IAAUD;CAChB,IAAIE,EAA8BD,GAAS,UAAUJ,CAAM,GAAG;EAC5D,IAAMM,IAA4B,CAAC;EACnC,KAAK,IAAM,CAACC,GAAKC,MAAU,OAAO,QAAQJ,EAAQ,KAAK,GACrD,AACEG,MAAQ,cACRA,MAAQ,6BACR,CAACE,EAAqB,IAAI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AAW,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/icons.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i={info:`Info:`,success:`Success:`,warning:`Warning:`,error:`Error:`},a={info:t.InfoIcon,success:t.SuccessIcon,warning:t.WarningIcon,error:t.ErrorIcon},o={info:`text-info-tint-foreground`,success:`text-success-tint-foreground`,warning:`text-warning-tint-foreground`,error:`text-error-tint-foreground`},s={info:`border-s-info`,success:`border-s-success`,warning:`border-s-warning`,error:`border-s-error`};function c(e,t){return t??i[e]}function l({status:e,size:t}){let n=a[e];return(0,r.jsx)(n,{size:t})}l.displayName=`StatusIcon`;function u({label:e}){return e?(0,r.jsx)(`span`,{className:`sr-only`,children:`${e} `}):null}u.displayName=`StatusText`,exports.STATUS_BORDER=s,exports.STATUS_ICON_COLOR=o,exports.STATUS_LABELS=i,exports.StatusIcon=l,exports.StatusText=u,exports.getStatusLabel=c;
2
+ //# sourceMappingURL=MessageBar.status.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBar.status.cjs","names":["InfoIcon","SuccessIcon","WarningIcon","ErrorIcon","require_runtime","require_icons","react","react_jsx_runtime","STATUS_LABELS","STATUS_ICONS","STATUS_ICON_COLOR","STATUS_BORDER","getStatusLabel","statusLabel","status","StatusIcon","Icon","StatusText","label"],"sources":["../../../src/components/feedback/MessageBar.status.tsx"],"sourcesContent":["/**\n * Internal status building blocks shared by MessageBar and Toast (spec §5.7): the status icons and\n * the visually hidden status text that tells screen-reader users the severity\n * (feedback-navigation#4). Not exported from the package.\n */\nimport * as React from 'react';\nimport { ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from '../../lib/icons';\nimport type { IconComponent } from '../../lib/icons';\nimport type { Status } from '../../lib/types';\n\n/** Default visually hidden status text, read before the message (\"Warning: Disk almost full\"). */\nexport const STATUS_LABELS: Readonly<Record<Status, string>> = {\n info: 'Info:',\n success: 'Success:',\n warning: 'Warning:',\n error: 'Error:',\n};\n\nconst STATUS_ICONS: Readonly<Record<Status, IconComponent>> = {\n info: InfoIcon,\n success: SuccessIcon,\n warning: WarningIcon,\n error: ErrorIcon,\n};\n\n/**\n * Icon color per status. The `*-tint-foreground` tokens keep ≥ 4.5:1 on both the status tints\n * (MessageBar) and the page background (Toast) in every theme, unlike the `warning` fill.\n */\nexport const STATUS_ICON_COLOR: Readonly<Record<Status, string>> = {\n info: 'text-info-tint-foreground',\n success: 'text-success-tint-foreground',\n warning: 'text-warning-tint-foreground',\n error: 'text-error-tint-foreground',\n};\n\n/** Logical start border color per status. */\nexport const STATUS_BORDER: Readonly<Record<Status, string>> = {\n info: 'border-s-info',\n success: 'border-s-success',\n warning: 'border-s-warning',\n error: 'border-s-error',\n};\n\n/** The resolved status text: `statusLabel` when given (`''` hides it), else the default. */\nexport function getStatusLabel(status: Status, statusLabel: string | undefined): string {\n return statusLabel ?? STATUS_LABELS[status];\n}\n\n/** The default status glyph (decorative: `aria-hidden`, `currentColor`). */\nexport function StatusIcon({ status, size }: { status: Status; size?: number }) {\n const Icon = STATUS_ICONS[status];\n return <Icon size={size} />;\n}\nStatusIcon.displayName = 'StatusIcon';\n\n/** Visually hidden status text, followed by a space so it reads apart from the message. */\nexport function StatusText({ label }: { label: string }) {\n if (!label) return null;\n return <span className=\"sr-only\">{`${label} `}</span>;\n}\nStatusText.displayName = 'StatusText';\n"],"mappings":"iLAWA,IAAaQ,EAAkD,CAC7D,KAAM,QACN,QAAS,WACT,QAAS,WACT,MAAO,QACT,EAEMC,EAAwD,CAC5D,KAAMT,EAAAA,SACN,QAASC,EAAAA,YACT,QAASC,EAAAA,YACT,MAAOC,EAAAA,SACT,EAMaO,EAAsD,CACjE,KAAM,4BACN,QAAS,+BACT,QAAS,+BACT,MAAO,4BACT,EAGaC,EAAkD,CAC7D,KAAM,gBACN,QAAS,mBACT,QAAS,mBACT,MAAO,gBACT,EAGA,SAAgBC,EAAe,EAAgB,EAAyC,CACtF,OAAOC,GAAeL,EAAcM,EACtC,CAGA,SAAgBC,EAAW,CAAE,SAAQ,QAA2C,CAC9E,IAAMC,EAAOP,EAAaK,GAC1B,OAAO,EAAAP,EAAA,IAAA,CAACS,EAAD,CAAY,MAAO,CAAA,CAC5B,CACA,EAAW,YAAc,aAGzB,SAAgBC,EAAW,CAAE,SAA4B,CAEvD,OADKC,GACE,EAAAX,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,UAAW,SAAA,GAAGW,EAAM,EAAS,CAAA,EADjC,IAErB,CACA,EAAW,YAAc"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { ErrorIcon as e, InfoIcon as t, SuccessIcon as n, WarningIcon as r } from "../../lib/icons.mjs";
3
+ import "react";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ //#region src/components/feedback/MessageBar.status.tsx
6
+ var a = {
7
+ info: "Info:",
8
+ success: "Success:",
9
+ warning: "Warning:",
10
+ error: "Error:"
11
+ }, o = {
12
+ info: t,
13
+ success: n,
14
+ warning: r,
15
+ error: e
16
+ }, s = {
17
+ info: "text-info-tint-foreground",
18
+ success: "text-success-tint-foreground",
19
+ warning: "text-warning-tint-foreground",
20
+ error: "text-error-tint-foreground"
21
+ }, c = {
22
+ info: "border-s-info",
23
+ success: "border-s-success",
24
+ warning: "border-s-warning",
25
+ error: "border-s-error"
26
+ };
27
+ function l(e, t) {
28
+ return t ?? a[e];
29
+ }
30
+ function u({ status: e, size: t }) {
31
+ let n = o[e];
32
+ return /* @__PURE__ */ i(n, { size: t });
33
+ }
34
+ u.displayName = "StatusIcon";
35
+ function d({ label: e }) {
36
+ return e ? /* @__PURE__ */ i("span", {
37
+ className: "sr-only",
38
+ children: `${e} `
39
+ }) : null;
40
+ }
41
+ d.displayName = "StatusText";
42
+ //#endregion
43
+ export { c as STATUS_BORDER, s as STATUS_ICON_COLOR, a as STATUS_LABELS, u as StatusIcon, d as StatusText, l as getStatusLabel };
44
+
45
+ //# sourceMappingURL=MessageBar.status.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBar.status.mjs","names":["STATUS_LABELS","STATUS_ICONS","InfoIcon","SuccessIcon","WarningIcon","ErrorIcon","STATUS_ICON_COLOR","STATUS_BORDER","getStatusLabel","statusLabel","status","StatusIcon","Icon","StatusText","label"],"sources":["../../../src/components/feedback/MessageBar.status.tsx"],"sourcesContent":["/**\n * Internal status building blocks shared by MessageBar and Toast (spec §5.7): the status icons and\n * the visually hidden status text that tells screen-reader users the severity\n * (feedback-navigation#4). Not exported from the package.\n */\nimport * as React from 'react';\nimport { ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from '../../lib/icons';\nimport type { IconComponent } from '../../lib/icons';\nimport type { Status } from '../../lib/types';\n\n/** Default visually hidden status text, read before the message (\"Warning: Disk almost full\"). */\nexport const STATUS_LABELS: Readonly<Record<Status, string>> = {\n info: 'Info:',\n success: 'Success:',\n warning: 'Warning:',\n error: 'Error:',\n};\n\nconst STATUS_ICONS: Readonly<Record<Status, IconComponent>> = {\n info: InfoIcon,\n success: SuccessIcon,\n warning: WarningIcon,\n error: ErrorIcon,\n};\n\n/**\n * Icon color per status. The `*-tint-foreground` tokens keep ≥ 4.5:1 on both the status tints\n * (MessageBar) and the page background (Toast) in every theme, unlike the `warning` fill.\n */\nexport const STATUS_ICON_COLOR: Readonly<Record<Status, string>> = {\n info: 'text-info-tint-foreground',\n success: 'text-success-tint-foreground',\n warning: 'text-warning-tint-foreground',\n error: 'text-error-tint-foreground',\n};\n\n/** Logical start border color per status. */\nexport const STATUS_BORDER: Readonly<Record<Status, string>> = {\n info: 'border-s-info',\n success: 'border-s-success',\n warning: 'border-s-warning',\n error: 'border-s-error',\n};\n\n/** The resolved status text: `statusLabel` when given (`''` hides it), else the default. */\nexport function getStatusLabel(status: Status, statusLabel: string | undefined): string {\n return statusLabel ?? STATUS_LABELS[status];\n}\n\n/** The default status glyph (decorative: `aria-hidden`, `currentColor`). */\nexport function StatusIcon({ status, size }: { status: Status; size?: number }) {\n const Icon = STATUS_ICONS[status];\n return <Icon size={size} />;\n}\nStatusIcon.displayName = 'StatusIcon';\n\n/** Visually hidden status text, followed by a space so it reads apart from the message. */\nexport function StatusText({ label }: { label: string }) {\n if (!label) return null;\n return <span className=\"sr-only\">{`${label} `}</span>;\n}\nStatusText.displayName = 'StatusText';\n"],"mappings":";;;;;AAWA,IAAaA,IAAkD;CAC7D,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEMC,IAAwD;CAC5D,MAAMC;CACN,SAASC;CACT,SAASC;CACT,OAAOC;AACT,GAMaC,IAAsD;CACjE,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAGaC,IAAkD;CAC7D,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAGA,SAAgBC,EAAe,GAAgB,GAAyC;CACtF,OAAOC,KAAeT,EAAcU;AACtC;AAGA,SAAgBC,EAAW,EAAE,WAAQ,WAA2C;CAC9E,IAAMC,IAAOX,EAAaS;CAC1B,OAAO,kBAACE,GAAD,EAAY,QAAO,CAAA;AAC5B;AACA,EAAW,cAAc;AAGzB,SAAgBC,EAAW,EAAE,YAA4B;CAEvD,OADKC,IACE,kBAAC,QAAD;EAAM,WAAU;EAAW,UAAA,GAAGA,EAAM;CAAS,CAAA,IADjC;AAErB;AACA,EAAW,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../hooks/useId.cjs"),i=require("../../hooks/useFieldControl.cjs"),a=require("../../lib/styles.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c={brand:`bg-primary`,success:`bg-success`,warning:`bg-severe`,error:`bg-error`},l={error:`error`,warning:`warning`,success:`success`};function u(e){return typeof e==`string`&&e.trim()!==``}var d=({value:e,max:d=100,label:f,showLabel:p,color:m,id:h,"aria-describedby":g,"aria-invalid":_,"aria-required":v,className:y,ref:b,...x})=>{let S=r.useId(`progress-label`),C=r.useId(`progress`),w=i.useFieldContext(),T=i.useFieldControl({id:h??(w?C:void 0),"aria-describedby":g},{labelable:!1}),E=w?w.validationState??(w.invalid?`error`:`none`):`none`,D=m??l[E]??`brand`,O=e===void 0,k=Number.isFinite(d)&&d>0,A=O||Number.isFinite(e),j=!O&&k&&A?Math.min(d,Math.max(0,e)):0,M=k?j/d*100:0,N=u(f),P=u(x[`aria-label`]),F=u(x[`aria-labelledby`]),I=T[`aria-labelledby`],L=!N&&!P&&!F&&u(I);o.useEffect(()=>{n.isDev&&(!N&&!P&&!F&&!L&&n.warnOnce(`ProgressBar:name`,"ProgressBar: a progress bar needs an accessible name. Pass `label` (add `showLabel` to show it), `aria-label` or `aria-labelledby`."),p&&!N&&n.warnOnce(`ProgressBar:show-label`,"ProgressBar: `showLabel` renders the `label` prop, which is empty."),k||n.warnOnce(`ProgressBar:max`,`ProgressBar: \`max\` must be a finite number greater than 0 (got ${String(d)}); the bar renders 0%.`),A||n.warnOnce(`ProgressBar:value`,`ProgressBar: \`value\` must be a finite number (got ${String(e)}); the bar renders 0%.`))},[N,P,F,L,p,k,A,d,e]);let R=!!(p&&N),z={role:`progressbar`,"aria-valuenow":O?void 0:j,"aria-valuemin":0,"aria-valuemax":k?d:100,"data-color":D};T.id!==void 0&&(z.id=T.id),T[`aria-describedby`]!==void 0&&(z[`aria-describedby`]=T[`aria-describedby`]),!P&&!F&&(R?z[`aria-labelledby`]=S:N?z[`aria-label`]=f:L&&(z[`aria-labelledby`]=I));for(let[e,t]of Object.entries(x))t!==void 0&&(e!==`aria-label`&&e!==`aria-labelledby`||u(t))&&(z[e]=t);let B=(0,s.jsx)(`div`,{...z,ref:b,className:t.cn(`h-2 overflow-hidden rounded-full bg-track`,`forced-colors:border`,a.forcedColors.border,y),children:(0,s.jsx)(`div`,{className:t.cn(`h-full rounded-full`,c[D],a.forcedColors.selectedLeaf,O&&`w-2/5 animate-wave-indeterminate wave-rtl:animate-wave-indeterminate-rtl motion-reduce:w-full motion-reduce:translate-x-0 motion-reduce:animate-wave-pulse wave-rtl:motion-reduce:animate-wave-pulse`),style:O?void 0:{width:`${M}%`}})});return R?(0,s.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,s.jsx)(`span`,{id:S,className:`text-body-1 text-foreground`,children:f}),B]}):B};d.displayName=`ProgressBar`,exports.ProgressBar=d;
2
+ //# sourceMappingURL=ProgressBar.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.cjs","names":["useId","useFieldContext","useFieldControl","isDev","cn","forcedColors","require_runtime","require_cn","require_dev","require_useId","require_useFieldControl","require_styles","react","react_jsx_runtime","fillColorClasses","fieldColors","isName","value","ProgressBar","ariaDescribedBy","_ariaInvalid","_ariaRequired","rest","labelId","ownId","field","fieldProps","id","fieldState","resolvedColor","color","isIndeterminate","validMax","max","validValue","clamped","percentage","hasLabel","label","hasAriaLabel","hasAriaLabelledBy","fieldLabelledBy","hasFieldName","showLabel","visibleLabel","barProps","key","propValue","bar","className"],"sources":["../../../src/components/feedback/ProgressBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { forcedColors } from '../../lib/styles';\nimport type { ValidationState } from '../../lib/types';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useId } from '../../hooks/useId';\n\n/** Color of a {@link ProgressBar}'s fill. */\nexport type ProgressBarColor = 'brand' | 'success' | 'warning' | 'error';\n\n/** Properties for the ProgressBar component. */\nexport interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value, clamped to `0…max` for both the fill and `aria-valuenow`. Omit for\n * indeterminate mode. A non-finite value renders 0% (development warning).\n */\n value?: number;\n /**\n * Maximum progress value. A `max` of 0 or less, or a non-finite `max`, renders 0% (development\n * warning) and is reported to assistive technology as 0 of 100.\n * @default 100\n */\n max?: number;\n /**\n * Accessible name of the progress bar: `aria-label` by default, or a visible label with\n * `showLabel`. A progress bar needs a name (`label`, `aria-label` or `aria-labelledby`); a\n * development warning fires without one. A consumer `aria-label` or `aria-labelledby` takes\n * precedence over `label`; an empty or whitespace-only one counts as absent (it is not rendered).\n * Inside a `Field`, the Field's label names the bar when neither `label` nor a consumer name is\n * given.\n */\n label?: string;\n /**\n * Renders `label` as visible text above the bar and names the bar with it (`aria-labelledby`)\n * instead of `aria-label`, unless a consumer `aria-label` or `aria-labelledby` names the bar\n * (keep the visible text in that name, WCAG 2.5.3). The label and the bar are then wrapped in a\n * `div`; `ref`, `className`, `style` and the other props stay on the progress bar element.\n */\n showLabel?: boolean;\n /**\n * Color of the fill. Inside a `Field` it follows the Field's validation state (error, warning,\n * success) unless you set it. `warning` fills with the dark orange of the `severe` color, which\n * keeps 3:1 against the track in every theme. The bar carries `data-color` with the resolved\n * color.\n * @default 'brand'\n */\n color?: ProgressBarColor;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst fillColorClasses: Record<ProgressBarColor, string> = {\n brand: 'bg-primary',\n success: 'bg-success',\n // The warning token (a light yellow) is 1.02:1 on the light track: the severe orange passes 3:1.\n warning: 'bg-severe',\n error: 'bg-error',\n};\n\n/** The fill color a Field's validation state gives the bar (`none` keeps the default). */\nconst fieldColors: Partial<Record<ValidationState, ProgressBarColor>> = {\n error: 'error',\n warning: 'warning',\n success: 'success',\n};\n\n/** Whether a name prop (`label`, `aria-label`, `aria-labelledby`) holds more than whitespace. */\nfunction isName(value: unknown): value is string {\n return typeof value === 'string' && value.trim() !== '';\n}\n\n/**\n * Shows the progress of a task, or that a task is running (indeterminate, `value` omitted).\n *\n * - Name it with `label` (or `aria-label` / `aria-labelledby`); `showLabel` shows the label above\n * the bar.\n * - `value` is clamped to `0…max`; invalid numbers render an empty bar and warn in development.\n * - `color` picks the fill (`brand`, `success`, `warning`, `error`).\n * - Inside a `Field`, the Field's label names a bar that has no name of its own, its validation\n * message and hint describe the bar, and its validation state (error, warning, success) colors\n * the fill unless `color` is set. A progress bar is never invalid or required: the\n * `aria-invalid` and `aria-required` a Field adds are not rendered. Next to another control in\n * a Field's wrapper element, the bar gets an id of its own and leaves the Field's\n * `<label htmlFor>` to that control.\n * - The indeterminate animation follows the writing direction and becomes a full-width pulse for\n * reduced motion. In forced-colors mode the fill uses `Highlight` and the track gets a border.\n *\n * @example\n * <ProgressBar value={uploaded} max={total} label=\"Uploading photos\" showLabel />\n *\n * @example\n * <Field label=\"Upload\" validationState=\"warning\" validationMessage=\"The connection is slow.\">\n * <ProgressBar value={uploaded} max={total} />\n * </Field>\n */\nexport const ProgressBar = ({\n value,\n max = 100,\n label,\n showLabel,\n color,\n id,\n 'aria-describedby': ariaDescribedBy,\n // Field merges both into its first child; neither is allowed on role=\"progressbar\".\n 'aria-invalid': _ariaInvalid,\n 'aria-required': _ariaRequired,\n className,\n ref,\n ...rest\n}: ProgressBarProps) => {\n const labelId = useId('progress-label');\n const ownId = useId('progress');\n const field = useFieldContext();\n // A <label htmlFor> cannot name a progress bar, so inside a Field a bar without an id (Field\n // passes its control id to a first child as `id`) takes its own instead of claiming the\n // control id: that stays with the control the label names (an Input next to the bar in a\n // wrapper). No name props are passed, so with `labelable: false` the merged `aria-labelledby`\n // is exactly the Field's label id (or absent); it is used only when the bar has no name of its\n // own.\n const fieldProps = useFieldControl(\n { id: id ?? (field ? ownId : undefined), 'aria-describedby': ariaDescribedBy },\n { labelable: false },\n );\n // A context built before 0.6 has no validation state: read it from `invalid`.\n const fieldState = field ? (field.validationState ?? (field.invalid ? 'error' : 'none')) : 'none';\n const resolvedColor = color ?? fieldColors[fieldState] ?? 'brand';\n const isIndeterminate = value === undefined;\n const validMax = Number.isFinite(max) && max > 0;\n const validValue = isIndeterminate || Number.isFinite(value);\n /** Clamped once, used for both the fill width and `aria-valuenow`. */\n const clamped =\n !isIndeterminate && validMax && validValue ? Math.min(max, Math.max(0, value)) : 0;\n const percentage = validMax ? (clamped / max) * 100 : 0;\n\n // An empty or whitespace-only `label`, `aria-label` or `aria-labelledby` names nothing: it is\n // treated like `undefined` by the precedence, the rendered attributes and the warning alike.\n const hasLabel = isName(label);\n const hasAriaLabel = isName(rest['aria-label']);\n const hasAriaLabelledBy = isName(rest['aria-labelledby']);\n const fieldLabelledBy = fieldProps['aria-labelledby'];\n const hasFieldName = !hasLabel && !hasAriaLabel && !hasAriaLabelledBy && isName(fieldLabelledBy);\n\n // Development diagnostics (C-DEV): emitted from an effect, once per page.\n React.useEffect(() => {\n if (!isDev) return;\n if (!hasLabel && !hasAriaLabel && !hasAriaLabelledBy && !hasFieldName) {\n warnOnce(\n 'ProgressBar:name',\n 'ProgressBar: a progress bar needs an accessible name. Pass `label` (add `showLabel` to show it), `aria-label` or `aria-labelledby`.',\n );\n }\n if (showLabel && !hasLabel) {\n warnOnce(\n 'ProgressBar:show-label',\n 'ProgressBar: `showLabel` renders the `label` prop, which is empty.',\n );\n }\n if (!validMax) {\n warnOnce(\n 'ProgressBar:max',\n `ProgressBar: \\`max\\` must be a finite number greater than 0 (got ${String(max)}); the bar renders 0%.`,\n );\n }\n if (!validValue) {\n warnOnce(\n 'ProgressBar:value',\n `ProgressBar: \\`value\\` must be a finite number (got ${String(value)}); the bar renders 0%.`,\n );\n }\n }, [\n hasLabel,\n hasAriaLabel,\n hasAriaLabelledBy,\n hasFieldName,\n showLabel,\n validMax,\n validValue,\n max,\n value,\n ]);\n\n const visibleLabel = Boolean(showLabel && hasLabel);\n\n /**\n * The bar's attributes. Defaults the consumer may override (C-COMPOSE) apply wherever the\n * consumer's value is `undefined` — also when the key is present, e.g. a wrapper that forwards\n * `aria-label={props['aria-label']}` — so a forwarded `undefined` never strips the role, the\n * values or the name derived from `label`. An empty `aria-label`/`aria-labelledby` is dropped\n * the same way instead of rendering a nameless attribute.\n */\n const barProps: Record<string, unknown> = {\n role: 'progressbar',\n 'aria-valuenow': isIndeterminate ? undefined : clamped,\n 'aria-valuemin': 0,\n 'aria-valuemax': validMax ? max : 100,\n 'data-color': resolvedColor,\n };\n // The consumer's id (or the control id Field passes to its first child), else its own id inside\n // a Field; the consumer's description, then the Field's validation message and hint.\n if (fieldProps.id !== undefined) barProps.id = fieldProps.id;\n if (fieldProps['aria-describedby'] !== undefined) {\n barProps['aria-describedby'] = fieldProps['aria-describedby'];\n }\n // A consumer `aria-label` or `aria-labelledby` wins over the name derived from `label`, also\n // with `showLabel` (the visible label then stays unreferenced text). The Field's label names\n // only a bar without a name of its own.\n if (!hasAriaLabel && !hasAriaLabelledBy) {\n if (visibleLabel) barProps['aria-labelledby'] = labelId;\n else if (hasLabel) barProps['aria-label'] = label;\n else if (hasFieldName) barProps['aria-labelledby'] = fieldLabelledBy;\n }\n for (const [key, propValue] of Object.entries(rest)) {\n if (propValue === undefined) continue;\n if ((key === 'aria-label' || key === 'aria-labelledby') && !isName(propValue)) continue;\n barProps[key] = propValue;\n }\n\n const bar = (\n <div\n {...barProps}\n ref={ref}\n className={cn(\n 'h-2 overflow-hidden rounded-full bg-track',\n 'forced-colors:border',\n forcedColors.border,\n className,\n )}\n >\n <div\n className={cn(\n 'h-full rounded-full',\n fillColorClasses[resolvedColor],\n forcedColors.selectedLeaf,\n isIndeterminate &&\n 'w-2/5 animate-wave-indeterminate wave-rtl:animate-wave-indeterminate-rtl motion-reduce:w-full motion-reduce:translate-x-0 motion-reduce:animate-wave-pulse wave-rtl:motion-reduce:animate-wave-pulse',\n )}\n style={isIndeterminate ? undefined : { width: `${percentage}%` }}\n />\n </div>\n );\n\n if (!visibleLabel) return bar;\n\n return (\n <div className=\"flex flex-col gap-1\">\n <span id={labelId} className=\"text-body-1 text-foreground\">\n {label}\n </span>\n {bar}\n </div>\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n"],"mappings":"+TAmDA,IAAMc,EAAqD,CACzD,MAAO,aACP,QAAS,aAET,QAAS,YACT,MAAO,UACT,EAGMC,EAAkE,CACtE,MAAO,QACP,QAAS,UACT,QAAS,S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B,EAEA,EAAY,YAAc"}
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { isDev as t, warnOnce as n } from "../../lib/dev.mjs";
4
+ import { useId as r } from "../../hooks/useId.mjs";
5
+ import { useFieldContext as i, useFieldControl as a } from "../../hooks/useFieldControl.mjs";
6
+ import { forcedColors as o } from "../../lib/styles.mjs";
7
+ import * as s from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ //#region src/components/feedback/ProgressBar.tsx
10
+ var u = {
11
+ brand: "bg-primary",
12
+ success: "bg-success",
13
+ warning: "bg-severe",
14
+ error: "bg-error"
15
+ }, d = {
16
+ error: "error",
17
+ warning: "warning",
18
+ success: "success"
19
+ };
20
+ function f(e) {
21
+ return typeof e == "string" && e.trim() !== "";
22
+ }
23
+ var p = ({ value: p, max: m = 100, label: h, showLabel: g, color: _, id: v, "aria-describedby": y, "aria-invalid": b, "aria-required": x, className: S, ref: C, ...w }) => {
24
+ let T = r("progress-label"), E = r("progress"), D = i(), O = a({
25
+ id: v ?? (D ? E : void 0),
26
+ "aria-describedby": y
27
+ }, { labelable: !1 }), k = D ? D.validationState ?? (D.invalid ? "error" : "none") : "none", A = _ ?? d[k] ?? "brand", j = p === void 0, M = Number.isFinite(m) && m > 0, N = j || Number.isFinite(p), P = !j && M && N ? Math.min(m, Math.max(0, p)) : 0, F = M ? P / m * 100 : 0, I = f(h), L = f(w["aria-label"]), R = f(w["aria-labelledby"]), z = O["aria-labelledby"], B = !I && !L && !R && f(z);
28
+ s.useEffect(() => {
29
+ t && (!I && !L && !R && !B && n("ProgressBar:name", "ProgressBar: a progress bar needs an accessible name. Pass `label` (add `showLabel` to show it), `aria-label` or `aria-labelledby`."), g && !I && n("ProgressBar:show-label", "ProgressBar: `showLabel` renders the `label` prop, which is empty."), M || n("ProgressBar:max", `ProgressBar: \`max\` must be a finite number greater than 0 (got ${String(m)}); the bar renders 0%.`), N || n("ProgressBar:value", `ProgressBar: \`value\` must be a finite number (got ${String(p)}); the bar renders 0%.`));
30
+ }, [
31
+ I,
32
+ L,
33
+ R,
34
+ B,
35
+ g,
36
+ M,
37
+ N,
38
+ m,
39
+ p
40
+ ]);
41
+ let V = !!(g && I), H = {
42
+ role: "progressbar",
43
+ "aria-valuenow": j ? void 0 : P,
44
+ "aria-valuemin": 0,
45
+ "aria-valuemax": M ? m : 100,
46
+ "data-color": A
47
+ };
48
+ O.id !== void 0 && (H.id = O.id), O["aria-describedby"] !== void 0 && (H["aria-describedby"] = O["aria-describedby"]), !L && !R && (V ? H["aria-labelledby"] = T : I ? H["aria-label"] = h : B && (H["aria-labelledby"] = z));
49
+ for (let [e, t] of Object.entries(w)) t !== void 0 && (e !== "aria-label" && e !== "aria-labelledby" || f(t)) && (H[e] = t);
50
+ let U = /* @__PURE__ */ c("div", {
51
+ ...H,
52
+ ref: C,
53
+ className: e("h-2 overflow-hidden rounded-full bg-track", "forced-colors:border", o.border, S),
54
+ children: /* @__PURE__ */ c("div", {
55
+ className: e("h-full rounded-full", u[A], o.selectedLeaf, j && "w-2/5 animate-wave-indeterminate wave-rtl:animate-wave-indeterminate-rtl motion-reduce:w-full motion-reduce:translate-x-0 motion-reduce:animate-wave-pulse wave-rtl:motion-reduce:animate-wave-pulse"),
56
+ style: j ? void 0 : { width: `${F}%` }
57
+ })
58
+ });
59
+ return V ? /* @__PURE__ */ l("div", {
60
+ className: "flex flex-col gap-1",
61
+ children: [/* @__PURE__ */ c("span", {
62
+ id: T,
63
+ className: "text-body-1 text-foreground",
64
+ children: h
65
+ }), U]
66
+ }) : U;
67
+ };
68
+ p.displayName = "ProgressBar";
69
+ //#endregion
70
+ export { p as ProgressBar };
71
+
72
+ //# sourceMappingURL=ProgressBar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.mjs","names":["useId","useId$1","React","fillColorClasses","fieldColors","isName","value","ProgressBar","ariaDescribedBy","_ariaInvalid","_ariaRequired","rest","labelId","ownId","field","useFieldContext","fieldProps","useFieldControl","id","fieldState","resolvedColor","color","isIndeterminate","validMax","max","validValue","clamped","percentage","hasLabel","label","hasAriaLabel","hasAriaLabelledBy","fieldLabelledBy","hasFieldName","isDev","warnOnce","showLabel","visibleLabel","barProps","key","propValue","bar","cn","forcedColors","className"],"sources":["../../../src/components/feedback/ProgressBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { forcedColors } from '../../lib/styles';\nimport type { ValidationState } from '../../lib/types';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useId } from '../../hooks/useId';\n\n/** Color of a {@link ProgressBar}'s fill. */\nexport type ProgressBarColor = 'brand' | 'success' | 'warning' | 'error';\n\n/** Properties for the ProgressBar component. */\nexport interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value, clamped to `0…max` for both the fill and `aria-valuenow`. Omit for\n * indeterminate mode. A non-finite value renders 0% (development warning).\n */\n value?: number;\n /**\n * Maximum progress value. A `max` of 0 or less, or a non-finite `max`, renders 0% (development\n * warning) and is reported to assistive technology as 0 of 100.\n * @default 100\n */\n max?: number;\n /**\n * Accessible name of the progress bar: `aria-label` by default, or a visible label with\n * `showLabel`. A progress bar needs a name (`label`, `aria-label` or `aria-labelledby`); a\n * development warning fires without one. A consumer `aria-label` or `aria-labelledby` takes\n * precedence over `label`; an empty or whitespace-only one counts as absent (it is not rendered).\n * Inside a `Field`, the Field's label names the bar when neither `label` nor a consumer name is\n * given.\n */\n label?: string;\n /**\n * Renders `label` as visible text above the bar and names the bar with it (`aria-labelledby`)\n * instead of `aria-label`, unless a consumer `aria-label` or `aria-labelledby` names the bar\n * (keep the visible text in that name, WCAG 2.5.3). The label and the bar are then wrapped in a\n * `div`; `ref`, `className`, `style` and the other props stay on the progress bar element.\n */\n showLabel?: boolean;\n /**\n * Color of the fill. Inside a `Field` it follows the Field's validation state (error, warning,\n * success) unless you set it. `warning` fills with the dark orange of the `severe` color, which\n * keeps 3:1 against the track in every theme. The bar carries `data-color` with the resolved\n * color.\n * @default 'brand'\n */\n color?: ProgressBarColor;\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst fillColorClasses: Record<ProgressBarColor, string> = {\n brand: 'bg-primary',\n success: 'bg-success',\n // The warning token (a light yellow) is 1.02:1 on the light track: the severe orange passes 3:1.\n warning: 'bg-severe',\n error: 'bg-error',\n};\n\n/** The fill color a Field's validation state gives the bar (`none` keeps the default). */\nconst fieldColors: Partial<Record<ValidationState, ProgressBarColor>> = {\n error: 'error',\n warning: 'warning',\n success: 'success',\n};\n\n/** Whether a name prop (`label`, `aria-label`, `aria-labelledby`) holds more than whitespace. */\nfunction isName(value: unknown): value is string {\n return typeof value === 'string' && value.trim() !== '';\n}\n\n/**\n * Shows the progress of a task, or that a task is running (indeterminate, `value` omitted).\n *\n * - Name it with `label` (or `aria-label` / `aria-labelledby`); `showLabel` shows the label above\n * the bar.\n * - `value` is clamped to `0…max`; invalid numbers render an empty bar and warn in development.\n * - `color` picks the fill (`brand`, `success`, `warning`, `error`).\n * - Inside a `Field`, the Field's label names a bar that has no name of its own, its validation\n * message and hint describe the bar, and its validation state (error, warning, success) colors\n * the fill unless `color` is set. A progress bar is never invalid or required: the\n * `aria-invalid` and `aria-required` a Field adds are not rendered. Next to another control in\n * a Field's wrapper element, the bar gets an id of its own and leaves the Field's\n * `<label htmlFor>` to that control.\n * - The indeterminate animation follows the writing direction and becomes a full-width pulse for\n * reduced motion. In forced-colors mode the fill uses `Highlight` and the track gets a border.\n *\n * @example\n * <ProgressBar value={uploaded} max={total} label=\"Uploading photos\" showLabel />\n *\n * @example\n * <Field label=\"Upload\" validationState=\"warning\" validationMessage=\"The connection is slow.\">\n * <ProgressBar value={uploaded} max={total} />\n * </Field>\n */\nexport const ProgressBar = ({\n value,\n max = 100,\n label,\n showLabel,\n color,\n id,\n 'aria-describedby': ariaDescribedBy,\n // Field merges both into its first child; neither is allowed on role=\"progressbar\".\n 'aria-invalid': _ariaInvalid,\n 'aria-required': _ariaRequired,\n className,\n ref,\n ...rest\n}: ProgressBarProps) => {\n const labelId = useId('progress-label');\n const ownId = useId('progress');\n const field = useFieldContext();\n // A <label htmlFor> cannot name a progress bar, so inside a Field a bar without an id (Field\n // passes its control id to a first child as `id`) takes its own instead of claiming the\n // control id: that stays with the control the label names (an Input next to the bar in a\n // wrapper). No name props are passed, so with `labelable: false` the merged `aria-labelledby`\n // is exactly the Field's label id (or absent); it is used only when the bar has no name of its\n // own.\n const fieldProps = useFieldControl(\n { id: id ?? (field ? ownId : undefined), 'aria-describedby': ariaDescribedBy },\n { labelable: false },\n );\n // A context built before 0.6 has no validation state: read it from `invalid`.\n const fieldState = field ? (field.validationState ?? (field.invalid ? 'error' : 'none')) : 'none';\n const resolvedColor = color ?? fieldColors[fieldState] ?? 'brand';\n const isIndeterminate = value === undefined;\n const validMax = Number.isFinite(max) && max > 0;\n const validValue = isIndeterminate || Number.isFinite(value);\n /** Clamped once, used for both the fill width and `aria-valuenow`. */\n const clamped =\n !isIndeterminate && validMax && validValue ? Math.min(max, Math.max(0, value)) : 0;\n const percentage = validMax ? (clamped / max) * 100 : 0;\n\n // An empty or whitespace-only `label`, `aria-label` or `aria-labelledby` names nothing: it is\n // treated like `undefined` by the precedence, the rendered attributes and the warning alike.\n const hasLabel = isName(label);\n const hasAriaLabel = isName(rest['aria-label']);\n const hasAriaLabelledBy = isName(rest['aria-labelledby']);\n const fieldLabelledBy = fieldProps['aria-labelledby'];\n const hasFieldName = !hasLabel && !hasAriaLabel && !hasAriaLabelledBy && isName(fieldLabelledBy);\n\n // Development diagnostics (C-DEV): emitted from an effect, once per page.\n React.useEffect(() => {\n if (!isDev) return;\n if (!hasLabel && !hasAriaLabel && !hasAriaLabelledBy && !hasFieldName) {\n warnOnce(\n 'ProgressBar:name',\n 'ProgressBar: a progress bar needs an accessible name. Pass `label` (add `showLabel` to show it), `aria-label` or `aria-labelledby`.',\n );\n }\n if (showLabel && !hasLabel) {\n warnOnce(\n 'ProgressBar:show-label',\n 'ProgressBar: `showLabel` renders the `label` prop, which is empty.',\n );\n }\n if (!validMax) {\n warnOnce(\n 'ProgressBar:max',\n `ProgressBar: \\`max\\` must be a finite number greater than 0 (got ${String(max)}); the bar renders 0%.`,\n );\n }\n if (!validValue) {\n warnOnce(\n 'ProgressBar:value',\n `ProgressBar: \\`value\\` must be a finite number (got ${String(value)}); the bar renders 0%.`,\n );\n }\n }, [\n hasLabel,\n hasAriaLabel,\n hasAriaLabelledBy,\n hasFieldName,\n showLabel,\n validMax,\n validValue,\n max,\n value,\n ]);\n\n const visibleLabel = Boolean(showLabel && hasLabel);\n\n /**\n * The bar's attributes. Defaults the consumer may override (C-COMPOSE) apply wherever the\n * consumer's value is `undefined` — also when the key is present, e.g. a wrapper that forwards\n * `aria-label={props['aria-label']}` — so a forwarded `undefined` never strips the role, the\n * values or the name derived from `label`. An empty `aria-label`/`aria-labelledby` is dropped\n * the same way instead of rendering a nameless attribute.\n */\n const barProps: Record<string, unknown> = {\n role: 'progressbar',\n 'aria-valuenow': isIndeterminate ? undefined : clamped,\n 'aria-valuemin': 0,\n 'aria-valuemax': validMax ? max : 100,\n 'data-color': resolvedColor,\n };\n // The consumer's id (or the control id Field passes to its first child), else its own id inside\n // a Field; the consumer's description, then the Field's validation message and hint.\n if (fieldProps.id !== undefined) barProps.id = fieldProps.id;\n if (fieldProps['aria-describedby'] !== undefined) {\n barProps['aria-describedby'] = fieldProps['aria-describedby'];\n }\n // A consumer `aria-label` or `aria-labelledby` wins over the name derived from `label`, also\n // with `showLabel` (the visible label then stays unreferenced text). The Field's label names\n // only a bar without a name of its own.\n if (!hasAriaLabel && !hasAriaLabelledBy) {\n if (visibleLabel) barProps['aria-labelledby'] = labelId;\n else if (hasLabel) barProps['aria-label'] = label;\n else if (hasFieldName) barProps['aria-labelledby'] = fieldLabelledBy;\n }\n for (const [key, propValue] of Object.entries(rest)) {\n if (propValue === undefined) continue;\n if ((key === 'aria-label' || key === 'aria-labelledby') && !isName(propValue)) continue;\n barProps[key] = propValue;\n }\n\n const bar = (\n <div\n {...barProps}\n ref={ref}\n className={cn(\n 'h-2 overflow-hidden rounded-full bg-track',\n 'forced-colors:border',\n forcedColors.border,\n className,\n )}\n >\n <div\n className={cn(\n 'h-full rounded-full',\n fillColorClasses[resolvedColor],\n forcedColors.selectedLeaf,\n isIndeterminate &&\n 'w-2/5 animate-wave-indeterminate wave-rtl:animate-wave-indeterminate-rtl motion-reduce:w-full motion-reduce:translate-x-0 motion-reduce:animate-wave-pulse wave-rtl:motion-reduce:animate-wave-pulse',\n )}\n style={isIndeterminate ? undefined : { width: `${percentage}%` }}\n />\n </div>\n );\n\n if (!visibleLabel) return bar;\n\n return (\n <div className=\"flex flex-col gap-1\">\n <span id={labelId} className=\"text-body-1 text-foreground\">\n {label}\n </span>\n {bar}\n </div>\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n"],"mappings":";;;;;;;;;AAmDA,IAAMG,IAAqD;CACzD,OAAO;CACP,SAAS;CAET,SAAS;CACT,OAAO;AACT,GAGMC,IAAkE;CACtE,OAAO;CACP,SAAS;CACT,SAAS;AACX;AAGA,SAASC,EAAO,GAAiC;CAC/C,OAAO,OAAOC,KAAU,YAAYA,EAAM,KAAK,MAAM;AACvD;AA0BA,IAAaC,KAAe,EAC1B,UACA,SAAM,KACN,UACA,cACA,UACA,OACA,oBAAoBC,GAEpB,gBAAgBC,GAChB,iBAAiBC,GACjB,cACA,QACA,GAAGC,QACmB;CACtB,IAAMC,IAAUZ,EAAM,gBAAgB,GAChCa,IAAQb,EAAM,UAAU,GACxBc,IAAQC,EAAgB,GAOxBC,IAAaC,EACjB;EAAE,IAAIC,MAAOJ,IAAQD,IAAQ,KAAA;EAAY,oBAAoBL;CAAgB,GAC7E,EAAE,WAAW,GAAM,CACrB,GAEMW,IAAaL,IAASA,EAAM,oBAAoBA,EAAM,UAAU,UAAU,UAAW,QACr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AqBD;CAEvD,KAAK,IAAM,CAACO,GAAKC,MAAc,OAAO,QAAQ7B,CAAI,GAChD,AAAI6B,MAAc,KAAA,MACbD,MAAQ,gBAAgBA,MAAQ,qBAAuBlC,EAAOmC,CAAS,OAC5E,EAASD,KAAOC;CAGlB,IAAMC,IACJ,kBAAC,OAAD;EACE,GAAIH;EACC;EACL,WAAWI,EACT,6CACA,wBACAC,EAAa,QACbC,CACF;EAEA,UAAA,kBAAC,OAAD;GACE,WAAWF,EACT,uBACAvC,EAAiBiB,IACjBuB,EAAa,cACbrB,KACE,sMACJ;GACA,OAAOA,IAAkB,KAAA,IAAY,EAAE,OAAO,GAAGK,EAAW,GAAG;EAChE,CAAA;CACE,CAAA;CAKP,OAFKU,IAGH,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,QAAD;GAAM,IAAIzB;GAAS,WAAU;GAC1B,UAAAiB;EACG,CAAA,GACLY,CACE;MARmBA;AAU5B;AAEA,EAAY,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");var a={text:`rounded`,circular:`circular`,rectangular:`rounded`},o=`forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none`,s={rounded:`rounded`,circular:`rounded-full`,square:`rounded-none`},c=({width:e,height:r,shape:c,variant:l,className:u,style:d,ref:f,...p})=>{let m=n.resolveDeprecatedProp(`Skeleton`,c,l===void 0?void 0:a[l],`variant`,`shape`)??`rounded`;return(0,i.jsx)(`div`,{"aria-hidden":`true`,...p,ref:f,className:t.cn(`bg-skeleton animate-wave-pulse motion-reduce:animate-none`,o,s[m],u),style:{width:e,height:r,...d}})};c.displayName=`Skeleton`;var l=({label:e=`Loading`,"aria-busy":t=!0,children:n,ref:r,...a})=>{let o=t!==!1&&t!==`false`;return(0,i.jsxs)(`div`,{...a,"aria-busy":t,ref:r,children:[o&&(0,i.jsx)(`span`,{className:`sr-only`,children:e}),n]})};l.displayName=`SkeletonGroup`;var u=Object.assign(c,{Group:l});exports.Skeleton=u,exports.SkeletonGroup=l;
2
+ //# sourceMappingURL=Skeleton.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.cjs","names":["resolveDeprecatedProp","cn","require_runtime","require_cn","require_dev","react","react_jsx_runtime","variantShapes","forcedColorsFill","shapeClasses","SkeletonRoot","shapeProp","rest","shape","variant","className","style","SkeletonGroup","busy","loading","label","children","Skeleton"],"sources":["../../../src/components/feedback/Skeleton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { Shape } from '../../lib/types';\n\n/** The 0.4 `variant` values (deprecated; written out in {@link SkeletonProps}, not a public name). */\ntype SkeletonVariant = NonNullable<SkeletonProps['variant']>;\n\n/** `rectangular` rendered with the default 4px radius in 0.4, so it maps to `rounded`. */\nconst variantShapes: Record<SkeletonVariant, Shape> = {\n text: 'rounded',\n circular: 'circular',\n rectangular: 'rounded',\n};\n\n/**\n * Forced colors replace the author fill with the page color, so the placeholder would vanish: it\n * is painted `GrayText` instead (a leaf element, so opting out of forced colors reaches nothing\n * else).\n */\nconst forcedColorsFill = 'forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none';\n\nconst shapeClasses: Record<Shape, string> = {\n rounded: 'rounded',\n circular: 'rounded-full',\n square: 'rounded-none',\n};\n\n/** Properties for the Skeleton component. */\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Width of the skeleton placeholder. */\n width?: string | number;\n /** Height of the skeleton placeholder. */\n height?: string | number;\n /**\n * Geometry of the placeholder: `rounded` (4px radius), `circular` (avatars) or `square`.\n * @default 'rounded'\n */\n shape?: Shape;\n /**\n * @deprecated Use `shape`: `text` and `rectangular` → `rounded` (their 0.4 look), `circular` →\n * `circular`. Still works, warns once in development, and `shape` wins when both are given.\n */\n variant?: 'text' | 'circular' | 'rectangular';\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// The component-level JSDoc sits on the exported `Skeleton` below (it reaches index.d.ts).\nconst SkeletonRoot = ({\n width,\n height,\n shape: shapeProp,\n variant,\n className,\n style,\n ref,\n ...rest\n}: SkeletonProps) => {\n const shape =\n resolveDeprecatedProp(\n 'Skeleton',\n shapeProp,\n variant === undefined ? undefined : variantShapes[variant],\n 'variant',\n 'shape',\n ) ?? 'rounded';\n\n return (\n <div\n aria-hidden=\"true\"\n {...rest}\n ref={ref}\n className={cn(\n 'bg-skeleton animate-wave-pulse motion-reduce:animate-none',\n forcedColorsFill,\n shapeClasses[shape],\n className,\n )}\n style={{ width, height, ...style }}\n />\n );\n};\nSkeletonRoot.displayName = 'Skeleton';\n\n/** Properties for the Skeleton.Group component. */\nexport interface SkeletonGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visually hidden text announced in place of the decorative placeholders. Localize it.\n * @default 'Loading'\n */\n label?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Container for the Skeletons of a loading region: `aria-busy=\"true\"` plus a visually hidden\n * `label` (\"Loading\"), while the placeholders stay decorative. It uses no live-region role, so it\n * does not interrupt; announce completion separately if needed. When the content arrives, remove\n * the group or pass `aria-busy={false}`, which also drops the hidden label (no stale \"Loading\" is\n * read before the content). A forwarded `aria-busy={undefined}` keeps the busy default. Flat\n * export for React Server Components (`Skeleton.Group` in client files).\n */\nexport const SkeletonGroup = ({\n label = 'Loading',\n // Destructured with a default rather than set before `{...rest}`: a wrapper that forwards\n // `aria-busy={props['aria-busy']}` passes `undefined`, which must not strip the busy state.\n 'aria-busy': busy = true,\n children,\n ref,\n ...rest\n}: SkeletonGroupProps) => {\n const loading = busy !== false && busy !== 'false';\n return (\n <div {...rest} aria-busy={busy} ref={ref}>\n {loading && <span className=\"sr-only\">{label}</span>}\n {children}\n </div>\n );\n};\nSkeletonGroup.displayName = 'SkeletonGroup';\n\n/**\n * A decorative loading placeholder. Each Skeleton is `aria-hidden` (a consumer `aria-hidden`\n * overrides it); wrap the placeholders of a loading region in {@link SkeletonGroup}\n * (`Skeleton.Group`), which marks it busy and gives it a visually hidden \"Loading\" label.\n * The pulse animation stops for reduced motion; in forced-colors mode the placeholders are\n * painted `GrayText`. In React Server Components use the flat export `SkeletonGroup` instead of\n * `Skeleton.Group`.\n *\n * @example\n * <Skeleton.Group label=\"Loading profile\">\n * <Skeleton shape=\"circular\" width={32} height={32} />\n * <Skeleton width={160} height={12} />\n * </Skeleton.Group>\n */\nexport const Skeleton = /* @__PURE__ */ Object.assign(SkeletonRoot, { Group: SkeletonGroup });\n"],"mappings":"6MASA,IAAMO,EAAgD,CACpD,KAAM,UACN,SAAU,WACV,YAAa,SACf,EAOMC,EAAmB,qEAEnBC,EAAsC,CAC1C,QAAS,UACT,SAAU,eACV,OAAQ,cACV,EAsBMC,GAAgB,CACpB,QACA,SACA,MAAOC,EACP,UACA,YACA,QACA,MACA,GAAGC,KACgB,CACnB,IAAMC,EACJb,EAAAA,sBACE,WACAW,EACAG,IAAY,IAAA,GAAY,IAAA,GAAYP,EAAcO,GAClD,UACA,OACF,GAAK,UAEP,OACE,EAAAR,EAAA,IAAA,CAAC,MAAD,CACE,cAAY,OACZ,GAAIM,EACC,MACL,UAAWX,EAAAA,GACT,4DACAO,EACAC,EAAaI,GACbE,CACF,EACA,MAAO,CAAE,QAAO,SAAQ,GAAGC,CAAM,CAClC,CAAA,CAEL,EACA,EAAa,YAAc,WAoB3B,IAAaC,GAAiB,CAC5B,QAAQ,UAGR,YAAaC,EAAO,GACpB,WACA,MACA,GAAGN,KACqB,CACxB,IAAMO,EAAUD,IAAS,IAASA,IAAS,QAC3C,OACE,EAAAZ,EAAA,KAAA,CAAC,MAAD,CAAK,GAAIM,EAAM,YAAWM,EAAW,MAArC,SAAA,CACGC,IAAW,EAAAb,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,UAAW,SAAAc,CAAY,CAAA,EAClDC,CACE,GAET,EACA,EAAc,YAAc,gBAgB5B,IAAaC,EAA2B,OAAO,OAAOZ,EAAc,CAAE,MAAOO,CAAc,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { resolveDeprecatedProp as t } from "../../lib/dev.mjs";
4
+ import "react";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
+ //#region src/components/feedback/Skeleton.tsx
7
+ var i = {
8
+ text: "rounded",
9
+ circular: "circular",
10
+ rectangular: "rounded"
11
+ }, a = "forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none", o = {
12
+ rounded: "rounded",
13
+ circular: "rounded-full",
14
+ square: "rounded-none"
15
+ }, s = ({ width: r, height: s, shape: c, variant: l, className: u, style: d, ref: f, ...p }) => {
16
+ let m = t("Skeleton", c, l === void 0 ? void 0 : i[l], "variant", "shape") ?? "rounded";
17
+ return /* @__PURE__ */ n("div", {
18
+ "aria-hidden": "true",
19
+ ...p,
20
+ ref: f,
21
+ className: e("bg-skeleton animate-wave-pulse motion-reduce:animate-none", a, o[m], u),
22
+ style: {
23
+ width: r,
24
+ height: s,
25
+ ...d
26
+ }
27
+ });
28
+ };
29
+ s.displayName = "Skeleton";
30
+ var c = ({ label: e = "Loading", "aria-busy": t = !0, children: i, ref: a, ...o }) => {
31
+ let s = t !== !1 && t !== "false";
32
+ return /* @__PURE__ */ r("div", {
33
+ ...o,
34
+ "aria-busy": t,
35
+ ref: a,
36
+ children: [s && /* @__PURE__ */ n("span", {
37
+ className: "sr-only",
38
+ children: e
39
+ }), i]
40
+ });
41
+ };
42
+ c.displayName = "SkeletonGroup";
43
+ var l = /* @__PURE__ */ Object.assign(s, { Group: c });
44
+ //#endregion
45
+ export { l as Skeleton, c as SkeletonGroup };
46
+
47
+ //# sourceMappingURL=Skeleton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Skeleton.mjs","names":["variantShapes","forcedColorsFill","shapeClasses","SkeletonRoot","shapeProp","rest","shape","resolveDeprecatedProp","variant","cn","className","style","SkeletonGroup","busy","loading","label","children","Skeleton"],"sources":["../../../src/components/feedback/Skeleton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { resolveDeprecatedProp } from '../../lib/dev';\nimport type { Shape } from '../../lib/types';\n\n/** The 0.4 `variant` values (deprecated; written out in {@link SkeletonProps}, not a public name). */\ntype SkeletonVariant = NonNullable<SkeletonProps['variant']>;\n\n/** `rectangular` rendered with the default 4px radius in 0.4, so it maps to `rounded`. */\nconst variantShapes: Record<SkeletonVariant, Shape> = {\n text: 'rounded',\n circular: 'circular',\n rectangular: 'rounded',\n};\n\n/**\n * Forced colors replace the author fill with the page color, so the placeholder would vanish: it\n * is painted `GrayText` instead (a leaf element, so opting out of forced colors reaches nothing\n * else).\n */\nconst forcedColorsFill = 'forced-colors:bg-[GrayText] forced-colors:forced-color-adjust-none';\n\nconst shapeClasses: Record<Shape, string> = {\n rounded: 'rounded',\n circular: 'rounded-full',\n square: 'rounded-none',\n};\n\n/** Properties for the Skeleton component. */\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Width of the skeleton placeholder. */\n width?: string | number;\n /** Height of the skeleton placeholder. */\n height?: string | number;\n /**\n * Geometry of the placeholder: `rounded` (4px radius), `circular` (avatars) or `square`.\n * @default 'rounded'\n */\n shape?: Shape;\n /**\n * @deprecated Use `shape`: `text` and `rectangular` → `rounded` (their 0.4 look), `circular` →\n * `circular`. Still works, warns once in development, and `shape` wins when both are given.\n */\n variant?: 'text' | 'circular' | 'rectangular';\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// The component-level JSDoc sits on the exported `Skeleton` below (it reaches index.d.ts).\nconst SkeletonRoot = ({\n width,\n height,\n shape: shapeProp,\n variant,\n className,\n style,\n ref,\n ...rest\n}: SkeletonProps) => {\n const shape =\n resolveDeprecatedProp(\n 'Skeleton',\n shapeProp,\n variant === undefined ? undefined : variantShapes[variant],\n 'variant',\n 'shape',\n ) ?? 'rounded';\n\n return (\n <div\n aria-hidden=\"true\"\n {...rest}\n ref={ref}\n className={cn(\n 'bg-skeleton animate-wave-pulse motion-reduce:animate-none',\n forcedColorsFill,\n shapeClasses[shape],\n className,\n )}\n style={{ width, height, ...style }}\n />\n );\n};\nSkeletonRoot.displayName = 'Skeleton';\n\n/** Properties for the Skeleton.Group component. */\nexport interface SkeletonGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Visually hidden text announced in place of the decorative placeholders. Localize it.\n * @default 'Loading'\n */\n label?: string;\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Container for the Skeletons of a loading region: `aria-busy=\"true\"` plus a visually hidden\n * `label` (\"Loading\"), while the placeholders stay decorative. It uses no live-region role, so it\n * does not interrupt; announce completion separately if needed. When the content arrives, remove\n * the group or pass `aria-busy={false}`, which also drops the hidden label (no stale \"Loading\" is\n * read before the content). A forwarded `aria-busy={undefined}` keeps the busy default. Flat\n * export for React Server Components (`Skeleton.Group` in client files).\n */\nexport const SkeletonGroup = ({\n label = 'Loading',\n // Destructured with a default rather than set before `{...rest}`: a wrapper that forwards\n // `aria-busy={props['aria-busy']}` passes `undefined`, which must not strip the busy state.\n 'aria-busy': busy = true,\n children,\n ref,\n ...rest\n}: SkeletonGroupProps) => {\n const loading = busy !== false && busy !== 'false';\n return (\n <div {...rest} aria-busy={busy} ref={ref}>\n {loading && <span className=\"sr-only\">{label}</span>}\n {children}\n </div>\n );\n};\nSkeletonGroup.displayName = 'SkeletonGroup';\n\n/**\n * A decorative loading placeholder. Each Skeleton is `aria-hidden` (a consumer `aria-hidden`\n * overrides it); wrap the placeholders of a loading region in {@link SkeletonGroup}\n * (`Skeleton.Group`), which marks it busy and gives it a visually hidden \"Loading\" label.\n * The pulse animation stops for reduced motion; in forced-colors mode the placeholders are\n * painted `GrayText`. In React Server Components use the flat export `SkeletonGroup` instead of\n * `Skeleton.Group`.\n *\n * @example\n * <Skeleton.Group label=\"Loading profile\">\n * <Skeleton shape=\"circular\" width={32} height={32} />\n * <Skeleton width={160} height={12} />\n * </Skeleton.Group>\n */\nexport const Skeleton = /* @__PURE__ */ Object.assign(SkeletonRoot, { Group: SkeletonGroup });\n"],"mappings":";;;;;;AASA,IAAMA,IAAgD;CACpD,MAAM;CACN,UAAU;CACV,aAAa;AACf,GAOMC,IAAmB,sEAEnBC,IAAsC;CAC1C,SAAS;CACT,UAAU;CACV,QAAQ;AACV,GAsBMC,KAAgB,EACpB,UACA,WACA,OAAOC,GACP,YACA,cACA,UACA,QACA,GAAGC,QACgB;CACnB,IAAMC,IACJC,EACE,YACAH,GACAI,MAAY,KAAA,IAAY,KAAA,IAAYR,EAAcQ,IAClD,WACA,OACF,KAAK;CAEP,OACE,kBAAC,OAAD;EACE,eAAY;EACZ,GAAIH;EACC;EACL,WAAWI,EACT,6DACAR,GACAC,EAAaI,IACbI,CACF;EACA,OAAO;GAAE;GAAO;GAAQ,GAAGC;EAAM;CAClC,CAAA;AAEL;AACA,EAAa,cAAc;AAoB3B,IAAaC,KAAiB,EAC5B,WAAQ,WAGR,aAAaC,IAAO,IACpB,aACA,QACA,GAAGR,QACqB;CACxB,IAAMS,IAAUD,MAAS,MAASA,MAAS;CAC3C,OACE,kBAAC,OAAD;EAAK,GAAIR;EAAM,aAAWQ;EAAW;EAArC,UAAA,CACGC,KAAW,kBAAC,QAAD;GAAM,WAAU;GAAW,UAAAC;EAAY,CAAA,GAClDC,CACE;;AAET;AACA,EAAc,cAAc;AAgB5B,IAAaC,IAA2B,uBAAO,OAAOd,GAAc,EAAE,OAAOS,EAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/styles.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime");function a(e){return typeof e==`string`&&e.trim()!==``}var o={"extra-small":`w-3 h-3`,small:`w-4 h-4`,medium:`w-6 h-6`,large:`w-9 h-9`,"extra-large":`w-12 h-12`},s={primary:{ring:`border-track border-t-primary`,label:`text-muted-foreground`},inverted:{ring:`border-current/30 border-t-current`,label:`text-current`}},c=({size:e=`medium`,label:c=`Loading`,labelVisible:l,appearance:u=`primary`,delay:d=0,className:f,role:p=`status`,ref:m,...h})=>{let g=Number.isFinite(d)&&d>0?d:0,[_,v]=r.useState(g===0),[y,b]=r.useState(!1);r.useEffect(()=>{if(_)return;let e=setTimeout(()=>v(!0),g);return()=>clearTimeout(e)},[_,g]),r.useEffect(()=>{if(!_)return;let e=requestAnimationFrame(()=>b(!0));return()=>cancelAnimationFrame(e)},[_]);let x=p===`progressbar`&&!a(h[`aria-label`])&&!a(h[`aria-labelledby`]),S=Object.hasOwn(s,u??``)?u:`primary`,C=s[S];return(0,i.jsxs)(`span`,{"data-appearance":S,"data-state":_?`shown`:`delayed`,...h,role:p,"aria-label":x?c:h[`aria-label`],ref:m,className:t.cn(`inline-flex items-center gap-2`,f),children:[_?(0,i.jsx)(`span`,{"aria-hidden":`true`,"data-wave-spinner-ring":``,className:t.cn(`rounded-full border-2 animate-wave-spin motion-reduce:animate-wave-spin-slow`,C.ring,n.forcedColors.ringArc,o[e])}):null,(0,i.jsx)(`span`,{"data-wave-spinner-label":``,className:l?t.cn(`text-body-1`,C.label):`sr-only`,children:y?c:null})]})};c.displayName=`Spinner`,exports.Spinner=c;
2
+ //# sourceMappingURL=Spinner.cjs.map