@cimpress-ui/react 0.0.0 → 0.1.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 (411) hide show
  1. package/README.md +6 -2
  2. package/dist/commonjs/components/button/button.d.ts +6 -1
  3. package/dist/commonjs/components/button/button.d.ts.map +1 -1
  4. package/dist/commonjs/components/button/button.js +16 -3
  5. package/dist/commonjs/components/button/button.js.map +1 -1
  6. package/dist/commonjs/components/button/constants.d.ts +3 -0
  7. package/dist/commonjs/components/button/constants.d.ts.map +1 -0
  8. package/dist/commonjs/components/button/constants.js +9 -0
  9. package/dist/commonjs/components/button/constants.js.map +1 -0
  10. package/dist/commonjs/components/button/icon-button.d.ts +6 -1
  11. package/dist/commonjs/components/button/icon-button.d.ts.map +1 -1
  12. package/dist/commonjs/components/button/icon-button.js +16 -3
  13. package/dist/commonjs/components/button/icon-button.js.map +1 -1
  14. package/dist/commonjs/components/button/icon-link-button.d.ts +9 -3
  15. package/dist/commonjs/components/button/icon-link-button.d.ts.map +1 -1
  16. package/dist/commonjs/components/button/icon-link-button.js +6 -0
  17. package/dist/commonjs/components/button/icon-link-button.js.map +1 -1
  18. package/dist/commonjs/components/button/link-button.d.ts +9 -3
  19. package/dist/commonjs/components/button/link-button.d.ts.map +1 -1
  20. package/dist/commonjs/components/button/link-button.js +6 -0
  21. package/dist/commonjs/components/button/link-button.js.map +1 -1
  22. package/dist/commonjs/components/button/types.d.ts +12 -6
  23. package/dist/commonjs/components/button/types.d.ts.map +1 -1
  24. package/dist/commonjs/components/button/types.js.map +1 -1
  25. package/dist/commonjs/components/checkbox/checkbox-group.d.ts +14 -4
  26. package/dist/commonjs/components/checkbox/checkbox-group.d.ts.map +1 -1
  27. package/dist/commonjs/components/checkbox/checkbox-group.js +16 -10
  28. package/dist/commonjs/components/checkbox/checkbox-group.js.map +1 -1
  29. package/dist/commonjs/components/checkbox/checkbox.d.ts +9 -4
  30. package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
  31. package/dist/commonjs/components/checkbox/checkbox.js +7 -1
  32. package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
  33. package/dist/commonjs/components/combo-box/combo-box.d.ts +25 -24
  34. package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
  35. package/dist/commonjs/components/combo-box/combo-box.js +31 -16
  36. package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
  37. package/dist/commonjs/components/form/form.d.ts +8 -3
  38. package/dist/commonjs/components/form/form.d.ts.map +1 -1
  39. package/dist/commonjs/components/form/form.js +6 -0
  40. package/dist/commonjs/components/form/form.js.map +1 -1
  41. package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts +16 -0
  42. package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -0
  43. package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js +17 -0
  44. package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js.map +1 -0
  45. package/dist/commonjs/components/internal/form-field/form-field.d.ts +29 -0
  46. package/dist/commonjs/components/internal/form-field/form-field.d.ts.map +1 -0
  47. package/dist/commonjs/components/internal/form-field/form-field.js +56 -0
  48. package/dist/commonjs/components/internal/form-field/form-field.js.map +1 -0
  49. package/dist/commonjs/components/internal/spinner/spinner.d.ts +18 -0
  50. package/dist/commonjs/components/internal/spinner/spinner.d.ts.map +1 -0
  51. package/dist/commonjs/components/internal/spinner/spinner.js +19 -0
  52. package/dist/commonjs/components/internal/spinner/spinner.js.map +1 -0
  53. package/dist/commonjs/components/menu/menu.d.ts +26 -15
  54. package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
  55. package/dist/commonjs/components/menu/menu.js +38 -15
  56. package/dist/commonjs/components/menu/menu.js.map +1 -1
  57. package/dist/commonjs/components/radio/radio-group.d.ts +14 -4
  58. package/dist/commonjs/components/radio/radio-group.d.ts.map +1 -1
  59. package/dist/commonjs/components/radio/radio-group.js +16 -10
  60. package/dist/commonjs/components/radio/radio-group.js.map +1 -1
  61. package/dist/commonjs/components/radio/radio.d.ts +9 -4
  62. package/dist/commonjs/components/radio/radio.d.ts.map +1 -1
  63. package/dist/commonjs/components/radio/radio.js +6 -0
  64. package/dist/commonjs/components/radio/radio.js.map +1 -1
  65. package/dist/commonjs/components/select/select.d.ts +27 -24
  66. package/dist/commonjs/components/select/select.d.ts.map +1 -1
  67. package/dist/commonjs/components/select/select.js +33 -14
  68. package/dist/commonjs/components/select/select.js.map +1 -1
  69. package/dist/commonjs/components/spacing/box/box.d.ts +5 -3
  70. package/dist/commonjs/components/spacing/box/box.d.ts.map +1 -1
  71. package/dist/commonjs/components/spacing/box/box.js +2 -0
  72. package/dist/commonjs/components/spacing/box/box.js.map +1 -1
  73. package/dist/commonjs/components/spacing/stack/stack.d.ts +28 -4
  74. package/dist/commonjs/components/spacing/stack/stack.d.ts.map +1 -1
  75. package/dist/commonjs/components/spacing/stack/stack.js +11 -3
  76. package/dist/commonjs/components/spacing/stack/stack.js.map +1 -1
  77. package/dist/commonjs/components/spacing/types.d.ts +9 -0
  78. package/dist/commonjs/components/spacing/types.d.ts.map +1 -1
  79. package/dist/commonjs/components/spacing/types.js +6 -0
  80. package/dist/commonjs/components/spacing/types.js.map +1 -1
  81. package/dist/commonjs/components/spinner/spinner.d.ts +12 -5
  82. package/dist/commonjs/components/spinner/spinner.d.ts.map +1 -1
  83. package/dist/commonjs/components/spinner/spinner.js +26 -14
  84. package/dist/commonjs/components/spinner/spinner.js.map +1 -1
  85. package/dist/commonjs/components/text-inputs/text-area.d.ts +4 -3
  86. package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
  87. package/dist/commonjs/components/text-inputs/text-area.js +13 -3
  88. package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
  89. package/dist/commonjs/components/text-inputs/text-field.d.ts +8 -3
  90. package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
  91. package/dist/commonjs/components/text-inputs/text-field.js +14 -1
  92. package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
  93. package/dist/commonjs/components/types.d.ts +80 -12
  94. package/dist/commonjs/components/types.d.ts.map +1 -1
  95. package/dist/commonjs/components/types.js.map +1 -1
  96. package/dist/commonjs/components/typography/link.d.ts +8 -3
  97. package/dist/commonjs/components/typography/link.d.ts.map +1 -1
  98. package/dist/commonjs/components/typography/link.js +9 -1
  99. package/dist/commonjs/components/typography/link.js.map +1 -1
  100. package/dist/commonjs/components/typography/text.d.ts +7 -2
  101. package/dist/commonjs/components/typography/text.d.ts.map +1 -1
  102. package/dist/commonjs/components/typography/text.js +6 -0
  103. package/dist/commonjs/components/typography/text.js.map +1 -1
  104. package/dist/commonjs/components/typography/types.d.ts +4 -3
  105. package/dist/commonjs/components/typography/types.d.ts.map +1 -1
  106. package/dist/commonjs/components/typography/types.js.map +1 -1
  107. package/dist/commonjs/components/typography/utils.d.ts +1 -0
  108. package/dist/commonjs/components/typography/utils.d.ts.map +1 -1
  109. package/dist/commonjs/components/typography/utils.js +1 -0
  110. package/dist/commonjs/components/typography/utils.js.map +1 -1
  111. package/dist/commonjs/forward-ref.d.ts +2 -2
  112. package/dist/commonjs/forward-ref.d.ts.map +1 -1
  113. package/dist/commonjs/forward-ref.js +1 -0
  114. package/dist/commonjs/forward-ref.js.map +1 -1
  115. package/dist/commonjs/icons/accounting-document.d.ts +8 -0
  116. package/dist/commonjs/icons/accounting-document.d.ts.map +1 -0
  117. package/dist/commonjs/icons/accounting-document.js +22 -0
  118. package/dist/commonjs/icons/accounting-document.js.map +1 -0
  119. package/dist/commonjs/icons/add-circle-fill.d.ts +8 -0
  120. package/dist/commonjs/icons/add-circle-fill.d.ts.map +1 -0
  121. package/dist/commonjs/icons/add-circle-fill.js +22 -0
  122. package/dist/commonjs/icons/add-circle-fill.js.map +1 -0
  123. package/dist/commonjs/icons/add-circle.d.ts +8 -0
  124. package/dist/commonjs/icons/add-circle.d.ts.map +1 -0
  125. package/dist/commonjs/icons/add-circle.js +22 -0
  126. package/dist/commonjs/icons/add-circle.js.map +1 -0
  127. package/dist/commonjs/icons/add.d.ts +3 -2
  128. package/dist/commonjs/icons/add.d.ts.map +1 -1
  129. package/dist/commonjs/icons/add.js +17 -2
  130. package/dist/commonjs/icons/add.js.map +1 -1
  131. package/dist/commonjs/icons/alert-triangle.d.ts +3 -2
  132. package/dist/commonjs/icons/alert-triangle.d.ts.map +1 -1
  133. package/dist/commonjs/icons/alert-triangle.js +17 -2
  134. package/dist/commonjs/icons/alert-triangle.js.map +1 -1
  135. package/dist/commonjs/icons/calculator-alt.d.ts +8 -0
  136. package/dist/commonjs/icons/calculator-alt.d.ts.map +1 -0
  137. package/dist/commonjs/icons/calculator-alt.js +22 -0
  138. package/dist/commonjs/icons/calculator-alt.js.map +1 -0
  139. package/dist/commonjs/icons/calculator.d.ts +8 -0
  140. package/dist/commonjs/icons/calculator.d.ts.map +1 -0
  141. package/dist/commonjs/icons/calculator.js +22 -0
  142. package/dist/commonjs/icons/calculator.js.map +1 -0
  143. package/dist/commonjs/icons/checkmark-circle-fill.d.ts +8 -0
  144. package/dist/commonjs/icons/checkmark-circle-fill.d.ts.map +1 -0
  145. package/dist/commonjs/icons/checkmark-circle-fill.js +22 -0
  146. package/dist/commonjs/icons/checkmark-circle-fill.js.map +1 -0
  147. package/dist/commonjs/icons/checkmark-circle.d.ts +8 -0
  148. package/dist/commonjs/icons/checkmark-circle.d.ts.map +1 -0
  149. package/dist/commonjs/icons/checkmark-circle.js +22 -0
  150. package/dist/commonjs/icons/checkmark-circle.js.map +1 -0
  151. package/dist/commonjs/icons/checkmark-small.d.ts +3 -2
  152. package/dist/commonjs/icons/checkmark-small.d.ts.map +1 -1
  153. package/dist/commonjs/icons/checkmark-small.js +17 -2
  154. package/dist/commonjs/icons/checkmark-small.js.map +1 -1
  155. package/dist/commonjs/icons/checkmark.d.ts +8 -0
  156. package/dist/commonjs/icons/checkmark.d.ts.map +1 -0
  157. package/dist/commonjs/icons/checkmark.js +22 -0
  158. package/dist/commonjs/icons/checkmark.js.map +1 -0
  159. package/dist/commonjs/icons/chevron-down-fill.d.ts +8 -0
  160. package/dist/commonjs/icons/chevron-down-fill.d.ts.map +1 -0
  161. package/dist/commonjs/icons/chevron-down-fill.js +22 -0
  162. package/dist/commonjs/icons/chevron-down-fill.js.map +1 -0
  163. package/dist/commonjs/icons/error-circle-fill.d.ts +8 -0
  164. package/dist/commonjs/icons/error-circle-fill.d.ts.map +1 -0
  165. package/dist/commonjs/icons/error-circle-fill.js +22 -0
  166. package/dist/commonjs/icons/error-circle-fill.js.map +1 -0
  167. package/dist/commonjs/icons/index.d.ts +13 -0
  168. package/dist/commonjs/icons/index.d.ts.map +1 -1
  169. package/dist/commonjs/icons/index.js +25 -1
  170. package/dist/commonjs/icons/index.js.map +1 -1
  171. package/dist/commonjs/icons/info-circle-fill.d.ts +8 -0
  172. package/dist/commonjs/icons/info-circle-fill.d.ts.map +1 -0
  173. package/dist/commonjs/icons/info-circle-fill.js +22 -0
  174. package/dist/commonjs/icons/info-circle-fill.js.map +1 -0
  175. package/dist/commonjs/icons/minus-small.d.ts +3 -2
  176. package/dist/commonjs/icons/minus-small.d.ts.map +1 -1
  177. package/dist/commonjs/icons/minus-small.js +17 -2
  178. package/dist/commonjs/icons/minus-small.js.map +1 -1
  179. package/dist/commonjs/icons/warning-circle-fill.d.ts +8 -0
  180. package/dist/commonjs/icons/warning-circle-fill.d.ts.map +1 -0
  181. package/dist/commonjs/icons/warning-circle-fill.js +22 -0
  182. package/dist/commonjs/icons/warning-circle-fill.js.map +1 -0
  183. package/dist/commonjs/index.d.ts +13 -11
  184. package/dist/commonjs/index.d.ts.map +1 -1
  185. package/dist/commonjs/index.js +11 -10
  186. package/dist/commonjs/index.js.map +1 -1
  187. package/dist/commonjs/providers/router/router-provider.d.ts +20 -0
  188. package/dist/commonjs/providers/router/router-provider.d.ts.map +1 -0
  189. package/dist/commonjs/providers/router/router-provider.js +15 -0
  190. package/dist/commonjs/providers/router/router-provider.js.map +1 -0
  191. package/dist/commonjs/providers/ssr/ssr-provider.d.ts +7 -3
  192. package/dist/commonjs/providers/ssr/ssr-provider.d.ts.map +1 -1
  193. package/dist/commonjs/providers/ssr/ssr-provider.js +3 -1
  194. package/dist/commonjs/providers/ssr/ssr-provider.js.map +1 -1
  195. package/dist/commonjs/with-style-props.d.ts +17 -11
  196. package/dist/commonjs/with-style-props.d.ts.map +1 -1
  197. package/dist/commonjs/with-style-props.js.map +1 -1
  198. package/dist/esm/components/button/button.d.ts +6 -1
  199. package/dist/esm/components/button/button.d.ts.map +1 -1
  200. package/dist/esm/components/button/button.js +16 -3
  201. package/dist/esm/components/button/button.js.map +1 -1
  202. package/dist/esm/components/button/constants.d.ts +3 -0
  203. package/dist/esm/components/button/constants.d.ts.map +1 -0
  204. package/dist/esm/components/button/constants.js +6 -0
  205. package/dist/esm/components/button/constants.js.map +1 -0
  206. package/dist/esm/components/button/icon-button.d.ts +6 -1
  207. package/dist/esm/components/button/icon-button.d.ts.map +1 -1
  208. package/dist/esm/components/button/icon-button.js +16 -3
  209. package/dist/esm/components/button/icon-button.js.map +1 -1
  210. package/dist/esm/components/button/icon-link-button.d.ts +9 -3
  211. package/dist/esm/components/button/icon-link-button.d.ts.map +1 -1
  212. package/dist/esm/components/button/icon-link-button.js +6 -0
  213. package/dist/esm/components/button/icon-link-button.js.map +1 -1
  214. package/dist/esm/components/button/link-button.d.ts +9 -3
  215. package/dist/esm/components/button/link-button.d.ts.map +1 -1
  216. package/dist/esm/components/button/link-button.js +6 -0
  217. package/dist/esm/components/button/link-button.js.map +1 -1
  218. package/dist/esm/components/button/types.d.ts +12 -6
  219. package/dist/esm/components/button/types.d.ts.map +1 -1
  220. package/dist/esm/components/button/types.js.map +1 -1
  221. package/dist/esm/components/checkbox/checkbox-group.d.ts +14 -4
  222. package/dist/esm/components/checkbox/checkbox-group.d.ts.map +1 -1
  223. package/dist/esm/components/checkbox/checkbox-group.js +16 -10
  224. package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
  225. package/dist/esm/components/checkbox/checkbox.d.ts +9 -4
  226. package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
  227. package/dist/esm/components/checkbox/checkbox.js +7 -1
  228. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  229. package/dist/esm/components/combo-box/combo-box.d.ts +25 -24
  230. package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
  231. package/dist/esm/components/combo-box/combo-box.js +35 -22
  232. package/dist/esm/components/combo-box/combo-box.js.map +1 -1
  233. package/dist/esm/components/form/form.d.ts +8 -3
  234. package/dist/esm/components/form/form.d.ts.map +1 -1
  235. package/dist/esm/components/form/form.js +6 -0
  236. package/dist/esm/components/form/form.js.map +1 -1
  237. package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts +16 -0
  238. package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -0
  239. package/dist/esm/components/internal/collapsible-list/collapsible-list.js +14 -0
  240. package/dist/esm/components/internal/collapsible-list/collapsible-list.js.map +1 -0
  241. package/dist/esm/components/internal/form-field/form-field.d.ts +29 -0
  242. package/dist/esm/components/internal/form-field/form-field.d.ts.map +1 -0
  243. package/dist/esm/components/internal/form-field/form-field.js +48 -0
  244. package/dist/esm/components/internal/form-field/form-field.js.map +1 -0
  245. package/dist/esm/components/internal/spinner/spinner.d.ts +18 -0
  246. package/dist/esm/components/internal/spinner/spinner.d.ts.map +1 -0
  247. package/dist/esm/components/internal/spinner/spinner.js +14 -0
  248. package/dist/esm/components/internal/spinner/spinner.js.map +1 -0
  249. package/dist/esm/components/menu/menu.d.ts +26 -15
  250. package/dist/esm/components/menu/menu.d.ts.map +1 -1
  251. package/dist/esm/components/menu/menu.js +39 -16
  252. package/dist/esm/components/menu/menu.js.map +1 -1
  253. package/dist/esm/components/radio/radio-group.d.ts +14 -4
  254. package/dist/esm/components/radio/radio-group.d.ts.map +1 -1
  255. package/dist/esm/components/radio/radio-group.js +16 -10
  256. package/dist/esm/components/radio/radio-group.js.map +1 -1
  257. package/dist/esm/components/radio/radio.d.ts +9 -4
  258. package/dist/esm/components/radio/radio.d.ts.map +1 -1
  259. package/dist/esm/components/radio/radio.js +6 -0
  260. package/dist/esm/components/radio/radio.js.map +1 -1
  261. package/dist/esm/components/select/select.d.ts +27 -24
  262. package/dist/esm/components/select/select.d.ts.map +1 -1
  263. package/dist/esm/components/select/select.js +35 -18
  264. package/dist/esm/components/select/select.js.map +1 -1
  265. package/dist/esm/components/spacing/box/box.d.ts +5 -3
  266. package/dist/esm/components/spacing/box/box.d.ts.map +1 -1
  267. package/dist/esm/components/spacing/box/box.js +2 -0
  268. package/dist/esm/components/spacing/box/box.js.map +1 -1
  269. package/dist/esm/components/spacing/stack/stack.d.ts +28 -4
  270. package/dist/esm/components/spacing/stack/stack.d.ts.map +1 -1
  271. package/dist/esm/components/spacing/stack/stack.js +11 -3
  272. package/dist/esm/components/spacing/stack/stack.js.map +1 -1
  273. package/dist/esm/components/spacing/types.d.ts +9 -0
  274. package/dist/esm/components/spacing/types.d.ts.map +1 -1
  275. package/dist/esm/components/spacing/types.js +6 -0
  276. package/dist/esm/components/spacing/types.js.map +1 -1
  277. package/dist/esm/components/spinner/spinner.d.ts +12 -5
  278. package/dist/esm/components/spinner/spinner.d.ts.map +1 -1
  279. package/dist/esm/components/spinner/spinner.js +28 -13
  280. package/dist/esm/components/spinner/spinner.js.map +1 -1
  281. package/dist/esm/components/text-inputs/text-area.d.ts +4 -3
  282. package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
  283. package/dist/esm/components/text-inputs/text-area.js +13 -3
  284. package/dist/esm/components/text-inputs/text-area.js.map +1 -1
  285. package/dist/esm/components/text-inputs/text-field.d.ts +8 -3
  286. package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
  287. package/dist/esm/components/text-inputs/text-field.js +14 -1
  288. package/dist/esm/components/text-inputs/text-field.js.map +1 -1
  289. package/dist/esm/components/types.d.ts +80 -12
  290. package/dist/esm/components/types.d.ts.map +1 -1
  291. package/dist/esm/components/types.js.map +1 -1
  292. package/dist/esm/components/typography/link.d.ts +8 -3
  293. package/dist/esm/components/typography/link.d.ts.map +1 -1
  294. package/dist/esm/components/typography/link.js +10 -2
  295. package/dist/esm/components/typography/link.js.map +1 -1
  296. package/dist/esm/components/typography/text.d.ts +7 -2
  297. package/dist/esm/components/typography/text.d.ts.map +1 -1
  298. package/dist/esm/components/typography/text.js +6 -0
  299. package/dist/esm/components/typography/text.js.map +1 -1
  300. package/dist/esm/components/typography/types.d.ts +4 -3
  301. package/dist/esm/components/typography/types.d.ts.map +1 -1
  302. package/dist/esm/components/typography/types.js.map +1 -1
  303. package/dist/esm/components/typography/utils.d.ts +1 -0
  304. package/dist/esm/components/typography/utils.d.ts.map +1 -1
  305. package/dist/esm/components/typography/utils.js +1 -0
  306. package/dist/esm/components/typography/utils.js.map +1 -1
  307. package/dist/esm/forward-ref.d.ts +2 -2
  308. package/dist/esm/forward-ref.d.ts.map +1 -1
  309. package/dist/esm/forward-ref.js +1 -0
  310. package/dist/esm/forward-ref.js.map +1 -1
  311. package/dist/esm/icons/accounting-document.d.ts +8 -0
  312. package/dist/esm/icons/accounting-document.d.ts.map +1 -0
  313. package/dist/esm/icons/accounting-document.js +17 -0
  314. package/dist/esm/icons/accounting-document.js.map +1 -0
  315. package/dist/esm/icons/add-circle-fill.d.ts +8 -0
  316. package/dist/esm/icons/add-circle-fill.d.ts.map +1 -0
  317. package/dist/esm/icons/add-circle-fill.js +17 -0
  318. package/dist/esm/icons/add-circle-fill.js.map +1 -0
  319. package/dist/esm/icons/add-circle.d.ts +8 -0
  320. package/dist/esm/icons/add-circle.d.ts.map +1 -0
  321. package/dist/esm/icons/add-circle.js +17 -0
  322. package/dist/esm/icons/add-circle.js.map +1 -0
  323. package/dist/esm/icons/add.d.ts +3 -2
  324. package/dist/esm/icons/add.d.ts.map +1 -1
  325. package/dist/esm/icons/add.js +15 -3
  326. package/dist/esm/icons/add.js.map +1 -1
  327. package/dist/esm/icons/alert-triangle.d.ts +3 -2
  328. package/dist/esm/icons/alert-triangle.d.ts.map +1 -1
  329. package/dist/esm/icons/alert-triangle.js +14 -2
  330. package/dist/esm/icons/alert-triangle.js.map +1 -1
  331. package/dist/esm/icons/calculator-alt.d.ts +8 -0
  332. package/dist/esm/icons/calculator-alt.d.ts.map +1 -0
  333. package/dist/esm/icons/calculator-alt.js +17 -0
  334. package/dist/esm/icons/calculator-alt.js.map +1 -0
  335. package/dist/esm/icons/calculator.d.ts +8 -0
  336. package/dist/esm/icons/calculator.d.ts.map +1 -0
  337. package/dist/esm/icons/calculator.js +17 -0
  338. package/dist/esm/icons/calculator.js.map +1 -0
  339. package/dist/esm/icons/checkmark-circle-fill.d.ts +8 -0
  340. package/dist/esm/icons/checkmark-circle-fill.d.ts.map +1 -0
  341. package/dist/esm/icons/checkmark-circle-fill.js +17 -0
  342. package/dist/esm/icons/checkmark-circle-fill.js.map +1 -0
  343. package/dist/esm/icons/checkmark-circle.d.ts +8 -0
  344. package/dist/esm/icons/checkmark-circle.d.ts.map +1 -0
  345. package/dist/esm/icons/checkmark-circle.js +17 -0
  346. package/dist/esm/icons/checkmark-circle.js.map +1 -0
  347. package/dist/esm/icons/checkmark-small.d.ts +3 -2
  348. package/dist/esm/icons/checkmark-small.d.ts.map +1 -1
  349. package/dist/esm/icons/checkmark-small.js +14 -2
  350. package/dist/esm/icons/checkmark-small.js.map +1 -1
  351. package/dist/esm/icons/checkmark.d.ts +8 -0
  352. package/dist/esm/icons/checkmark.d.ts.map +1 -0
  353. package/dist/esm/icons/checkmark.js +17 -0
  354. package/dist/esm/icons/checkmark.js.map +1 -0
  355. package/dist/esm/icons/chevron-down-fill.d.ts +8 -0
  356. package/dist/esm/icons/chevron-down-fill.d.ts.map +1 -0
  357. package/dist/esm/icons/chevron-down-fill.js +17 -0
  358. package/dist/esm/icons/chevron-down-fill.js.map +1 -0
  359. package/dist/esm/icons/error-circle-fill.d.ts +8 -0
  360. package/dist/esm/icons/error-circle-fill.d.ts.map +1 -0
  361. package/dist/esm/icons/error-circle-fill.js +17 -0
  362. package/dist/esm/icons/error-circle-fill.js.map +1 -0
  363. package/dist/esm/icons/index.d.ts +13 -0
  364. package/dist/esm/icons/index.d.ts.map +1 -1
  365. package/dist/esm/icons/index.js +12 -0
  366. package/dist/esm/icons/index.js.map +1 -1
  367. package/dist/esm/icons/info-circle-fill.d.ts +8 -0
  368. package/dist/esm/icons/info-circle-fill.d.ts.map +1 -0
  369. package/dist/esm/icons/info-circle-fill.js +17 -0
  370. package/dist/esm/icons/info-circle-fill.js.map +1 -0
  371. package/dist/esm/icons/minus-small.d.ts +3 -2
  372. package/dist/esm/icons/minus-small.d.ts.map +1 -1
  373. package/dist/esm/icons/minus-small.js +14 -2
  374. package/dist/esm/icons/minus-small.js.map +1 -1
  375. package/dist/esm/icons/warning-circle-fill.d.ts +8 -0
  376. package/dist/esm/icons/warning-circle-fill.d.ts.map +1 -0
  377. package/dist/esm/icons/warning-circle-fill.js +17 -0
  378. package/dist/esm/icons/warning-circle-fill.js.map +1 -0
  379. package/dist/esm/index.d.ts +13 -11
  380. package/dist/esm/index.d.ts.map +1 -1
  381. package/dist/esm/index.js +11 -10
  382. package/dist/esm/index.js.map +1 -1
  383. package/dist/esm/providers/router/router-provider.d.ts +20 -0
  384. package/dist/esm/providers/router/router-provider.d.ts.map +1 -0
  385. package/dist/esm/providers/router/router-provider.js +12 -0
  386. package/dist/esm/providers/router/router-provider.js.map +1 -0
  387. package/dist/esm/providers/ssr/ssr-provider.d.ts +7 -3
  388. package/dist/esm/providers/ssr/ssr-provider.d.ts.map +1 -1
  389. package/dist/esm/providers/ssr/ssr-provider.js +3 -1
  390. package/dist/esm/providers/ssr/ssr-provider.js.map +1 -1
  391. package/dist/esm/with-style-props.d.ts +17 -11
  392. package/dist/esm/with-style-props.d.ts.map +1 -1
  393. package/dist/esm/with-style-props.js.map +1 -1
  394. package/dist-styles/styles.css +1 -1
  395. package/package.json +71 -26
  396. package/dist/commonjs/components/form-field/form-field.d.ts +0 -13
  397. package/dist/commonjs/components/form-field/form-field.d.ts.map +0 -1
  398. package/dist/commonjs/components/form-field/form-field.js +0 -36
  399. package/dist/commonjs/components/form-field/form-field.js.map +0 -1
  400. package/dist/commonjs/components/sr-only/sr-only.d.ts +0 -8
  401. package/dist/commonjs/components/sr-only/sr-only.d.ts.map +0 -1
  402. package/dist/commonjs/components/sr-only/sr-only.js +0 -10
  403. package/dist/commonjs/components/sr-only/sr-only.js.map +0 -1
  404. package/dist/esm/components/form-field/form-field.d.ts +0 -13
  405. package/dist/esm/components/form-field/form-field.d.ts.map +0 -1
  406. package/dist/esm/components/form-field/form-field.js +0 -28
  407. package/dist/esm/components/form-field/form-field.js.map +0 -1
  408. package/dist/esm/components/sr-only/sr-only.d.ts +0 -8
  409. package/dist/esm/components/sr-only/sr-only.d.ts.map +0 -1
  410. package/dist/esm/components/sr-only/sr-only.js +0 -7
  411. package/dist/esm/components/sr-only/sr-only.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -6,38 +7,60 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.Menu = void 0;
