@cimpress-ui/react 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/dist/commonjs/components/app-header/app-header.d.ts +2 -0
  2. package/dist/commonjs/components/app-header/app-header.d.ts.map +1 -1
  3. package/dist/commonjs/components/app-header/app-header.js +7 -2
  4. package/dist/commonjs/components/app-header/app-header.js.map +1 -1
  5. package/dist/commonjs/components/app-header/cimpress-logo.js +1 -1
  6. package/dist/commonjs/components/app-header/cimpress-logo.js.map +1 -1
  7. package/dist/commonjs/components/copy/copy-button.d.ts +7 -0
  8. package/dist/commonjs/components/copy/copy-button.d.ts.map +1 -1
  9. package/dist/commonjs/components/copy/copy-button.js +42 -7
  10. package/dist/commonjs/components/copy/copy-button.js.map +1 -1
  11. package/dist/commonjs/components/copy/use-copy.d.ts.map +1 -1
  12. package/dist/commonjs/components/copy/use-copy.js +10 -10
  13. package/dist/commonjs/components/copy/use-copy.js.map +1 -1
  14. package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.js +4 -7
  15. package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.js.map +1 -1
  16. package/dist/commonjs/components/select/select.d.ts +7 -1
  17. package/dist/commonjs/components/select/select.d.ts.map +1 -1
  18. package/dist/commonjs/components/select/select.js +2 -2
  19. package/dist/commonjs/components/select/select.js.map +1 -1
  20. package/dist/commonjs/components/table/contexts/column-collection.d.ts.map +1 -1
  21. package/dist/commonjs/components/table/contexts/column-collection.js +0 -1
  22. package/dist/commonjs/components/table/contexts/column-collection.js.map +1 -1
  23. package/dist/commonjs/components/table/contexts/row-state.js.map +1 -1
  24. package/dist/commonjs/components/table/contexts/table-state.js.map +1 -1
  25. package/dist/commonjs/components/table/hooks/use-table-cell.js.map +1 -1
  26. package/dist/commonjs/components/tag-field/tag-field-list-box.js +5 -2
  27. package/dist/commonjs/components/tag-field/tag-field-list-box.js.map +1 -1
  28. package/dist/commonjs/components/tag-field/tag-field-tags.js +2 -0
  29. package/dist/commonjs/components/tag-field/tag-field-tags.js.map +1 -1
  30. package/dist/commonjs/components/tag-field/tag-field.js +1 -1
  31. package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
  32. package/dist/commonjs/components/toggle-button/internal-toggle-button.js +7 -7
  33. package/dist/commonjs/components/toggle-button/internal-toggle-button.js.map +1 -1
  34. package/dist/commonjs/components/toggle-button/toggle-button-group.d.ts.map +1 -1
  35. package/dist/commonjs/components/toggle-button/toggle-button-group.js +3 -0
  36. package/dist/commonjs/components/toggle-button/toggle-button-group.js.map +1 -1
  37. package/dist/commonjs/components/typography/link.js +1 -1
  38. package/dist/commonjs/components/typography/link.js.map +1 -1
  39. package/dist/commonjs/icons/align-horizontal-center.d.ts +8 -0
  40. package/dist/commonjs/icons/align-horizontal-center.d.ts.map +1 -0
  41. package/dist/commonjs/icons/align-horizontal-center.js +24 -0
  42. package/dist/commonjs/icons/align-horizontal-center.js.map +1 -0
  43. package/dist/commonjs/icons/align-horizontal-left.d.ts +8 -0
  44. package/dist/commonjs/icons/align-horizontal-left.d.ts.map +1 -0
  45. package/dist/commonjs/icons/align-horizontal-left.js +24 -0
  46. package/dist/commonjs/icons/align-horizontal-left.js.map +1 -0
  47. package/dist/commonjs/icons/align-horizontal-right.d.ts +8 -0
  48. package/dist/commonjs/icons/align-horizontal-right.d.ts.map +1 -0
  49. package/dist/commonjs/icons/align-horizontal-right.js +24 -0
  50. package/dist/commonjs/icons/align-horizontal-right.js.map +1 -0
  51. package/dist/commonjs/icons/align-vertical-bottom.d.ts +8 -0
  52. package/dist/commonjs/icons/align-vertical-bottom.d.ts.map +1 -0
  53. package/dist/commonjs/icons/align-vertical-bottom.js +24 -0
  54. package/dist/commonjs/icons/align-vertical-bottom.js.map +1 -0
  55. package/dist/commonjs/icons/align-vertical-center.d.ts +8 -0
  56. package/dist/commonjs/icons/align-vertical-center.d.ts.map +1 -0
  57. package/dist/commonjs/icons/align-vertical-center.js +24 -0
  58. package/dist/commonjs/icons/align-vertical-center.js.map +1 -0
  59. package/dist/commonjs/icons/align-vertical-top.d.ts +8 -0
  60. package/dist/commonjs/icons/align-vertical-top.d.ts.map +1 -0
  61. package/dist/commonjs/icons/align-vertical-top.js +24 -0
  62. package/dist/commonjs/icons/align-vertical-top.js.map +1 -0
  63. package/dist/commonjs/icons/analytics-bars.d.ts +8 -0
  64. package/dist/commonjs/icons/analytics-bars.d.ts.map +1 -0
  65. package/dist/commonjs/icons/analytics-bars.js +24 -0
  66. package/dist/commonjs/icons/analytics-bars.js.map +1 -0
  67. package/dist/commonjs/icons/bolt.d.ts +8 -0
  68. package/dist/commonjs/icons/bolt.d.ts.map +1 -0
  69. package/dist/commonjs/icons/bolt.js +24 -0
  70. package/dist/commonjs/icons/bolt.js.map +1 -0
  71. package/dist/commonjs/icons/border-dashed.d.ts +8 -0
  72. package/dist/commonjs/icons/border-dashed.d.ts.map +1 -0
  73. package/dist/commonjs/icons/border-dashed.js +24 -0
  74. package/dist/commonjs/icons/border-dashed.js.map +1 -0
  75. package/dist/commonjs/icons/border-solid.d.ts +8 -0
  76. package/dist/commonjs/icons/border-solid.d.ts.map +1 -0
  77. package/dist/commonjs/icons/border-solid.js +24 -0
  78. package/dist/commonjs/icons/border-solid.js.map +1 -0
  79. package/dist/commonjs/icons/clock-fill.d.ts +8 -0
  80. package/dist/commonjs/icons/clock-fill.d.ts.map +1 -0
  81. package/dist/commonjs/icons/clock-fill.js +24 -0
  82. package/dist/commonjs/icons/clock-fill.js.map +1 -0
  83. package/dist/commonjs/icons/clock-history.d.ts +8 -0
  84. package/dist/commonjs/icons/clock-history.d.ts.map +1 -0
  85. package/dist/commonjs/icons/clock-history.js +24 -0
  86. package/dist/commonjs/icons/clock-history.js.map +1 -0
  87. package/dist/commonjs/icons/clock-user.d.ts.map +1 -1
  88. package/dist/commonjs/icons/clock-user.js +1 -1
  89. package/dist/commonjs/icons/clock-user.js.map +1 -1
  90. package/dist/commonjs/icons/clock.d.ts +8 -0
  91. package/dist/commonjs/icons/clock.d.ts.map +1 -0
  92. package/dist/commonjs/icons/clock.js +24 -0
  93. package/dist/commonjs/icons/clock.js.map +1 -0
  94. package/dist/commonjs/icons/crown.d.ts +8 -0
  95. package/dist/commonjs/icons/crown.d.ts.map +1 -0
  96. package/dist/commonjs/icons/crown.js +24 -0
  97. package/dist/commonjs/icons/crown.js.map +1 -0
  98. package/dist/commonjs/icons/duplicate.d.ts +8 -0
  99. package/dist/commonjs/icons/duplicate.d.ts.map +1 -0
  100. package/dist/commonjs/icons/duplicate.js +24 -0
  101. package/dist/commonjs/icons/duplicate.js.map +1 -0
  102. package/dist/commonjs/icons/error-fill.d.ts +8 -0
  103. package/dist/commonjs/icons/error-fill.d.ts.map +1 -0
  104. package/dist/commonjs/icons/error-fill.js +24 -0
  105. package/dist/commonjs/icons/error-fill.js.map +1 -0
  106. package/dist/commonjs/icons/error.d.ts +8 -0
  107. package/dist/commonjs/icons/error.d.ts.map +1 -0
  108. package/dist/commonjs/icons/error.js +24 -0
  109. package/dist/commonjs/icons/error.js.map +1 -0
  110. package/dist/commonjs/icons/experiment.d.ts +8 -0
  111. package/dist/commonjs/icons/experiment.d.ts.map +1 -0
  112. package/dist/commonjs/icons/experiment.js +24 -0
  113. package/dist/commonjs/icons/experiment.js.map +1 -0
  114. package/dist/commonjs/icons/external-slack.d.ts +8 -0
  115. package/dist/commonjs/icons/external-slack.d.ts.map +1 -0
  116. package/dist/commonjs/icons/external-slack.js +24 -0
  117. package/dist/commonjs/icons/external-slack.js.map +1 -0
  118. package/dist/commonjs/icons/filter.d.ts +8 -0
  119. package/dist/commonjs/icons/filter.d.ts.map +1 -0
  120. package/dist/commonjs/icons/filter.js +24 -0
  121. package/dist/commonjs/icons/filter.js.map +1 -0
  122. package/dist/commonjs/icons/flip-horizontal.d.ts +8 -0
  123. package/dist/commonjs/icons/flip-horizontal.d.ts.map +1 -0
  124. package/dist/commonjs/icons/flip-horizontal.js +24 -0
  125. package/dist/commonjs/icons/flip-horizontal.js.map +1 -0
  126. package/dist/commonjs/icons/flip-vertical.d.ts +8 -0
  127. package/dist/commonjs/icons/flip-vertical.d.ts.map +1 -0
  128. package/dist/commonjs/icons/flip-vertical.js +24 -0
  129. package/dist/commonjs/icons/flip-vertical.js.map +1 -0
  130. package/dist/commonjs/icons/index.d.ts +40 -0
  131. package/dist/commonjs/icons/index.d.ts.map +1 -1
  132. package/dist/commonjs/icons/index.js +84 -3
  133. package/dist/commonjs/icons/index.js.map +1 -1
  134. package/dist/commonjs/icons/layer-down.d.ts +8 -0
  135. package/dist/commonjs/icons/layer-down.d.ts.map +1 -0
  136. package/dist/commonjs/icons/layer-down.js +24 -0
  137. package/dist/commonjs/icons/layer-down.js.map +1 -0
  138. package/dist/commonjs/icons/layer-up.d.ts +8 -0
  139. package/dist/commonjs/icons/layer-up.d.ts.map +1 -0
  140. package/dist/commonjs/icons/layer-up.js +24 -0
  141. package/dist/commonjs/icons/layer-up.js.map +1 -0
  142. package/dist/commonjs/icons/play.d.ts +8 -0
  143. package/dist/commonjs/icons/play.d.ts.map +1 -0
  144. package/dist/commonjs/icons/play.js +24 -0
  145. package/dist/commonjs/icons/play.js.map +1 -0
  146. package/dist/commonjs/icons/pointer.d.ts +8 -0
  147. package/dist/commonjs/icons/pointer.d.ts.map +1 -0
  148. package/dist/commonjs/icons/pointer.js +24 -0
  149. package/dist/commonjs/icons/pointer.js.map +1 -0
  150. package/dist/commonjs/icons/push-left.d.ts +8 -0
  151. package/dist/commonjs/icons/push-left.d.ts.map +1 -0
  152. package/dist/commonjs/icons/push-left.js +24 -0
  153. package/dist/commonjs/icons/push-left.js.map +1 -0
  154. package/dist/commonjs/icons/push-right.d.ts +8 -0
  155. package/dist/commonjs/icons/push-right.d.ts.map +1 -0
  156. package/dist/commonjs/icons/push-right.js +24 -0
  157. package/dist/commonjs/icons/push-right.js.map +1 -0
  158. package/dist/commonjs/icons/qrcode.d.ts +8 -0
  159. package/dist/commonjs/icons/qrcode.d.ts.map +1 -0
  160. package/dist/commonjs/icons/qrcode.js +24 -0
  161. package/dist/commonjs/icons/qrcode.js.map +1 -0
  162. package/dist/commonjs/icons/rotation-angle.d.ts +8 -0
  163. package/dist/commonjs/icons/rotation-angle.d.ts.map +1 -0
  164. package/dist/commonjs/icons/rotation-angle.js +24 -0
  165. package/dist/commonjs/icons/rotation-angle.js.map +1 -0
  166. package/dist/commonjs/icons/shape-circle.d.ts +8 -0
  167. package/dist/commonjs/icons/shape-circle.d.ts.map +1 -0
  168. package/dist/commonjs/icons/shape-circle.js +24 -0
  169. package/dist/commonjs/icons/shape-circle.js.map +1 -0
  170. package/dist/commonjs/icons/shape-line.d.ts +8 -0
  171. package/dist/commonjs/icons/shape-line.d.ts.map +1 -0
  172. package/dist/commonjs/icons/shape-line.js +24 -0
  173. package/dist/commonjs/icons/shape-line.js.map +1 -0
  174. package/dist/commonjs/icons/shape-rectangle.d.ts +8 -0
  175. package/dist/commonjs/icons/shape-rectangle.d.ts.map +1 -0
  176. package/dist/commonjs/icons/shape-rectangle.js +24 -0
  177. package/dist/commonjs/icons/shape-rectangle.js.map +1 -0
  178. package/dist/commonjs/icons/shape-triangle.d.ts +8 -0
  179. package/dist/commonjs/icons/shape-triangle.d.ts.map +1 -0
  180. package/dist/commonjs/icons/shape-triangle.js +24 -0
  181. package/dist/commonjs/icons/shape-triangle.js.map +1 -0
  182. package/dist/commonjs/icons/shapes.d.ts +8 -0
  183. package/dist/commonjs/icons/shapes.d.ts.map +1 -0
  184. package/dist/commonjs/icons/shapes.js +24 -0
  185. package/dist/commonjs/icons/shapes.js.map +1 -0
  186. package/dist/commonjs/icons/target.d.ts +8 -0
  187. package/dist/commonjs/icons/target.d.ts.map +1 -0
  188. package/dist/commonjs/icons/target.js +24 -0
  189. package/dist/commonjs/icons/target.js.map +1 -0
  190. package/dist/commonjs/icons/text.d.ts +8 -0
  191. package/dist/commonjs/icons/text.d.ts.map +1 -0
  192. package/dist/commonjs/icons/text.js +24 -0
  193. package/dist/commonjs/icons/text.js.map +1 -0
  194. package/dist/commonjs/icons/upload.d.ts +8 -0
  195. package/dist/commonjs/icons/upload.d.ts.map +1 -0
  196. package/dist/commonjs/icons/upload.js +24 -0
  197. package/dist/commonjs/icons/upload.js.map +1 -0
  198. package/dist/commonjs/icons/user.d.ts +8 -0
  199. package/dist/commonjs/icons/user.d.ts.map +1 -0
  200. package/dist/commonjs/icons/user.js +24 -0
  201. package/dist/commonjs/icons/user.js.map +1 -0
  202. package/dist/commonjs/icons/users.d.ts +8 -0
  203. package/dist/commonjs/icons/users.d.ts.map +1 -0
  204. package/dist/commonjs/icons/users.js +24 -0
  205. package/dist/commonjs/icons/users.js.map +1 -0
  206. package/dist/esm/components/app-header/app-header.d.ts +2 -0
  207. package/dist/esm/components/app-header/app-header.d.ts.map +1 -1
  208. package/dist/esm/components/app-header/app-header.js +7 -2
  209. package/dist/esm/components/app-header/app-header.js.map +1 -1
  210. package/dist/esm/components/app-header/cimpress-logo.js +1 -1
  211. package/dist/esm/components/app-header/cimpress-logo.js.map +1 -1
  212. package/dist/esm/components/copy/copy-button.d.ts +7 -0
  213. package/dist/esm/components/copy/copy-button.d.ts.map +1 -1
  214. package/dist/esm/components/copy/copy-button.js +42 -7
  215. package/dist/esm/components/copy/copy-button.js.map +1 -1
  216. package/dist/esm/components/copy/use-copy.d.ts.map +1 -1
  217. package/dist/esm/components/copy/use-copy.js +11 -11
  218. package/dist/esm/components/copy/use-copy.js.map +1 -1
  219. package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.js +4 -7
  220. package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.js.map +1 -1
  221. package/dist/esm/components/select/select.d.ts +7 -1
  222. package/dist/esm/components/select/select.d.ts.map +1 -1
  223. package/dist/esm/components/select/select.js +2 -2
  224. package/dist/esm/components/select/select.js.map +1 -1
  225. package/dist/esm/components/table/contexts/column-collection.d.ts.map +1 -1
  226. package/dist/esm/components/table/contexts/column-collection.js +0 -1
  227. package/dist/esm/components/table/contexts/column-collection.js.map +1 -1
  228. package/dist/esm/components/table/contexts/row-state.js +2 -2
  229. package/dist/esm/components/table/contexts/row-state.js.map +1 -1
  230. package/dist/esm/components/table/contexts/table-state.js +2 -2
  231. package/dist/esm/components/table/contexts/table-state.js.map +1 -1
  232. package/dist/esm/components/table/hooks/use-table-cell.js +2 -2
  233. package/dist/esm/components/table/hooks/use-table-cell.js.map +1 -1
  234. package/dist/esm/components/tag-field/tag-field-list-box.js +5 -2
  235. package/dist/esm/components/tag-field/tag-field-list-box.js.map +1 -1
  236. package/dist/esm/components/tag-field/tag-field-tags.js +2 -0
  237. package/dist/esm/components/tag-field/tag-field-tags.js.map +1 -1
  238. package/dist/esm/components/tag-field/tag-field.js +1 -1
  239. package/dist/esm/components/tag-field/tag-field.js.map +1 -1
  240. package/dist/esm/components/toggle-button/internal-toggle-button.js +7 -7
  241. package/dist/esm/components/toggle-button/internal-toggle-button.js.map +1 -1
  242. package/dist/esm/components/toggle-button/toggle-button-group.d.ts.map +1 -1
  243. package/dist/esm/components/toggle-button/toggle-button-group.js +3 -0
  244. package/dist/esm/components/toggle-button/toggle-button-group.js.map +1 -1
  245. package/dist/esm/components/typography/link.js +1 -1
  246. package/dist/esm/components/typography/link.js.map +1 -1
  247. package/dist/esm/icons/align-horizontal-center.d.ts +8 -0
  248. package/dist/esm/icons/align-horizontal-center.d.ts.map +1 -0
  249. package/dist/esm/icons/align-horizontal-center.js +19 -0
  250. package/dist/esm/icons/align-horizontal-center.js.map +1 -0
  251. package/dist/esm/icons/align-horizontal-left.d.ts +8 -0
  252. package/dist/esm/icons/align-horizontal-left.d.ts.map +1 -0
  253. package/dist/esm/icons/align-horizontal-left.js +19 -0
  254. package/dist/esm/icons/align-horizontal-left.js.map +1 -0
  255. package/dist/esm/icons/align-horizontal-right.d.ts +8 -0
  256. package/dist/esm/icons/align-horizontal-right.d.ts.map +1 -0
  257. package/dist/esm/icons/align-horizontal-right.js +19 -0
  258. package/dist/esm/icons/align-horizontal-right.js.map +1 -0
  259. package/dist/esm/icons/align-vertical-bottom.d.ts +8 -0
  260. package/dist/esm/icons/align-vertical-bottom.d.ts.map +1 -0
  261. package/dist/esm/icons/align-vertical-bottom.js +19 -0
  262. package/dist/esm/icons/align-vertical-bottom.js.map +1 -0
  263. package/dist/esm/icons/align-vertical-center.d.ts +8 -0
  264. package/dist/esm/icons/align-vertical-center.d.ts.map +1 -0
  265. package/dist/esm/icons/align-vertical-center.js +19 -0
  266. package/dist/esm/icons/align-vertical-center.js.map +1 -0
  267. package/dist/esm/icons/align-vertical-top.d.ts +8 -0
  268. package/dist/esm/icons/align-vertical-top.d.ts.map +1 -0
  269. package/dist/esm/icons/align-vertical-top.js +19 -0
  270. package/dist/esm/icons/align-vertical-top.js.map +1 -0
  271. package/dist/esm/icons/analytics-bars.d.ts +8 -0
  272. package/dist/esm/icons/analytics-bars.d.ts.map +1 -0
  273. package/dist/esm/icons/analytics-bars.js +19 -0
  274. package/dist/esm/icons/analytics-bars.js.map +1 -0
  275. package/dist/esm/icons/bolt.d.ts +8 -0
  276. package/dist/esm/icons/bolt.d.ts.map +1 -0
  277. package/dist/esm/icons/bolt.js +19 -0
  278. package/dist/esm/icons/bolt.js.map +1 -0
  279. package/dist/esm/icons/border-dashed.d.ts +8 -0
  280. package/dist/esm/icons/border-dashed.d.ts.map +1 -0
  281. package/dist/esm/icons/border-dashed.js +19 -0
  282. package/dist/esm/icons/border-dashed.js.map +1 -0
  283. package/dist/esm/icons/border-solid.d.ts +8 -0
  284. package/dist/esm/icons/border-solid.d.ts.map +1 -0
  285. package/dist/esm/icons/border-solid.js +19 -0
  286. package/dist/esm/icons/border-solid.js.map +1 -0
  287. package/dist/esm/icons/clock-fill.d.ts +8 -0
  288. package/dist/esm/icons/clock-fill.d.ts.map +1 -0
  289. package/dist/esm/icons/clock-fill.js +19 -0
  290. package/dist/esm/icons/clock-fill.js.map +1 -0
  291. package/dist/esm/icons/clock-history.d.ts +8 -0
  292. package/dist/esm/icons/clock-history.d.ts.map +1 -0
  293. package/dist/esm/icons/clock-history.js +19 -0
  294. package/dist/esm/icons/clock-history.js.map +1 -0
  295. package/dist/esm/icons/clock-user.d.ts.map +1 -1
  296. package/dist/esm/icons/clock-user.js +1 -1
  297. package/dist/esm/icons/clock-user.js.map +1 -1
  298. package/dist/esm/icons/clock.d.ts +8 -0
  299. package/dist/esm/icons/clock.d.ts.map +1 -0
  300. package/dist/esm/icons/clock.js +19 -0
  301. package/dist/esm/icons/clock.js.map +1 -0
  302. package/dist/esm/icons/crown.d.ts +8 -0
  303. package/dist/esm/icons/crown.d.ts.map +1 -0
  304. package/dist/esm/icons/crown.js +19 -0
  305. package/dist/esm/icons/crown.js.map +1 -0
  306. package/dist/esm/icons/duplicate.d.ts +8 -0
  307. package/dist/esm/icons/duplicate.d.ts.map +1 -0
  308. package/dist/esm/icons/duplicate.js +19 -0
  309. package/dist/esm/icons/duplicate.js.map +1 -0
  310. package/dist/esm/icons/error-fill.d.ts +8 -0
  311. package/dist/esm/icons/error-fill.d.ts.map +1 -0
  312. package/dist/esm/icons/error-fill.js +19 -0
  313. package/dist/esm/icons/error-fill.js.map +1 -0
  314. package/dist/esm/icons/error.d.ts +8 -0
  315. package/dist/esm/icons/error.d.ts.map +1 -0
  316. package/dist/esm/icons/error.js +19 -0
  317. package/dist/esm/icons/error.js.map +1 -0
  318. package/dist/esm/icons/experiment.d.ts +8 -0
  319. package/dist/esm/icons/experiment.d.ts.map +1 -0
  320. package/dist/esm/icons/experiment.js +19 -0
  321. package/dist/esm/icons/experiment.js.map +1 -0
  322. package/dist/esm/icons/external-slack.d.ts +8 -0
  323. package/dist/esm/icons/external-slack.d.ts.map +1 -0
  324. package/dist/esm/icons/external-slack.js +19 -0
  325. package/dist/esm/icons/external-slack.js.map +1 -0
  326. package/dist/esm/icons/filter.d.ts +8 -0
  327. package/dist/esm/icons/filter.d.ts.map +1 -0
  328. package/dist/esm/icons/filter.js +19 -0
  329. package/dist/esm/icons/filter.js.map +1 -0
  330. package/dist/esm/icons/flip-horizontal.d.ts +8 -0
  331. package/dist/esm/icons/flip-horizontal.d.ts.map +1 -0
  332. package/dist/esm/icons/flip-horizontal.js +19 -0
  333. package/dist/esm/icons/flip-horizontal.js.map +1 -0
  334. package/dist/esm/icons/flip-vertical.d.ts +8 -0
  335. package/dist/esm/icons/flip-vertical.d.ts.map +1 -0
  336. package/dist/esm/icons/flip-vertical.js +19 -0
  337. package/dist/esm/icons/flip-vertical.js.map +1 -0
  338. package/dist/esm/icons/index.d.ts +40 -0
  339. package/dist/esm/icons/index.d.ts.map +1 -1
  340. package/dist/esm/icons/index.js +40 -0
  341. package/dist/esm/icons/index.js.map +1 -1
  342. package/dist/esm/icons/layer-down.d.ts +8 -0
  343. package/dist/esm/icons/layer-down.d.ts.map +1 -0
  344. package/dist/esm/icons/layer-down.js +19 -0
  345. package/dist/esm/icons/layer-down.js.map +1 -0
  346. package/dist/esm/icons/layer-up.d.ts +8 -0
  347. package/dist/esm/icons/layer-up.d.ts.map +1 -0
  348. package/dist/esm/icons/layer-up.js +19 -0
  349. package/dist/esm/icons/layer-up.js.map +1 -0
  350. package/dist/esm/icons/play.d.ts +8 -0
  351. package/dist/esm/icons/play.d.ts.map +1 -0
  352. package/dist/esm/icons/play.js +19 -0
  353. package/dist/esm/icons/play.js.map +1 -0
  354. package/dist/esm/icons/pointer.d.ts +8 -0
  355. package/dist/esm/icons/pointer.d.ts.map +1 -0
  356. package/dist/esm/icons/pointer.js +19 -0
  357. package/dist/esm/icons/pointer.js.map +1 -0
  358. package/dist/esm/icons/push-left.d.ts +8 -0
  359. package/dist/esm/icons/push-left.d.ts.map +1 -0
  360. package/dist/esm/icons/push-left.js +19 -0
  361. package/dist/esm/icons/push-left.js.map +1 -0
  362. package/dist/esm/icons/push-right.d.ts +8 -0
  363. package/dist/esm/icons/push-right.d.ts.map +1 -0
  364. package/dist/esm/icons/push-right.js +19 -0
  365. package/dist/esm/icons/push-right.js.map +1 -0
  366. package/dist/esm/icons/qrcode.d.ts +8 -0
  367. package/dist/esm/icons/qrcode.d.ts.map +1 -0
  368. package/dist/esm/icons/qrcode.js +19 -0
  369. package/dist/esm/icons/qrcode.js.map +1 -0
  370. package/dist/esm/icons/rotation-angle.d.ts +8 -0
  371. package/dist/esm/icons/rotation-angle.d.ts.map +1 -0
  372. package/dist/esm/icons/rotation-angle.js +19 -0
  373. package/dist/esm/icons/rotation-angle.js.map +1 -0
  374. package/dist/esm/icons/shape-circle.d.ts +8 -0
  375. package/dist/esm/icons/shape-circle.d.ts.map +1 -0
  376. package/dist/esm/icons/shape-circle.js +19 -0
  377. package/dist/esm/icons/shape-circle.js.map +1 -0
  378. package/dist/esm/icons/shape-line.d.ts +8 -0
  379. package/dist/esm/icons/shape-line.d.ts.map +1 -0
  380. package/dist/esm/icons/shape-line.js +19 -0
  381. package/dist/esm/icons/shape-line.js.map +1 -0
  382. package/dist/esm/icons/shape-rectangle.d.ts +8 -0
  383. package/dist/esm/icons/shape-rectangle.d.ts.map +1 -0
  384. package/dist/esm/icons/shape-rectangle.js +19 -0
  385. package/dist/esm/icons/shape-rectangle.js.map +1 -0
  386. package/dist/esm/icons/shape-triangle.d.ts +8 -0
  387. package/dist/esm/icons/shape-triangle.d.ts.map +1 -0
  388. package/dist/esm/icons/shape-triangle.js +19 -0
  389. package/dist/esm/icons/shape-triangle.js.map +1 -0
  390. package/dist/esm/icons/shapes.d.ts +8 -0
  391. package/dist/esm/icons/shapes.d.ts.map +1 -0
  392. package/dist/esm/icons/shapes.js +19 -0
  393. package/dist/esm/icons/shapes.js.map +1 -0
  394. package/dist/esm/icons/target.d.ts +8 -0
  395. package/dist/esm/icons/target.d.ts.map +1 -0
  396. package/dist/esm/icons/target.js +19 -0
  397. package/dist/esm/icons/target.js.map +1 -0
  398. package/dist/esm/icons/text.d.ts +8 -0
  399. package/dist/esm/icons/text.d.ts.map +1 -0
  400. package/dist/esm/icons/text.js +19 -0
  401. package/dist/esm/icons/text.js.map +1 -0
  402. package/dist/esm/icons/upload.d.ts +8 -0
  403. package/dist/esm/icons/upload.d.ts.map +1 -0
  404. package/dist/esm/icons/upload.js +19 -0
  405. package/dist/esm/icons/upload.js.map +1 -0
  406. package/dist/esm/icons/user.d.ts +8 -0
  407. package/dist/esm/icons/user.d.ts.map +1 -0
  408. package/dist/esm/icons/user.js +19 -0
  409. package/dist/esm/icons/user.js.map +1 -0
  410. package/dist/esm/icons/users.d.ts +8 -0
  411. package/dist/esm/icons/users.d.ts.map +1 -0
  412. package/dist/esm/icons/users.js +19 -0
  413. package/dist/esm/icons/users.js.map +1 -0
  414. package/dist-styles/core.css +1 -1
  415. package/dist-styles/normalize.css +1 -1
  416. package/dist-styles/styles.css +1 -1
  417. package/package.json +16 -16
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA0C,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,UAAU,IAAI,aAAa,EAC3B,MAAM,IAAI,SAAS,EACnB,OAAO,IAAI,UAAU,EACrB,mBAAmB,IAAI,sBAAsB,EAC7C,WAAW,IAAI,cAAc,EAC7B,cAAc,IAAI,iBAAiB,EACnC,UAAU,IAAI,aAAa,EAE3B,MAAM,IAAI,SAAS,EACnB,WAAW,IAAI,cAAc,EAC7B,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,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,YAAY,EA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AM,EAAE,CAAC,YACjG,QAAQ,GACD,IACT,CACJ,GACc,CAClB,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAStC,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAA2B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAyB;IACjH,IAAI,CAAC,YAAY,EAAE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,CACL,MAAC,iBAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,oBAAoB,aAC1D,KAAC,SAAS,IACR,SAAS,EAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAErG,KAAK,GACI,EACZ,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type ForwardedRef, type UIEventHandler, useImperativeHandle, useRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\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 Select as RACSelect,\n SelectValue as RACSelectValue,\n Text as RACText,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { stringLikeChildrenToString } from '../../utils/string-like-children-to-string.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 { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldProps,\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 loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\nexport interface SelectProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldProps<Key>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<SelectApi>,\n Pick<\n RACSelectProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'autoComplete'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'placeholder'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /**\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 `Select` component. */\nexport interface SelectApi {\n /** Focuses the trigger button and opens the list of items. */\n focus: () => void;\n}\n\nfunction Select<T extends CollectionItem>(\n {\n children,\n items,\n label,\n description,\n error,\n UNSAFE_className,\n UNSAFE_style,\n onScroll,\n isVirtualized = false,\n apiRef,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n ...props\n }: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`Select` requires `children` to be a function when using `items` prop');\n }\n\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => triggerRef.current?.focus(),\n }),\n [],\n );\n\n const listBox = (\n <RACListBox\n className=\"cim-select-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 return (\n <RACSelect {...props} ref={ref} className={clsx('cim-select', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACButton ref={triggerRef} className=\"cim-select-button\">\n <RACSelectValue\n className={(values) => clsx(values.defaultClassName, textStyle({ variant: 'body', alignment: 'start' }))}\n >\n {({ selectedText }) => selectedText}\n </RACSelectValue>\n <IconChevronDown />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACSelect>\n );\n}\n\n/**\n * Allows users to select one item from a collapsible list.\n *\n * See [select usage guidelines](https://ui.cimpress.io/components/select/).\n */\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nexport interface SelectItemProps extends Pick<RACListBoxItemProps, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `Select`. */\nexport function SelectItem({ children, ...props }: SelectItemProps) {\n const textValue = stringLikeChildrenToString(children);\n\n return (\n <RACListBoxItem {...props} className=\"cim-select-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\nSelectItem.displayName = 'SelectItem';\n\nexport interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Select` into a section. */\nexport function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`SelectSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-select-section\">\n <RACHeader\n className={clsx('cim-select-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nSelectSection.displayName = 'SelectSection';\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA0C,mB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AO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAErG,KAAK,GACI,EACZ,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type ForwardedRef, type UIEventHandler, useImperativeHandle, useRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\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 Select as RACSelect,\n SelectValue as RACSelectValue,\n Text as RACText,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { stringLikeChildrenToString } from '../../utils/string-like-children-to-string.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 { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldProps,\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 loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\nexport interface SelectProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldProps<Key>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<SelectApi>,\n Pick<\n RACSelectProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'autoComplete'\n | 'autoFocus'\n | 'placeholder'\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}\n\n/** The imperative API exposed by the `Select` component. */\nexport interface SelectApi {\n /** Focuses the trigger button and opens the list of items. */\n focus: () => void;\n}\n\nfunction Select<T extends CollectionItem>(\n {\n children,\n items,\n label,\n description,\n error,\n UNSAFE_className,\n UNSAFE_style,\n onScroll,\n isVirtualized = false,\n apiRef,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n ...props\n }: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`Select` requires `children` to be a function when using `items` prop');\n }\n\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => triggerRef.current?.focus(),\n }),\n [],\n );\n\n const listBox = (\n <RACListBox\n className=\"cim-select-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 return (\n <RACSelect\n {...props}\n ref={ref}\n className={clsx('cim-select', UNSAFE_className)}\n style={UNSAFE_style}\n value={selectedKey}\n defaultValue={defaultSelectedKey}\n onChange={onSelectionChange}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACButton ref={triggerRef} className=\"cim-select-button\">\n <RACSelectValue\n className={(values) => clsx(values.defaultClassName, textStyle({ variant: 'body', alignment: 'start' }))}\n >\n {({ selectedText }) => selectedText}\n </RACSelectValue>\n <IconChevronDown />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACSelect>\n );\n}\n\n/**\n * Allows users to select one item from a collapsible list.\n *\n * See [select usage guidelines](https://ui.cimpress.io/components/select/).\n */\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nexport interface SelectItemProps extends Pick<RACListBoxItemProps, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `Select`. */\nexport function SelectItem({ children, ...props }: SelectItemProps) {\n const textValue = stringLikeChildrenToString(children);\n\n return (\n <RACListBoxItem {...props} className=\"cim-select-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\nSelectItem.displayName = 'SelectItem';\n\nexport interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Select` into a section. */\nexport function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`SelectSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-select-section\">\n <RACHeader\n className={clsx('cim-select-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nSelectSection.displayName = 'SelectSection';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"column-collection.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/contexts/column-collection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAyC,MAAM,OAAO,CAAC;AAQ7G,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAED,2EAA2E;AAC3E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAMhE,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAsB7E;AAED,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,MAAM,IAAI,CAAC;AAGvE,wBAAgB,qBAAqB,IAAI,iBAAiB,CAuBzD;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAO3E;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAchG"}
1
+ {"version":3,"file":"column-collection.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/contexts/column-collection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAyC,MAAM,OAAO,CAAC;AAQ7G,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAED,2EAA2E;AAC3E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAMhE,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAsB7E;AAED,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,MAAM,IAAI,CAAC;AAGvE,wBAAgB,qBAAqB,IAAI,iBAAiB,CAsBzD;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAO3E;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAchG"}
@@ -37,7 +37,6 @@ export function useColumnRegistration() {
37
37
  const { columns } = columnCollection;
38
38
  if (columns[key] === data) {
39
39
  // This is a temporary deletion before a context update, so this is fine
40
- // eslint-disable-next-line react-hooks/react-compiler
41
40
  delete columns[key];
42
41
  columnCollection.setColumns({ ...columns });
43
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"column-collection.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/column-collection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAkC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAgBjF,MAAM,uBAAuB,GAAG,aAAa,CAA0B,IAAI,CAAC,CAAC;AAE7E,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,UAAU,wBAAwB,CAAC,EAAE,QAAQ,EAA2B;IAC5E,qEAAqE;IACrE,0EAA0E;IAC1E,oDAAoD;IACpD,MAAM,UAAU,GAAG,MAAM,CAA6B,YAAY,CAAC,CAAC;IACpE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA6B,YAAY,CAAC,CAAC;IAEnF,MAAM,UAAU,GAAqB,OAAO,CAC1C,GAAG,EAAE,CAAC,CAAC;QACL,IAAI,OAAO;YACT,OAAO,UAAU,CAAC,OAAO,CAAC;QAC5B,CAAC;QACD,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE;YACtB,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;YAC7B,WAAW,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;IACF,uDAAuD;IACvD,CAAC,QAAQ,CAAC,CACX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IAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,gGAAgG;IAChG,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,kBAAkB,EAAE,aAAa,CAAC,2CAA2C,CAAC,CAAC;IAEnG,OAAO;QACL,SAAS,EAAG,WAAgD,EAAE,OAAO,CAAC,aAAa,IAAI,KAAK;QAC5F,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM;KACtD,CAAC;AACJ,CAAC","sourcesContent":["import { createContext, type ReactNode, type RefObject, useContext, useMemo, useRef, useState } from 'react';\nimport { useServerEffectEvent } from '../../../utils/use-server-effect-event.js';\n\ninterface ColumnCollection {\n columns: Record<string, ColumnData>;\n setColumns: (columns: Record<string, ColumnData>) => void;\n}\n\ninterface ColumnData {\n number?: number;\n width?: string | number;\n contentAlignment: ColumnContentAlignment;\n}\n\n/** Represents the direction of content alignment within a table column. */\nexport type ColumnContentAlignment = 'start' | 'center' | 'end';\n\nconst ColumnCollectionContext = createContext<ColumnCollection | null>(null);\n\nconst EMPTY_OBJECT = {};\n\nexport function ColumnCollectionProvider({ children }: { children: ReactNode }) {\n // When column collection is updated, we want to trigger a re-render,\n // but we also want immediate access to the updated collection during SSR.\n // Hence why it is stored as both a ref and a state.\n const columnsRef = useRef<Record<string, ColumnData>>(EMPTY_OBJECT);\n const [_columns, _setColumns] = useState<Record<string, ColumnData>>(EMPTY_OBJECT);\n\n const collection: ColumnCollection = useMemo(\n () => ({\n get columns() {\n return columnsRef.current;\n },\n setColumns: (columns) => {\n columnsRef.current = columns;\n _setColumns(columns);\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_columns],\n );\n\n return <ColumnCollectionContext.Provider value={collection}>{children}</ColumnCollectionContext.Provider>;\n}\n\ntype ColumnRegistrator = (key: string, data: ColumnData) => () => void;\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useColumnRegistration(): ColumnRegistrator {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use column registration outside of a table');\n }\n\n return useServerEffectEvent((key, data) => {\n columnCollection.setColumns({\n ...columnCollection.columns,\n [key]: data,\n });\n\n return () => {\n const { columns } = columnCollection;\n\n if (columns[key] === data) {\n // This is a temporary deletion before a context update, so this is fine\n // eslint-disable-next-line react-hooks/react-compiler\n delete columns[key];\n columnCollection.setColumns({ ...columns });\n }\n };\n });\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useColumnData(key: string): Readonly<ColumnData> | undefined {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use column data outside of a table');\n }\n\n return columnCollection.columns[key];\n}\n\nexport interface UseEmptyStateCell {\n columnKey: string;\n colSpan: number;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useEmptyStateCell(ref: RefObject<HTMLTableCellElement | null>): UseEmptyStateCell {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use empty state cell outside of a table');\n }\n\n // Empty state cell should have the same column key as the first column in the table, so find it\n const parentTableElement = ref.current?.closest('table');\n const firstColumn = parentTableElement?.querySelector('[data-cell-row-key][data-cell-column-key]');\n\n return {\n columnKey: (firstColumn as HTMLTableCellElement | undefined)?.dataset.cellColumnKey ?? '???',\n colSpan: Object.keys(columnCollection.columns).length,\n };\n}\n"]}
1
+ {"version":3,"file":"column-collection.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/column-collection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAkC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;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,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;gBAC1B,wEAAwE;gBACxE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpB,gBAAgB,CAAC,UAAU,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,gBAAgB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAOD,gEAAgE;AAChE,MAAM,UAAU,iBAAiB,CAAC,GAA2C;IAC3E,MAAM,gBAAgB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,gGAAgG;IAChG,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,kBAAkB,EAAE,aAAa,CAAC,2CAA2C,CAAC,CAAC;IAEnG,OAAO;QACL,SAAS,EAAG,WAAgD,EAAE,OAAO,CAAC,aAAa,IAAI,KAAK;QAC5F,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM;KACtD,CAAC;AACJ,CAAC","sourcesContent":["import { createContext, type ReactNode, type RefObject, useContext, useMemo, useRef, useState } from 'react';\nimport { useServerEffectEvent } from '../../../utils/use-server-effect-event.js';\n\ninterface ColumnCollection {\n columns: Record<string, ColumnData>;\n setColumns: (columns: Record<string, ColumnData>) => void;\n}\n\ninterface ColumnData {\n number?: number;\n width?: string | number;\n contentAlignment: ColumnContentAlignment;\n}\n\n/** Represents the direction of content alignment within a table column. */\nexport type ColumnContentAlignment = 'start' | 'center' | 'end';\n\nconst ColumnCollectionContext = createContext<ColumnCollection | null>(null);\n\nconst EMPTY_OBJECT = {};\n\nexport function ColumnCollectionProvider({ children }: { children: ReactNode }) {\n // When column collection is updated, we want to trigger a re-render,\n // but we also want immediate access to the updated collection during SSR.\n // Hence why it is stored as both a ref and a state.\n const columnsRef = useRef<Record<string, ColumnData>>(EMPTY_OBJECT);\n const [_columns, _setColumns] = useState<Record<string, ColumnData>>(EMPTY_OBJECT);\n\n const collection: ColumnCollection = useMemo(\n () => ({\n get columns() {\n return columnsRef.current;\n },\n setColumns: (columns) => {\n columnsRef.current = columns;\n _setColumns(columns);\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_columns],\n );\n\n return <ColumnCollectionContext.Provider value={collection}>{children}</ColumnCollectionContext.Provider>;\n}\n\ntype ColumnRegistrator = (key: string, data: ColumnData) => () => void;\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useColumnRegistration(): ColumnRegistrator {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use column registration outside of a table');\n }\n\n return useServerEffectEvent((key, data) => {\n columnCollection.setColumns({\n ...columnCollection.columns,\n [key]: data,\n });\n\n return () => {\n const { columns } = columnCollection;\n\n if (columns[key] === data) {\n // This is a temporary deletion before a context update, so this is fine\n delete columns[key];\n columnCollection.setColumns({ ...columns });\n }\n };\n });\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useColumnData(key: string): Readonly<ColumnData> | undefined {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use column data outside of a table');\n }\n\n return columnCollection.columns[key];\n}\n\nexport interface UseEmptyStateCell {\n columnKey: string;\n colSpan: number;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useEmptyStateCell(ref: RefObject<HTMLTableCellElement | null>): UseEmptyStateCell {\n const columnCollection = useContext(ColumnCollectionContext);\n if (!columnCollection) {\n throw new Error('Cannot use empty state cell outside of a table');\n }\n\n // Empty state cell should have the same column key as the first column in the table, so find it\n const parentTableElement = ref.current?.closest('table');\n const firstColumn = parentTableElement?.querySelector('[data-cell-row-key][data-cell-column-key]');\n\n return {\n columnKey: (firstColumn as HTMLTableCellElement | undefined)?.dataset.cellColumnKey ?? '???',\n colSpan: Object.keys(columnCollection.columns).length,\n };\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffectEvent } from '@react-aria/utils';
2
+ import { useEffectEvent as useRACEffectEvent } from '@react-aria/utils';
3
3
  import { createContext, useContext, useMemo } from 'react';
4
4
  const TableRowStateContext = createContext(null);
5
5
  export function TableRowStateProvider({ children, rowKey, isSelected, onSelectionToggle, }) {
6
- const onSelectionToggleMemoized = useEffectEvent(onSelectionToggle);
6
+ const onSelectionToggleMemoized = useRACEffectEvent(onSelectionToggle);
7
7
  const tableRowState = useMemo(() => ({
8
8
  rowKey,
9
9
  isSelected,
@@ -1 +1 @@
1
- {"version":3,"file":"row-state.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/row-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQ3E,MAAM,oBAAoB,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEvE,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,MAAM,EACN,UAAU,EACV,iBAAiB,GAMlB;IACC,MAAM,yBAAyB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAEpE,MAAM,aAAa,GAAkB,OAAO,CAC1C,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,UAAU;QACV,iBAAiB,EAAE,yBAAyB;KAC7C,CAAC,EACF,CAAC,MAAM,EAAE,UAAU,EAAE,yBAAyB,CAAC,CAChD,CAAC;IAEF,OAAO,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAAG,QAAQ,GAAiC,CAAC;AACzG,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,aAAa,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { useEffectEvent } from '@react-aria/utils';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\n\nexport interface TableRowState {\n rowKey: string;\n isSelected?: boolean;\n onSelectionToggle?: (value?: boolean) => void;\n}\n\nconst TableRowStateContext = createContext<TableRowState | null>(null);\n\nexport function TableRowStateProvider({\n children,\n rowKey,\n isSelected,\n onSelectionToggle,\n}: {\n children: ReactNode;\n rowKey: string;\n isSelected?: boolean;\n onSelectionToggle?: (value?: boolean) => void;\n}) {\n const onSelectionToggleMemoized = useEffectEvent(onSelectionToggle);\n\n const tableRowState: TableRowState = useMemo(\n () => ({\n rowKey,\n isSelected,\n onSelectionToggle: onSelectionToggleMemoized,\n }),\n [rowKey, isSelected, onSelectionToggleMemoized],\n );\n\n return <TableRowStateContext.Provider value={tableRowState}>{children}</TableRowStateContext.Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTableRowState(): TableRowState {\n const tableRowState = useContext(TableRowStateContext);\n if (!tableRowState) {\n throw new Error('Cannot use table row state outside of a table row');\n }\n\n return tableRowState;\n}\n"]}
1
+ {"version":3,"file":"row-state.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/row-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQ3E,MAAM,oBAAoB,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEvE,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,MAAM,EACN,UAAU,EACV,iBAAiB,GAMlB;IACC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAEvE,MAAM,aAAa,GAAkB,OAAO,CAC1C,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,UAAU;QACV,iBAAiB,EAAE,yBAAyB;KAC7C,CAAC,EACF,CAAC,MAAM,EAAE,UAAU,EAAE,yBAAyB,CAAC,CAChD,CAAC;IAEF,OAAO,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAAG,QAAQ,GAAiC,CAAC;AACzG,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,aAAa,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { useEffectEvent as useRACEffectEvent } from '@react-aria/utils';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\n\nexport interface TableRowState {\n rowKey: string;\n isSelected?: boolean;\n onSelectionToggle?: (value?: boolean) => void;\n}\n\nconst TableRowStateContext = createContext<TableRowState | null>(null);\n\nexport function TableRowStateProvider({\n children,\n rowKey,\n isSelected,\n onSelectionToggle,\n}: {\n children: ReactNode;\n rowKey: string;\n isSelected?: boolean;\n onSelectionToggle?: (value?: boolean) => void;\n}) {\n const onSelectionToggleMemoized = useRACEffectEvent(onSelectionToggle);\n\n const tableRowState: TableRowState = useMemo(\n () => ({\n rowKey,\n isSelected,\n onSelectionToggle: onSelectionToggleMemoized,\n }),\n [rowKey, isSelected, onSelectionToggleMemoized],\n );\n\n return <TableRowStateContext.Provider value={tableRowState}>{children}</TableRowStateContext.Provider>;\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTableRowState(): TableRowState {\n const tableRowState = useContext(TableRowStateContext);\n if (!tableRowState) {\n throw new Error('Cannot use table row state outside of a table row');\n }\n\n return tableRowState;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffectEvent, useId } from '@react-aria/utils';
2
+ import { useEffectEvent as useRACEffectEvent, useId } from '@react-aria/utils';
3
3
  import { createContext, useContext, useMemo, useRef, useState } from 'react';
4
4
  import { useLocalizedMessages } from '../../../i18n/localization-provider.js';
5
5
  const TableStateContext = createContext(null);
@@ -11,7 +11,7 @@ export function TableStateProvider({ children, rowSelectionMode, areAllRowsSelec
11
11
  const [_pendingRowSelectionState, _setPendingRowSelectionState] = useState(undefined);
12
12
  const sortLabelId = useId();
13
13
  const messages = useLocalizedMessages('table');
14
- const onAllRowsSelectionToggleMemoized = useEffectEvent(onAllRowsSelectionToggle);
14
+ const onAllRowsSelectionToggleMemoized = useRACEffectEvent(onAllRowsSelectionToggle);
15
15
  const tableState = useMemo(() => ({
16
16
  sortLabelId,
17
17
  rowSelectionMode,
@@ -1 +1 @@
1
- {"version":3,"file":"table-state.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/table-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAgB9E,MAAM,iBAAiB,G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ChE,MAAM,UAAU,aAAa;IAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { useEffectEvent, useId } from '@react-aria/utils';\nimport { createContext, type ReactNode, useContext, useMemo, useRef, useState } from 'react';\nimport { useLocalizedMessages } from '../../../i18n/localization-provider.js';\n\n/** Represents the type of row selection allowed within a table. */\nexport type RowSelectionMode = 'single' | 'multiple' | 'none';\n\nexport interface TableState {\n sortLabelId: string;\n rowSelectionMode: RowSelectionMode;\n areAllRowsSelected?: boolean;\n areSomeRowsSelected?: boolean;\n onAllRowsSelectionToggle?: (value?: boolean) => void;\n /** The selection state that will be applied to the next focused row. */\n pendingRowSelectionState?: boolean;\n setPendingRowSelectionState: (value: boolean | undefined) => void;\n}\n\nconst TableStateContext = createContext<TableState | null>(null);\n\nexport function TableStateProvider({\n children,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggle,\n}: {\n children: ReactNode;\n rowSelectionMode: RowSelectionMode;\n areAllRowsSelected?: boolean;\n areSomeRowsSelected?: boolean;\n onAllRowsSelectionToggle?: (value?: boolean) => void;\n}) {\n // When the pending selection state is updated, we want to trigger a re-render,\n // but we also want immediate access to the new value.\n // Hence why it is stored as both a ref and a state.\n const pendingRowSelectionStateRef = useRef<boolean | undefined>(undefined);\n const [_pendingRowSelectionState, _setPendingRowSelectionState] = useState<boolean | undefined>(undefined);\n\n const sortLabelId = useId();\n const messages = useLocalizedMessages('table');\n\n const onAllRowsSelectionToggleMemoized = useEffectEvent(onAllRowsSelectionToggle);\n\n const tableState: TableState = useMemo(\n () => ({\n sortLabelId,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggle: onAllRowsSelectionToggleMemoized,\n get pendingRowSelectionState() {\n return pendingRowSelectionStateRef.current;\n },\n setPendingRowSelectionState(pendingRowSelectionState: boolean | undefined) {\n pendingRowSelectionStateRef.current = pendingRowSelectionState;\n _setPendingRowSelectionState(pendingRowSelectionState);\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n sortLabelId,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggleMemoized,\n _pendingRowSelectionState,\n ],\n );\n\n return (\n <TableStateContext.Provider value={tableState}>\n {children}\n <span style={{ display: 'none' }} id={sortLabelId}>\n {messages.format('toggleColumnSortOrder')}\n </span>\n </TableStateContext.Provider>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTableState(): TableState {\n const tableState = useContext(TableStateContext);\n if (!tableState) {\n throw new Error('Cannot use table state outside of a table');\n }\n\n return tableState;\n}\n"]}
1
+ {"version":3,"file":"table-state.js","sourceRoot":"","sources":["../../../../../src/components/table/contexts/table-state.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAgB9E,MAAM,iBAAiB,GAAG,aAAa,CAAoB,IAAI,CAAC,CAAC;AAEjE,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GAOzB;IACC,+EAA+E;IAC/E,sDAAsD;IACtD,oDAAoD;IACpD,MAAM,2BAA2B,GAAG,MAAM,CAAsB,SAAS,CAAC,CAAC;IAC3E,MAAM,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,GAAG,QAAQ,CAAsB,SAAS,CAAC,CAAC;IAE3G,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,gCAAgC,GAAG,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IAErF,MAAM,UAAU,GAAe,OAAO,CACpC,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB;QACnB,wBAAwB,EAAE,gCAAgC;QAC1D,IAAI,wBAAwB;YAC1B,OAAO,2BAA2B,CAAC,OAAO,CAAC;QAC7C,CAAC;QACD,2BAA2B,CAAC,wBAA6C;YACvE,2BAA2B,CAAC,OAAO,GAAG,wBAAwB,CAAC;YAC/D,4BAA4B,CAAC,wBAAwB,CAAC,CAAC;QACzD,CAAC;KACF,CAAC;IACF,uDAAuD;IACvD;QACE,WAAW;QACX,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB;QACnB,gCAAgC;QAChC,yBAAyB;KAC1B,CACF,CAAC;IAEF,OAAO,CACL,MAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,aAC1C,QAAQ,EACT,eAAM,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,WAAW,YAC9C,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,GACpC,IACoB,CAC9B,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,aAAa;IAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { useEffectEvent as useRACEffectEvent, useId } from '@react-aria/utils';\nimport { createContext, type ReactNode, useContext, useMemo, useRef, useState } from 'react';\nimport { useLocalizedMessages } from '../../../i18n/localization-provider.js';\n\n/** Represents the type of row selection allowed within a table. */\nexport type RowSelectionMode = 'single' | 'multiple' | 'none';\n\nexport interface TableState {\n sortLabelId: string;\n rowSelectionMode: RowSelectionMode;\n areAllRowsSelected?: boolean;\n areSomeRowsSelected?: boolean;\n onAllRowsSelectionToggle?: (value?: boolean) => void;\n /** The selection state that will be applied to the next focused row. */\n pendingRowSelectionState?: boolean;\n setPendingRowSelectionState: (value: boolean | undefined) => void;\n}\n\nconst TableStateContext = createContext<TableState | null>(null);\n\nexport function TableStateProvider({\n children,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggle,\n}: {\n children: ReactNode;\n rowSelectionMode: RowSelectionMode;\n areAllRowsSelected?: boolean;\n areSomeRowsSelected?: boolean;\n onAllRowsSelectionToggle?: (value?: boolean) => void;\n}) {\n // When the pending selection state is updated, we want to trigger a re-render,\n // but we also want immediate access to the new value.\n // Hence why it is stored as both a ref and a state.\n const pendingRowSelectionStateRef = useRef<boolean | undefined>(undefined);\n const [_pendingRowSelectionState, _setPendingRowSelectionState] = useState<boolean | undefined>(undefined);\n\n const sortLabelId = useId();\n const messages = useLocalizedMessages('table');\n\n const onAllRowsSelectionToggleMemoized = useRACEffectEvent(onAllRowsSelectionToggle);\n\n const tableState: TableState = useMemo(\n () => ({\n sortLabelId,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggle: onAllRowsSelectionToggleMemoized,\n get pendingRowSelectionState() {\n return pendingRowSelectionStateRef.current;\n },\n setPendingRowSelectionState(pendingRowSelectionState: boolean | undefined) {\n pendingRowSelectionStateRef.current = pendingRowSelectionState;\n _setPendingRowSelectionState(pendingRowSelectionState);\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n sortLabelId,\n rowSelectionMode,\n areAllRowsSelected,\n areSomeRowsSelected,\n onAllRowsSelectionToggleMemoized,\n _pendingRowSelectionState,\n ],\n );\n\n return (\n <TableStateContext.Provider value={tableState}>\n {children}\n <span style={{ display: 'none' }} id={sortLabelId}>\n {messages.format('toggleColumnSortOrder')}\n </span>\n </TableStateContext.Provider>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTableState(): TableState {\n const tableState = useContext(TableStateContext);\n if (!tableState) {\n throw new Error('Cannot use table state outside of a table');\n }\n\n return tableState;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { getFocusableTreeWalker, useFocusRing } from '@react-aria/focus';
2
2
  import { isFocusVisible } from '@react-aria/interactions';
3
- import { mergeProps, useEffectEvent, useLayoutEffect } from '@react-aria/utils';
3
+ import { mergeProps, useEffectEvent as useRACEffectEvent, useLayoutEffect } from '@react-aria/utils';
4
4
  import { useEffect } from 'react';
5
5
  import { useTableFocus } from '../contexts/focus.js';
6
6
  import { useTableRowState } from '../contexts/row-state.js';
@@ -50,7 +50,7 @@ export function useTableCell(ref, rowKey, columnKey) {
50
50
  }
51
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
52
52
  }, [ref, isTabbable]);
53
- const resetIfFocused = useEffectEvent(() => {
53
+ const resetIfFocused = useRACEffectEvent(() => {
54
54
  if (isTabbable) {
55
55
  tableFocus.setFocus('', '');
56
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-cell.js","sourceRoot":"","sources":["../../../../../src/components/table/hooks/use-table-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAqE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,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Visible } from '@react-aria/interactions';\nimport { mergeProps, useEffectEvent, useLayoutEffect } from '@react-aria/utils';\nimport { type KeyboardEventHandler, type FocusEventHandler, type RefObject, useEffect } from 'react';\nimport type { FocusableElement, NativeElementProps } from '../../types.js';\nimport { useTableFocus } from '../contexts/focus.js';\nimport { useTableRowState } from '../contexts/row-state.js';\nimport { useTableState } from '../contexts/table-state.js';\nimport { focusTableChild } from '../utils/focus-table-child.js';\n\nexport interface UseTableCell {\n cellProps: NativeElementProps<HTMLTableCellElement>;\n}\n\nexport function useTableCell(\n ref: RefObject<HTMLTableCellElement | null>,\n rowKey: string,\n columnKey: string,\n): UseTableCell {\n const tableFocus = useTableFocus();\n const { pendingRowSelectionState, setPendingRowSelectionState } = useTableState();\n const { onSelectionToggle } = useTableRowState();\n\n const { focusProps, isFocusVisible: isCellFocusVisible } = useFocusRing();\n\n const isTabbable = rowKey === tableFocus.focusedRowKey && columnKey === tableFocus.focusedColumnKey;\n\n // Handles focusing the cell.\n // If there is a focusable child, it is focused, otherwise the cell itself is focused.\n const focusCell = () => {\n if (!ref.current) {\n return;\n }\n\n // If there's a pending selection state, apply it to this cell's row.\n // If this cell is a header cell, `onSelectionToggle` will be undefined, but we still want to clear the pending selection state.\n if (pendingRowSelectionState !== undefined) {\n onSelectionToggle?.(pendingRowSelectionState);\n setPendingRowSelectionState(undefined);\n }\n\n // If focus is already on a focusable child within the cell, early return so we don't shift focus\n if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {\n return;\n }\n\n const treeWalker = getFocusableTreeWalker(ref.current);\n const focusable = tableFocus.childFocusStrategy === 'last' ? treeWalker.lastChild() : treeWalker.firstChild();\n\n if (focusable) {\n // Cell has focusable children, focus the child\n focusTableChild(focusable as FocusableElement);\n } else if (!ref.current.contains(document.activeElement)) {\n // Cell has no focusable children and current focus is outside of the cell, focus the cell itself\n focusTableChild(ref.current);\n } else if (ref.current === document.activeElement && !isTabbable) {\n // Focus is on the current cell, but table focus is elsewhere, update table focus state\n tableFocus.setFocus(rowKey, columnKey);\n }\n };\n\n // Focus the cell DOM node when table focus moves to this cell\n useLayoutEffect(() => {\n if (isTabbable && !ref.current!.contains(document.activeElement)) {\n focusCell();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, isTabbable]);\n\n const resetIfFocused = useEffectEvent(() => {\n if (isTabbable) {\n tableFocus.setFocus('', '');\n }\n });\n\n // Reset table focus when the focused cell unmounts\n useEffect(\n () => () => {\n resetIfFocused();\n },\n [resetIfFocused],\n );\n\n const onFocus: FocusEventHandler = (e) => {\n // Ignore focus events bubbling through portals\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n // If cell is already focused, return early.\n // However, if focus happens as a result of a press, we need to re-run the child-focusing logic,\n // otherwise `useFocusRing` will force the cell itself to become focused.\n if (e.currentTarget.contains(e.relatedTarget) && isFocusVisible()) {\n return;\n }\n\n // There are 3 scenarios for why a cell might receive focus:\n // - focus happens through a press, we need to update table focus state to the current cell\n // - focus happens through arrow key navigation within the table,\n // we do nothing as table focus state would have already been updated earlier\n // - focus happens through tabbing into the table from outside,\n // we do nothing because we want to restore focus to the previously focused cell,\n // and overriding table focus state would make that impossible\n if (!isFocusVisible()) {\n tableFocus.setFocus(rowKey, columnKey);\n }\n\n if (e.target === ref.current) {\n // If the cell itself receives focus, wait a frame so that focus finishes propagating\n // up to the tree, and move focus to a focusable child if possible.\n requestAnimationFrame(() => {\n if (document.activeElement === ref.current) {\n focusCell();\n }\n });\n }\n };\n\n // Handles keyboard navigation between focusable children within the cell.\n const onKeyDownCapture: KeyboardEventHandler = (e) => {\n // Ignore keyboard events bubbling through portals\n if (!e.currentTarget.contains(e.target as Element) || !ref.current || !document.activeElement) {\n return;\n }\n\n const walker = getFocusableTreeWalker(ref.current);\n walker.currentNode = document.activeElement;\n\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n // Move to the previous/next focusable element within the cell\n const childElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();\n\n if (childElementToFocus && childElementToFocus !== ref.current) {\n focusTableChild(childElementToFocus as FocusableElement);\n } else {\n // If there is no previous/next focusable element within the current cell, focus should move to the previous/next cell.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement!.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n // Move to the previous/next cell in the current column.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n } else {\n // if we didn't handle anything, return early so we don't stop propagation and preventDefault\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n };\n\n const customProps: NativeElementProps<HTMLTableCellElement> = {\n tabIndex: isTabbable ? 0 : -1,\n onFocus,\n onKeyDownCapture,\n 'data-cell-row-key': rowKey,\n 'data-cell-column-key': columnKey,\n 'data-focus-visible': isCellFocusVisible || undefined,\n };\n\n return {\n cellProps: mergeProps(focusProps, customProps),\n };\n}\n"]}
1
+ {"version":3,"file":"use-table-cell.js","sourceRoot":"","sources":["../../../../../src/components/table/hooks/use-table-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,cAAc,IAAI,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EAAqE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAA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Content":["import { getFocusableTreeWalker, useFocusRing } from '@react-aria/focus';\nimport { isFocusVisible } from '@react-aria/interactions';\nimport { mergeProps, useEffectEvent as useRACEffectEvent, useLayoutEffect } from '@react-aria/utils';\nimport { type KeyboardEventHandler, type FocusEventHandler, type RefObject, useEffect } from 'react';\nimport type { FocusableElement, NativeElementProps } from '../../types.js';\nimport { useTableFocus } from '../contexts/focus.js';\nimport { useTableRowState } from '../contexts/row-state.js';\nimport { useTableState } from '../contexts/table-state.js';\nimport { focusTableChild } from '../utils/focus-table-child.js';\n\nexport interface UseTableCell {\n cellProps: NativeElementProps<HTMLTableCellElement>;\n}\n\nexport function useTableCell(\n ref: RefObject<HTMLTableCellElement | null>,\n rowKey: string,\n columnKey: string,\n): UseTableCell {\n const tableFocus = useTableFocus();\n const { pendingRowSelectionState, setPendingRowSelectionState } = useTableState();\n const { onSelectionToggle } = useTableRowState();\n\n const { focusProps, isFocusVisible: isCellFocusVisible } = useFocusRing();\n\n const isTabbable = rowKey === tableFocus.focusedRowKey && columnKey === tableFocus.focusedColumnKey;\n\n // Handles focusing the cell.\n // If there is a focusable child, it is focused, otherwise the cell itself is focused.\n const focusCell = () => {\n if (!ref.current) {\n return;\n }\n\n // If there's a pending selection state, apply it to this cell's row.\n // If this cell is a header cell, `onSelectionToggle` will be undefined, but we still want to clear the pending selection state.\n if (pendingRowSelectionState !== undefined) {\n onSelectionToggle?.(pendingRowSelectionState);\n setPendingRowSelectionState(undefined);\n }\n\n // If focus is already on a focusable child within the cell, early return so we don't shift focus\n if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {\n return;\n }\n\n const treeWalker = getFocusableTreeWalker(ref.current);\n const focusable = tableFocus.childFocusStrategy === 'last' ? treeWalker.lastChild() : treeWalker.firstChild();\n\n if (focusable) {\n // Cell has focusable children, focus the child\n focusTableChild(focusable as FocusableElement);\n } else if (!ref.current.contains(document.activeElement)) {\n // Cell has no focusable children and current focus is outside of the cell, focus the cell itself\n focusTableChild(ref.current);\n } else if (ref.current === document.activeElement && !isTabbable) {\n // Focus is on the current cell, but table focus is elsewhere, update table focus state\n tableFocus.setFocus(rowKey, columnKey);\n }\n };\n\n // Focus the cell DOM node when table focus moves to this cell\n useLayoutEffect(() => {\n if (isTabbable && !ref.current!.contains(document.activeElement)) {\n focusCell();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, isTabbable]);\n\n const resetIfFocused = useRACEffectEvent(() => {\n if (isTabbable) {\n tableFocus.setFocus('', '');\n }\n });\n\n // Reset table focus when the focused cell unmounts\n useEffect(\n () => () => {\n resetIfFocused();\n },\n [resetIfFocused],\n );\n\n const onFocus: FocusEventHandler = (e) => {\n // Ignore focus events bubbling through portals\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n // If cell is already focused, return early.\n // However, if focus happens as a result of a press, we need to re-run the child-focusing logic,\n // otherwise `useFocusRing` will force the cell itself to become focused.\n if (e.currentTarget.contains(e.relatedTarget) && isFocusVisible()) {\n return;\n }\n\n // There are 3 scenarios for why a cell might receive focus:\n // - focus happens through a press, we need to update table focus state to the current cell\n // - focus happens through arrow key navigation within the table,\n // we do nothing as table focus state would have already been updated earlier\n // - focus happens through tabbing into the table from outside,\n // we do nothing because we want to restore focus to the previously focused cell,\n // and overriding table focus state would make that impossible\n if (!isFocusVisible()) {\n tableFocus.setFocus(rowKey, columnKey);\n }\n\n if (e.target === ref.current) {\n // If the cell itself receives focus, wait a frame so that focus finishes propagating\n // up to the tree, and move focus to a focusable child if possible.\n requestAnimationFrame(() => {\n if (document.activeElement === ref.current) {\n focusCell();\n }\n });\n }\n };\n\n // Handles keyboard navigation between focusable children within the cell.\n const onKeyDownCapture: KeyboardEventHandler = (e) => {\n // Ignore keyboard events bubbling through portals\n if (!e.currentTarget.contains(e.target as Element) || !ref.current || !document.activeElement) {\n return;\n }\n\n const walker = getFocusableTreeWalker(ref.current);\n walker.currentNode = document.activeElement;\n\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n // Move to the previous/next focusable element within the cell\n const childElementToFocus = e.key === 'ArrowLeft' ? walker.previousNode() : walker.nextNode();\n\n if (childElementToFocus && childElementToFocus !== ref.current) {\n focusTableChild(childElementToFocus as FocusableElement);\n } else {\n // If there is no previous/next focusable element within the current cell, focus should move to the previous/next cell.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement!.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n // Move to the previous/next cell in the current column.\n // This is handled by `useTable`, so we need to let the event bubble up to it.\n // But we also don't want this event to reach children of the current cell, as arrow keys should be used exclusively for table navigation.\n // Solution: re-dispatch the event from a parent element of the current cell.\n ref.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));\n } else {\n // if we didn't handle anything, return early so we don't stop propagation and preventDefault\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n };\n\n const customProps: NativeElementProps<HTMLTableCellElement> = {\n tabIndex: isTabbable ? 0 : -1,\n onFocus,\n onKeyDownCapture,\n 'data-cell-row-key': rowKey,\n 'data-cell-column-key': columnKey,\n 'data-focus-visible': isCellFocusVisible || undefined,\n };\n\n return {\n cellProps: mergeProps(focusProps, customProps),\n };\n}\n"]}
@@ -18,13 +18,15 @@ export function TagFieldListBox({ children, inputId, selectedKeys, setSelectedKe
18
18
  if (!listState || !listState.selectionManager) {
19
19
  return listState;
20
20
  }
21
- // @ts-expect-error `selectionManager.state` is private
22
21
  // This is a temporary mutation before a context update, so this is fine
23
- // eslint-disable-next-line react-hooks/react-compiler
22
+ // @ts-expect-error `selectionManager.state` is private
23
+ // eslint-disable-next-line react-hooks/immutability
24
24
  listState.selectionManager.state.selectionMode = 'multiple';
25
25
  // @ts-expect-error `selectionManager.state` is private
26
+ // eslint-disable-next-line react-hooks/immutability
26
27
  listState.selectionManager.state.selectedKeys = selectedKeys;
27
28
  // @ts-expect-error `selectionManager.state` is private
29
+ // eslint-disable-next-line react-hooks/immutability
28
30
  listState.selectionManager.state.setSelectedKeys = (keys) => {
29
31
  if (keys === 'all') {
30
32
  // When the end-user presses Ctrl/Cmd + A on a list which has `selectionMode` set to `'multiple'`,
@@ -38,6 +40,7 @@ export function TagFieldListBox({ children, inputId, selectedKeys, setSelectedKe
38
40
  }
39
41
  };
40
42
  // @ts-expect-error `selectionManager.state` is private
43
+ // eslint-disable-next-line react-hooks/immutability
41
44
  listState.selectionManager.state.disallowEmptySelection = false;
42
45
  return {
43
46
  ...listState,
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field-list-box.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field-list-box.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,oBAAoB,IAAI,uBAAuB,EAC/C,OAAO,IAAI,UAAU,EACrB,UAAU,IAAI,aAAa,EAE3B,gBAAgB,IAAI,mBAAmB,EACvC,WAAW,IAAI,cAAc,GAC9B,MAAM,uBAAuB,CAAC;AAI/B,MAAM,sBAAsB,GAAyB;IACnD,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;CACP,CAAC;AAEF,gBAAgB;AAChB,MAAM,UAAU,eAAe,CAA2B,EACxD,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,EACf,KAAK,EACL,QAAQ,EACR,aAAa,GAKd;IACC,MAAM,aAAa,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAElD,gBAAgB,CAAC,EAAE,UAAU,EAAE,CA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ACf,KAAC,cAAc,IAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,YACzE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,GAC4B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useMemo } from 'react';\nimport { usePreventScroll } from 'react-aria';\nimport {\n ComboBoxStateContext as RACComboBoxStateContext,\n ListBox as RACListBox,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n ListStateContext as RACListStateContext,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport type { CollectionItem, Key } from '../types.js';\nimport type { TagFieldProps } from './tag-field.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n rowHeight: 36,\n headingHeight: 32,\n padding: 0,\n gap: 0,\n};\n\n/** @internal */\nexport function TagFieldListBox<T extends CollectionItem>({\n children,\n inputId,\n selectedKeys,\n setSelectedKeys,\n items,\n onScroll,\n isVirtualized,\n}: Pick<TagFieldProps<T>, 'children' | 'items' | 'onScroll' | 'isVirtualized'> & {\n inputId: string;\n selectedKeys: Set<Key>;\n setSelectedKeys: (keys: Set<Key>) => void;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const listState = useContext(RACListStateContext);\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n // Override RACListStateContext to allow multiple selection within the list\n const updatedListState = useMemo(() => {\n if (!listState || !listState.selectionManager) {\n return listState;\n }\n\n // @ts-expect-error `selectionManager.state` is private\n // This is a temporary mutation before a context update, so this is fine\n // eslint-disable-next-line react-hooks/react-compiler\n listState.selectionManager.state.selectionMode = 'multiple';\n // @ts-expect-error `selectionManager.state` is private\n listState.selectionManager.state.selectedKeys = selectedKeys;\n // @ts-expect-error `selectionManager.state` is private\n listState.selectionManager.state.setSelectedKeys = (keys: Set<Key> | 'all') => {\n if (keys === 'all') {\n // When the end-user presses Ctrl/Cmd + A on a list which has `selectionMode` set to `'multiple'`,\n // the selection manager emits the `'all'` string as an indication to select all items.\n // We don't want to do that - instead, we select the contents of the input field.\n // Querying by ID because RACInputContext has a null ref for some reason.\n (document.getElementById(inputId) as HTMLInputElement | null)?.select();\n } else {\n setSelectedKeys(keys);\n }\n };\n // @ts-expect-error `selectionManager.state` is private\n listState.selectionManager.state.disallowEmptySelection = false;\n\n return {\n ...listState,\n };\n }, [listState, selectedKeys, setSelectedKeys, inputId]);\n\n const listBox = (\n <RACListBox className=\"cim-combo-box-listbox\" onScroll={onScroll} items={items}>\n {children}\n </RACListBox>\n );\n\n return (\n <RACListStateContext.Provider value={updatedListState}>\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </RACListStateContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"tag-field-list-box.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field-list-box.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,oBAAoB,IAAI,uBAAuB,EAC/C,OAAO,IAAI,UAAU,EACrB,UAAU,IAAI,aAAa,EAE3B,gBAAgB,IAAI,mBAAmB,EACvC,WAAW,IAAI,cAAc,GAC9B,MAAM,uBAAuB,CAAC;AAI/B,MAAM,sBAAsB,GAAyB;IACnD,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;CACP,CAAC;AAEF,gBAAgB;AAChB,MAAM,UAAU,eAAe,CAA2B,EACxD,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,EACf,KAAK,EACL,QAAQ,EACR,aAAa,GAKd;IACC,MAAM,aAAa,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;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AE,KAAK,YAC3E,QAAQ,GACE,CACd,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB,YAClD,aAAa,CAAC,CAAC,CAAC,CACf,KAAC,cAAc,IAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,YACzE,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,GAC4B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useMemo } from 'react';\nimport { usePreventScroll } from 'react-aria';\nimport {\n ComboBoxStateContext as RACComboBoxStateContext,\n ListBox as RACListBox,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n ListStateContext as RACListStateContext,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport type { CollectionItem, Key } from '../types.js';\nimport type { TagFieldProps } from './tag-field.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n rowHeight: 36,\n headingHeight: 32,\n padding: 0,\n gap: 0,\n};\n\n/** @internal */\nexport function TagFieldListBox<T extends CollectionItem>({\n children,\n inputId,\n selectedKeys,\n setSelectedKeys,\n items,\n onScroll,\n isVirtualized,\n}: Pick<TagFieldProps<T>, 'children' | 'items' | 'onScroll' | 'isVirtualized'> & {\n inputId: string;\n selectedKeys: Set<Key>;\n setSelectedKeys: (keys: Set<Key>) => void;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const listState = useContext(RACListStateContext);\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n // Override RACListStateContext to allow multiple selection within the list\n const updatedListState = useMemo(() => {\n if (!listState || !listState.selectionManager) {\n return listState;\n }\n\n // This is a temporary mutation before a context update, so this is fine\n // @ts-expect-error `selectionManager.state` is private\n // eslint-disable-next-line react-hooks/immutability\n listState.selectionManager.state.selectionMode = 'multiple';\n // @ts-expect-error `selectionManager.state` is private\n // eslint-disable-next-line react-hooks/immutability\n listState.selectionManager.state.selectedKeys = selectedKeys;\n // @ts-expect-error `selectionManager.state` is private\n // eslint-disable-next-line react-hooks/immutability\n listState.selectionManager.state.setSelectedKeys = (keys: Set<Key> | 'all') => {\n if (keys === 'all') {\n // When the end-user presses Ctrl/Cmd + A on a list which has `selectionMode` set to `'multiple'`,\n // the selection manager emits the `'all'` string as an indication to select all items.\n // We don't want to do that - instead, we select the contents of the input field.\n // Querying by ID because RACInputContext has a null ref for some reason.\n (document.getElementById(inputId) as HTMLInputElement | null)?.select();\n } else {\n setSelectedKeys(keys);\n }\n };\n // @ts-expect-error `selectionManager.state` is private\n // eslint-disable-next-line react-hooks/immutability\n listState.selectionManager.state.disallowEmptySelection = false;\n\n return {\n ...listState,\n };\n }, [listState, selectedKeys, setSelectedKeys, inputId]);\n\n const listBox = (\n <RACListBox className=\"cim-combo-box-listbox\" onScroll={onScroll} items={items}>\n {children}\n </RACListBox>\n );\n\n return (\n <RACListStateContext.Provider value={updatedListState}>\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </RACListStateContext.Provider>\n );\n}\n"]}
@@ -6,6 +6,8 @@ import { Tag } from '../tag/tag.js';
6
6
  /** @internal */
7
7
  export function TagFieldTags({ inputId, selectedKeys, isDisabled, isReadOnly, renderEmptyState, onRemove, }) {
8
8
  const listState = useContext(RACListStateContext);
9
+ // The plugin doesn't see `selectedKeys` as a legitimate dependency
10
+ // eslint-disable-next-line react-hooks/preserve-manual-memoization
9
11
  const selectedItems = useMemo(() => {
10
12
  return [...selectedKeys.values()]
11
13
  .map((key) => listState?.selectionManager.collection.getItem(key))
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field-tags.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field-tags.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AA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gBACX,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;oBACP,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzB,CAAC,YAGN,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B,KAAC,GAAG,IAAgB,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,UAAU,EAAG,IAAI,CAAC,KAAkB,CAAC,UAAU,YAC9E,IAAI,CAAC,SAAS,IADP,IAAI,CAAC,GAAG,CAEZ,CACP,CAAC,GACO,GACC,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useMemo } from 'react';\nimport {\n ButtonContext as RACButtonContext,\n LabelContext as RACLabelContext,\n ListStateContext as RACListStateContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { TagGroup } from '../tag/tag-group.js';\nimport { Tag, type TagProps } from '../tag/tag.js';\nimport type { CollectionItem, Key } from '../types.js';\nimport type { TagFieldProps } from './tag-field.js';\n\n/** @internal */\nexport function TagFieldTags<T extends CollectionItem>({\n inputId,\n selectedKeys,\n isDisabled,\n isReadOnly,\n renderEmptyState,\n onRemove,\n}: Pick<TagFieldProps<T>, 'isDisabled' | 'isReadOnly' | 'renderEmptyState'> & {\n inputId: string;\n selectedKeys: Set<Key>;\n onRemove: (key: Key) => void;\n}) {\n const listState = useContext(RACListStateContext);\n\n const selectedItems = useMemo(() => {\n return [...selectedKeys.values()]\n .map((key) => listState?.selectionManager.collection.getItem(key))\n .filter((value) => !!value);\n }, [selectedKeys, listState?.selectionManager.collection]);\n\n return (\n <RACProvider\n values={[\n // Reset contexts so that TagGroup doesn't inherit any data from RACComboBox\n [RACLabelContext, null],\n [RACButtonContext, null],\n [RACTextContext, null],\n [RACListStateContext, null],\n ]}\n >\n <TagGroup\n aria-labelledby={inputId}\n disabledKeys={isDisabled ? selectedKeys : undefined}\n renderEmptyState={renderEmptyState}\n onRemove={\n isReadOnly\n ? undefined\n : (keys) => {\n keys.forEach(onRemove);\n }\n }\n >\n {selectedItems.map((item) => (\n <Tag key={item.key} id={item.key} isDisabled={(item.props as TagProps).isDisabled}>\n {item.textValue}\n </Tag>\n ))}\n </TagGroup>\n </RACProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"tag-field-tags.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field-tags.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,aAAa,IAAI,gBAAgB,EACjC,YAAY,IAAI,eAAe,EAC/B,gBAAgB,IAAI,mBAAmB,EACvC,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAiB,MAAM,eAAe,CAAC;AAInD,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAA2B,EACrD,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAKT;IACC,MAAM,SAAS,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAElD,mEAAmE;IACnE,mEAAmE;IACnE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;aAC9B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aACjE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,WAAW,IACV,MAAM,EAAE;YACN,4EAA4E;YAC5E,CAAC,eAAe,EAAE,IAAI,CAAC;YACvB,CAAC,gBAAgB,EAAE,IAAI,CAAC;YACxB,CAAC,cAAc,EAAE,IAAI,CAAC;YACtB,CAAC,mBAAmB,EAAE,IAAI,CAAC;SAC5B,YAED,KAAC,QAAQ,uBACU,OAAO,EACxB,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EACnD,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EACN,UAAU;gBACR,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;oBACP,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzB,CAAC,YAGN,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC3B,KAAC,GAAG,IAAgB,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,UAAU,EAAG,IAAI,CAAC,KAAkB,CAAC,UAAU,YAC9E,IAAI,CAAC,SAAS,IADP,IAAI,CAAC,GAAG,CAEZ,CACP,CAAC,GACO,GACC,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useMemo } from 'react';\nimport {\n ButtonContext as RACButtonContext,\n LabelContext as RACLabelContext,\n ListStateContext as RACListStateContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { TagGroup } from '../tag/tag-group.js';\nimport { Tag, type TagProps } from '../tag/tag.js';\nimport type { CollectionItem, Key } from '../types.js';\nimport type { TagFieldProps } from './tag-field.js';\n\n/** @internal */\nexport function TagFieldTags<T extends CollectionItem>({\n inputId,\n selectedKeys,\n isDisabled,\n isReadOnly,\n renderEmptyState,\n onRemove,\n}: Pick<TagFieldProps<T>, 'isDisabled' | 'isReadOnly' | 'renderEmptyState'> & {\n inputId: string;\n selectedKeys: Set<Key>;\n onRemove: (key: Key) => void;\n}) {\n const listState = useContext(RACListStateContext);\n\n // The plugin doesn't see `selectedKeys` as a legitimate dependency\n // eslint-disable-next-line react-hooks/preserve-manual-memoization\n const selectedItems = useMemo(() => {\n return [...selectedKeys.values()]\n .map((key) => listState?.selectionManager.collection.getItem(key))\n .filter((value) => !!value);\n }, [selectedKeys, listState?.selectionManager.collection]);\n\n return (\n <RACProvider\n values={[\n // Reset contexts so that TagGroup doesn't inherit any data from RACComboBox\n [RACLabelContext, null],\n [RACButtonContext, null],\n [RACTextContext, null],\n [RACListStateContext, null],\n ]}\n >\n <TagGroup\n aria-labelledby={inputId}\n disabledKeys={isDisabled ? selectedKeys : undefined}\n renderEmptyState={renderEmptyState}\n onRemove={\n isReadOnly\n ? undefined\n : (keys) => {\n keys.forEach(onRemove);\n }\n }\n >\n {selectedItems.map((item) => (\n <Tag key={item.key} id={item.key} isDisabled={(item.props as TagProps).isDisabled}>\n {item.textValue}\n </Tag>\n ))}\n </TagGroup>\n </RACProvider>\n );\n}\n"]}
@@ -88,7 +88,7 @@ function TagField({ label, description, error, items, children, placeholder, UNS
88
88
  const onItemSelectionChange = (key) => {
89
89
  if (selectedSet.has(key)) {
90
90
  // This is a temporary mutation followed immediately by a state update, so this is fine
91
- // eslint-disable-next-line react-hooks/react-compiler
91
+ // eslint-disable-next-line react-hooks/immutability
92
92
  selectedSet.delete(key);
93
93
  }
94
94
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,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,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA0C,mBAAmB,EAAE,OAAO,E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,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 { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type UIEventHandler, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n Provider as RACProvider,\n TextContext as RACTextContext,\n GroupContext as RACGroupContext,\n FieldErrorContext as RACFieldErrorContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.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 type { TagGroupProps } from '../tag/tag-group.js';\nimport type {\n ApiProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\nimport { TagFieldInput } from './tag-field-input.js';\nimport { TagFieldListBox } from './tag-field-list-box.js';\nimport { TagFieldTags } from './tag-field-tags.js';\n\n/** Represents the state of the `TagField` component for validation purposes. */\nexport interface TagFieldValidationValue {\n /** The selected keys in the TagField. */\n selectedKeys: Set<Key> | null;\n /** The value of the TagField input. */\n inputValue: string;\n}\n\nexport interface TagFieldProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldWithPlaceholderProps<TagFieldValidationValue>,\n CollectionProps<T>,\n ApiProps<TagFieldApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isRequired'\n | 'isDisabled'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<TagGroupProps<T>, 'renderEmptyState'> {\n /** The currently selected keys in the collection (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The initial selected keys in the collection (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (keys: Set<Key>) => 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}\n\n/** The imperative API exposed by the `TagField` component. */\nexport interface TagFieldApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n}\n\nfunction TagField<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 inputValue: consumerInputValue,\n defaultInputValue: defaultConsumerInputValue,\n onInputChange,\n form,\n name,\n validate,\n onScroll,\n selectedKeys: consumerSelectedKeys,\n defaultSelectedKeys: defaultConsumerSelectedKeys,\n onSelectionChange,\n id,\n renderEmptyState,\n isVirtualized = false,\n apiRef,\n ...props\n }: TagFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isRequired, isDisabled, isInvalid } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TagField 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('`TagField` requires `children` to be a function when using `items` prop');\n }\n\n const messages = useLocalizedMessages('tagField');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n }),\n [],\n );\n\n // State\n\n const [defaultSelectedKeys] = useState(() => defaultConsumerSelectedKeys ?? new Set<Key>());\n const [selectedKeys, setSelectedKeys] = useControlledState(\n consumerSelectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n );\n const [inputValue, setInputValue] = useControlledState(\n consumerInputValue,\n defaultConsumerInputValue ?? '',\n onInputChange,\n );\n\n const selectedSet = useMemo(() => {\n // eslint-disable-next-line unicorn/no-instanceof-builtins\n if (selectedKeys instanceof Set) {\n return new Set<Key>(selectedKeys.values());\n }\n\n return new Set<Key>(selectedKeys);\n }, [selectedKeys]);\n\n // Validation\n\n const inputId = useId(id);\n const formInputRef = useRef<HTMLInputElement>(null);\n\n const validationState = useFormValidationState({\n name,\n value: useMemo(() => ({ selectedKeys: selectedSet, inputValue }), [selectedSet, inputValue]),\n isInvalid,\n isRequired,\n validate,\n validationBehavior: 'native',\n });\n\n const [initialSelectedKeys] = useState(selectedKeys);\n const [initialInputValue] = useState(inputValue);\n\n useFormReset<[Iterable<Key>, string]>(\n formInputRef,\n [defaultConsumerSelectedKeys ?? initialSelectedKeys, defaultConsumerInputValue ?? initialInputValue],\n ([a, b]) => {\n setSelectedKeys(a);\n setInputValue(b);\n },\n );\n\n useFormValidation(\n {\n focus: () => {\n // Querying by element ID because a ref is always null here, I don't know why :(\n document.getElementById(inputId)?.focus();\n },\n isInvalid,\n isRequired,\n validate,\n validationBehavior: 'native',\n },\n validationState,\n formInputRef,\n );\n\n // Event handlers\n\n // Commit validation on input blur if the values have changed\n const inputValueOnFocus = useRef(inputValue);\n const selectedSetOnFocus = useRef(selectedSet);\n\n const onFocusChange = (isFocused: boolean) => {\n if (isFocused) {\n inputValueOnFocus.current = inputValue;\n selectedSetOnFocus.current = selectedSet;\n } else if (inputValue !== inputValueOnFocus.current || selectedSet !== selectedSetOnFocus.current) {\n validationState.commitValidation();\n }\n };\n\n const onItemSelectionChange = (key: Key) => {\n if (selectedSet.has(key)) {\n // This is a temporary mutation followed immediately by a state update, so this is fine\n // eslint-disable-next-line react-hooks/react-compiler\n selectedSet.delete(key);\n } else {\n selectedSet.add(key);\n }\n\n setSelectedKeys(new Set(selectedSet.values()));\n validationState.commitValidation();\n };\n\n // Text slots\n\n const descriptionId = useSlotId([Boolean(description)]);\n\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <>\n <RACComboBox\n {...props}\n ref={ref}\n id={inputId}\n className={clsx('cim-combo-box', 'cim-tag-field', UNSAFE_className)}\n style={UNSAFE_style}\n // Force no internal selection - we handle selection manually\n selectedKey={null}\n inputValue={inputValue}\n onInputChange={setInputValue}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n onSelectionChange={(key) => {\n if (key) {\n onItemSelectionChange(key);\n }\n }}\n >\n <RACProvider\n values={[\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACGroupContext, { isInvalid: validationState.displayValidation.isInvalid, isDisabled }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n\n <RACGroup className=\"cim-combo-box-input-group\">\n <TagFieldInput\n inputRef={inputRef}\n aria-describedby={props['aria-describedby']}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n isInvalid={validationState.displayValidation.isInvalid}\n placeholder={\n selectedSet.size === 0 && placeholder\n ? placeholder\n : messages.format('itemsSelected', { selectedItemCount: selectedSet.size })\n }\n onFocusChange={onFocusChange}\n />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\n\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n\n <TagFieldTags<T>\n inputId={inputId}\n selectedKeys={selectedSet}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n renderEmptyState={renderEmptyState}\n onRemove={onItemSelectionChange}\n />\n\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <TagFieldListBox<T>\n inputId={inputId}\n items={items}\n selectedKeys={selectedSet}\n setSelectedKeys={setSelectedKeys}\n onScroll={onScroll}\n isVirtualized={isVirtualized}\n >\n {children}\n </TagFieldListBox>\n </CollapsibleList>\n </RACProvider>\n </RACComboBox>\n\n {/* This input is used for native form validation. We can't use the combo box input because its value has no relation to the selected values. */}\n <RACInput\n ref={formInputRef}\n style={{ display: 'none' }}\n value={selectedSet.size || ''}\n required={isRequired}\n aria-invalid={validationState.displayValidation.isInvalid || undefined}\n onChange={() => {}}\n />\n\n {/* These hidden inputs provide values when a form is submitted. */}\n {name &&\n [...selectedSet].map((value) => <input type=\"hidden\" key={value} form={form} name={name} value={value} />)}\n </>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select multiple items from it.\n *\n * See [tag field usage guidelines](https://ui.cimpress.io/components/tag-field).\n */\nconst _TagField = withStyleProps(forwardRef(TagField), 'TagField');\n\nexport { _TagField as TagField };\n\nexport interface TagFieldItemProps<T extends CollectionItem>\n extends Pick<RACListBoxItemProps<T>, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `TagField`. */\nexport function TagFieldItem<T extends CollectionItem>({ children, ...props }: TagFieldItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-tag-field-item cim-checkbox\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <div className=\"cim-checkbox-toggle-wrapper\" aria-hidden>\n <div className=\"cim-checkbox-toggle\">\n <IconCheckBold />\n </div>\n </div>\n\n <RACText slot=\"label\" className={textStyle({ variant: 'medium', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nTagFieldItem.displayName = 'TagFieldItem';\n\nexport interface TagFieldSectionProps<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 `TagField` into a section. */\nexport function TagFieldSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: TagFieldSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`TagFieldSection` 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\nTagFieldSection.displayName = 'TagFieldSection';\n"]}
1
+ {"version":3,"file":"tag-field.js","sourceRoot":"","sources":["../../../../src/components/tag-field/tag-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,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,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAA0C,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/G,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,UAAU,IAAI,aAAa,EAC3B,QAAQ,IAAI,WAAW,EACvB,KAAK,IAAI,QAAQ,EACjB,MAAM,IAAI,SAAS,EACnB,KAAK,IAAI,QAAQ,EACjB,WAAW,IAAI,cAAc,EAC7B,cAAc,IAAI,iBAAiB,EACnC,IAAI,IAAI,OAAO,EAGf,QAAQ,IAAI,WAAW,EACvB,WAAW,IAAI,cAAc,EAC7B,YAAY,IAAI,eAAe,EAC/B,iBAAiB,IAAI,oBAAoB,GAC1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,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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,cAAc,OAAK,KAAK,EAAE,SAAS,EAAC,iCAAiC,EAAC,SAAS,EAAE,SAAS,YACxF,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CACnB,8BACE,cAAK,SAAS,EAAC,6BAA6B,iCAC1C,cAAK,SAAS,EAAC,qBAAqB,YAClC,KAAC,aAAa,KAAG,GACb,GACF,EAEN,KAAC,OAAO,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,YACnG,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 { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type UIEventHandler, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n Provider as RACProvider,\n TextContext as RACTextContext,\n GroupContext as RACGroupContext,\n FieldErrorContext as RACFieldErrorContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.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 type { TagGroupProps } from '../tag/tag-group.js';\nimport type {\n ApiProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\nimport { TagFieldInput } from './tag-field-input.js';\nimport { TagFieldListBox } from './tag-field-list-box.js';\nimport { TagFieldTags } from './tag-field-tags.js';\n\n/** Represents the state of the `TagField` component for validation purposes. */\nexport interface TagFieldValidationValue {\n /** The selected keys in the TagField. */\n selectedKeys: Set<Key> | null;\n /** The value of the TagField input. */\n inputValue: string;\n}\n\nexport interface TagFieldProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldWithPlaceholderProps<TagFieldValidationValue>,\n CollectionProps<T>,\n ApiProps<TagFieldApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isRequired'\n | 'isDisabled'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<TagGroupProps<T>, 'renderEmptyState'> {\n /** The currently selected keys in the collection (controlled). */\n selectedKeys?: Iterable<Key>;\n /** The initial selected keys in the collection (uncontrolled). */\n defaultSelectedKeys?: Iterable<Key>;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (keys: Set<Key>) => 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}\n\n/** The imperative API exposed by the `TagField` component. */\nexport interface TagFieldApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n}\n\nfunction TagField<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 inputValue: consumerInputValue,\n defaultInputValue: defaultConsumerInputValue,\n onInputChange,\n form,\n name,\n validate,\n onScroll,\n selectedKeys: consumerSelectedKeys,\n defaultSelectedKeys: defaultConsumerSelectedKeys,\n onSelectionChange,\n id,\n renderEmptyState,\n isVirtualized = false,\n apiRef,\n ...props\n }: TagFieldProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, isRequired, isDisabled, isInvalid } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TagField 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('`TagField` requires `children` to be a function when using `items` prop');\n }\n\n const messages = useLocalizedMessages('tagField');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n }),\n [],\n );\n\n // State\n\n const [defaultSelectedKeys] = useState(() => defaultConsumerSelectedKeys ?? new Set<Key>());\n const [selectedKeys, setSelectedKeys] = useControlledState(\n consumerSelectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n );\n const [inputValue, setInputValue] = useControlledState(\n consumerInputValue,\n defaultConsumerInputValue ?? '',\n onInputChange,\n );\n\n const selectedSet = useMemo(() => {\n // eslint-disable-next-line unicorn/no-instanceof-builtins\n if (selectedKeys instanceof Set) {\n return new Set<Key>(selectedKeys.values());\n }\n\n return new Set<Key>(selectedKeys);\n }, [selectedKeys]);\n\n // Validation\n\n const inputId = useId(id);\n const formInputRef = useRef<HTMLInputElement>(null);\n\n const validationState = useFormValidationState({\n name,\n value: useMemo(() => ({ selectedKeys: selectedSet, inputValue }), [selectedSet, inputValue]),\n isInvalid,\n isRequired,\n validate,\n validationBehavior: 'native',\n });\n\n const [initialSelectedKeys] = useState(selectedKeys);\n const [initialInputValue] = useState(inputValue);\n\n useFormReset<[Iterable<Key>, string]>(\n formInputRef,\n [defaultConsumerSelectedKeys ?? initialSelectedKeys, defaultConsumerInputValue ?? initialInputValue],\n ([a, b]) => {\n setSelectedKeys(a);\n setInputValue(b);\n },\n );\n\n useFormValidation(\n {\n focus: () => {\n // Querying by element ID because a ref is always null here, I don't know why :(\n document.getElementById(inputId)?.focus();\n },\n isInvalid,\n isRequired,\n validate,\n validationBehavior: 'native',\n },\n validationState,\n formInputRef,\n );\n\n // Event handlers\n\n // Commit validation on input blur if the values have changed\n const inputValueOnFocus = useRef(inputValue);\n const selectedSetOnFocus = useRef(selectedSet);\n\n const onFocusChange = (isFocused: boolean) => {\n if (isFocused) {\n inputValueOnFocus.current = inputValue;\n selectedSetOnFocus.current = selectedSet;\n } else if (inputValue !== inputValueOnFocus.current || selectedSet !== selectedSetOnFocus.current) {\n validationState.commitValidation();\n }\n };\n\n const onItemSelectionChange = (key: Key) => {\n if (selectedSet.has(key)) {\n // This is a temporary mutation followed immediately by a state update, so this is fine\n // eslint-disable-next-line react-hooks/immutability\n selectedSet.delete(key);\n } else {\n selectedSet.add(key);\n }\n\n setSelectedKeys(new Set(selectedSet.values()));\n validationState.commitValidation();\n };\n\n // Text slots\n\n const descriptionId = useSlotId([Boolean(description)]);\n\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <>\n <RACComboBox\n {...props}\n ref={ref}\n id={inputId}\n className={clsx('cim-combo-box', 'cim-tag-field', UNSAFE_className)}\n style={UNSAFE_style}\n // Force no internal selection - we handle selection manually\n selectedKey={null}\n inputValue={inputValue}\n onInputChange={setInputValue}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n onSelectionChange={(key) => {\n if (key) {\n onItemSelectionChange(key);\n }\n }}\n >\n <RACProvider\n values={[\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACGroupContext, { isInvalid: validationState.displayValidation.isInvalid, isDisabled }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n\n <RACGroup className=\"cim-combo-box-input-group\">\n <TagFieldInput\n inputRef={inputRef}\n aria-describedby={props['aria-describedby']}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n isInvalid={validationState.displayValidation.isInvalid}\n placeholder={\n selectedSet.size === 0 && placeholder\n ? placeholder\n : messages.format('itemsSelected', { selectedItemCount: selectedSet.size })\n }\n onFocusChange={onFocusChange}\n />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\n\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n\n <TagFieldTags<T>\n inputId={inputId}\n selectedKeys={selectedSet}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n renderEmptyState={renderEmptyState}\n onRemove={onItemSelectionChange}\n />\n\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <TagFieldListBox<T>\n inputId={inputId}\n items={items}\n selectedKeys={selectedSet}\n setSelectedKeys={setSelectedKeys}\n onScroll={onScroll}\n isVirtualized={isVirtualized}\n >\n {children}\n </TagFieldListBox>\n </CollapsibleList>\n </RACProvider>\n </RACComboBox>\n\n {/* This input is used for native form validation. We can't use the combo box input because its value has no relation to the selected values. */}\n <RACInput\n ref={formInputRef}\n style={{ display: 'none' }}\n value={selectedSet.size || ''}\n required={isRequired}\n aria-invalid={validationState.displayValidation.isInvalid || undefined}\n onChange={() => {}}\n />\n\n {/* These hidden inputs provide values when a form is submitted. */}\n {name &&\n [...selectedSet].map((value) => <input type=\"hidden\" key={value} form={form} name={name} value={value} />)}\n </>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select multiple items from it.\n *\n * See [tag field usage guidelines](https://ui.cimpress.io/components/tag-field).\n */\nconst _TagField = withStyleProps(forwardRef(TagField), 'TagField');\n\nexport { _TagField as TagField };\n\nexport interface TagFieldItemProps<T extends CollectionItem>\n extends Pick<RACListBoxItemProps<T>, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `TagField`. */\nexport function TagFieldItem<T extends CollectionItem>({ children, ...props }: TagFieldItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-tag-field-item cim-checkbox\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <div className=\"cim-checkbox-toggle-wrapper\" aria-hidden>\n <div className=\"cim-checkbox-toggle\">\n <IconCheckBold />\n </div>\n </div>\n\n <RACText slot=\"label\" className={textStyle({ variant: 'medium', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nTagFieldItem.displayName = 'TagFieldItem';\n\nexport interface TagFieldSectionProps<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 `TagField` into a section. */\nexport function TagFieldSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: TagFieldSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`TagFieldSection` 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\nTagFieldSection.displayName = 'TagFieldSection';\n"]}
@@ -14,6 +14,13 @@ export function InternalToggleButton({ buttonRef: ref, children, size = 'medium'
14
14
  const toggleGroupState = useContext(RACToggleGroupStateContext);
15
15
  const descriptionProps = useSlottedContext(RACTextContext, 'description');
16
16
  const errorMessageProps = useSlottedContext(RACTextContext, 'errorMessage');
17
+ const validationState = useFormValidationState({
18
+ // If part of a group, validation is handled at group level
19
+ name: toggleButtonGroupContext ? undefined : name,
20
+ value,
21
+ validationBehavior: 'native',
22
+ [privateValidationStateProp]: toggleButtonGroupContext?.validationState ?? undefined,
23
+ });
17
24
  const [isSelected, setIsSelected] = useControlledState(toggleGroupState && value ? toggleGroupState.selectedKeys.has(value) : consumerIsSelected, consumerDefaultSelected ?? false, (newIsSelected) => {
18
25
  onChange?.(newIsSelected);
19
26
  if (toggleGroupState && value) {
@@ -25,13 +32,6 @@ export function InternalToggleButton({ buttonRef: ref, children, size = 'medium'
25
32
  const buttonRef = useObjectRef(ref);
26
33
  const formInputRef = useRef(null);
27
34
  const formInputName = toggleButtonGroupContext?.name ?? name;
28
- const validationState = useFormValidationState({
29
- // If part of a group, validation is handled at group level
30
- name: toggleButtonGroupContext ? undefined : name,
31
- value,
32
- validationBehavior: 'native',
33
- [privateValidationStateProp]: toggleButtonGroupContext?.validationState ?? undefined,
34
- });
35
35
  const [initialSelected] = useState(isSelected);
36
36
  useFormReset(formInputRef, consumerDefaultSelected ?? initialSelected, setIsSelected);
37
37
  useFormValidation({
@@ -1 +1 @@
1
- {"version":3,"file":"internal-toggle-button.js","sourceRoot":"","sources":["../../../../src/components/toggle-button/internal-toggle-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAkB,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAC;AAC/E,OAAO,EACL,WAAW,IAAI,cAAc,EAC7B,YAAY,IAAI,eAAe,EAE/B,uBAAuB,IAAI,0BAA0B,EACrD,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AA2CxD,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,EACnC,SAAS,EAAE,GAAG,EACd,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,UAAU,EAAE,kBAAkB,EAC9B,eAAe,EAAE,uBAAuB,EACxC,QAAQ,EACR,GAAG,KAAK,EACkB;IAC1B,QAAQ;IAER,MAAM,wBAAwB,GAAG,UAAU,CA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E,GAAE,CAAC,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useObjectRef } from '@react-aria/utils';\nimport { privateValidationStateProp, useFormValidationState } from '@react-stately/form';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ReactNode, useContext, useRef, useState, type Ref } from 'react';\nimport {\n TextContext as RACTextContext,\n ToggleButton as RACToggleButton,\n type ToggleButtonProps as RACToggleButtonProps,\n ToggleGroupStateContext as RACToggleGroupStateContext,\n useSlottedContext,\n} from 'react-aria-components';\nimport type { BaseButtonProps } from '../button/types.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { ToggleButtonGroupContext } from './context.js';\n\n/** @internal */\nexport interface BaseToggleButtonProps\n extends Omit<CommonProps, 'id'>,\n AriaLabelingProps,\n Pick<BaseButtonProps, 'size' | 'fullWidth'>,\n Pick<\n RACToggleButtonProps,\n | 'defaultSelected'\n | 'isSelected'\n | 'onPress'\n | 'onHoverStart'\n | 'onHoverEnd'\n | 'onChange'\n | 'isDisabled'\n | 'autoFocus'\n > {\n /**\n * The `<form>` element to associate the input with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).\n */\n form?: string;\n /**\n * The name of the input element, used when submitting an HTML form.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name).\n */\n name?: string;\n /**\n * The value of the input element, used when submitting an HTML form.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#value).\n *\n * When used in a `ToggleButtonGroup`, `value` serves as an identifier for this button, and has to be unique across all buttons in the group.\n */\n value?: string;\n}\n\ninterface InternalToggleButtonProps extends BaseToggleButtonProps {\n children?: ReactNode;\n buttonRef?: Ref<HTMLButtonElement>;\n}\n\n/** @internal */\nexport function InternalToggleButton({\n buttonRef: ref,\n children,\n size = 'medium',\n isDisabled,\n fullWidth,\n UNSAFE_className,\n UNSAFE_style,\n form,\n name,\n value,\n isSelected: consumerIsSelected,\n defaultSelected: consumerDefaultSelected,\n onChange,\n ...props\n}: InternalToggleButtonProps) {\n // State\n\n const toggleButtonGroupContext = useContext(ToggleButtonGroupContext);\n const toggleGroupState = useContext(RACToggleGroupStateContext);\n const descriptionProps = useSlottedContext(RACTextContext, 'description');\n const errorMessageProps = useSlottedContext(RACTextContext, 'errorMessage');\n\n const [isSelected, setIsSelected] = useControlledState(\n toggleGroupState && value ? toggleGroupState.selectedKeys.has(value) : consumerIsSelected,\n consumerDefaultSelected ?? false,\n (newIsSelected) => {\n onChange?.(newIsSelected);\n\n if (toggleGroupState && value) {\n toggleGroupState.setSelected(value, newIsSelected);\n }\n\n validationState.commitValidation();\n },\n );\n\n // Validation\n\n const buttonRef = useObjectRef(ref);\n const formInputRef = useRef<HTMLInputElement>(null);\n const formInputName = toggleButtonGroupContext?.name ?? name;\n\n const validationState = useFormValidationState({\n // If part of a group, validation is handled at group level\n name: toggleButtonGroupContext ? undefined : name,\n value,\n validationBehavior: 'native',\n [privateValidationStateProp]: toggleButtonGroupContext?.validationState ?? undefined,\n });\n\n const [initialSelected] = useState(isSelected);\n useFormReset(formInputRef, consumerDefaultSelected ?? initialSelected, setIsSelected);\n\n useFormValidation(\n {\n focus: () => buttonRef.current?.focus(),\n validationBehavior: 'native',\n },\n validationState,\n formInputRef,\n );\n\n return (\n <>\n <RACToggleButton\n {...props}\n ref={buttonRef}\n className={clsx('cim-toggle-button', UNSAFE_className)}\n style={UNSAFE_style}\n id={toggleButtonGroupContext ? value : undefined}\n isDisabled={isDisabled}\n isSelected={isSelected}\n onChange={setIsSelected}\n aria-describedby={\n [\n props['aria-describedby'],\n toggleButtonGroupContext?.isInvalid ? errorMessageProps?.id : null,\n descriptionProps?.id,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n data-variant=\"secondary\"\n data-tone=\"base\"\n data-size={size}\n data-full-width={fullWidth || undefined}\n >\n {children}\n </RACToggleButton>\n\n {formInputName && (\n <input\n ref={formInputRef}\n style={{ display: 'none' }}\n type=\"checkbox\"\n form={toggleButtonGroupContext?.form ?? form}\n name={formInputName}\n checked={isSelected}\n value={value}\n required={toggleButtonGroupContext?.isRequired}\n aria-invalid={\n toggleButtonGroupContext?.validationState.displayValidation.isInvalid ??\n validationState.displayValidation.isInvalid ??\n undefined\n }\n onChange={() => {}}\n />\n )}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"internal-toggle-button.js","sourceRoot":"","sources":["../../../../src/components/toggle-button/internal-toggle-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAkB,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAC;AAC/E,OAAO,EACL,WAAW,IAAI,cAAc,EAC7B,YAAY,IAAI,eAAe,EAE/B,uBAAuB,IAAI,0BAA0B,EACrD,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AA2CxD,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,EACnC,SAAS,EAAE,GAAG,EACd,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,UAAU,EAAE,kBAAkB,EAC9B,eAAe,EAAE,uBAAuB,EACxC,QAAQ,EACR,GAAG,KAAK,EACkB;IAC1B,QAAQ;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AAS,EAEX,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useObjectRef } from '@react-aria/utils';\nimport { privateValidationStateProp, useFormValidationState } from '@react-stately/form';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ReactNode, useContext, useRef, useState, type Ref } from 'react';\nimport {\n TextContext as RACTextContext,\n ToggleButton as RACToggleButton,\n type ToggleButtonProps as RACToggleButtonProps,\n ToggleGroupStateContext as RACToggleGroupStateContext,\n useSlottedContext,\n} from 'react-aria-components';\nimport type { BaseButtonProps } from '../button/types.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { ToggleButtonGroupContext } from './context.js';\n\n/** @internal */\nexport interface BaseToggleButtonProps\n extends Omit<CommonProps, 'id'>,\n AriaLabelingProps,\n Pick<BaseButtonProps, 'size' | 'fullWidth'>,\n Pick<\n RACToggleButtonProps,\n | 'defaultSelected'\n | 'isSelected'\n | 'onPress'\n | 'onHoverStart'\n | 'onHoverEnd'\n | 'onChange'\n | 'isDisabled'\n | 'autoFocus'\n > {\n /**\n * The `<form>` element to associate the input with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).\n */\n form?: string;\n /**\n * The name of the input element, used when submitting an HTML form.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name).\n */\n name?: string;\n /**\n * The value of the input element, used when submitting an HTML form.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#value).\n *\n * When used in a `ToggleButtonGroup`, `value` serves as an identifier for this button, and has to be unique across all buttons in the group.\n */\n value?: string;\n}\n\ninterface InternalToggleButtonProps extends BaseToggleButtonProps {\n children?: ReactNode;\n buttonRef?: Ref<HTMLButtonElement>;\n}\n\n/** @internal */\nexport function InternalToggleButton({\n buttonRef: ref,\n children,\n size = 'medium',\n isDisabled,\n fullWidth,\n UNSAFE_className,\n UNSAFE_style,\n form,\n name,\n value,\n isSelected: consumerIsSelected,\n defaultSelected: consumerDefaultSelected,\n onChange,\n ...props\n}: InternalToggleButtonProps) {\n // State\n\n const toggleButtonGroupContext = useContext(ToggleButtonGroupContext);\n const toggleGroupState = useContext(RACToggleGroupStateContext);\n const descriptionProps = useSlottedContext(RACTextContext, 'description');\n const errorMessageProps = useSlottedContext(RACTextContext, 'errorMessage');\n\n const validationState = useFormValidationState({\n // If part of a group, validation is handled at group level\n name: toggleButtonGroupContext ? undefined : name,\n value,\n validationBehavior: 'native',\n [privateValidationStateProp]: toggleButtonGroupContext?.validationState ?? undefined,\n });\n\n const [isSelected, setIsSelected] = useControlledState(\n toggleGroupState && value ? toggleGroupState.selectedKeys.has(value) : consumerIsSelected,\n consumerDefaultSelected ?? false,\n (newIsSelected) => {\n onChange?.(newIsSelected);\n\n if (toggleGroupState && value) {\n toggleGroupState.setSelected(value, newIsSelected);\n }\n\n validationState.commitValidation();\n },\n );\n\n // Validation\n\n const buttonRef = useObjectRef(ref);\n const formInputRef = useRef<HTMLInputElement>(null);\n const formInputName = toggleButtonGroupContext?.name ?? name;\n\n const [initialSelected] = useState(isSelected);\n useFormReset(formInputRef, consumerDefaultSelected ?? initialSelected, setIsSelected);\n\n useFormValidation(\n {\n focus: () => buttonRef.current?.focus(),\n validationBehavior: 'native',\n },\n validationState,\n formInputRef,\n );\n\n return (\n <>\n <RACToggleButton\n {...props}\n ref={buttonRef}\n className={clsx('cim-toggle-button', UNSAFE_className)}\n style={UNSAFE_style}\n id={toggleButtonGroupContext ? value : undefined}\n isDisabled={isDisabled}\n isSelected={isSelected}\n onChange={setIsSelected}\n aria-describedby={\n [\n props['aria-describedby'],\n toggleButtonGroupContext?.isInvalid ? errorMessageProps?.id : null,\n descriptionProps?.id,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n data-variant=\"secondary\"\n data-tone=\"base\"\n data-size={size}\n data-full-width={fullWidth || undefined}\n >\n {children}\n </RACToggleButton>\n\n {formInputName && (\n <input\n ref={formInputRef}\n style={{ display: 'none' }}\n type=\"checkbox\"\n form={toggleButtonGroupContext?.form ?? form}\n name={formInputName}\n checked={isSelected}\n value={value}\n required={toggleButtonGroupContext?.isRequired}\n aria-invalid={\n toggleButtonGroupContext?.validationState.displayValidation.isInvalid ??\n validationState.displayValidation.isInvalid ??\n undefined\n }\n onChange={() => {}}\n />\n )}\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-button-group.d.ts","sourceRoot":"","sources":["../../../../src/components/toggle-button/toggle-button-group.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAML,KAAK,sBAAsB,IAAI,yBAAyB,EACzD,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI9E,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,EAC3C,IAAI,CACF,yBAAyB,EACzB,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,eAAe,GAAG,YAAY,CAC9F;IACH,2FAA2F;IAC3F,QAAQ,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAsHD;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,wKAAqE,CAAC;AAE9F,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"toggle-button-group.d.ts","sourceRoot":"","sources":["../../../../src/components/toggle-button/toggle-button-group.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAML,KAAK,sBAAsB,IAAI,yBAAyB,EACzD,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI9E,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,EAC3C,IAAI,CACF,yBAAyB,EACzB,cAAc,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,eAAe,GAAG,YAAY,CAC9F;IACH,2FAA2F;IAC3F,QAAQ,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAyHD;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,wKAAqE,CAAC;AAE9F,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,CAAC"}
@@ -24,6 +24,9 @@ function ToggleButtonGroup({ children, label, description, error: errorMessage,
24
24
  // State
25
25
  const [selectedKeys, setSelectedKeys] = useControlledState(consumerSelectedKeys, consumerDefaultSelectedKeys ?? [], (newSelectedKeys) => {
26
26
  onSelectionChange?.(new Set(newSelectedKeys));
27
+ // `validationState` is technically accessed before its declaration, but there's no way to write this in a different order,
28
+ // and this is a callback anyway so it won't be called immediately
29
+ // eslint-disable-next-line react-hooks/immutability
27
30
  validationState.commitValidation();
28
31
  });
29
32
  const selectedSet = useMemo(() => new Set(selectedKeys), [selectedKeys]);