@cimpress-ui/react 0.4.0 → 1.0.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 (226) hide show
  1. package/README.md +0 -2
  2. package/dist/commonjs/components/app-header/app-header.d.ts +20 -0
  3. package/dist/commonjs/components/app-header/app-header.d.ts.map +1 -0
  4. package/dist/commonjs/components/app-header/app-header.js +26 -0
  5. package/dist/commonjs/components/app-header/app-header.js.map +1 -0
  6. package/dist/commonjs/components/app-header/cimpress-logo.d.ts.map +1 -0
  7. package/dist/commonjs/components/app-header/cimpress-logo.js.map +1 -0
  8. package/dist/commonjs/components/app-header/simple-auth-tool.d.ts +29 -0
  9. package/dist/commonjs/components/app-header/simple-auth-tool.d.ts.map +1 -0
  10. package/dist/commonjs/components/app-header/simple-auth-tool.js +31 -0
  11. package/dist/commonjs/components/app-header/simple-auth-tool.js.map +1 -0
  12. package/dist/commonjs/components/card/card.d.ts +41 -13
  13. package/dist/commonjs/components/card/card.d.ts.map +1 -1
  14. package/dist/commonjs/components/card/card.js +15 -15
  15. package/dist/commonjs/components/card/card.js.map +1 -1
  16. package/dist/commonjs/components/checkbox/checkbox.js +1 -1
  17. package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
  18. package/dist/commonjs/components/combo-box/combo-box.d.ts +5 -0
  19. package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
  20. package/dist/commonjs/components/combo-box/combo-box.js +10 -3
  21. package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
  22. package/dist/commonjs/components/date-picker/date-picker.js +1 -1
  23. package/dist/commonjs/components/date-picker/date-picker.js.map +1 -1
  24. package/dist/commonjs/components/drawer/drawer.d.ts +81 -0
  25. package/dist/commonjs/components/drawer/drawer.d.ts.map +1 -0
  26. package/dist/commonjs/components/drawer/drawer.js +59 -0
  27. package/dist/commonjs/components/drawer/drawer.js.map +1 -0
  28. package/dist/commonjs/components/file-picker/file-picker.d.ts.map +1 -1
  29. package/dist/commonjs/components/file-picker/file-picker.js +2 -2
  30. package/dist/commonjs/components/file-picker/file-picker.js.map +1 -1
  31. package/dist/commonjs/components/link-tabs/context.d.ts +2 -0
  32. package/dist/commonjs/components/link-tabs/context.d.ts.map +1 -0
  33. package/dist/commonjs/components/link-tabs/context.js +7 -0
  34. package/dist/commonjs/components/link-tabs/context.js.map +1 -0
  35. package/dist/commonjs/components/link-tabs/link-tabs.d.ts +36 -0
  36. package/dist/commonjs/components/link-tabs/link-tabs.d.ts.map +1 -0
  37. package/dist/commonjs/components/link-tabs/link-tabs.js +54 -0
  38. package/dist/commonjs/components/link-tabs/link-tabs.js.map +1 -0
  39. package/dist/commonjs/components/modal-dialog/modal-dialog.d.ts +3 -3
  40. package/dist/commonjs/components/modal-dialog/modal-dialog.d.ts.map +1 -1
  41. package/dist/commonjs/components/modal-dialog/modal-dialog.js +1 -5
  42. package/dist/commonjs/components/modal-dialog/modal-dialog.js.map +1 -1
  43. package/dist/commonjs/components/number-field/number-field.js +1 -1
  44. package/dist/commonjs/components/number-field/number-field.js.map +1 -1
  45. package/dist/commonjs/components/radio/radio.js +1 -1
  46. package/dist/commonjs/components/radio/radio.js.map +1 -1
  47. package/dist/commonjs/components/select/select.d.ts +5 -0
  48. package/dist/commonjs/components/select/select.d.ts.map +1 -1
  49. package/dist/commonjs/components/select/select.js +9 -2
  50. package/dist/commonjs/components/select/select.js.map +1 -1
  51. package/dist/commonjs/components/tabs/tabs.d.ts +53 -0
  52. package/dist/commonjs/components/tabs/tabs.d.ts.map +1 -0
  53. package/dist/commonjs/components/tabs/tabs.js +69 -0
  54. package/dist/commonjs/components/tabs/tabs.js.map +1 -0
  55. package/dist/commonjs/components/tag-field/tag-field-input.js +1 -2
  56. package/dist/commonjs/components/tag-field/tag-field-input.js.map +1 -1
  57. package/dist/commonjs/components/tag-field/tag-field-list-box.js +9 -2
  58. package/dist/commonjs/components/tag-field/tag-field-list-box.js.map +1 -1
  59. package/dist/commonjs/components/tag-field/tag-field-tags.js +6 -4
  60. package/dist/commonjs/components/tag-field/tag-field-tags.js.map +1 -1
  61. package/dist/commonjs/components/tag-field/tag-field.d.ts +19 -11
  62. package/dist/commonjs/components/tag-field/tag-field.d.ts.map +1 -1
  63. package/dist/commonjs/components/tag-field/tag-field.js +16 -16
  64. package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
  65. package/dist/commonjs/components/text-inputs/text-area.js +1 -1
  66. package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
  67. package/dist/commonjs/components/text-inputs/text-field.js +1 -1
  68. package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
  69. package/dist/commonjs/components/toggle/toggle.js +1 -1
  70. package/dist/commonjs/components/toggle/toggle.js.map +1 -1
  71. package/dist/commonjs/components/toggle-button/toggle-button-group.d.ts +15 -0
  72. package/dist/commonjs/components/toggle-button/toggle-button-group.d.ts.map +1 -0
  73. package/dist/commonjs/components/toggle-button/toggle-button-group.js +30 -0
  74. package/dist/commonjs/components/toggle-button/toggle-button-group.js.map +1 -0
  75. package/dist/commonjs/components/toggle-button/toggle-button.d.ts +16 -0
  76. package/dist/commonjs/components/toggle-button/toggle-button.d.ts.map +1 -0
  77. package/dist/commonjs/components/toggle-button/toggle-button.js +24 -0
  78. package/dist/commonjs/components/toggle-button/toggle-button.js.map +1 -0
  79. package/dist/commonjs/components/toggle-button/toggle-icon-button.d.ts +14 -0
  80. package/dist/commonjs/components/toggle-button/toggle-icon-button.d.ts.map +1 -0
  81. package/dist/commonjs/components/toggle-button/toggle-icon-button.js +24 -0
  82. package/dist/commonjs/components/toggle-button/toggle-icon-button.js.map +1 -0
  83. package/dist/commonjs/i18n/messages/en-US.d.ts.map +1 -1
  84. package/dist/commonjs/i18n/messages/en-US.js +6 -0
  85. package/dist/commonjs/i18n/messages/en-US.js.map +1 -1
  86. package/dist/commonjs/i18n/messages/types.d.ts +10 -0
  87. package/dist/commonjs/i18n/messages/types.d.ts.map +1 -1
  88. package/dist/commonjs/i18n/messages/types.js.map +1 -1
  89. package/dist/commonjs/icons/index.d.ts +1 -0
  90. package/dist/commonjs/icons/index.d.ts.map +1 -1
  91. package/dist/commonjs/icons/index.js +3 -1
  92. package/dist/commonjs/icons/index.js.map +1 -1
  93. package/dist/commonjs/icons/rating-star.d.ts +8 -0
  94. package/dist/commonjs/icons/rating-star.d.ts.map +1 -0
  95. package/dist/commonjs/icons/rating-star.js +24 -0
  96. package/dist/commonjs/icons/rating-star.js.map +1 -0
  97. package/dist/commonjs/index.d.ts +10 -4
  98. package/dist/commonjs/index.d.ts.map +1 -1
  99. package/dist/commonjs/index.js +10 -4
  100. package/dist/commonjs/index.js.map +1 -1
  101. package/dist/esm/components/app-header/app-header.d.ts +20 -0
  102. package/dist/esm/components/app-header/app-header.d.ts.map +1 -0
  103. package/dist/esm/components/app-header/app-header.js +20 -0
  104. package/dist/esm/components/app-header/app-header.js.map +1 -0
  105. package/dist/esm/components/app-header/cimpress-logo.d.ts.map +1 -0
  106. package/dist/esm/components/app-header/cimpress-logo.js.map +1 -0
  107. package/dist/esm/components/app-header/simple-auth-tool.d.ts +29 -0
  108. package/dist/esm/components/app-header/simple-auth-tool.d.ts.map +1 -0
  109. package/dist/esm/components/app-header/simple-auth-tool.js +28 -0
  110. package/dist/esm/components/app-header/simple-auth-tool.js.map +1 -0
  111. package/dist/esm/components/card/card.d.ts +41 -13
  112. package/dist/esm/components/card/card.d.ts.map +1 -1
  113. package/dist/esm/components/card/card.js +12 -12
  114. package/dist/esm/components/card/card.js.map +1 -1
  115. package/dist/esm/components/checkbox/checkbox.js +1 -1
  116. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  117. package/dist/esm/components/combo-box/combo-box.d.ts +5 -0
  118. package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
  119. package/dist/esm/components/combo-box/combo-box.js +11 -4
  120. package/dist/esm/components/combo-box/combo-box.js.map +1 -1
  121. package/dist/esm/components/date-picker/date-picker.js +1 -1
  122. package/dist/esm/components/date-picker/date-picker.js.map +1 -1
  123. package/dist/esm/components/drawer/drawer.d.ts +81 -0
  124. package/dist/esm/components/drawer/drawer.d.ts.map +1 -0
  125. package/dist/esm/components/drawer/drawer.js +50 -0
  126. package/dist/esm/components/drawer/drawer.js.map +1 -0
  127. package/dist/esm/components/file-picker/file-picker.d.ts.map +1 -1
  128. package/dist/esm/components/file-picker/file-picker.js +2 -2
  129. package/dist/esm/components/file-picker/file-picker.js.map +1 -1
  130. package/dist/esm/components/link-tabs/context.d.ts +2 -0
  131. package/dist/esm/components/link-tabs/context.d.ts.map +1 -0
  132. package/dist/esm/components/link-tabs/context.js +4 -0
  133. package/dist/esm/components/link-tabs/context.js.map +1 -0
  134. package/dist/esm/components/link-tabs/link-tabs.d.ts +36 -0
  135. package/dist/esm/components/link-tabs/link-tabs.d.ts.map +1 -0
  136. package/dist/esm/components/link-tabs/link-tabs.js +47 -0
  137. package/dist/esm/components/link-tabs/link-tabs.js.map +1 -0
  138. package/dist/esm/components/modal-dialog/modal-dialog.d.ts +3 -3
  139. package/dist/esm/components/modal-dialog/modal-dialog.d.ts.map +1 -1
  140. package/dist/esm/components/modal-dialog/modal-dialog.js +1 -5
  141. package/dist/esm/components/modal-dialog/modal-dialog.js.map +1 -1
  142. package/dist/esm/components/number-field/number-field.js +1 -1
  143. package/dist/esm/components/number-field/number-field.js.map +1 -1
  144. package/dist/esm/components/radio/radio.js +1 -1
  145. package/dist/esm/components/radio/radio.js.map +1 -1
  146. package/dist/esm/components/select/select.d.ts +5 -0
  147. package/dist/esm/components/select/select.d.ts.map +1 -1
  148. package/dist/esm/components/select/select.js +10 -3
  149. package/dist/esm/components/select/select.js.map +1 -1
  150. package/dist/esm/components/tabs/tabs.d.ts +53 -0
  151. package/dist/esm/components/tabs/tabs.d.ts.map +1 -0
  152. package/dist/esm/components/tabs/tabs.js +59 -0
  153. package/dist/esm/components/tabs/tabs.js.map +1 -0
  154. package/dist/esm/components/tag-field/tag-field-input.js +1 -2
  155. package/dist/esm/components/tag-field/tag-field-input.js.map +1 -1
  156. package/dist/esm/components/tag-field/tag-field-list-box.js +10 -3
  157. package/dist/esm/components/tag-field/tag-field-list-box.js.map +1 -1
  158. package/dist/esm/components/tag-field/tag-field-tags.js +6 -4
  159. package/dist/esm/components/tag-field/tag-field-tags.js.map +1 -1
  160. package/dist/esm/components/tag-field/tag-field.d.ts +19 -11
  161. package/dist/esm/components/tag-field/tag-field.d.ts.map +1 -1
  162. package/dist/esm/components/tag-field/tag-field.js +13 -13
  163. package/dist/esm/components/tag-field/tag-field.js.map +1 -1
  164. package/dist/esm/components/text-inputs/text-area.js +1 -1
  165. package/dist/esm/components/text-inputs/text-area.js.map +1 -1
  166. package/dist/esm/components/text-inputs/text-field.js +1 -1
  167. package/dist/esm/components/text-inputs/text-field.js.map +1 -1
  168. package/dist/esm/components/toggle/toggle.js +1 -1
  169. package/dist/esm/components/toggle/toggle.js.map +1 -1
  170. package/dist/esm/components/toggle-button/toggle-button-group.d.ts +15 -0
  171. package/dist/esm/components/toggle-button/toggle-button-group.d.ts.map +1 -0
  172. package/dist/esm/components/toggle-button/toggle-button-group.js +24 -0
  173. package/dist/esm/components/toggle-button/toggle-button-group.js.map +1 -0
  174. package/dist/esm/components/toggle-button/toggle-button.d.ts +16 -0
  175. package/dist/esm/components/toggle-button/toggle-button.d.ts.map +1 -0
  176. package/dist/esm/components/toggle-button/toggle-button.js +18 -0
  177. package/dist/esm/components/toggle-button/toggle-button.js.map +1 -0
  178. package/dist/esm/components/toggle-button/toggle-icon-button.d.ts +14 -0
  179. package/dist/esm/components/toggle-button/toggle-icon-button.d.ts.map +1 -0
  180. package/dist/esm/components/toggle-button/toggle-icon-button.js +18 -0
  181. package/dist/esm/components/toggle-button/toggle-icon-button.js.map +1 -0
  182. package/dist/esm/i18n/messages/en-US.d.ts.map +1 -1
  183. package/dist/esm/i18n/messages/en-US.js +6 -0
  184. package/dist/esm/i18n/messages/en-US.js.map +1 -1
  185. package/dist/esm/i18n/messages/types.d.ts +10 -0
  186. package/dist/esm/i18n/messages/types.d.ts.map +1 -1
  187. package/dist/esm/i18n/messages/types.js.map +1 -1
  188. package/dist/esm/icons/index.d.ts +1 -0
  189. package/dist/esm/icons/index.d.ts.map +1 -1
  190. package/dist/esm/icons/index.js +1 -0
  191. package/dist/esm/icons/index.js.map +1 -1
  192. package/dist/esm/icons/rating-star.d.ts +8 -0
  193. package/dist/esm/icons/rating-star.d.ts.map +1 -0
  194. package/dist/esm/icons/rating-star.js +19 -0
  195. package/dist/esm/icons/rating-star.js.map +1 -0
  196. package/dist/esm/index.d.ts +10 -4
  197. package/dist/esm/index.d.ts.map +1 -1
  198. package/dist/esm/index.js +10 -4
  199. package/dist/esm/index.js.map +1 -1
  200. package/dist-styles/core.css +1 -1
  201. package/dist-styles/styles.css +1 -1
  202. package/package.json +1 -1
  203. package/dist/commonjs/components/header/cimpress-logo.d.ts.map +0 -1
  204. package/dist/commonjs/components/header/cimpress-logo.js.map +0 -1
  205. package/dist/commonjs/components/header/header.d.ts +0 -10
  206. package/dist/commonjs/components/header/header.d.ts.map +0 -1
  207. package/dist/commonjs/components/header/header.js +0 -19
  208. package/dist/commonjs/components/header/header.js.map +0 -1
  209. package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts +0 -23
  210. package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts.map +0 -1
  211. package/dist/commonjs/components/nav-tabs/nav-tabs.js +0 -27
  212. package/dist/commonjs/components/nav-tabs/nav-tabs.js.map +0 -1
  213. package/dist/esm/components/header/cimpress-logo.d.ts.map +0 -1
  214. package/dist/esm/components/header/cimpress-logo.js.map +0 -1
  215. package/dist/esm/components/header/header.d.ts +0 -10
  216. package/dist/esm/components/header/header.d.ts.map +0 -1
  217. package/dist/esm/components/header/header.js +0 -13
  218. package/dist/esm/components/header/header.js.map +0 -1
  219. package/dist/esm/components/nav-tabs/nav-tabs.d.ts +0 -23
  220. package/dist/esm/components/nav-tabs/nav-tabs.d.ts.map +0 -1
  221. package/dist/esm/components/nav-tabs/nav-tabs.js +0 -20
  222. package/dist/esm/components/nav-tabs/nav-tabs.js.map +0 -1
  223. /package/dist/commonjs/components/{header → app-header}/cimpress-logo.d.ts +0 -0
  224. /package/dist/commonjs/components/{header → app-header}/cimpress-logo.js +0 -0
  225. /package/dist/esm/components/{header → app-header}/cimpress-logo.d.ts +0 -0
  226. /package/dist/esm/components/{header → app-header}/cimpress-logo.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"card.js","sourceRoot":"","sources":["../../../../src/components/card/card.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAO7C,SAAS,aAAa,CACpB,EAAE,QAAQ,EAAE,OAAO,GAAG,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAsB,EAChG,GAAiC;IAEjC,OAAO,CACL,iBACM,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAC7C,KAAK,EAAE,YAAY,kBACL,OAAO,YAEpB,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;AAEzE,OAAO,EAAE,cAAc,IAAI,aAAa,EAAE,CAAC;AAO3C,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACkB;IAC1B,OAAO,CACL,iBACM,KAAK,EACT,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,KAAK,EAAE,YAAY,qBACF,SAAS,IAAI,SAAS,YAEtC,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,WAAW,GAAG,aAAa,CAAC;AASjD,MAAM,UAAU,mBAAmB,CAAC,EAClC,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,WAAW,EACX,IAAI,EACJ,GAAG,KAAK,EACiB;IACzB,OAAO,CACL,kBAAS,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,aAC1G,SAAS,EAEV,eAAK,SAAS,EAAC,sBAAsB,aACnC,KAAC,IAAI,IAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,YAC9C,KAAK,GACD,EACP,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,YAC1C,WAAW,GACP,IACH,EAEL,IAAI,IAAI,CACP,MAAC,QAAQ,eAEP,KAAC,UAAU,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,KAAC,sBAAsB,KAAG,gBAAa,SAAS,GAAG,EACpG,IAAI,IACI,CACZ,IACG,CACP,CAAC;AACJ,CAAC;AAED,mBAAmB,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconMenuMoreHorizontal } from '../../icons/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { MenuRoot } from '../menu/menu.js';\nimport type { CommonProps } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface UNSTABLE_CardProps extends CommonProps {\n children: ReactNode;\n variant?: 'bordered' | 'borderless';\n}\n\nfunction UNSTABLE_Card(\n { children, variant = 'bordered', UNSAFE_className, UNSAFE_style, ...props }: UNSTABLE_CardProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...props}\n ref={ref}\n className={clsx('cim-card', UNSAFE_className)}\n style={UNSAFE_style}\n data-variant={variant}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Groups related blocks of content into a single unit.\n *\n * See [card usage guidelines](https://ui.cimpress.io/components/card/).\n */\nconst _UNSTABLE_Card = withStyleProps(forwardRef(UNSTABLE_Card), 'Card');\n\nexport { _UNSTABLE_Card as UNSTABLE_Card };\n\nexport interface UNSTABLE_CardContentProps extends CommonProps {\n children: ReactNode;\n fullBleed?: boolean;\n}\n\nexport function UNSTABLE_CardContent({\n children,\n UNSAFE_className,\n UNSAFE_style,\n fullBleed = false,\n ...props\n}: UNSTABLE_CardContentProps) {\n return (\n <div\n {...props}\n className={clsx('cim-card-content', UNSAFE_className)}\n style={UNSAFE_style}\n data-full-bleed={fullBleed || undefined}\n >\n {children}\n </div>\n );\n}\n\nUNSTABLE_CardContent.displayName = 'CardContent';\n\nexport interface UNSTABLE_CardHeaderProps extends CommonProps {\n iconStart?: ReactNode;\n title: string;\n description?: string;\n menu?: ReactNode;\n}\n\nexport function UNSTABLE_CardHeader({\n UNSAFE_className,\n UNSAFE_style,\n iconStart,\n title,\n description,\n menu,\n ...props\n}: UNSTABLE_CardHeaderProps) {\n return (\n <div {...props} className={clsx('cim-card-header', 'cim-card-content', UNSAFE_className)} style={UNSAFE_style}>\n {iconStart}\n\n <div className=\"cim-card-header-text\">\n <Text as=\"h2\" variant=\"body-semibold\" tone=\"base\">\n {title}\n </Text>\n <Text as=\"span\" variant=\"small\" tone=\"subtle\">\n {description}\n </Text>\n </div>\n\n {menu && (\n <MenuRoot>\n {/* TODO: i18n */}\n <IconButton variant=\"tertiary\" size=\"small\" icon={<IconMenuMoreHorizontal />} aria-label=\"Actions\" />\n {menu}\n </MenuRoot>\n )}\n </div>\n );\n}\n\nUNSTABLE_CardHeader.displayName = 'CardHeader';\n"]}
