@mortenbrudvik/waveui 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/README.md +564 -155
  2. package/dist/components/button/Button.cjs +1 -1
  3. package/dist/components/button/Button.cjs.map +1 -1
  4. package/dist/components/button/Button.mjs +36 -35
  5. package/dist/components/button/Button.mjs.map +1 -1
  6. package/dist/components/button/Button.slots.cjs +1 -1
  7. package/dist/components/button/Button.slots.cjs.map +1 -1
  8. package/dist/components/button/Button.slots.mjs +31 -21
  9. package/dist/components/button/Button.slots.mjs.map +1 -1
  10. package/dist/components/button/CompoundButton.cjs +1 -1
  11. package/dist/components/button/CompoundButton.cjs.map +1 -1
  12. package/dist/components/button/CompoundButton.mjs +31 -29
  13. package/dist/components/button/CompoundButton.mjs.map +1 -1
  14. package/dist/components/button/Link.cjs +1 -1
  15. package/dist/components/button/Link.cjs.map +1 -1
  16. package/dist/components/button/Link.mjs +24 -23
  17. package/dist/components/button/Link.mjs.map +1 -1
  18. package/dist/components/button/MenuButton.cjs +1 -1
  19. package/dist/components/button/MenuButton.cjs.map +1 -1
  20. package/dist/components/button/MenuButton.mjs +29 -28
  21. package/dist/components/button/MenuButton.mjs.map +1 -1
  22. package/dist/components/button/SplitButton.cjs +1 -1
  23. package/dist/components/button/SplitButton.cjs.map +1 -1
  24. package/dist/components/button/SplitButton.mjs +46 -45
  25. package/dist/components/button/SplitButton.mjs.map +1 -1
  26. package/dist/components/button/ToggleButton.cjs +1 -1
  27. package/dist/components/button/ToggleButton.cjs.map +1 -1
  28. package/dist/components/button/ToggleButton.mjs +38 -35
  29. package/dist/components/button/ToggleButton.mjs.map +1 -1
  30. package/dist/components/button/Toolbar.cjs +1 -1
  31. package/dist/components/button/Toolbar.cjs.map +1 -1
  32. package/dist/components/button/Toolbar.mjs +43 -42
  33. package/dist/components/button/Toolbar.mjs.map +1 -1
  34. package/dist/components/button/Toolbar.parts.cjs +1 -1
  35. package/dist/components/button/Toolbar.parts.cjs.map +1 -1
  36. package/dist/components/button/Toolbar.parts.mjs +76 -81
  37. package/dist/components/button/Toolbar.parts.mjs.map +1 -1
  38. package/dist/components/data-display/Avatar.cjs +1 -1
  39. package/dist/components/data-display/Avatar.cjs.map +1 -1
  40. package/dist/components/data-display/Avatar.mjs +72 -67
  41. package/dist/components/data-display/Avatar.mjs.map +1 -1
  42. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  43. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  44. package/dist/components/data-display/AvatarGroup.mjs +89 -88
  45. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  46. package/dist/components/data-display/Badge.cjs +1 -1
  47. package/dist/components/data-display/Badge.cjs.map +1 -1
  48. package/dist/components/data-display/Badge.mjs +17 -16
  49. package/dist/components/data-display/Badge.mjs.map +1 -1
  50. package/dist/components/data-display/CounterBadge.cjs +1 -1
  51. package/dist/components/data-display/CounterBadge.cjs.map +1 -1
  52. package/dist/components/data-display/CounterBadge.mjs +18 -17
  53. package/dist/components/data-display/CounterBadge.mjs.map +1 -1
  54. package/dist/components/data-display/Divider.cjs +1 -1
  55. package/dist/components/data-display/Divider.cjs.map +1 -1
  56. package/dist/components/data-display/Divider.mjs +31 -30
  57. package/dist/components/data-display/Divider.mjs.map +1 -1
  58. package/dist/components/data-display/Image.cjs +1 -1
  59. package/dist/components/data-display/Image.cjs.map +1 -1
  60. package/dist/components/data-display/Image.mjs +16 -15
  61. package/dist/components/data-display/Image.mjs.map +1 -1
  62. package/dist/components/data-display/InfoButton.cjs +2 -0
  63. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  64. package/dist/components/data-display/InfoButton.mjs +173 -0
  65. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  66. package/dist/components/data-display/InfoLabel.cjs +1 -1
  67. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  68. package/dist/components/data-display/InfoLabel.mjs +36 -92
  69. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  70. package/dist/components/data-display/List.cjs +1 -1
  71. package/dist/components/data-display/List.cjs.map +1 -1
  72. package/dist/components/data-display/List.mjs +175 -174
  73. package/dist/components/data-display/List.mjs.map +1 -1
  74. package/dist/components/data-display/Persona.cjs +1 -1
  75. package/dist/components/data-display/Persona.cjs.map +1 -1
  76. package/dist/components/data-display/Persona.mjs +31 -29
  77. package/dist/components/data-display/Persona.mjs.map +1 -1
  78. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  79. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  80. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  81. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  82. package/dist/components/data-display/Tag.cjs +1 -1
  83. package/dist/components/data-display/Tag.cjs.map +1 -1
  84. package/dist/components/data-display/Tag.mjs +87 -82
  85. package/dist/components/data-display/Tag.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.cjs +1 -1
  87. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  88. package/dist/components/feedback/MessageBar.mjs +129 -71
  89. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  90. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  93. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  95. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  96. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  97. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  98. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  99. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  100. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  101. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  102. package/dist/components/feedback/ProgressBar.cjs +1 -1
  103. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  104. package/dist/components/feedback/ProgressBar.mjs +44 -43
  105. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  106. package/dist/components/feedback/Skeleton.cjs +1 -1
  107. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  108. package/dist/components/feedback/Skeleton.mjs +26 -24
  109. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  110. package/dist/components/feedback/Spinner.cjs +1 -1
  111. package/dist/components/feedback/Spinner.cjs.map +1 -1
  112. package/dist/components/feedback/Spinner.mjs +32 -31
  113. package/dist/components/feedback/Spinner.mjs.map +1 -1
  114. package/dist/components/feedback/Toast.cjs +1 -1
  115. package/dist/components/feedback/Toast.cjs.map +1 -1
  116. package/dist/components/feedback/Toast.context.cjs +2 -0
  117. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  118. package/dist/components/feedback/Toast.context.mjs +23 -0
  119. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  120. package/dist/components/feedback/Toast.mjs +10 -342
  121. package/dist/components/feedback/Toast.mjs.map +1 -1
  122. package/dist/components/feedback/Toast.parts.cjs +2 -0
  123. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.parts.mjs +98 -0
  125. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  126. package/dist/components/feedback/Toast.root.cjs +2 -0
  127. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  128. package/dist/components/feedback/Toast.root.mjs +109 -0
  129. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  130. package/dist/components/feedback/Toaster.cjs +2 -0
  131. package/dist/components/feedback/Toaster.cjs.map +1 -0
  132. package/dist/components/feedback/Toaster.mjs +564 -0
  133. package/dist/components/feedback/Toaster.mjs.map +1 -0
  134. package/dist/components/input/AlphaSlider.cjs +2 -0
  135. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  136. package/dist/components/input/AlphaSlider.mjs +115 -0
  137. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  138. package/dist/components/input/Checkbox.cjs +1 -1
  139. package/dist/components/input/Checkbox.cjs.map +1 -1
  140. package/dist/components/input/Checkbox.mjs +87 -70
  141. package/dist/components/input/Checkbox.mjs.map +1 -1
  142. package/dist/components/input/ColorArea.cjs +2 -0
  143. package/dist/components/input/ColorArea.cjs.map +1 -0
  144. package/dist/components/input/ColorArea.mjs +204 -0
  145. package/dist/components/input/ColorArea.mjs.map +1 -0
  146. package/dist/components/input/ColorPicker.cjs +5 -5
  147. package/dist/components/input/ColorPicker.cjs.map +1 -1
  148. package/dist/components/input/ColorPicker.mjs +142 -165
  149. package/dist/components/input/ColorPicker.mjs.map +1 -1
  150. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  151. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  152. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  153. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  154. package/dist/components/input/ColorSlider.cjs +2 -0
  155. package/dist/components/input/ColorSlider.cjs.map +1 -0
  156. package/dist/components/input/ColorSlider.mjs +138 -0
  157. package/dist/components/input/ColorSlider.mjs.map +1 -0
  158. package/dist/components/input/Combobox.cjs +1 -1
  159. package/dist/components/input/Combobox.cjs.map +1 -1
  160. package/dist/components/input/Combobox.expand.cjs +1 -1
  161. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  162. package/dist/components/input/Combobox.expand.mjs +22 -22
  163. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  164. package/dist/components/input/Combobox.mjs +151 -141
  165. package/dist/components/input/Combobox.mjs.map +1 -1
  166. package/dist/components/input/DatePicker.cjs +1 -1
  167. package/dist/components/input/DatePicker.cjs.map +1 -1
  168. package/dist/components/input/DatePicker.mjs +239 -234
  169. package/dist/components/input/DatePicker.mjs.map +1 -1
  170. package/dist/components/input/Dropdown.cjs +1 -1
  171. package/dist/components/input/Dropdown.cjs.map +1 -1
  172. package/dist/components/input/Dropdown.mjs +109 -100
  173. package/dist/components/input/Dropdown.mjs.map +1 -1
  174. package/dist/components/input/Field.cjs +1 -1
  175. package/dist/components/input/Field.cjs.map +1 -1
  176. package/dist/components/input/Field.mjs +139 -105
  177. package/dist/components/input/Field.mjs.map +1 -1
  178. package/dist/components/input/Input.cjs +1 -1
  179. package/dist/components/input/Input.cjs.map +1 -1
  180. package/dist/components/input/Input.mjs +80 -55
  181. package/dist/components/input/Input.mjs.map +1 -1
  182. package/dist/components/input/Label.cjs +1 -1
  183. package/dist/components/input/Label.cjs.map +1 -1
  184. package/dist/components/input/Label.mjs +19 -12
  185. package/dist/components/input/Label.mjs.map +1 -1
  186. package/dist/components/input/Option.cjs +1 -1
  187. package/dist/components/input/Option.cjs.map +1 -1
  188. package/dist/components/input/Option.mjs +100 -98
  189. package/dist/components/input/Option.mjs.map +1 -1
  190. package/dist/components/input/RadioGroup.cjs +1 -1
  191. package/dist/components/input/RadioGroup.cjs.map +1 -1
  192. package/dist/components/input/RadioGroup.mjs +89 -88
  193. package/dist/components/input/RadioGroup.mjs.map +1 -1
  194. package/dist/components/input/Rating.cjs +1 -1
  195. package/dist/components/input/Rating.cjs.map +1 -1
  196. package/dist/components/input/Rating.item.cjs +2 -0
  197. package/dist/components/input/Rating.item.cjs.map +1 -0
  198. package/dist/components/input/Rating.item.mjs +255 -0
  199. package/dist/components/input/Rating.item.mjs.map +1 -0
  200. package/dist/components/input/Rating.mjs +152 -152
  201. package/dist/components/input/Rating.mjs.map +1 -1
  202. package/dist/components/input/SearchBox.cjs +1 -1
  203. package/dist/components/input/SearchBox.cjs.map +1 -1
  204. package/dist/components/input/SearchBox.mjs +162 -132
  205. package/dist/components/input/SearchBox.mjs.map +1 -1
  206. package/dist/components/input/Select.cjs +1 -1
  207. package/dist/components/input/Select.cjs.map +1 -1
  208. package/dist/components/input/Select.mjs +34 -24
  209. package/dist/components/input/Select.mjs.map +1 -1
  210. package/dist/components/input/Slider.cjs +1 -1
  211. package/dist/components/input/Slider.cjs.map +1 -1
  212. package/dist/components/input/Slider.mjs +78 -54
  213. package/dist/components/input/Slider.mjs.map +1 -1
  214. package/dist/components/input/SpinButton.cjs +1 -1
  215. package/dist/components/input/SpinButton.cjs.map +1 -1
  216. package/dist/components/input/SpinButton.mjs +202 -99
  217. package/dist/components/input/SpinButton.mjs.map +1 -1
  218. package/dist/components/input/SwatchPicker.cjs +1 -1
  219. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  220. package/dist/components/input/SwatchPicker.mjs +38 -37
  221. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  222. package/dist/components/input/Switch.cjs +1 -1
  223. package/dist/components/input/Switch.cjs.map +1 -1
  224. package/dist/components/input/Switch.mjs +75 -58
  225. package/dist/components/input/Switch.mjs.map +1 -1
  226. package/dist/components/input/TagPicker.cjs +1 -1
  227. package/dist/components/input/TagPicker.cjs.map +1 -1
  228. package/dist/components/input/TagPicker.mjs +199 -169
  229. package/dist/components/input/TagPicker.mjs.map +1 -1
  230. package/dist/components/input/Textarea.cjs +1 -1
  231. package/dist/components/input/Textarea.cjs.map +1 -1
  232. package/dist/components/input/Textarea.mjs +31 -23
  233. package/dist/components/input/Textarea.mjs.map +1 -1
  234. package/dist/components/input/TimePicker.cjs +1 -1
  235. package/dist/components/input/TimePicker.cjs.map +1 -1
  236. package/dist/components/input/TimePicker.mjs +185 -177
  237. package/dist/components/input/TimePicker.mjs.map +1 -1
  238. package/dist/components/input/colorName.cjs +2 -0
  239. package/dist/components/input/colorName.cjs.map +1 -0
  240. package/dist/components/input/colorName.mjs +30 -0
  241. package/dist/components/input/colorName.mjs.map +1 -0
  242. package/dist/components/input/colorUtils.cjs +1 -1
  243. package/dist/components/input/colorUtils.cjs.map +1 -1
  244. package/dist/components/input/colorUtils.mjs +154 -56
  245. package/dist/components/input/colorUtils.mjs.map +1 -1
  246. package/dist/components/input/fieldLabel.cjs +2 -0
  247. package/dist/components/input/fieldLabel.cjs.map +1 -0
  248. package/dist/components/input/fieldLabel.mjs +17 -0
  249. package/dist/components/input/fieldLabel.mjs.map +1 -0
  250. package/dist/components/input/inputLook.cjs +2 -0
  251. package/dist/components/input/inputLook.cjs.map +1 -0
  252. package/dist/components/input/inputLook.mjs +28 -0
  253. package/dist/components/input/inputLook.mjs.map +1 -0
  254. package/dist/components/input/pickerStyles.cjs +1 -1
  255. package/dist/components/input/pickerStyles.cjs.map +1 -1
  256. package/dist/components/input/pickerStyles.mjs +42 -4
  257. package/dist/components/input/pickerStyles.mjs.map +1 -1
  258. package/dist/components/layout/Accordion.cjs +1 -1
  259. package/dist/components/layout/Accordion.cjs.map +1 -1
  260. package/dist/components/layout/Accordion.mjs +130 -129
  261. package/dist/components/layout/Accordion.mjs.map +1 -1
  262. package/dist/components/layout/Card.cjs +1 -1
  263. package/dist/components/layout/Card.cjs.map +1 -1
  264. package/dist/components/layout/Card.mjs +78 -77
  265. package/dist/components/layout/Card.mjs.map +1 -1
  266. package/dist/components/layout/Carousel.cjs +1 -1
  267. package/dist/components/layout/Carousel.cjs.map +1 -1
  268. package/dist/components/layout/Carousel.mjs +111 -110
  269. package/dist/components/layout/Carousel.mjs.map +1 -1
  270. package/dist/components/layout/Flex.cjs +1 -1
  271. package/dist/components/layout/Flex.cjs.map +1 -1
  272. package/dist/components/layout/Flex.mjs +22 -21
  273. package/dist/components/layout/Flex.mjs.map +1 -1
  274. package/dist/components/layout/Grid.cjs +1 -1
  275. package/dist/components/layout/Grid.cjs.map +1 -1
  276. package/dist/components/layout/Grid.mjs +19 -18
  277. package/dist/components/layout/Grid.mjs.map +1 -1
  278. package/dist/components/layout/Overflow.cjs +1 -1
  279. package/dist/components/layout/Overflow.cjs.map +1 -1
  280. package/dist/components/layout/Overflow.mjs +92 -91
  281. package/dist/components/layout/Overflow.mjs.map +1 -1
  282. package/dist/components/layout/Stack.cjs +1 -1
  283. package/dist/components/layout/Stack.cjs.map +1 -1
  284. package/dist/components/layout/Stack.mjs +14 -13
  285. package/dist/components/layout/Stack.mjs.map +1 -1
  286. package/dist/components/layout/TabList.cjs +1 -1
  287. package/dist/components/layout/TabList.cjs.map +1 -1
  288. package/dist/components/layout/TabList.mjs +118 -117
  289. package/dist/components/layout/TabList.mjs.map +1 -1
  290. package/dist/components/layout/Tree.cjs +1 -1
  291. package/dist/components/layout/Tree.cjs.map +1 -1
  292. package/dist/components/layout/Tree.context.cjs +2 -0
  293. package/dist/components/layout/Tree.context.cjs.map +1 -0
  294. package/dist/components/layout/Tree.context.mjs +33 -0
  295. package/dist/components/layout/Tree.context.mjs.map +1 -0
  296. package/dist/components/layout/Tree.core.cjs +2 -0
  297. package/dist/components/layout/Tree.core.cjs.map +1 -0
  298. package/dist/components/layout/Tree.core.mjs +416 -0
  299. package/dist/components/layout/Tree.core.mjs.map +1 -0
  300. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  301. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  302. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  303. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  304. package/dist/components/layout/Tree.mjs +7 -215
  305. package/dist/components/layout/Tree.mjs.map +1 -1
  306. package/dist/components/layout/Tree.selection.cjs +2 -0
  307. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  308. package/dist/components/layout/Tree.selection.mjs +73 -0
  309. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  310. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  311. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  312. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  313. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.group.cjs +1 -1
  315. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.group.mjs +39 -37
  317. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.items.cjs +1 -1
  319. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.items.mjs +67 -61
  321. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.link.cjs +1 -1
  323. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.link.mjs +34 -28
  325. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  326. package/dist/components/navigation/Menu.popover.cjs +1 -1
  327. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  328. package/dist/components/navigation/Menu.popover.mjs +114 -113
  329. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  330. package/dist/components/navigation/Menu.root.cjs +1 -1
  331. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  332. package/dist/components/navigation/Menu.root.mjs +171 -170
  333. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  334. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  335. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  336. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  337. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  338. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  339. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  340. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  341. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  342. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  343. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  344. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  345. package/dist/components/navigation/Nav.cjs +1 -1
  346. package/dist/components/navigation/Nav.cjs.map +1 -1
  347. package/dist/components/navigation/Nav.mjs +170 -155
  348. package/dist/components/navigation/Nav.mjs.map +1 -1
  349. package/dist/components/navigation/Pagination.cjs +1 -1
  350. package/dist/components/navigation/Pagination.cjs.map +1 -1
  351. package/dist/components/navigation/Pagination.mjs +73 -65
  352. package/dist/components/navigation/Pagination.mjs.map +1 -1
  353. package/dist/components/navigation/Stepper.cjs +1 -1
  354. package/dist/components/navigation/Stepper.cjs.map +1 -1
  355. package/dist/components/navigation/Stepper.mjs +110 -109
  356. package/dist/components/navigation/Stepper.mjs.map +1 -1
  357. package/dist/components/overlays/Dialog.cjs +1 -1
  358. package/dist/components/overlays/Dialog.cjs.map +1 -1
  359. package/dist/components/overlays/Dialog.mjs +109 -108
  360. package/dist/components/overlays/Dialog.mjs.map +1 -1
  361. package/dist/components/overlays/Drawer.cjs +1 -1
  362. package/dist/components/overlays/Drawer.cjs.map +1 -1
  363. package/dist/components/overlays/Drawer.mjs +110 -109
  364. package/dist/components/overlays/Drawer.mjs.map +1 -1
  365. package/dist/components/overlays/Popover.cjs +1 -1
  366. package/dist/components/overlays/Popover.cjs.map +1 -1
  367. package/dist/components/overlays/Popover.mjs +148 -151
  368. package/dist/components/overlays/Popover.mjs.map +1 -1
  369. package/dist/components/overlays/Popover.shared.cjs +1 -1
  370. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  371. package/dist/components/overlays/Popover.shared.mjs +82 -77
  372. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  373. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  374. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  375. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  376. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  377. package/dist/components/overlays/Tooltip.cjs +1 -1
  378. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  379. package/dist/components/overlays/Tooltip.mjs +87 -86
  380. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  381. package/dist/components/portal/Portal.cjs +1 -1
  382. package/dist/components/portal/Portal.cjs.map +1 -1
  383. package/dist/components/portal/Portal.mjs +33 -32
  384. package/dist/components/portal/Portal.mjs.map +1 -1
  385. package/dist/components/provider/WaveProvider.cjs +1 -1
  386. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  387. package/dist/components/provider/WaveProvider.mjs +36 -29
  388. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  389. package/dist/components/table/DataGrid.cjs +1 -1
  390. package/dist/components/table/DataGrid.cjs.map +1 -1
  391. package/dist/components/table/DataGrid.mjs +228 -227
  392. package/dist/components/table/DataGrid.mjs.map +1 -1
  393. package/dist/components/table/Table.cjs +1 -1
  394. package/dist/components/table/Table.cjs.map +1 -1
  395. package/dist/components/table/Table.mjs +60 -59
  396. package/dist/components/table/Table.mjs.map +1 -1
  397. package/dist/components/typography/Text.cjs +1 -1
  398. package/dist/components/typography/Text.cjs.map +1 -1
  399. package/dist/components/typography/Text.mjs +12 -11
  400. package/dist/components/typography/Text.mjs.map +1 -1
  401. package/dist/hooks/useFieldControl.cjs.map +1 -1
  402. package/dist/hooks/useFieldControl.mjs.map +1 -1
  403. package/dist/hooks/useMediaQuery.cjs +2 -0
  404. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  405. package/dist/hooks/useMediaQuery.mjs +20 -0
  406. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  407. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  408. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  409. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  410. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  411. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  412. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  413. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  414. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  415. package/dist/index.cjs +1 -1
  416. package/dist/index.d.cts +2890 -197
  417. package/dist/index.d.ts +2890 -197
  418. package/dist/index.mjs +101 -87
  419. package/dist/lib/classNames.cjs +2 -0
  420. package/dist/lib/classNames.cjs.map +1 -0
  421. package/dist/lib/classNames.mjs +423 -0
  422. package/dist/lib/classNames.mjs.map +1 -0
  423. package/dist/lib/color.cjs +2 -0
  424. package/dist/lib/color.cjs.map +1 -0
  425. package/dist/lib/color.mjs +86 -0
  426. package/dist/lib/color.mjs.map +1 -0
  427. package/dist/lib/globalRegistry.cjs.map +1 -1
  428. package/dist/lib/globalRegistry.mjs.map +1 -1
  429. package/dist/lib/styles.cjs +1 -1
  430. package/dist/lib/styles.cjs.map +1 -1
  431. package/dist/lib/styles.mjs +21 -4
  432. package/dist/lib/styles.mjs.map +1 -1
  433. package/dist/lib/toaster.cjs +2 -0
  434. package/dist/lib/toaster.cjs.map +1 -0
  435. package/dist/lib/toaster.mjs +77 -0
  436. package/dist/lib/toaster.mjs.map +1 -0
  437. package/dist/styles.css +1 -1
  438. package/package.json +1 -1
  439. package/src/styles/tokens.css +13 -0
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBox.cjs","names":["Button","slotRendersContent","materialiseSlotContent","hasTextLabel","BUTTON_OWN_PROP_KEYS","renderSlot","placeButtonIcon","isElementOfType","getElementType","resolveSlot","slotWrapsDefaultContent","DismissIcon","React","useControllable","useMergedRefs","useFieldControl","isInvalidLook","observeTextLabel","hasRenderedTextLabel","mergeProps","cn","focusRing","mergedAriaDisabledClasses","inputFocusWithin","composeEventHandlers","SearchIcon","MERGED_DISABLED_FOCUSABLE_PROPS","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_useControllable","require_useMergedRefs","require_useFieldControl","require_styles","require_Button","require_icons","require_mergeProps","require_Button_slots","require_Input","require_useFormReset","require_labelInName","react","react_jsx_runtime","BUTTON_ONLY_KEYS","HANDLER_KEY","NAMING_KEYS","DEFAULT_CLEAR_LABEL","noop","INTERACTIVE_CONTENT","DEFAULT_DISMISS","isButtonType","type","splitButtonLike","hasChildren","children","content","literalTextLabel","buttonProps","key","value","props","iconNode","_children","resolveDismiss","node","dismiss","resolved","Component","contentProps","hasButtonProps","empty","contentChildren","SearchBox","controlledValue","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","onChange","setValue","defaultValue","onValueChange","next","inputRef","mergedInputRef","controlRef","form","fieldProps","invalidLook","dismissParts","dismissKind","handleClear","onClear","handleKeyDown","event","readOnly","disabled","handleRootMouseDown","input","root","target","control","slotOnClick","slotRef","slotButtonProps","hasOwnName","checksContent","labelTarget","setLabelTarget","subscribeToContent","contentHasTextLabel","namedByContent","clearRef","clearButtonProps","clearContent","hasBefore","contentBefore","hasAfter","contentAfter","className","onMouseDown","onKeyDown"],"sources":["../../../src/components/input/SearchBox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getElementType, isElementOfType } from '../../lib/children';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { DismissIcon, SearchIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport { focusRing, inputFocusWithin, inputInvalidWithin } from '../../lib/styles';\nimport type { Slot, SlotObject } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport { isInvalidLook } from './Input';\n\n/**\n * Props that SearchBox routes to its `<input>` (C-ROUTING): the id, the ARIA naming/validation\n * attributes, native text-input attributes and the focus/keyboard handlers.\n */\nexport type SearchBoxInputProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'aria-invalid'\n | 'aria-required'\n | 'aria-errormessage'\n | 'aria-details'\n | 'name'\n | 'form'\n | 'required'\n | 'readOnly'\n | 'autoComplete'\n | 'autoFocus'\n | 'autoCapitalize'\n | 'autoCorrect'\n | 'inputMode'\n | 'enterKeyHint'\n | 'spellCheck'\n | 'maxLength'\n | 'minLength'\n | 'pattern'\n | 'tabIndex'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n | 'onKeyUp'\n>;\n\n/** Properties for the SearchBox component. */\nexport interface SearchBoxProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | keyof SearchBoxInputProps\n >,\n SearchBoxInputProps {\n /** Controlled search text value. */\n value?: string;\n /** Initial search text for uncontrolled usage (also what a form reset restores).\n * @default ''\n */\n defaultValue?: string;\n /** Called with the new search text when it changes (typing or clearing). */\n onValueChange?: (value: string) => void;\n /**\n * Called with the new search text when it changes.\n * @deprecated Use `onValueChange`. (`onChange` is reserved for native change events.)\n */\n onChange?: (value: string) => void;\n /**\n * Called when the user clears the search: with the clear button, or with Escape while there is\n * text (after `onValueChange('')`).\n */\n onClear?: () => void;\n /** Placeholder text shown when the input is empty.\n * @default 'Search'\n */\n placeholder?: string;\n /** Whether the search box is disabled and non-interactive. */\n disabled?: boolean;\n /**\n * Slot rendered before the text (replaces the default search icon). It takes the room it needs;\n * the text starts after it. A value that renders nothing (`null`, `false`, `''`, an empty array\n * or Fragment) keeps the default icon.\n */\n contentBefore?: Slot<'span'>;\n /**\n * Slot rendered after the text, before the clear button. It takes the room it needs; the text\n * ends before it. A value that renders nothing (`false`, `''`, an empty array or Fragment) is no\n * slot: nothing takes room.\n */\n contentAfter?: Slot<'span'>;\n /**\n * Content of the clear button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Clear search\">`, which clears the value, calls\n * `onClear` and moves focus back to the input. The slot cannot hide the clear button or leave\n * it empty: content that renders nothing (`null`, `false`, `true`, `''`, or an array, `Set`,\n * generator or Fragment of only those) keeps the default icon, and a slot object without\n * children (`{ className: 'text-error' }`) wraps the default icon in its element (not when it\n * brings markup of its own through `dangerouslySetInnerHTML`, or is a void or component element).\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first; `preventDefault()` cancels the clear) and its\n * children become the content, with a development warning. A Wave `Button`'s own props are not\n * attributes: its `icon` becomes decorative content before its children (after them with\n * `iconPosition=\"after\"`), `disabledFocusable` makes the clear button unavailable but focusable\n * as on the Button (nothing is cleared), and `appearance` and `size` are ignored. The 0.4\n * button-object form (`{ as: 'button', onClick, … }` or an object with button props) is\n * **deprecated**: its button props are merged the same way. Pass icon content instead.\n *\n * Name (WCAG 2.5.3 Label in Name): content is decorative (`aria-hidden`), so the button keeps\n * the name \"Clear search\". An `aria-label`, `aria-labelledby` or `title` on the merged button or\n * on a slot object names the button instead (`{ children: 'Reset', 'aria-label': 'Reset' }`).\n * The children of a merged `<button>`/`Button` (or of `{ as: 'button' }`) are rendered as is:\n * when they render a text label (at least two letters or digits outside `aria-hidden`/`hidden`\n * content, text from components such as translations included), that text names the button;\n * an icon or a lone character (`X`, `×`) keeps \"Clear search\". Text hidden only with CSS still\n * counts as the label, so give a button with a responsive label an explicit `aria-label`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n /** Ref to the `<input type=\"search\">` (the focusable control). */\n controlRef?: React.Ref<HTMLInputElement>;\n}\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Attributes that only make sense on the clear `<button>` itself (merged onto it). */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\nconst HANDLER_KEY = /^on[A-Z]/;\n\n/**\n * Attributes that name the clear button (C-SLOTS naming). On a merged button or a slot object they\n * go to the clear button (slot content is `aria-hidden`), and any of them replaces the default\n * `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\n/** Default name of the clear button. */\nconst DEFAULT_CLEAR_LABEL = 'Clear search';\n\ninterface DismissParts {\n /**\n * `default`: no slot (default icon); `content`: icon content; `element`: a `<button>`/`Button`\n * element; `button-object`: the deprecated button-object form.\n */\n kind: 'default' | 'content' | 'element' | 'button-object';\n /** Props merged onto the built-in clear button. */\n buttonProps: UnknownProps;\n /** Content of the clear button (`null` = the default icon, except for `content`). */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button` or `{ as: 'button' }`),\n * so a text label in it names the button (C-SLOTS naming, WCAG 2.5.3); `false` when the content\n * is decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the literal children contain a text label: the name for the server render and the\n * first client render. After mount the rendered button's text decides.\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the clear button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n}\n\nconst noop = () => {};\n\n/**\n * Elements inside the field that keep a press to themselves: a control in a slot, the clear\n * button.\n */\nconst INTERACTIVE_CONTENT =\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable]:not([contenteditable=\"false\"])';\n\nconst DEFAULT_DISMISS: DismissParts = {\n kind: 'default',\n buttonProps: {},\n content: null,\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n};\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/**\n * Splits the props of a button-like element or object into button props and content. The content\n * is rendered as is, so a text label in it names the button (C-SLOTS naming). Content that renders\n * nothing is `null` (the default icon); a generator is read once and rendered as its items.\n */\nfunction splitButtonLike(type: unknown, props: UnknownProps, children: React.ReactNode) {\n const hasChildren = slotRendersContent(children);\n const content = materialiseSlotContent(children);\n const literalTextLabel = hasTextLabel(content);\n if (type === Button) {\n // Wave Button's own props do not belong on a native <button>: its icon becomes content (after\n // the children with `iconPosition=\"after\"`) and `disabledFocusable` is applied by the caller.\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(props)) {\n if (key !== 'children' && !BUTTON_OWN_PROP_KEYS.has(key)) buttonProps[key] = value;\n }\n const iconNode = renderSlot(props.icon as Slot<'span'>, 'span', 'inline-flex', {\n 'aria-hidden': true,\n });\n const buttonContent =\n iconNode || hasChildren ? placeButtonIcon(iconNode, content, props.iconPosition) : null;\n return {\n buttonProps,\n content: buttonContent,\n contentMayName: true,\n literalTextLabel,\n disabledFocusable: Boolean(props.disabledFocusable),\n };\n }\n const { as, children: _children, ...buttonProps } = props;\n // `null` content falls back to the default icon.\n return {\n buttonProps,\n content: hasChildren ? content : null,\n contentMayName: true,\n literalTextLabel,\n disabledFocusable: false,\n };\n}\n\n/**\n * Splits `dismiss` into the props merged onto the built-in clear button and its content. Content\n * that renders nothing (`slotRendersContent`) never leaves the button empty: without other props\n * it is the default icon; a slot object with its own content props (`className`, `style`, …)\n * wraps the default icon in its element.\n */\nfunction resolveDismiss(dismiss: SearchBoxProps['dismiss']): DismissParts {\n // The type is unwrapped (C-COMPOUND): a Button written in a Server Component arrives as a lazy\n // client reference, and must be merged like a plain one rather than nested inside the clear\n // button. A slot object is never an element, so the check can take any slot value as a node.\n const node = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(node, 'button', Button)) {\n const children = node.props.children as React.ReactNode;\n return {\n kind: 'element',\n ...splitButtonLike(getElementType(node), node.props, children),\n };\n }\n // Resolved once: a generator is materialised (and cached) by resolveSlot, so it can be checked\n // for emptiness and rendered without being consumed twice.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return DEFAULT_DISMISS;\n const { Component, props, children } = resolved;\n if (isButtonType(Component)) {\n return { kind: 'button-object', ...splitButtonLike(Component, props, children) };\n }\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let hasButtonProps = false;\n for (const [key, value] of Object.entries(props)) {\n // resolveSlot sets `className: undefined` when there are no classes.\n if (value === undefined) continue;\n if (BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key)) {\n buttonProps[key] = value;\n hasButtonProps = true;\n } else if (NAMING_KEYS.has(key)) {\n // The content is aria-hidden, so a naming attribute names the clear button instead (not the\n // deprecated button-object form).\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n // A void (`img`), component (`{ as: MyIcon }`) or markup (`dangerouslySetInnerHTML`) slot\n // renders content of its own.\n const hasChildren = slotRendersContent(children);\n const empty = slotWrapsDefaultContent(Component, { ...contentProps, children });\n if (empty && Object.keys(buttonProps).length === 0 && Object.keys(contentProps).length === 0) {\n return DEFAULT_DISMISS;\n }\n // A button object without content (`{ onClick }`, `{ type: 'button' }`) or a content object\n // without children (`{ className }`) keeps the default icon inside the object's own element (its\n // className/style/attributes still apply). Markup of its own takes no children at all.\n const contentChildren = empty ? <DismissIcon /> : hasChildren ? children : undefined;\n const content =\n contentChildren === undefined\n ? React.createElement(Component, { 'aria-hidden': true, ...contentProps })\n : React.createElement(Component, { 'aria-hidden': true, ...contentProps }, contentChildren);\n return {\n kind: hasButtonProps ? 'button-object' : 'content',\n buttonProps,\n content,\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n };\n}\n\n/**\n * A search input with a leading search icon and a clear button that appears while there is text\n * (not while `readOnly`).\n *\n * - **Layout**: the root `<div>` draws the field (its outline, focus and invalid look). The icon\n * (or `contentBefore`), the text, `contentAfter` and the clear button sit side by side in it, so\n * no slot covers the text. Pressing the field outside a control of its own focuses the input.\n * - **Clearing**: the clear button clears the text and moves focus back to the input. Escape\n * clears the text too while there is any, and is then consumed, so an enclosing Dialog, Drawer\n * or Popover stays open; in an empty field Escape reaches them. Both call `onClear`.\n * - **Routing**: `id`, ARIA and native input attributes and the focus/keyboard handlers go to the\n * `<input type=\"search\">` (role `searchbox`); `className`, `style`, `data-*`, other handlers and\n * `ref` stay on the root `<div>` (`controlRef` reaches the input). Inside a `Field` it picks up\n * the label, hint, error and required state automatically.\n * - **Forms**: with `name` the text is submitted with the form; a form reset restores\n * `defaultValue`.\n *\n * @example\n * <SearchBox aria-label=\"Search files\" value={query} onValueChange={setQuery} />\n */\nexport const SearchBox = ({\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n onChange,\n onClear,\n placeholder = 'Search',\n disabled,\n contentBefore,\n contentAfter,\n dismiss,\n className,\n ref,\n controlRef,\n // Routed to the input (C-ROUTING)\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n required,\n name,\n form,\n readOnly,\n autoComplete,\n autoFocus,\n autoCapitalize,\n autoCorrect,\n inputMode,\n enterKeyHint,\n spellCheck,\n maxLength,\n minLength,\n pattern,\n tabIndex,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n hidden,\n ...rest\n}: SearchBoxProps) => {\n if (onChange !== undefined) warnDeprecated('SearchBox', 'onChange', 'onValueChange');\n\n const [value, setValue] = useControllable(controlledValue, defaultValue, (next: string) => {\n onValueChange?.(next);\n onChange?.(next);\n });\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedInputRef = useMergedRefs(inputRef, controlRef);\n // The input is always React-controlled, so the browser's own reset would put the current text\n // back: restore the default here instead (C-FORMS).\n useFormReset(inputRef, () => setValue(defaultValue), form);\n\n const fieldProps = useFieldControl(\n {\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n required,\n },\n { nativeRequired: true },\n );\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n const dismissParts = resolveDismiss(dismiss);\n const dismissKind = dismissParts.kind;\n React.useEffect(() => {\n if (dismissKind === 'element') {\n warnOnce(\n 'SearchBox:dismiss-button-element',\n 'SearchBox: `dismiss` received a button element; its props were merged into the built-in clear button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<MyIcon />}`.',\n );\n } else if (dismissKind === 'button-object') {\n warnOnce(\n 'SearchBox:dismiss-button-object',\n 'SearchBox: `dismiss` with button props (`as: \"button\"`, `onClick`, `type`, …) is deprecated and will be removed in 1.0; the props were merged into the built-in clear button. Pass icon content instead, e.g. `dismiss={<MyIcon />}`.',\n );\n }\n }, [dismissKind]);\n\n const handleClear = () => {\n setValue('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n // Escape clears the text first, as native search fields do, and is consumed so an enclosing\n // Dialog, Drawer or Popover stays open; with an empty field it reaches them (C-POPUPS).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Escape' || event.nativeEvent.isComposing) return;\n if (!value || readOnly || disabled) return;\n event.preventDefault();\n setValue('');\n onClear?.();\n };\n\n // The whole box is the field: pressing the icon, a slot or the padding around the text focuses\n // the input, as it does in a native search field. A control inside a slot keeps its press.\n const handleRootMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current;\n const root = event.currentTarget;\n const target = event.target;\n if (!input || disabled || event.button !== 0 || target === input) return;\n // Events that bubble through React portals from outside this box are not ours (C-COMPOSE).\n if (!(target instanceof Element) || !root.contains(target)) return;\n const control = target.closest(INTERACTIVE_CONTENT);\n if (control && root.contains(control)) return;\n event.preventDefault(); // keeps the press from moving focus to the page\n input.focus();\n };\n\n // The slot's onClick is composed at click time (it runs first; preventDefault() cancels the\n // clear), so handleClear, which reads the input ref, is never passed to a render-time helper.\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const {\n onClick: slotOnClick,\n ref: slotRef,\n ...slotButtonProps\n } = dismissParts.buttonProps as UnknownProps & {\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n ref?: React.Ref<HTMLButtonElement>;\n };\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a consumer naming attribute names the clear button;\n // otherwise content rendered as is names it when it has a text label, and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, later changes).\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n const checksContent = dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts.literalTextLabel;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const clearRef = useMergedRefs<HTMLButtonElement>(\n slotRef,\n checksContent ? setLabelTarget : undefined,\n );\n\n const clearButtonProps = mergeProps(\n {\n type: 'button',\n disabled,\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_CLEAR_LABEL,\n className: cn(\n // Padding and background set here (C-NATIVE): an app-wide `button` rule cannot fill it.\n 'me-1 flex h-6 w-6 shrink-0 items-center justify-center rounded bg-transparent p-0 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:text-foreground',\n focusRing,\n 'disabled:cursor-not-allowed',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n\n // A merged button with markup of its own (`dangerouslySetInnerHTML`) takes no children.\n const clearContent =\n clearButtonProps.dangerouslySetInnerHTML != null\n ? undefined\n : dismissKind === 'content'\n ? dismissParts.content\n : (dismissParts.content ?? <DismissIcon />);\n // A slot value that renders nothing is no slot (the default icon before the text, no box after).\n const hasBefore = slotRendersContent(contentBefore);\n const hasAfter = slotRendersContent(contentAfter);\n\n return (\n <div\n ref={ref}\n className={cn(\n // The root draws the field; the slots, the text and the clear button are laid out side by\n // side inside it, so a slot never covers the text.\n 'relative inline-flex h-8 w-full items-center rounded border border-input border-b-stroke-accessible bg-background text-body-1 text-foreground',\n inputFocusWithin,\n invalidLook && inputInvalidWithin,\n // The dimmed look lifts while a focus ring shows inside the root (a clear button kept\n // focusable by a merged `disabledFocusable` Button, focusable slot content; the disabled\n // input never takes focus): opacity would dim the ring below 3:1.\n disabled && 'cursor-not-allowed opacity-50 has-focus-visible:opacity-100',\n className,\n )}\n hidden={hidden}\n {...rest}\n // Composed at press time, like the clear button's click: the handler reads the input ref.\n onMouseDown={(event) => composeEventHandlers(onMouseDown, handleRootMouseDown)(event)}\n >\n <span className=\"flex shrink-0 items-center ps-2\">\n {hasBefore ? (\n renderSlot(contentBefore, 'span', 'shrink-0')\n ) : (\n <SearchIcon className=\"text-muted-foreground\" />\n )}\n </span>\n\n <input\n ref={mergedInputRef}\n type=\"search\"\n value={value}\n onChange={(event) => setValue(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n className={cn(\n 'h-full min-w-0 flex-1 appearance-none border-none bg-transparent px-2 text-body-1 text-foreground',\n 'placeholder:text-muted-foreground',\n 'focus:outline-hidden',\n 'disabled:cursor-not-allowed',\n '[&::-webkit-search-cancel-button]:hidden',\n )}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n name={name}\n form={form}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n inputMode={inputMode}\n enterKeyHint={enterKeyHint}\n spellCheck={spellCheck}\n maxLength={maxLength}\n minLength={minLength}\n pattern={pattern}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyUp={onKeyUp}\n {...fieldProps}\n />\n\n {hasAfter && (\n <span className=\"flex shrink-0 items-center pe-2\">\n {renderSlot(contentAfter, 'span', 'shrink-0')}\n </span>\n )}\n\n {/* No clear button while read-only: clearing would change a value the user cannot edit. */}\n {value && !readOnly ? (\n <button\n {...clearButtonProps}\n ref={clearRef}\n // mergeProps keeps a slot's `type: null`, which would drop the attribute and make the\n // button submit its form; only nullish falls back (an explicit type is kept).\n type={clearButtonProps.type ?? 'button'}\n disabled={disabled || clearButtonProps.disabled}\n onClick={(event) => composeEventHandlers(slotOnClick, handleClear)(event)}\n // A merged `disabledFocusable` Button makes the clear button unavailable but focusable\n // (spread last: it wins over `disabled` and the clear handler).\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {clearContent}\n </button>\n ) : null}\n </div>\n );\n};\n\nSearchBox.displayName = 'SearchBox';\n"],"mappings":"muBAkJA,IAAM8C,EAAwC,IAAI,IAAI,CACpD,OACA,WACA,OACA,aACA,cACA,aACA,iBACA,aACA,OACA,QACA,gBACA,qBACF,CAAC,EACKC,EAAc,WAOdC,EAAmC,IAAI,IAAI,CAAC,aAAc,kBAAmB,OAAO,CAAC,EAGrFC,GAAsB,eA8BtBC,OAAa,CAAC,EAMdC,GACJ,yGAEIC,EAAgC,CACpC,KAAM,UACN,YAAa,CAAC,EACd,QAAS,KACT,eAAgB,GAChB,iBAAkB,GAClB,kBAAmB,EACrB,EAEA,SAASC,EAAa,EAAwB,CAC5C,OAAOC,IAAS,UAAYA,IAAStD,EAAAA,MACvC,CAOA,SAASuD,EAAgB,EAAe,EAAqB,EAA2B,CACtF,IAAMC,EAAcvD,EAAAA,mBAAmBwD,CAAQ,EACzCC,EAAUxD,EAAAA,uBAAuBuD,CAAQ,EACzCE,EAAmBxD,EAAAA,aAAauD,CAAO,EAC7C,GAAIJ,IAAStD,EAAAA,OAAQ,CAGnB,IAAM4D,EAA4B,CAAC,EACnC,IAAK,GAAM,CAACC,EAAKC,KAAU,OAAO,QAAQC,CAAK,EACzCF,IAAQ,YAAc,CAACzD,EAAAA,qBA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AW,GAAUL,EAASe,EAAM,OAAO,KAAK,EACnC,cACH,WACV,UAAWjF,EAAAA,GACT,oGACA,oCACA,uBACA,8BACA,0CACF,EACA,oBAAmB8D,GACnB,eAAcC,GACR,OACA,OACI,WACI,eACH,YACK,iBACH,cACF,YACG,eACF,aACD,YACA,YACF,WACC,YACD,WACD,UACR,UAAW3D,EAAAA,qBAAqBwG,GAAW5B,EAAa,EAC/C,WACT,GAAIN,CACL,CAAA,EAEA8B,KACC,EAAA/E,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,kCACb,SAAAxC,EAAAA,WAAWwH,EAAc,OAAQ,UAAU,CACxC,CAAA,EAIP/D,GAAS,CAACwC,GACT,EAAAzD,EAAA,IAAA,CAAC,SAAD,CACE,GAAI2E,EACJ,IAAKD,GAGL,KAAMC,EAAiB,MAAQ,SAC/B,SAAUjB,GAAYiB,EAAiB,SACvC,QAAU,GAAUhG,EAAAA,qBAAqBqF,GAAaX,EAAW,CAAC,CAACG,CAAK,EAGxE,GAAKL,EAAa,kBAAoBtE,EAAAA,gCAAkC,IAAA,GAEvE,SAAA+F,EACK,CAAA,EACN,IACD,GAET,EAEA,EAAU,YAAc"}
1
+ {"version":3,"file":"SearchBox.cjs","names":["Button","slotRendersContent","materialiseSlotContent","hasTextLabel","BUTTON_OWN_PROP_KEYS","renderSlot","cn","searchBoxClassNames","placeButtonIcon","isElementOfType","getElementType","resolveSlot","slotWrapsDefaultContent","DismissIcon","React","useControllable","useMergedRefs","useFieldControl","isInvalidLook","useInputLook","observeTextLabel","hasRenderedTextLabel","mergeProps","focusRing","mergedAriaDisabledClasses","inputHeightClasses","inputTextClasses","inputAppearanceClasses","inputFocusWithin","composeEventHandlers","SearchIcon","MERGED_DISABLED_FOCUSABLE_PROPS","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useControllable","require_useMergedRefs","require_useFieldControl","require_styles","require_Button","require_Button_slots","require_icons","require_mergeProps","require_inputLook","require_Input","require_useFormReset","require_labelInName","react","react_jsx_runtime","SEARCH_SIZE","BUTTON_ONLY_KEYS","HANDLER_KEY","NAMING_KEYS","DEFAULT_CLEAR_LABEL","noop","INTERACTIVE_CONTENT","DEFAULT_DISMISS","isButtonType","type","splitButtonLike","hasChildren","children","content","literalTextLabel","buttonProps","key","value","props","iconNode","_children","resolveDismiss","node","dismiss","resolved","Component","contentProps","hasButtonProps","empty","contentChildren","size","iconProps","SearchBox","controlledValue","sizeProp","appearanceProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","onChange","setValue","defaultValue","onValueChange","next","inputRef","mergedInputRef","controlRef","form","fieldProps","invalidLook","dismissParts","dismissKind","handleClear","onClear","handleKeyDown","event","readOnly","disabled","handleRootMouseDown","input","root","target","control","slotOnClick","slotRef","slotButtonProps","hasOwnName","checksContent","labelTarget","setLabelTarget","subscribeToContent","contentHasTextLabel","namedByContent","clearRef","clearButtonProps","clearContent","hasBefore","contentBefore","hasAfter","contentAfter","appearance","className","onMouseDown","onKeyDown"],"sources":["../../../src/components/input/SearchBox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getElementType, isElementOfType } from '../../lib/children';\nimport { searchBoxClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated, warnOnce } from '../../lib/dev';\nimport { DismissIcon, SearchIcon } from '../../lib/icons';\nimport { hasRenderedTextLabel, hasTextLabel, observeTextLabel } from '../../lib/labelInName';\nimport { mergeProps } from '../../lib/mergeProps';\nimport {\n materialiseSlotContent,\n renderSlot,\n resolveSlot,\n slotRendersContent,\n slotWrapsDefaultContent,\n} from '../../lib/slot';\nimport {\n focusRing,\n hitAreaLayer,\n inputAppearanceClasses,\n inputFocusWithin,\n inputHeightClasses,\n inputInvalidWithin,\n inputTextClasses,\n} from '../../lib/styles';\nimport type { CoreSize, InputAppearance, Slot, SlotObject } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { Button } from '../button/Button';\nimport {\n BUTTON_OWN_PROP_KEYS,\n MERGED_DISABLED_FOCUSABLE_PROPS,\n mergedAriaDisabledClasses,\n placeButtonIcon,\n} from '../button/Button.slots';\nimport { isInvalidLook } from './Input';\nimport { useInputLook } from './inputLook';\n\n/**\n * Props that SearchBox routes to its `<input>` (C-ROUTING): the id, the ARIA naming/validation\n * attributes, native text-input attributes and the focus/keyboard handlers.\n */\nexport type SearchBoxInputProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'id'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'aria-invalid'\n | 'aria-required'\n | 'aria-errormessage'\n | 'aria-details'\n | 'name'\n | 'form'\n | 'required'\n | 'readOnly'\n | 'autoComplete'\n | 'autoFocus'\n | 'autoCapitalize'\n | 'autoCorrect'\n | 'inputMode'\n | 'enterKeyHint'\n | 'spellCheck'\n | 'maxLength'\n | 'minLength'\n | 'pattern'\n | 'tabIndex'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n | 'onKeyUp'\n>;\n\n/** Properties for the SearchBox component. */\nexport interface SearchBoxProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | keyof SearchBoxInputProps\n >,\n SearchBoxInputProps {\n /** Controlled search text value. */\n value?: string;\n /** Initial search text for uncontrolled usage (also what a form reset restores).\n * @default ''\n */\n defaultValue?: string;\n /** Called with the new search text when it changes (typing or clearing). */\n onValueChange?: (value: string) => void;\n /**\n * Called with the new search text when it changes.\n * @deprecated Use `onValueChange`. (`onChange` is reserved for native change events.)\n */\n onChange?: (value: string) => void;\n /**\n * Called when the user clears the search: with the clear button, or with Escape while there is\n * text (after `onValueChange('')`).\n */\n onClear?: () => void;\n /** Placeholder text shown when the input is empty.\n * @default 'Search'\n */\n placeholder?: string;\n /** Whether the search box is disabled and non-interactive. */\n disabled?: boolean;\n /**\n * Size of the field: `small` (24px tall), `medium` (32px) or `large` (40px). Default: the\n * surrounding Field's `size`, else `WaveProvider inputDefaults.size`, else `'medium'`.\n */\n size?: CoreSize;\n /**\n * Look of the field: `outline` (a full border), `underline` (a bottom stroke only),\n * `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible\n * label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.\n */\n appearance?: InputAppearance;\n /**\n * Slot rendered before the text (replaces the default search icon). It takes the room it needs;\n * the text starts after it. A value that renders nothing (`null`, `false`, `''`, an empty array\n * or Fragment) keeps the default icon.\n */\n contentBefore?: Slot<'span'>;\n /**\n * Slot rendered after the text, before the clear button. It takes the room it needs; the text\n * ends before it. A value that renders nothing (`false`, `''`, an empty array or Fragment) is no\n * slot: nothing takes room.\n */\n contentAfter?: Slot<'span'>;\n /**\n * Content of the clear button (replaces the default dismiss icon). It always renders **inside**\n * the built-in `<button type=\"button\" aria-label=\"Clear search\">`, which clears the value, calls\n * `onClear` and moves focus back to the input. The slot cannot hide the clear button or leave\n * it empty: content that renders nothing (`null`, `false`, `true`, `''`, or an array, `Set`,\n * generator or Fragment of only those) keeps the default icon, and a slot object without\n * children (`{ className: 'text-error' }`) wraps the default icon in its element (not when it\n * brings markup of its own through `dangerouslySetInnerHTML`, or is a void or component element).\n *\n * A `<button>` element or a Wave `Button` passed here is not nested: its props are merged into\n * the built-in button (its `onClick` runs first; `preventDefault()` cancels the clear) and its\n * children become the content, with a development warning. A Wave `Button`'s own props are not\n * attributes: its `icon` becomes decorative content before its children (after them with\n * `iconPosition=\"after\"`), `disabledFocusable` makes the clear button unavailable but focusable\n * as on the Button (nothing is cleared), and `appearance` and `size` are ignored. The 0.4\n * button-object form (`{ as: 'button', onClick, … }` or an object with button props) is\n * **deprecated**: its button props are merged the same way. Pass icon content instead.\n *\n * Name (WCAG 2.5.3 Label in Name): content is decorative (`aria-hidden`), so the button keeps\n * the name \"Clear search\". An `aria-label`, `aria-labelledby` or `title` on the merged button or\n * on a slot object names the button instead (`{ children: 'Reset', 'aria-label': 'Reset' }`).\n * The children of a merged `<button>`/`Button` (or of `{ as: 'button' }`) are rendered as is:\n * when they render a text label (at least two letters or digits outside `aria-hidden`/`hidden`\n * content, text from components such as translations included), that text names the button;\n * an icon or a lone character (`X`, `×`) keeps \"Clear search\". Text hidden only with CSS still\n * counts as the label, so give a button with a responsive label an explicit `aria-label`.\n */\n dismiss?: Slot<'span'> | SlotObject<'button'>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n /** Ref to the `<input type=\"search\">` (the focusable control). */\n controlRef?: React.Ref<HTMLInputElement>;\n}\n\n/** Per-size metrics of SearchBox (medium is the 0.7 look). */\nconst SEARCH_SIZE: Readonly<\n Record<CoreSize, { before: string; after: string; input: string; clear: string; glyph: number }>\n> = {\n small: { before: 'ps-1.5', after: 'pe-1.5', input: 'px-1.5', clear: 'size-5', glyph: 12 },\n medium: { before: 'ps-2', after: 'pe-2', input: 'px-2', clear: 'h-6 w-6', glyph: 16 },\n large: { before: 'ps-3', after: 'pe-3', input: 'px-3', clear: 'size-8', glyph: 20 },\n};\n\ntype UnknownProps = Record<string, unknown>;\n\n/** Attributes that only make sense on the clear `<button>` itself (merged onto it). */\nconst BUTTON_ONLY_KEYS: ReadonlySet<string> = new Set([\n 'type',\n 'disabled',\n 'form',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'name',\n 'value',\n 'popoverTarget',\n 'popoverTargetAction',\n]);\nconst HANDLER_KEY = /^on[A-Z]/;\n\n/**\n * Attributes that name the clear button (C-SLOTS naming). On a merged button or a slot object they\n * go to the clear button (slot content is `aria-hidden`), and any of them replaces the default\n * `aria-label`.\n */\nconst NAMING_KEYS: ReadonlySet<string> = new Set(['aria-label', 'aria-labelledby', 'title']);\n\n/** Default name of the clear button. */\nconst DEFAULT_CLEAR_LABEL = 'Clear search';\n\ninterface DismissParts {\n /**\n * `default`: no slot (default icon); `content`: icon content; `element`: a `<button>`/`Button`\n * element; `button-object`: the deprecated button-object form.\n */\n kind: 'default' | 'content' | 'element' | 'button-object';\n /** Props merged onto the built-in clear button. */\n buttonProps: UnknownProps;\n /** Content of the clear button (`null` = the default icon, except for `content`). */\n content: React.ReactNode;\n /**\n * `true` when the content is rendered as is (a merged `<button>`/`Button` or `{ as: 'button' }`),\n * so a text label in it names the button (C-SLOTS naming, WCAG 2.5.3); `false` when the content\n * is decorative (`aria-hidden`).\n */\n contentMayName: boolean;\n /**\n * Whether the literal children contain a text label: the name for the server render and the\n * first client render. After mount the rendered button's text decides.\n */\n literalTextLabel: boolean;\n /**\n * Whether a merged Wave `Button` set `disabledFocusable`: the clear button is then unavailable\n * but focusable, as the Button would be.\n */\n disabledFocusable: boolean;\n}\n\nconst noop = () => {};\n\n/**\n * Elements inside the field that keep a press to themselves: a control in a slot, the clear\n * button.\n */\nconst INTERACTIVE_CONTENT =\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable]:not([contenteditable=\"false\"])';\n\nconst DEFAULT_DISMISS: DismissParts = {\n kind: 'default',\n buttonProps: {},\n content: null,\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n};\n\nfunction isButtonType(type: unknown): boolean {\n return type === 'button' || type === Button;\n}\n\n/**\n * Splits the props of a button-like element or object into button props and content. The content\n * is rendered as is, so a text label in it names the button (C-SLOTS naming). Content that renders\n * nothing is `null` (the default icon); a generator is read once and rendered as its items.\n */\nfunction splitButtonLike(type: unknown, props: UnknownProps, children: React.ReactNode) {\n const hasChildren = slotRendersContent(children);\n const content = materialiseSlotContent(children);\n const literalTextLabel = hasTextLabel(content);\n if (type === Button) {\n // Wave Button's own props do not belong on a native <button>: its icon becomes content (after\n // the children with `iconPosition=\"after\"`) and `disabledFocusable` is applied by the caller.\n const buttonProps: UnknownProps = {};\n for (const [key, value] of Object.entries(props)) {\n if (key !== 'children' && !BUTTON_OWN_PROP_KEYS.has(key)) buttonProps[key] = value;\n }\n const iconNode = renderSlot(\n props.icon as Slot<'span'>,\n 'span',\n cn(searchBoxClassNames.dismissIcon, 'inline-flex'),\n { 'aria-hidden': true },\n );\n const buttonContent =\n iconNode || hasChildren ? placeButtonIcon(iconNode, content, props.iconPosition) : null;\n return {\n buttonProps,\n content: buttonContent,\n contentMayName: true,\n literalTextLabel,\n disabledFocusable: Boolean(props.disabledFocusable),\n };\n }\n const { as, children: _children, ...buttonProps } = props;\n // `null` content falls back to the default icon.\n return {\n buttonProps,\n content: hasChildren ? content : null,\n contentMayName: true,\n literalTextLabel,\n disabledFocusable: false,\n };\n}\n\n/**\n * Splits `dismiss` into the props merged onto the built-in clear button and its content. Content\n * that renders nothing (`slotRendersContent`) never leaves the button empty: without other props\n * it is the default icon; a slot object with its own content props (`className`, `style`, …)\n * wraps the default icon in its element.\n */\nfunction resolveDismiss(dismiss: SearchBoxProps['dismiss'], size: CoreSize): DismissParts {\n // The type is unwrapped (C-COMPOUND): a Button written in a Server Component arrives as a lazy\n // client reference, and must be merged like a plain one rather than nested inside the clear\n // button. A slot object is never an element, so the check can take any slot value as a node.\n const node = dismiss as React.ReactNode;\n if (isElementOfType<UnknownProps>(node, 'button', Button)) {\n const children = node.props.children as React.ReactNode;\n return {\n kind: 'element',\n ...splitButtonLike(getElementType(node), node.props, children),\n };\n }\n // Resolved once: a generator is materialised (and cached) by resolveSlot, so it can be checked\n // for emptiness and rendered without being consumed twice.\n const resolved = resolveSlot(dismiss as Slot<'span'>, 'span');\n if (!resolved) return DEFAULT_DISMISS;\n const { Component, props, children } = resolved;\n if (isButtonType(Component)) {\n return { kind: 'button-object', ...splitButtonLike(Component, props, children) };\n }\n const buttonProps: UnknownProps = {};\n const contentProps: UnknownProps = {};\n let hasButtonProps = false;\n for (const [key, value] of Object.entries(props)) {\n // resolveSlot sets `className: undefined` when there are no classes.\n if (value === undefined) continue;\n if (BUTTON_ONLY_KEYS.has(key) || HANDLER_KEY.test(key)) {\n buttonProps[key] = value;\n hasButtonProps = true;\n } else if (NAMING_KEYS.has(key)) {\n // The content is aria-hidden, so a naming attribute names the clear button instead (not the\n // deprecated button-object form).\n buttonProps[key] = value;\n } else {\n contentProps[key] = value;\n }\n }\n // A void (`img`), component (`{ as: MyIcon }`) or markup (`dangerouslySetInnerHTML`) slot\n // renders content of its own.\n const hasChildren = slotRendersContent(children);\n const empty = slotWrapsDefaultContent(Component, { ...contentProps, children });\n if (empty && Object.keys(buttonProps).length === 0 && Object.keys(contentProps).length === 0) {\n return DEFAULT_DISMISS;\n }\n // A button object without content (`{ onClick }`, `{ type: 'button' }`) or a content object\n // without children (`{ className }`) keeps the default icon inside the object's own element (its\n // className/style/attributes still apply). Markup of its own takes no children at all.\n const contentChildren = empty ? (\n <DismissIcon size={SEARCH_SIZE[size].glyph} />\n ) : hasChildren ? (\n children\n ) : undefined;\n // The element the slot renders carries the dismissIcon part class, before the slot's own.\n const iconProps = {\n 'aria-hidden': true,\n ...contentProps,\n className: cn(searchBoxClassNames.dismissIcon, contentProps.className as string | undefined),\n };\n const content =\n contentChildren === undefined\n ? React.createElement(Component, iconProps)\n : React.createElement(Component, iconProps, contentChildren);\n return {\n kind: hasButtonProps ? 'button-object' : 'content',\n buttonProps,\n content,\n contentMayName: false,\n literalTextLabel: false,\n disabledFocusable: false,\n };\n}\n\n/**\n * A search input with a leading search icon and a clear button that appears while there is text\n * (not while `readOnly`).\n *\n * - **Layout**: the root `<div>` draws the field (its outline, focus and invalid look). The icon\n * (or `contentBefore`), the text, `contentAfter` and the clear button sit side by side in it, so\n * no slot covers the text. Pressing the field outside a control of its own focuses the input.\n * - **Clearing**: the clear button clears the text and moves focus back to the input. Escape\n * clears the text too while there is any, and is then consumed, so an enclosing Dialog, Drawer\n * or Popover stays open; in an empty field Escape reaches them. Both call `onClear`.\n * - **Routing**: `id`, ARIA and native input attributes and the focus/keyboard handlers go to the\n * `<input type=\"search\">` (role `searchbox`); `className`, `style`, `data-*`, other handlers and\n * `ref` stay on the root `<div>` (`controlRef` reaches the input). Inside a `Field` it picks up\n * the label, hint, error and required state automatically.\n * - **Forms**: with `name` the text is submitted with the form; a form reset restores\n * `defaultValue`.\n * - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s\n * `size`, then `WaveProvider inputDefaults.size`, else `'medium'`; `appearance` from its own\n * prop, then `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as\n * `data-size` and `data-appearance` on the root `<div>`.\n *\n * @example\n * <SearchBox aria-label=\"Search files\" value={query} onValueChange={setQuery} />\n */\nexport const SearchBox = ({\n value: controlledValue,\n defaultValue = '',\n onValueChange,\n onChange,\n onClear,\n placeholder = 'Search',\n disabled,\n size: sizeProp,\n appearance: appearanceProp,\n contentBefore,\n contentAfter,\n dismiss,\n className,\n ref,\n controlRef,\n // Routed to the input (C-ROUTING)\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-errormessage': ariaErrorMessage,\n 'aria-details': ariaDetails,\n required,\n name,\n form,\n readOnly,\n autoComplete,\n autoFocus,\n autoCapitalize,\n autoCorrect,\n inputMode,\n enterKeyHint,\n spellCheck,\n maxLength,\n minLength,\n pattern,\n tabIndex,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n hidden,\n ...rest\n}: SearchBoxProps) => {\n if (onChange !== undefined) warnDeprecated('SearchBox', 'onChange', 'onValueChange');\n\n const [value, setValue] = useControllable(controlledValue, defaultValue, (next: string) => {\n onValueChange?.(next);\n onChange?.(next);\n });\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedInputRef = useMergedRefs(inputRef, controlRef);\n // The input is always React-controlled, so the browser's own reset would put the current text\n // back: restore the default here instead (C-FORMS).\n useFormReset(inputRef, () => setValue(defaultValue), form);\n\n const fieldProps = useFieldControl(\n {\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n required,\n },\n { nativeRequired: true },\n );\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n const { size, appearance } = useInputLook(sizeProp, appearanceProp);\n\n const dismissParts = resolveDismiss(dismiss, size);\n const dismissKind = dismissParts.kind;\n React.useEffect(() => {\n if (dismissKind === 'element') {\n warnOnce(\n 'SearchBox:dismiss-button-element',\n 'SearchBox: `dismiss` received a button element; its props were merged into the built-in clear button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<MyIcon />}`.',\n );\n } else if (dismissKind === 'button-object') {\n warnOnce(\n 'SearchBox:dismiss-button-object',\n 'SearchBox: `dismiss` with button props (`as: \"button\"`, `onClick`, `type`, …) is deprecated and will be removed in 1.0; the props were merged into the built-in clear button. Pass icon content instead, e.g. `dismiss={<MyIcon />}`.',\n );\n }\n }, [dismissKind]);\n\n const handleClear = () => {\n setValue('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n // Escape clears the text first, as native search fields do, and is consumed so an enclosing\n // Dialog, Drawer or Popover stays open; with an empty field it reaches them (C-POPUPS).\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Escape' || event.nativeEvent.isComposing) return;\n if (!value || readOnly || disabled) return;\n event.preventDefault();\n setValue('');\n onClear?.();\n };\n\n // The whole box is the field: pressing the icon, a slot or the padding around the text focuses\n // the input, as it does in a native search field. A control inside a slot keeps its press.\n const handleRootMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current;\n const root = event.currentTarget;\n const target = event.target;\n if (!input || disabled || event.button !== 0 || target === input) return;\n // Events that bubble through React portals from outside this box are not ours (C-COMPOSE).\n if (!(target instanceof Element) || !root.contains(target)) return;\n const control = target.closest(INTERACTIVE_CONTENT);\n if (control && root.contains(control)) return;\n event.preventDefault(); // keeps the press from moving focus to the page\n input.focus();\n };\n\n // The slot's onClick is composed at click time (it runs first; preventDefault() cancels the\n // clear), so handleClear, which reads the input ref, is never passed to a render-time helper.\n // The slot's ref joins ours through a stable merged ref (never a new callback per render).\n const {\n onClick: slotOnClick,\n ref: slotRef,\n ...slotButtonProps\n } = dismissParts.buttonProps as UnknownProps & {\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n ref?: React.Ref<HTMLButtonElement>;\n };\n\n // C-SLOTS naming (WCAG 2.5.3 Label in Name): a consumer naming attribute names the clear button;\n // otherwise content rendered as is names it when it has a text label, and the default\n // `aria-label` would hide that label. The literal children decide on the server and on the first\n // render; after mount, the rendered button's text does (text from components, later changes).\n const hasOwnName = Object.keys(slotButtonProps).some(\n (key) => NAMING_KEYS.has(key) && slotButtonProps[key] != null,\n );\n const checksContent = dismissParts.contentMayName && !hasOwnName;\n const literalTextLabel = dismissParts.literalTextLabel;\n const [labelTarget, setLabelTarget] = React.useState<HTMLButtonElement | null>(null);\n const subscribeToContent = React.useCallback(\n (onChange: () => void) => (labelTarget ? observeTextLabel(labelTarget, onChange) : noop),\n [labelTarget],\n );\n const contentHasTextLabel = React.useSyncExternalStore(\n subscribeToContent,\n () => (labelTarget ? hasRenderedTextLabel(labelTarget) : literalTextLabel),\n () => literalTextLabel,\n );\n const namedByContent = checksContent && contentHasTextLabel;\n const clearRef = useMergedRefs<HTMLButtonElement>(\n slotRef,\n checksContent ? setLabelTarget : undefined,\n );\n\n const clearButtonProps = mergeProps(\n {\n type: 'button',\n disabled,\n 'aria-label': hasOwnName || namedByContent ? undefined : DEFAULT_CLEAR_LABEL,\n className: cn(\n searchBoxClassNames.dismissButton,\n // Padding and background set here (C-NATIVE): an app-wide `button` rule cannot fill it.\n 'me-1 flex shrink-0 items-center justify-center rounded bg-transparent p-0 text-muted-foreground',\n SEARCH_SIZE[size].clear,\n // hitAreaLayer needs a positioned element: unlike the picker buttons, the small clear\n // button sits in the row without its own position, so it sets one here.\n size === 'small' && cn('relative', hitAreaLayer),\n 'not-disabled:not-aria-disabled:hover:text-foreground',\n focusRing,\n 'disabled:cursor-not-allowed',\n mergedAriaDisabledClasses,\n ),\n },\n slotButtonProps,\n ) as React.ComponentPropsWithoutRef<'button'>;\n\n // A merged button with markup of its own (`dangerouslySetInnerHTML`) takes no children.\n const clearContent =\n clearButtonProps.dangerouslySetInnerHTML != null\n ? undefined\n : dismissKind === 'content'\n ? dismissParts.content\n : (dismissParts.content ?? (\n <DismissIcon\n size={SEARCH_SIZE[size].glyph}\n className={searchBoxClassNames.dismissIcon}\n />\n ));\n // A slot value that renders nothing is no slot (the default icon before the text, no box after).\n const hasBefore = slotRendersContent(contentBefore);\n const hasAfter = slotRendersContent(contentAfter);\n\n return (\n <div\n ref={ref}\n data-size={size}\n data-appearance={appearance}\n className={cn(\n searchBoxClassNames.root,\n // The root draws the field; the slots, the text and the clear button are laid out side by\n // side inside it, so a slot never covers the text.\n 'relative inline-flex w-full items-center',\n inputHeightClasses[size],\n inputTextClasses[size],\n inputAppearanceClasses[appearance],\n 'text-foreground',\n inputFocusWithin,\n invalidLook && inputInvalidWithin,\n // The dimmed look lifts while a focus ring shows inside the root (a clear button kept\n // focusable by a merged `disabledFocusable` Button, focusable slot content; the disabled\n // input never takes focus): opacity would dim the ring below 3:1.\n disabled && 'cursor-not-allowed opacity-50 has-focus-visible:opacity-100',\n className,\n )}\n hidden={hidden}\n {...rest}\n // Composed at press time, like the clear button's click: the handler reads the input ref.\n onMouseDown={(event) => composeEventHandlers(onMouseDown, handleRootMouseDown)(event)}\n >\n <span\n className={cn(\n searchBoxClassNames.contentBefore,\n 'flex shrink-0 items-center',\n SEARCH_SIZE[size].before,\n )}\n >\n {hasBefore ? (\n renderSlot(contentBefore, 'span', 'shrink-0')\n ) : (\n <SearchIcon size={SEARCH_SIZE[size].glyph} className=\"text-muted-foreground\" />\n )}\n </span>\n\n <input\n ref={mergedInputRef}\n type=\"search\"\n value={value}\n onChange={(event) => setValue(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n className={cn(\n searchBoxClassNames.input,\n 'h-full min-w-0 flex-1 appearance-none border-none bg-transparent text-foreground',\n SEARCH_SIZE[size].input,\n inputTextClasses[size],\n 'placeholder:text-muted-foreground',\n 'focus:outline-hidden',\n 'disabled:cursor-not-allowed',\n '[&::-webkit-search-cancel-button]:hidden',\n )}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n name={name}\n form={form}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n inputMode={inputMode}\n enterKeyHint={enterKeyHint}\n spellCheck={spellCheck}\n maxLength={maxLength}\n minLength={minLength}\n pattern={pattern}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyUp={onKeyUp}\n {...fieldProps}\n />\n\n {hasAfter && (\n <span\n className={cn(\n searchBoxClassNames.contentAfter,\n 'flex shrink-0 items-center',\n SEARCH_SIZE[size].after,\n )}\n >\n {renderSlot(contentAfter, 'span', 'shrink-0')}\n </span>\n )}\n\n {/* No clear button while read-only: clearing would change a value the user cannot edit. */}\n {value && !readOnly ? (\n <button\n {...clearButtonProps}\n ref={clearRef}\n // mergeProps keeps a slot's `type: null`, which would drop the attribute and make the\n // button submit its form; only nullish falls back (an explicit type is kept).\n type={clearButtonProps.type ?? 'button'}\n disabled={disabled || clearButtonProps.disabled}\n onClick={(event) => composeEventHandlers(slotOnClick, handleClear)(event)}\n // A merged `disabledFocusable` Button makes the clear button unavailable but focusable\n // (spread last: it wins over `disabled` and the clear handler).\n {...(dismissParts.disabledFocusable ? MERGED_DISABLED_FOCUSABLE_PROPS : undefined)}\n >\n {clearContent}\n </button>\n ) : null}\n </div>\n );\n};\n\nSearchBox.displayName = 'SearchBox';\n"],"mappings":"syBAqKA,IAAMqD,EA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ACD,GAET,EAEA,EAAU,YAAc"}
@@ -4,21 +4,45 @@ import { getElementType as t, isElementOfType as n } from "../../lib/children.mj
4
4
  import { warnDeprecated as r, warnOnce as i } from "../../lib/dev.mjs";