7
8
  exports.MenuSection = MenuSection;
8
9
  exports.MenuItem = MenuItem;
9
- exports.MenuSeparator = MenuSeparator;
10
+ exports.MenuDivider = MenuDivider;
10
11
  const jsx_runtime_1 = require("react/jsx-runtime");
11
12
  const clsx_1 = __importDefault(require("clsx"));
12
13
  const react_1 = require("react");
13
14
  const react_aria_components_1 = require("react-aria-components");
14
15
  const forward_ref_js_1 = require("../../forward-ref.js");
16
+ const index_js_1 = require("../../icons/index.js");
15
17
  const with_style_props_js_1 = require("../../with-style-props.js");
18
+ const button_js_1 = require("../button/button.js");
19
+ const icon_button_js_1 = require("../button/icon-button.js");
20
+ const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
16
21
  const utils_js_1 = require("../typography/utils.js");
17
- function Menu({ label, children, onAction, UNSAFE_className, UNSAFE_style, ...props }, ref) {
18
- const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
22
+ function Menu({ children, isDisabled, onAction, items, onOpenChange, onScroll, ...props }, ref) {
23
+ const { label, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
19
24
  (0, react_1.useEffect)(() => {
20
25
  if (!label && !ariaLabel && !ariaLabelledBy) {
21
- console.warn('Menu requires one of label / aria-label / aria-labelledby for accessibility');
26
+ console.warn('`Menu` requires one of `label` / `aria-label` / `aria-labelledby` for accessibility');
22
27
  }
23
28
  }, [label, ariaLabel, ariaLabelledBy]);
24
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.MenuTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { ...props, ref: ref, className: (0, clsx_1.default)('cim-menu-button', UNSAFE_className), style: UNSAFE_style, children: [label, (0, jsx_runtime_1.jsx)(ChevronDownIcon, { height: 12, width: 12, "aria-hidden": true })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: "cim-menu-popover", offset: 2, maxHeight: 315, "data-experimental-cim-style-root": true, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Menu, { className: "cim-menu", onAction: onAction, children: children }) })] }));
29
+ if (items != null && typeof children !== 'function') {
30
+ console.warn('`Menu` requires `children` to be a function when using `items` prop');
31
+ }
32
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.MenuTrigger, { onOpenChange: onOpenChange, children: [(0, jsx_runtime_1.jsx)(MenuTrigger, { ...props, triggerRef: ref, isDisabled: isDisabled }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { placement: "bottom start", offset: 5, maxHeight: 315, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Menu, { className: "cim-menu", onAction: onAction, onScroll: onScroll, items: items, children: children }) })] }));
25
33
  }
