@mortenbrudvik/waveui 0.7.0 → 0.8.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 (408) hide show
  1. package/README.md +395 -132
  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/InfoLabel.cjs +1 -1
  63. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  64. package/dist/components/data-display/InfoLabel.mjs +74 -73
  65. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  66. package/dist/components/data-display/List.cjs +1 -1
  67. package/dist/components/data-display/List.cjs.map +1 -1
  68. package/dist/components/data-display/List.mjs +175 -174
  69. package/dist/components/data-display/List.mjs.map +1 -1
  70. package/dist/components/data-display/Persona.cjs +1 -1
  71. package/dist/components/data-display/Persona.cjs.map +1 -1
  72. package/dist/components/data-display/Persona.mjs +31 -29
  73. package/dist/components/data-display/Persona.mjs.map +1 -1
  74. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  75. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  76. package/dist/components/data-display/PresenceBadge.mjs +25 -24
  77. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  78. package/dist/components/data-display/Tag.cjs +1 -1
  79. package/dist/components/data-display/Tag.cjs.map +1 -1
  80. package/dist/components/data-display/Tag.mjs +87 -82
  81. package/dist/components/data-display/Tag.mjs.map +1 -1
  82. package/dist/components/feedback/MessageBar.cjs +1 -1
  83. package/dist/components/feedback/MessageBar.cjs.map +1 -1
  84. package/dist/components/feedback/MessageBar.mjs +129 -71
  85. package/dist/components/feedback/MessageBar.mjs.map +1 -1
  86. package/dist/components/feedback/MessageBar.parts.cjs +2 -0
  87. package/dist/components/feedback/MessageBar.parts.cjs.map +1 -0
  88. package/dist/components/feedback/MessageBar.parts.mjs +84 -0
  89. package/dist/components/feedback/MessageBar.parts.mjs.map +1 -0
  90. package/dist/components/feedback/MessageBar.reflow.cjs +2 -0
  91. package/dist/components/feedback/MessageBar.reflow.cjs.map +1 -0
  92. package/dist/components/feedback/MessageBar.reflow.mjs +74 -0
  93. package/dist/components/feedback/MessageBar.reflow.mjs.map +1 -0
  94. package/dist/components/feedback/MessageBar.status.cjs +1 -1
  95. package/dist/components/feedback/MessageBar.status.cjs.map +1 -1
  96. package/dist/components/feedback/MessageBar.status.mjs +2 -1
  97. package/dist/components/feedback/MessageBar.status.mjs.map +1 -1
  98. package/dist/components/feedback/ProgressBar.cjs +1 -1
  99. package/dist/components/feedback/ProgressBar.cjs.map +1 -1
  100. package/dist/components/feedback/ProgressBar.mjs +44 -43
  101. package/dist/components/feedback/ProgressBar.mjs.map +1 -1
  102. package/dist/components/feedback/Skeleton.cjs +1 -1
  103. package/dist/components/feedback/Skeleton.cjs.map +1 -1
  104. package/dist/components/feedback/Skeleton.mjs +26 -24
  105. package/dist/components/feedback/Skeleton.mjs.map +1 -1
  106. package/dist/components/feedback/Spinner.cjs +1 -1
  107. package/dist/components/feedback/Spinner.cjs.map +1 -1
  108. package/dist/components/feedback/Spinner.mjs +32 -31
  109. package/dist/components/feedback/Spinner.mjs.map +1 -1
  110. package/dist/components/feedback/Toast.cjs +1 -1
  111. package/dist/components/feedback/Toast.cjs.map +1 -1
  112. package/dist/components/feedback/Toast.context.cjs +2 -0
  113. package/dist/components/feedback/Toast.context.cjs.map +1 -0
  114. package/dist/components/feedback/Toast.context.mjs +23 -0
  115. package/dist/components/feedback/Toast.context.mjs.map +1 -0
  116. package/dist/components/feedback/Toast.mjs +10 -342
  117. package/dist/components/feedback/Toast.mjs.map +1 -1
  118. package/dist/components/feedback/Toast.parts.cjs +2 -0
  119. package/dist/components/feedback/Toast.parts.cjs.map +1 -0
  120. package/dist/components/feedback/Toast.parts.mjs +98 -0
  121. package/dist/components/feedback/Toast.parts.mjs.map +1 -0
  122. package/dist/components/feedback/Toast.root.cjs +2 -0
  123. package/dist/components/feedback/Toast.root.cjs.map +1 -0
  124. package/dist/components/feedback/Toast.root.mjs +109 -0
  125. package/dist/components/feedback/Toast.root.mjs.map +1 -0
  126. package/dist/components/feedback/Toaster.cjs +2 -0
  127. package/dist/components/feedback/Toaster.cjs.map +1 -0
  128. package/dist/components/feedback/Toaster.mjs +564 -0
  129. package/dist/components/feedback/Toaster.mjs.map +1 -0
  130. package/dist/components/input/AlphaSlider.cjs +2 -0
  131. package/dist/components/input/AlphaSlider.cjs.map +1 -0
  132. package/dist/components/input/AlphaSlider.mjs +115 -0
  133. package/dist/components/input/AlphaSlider.mjs.map +1 -0
  134. package/dist/components/input/Checkbox.cjs +1 -1
  135. package/dist/components/input/Checkbox.cjs.map +1 -1
  136. package/dist/components/input/Checkbox.mjs +47 -46
  137. package/dist/components/input/Checkbox.mjs.map +1 -1
  138. package/dist/components/input/ColorArea.cjs +2 -0
  139. package/dist/components/input/ColorArea.cjs.map +1 -0
  140. package/dist/components/input/ColorArea.mjs +204 -0
  141. package/dist/components/input/ColorArea.mjs.map +1 -0
  142. package/dist/components/input/ColorPicker.cjs +5 -5
  143. package/dist/components/input/ColorPicker.cjs.map +1 -1
  144. package/dist/components/input/ColorPicker.mjs +142 -165
  145. package/dist/components/input/ColorPicker.mjs.map +1 -1
  146. package/dist/components/input/ColorPicker.parts.cjs +2 -0
  147. package/dist/components/input/ColorPicker.parts.cjs.map +1 -0
  148. package/dist/components/input/ColorPicker.parts.mjs +192 -0
  149. package/dist/components/input/ColorPicker.parts.mjs.map +1 -0
  150. package/dist/components/input/ColorSlider.cjs +2 -0
  151. package/dist/components/input/ColorSlider.cjs.map +1 -0
  152. package/dist/components/input/ColorSlider.mjs +138 -0
  153. package/dist/components/input/ColorSlider.mjs.map +1 -0
  154. package/dist/components/input/Combobox.cjs +1 -1
  155. package/dist/components/input/Combobox.cjs.map +1 -1
  156. package/dist/components/input/Combobox.expand.cjs +1 -1
  157. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  158. package/dist/components/input/Combobox.expand.mjs +9 -9
  159. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  160. package/dist/components/input/Combobox.mjs +90 -85
  161. package/dist/components/input/Combobox.mjs.map +1 -1
  162. package/dist/components/input/DatePicker.cjs +1 -1
  163. package/dist/components/input/DatePicker.cjs.map +1 -1
  164. package/dist/components/input/DatePicker.mjs +186 -185
  165. package/dist/components/input/DatePicker.mjs.map +1 -1
  166. package/dist/components/input/Dropdown.cjs +1 -1
  167. package/dist/components/input/Dropdown.cjs.map +1 -1
  168. package/dist/components/input/Dropdown.mjs +71 -68
  169. package/dist/components/input/Dropdown.mjs.map +1 -1
  170. package/dist/components/input/Field.cjs +1 -1
  171. package/dist/components/input/Field.cjs.map +1 -1
  172. package/dist/components/input/Field.mjs +113 -112
  173. package/dist/components/input/Field.mjs.map +1 -1
  174. package/dist/components/input/Input.cjs +1 -1
  175. package/dist/components/input/Input.cjs.map +1 -1
  176. package/dist/components/input/Input.mjs +55 -54
  177. package/dist/components/input/Input.mjs.map +1 -1
  178. package/dist/components/input/Label.cjs +1 -1
  179. package/dist/components/input/Label.cjs.map +1 -1
  180. package/dist/components/input/Label.mjs +12 -11
  181. package/dist/components/input/Label.mjs.map +1 -1
  182. package/dist/components/input/Option.cjs +1 -1
  183. package/dist/components/input/Option.cjs.map +1 -1
  184. package/dist/components/input/Option.mjs +100 -98
  185. package/dist/components/input/Option.mjs.map +1 -1
  186. package/dist/components/input/RadioGroup.cjs +1 -1
  187. package/dist/components/input/RadioGroup.cjs.map +1 -1
  188. package/dist/components/input/RadioGroup.mjs +89 -88
  189. package/dist/components/input/RadioGroup.mjs.map +1 -1
  190. package/dist/components/input/Rating.cjs +1 -1
  191. package/dist/components/input/Rating.cjs.map +1 -1
  192. package/dist/components/input/Rating.mjs +110 -109
  193. package/dist/components/input/Rating.mjs.map +1 -1
  194. package/dist/components/input/SearchBox.cjs +1 -1
  195. package/dist/components/input/SearchBox.cjs.map +1 -1
  196. package/dist/components/input/SearchBox.mjs +118 -119
  197. package/dist/components/input/SearchBox.mjs.map +1 -1
  198. package/dist/components/input/Select.cjs +1 -1
  199. package/dist/components/input/Select.cjs.map +1 -1
  200. package/dist/components/input/Select.mjs +25 -24
  201. package/dist/components/input/Select.mjs.map +1 -1
  202. package/dist/components/input/Slider.cjs +1 -1
  203. package/dist/components/input/Slider.cjs.map +1 -1
  204. package/dist/components/input/Slider.mjs +47 -46
  205. package/dist/components/input/Slider.mjs.map +1 -1
  206. package/dist/components/input/SpinButton.cjs +1 -1
  207. package/dist/components/input/SpinButton.cjs.map +1 -1
  208. package/dist/components/input/SpinButton.mjs +76 -75
  209. package/dist/components/input/SpinButton.mjs.map +1 -1
  210. package/dist/components/input/SwatchPicker.cjs +1 -1
  211. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  212. package/dist/components/input/SwatchPicker.mjs +38 -37
  213. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  214. package/dist/components/input/Switch.cjs +1 -1
  215. package/dist/components/input/Switch.cjs.map +1 -1
  216. package/dist/components/input/Switch.mjs +65 -64
  217. package/dist/components/input/Switch.mjs.map +1 -1
  218. package/dist/components/input/TagPicker.cjs +1 -1
  219. package/dist/components/input/TagPicker.cjs.map +1 -1
  220. package/dist/components/input/TagPicker.mjs +161 -157
  221. package/dist/components/input/TagPicker.mjs.map +1 -1
  222. package/dist/components/input/Textarea.cjs +1 -1
  223. package/dist/components/input/Textarea.cjs.map +1 -1
  224. package/dist/components/input/Textarea.mjs +24 -23
  225. package/dist/components/input/Textarea.mjs.map +1 -1
  226. package/dist/components/input/TimePicker.cjs +1 -1
  227. package/dist/components/input/TimePicker.cjs.map +1 -1
  228. package/dist/components/input/TimePicker.mjs +202 -199
  229. package/dist/components/input/TimePicker.mjs.map +1 -1
  230. package/dist/components/input/colorName.cjs +2 -0
  231. package/dist/components/input/colorName.cjs.map +1 -0
  232. package/dist/components/input/colorName.mjs +30 -0
  233. package/dist/components/input/colorName.mjs.map +1 -0
  234. package/dist/components/input/colorUtils.cjs +1 -1
  235. package/dist/components/input/colorUtils.cjs.map +1 -1
  236. package/dist/components/input/colorUtils.mjs +154 -56
  237. package/dist/components/input/colorUtils.mjs.map +1 -1
  238. package/dist/components/layout/Accordion.cjs +1 -1
  239. package/dist/components/layout/Accordion.cjs.map +1 -1
  240. package/dist/components/layout/Accordion.mjs +130 -129
  241. package/dist/components/layout/Accordion.mjs.map +1 -1
  242. package/dist/components/layout/Card.cjs +1 -1
  243. package/dist/components/layout/Card.cjs.map +1 -1
  244. package/dist/components/layout/Card.mjs +78 -77
  245. package/dist/components/layout/Card.mjs.map +1 -1
  246. package/dist/components/layout/Carousel.cjs +1 -1
  247. package/dist/components/layout/Carousel.cjs.map +1 -1
  248. package/dist/components/layout/Carousel.mjs +111 -110
  249. package/dist/components/layout/Carousel.mjs.map +1 -1
  250. package/dist/components/layout/Flex.cjs +1 -1
  251. package/dist/components/layout/Flex.cjs.map +1 -1
  252. package/dist/components/layout/Flex.mjs +22 -21
  253. package/dist/components/layout/Flex.mjs.map +1 -1
  254. package/dist/components/layout/Grid.cjs +1 -1
  255. package/dist/components/layout/Grid.cjs.map +1 -1
  256. package/dist/components/layout/Grid.mjs +19 -18
  257. package/dist/components/layout/Grid.mjs.map +1 -1
  258. package/dist/components/layout/Overflow.cjs +1 -1
  259. package/dist/components/layout/Overflow.cjs.map +1 -1
  260. package/dist/components/layout/Overflow.mjs +92 -91
  261. package/dist/components/layout/Overflow.mjs.map +1 -1
  262. package/dist/components/layout/Stack.cjs +1 -1
  263. package/dist/components/layout/Stack.cjs.map +1 -1
  264. package/dist/components/layout/Stack.mjs +14 -13
  265. package/dist/components/layout/Stack.mjs.map +1 -1
  266. package/dist/components/layout/TabList.cjs +1 -1
  267. package/dist/components/layout/TabList.cjs.map +1 -1
  268. package/dist/components/layout/TabList.mjs +118 -117
  269. package/dist/components/layout/TabList.mjs.map +1 -1
  270. package/dist/components/layout/Tree.cjs +1 -1
  271. package/dist/components/layout/Tree.cjs.map +1 -1
  272. package/dist/components/layout/Tree.context.cjs +2 -0
  273. package/dist/components/layout/Tree.context.cjs.map +1 -0
  274. package/dist/components/layout/Tree.context.mjs +33 -0
  275. package/dist/components/layout/Tree.context.mjs.map +1 -0
  276. package/dist/components/layout/Tree.core.cjs +2 -0
  277. package/dist/components/layout/Tree.core.cjs.map +1 -0
  278. package/dist/components/layout/Tree.core.mjs +416 -0
  279. package/dist/components/layout/Tree.core.mjs.map +1 -0
  280. package/dist/components/layout/Tree.itemPersonaLayout.cjs +2 -0
  281. package/dist/components/layout/Tree.itemPersonaLayout.cjs.map +1 -0
  282. package/dist/components/layout/Tree.itemPersonaLayout.mjs +46 -0
  283. package/dist/components/layout/Tree.itemPersonaLayout.mjs.map +1 -0
  284. package/dist/components/layout/Tree.mjs +7 -215
  285. package/dist/components/layout/Tree.mjs.map +1 -1
  286. package/dist/components/layout/Tree.selection.cjs +2 -0
  287. package/dist/components/layout/Tree.selection.cjs.map +1 -0
  288. package/dist/components/layout/Tree.selection.mjs +73 -0
  289. package/dist/components/layout/Tree.selection.mjs.map +1 -0
  290. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  291. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  292. package/dist/components/navigation/Breadcrumb.mjs +76 -75
  293. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  294. package/dist/components/navigation/Menu.group.cjs +1 -1
  295. package/dist/components/navigation/Menu.group.cjs.map +1 -1
  296. package/dist/components/navigation/Menu.group.mjs +39 -37
  297. package/dist/components/navigation/Menu.group.mjs.map +1 -1
  298. package/dist/components/navigation/Menu.items.cjs +1 -1
  299. package/dist/components/navigation/Menu.items.cjs.map +1 -1
  300. package/dist/components/navigation/Menu.items.mjs +67 -61
  301. package/dist/components/navigation/Menu.items.mjs.map +1 -1
  302. package/dist/components/navigation/Menu.link.cjs +1 -1
  303. package/dist/components/navigation/Menu.link.cjs.map +1 -1
  304. package/dist/components/navigation/Menu.link.mjs +34 -28
  305. package/dist/components/navigation/Menu.link.mjs.map +1 -1
  306. package/dist/components/navigation/Menu.popover.cjs +1 -1
  307. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  308. package/dist/components/navigation/Menu.popover.mjs +110 -109
  309. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  310. package/dist/components/navigation/Menu.root.cjs +1 -1
  311. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  312. package/dist/components/navigation/Menu.root.mjs +171 -170
  313. package/dist/components/navigation/Menu.root.mjs.map +1 -1
  314. package/dist/components/navigation/Menu.selectable.cjs +1 -1
  315. package/dist/components/navigation/Menu.selectable.cjs.map +1 -1
  316. package/dist/components/navigation/Menu.selectable.mjs +85 -63
  317. package/dist/components/navigation/Menu.selectable.mjs.map +1 -1
  318. package/dist/components/navigation/Menu.splitGroup.cjs +1 -1
  319. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -1
  320. package/dist/components/navigation/Menu.splitGroup.mjs +27 -26
  321. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -1
  322. package/dist/components/navigation/Menu.trigger.cjs +1 -1
  323. package/dist/components/navigation/Menu.trigger.cjs.map +1 -1
  324. package/dist/components/navigation/Menu.trigger.mjs +6 -6
  325. package/dist/components/navigation/Nav.cjs +1 -1
  326. package/dist/components/navigation/Nav.cjs.map +1 -1
  327. package/dist/components/navigation/Nav.mjs +170 -155
  328. package/dist/components/navigation/Nav.mjs.map +1 -1
  329. package/dist/components/navigation/Pagination.cjs +1 -1
  330. package/dist/components/navigation/Pagination.cjs.map +1 -1
  331. package/dist/components/navigation/Pagination.mjs +73 -65
  332. package/dist/components/navigation/Pagination.mjs.map +1 -1
  333. package/dist/components/navigation/Stepper.cjs +1 -1
  334. package/dist/components/navigation/Stepper.cjs.map +1 -1
  335. package/dist/components/navigation/Stepper.mjs +110 -109
  336. package/dist/components/navigation/Stepper.mjs.map +1 -1
  337. package/dist/components/overlays/Dialog.cjs +1 -1
  338. package/dist/components/overlays/Dialog.cjs.map +1 -1
  339. package/dist/components/overlays/Dialog.mjs +109 -108
  340. package/dist/components/overlays/Dialog.mjs.map +1 -1
  341. package/dist/components/overlays/Drawer.cjs +1 -1
  342. package/dist/components/overlays/Drawer.cjs.map +1 -1
  343. package/dist/components/overlays/Drawer.mjs +110 -109
  344. package/dist/components/overlays/Drawer.mjs.map +1 -1
  345. package/dist/components/overlays/Popover.cjs +1 -1
  346. package/dist/components/overlays/Popover.cjs.map +1 -1
  347. package/dist/components/overlays/Popover.mjs +229 -227
  348. package/dist/components/overlays/Popover.mjs.map +1 -1
  349. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  350. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  351. package/dist/components/overlays/TeachingPopover.mjs +41 -37
  352. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  353. package/dist/components/overlays/Tooltip.cjs +1 -1
  354. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  355. package/dist/components/overlays/Tooltip.mjs +87 -86
  356. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  357. package/dist/components/portal/Portal.cjs +1 -1
  358. package/dist/components/portal/Portal.cjs.map +1 -1
  359. package/dist/components/portal/Portal.mjs +33 -32
  360. package/dist/components/portal/Portal.mjs.map +1 -1
  361. package/dist/components/provider/WaveProvider.cjs +1 -1
  362. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  363. package/dist/components/provider/WaveProvider.mjs +31 -30
  364. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  365. package/dist/components/table/DataGrid.cjs +1 -1
  366. package/dist/components/table/DataGrid.cjs.map +1 -1
  367. package/dist/components/table/DataGrid.mjs +228 -227
  368. package/dist/components/table/DataGrid.mjs.map +1 -1
  369. package/dist/components/table/Table.cjs +1 -1
  370. package/dist/components/table/Table.cjs.map +1 -1
  371. package/dist/components/table/Table.mjs +60 -59
  372. package/dist/components/table/Table.mjs.map +1 -1
  373. package/dist/components/typography/Text.cjs +1 -1
  374. package/dist/components/typography/Text.cjs.map +1 -1
  375. package/dist/components/typography/Text.mjs +12 -11
  376. package/dist/components/typography/Text.mjs.map +1 -1
  377. package/dist/hooks/useMediaQuery.cjs +2 -0
  378. package/dist/hooks/useMediaQuery.cjs.map +1 -0
  379. package/dist/hooks/useMediaQuery.mjs +20 -0
  380. package/dist/hooks/useMediaQuery.mjs.map +1 -0
  381. package/dist/hooks/usePrefersReducedMotion.cjs +1 -1
  382. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -1
  383. package/dist/hooks/usePrefersReducedMotion.mjs +4 -18
  384. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -1
  385. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  386. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  387. package/dist/hooks/useRovingTabIndex.mjs +3 -3
  388. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  389. package/dist/index.cjs +1 -1
  390. package/dist/index.d.cts +2089 -102
  391. package/dist/index.d.ts +2089 -102
  392. package/dist/index.mjs +99 -87
  393. package/dist/lib/classNames.cjs +2 -0
  394. package/dist/lib/classNames.cjs.map +1 -0
  395. package/dist/lib/classNames.mjs +415 -0
  396. package/dist/lib/classNames.mjs.map +1 -0
  397. package/dist/lib/color.cjs +2 -0
  398. package/dist/lib/color.cjs.map +1 -0
  399. package/dist/lib/color.mjs +86 -0
  400. package/dist/lib/color.mjs.map +1 -0
  401. package/dist/lib/globalRegistry.cjs.map +1 -1
  402. package/dist/lib/globalRegistry.mjs.map +1 -1
  403. package/dist/lib/toaster.cjs +2 -0
  404. package/dist/lib/toaster.cjs.map +1 -0
  405. package/dist/lib/toaster.mjs +77 -0
  406. package/dist/lib/toaster.mjs.map +1 -0
  407. package/dist/styles.css +1 -1
  408. package/package.json +1 -1
