@cimpress-ui/react 1.25.2 → 1.27.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 (221) hide show
  1. package/dist/commonjs/components/app-header/app-header.d.ts +1 -1
  2. package/dist/commonjs/components/app-header/app-header.d.ts.map +1 -1
  3. package/dist/commonjs/components/app-header/app-header.js +5 -1
  4. package/dist/commonjs/components/app-header/app-header.js.map +1 -1
  5. package/dist/commonjs/components/app-header/nav-button.d.ts +2 -2
  6. package/dist/commonjs/components/app-header/nav-button.d.ts.map +1 -1
  7. package/dist/commonjs/components/app-header/nav-button.js +8 -1
  8. package/dist/commonjs/components/app-header/nav-button.js.map +1 -1
  9. package/dist/commonjs/components/app-shell/app-shell-context.d.ts +2 -0
  10. package/dist/commonjs/components/app-shell/app-shell-context.d.ts.map +1 -0
  11. package/dist/commonjs/components/app-shell/app-shell-context.js +7 -0
  12. package/dist/commonjs/components/app-shell/app-shell-context.js.map +1 -0
  13. package/dist/commonjs/components/app-shell/app-shell.d.ts +1 -1
  14. package/dist/commonjs/components/app-shell/app-shell.d.ts.map +1 -1
  15. package/dist/commonjs/components/app-shell/app-shell.js +12 -2
  16. package/dist/commonjs/components/app-shell/app-shell.js.map +1 -1
  17. package/dist/commonjs/components/combo-box/combo-box.d.ts +28 -7
  18. package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
  19. package/dist/commonjs/components/combo-box/combo-box.js +9 -7
  20. package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
  21. package/dist/commonjs/components/internal/input/input.d.ts +0 -6
  22. package/dist/commonjs/components/internal/input/input.d.ts.map +1 -1
  23. package/dist/commonjs/components/internal/input/input.js +6 -22
  24. package/dist/commonjs/components/internal/input/input.js.map +1 -1
  25. package/dist/commonjs/components/select/select.d.ts +42 -31
  26. package/dist/commonjs/components/select/select.d.ts.map +1 -1
  27. package/dist/commonjs/components/select/select.js +38 -41
  28. package/dist/commonjs/components/select/select.js.map +1 -1
  29. package/dist/commonjs/components/{app-header → side-nav}/side-nav.d.ts +12 -1
  30. package/dist/commonjs/components/side-nav/side-nav.d.ts.map +1 -0
  31. package/dist/commonjs/components/side-nav/side-nav.js +56 -0
  32. package/dist/commonjs/components/side-nav/side-nav.js.map +1 -0
  33. package/dist/commonjs/components/slider/slider.d.ts.map +1 -1
  34. package/dist/commonjs/components/slider/slider.js +6 -2
  35. package/dist/commonjs/components/slider/slider.js.map +1 -1
  36. package/dist/commonjs/components/tag-field/tag-field.d.ts +11 -2
  37. package/dist/commonjs/components/tag-field/tag-field.d.ts.map +1 -1
  38. package/dist/commonjs/components/tag-field/tag-field.js +11 -2
  39. package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
  40. package/dist/commonjs/i18n/messages/en-US.d.ts.map +1 -1
  41. package/dist/commonjs/i18n/messages/en-US.js +7 -0
  42. package/dist/commonjs/i18n/messages/en-US.js.map +1 -1
  43. package/dist/commonjs/i18n/messages/types.d.ts +12 -0
  44. package/dist/commonjs/i18n/messages/types.d.ts.map +1 -1
  45. package/dist/commonjs/i18n/messages/types.js.map +1 -1
  46. package/dist/commonjs/icons/case-lower.d.ts +8 -0
  47. package/dist/commonjs/icons/case-lower.d.ts.map +1 -0
  48. package/dist/commonjs/icons/case-lower.js +24 -0
  49. package/dist/commonjs/icons/case-lower.js.map +1 -0
  50. package/dist/commonjs/icons/case-normal.d.ts +8 -0
  51. package/dist/commonjs/icons/case-normal.d.ts.map +1 -0
  52. package/dist/commonjs/icons/case-normal.js +24 -0
  53. package/dist/commonjs/icons/case-normal.js.map +1 -0
  54. package/dist/commonjs/icons/case-upper.d.ts +8 -0
  55. package/dist/commonjs/icons/case-upper.d.ts.map +1 -0
  56. package/dist/commonjs/icons/case-upper.js +24 -0
  57. package/dist/commonjs/icons/case-upper.js.map +1 -0
  58. package/dist/commonjs/icons/chevron-double-down.d.ts +8 -0
  59. package/dist/commonjs/icons/chevron-double-down.d.ts.map +1 -0
  60. package/dist/commonjs/icons/chevron-double-down.js +24 -0
  61. package/dist/commonjs/icons/chevron-double-down.js.map +1 -0
  62. package/dist/commonjs/icons/chevron-double-left.d.ts +8 -0
  63. package/dist/commonjs/icons/chevron-double-left.d.ts.map +1 -0
  64. package/dist/commonjs/icons/chevron-double-left.js +24 -0
  65. package/dist/commonjs/icons/chevron-double-left.js.map +1 -0
  66. package/dist/commonjs/icons/chevron-double-right.d.ts +8 -0
  67. package/dist/commonjs/icons/chevron-double-right.d.ts.map +1 -0
  68. package/dist/commonjs/icons/chevron-double-right.js +24 -0
  69. package/dist/commonjs/icons/chevron-double-right.js.map +1 -0
  70. package/dist/commonjs/icons/chevron-double-up.d.ts +8 -0
  71. package/dist/commonjs/icons/chevron-double-up.d.ts.map +1 -0
  72. package/dist/commonjs/icons/chevron-double-up.js +24 -0
  73. package/dist/commonjs/icons/chevron-double-up.js.map +1 -0
  74. package/dist/commonjs/icons/cut.d.ts +8 -0
  75. package/dist/commonjs/icons/cut.d.ts.map +1 -0
  76. package/dist/commonjs/icons/cut.js +24 -0
  77. package/dist/commonjs/icons/cut.js.map +1 -0
  78. package/dist/commonjs/icons/drag-handle.d.ts +8 -0
  79. package/dist/commonjs/icons/drag-handle.d.ts.map +1 -0
  80. package/dist/commonjs/icons/drag-handle.js +24 -0
  81. package/dist/commonjs/icons/drag-handle.js.map +1 -0
  82. package/dist/commonjs/icons/file-text.d.ts +8 -0
  83. package/dist/commonjs/icons/file-text.d.ts.map +1 -0
  84. package/dist/commonjs/icons/file-text.js +24 -0
  85. package/dist/commonjs/icons/file-text.js.map +1 -0
  86. package/dist/commonjs/icons/file.d.ts +8 -0
  87. package/dist/commonjs/icons/file.d.ts.map +1 -0
  88. package/dist/commonjs/icons/file.js +24 -0
  89. package/dist/commonjs/icons/file.js.map +1 -0
  90. package/dist/commonjs/icons/index.d.ts +11 -0
  91. package/dist/commonjs/icons/index.d.ts.map +1 -1
  92. package/dist/commonjs/icons/index.js +27 -5
  93. package/dist/commonjs/icons/index.js.map +1 -1
  94. package/dist/commonjs/index.d.ts +2 -2
  95. package/dist/commonjs/index.d.ts.map +1 -1
  96. package/dist/commonjs/index.js +2 -2
  97. package/dist/commonjs/index.js.map +1 -1
  98. package/dist/commonjs/utils/breakpoints.d.ts +9 -0
  99. package/dist/commonjs/utils/breakpoints.d.ts.map +1 -0
  100. package/dist/commonjs/utils/breakpoints.js +39 -0
  101. package/dist/commonjs/utils/breakpoints.js.map +1 -0
  102. package/dist/commonjs/utils/use-is-mobile.js +2 -2
  103. package/dist/commonjs/utils/use-is-mobile.js.map +1 -1
  104. package/dist/commonjs/utils/use-media-query.d.ts +4 -1
  105. package/dist/commonjs/utils/use-media-query.d.ts.map +1 -1
  106. package/dist/commonjs/utils/use-media-query.js.map +1 -1
  107. package/dist/esm/components/app-header/app-header.d.ts +1 -1
  108. package/dist/esm/components/app-header/app-header.d.ts.map +1 -1
  109. package/dist/esm/components/app-header/app-header.js +5 -1
  110. package/dist/esm/components/app-header/app-header.js.map +1 -1
  111. package/dist/esm/components/app-header/nav-button.d.ts +2 -2
  112. package/dist/esm/components/app-header/nav-button.d.ts.map +1 -1
  113. package/dist/esm/components/app-header/nav-button.js +8 -1
  114. package/dist/esm/components/app-header/nav-button.js.map +1 -1
  115. package/dist/esm/components/app-shell/app-shell-context.d.ts +2 -0
  116. package/dist/esm/components/app-shell/app-shell-context.d.ts.map +1 -0
  117. package/dist/esm/components/app-shell/app-shell-context.js +4 -0
  118. package/dist/esm/components/app-shell/app-shell-context.js.map +1 -0
  119. package/dist/esm/components/app-shell/app-shell.d.ts +1 -1
  120. package/dist/esm/components/app-shell/app-shell.d.ts.map +1 -1
  121. package/dist/esm/components/app-shell/app-shell.js +12 -2
  122. package/dist/esm/components/app-shell/app-shell.js.map +1 -1
  123. package/dist/esm/components/combo-box/combo-box.d.ts +28 -7
  124. package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
  125. package/dist/esm/components/combo-box/combo-box.js +9 -7
  126. package/dist/esm/components/combo-box/combo-box.js.map +1 -1
  127. package/dist/esm/components/internal/input/input.d.ts +0 -6
  128. package/dist/esm/components/internal/input/input.d.ts.map +1 -1
  129. package/dist/esm/components/internal/input/input.js +6 -22
  130. package/dist/esm/components/internal/input/input.js.map +1 -1
  131. package/dist/esm/components/select/select.d.ts +42 -31
  132. package/dist/esm/components/select/select.d.ts.map +1 -1
  133. package/dist/esm/components/select/select.js +40 -43
  134. package/dist/esm/components/select/select.js.map +1 -1
  135. package/dist/esm/components/{app-header → side-nav}/side-nav.d.ts +12 -1
  136. package/dist/esm/components/side-nav/side-nav.d.ts.map +1 -0
  137. package/dist/esm/components/side-nav/side-nav.js +50 -0
  138. package/dist/esm/components/side-nav/side-nav.js.map +1 -0
  139. package/dist/esm/components/slider/slider.d.ts.map +1 -1
  140. package/dist/esm/components/slider/slider.js +6 -2
  141. package/dist/esm/components/slider/slider.js.map +1 -1
  142. package/dist/esm/components/tag-field/tag-field.d.ts +11 -2
  143. package/dist/esm/components/tag-field/tag-field.d.ts.map +1 -1
  144. package/dist/esm/components/tag-field/tag-field.js +11 -2
  145. package/dist/esm/components/tag-field/tag-field.js.map +1 -1
  146. package/dist/esm/i18n/messages/en-US.d.ts.map +1 -1
  147. package/dist/esm/i18n/messages/en-US.js +7 -0
  148. package/dist/esm/i18n/messages/en-US.js.map +1 -1
  149. package/dist/esm/i18n/messages/types.d.ts +12 -0
  150. package/dist/esm/i18n/messages/types.d.ts.map +1 -1
  151. package/dist/esm/i18n/messages/types.js.map +1 -1
  152. package/dist/esm/icons/case-lower.d.ts +8 -0
  153. package/dist/esm/icons/case-lower.d.ts.map +1 -0
  154. package/dist/esm/icons/case-lower.js +19 -0
  155. package/dist/esm/icons/case-lower.js.map +1 -0
  156. package/dist/esm/icons/case-normal.d.ts +8 -0
  157. package/dist/esm/icons/case-normal.d.ts.map +1 -0
  158. package/dist/esm/icons/case-normal.js +19 -0
  159. package/dist/esm/icons/case-normal.js.map +1 -0
  160. package/dist/esm/icons/case-upper.d.ts +8 -0
  161. package/dist/esm/icons/case-upper.d.ts.map +1 -0
  162. package/dist/esm/icons/case-upper.js +19 -0
  163. package/dist/esm/icons/case-upper.js.map +1 -0
  164. package/dist/esm/icons/chevron-double-down.d.ts +8 -0
  165. package/dist/esm/icons/chevron-double-down.d.ts.map +1 -0
  166. package/dist/esm/icons/chevron-double-down.js +19 -0
  167. package/dist/esm/icons/chevron-double-down.js.map +1 -0
  168. package/dist/esm/icons/chevron-double-left.d.ts +8 -0
  169. package/dist/esm/icons/chevron-double-left.d.ts.map +1 -0
  170. package/dist/esm/icons/chevron-double-left.js +19 -0
  171. package/dist/esm/icons/chevron-double-left.js.map +1 -0
  172. package/dist/esm/icons/chevron-double-right.d.ts +8 -0
  173. package/dist/esm/icons/chevron-double-right.d.ts.map +1 -0
  174. package/dist/esm/icons/chevron-double-right.js +19 -0
  175. package/dist/esm/icons/chevron-double-right.js.map +1 -0
  176. package/dist/esm/icons/chevron-double-up.d.ts +8 -0
  177. package/dist/esm/icons/chevron-double-up.d.ts.map +1 -0
  178. package/dist/esm/icons/chevron-double-up.js +19 -0
  179. package/dist/esm/icons/chevron-double-up.js.map +1 -0
  180. package/dist/esm/icons/cut.d.ts +8 -0
  181. package/dist/esm/icons/cut.d.ts.map +1 -0
  182. package/dist/esm/icons/cut.js +19 -0
  183. package/dist/esm/icons/cut.js.map +1 -0
  184. package/dist/esm/icons/drag-handle.d.ts +8 -0
  185. package/dist/esm/icons/drag-handle.d.ts.map +1 -0
  186. package/dist/esm/icons/drag-handle.js +19 -0
  187. package/dist/esm/icons/drag-handle.js.map +1 -0
  188. package/dist/esm/icons/file-text.d.ts +8 -0
  189. package/dist/esm/icons/file-text.d.ts.map +1 -0
  190. package/dist/esm/icons/file-text.js +19 -0
  191. package/dist/esm/icons/file-text.js.map +1 -0
  192. package/dist/esm/icons/file.d.ts +8 -0
  193. package/dist/esm/icons/file.d.ts.map +1 -0
  194. package/dist/esm/icons/file.js +19 -0
  195. package/dist/esm/icons/file.js.map +1 -0
  196. package/dist/esm/icons/index.d.ts +11 -0
  197. package/dist/esm/icons/index.d.ts.map +1 -1
  198. package/dist/esm/icons/index.js +11 -0
  199. package/dist/esm/icons/index.js.map +1 -1
  200. package/dist/esm/index.d.ts +2 -2
  201. package/dist/esm/index.d.ts.map +1 -1
  202. package/dist/esm/index.js +2 -2
  203. package/dist/esm/index.js.map +1 -1
  204. package/dist/esm/utils/breakpoints.d.ts +9 -0
  205. package/dist/esm/utils/breakpoints.d.ts.map +1 -0
  206. package/dist/esm/utils/breakpoints.js +35 -0
  207. package/dist/esm/utils/breakpoints.js.map +1 -0
  208. package/dist/esm/utils/use-is-mobile.js +2 -2
  209. package/dist/esm/utils/use-is-mobile.js.map +1 -1
  210. package/dist/esm/utils/use-media-query.d.ts +4 -1
  211. package/dist/esm/utils/use-media-query.d.ts.map +1 -1
  212. package/dist/esm/utils/use-media-query.js.map +1 -1
  213. package/dist-styles/core.css +1 -1
  214. package/dist-styles/styles.css +1 -1
  215. package/package.json +1 -1
  216. package/dist/commonjs/components/app-header/side-nav.d.ts.map +0 -1
  217. package/dist/commonjs/components/app-header/side-nav.js +0 -36
  218. package/dist/commonjs/components/app-header/side-nav.js.map +0 -1
  219. package/dist/esm/components/app-header/side-nav.d.ts.map +0 -1
  220. package/dist/esm/components/app-header/side-nav.js +0 -30
  221. package/dist/esm/components/app-header/side-nav.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAeL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,GAAG,E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AIG;AACH,QAAA,MAAM,SAAS,GAzHG,CAAC,SAAS,cAAc,iKAyHwB,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC;AAuFjC,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,IAAI,CACvE,mBAAmB,CAAC,CAAC,CAAC,EACtB,YAAY,GAAG,cAAc,GAAG,YAAY,CAC7C;IACC,0EAA0E;IAC1E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,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"}