5
5
  import { materialiseSlotContent as a, renderSlot as o, resolveSlot as s, slotRendersContent as c, slotWrapsDefaultContent as l } from "../../lib/slot.mjs";
6
6
  import { composeEventHandlers as u } from "../../lib/composeEventHandlers.mjs";
7
- import { useControllable as d } from "../../hooks/useControllable.mjs";
8
- import { useMergedRefs as f } from "../../hooks/useMergedRefs.mjs";
9
- import { useFieldControl as p } from "../../hooks/useFieldControl.mjs";
10
- import { focusRing as m, inputFocusWithin as h } from "../../lib/styles.mjs";
11
- import { Button as g } from "../button/Button.mjs";
12
- import { DismissIcon as _, SearchIcon as v } from "../../lib/icons.mjs";
13
- import { mergeProps as y } from "../../lib/mergeProps.mjs";
14
- import { BUTTON_OWN_PROP_KEYS as b, MERGED_DISABLED_FOCUSABLE_PROPS as ee, mergedAriaDisabledClasses as te, placeButtonIcon as x } from "../button/Button.slots.mjs";
15
- import { isInvalidLook as ne } from "./Input.mjs";
16
- import { useFormReset as re } from "../../hooks/useFormReset.mjs";
17
- import { hasRenderedTextLabel as ie, hasTextLabel as S, observeTextLabel as ae } from "../../lib/labelInName.mjs";
18
- import * as C from "react";
19
- import { jsx as w, jsxs as oe } from "react/jsx-runtime";
7
+ import { searchBoxClassNames as d } from "../../lib/classNames.mjs";
8
+ import { useControllable as f } from "../../hooks/useControllable.mjs";
9
+ import { useMergedRefs as p } from "../../hooks/useMergedRefs.mjs";
10
+ import { useFieldControl as m } from "../../hooks/useFieldControl.mjs";
11
+ import { focusRing as h, inputAppearanceClasses as g, inputFocusWithin as _, inputHeightClasses as v, inputTextClasses as y } from "../../lib/styles.mjs";
12
+ import { Button as b } from "../button/Button.mjs";
13
+ import { BUTTON_OWN_PROP_KEYS as x, MERGED_DISABLED_FOCUSABLE_PROPS as S, mergedAriaDisabledClasses as ee, placeButtonIcon as C } from "../button/Button.slots.mjs";
14
+ import { DismissIcon as w, SearchIcon as te } from "../../lib/icons.mjs";
15
+ import { mergeProps as ne } from "../../lib/mergeProps.mjs";
16
+ import { useInputLook as re } from "./inputLook.mjs";
17
+ import { isInvalidLook as ie } from "./Input.mjs";
18
+ import { useFormReset as ae } from "../../hooks/useFormReset.mjs";
19
+ import { hasRenderedTextLabel as oe, hasTextLabel as T, observeTextLabel as se } from "../../lib/labelInName.mjs";
20
+ import * as E from "react";
21
+ import { jsx as D, jsxs as ce } from "react/jsx-runtime";
20
22
  //#region src/components/input/SearchBox.tsx