34
+ /**
35
+ * Displays a collapsible list of options and actions that users can choose from.
36
+ *
37
+ * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).
38
+ */
26
39
  const _Menu = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Menu), 'Menu');
27
40
  exports.Menu = _Menu;
28
- function MenuSection({ title, children, ...props }) {
29
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Section, { ...props, className: "cim-menu-section", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Header, { className: (0, clsx_1.default)('cim-menu-section-header', (0, utils_js_1.textStyle)({ variant: 'small-semibold', tone: 'subtle' })), children: title }), children] }));
41
+ function MenuTrigger({ label, triggerRef, ...props }) {
42
+ if (label) {
43
+ return ((0, jsx_runtime_1.jsx)(button_js_1.Button, { ...props, variant: "secondary", size: "medium", ref: triggerRef, iconEnd: (0, jsx_runtime_1.jsx)(index_js_1.IconChevronDownFill, { UNSAFE_className: "cim-menu-trigger-icon" }), children: label }));
44
+ }
45
+ return ((0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { ...props, "aria-label": props['aria-label'] ?? '', variant: "secondary", size: "medium", ref: triggerRef, icon: (0, jsx_runtime_1.jsx)(index_js_1.IconChevronDownFill, { UNSAFE_className: "cim-menu-trigger-icon" }) }));
46
+ }
47
+ /** Groups list items within `Menu` into a section. */
48
+ function MenuSection({ title, children, items, ...props }) {
49
+ if (items != null && typeof children !== 'function') {
50
+ console.warn('`MenuSection` requires `children` to be a function when using `items` prop');
51
+ }
52
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.MenuSection, { ...props, className: "cim-menu-section", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Header, { className: (0, clsx_1.default)('cim-menu-section-header', (0, utils_js_1.textStyle)({ variant: 'small-semibold', tone: 'subtle' })), children: title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Collection, { items: items, children: children })] }));
30
53
  }