@@ -22,7 +22,7 @@ const VIRTUAL_LAYOUT_OPTIONS = {
22
22
  padding: 0,
23
23
  gap: 0,
24
24
  };
25
- function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, isVirtualized = false, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, UNSTABLE_isClearable: isClearable = false, apiRef, selectedKey, defaultSelectedKey, onSelectionChange, validate, ...props }, ref) {
25
+ function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, isVirtualized = false, isClearable = false, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, apiRef, value, defaultValue, onChange, selectedKey, defaultSelectedKey, onSelectionChange, validate, ...props }, ref) {
26
26
  const inputRef = useRef(null);
27
27
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
28
28
  useProductionWarning(() => {
@@ -39,11 +39,11 @@ function ComboBox({ label, description, error, items, children, placeholder, UNS
39
39
  }), []);
40
40
  const isFieldClearable = isClearable && !props.isDisabled && !isReadOnly;
41
41
  const listBox = (_jsx(ComboBoxList, { items: items, isLoading: isLoading, onLoadMore: onLoadMore, onScroll: onScroll, children: children }));
42
- return (_jsxs(RACComboBox, { ...props, ref: ref, className: clsx('cim-combo-box', UNSAFE_className), style: UNSAFE_style, selectionMode: "single", value: selectedKey, defaultValue: defaultSelectedKey, onChange: onSelectionChange, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, validate: validate
42
+ return (_jsxs(RACComboBox, { ...props, ref: ref, className: clsx('cim-combo-box', UNSAFE_className), style: UNSAFE_style, selectionMode: "single", value: value, defaultValue: defaultValue, onChange: onChange, selectedKey: selectedKey, defaultSelectedKey: defaultSelectedKey, onSelectionChange: onSelectionChange, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, validate: validate
43
43
  ? ({ inputValue, value }) => {
44
- return validate({ inputValue, selectedKey: value });
44
+ return validate({ inputValue, value, selectedKey: value });
45
45
  }
46
- : undefined, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-combo-box-input-group", children: [_jsx(ComboBoxInput, { inputRef: inputRef, isReadOnly: isReadOnly, placeholder: placeholder, isClearable: isFieldClearable }), isFieldClearable && _jsx(ComboBoxClearButton, {}), _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) })] }));
46
+ : undefined, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-combo-box-input-group", children: [_jsx(ComboBoxInput, { inputRef: inputRef, isReadOnly: isReadOnly, placeholder: placeholder, isClearable: isFieldClearable }), isFieldClearable && _jsx(ComboBoxClearButton, { onClear: () => inputRef.current?.focus() }), _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) })] }));
47
47
  }
48
48
  /**
49
49
  * Allows users to filter a collapsible list and select one item from it.
@@ -52,15 +52,17 @@ function ComboBox({ label, description, error, items, children, placeholder, UNS
52
52
  */
53
53
  const _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');
54
54
  export { _ComboBox as ComboBox };
55
- function ComboBoxClearButton() {
55
+ function ComboBoxClearButton({ onClear }) {
56
56
  const comboBoxState = useContext(RACComboBoxStateContext);
57
+ const selectMessages = useLocalizedMessages('select');
57
58
  const inputValue = comboBoxState?.inputValue;
58
59
  if (!comboBoxState || inputValue === '') {
59
60
  return null;
60
61
  }
61
62
  return (_jsx(XButton, { onPress: () => {
62
- comboBoxState?.setValue(null);
63
- }, iconType: "circled", "aria-label": "Clear selection",
63
+ comboBoxState.setValue(null);
64
+ onClear?.();
65
+ }, iconType: "circled", "aria-label": selectMessages.format('clearSelection'),
64
66
  // Prevent this button from acting as a trigger for opening/closing the ComboBox
65
67
  slot: null, excludeFromTabOrder: true }));
66
68
  }
@@ -1 +1 @@
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,EAIL,UAAU,EACV,mBAAmB,EACnB,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,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,EACrB,mBAAmB,IAAI,sBAAsB,EAC7C,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,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA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,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 {\n type ForwardedRef,\n type MutableRefObject,\n type UIEventHandler,\n useContext,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { usePreventScroll } from 'react-aria';\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 ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\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 { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheckBold, 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 { XButton } from '../internal/x-button/x-button.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\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 estimatedRowHeight: 40,\n estimatedHeadingHeight: 32,\n loaderHeight: 40,\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\n CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<ComboBoxApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /** The currently selected key in the collection (controlled). */\n selectedKey?: Key | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: Key;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (key: Key | null) => void;\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 /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n UNSTABLE_isClearable?: boolean;\n}\n\n/** The imperative API exposed by the `ComboBox` component. */\nexport interface ComboBoxApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\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 UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n UNSTABLE_isClearable: isClearable = false,\n apiRef,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n validate,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\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 useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const isFieldClearable = isClearable && !props.isDisabled && !isReadOnly;\n\n const listBox = (\n <ComboBoxList<T> items={items} isLoading={isLoading} onLoadMore={onLoadMore} onScroll={onScroll}>\n {children}\n </ComboBoxList>\n );\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n selectionMode=\"single\"\n value={selectedKey}\n defaultValue={defaultSelectedKey}\n onChange={onSelectionChange}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n validate={\n validate\n ? ({ inputValue, value }) => {\n return validate({ inputValue, selectedKey: value });\n }\n : undefined\n }\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput\n inputRef={inputRef}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n isClearable={isFieldClearable}\n />\n {isFieldClearable && <ComboBoxClearButton />}\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.io/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxClearButton() {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const inputValue = comboBoxState?.inputValue;\n\n if (!comboBoxState || inputValue === '') {\n return null;\n }\n\n return (\n <XButton\n onPress={() => {\n comboBoxState?.setValue(null);\n }}\n iconType=\"circled\"\n // TODO: i18n once stabilized\n aria-label=\"Clear selection\"\n // Prevent this button from acting as a trigger for opening/closing the ComboBox\n slot={null}\n excludeFromTabOrder\n />\n );\n}\n\nfunction ComboBoxInput({\n inputRef,\n isReadOnly,\n placeholder,\n isClearable,\n}: {\n inputRef: MutableRefObject<HTMLInputElement | null>;\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n isClearable: boolean;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n ref={inputRef}\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 onKeyDown={(e) => {\n if (e.key === 'Escape' && !comboBoxState?.isOpen && isClearable) {\n comboBoxState?.setValue(null);\n }\n }}\n />\n );\n}\n\nfunction ComboBoxList<T extends CollectionItem = CollectionItem>({\n items,\n children,\n isLoading,\n onLoadMore,\n onScroll,\n}: Pick<ComboBoxProps<T>, 'items' | 'children' | 'onScroll'> & {\n isLoading: ComboBoxProps['UNSTABLE_isLoading'];\n onLoadMore: ComboBoxProps['UNSTABLE_onLoadMore'];\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n return (\n <RACListBox\n className=\"cim-combo-box-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem> extends Pick<\n RACListBoxItemProps<T>,\n 'isDisabled' | 'onHoverStart' | 'onHoverEnd'\n> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n 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 <IconCheckBold />\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,EAIL,UAAU,EACV,mBAAmB,EACnB,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,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,EACrB,mBAAmB,IAAI,sBAAsB,EAC7C,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,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,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,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,YACjG,QAAQ,GACD,IACT,CACJ,GACc,CAClB,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,WAAW,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 {\n type ForwardedRef,\n type MutableRefObject,\n type UIEventHandler,\n useContext,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { usePreventScroll } from 'react-aria';\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 ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\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 { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheckBold, 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 { XButton } from '../internal/x-button/x-button.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\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 estimatedRowHeight: 40,\n estimatedHeadingHeight: 32,\n loaderHeight: 40,\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 combo box. */\n value: Key | null;\n /** The value of the combo box input. */\n inputValue: string;\n /**\n * The selected key in the combo box.\n * @deprecated Use `value` instead.\n */\n selectedKey: Key | null;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends\n CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<ComboBoxApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /** The current value (controlled). */\n value?: Key | null;\n /** The initial value (uncontrolled). */\n defaultValue?: Key;\n /** Handler that is called when the value changes. */\n onChange?: (key: Key | null) => void;\n /**\n * The currently selected key in the collection (controlled).\n * @deprecated Use `value` instead.\n */\n selectedKey?: Key | null;\n /**\n * The initial selected key in the collection (uncontrolled).\n * @deprecated Use `defaultValue` instead.\n */\n defaultSelectedKey?: Key;\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead.\n */\n onSelectionChange?: (key: Key | null) => void;\n /** Whether to display a clear button to clear the selection. */\n isClearable?: boolean;\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 /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** The imperative API exposed by the `ComboBox` component. */\nexport interface ComboBoxApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\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 isClearable = false,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n apiRef,\n value,\n defaultValue,\n onChange,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n validate,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\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 useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const isFieldClearable = isClearable && !props.isDisabled && !isReadOnly;\n\n const listBox = (\n <ComboBoxList<T> items={items} isLoading={isLoading} onLoadMore={onLoadMore} onScroll={onScroll}>\n {children}\n </ComboBoxList>\n );\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n selectionMode=\"single\"\n value={value}\n defaultValue={defaultValue}\n onChange={onChange}\n selectedKey={selectedKey}\n defaultSelectedKey={defaultSelectedKey}\n onSelectionChange={onSelectionChange}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n validate={\n validate\n ? ({ inputValue, value }) => {\n return validate({ inputValue, value, selectedKey: value });\n }\n : undefined\n }\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput\n inputRef={inputRef}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n isClearable={isFieldClearable}\n />\n {isFieldClearable && <ComboBoxClearButton onClear={() => inputRef.current?.focus()} />}\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.io/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxClearButton({ onClear }: { onClear?: () => void }) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const selectMessages = useLocalizedMessages('select');\n const inputValue = comboBoxState?.inputValue;\n\n if (!comboBoxState || inputValue === '') {\n return null;\n }\n\n return (\n <XButton\n onPress={() => {\n comboBoxState.setValue(null);\n onClear?.();\n }}\n iconType=\"circled\"\n aria-label={selectMessages.format('clearSelection')}\n // Prevent this button from acting as a trigger for opening/closing the ComboBox\n slot={null}\n excludeFromTabOrder\n />\n );\n}\n\nfunction ComboBoxInput({\n inputRef,\n isReadOnly,\n placeholder,\n isClearable,\n}: {\n inputRef: MutableRefObject<HTMLInputElement | null>;\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n isClearable: boolean;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n ref={inputRef}\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 onKeyDown={(e) => {\n if (e.key === 'Escape' && !comboBoxState?.isOpen && isClearable) {\n comboBoxState?.setValue(null);\n }\n }}\n />\n );\n}\n\nfunction ComboBoxList<T extends CollectionItem = CollectionItem>({\n items,\n children,\n isLoading,\n onLoadMore,\n onScroll,\n}: Pick<ComboBoxProps<T>, 'items' | 'children' | 'onScroll'> & {\n isLoading: ComboBoxProps['UNSTABLE_isLoading'];\n onLoadMore: ComboBoxProps['UNSTABLE_onLoadMore'];\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n return (\n <RACListBox\n className=\"cim-combo-box-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem> extends Pick<\n RACListBoxItemProps<T>,\n 'isDisabled' | 'onHoverStart' | 'onHoverEnd'\n> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n 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 <IconCheckBold />\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,8 +1,2 @@
1
- import { type InputProps as RACInputProps } from 'react-aria-components';
2
- import type { CommonProps } from '../../types.js';
3
- interface InputProps extends CommonProps, Exclude<RACInputProps, 'className' | 'style'> {
4
- width?: 'fit-content' | 'full-width';
5
- }
6
- export declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
7
1
  export {};
8
2
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/internal/input/input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,UAAU,UAAW,SAAQ,WAAW,EAAE,OAAO,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC;IACrF,KAAK,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CACtC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAqDtC"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../../src/components/internal/input/input.tsx"],"names":[],"mappings":""}
@@ -1,30 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useLayoutEffect } from '@react-aria/utils';
3
2
  import clsx from 'clsx';
4
- import { useRef } from 'react';
5
3
  import { Input as RACInput } from 'react-aria-components';
6
4
  import { textStyle } from '../../typography/utils.js';
5
+ /**
6
+ * Renders a styled input field.
7
+ * @internal
8
+ */
7
9
  export function Input(props) {
8
- const inputRef = useRef(null);
9
10
  // TODO: find a better way to extract common props, if a new prop is added to `CommonProps` this will break
10
- const { id, UNSAFE_className, UNSAFE_style, 'data-cim-style-root': dataCimStyleRoot, width, ...inputProps } = props;
11
- // Field sizing based on input length for browsers that don't support `field-sizing: content`
12
- useLayoutEffect(() => {
13
- const input = inputRef.current;
14
- function setInputLengthStyle() {
15
- // Ensure input value changes are flushed before updating input width, especially in Safari
16
- requestAnimationFrame(() => input?.style.setProperty('--cim-input-length', input?.value.length.toString() ?? '0'));
17
- }
18
- if (input != null) {
19
- setInputLengthStyle();
20
- input.addEventListener('input', setInputLengthStyle);
21
- input.addEventListener('change', setInputLengthStyle);
22
- }
23
- return () => {
24
- input?.removeEventListener('input', setInputLengthStyle);
25
- input?.removeEventListener('change', setInputLengthStyle);
26
- };
27
- }, []);
28
- return (_jsx("div", { id: id, className: clsx('cim-input', UNSAFE_className), style: UNSAFE_style, "data-cim-style-root": dataCimStyleRoot, children: _jsx(RACInput, { ...inputProps, ref: inputRef, className: clsx('cim-input-control', textStyle({ variant: 'body' })), "data-width": width }) }));
11
+ const { id, UNSAFE_className, UNSAFE_style, 'data-cim-style-root': dataCimStyleRoot, contentWidth, ...inputProps } = props;
12
+ return (_jsx("div", { id: id, className: clsx('cim-input', UNSAFE_className), style: UNSAFE_style, "data-cim-style-root": dataCimStyleRoot, children: _jsx(RACInput, { ...inputProps, className: clsx('cim-input-control', textStyle({ variant: 'body' })), style: { '--cim-input-content-width': contentWidth } }) }));
29
13
  }
30
14
  //# sourceMappingURL=input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/internal/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAoC,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAMtD,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,2GAA2G;IAC3G,MAAM,EACJ,EAAE,EAC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useRef } from 'react';\nimport { Input as RACInput, type InputProps as RACInputProps } from 'react-aria-components';\nimport type { CommonProps } from '../../types.js';\nimport { textStyle } from '../../typography/utils.js';\n\ninterface InputProps extends CommonProps, Exclude<RACInputProps, 'className' | 'style'> {\n width?: 'fit-content' | 'full-width';\n}\n\nexport function Input(props: InputProps) {\n const inputRef = useRef<HTMLInputElement>(null);\n // TODO: find a better way to extract common props, if a new prop is added to `CommonProps` this will break\n const {\n id,\n UNSAFE_className,\n UNSAFE_style,\n 'data-cim-style-root': dataCimStyleRoot,\n\n width,\n\n ...inputProps\n } = props;\n\n // Field sizing based on input length for browsers that don't support `field-sizing: content`\n useLayoutEffect(() => {\n const input = inputRef.current;\n\n function setInputLengthStyle() {\n // Ensure input value changes are flushed before updating input width, especially in Safari\n requestAnimationFrame(() =>\n input?.style.setProperty('--cim-input-length', input?.value.length.toString() ?? '0'),\n );\n }\n\n if (input != null) {\n setInputLengthStyle();\n\n input.addEventListener('input', setInputLengthStyle);\n input.addEventListener('change', setInputLengthStyle);\n }\n\n return () => {\n input?.removeEventListener('input', setInputLengthStyle);\n input?.removeEventListener('change', setInputLengthStyle);\n };\n }, []);\n\n return (\n <div\n id={id}\n className={clsx('cim-input', UNSAFE_className)}\n style={UNSAFE_style}\n data-cim-style-root={dataCimStyleRoot}\n >\n <RACInput\n {...inputProps}\n ref={inputRef}\n className={clsx('cim-input-control', textStyle({ variant: 'body' }))}\n data-width={width}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../../src/components/internal/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAoC,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAMtD;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,2GAA2G;IAC3G,MAAM,EACJ,EAAE,EACF,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EAAE,gBAAgB,EAEvC,YAAY,EAEZ,GAAG,UAAU,EACd,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,cACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,EAC9C,KAAK,EAAE,YAAY,yBACE,gBAAgB,YAErC,KAAC,QAAQ,OACH,UAAU,EACd,SAAS,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EACpE,KAAK,EAAE,EAAE,2BAA2B,EAAE,YAAY,EAAmB,GACrE,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { CSSProperties } from 'react';\nimport { Input as RACInput, type InputProps as RACInputProps } from 'react-aria-components';\nimport type { CommonProps } from '../../types.js';\nimport { textStyle } from '../../typography/utils.js';\n\ninterface InputProps extends CommonProps, Exclude<RACInputProps, 'className' | 'style'> {\n contentWidth?: CSSProperties['width'];\n}\n\n/**\n * Renders a styled input field.\n * @internal\n */\nexport function Input(props: InputProps) {\n // TODO: find a better way to extract common props, if a new prop is added to `CommonProps` this will break\n const {\n id,\n UNSAFE_className,\n UNSAFE_style,\n 'data-cim-style-root': dataCimStyleRoot,\n\n contentWidth,\n\n ...inputProps\n } = props;\n\n return (\n <div\n id={id}\n className={clsx('cim-input', UNSAFE_className)}\n style={UNSAFE_style}\n data-cim-style-root={dataCimStyleRoot}\n >\n <RACInput\n {...inputProps}\n className={clsx('cim-input-control', textStyle({ variant: 'body' }))}\n style={{ '--cim-input-content-width': contentWidth } as CSSProperties}\n />\n </div>\n );\n}\n"]}
@@ -1,14 +1,36 @@
1
- import { type UIEventHandler } from 'react';
1
+ import { type ReactNode, type UIEventHandler } from 'react';
2
2
  import { type ListBoxItemProps as RACListBoxItemProps, type SelectProps as RACSelectProps } from 'react-aria-components';
3
3
  import type { ApiProps, AsyncItemLoadingProps, CollectionItem, CollectionProps, CommonProps, FieldProps, Key, StringLikeChildren } from '../types.js';
4
- export type UNSTABLE_SelectSelectionMode = 'single' | 'multiple';
5
- export interface SelectProps<T extends CollectionItem = CollectionItem, M extends UNSTABLE_SelectSelectionMode = 'single'> extends CommonProps, FieldProps<M extends 'single' ? Key : Key[]>, CollectionProps<T>, AsyncItemLoadingProps, ApiProps<SelectApi>, Pick<RACSelectProps<T, M>, 'isDisabled' | 'isRequired' | 'isInvalid' | 'autoComplete' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur' | 'onOpenChange'> {
6
- /** The currently selected key in the collection (controlled). */
4
+ export type SelectSelectionMode = 'single' | 'multiple';
5
+ export interface SelectProps<T extends CollectionItem = CollectionItem, M extends SelectSelectionMode = 'single'> extends CommonProps, FieldProps<M extends 'single' ? Key : Key[]>, CollectionProps<T>, AsyncItemLoadingProps, ApiProps<SelectApi>, Pick<RACSelectProps<T, M>, 'isDisabled' | 'isRequired' | 'isInvalid' | 'autoComplete' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur' | 'onOpenChange'> {
6
+ /**
7
+ * The selection mode of the select.
8
+ * @default 'single'
9
+ */
10
+ selectionMode?: M;
11
+ /** The current value (controlled). */
12
+ value?: M extends 'single' ? Key | null : Key[];
13
+ /** The initial value (uncontrolled). */
14
+ defaultValue?: M extends 'single' ? Key : Key[];
15
+ /** Handler that is called when the value changes. */
16
+ onChange?: (key: M extends 'single' ? Key | null : Key[]) => void;
17
+ /**
18
+ * The currently selected key in the collection (controlled).
19
+ * @deprecated Use `value` instead. Not compatible with `selectionMode="multiple"`.
20
+ */
7
21
  selectedKey?: Key | null;
8
- /** The initial selected key in the collection (uncontrolled). */
22
+ /**
23
+ * The initial selected key in the collection (uncontrolled).
24
+ * @deprecated Use `defaultValue` instead. Not compatible with `selectionMode="multiple"`.
25
+ */
9
26
  defaultSelectedKey?: Key;
10
- /** Handler that is called when the selection changes. */
27
+ /**
28
+ * Handler that is called when the selection changes.
29
+ * @deprecated Use `onChange` instead. Not compatible with `selectionMode="multiple"`.
30
+ */
11
31
  onSelectionChange?: (key: Key | null) => void;
32
+ /** Whether to display a clear button to clear the selection. */
33
+ isClearable?: boolean;
12
34
  /**
13
35
  * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.
14
36
  * @default false
@@ -16,39 +38,22 @@ export interface SelectProps<T extends CollectionItem = CollectionItem, M extend
16
38
  isVirtualized?: boolean;
17
39
  /** Handler that is called when the list of items is scrolled. */
18
40
  onScroll?: UIEventHandler<HTMLDivElement>;
19
- /**
20
- * The selection mode of the select.
21
- * @default 'single'
22
- */
23
- UNSTABLE_selectionMode?: M;
24
- /** The value of the select (controlled). */
25
- UNSTABLE_value?: M extends 'single' ? Key | null : Key[];
26
- /** The initial value of the select (uncontrolled). */
27
- UNSTABLE_defaultValue?: M extends 'single' ? Key : Key[];
28
- /** Handler that is called when the value changes. */
29
- UNSTABLE_onChange?: (key: M extends 'single' ? Key | null : Key[]) => void;
30
- /**
31
- * How the selected value is displayed.
32
- * @default 'text'
33
- */
34
- UNSTABLE_valueDisplay?: 'text' | 'tags' | 'count';
35
41
  /**
36
42
  * Whether the list of options should be filterable.
37
43
  * @default false
38
44
  */
39
- UNSTABLE_isFilterable?: boolean;
45
+ isFilterable?: boolean;
40
46
  /** The value of the filter input (controlled). */
41
- UNSTABLE_filterValue?: string;
47
+ filterValue?: string;
42
48
  /** The initial value of the filter input (uncontrolled). */
43
- UNSTABLE_defaultFilterValue?: string;
49
+ defaultFilterValue?: string;
44
50
  /** Handler that is called when the filter value changes. */
45
- UNSTABLE_onFilterChange?: (value: string) => void;
51
+ onFilterChange?: (value: string) => void;
46
52
  /** A custom filter function to use instead of the default filter. */
47
- UNSTABLE_filter?: ((textValue: string, inputValue: string, node: {
53
+ UNSTABLE_filter?: ((textValue: string, inputValue: string, item: {
48
54
  key: Key;
49
55
  value: T | null;
50
56
  }) => boolean) | null;
51
- UNSTABLE_isClearable?: boolean;
52
57
  }
53
58
  /** The imperative API exposed by the `Select` component. */
54
59
  export interface SelectApi {
@@ -56,20 +61,26 @@ export interface SelectApi {
56
61
  focus: () => void;
57
62
  }
58
63
  /**
59
- * Allows users to select one item from a collapsible list.
64
+ * Allows users to select one or more items from a collapsible list.
60
65
  *
61
66
  * See [select usage guidelines](https://ui.cimpress.io/components/select/).
62
67
  */
63
- declare const _Select: <T extends CollectionItem, M extends UNSTABLE_SelectSelectionMode = "single">(props: SelectProps<T, M> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
68
+ declare const _Select: <T extends CollectionItem, M extends SelectSelectionMode = "single">(props: SelectProps<T, M> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
64
69
  export { _Select as Select };
65
70
  export interface SelectItemProps extends Pick<RACListBoxItemProps, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {
66
71
  /** The ID of the item. Has to be unique across all sections and items. */
67
72
  id?: Key;
68
73
  /** The content to display as the label. */
69
74
  children: StringLikeChildren;
75
+ /** Additional description for the item. */
76
+ description?: string;
77
+ /** A non-interactive piece of content displayed at the start of the item. */
78
+ icon?: ReactNode;
79
+ /** A non-interactive piece of content displayed at the end of the item. */
80
+ UNSTABLE_meta?: ReactNode;
70
81
  }
71
82
  /** Renders a single list item within `Select`. */
72
- export declare function SelectItem({ children, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
83
+ export declare function SelectItem({ children, description, icon, UNSTABLE_meta: meta, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
73
84
  export declare namespace SelectItem {
74
85
  var displayName: string;
75
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAQL,KAAK,gBAAgB,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E,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAelH;yBAfe,aAAa"}
@@ -1,10 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { mergeRefs } from '@react-aria/utils';
4
3
  import clsx from 'clsx';
5
4
  import { useContext, useImperativeHandle, useMemo, useRef, } from 'react';
6
- import { useFilter, useId, useInteractOutside, usePreventScroll } from 'react-aria';
7
- import { Autocomplete as RACAutocomplete, Button as RACButton, Collection as RACCollection, Header as RACHeader, LabelContext as RACLabelContext, ListBox as RACListBox, ListBoxItem as RACListBoxItem, ListBoxLoadMoreItem as RACListBoxLoadMoreItem, ListBoxSection as RACListBoxSection, ListLayout as RACListLayout, Select as RACSelect, SelectStateContext as RACSelectStateContext, SelectValue as RACSelectValue, Text as RACText, Virtualizer as RACVirtualizer, useSlottedContext, } from 'react-aria-components';
5
+ import { useFilter, useId, useInteractOutside, useObjectRef, usePreventScroll } from 'react-aria';
6
+ import { Autocomplete as RACAutocomplete, Button as RACButton, Collection as RACCollection, Header as RACHeader, ListBox as RACListBox, ListBoxItem as RACListBoxItem, ListBoxLoadMoreItem as RACListBoxLoadMoreItem, ListBoxSection as RACListBoxSection, ListLayout as RACListLayout, Select as RACSelect, SelectStateContext as RACSelectStateContext, SelectValue as RACSelectValue, Text as RACText, Virtualizer as RACVirtualizer, } from 'react-aria-components';
8
7
  import { forwardRef } from '../../forward-ref.js';
9
8
  import { useLocalizedMessages } from '../../i18n/index.js';
10
9
  import { IconCheckBold, IconChevronDown } from '../../icons/index.js';
@@ -22,7 +21,6 @@ import { Tag } from '../tag/tag.js';
22
21
  import { SearchField } from '../text-inputs/search-field.js';
23
22
  import { Text } from '../typography/text.js';
24
23
  import { textStyle } from '../typography/utils.js';
25
- import { UNSTABLE_VisuallyHidden } from '../visually-hidden/visually-hidden.js';
26
24
  const VIRTUAL_LAYOUT_OPTIONS = {
27
25
  estimatedRowHeight: 40,
28
26
  estimatedHeadingHeight: 32,
@@ -30,8 +28,9 @@ const VIRTUAL_LAYOUT_OPTIONS = {
30
28
  padding: 0,
31
29
  gap: 0,
32
30
  };
33
- function Select({ children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, isVirtualized = false, apiRef, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, selectedKey, defaultSelectedKey, onSelectionChange, UNSTABLE_selectionMode, UNSTABLE_value, UNSTABLE_defaultValue, UNSTABLE_onChange, UNSTABLE_valueDisplay: valueDisplay = 'text', UNSTABLE_isFilterable: isFilterable = false, UNSTABLE_filterValue: filterValue, UNSTABLE_defaultFilterValue: defaultFilterValue, UNSTABLE_onFilterChange: onFilterChange, UNSTABLE_filter: filter, UNSTABLE_isClearable: isClearable = false, ...props }, ref) {
31
+ function Select({ children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, isVirtualized = false, apiRef, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, selectedKey, defaultSelectedKey, onSelectionChange, selectionMode = 'single', value, defaultValue, onChange, isClearable = false, isFilterable = false, filterValue, defaultFilterValue, onFilterChange, UNSTABLE_filter: filter, id, isDisabled, ...props }, ref) {
34
32
  const triggerRef = useRef(null);
33
+ const selectId = useId(id);
35
34
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
36
35
  useProductionWarning(() => {
37
36
  if (!label && !ariaLabel && !ariaLabelledBy) {
@@ -47,16 +46,25 @@ function Select({ children, items, label, description, error, UNSAFE_className,
47
46
  const listBox = (_jsx(SelectListBox, { items: items, isLoading: isLoading, onLoadMore: onLoadMore, onScroll: onScroll, children: children }));
48
47
  const listBoxWithVirtualizer = isVirtualized ? (_jsx(RACVirtualizer, { layout: RACListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox);
49
48
  const listBoxWithFilter = isFilterable ? (_jsx(SelectFilter, { filterValue: filterValue, defaultFilterValue: defaultFilterValue, onFilterChange: onFilterChange, filter: filter, children: listBoxWithVirtualizer })) : (listBoxWithVirtualizer);
50
- return (_jsxs(RACSelect, { ...props, ref: ref, className: clsx('cim-select', UNSAFE_className), style: UNSAFE_style, selectedKey: selectedKey, defaultSelectedKey: defaultSelectedKey, onSelectionChange: onSelectionChange, value: UNSTABLE_value, defaultValue: UNSTABLE_defaultValue, onChange: UNSTABLE_onChange, selectionMode: UNSTABLE_selectionMode, allowsEmptyCollection: isLoading, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsx(SelectButton, { ref: triggerRef, valueDisplay: valueDisplay, isClearable: isClearable }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description }), _jsx(SelectPopover, { children: listBoxWithFilter }), UNSTABLE_selectionMode === 'multiple' && valueDisplay === 'tags' && _jsx(SelectTags, {})] }));
49
+ return (_jsxs(RACSelect, { ...props, ref: ref, id: selectId, className: clsx('cim-select', UNSAFE_className), style: UNSAFE_style, selectedKey: selectedKey, defaultSelectedKey: defaultSelectedKey, onSelectionChange: onSelectionChange, value: value, defaultValue: defaultValue, onChange: onChange, selectionMode: selectionMode, allowsEmptyCollection: isLoading, isDisabled: isDisabled, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: isDisabled, children: label }), _jsx(SelectButton, { ref: triggerRef, selectId: selectId, isDisabled: isDisabled, isClearable: isClearable, selectionMode: selectionMode }), _jsx(FormFieldError, { children: error }), _jsx(FormFieldDescription, { children: description }), _jsx(SelectPopover, { children: listBoxWithFilter })] }));
51
50
  }
52
51
  function SelectPopover({ children }) {
53
52
  const popoverRef = useRef(null);
53
+ const interactOutsideTarget = useRef(null);
54
54
  const selectState = useContext(RACSelectStateContext);
55
55
  // Popover is non-modal, but we still want to close it when the user interacts outside
56
56
  useInteractOutside({
57
57
  ref: popoverRef,
58
- onInteractOutside: () => {
59
- selectState?.close();
58
+ onInteractOutsideStart: (e) => {
59
+ interactOutsideTarget.current = e.target;
60
+ },
61
+ onInteractOutside: (e) => {
62
+ if (interactOutsideTarget.current === e.target) {
63
+ requestAnimationFrame(() => {
64
+ selectState?.close();
65
+ });
66
+ }
67
+ interactOutsideTarget.current = null;
60
68
  },
61
69
  isDisabled: !selectState?.isOpen,
62
70
  });
@@ -66,14 +74,22 @@ function SelectPopover({ children }) {
66
74
  // Set to non-modal so that interactions like clicking the clear button can be performed without first having to close the popover
67
75
  isNonModal: true, children: children }));
68
76
  }
69
- const SelectButton = forwardRef(({ valueDisplay, isClearable }, ref) => {
70
- const triggerRef = useRef(null);
71
- const collectionMessages = useLocalizedMessages('UNSTABLE_collection');
72
- return (_jsxs("div", { className: "cim-select-button", children: [_jsx(RACButton, { ref: mergeRefs(ref, triggerRef), className: "cim-select-button-trigger" }), _jsx(RACSelectValue, { className: clsx('cim-select-button-value', textStyle({ variant: 'body', alignment: 'start' })), children: ({ selectedText, defaultChildren, isPlaceholder, state }) => {
73
- if ((valueDisplay === 'tags' && state.selectedItems.length > 0) || valueDisplay === 'count') {
74
- return (_jsx(Text, { as: "span", variant: "body", tone: "subtle", children: collectionMessages.format('itemsSelected', { selectedItemCount: state.selectedItems.length }) }));
77
+ const SelectButton = forwardRef(({ selectId, isDisabled, isClearable, selectionMode }, ref) => {
78
+ const triggerRef = useObjectRef(ref);
79
+ return (_jsxs("div", { className: "cim-select-button", children: [_jsx(RACButton, { ref: triggerRef, className: "cim-select-button-trigger" }), _jsx(RACSelectValue, { className: clsx('cim-select-button-value', textStyle({ variant: 'body', alignment: 'start' })), "data-testid": "select-button-value", children: ({ defaultChildren, isPlaceholder, state }) => {
80
+ if (isPlaceholder) {
81
+ return _jsx("span", { className: "cim-select-button-value-text", children: defaultChildren });
75
82
  }
76
- return isPlaceholder ? defaultChildren : selectedText;
83
+ if (selectionMode === 'multiple') {
84
+ return (_jsx(TagGroup, { "aria-labelledby": selectId, disabledKeys: isDisabled ? state.selectedItems.map((item) => item.key) : undefined, items: state.selectedItems.filter((item) => item != null).map((item) => ({ id: item.key, item })), onRemove: isDisabled
85
+ ? undefined
86
+ : (keys) => {
87
+ if (Array.isArray(state.value)) {
88
+ state.setValue(state.value.filter((k) => !keys.has(k)));
89
+ }
90
+ }, UNSAFE_className: "cim-select-tags", children: ({ item }) => _jsx(Tag, { isDisabled: item.props.isDisabled, children: item.textValue }) }));
91
+ }
92
+ return defaultChildren;
77
93
  } }), isClearable && (_jsx(SelectClearButton
78
94
  // Move focus to trigger button, because button will disappear after clearing
79
95
  , {
@@ -82,25 +98,24 @@ const SelectButton = forwardRef(({ valueDisplay, isClearable }, ref) => {
82
98
  });
83
99
  function SelectClearButton({ onClear }) {
84
100
  const selectState = useContext(RACSelectStateContext);
101
+ const selectMessages = useLocalizedMessages('select');
85
102
  if (!selectState || selectState.selectedItems.length === 0) {
86
103
  return null;
87
104
  }
88
- return (_jsx(XButton
89
- // TODO: i18n once stabilized
90
- , { "aria-label": "Clear selection", iconType: "circled", onPress: () => {
105
+ return (_jsx(XButton, { "aria-label": selectMessages.format('clearSelection'), iconType: "circled", onPress: () => {
91
106
  selectState.setValue(null);
92
107
  onClear?.();
93
108
  }, slot: null, UNSAFE_className: "cim-select-button-clear" }));
94
109
  }
95
110
  function SelectListBox({ children, items, isLoading, onLoadMore, ...props }) {
96
111
  const collectionMessages = useLocalizedMessages('UNSTABLE_collection');
112
+ const selectMessages = useLocalizedMessages('select');
97
113
  const selectState = useContext(RACSelectStateContext);
98
114
  const isEmpty = selectState?.collection.size === 0;
99
- return (_jsxs(RACListBox, { className: "cim-select-listbox", renderEmptyState: () => !isLoading && (
100
- // TODO: i18n once stabilized
101
- _jsx(Text, { as: "p", variant: "body", tone: "subtle", marginX: 8, marginY: 8, UNSAFE_className: "cim-select-listbox-empty-state", children: "No results found." })), ...props, children: [_jsx(RACCollection, { items: items, children: children }), _jsx(RACListBoxLoadMoreItem, { onLoadMore: onLoadMore, isLoading: isLoading, children: _jsx(Spinner, { "aria-label": collectionMessages.format(isEmpty ? 'loading' : 'loadingMore'), size: "small", marginY: 8 }) })] }));
115
+ return (_jsxs(RACListBox, { className: "cim-select-listbox", renderEmptyState: () => !isLoading && (_jsx(Text, { as: "p", variant: "body", tone: "subtle", marginX: 8, marginY: 8, UNSAFE_className: "cim-select-listbox-empty-state", children: selectMessages.format('noResultsFound') })), ...props, children: [_jsx(RACCollection, { items: items, children: children }), _jsx(RACListBoxLoadMoreItem, { onLoadMore: onLoadMore, isLoading: isLoading, children: _jsx(Spinner, { "aria-label": collectionMessages.format(isEmpty ? 'loading' : 'loadingMore'), size: "small", marginY: 8 }) })] }));
102
116
  }
103
117
  function SelectFilter({ children, filterValue, defaultFilterValue, onFilterChange, filter, }) {
118
+ const selectMessages = useLocalizedMessages('select');
104
119
  const { contains } = useFilter({ sensitivity: 'base' });
105
120
  const filterFn = useMemo(() => {
106
121
  if (filter === null)
@@ -111,37 +126,19 @@ function SelectFilter({ children, filterValue, defaultFilterValue, onFilterChang
111
126
  return filter(textValue, inputValue, { key: node.key, value: node.value });
112
127
  };
113
128
  }, [filter, contains]);
114
- return (_jsxs(RACAutocomplete, { filter: filterFn, inputValue: filterValue, defaultInputValue: defaultFilterValue, onInputChange: onFilterChange, children: [_jsx(SearchField
115
- // TODO: i18n once stabilized
116
- , { "aria-label": "Search", placeholder: "Search", autoFocus: true, marginX: 8, marginTop: 8 }), children] }));
117
- }
118
- function SelectTags() {
119
- const labelContext = useSlottedContext(RACLabelContext);
120
- const selectedItemsLabelId = useId();
121
- return (_jsx(RACSelectValue, { children: ({ state }) => {
122
- if (state.selectedItems.length === 0) {
123
- return _jsx(_Fragment, {});
124
- }
125
- return (_jsxs(_Fragment, { children: [_jsx(TagGroup, { "aria-labelledby": [labelContext?.id, selectedItemsLabelId].filter(Boolean).join(' '), items: state.selectedItems
126
- .filter((item) => item != null)
127
- .map((item) => ({ id: item.key, label: item.textValue })), onRemove: (keys) => {
128
- if (Array.isArray(state.value)) {
129
- state.setValue(state.value.filter((k) => !keys.has(k)));
130
- }
131
- }, marginTop: 8, children: (item) => _jsx(Tag, { children: item.label }) }), _jsx(UNSTABLE_VisuallyHidden, { id: selectedItemsLabelId, children: "selected items" })] }));
132
- } }));
129
+ return (_jsxs(RACAutocomplete, { filter: filterFn, inputValue: filterValue, defaultInputValue: defaultFilterValue, onInputChange: onFilterChange, children: [_jsx(SearchField, { "aria-label": selectMessages.format('searchLabel'), placeholder: selectMessages.format('searchPlaceholder'), autoFocus: true, UNSAFE_className: "cim-select-search-field" }), children] }));
133
130
  }
134
131
  /**
135
- * Allows users to select one item from a collapsible list.
132
+ * Allows users to select one or more items from a collapsible list.
136
133
  *
137
134
  * See [select usage guidelines](https://ui.cimpress.io/components/select/).
138
135
  */
139
136
  const _Select = withStyleProps(forwardRef(Select), 'Select');
140
137
  export { _Select as Select };
141
138
  /** Renders a single list item within `Select`. */
142
- export function SelectItem({ children, ...props }) {
139
+ export function SelectItem({ children, description, icon, UNSTABLE_meta: meta, ...props }) {
143
140
  const textValue = stringLikeChildrenToString(children);
144
- return (_jsx(RACListBoxItem, { ...props, className: "cim-select-item", textValue: textValue, children: ({ isDisabled, isSelected, selectionMode }) => (_jsxs(_Fragment, { children: [selectionMode === 'single' && _jsx(IconCheckBold, {}), selectionMode === 'multiple' && _jsx(CheckboxIndicator, { isSelected: isSelected, isDisabled: isDisabled }), _jsx(RACText, { slot: "label", className: textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
141
+ return (_jsx(RACListBoxItem, { ...props, className: "cim-select-item", textValue: textValue, children: ({ isDisabled, isSelected, selectionMode }) => (_jsxs(_Fragment, { children: [selectionMode === 'single' && _jsx(IconCheckBold, { "data-selection-indicator": true }), selectionMode === 'multiple' && _jsx(CheckboxIndicator, { isSelected: isSelected, isDisabled: isDisabled }), icon && _jsx("div", { className: "cim-select-item-slot", children: icon }), _jsxs("div", { className: "cim-select-item-text", children: [_jsx(RACText, { slot: "label", className: textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children }), description && (_jsx(RACText, { slot: "description", className: textStyle({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' }), children: description }))] }), meta && _jsx("div", { className: "cim-select-item-slot", children: meta })] })) }));
145
142
  }
146
143
  SelectItem.displayName = 'SelectItem';
147
144
  /** Groups list items within `Select` into a section. */