1
+ {"version":3,"file":"card.js","sourceRoot":"","sources":["../../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAO7C,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAa,EAAE,GAAiC;IAChH,OAAO,CACL,iBAAS,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,YACzF,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAEvD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;AAYzB,uDAAuD;AACvD,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACS;IACjB,OAAO,CACL,iBACM,KAAK,EACT,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,KAAK,EAAE,YAAY,qBACF,SAAS,IAAI,SAAS,YAEtC,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AA8BxC,wCAAwC;AACxC,MAAM,UAAU,UAAU,CAAC,EACzB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,kBAAS,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,aAC1G,SAAS,EAEV,eAAK,SAAS,EAAC,sBAAsB,aACnC,KAAC,IAAI,IAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,YAC9C,KAAK,GACD,EACN,WAAW,IAAI,CACd,KAAC,IAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,YACvC,WAAW,GACP,CACR,IACG,EAEN,cAAK,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAO,IAChD,CACP,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\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';\nimport { Text } from '../typography/text.js';\n\nexport interface CardProps extends CommonProps {\n /** The contents of the card. */\n children: ReactNode;\n}\n\nfunction Card({ children, UNSAFE_className, UNSAFE_style, ...props }: CardProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <div {...props} ref={ref} className={clsx('cim-card', UNSAFE_className)} style={UNSAFE_style}>\n {children}\n </div>\n );\n}\n\n/**\n * Groups related blocks of content into a single unit.\n *\n * See [card usage guidelines](https://ui.cimpress.io/components/card/).\n */\nconst _Card = withStyleProps(forwardRef(Card), 'Card');\n\nexport { _Card as Card };\n\nexport interface CardContentProps extends CommonProps {\n /** The content of this block. */\n children: ReactNode;\n /**\n * Whether the block's content should stretch to the edges of the block.\n * @default false\n */\n fullBleed?: boolean;\n}\n\n/** Renders a single block of content within `Card`. */\nexport function CardContent({\n children,\n UNSAFE_className,\n UNSAFE_style,\n fullBleed = false,\n ...props\n}: CardContentProps) {\n return (\n <div\n {...props}\n className={clsx('cim-card-content', UNSAFE_className)}\n style={UNSAFE_style}\n data-full-bleed={fullBleed || undefined}\n >\n {children}\n </div>\n );\n}\n\nCardContent.displayName = 'CardContent';\n\nexport interface CardHeaderProps extends CommonProps {\n /** The icon to display at the start of the header. */\n iconStart?: ReactNode;\n /**\n * The title of the card. Optionally, you can pass a React node to render a link.\n *\n * @example\n * <CardHeader title=\"Card title\" />\n * <CardHeader title={<Link href=\"#\">Card title</Link>} />\n */\n title: ReactNode;\n /**\n * The description of the card. Optionally, you can pass a React node to render rich text.\n *\n * @example\n * <CardHeader title=\"Card title\" description=\"Card subtitle\" />\n * <CardHeader title=\"Card title\" description={<Link href=\"#\">Card subtitle</Link>} />\n */\n description?: ReactNode;\n /**\n * The tools to render at the end of the header. Usually a menu, icon button, or badge. For buttons, use the \"small\" size variant.\n *\n * @example\n * <CardHeader title=\"Card title\" tools={<IconButton size=\"small\" icon={<IconRatingStar />} aria-label=\"Favorite\" />} />\n */\n tools?: ReactNode;\n}\n\n/** Renders a header within a `Card`. */\nexport function CardHeader({\n UNSAFE_className,\n UNSAFE_style,\n iconStart,\n title,\n description,\n tools,\n ...props\n}: CardHeaderProps) {\n return (\n <div {...props} className={clsx('cim-card-header', 'cim-card-content', UNSAFE_className)} style={UNSAFE_style}>\n {iconStart}\n\n <div className=\"cim-card-header-text\">\n <Text as=\"h2\" variant=\"body-semibold\" tone=\"base\">\n {title}\n </Text>\n {description && (\n <Text as=\"p\" variant=\"small\" tone=\"subtle\">\n {description}\n </Text>\n )}\n </div>\n\n <div className=\"cim-card-header-tools\">{tools}</div>\n </div>\n );\n}\n\nCardHeader.displayName = 'CardHeader';\n"]}
@@ -14,7 +14,7 @@ function Checkbox({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
14
14
  console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');
15
15
  }
16
16
  }, [children, ariaLabel, ariaLabelledBy]);