@@ -2,8 +2,9 @@
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
3
  import { warnDeprecated as t } from "../../lib/dev.mjs";
4
4
  import { composeEventHandlers as n } from "../../lib/composeEventHandlers.mjs";
5
- import { useControllable as r } from "../../hooks/useControllable.mjs";
6
- import { useMergedRefs as i } from "../../hooks/useMergedRefs.mjs";
5
+ import { comboboxClassNames as r } from "../../lib/classNames.mjs";
6
+ import { useControllable as i } from "../../hooks/useControllable.mjs";
7
+ import { useMergedRefs as a } from "../../hooks/useMergedRefs.mjs";
7
8
  import { useFieldContext as ee, useFieldControl as te } from "../../hooks/useFieldControl.mjs";
8
9
  import { disabledStyles as ne, inputBase as re, inputFocus as ie } from "../../lib/styles.mjs";
9
10
  import { DismissIcon as ae } from "../../lib/icons.mjs";
@@ -13,35 +14,35 @@ import { HiddenInput as ce } from "../internal/HiddenInput.mjs";
13
14
  import { collectOptionLabels as le, useListbox as ue } from "../../hooks/useListbox.mjs";
14
15
  import { pickerEndPadding as de } from "./pickerStyles.mjs";
15
16
  import { PickerExpandButton as fe, showsExpandButton as pe } from "./Combobox.expand.mjs";