31
54
  MenuSection.displayName = 'MenuSection';
32
- function MenuItem({ label, ...props }) {
33
- return ((0, jsx_runtime_1.jsx)(react_aria_components_1.MenuItem, { ...props, className: "cim-menu-item", textValue: label, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, clsx_1.default)('cim-menu-item-label', (0, utils_js_1.textStyle)({ variant: 'body' })), children: label }) }));
55
+ /** Renders a single list item within `Menu`. */
56
+ function MenuItem({ children, description, icon, ...props }) {
57
+ const textValue = typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');
58
+ return ((0, jsx_runtime_1.jsx)(react_aria_components_1.MenuItem, { ...props, className: "cim-menu-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon, (0, jsx_runtime_1.jsxs)("div", { className: "cim-menu-item-text", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children }), description && ((0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "description", className: (0, utils_js_1.textStyle)({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' }), children: description }))] })] })) }));
34
59
  }
35
60
  MenuItem.displayName = 'MenuItem';
36
- function MenuSeparator() {
37
- return (0, jsx_runtime_1.jsx)(react_aria_components_1.Separator, { className: "cim-menu-separator" });
38
- }
39
- MenuSeparator.displayName = 'MenuSeparator';
40
- function ChevronDownIcon(props) {
41
- return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 12", fill: "currentColor", "data-icon": true, ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M.124 3.603 5.617 9.84a.533.533 0 0 0 .769 0l5.49-6.236a.493.493 0 0 0-.054-.707l-.925-.778a.514.514 0 0 0-.719.055L6.095 6.9a.125.125 0 0 1-.189 0L1.822 2.173A.51.51 0 0 0 1.474 2a.5.5 0 0 0-.37.119l-.926.777a.494.494 0 0 0-.054.707Z" }) }));
61
+ /** Renders a horizontal divider between list items within `Menu`. */
62
+ function MenuDivider() {
63
+ return (0, jsx_runtime_1.jsx)(react_aria_components_1.Separator, { className: "cim-menu-divider" });
42
64
  }
65
+ MenuDivider.displayName = 'MenuDivider';
43
66
  //# sourceMappingURL=menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":";;;;;;AAoEA,kCASC;AAwBD,4BAQC;AAID,sCAEC;;AAnHD,gDAAwB;AACxB,iCAAyF;AACzF,iEAW+B;AAC/B,yDAAkD;AAClD,mEAA2D;AAE3D,qDAAmD;AAWnD,SAAS,IAAI,CACX,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAa,EAClF,GAAoC;IAEpC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAEvC,OAAO,CACL,wBAAC,mCAAc,eACb,wBAAC,8BAAS,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,aACtG,KAAK,EACN,uBAAC,eAAe,IAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,wBAAgB,IAC5C,EACZ,uBAAC,+BAAU,IAAC,SAAS,EAAC,kBAAkB,EAAC,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,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CACL,gCAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,wBAAe,KAAK,YACjG,iCAAM,CAAC,EAAC,4OAA4O,GAAG,GACnP,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport { type ReactNode, type SVGAttributes, type ForwardedRef, useEffect } from 'react';\nimport {\n Button as RACButton,\n Header as RACHeader,\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n type MenuItemProps as RACMenuItemProps,\n MenuTrigger as RACMenuTrigger,\n Section as RACSection,\n Popover as RACPopover,\n Separator as RACSeparator,\n Text as RACText,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { DOMProps, Key, LabellableProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\n// TODO: document that when creating the items dynamically, all items must have `key` and `id` defined\n\nexport interface MenuProps extends DOMProps, LabellableProps {\n /** The contents of the menu. */\n children?: ReactNode;\n /** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */\n onAction?: (key: Key) => void;\n}\n\nfunction Menu(\n { label, children, onAction, UNSAFE_className, UNSAFE_style, ...props }: MenuProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Menu requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACMenuTrigger>\n <RACButton {...props} ref={ref} className={clsx('cim-menu-button', UNSAFE_className)} style={UNSAFE_style}>\n {label}\n <ChevronDownIcon height={12} width={12} aria-hidden />\n </RACButton>\n <RACPopover className=\"cim-menu-popover\" offset={2} maxHeight={315} data-experimental-cim-style-root>\n <RACMenu className=\"cim-menu\" onAction={onAction}>\n {children}\n </RACMenu>\n </RACPopover>\n </RACMenuTrigger>\n );\n}\n\nconst _Menu = withStyleProps(forwardRef(Menu), 'Menu');\n\nexport { _Menu as Menu };\n\nexport interface MenuSectionProps {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n /** The contents of the section. */\n children: ReactNode;\n}\n\nexport function MenuSection({ title, children, ...props }: MenuSectionProps) {\n return (\n <RACSection {...props} className=\"cim-menu-section\">\n <RACHeader className={clsx('cim-menu-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n {children}\n </RACSection>\n );\n}\n\nMenuSection.displayName = 'MenuSection';\n\nexport interface MenuItemProps\n extends Pick<\n RACMenuItemProps,\n | 'isDisabled'\n | 'href'\n | 'hrefLang'\n | 'target'\n | 'rel'\n | 'download'\n | 'ping'\n | 'referrerPolicy'\n | 'routerOptions'\n | 'onAction'\n > {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n label: string;\n}\n\nexport function MenuItem({ label, ...props }: MenuItemProps) {\n return (\n <RACMenuItem {...props} className=\"cim-menu-item\" textValue={label}>\n <RACText slot=\"label\" className={clsx('cim-menu-item-label', textStyle({ variant: 'body' }))}>\n {label}\n </RACText>\n </RACMenuItem>\n );\n}\n\nMenuItem.displayName = 'MenuItem';\n\nexport function MenuSeparator() {\n return <RACSeparator className=\"cim-menu-separator\" />;\n}\n\nMenuSeparator.displayName = 'MenuSeparator';\n\nfunction ChevronDownIcon(props: SVGAttributes<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\" fill=\"currentColor\" data-icon {...props}>\n <path d=\"M.124 3.603 5.617 9.84a.533.533 0 0 0 .769 0l5.49-6.236a.493.493 0 0 0-.054-.707l-.925-.778a.514.514 0 0 0-.719.055L6.095 6.9a.125.125 0 0 1-.189 0L1.822 2.173A.51.51 0 0 0 1.474 2a.5.5 0 0 0-.37.119l-.926.777a.494.494 0 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CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,qEAAqE;AACrE,SAAgB,WAAW;IACzB,OAAO,uBAAC,iCAAY,IAAC,SAAS,EAAC,kBAAkB,GAAG,CAAC;AACvD,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type ReactNode, type ForwardedRef, useEffect, type Ref } from 'react';\nimport {\n Header as RACHeader,\n Menu as RACMenu,\n type MenuProps as RACMenuProps,\n MenuItem as RACMenuItem,\n type MenuItemProps as RACMenuItemProps,\n MenuTrigger as RACMenuTrigger,\n type MenuTriggerProps as RACMenuTriggerProps,\n MenuSection as RACMenuSection,\n Separator as RACSeparator,\n Collection as RACCollection,\n Text as RACText,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconChevronDownFill } from '../../icons/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { Button } from '../button/button.js';\nimport { IconButton } from '../button/icon-button.js';\nimport type { ActionButtonProps } from '../button/types.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport type {\n CommonProps,\n Key,\n LabellableProps,\n NavigationProps,\n CollectionProps,\n CollectionItem,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface MenuProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n CollectionProps<T>,\n LabellableProps,\n Pick<RACMenuTriggerProps, 'onOpenChange'>,\n Pick<RACMenuProps<T>, 'onScroll'>,\n Pick<ActionButtonProps, 'onHoverStart' | 'onHoverEnd'> {\n /** Whether the menu trigger is disabled. */\n isDisabled?: boolean;\n /** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */\n onAction?: (key: Key) => void;\n}\n\nfunction Menu<T extends CollectionItem>(\n { children, isDisabled, onAction, items, onOpenChange, onScroll, ...props }: MenuProps<T>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const { label, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('`Menu` requires one of `label` / `aria-label` / `aria-labelledby` for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (items != null && typeof children !== 'function') {\n console.warn('`Menu` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACMenuTrigger onOpenChange={onOpenChange}>\n <MenuTrigger {...props} triggerRef={ref} isDisabled={isDisabled} />\n <CollapsibleList\n placement=\"bottom start\"\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <RACMenu className=\"cim-menu\" onAction={onAction} onScroll={onScroll} items={items}>\n {children}\n </RACMenu>\n </CollapsibleList>\n </RACMenuTrigger>\n );\n}\n\n/**\n * Displays a collapsible list of options and actions that users can choose from.\n *\n * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).\n */\nconst _Menu = withStyleProps(forwardRef(Menu), 'Menu');\n\nexport { _Menu as Menu };\n\ninterface MenuTriggerProps\n extends CommonProps,\n LabellableProps,\n Pick<ActionButtonProps, 'onHoverStart' | 'onHoverEnd'> {\n triggerRef: Ref<HTMLButtonElement>;\n isDisabled?: boolean;\n}\n\nfunction MenuTrigger({ label, triggerRef, ...props }: MenuTriggerProps) {\n if (label) {\n return (\n <Button\n {...props}\n variant=\"secondary\"\n size=\"medium\"\n ref={triggerRef}\n iconEnd={<IconChevronDownFill UNSAFE_className=\"cim-menu-trigger-icon\" />}\n >\n {label}\n </Button>\n );\n }\n\n return (\n <IconButton\n {...props}\n // The warning for missing aria-label would have been already emitted in the <Menu> component, so this is fine\n aria-label={props['aria-label'] ?? ''}\n variant=\"secondary\"\n size=\"medium\"\n ref={triggerRef}\n icon={<IconChevronDownFill UNSAFE_className=\"cim-menu-trigger-icon\" />}\n />\n );\n}\n\nexport interface MenuSectionProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Menu` into a section. */\nexport function MenuSection<T extends CollectionItem>({ title, children, items, ...props }: MenuSectionProps<T>) {\n if (items != null && typeof children !== 'function') {\n console.warn('`MenuSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACMenuSection {...props} className=\"cim-menu-section\">\n <RACHeader className={clsx('cim-menu-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACMenuSection>\n );\n}\n\nMenuSection.displayName = 'MenuSection';\n\nexport interface MenuItemProps\n extends NavigationProps,\n Pick<RACMenuItemProps, 'isDisabled' | 'onAction' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n /** Additional description for the menu item. */\n description?: string;\n /** An icon representing the menu item. */\n icon?: ReactNode;\n}\n\n/** Renders a single list item within `Menu`. */\nexport function MenuItem({ children, description, icon, ...props }: MenuItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACMenuItem {...props} className=\"cim-menu-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n {icon}\n\n <div className=\"cim-menu-item-text\">\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n\n {description && (\n <RACText\n slot=\"description\"\n className={textStyle({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' })}\n >\n {description}\n </RACText>\n )}\n </div>\n </>\n )}\n </RACMenuItem>\n );\n}\n\nMenuItem.displayName = 'MenuItem';\n\n/** Renders a horizontal divider between list items within `Menu`. */\nexport function MenuDivider() {\n return <RACSeparator className=\"cim-menu-divider\" />;\n}\n\nMenuDivider.displayName = 'MenuDivider';\n"]}