17
- return (_jsx(RACCheckbox, { ...props, ref: ref, className: clsx('cim-checkbox', UNSAFE_className), style: UNSAFE_style, children: ({ isIndeterminate }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "cim-checkbox-toggle-wrapper", children: _jsx("div", { className: "cim-checkbox-toggle", children: isIndeterminate ? _jsx(IconSubtractBold, {}) : _jsx(IconCheckBold, {}) }) }), children && (_jsx(Text, { as: "span", variant: "body", children: children }))] })) }));
17
+ return (_jsx(RACCheckbox, { ...props, ref: ref, className: clsx('cim-checkbox', UNSAFE_className), style: UNSAFE_style, children: ({ isIndeterminate }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "cim-checkbox-toggle-wrapper", children: _jsx("div", { className: "cim-checkbox-toggle", children: isIndeterminate ? _jsx(IconSubtractBold, {}) : _jsx(IconCheckBold, {}) }) }), children && (_jsx(Text, { as: "span", variant: "medium", children: children }))] })) }));
18
18
  }
19
19
  /**
20
20
  * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,IAAI,WAAW,EAA0C,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAuB7C,SAAS,QAAQ,CACf,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAiB,EACrE,GAAmC;IAEnC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,oBAAoB,CAAC,GAAG,EAAE;QACxB,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACrG,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,KAAC,WAAW,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,YACrG,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CACxB,8BACE,cAAK,SAAS,EAAC,6BAA6B,YAC1C,cAAK,SAAS,EAAC,qBAAqB,YAAE,eAAe,CAAC,CAAC,CAAC,KAAC,gBAAgB,KAAG,CAAC,CAAC,CAAC,KAAC,aAAa,KAAG,GAAO,GACnG,EACL,QAAQ,IAAI,CACX,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,YAC3B,QAAQ,GACJ,CACR,IACA,CACJ,GACW,CACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { Checkbox as RACCheckbox, type CheckboxProps as RACCheckboxProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheckBold, IconSubtractBold } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface CheckboxProps\n extends CommonProps,\n AriaLabelingProps,\n Pick<\n RACCheckboxProps,\n | 'onChange'\n | 'isSelected'\n | 'isIndeterminate'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isRequired'\n | 'isInvalid'\n | 'name'\n | 'value'\n | 'defaultSelected'\n | 'autoFocus'\n > {\n /** The label rendered next to the checkbox. */\n children?: StringLikeChildren;\n}\n\nfunction Checkbox(\n { children, UNSAFE_className, UNSAFE_style, ...props }: CheckboxProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACCheckbox {...props} ref={ref} className={clsx('cim-checkbox', UNSAFE_className)} style={UNSAFE_style}>\n {({ isIndeterminate }) => (\n <>\n <div className=\"cim-checkbox-toggle-wrapper\">\n <div className=\"cim-checkbox-toggle\">{isIndeterminate ? <IconSubtractBold /> : <IconCheckBold />}</div>\n </div>\n {children && (\n <Text as=\"span\" variant=\"body\">\n {children}\n </Text>\n )}\n </>\n )}\n </RACCheckbox>\n );\n}\n\n/**\n * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.\n *\n * See [checkbox usage guidelines](https://ui.cimpress.io/components/checkbox/).\n */\nconst _Checkbox = withStyleProps(forwardRef(Checkbox), 'Checkbox');\n\nexport { _Checkbox as Checkbox };\n"]}
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/components/chec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Q,IAAI,CACX,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,YAC7B,QAAQ,GACJ,CACR,IACA,CACJ,GACW,CACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { Checkbox as RACCheckbox, type CheckboxProps as RACCheckboxProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheckBold, IconSubtractBold } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface CheckboxProps\n extends CommonProps,\n AriaLabelingProps,\n Pick<\n RACCheckboxProps,\n | 'onChange'\n | 'isSelected'\n | 'isIndeterminate'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isRequired'\n | 'isInvalid'\n | 'name'\n | 'value'\n | 'defaultSelected'\n | 'autoFocus'\n > {\n /** The label rendered next to the checkbox. */\n children?: StringLikeChildren;\n}\n\nfunction Checkbox(\n { children, UNSAFE_className, UNSAFE_style, ...props }: CheckboxProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACCheckbox {...props} ref={ref} className={clsx('cim-checkbox', UNSAFE_className)} style={UNSAFE_style}>\n {({ isIndeterminate }) => (\n <>\n <div className=\"cim-checkbox-toggle-wrapper\">\n <div className=\"cim-checkbox-toggle\">{isIndeterminate ? <IconSubtractBold /> : <IconCheckBold />}</div>\n </div>\n {children && (\n <Text as=\"span\" variant=\"medium\">\n {children}\n </Text>\n )}\n </>\n )}\n </RACCheckbox>\n );\n}\n\n/**\n * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.\n *\n * See [checkbox usage guidelines](https://ui.cimpress.io/components/checkbox/).\n */\nconst _Checkbox = withStyleProps(forwardRef(Checkbox), 'Checkbox');\n\nexport { _Checkbox as Checkbox };\n"]}
@@ -8,6 +8,11 @@ export interface ComboBoxValidationValue {
8
8
  inputValue: string;
9
9
  }
10
10
  export interface ComboBoxProps<T extends CollectionItem = CollectionItem> extends CommonProps, FieldWithPlaceholderProps<ComboBoxValidationValue>, CollectionProps<T>, Pick<RACComboBoxProps<T>, 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'selectedKey' | 'defaultSelectedKey' | 'inputValue' | 'defaultInputValue' | 'autoFocus' | 'onSelectionChange' | 'onInputChange' | 'onFocus' | 'onBlur' | 'onOpenChange'>, Pick<RACListBoxProps<T>, 'onScroll'> {
11
+ /**
12
+ * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.
13
+ * @default false
14
+ */
15
+ isVirtualized?: boolean;
11
16
  }
12
17
  /**
13
18
  * Allows users to filter a collapsible list and select one item from it.
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAIA,OAAO,EASL,KAAK,YAAY,IAAI,eAAe,EAIpC,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,gBAAgB,IAAI,mBAAmB,EAC7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,gFAAgF;AA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,EAAE,MAAM,CAAC;CACf;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAezB;yBApBe,eAAe"}
1
+ {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAIA,OAAO,EASL,KAAK,YAAY,IAAI,eAAe,EAMpC,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAUrB,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,WAAW,EAAE,GAAG,GAAG,IAAI,CAAC;IACxB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CACtE,SAAQ,WAAW,EACjB,yBAAyB,CAAC,uBAAuB,CAAC,EAClD,eAAe,CAAC,CAAC,CAAC,EAClB,IAAI,CACF,gBAAgB,CAAC,CAAC,CAAC,EACjB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,aAAa,GACb,oBAAoB,GACpB,YAAY,GACZ,mBAAmB,GACnB,WAAW,GACX,mBAAmB,GACnB,eAAe,GACf,SAAS,GACT,QAAQ,GACR,cAAc,CACjB,EACD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0ED;;;;GAIG;AACH,QAAA,MAAM,SAAS,GA7EG,CAAC,SAAS,cAAc,iKA6EwB,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC;AAsBjC,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,cAAc,CACzD,SAAQ,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;IACzF,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAiBlG;yBAjBe,YAAY;;;AAqB5B,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACxF,6EAA6E;IAC7E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAezB;yBApBe,eAAe"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import clsx from 'clsx';
4
4
  import { useContext } from 'react';
5
- import { Button as RACButton, Collection as RACCollection, ComboBox as RACComboBox, ComboBoxStateContext as RACComboBoxStateContext, Group as RACGroup, Header as RACHeader, Input as RACInput, ListBox as RACListBox, ListBoxItem as RACListBoxItem, ListBoxSection as RACListBoxSection, Text as RACText, } from 'react-aria-components';
5
+ import { Button as RACButton, Collection as RACCollection, ComboBox as RACComboBox, ComboBoxStateContext as RACComboBoxStateContext, Group as RACGroup, Header as RACHeader, Input as RACInput, ListBox as RACListBox, ListBoxItem as RACListBoxItem, ListBoxSection as RACListBoxSection, ListLayout as RACListLayout, Text as RACText, Virtualizer as RACVirtualizer, } from 'react-aria-components';
6
6
  import { forwardRef } from '../../forward-ref.js';
7
7
  import { IconCheck, IconChevronDown } from '../../icons/index.js';
8
8
  import { isProduction } from '../../utils/is-production.js';
@@ -11,7 +11,13 @@ import { withStyleProps } from '../../with-style-props.js';
11
11
  import { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';
12
12
  import { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';
13
13
  import { textStyle } from '../typography/utils.js';
14
- function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, ...props }, ref) {
14
+ const VIRTUAL_LAYOUT_OPTIONS = {
15
+ rowHeight: 40,
16
+ headingHeight: 32,
17
+ padding: 0,
18
+ gap: 0,
19
+ };
20
+ function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, isVirtualized = false, ...props }, ref) {
15
21
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
16
22
  useProductionWarning(() => {
17
23
  if (!label && !ariaLabel && !ariaLabelledBy) {
@@ -21,7 +27,8 @@ function ComboBox({ label, description, error, items, children, placeholder, UNS
21
27
  if (!isProduction() && items != null && typeof children !== 'function') {
22
28
  console.warn('`ComboBox` requires `children` to be a function when using `items` prop');
23
29
  }
24
- return (_jsxs(RACComboBox, { ...props, ref: ref, className: clsx('cim-combo-box', UNSAFE_className), style: UNSAFE_style, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-combo-box-input-group", children: [_jsx(ComboBoxInput, { isReadOnly: isReadOnly, placeholder: placeholder }), _jsx(RACButton, { className: "cim-combo-box-button", children: _jsx(IconChevronDown, {}) })] }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description }), _jsx(CollapsibleList, { offset: 5, maxHeight: 315, children: _jsx(RACListBox, { className: "cim-combo-box-listbox", onScroll: onScroll, items: items, children: children }) })] }));
30
+ const listBox = (_jsx(RACListBox, { className: "cim-combo-box-listbox", onScroll: onScroll, items: items, children: children }));
31
+ return (_jsxs(RACComboBox, { ...props, ref: ref, className: clsx('cim-combo-box', UNSAFE_className), style: UNSAFE_style, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-combo-box-input-group", children: [_jsx(ComboBoxInput, { isReadOnly: isReadOnly, placeholder: placeholder }), _jsx(RACButton, { className: "cim-combo-box-button", children: _jsx(IconChevronDown, {}) })] }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description }), _jsx(CollapsibleList, { offset: 5, maxHeight: 315, children: isVirtualized ? (_jsx(RACVirtualizer, { layout: RACListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox) })] }));
25
32
  }
26
33
  /**
27
34
  * Allows users to filter a collapsible list and select one item from it.
@@ -32,7 +39,7 @@ const _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');
32
39
  export { _ComboBox as ComboBox };
33
40
  function ComboBoxInput({ isReadOnly, placeholder, }) {
34
41
  const comboBoxState = useContext(RACComboBoxStateContext);
35
- return (_jsx(RACInput, { className: clsx('cim-combo-box-input', textStyle({ variant: 'medium' })),
42
+ return (_jsx(RACInput, { className: clsx('cim-combo-box-input', textStyle({ variant: 'body' })),
36
43
  // Ensure the popover opens when the input is clicked.
37
44
  // By default, React Aria only opens the popover when the input is focused.
38
45
  onClick: () => !isReadOnly && comboBoxState.open(), placeholder: placeholder }));
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/comb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AW,GAAG,cAAc,CAAC;AAS1C,0DAA0D;AAC1D,MAAM,UAAU,eAAe,CAA2B,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACgB;IACxB,IAAI,CAAC,YAAY,EAAE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CACL,MAAC,iBAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aAC7D,KAAC,SAAS,IACR,SAAS,EAAE,IAAI,CAAC,8BAA8B,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAExG,KAAK,GACI,EACZ,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useContext, type ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n type ListBoxProps as RACListBoxProps,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.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 {\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\n/** Represents the state of the `ComboBox` component for validation purposes. */\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<RACListBoxProps<T>, 'onScroll'> {}\n\nfunction ComboBox<T extends CollectionItem>(\n {\n label,\n description,\n error,\n items,\n children,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n isReadOnly,\n onScroll,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBox` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput isReadOnly={isReadOnly} placeholder={placeholder} />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\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-combo-box-listbox\" onScroll={onScroll} items={items}>\n {children}\n </RACListBox>\n </CollapsibleList>\n </RACComboBox>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select one item from it.\n *\n * See [combo box usage guidelines](https://ui.cimpress.com/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxInput({\n isReadOnly,\n placeholder,\n}: {\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n className={clsx('cim-combo-box-input', textStyle({ variant: 'medium' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState!.open()}\n placeholder={placeholder}\n />\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem>\n extends Pick<RACListBoxItemProps<T>, 'id' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `ComboBox`. */\nexport function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-combo-box-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheck />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport interface ComboBoxSectionProps<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 `ComboBox` into a section. */\nexport function ComboBoxSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: ComboBoxSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-combo-box-section\">\n <RACHeader\n className={clsx('cim-combo-box-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nComboBoxSection.displayName = 'ComboBoxSection';\n"]}
1
+ {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AACtD,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,oBAAoB,IAAI,uBAAuB,EAC/C,KAAK,IAAI,QAAQ,EACjB,MAAM,IAAI,SAAS,EACnB,KAAK,IAAI,QAAQ,EACjB,OAAO,IAAI,UAAU,EAErB,WAAW,IAAI,cAAc,EAC7B,cAAc,IAAI,iBAAiB,EACnC,UAAU,IAAI,aAAa,EAE3B,IAAI,IAAI,OAAO,EAGf,WAAW,IAAI,cAAc,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,eAA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AAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CACL,MAAC,iBAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aAC7D,KAAC,SAAS,IACR,SAAS,EAAE,IAAI,CAAC,8BAA8B,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAExG,KAAK,GACI,EACZ,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useContext, type ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n type ListBoxProps as RACListBoxProps,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.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 {\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n rowHeight: 40,\n headingHeight: 32,\n padding: 0,\n gap: 0,\n};\n\n/** Represents the state of the `ComboBox` component for validation purposes. */\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<RACListBoxProps<T>, 'onScroll'> {\n /**\n * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.\n * @default false\n */\n isVirtualized?: boolean;\n}\n\nfunction ComboBox<T extends CollectionItem>(\n {\n label,\n description,\n error,\n items,\n children,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n isReadOnly,\n onScroll,\n isVirtualized = false,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBox` requires `children` to be a function when using `items` prop');\n }\n\n const listBox = (\n <RACListBox className=\"cim-combo-box-listbox\" onScroll={onScroll} items={items}>\n {children}\n </RACListBox>\n );\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput isReadOnly={isReadOnly} placeholder={placeholder} />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACComboBox>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select one item from it.\n *\n * See [combo box usage guidelines](https://ui.cimpress.com/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxInput({\n isReadOnly,\n placeholder,\n}: {\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n className={clsx('cim-combo-box-input', textStyle({ variant: 'body' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState!.open()}\n placeholder={placeholder}\n />\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem>\n extends Pick<RACListBoxItemProps<T>, 'id' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `ComboBox`. */\nexport function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-combo-box-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheck />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport interface ComboBoxSectionProps<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 `ComboBox` into a section. */\nexport function ComboBoxSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: ComboBoxSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-combo-box-section\">\n <RACHeader\n className={clsx('cim-combo-box-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nComboBoxSection.displayName = 'ComboBoxSection';\n"]}
@@ -20,7 +20,7 @@ function DatePicker({ label, description, error: errorMessage, focusedValue, def
20
20
  }
21
21
  }, [label, ariaLabel, ariaLabelledBy]);
22
22
  const messages = useLocalizedMessages('datePicker');
23
- return (_jsxs(RACDatePicker, { ...props, ref: ref, className: clsx('cim-date-picker', UNSAFE_className), style: UNSAFE_style, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-date-picker-input-group", "data-readonly": props.isReadOnly || undefined, children: [_jsx(RACDateInput, { className: clsx('cim-date-picker-input', textStyle({ variant: 'medium' })), children: (segment) => (_jsx("span", { className: "cim-date-picker-segment-wrapper", children: _jsx(RACDateSegment, { segment: segment }) })) }), _jsxs("div", { className: "cim-date-picker-input-controls", children: [_jsx(DatePickerClearButton, { isDisabled: props.isDisabled || props.isReadOnly }), _jsx(IconButton, { icon: _jsx(IconCalendarEmpty, {}), "aria-label": messages.format('openCalendar'), variant: "tertiary", size: "small" })] })] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), _jsx(RACPopover, { className: "cim-date-picker-popover", placement: "bottom end", offset: 5, containerPadding: 16, "data-cim-style-root": true, children: _jsx(RACDialog, { children: _jsx(DatePickerCalendar, { focusedValue: focusedValue, defaultFocusedValue: defaultFocusedValue, placeholderValue: props.placeholderValue }) }) })] }));
23
+ return (_jsxs(RACDatePicker, { ...props, ref: ref, className: clsx('cim-date-picker', UNSAFE_className), style: UNSAFE_style, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-date-picker-input-group", "data-readonly": props.isReadOnly || undefined, children: [_jsx(RACDateInput, { className: clsx('cim-date-picker-input', textStyle({ variant: 'body' })), children: (segment) => (_jsx("span", { className: "cim-date-picker-segment-wrapper", children: _jsx(RACDateSegment, { segment: segment }) })) }), _jsxs("div", { className: "cim-date-picker-input-controls", children: [_jsx(DatePickerClearButton, { isDisabled: props.isDisabled || props.isReadOnly }), _jsx(IconButton, { icon: _jsx(IconCalendarEmpty, {}), "aria-label": messages.format('openCalendar'), variant: "tertiary", size: "small" })] })] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), _jsx(RACPopover, { className: "cim-date-picker-popover", placement: "bottom end", offset: 5, containerPadding: 16, "data-cim-style-root": true, children: _jsx(RACDialog, { children: _jsx(DatePickerCalendar, { focusedValue: focusedValue, defaultFocusedValue: defaultFocusedValue, placeholderValue: props.placeholderValue }) }) })] }));
24
24
  }
25
25
  /**
26
26
  * Allows users to enter or select a date and time value.
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../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esContent":["'use client';\n\nimport type { CalendarDate, CalendarDateTime, ZonedDateTime } from '@internationalized/date';\nimport clsx from 'clsx';\nimport { useContext, type ForwardedRef } from 'react';\nimport {\n type CalendarProps as RACCalendarProps,\n DateInput as RACDateInput,\n DatePicker as RACDatePicker,\n type DatePickerProps as RACDatePickerProps,\n DatePickerStateContext as RACDatePickerStateContext,\n DateSegment as RACDateSegment,\n Dialog as RACDialog,\n Group as RACGroup,\n Popover as RACPopover,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCalendarEmpty } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\nimport { DatePickerCalendar } from './date-picker-calendar.js';\n\n/** Represents a date with optional time and timezone components. */\nexport type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Maps a date value to a specific subtype depending on which components it contains. */\nexport type MappedDateValue<T> = T extends ZonedDateTime\n ? ZonedDateTime\n : T extends CalendarDateTime\n ? CalendarDateTime\n : T extends CalendarDate\n ? CalendarDate\n : never;\n\nexport interface DatePickerProps<T extends DateValue>\n extends CommonProps,\n FieldProps<MappedDateValue<T>>,\n Pick<\n RACDatePickerProps<T>,\n | 'value'\n | 'defaultValue'\n | 'placeholderValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'onFocus'\n | 'onBlur'\n | 'isOpen'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'minValue'\n | 'maxValue'\n | 'isDateUnavailable'\n | 'granularity'\n | 'firstDayOfWeek'\n >,\n Pick<RACCalendarProps<T>, 'focusedValue' | 'defaultFocusedValue'> {}\n\nfunction DatePicker<T extends DateValue>(\n {\n label,\n description,\n error: errorMessage,\n focusedValue,\n defaultFocusedValue,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: DatePickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('DatePicker requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('datePicker');\n\n return (\n <RACDatePicker {...props} ref={ref} className={clsx('cim-date-picker', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-date-picker-input-group\" data-readonly={props.isReadOnly || undefined}>\n <RACDateInput className={clsx('cim-date-picker-input', textStyle({ variant: 'medium' }))}>\n {(segment) => (\n <span className=\"cim-date-picker-segment-wrapper\">\n <RACDateSegment segment={segment} />\n </span>\n )}\n </RACDateInput>\n <div className=\"cim-date-picker-input-controls\">\n <DatePickerClearButton isDisabled={props.isDisabled || props.isReadOnly} />\n <IconButton\n icon={<IconCalendarEmpty />}\n aria-label={messages.format('openCalendar')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <RACPopover\n className=\"cim-date-picker-popover\"\n placement=\"bottom end\"\n offset={5} // 1px border + 4px actual offset\n containerPadding={16}\n data-cim-style-root\n >\n <RACDialog>\n <DatePickerCalendar<T>\n focusedValue={focusedValue}\n defaultFocusedValue={defaultFocusedValue}\n placeholderValue={props.placeholderValue}\n />\n </RACDialog>\n </RACPopover>\n </RACDatePicker>\n );\n}\n\n/**\n * Allows users to enter or select a date and time value.\n *\n * See [date picker usage guidelines](https://ui.cimpress.io/components/date-picker/).\n */\nconst _DatePicker = withStyleProps(forwardRef(DatePicker), 'DatePicker');\n\nexport { _DatePicker as DatePicker };\n\nfunction DatePickerClearButton({ isDisabled }: { isDisabled: boolean | undefined }) {\n const datePickerState = useContext(RACDatePickerStateContext)!;\n const messages = useLocalizedMessages('datePicker');\n\n if (!datePickerState.value) {\n return null;\n }\n\n return (\n <IconButton\n // Don't inherit default Button behavior from DatePicker\n slot={null}\n UNSAFE_className=\"cim-date-picker-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => datePickerState.setValue(null)}\n icon={<IconCloseDetached />}\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={isDisabled}\n />\n );\n}\n\n// TODO: use one of our standard icons instead of this custom one\nfunction IconCloseDetached() {\n return (\n <svg viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg\" className=\"cim-icon\" fill=\"currentcolor\" data-icon>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0.21967 0.21967C0.512563 -0.0732233 0.987437 -0.0732233 1.28033 0.21967L6 4.93934L10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967C12.0732 0.512563 12.0732 0.987437 11.7803 1.28033L7.06066 6L11.7803 10.7197C12.0732 11.0126 12.0732 11.4874 11.7803 11.7803C11.4874 12.0732 11.0126 12.0732 10.7197 11.7803L6 7.06066L1.28033 11.7803C0.987437 12.0732 0.512563 12.0732 0.21967 11.7803C-0.0732233 11.4874 -0.0732233 11.0126 0.21967 10.7197L4.93934 6L0.21967 1.28033C-0.0732233 0.987437 -0.0732233 0.512563 0.21967 0.21967Z\"\n />\n </svg>\n );\n}\n"]}
1
+ {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AACtD,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xC,GACQ,GACD,IACC,CACjB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,YAAY,CAAC,CAAC;AAEzE,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC;AAErC,SAAS,qBAAqB,CAAC,EAAE,UAAU,EAAuC;IAChF,MAAM,eAAe,GAAG,UAAU,CAAC,yBAAyB,CAAE,CAAC;IAC/D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEpD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,UAAU;IACT,wDAAwD;;QAAxD,wDAAwD;QACxD,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAC,uBAAuB,gBAC5B,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7C,IAAI,EAAE,KAAC,iBAAiB,KAAG,EAC3B,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,EACZ,UAAU,EAAE,UAAU,GACtB,CACH,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAS,iBAAiB;IACxB,OAAO,CACL,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,cAAc,+BAClG,eACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,2hBAA2hB,GAC7hB,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CalendarDate, CalendarDateTime, ZonedDateTime } from '@internationalized/date';\nimport clsx from 'clsx';\nimport { useContext, type ForwardedRef } from 'react';\nimport {\n type CalendarProps as RACCalendarProps,\n DateInput as RACDateInput,\n DatePicker as RACDatePicker,\n type DatePickerProps as RACDatePickerProps,\n DatePickerStateContext as RACDatePickerStateContext,\n DateSegment as RACDateSegment,\n Dialog as RACDialog,\n Group as RACGroup,\n Popover as RACPopover,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCalendarEmpty } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\nimport { DatePickerCalendar } from './date-picker-calendar.js';\n\n/** Represents a date with optional time and timezone components. */\nexport type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Maps a date value to a specific subtype depending on which components it contains. */\nexport type MappedDateValue<T> = T extends ZonedDateTime\n ? ZonedDateTime\n : T extends CalendarDateTime\n ? CalendarDateTime\n : T extends CalendarDate\n ? CalendarDate\n : never;\n\nexport interface DatePickerProps<T extends DateValue>\n extends CommonProps,\n FieldProps<MappedDateValue<T>>,\n Pick<\n RACDatePickerProps<T>,\n | 'value'\n | 'defaultValue'\n | 'placeholderValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'onFocus'\n | 'onBlur'\n | 'isOpen'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'minValue'\n | 'maxValue'\n | 'isDateUnavailable'\n | 'granularity'\n | 'firstDayOfWeek'\n >,\n Pick<RACCalendarProps<T>, 'focusedValue' | 'defaultFocusedValue'> {}\n\nfunction DatePicker<T extends DateValue>(\n {\n label,\n description,\n error: errorMessage,\n focusedValue,\n defaultFocusedValue,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: DatePickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('DatePicker requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('datePicker');\n\n return (\n <RACDatePicker {...props} ref={ref} className={clsx('cim-date-picker', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-date-picker-input-group\" data-readonly={props.isReadOnly || undefined}>\n <RACDateInput className={clsx('cim-date-picker-input', textStyle({ variant: 'body' }))}>\n {(segment) => (\n <span className=\"cim-date-picker-segment-wrapper\">\n <RACDateSegment segment={segment} />\n </span>\n )}\n </RACDateInput>\n <div className=\"cim-date-picker-input-controls\">\n <DatePickerClearButton isDisabled={props.isDisabled || props.isReadOnly} />\n <IconButton\n icon={<IconCalendarEmpty />}\n aria-label={messages.format('openCalendar')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <RACPopover\n className=\"cim-date-picker-popover\"\n placement=\"bottom end\"\n offset={5} // 1px border + 4px actual offset\n containerPadding={16}\n data-cim-style-root\n >\n <RACDialog>\n <DatePickerCalendar<T>\n focusedValue={focusedValue}\n defaultFocusedValue={defaultFocusedValue}\n placeholderValue={props.placeholderValue}\n />\n </RACDialog>\n </RACPopover>\n </RACDatePicker>\n );\n}\n\n/**\n * Allows users to enter or select a date and time value.\n *\n * See [date picker usage guidelines](https://ui.cimpress.io/components/date-picker/).\n */\nconst _DatePicker = withStyleProps(forwardRef(DatePicker), 'DatePicker');\n\nexport { _DatePicker as DatePicker };\n\nfunction DatePickerClearButton({ isDisabled }: { isDisabled: boolean | undefined }) {\n const datePickerState = useContext(RACDatePickerStateContext)!;\n const messages = useLocalizedMessages('datePicker');\n\n if (!datePickerState.value) {\n return null;\n }\n\n return (\n <IconButton\n // Don't inherit default Button behavior from DatePicker\n slot={null}\n UNSAFE_className=\"cim-date-picker-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => datePickerState.setValue(null)}\n icon={<IconCloseDetached />}\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={isDisabled}\n />\n );\n}\n\n// TODO: use one of our standard icons instead of this custom one\nfunction IconCloseDetached() {\n return (\n <svg viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg\" className=\"cim-icon\" fill=\"currentcolor\" data-icon>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0.21967 0.21967C0.512563 -0.0732233 0.987437 -0.0732233 1.28033 0.21967L6 4.93934L10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967C12.0732 0.512563 12.0732 0.987437 11.7803 1.28033L7.06066 6L11.7803 10.7197C12.0732 11.0126 12.0732 11.4874 11.7803 11.7803C11.4874 12.0732 11.0126 12.0732 10.7197 11.7803L6 7.06066L1.28033 11.7803C0.987437 12.0732 0.512563 12.0732 0.21967 11.7803C-0.0732233 11.4874 -0.0732233 11.0126 0.21967 10.7197L4.93934 6L0.21967 1.28033C-0.0732233 0.987437 -0.0732233 0.512563 0.21967 0.21967Z\"\n />\n </svg>\n );\n}\n"]}
@@ -0,0 +1,81 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { AriaLabelingProps, CommonProps } from '../types.js';
3
+ export interface UNSTABLE_DrawerRootProps {
4
+ /** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */
5
+ children: ReactNode;
6
+ /** Whether the drawer is open (controlled). */
7
+ isOpen?: boolean;
8
+ /** Whether the drawer is open by default (uncontrolled). */
9
+ defaultOpen?: boolean;
10
+ /** Handler that is called when the drawer's open state changes. */
11
+ onOpenChange?: (isOpen: boolean) => void;
12
+ }
13
+ /**
14
+ * Encapsulates a drawer trigger and its associated drawer.
15
+ * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.
16
+ */
17
+ export declare function UNSTABLE_DrawerRoot(props: UNSTABLE_DrawerRootProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare namespace UNSTABLE_DrawerRoot {
19
+ var displayName: string;
20
+ }
21
+ export interface UNSTABLE_DrawerRenderProps {
22
+ /** Closes the drawer when called. */
23
+ close: () => void;
24
+ }
25
+ export interface UNSTABLE_DrawerProps extends CommonProps, AriaLabelingProps {
26
+ /** The contents of the drawer. A function may be provided to access a function to close the drawer. */
27
+ children: ReactNode | ((renderProps: UNSTABLE_DrawerRenderProps) => ReactNode);
28
+ /** The title of the drawer. */
29
+ title?: string;
30
+ /**
31
+ * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.
32
+ * @default 'medium'
33
+ */
34
+ size?: 'small' | 'medium' | 'large';
35
+ /**
36
+ * Whether to close the drawer when the user interacts outside of it or presses the Escape key.
37
+ * @default true
38
+ */
39
+ isDismissible?: boolean;
40
+ /**
41
+ * Whether the drawer is open (controlled).
42
+ * If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.
43
+ */
44
+ isOpen?: boolean;
45
+ /**
46
+ * Whether the drawer is open by default (uncontrolled).
47
+ * If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.
48
+ */
49
+ defaultOpen?: boolean;
50
+ /**
51
+ * Handler that is called when the drawer's open state changes.
52
+ * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.
53
+ */
54
+ onOpenChange?: (isOpen: boolean) => void;
55
+ }
56
+ /**
57
+ * Displays an overlay element which blocks interaction with outside elements.
58
+ *
59
+ * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).
60
+ */
61
+ declare const _UNSTABLE_Drawer: (props: UNSTABLE_DrawerProps & import("react").RefAttributes<HTMLElement>) => import("react").JSX.Element | null;
62
+ export { _UNSTABLE_Drawer as UNSTABLE_Drawer };
63
+ export interface UNSTABLE_DrawerBodyProps {
64
+ /** The content to render within the drawer. */
65
+ children: ReactNode;
66
+ }
67
+ /** Renders content within `Drawer`. */
68
+ export declare function UNSTABLE_DrawerBody(props: UNSTABLE_DrawerBodyProps): import("react/jsx-runtime").JSX.Element;
69
+ export declare namespace UNSTABLE_DrawerBody {
70
+ var displayName: string;
71
+ }
72
+ export interface UNSTABLE_DrawerActionsProps {
73
+ /** Actions that should be available in the drawer. */
74
+ children: ReactNode;
75
+ }
76
+ /** Renders actions within `Drawer`. */
77
+ export declare function UNSTABLE_DrawerActions({ children, ...props }: UNSTABLE_DrawerActionsProps): import("react/jsx-runtime").JSX.Element;
78
+ export declare namespace UNSTABLE_DrawerActions {
79
+ var displayName: string;
80
+ }
81
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAcpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlE,MAAM,WAAW,wBAAwB;IACvC,iIAAiI;IACjI,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mEAAmE;IACnE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAElE;yBAFe,mBAAmB;;;AAMnC,MAAM,WAAW,0BAA0B;IACzC,qCAAqC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,EAAE,iBAAiB;IAC1E,uGAAuG;IACvG,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,0BAA0B,KAAK,SAAS,CAAC,CAAC;IAC/E,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AA6DD;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,kHAAwC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,IAAI,eAAe,EAAE,CAAC;AAE/C,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAElE;yBAFe,mBAAmB;;;AAMnC,MAAM,WAAW,2BAA2B;IAC1C,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,2BAA2B,2CASzF;yBATe,sBAAsB"}
@@ -0,0 +1,50 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import clsx from 'clsx';
4
+ import { Children } from 'react';
5
+ import { Dialog as RACDialog, DialogTrigger as RACDialogTrigger, Heading as RACHeading, Modal as RACModal, ModalOverlay as RACModalOverlay, } from 'react-aria-components';
6
+ import { forwardRef } from '../../forward-ref.js';
7
+ import { useLocalizedMessages } from '../../i18n/index.js';
8
+ import { useMediaQuery } from '../../utils/use-media-query.js';
9
+ import { useProductionWarning } from '../../utils/use-production-warning.js';
10
+ import { FocusableContainer } from '../internal/focusable-container/focusable-container.js';
11
+ import { XButton } from '../internal/x-button/x-button.js';
12
+ import { textStyle } from '../typography/utils.js';
13
+ /**
14
+ * Encapsulates a drawer trigger and its associated drawer.
15
+ * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.
16
+ */
17
+ export function UNSTABLE_DrawerRoot(props) {
18
+ return _jsx(RACDialogTrigger, { ...props });
19
+ }
20
+ UNSTABLE_DrawerRoot.displayName = 'DrawerRoot';
21
+ function UNSTABLE_Drawer({ children, title, size = 'medium', UNSAFE_className, UNSAFE_style, isDismissible = true, isOpen, defaultOpen, onOpenChange, ...props }, ref) {
22
+ const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
23
+ useProductionWarning(() => {
24
+ if (!title && !ariaLabel && !ariaLabelledBy) {
25
+ console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');
26
+ }
27
+ }, [title, ariaLabel, ariaLabelledBy]);
28
+ const messages = useLocalizedMessages('common');
29
+ return (_jsx(RACModalOverlay, { className: "cim-drawer-overlay", isDismissable: isDismissible, isKeyboardDismissDisabled: !isDismissible, isOpen: isOpen, defaultOpen: defaultOpen, onOpenChange: onOpenChange, "data-cim-style-root": true, children: _jsx(RACModal, { className: clsx('cim-drawer', UNSAFE_className), style: UNSAFE_style, "data-size": size, children: _jsx(RACDialog, { ...props, ref: ref, className: "cim-drawer-dialog", children: (renderProps) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cim-drawer-header", children: [title && (_jsx(RACHeading, { slot: "title", className: clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' })), children: title })), _jsx(XButton, { "aria-label": messages.format('dismiss'), slot: "close" })] }), typeof children === 'function' ? children(renderProps) : children] })) }) }) }));
30
+ }
31
+ /**
32
+ * Displays an overlay element which blocks interaction with outside elements.
33
+ *
34
+ * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).
35
+ */
36
+ const _UNSTABLE_Drawer = forwardRef(UNSTABLE_Drawer, 'Drawer');
37
+ export { _UNSTABLE_Drawer as UNSTABLE_Drawer };
38
+ /** Renders content within `Drawer`. */
39
+ export function UNSTABLE_DrawerBody(props) {
40
+ return _jsx(FocusableContainer, { ...props, className: "cim-drawer-body", scrollDirection: "vertical" });
41
+ }
42
+ UNSTABLE_DrawerBody.displayName = 'DrawerBody';
43
+ /** Renders actions within `Drawer`. */
44
+ export function UNSTABLE_DrawerActions({ children, ...props }) {
45
+ const matches = useMediaQuery('(min-width: 640px)');
46
+ const componentChildren = matches ? children : Children.toArray(children).reverse();
47
+ return (_jsx("div", { ...props, className: "cim-drawer-actions", children: componentChildren }));
48
+ }
49
+ UNSTABLE_DrawerActions.displayName = 'DrawerActions';
50
+ //# sourceMappingURL=drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAqC,MAAM,OAAO,CAAC;AACpE,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,aAAa,IAAI,gBAAgB,EACjC,OAAO,IAAI,UAAU,EACrB,KAAK,IAAI,QAAQ,EACjB,YAAY,IAAI,eAAe,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OA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,CAAC;AAED,sBAAsB,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { Children, type ForwardedRef, type ReactNode } from 'react';\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { useMediaQuery } from '../../utils/use-media-query.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { FocusableContainer } from '../internal/focusable-container/focusable-container.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface UNSTABLE_DrawerRootProps {\n /** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */\n children: ReactNode;\n /** Whether the drawer is open (controlled). */\n isOpen?: boolean;\n /** Whether the drawer is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler that is called when the drawer's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\n/**\n * Encapsulates a drawer trigger and its associated drawer.\n * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.\n */\nexport function UNSTABLE_DrawerRoot(props: UNSTABLE_DrawerRootProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nUNSTABLE_DrawerRoot.displayName = 'DrawerRoot';\n\nexport interface UNSTABLE_DrawerRenderProps {\n /** Closes the drawer when called. */\n close: () => void;\n}\n\nexport interface UNSTABLE_DrawerProps extends CommonProps, AriaLabelingProps {\n /** The contents of the drawer. A function may be provided to access a function to close the drawer. */\n children: ReactNode | ((renderProps: UNSTABLE_DrawerRenderProps) => ReactNode);\n /** The title of the drawer. */\n title?: string;\n /**\n * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Whether to close the drawer when the user interacts outside of it or presses the Escape key.\n * @default true\n */\n isDismissible?: boolean;\n /**\n * Whether the drawer is open (controlled).\n * If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.\n */\n isOpen?: boolean;\n /**\n * Whether the drawer is open by default (uncontrolled).\n * If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.\n */\n defaultOpen?: boolean;\n /**\n * Handler that is called when the drawer's open state changes.\n * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.\n */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nfunction UNSTABLE_Drawer(\n {\n children,\n title,\n size = 'medium',\n UNSAFE_className,\n UNSAFE_style,\n isDismissible = true,\n isOpen,\n defaultOpen,\n onOpenChange,\n ...props\n }: UNSTABLE_DrawerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!title && !ariaLabel && !ariaLabelledBy) {\n console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');\n }\n }, [title, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('common');\n\n return (\n <RACModalOverlay\n className=\"cim-drawer-overlay\"\n isDismissable={isDismissible}\n isKeyboardDismissDisabled={!isDismissible}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n data-cim-style-root\n >\n <RACModal className={clsx('cim-drawer', UNSAFE_className)} style={UNSAFE_style} data-size={size}>\n <RACDialog {...props} ref={ref} className=\"cim-drawer-dialog\">\n {(renderProps) => (\n <>\n <div className=\"cim-drawer-header\">\n {title && (\n <RACHeading\n slot=\"title\"\n className={clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' }))}\n >\n {title}\n </RACHeading>\n )}\n <XButton aria-label={messages.format('dismiss')} slot=\"close\" />\n </div>\n {typeof children === 'function' ? children(renderProps) : children}\n </>\n )}\n </RACDialog>\n </RACModal>\n </RACModalOverlay>\n );\n}\n\n/**\n * Displays an overlay element which blocks interaction with outside elements.\n *\n * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).\n */\nconst _UNSTABLE_Drawer = forwardRef(UNSTABLE_Drawer, 'Drawer');\n\nexport { _UNSTABLE_Drawer as UNSTABLE_Drawer };\n\nexport interface UNSTABLE_DrawerBodyProps {\n /** The content to render within the drawer. */\n children: ReactNode;\n}\n\n/** Renders content within `Drawer`. */\nexport function UNSTABLE_DrawerBody(props: UNSTABLE_DrawerBodyProps) {\n return <FocusableContainer {...props} className=\"cim-drawer-body\" scrollDirection=\"vertical\" />;\n}\n\nUNSTABLE_DrawerBody.displayName = 'DrawerBody';\n\nexport interface UNSTABLE_DrawerActionsProps {\n /** Actions that should be available in the drawer. */\n children: ReactNode;\n}\n\n/** Renders actions within `Drawer`. */\nexport function UNSTABLE_DrawerActions({ children, ...props }: UNSTABLE_DrawerActionsProps) {\n const matches = useMediaQuery('(min-width: 640px)');\n const componentChildren = matches ? children : Children.toArray(children).reverse();\n\n return (\n <div {...props} className=\"cim-drawer-actions\">\n {componentChildren}\n </div>\n );\n}\n\nUNSTABLE_DrawerActions.displayName = 'DrawerActions';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"file-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAI7C,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D,MAAM,WAAW,wBACf,SAAQ,WAAW,EACjB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,EACtC,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IACzG,q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K,IAAI,CAAC;CAC3C;AAmID,QAAA,MAAM,oBAAoB,0KAAgE,CAAC;AAE3F,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC"}
@@ -55,8 +55,8 @@ function UNSTABLE_FilePicker({ id, label, description, isDisabled, isRequired, i
55
55
  [RACLabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],
56
56
  [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],
57
57
  [RACFieldErrorContext, validationState.displayValidation],
58
- ], children: [_jsxs("div", { ...props, className: clsx('cim-file-field', UNSAFE_className), style: UNSAFE_style, ref: ref, children: [label && (_jsxs(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: [label, isRequired && _jsx(UNSTABLE_VisuallyHidden, { children: labelMessages.format('required') })] })), _jsxs("div", { className: "cim-file-field-button-container", children: [_jsx(RACFileTrigger, { onSelect: handleSelect, acceptedFileTypes: acceptedFileTypes, allowsMultiple: allowsMultiple, acceptDirectory: acceptDirectory, defaultCamera: defaultCamera, children: _jsx(Button, { id: buttonId, isDisabled: isDisabled, "aria-labelledby": [buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' '), "aria-describedby": [fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' '), "aria-details": ariaDetails, children: messages.format('chooseFile') }) }), _jsx(Text, { id: fileTextId, as: "p", variant: "medium", tone: "base", children: labelText })] }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description })] }), name && (_jsx("input", { type: "file", className: "cim-file-field-hidden-input", name: name, multiple: allowsMultiple, required: isRequired, ref: fileInputRef }))] }));
58
+ ], children: [_jsxs("div", { ...props, className: clsx('cim-file-picker', UNSAFE_className), style: UNSAFE_style, ref: ref, children: [label && (_jsxs(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: [label, isRequired && _jsx(UNSTABLE_VisuallyHidden, { children: labelMessages.format('required') })] })), _jsxs("div", { className: "cim-file-picker-button-container", children: [_jsx(RACFileTrigger, { onSelect: handleSelect, acceptedFileTypes: acceptedFileTypes, allowsMultiple: allowsMultiple, acceptDirectory: acceptDirectory, defaultCamera: defaultCamera, children: _jsx(Button, { id: buttonId, isDisabled: isDisabled, "aria-labelledby": [buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' '), "aria-describedby": [fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' '), "aria-details": ariaDetails, children: messages.format('chooseFile') }) }), _jsx(Text, { id: fileTextId, as: "p", variant: "medium", tone: "base", children: labelText })] }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description })] }), name && (_jsx("input", { type: "file", className: "cim-file-picker-hidden-input", name: name, multiple: allowsMultiple, required: isRequired, ref: fileInputRef }))] }));
59
59
  }
60
- const _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FileField');
60
+ const _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FilePicker');
61
61
  export { _UNSTABLE_FilePicker as UNSTABLE_FilePicker };
62
62
  //# sourceMappingURL=file-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-picker.js","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAqB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,iBAAiB,IAAI,oBAAoB,EACzC,WAAW,IAAI,cAAc,EAE7B,YAAY,IAAI,eAAe,EAC/B,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,GAC9B,MAAM,uB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,CAAC,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,kBAC1E,WAAW,YAExB,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,GACvB,GACM,EACjB,KAAC,IAAI,IAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,YACtD,SAAS,GACL,IACH,EACN,KAAC,cAAc,cAAE,KAAK,GAAkB,EACxC,KAAC,oBAAoB,cAAE,WAAW,GAAwB,IACtD,EACL,IAAI,IAAI,CACP,gBACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,YAAY,GACjB,CACH,IACW,CACf,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG,cAAc,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,WAAW,CAAC,CAAC;AAE1F,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport clsx from 'clsx';\nimport { type ForwardedRef, useRef, useState } from 'react';\nimport {\n FieldErrorContext as RACFieldErrorContext,\n FileTrigger as RACFileTrigger,\n type FileTriggerProps as RACFileTriggerProps,\n LabelContext as RACLabelContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { Button } from '../button/button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { UNSTABLE_VisuallyHidden } from '../visually-hidden/visually-hidden.js';\n\nexport interface UNSTABLE_FilePickerProps\n extends CommonProps,\n Omit<FieldProps<File[]>, 'aria-label'>,\n Pick<RACFileTriggerProps, 'acceptedFileTypes' | 'allowsMultiple' | 'acceptDirectory' | 'defaultCamera'> {\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** The allowed file types that can be selected. */\n acceptedFileTypes?: string[];\n /** Whether multiple files can be selected. */\n allowsMultiple?: boolean;\n /** Handler called when files are selected. */\n onSelect?: (files: File[] | null) => void;\n}\n\nfunction UNSTABLE_FilePicker(\n {\n id,\n label,\n description,\n isDisabled,\n isRequired,\n isInvalid,\n onSelect,\n acceptedFileTypes,\n allowsMultiple,\n acceptDirectory,\n defaultCamera,\n error,\n name,\n validate,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-details': ariaDetails,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: UNSTABLE_FilePickerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const buttonId = useId(id);\n const labelId = useId();\n const fileTextId = useId();\n\n const [files, setFiles] = useState<File[] | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const handleSelect = (files: FileList | null) => {\n // Commit validation to clear any previous validation errors when new files are selected\n validationState.commitValidation();\n\n const filesArray = files?.length ? Array.from(files) : null;\n setFiles(filesArray);\n onSelect?.(filesArray);\n\n if (fileInputRef.current) {\n fileInputRef.current.files = files;\n }\n };\n\n const labelMessages = useLocalizedMessages('label');\n const messages = useLocalizedMessages('filePicker');\n const labelText =\n files?.length != null\n ? files.length === 1\n ? files[0]?.name\n : messages.format('multipleFilesSelected', { fileCount: files.length })\n : messages.format('noFilesSelected', { allowsMultiple: allowsMultiple ?? false });\n\n const validationBehavior = 'native';\n const validationState = useFormValidationState({\n value: files,\n isInvalid,\n isRequired,\n name,\n validate,\n validationBehavior,\n });\n useFormValidation({ isInvalid, isRequired, validate, validationBehavior }, validationState, fileInputRef);\n useFormReset(fileInputRef, files, setFiles);\n\n const descriptionId = useSlotId([Boolean(description)]);\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <RACProvider\n values={[\n [RACLabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <div {...props} className={clsx('cim-file-field', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n {label && (\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n {/*\n * Button elements don't support `aria-required`, so we need to add visually hidden text to indicate that the field is required.\n * See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-required#examples:~:text=Note%3A%20If%20the%20field%27s%20label%20already%20contains%20the%20word%20%22required%22%2C%20it%20is%20recommended%20to%20leave%20out%20the%20aria%2Drequired%20attribute.%20This%20avoids%20that%20screen%20readers%20read%20out%20the%20term%20%22required%22%20twice.\n */}\n {isRequired && <UNSTABLE_VisuallyHidden>{labelMessages.format('required')}</UNSTABLE_VisuallyHidden>}\n </FormFieldLabel>\n )}\n <div className=\"cim-file-field-button-container\">\n <RACFileTrigger\n onSelect={handleSelect}\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n acceptDirectory={acceptDirectory}\n defaultCamera={defaultCamera}\n >\n <Button\n id={buttonId}\n isDisabled={isDisabled}\n aria-labelledby={[buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' ')}\n aria-describedby={[fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' ')}\n aria-details={ariaDetails}\n >\n {messages.format('chooseFile')}\n </Button>\n </RACFileTrigger>\n <Text id={fileTextId} as=\"p\" variant=\"medium\" tone=\"base\">\n {labelText}\n </Text>\n </div>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </div>\n {name && (\n <input\n type=\"file\"\n className=\"cim-file-field-hidden-input\"\n name={name}\n multiple={allowsMultiple}\n required={isRequired}\n ref={fileInputRef}\n />\n )}\n </RACProvider>\n );\n}\n\nconst _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FileField');\n\nexport { _UNSTABLE_FilePicker as UNSTABLE_FilePicker };\n"]}
1
+ {"version":3,"file":"file-picker.js","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAqB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,iBAAiB,IAAI,oBAAoB,EACzC,WAAW,IAAI,cAAc,EAE7B,YAAY,IAAI,eAAe,EAC/B,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE5G,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,E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,IACtD,EACL,IAAI,IAAI,CACP,gBACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,8BAA8B,EACxC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,YAAY,GACjB,CACH,IACW,CACf,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG,cAAc,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,YAAY,CAAC,CAAC;AAE3F,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport clsx from 'clsx';\nimport { type ForwardedRef, useRef, useState } from 'react';\nimport {\n FieldErrorContext as RACFieldErrorContext,\n FileTrigger as RACFileTrigger,\n type FileTriggerProps as RACFileTriggerProps,\n LabelContext as RACLabelContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { Button } from '../button/button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { UNSTABLE_VisuallyHidden } from '../visually-hidden/visually-hidden.js';\n\nexport interface UNSTABLE_FilePickerProps\n extends CommonProps,\n Omit<FieldProps<File[]>, 'aria-label'>,\n Pick<RACFileTriggerProps, 'acceptedFileTypes' | 'allowsMultiple' | 'acceptDirectory' | 'defaultCamera'> {\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** The allowed file types that can be selected. */\n acceptedFileTypes?: string[];\n /** Whether multiple files can be selected. */\n allowsMultiple?: boolean;\n /** Handler called when files are selected. */\n onSelect?: (files: File[] | null) => void;\n}\n\nfunction UNSTABLE_FilePicker(\n {\n id,\n label,\n description,\n isDisabled,\n isRequired,\n isInvalid,\n onSelect,\n acceptedFileTypes,\n allowsMultiple,\n acceptDirectory,\n defaultCamera,\n error,\n name,\n validate,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-details': ariaDetails,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: UNSTABLE_FilePickerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const buttonId = useId(id);\n const labelId = useId();\n const fileTextId = useId();\n\n const [files, setFiles] = useState<File[] | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const handleSelect = (files: FileList | null) => {\n // Commit validation to clear any previous validation errors when new files are selected\n validationState.commitValidation();\n\n const filesArray = files?.length ? Array.from(files) : null;\n setFiles(filesArray);\n onSelect?.(filesArray);\n\n if (fileInputRef.current) {\n fileInputRef.current.files = files;\n }\n };\n\n const labelMessages = useLocalizedMessages('label');\n const messages = useLocalizedMessages('filePicker');\n const labelText =\n files?.length != null\n ? files.length === 1\n ? files[0]?.name\n : messages.format('multipleFilesSelected', { fileCount: files.length })\n : messages.format('noFilesSelected', { allowsMultiple: allowsMultiple ?? false });\n\n const validationBehavior = 'native';\n const validationState = useFormValidationState({\n value: files,\n isInvalid,\n isRequired,\n name,\n validate,\n validationBehavior,\n });\n useFormValidation({ isInvalid, isRequired, validate, validationBehavior }, validationState, fileInputRef);\n useFormReset(fileInputRef, files, setFiles);\n\n const descriptionId = useSlotId([Boolean(description)]);\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <RACProvider\n values={[\n [RACLabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <div {...props} className={clsx('cim-file-picker', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n {label && (\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n {/*\n * Button elements don't support `aria-required`, so we need to add visually hidden text to indicate that the field is required.\n * See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-required#examples:~:text=Note%3A%20If%20the%20field%27s%20label%20already%20contains%20the%20word%20%22required%22%2C%20it%20is%20recommended%20to%20leave%20out%20the%20aria%2Drequired%20attribute.%20This%20avoids%20that%20screen%20readers%20read%20out%20the%20term%20%22required%22%20twice.\n */}\n {isRequired && <UNSTABLE_VisuallyHidden>{labelMessages.format('required')}</UNSTABLE_VisuallyHidden>}\n </FormFieldLabel>\n )}\n <div className=\"cim-file-picker-button-container\">\n <RACFileTrigger\n onSelect={handleSelect}\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n acceptDirectory={acceptDirectory}\n defaultCamera={defaultCamera}\n >\n <Button\n id={buttonId}\n isDisabled={isDisabled}\n aria-labelledby={[buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' ')}\n aria-describedby={[fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' ')}\n aria-details={ariaDetails}\n >\n {messages.format('chooseFile')}\n </Button>\n </RACFileTrigger>\n <Text id={fileTextId} as=\"p\" variant=\"medium\" tone=\"base\">\n {labelText}\n </Text>\n </div>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </div>\n {name && (\n <input\n type=\"file\"\n className=\"cim-file-picker-hidden-input\"\n name={name}\n multiple={allowsMultiple}\n required={isRequired}\n ref={fileInputRef}\n />\n )}\n </RACProvider>\n );\n}\n\nconst _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FilePicker');\n\nexport { _UNSTABLE_FilePicker as UNSTABLE_FilePicker };\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/link-tabs/context.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { createContext } from 'react';
2
+ /** @internal */
3
+ export const LinkTabsContext = createContext(null);
4
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/link-tabs/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAUtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAA8B,IAAI,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\nimport type { Href } from '../types.js';\n\n/** @internal */\nexport interface LinkTabsContextValue {\n isDisabled?: boolean;\n currentHref: Href | null;\n setCurrentHref: (href: Href | null) => void;\n}\n\n/** @internal */\nexport const LinkTabsContext = createContext<LinkTabsContextValue | null>(null);\n"]}
@@ -0,0 +1,36 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type LinkProps as RACLinkProps } from 'react-aria-components';
3
+ import type { AriaLabelingProps, CommonProps, Href, NavigationProps, StringLikeChildren, WithRequired } from '../types.js';
4
+ export interface LinkTabsProps extends CommonProps, AriaLabelingProps {
5
+ /** Link tabs belonging to the group. */
6
+ children: ReactNode;
7
+ /** Whether the link tabs are disabled. */
8
+ isDisabled?: boolean;
9
+ /** The currently selected key in the collection (controlled). */
10
+ currentHref?: Href | null;
11
+ /** The initial selected key in the collection (uncontrolled). */
12
+ defaultHref?: Href | null;
13
+ /** Handler that is called when the selection changes. */
14
+ onHrefChange?: (href: Href | null) => void;
15
+ }
16
+ /**
17
+ * Displays a list of tabs to help users navigate through a website.
18
+ *
19
+ * See [tabs usage guidelines](https://ui.cimpress.io/components/tabs/).
20
+ */
21
+ declare const _LinkTabs: (props: LinkTabsProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
22
+ export { _LinkTabs as LinkTabs };
23
+ export interface LinkTabProps extends Omit<CommonProps, 'id'>, WithRequired<NavigationProps, 'href'>, Pick<RACLinkProps, 'children' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {
24
+ /** The text to display as the tab title. */
25
+ children: StringLikeChildren;
26
+ /** An icon displayed before the tab title. */
27
+ iconStart?: ReactNode;
28
+ /** A badge displayed after the tab title. */
29
+ badge?: ReactNode;
30
+ }
31
+ /** Renders a single tab within `LinkTabs`. */
32
+ export declare function LinkTab({ children, href, iconStart, badge, UNSAFE_className, UNSAFE_style, isDisabled, ...props }: LinkTabProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare namespace LinkTab {
34
+ var displayName: string;
35
+ }
36
+ //# sourceMappingURL=link-tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAmB,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIxF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,aAAc,SAAQ,WAAW,EAAE,iBAAiB;IACnE,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,yDAAyD;IACzD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,I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