21
- var T = /* @__PURE__ */ new Set([
23
+ var O = {
24
+ small: {
25
+ before: "ps-1.5",
26
+ after: "pe-1.5",
27
+ input: "px-1.5",
28
+ clear: "size-5",
29
+ glyph: 12
30
+ },
31
+ medium: {
32
+ before: "ps-2",
33
+ after: "pe-2",
34
+ input: "px-2",
35
+ clear: "h-6 w-6",
36
+ glyph: 16
37
+ },
38
+ large: {
39
+ before: "ps-3",
40
+ after: "pe-3",
41
+ input: "px-3",
42
+ clear: "size-8",
43
+ glyph: 20
44
+ }
45
+ }, k = /* @__PURE__ */ new Set([
22
46
  "type",
23
47
  "disabled",
24
48
  "form",
@@ -31,11 +55,11 @@ var T = /* @__PURE__ */ new Set([
31
55
  "value",
32
56
  "popoverTarget",
33
57
  "popoverTargetAction"
34
- ]), E = /^on[A-Z]/, D = /* @__PURE__ */ new Set([
58
+ ]), A = /^on[A-Z]/, j = /* @__PURE__ */ new Set([
35
59
  "aria-label",
36
60
  "aria-labelledby",
37
61
  "title"
38
- ]), O = "Clear search", k = () => {}, se = "a[href], button, input, select, textarea, [tabindex], [contenteditable]:not([contenteditable=\"false\"])", A = {
62
+ ]), le = "Clear search", ue = () => {}, de = "a[href], button, input, select, textarea, [tabindex], [contenteditable]:not([contenteditable=\"false\"])", M = {
39
63
  kind: "default",
40
64
  buttonProps: {},
41
65
  content: null,
@@ -43,163 +67,169 @@ var T = /* @__PURE__ */ new Set([
43
67
  literalTextLabel: !1,
44
68
  disabledFocusable: !1
45
69
  };
46
- function j(e) {
47
- return e === "button" || e === g;
70
+ function N(e) {
71
+ return e === "button" || e === b;
48
72
  }
49
- function M(e, t, n) {
50
- let r = c(n), i = a(n), s = S(i);
51
- if (e === g) {
52
- let e = {};
53
- for (let [n, r] of Object.entries(t)) n !== "children" && !b.has(n) && (e[n] = r);
54
- let n = o(t.icon, "span", "inline-flex", { "aria-hidden": !0 });
73
+ function P(t, n, r) {
74
+ let i = c(r), s = a(r), l = T(s);
75
+ if (t === b) {
76
+ let t = {};
77
+ for (let [e, r] of Object.entries(n)) e !== "children" && !x.has(e) && (t[e] = r);
78
+ let r = o(n.icon, "span", e(d.dismissIcon, "inline-flex"), { "aria-hidden": !0 });
55
79
  return {
56
- buttonProps: e,
57
- content: n || r ? x(n, i, t.iconPosition) : null,
80
+ buttonProps: t,
81
+ content: r || i ? C(r, s, n.iconPosition) : null,
58
82
  contentMayName: !0,
59
- literalTextLabel: s,
60
- disabledFocusable: !!t.disabledFocusable
83
+ literalTextLabel: l,
84
+ disabledFocusable: !!n.disabledFocusable
61
85
  };
62
86
  }
63
- let { as: l, children: u, ...d } = t;
87
+ let { as: u, children: f, ...p } = n;
64
88
  return {
65
- buttonProps: d,
66
- content: r ? i : null,
89
+ buttonProps: p,
90
+ content: i ? s : null,
67
91
  contentMayName: !0,
68
- literalTextLabel: s,
92
+ literalTextLabel: l,
69
93
  disabledFocusable: !1
70
94
  };
71
95
  }
72
- function ce(e) {
73
- let r = e;
74
- if (n(r, "button", g)) {
75
- let e = r.props.children;
96
+ function fe(r, i) {
97
+ let a = r;
98
+ if (n(a, "button", b)) {
99
+ let e = a.props.children;
76
100
  return {
77
101
  kind: "element",
78
- ...M(t(r), r.props, e)
102
+ ...P(t(a), a.props, e)
79
103
  };
80
104
  }
81
- let i = s(e, "span");
82
- if (!i) return A;
83
- let { Component: a, props: o, children: u } = i;
84
- if (j(a)) return {
105
+ let o = s(r, "span");
106
+ if (!o) return M;
107
+ let { Component: u, props: f, children: p } = o;
108
+ if (N(u)) return {
85
109
  kind: "button-object",
86
- ...M(a, o, u)
110
+ ...P(u, f, p)
87
111
  };
88
- let d = {}, f = {}, p = !1;
89
- for (let [e, t] of Object.entries(o)) t !== void 0 && (T.has(e) || E.test(e) ? (d[e] = t, p = !0) : D.has(e) ? d[e] = t : f[e] = t);
90
- let m = c(u), h = l(a, {
91
- ...f,
92
- children: u
112
+ let m = {}, h = {}, g = !1;
113
+ for (let [e, t] of Object.entries(f)) t !== void 0 && (k.has(e) || A.test(e) ? (m[e] = t, g = !0) : j.has(e) ? m[e] = t : h[e] = t);
114
+ let _ = c(p), v = l(u, {
115
+ ...h,
116
+ children: p
93
117
  });
94
- if (h && Object.keys(d).length === 0 && Object.keys(f).length === 0) return A;
95
- let v = h ? /* @__PURE__ */ w(_, {}) : m ? u : void 0, y = v === void 0 ? C.createElement(a, {
96
- "aria-hidden": !0,
97
- ...f
98
- }) : C.createElement(a, {
118
+ if (v && Object.keys(m).length === 0 && Object.keys(h).length === 0) return M;
119
+ let y = v ? /* @__PURE__ */ D(w, { size: O[i].glyph }) : _ ? p : void 0, x = {
99
120
  "aria-hidden": !0,
100
- ...f
101
- }, v);
121
+ ...h,
122
+ className: e(d.dismissIcon, h.className)
123
+ }, S = y === void 0 ? E.createElement(u, x) : E.createElement(u, x, y);
102
124
  return {
103
- kind: p ? "button-object" : "content",
104
- buttonProps: d,
105
- content: y,
125
+ kind: g ? "button-object" : "content",
126
+ buttonProps: m,
127
+ content: S,
106
128
  contentMayName: !1,
107
129
  literalTextLabel: !1,
108
130
  disabledFocusable: !1
109
131
  };
110
132
  }
111
- var N = ({ value: t, defaultValue: n = "", onValueChange: a, onChange: s, onClear: l, placeholder: g = "Search", disabled: b, contentBefore: x, contentAfter: S, dismiss: T, className: E, ref: A, controlRef: j, id: M, "aria-label": N, "aria-labelledby": le, "aria-describedby": ue, "aria-invalid": de, "aria-required": fe, "aria-errormessage": pe, "aria-details": P, required: F, name: I, form: L, readOnly: R, autoComplete: z, autoFocus: B, autoCapitalize: me, autoCorrect: he, inputMode: ge, enterKeyHint: _e, spellCheck: ve, maxLength: ye, minLength: be, pattern: xe, tabIndex: Se, onFocus: Ce, onBlur: we, onKeyDown: Te, onKeyUp: Ee, onMouseDown: De, hidden: Oe, ...ke }) => {
133
+ var F = ({ value: t, defaultValue: n = "", onValueChange: a, onChange: s, onClear: l, placeholder: b = "Search", disabled: x, size: C, appearance: T, contentBefore: k, contentAfter: A, dismiss: M, className: N, ref: P, controlRef: F, id: pe, "aria-label": me, "aria-labelledby": he, "aria-describedby": ge, "aria-invalid": _e, "aria-required": I, "aria-errormessage": ve, "aria-details": ye, required: be, name: xe, form: L, readOnly: R, autoComplete: Se, autoFocus: Ce, autoCapitalize: we, autoCorrect: Te, inputMode: Ee, enterKeyHint: De, spellCheck: Oe, maxLength: ke, minLength: Ae, pattern: je, tabIndex: Me, onFocus: Ne, onBlur: Pe, onKeyDown: Fe, onKeyUp: Ie, onMouseDown: z, hidden: Le, ...Re }) => {
112
134
  s !== void 0 && r("SearchBox", "onChange", "onValueChange");
113
- let [V, H] = d(t, n, (e) => {
135
+ let [B, V] = f(t, n, (e) => {
114
136
  a?.(e), s?.(e);
115
- }), U = C.useRef(null), Ae = f(U, j);
116
- re(U, () => H(n), L);
117
- let W = p({
118
- id: M,
119
- "aria-label": N,
120
- "aria-labelledby": le,
121
- "aria-describedby": ue,
122
- "aria-invalid": de,
123
- "aria-required": fe,
124
- required: F
125
- }, { nativeRequired: !0 }), je = ne(!1, W["aria-invalid"]), G = ce(T), K = G.kind;
126
- C.useEffect(() => {
127
- K === "element" ? i("SearchBox:dismiss-button-element", "SearchBox: `dismiss` received a button element; its props were merged into the built-in clear button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<MyIcon />}`.") : K === "button-object" && i("SearchBox:dismiss-button-object", "SearchBox: `dismiss` with button props (`as: \"button\"`, `onClick`, `type`, …) is deprecated and will be removed in 1.0; the props were merged into the built-in clear button. Pass icon content instead, e.g. `dismiss={<MyIcon />}`.");
128
- }, [K]);
129
- let Me = () => {
130
- H(""), l?.(), U.current?.focus();
131
- }, Ne = (e) => {
132
- e.key !== "Escape" || e.nativeEvent.isComposing || !V || R || b || (e.preventDefault(), H(""), l?.());
133
- }, Pe = (e) => {
134
- let t = U.current, n = e.currentTarget, r = e.target;
135
- if (!t || b || e.button !== 0 || r === t || !(r instanceof Element) || !n.contains(r)) return;
136
- let i = r.closest(se);
137
+ }), H = E.useRef(null), ze = p(H, F);
138
+ ae(H, () => V(n), L);
139
+ let U = m({
140
+ id: pe,
141
+ "aria-label": me,
142
+ "aria-labelledby": he,
143
+ "aria-describedby": ge,
144
+ "aria-invalid": _e,
145
+ "aria-required": I,
146
+ required: be
147
+ }, { nativeRequired: !0 }), Be = ie(!1, U["aria-invalid"]), { size: W, appearance: G } = re(C, T), K = fe(M, W), q = K.kind;
148
+ E.useEffect(() => {
149
+ q === "element" ? i("SearchBox:dismiss-button-element", "SearchBox: `dismiss` received a button element; its props were merged into the built-in clear button (buttons cannot be nested). Pass icon content instead, e.g. `dismiss={<MyIcon />}`.") : q === "button-object" && i("SearchBox:dismiss-button-object", "SearchBox: `dismiss` with button props (`as: \"button\"`, `onClick`, `type`, …) is deprecated and will be removed in 1.0; the props were merged into the built-in clear button. Pass icon content instead, e.g. `dismiss={<MyIcon />}`.");
150
+ }, [q]);
151
+ let Ve = () => {
152
+ V(""), l?.(), H.current?.focus();
153
+ }, He = (e) => {
154
+ e.key !== "Escape" || e.nativeEvent.isComposing || !B || R || x || (e.preventDefault(), V(""), l?.());
155
+ }, Ue = (e) => {
156
+ let t = H.current, n = e.currentTarget, r = e.target;
157
+ if (!t || x || e.button !== 0 || r === t || !(r instanceof Element) || !n.contains(r)) return;
158
+ let i = r.closest(de);
137
159
  i && n.contains(i) || (e.preventDefault(), t.focus());
138
- }, { onClick: Fe, ref: Ie, ...q } = G.buttonProps, J = Object.keys(q).some((e) => D.has(e) && q[e] != null), Y = G.contentMayName && !J, X = G.literalTextLabel, [Z, Le] = C.useState(null), Re = C.useCallback((e) => Z ? ae(Z, e) : k, [Z]), ze = C.useSyncExternalStore(Re, () => Z ? ie(Z) : X, () => X), Be = Y && ze, Q = f(Ie, Y ? Le : void 0), $ = y({
160
+ }, { onClick: We, ref: Ge, ...J } = K.buttonProps, Y = Object.keys(J).some((e) => j.has(e) && J[e] != null), X = K.contentMayName && !Y, Z = K.literalTextLabel, [Q, Ke] = E.useState(null), qe = E.useCallback((e) => Q ? se(Q, e) : ue, [Q]), Je = E.useSyncExternalStore(qe, () => Q ? oe(Q) : Z, () => Z), Ye = X && Je, Xe = p(Ge, X ? Ke : void 0), $ = ne({
139
161
  type: "button",
140
- disabled: b,
141
- "aria-label": J || Be ? void 0 : O,
142
- className: e("me-1 flex h-6 w-6 shrink-0 items-center justify-center rounded bg-transparent p-0 text-muted-foreground", "not-disabled:not-aria-disabled:hover:text-foreground", m, "disabled:cursor-not-allowed", te)
143
- }, q), Ve = $.dangerouslySetInnerHTML == null ? K === "content" ? G.content : G.content ?? /* @__PURE__ */ w(_, {}) : void 0, He = c(x), Ue = c(S);
144
- return /* @__PURE__ */ oe("div", {
145
- ref: A,
146
- className: e("relative inline-flex h-8 w-full items-center rounded border border-input border-b-stroke-accessible bg-background text-body-1 text-foreground", h, je && "border-destructive focus-within:border-b-destructive", b && "cursor-not-allowed opacity-50 has-focus-visible:opacity-100", E),
147
- hidden: Oe,
148
- ...ke,
149
- onMouseDown: (e) => u(De, Pe)(e),
162
+ disabled: x,
163
+ "aria-label": Y || Ye ? void 0 : le,
164
+ className: e(d.dismissButton, "me-1 flex shrink-0 items-center justify-center rounded bg-transparent p-0 text-muted-foreground", O[W].clear, W === "small" && e("relative", "before:absolute before:-inset-0.5"), "not-disabled:not-aria-disabled:hover:text-foreground", h, "disabled:cursor-not-allowed", ee)
165
+ }, J), Ze = $.dangerouslySetInnerHTML == null ? q === "content" ? K.content : K.content ?? /* @__PURE__ */ D(w, {
166
+ size: O[W].glyph,
167
+ className: d.dismissIcon
168
+ }) : void 0, Qe = c(k), $e = c(A);
169
+ return /* @__PURE__ */ ce("div", {
170
+ ref: P,
171
+ "data-size": W,
172
+ "data-appearance": G,
173
+ className: e(d.root, "relative inline-flex w-full items-center", v[W], y[W], g[G], "text-foreground", _, Be && "border-destructive", x && "cursor-not-allowed opacity-50 has-focus-visible:opacity-100", N),
174
+ hidden: Le,
175
+ ...Re,
176
+ onMouseDown: (e) => u(z, Ue)(e),
150
177
  children: [
151
- /* @__PURE__ */ w("span", {
152
- className: "flex shrink-0 items-center ps-2",
153
- children: He ? o(x, "span", "shrink-0") : /* @__PURE__ */ w(v, { className: "text-muted-foreground" })
178
+ /* @__PURE__ */ D("span", {
179
+ className: e(d.contentBefore, "flex shrink-0 items-center", O[W].before),
180
+ children: Qe ? o(k, "span", "shrink-0") : /* @__PURE__ */ D(te, {
181
+ size: O[W].glyph,
182
+ className: "text-muted-foreground"
183
+ })
154
184
  }),
155
- /* @__PURE__ */ w("input", {
156
- ref: Ae,
185
+ /* @__PURE__ */ D("input", {
186
+ ref: ze,
157
187
  type: "search",
158
- value: V,
159
- onChange: (e) => H(e.target.value),
160
- placeholder: g,
161
- disabled: b,
162
- className: e("h-full min-w-0 flex-1 appearance-none border-none bg-transparent px-2 text-body-1 text-foreground", "placeholder:text-muted-foreground", "focus:outline-hidden", "disabled:cursor-not-allowed", "[&::-webkit-search-cancel-button]:hidden"),
163
- "aria-errormessage": pe,
164
- "aria-details": P,
165
- name: I,
188
+ value: B,
189
+ onChange: (e) => V(e.target.value),
190
+ placeholder: b,
191
+ disabled: x,
192
+ className: e(d.input, "h-full min-w-0 flex-1 appearance-none border-none bg-transparent text-foreground", O[W].input, y[W], "placeholder:text-muted-foreground", "focus:outline-hidden", "disabled:cursor-not-allowed", "[&::-webkit-search-cancel-button]:hidden"),
193
+ "aria-errormessage": ve,
194
+ "aria-details": ye,
195
+ name: xe,
166
196
  form: L,
167
197
  readOnly: R,
168
- autoComplete: z,
169
- autoFocus: B,
170
- autoCapitalize: me,
171
- autoCorrect: he,
172
- inputMode: ge,
173
- enterKeyHint: _e,
174
- spellCheck: ve,
175
- maxLength: ye,
176
- minLength: be,
177
- pattern: xe,
178
- tabIndex: Se,
179
- onFocus: Ce,
180
- onBlur: we,
181
- onKeyDown: u(Te, Ne),
182
- onKeyUp: Ee,
183
- ...W
198
+ autoComplete: Se,
199
+ autoFocus: Ce,
200
+ autoCapitalize: we,
201
+ autoCorrect: Te,
202
+ inputMode: Ee,
203
+ enterKeyHint: De,
204
+ spellCheck: Oe,
205
+ maxLength: ke,
206
+ minLength: Ae,
207
+ pattern: je,
208
+ tabIndex: Me,
209
+ onFocus: Ne,
210
+ onBlur: Pe,
211
+ onKeyDown: u(Fe, He),
212
+ onKeyUp: Ie,
213
+ ...U
184
214
  }),
185
- Ue && /* @__PURE__ */ w("span", {
186
- className: "flex shrink-0 items-center pe-2",
187
- children: o(S, "span", "shrink-0")
215
+ $e && /* @__PURE__ */ D("span", {
216
+ className: e(d.contentAfter, "flex shrink-0 items-center", O[W].after),
217
+ children: o(A, "span", "shrink-0")
188
218
  }),
189
- V && !R ? /* @__PURE__ */ w("button", {
219
+ B && !R ? /* @__PURE__ */ D("button", {
190
220
  ...$,
191
- ref: Q,
221
+ ref: Xe,
192
222
  type: $.type ?? "button",
193
- disabled: b || $.disabled,
194
- onClick: (e) => u(Fe, Me)(e),
195
- ...G.disabledFocusable ? ee : void 0,
196
- children: Ve
223
+ disabled: x || $.disabled,
224
+ onClick: (e) => u(We, Ve)(e),
225
+ ...K.disabledFocusable ? S : void 0,
226
+ children: Ze
197
227
  }) : null
198
228
  ]
199
229
  });
200
230
  };
201
- N.displayName = "SearchBox";
231
+ F.displayName = "SearchBox";
202
232
  //#endregion
203
- export { N as SearchBox };
233
+ export { F as SearchBox };
204
234
 
205
235
  //# sourceMappingURL=SearchBox.mjs.map