@@ -1,11 +1,21 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { type RadioGroupProps as RACRadioGroupProps } from 'react-aria-components';
3
- import { type StackProps } from '../spacing/stack/stack.js';
4
- import type { DOMProps, FieldProps, WithRequired } from '../types.js';
5
- export interface RadioGroupProps extends DOMProps, WithRequired<FieldProps<string | null>, 'label'>, Pick<RACRadioGroupProps, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'value' | 'onChange' | 'defaultValue' | 'name'>, Pick<StackProps, 'inline'> {
3
+ import type { Responsive } from '../spacing/types.js';
4
+ import type { Direction, CommonProps, FieldProps, WithRequired } from '../types.js';
5
+ export interface RadioGroupProps extends CommonProps, WithRequired<FieldProps<string | null>, 'label'>, Pick<RACRadioGroupProps, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'value' | 'onChange' | 'defaultValue' | 'name'> {
6
6
  /** Radio buttons belonging to the group. */
7
7
  children: ReactNode;
8
+ /**
9
+ * Determines the direction in which radio buttons will be stacked.
10
+ * @default 'vertical'
11
+ */
12
+ direction?: Responsive<Direction>;
8
13
  }
9
- declare const _RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => ReactNode;
14
+ /**
15
+ * Allows users to select a single item from a visible list.
16
+ *
17
+ * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).
18
+ */
19
+ declare const _RadioGroup: (props: RadioGroupProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
10
20
  export { _RadioGroup as RadioGroup };
11
21
  //# sourceMappingURL=radio-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/components/radio/radio-group.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAA+B,KAAK,eAAe,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhH,OAAO,EAAS,KAAK,U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AAS,CAAC,CAAC;CACnC;AA2BD;;;;GAIG;AACH,QAAA,MAAM,WAAW,iKAAuD,CAAC;AAEzE,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -9,23 +10,28 @@ const clsx_1 = __importDefault(require("clsx"));
9
10
  const react_aria_components_1 = require("react-aria-components");
10
11
  const forward_ref_js_1 = require("../../forward-ref.js");
11
12
  const with_style_props_js_1 = require("../../with-style-props.js");
12
- const form_field_js_1 = require("../form-field/form-field.js");
13
+ const form_field_js_1 = require("../internal/form-field/form-field.js");
13
14
  const stack_js_1 = require("../spacing/stack/stack.js");
14
- function RadioGroup({ label, description, error: errorMessage, inline = false, children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
15
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.RadioGroup, { ...props, ref: ref, className: (0, clsx_1.default)('cim-radio-group', UNSAFE_className), style: UNSAFE_style, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, children: label }), (0, jsx_runtime_1.jsx)(stack_js_1.Stack, { gap: getGapFromInline(inline), inline: inline, children: children }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }));
15
+ function RadioGroup({ label, description, error: errorMessage, direction = 'vertical', children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
16
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.RadioGroup, { ...props, ref: ref, className: (0, clsx_1.default)('cim-radio-group', UNSAFE_className), style: UNSAFE_style, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, children: label }), (0, jsx_runtime_1.jsx)(stack_js_1.Stack, { gap: getGapFromDirection(direction), direction: direction, children: children }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }));
16
17
  }
18
+ /**
19
+ * Allows users to select a single item from a visible list.
20
+ *
21
+ * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).
22
+ */
17
23
  const _RadioGroup = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(RadioGroup), 'RadioGroup');
18
24
  exports.RadioGroup = _RadioGroup;
