@mortenbrudvik/waveui 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/README.md +564 -155
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoButton.cjs +2 -0
  63. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  64. package/dist/components/data-display/InfoButton.mjs +173 -0
  65. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  66. package/dist/components/data-display/InfoLabel.cjs +1 -1
  67. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  68. package/dist/components/data-display/InfoLabel.mjs +36 -92
  69. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  70. package/dist/components/data-display/List.cjs +1 -1
  71. package/dist/components/data-display/List.cjs.map +1 -1
  72. package/dist/components/data-display/List.mjs +175 -174
  73. package/dist/components/data-display/List.mjs.map +1 -1
  74. package/dist/components/data-display/Persona.cjs +1 -1
  75. package/dist/components/data-display/Persona.cjs.map +1 -1
  76. package/dist/components/data-display/Persona.mjs +31 -29
  77. package/dist/components/data-display/Persona.mjs.map +1 -1
  78. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  79. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  80. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  81. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  82. package/dist/components/data-display/Tag.cjs +1 -1
  83. package/dist/components/data-display/Tag.cjs.map +1 -1
  84. package/dist/components/data-display/Tag.mjs +87 -82
  85. package/dist/components/data-display/Tag.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.cjs +1 -1
  87. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  88. package/dist/components/feedback/MessageBar.mjs +129 -71
  89. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  90. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  93. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  95. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  96. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  97. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  98. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  99. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  100. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  101. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  102. package/dist/components/feedback/ProgressBar.cjs +1 -1
  103. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  104. package/dist/components/feedback/ProgressBar.mjs +44 -43
  105. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  106. package/dist/components/feedback/Skeleton.cjs +1 -1
  107. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  108. package/dist/components/feedback/Skeleton.mjs +26 -24
  109. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  110. package/dist/components/feedback/Spinner.cjs +1 -1
  111. package/dist/components/feedback/Spinner.cjs.map +1 -1
  112. package/dist/components/feedback/Spinner.mjs +32 -31
  113. package/dist/components/feedback/Spinner.mjs.map +1 -1
  114. package/dist/components/feedback/Toast.cjs +1 -1
  115. package/dist/components/feedback/Toast.cjs.map +1 -1
  116. package/dist/components/feedback/Toast.context.cjs +2 -0
  117. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  118. package/dist/components/feedback/Toast.context.mjs +23 -0
  119. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  120. package/dist/components/feedback/Toast.mjs +10 -342
  121. package/dist/components/feedback/Toast.mjs.map +1 -1
  122. package/dist/components/feedback/Toast.parts.cjs +2 -0
  123. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.parts.mjs +98 -0
  125. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  126. package/dist/components/feedback/Toast.root.cjs +2 -0
  127. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  128. package/dist/components/feedback/Toast.root.mjs +109 -0
  129. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  130. package/dist/components/feedback/Toaster.cjs +2 -0
  131. package/dist/components/feedback/Toaster.cjs.map +1 -0
  132. package/dist/components/feedback/Toaster.mjs +564 -0
  133. package/dist/components/feedback/Toaster.mjs.map +1 -0
  134. package/dist/components/input/AlphaSlider.cjs +2 -0
  135. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  136. package/dist/components/input/AlphaSlider.mjs +115 -0
  137. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  138. package/dist/components/input/Checkbox.cjs +1 -1
  139. package/dist/components/input/Checkbox.cjs.map +1 -1
  140. package/dist/components/input/Checkbox.mjs +87 -70
  141. package/dist/components/input/Checkbox.mjs.map +1 -1
  142. package/dist/components/input/ColorArea.cjs +2 -0
  143. package/dist/components/input/ColorArea.cjs.map +1 -0
  144. package/dist/components/input/ColorArea.mjs +204 -0
  145. package/dist/components/input/ColorArea.mjs.map +1 -0
  146. package/dist/components/input/ColorPicker.cjs +5 -5
  147. package/dist/components/input/ColorPicker.cjs.map +1 -1
  148. package/dist/components/input/ColorPicker.mjs +142 -165
  149. package/dist/components/input/ColorPicker.mjs.map +1 -1
  150. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  151. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  152. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  153. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  154. package/dist/components/input/ColorSlider.cjs +2 -0
  155. package/dist/components/input/ColorSlider.cjs.map +1 -0
  156. package/dist/components/input/ColorSlider.mjs +138 -0
  157. package/dist/components/input/ColorSlider.mjs.map +1 -0
  158. package/dist/components/input/Combobox.cjs +1 -1
  159. package/dist/components/input/Combobox.cjs.map +1 -1
  160. package/dist/components/input/Combobox.expand.cjs +1 -1
  161. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  162. package/dist/components/input/Combobox.expand.mjs +22 -22
  163. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  164. package/dist/components/input/Combobox.mjs +151 -141
  165. package/dist/components/input/Combobox.mjs.map +1 -1
  166. package/dist/components/input/DatePicker.cjs +1 -1
  167. package/dist/components/input/DatePicker.cjs.map +1 -1
  168. package/dist/components/input/DatePicker.mjs +239 -234
  169. package/dist/components/input/DatePicker.mjs.map +1 -1
  170. package/dist/components/input/Dropdown.cjs +1 -1
  171. package/dist/components/input/Dropdown.cjs.map +1 -1
  172. package/dist/components/input/Dropdown.mjs +109 -100
  173. package/dist/components/input/Dropdown.mjs.map +1 -1
  174. package/dist/components/input/Field.cjs +1 -1
  175. package/dist/components/input/Field.cjs.map +1 -1
  176. package/dist/components/input/Field.mjs +139 -105
  177. package/dist/components/input/Field.mjs.map +1 -1
  178. package/dist/components/input/Input.cjs +1 -1
  179. package/dist/components/input/Input.cjs.map +1 -1
  180. package/dist/components/input/Input.mjs +80 -55
  181. package/dist/components/input/Input.mjs.map +1 -1
  182. package/dist/components/input/Label.cjs +1 -1
  183. package/dist/components/input/Label.cjs.map +1 -1
  184. package/dist/components/input/Label.mjs +19 -12
  185. package/dist/components/input/Label.mjs.map +1 -1
  186. package/dist/components/input/Option.cjs +1 -1
  187. package/dist/components/input/Option.cjs.map +1 -1
  188. package/dist/components/input/Option.mjs +100 -98
  189. package/dist/components/input/Option.mjs.map +1 -1
  190. package/dist/components/input/RadioGroup.cjs +1 -1
  191. package/dist/components/input/RadioGroup.cjs.map +1 -1
  192. package/dist/components/input/RadioGroup.mjs +89 -88
  193. package/dist/components/input/RadioGroup.mjs.map +1 -1
  194. package/dist/components/input/Rating.cjs +1 -1
  195. package/dist/components/input/Rating.cjs.map +1 -1
  196. package/dist/components/input/Rating.item.cjs +2 -0
  197. package/dist/components/input/Rating.item.cjs.map +1 -0
  198. package/dist/components/input/Rating.item.mjs +255 -0
  199. package/dist/components/input/Rating.item.mjs.map +1 -0
  200. package/dist/components/input/Rating.mjs +152 -152
  201. package/dist/components/input/Rating.mjs.map +1 -1
  202. package/dist/components/input/SearchBox.cjs +1 -1
  203. package/dist/components/input/SearchBox.cjs.map +1 -1
  204. package/dist/components/input/SearchBox.mjs +162 -132
  205. package/dist/components/input/SearchBox.mjs.map +1 -1
  206. package/dist/components/input/Select.cjs +1 -1
  207. package/dist/components/input/Select.cjs.map +1 -1
  208. package/dist/components/input/Select.mjs +34 -24
  209. package/dist/components/input/Select.mjs.map +1 -1
  210. package/dist/components/input/Slider.cjs +1 -1
  211. package/dist/components/input/Slider.cjs.map +1 -1
  212. package/dist/components/input/Slider.mjs +78 -54
  213. package/dist/components/input/Slider.mjs.map +1 -1
  214. package/dist/components/input/SpinButton.cjs +1 -1
  215. package/dist/components/input/SpinButton.cjs.map +1 -1
  216. package/dist/components/input/SpinButton.mjs +202 -99
  217. package/dist/components/input/SpinButton.mjs.map +1 -1
  218. package/dist/components/input/SwatchPicker.cjs +1 -1
  219. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  220. package/dist/components/input/SwatchPicker.mjs +38 -37
  221. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  222. package/dist/components/input/Switch.cjs +1 -1
  223. package/dist/components/input/Switch.cjs.map +1 -1
  224. package/dist/components/input/Switch.mjs +75 -58
  225. package/dist/components/input/Switch.mjs.map +1 -1
  226. package/dist/components/input/TagPicker.cjs +1 -1
  227. package/dist/components/input/TagPicker.cjs.map +1 -1
  228. package/dist/components/input/TagPicker.mjs +199 -169
  229. package/dist/components/input/TagPicker.mjs.map +1 -1
  230. package/dist/components/input/Textarea.cjs +1 -1
  231. package/dist/components/input/Textarea.cjs.map +1 -1
  232. package/dist/components/input/Textarea.mjs +31 -23
  233. package/dist/components/input/Textarea.mjs.map +1 -1
  234. package/dist/components/input/TimePicker.cjs +1 -1
  235. package/dist/components/input/TimePicker.cjs.map +1 -1
  236. package/dist/components/input/TimePicker.mjs +185 -177
  237. package/dist/components/input/TimePicker.mjs.map +1 -1
  238. package/dist/components/input/colorName.cjs +2 -0
  239. package/dist/components/input/colorName.cjs.map +1 -0
  240. package/dist/components/input/colorName.mjs +30 -0
  241. package/dist/components/input/colorName.mjs.map +1 -0
  242. package/dist/components/input/colorUtils.cjs +1 -1
  243. package/dist/components/input/colorUtils.cjs.map +1 -1
  244. package/dist/components/input/colorUtils.mjs +154 -56
  245. package/dist/components/input/colorUtils.mjs.map +1 -1
  246. package/dist/components/input/fieldLabel.cjs +2 -0
  247. package/dist/components/input/fieldLabel.cjs.map +1 -0
  248. package/dist/components/input/fieldLabel.mjs +17 -0
  249. package/dist/components/input/fieldLabel.mjs.map +1 -0
  250. package/dist/components/input/inputLook.cjs +2 -0
  251. package/dist/components/input/inputLook.cjs.map +1 -0
  252. package/dist/components/input/inputLook.mjs +28 -0
  253. package/dist/components/input/inputLook.mjs.map +1 -0
  254. package/dist/components/input/pickerStyles.cjs +1 -1
  255. package/dist/components/input/pickerStyles.cjs.map +1 -1
  256. package/dist/components/input/pickerStyles.mjs +42 -4
  257. package/dist/components/input/pickerStyles.mjs.map +1 -1
  258. package/dist/components/layout/Accordion.cjs +1 -1
  259. package/dist/components/layout/Accordion.cjs.map +1 -1
  260. package/dist/components/layout/Accordion.mjs +130 -129
  261. package/dist/components/layout/Accordion.mjs.map +1 -1
  262. package/dist/components/layout/Card.cjs +1 -1
  263. package/dist/components/layout/Card.cjs.map +1 -1
  264. package/dist/components/layout/Card.mjs +78 -77
  265. package/dist/components/layout/Card.mjs.map +1 -1
  266. package/dist/components/layout/Carousel.cjs +1 -1
  267. package/dist/components/layout/Carousel.cjs.map +1 -1
  268. package/dist/components/layout/Carousel.mjs +111 -110
  269. package/dist/components/layout/Carousel.mjs.map +1 -1
  270. package/dist/components/layout/Flex.cjs +1 -1
  271. package/dist/components/layout/Flex.cjs.map +1 -1
  272. package/dist/components/layout/Flex.mjs +22 -21
  273. package/dist/components/layout/Flex.mjs.map +1 -1
  274. package/dist/components/layout/Grid.cjs +1 -1
  275. package/dist/components/layout/Grid.cjs.map +1 -1
  276. package/dist/components/layout/Grid.mjs +19 -18
  277. package/dist/components/layout/Grid.mjs.map +1 -1
  278. package/dist/components/layout/Overflow.cjs +1 -1
  279. package/dist/components/layout/Overflow.cjs.map +1 -1
  280. package/dist/components/layout/Overflow.mjs +92 -91
  281. package/dist/components/layout/Overflow.mjs.map +1 -1
  282. package/dist/components/layout/Stack.cjs +1 -1
  283. package/dist/components/layout/Stack.cjs.map +1 -1
  284. package/dist/components/layout/Stack.mjs +14 -13
  285. package/dist/components/layout/Stack.mjs.map +1 -1
  286. package/dist/components/layout/TabList.cjs +1 -1
  287. package/dist/components/layout/TabList.cjs.map +1 -1
  288. package/dist/components/layout/TabList.mjs +118 -117
  289. package/dist/components/layout/TabList.mjs.map +1 -1
  290. package/dist/components/layout/Tree.cjs +1 -1
  291. package/dist/components/layout/Tree.cjs.map +1 -1
  292. package/dist/components/layout/Tree.context.cjs +2 -0
  293. package/dist/components/layout/Tree.context.cjs.map +1 -0
  294. package/dist/components/layout/Tree.context.mjs +33 -0
  295. package/dist/components/layout/Tree.context.mjs.map +1 -0
  296. package/dist/components/layout/Tree.core.cjs +2 -0
  297. package/dist/components/layout/Tree.core.cjs.map +1 -0
  298. package/dist/components/layout/Tree.core.mjs +416 -0
  299. package/dist/components/layout/Tree.core.mjs.map +1 -0
  300. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  301. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  302. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  303. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  304. package/dist/components/layout/Tree.mjs +7 -215
  305. package/dist/components/layout/Tree.mjs.map +1 -1
  306. package/dist/components/layout/Tree.selection.cjs +2 -0
  307. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  308. package/dist/components/layout/Tree.selection.mjs +73 -0
  309. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  310. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  311. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  312. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  313. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.group.cjs +1 -1
  315. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.group.mjs +39 -37
  317. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.items.cjs +1 -1
  319. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.items.mjs +67 -61
  321. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.link.cjs +1 -1
  323. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.link.mjs +34 -28
  325. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  326. package/dist/components/navigation/Menu.popover.cjs +1 -1
  327. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  328. package/dist/components/navigation/Menu.popover.mjs +114 -113
  329. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  330. package/dist/components/navigation/Menu.root.cjs +1 -1
  331. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  332. package/dist/components/navigation/Menu.root.mjs +171 -170
  333. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  334. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  335. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  336. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  337. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  338. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  339. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  340. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  341. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  342. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  343. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  344. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  345. package/dist/components/navigation/Nav.cjs +1 -1
  346. package/dist/components/navigation/Nav.cjs.map +1 -1
  347. package/dist/components/navigation/Nav.mjs +170 -155
  348. package/dist/components/navigation/Nav.mjs.map +1 -1
  349. package/dist/components/navigation/Pagination.cjs +1 -1
  350. package/dist/components/navigation/Pagination.cjs.map +1 -1
  351. package/dist/components/navigation/Pagination.mjs +73 -65
  352. package/dist/components/navigation/Pagination.mjs.map +1 -1
  353. package/dist/components/navigation/Stepper.cjs +1 -1
  354. package/dist/components/navigation/Stepper.cjs.map +1 -1
  355. package/dist/components/navigation/Stepper.mjs +110 -109
  356. package/dist/components/navigation/Stepper.mjs.map +1 -1
  357. package/dist/components/overlays/Dialog.cjs +1 -1
  358. package/dist/components/overlays/Dialog.cjs.map +1 -1
  359. package/dist/components/overlays/Dialog.mjs +109 -108
  360. package/dist/components/overlays/Dialog.mjs.map +1 -1
  361. package/dist/components/overlays/Drawer.cjs +1 -1
  362. package/dist/components/overlays/Drawer.cjs.map +1 -1
  363. package/dist/components/overlays/Drawer.mjs +110 -109
  364. package/dist/components/overlays/Drawer.mjs.map +1 -1
  365. package/dist/components/overlays/Popover.cjs +1 -1
  366. package/dist/components/overlays/Popover.cjs.map +1 -1
  367. package/dist/components/overlays/Popover.mjs +148 -151
  368. package/dist/components/overlays/Popover.mjs.map +1 -1
  369. package/dist/components/overlays/Popover.shared.cjs +1 -1
  370. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  371. package/dist/components/overlays/Popover.shared.mjs +82 -77
  372. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  373. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  374. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  375. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  376. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  377. package/dist/components/overlays/Tooltip.cjs +1 -1
  378. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  379. package/dist/components/overlays/Tooltip.mjs +87 -86
  380. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  381. package/dist/components/portal/Portal.cjs +1 -1
  382. package/dist/components/portal/Portal.cjs.map +1 -1
  383. package/dist/components/portal/Portal.mjs +33 -32
  384. package/dist/components/portal/Portal.mjs.map +1 -1
  385. package/dist/components/provider/WaveProvider.cjs +1 -1
  386. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  387. package/dist/components/provider/WaveProvider.mjs +36 -29
  388. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  389. package/dist/components/table/DataGrid.cjs +1 -1
  390. package/dist/components/table/DataGrid.cjs.map +1 -1
  391. package/dist/components/table/DataGrid.mjs +228 -227
  392. package/dist/components/table/DataGrid.mjs.map +1 -1
  393. package/dist/components/table/Table.cjs +1 -1
  394. package/dist/components/table/Table.cjs.map +1 -1
  395. package/dist/components/table/Table.mjs +60 -59
  396. package/dist/components/table/Table.mjs.map +1 -1
  397. package/dist/components/typography/Text.cjs +1 -1
  398. package/dist/components/typography/Text.cjs.map +1 -1
  399. package/dist/components/typography/Text.mjs +12 -11
  400. package/dist/components/typography/Text.mjs.map +1 -1
  401. package/dist/hooks/useFieldControl.cjs.map +1 -1
  402. package/dist/hooks/useFieldControl.mjs.map +1 -1
  403. package/dist/hooks/useMediaQuery.cjs +2 -0
  404. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  405. package/dist/hooks/useMediaQuery.mjs +20 -0
  406. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  407. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  408. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  409. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  410. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  411. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  412. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  413. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  414. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  415. package/dist/index.cjs +1 -1
  416. package/dist/index.d.cts +2890 -197
  417. package/dist/index.d.ts +2890 -197
  418. package/dist/index.mjs +101 -87
  419. package/dist/lib/classNames.cjs +2 -0
  420. package/dist/lib/classNames.cjs.map +1 -0
  421. package/dist/lib/classNames.mjs +423 -0
  422. package/dist/lib/classNames.mjs.map +1 -0
  423. package/dist/lib/color.cjs +2 -0
  424. package/dist/lib/color.cjs.map +1 -0
  425. package/dist/lib/color.mjs +86 -0
  426. package/dist/lib/color.mjs.map +1 -0
  427. package/dist/lib/globalRegistry.cjs.map +1 -1
  428. package/dist/lib/globalRegistry.mjs.map +1 -1
  429. package/dist/lib/styles.cjs +1 -1
  430. package/dist/lib/styles.cjs.map +1 -1
  431. package/dist/lib/styles.mjs +21 -4
  432. package/dist/lib/styles.mjs.map +1 -1
  433. package/dist/lib/toaster.cjs +2 -0
  434. package/dist/lib/toaster.cjs.map +1 -0
  435. package/dist/lib/toaster.mjs +77 -0
  436. package/dist/lib/toaster.mjs.map +1 -0
  437. package/dist/styles.css +1 -1
  438. package/package.json +1 -1
  439. package/src/styles/tokens.css +13 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rating.item.cjs","names":["unwrapButtonGlyph","slotRendersContent","React","renderSlot","cn","StarIcon","ratingItemClassNames","ratingDisplayClassNames","ratingClassNames","getDirection","composeEventHandlers","isOwnEvent","focusRing","materialiseSlotContent","require_runtime","require_cn","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_direction","require_styles","require_Button_slots","require_icons","require_events","react","react_jsx_runtime","FILLED_COLOR","UNFILLED_COLOR","resolveRatingColor","color","sizeMap","targetPaddingMap","DEFAULT_GLYPHS","resolveGlyph","slot","renders","glyph","button","useGlyphWarnings","empty","component","name","useStarGlyphs","filled","iconFilled","outline","iconOutline","onlyOne","filledGlyph","outlineGlyph","starLook","glyphs","GlyphLayer","className","StarGlyph","rest","percent","fraction","starSize","size","unfilled","starClassName","iconClassName","look","noop","INERT_RATING_CONTEXT","RatingContext","useRatingContext","useRatingItemRegistry","registry","counts","value","count","useRatingItemChecks","max","hasItems","RatingItem","ctx","registerItem","ownGlyphs","starProps","half","drawn","pick","rect","event","onClick","radio","onPointerMove","radioKey","radioValue","index","radioProps","key","onMouseEnter","ratingItems","items","children","i"],"sources":["../../../src/components/input/Rating.item.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ratingClassNames,\n ratingDisplayClassNames,\n ratingItemClassNames,\n} from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { getDirection } from '../../lib/direction';\nimport { isOwnEvent } from '../../lib/events';\nimport { StarIcon } from '../../lib/icons';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Size } from '../../lib/types';\nimport { unwrapButtonGlyph, type UnwrappedButton } from '../button/Button.slots';\n\n/** Color of a rating's filled stars. */\nexport type RatingColor = 'neutral' | 'brand' | 'marigold';\n\n/** Filled-star color of each `color` (unfilled stars keep {@link UNFILLED_COLOR}). */\nexport const FILLED_COLOR: Readonly<Record<RatingColor, string>> = {\n marigold: 'text-rating',\n brand: 'text-primary',\n neutral: 'text-foreground',\n};\n\n/** Unfilled-star color in every `color`: the outline token, with a 3:1 non-text contrast. */\nconst UNFILLED_COLOR = 'text-stroke-accessible';\n\n/**\n * The color a root draws (Phase 4 D24): `color` itself, or `'marigold'` (the default) for\n * `undefined` and for a value outside the union from untyped code.\n */\nexport function resolveRatingColor(color: RatingColor | undefined): RatingColor {\n return color === 'brand' || color === 'neutral' ? color : 'marigold';\n}\n\n/** Icon size of each star size. */\nconst sizeMap: Record<Size, string> = {\n 'extra-small': 'h-3 w-3',\n small: 'h-4 w-4',\n medium: 'h-5 w-5',\n large: 'h-6 w-6',\n 'extra-large': 'h-8 w-8',\n};\n\n/** Padding that gives every interactive star a target of at least 24×24px (WCAG 2.5.8). */\nconst targetPaddingMap: Record<Size, string> = {\n 'extra-small': 'p-1.5', // 12px icon + 12px\n small: 'p-1', // 16px icon + 8px\n medium: 'p-0.5', // 20px icon + 4px\n large: 'p-0.5',\n 'extra-large': 'p-0.5',\n};\n\n/**\n * The glyphs a star draws, from an `iconFilled`/`iconOutline` pair resolved by\n * {@link useStarGlyphs}: `null` draws the default star.\n */\nexport interface StarGlyphs {\n /** The glyph of a filled star, or `null` for the default star. */\n filled: Slot<'span'> | null;\n /** The glyph of an unfilled star, or `null` for the default star. */\n outline: Slot<'span'> | null;\n}\n\n/** The default stars: what a rating without an icon pair draws. */\nconst DEFAULT_GLYPHS: StarGlyphs = { filled: null, outline: null };\n\n/** One glyph of an icon pair, resolved, with what its development warnings need. */\ninterface ResolvedGlyph {\n /** What the star draws: the glyph, or `null` for the default star. */\n glyph: Slot<'span'> | null;\n /** The button unwrapped from the slot, if any. */\n button: UnwrappedButton | null;\n /** The slot is set but renders nothing (an unwrapped button warns about itself instead). */\n empty: boolean;\n}\n\n/**\n * One glyph of an icon pair (C-SLOTS: a required indicator, and a glyph inside a wired button,\n * the radio of a Rating): a button passed as the glyph is unwrapped, its children becoming the\n * glyph, and `null`, `undefined` and a value that renders nothing keep the default star.\n */\nfunction resolveGlyph(slot: Slot<'span'> | undefined): ResolvedGlyph {\n const { glyph, button } = unwrapButtonGlyph(slot);\n const renders = slotRendersContent(glyph);\n return {\n glyph: renders ? glyph : null,\n button,\n empty: slot != null && button === null && !renders,\n };\n}\n\n/** The development warnings of one glyph of a pair (C-DEV: from an effect, once per key). */\nfunction useGlyphWarnings(\n component: string,\n name: 'iconFilled' | 'iconOutline',\n { button, empty }: ResolvedGlyph,\n) {\n React.useEffect(() => {\n if (empty) {\n warnOnce(\n `${component}:${name}-empty`,\n `${component}: \\`${name}\\` renders nothing, so the default star is used.`,\n );\n }\n if (button) {\n warnOnce(\n `${component}:${name}-button`,\n `${component}: \\`${name}\\` received ${button}; its children render as the glyph of the ` +\n 'star and its props were dropped (buttons cannot be nested). Pass icon content ' +\n `instead, e.g. \\`${name}={<MyIcon />}\\`.`,\n );\n }\n }, [component, name, empty, button]);\n}\n\n/**\n * The glyphs of a component's `iconFilled`/`iconOutline` pair (Phase 4 D25), with the pair's\n * development warnings, each from an effect and once per key (C-DEV): only one of the two set\n * (`<component>:icon-pair`), a glyph that renders nothing (`<component>:iconFilled-empty`,\n * `<component>:iconOutline-empty`) and a button unwrapped (`<component>:iconFilled-button`,\n * `<component>:iconOutline-button`). The result keeps its identity while the glyphs do.\n *\n * @param component The public name that starts the keys and messages: `'Rating'`,\n * `'RatingDisplay'` or `'Rating.Item'`.\n */\nexport function useStarGlyphs(\n component: string,\n iconFilled: Slot<'span'> | undefined,\n iconOutline: Slot<'span'> | undefined,\n): StarGlyphs {\n const filled = resolveGlyph(iconFilled);\n const outline = resolveGlyph(iconOutline);\n // A custom glyph next to the default star mixes shapes.\n const onlyOne = (iconFilled === undefined) !== (iconOutline === undefined);\n React.useEffect(() => {\n if (onlyOne) {\n warnOnce(\n `${component}:icon-pair`,\n `${component}: pass both \\`iconFilled\\` and \\`iconOutline\\`: with only one of them, the ` +\n 'other is the default star.',\n );\n }\n }, [component, onlyOne]);\n useGlyphWarnings(component, 'iconFilled', filled);\n useGlyphWarnings(component, 'iconOutline', outline);\n const filledGlyph = filled.glyph;\n const outlineGlyph = outline.glyph;\n return React.useMemo(\n () => ({ filled: filledGlyph, outline: outlineGlyph }),\n [filledGlyph, outlineGlyph],\n );\n}\n\n/** How a whole star looks, filled or unfilled: see {@link starLook}. */\ninterface StarLook {\n /** The color class: the rating color when filled, else the outline token. */\n colorClass: string;\n /** The glyph of the pair to draw (`null`: the default star). */\n glyph: Slot<'span'> | null;\n}\n\n/**\n * The one look of a star (every star kind draws through it): a filled star takes the rating\n * color and the filled glyph of the pair, an unfilled star the outline token and the outline\n * glyph.\n */\nfunction starLook(filled: boolean, color: RatingColor, glyphs: StarGlyphs): StarLook {\n return filled\n ? { colorClass: FILLED_COLOR[color], glyph: glyphs.filled }\n : { colorClass: UNFILLED_COLOR, glyph: glyphs.outline };\n}\n\n/**\n * Draws only the glyph of a star, in the color its box sets: the custom `glyph` when there is\n * one, in a decorative span of the star's size (an SVG child fills it), else the default star,\n * filled or outlined. The box around it (a {@link StarGlyph}, or the radio of a whole star)\n * carries the color.\n */\nfunction GlyphLayer({\n filled,\n glyph,\n className,\n}: {\n filled: boolean;\n glyph: Slot<'span'> | null;\n className: string;\n}) {\n if (glyph != null) {\n return renderSlot(glyph, 'span', cn('inline-flex shrink-0 [&>svg]:size-full', className), {\n 'aria-hidden': true,\n });\n }\n return filled ? (\n <StarIcon className={className} />\n ) : (\n <StarIcon className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5} />\n );\n}\nGlyphLayer.displayName = 'GlyphLayer';\n\n/** Properties of {@link StarGlyph}. */\nexport interface StarGlyphProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {\n /**\n * How much of the star is filled: `1` filled, `0` unfilled, and a partly filled star in between\n * (clamped to 0…1, drawn to the whole percent).\n */\n fraction: number;\n /** The star size. */\n size: Size;\n /** The color of the filled glyph; the unfilled glyph keeps the 3:1 outline token. */\n color: RatingColor;\n /** The glyphs to draw, from {@link useStarGlyphs}. */\n glyphs: StarGlyphs;\n /**\n * The stable classes of the star's `<span>` (P3-00), first in its class list, before\n * `className`: a star part, and a RatingItem's root.\n */\n starClassName?: string;\n /** The stable classes of every glyph it draws (P3-00): the icon parts. */\n iconClassName?: string;\n /** Ref to the star's `<span>`. */\n ref?: React.Ref<HTMLSpanElement>;\n}\n\n/**\n * One star drawn filled to `fraction`, in a `<span>` that is the star's own box, so it draws the\n * same wherever it is placed: at 1 the filled glyph in the rating color, at 0 the unfilled glyph\n * in the outline color, and in between the unfilled glyph with the filled glyph clipped over it\n * from the inline start to the fraction (the reading direction of the stars, also under RTL).\n * The stars of a RatingDisplay (each item, and the compact star) and the half stars of a Rating\n * draw through it; a whole radio star is a box itself (its button carries the color) and draws\n * its glyph with {@link GlyphLayer}.\n */\nexport const StarGlyph = ({\n fraction,\n size,\n color,\n glyphs,\n starClassName,\n iconClassName,\n className,\n ref,\n ...rest\n}: StarGlyphProps) => {\n const percent = Math.round(Math.min(1, Math.max(0, fraction)) * 100);\n const starSize = sizeMap[size];\n if (percent > 0 && percent < 100) {\n const unfilled = starLook(false, color, glyphs);\n const filled = starLook(true, color, glyphs);\n return (\n <span\n {...rest}\n ref={ref}\n className={cn(starClassName, 'relative inline-flex', unfilled.colorClass, className)}\n >\n <GlyphLayer filled={false} glyph={unfilled.glyph} className={cn(iconClassName, starSize)} />\n <span\n className={cn('absolute inset-y-0 start-0 flex overflow-hidden', filled.colorClass)}\n style={{ width: `${percent}%` }}\n >\n <GlyphLayer\n filled\n glyph={filled.glyph}\n className={cn(iconClassName, starSize, 'shrink-0')}\n />\n </span>\n </span>\n );\n }\n const filled = percent === 100;\n const look = starLook(filled, color, glyphs);\n return (\n <span\n {...rest}\n ref={ref}\n className={cn(starClassName, 'inline-flex', look.colorClass, className)}\n >\n <GlyphLayer filled={filled} glyph={look.glyph} className={cn(iconClassName, starSize)} />\n </span>\n );\n};\nStarGlyph.displayName = 'StarGlyph';\n\n/**\n * What a Rating or a RatingDisplay tells its items: the stars render from it, whether the root\n * generated them or the consumer passed them as children.\n */\nexport interface RatingContextValue {\n /** `'input'`: the items are the radios of a Rating; `'display'`: the drawn stars of a RatingDisplay. */\n kind: 'input' | 'display';\n /** The chosen rating (a Rating) or the displayed value (a RatingDisplay). */\n value: number;\n /** The value the stars draw: a Rating's hover preview while there is one, else `value`. */\n drawnValue: number;\n /** The grain of the values a star chooses. */\n step: 0.5 | 1;\n /** The number of stars: the key range, and the second argument of `starLabel`. */\n max: number;\n /** The star size. */\n size: Size;\n /** The color of the filled stars (resolved: a value outside the union is `'marigold'`). */\n color: RatingColor;\n /**\n * The glyphs of the root's `iconFilled`/`iconOutline` pair, for every item (an item that sets\n * its own pair draws that one instead).\n */\n glyphs: StarGlyphs;\n /** The stars cannot be chosen or previewed (a disabled Rating, and every RatingDisplay). */\n disabled: boolean;\n /** The accessible name of the radio that chooses `value` (the root's `labels.star`). */\n starLabel: (value: number, max: number) => string;\n /** The roving `tabIndex` of the radio whose `data-roving-value` is `key`. */\n getTabIndex: (key: string) => number;\n /**\n * Chooses `value`; with `focus`, the radio of `value` also takes focus, without scrolling (a\n * pointer click on a half star).\n */\n choose: (value: number, focus: boolean) => void;\n /** Previews `value` under the mouse (`0` clears the preview). */\n preview: (value: number) => void;\n /** Counts a mounted item's value; returns the cleanup that uncounts it. */\n registerItem: (value: number) => () => void;\n}\n\nconst noop = () => {};\n\n/**\n * The context of an item outside a rating (production; development throws there): an empty,\n * read-only star. RatingDisplay starts from it, since its stars choose, preview and rove nothing.\n */\nexport const INERT_RATING_CONTEXT: RatingContextValue = {\n kind: 'display',\n value: 0,\n drawnValue: 0,\n step: 1,\n max: 5,\n size: 'medium',\n color: 'marigold',\n glyphs: DEFAULT_GLYPHS,\n disabled: true,\n starLabel: () => '',\n getTabIndex: () => -1,\n choose: noop,\n preview: noop,\n registerItem: () => noop,\n};\n\n/** Provided by Rating and RatingDisplay to their items; `null` outside them. */\nexport const RatingContext = React.createContext<RatingContextValue | null>(null);\nRatingContext.displayName = 'RatingContext';\n\n/** C-CONTEXT: throws in development, logs once and returns the inert value in production. */\nexport function useRatingContext(): RatingContextValue {\n const context = React.useContext(RatingContext);\n if (context) return context;\n reportMissingContext('Rating.Item', 'a rating (Rating or RatingDisplay)');\n return INERT_RATING_CONTEXT;\n}\n\n/** The item registry of a rating root: the values of its mounted items, counted. */\nexport interface RatingItemRegistry {\n /**\n * Counts a mounted item's value and returns the cleanup that uncounts it. Items call it from a\n * layout effect.\n */\n registerItem: (value: number) => () => void;\n /**\n * How many mounted items have each value. The items change it in their layout effects, so read\n * it in an effect of the root (a passive effect runs after every layout effect of the commit),\n * never during render.\n */\n counts: ReadonlyMap<number, number>;\n}\n\n/**\n * A rating root's item registry: one object, with the same `registerItem` and `counts`, for the\n * root's lifetime, so the memoized context keeps its identity.\n */\nexport function useRatingItemRegistry(): RatingItemRegistry {\n const [registry] = React.useState<RatingItemRegistry>(() => {\n const counts = new Map<number, number>();\n return {\n counts,\n registerItem: (value) => {\n counts.set(value, (counts.get(value) ?? 0) + 1);\n return () => {\n const count = (counts.get(value) ?? 1) - 1;\n if (count > 0) counts.set(value, count);\n else counts.delete(value);\n };\n },\n };\n });\n return registry;\n}\n\n/**\n * The item value checks of a rating root (Phase 4 D26, C-DEV): a passive effect, run after every\n * layout effect of the commit (so every item's own layout effect has already registered its\n * value, C-HOOKS: `counts` is never read during render), that warns once per problem found. No\n * dependency array: `counts` keeps its identity for the root's lifetime (`useRatingItemRegistry`)\n * and only its entries change in place, so the effect must re-run on every commit to see a later\n * change, exactly as the registration effects of `useListbox` do.\n *\n * - A value more than one item registers is not unique (`Rating.Item:duplicate:<value>`).\n * - A value that is not a whole number from 1 to `max` — untyped code, or a mistake — is not one\n * of the star positions the root can draw (`Rating.Item:value:<value>`).\n * - `hasItems`: the root draws its own children instead of the `max` generated stars, which\n * always cover every value on their own; only then can a value from 1 to `max` be left without\n * an item, and only the first one found is named (`Rating.Item:missing`).\n */\nexport function useRatingItemChecks(\n counts: ReadonlyMap<number, number>,\n max: number,\n hasItems: boolean,\n): void {\n React.useEffect(() => {\n for (const [value, count] of counts) {\n if (count > 1) {\n warnOnce(\n `Rating.Item:duplicate:${value}`,\n `Rating.Item: two items have the value ${value}; give each star a unique value from 1 ` +\n 'to max.',\n );\n }\n if (!Number.isInteger(value) || value < 1 || value > max) {\n warnOnce(\n `Rating.Item:value:${value}`,\n `Rating.Item: the value ${value} is not a whole number from 1 to ${max}.`,\n );\n }\n }\n if (!hasItems) return;\n for (let value = 1; value <= max; value++) {\n if (!counts.has(value)) {\n warnOnce(\n 'Rating.Item:missing',\n `Rating.Item: no item has the value ${value}; pass one Rating.Item per value from 1 to ` +\n 'max.',\n );\n return;\n }\n }\n });\n}\n\n/** Properties for the RatingItem component (`Rating.Item`, `RatingDisplay.Item`). */\nexport interface RatingItemProps extends Omit<\n React.HTMLAttributes<HTMLElement>,\n 'role' | 'aria-checked' | 'aria-label' | 'aria-labelledby' | 'tabIndex' | 'children' | 'onChange'\n> {\n /**\n * The star's full value, from 1 to the root's `max`: the rating it chooses (with the root's\n * `step={0.5}` also its half, `value - 0.5`), or shows.\n */\n value: number;\n /**\n * The glyph of this star when filled, as a pair with `iconOutline`, following the rules of the\n * root's `iconFilled` (a button is unwrapped, its children becoming the glyph, and a value or\n * button children that render nothing draw the default star). An item that sets either glyph\n * of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves\n * unset is the default star (a development warning says so).\n */\n iconFilled?: Slot<'span'>;\n /**\n * The glyph of this star when unfilled, as a pair with `iconFilled`, following the rules of the\n * root's `iconOutline` (a button is unwrapped, its children becoming the glyph, and a value or\n * button children that render nothing draw the default star). An item that sets either glyph\n * of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves\n * unset is the default star (a development warning says so).\n */\n iconOutline?: Slot<'span'>;\n /**\n * Ref to the star element: the `role=\"radio\"` button in a Rating, the star `<span>` in a Rating\n * with `step={0.5}` and in a RatingDisplay.\n */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * One star of a `Rating` or a `RatingDisplay`, drawn from its root: pass one per value from 1 to\n * `max` as the root's children, in place of the stars it generates.\n *\n * - In a `Rating` it is a `role=\"radio\"` button named by the root's `labels.star` (\"2 stars\"),\n * chosen, previewed and roved as a generated star is. With the root's `step={0.5}` it is a star\n * `<span>`, one pointer target that chooses by the pointer's position, holding two transparent\n * radios: its half value, then its full value (\"1.5 stars\", \"2 stars\"). In a `RatingDisplay` it\n * is a star filled, partly filled or empty by the root's value.\n * - It draws the root's `color` and glyph pair, or its own `iconFilled`/`iconOutline` pair when it\n * sets one.\n * - `className`, `style`, `data-*`, the other attributes, the handlers and `ref` go to that star\n * element, the consumer's handlers first. The role, name, checked state and tab stop of its\n * radio (or radios) come from the root.\n * - At `step={1}` the consumer's `onClick` and `onMouseEnter` compose onto the radio itself, so a\n * `preventDefault()` in either vetoes that star's own activation or hover preview. At\n * `step={0.5}` `onClick` and `onPointerMove` compose onto the star `<span>` instead: its two\n * radios run their own `onClick` first and choose their own value directly (Space, Enter, a\n * screen reader, or `radio.click()`), before the click bubbles to the span's composed handler,\n * so a `preventDefault()` there vetoes only a pointer-chosen value, never a keyboard or\n * assistive-technology activation.\n * - Outside a `Rating` or `RatingDisplay` it throws in development.\n */\nexport const RatingItem = ({\n value,\n iconFilled,\n iconOutline,\n className,\n ref,\n ...rest\n}: RatingItemProps) => {\n const ctx = useRatingContext();\n const { registerItem } = ctx;\n React.useLayoutEffect(() => registerItem(value), [registerItem, value]);\n // The item's own pair, when it sets either glyph, replaces its root's pair as a whole.\n const ownGlyphs = useStarGlyphs('Rating.Item', iconFilled, iconOutline);\n const glyphs = iconFilled !== undefined || iconOutline !== undefined ? ownGlyphs : ctx.glyphs;\n // Stable classes (P3-00): the item's own, then its rating's part classes (a public component\n // rendered inside another, D5), whether the root generated the item or the consumer passed it.\n const starClassName =\n ctx.kind === 'display'\n ? cn(ratingItemClassNames.root, ratingDisplayClassNames.star)\n : cn(ratingItemClassNames.root, ratingClassNames.star);\n const iconClassName =\n ctx.kind === 'display'\n ? cn(ratingItemClassNames.icon, ratingDisplayClassNames.icon)\n : cn(ratingItemClassNames.icon, ratingClassNames.icon);\n\n // `rest` keeps every consumer handler: a star without handlers of its own (a display star)\n // spreads them all, and a star that composes one takes that one out of `rest` itself.\n if (ctx.kind === 'display') {\n // Filled by the share of this star that the drawn value covers.\n return (\n <StarGlyph\n {...rest}\n ref={ref as React.Ref<HTMLSpanElement>}\n starClassName={starClassName}\n iconClassName={iconClassName}\n className={className}\n fraction={ctx.drawnValue - (value - 1)}\n size={ctx.size}\n color={ctx.color}\n glyphs={glyphs}\n />\n );\n }\n\n if (ctx.step === 0.5) {\n // A half star (D22): one pointer target (a span with the padding of a whole star) holding two\n // transparent radios over its halves, the half value first. The pointer chooses by its\n // position over the star; the keyboard and screen readers use the radios. The span composes\n // the consumer's click and pointer-move handlers with its own.\n const { onClick, onPointerMove, ...starProps } = rest;\n const half = value - 0.5;\n const drawn = ctx.drawnValue;\n const fraction = drawn >= value ? 1 : drawn >= half ? 0.5 : 0;\n // The value under the pointer: the half from the inline start (mirrored under RTL), else the\n // full value.\n const pick = (event: React.MouseEvent<HTMLElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n const fromStart =\n getDirection(event.currentTarget) === 'rtl'\n ? rect.right - event.clientX\n : event.clientX - rect.left;\n return fromStart < rect.width / 2 ? half : value;\n };\n return (\n <span\n {...starProps}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(\n starClassName,\n 'relative inline-flex cursor-pointer rounded',\n targetPaddingMap[ctx.size],\n 'has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-ring',\n ctx.disabled && 'cursor-not-allowed',\n className,\n )}\n onClick={composeEventHandlers(onClick, (event) => {\n // A click on a radio (Space, Enter, a screen reader, `click()`) chose its own value, and\n // a click without a press (`detail` 0) or from a portal inside the star is not the\n // pointer's to place. The radio search is bounded to this star: an unrelated\n // `role=\"radio\"` ancestor elsewhere in the document (the star's own radios have no\n // children, so a pointer click's target is never one of them, `pointer-events-none`)\n // must not silence every pointer pick.\n if (ctx.disabled || event.detail === 0 || !isOwnEvent(event)) return;\n const radio = (event.target as Element).closest('[role=\"radio\"]');\n if (radio && event.currentTarget.contains(radio)) return;\n ctx.choose(pick(event), true);\n })}\n onPointerMove={composeEventHandlers(onPointerMove, (event) => {\n if (!ctx.disabled && event.pointerType === 'mouse' && isOwnEvent(event)) {\n ctx.preview(pick(event));\n }\n })}\n >\n <StarGlyph\n iconClassName={iconClassName}\n fraction={fraction}\n size={ctx.size}\n color={ctx.color}\n glyphs={glyphs}\n />\n {[half, value].map((radioValue, index) => {\n const radioKey = String(radioValue);\n return (\n <button\n key={radioKey}\n type=\"button\"\n role=\"radio\"\n aria-checked={ctx.value === radioValue}\n aria-label={ctx.starLabel(radioValue, ctx.max)}\n data-roving-value={radioKey}\n tabIndex={ctx.disabled ? -1 : ctx.getTabIndex(radioKey)}\n disabled={ctx.disabled}\n className={cn(\n 'pointer-events-none absolute inset-y-0 w-1/2 border-0 bg-transparent p-0 opacity-0',\n index === 0 ? 'start-0' : 'end-0',\n )}\n onClick={() => {\n // Choosing the current value again is a no-op for both callbacks (useControllable).\n if (!ctx.disabled) ctx.choose(radioValue, false);\n }}\n />\n );\n })}\n </span>\n );\n }\n\n // The radio composes the consumer's click and mouse-enter handlers with its own. It is the\n // star's box itself (the button carries the color), so it draws only the glyph.\n const { onClick, onMouseEnter, ...radioProps } = rest;\n const key = String(value);\n const filled = ctx.drawnValue >= value;\n const look = starLook(filled, ctx.color, glyphs);\n return (\n <button\n type=\"button\"\n {...radioProps}\n ref={ref as React.Ref<HTMLButtonElement>}\n role=\"radio\"\n aria-checked={ctx.value === value}\n aria-label={ctx.starLabel(value, ctx.max)}\n data-roving-value={key}\n tabIndex={ctx.disabled ? -1 : ctx.getTabIndex(key)}\n disabled={ctx.disabled}\n className={cn(\n starClassName,\n 'inline-flex cursor-pointer rounded border-0 bg-transparent transition-colors motion-reduce:transition-none disabled:cursor-not-allowed',\n targetPaddingMap[ctx.size],\n focusRing,\n look.colorClass,\n className,\n )}\n onClick={composeEventHandlers(onClick, (event) => {\n // Choosing the current star again is a no-op for both callbacks (useControllable). A click\n // from a portal rendered inside the star (a custom glyph's popup) is not the star's.\n if (!ctx.disabled && isOwnEvent(event)) ctx.choose(value, false);\n })}\n onMouseEnter={composeEventHandlers(onMouseEnter, (event) => {\n if (!ctx.disabled && isOwnEvent(event)) ctx.preview(value);\n })}\n >\n <GlyphLayer\n filled={filled}\n glyph={look.glyph}\n className={cn(iconClassName, sizeMap[ctx.size])}\n />\n </button>\n );\n};\nRatingItem.displayName = 'RatingItem';\n\n/**\n * A root's stars: its `children` when they render content, else one generated item per value\n * from 1 to `max`.\n */\nexport function ratingItems(children: React.ReactNode, max: number): React.ReactNode {\n const items = materialiseSlotContent(children);\n return slotRendersContent(items)\n ? items\n : Array.from({ length: max }, (_, i) => <RatingItem key={i + 1} value={i + 1} />);\n}\n"],"mappings":"qfAqBA,IAAa2B,EAAsD,CACjE,SAAU,cACV,MAAO,eACP,QAAS,iBACX,EAGMC,EAAiB,yBAMvB,SAAgBC,EAAmB,EAA6C,CA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tD,CAACjB,EAAI,UAAYnE,EAAAA,WAAW2E,CAAK,GAAGR,EAAI,QAAQN,CAAK,CAC3D,CAAC,EAED,UAAA,EAAA9C,EAAA,IAAA,CAAC2B,EAAD,CACU,SACR,MAAOW,EAAK,MACZ,UAAW5D,EAAAA,GAAG2D,EAAehC,EAAQ+C,EAAI,KAAK,CAC/C,CAAA,CACK,CAAA,CAEZ,EACA,EAAW,YAAc,aAMzB,SAAgBkB,EAAY,EAA2B,EAA8B,CACnF,IAAMC,EAAQpF,EAAAA,uBAAuBqF,CAAQ,EAC7C,OAAOjG,EAAAA,mBAAmBgG,CAAK,EAC3BA,EACA,MAAM,KAAK,CAAE,OAAQtB,CAAI,GAAI,EAAG,KAAM,EAAAjD,EAAA,IAAA,CAACmD,EAAD,CAAwB,MAAOsB,EAAI,CAAI,EAAtBA,EAAI,CAAkB,CAAC,CACpF"}
@@ -0,0 +1,255 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { reportMissingContext as t, warnOnce as n } from "../../lib/dev.mjs";
4
+ import { materialiseSlotContent as r, renderSlot as i, slotRendersContent as a } from "../../lib/slot.mjs";
5
+ import { composeEventHandlers as o } from "../../lib/composeEventHandlers.mjs";
6
+ import { ratingClassNames as s, ratingDisplayClassNames as c, ratingItemClassNames as l } from "../../lib/classNames.mjs";
7
+ import { getDirection as u } from "../../lib/direction.mjs";
8
+ import { focusRing as d } from "../../lib/styles.mjs";
9
+ import { unwrapButtonGlyph as f } from "../button/Button.slots.mjs";
10
+ import { StarIcon as p } from "../../lib/icons.mjs";
11
+ import { isOwnEvent as m } from "../../lib/events.mjs";
12
+ import * as h from "react";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ //#region src/components/input/Rating.item.tsx
15
+ var v = {
16
+ marigold: "text-rating",
17
+ brand: "text-primary",
18
+ neutral: "text-foreground"
19
+ }, y = "text-stroke-accessible";
20
+ function b(e) {
21
+ return e === "brand" || e === "neutral" ? e : "marigold";
22
+ }
23
+ var x = {
24
+ "extra-small": "h-3 w-3",
25
+ small: "h-4 w-4",
26
+ medium: "h-5 w-5",
27
+ large: "h-6 w-6",
28
+ "extra-large": "h-8 w-8"
29
+ }, S = {
30
+ "extra-small": "p-1.5",
31
+ small: "p-1",
32
+ medium: "p-0.5",
33
+ large: "p-0.5",
34
+ "extra-large": "p-0.5"
35
+ }, C = {
36
+ filled: null,
37
+ outline: null
38
+ };
39
+ function w(e) {
40
+ let { glyph: t, button: n } = f(e), r = a(t);
41
+ return {
42
+ glyph: r ? t : null,
43
+ button: n,
44
+ empty: e != null && n === null && !r
45
+ };
46
+ }
47
+ function T(e, t, { button: r, empty: i }) {
48
+ h.useEffect(() => {
49
+ i && n(`${e}:${t}-empty`, `${e}: \`${t}\` renders nothing, so the default star is used.`), r && n(`${e}:${t}-button`, `${e}: \`${t}\` received ${r}; its children render as the glyph of the star and its props were dropped (buttons cannot be nested). Pass icon content instead, e.g. \`${t}={<MyIcon />}\`.`);
50
+ }, [
51
+ e,
52
+ t,
53
+ i,
54
+ r
55
+ ]);
56
+ }
57
+ function E(e, t, r) {
58
+ let i = w(t), a = w(r), o = t === void 0 != (r === void 0);
59
+ h.useEffect(() => {
60
+ o && n(`${e}:icon-pair`, `${e}: pass both \`iconFilled\` and \`iconOutline\`: with only one of them, the other is the default star.`);
61
+ }, [e, o]), T(e, "iconFilled", i), T(e, "iconOutline", a);
62
+ let s = i.glyph, c = a.glyph;
63
+ return h.useMemo(() => ({
64
+ filled: s,
65
+ outline: c
66
+ }), [s, c]);
67
+ }
68
+ function D(e, t, n) {
69
+ return e ? {
70
+ colorClass: v[t],
71
+ glyph: n.filled
72
+ } : {
73
+ colorClass: y,
74
+ glyph: n.outline
75
+ };
76
+ }
77
+ function O({ filled: t, glyph: n, className: r }) {
78
+ return n == null ? t ? /* @__PURE__ */ g(p, { className: r }) : /* @__PURE__ */ g(p, {
79
+ className: r,
80
+ fill: "none",
81
+ stroke: "currentColor",
82
+ strokeWidth: 1.5
83
+ }) : i(n, "span", e("inline-flex shrink-0 [&>svg]:size-full", r), { "aria-hidden": !0 });
84
+ }
85
+ O.displayName = "GlyphLayer";
86
+ var k = ({ fraction: t, size: n, color: r, glyphs: i, starClassName: a, iconClassName: o, className: s, ref: c, ...l }) => {
87
+ let u = Math.round(Math.min(1, Math.max(0, t)) * 100), d = x[n];
88
+ if (u > 0 && u < 100) {
89
+ let t = D(!1, r, i), n = D(!0, r, i);
90
+ return /* @__PURE__ */ _("span", {
91
+ ...l,
92
+ ref: c,
93
+ className: e(a, "relative inline-flex", t.colorClass, s),
94
+ children: [/* @__PURE__ */ g(O, {
95
+ filled: !1,
96
+ glyph: t.glyph,
97
+ className: e(o, d)
98
+ }), /* @__PURE__ */ g("span", {
99
+ className: e("absolute inset-y-0 start-0 flex overflow-hidden", n.colorClass),
100
+ style: { width: `${u}%` },
101
+ children: /* @__PURE__ */ g(O, {
102
+ filled: !0,
103
+ glyph: n.glyph,
104
+ className: e(o, d, "shrink-0")
105
+ })
106
+ })]
107
+ });
108
+ }
109
+ let f = u === 100, p = D(f, r, i);
110
+ return /* @__PURE__ */ g("span", {
111
+ ...l,
112
+ ref: c,
113
+ className: e(a, "inline-flex", p.colorClass, s),
114
+ children: /* @__PURE__ */ g(O, {
115
+ filled: f,
116
+ glyph: p.glyph,
117
+ className: e(o, d)
118
+ })
119
+ });
120
+ };
121
+ k.displayName = "StarGlyph";
122
+ var A = () => {}, j = {
123
+ kind: "display",
124
+ value: 0,
125
+ drawnValue: 0,
126
+ step: 1,
127
+ max: 5,
128
+ size: "medium",
129
+ color: "marigold",
130
+ glyphs: C,
131
+ disabled: !0,
132
+ starLabel: () => "",
133
+ getTabIndex: () => -1,
134
+ choose: A,
135
+ preview: A,
136
+ registerItem: () => A
137
+ }, M = h.createContext(null);
138
+ M.displayName = "RatingContext";
139
+ function N() {
140
+ return h.useContext(M) || (t("Rating.Item", "a rating (Rating or RatingDisplay)"), j);
141
+ }
142
+ function P() {
143
+ let [e] = h.useState(() => {
144
+ let e = /* @__PURE__ */ new Map();
145
+ return {
146
+ counts: e,
147
+ registerItem: (t) => (e.set(t, (e.get(t) ?? 0) + 1), () => {
148
+ let n = (e.get(t) ?? 1) - 1;
149
+ n > 0 ? e.set(t, n) : e.delete(t);
150
+ })
151
+ };
152
+ });
153
+ return e;
154
+ }
155
+ function F(e, t, r) {
156
+ h.useEffect(() => {
157
+ for (let [r, i] of e) i > 1 && n(`Rating.Item:duplicate:${r}`, `Rating.Item: two items have the value ${r}; give each star a unique value from 1 to max.`), (!Number.isInteger(r) || r < 1 || r > t) && n(`Rating.Item:value:${r}`, `Rating.Item: the value ${r} is not a whole number from 1 to ${t}.`);
158
+ if (r) {
159
+ for (let r = 1; r <= t; r++) if (!e.has(r)) {
160
+ n("Rating.Item:missing", `Rating.Item: no item has the value ${r}; pass one Rating.Item per value from 1 to max.`);
161
+ return;
162
+ }
163
+ }
164
+ });
165
+ }
166
+ var I = ({ value: t, iconFilled: n, iconOutline: r, className: i, ref: a, ...f }) => {
167
+ let p = N(), { registerItem: v } = p;
168
+ h.useLayoutEffect(() => v(t), [v, t]);
169
+ let y = E("Rating.Item", n, r), b = n !== void 0 || r !== void 0 ? y : p.glyphs, C = p.kind === "display" ? e(l.root, c.star) : e(l.root, s.star), w = p.kind === "display" ? e(l.icon, c.icon) : e(l.icon, s.icon);
170
+ if (p.kind === "display") return /* @__PURE__ */ g(k, {
171
+ ...f,
172
+ ref: a,
173
+ starClassName: C,
174
+ iconClassName: w,
175
+ className: i,
176
+ fraction: p.drawnValue - (t - 1),
177
+ size: p.size,
178
+ color: p.color,
179
+ glyphs: b
180
+ });
181
+ if (p.step === .5) {
182
+ let { onClick: n, onPointerMove: r, ...s } = f, c = t - .5, l = p.drawnValue, d = l >= t ? 1 : l >= c ? .5 : 0, h = (e) => {
183
+ let n = e.currentTarget.getBoundingClientRect();
184
+ return (u(e.currentTarget) === "rtl" ? n.right - e.clientX : e.clientX - n.left) < n.width / 2 ? c : t;
185
+ };
186
+ return /* @__PURE__ */ _("span", {
187
+ ...s,
188
+ ref: a,
189
+ className: e(C, "relative inline-flex cursor-pointer rounded", S[p.size], "has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-ring", p.disabled && "cursor-not-allowed", i),
190
+ onClick: o(n, (e) => {
191
+ if (p.disabled || e.detail === 0 || !m(e)) return;
192
+ let t = e.target.closest("[role=\"radio\"]");
193
+ t && e.currentTarget.contains(t) || p.choose(h(e), !0);
194
+ }),
195
+ onPointerMove: o(r, (e) => {
196
+ !p.disabled && e.pointerType === "mouse" && m(e) && p.preview(h(e));
197
+ }),
198
+ children: [/* @__PURE__ */ g(k, {
199
+ iconClassName: w,
200
+ fraction: d,
201
+ size: p.size,
202
+ color: p.color,
203
+ glyphs: b
204
+ }), [c, t].map((t, n) => {
205
+ let r = String(t);
206
+ return /* @__PURE__ */ g("button", {
207
+ type: "button",
208
+ role: "radio",
209
+ "aria-checked": p.value === t,
210
+ "aria-label": p.starLabel(t, p.max),
211
+ "data-roving-value": r,
212
+ tabIndex: p.disabled ? -1 : p.getTabIndex(r),
213
+ disabled: p.disabled,
214
+ className: e("pointer-events-none absolute inset-y-0 w-1/2 border-0 bg-transparent p-0 opacity-0", n === 0 ? "start-0" : "end-0"),
215
+ onClick: () => {
216
+ p.disabled || p.choose(t, !1);
217
+ }
218
+ }, r);
219
+ })]
220
+ });
221
+ }
222
+ let { onClick: T, onMouseEnter: A, ...j } = f, M = String(t), P = p.drawnValue >= t, F = D(P, p.color, b);
223
+ return /* @__PURE__ */ g("button", {
224
+ type: "button",
225
+ ...j,
226
+ ref: a,
227
+ role: "radio",
228
+ "aria-checked": p.value === t,
229
+ "aria-label": p.starLabel(t, p.max),
230
+ "data-roving-value": M,
231
+ tabIndex: p.disabled ? -1 : p.getTabIndex(M),
232
+ disabled: p.disabled,
233
+ className: e(C, "inline-flex cursor-pointer rounded border-0 bg-transparent transition-colors motion-reduce:transition-none disabled:cursor-not-allowed", S[p.size], d, F.colorClass, i),
234
+ onClick: o(T, (e) => {
235
+ !p.disabled && m(e) && p.choose(t, !1);
236
+ }),
237
+ onMouseEnter: o(A, (e) => {
238
+ !p.disabled && m(e) && p.preview(t);
239
+ }),
240
+ children: /* @__PURE__ */ g(O, {
241
+ filled: P,
242
+ glyph: F.glyph,
243
+ className: e(w, x[p.size])
244
+ })
245
+ });
246
+ };
247
+ I.displayName = "RatingItem";
248
+ function L(e, t) {
249
+ let n = r(e);
250
+ return a(n) ? n : Array.from({ length: t }, (e, t) => /* @__PURE__ */ g(I, { value: t + 1 }, t + 1));
251
+ }
252
+ //#endregion
253
+ export { v as FILLED_COLOR, j as INERT_RATING_CONTEXT, M as RatingContext, I as RatingItem, k as StarGlyph, L as ratingItems, b as resolveRatingColor, N as useRatingContext, F as useRatingItemChecks, P as useRatingItemRegistry, E as useStarGlyphs };
254
+
255
+ //# sourceMappingURL=Rating.item.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rating.item.mjs","names":["React","FILLED_COLOR","UNFILLED_COLOR","resolveRatingColor","color","sizeMap","targetPaddingMap","DEFAULT_GLYPHS","resolveGlyph","unwrapButtonGlyph","slot","renders","slotRendersContent","glyph","button","useGlyphWarnings","empty","warnOnce","component","name","useStarGlyphs","filled","iconFilled","outline","iconOutline","onlyOne","filledGlyph","outlineGlyph","starLook","glyphs","GlyphLayer","StarIcon","renderSlot","cn","className","StarGlyph","rest","percent","fraction","starSize","size","unfilled","starClassName","iconClassName","look","noop","INERT_RATING_CONTEXT","RatingContext","useRatingContext","reportMissingContext","useRatingItemRegistry","registry","counts","value","count","useRatingItemChecks","max","hasItems","RatingItem","ctx","registerItem","ownGlyphs","ratingItemClassNames","ratingDisplayClassNames","ratingClassNames","starProps","half","drawn","pick","rect","event","getDirection","composeEventHandlers","onClick","isOwnEvent","radio","onPointerMove","radioKey","radioValue","index","radioProps","key","focusRing","onMouseEnter","ratingItems","items","materialiseSlotContent","children","i"],"sources":["../../../src/components/input/Rating.item.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ratingClassNames,\n ratingDisplayClassNames,\n ratingItemClassNames,\n} from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { getDirection } from '../../lib/direction';\nimport { isOwnEvent } from '../../lib/events';\nimport { StarIcon } from '../../lib/icons';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Size } from '../../lib/types';\nimport { unwrapButtonGlyph, type UnwrappedButton } from '../button/Button.slots';\n\n/** Color of a rating's filled stars. */\nexport type RatingColor = 'neutral' | 'brand' | 'marigold';\n\n/** Filled-star color of each `color` (unfilled stars keep {@link UNFILLED_COLOR}). */\nexport const FILLED_COLOR: Readonly<Record<RatingColor, string>> = {\n marigold: 'text-rating',\n brand: 'text-primary',\n neutral: 'text-foreground',\n};\n\n/** Unfilled-star color in every `color`: the outline token, with a 3:1 non-text contrast. */\nconst UNFILLED_COLOR = 'text-stroke-accessible';\n\n/**\n * The color a root draws (Phase 4 D24): `color` itself, or `'marigold'` (the default) for\n * `undefined` and for a value outside the union from untyped code.\n */\nexport function resolveRatingColor(color: RatingColor | undefined): RatingColor {\n return color === 'brand' || color === 'neutral' ? color : 'marigold';\n}\n\n/** Icon size of each star size. */\nconst sizeMap: Record<Size, string> = {\n 'extra-small': 'h-3 w-3',\n small: 'h-4 w-4',\n medium: 'h-5 w-5',\n large: 'h-6 w-6',\n 'extra-large': 'h-8 w-8',\n};\n\n/** Padding that gives every interactive star a target of at least 24×24px (WCAG 2.5.8). */\nconst targetPaddingMap: Record<Size, string> = {\n 'extra-small': 'p-1.5', // 12px icon + 12px\n small: 'p-1', // 16px icon + 8px\n medium: 'p-0.5', // 20px icon + 4px\n large: 'p-0.5',\n 'extra-large': 'p-0.5',\n};\n\n/**\n * The glyphs a star draws, from an `iconFilled`/`iconOutline` pair resolved by\n * {@link useStarGlyphs}: `null` draws the default star.\n */\nexport interface StarGlyphs {\n /** The glyph of a filled star, or `null` for the default star. */\n filled: Slot<'span'> | null;\n /** The glyph of an unfilled star, or `null` for the default star. */\n outline: Slot<'span'> | null;\n}\n\n/** The default stars: what a rating without an icon pair draws. */\nconst DEFAULT_GLYPHS: StarGlyphs = { filled: null, outline: null };\n\n/** One glyph of an icon pair, resolved, with what its development warnings need. */\ninterface ResolvedGlyph {\n /** What the star draws: the glyph, or `null` for the default star. */\n glyph: Slot<'span'> | null;\n /** The button unwrapped from the slot, if any. */\n button: UnwrappedButton | null;\n /** The slot is set but renders nothing (an unwrapped button warns about itself instead). */\n empty: boolean;\n}\n\n/**\n * One glyph of an icon pair (C-SLOTS: a required indicator, and a glyph inside a wired button,\n * the radio of a Rating): a button passed as the glyph is unwrapped, its children becoming the\n * glyph, and `null`, `undefined` and a value that renders nothing keep the default star.\n */\nfunction resolveGlyph(slot: Slot<'span'> | undefined): ResolvedGlyph {\n const { glyph, button } = unwrapButtonGlyph(slot);\n const renders = slotRendersContent(glyph);\n return {\n glyph: renders ? glyph : null,\n button,\n empty: slot != null && button === null && !renders,\n };\n}\n\n/** The development warnings of one glyph of a pair (C-DEV: from an effect, once per key). */\nfunction useGlyphWarnings(\n component: string,\n name: 'iconFilled' | 'iconOutline',\n { button, empty }: ResolvedGlyph,\n) {\n React.useEffect(() => {\n if (empty) {\n warnOnce(\n `${component}:${name}-empty`,\n `${component}: \\`${name}\\` renders nothing, so the default star is used.`,\n );\n }\n if (button) {\n warnOnce(\n `${component}:${name}-button`,\n `${component}: \\`${name}\\` received ${button}; its children render as the glyph of the ` +\n 'star and its props were dropped (buttons cannot be nested). Pass icon content ' +\n `instead, e.g. \\`${name}={<MyIcon />}\\`.`,\n );\n }\n }, [component, name, empty, button]);\n}\n\n/**\n * The glyphs of a component's `iconFilled`/`iconOutline` pair (Phase 4 D25), with the pair's\n * development warnings, each from an effect and once per key (C-DEV): only one of the two set\n * (`<component>:icon-pair`), a glyph that renders nothing (`<component>:iconFilled-empty`,\n * `<component>:iconOutline-empty`) and a button unwrapped (`<component>:iconFilled-button`,\n * `<component>:iconOutline-button`). The result keeps its identity while the glyphs do.\n *\n * @param component The public name that starts the keys and messages: `'Rating'`,\n * `'RatingDisplay'` or `'Rating.Item'`.\n */\nexport function useStarGlyphs(\n component: string,\n iconFilled: Slot<'span'> | undefined,\n iconOutline: Slot<'span'> | undefined,\n): StarGlyphs {\n const filled = resolveGlyph(iconFilled);\n const outline = resolveGlyph(iconOutline);\n // A custom glyph next to the default star mixes shapes.\n const onlyOne = (iconFilled === undefined) !== (iconOutline === undefined);\n React.useEffect(() => {\n if (onlyOne) {\n warnOnce(\n `${component}:icon-pair`,\n `${component}: pass both \\`iconFilled\\` and \\`iconOutline\\`: with only one of them, the ` +\n 'other is the default star.',\n );\n }\n }, [component, onlyOne]);\n useGlyphWarnings(component, 'iconFilled', filled);\n useGlyphWarnings(component, 'iconOutline', outline);\n const filledGlyph = filled.glyph;\n const outlineGlyph = outline.glyph;\n return React.useMemo(\n () => ({ filled: filledGlyph, outline: outlineGlyph }),\n [filledGlyph, outlineGlyph],\n );\n}\n\n/** How a whole star looks, filled or unfilled: see {@link starLook}. */\ninterface StarLook {\n /** The color class: the rating color when filled, else the outline token. */\n colorClass: string;\n /** The glyph of the pair to draw (`null`: the default star). */\n glyph: Slot<'span'> | null;\n}\n\n/**\n * The one look of a star (every star kind draws through it): a filled star takes the rating\n * color and the filled glyph of the pair, an unfilled star the outline token and the outline\n * glyph.\n */\nfunction starLook(filled: boolean, color: RatingColor, glyphs: StarGlyphs): StarLook {\n return filled\n ? { colorClass: FILLED_COLOR[color], glyph: glyphs.filled }\n : { colorClass: UNFILLED_COLOR, glyph: glyphs.outline };\n}\n\n/**\n * Draws only the glyph of a star, in the color its box sets: the custom `glyph` when there is\n * one, in a decorative span of the star's size (an SVG child fills it), else the default star,\n * filled or outlined. The box around it (a {@link StarGlyph}, or the radio of a whole star)\n * carries the color.\n */\nfunction GlyphLayer({\n filled,\n glyph,\n className,\n}: {\n filled: boolean;\n glyph: Slot<'span'> | null;\n className: string;\n}) {\n if (glyph != null) {\n return renderSlot(glyph, 'span', cn('inline-flex shrink-0 [&>svg]:size-full', className), {\n 'aria-hidden': true,\n });\n }\n return filled ? (\n <StarIcon className={className} />\n ) : (\n <StarIcon className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5} />\n );\n}\nGlyphLayer.displayName = 'GlyphLayer';\n\n/** Properties of {@link StarGlyph}. */\nexport interface StarGlyphProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {\n /**\n * How much of the star is filled: `1` filled, `0` unfilled, and a partly filled star in between\n * (clamped to 0…1, drawn to the whole percent).\n */\n fraction: number;\n /** The star size. */\n size: Size;\n /** The color of the filled glyph; the unfilled glyph keeps the 3:1 outline token. */\n color: RatingColor;\n /** The glyphs to draw, from {@link useStarGlyphs}. */\n glyphs: StarGlyphs;\n /**\n * The stable classes of the star's `<span>` (P3-00), first in its class list, before\n * `className`: a star part, and a RatingItem's root.\n */\n starClassName?: string;\n /** The stable classes of every glyph it draws (P3-00): the icon parts. */\n iconClassName?: string;\n /** Ref to the star's `<span>`. */\n ref?: React.Ref<HTMLSpanElement>;\n}\n\n/**\n * One star drawn filled to `fraction`, in a `<span>` that is the star's own box, so it draws the\n * same wherever it is placed: at 1 the filled glyph in the rating color, at 0 the unfilled glyph\n * in the outline color, and in between the unfilled glyph with the filled glyph clipped over it\n * from the inline start to the fraction (the reading direction of the stars, also under RTL).\n * The stars of a RatingDisplay (each item, and the compact star) and the half stars of a Rating\n * draw through it; a whole radio star is a box itself (its button carries the color) and draws\n * its glyph with {@link GlyphLayer}.\n */\nexport const StarGlyph = ({\n fraction,\n size,\n color,\n glyphs,\n starClassName,\n iconClassName,\n className,\n ref,\n ...rest\n}: StarGlyphProps) => {\n const percent = Math.round(Math.min(1, Math.max(0, fraction)) * 100);\n const starSize = sizeMap[size];\n if (percent > 0 && percent < 100) {\n const unfilled = starLook(false, color, glyphs);\n const filled = starLook(true, color, glyphs);\n return (\n <span\n {...rest}\n ref={ref}\n className={cn(starClassName, 'relative inline-flex', unfilled.colorClass, className)}\n >\n <GlyphLayer filled={false} glyph={unfilled.glyph} className={cn(iconClassName, starSize)} />\n <span\n className={cn('absolute inset-y-0 start-0 flex overflow-hidden', filled.colorClass)}\n style={{ width: `${percent}%` }}\n >\n <GlyphLayer\n filled\n glyph={filled.glyph}\n className={cn(iconClassName, starSize, 'shrink-0')}\n />\n </span>\n </span>\n );\n }\n const filled = percent === 100;\n const look = starLook(filled, color, glyphs);\n return (\n <span\n {...rest}\n ref={ref}\n className={cn(starClassName, 'inline-flex', look.colorClass, className)}\n >\n <GlyphLayer filled={filled} glyph={look.glyph} className={cn(iconClassName, starSize)} />\n </span>\n );\n};\nStarGlyph.displayName = 'StarGlyph';\n\n/**\n * What a Rating or a RatingDisplay tells its items: the stars render from it, whether the root\n * generated them or the consumer passed them as children.\n */\nexport interface RatingContextValue {\n /** `'input'`: the items are the radios of a Rating; `'display'`: the drawn stars of a RatingDisplay. */\n kind: 'input' | 'display';\n /** The chosen rating (a Rating) or the displayed value (a RatingDisplay). */\n value: number;\n /** The value the stars draw: a Rating's hover preview while there is one, else `value`. */\n drawnValue: number;\n /** The grain of the values a star chooses. */\n step: 0.5 | 1;\n /** The number of stars: the key range, and the second argument of `starLabel`. */\n max: number;\n /** The star size. */\n size: Size;\n /** The color of the filled stars (resolved: a value outside the union is `'marigold'`). */\n color: RatingColor;\n /**\n * The glyphs of the root's `iconFilled`/`iconOutline` pair, for every item (an item that sets\n * its own pair draws that one instead).\n */\n glyphs: StarGlyphs;\n /** The stars cannot be chosen or previewed (a disabled Rating, and every RatingDisplay). */\n disabled: boolean;\n /** The accessible name of the radio that chooses `value` (the root's `labels.star`). */\n starLabel: (value: number, max: number) => string;\n /** The roving `tabIndex` of the radio whose `data-roving-value` is `key`. */\n getTabIndex: (key: string) => number;\n /**\n * Chooses `value`; with `focus`, the radio of `value` also takes focus, without scrolling (a\n * pointer click on a half star).\n */\n choose: (value: number, focus: boolean) => void;\n /** Previews `value` under the mouse (`0` clears the preview). */\n preview: (value: number) => void;\n /** Counts a mounted item's value; returns the cleanup that uncounts it. */\n registerItem: (value: number) => () => void;\n}\n\nconst noop = () => {};\n\n/**\n * The context of an item outside a rating (production; development throws there): an empty,\n * read-only star. RatingDisplay starts from it, since its stars choose, preview and rove nothing.\n */\nexport const INERT_RATING_CONTEXT: RatingContextValue = {\n kind: 'display',\n value: 0,\n drawnValue: 0,\n step: 1,\n max: 5,\n size: 'medium',\n color: 'marigold',\n glyphs: DEFAULT_GLYPHS,\n disabled: true,\n starLabel: () => '',\n getTabIndex: () => -1,\n choose: noop,\n preview: noop,\n registerItem: () => noop,\n};\n\n/** Provided by Rating and RatingDisplay to their items; `null` outside them. */\nexport const RatingContext = React.createContext<RatingContextValue | null>(null);\nRatingContext.displayName = 'RatingContext';\n\n/** C-CONTEXT: throws in development, logs once and returns the inert value in production. */\nexport function useRatingContext(): RatingContextValue {\n const context = React.useContext(RatingContext);\n if (context) return context;\n reportMissingContext('Rating.Item', 'a rating (Rating or RatingDisplay)');\n return INERT_RATING_CONTEXT;\n}\n\n/** The item registry of a rating root: the values of its mounted items, counted. */\nexport interface RatingItemRegistry {\n /**\n * Counts a mounted item's value and returns the cleanup that uncounts it. Items call it from a\n * layout effect.\n */\n registerItem: (value: number) => () => void;\n /**\n * How many mounted items have each value. The items change it in their layout effects, so read\n * it in an effect of the root (a passive effect runs after every layout effect of the commit),\n * never during render.\n */\n counts: ReadonlyMap<number, number>;\n}\n\n/**\n * A rating root's item registry: one object, with the same `registerItem` and `counts`, for the\n * root's lifetime, so the memoized context keeps its identity.\n */\nexport function useRatingItemRegistry(): RatingItemRegistry {\n const [registry] = React.useState<RatingItemRegistry>(() => {\n const counts = new Map<number, number>();\n return {\n counts,\n registerItem: (value) => {\n counts.set(value, (counts.get(value) ?? 0) + 1);\n return () => {\n const count = (counts.get(value) ?? 1) - 1;\n if (count > 0) counts.set(value, count);\n else counts.delete(value);\n };\n },\n };\n });\n return registry;\n}\n\n/**\n * The item value checks of a rating root (Phase 4 D26, C-DEV): a passive effect, run after every\n * layout effect of the commit (so every item's own layout effect has already registered its\n * value, C-HOOKS: `counts` is never read during render), that warns once per problem found. No\n * dependency array: `counts` keeps its identity for the root's lifetime (`useRatingItemRegistry`)\n * and only its entries change in place, so the effect must re-run on every commit to see a later\n * change, exactly as the registration effects of `useListbox` do.\n *\n * - A value more than one item registers is not unique (`Rating.Item:duplicate:<value>`).\n * - A value that is not a whole number from 1 to `max` — untyped code, or a mistake — is not one\n * of the star positions the root can draw (`Rating.Item:value:<value>`).\n * - `hasItems`: the root draws its own children instead of the `max` generated stars, which\n * always cover every value on their own; only then can a value from 1 to `max` be left without\n * an item, and only the first one found is named (`Rating.Item:missing`).\n */\nexport function useRatingItemChecks(\n counts: ReadonlyMap<number, number>,\n max: number,\n hasItems: boolean,\n): void {\n React.useEffect(() => {\n for (const [value, count] of counts) {\n if (count > 1) {\n warnOnce(\n `Rating.Item:duplicate:${value}`,\n `Rating.Item: two items have the value ${value}; give each star a unique value from 1 ` +\n 'to max.',\n );\n }\n if (!Number.isInteger(value) || value < 1 || value > max) {\n warnOnce(\n `Rating.Item:value:${value}`,\n `Rating.Item: the value ${value} is not a whole number from 1 to ${max}.`,\n );\n }\n }\n if (!hasItems) return;\n for (let value = 1; value <= max; value++) {\n if (!counts.has(value)) {\n warnOnce(\n 'Rating.Item:missing',\n `Rating.Item: no item has the value ${value}; pass one Rating.Item per value from 1 to ` +\n 'max.',\n );\n return;\n }\n }\n });\n}\n\n/** Properties for the RatingItem component (`Rating.Item`, `RatingDisplay.Item`). */\nexport interface RatingItemProps extends Omit<\n React.HTMLAttributes<HTMLElement>,\n 'role' | 'aria-checked' | 'aria-label' | 'aria-labelledby' | 'tabIndex' | 'children' | 'onChange'\n> {\n /**\n * The star's full value, from 1 to the root's `max`: the rating it chooses (with the root's\n * `step={0.5}` also its half, `value - 0.5`), or shows.\n */\n value: number;\n /**\n * The glyph of this star when filled, as a pair with `iconOutline`, following the rules of the\n * root's `iconFilled` (a button is unwrapped, its children becoming the glyph, and a value or\n * button children that render nothing draw the default star). An item that sets either glyph\n * of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves\n * unset is the default star (a development warning says so).\n */\n iconFilled?: Slot<'span'>;\n /**\n * The glyph of this star when unfilled, as a pair with `iconFilled`, following the rules of the\n * root's `iconOutline` (a button is unwrapped, its children becoming the glyph, and a value or\n * button children that render nothing draw the default star). An item that sets either glyph\n * of the pair (`null` included) draws its own pair instead of its root's, and a glyph it leaves\n * unset is the default star (a development warning says so).\n */\n iconOutline?: Slot<'span'>;\n /**\n * Ref to the star element: the `role=\"radio\"` button in a Rating, the star `<span>` in a Rating\n * with `step={0.5}` and in a RatingDisplay.\n */\n ref?: React.Ref<HTMLElement>;\n}\n\n/**\n * One star of a `Rating` or a `RatingDisplay`, drawn from its root: pass one per value from 1 to\n * `max` as the root's children, in place of the stars it generates.\n *\n * - In a `Rating` it is a `role=\"radio\"` button named by the root's `labels.star` (\"2 stars\"),\n * chosen, previewed and roved as a generated star is. With the root's `step={0.5}` it is a star\n * `<span>`, one pointer target that chooses by the pointer's position, holding two transparent\n * radios: its half value, then its full value (\"1.5 stars\", \"2 stars\"). In a `RatingDisplay` it\n * is a star filled, partly filled or empty by the root's value.\n * - It draws the root's `color` and glyph pair, or its own `iconFilled`/`iconOutline` pair when it\n * sets one.\n * - `className`, `style`, `data-*`, the other attributes, the handlers and `ref` go to that star\n * element, the consumer's handlers first. The role, name, checked state and tab stop of its\n * radio (or radios) come from the root.\n * - At `step={1}` the consumer's `onClick` and `onMouseEnter` compose onto the radio itself, so a\n * `preventDefault()` in either vetoes that star's own activation or hover preview. At\n * `step={0.5}` `onClick` and `onPointerMove` compose onto the star `<span>` instead: its two\n * radios run their own `onClick` first and choose their own value directly (Space, Enter, a\n * screen reader, or `radio.click()`), before the click bubbles to the span's composed handler,\n * so a `preventDefault()` there vetoes only a pointer-chosen value, never a keyboard or\n * assistive-technology activation.\n * - Outside a `Rating` or `RatingDisplay` it throws in development.\n */\nexport const RatingItem = ({\n value,\n iconFilled,\n iconOutline,\n className,\n ref,\n ...rest\n}: RatingItemProps) => {\n const ctx = useRatingContext();\n const { registerItem } = ctx;\n React.useLayoutEffect(() => registerItem(value), [registerItem, value]);\n // The item's own pair, when it sets either glyph, replaces its root's pair as a whole.\n const ownGlyphs = useStarGlyphs('Rating.Item', iconFilled, iconOutline);\n const glyphs = iconFilled !== undefined || iconOutline !== undefined ? ownGlyphs : ctx.glyphs;\n // Stable classes (P3-00): the item's own, then its rating's part classes (a public component\n // rendered inside another, D5), whether the root generated the item or the consumer passed it.\n const starClassName =\n ctx.kind === 'display'\n ? cn(ratingItemClassNames.root, ratingDisplayClassNames.star)\n : cn(ratingItemClassNames.root, ratingClassNames.star);\n const iconClassName =\n ctx.kind === 'display'\n ? cn(ratingItemClassNames.icon, ratingDisplayClassNames.icon)\n : cn(ratingItemClassNames.icon, ratingClassNames.icon);\n\n // `rest` keeps every consumer handler: a star without handlers of its own (a display star)\n // spreads them all, and a star that composes one takes that one out of `rest` itself.\n if (ctx.kind === 'display') {\n // Filled by the share of this star that the drawn value covers.\n return (\n <StarGlyph\n {...rest}\n ref={ref as React.Ref<HTMLSpanElement>}\n starClassName={starClassName}\n iconClassName={iconClassName}\n className={className}\n fraction={ctx.drawnValue - (value - 1)}\n size={ctx.size}\n color={ctx.color}\n glyphs={glyphs}\n />\n );\n }\n\n if (ctx.step === 0.5) {\n // A half star (D22): one pointer target (a span with the padding of a whole star) holding two\n // transparent radios over its halves, the half value first. The pointer chooses by its\n // position over the star; the keyboard and screen readers use the radios. The span composes\n // the consumer's click and pointer-move handlers with its own.\n const { onClick, onPointerMove, ...starProps } = rest;\n const half = value - 0.5;\n const drawn = ctx.drawnValue;\n const fraction = drawn >= value ? 1 : drawn >= half ? 0.5 : 0;\n // The value under the pointer: the half from the inline start (mirrored under RTL), else the\n // full value.\n const pick = (event: React.MouseEvent<HTMLElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n const fromStart =\n getDirection(event.currentTarget) === 'rtl'\n ? rect.right - event.clientX\n : event.clientX - rect.left;\n return fromStart < rect.width / 2 ? half : value;\n };\n return (\n <span\n {...starProps}\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(\n starClassName,\n 'relative inline-flex cursor-pointer rounded',\n targetPaddingMap[ctx.size],\n 'has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-ring',\n ctx.disabled && 'cursor-not-allowed',\n className,\n )}\n onClick={composeEventHandlers(onClick, (event) => {\n // A click on a radio (Space, Enter, a screen reader, `click()`) chose its own value, and\n // a click without a press (`detail` 0) or from a portal inside the star is not the\n // pointer's to place. The radio search is bounded to this star: an unrelated\n // `role=\"radio\"` ancestor elsewhere in the document (the star's own radios have no\n // children, so a pointer click's target is never one of them, `pointer-events-none`)\n // must not silence every pointer pick.\n if (ctx.disabled || event.detail === 0 || !isOwnEvent(event)) return;\n const radio = (event.target as Element).closest('[role=\"radio\"]');\n if (radio && event.currentTarget.contains(radio)) return;\n ctx.choose(pick(event), true);\n })}\n onPointerMove={composeEventHandlers(onPointerMove, (event) => {\n if (!ctx.disabled && event.pointerType === 'mouse' && isOwnEvent(event)) {\n ctx.preview(pick(event));\n }\n })}\n >\n <StarGlyph\n iconClassName={iconClassName}\n fraction={fraction}\n size={ctx.size}\n color={ctx.color}\n glyphs={glyphs}\n />\n {[half, value].map((radioValue, index) => {\n const radioKey = String(radioValue);\n return (\n <button\n key={radioKey}\n type=\"button\"\n role=\"radio\"\n aria-checked={ctx.value === radioValue}\n aria-label={ctx.starLabel(radioValue, ctx.max)}\n data-roving-value={radioKey}\n tabIndex={ctx.disabled ? -1 : ctx.getTabIndex(radioKey)}\n disabled={ctx.disabled}\n className={cn(\n 'pointer-events-none absolute inset-y-0 w-1/2 border-0 bg-transparent p-0 opacity-0',\n index === 0 ? 'start-0' : 'end-0',\n )}\n onClick={() => {\n // Choosing the current value again is a no-op for both callbacks (useControllable).\n if (!ctx.disabled) ctx.choose(radioValue, false);\n }}\n />\n );\n })}\n </span>\n );\n }\n\n // The radio composes the consumer's click and mouse-enter handlers with its own. It is the\n // star's box itself (the button carries the color), so it draws only the glyph.\n const { onClick, onMouseEnter, ...radioProps } = rest;\n const key = String(value);\n const filled = ctx.drawnValue >= value;\n const look = starLook(filled, ctx.color, glyphs);\n return (\n <button\n type=\"button\"\n {...radioProps}\n ref={ref as React.Ref<HTMLButtonElement>}\n role=\"radio\"\n aria-checked={ctx.value === value}\n aria-label={ctx.starLabel(value, ctx.max)}\n data-roving-value={key}\n tabIndex={ctx.disabled ? -1 : ctx.getTabIndex(key)}\n disabled={ctx.disabled}\n className={cn(\n starClassName,\n 'inline-flex cursor-pointer rounded border-0 bg-transparent transition-colors motion-reduce:transition-none disabled:cursor-not-allowed',\n targetPaddingMap[ctx.size],\n focusRing,\n look.colorClass,\n className,\n )}\n onClick={composeEventHandlers(onClick, (event) => {\n // Choosing the current star again is a no-op for both callbacks (useControllable). A click\n // from a portal rendered inside the star (a custom glyph's popup) is not the star's.\n if (!ctx.disabled && isOwnEvent(event)) ctx.choose(value, false);\n })}\n onMouseEnter={composeEventHandlers(onMouseEnter, (event) => {\n if (!ctx.disabled && isOwnEvent(event)) ctx.preview(value);\n })}\n >\n <GlyphLayer\n filled={filled}\n glyph={look.glyph}\n className={cn(iconClassName, sizeMap[ctx.size])}\n />\n </button>\n );\n};\nRatingItem.displayName = 'RatingItem';\n\n/**\n * A root's stars: its `children` when they render content, else one generated item per value\n * from 1 to `max`.\n */\nexport function ratingItems(children: React.ReactNode, max: number): React.ReactNode {\n const items = materialiseSlotContent(children);\n return slotRendersContent(items)\n ? items\n : Array.from({ length: max }, (_, i) => <RatingItem key={i + 1} value={i + 1} />);\n}\n"],"mappings":";;;;;;;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