16
- import { ListboxSurface as me, Option as a, OptionGroup as o, useListboxPopup as he } from "./Option.mjs";
17
- import * as s from "react";
18
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
17
+ import { ListboxSurface as me, Option as o, OptionGroup as s, useListboxPopup as he } from "./Option.mjs";
18
+ import * as c from "react";
19
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
19
20
  //#region src/components/input/Combobox.tsx
20
21
  function ge(e, t) {
21
22
  return (e.textValue ?? e.label).toLowerCase().includes(t.toLowerCase());
22
23
  }
23
- var u = (a) => {
24
- let { value: o, defaultValue: u, onValueChange: d, onOptionSelect: f, open: p, defaultOpen: _e, onOpenChange: ve, placeholder: ye, disabled: m = !1, freeform: h = !1, name: be, form: g, required: _, autoComplete: xe = "off", autoCapitalize: Se, autoCorrect: Ce, maxLength: we, readOnly: v, clearable: Te = !1, expandIcon: y, labels: b, inputMode: Ee, spellCheck: De, enterKeyHint: x, autoFocus: S, tabIndex: C, id: w, "aria-label": T, "aria-labelledby": E, "aria-describedby": Oe, "aria-invalid": ke, "aria-required": Ae, "aria-errormessage": je, "aria-details": Me, onFocus: Ne, onBlur: Pe, onKeyDown: Fe, onKeyUp: Ie, controlRef: Le, className: Re, children: D, ref: ze, ...Be } = a;
25
- f !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
26
- let O = ee(), Ve = (_ ?? O?.required ?? !1) && !v, k = te({
27
- id: w,
28
- "aria-label": T,
29
- "aria-labelledby": E,
30
- "aria-describedby": Oe,
31
- "aria-invalid": ke,
32
- "aria-required": Ae ?? _
33
- }), He = oe(!1, k["aria-invalid"]), [A, j] = r(o, u ?? "", d), M = !m && !v, [N, P] = r(p, (_e ?? !1) && M, ve), F = N && M, [I, L] = s.useState(null), [Ue, We] = s.useState(M);
34
- Ue !== M && (We(M), M || L(null));
24
+ var d = (o) => {
25
+ let { value: s, defaultValue: d, onValueChange: f, onOptionSelect: p, open: m, defaultOpen: _e, onOpenChange: ve, placeholder: ye, disabled: h = !1, freeform: g = !1, name: be, form: _, required: v, autoComplete: xe = "off", autoCapitalize: Se, autoCorrect: Ce, maxLength: we, readOnly: y, clearable: Te = !1, expandIcon: b, labels: x, inputMode: Ee, spellCheck: De, enterKeyHint: S, autoFocus: C, tabIndex: w, id: T, "aria-label": E, "aria-labelledby": Oe, "aria-describedby": ke, "aria-invalid": Ae, "aria-required": je, "aria-errormessage": Me, "aria-details": Ne, onFocus: Pe, onBlur: Fe, onKeyDown: Ie, onKeyUp: Le, controlRef: Re, className: ze, children: D, ref: Be, ...Ve } = o;
26
+ p !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
27
+ let O = ee(), He = (v ?? O?.required ?? !1) && !y, k = te({
28
+ id: T,
29
+ "aria-label": E,
30
+ "aria-labelledby": Oe,
31
+ "aria-describedby": ke,
32
+ "aria-invalid": Ae,
33
+ "aria-required": je ?? v
34
+ }), Ue = oe(!1, k["aria-invalid"]), [A, j] = i(s, d ?? "", f), M = !h && !y, [N, P] = i(m, (_e ?? !1) && M, ve), F = N && M, [I, L] = c.useState(null), [We, Ge] = c.useState(M);
35
+ We !== M && (Ge(M), M || L(null));
35
36
  let R = !M && N;
36
- s.useEffect(() => {
37
+ c.useEffect(() => {
37
38
  R && P(!1);
38
39
  }, [R, P]);
39
- let [Ge, z] = s.useState(null), B = s.useRef(null), V = s.useRef(null), Ke = s.useMemo(() => le(D), [D]), qe = s.useMemo(() => I ? (e) => ge(e, I) : void 0, [I]), H = (e) => {
40
- z(e), j(e), f?.(e);
40
+ let [Ke, z] = c.useState(null), B = c.useRef(null), V = c.useRef(null), qe = c.useMemo(() => le(D), [D]), Je = c.useMemo(() => I ? (e) => ge(e, I) : void 0, [I]), H = (e) => {
41
+ z(e), j(e), p?.(e);
41
42
  }, U = () => {
42
43
  P(!1), L(null);
43
44
  }, W;
44
- h ? W = () => {
45
+ g ? W = () => {
45
46
  L(null), H("");
46
47
  } : I && (W = () => L(null));
47
48
  let G = ue({
@@ -52,136 +53,140 @@ var u = (a) => {
52
53
  mode: "editable",
53
54
  selectedValues: A ? [A] : [],
54
55
  onSelect: (e) => {
55
- j(e), f?.(e), L(null), z(null);
56
+ j(e), p?.(e), L(null), z(null);
56
57
  },
57
- filter: qe,
58
- autoHighlight: !h && I ? "first" : !1,
58
+ filter: Je,
59
+ autoHighlight: !g && I ? "first" : !1,
59
60
  idPrefix: "combobox-listbox",
60
61
  onClearDraft: W
61
- }), K = A ? G.getItem(A)?.label ?? Ke.get(A) : void 0, q;
62
- q = h ? A === Ge ? A : K ?? A : I ?? K ?? "", h && I !== null && I !== q && L(q);
63
- let J = F && G.items.length > 0, Y = b?.noMatches ?? "No matches", X = F && (J || !!I), Je = X && !J, { layerId: Ye, setReference: Xe, surfaceRef: Ze, floatingProps: Qe } = he({
62
+ }), K = A ? G.getItem(A)?.label ?? qe.get(A) : void 0, q;
63
+ q = g ? A === Ke ? A : K ?? A : I ?? K ?? "", g && I !== null && I !== q && L(q);
64
+ let J = F && G.items.length > 0, Y = x?.noMatches ?? "No matches", X = F && (J || !!I), Ye = X && !J, { layerId: Xe, setReference: Ze, surfaceRef: Qe, floatingProps: $e } = he({
64
65
  open: F,
65
66
  surfaceOpen: X,
66
67
  onDismiss: U,
67
68
  rootRef: B,
68
69
  anchorRef: V
69
- }), $e = i(B, ze), Z = i(V, Le, Xe);
70
+ }), Z = a(B, Be), et = a(V, Re, Ze);
70
71
  se(V, () => {
71
- j(u ?? ""), L(null), z(null);
72
- }, g);
73
- let et = (e) => {
72
+ j(d ?? ""), L(null), z(null);
73
+ }, _);
74
+ let tt = (e) => {
74
75
  if (e.key === "Escape" && F && !X && !e.nativeEvent.isComposing) {
75
76
  U(), W && e.currentTarget.value !== "" && (e.preventDefault(), W());
76
77
  return;
77
78
  }
78
79
  G.onKeyDown(e);
79
- }, tt = (e) => {
80
+ }, nt = (e) => {
80
81
  let t = e.target.value;
81
- L(t), F || P(!0), h && H(t);
82
- }, nt = () => {
83
- M && (F ? U() : P(!0), V.current?.focus());
82
+ L(t), F || P(!0), g && H(t);
84
83
  }, rt = () => {
84
+ M && (F ? U() : P(!0), V.current?.focus());
85
+ }, it = () => {
85
86
  j(""), z(null), L(null), P(!1), V.current?.focus();
86
- }, Q = pe(y), $ = Te && A !== "" && !v, it = k["aria-label"] === void 0 ? k["aria-labelledby"] ?? O?.labelId : k["aria-labelledby"];
87
- return /* @__PURE__ */ l("div", {
88
- ...Be,
89
- ref: $e,
90
- className: e("relative inline-flex flex-col", Re),
87
+ }, Q = pe(b), $ = Te && A !== "" && !y, at = k["aria-label"] === void 0 ? k["aria-labelledby"] ?? O?.labelId : k["aria-labelledby"];
88
+ return /* @__PURE__ */ u("div", {
89
+ ...Ve,
90
+ ref: Z,
91
+ className: e(r.root, "relative inline-flex flex-col", ze),
91
92
  children: [
92
- /* @__PURE__ */ l("div", {
93
+ /* @__PURE__ */ u("div", {
93
94
  className: "relative flex items-center",
94
95
  children: [
95
- /* @__PURE__ */ c("input", {
96
+ /* @__PURE__ */ l("input", {
96
97
  type: "text",
97
98
  autoComplete: xe,
98
99
  ...k,
99
100
  ...G.getComboboxProps(),
100
101
  "aria-expanded": J,
101
- "aria-errormessage": je,
102
- "aria-details": Me,
103
- ref: Z,
104
- disabled: m,
105
- readOnly: v,
102
+ "aria-errormessage": Me,
103
+ "aria-details": Ne,
104
+ ref: et,
105
+ disabled: h,
106
+ readOnly: y,
106
107
  placeholder: ye,
107
108
  autoCapitalize: Se,
108
109
  autoCorrect: Ce,
109
110
  maxLength: we,
110
111
  inputMode: Ee,
111
112
  spellCheck: De,
112
- enterKeyHint: x,
113
- autoFocus: S,
114
- tabIndex: C,
113
+ enterKeyHint: S,
114
+ autoFocus: C,
115
+ tabIndex: w,
115
116
  value: q,
116
- onChange: tt,
117
+ onChange: nt,
117
118
  onClick: () => {
118
119
  !F && M && P(!0);
119
120
  },
120
- onKeyDown: n(Fe, v ? void 0 : et),
121
- onKeyUp: n(Ie, G.onKeyUp),
122
- onFocus: Ne,
123
- onBlur: n(Pe, () => L(null), { checkDefaultPrevented: !1 }),
124
- className: e(re, "border-b-stroke-accessible", ie, ne, He && "border-destructive focus:border-b-destructive", de(Number($) + Number(Q)))
121
+ onKeyDown: n(Ie, y ? void 0 : tt),
122
+ onKeyUp: n(Le, G.onKeyUp),
123
+ onFocus: Pe,
124
+ onBlur: n(Fe, () => L(null), { checkDefaultPrevented: !1 }),
125
+ className: e(r.input, re, "border-b-stroke-accessible", ie, ne, Ue && "border-destructive focus:border-b-destructive", de(Number($) + Number(Q)))
125
126
  }),
126
- $ && /* @__PURE__ */ c("button", {
127
+ $ && /* @__PURE__ */ l("button", {
127
128
  type: "button",
128
- "aria-label": b?.clear ?? "Clear selection",
129
- disabled: m,
129
+ "aria-label": x?.clear ?? "Clear selection",
130
+ disabled: h,
130
131
  onMouseDown: (e) => e.preventDefault(),
131
- onClick: rt,
132
- className: e("absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", Q ? "end-7" : "end-1", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
133
- children: /* @__PURE__ */ c(ae, {})
132
+ onClick: it,
133
+ className: e(r.clearButton, "absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", Q ? "end-7" : "end-1", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
134
+ children: /* @__PURE__ */ l(ae, {})
134
135
  }),
135
- Q && /* @__PURE__ */ c(fe, {
136
+ Q && /* @__PURE__ */ l(fe, {
136
137
  component: "Combobox",
137
- expandIcon: y,
138
- label: b?.expand ?? "Show options",
138
+ expandIcon: b,
139
+ label: x?.expand ?? "Show options",
139
140
  expanded: J,
140
141
  listboxId: G.listboxId,
141
- disabled: m || !!v,
142
- onToggle: nt
142
+ disabled: h || !!y,
143
+ onToggle: rt,
144
+ className: r.expandButton,
145
+ iconClassName: r.expandIcon
143
146
  })
144
147
  ]
145
148
  }),
146
- /* @__PURE__ */ c("span", {
149
+ /* @__PURE__ */ l("span", {
147
150
  role: "status",
148
151
  className: "sr-only",
149
- children: Je && Y
152
+ children: Ye && Y
150
153
  }),
151
- /* @__PURE__ */ c(me, {
154
+ /* @__PURE__ */ l(me, {
152
155
  listbox: G,
153
- layerId: Ye,
154
- surfaceRef: Ze,
155
- floatingProps: Qe,
156
+ layerId: Xe,
157
+ surfaceRef: Qe,
158
+ floatingProps: $e,
156
159
  open: F,
157
160
  expanded: J,
158
- emptyContent: I ? /* @__PURE__ */ c("div", {
161
+ listboxClassName: r.listbox,
162
+ surfaceClassName: r.surface,
163
+ emptyContent: I ? /* @__PURE__ */ l("div", {
159
164
  "aria-hidden": "true",
160
- className: "px-3 py-1.5 text-body-1 text-muted-foreground",
165
+ className: e(r.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
161
166
  children: Y
162
167
  }) : void 0,
163
168
  "aria-label": k["aria-label"],
164
- "aria-labelledby": it,
169
+ "aria-labelledby": at,
165
170
  children: D
166
171
  }),
167
- /* @__PURE__ */ c(ce, {
172
+ /* @__PURE__ */ l(ce, {
168
173
  name: be,
169
- form: g,
170
- disabled: m,
174
+ form: _,
175
+ disabled: h,
171
176
  value: A,
172
177
  type: "text",
173
- required: Ve,
178
+ required: He,
174
179
  onInvalid: () => V.current?.focus()
175
180
  })
176
181
  ]
177
182
  });
178
183
  };
179
- u.displayName = "Combobox";
180
- var d = a, f = o, p = /* @__PURE__ */ Object.assign(u, {
181
- Option: a,
182
- OptionGroup: o
184
+ d.displayName = "Combobox";
185
+ var f = o, p = s, m = /* @__PURE__ */ Object.assign(d, {
186
+ Option: o,
187
+ OptionGroup: s
183
188
  });
184
189
  //#endregion
185
- export { p as Combobox, d as ComboboxOption, f as ComboboxOptionGroup, a as Option, o as OptionGroup };
190
+ export { m as Combobox, f as ComboboxOption, p as ComboboxOptionGroup, o as Option, s as OptionGroup };
186
191
 
187
192
  //# sourceMappingURL=Combobox.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","cn","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputBase","inputFocus","disabledStyles","pickerEndPadding","DismissIcon","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport { disabledStyles, focusRing, inputBase, inputFocus, inputInvalid } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport { PICKER_ICON_BUTTON_CLASSES, pickerEndPadding } from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\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 onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div {...rest} ref={rootMergedRef} className={cn('relative inline-flex flex-col', className)}>\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n inputBase,\n 'border-b-stroke-accessible',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand)),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n PICKER_ICON_BUTTON_CLASSES,\n showExpand ? 'end-7' : 'end-1',\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n emptyContent={\n draft ? (\n <div aria-hidden=\"true\" className=\"px-3 py-1.5 text-body-1 text-muted-foreground\">\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgKA,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EAAK,aAAaA,EAAK,MAAA,CAAO,YAAY,CAAC,CAAC,SAASC,EAAK,YAAY,CAAC;AACjF;AAEA,IAAMC,KAAgB,MAAyB;CAC7C,IAAM,EACJ,OAAOC,GACP,iBACA,kBACA,mBACA,MAAMC,GACN,iBACA,kBACA,iBACA,cAAW,IACX,cAAW,IACX,UACA,SACA,aACA,mBAAe,OACf,oBACA,iBACA,eACA,aACA,gBAAY,IACZ,eACA,WACA,eACA,gBACA,iBACA,cACA,aACA,OACA,cAAcC,GACd,mBAAmBC,GACnB,oBAAoBC,IACpB,gBAAgBC,IAChB,iBAAiBC,IACjB,qBAAqBC,IACrB,gBAAgBC,IAChB,aACA,YACA,eACA,aACA,gBACA,eACA,aACA,SACA,GAAGC,OACDC;CAEJ,AAAIC,MAAmB,KAAA,KAAWC,EAAe,YAAY,kBAAkB,eAAe;CAE9F,IAAMC,IAAQC,GAAgB,GAExBC,MADaC,KAAYH,GAAO,YAAY,OAClB,CAACI,GAC3BC,IAAaC,GAAgB;EACjC;EACA,cAAcjB;EACd,mBAAmBC;EACnB,oBAAoBC;EACpB,gBAAgBC;EAGhB,iBAAiBC,MAAgBU;CACnC,CAAC,GAEKI,KAAcC,GAAc,IAAOH,EAAW,eAA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V,cAAc,MAAUY,EAAM,eAAe;MAC7C,SAASG;MACT,WAAWO,EAAA,gNAETN,IAAa,UAAU,SAAA,qFAAA,mJAGzB;MAEA,UAAA,kBAACgB,IAAD,CAAc,CAAA;KACR,CAAA;KAEThB,KACC,kBAACiB,IAAD;MACE,WAAU;MACE;MACZ,OAAOjC,GAAQ,UAAU;MACf;MACV,WAAWP,EAAQ;MACnB,UAAUvB,KAAY,CAAC,CAACX;MACxB,UAAUuD;KACX,CAAA;IAEA;;GAGL,kBAAC,QAAD;IAAM,MAAK;IAAS,WAAU;IAC3B,UAAAZ,MAAaH;GACV,CAAA;GACN,kBAACmC,IAAD;IACW;IACA;IACG;IACG;IACT;IACI;IACV,cACE1D,IACE,kBAAC,OAAD;KAAK,eAAY;KAAO,WAAU;KAC/B,UAAAuB;IACE,CAAA,IACH,KAAA;IAEN,cAAYvC,EAAW;IACvB,mBAAiB6D;IAEhB;GACa,CAAA;GAChB,kBAACc,IAAD;IACQ;IACA;IACI;IACH;IACP,MAAK;IAGL,UAAU9E;IACV,iBAAiB2B,EAAS,SAAS,MAAM;GAC1C,CAAA;EACE;;AAET;AACA,EAAa,cAAc;AAG3B,IAAaoD,IAAiBC,GAEjBC,IAAsBC,GA0BtBC,IAA2B,uBAAO,OAAOnG,GAAc;CAClE;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"Combobox.mjs","names":["React","matchesText","item","text","ComboboxRoot","valueProp","openProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","ariaErrorMessage","ariaDetails","rest","props","onOptionSelect","warnDeprecated","field","useFieldContext","validates","required","readOnly","fieldProps","useFieldControl","invalidLook","isInvalidLook","value","setValue","useControllable","defaultValue","onValueChange","interactive","disabled","openState","setOpen","defaultOpen","onOpenChange","open","draft","setDraft","wasInteractive","setWasInteractive","lockedOpen","typedValue","setTypedValue","rootRef","inputRef","optionLabels","collectOptionLabels","children","filter","commitText","close","clearDraft","freeform","listbox","useListbox","next","optionLabel","inputText","expanded","noMatchesText","labels","surfaceOpen","noMatches","useListboxPopup","rootMergedRef","useMergedRefs","ref","inputMergedRef","controlRef","setReference","form","handleKeyDown","event","handleChange","handleExpandClick","handleClear","showExpand","showsExpandButton","expandIcon","showClear","clearable","listLabelledBy","cn","comboboxClassNames","className","composeEventHandlers","onKeyDown","onKeyUp","onBlur","inputBase","inputFocus","disabledStyles","pickerEndPadding","DismissIcon","PickerExpandButton","ListboxSurface","HiddenInput","ComboboxOption","Option","ComboboxOptionGroup","OptionGroup","Combobox"],"sources":["../../../src/components/input/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { comboboxClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { warnDeprecated } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport type { Slot } from '../../lib/slot';\nimport { disabledStyles, focusRing, inputBase, inputFocus, inputInvalid } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { collectOptionLabels, useListbox, type ListboxItem } from '../../hooks/useListbox';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { PickerExpandButton, showsExpandButton } from './Combobox.expand';\nimport { isInvalidLook } from './Input';\nimport { ListboxSurface, Option, OptionGroup, useListboxPopup } from './Option';\nimport { PICKER_ICON_BUTTON_CLASSES, pickerEndPadding } from './pickerStyles';\nimport type { RoutedHandlers } from './routedHandlers';\n\nexport { Option, OptionGroup } from './Option';\nexport type { OptionProps, OptionGroupProps } from './Option';\n\n/* ------------------------------------------------------------------ */\n/* Combobox */\n/* ------------------------------------------------------------------ */\n\n/**\n * The Combobox's built-in texts, for localization. Each member is optional and falls back to its\n * English default.\n */\nexport interface ComboboxLabels {\n /** Status text (announced, and shown in the popup) when the typed text matches no option.\n * @default 'No matches'\n */\n noMatches?: string;\n /** Name of the clear button (`clearable`).\n * @default 'Clear selection'\n */\n clear?: string;\n /** Name of the expand button at the end of the input.\n * @default 'Show options'\n */\n expand?: string;\n}\n\n/** Properties for the Combobox component. */\nexport interface ComboboxProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | RoutedHandlers\n> {\n /** Controlled selected value (`''` for none). */\n value?: string;\n /**\n * Initial selected value for uncontrolled usage.\n * @default ''\n */\n defaultValue?: string;\n /**\n * Called with the new value when it changes: an option is selected, or (with `freeform`) the\n * text changes. Not called when the current option is selected again.\n */\n onValueChange?: (value: string) => void;\n /**\n * Called on every option activation, also when the current option is selected again (and, with\n * `freeform`, on every text change).\n * @deprecated Use `onValueChange`.\n */\n onOptionSelect?: (value: string) => void;\n /**\n * Controlled open state of the listbox. The list renders only in the browser: an open combobox\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Initial open state for uncontrolled usage. A combobox that starts disabled or read-only\n * starts closed. The list renders only in the browser: it is closed in the server HTML and opens\n * once the combobox has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /** Called when the listbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Placeholder text shown when no value is selected. */\n placeholder?: string;\n /**\n * Whether the combobox is disabled and non-interactive.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the typed text is itself the value. Without it, typing only filters the options (the\n * first match becomes active, so Enter selects it) and the input shows the selected option's\n * label again when the listbox closes or loses focus. With it, the input shows typed text as\n * typed (also when it equals an option's value), a selected option's label, and a controlled\n * `value` as soon as the parent sets it (a parent that normalizes or rejects the text).\n * @default false\n */\n freeform?: boolean;\n /** Name of the value in form submissions (renders a hidden input). */\n name?: string;\n /** Id of the form the value belongs to, when the Combobox is outside it. */\n form?: string;\n /**\n * A value is required to submit the form (native constraint validation). Like a native readonly\n * input, a `readOnly` Combobox does not block submission.\n */\n required?: boolean;\n /**\n * The `autocomplete` attribute of the `<input role=\"combobox\">`. Browser autofill is off unless\n * you set it (for example `'on'`).\n * @default 'off'\n */\n autoComplete?: string;\n /** The maximum length of the typed text (`maxlength` of the `<input role=\"combobox\">`). */\n maxLength?: number;\n /**\n * The value cannot be changed: the input is read-only and the listbox neither opens (click,\n * keyboard, a controlled `open`) nor commits; Escape is left to the page. Turning it (or\n * `disabled`) on while the listbox is open closes it (`onOpenChange(false)`).\n */\n readOnly?: boolean;\n /**\n * Shows a clear button while a value is selected (not while `readOnly`; while `disabled` it is\n * shown disabled, as in DatePicker and TimePicker). It clears the value\n * (`onValueChange('')`), drops typed text, closes the list and moves focus to the input. It is\n * a tab stop after the input.\n * @default false\n */\n clearable?: boolean;\n /**\n * The glyph of the expand button at the end of the input (default: a chevron). The button\n * opens and closes the list without moving focus out of the input and is not a tab stop\n * (Alt+ArrowDown opens the list from the keyboard). `null` or `undefined` keep the chevron;\n * `false`, or a value that renders nothing, hides the button. Decorative content rendered\n * inside the built-in button: a `<button>` or `Button` passed here is not nested (its children\n * become the glyph, with a development warning).\n */\n expandIcon?: Slot<'span'>;\n /**\n * The built-in texts (the \"No matches\" status and the names of the clear and expand buttons),\n * for localization. Unset members keep their English defaults.\n */\n labels?: ComboboxLabels;\n /** Called when the `<input role=\"combobox\">` receives focus (the root keeps other handlers). */\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n /** Called when the `<input role=\"combobox\">` loses focus. */\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n /**\n * Called on a key press in the `<input role=\"combobox\">`, before the built-in listbox keys;\n * `event.preventDefault()` skips them.\n */\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Called when a key is released in the `<input role=\"combobox\">`. */\n onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;\n /** Ref to the `<input role=\"combobox\">` (the focusable element). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nfunction matchesText(item: ListboxItem, text: string): boolean {\n return (item.textValue ?? item.label).toLowerCase().includes(text.toLowerCase());\n}\n\nconst ComboboxRoot = (props: ComboboxProps) => {\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n onOptionSelect,\n open: openProp,\n defaultOpen,\n onOpenChange,\n placeholder,\n disabled = false,\n freeform = false,\n name,\n form,\n required,\n autoComplete = 'off',\n autoCapitalize,\n autoCorrect,\n maxLength,\n readOnly,\n clearable = false,\n expandIcon,\n labels,\n inputMode,\n spellCheck,\n enterKeyHint,\n autoFocus,\n tabIndex,\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 onFocus,\n onBlur,\n onKeyDown,\n onKeyUp,\n controlRef,\n className,\n children,\n ref,\n ...rest\n } = props;\n\n if (onOptionSelect !== undefined) warnDeprecated('Combobox', 'onOptionSelect', 'onValueChange');\n\n const field = useFieldContext();\n const isRequired = required ?? field?.required ?? false;\n const validates = isRequired && !readOnly;\n const fieldProps = useFieldControl({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so aria-required matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n });\n // The error look follows the resolved state: the consumer's `aria-invalid` or the Field's.\n const invalidLook = isInvalidLook(false, fieldProps['aria-invalid']);\n\n const [value, setValue] = useControllable(valueProp, defaultValue ?? '', onValueChange);\n const interactive = !disabled && !readOnly;\n // A combobox that starts disabled or read-only never shows its list, so it starts closed (no\n // close to report later).\n const [openState, setOpen] = useControllable(\n openProp,\n (defaultOpen ?? false) && interactive,\n onOpenChange,\n );\n const open = openState && interactive;\n // Text typed since the last commit, the filter; `null` shows the committed value's label\n // (input-pickers#7). Freeform: the input shows the value, and the draft follows that text.\n const [draft, setDraft] = React.useState<string | null>(null);\n // Locking the control (readOnly/disabled) while typing drops the draft, so the input shows the\n // committed value again (adjust-during-render pattern, C-HOOKS).\n const [wasInteractive, setWasInteractive] = React.useState(interactive);\n if (wasInteractive !== interactive) {\n setWasInteractive(interactive);\n if (!interactive) setDraft(null);\n }\n // Locking also closes the list itself, not only the derived `open`, so unlocking does not reopen\n // it without a user action. The close is reported through onOpenChange (a consumer callback from\n // an effect, C-HOOKS); a controlled `open` that stays true is still not shown while locked.\n const lockedOpen = !interactive && openState;\n React.useEffect(() => {\n if (lockedOpen) setOpen(false);\n }, [lockedOpen, setOpen]);\n\n // Freeform: the value the user typed last. While the value still equals it, the input shows it\n // as typed, even when it equals an option's value (not that option's label).\n const [typedValue, setTypedValue] = React.useState<string | null>(null);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n\n const optionLabels = React.useMemo(() => collectOptionLabels(children), [children]);\n const filter = React.useMemo(\n () => (draft ? (item: ListboxItem) => matchesText(item, draft) : undefined),\n [draft],\n );\n\n const commitText = (text: string) => {\n setTypedValue(text);\n setValue(text);\n onOptionSelect?.(text);\n };\n\n const close = () => {\n setOpen(false);\n setDraft(null);\n };\n\n // APG: Escape on a closed listbox clears the textbox. Freeform: the text is the value, so it is\n // cleared. Otherwise only a typed filter is dropped (the input shows the selected label again);\n // without one there is nothing to clear and Escape is left to the page.\n let clearDraft: (() => void) | undefined;\n if (freeform) {\n clearDraft = () => {\n setDraft(null);\n commitText('');\n };\n } else if (draft) {\n clearDraft = () => setDraft(null);\n }\n\n const listbox = useListbox({\n open,\n onOpenChange: (next) => {\n if (next) setOpen(true);\n else close();\n },\n mode: 'editable',\n selectedValues: value ? [value] : [],\n onSelect: (next) => {\n setValue(next);\n onOptionSelect?.(next);\n setDraft(null);\n setTypedValue(null);\n },\n filter,\n // Typing a filter makes its first match active (like Fluent's Combobox), so Enter selects what\n // the list shows instead of submitting the form. Nothing is active on open or with the text\n // cleared. Freeform: the text is the value, so Enter keeps it unless the user moved to an\n // option.\n autoHighlight: !freeform && draft ? 'first' : false,\n idPrefix: 'combobox-listbox',\n onClearDraft: clearDraft,\n });\n\n // The input text. Freeform: the value as typed while it is the value the user typed last, else\n // the label of the option with that value, else the value itself — so the text follows a\n // controlled parent that normalizes or rejects what was typed while the input still has focus.\n // Otherwise: the typed filter, else the selected option's label.\n const optionLabel = value\n ? (listbox.getItem(value)?.label ?? optionLabels.get(value))\n : undefined;\n let inputText: string;\n if (freeform) inputText = value === typedValue ? value : (optionLabel ?? value);\n else inputText = draft ?? optionLabel ?? '';\n // Freeform: the filter follows the text (adjust-during-render pattern, C-HOOKS; the text does not\n // depend on the filter, so this settles in one pass).\n if (freeform && draft !== null && draft !== inputText) setDraft(inputText);\n\n const expanded = open && listbox.items.length > 0;\n const noMatchesText = labels?.noMatches ?? 'No matches';\n // The popup shows the list, or \"No matches\" for a draft.\n const surfaceOpen = open && (expanded || !!draft);\n const noMatches = surfaceOpen && !expanded;\n const { layerId, setReference, surfaceRef, floatingProps } = useListboxPopup({\n open,\n surfaceOpen,\n onDismiss: close,\n rootRef,\n anchorRef: inputRef,\n });\n\n const rootMergedRef = useMergedRefs<HTMLDivElement>(rootRef, ref);\n const inputMergedRef = useMergedRefs<HTMLInputElement>(inputRef, controlRef, setReference);\n\n useFormReset(\n inputRef,\n () => {\n setValue(defaultValue ?? '');\n setDraft(null);\n setTypedValue(null);\n },\n form,\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && open && !surfaceOpen && !event.nativeEvent.isComposing) {\n // Open with nothing shown (no options): close as a closed list would handle Escape — clear\n // the text if there is any, otherwise leave the key to an enclosing layer (overlays#1).\n close();\n if (clearDraft && event.currentTarget.value !== '') {\n event.preventDefault();\n clearDraft();\n }\n return;\n }\n listbox.onKeyDown(event);\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const text = event.target.value;\n setDraft(text);\n if (!open) setOpen(true);\n if (freeform) commitText(text);\n };\n\n // The expand button opens and closes the list like the input's own keys; focus stays in (or\n // returns to) the input.\n const handleExpandClick = () => {\n if (!interactive) return;\n if (open) close();\n else setOpen(true);\n inputRef.current?.focus();\n };\n\n // Clearing is not an option activation: the state is set directly, not through `commitText`\n // (which calls the deprecated `onOptionSelect` in freeform mode). The button disappears with the\n // value, so focus moves to the input explicitly (C-DISABLED).\n const handleClear = () => {\n setValue('');\n setTypedValue(null);\n setDraft(null);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n const showExpand = showsExpandButton(expandIcon);\n // Read-only comboboxes offer no clear action (the value cannot change).\n const showClear = clearable && value !== '' && !readOnly;\n\n const listLabelledBy =\n fieldProps['aria-label'] === undefined\n ? (fieldProps['aria-labelledby'] ?? field?.labelId)\n : fieldProps['aria-labelledby'];\n\n return (\n <div\n {...rest}\n ref={rootMergedRef}\n className={cn(comboboxClassNames.root, 'relative inline-flex flex-col', className)}\n >\n <div className=\"relative flex items-center\">\n <input\n type=\"text\"\n autoComplete={autoComplete}\n {...fieldProps}\n {...listbox.getComboboxProps()}\n aria-expanded={expanded}\n aria-errormessage={ariaErrorMessage}\n aria-details={ariaDetails}\n ref={inputMergedRef}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n maxLength={maxLength}\n inputMode={inputMode}\n spellCheck={spellCheck}\n enterKeyHint={enterKeyHint}\n autoFocus={autoFocus}\n tabIndex={tabIndex}\n value={inputText}\n onChange={handleChange}\n onClick={() => {\n if (!open && interactive) setOpen(true);\n }}\n // Read-only: no listbox keys at all (they would open, commit or clear the value).\n onKeyDown={composeEventHandlers(onKeyDown, readOnly ? undefined : handleKeyDown)}\n onKeyUp={composeEventHandlers(onKeyUp, listbox.onKeyUp)}\n onFocus={onFocus}\n onBlur={composeEventHandlers(onBlur, () => setDraft(null), {\n checkDefaultPrevented: false,\n })}\n className={cn(\n comboboxClassNames.input,\n inputBase,\n 'border-b-stroke-accessible',\n inputFocus,\n disabledStyles,\n invalidLook && inputInvalid,\n pickerEndPadding(Number(showClear) + Number(showExpand)),\n )}\n />\n {showClear && (\n <button\n type=\"button\"\n aria-label={labels?.clear ?? 'Clear selection'}\n disabled={disabled}\n // Keeps focus in the input, so its blur does not act on a draft before the clear.\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleClear}\n className={cn(\n comboboxClassNames.clearButton,\n PICKER_ICON_BUTTON_CLASSES,\n showExpand ? 'end-7' : 'end-1',\n focusRing,\n disabledStyles,\n )}\n >\n <DismissIcon />\n </button>\n )}\n {showExpand && (\n <PickerExpandButton\n component=\"Combobox\"\n expandIcon={expandIcon}\n label={labels?.expand ?? 'Show options'}\n expanded={expanded}\n listboxId={listbox.listboxId}\n disabled={disabled || !!readOnly}\n onToggle={handleExpandClick}\n className={comboboxClassNames.expandButton}\n iconClassName={comboboxClassNames.expandIcon}\n />\n )}\n </div>\n {/* Mounted before its text: a live region added together with its text is not announced by\n every screen reader. The row in the popup is the visible copy. */}\n <span role=\"status\" className=\"sr-only\">\n {noMatches && noMatchesText}\n </span>\n <ListboxSurface\n listbox={listbox}\n layerId={layerId}\n surfaceRef={surfaceRef}\n floatingProps={floatingProps}\n open={open}\n expanded={expanded}\n listboxClassName={comboboxClassNames.listbox}\n surfaceClassName={comboboxClassNames.surface}\n emptyContent={\n draft ? (\n <div\n aria-hidden=\"true\"\n className={cn(\n comboboxClassNames.emptyMessage,\n 'px-3 py-1.5 text-body-1 text-muted-foreground',\n )}\n >\n {noMatchesText}\n </div>\n ) : undefined\n }\n aria-label={fieldProps['aria-label']}\n aria-labelledby={listLabelledBy}\n >\n {children}\n </ListboxSurface>\n <HiddenInput\n name={name}\n form={form}\n disabled={disabled}\n value={value}\n type=\"text\"\n // Like a native readonly input, a read-only Combobox is barred from constraint validation\n // (the user could not fix it); its value is still submitted.\n required={validates}\n onInvalid={() => inputRef.current?.focus()}\n />\n </div>\n );\n};\nComboboxRoot.displayName = 'Combobox';\n\n/** Flat name of `Combobox.Option` for React Server Components. */\nexport const ComboboxOption = Option;\n/** Flat name of `Combobox.OptionGroup` for React Server Components. */\nexport const ComboboxOptionGroup = OptionGroup;\n\n/**\n * An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with\n * list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight\n * (`aria-activedescendant`), Enter selects, Escape closes. Without `freeform` the text is only a\n * filter: its first match becomes active while typing, and the input shows the selected option's\n * label again when the listbox closes. With `freeform` the text itself is the value. Text that\n * matches no option shows \"No matches\" (`labels.noMatches`), announced through a status region.\n * The expand button at the end of the input (a chevron, see `expandIcon`) opens and closes the\n * list without taking focus from the input and is not a tab stop; `clearable` adds a clear button,\n * a tab stop after the input. Both sit with the input in a wrapper `<div>` inside the root.\n *\n * The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,\n * `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,\n * `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.\n * `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root\n * `<div>`. Inside a `Field` the input is labelled and described by it. It shows the error look\n * whenever it ends up `aria-invalid` (its own `aria-invalid` or a `Field` error). With\n * `name`/`required` the value takes part in form submission, validation and reset. The open\n * listbox renders in a portal; while closed it stays in the DOM, hidden.\n *\n * Sub-components: `Combobox.Option`, `Combobox.OptionGroup`. React Server Components import the\n * flat names `ComboboxOption` / `ComboboxOptionGroup` (dotted access needs a client file).\n */\nexport const Combobox = /* @__PURE__ */ Object.assign(ComboboxRoot, {\n Option,\n OptionGroup,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiKA,SAASC,GAAY,GAAmB,GAAuB;CAC7D,QAAQC,EA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GACN,kBAACoC,IAAD;IACW;IACA;IACG;IACG;IACT;IACI;IACV,kBAAkBZ,EAAmB;IACrC,kBAAkBA,EAAmB;IACrC,cACE/C,IACE,kBAAC,OAAD;KACE,eAAY;KACZ,WAAW8C,EACTC,EAAmB,cACnB,+CACF;KAEC,UAAAxB;IACE,CAAA,IACH,KAAA;IAEN,cAAYvC,EAAW;IACvB,mBAAiB6D;IAEhB;GACa,CAAA;GAChB,kBAACe,IAAD;IACQ;IACA;IACI;IACH;IACP,MAAK;IAGL,UAAU/E;IACV,iBAAiB2B,EAAS,SAAS,MAAM;GAC1C,CAAA;EACE;;AAET;AACA,EAAa,cAAc;AAG3B,IAAaqD,IAAiBC,GAEjBC,IAAsBC,GA0BtBC,IAA2B,uBAAO,OAAOpG,GAAc;CAClE;CACA;AACF,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../hooks/useControllable.cjs"),a=require("../../hooks/useId.cjs"),o=require("../../lib/direction.cjs"),ee=require("../../lib/focus.cjs"),te=require("../../hooks/useMergedRefs.cjs"),ne=require("../../hooks/useIsClient.cjs"),s=require("../../lib/aria.cjs"),re=require("../../hooks/useFieldControl.cjs"),ie=require("../../hooks/useDismiss.cjs"),ae=require("../portal/Portal.cjs"),c=require("../../lib/styles.cjs"),l=require("../../lib/icons.cjs"),oe=require("./Input.cjs"),se=require("../../hooks/useFormReset.cjs"),ce=require("../internal/HiddenInput.cjs"),le=require("../../hooks/usePopupPosition.cjs"),u=require("./dateUtils.cjs"),ue=require("../../hooks/useFocusTrap.cjs"),de=require("../../hooks/useRestoreFocus.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime"),fe=require("react-dom");var pe=e=>e?`Enter a date in the format ${e}.`:`Enter a valid date.`,me=(e,t)=>e!==void 0&&t!==void 0?`Enter a date between ${e} and ${t}.`:e===void 0?`Enter a date on or before ${t}.`:`Enter a date on or after ${e}.`,he=`absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`,ge=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover`,_e=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`;function ve(e){let t=[];for(let n=0;n<e.length;n+=7)t.push(e.slice(n,n+7));return t}var p=e=>{let{value:p,defaultValue:ye,onValueChange:be,onChange:xe,formatDate:m,parseDate:Se,locale:h,minDate:g,maxDate:_,disabledDates:Ce,placeholder:we=`Select a date`,disabled:v=!1,readOnly:y,clearable:Te=!1,firstDayOfWeek:b=0,open:Ee,defaultOpen:De,onOpenChange:Oe,onInvalidInput:ke,labels:x,name:Ae,form:je,required:Me,autoComplete:Ne=`off`,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":We,"aria-invalid":Ge,"aria-required":Ke,"aria-errormessage":qe,"aria-details":Je,onFocus:Ye,onBlur:Xe,onKeyDown:Ze,onKeyUp:Qe,controlRef:$e,className:et,ref:tt,...nt}=e;xe!==void 0&&n.warnDeprecated(`DatePicker`,`onChange`,`onValueChange`);let rt=m!==void 0,S=Se!==void 0;d.useEffect(()=>{rt&&!S&&n.warnOnce(`DatePicker:formatDate-without-parseDate`,"DatePicker: `formatDate` is set without `parseDate`. Typed dates are parsed with the default parser for `locale` (its numeric format or yyyy-mm-dd), which may not read your format; pass `parseDate` as the inverse of `formatDate`.")},[rt,S]),d.useEffect(()=>{h!==void 0&&!u.isValidLocaleTag(h)&&n.warnOnce(`DatePicker:invalid-locale:${h}`,`DatePicker: \`locale\` "${h}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats and parses the dates instead, so the server and the browser may render different text.`)},[h]);let[C,it]=i.useControllable(p,ye??null,e=>{be?.(e),xe?.(e)}),w=!v&&!y,[T,E]=i.useControllable(Ee,(De??!1)&&w,Oe),at=ne.useIsClient(),D=T&&w&&at,ot=Ee!==void 0;d.useEffect(()=>{!w&&T&&!ot&&E(!1)},[w,T,ot,E]);let O=e=>m?m(e):u.formatDate(e,h),st=e=>Se?Se(e):u.parseDate(e,h),[k,A]=d.useState(null),[j,M]=d.useState(null),[ct,lt]=d.useState(w);ct!==w&&(lt(w),w||(A(null),M(null)));let N=C?u.formatISODate(C):``,[ut,dt]=d.useState(N);ut!==N&&(dt(N),j!==null&&(A(null),M(null)));let ft=e=>!u.isDateInRange(e,g,_)||!!Ce?.(u.startOfDay(e)),P=e=>{let t=e?u.startOfDay(e):null;(t?u.isSameDay(t,C):C===null)||it(t),A(null),M(null)},F=e=>{if(!e.trim())return P(null),!0;let t=st(e),n=null;if(!t||Number.isNaN(t.getTime())?n=`unparseable`:u.isDateInRange(t,g,_)?Ce?.(u.startOfDay(t))&&(n=`disabled`):n=`out-of-range`,n||!t){let t=n??`unparseable`;return M(t),ke?.(e,t),!1}return P(t),!0},I=u.startOfDay(new Date),pt=()=>u.startOfMonth(u.clampDate(C??I,g,_)),[L,R]=d.useState(pt),[mt,z]=d.useState(null),[B,V]=d.useState(!1),[ht,gt]=d.useState(D);ht!==D&&(gt(D),D&&(R(pt()),z(null))),B&&!D&&V(!1);let H=d.useMemo(()=>ve(u.getCalendarDays(L,b)),[L,b]),U=e=>!!e&&u.isSameMonth(e,L),_t=e=>!!e&&e>=H[0][0]&&e<=H[H.length-1][6],vt=u.clampDate(I,g,_),yt=u.clampDate(L,g,_),W=_t(mt)?mt:U(C)?u.startOfDay(C):U(vt)?vt:U(yt)?yt:L,G=u.formatISODate(W),bt=e=>{let t=u.clampDate(e,g,_);z(t),u.isSameMonth(t,L)||R(u.startOfMonth(t))},xt=e=>{let t=u.addMonths(L,e),n=u.clampDate(u.addMonths(W,e),g,_);R(t),z(u.isSameMonth(n,t)?n:null)},St=e=>{u.isSameDay(e,W)||z(e)},Ct=!!g&&u.addDays(L,-1)<u.startOfDay(g),wt=!!_&&u.addMonths(L,1)>u.startOfDay(_),Tt=d.useMemo(()=>u.getWeekdayNames(h,b),[h,b]),K=d.useRef(null),q=d.useRef(null),J=d.useRef(null),Et=d.useRef(null),Y=d.useRef(null),[Dt,Ot]=d.useState(null),kt=te.useMergedRefs($e,K),At=a.useId(`datepicker-dialog`),X=a.useId(`datepicker-heading`),Z=a.useId(`datepicker-grid`),jt=a.useId(`datepicker-error`),Mt=e=>{Y.current=e,E(!1)},{layerId:Nt}=ie.useDismiss({open:D,onDismiss:(e,t)=>{let n=e===`outside-press`&&t.target instanceof Element?t.target.closest(ee.FOCUSABLE_SELECTOR):null;Mt(n??(B?K.current:null))},refs:[Et,q],anchorRef:q,kind:`modal`}),{setReference:Pt,setFloating:Ft,floatingProps:It}=le.usePopupPosition({open:D,side:`bottom`,align:`start`}),Lt=te.useMergedRefs(Et,Ot,Ft);ue.useFocusTrap(Dt,{enabled:D,layerId:Nt,initialFocus:()=>J.current?.querySelector(`button[tabindex="0"]`)??null}),de.useRestoreFocus({enabled:D,container:Dt,triggerRef:q,finalFocusRef:Y,onlyIfFocusInside:!0}),d.useLayoutEffect(()=>{D&&(Y.current=null)},[D]),d.useLayoutEffect(()=>{let e=J.current;if(!e)return;let t=e.ownerDocument.activeElement;if(!t||!e.contains(t))return;let n=e.querySelector(`button[data-date="${G}"]`);n&&n!==t&&n.focus()},[G]);let Rt=re.useFieldContext(),zt=(Me??Rt?.required??!1)&&!y,Bt=j!==null&&!Rt?.hasErrorMessage,Vt=re.useFieldControl({id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":s.joinIds(We,Bt?jt:void 0),"aria-invalid":j!==null||Ge,"aria-required":Ke??Me}),Ht=oe.isInvalidLook(!1,Vt[`aria-invalid`]);se.useFormReset(K,()=>P(ye??null),je);let Q=Te&&!y&&C!==null,Ut=e=>{w&&(A(e.target.value),M(null))},Wt=r.composeEventHandlers(Ze,e=>{w&&!e.nativeEvent.isComposing&&(e.key===`Enter`&&k!==null?(e.preventDefault(),F(k)):e.key===`Tab`&&!e.shiftKey&&Q&&k!==null&&!k.trim()?(0,fe.flushSync)(()=>F(k)):e.key===`ArrowDown`&&e.altKey&&!D&&(e.preventDefault(),k!==null&&j===null&&F(k),V(!0),E(!0)))}),Gt=r.composeEventHandlers(Xe,()=>{w&&k!==null&&j===null&&F(k)}),Kt=()=>{w&&(Y.current=null,V(!1),E(!D))},qt=()=>{w&&(P(null),K.current?.focus())},Jt=e=>{e.preventDefault()},Yt=e=>{w&&!ft(e)&&(P(e),Mt(K.current))},Xt=e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),Mt(B?K.current:null))},Zt=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=(W.getDay()-b+7)%7,n;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=o.getArrowIntent(e.key,{orientation:`horizontal`,dir:o.getDirection(e.currentTarget)});n=u.addDays(W,t===`next`?1:-1);break}case`ArrowDown`:n=u.addDays(W,7);break;case`ArrowUp`:n=u.addDays(W,-7);break;case`PageDown`:n=u.addMonths(W,e.shiftKey?12:1);break;case`PageUp`:n=u.addMonths(W,e.shiftKey?-12:-1);break;case`Home`:n=u.addDays(W,-t);break;case`End`:n=u.addDays(W,6-t);break;default:return}e.preventDefault(),bt(n)},Qt=k??(C?O(C):``),$=``;return j===`unparseable`?$=(x?.invalidDate??pe)(S?void 0:u.getLocaleDateFormat(h).pattern):j===`out-of-range`&&(g||_)?$=(x?.outOfRange??me)(g?O(u.startOfDay(g)):void 0,_?O(u.startOfDay(_)):void 0):j===`disabled`&&($=x?.unavailableDate??`This date is not available.`),(0,f.jsxs)(`div`,{...nt,ref:tt,className:t.cn(`relative inline-flex flex-col`,et),children:[(0,f.jsxs)(`div`,{ref:Pt,className:`relative flex items-center`,children:[(0,f.jsx)(`input`,{ref:kt,type:`text`,...Vt,"aria-errormessage":qe,"aria-details":Je,value:Qt,onChange:Ut,onFocus:Ye,onBlur:Gt,onKeyDown:Wt,onKeyUp:Qe,placeholder:we,disabled:v,readOnly:y,autoComplete:Ne,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,className:t.cn(c.inputBase,`border-b-stroke-accessible`,c.inputFocus,c.disabledStyles,Ht&&`border-destructive focus:border-b-destructive`,Q?`pe-14`:`pe-8`)}),Q&&(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.clear??`Clear date`,disabled:v,onMouseDown:Jt,onClick:qt,className:t.cn(he,`end-7`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.DismissIcon,{})}),(0,f.jsx)(`button`,{ref:q,type:`button`,"aria-label":x?.openCalendar??`Open calendar`,"aria-haspopup":`dialog`,"aria-expanded":D,"aria-controls":D?At:void 0,disabled:v||y,onClick:Kt,className:t.cn(he,`end-1`,c.focusRing,c.disabledStyles),children:(0,f.jsx)(l.CalendarIcon,{})})]}),Bt&&(0,f.jsx)(`p`,{id:jt,role:`alert`,className:`mt-1 text-caption-1 text-error`,children:$}),(0,f.jsx)(ce.HiddenInput,{name:Ae,form:je,disabled:v,value:C?u.formatISODate(C):``,type:`text`,required:zt,onInvalid:()=>K.current?.focus()}),D&&(0,f.jsx)(ae.Portal,{layerId:Nt,children:(0,f.jsxs)(`div`,{ref:Lt,id:At,role:`dialog`,"aria-modal":`true`,"aria-labelledby":X,...It,"data-state":`open`,onKeyDown:Xt,className:`rounded-md border border-border bg-background p-3 text-foreground shadow-16`,children:[(0,f.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.previousMonth??`Previous month`,"aria-controls":Z,...s.focusableDisabledProps(Ct),onClick:s.preventIfDisabled(Ct,()=>xt(-1)),className:t.cn(ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronLeftIcon,{className:`wave-rtl:-scale-x-100`})}),(0,f.jsx)(`h2`,{id:X,"aria-live":`polite`,className:`text-body-1 font-semibold`,children:u.formatMonthYear(L,h)}),(0,f.jsx)(`button`,{type:`button`,"aria-label":x?.nextMonth??`Next month`,"aria-controls":Z,...s.focusableDisabledProps(wt),onClick:s.preventIfDisabled(wt,()=>xt(1)),className:t.cn(ge,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronRightIcon,{className:`wave-rtl:-scale-x-100`})})]}),(0,f.jsxs)(`table`,{ref:J,id:Z,role:`grid`,"aria-labelledby":X,onKeyDown:Zt,className:`border-collapse`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsx)(`tr`,{children:Tt.map(e=>(0,f.jsxs)(`th`,{scope:`col`,abbr:e.long,"aria-label":e.long,className:`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`,children:[(0,f.jsx)(`span`,{"aria-hidden":`true`,children:e.short}),(0,f.jsx)(`span`,{className:`sr-only`,children:e.long})]},e.long))})}),(0,f.jsx)(`tbody`,{children:H.map((e,n)=>(0,f.jsx)(`tr`,{children:e.map((e,n)=>{let r=u.formatISODate(e),i=u.isSameDay(e,C),a=u.isSameDay(e,I),o=r===G,ee=ft(e);return(0,f.jsx)(`td`,{role:`gridcell`,"aria-selected":i,className:`p-0`,children:(0,f.jsx)(`button`,{type:`button`,tabIndex:o?0:-1,"aria-label":u.formatDayLabel(e,h),"aria-pressed":i||void 0,"aria-current":a?`date`:void 0,...s.focusableDisabledProps(ee),"data-date":r,"data-selected":i?``:void 0,"data-today":a?``:void 0,"data-outside":u.isSameMonth(e,L)?void 0:``,onFocus:()=>St(e),onClick:()=>Yt(e),className:t.cn(_e,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`,i&&c.forcedColors.selectedLeaf),children:u.formatDayNumber(e,h)})},n)})},n))})]})]})})]})};p.displayName=`DatePicker`,exports.DatePicker=p;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/composeEventHandlers.cjs"),i=require("../../lib/classNames.cjs"),a=require("../../hooks/useControllable.cjs"),o=require("../../hooks/useId.cjs"),ee=require("../../lib/direction.cjs"),te=require("../../lib/focus.cjs"),ne=require("../../hooks/useMergedRefs.cjs"),re=require("../../hooks/useIsClient.cjs"),s=require("../../lib/aria.cjs"),ie=require("../../hooks/useFieldControl.cjs"),ae=require("../../hooks/useDismiss.cjs"),oe=require("../portal/Portal.cjs"),c=require("../../lib/styles.cjs"),l=require("../../lib/icons.cjs"),se=require("./Input.cjs"),ce=require("../../hooks/useFormReset.cjs"),le=require("../internal/HiddenInput.cjs"),ue=require("../../hooks/usePopupPosition.cjs"),u=require("./dateUtils.cjs"),de=require("../../hooks/useFocusTrap.cjs"),fe=require("../../hooks/useRestoreFocus.cjs");let d=require("react");d=e.__toESM(d,1);let f=require("react/jsx-runtime"),pe=require("react-dom");var me=e=>e?`Enter a date in the format ${e}.`:`Enter a valid date.`,he=(e,t)=>e!==void 0&&t!==void 0?`Enter a date between ${e} and ${t}.`:e===void 0?`Enter a date on or before ${t}.`:`Enter a date on or after ${e}.`,ge=`absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`,_e=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover`,ve=`flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`;function ye(e){let t=[];for(let n=0;n<e.length;n+=7)t.push(e.slice(n,n+7));return t}var p=e=>{let{value:p,defaultValue:be,onValueChange:xe,onChange:Se,formatDate:m,parseDate:h,locale:g,minDate:_,maxDate:v,disabledDates:Ce,placeholder:we=`Select a date`,disabled:y=!1,readOnly:b,clearable:Te=!1,firstDayOfWeek:x=0,open:Ee,defaultOpen:De,onOpenChange:Oe,onInvalidInput:ke,labels:S,name:Ae,form:je,required:Me,autoComplete:Ne=`off`,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":We,"aria-invalid":Ge,"aria-required":Ke,"aria-errormessage":qe,"aria-details":Je,onFocus:Ye,onBlur:Xe,onKeyDown:Ze,onKeyUp:Qe,controlRef:$e,className:et,ref:tt,...nt}=e;Se!==void 0&&n.warnDeprecated(`DatePicker`,`onChange`,`onValueChange`);let rt=m!==void 0,C=h!==void 0;d.useEffect(()=>{rt&&!C&&n.warnOnce(`DatePicker:formatDate-without-parseDate`,"DatePicker: `formatDate` is set without `parseDate`. Typed dates are parsed with the default parser for `locale` (its numeric format or yyyy-mm-dd), which may not read your format; pass `parseDate` as the inverse of `formatDate`.")},[rt,C]),d.useEffect(()=>{g!==void 0&&!u.isValidLocaleTag(g)&&n.warnOnce(`DatePicker:invalid-locale:${g}`,`DatePicker: \`locale\` "${g}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats and parses the dates instead, so the server and the browser may render different text.`)},[g]);let[w,it]=a.useControllable(p,be??null,e=>{xe?.(e),Se?.(e)}),T=!y&&!b,[E,D]=a.useControllable(Ee,(De??!1)&&T,Oe),at=re.useIsClient(),O=E&&T&&at,ot=Ee!==void 0;d.useEffect(()=>{!T&&E&&!ot&&D(!1)},[T,E,ot,D]);let k=e=>m?m(e):u.formatDate(e,g),st=e=>h?h(e):u.parseDate(e,g),[A,j]=d.useState(null),[M,N]=d.useState(null),[ct,lt]=d.useState(T);ct!==T&&(lt(T),T||(j(null),N(null)));let P=w?u.formatISODate(w):``,[ut,dt]=d.useState(P);ut!==P&&(dt(P),M!==null&&(j(null),N(null)));let ft=e=>!u.isDateInRange(e,_,v)||!!Ce?.(u.startOfDay(e)),F=e=>{let t=e?u.startOfDay(e):null;(t?u.isSameDay(t,w):w===null)||it(t),j(null),N(null)},I=e=>{if(!e.trim())return F(null),!0;let t=st(e),n=null;if(!t||Number.isNaN(t.getTime())?n=`unparseable`:u.isDateInRange(t,_,v)?Ce?.(u.startOfDay(t))&&(n=`disabled`):n=`out-of-range`,n||!t){let t=n??`unparseable`;return N(t),ke?.(e,t),!1}return F(t),!0},L=u.startOfDay(new Date),pt=()=>u.startOfMonth(u.clampDate(w??L,_,v)),[R,z]=d.useState(pt),[mt,B]=d.useState(null),[V,H]=d.useState(!1),[ht,gt]=d.useState(O);ht!==O&&(gt(O),O&&(z(pt()),B(null))),V&&!O&&H(!1);let U=d.useMemo(()=>ye(u.getCalendarDays(R,x)),[R,x]),W=e=>!!e&&u.isSameMonth(e,R),_t=e=>!!e&&e>=U[0][0]&&e<=U[U.length-1][6],vt=u.clampDate(L,_,v),yt=u.clampDate(R,_,v),G=_t(mt)?mt:W(w)?u.startOfDay(w):W(vt)?vt:W(yt)?yt:R,K=u.formatISODate(G),bt=e=>{let t=u.clampDate(e,_,v);B(t),u.isSameMonth(t,R)||z(u.startOfMonth(t))},xt=e=>{let t=u.addMonths(R,e),n=u.clampDate(u.addMonths(G,e),_,v);z(t),B(u.isSameMonth(n,t)?n:null)},St=e=>{u.isSameDay(e,G)||B(e)},Ct=!!_&&u.addDays(R,-1)<u.startOfDay(_),wt=!!v&&u.addMonths(R,1)>u.startOfDay(v),Tt=d.useMemo(()=>u.getWeekdayNames(g,x),[g,x]),q=d.useRef(null),J=d.useRef(null),Y=d.useRef(null),Et=d.useRef(null),X=d.useRef(null),[Dt,Ot]=d.useState(null),kt=ne.useMergedRefs($e,q),At=o.useId(`datepicker-dialog`),Z=o.useId(`datepicker-heading`),Q=o.useId(`datepicker-grid`),jt=o.useId(`datepicker-error`),Mt=e=>{X.current=e,D(!1)},{layerId:Nt}=ae.useDismiss({open:O,onDismiss:(e,t)=>{let n=e===`outside-press`&&t.target instanceof Element?t.target.closest(te.FOCUSABLE_SELECTOR):null;Mt(n??(V?q.current:null))},refs:[Et,J],anchorRef:J,kind:`modal`}),{setReference:Pt,setFloating:Ft,floatingProps:It}=ue.usePopupPosition({open:O,side:`bottom`,align:`start`}),Lt=ne.useMergedRefs(Et,Ot,Ft);de.useFocusTrap(Dt,{enabled:O,layerId:Nt,initialFocus:()=>Y.current?.querySelector(`button[tabindex="0"]`)??null}),fe.useRestoreFocus({enabled:O,container:Dt,triggerRef:J,finalFocusRef:X,onlyIfFocusInside:!0}),d.useLayoutEffect(()=>{O&&(X.current=null)},[O]),d.useLayoutEffect(()=>{let e=Y.current;if(!e)return;let t=e.ownerDocument.activeElement;if(!t||!e.contains(t))return;let n=e.querySelector(`button[data-date="${K}"]`);n&&n!==t&&n.focus()},[K]);let Rt=ie.useFieldContext(),zt=(Me??Rt?.required??!1)&&!b,Bt=M!==null&&!Rt?.hasErrorMessage,Vt=ie.useFieldControl({id:Ve,"aria-label":He,"aria-labelledby":Ue,"aria-describedby":s.joinIds(We,Bt?jt:void 0),"aria-invalid":M!==null||Ge,"aria-required":Ke??Me}),Ht=se.isInvalidLook(!1,Vt[`aria-invalid`]);ce.useFormReset(q,()=>F(be??null),je);let Ut=Te&&!b&&w!==null,Wt=e=>{T&&(j(e.target.value),N(null))},Gt=r.composeEventHandlers(Ze,e=>{T&&!e.nativeEvent.isComposing&&(e.key===`Enter`&&A!==null?(e.preventDefault(),I(A)):e.key===`Tab`&&!e.shiftKey&&Ut&&A!==null&&!A.trim()?(0,pe.flushSync)(()=>I(A)):e.key===`ArrowDown`&&e.altKey&&!O&&(e.preventDefault(),A!==null&&M===null&&I(A),H(!0),D(!0)))}),Kt=r.composeEventHandlers(Xe,()=>{T&&A!==null&&M===null&&I(A)}),qt=()=>{T&&(X.current=null,H(!1),D(!O))},Jt=()=>{T&&(F(null),q.current?.focus())},Yt=e=>{e.preventDefault()},Xt=e=>{T&&!ft(e)&&(F(e),Mt(q.current))},Zt=e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),Mt(V?q.current:null))},Qt=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=(G.getDay()-x+7)%7,n;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=ee.getArrowIntent(e.key,{orientation:`horizontal`,dir:ee.getDirection(e.currentTarget)});n=u.addDays(G,t===`next`?1:-1);break}case`ArrowDown`:n=u.addDays(G,7);break;case`ArrowUp`:n=u.addDays(G,-7);break;case`PageDown`:n=u.addMonths(G,e.shiftKey?12:1);break;case`PageUp`:n=u.addMonths(G,e.shiftKey?-12:-1);break;case`Home`:n=u.addDays(G,-t);break;case`End`:n=u.addDays(G,6-t);break;default:return}e.preventDefault(),bt(n)},$t=A??(w?k(w):``),$=``;return M===`unparseable`?$=(S?.invalidDate??me)(C?void 0:u.getLocaleDateFormat(g).pattern):M===`out-of-range`&&(_||v)?$=(S?.outOfRange??he)(_?k(u.startOfDay(_)):void 0,v?k(u.startOfDay(v)):void 0):M===`disabled`&&($=S?.unavailableDate??`This date is not available.`),(0,f.jsxs)(`div`,{...nt,ref:tt,className:t.cn(i.datePickerClassNames.root,`relative inline-flex flex-col`,et),children:[(0,f.jsxs)(`div`,{ref:Pt,className:`relative flex items-center`,children:[(0,f.jsx)(`input`,{ref:kt,type:`text`,...Vt,"aria-errormessage":qe,"aria-details":Je,value:$t,onChange:Wt,onFocus:Ye,onBlur:Kt,onKeyDown:Gt,onKeyUp:Qe,placeholder:we,disabled:y,readOnly:b,autoComplete:Ne,autoCapitalize:Pe,autoCorrect:Fe,enterKeyHint:Ie,inputMode:Le,spellCheck:Re,autoFocus:ze,tabIndex:Be,className:t.cn(i.datePickerClassNames.input,c.inputBase,`border-b-stroke-accessible`,c.inputFocus,c.disabledStyles,Ht&&`border-destructive focus:border-b-destructive`,Ut?`pe-14`:`pe-8`)}),Ut&&(0,f.jsx)(`button`,{type:`button`,"aria-label":S?.clear??`Clear date`,disabled:y,onMouseDown:Yt,onClick:Jt,className:t.cn(i.datePickerClassNames.clearButton,ge,`end-7`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.DismissIcon,{})}),(0,f.jsx)(`button`,{ref:J,type:`button`,"aria-label":S?.openCalendar??`Open calendar`,"aria-haspopup":`dialog`,"aria-expanded":O,"aria-controls":O?At:void 0,disabled:y||b,onClick:qt,className:t.cn(i.datePickerClassNames.openCalendarButton,ge,`end-1`,c.focusRing,c.disabledStyles),children:(0,f.jsx)(l.CalendarIcon,{})})]}),Bt&&(0,f.jsx)(`p`,{id:jt,role:`alert`,className:t.cn(i.datePickerClassNames.errorMessage,`mt-1 text-caption-1 text-error`),children:$}),(0,f.jsx)(le.HiddenInput,{name:Ae,form:je,disabled:y,value:w?u.formatISODate(w):``,type:`text`,required:zt,onInvalid:()=>q.current?.focus()}),O&&(0,f.jsx)(oe.Portal,{layerId:Nt,children:(0,f.jsxs)(`div`,{ref:Lt,id:At,role:`dialog`,"aria-modal":`true`,"aria-labelledby":Z,...It,"data-state":`open`,onKeyDown:Zt,className:t.cn(i.datePickerClassNames.surface,`rounded-md border border-border bg-background p-3 text-foreground shadow-16`),children:[(0,f.jsxs)(`div`,{className:t.cn(i.datePickerClassNames.header,`mb-2 flex items-center justify-between gap-2`),children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":S?.previousMonth??`Previous month`,"aria-controls":Q,...s.focusableDisabledProps(Ct),onClick:s.preventIfDisabled(Ct,()=>xt(-1)),className:t.cn(i.datePickerClassNames.previousMonthButton,_e,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronLeftIcon,{className:`wave-rtl:-scale-x-100`})}),(0,f.jsx)(`h2`,{id:Z,"aria-live":`polite`,className:t.cn(i.datePickerClassNames.heading,`text-body-1 font-semibold`),children:u.formatMonthYear(R,g)}),(0,f.jsx)(`button`,{type:`button`,"aria-label":S?.nextMonth??`Next month`,"aria-controls":Q,...s.focusableDisabledProps(wt),onClick:s.preventIfDisabled(wt,()=>xt(1)),className:t.cn(i.datePickerClassNames.nextMonthButton,_e,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`),children:(0,f.jsx)(l.ChevronRightIcon,{className:`wave-rtl:-scale-x-100`})})]}),(0,f.jsxs)(`table`,{ref:Y,id:Q,role:`grid`,"aria-labelledby":Z,onKeyDown:Qt,className:t.cn(i.datePickerClassNames.grid,`border-collapse`),children:[(0,f.jsx)(`thead`,{children:(0,f.jsx)(`tr`,{children:Tt.map(e=>(0,f.jsxs)(`th`,{scope:`col`,abbr:e.long,"aria-label":e.long,className:t.cn(i.datePickerClassNames.weekday,`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`),children:[(0,f.jsx)(`span`,{"aria-hidden":`true`,children:e.short}),(0,f.jsx)(`span`,{className:`sr-only`,children:e.long})]},e.long))})}),(0,f.jsx)(`tbody`,{children:U.map((e,n)=>(0,f.jsx)(`tr`,{children:e.map((e,n)=>{let r=u.formatISODate(e),a=u.isSameDay(e,w),o=u.isSameDay(e,L),ee=r===K,te=ft(e);return(0,f.jsx)(`td`,{role:`gridcell`,"aria-selected":a,className:`p-0`,children:(0,f.jsx)(`button`,{type:`button`,tabIndex:ee?0:-1,"aria-label":u.formatDayLabel(e,g),"aria-pressed":a||void 0,"aria-current":o?`date`:void 0,...s.focusableDisabledProps(te),"data-date":r,"data-selected":a?``:void 0,"data-today":o?``:void 0,"data-outside":u.isSameMonth(e,R)?void 0:``,onFocus:()=>St(e),onClick:()=>Xt(e),className:t.cn(i.datePickerClassNames.day,ve,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,`disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100`,a&&c.forcedColors.selectedLeaf),children:u.formatDayNumber(e,g)})},n)})},n))})]})]})})]})};p.displayName=`DatePicker`,exports.DatePicker=p;
2
2
  //# sourceMappingURL=DatePicker.cjs.map