19
- // Make sure that radio buttons are spaced by 16px when stacked inline, and 4px otherwise.
20
- function getGapFromInline(inline) {
21
- if (typeof inline === 'object') {
22
- const gap = { xs: inline.xs ? 16 : 4 };
23
- Object.entries(inline).reduce((acc, curr) => {
24
- gap[curr[0]] = curr[1] ? 16 : 4;
25
+ // Make sure that radio buttons are spaced by 16px when stacked horizontally, and 8px otherwise.
26
+ function getGapFromDirection(direction) {
27
+ if (typeof direction === 'object') {
28
+ const gap = { xs: direction.xs === 'horizontal' ? 16 : 8 };
29
+ Object.entries(direction).reduce((acc, curr) => {
30
+ gap[curr[0]] = curr[1] === 'horizontal' ? 16 : 8;
25
31
  return acc;
26
32
  }, gap);
27
33
  return gap;
28
34
  }
29
- return inline ? 16 : 4;
35
+ return direction === 'horizontal' ? 16 : 8;
30
36
  }
31
37
  //# sourceMappingURL=radio-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/components/radio/radio-group.tsx"],"names":[],"mappings":";;;;;;;AAAA,gDAAwB;AAExB,iEAAgH;AAChH,yDAAkD;AAClD,mEAA2D;AAC3D,+DAAmG;AACnG,wDAAmE;AAgBnE,SAAS,UAAU,CACjB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,MAAM,GAAG,KAAK,EACd,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACQ,EAClB,GAAiC;IAEj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Node } from 'react';\nimport { RadioGroup as RACRadioGroup, type RadioGroupProps as RACRadioGroupProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../form-field/form-field.js';\nimport { Stack, type StackProps } from '../spacing/stack/stack.js';\nimport type { Breakpoint, Responsive, Spacing } from '../spacing/types.js';\nimport type { DOMProps, FieldProps, WithRequired } from '../types.js';\n\nexport interface RadioGroupProps\n extends DOMProps,\n WithRequired<FieldProps<string | null>, 'label'>,\n Pick<\n RACRadioGroupProps,\n 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'value' | 'onChange' | 'defaultValue' | 'name'\n >,\n Pick<StackProps, 'inline'> {\n /** Radio buttons belonging to the group. */\n children: ReactNode;\n}\n\nfunction RadioGroup(\n {\n label,\n description,\n error: errorMessage,\n inline = false,\n children,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: RadioGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <RACRadioGroup {...props} ref={ref} className={clsx('cim-radio-group', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired}>{label}</FormFieldLabel>\n <Stack gap={getGapFromInline(inline)} inline={inline}>\n {children}\n </Stack>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACRadioGroup>\n );\n}\n\nconst _RadioGroup = withStyleProps(forwardRef(RadioGroup), 'RadioGroup');\n\nexport { _RadioGroup as RadioGroup };\n\n// Make sure that radio buttons are spaced by 16px when stacked inline, and 4px otherwise.\nfunction getGapFromInline(inline: Responsive<boolean>): Responsive<Spacing> {\n if (typeof inline === 'object') {\n const gap: Responsive<Spacing> = { xs: inline.xs ? 16 : 4 };\n\n (Object.entries(inline) as [Breakpoint, boolean][]).reduce((acc, curr) => {\n gap[curr[0]] = curr[1] ? 16 : 4;\n return acc;\n }, gap);\n\n return gap;\n }\n\n return inline ? 16 : 4;\n}\n"]}
1
+ {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/components/radio/radio-group.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,iEAAgH;AAChH,yDAAkD;AAClD,mEAA2D;AAC3D,wEAA4G;AAC5G,wDAAkD;AAoBlD,SAAS,UAAU,CACjB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,GAAG,UAAU,EACtB,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACQ,EAClB,GAAiC;IAEjC,OAAO,CACL,wBAAC,kCAAa,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,aAC3G,uBAAC,8BAAc,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,YAAG,KAAK,GAAkB,EACtE,uBAAC,gBAAK,IAAC,GAAG,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,YAC7D,QAAQ,GACH,EACR,uBAAC,8BAAc,cAAE,YAAY,GAAkB,EAC/C,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IAC5C,CACjB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,WAAW,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,UAAU,CAAC,EAAE,YAAY,CAAC,CAAC;AAEjD,iCAAU;AAElC,gGAAgG;AAChG,SAAS,mBAAmB,CAAC,SAAgC;IAC3D,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,GAAG,GAAwB,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/E,MAAM,CAAC,OAAO,CAAC,SAAS,CAA+B,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAC5E,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { RadioGroup as RACRadioGroup, type RadioGroupProps as RACRadioGroupProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { Stack } from '../spacing/stack/stack.js';\nimport type { Breakpoint, Responsive, Spacing } from '../spacing/types.js';\nimport type { Direction, CommonProps, FieldProps, WithRequired } from '../types.js';\n\nexport interface RadioGroupProps\n extends CommonProps,\n WithRequired<FieldProps<string | null>, 'label'>,\n Pick<\n RACRadioGroupProps,\n 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'value' | 'onChange' | 'defaultValue' | 'name'\n > {\n /** Radio buttons belonging to the group. */\n children: ReactNode;\n /**\n * Determines the direction in which radio buttons will be stacked.\n * @default 'vertical'\n */\n direction?: Responsive<Direction>;\n}\n\nfunction RadioGroup(\n {\n label,\n description,\n error: errorMessage,\n direction = 'vertical',\n children,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: RadioGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <RACRadioGroup {...props} ref={ref} className={clsx('cim-radio-group', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired}>{label}</FormFieldLabel>\n <Stack gap={getGapFromDirection(direction)} direction={direction}>\n {children}\n </Stack>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACRadioGroup>\n );\n}\n\n/**\n * Allows users to select a single item from a visible list.\n *\n * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).\n */\nconst _RadioGroup = withStyleProps(forwardRef(RadioGroup), 'RadioGroup');\n\nexport { _RadioGroup as RadioGroup };\n\n// Make sure that radio buttons are spaced by 16px when stacked horizontally, and 8px otherwise.\nfunction getGapFromDirection(direction: Responsive<Direction>): Responsive<Spacing> {\n if (typeof direction === 'object') {\n const gap: Responsive<Spacing> = { xs: direction.xs === 'horizontal' ? 16 : 8 };\n\n (Object.entries(direction) as [Breakpoint, Direction][]).reduce((acc, curr) => {\n gap[curr[0]] = curr[1] === 'horizontal' ? 16 : 8;\n return acc;\n }, gap);\n\n return gap;\n }\n\n return direction === 'horizontal' ? 16 : 8;\n}\n"]}
@@ -1,9 +1,14 @@
1
1
  import { type RadioProps as RACRadioProps } from 'react-aria-components';
2
- import type { DOMProps, LabellableProps } from '../types.js';
3
- export interface RadioProps extends DOMProps, Omit<LabellableProps, 'label'>, Pick<RACRadioProps, 'value' | 'isDisabled'> {
2
+ import type { CommonProps, LabellableProps, StringLikeChildren } from '../types.js';
3
+ export interface RadioProps extends CommonProps, Omit<LabellableProps, 'label'>, Pick<RACRadioProps, 'value' | 'isDisabled'> {
4
4
  /** The label rendered next to the radio. */
5
- children?: string;
5
+ children?: StringLikeChildren;
6
6
  }
7
- declare const _Radio: (props: RadioProps & import("react").RefAttributes<HTMLLabelElement> & import("../../with-style-props.js").StyleProps) => import("react").ReactNode;
7
+ /**
8
+ * Renders a single option within `RadioGroup`.
9
+ *
10
+ * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).
11
+ */
12
+ declare const _Radio: (props: RadioProps & import("react").RefAttributes<HTMLLabelElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
8
13
  export { _Radio as Radio };
9
14
  //# sourceMappingURL=radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG7D,MAAM,WAAW,UACf,SAAQ,QAAQ,EACd,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EAC9B,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY,CAAC;IAC7C,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8BD,QAAA,MAAM,MAAM,qJAA6C,CAAC;AAE1D,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGpF,MAAM,WAAW,UACf,SAAQ,WAAW,EACjB,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EAC9B,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY,CAAC;IAC7C,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AA8BD;;;;GAIG;AACH,QAAA,MAAM,MAAM,8JAA6C,CAAC;AAE1D,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -20,6 +21,11 @@ function Radio({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
20
21
  }, [children, ariaLabel, ariaLabelledBy]);
21
22
  return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Radio, { ...props, className: (0, clsx_1.default)('cim-radio', UNSAFE_className), style: UNSAFE_style, ref: ref, children: [(0, jsx_runtime_1.jsx)("div", { className: "cim-radio-toggle-wrapper", children: (0, jsx_runtime_1.jsx)("div", { className: "cim-radio-toggle", children: (0, jsx_runtime_1.jsx)("div", { className: "cim-radio-toggle-inner" }) }) }), children && ((0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "body", children: children }))] }));
22
23
  }
24
+ /**
25
+ * Renders a single option within `RadioGroup`.
26
+ *
27
+ * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).
28
+ */
23
29
  const _Radio = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Radio), 'Radio');
24
30
  exports.Radio = _Radio;
25
31
  //# sourceMappingURL=radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../../src/components/radio/radio.tsx"],"names":[],"mappings":";;;;;;;AAAA,gDAAwB;AACxB,iCAAqD;AACrD,iEAA4F;AAC5F,yDAAkD;AAClD,mEAA2D;AAE3D,mDAA6C;AAU7C,SAAS,KAAK,CACZ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAc,EAClE,GAAmC;IAEnC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;QAClG,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,wBAAC,6BAAQ,OAAK,KAAK,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,WAAW,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,aAChG,gCAAK,SAAS,EAAC,0BAA0B,YACvC,gCAAK,SAAS,EAAC,kBAAkB,YAC/B,gCAAK,SAAS,EAAC,wBAAwB,GAAG,GACtC,GACF,EACL,QAAQ,IAAI,CACX,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,YAC3B,QAAQ,GACJ,CACR,IACQ,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;AAEvC,uBAAK","sourcesContent":["import clsx from 'clsx';\nimport { useEffect, type ForwardedRef } from 'react';\nimport { Radio as RACRadio, type RadioProps as RACRadioProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { DOMProps, LabellableProps } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface RadioProps\n extends DOMProps,\n Omit<LabellableProps, 'label'>,\n Pick<RACRadioProps, 'value' | 'isDisabled'> {\n /** The label rendered next to the radio. */\n children?: string;\n}\n\nfunction Radio(\n { children, UNSAFE_className, UNSAFE_style, ...props }: RadioProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Radio requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACRadio {...props} className={clsx('cim-radio', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n <div className=\"cim-radio-toggle-wrapper\">\n <div className=\"cim-radio-toggle\">\n <div className=\"cim-radio-toggle-inner\" />\n </div>\n </div>\n {children && (\n <Text as=\"span\" variant=\"body\">\n {children}\n </Text>\n )}\n </RACRadio>\n );\n}\n\nconst _Radio = withStyleProps(forwardRef(Radio), 'Radio');\n\nexport { _Radio as Radio };\n"]}
1
+ {"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAqD;AACrD,iEAA4F;AAC5F,yDAAkD;AAClD,mEAA2D;AAE3D,mDAA6C;AAU7C,SAAS,KAAK,CACZ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAc,EAClE,GAAmC;IAEnC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;QAClG,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,wBAAC,6BAAQ,OAAK,KAAK,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,WAAW,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,aAChG,gCAAK,SAAS,EAAC,0BAA0B,YACvC,gCAAK,SAAS,EAAC,kBAAkB,YAC/B,gCAAK,SAAS,EAAC,wBAAwB,GAAG,GACtC,GACF,EACL,QAAQ,IAAI,CACX,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,YAC3B,QAAQ,GACJ,CACR,IACQ,CACZ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;AAEvC,uBAAK","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useEffect, type ForwardedRef } from 'react';\nimport { Radio as RACRadio, type RadioProps as RACRadioProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps, LabellableProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface RadioProps\n extends CommonProps,\n Omit<LabellableProps, 'label'>,\n Pick<RACRadioProps, 'value' | 'isDisabled'> {\n /** The label rendered next to the radio. */\n children?: StringLikeChildren;\n}\n\nfunction Radio(\n { children, UNSAFE_className, UNSAFE_style, ...props }: RadioProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Radio requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACRadio {...props} className={clsx('cim-radio', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n <div className=\"cim-radio-toggle-wrapper\">\n <div className=\"cim-radio-toggle\">\n <div className=\"cim-radio-toggle-inner\" />\n </div>\n </div>\n {children && (\n <Text as=\"span\" variant=\"body\">\n {children}\n </Text>\n )}\n </RACRadio>\n );\n}\n\n/**\n * Renders a single option within `RadioGroup`.\n *\n * See [radio group usage guidelines](https://ui.cimpress.io/components/radio-group/).\n */\nconst _Radio = withStyleProps(forwardRef(Radio), 'Radio');\n\nexport { _Radio as Radio };\n"]}
@@ -1,28 +1,31 @@
1
- import type { ReactNode } from 'react';
2
- import { type SelectProps as RACSelectProps } from 'react-aria-components';
3
- import type { DOMProps, FieldWithPlaceholderProps, Key } from '../types.js';
4
- export interface SelectOption {
5
- /** The unique id of the item. When integrated with a form, this will be the value of the option. */
6
- id: string;
7
- /** The content to display as the label of the option. */
8
- label: string;
9
- /** Whether the option is disabled. */
10
- isDisabled?: boolean;
1
+ import { type ListBoxProps as RACListBoxProps, type ListBoxItemProps as RACListBoxItemProps, type SelectProps as RACSelectProps } from 'react-aria-components';
2
+ import type { CollectionItem, CollectionProps, CommonProps, FieldProps, Key, StringLikeChildren } from '../types.js';
3
+ export interface SelectProps<T extends CollectionItem = CollectionItem> extends CommonProps, FieldProps<Key>, CollectionProps<T>, Pick<RACSelectProps<T>, 'name' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'selectedKey' | 'defaultSelectedKey' | 'autoComplete' | 'autoFocus' | 'onSelectionChange' | 'placeholder' | 'onFocus' | 'onBlur' | 'onOpenChange'>, Pick<RACListBoxProps<T>, 'onScroll'> {
11
4
  }
12
- export interface SelectOptionGroup {
13
- /** The unique id of the group. */
14
- id: string;
15
- /** The content to display as the title of the group. */
16
- label: string;
17
- /** The options available for selection within the group. */
18
- options: SelectOption[];
19
- isDisabled?: never;
5
+ /**
6
+ * Allows users to select one item from a collapsible list.
7
+ *
8
+ * See [select usage guidelines](https://ui.cimpress.io/components/select/).
9
+ */
10
+ declare const _Select: <T extends CollectionItem>(props: SelectProps<T> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
11
+ export { _Select as Select };
12
+ export interface SelectItemProps extends Pick<RACListBoxItemProps, 'id' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {
13
+ children: StringLikeChildren;
20
14
  }
21
- export type SelectOptionType = SelectOption | SelectOptionGroup;
22
- export interface SelectProps extends Pick<RACSelectProps<SelectOptionType>, 'name' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'selectedKey' | 'defaultSelectedKey' | 'placeholder' | 'autoComplete' | 'autoFocus' | 'onSelectionChange'>, DOMProps, FieldWithPlaceholderProps<Key> {
23
- /** The options available for selection. Supports groups with a single level of nesting. */
24
- options: SelectOptionType[];
15
+ /** Renders a single list item within `Select`. */
16
+ export declare function SelectItem({ children, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare namespace SelectItem {
18
+ var displayName: string;
19
+ }
20
+ export interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {
21
+ /** The ID of the section. Has to be unique across all sections and items. */
22
+ id?: Key;
23
+ /** The content to display as the section title. */
24
+ title: string;
25
+ }
26
+ /** Groups list items within `Select` into a section. */
27
+ export declare function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>): import("react/jsx-runtime").JSX.Element;
28
+ export declare namespace SelectSection {
29
+ var displayName: string;
25
30
  }
26
- declare const _Select: (props: SelectProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => ReactNode;
27
- export { _Select as Select };
28
31
  //# sourceMappingURL=select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AACpE,OAAO,EAWL,KAAK,WAAW,IAAI,cAAc,EACnC,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAG5E,MAAM,WAAW,YAAY;IAC3B,oGAAoG;IACpG,EAAE,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAEhE,MAAM,WAAW,WACf,SAAQ,IAAI,CACR,cAAc,CAAC,gBAAgB,CAAC,EAC9B,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,aAAa,GACb,cAAc,GACd,WAAW,GACX,mBAAmB,CACtB,EACD,QAAQ,EACR,yBAAyB,CAAC,GAAG,CAAC;IAChC,2FAA2F;IAC3F,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AA+BD,QAAA,MAAM,OAAO,oIAA+C,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,YAAY,IAAI,eAAe,EAMpC,KAAK,gBAAgB,IAAI,mBAAmB,EAC5C,KAAK,WAAW,IAAI,cAAc,EACnC,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGrH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CACpE,SAAQ,WAAW,EACjB,UAAU,CAAC,GAAG,CAAC,EACf,eAAe,CAAC,CAAC,CAAC,EAClB,IAAI,CACF,cAAc,CAAC,CAAC,CAAC,EACf,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,mBAAmB,GACnB,aAAa,GACb,SAAS,GACT,QAAQ,GACR,cAAc,CACjB,EACD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;CAAG;AA6C3C;;;;GAIG;AACH,QAAA,MAAM,OAAO,GAhDG,CAAC,SAAS,cAAc,+JAgDoB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;IACtF,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAiBjE;yBAjBe,UAAU;;;AAqB1B,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACtF,6EAA6E;IAC7E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAelH;yBAfe,aAAa"}
@@ -1,34 +1,53 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.Select = void 0;
8
+ exports.SelectItem = SelectItem;
9
+ exports.SelectSection = SelectSection;
7
10
  const jsx_runtime_1 = require("react/jsx-runtime");
8
11
  const clsx_1 = __importDefault(require("clsx"));
12
+ const react_1 = require("react");
9
13
  const react_aria_components_1 = require("react-aria-components");
10
14
  const forward_ref_js_1 = require("../../forward-ref.js");
15
+ const index_js_1 = require("../../icons/index.js");
11
16
  const with_style_props_js_1 = require("../../with-style-props.js");
12
- const form_field_js_1 = require("../form-field/form-field.js");
17
+ const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
18
+ const form_field_js_1 = require("../internal/form-field/form-field.js");
13
19
  const utils_js_1 = require("../typography/utils.js");
14
- function Select({ label, description, error, options, UNSAFE_className, UNSAFE_style, ...props }, ref) {
15
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Select, { ...props, ref: ref, className: (0, clsx_1.default)('cim-select', UNSAFE_className), style: UNSAFE_style, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: "cim-select-button", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.SelectValue, { className: (values) => (0, clsx_1.default)(values.defaultClassName, (0, utils_js_1.textStyle)({ variant: 'medium', tone: values.isPlaceholder ? 'muted' : 'base' })) }), (0, jsx_runtime_1.jsx)(ChevronDownIcon, { height: 12, width: 12, "aria-hidden": "true" })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { offset: 2, maxHeight: 315, className: "cim-select-popover", "data-experimental-cim-style-root": true, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.ListBox, { className: "cim-select-listbox", items: options, children: renderOptions }) })] }));
20
+ function Select({ children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, ...props }, ref) {
21
+ const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
22
+ (0, react_1.useEffect)(() => {
23
+ if (!label && !ariaLabel && !ariaLabelledBy) {
24
+ console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');
25
+ }
26
+ }, [label, ariaLabel, ariaLabelledBy]);
27
+ if (items != null && typeof children !== 'function') {
28
+ console.warn('`Select` requires `children` to be a function when using `items` prop');
29
+ }
30
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Select, { ...props, ref: ref, className: (0, clsx_1.default)('cim-select', UNSAFE_className), style: UNSAFE_style, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: "cim-select-button", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.SelectValue, { className: (values) => (0, clsx_1.default)(values.defaultClassName, (0, utils_js_1.textStyle)({ variant: 'medium', alignment: 'start' })), children: ({ selectedText }) => selectedText }), (0, jsx_runtime_1.jsx)(index_js_1.IconChevronDownFill, {})] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.ListBox, { className: "cim-select-listbox", onScroll: onScroll, items: items, children: children }) })] }));
16
31
  }
32
+ /**
33
+ * Allows users to select one item from a collapsible list.
34
+ *
35
+ * See [select usage guidelines](https://ui.cimpress.io/components/select/).
36
+ */
17
37
  const _Select = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Select), 'Select');
18
38
  exports.Select = _Select;
19
- function renderOptions(item) {
20
- if ('options' in item) {
21
- return ((0, jsx_runtime_1.jsx)(SelectSection, { id: item.id, title: item.label, items: item.options, children: (child) => ((0, jsx_runtime_1.jsx)(SelectItem, { id: child.id, isDisabled: child.isDisabled, children: child.label })) }));
22
- }
23
- return ((0, jsx_runtime_1.jsx)(SelectItem, { id: item.id, isDisabled: item.isDisabled, children: item.label }));
24
- }
39
+ /** Renders a single list item within `Select`. */
25
40
  function SelectItem({ children, ...props }) {
26
- return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: (0, clsx_1.default)('cim-select-item', (0, utils_js_1.textStyle)({ variant: 'medium' })), children: children }));
41
+ const textValue = typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');
42
+ return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-select-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_1.IconCheckmark, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
27
43
  }
44
+ SelectItem.displayName = 'SelectItem';
45
+ /** Groups list items within `Select` into a section. */
28
46
  function SelectSection({ title, children, items, ...props }) {
29
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Section, { ...props, className: "cim-select-section", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Header, { className: (0, clsx_1.default)('cim-select-header', (0, utils_js_1.textStyle)({ variant: 'small', tone: 'subtle' })), children: title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Collection, { items: items, children: children })] }));
30
- }
31
- function ChevronDownIcon(props) {
32
- return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 12", fill: "currentColor", "data-icon": true, ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M.124 3.603 5.617 9.84a.533.533 0 0 0 .769 0l5.49-6.236a.493.493 0 0 0-.054-.707l-.925-.778a.514.514 0 0 0-.719.055L6.095 6.9a.125.125 0 0 1-.189 0L1.822 2.173A.51.51 0 0 0 1.474 2a.5.5 0 0 0-.37.119l-.926.777a.494.494 0 0 0-.054.707Z" }) }));
47
+ if (items != null && typeof children !== 'function') {
48
+ console.warn('`SelectSection` requires `children` to be a function when using `items` prop');
49
+ }
50
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ListBoxSection, { ...props, className: "cim-select-section", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Header, { className: (0, clsx_1.default)('cim-select-section-header', (0, utils_js_1.textStyle)({ variant: 'small-semibold', tone: 'subtle' })), children: title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Collection, { items: items, children: children })] }));
33
51
  }
52
+ SelectSection.displayName = 'SelectSection';
34
53
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":";;;;;;;AAAA,gDAAwB;AAExB,iEAY+B;AAC/B,yDAAkD;AAClD,mEAA2D;AAC3D,+DAAmG;AAEnG,qDAAmD;AA2CnD,SAAS,MAAM,CACb,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAe,EAC7F,GAAiC;IAEjC,OAAO,CACL,wBAAC,8BAAS,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,YAAY,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,aAClG,uBAAC,8BAAc,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,YAAG,KAAK,GAAkB,EACtE,wBAAC,8BAAS,IAAC,SAAS,EAAC,mBAAmB,aACtC,uBAAC,mCAAc,IACb,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CACpB,IAAA,cAAI,EACF,MAAM,CAAC,gBAAgB,EACvB,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAChF,GAEH,EACF,uBAAC,eAAe,IAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,iBAAc,MAAM,GAAG,IACnD,EACZ,uBAAC,8BAAc,cAAE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E,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAsB;IAC7E,OAAO,CACL,wBAAC,+BAAU,OAAK,KAAK,EAAE,SAAS,EAAC,oBAAoB,aACnD,uBAAC,8BAAS,IAAC,SAAS,EAAE,IAAA,cAAI,EAAC,mBAAmB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAC7F,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IAC5C,CACd,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAmC;IAC1D,OAAO,CACL,gCAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,wBAAe,KAAK,YACjG,iCAAM,CAAC,EAAC,4OAA4O,GAAG,GACnP,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ReactNode, SVGAttributes, ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\n ListBox as RACListBox,\n ListBoxItem as RACListBoxItem,\n Popover as RACPopover,\n Section as RACSection,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../form-field/form-field.js';\nimport type { DOMProps, FieldWithPlaceholderProps, Key } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface SelectOption {\n /** The unique id of the item. When integrated with a form, this will be the value of the option. */\n id: string;\n /** The content to display as the label of the option. */\n label: string;\n /** Whether the option is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface SelectOptionGroup {\n /** The unique id of the group. */\n id: string;\n /** The content to display as the title of the group. */\n label: string;\n /** The options available for selection within the group. */\n options: SelectOption[];\n isDisabled?: never;\n}\n\nexport type SelectOptionType = SelectOption | SelectOptionGroup;\n\nexport interface SelectProps\n extends Pick<\n RACSelectProps<SelectOptionType>,\n | 'name'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'placeholder'\n | 'autoComplete'\n | 'autoFocus'\n | 'onSelectionChange'\n >,\n DOMProps,\n FieldWithPlaceholderProps<Key> {\n /** The options available for selection. Supports groups with a single level of nesting. */\n options: SelectOptionType[];\n}\n\nfunction Select(\n { label, description, error, options, UNSAFE_className, UNSAFE_style, ...props }: SelectProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <RACSelect {...props} ref={ref} className={clsx('cim-select', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired}>{label}</FormFieldLabel>\n <RACButton className=\"cim-select-button\">\n <RACSelectValue\n className={(values) =>\n clsx(\n values.defaultClassName,\n textStyle({ variant: 'medium', tone: values.isPlaceholder ? 'muted' : 'base' }),\n )\n }\n />\n <ChevronDownIcon height={12} width={12} aria-hidden=\"true\" />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <RACPopover offset={2} maxHeight={315} className=\"cim-select-popover\" data-experimental-cim-style-root>\n <RACListBox className=\"cim-select-listbox\" items={options}>\n {renderOptions}\n </RACListBox>\n </RACPopover>\n </RACSelect>\n );\n}\n\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nfunction renderOptions(item: SelectOptionType) {\n if ('options' in item) {\n return (\n <SelectSection id={item.id} title={item.label} items={item.options}>\n {(child) => (\n <SelectItem id={child.id} isDisabled={child.isDisabled}>\n {child.label}\n </SelectItem>\n )}\n </SelectSection>\n );\n }\n\n return (\n <SelectItem id={item.id} isDisabled={item.isDisabled}>\n {item.label}\n </SelectItem>\n );\n}\n\ninterface SelectItemProps extends Pick<RACListBoxItemProps<SelectOption>, 'id' | 'value' | 'isDisabled'> {\n children: string;\n}\n\nfunction SelectItem({ children, ...props }: SelectItemProps) {\n return (\n <RACListBoxItem {...props} className={clsx('cim-select-item', textStyle({ variant: 'medium' }))}>\n {children}\n </RACListBoxItem>\n );\n}\n\ninterface SelectSectionProps {\n id: string;\n title: string;\n children: ReactNode | ((item: SelectOption) => ReactNode);\n items?: Iterable<SelectOption>;\n}\n\nfunction SelectSection({ title, children, items, ...props }: SelectSectionProps) {\n return (\n <RACSection {...props} className=\"cim-select-section\">\n <RACHeader className={clsx('cim-select-header', textStyle({ variant: 'small', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACSection>\n );\n}\n\nfunction ChevronDownIcon(props: SVGAttributes<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\" fill=\"currentColor\" data-icon {...props}>\n <path d=\"M.124 3.603 5.617 9.84a.533.533 0 0 0 .769 0l5.49-6.236a.493.493 0 0 0-.054-.707l-.925-.778a.514.514 0 0 0-.719.055L6.095 6.9a.125.125 0 0 1-.189 0L1.822 2.173A.51.51 0 0 0 1.474 2a.5.5 0 0 0-.37.119l-.926.777a.494.494 0 0 0-.054.707Z\" />\n </svg>\n );\n}\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AA0Gb,gCAiBC;AAYD,sCAeC;;AApJD,gDAAwB;AACxB,iCAAqD;AACrD,iEAa+B;AAC/B,yDAAkD;AAClD,mDAA0E;AAC1E,mEAA2D;AAC3D,0FAAmF;AACnF,wEAA4G;AAE5G,qDAAmD;AAwBnD,SAAS,MAAM,CACb,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,YAAY,E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,KAAK,UAAU,EAAE,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,oBAAoB,aAC1D,uBAAC,8BAAS,IACR,SAAS,EAAE,IAAA,cAAI,EAAC,2BAA2B,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAErG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useEffect, type ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\n ListBox as RACListBox,\n type ListBoxProps as RACListBoxProps,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n Text as RACText,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheckmark, IconChevronDownFill } from '../../icons/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CollectionItem, CollectionProps, CommonProps, FieldProps, Key, StringLikeChildren } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface SelectProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldProps<Key>,\n CollectionProps<T>,\n Pick<\n RACSelectProps<T>,\n | 'name'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'autoComplete'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'placeholder'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<RACListBoxProps<T>, 'onScroll'> {}\n\nfunction Select<T extends CollectionItem>(\n { children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, ...props }: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (items != null && typeof children !== 'function') {\n console.warn('`Select` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACSelect {...props} ref={ref} className={clsx('cim-select', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACButton className=\"cim-select-button\">\n <RACSelectValue\n className={(values) => clsx(values.defaultClassName, textStyle({ variant: 'medium', alignment: 'start' }))}\n >\n {({ selectedText }) => selectedText}\n </RACSelectValue>\n <IconChevronDownFill />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <RACListBox className=\"cim-select-listbox\" onScroll={onScroll} items={items}>\n {children}\n </RACListBox>\n </CollapsibleList>\n </RACSelect>\n );\n}\n\n/**\n * Allows users to select one item from a collapsible list.\n *\n * See [select usage guidelines](https://ui.cimpress.io/components/select/).\n */\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nexport interface SelectItemProps\n extends Pick<RACListBoxItemProps, 'id' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `Select`. */\nexport function SelectItem({ children, ...props }: SelectItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-select-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheckmark />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nSelectItem.displayName = 'SelectItem';\n\nexport interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Select` into a section. */\nexport function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>) {\n if (items != null && typeof children !== 'function') {\n console.warn('`SelectSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-select-section\">\n <RACHeader\n className={clsx('cim-select-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nSelectSection.displayName = 'SelectSection';\n"]}
@@ -1,8 +1,10 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { DOMProps } from '../../types.js';
3
- export interface BoxProps extends DOMProps {
2
+ import type { CommonProps } from '../../types.js';
3
+ export interface BoxProps extends CommonProps {
4
+ /** The contents of the box. */
4
5
  children: ReactNode;
5
6
  }
6
- declare const _Box: (props: BoxProps & import("react").RefAttributes<HTMLDivElement> & import("../../../with-style-props.js").StyleProps) => ReactNode;
7
+ /** A primitive layout component that exposes style props. */
8
+ declare const _Box: (props: BoxProps & import("react").RefAttributes<HTMLDivElement> & import("../../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
7
9
  export { _Box as Box };
8
10
  //# sourceMappingURL=box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../../../src/components/spacing/box/box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAUD,QAAA,MAAM,IAAI,oIAAyC,CAAC;AAEpD,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../../../src/components/spacing/box/box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,QAAS,SAAQ,WAAW;IAC3C,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAUD,6DAA6D;AAC7D,QAAA,MAAM,IAAI,6JAAyC,CAAC;AAEpD,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.Box = void 0;
@@ -7,6 +8,7 @@ const with_style_props_js_1 = require("../../../with-style-props.js");
7
8
  function Box({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
8
9
  return ((0, jsx_runtime_1.jsx)("div", { ...props, ref: ref, className: UNSAFE_className, style: UNSAFE_style, role: "presentation", children: children }));
9
10
  }
11
+ /** A primitive layout component that exposes style props. */
10
12
  const _Box = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Box), 'Box');
11
13
  exports.Box = _Box;
12
14
  //# sourceMappingURL=box.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"box.js","sourceRoot":"","sources":["../../../../../src/components/spacing/box/box.tsx"],"names":[],"mappings":";;;;AACA,4DAAqD;AACrD,sEAA8D;AAO9D,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAY,EAAE,GAAiC;IAC9G,OAAO,CACL,mCAAS,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAC,cAAc,YAC5F,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAEnC,mBAAG","sourcesContent":["import type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../../forward-ref.js';\nimport { withStyleProps } from '../../../with-style-props.js';\nimport type { DOMProps } from '../../types.js';\n\nexport interface BoxProps extends DOMProps {\n children: ReactNode;\n}\n\nfunction Box({ children, UNSAFE_className, UNSAFE_style, ...props }: BoxProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <div {...props} ref={ref} className={UNSAFE_className} style={UNSAFE_style} role=\"presentation\">\n {children}\n </div>\n );\n}\n\nconst _Box = withStyleProps(forwardRef(Box), 'Box');\n\nexport { _Box as Box };\n"]}
1
+ {"version":3,"file":"box.js","sourceRoot":"","sources":["../../../../../src/components/spacing/box/box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAGb,4DAAqD;AACrD,sEAA8D;AAQ9D,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAY,EAAE,GAAiC;IAC9G,OAAO,CACL,mCAAS,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAC,cAAc,YAC5F,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,IAAI,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAEnC,mBAAG","sourcesContent":["'use client';\n\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../../forward-ref.js';\nimport { withStyleProps } from '../../../with-style-props.js';\nimport type { CommonProps } from '../../types.js';\n\nexport interface BoxProps extends CommonProps {\n /** The contents of the box. */\n children: ReactNode;\n}\n\nfunction Box({ children, UNSAFE_className, UNSAFE_style, ...props }: BoxProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <div {...props} ref={ref} className={UNSAFE_className} style={UNSAFE_style} role=\"presentation\">\n {children}\n </div>\n );\n}\n\n/** A primitive layout component that exposes style props. */\nconst _Box = withStyleProps(forwardRef(Box), 'Box');\n\nexport { _Box as Box };\n"]}