@react-spectrum/s2 3.0.0-nightly-5ae234603-240925 → 3.0.0-nightly-d57bd8d90-240927

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 (445) hide show
  1. package/dist/Accordion.cjs.map +1 -1
  2. package/dist/Accordion.css.map +1 -1
  3. package/dist/Accordion.mjs.map +1 -1
  4. package/dist/ActionButton.cjs.map +1 -1
  5. package/dist/ActionButton.css.map +1 -1
  6. package/dist/ActionButton.mjs.map +1 -1
  7. package/dist/AlertDialog.cjs.map +1 -1
  8. package/dist/AlertDialog.css.map +1 -1
  9. package/dist/AlertDialog.mjs.map +1 -1
  10. package/dist/Avatar.cjs.map +1 -1
  11. package/dist/Avatar.css.map +1 -1
  12. package/dist/Avatar.mjs.map +1 -1
  13. package/dist/AvatarGroup.cjs.map +1 -1
  14. package/dist/AvatarGroup.css.map +1 -1
  15. package/dist/AvatarGroup.mjs.map +1 -1
  16. package/dist/Badge.cjs.map +1 -1
  17. package/dist/Badge.css.map +1 -1
  18. package/dist/Badge.mjs.map +1 -1
  19. package/dist/Breadcrumbs.cjs.map +1 -1
  20. package/dist/Breadcrumbs.css.map +1 -1
  21. package/dist/Breadcrumbs.mjs.map +1 -1
  22. package/dist/Button.cjs +39 -5
  23. package/dist/Button.cjs.map +1 -1
  24. package/dist/Button.css +64 -0
  25. package/dist/Button.css.map +1 -1
  26. package/dist/Button.mjs +39 -5
  27. package/dist/Button.mjs.map +1 -1
  28. package/dist/ButtonGroup.cjs.map +1 -1
  29. package/dist/ButtonGroup.css.map +1 -1
  30. package/dist/ButtonGroup.mjs.map +1 -1
  31. package/dist/Card.cjs +2 -2
  32. package/dist/Card.cjs.map +1 -1
  33. package/dist/Card.css.map +1 -1
  34. package/dist/Card.mjs +2 -2
  35. package/dist/Card.mjs.map +1 -1
  36. package/dist/CardView.cjs.map +1 -1
  37. package/dist/CardView.css.map +1 -1
  38. package/dist/CardView.mjs.map +1 -1
  39. package/dist/CenterBaseline.cjs.map +1 -1
  40. package/dist/CenterBaseline.css.map +1 -1
  41. package/dist/CenterBaseline.mjs.map +1 -1
  42. package/dist/Checkbox.cjs +4 -1
  43. package/dist/Checkbox.cjs.map +1 -1
  44. package/dist/Checkbox.css +4 -0
  45. package/dist/Checkbox.css.map +1 -1
  46. package/dist/Checkbox.mjs +4 -1
  47. package/dist/Checkbox.mjs.map +1 -1
  48. package/dist/CheckboxGroup.cjs.map +1 -1
  49. package/dist/CheckboxGroup.css.map +1 -1
  50. package/dist/CheckboxGroup.mjs.map +1 -1
  51. package/dist/ClearButton.cjs.map +1 -1
  52. package/dist/ClearButton.css.map +1 -1
  53. package/dist/ClearButton.mjs.map +1 -1
  54. package/dist/CloseButton.cjs.map +1 -1
  55. package/dist/CloseButton.css.map +1 -1
  56. package/dist/CloseButton.mjs.map +1 -1
  57. package/dist/ColorArea.cjs.map +1 -1
  58. package/dist/ColorArea.css.map +1 -1
  59. package/dist/ColorArea.mjs.map +1 -1
  60. package/dist/ColorField.cjs.map +1 -1
  61. package/dist/ColorField.css.map +1 -1
  62. package/dist/ColorField.mjs.map +1 -1
  63. package/dist/ColorHandle.cjs.map +1 -1
  64. package/dist/ColorHandle.css.map +1 -1
  65. package/dist/ColorHandle.mjs.map +1 -1
  66. package/dist/ColorSlider.cjs.map +1 -1
  67. package/dist/ColorSlider.css.map +1 -1
  68. package/dist/ColorSlider.mjs.map +1 -1
  69. package/dist/ColorSwatch.cjs.map +1 -1
  70. package/dist/ColorSwatch.css.map +1 -1
  71. package/dist/ColorSwatch.mjs.map +1 -1
  72. package/dist/ColorSwatchPicker.cjs.map +1 -1
  73. package/dist/ColorSwatchPicker.css.map +1 -1
  74. package/dist/ColorSwatchPicker.mjs.map +1 -1
  75. package/dist/ColorWheel.cjs.map +1 -1
  76. package/dist/ColorWheel.css.map +1 -1
  77. package/dist/ColorWheel.mjs.map +1 -1
  78. package/dist/ComboBox.cjs +3 -0
  79. package/dist/ComboBox.cjs.map +1 -1
  80. package/dist/ComboBox.css.map +1 -1
  81. package/dist/ComboBox.mjs +3 -0
  82. package/dist/ComboBox.mjs.map +1 -1
  83. package/dist/Content.cjs +0 -2
  84. package/dist/Content.cjs.map +1 -1
  85. package/dist/Content.mjs +1 -2
  86. package/dist/Content.mjs.map +1 -1
  87. package/dist/ContextualHelp.cjs.map +1 -1
  88. package/dist/ContextualHelp.css.map +1 -1
  89. package/dist/ContextualHelp.mjs.map +1 -1
  90. package/dist/Dialog.cjs +7 -5
  91. package/dist/Dialog.cjs.map +1 -1
  92. package/dist/Dialog.css.map +1 -1
  93. package/dist/Dialog.mjs +8 -6
  94. package/dist/Dialog.mjs.map +1 -1
  95. package/dist/Disclosure.cjs.map +1 -1
  96. package/dist/Disclosure.css.map +1 -1
  97. package/dist/Disclosure.mjs.map +1 -1
  98. package/dist/Divider.cjs.map +1 -1
  99. package/dist/Divider.css.map +1 -1
  100. package/dist/Divider.mjs.map +1 -1
  101. package/dist/DropZone.cjs.map +1 -1
  102. package/dist/DropZone.css.map +1 -1
  103. package/dist/DropZone.mjs.map +1 -1
  104. package/dist/Field.cjs.map +1 -1
  105. package/dist/Field.css.map +1 -1
  106. package/dist/Field.mjs.map +1 -1
  107. package/dist/Form.cjs.map +1 -1
  108. package/dist/Form.css.map +1 -1
  109. package/dist/Form.mjs.map +1 -1
  110. package/dist/IllustratedMessage.cjs.map +1 -1
  111. package/dist/IllustratedMessage.css.map +1 -1
  112. package/dist/IllustratedMessage.mjs.map +1 -1
  113. package/dist/Image.cjs.map +1 -1
  114. package/dist/Image.css.map +1 -1
  115. package/dist/Image.mjs.map +1 -1
  116. package/dist/InlineAlert.cjs.map +1 -1
  117. package/dist/InlineAlert.css.map +1 -1
  118. package/dist/InlineAlert.mjs.map +1 -1
  119. package/dist/Link.cjs.map +1 -1
  120. package/dist/Link.css.map +1 -1
  121. package/dist/Link.mjs.map +1 -1
  122. package/dist/Menu.cjs.map +1 -1
  123. package/dist/Menu.css.map +1 -1
  124. package/dist/Menu.mjs.map +1 -1
  125. package/dist/Meter.cjs.map +1 -1
  126. package/dist/Meter.css.map +1 -1
  127. package/dist/Meter.mjs.map +1 -1
  128. package/dist/Modal.cjs.map +1 -1
  129. package/dist/Modal.css.map +1 -1
  130. package/dist/Modal.mjs.map +1 -1
  131. package/dist/MoveHorizontalCircleTableWidget.cjs +33 -0
  132. package/dist/MoveHorizontalCircleTableWidget.cjs.map +1 -0
  133. package/dist/MoveHorizontalCircleTableWidget.mjs +28 -0
  134. package/dist/MoveHorizontalCircleTableWidget.mjs.map +1 -0
  135. package/dist/NumberField.cjs.map +1 -1
  136. package/dist/NumberField.css.map +1 -1
  137. package/dist/NumberField.mjs.map +1 -1
  138. package/dist/Picker.cjs +3 -0
  139. package/dist/Picker.cjs.map +1 -1
  140. package/dist/Picker.css.map +1 -1
  141. package/dist/Picker.mjs +3 -0
  142. package/dist/Picker.mjs.map +1 -1
  143. package/dist/Popover.cjs +1 -0
  144. package/dist/Popover.cjs.map +1 -1
  145. package/dist/Popover.css +4 -0
  146. package/dist/Popover.css.map +1 -1
  147. package/dist/Popover.mjs +1 -0
  148. package/dist/Popover.mjs.map +1 -1
  149. package/dist/ProgressBar.cjs.map +1 -1
  150. package/dist/ProgressBar.css.map +1 -1
  151. package/dist/ProgressBar.mjs.map +1 -1
  152. package/dist/ProgressCircle.cjs +0 -1
  153. package/dist/ProgressCircle.cjs.map +1 -1
  154. package/dist/ProgressCircle.css +0 -4
  155. package/dist/ProgressCircle.css.map +1 -1
  156. package/dist/ProgressCircle.mjs +0 -1
  157. package/dist/ProgressCircle.mjs.map +1 -1
  158. package/dist/Provider.cjs.map +1 -1
  159. package/dist/Provider.css.map +1 -1
  160. package/dist/Provider.mjs.map +1 -1
  161. package/dist/Radio.cjs.map +1 -1
  162. package/dist/Radio.css.map +1 -1
  163. package/dist/Radio.mjs.map +1 -1
  164. package/dist/RadioGroup.cjs.map +1 -1
  165. package/dist/RadioGroup.css.map +1 -1
  166. package/dist/RadioGroup.mjs.map +1 -1
  167. package/dist/SearchField.cjs.map +1 -1
  168. package/dist/SearchField.css.map +1 -1
  169. package/dist/SearchField.mjs.map +1 -1
  170. package/dist/SegmentedControl.cjs +11 -8
  171. package/dist/SegmentedControl.cjs.map +1 -1
  172. package/dist/SegmentedControl.css.map +1 -1
  173. package/dist/SegmentedControl.mjs +11 -8
  174. package/dist/SegmentedControl.mjs.map +1 -1
  175. package/dist/SkeletonCollection.cjs.map +1 -1
  176. package/dist/SkeletonCollection.mjs.map +1 -1
  177. package/dist/Slider.cjs.map +1 -1
  178. package/dist/Slider.css.map +1 -1
  179. package/dist/Slider.mjs.map +1 -1
  180. package/dist/StatusLight.cjs.map +1 -1
  181. package/dist/StatusLight.css.map +1 -1
  182. package/dist/StatusLight.mjs.map +1 -1
  183. package/dist/Switch.cjs.map +1 -1
  184. package/dist/Switch.css.map +1 -1
  185. package/dist/Switch.mjs.map +1 -1
  186. package/dist/Table.cjs +1064 -0
  187. package/dist/Table.cjs.map +1 -0
  188. package/dist/Table.css +801 -0
  189. package/dist/Table.css.map +1 -0
  190. package/dist/Table.mjs +1054 -0
  191. package/dist/Table.mjs.map +1 -0
  192. package/dist/Tabs.cjs.map +1 -1
  193. package/dist/Tabs.css.map +1 -1
  194. package/dist/Tabs.mjs.map +1 -1
  195. package/dist/TagGroup.cjs +5 -3
  196. package/dist/TagGroup.cjs.map +1 -1
  197. package/dist/TagGroup.css.map +1 -1
  198. package/dist/TagGroup.mjs +5 -3
  199. package/dist/TagGroup.mjs.map +1 -1
  200. package/dist/TextField.cjs.map +1 -1
  201. package/dist/TextField.css.map +1 -1
  202. package/dist/TextField.mjs.map +1 -1
  203. package/dist/ToggleButton.cjs +2 -1
  204. package/dist/ToggleButton.cjs.map +1 -1
  205. package/dist/ToggleButton.css.map +1 -1
  206. package/dist/ToggleButton.mjs +2 -1
  207. package/dist/ToggleButton.mjs.map +1 -1
  208. package/dist/Tooltip.cjs.map +1 -1
  209. package/dist/Tooltip.css.map +1 -1
  210. package/dist/Tooltip.mjs.map +1 -1
  211. package/dist/ar-AE.cjs +5 -0
  212. package/dist/ar-AE.cjs.map +1 -1
  213. package/dist/ar-AE.mjs +5 -0
  214. package/dist/ar-AE.mjs.map +1 -1
  215. package/dist/bg-BG.cjs +5 -0
  216. package/dist/bg-BG.cjs.map +1 -1
  217. package/dist/bg-BG.mjs +5 -0
  218. package/dist/bg-BG.mjs.map +1 -1
  219. package/dist/cs-CZ.cjs +5 -0
  220. package/dist/cs-CZ.cjs.map +1 -1
  221. package/dist/cs-CZ.mjs +5 -0
  222. package/dist/cs-CZ.mjs.map +1 -1
  223. package/dist/da-DK.cjs +5 -0
  224. package/dist/da-DK.cjs.map +1 -1
  225. package/dist/da-DK.mjs +5 -0
  226. package/dist/da-DK.mjs.map +1 -1
  227. package/dist/de-DE.cjs +5 -0
  228. package/dist/de-DE.cjs.map +1 -1
  229. package/dist/de-DE.mjs +5 -0
  230. package/dist/de-DE.mjs.map +1 -1
  231. package/dist/el-GR.cjs +5 -0
  232. package/dist/el-GR.cjs.map +1 -1
  233. package/dist/el-GR.mjs +5 -0
  234. package/dist/el-GR.mjs.map +1 -1
  235. package/dist/en-US.cjs +5 -0
  236. package/dist/en-US.cjs.map +1 -1
  237. package/dist/en-US.mjs +5 -0
  238. package/dist/en-US.mjs.map +1 -1
  239. package/dist/es-ES.cjs +5 -0
  240. package/dist/es-ES.cjs.map +1 -1
  241. package/dist/es-ES.mjs +5 -0
  242. package/dist/es-ES.mjs.map +1 -1
  243. package/dist/et-EE.cjs +5 -0
  244. package/dist/et-EE.cjs.map +1 -1
  245. package/dist/et-EE.mjs +5 -0
  246. package/dist/et-EE.mjs.map +1 -1
  247. package/dist/fi-FI.cjs +5 -0
  248. package/dist/fi-FI.cjs.map +1 -1
  249. package/dist/fi-FI.mjs +5 -0
  250. package/dist/fi-FI.mjs.map +1 -1
  251. package/dist/fr-FR.cjs +5 -0
  252. package/dist/fr-FR.cjs.map +1 -1
  253. package/dist/fr-FR.mjs +5 -0
  254. package/dist/fr-FR.mjs.map +1 -1
  255. package/dist/he-IL.cjs +5 -0
  256. package/dist/he-IL.cjs.map +1 -1
  257. package/dist/he-IL.mjs +5 -0
  258. package/dist/he-IL.mjs.map +1 -1
  259. package/dist/hr-HR.cjs +5 -0
  260. package/dist/hr-HR.cjs.map +1 -1
  261. package/dist/hr-HR.mjs +5 -0
  262. package/dist/hr-HR.mjs.map +1 -1
  263. package/dist/hu-HU.cjs +5 -0
  264. package/dist/hu-HU.cjs.map +1 -1
  265. package/dist/hu-HU.mjs +5 -0
  266. package/dist/hu-HU.mjs.map +1 -1
  267. package/dist/it-IT.cjs +5 -0
  268. package/dist/it-IT.cjs.map +1 -1
  269. package/dist/it-IT.mjs +5 -0
  270. package/dist/it-IT.mjs.map +1 -1
  271. package/dist/ja-JP.cjs +5 -0
  272. package/dist/ja-JP.cjs.map +1 -1
  273. package/dist/ja-JP.mjs +5 -0
  274. package/dist/ja-JP.mjs.map +1 -1
  275. package/dist/ko-KR.cjs +5 -0
  276. package/dist/ko-KR.cjs.map +1 -1
  277. package/dist/ko-KR.mjs +5 -0
  278. package/dist/ko-KR.mjs.map +1 -1
  279. package/dist/lt-LT.cjs +5 -0
  280. package/dist/lt-LT.cjs.map +1 -1
  281. package/dist/lt-LT.mjs +5 -0
  282. package/dist/lt-LT.mjs.map +1 -1
  283. package/dist/lv-LV.cjs +5 -0
  284. package/dist/lv-LV.cjs.map +1 -1
  285. package/dist/lv-LV.mjs +5 -0
  286. package/dist/lv-LV.mjs.map +1 -1
  287. package/dist/main.cjs +11 -0
  288. package/dist/main.cjs.map +1 -1
  289. package/dist/module.mjs +5 -1
  290. package/dist/module.mjs.map +1 -1
  291. package/dist/nb-NO.cjs +5 -0
  292. package/dist/nb-NO.cjs.map +1 -1
  293. package/dist/nb-NO.mjs +5 -0
  294. package/dist/nb-NO.mjs.map +1 -1
  295. package/dist/nl-NL.cjs +5 -0
  296. package/dist/nl-NL.cjs.map +1 -1
  297. package/dist/nl-NL.mjs +5 -0
  298. package/dist/nl-NL.mjs.map +1 -1
  299. package/dist/pl-PL.cjs +5 -0
  300. package/dist/pl-PL.cjs.map +1 -1
  301. package/dist/pl-PL.mjs +5 -0
  302. package/dist/pl-PL.mjs.map +1 -1
  303. package/dist/pt-BR.cjs +5 -0
  304. package/dist/pt-BR.cjs.map +1 -1
  305. package/dist/pt-BR.mjs +5 -0
  306. package/dist/pt-BR.mjs.map +1 -1
  307. package/dist/pt-PT.cjs +5 -0
  308. package/dist/pt-PT.cjs.map +1 -1
  309. package/dist/pt-PT.mjs +5 -0
  310. package/dist/pt-PT.mjs.map +1 -1
  311. package/dist/ro-RO.cjs +5 -0
  312. package/dist/ro-RO.cjs.map +1 -1
  313. package/dist/ro-RO.mjs +5 -0
  314. package/dist/ro-RO.mjs.map +1 -1
  315. package/dist/ru-RU.cjs +5 -0
  316. package/dist/ru-RU.cjs.map +1 -1
  317. package/dist/ru-RU.mjs +5 -0
  318. package/dist/ru-RU.mjs.map +1 -1
  319. package/dist/sk-SK.cjs +5 -0
  320. package/dist/sk-SK.cjs.map +1 -1
  321. package/dist/sk-SK.mjs +5 -0
  322. package/dist/sk-SK.mjs.map +1 -1
  323. package/dist/sl-SI.cjs +5 -0
  324. package/dist/sl-SI.cjs.map +1 -1
  325. package/dist/sl-SI.mjs +5 -0
  326. package/dist/sl-SI.mjs.map +1 -1
  327. package/dist/sr-SP.cjs +5 -0
  328. package/dist/sr-SP.cjs.map +1 -1
  329. package/dist/sr-SP.mjs +5 -0
  330. package/dist/sr-SP.mjs.map +1 -1
  331. package/dist/sv-SE.cjs +5 -0
  332. package/dist/sv-SE.cjs.map +1 -1
  333. package/dist/sv-SE.mjs +5 -0
  334. package/dist/sv-SE.mjs.map +1 -1
  335. package/dist/tr-TR.cjs +5 -0
  336. package/dist/tr-TR.cjs.map +1 -1
  337. package/dist/tr-TR.mjs +5 -0
  338. package/dist/tr-TR.mjs.map +1 -1
  339. package/dist/types.d.ts +136 -30
  340. package/dist/types.d.ts.map +1 -1
  341. package/dist/uk-UA.cjs +5 -0
  342. package/dist/uk-UA.cjs.map +1 -1
  343. package/dist/uk-UA.mjs +5 -0
  344. package/dist/uk-UA.mjs.map +1 -1
  345. package/dist/utils.cjs +30 -0
  346. package/dist/utils.cjs.map +1 -0
  347. package/dist/utils.mjs +25 -0
  348. package/dist/utils.mjs.map +1 -0
  349. package/dist/zh-CN.cjs +5 -0
  350. package/dist/zh-CN.cjs.map +1 -1
  351. package/dist/zh-CN.mjs +5 -0
  352. package/dist/zh-CN.mjs.map +1 -1
  353. package/dist/zh-TW.cjs +5 -0
  354. package/dist/zh-TW.cjs.map +1 -1
  355. package/dist/zh-TW.mjs +5 -0
  356. package/dist/zh-TW.mjs.map +1 -1
  357. package/icons/Skeleton.cjs.map +1 -1
  358. package/icons/Skeleton.css.map +1 -1
  359. package/icons/Skeleton.mjs.map +1 -1
  360. package/package.json +18 -16
  361. package/src/Accordion.tsx +2 -2
  362. package/src/ActionButton.tsx +3 -3
  363. package/src/AlertDialog.tsx +1 -1
  364. package/src/Avatar.tsx +1 -1
  365. package/src/AvatarGroup.tsx +1 -1
  366. package/src/Badge.tsx +1 -1
  367. package/src/Breadcrumbs.tsx +2 -2
  368. package/src/Button.tsx +41 -19
  369. package/src/ButtonGroup.tsx +1 -1
  370. package/src/Card.tsx +7 -7
  371. package/src/CardView.tsx +2 -2
  372. package/src/CenterBaseline.tsx +1 -1
  373. package/src/Checkbox.tsx +3 -2
  374. package/src/CheckboxGroup.tsx +1 -1
  375. package/src/ClearButton.tsx +1 -1
  376. package/src/CloseButton.tsx +2 -2
  377. package/src/ColorArea.tsx +1 -1
  378. package/src/ColorField.tsx +1 -1
  379. package/src/ColorHandle.tsx +1 -1
  380. package/src/ColorSlider.tsx +1 -1
  381. package/src/ColorSwatch.tsx +3 -3
  382. package/src/ColorSwatchPicker.tsx +5 -5
  383. package/src/ColorWheel.tsx +1 -1
  384. package/src/ComboBox.tsx +7 -4
  385. package/src/Content.tsx +1 -3
  386. package/src/ContextualHelp.tsx +1 -1
  387. package/src/Dialog.tsx +4 -3
  388. package/src/Disclosure.tsx +4 -4
  389. package/src/Divider.tsx +1 -1
  390. package/src/DropZone.tsx +1 -1
  391. package/src/Field.tsx +2 -2
  392. package/src/Form.tsx +1 -1
  393. package/src/IllustratedMessage.tsx +1 -1
  394. package/src/Image.tsx +1 -1
  395. package/src/InlineAlert.tsx +2 -2
  396. package/src/Link.tsx +2 -2
  397. package/src/Menu.tsx +2 -2
  398. package/src/Meter.tsx +1 -1
  399. package/src/Modal.tsx +1 -1
  400. package/src/NumberField.tsx +2 -2
  401. package/src/Picker.tsx +7 -4
  402. package/src/Popover.tsx +5 -2
  403. package/src/ProgressBar.tsx +1 -1
  404. package/src/ProgressCircle.tsx +7 -5
  405. package/src/Provider.tsx +1 -1
  406. package/src/Radio.tsx +2 -2
  407. package/src/RadioGroup.tsx +1 -1
  408. package/src/SearchField.tsx +1 -1
  409. package/src/SegmentedControl.tsx +32 -22
  410. package/src/Skeleton.tsx +4 -1
  411. package/src/SkeletonCollection.tsx +4 -0
  412. package/src/Slider.tsx +2 -2
  413. package/src/StatusLight.tsx +1 -1
  414. package/src/Switch.tsx +2 -2
  415. package/src/Table.tsx +1063 -48
  416. package/src/Tabs.tsx +3 -3
  417. package/src/TagGroup.tsx +5 -4
  418. package/src/TextField.tsx +1 -1
  419. package/src/ToggleButton.tsx +3 -2
  420. package/src/Tooltip.tsx +1 -1
  421. package/src/index.ts +4 -0
  422. package/src/style-utils.ts +0 -10
  423. package/src/utils.ts +28 -0
  424. package/style/__tests__/mergeStyles.test.js +32 -0
  425. package/style/__tests__/style-macro.test.js +128 -0
  426. package/style/dist/main.cjs +38 -0
  427. package/style/dist/main.cjs.map +1 -0
  428. package/style/dist/module.mjs +26 -0
  429. package/style/dist/module.mjs.map +1 -0
  430. package/style/dist/spectrum-theme.cjs +1989 -0
  431. package/style/dist/spectrum-theme.cjs.map +1 -0
  432. package/style/dist/spectrum-theme.mjs +1978 -0
  433. package/style/dist/spectrum-theme.mjs.map +1 -0
  434. package/style/dist/style-macro.cjs +544 -0
  435. package/style/dist/style-macro.cjs.map +1 -0
  436. package/style/dist/style-macro.mjs +534 -0
  437. package/style/dist/style-macro.mjs.map +1 -0
  438. package/style/dist/types.d.ts +791 -0
  439. package/style/dist/types.d.ts.map +1 -0
  440. package/style/index.ts +24 -0
  441. package/style/runtime.ts +103 -0
  442. package/style/spectrum-theme.ts +980 -0
  443. package/style/style-macro.ts +638 -0
  444. package/style/tokens.ts +68 -0
  445. package/style/types.ts +178 -0
@@ -1 +1 @@
1
- {"mappings":"ACmFuB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA2Ma;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAcjB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyBQ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+BF;;;;EAwDR;;;;EA6BC;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkHC;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAUgB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAGb;;;;EAOG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5eF;EAsWL;;;;EAAA;;;;;AAtWK;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IA2Ma;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAsEX;;;;IAqFP;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAkHC;;;;IAAA;;;;IAAA;;;;;;AAlHD;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAkHC","sources":["b7ca70995960d034","packages/@react-spectrum/s2/src/TagGroup.tsx"],"sourcesContent":["@import \"53ec8c3f8184f13f\";\n@import \"39511c3f261b5ed5\";\n@import \"0adf7c6cbf3a1f42\";\n@import \"05f90dba9e9f901e\";\n@import \"76f74241f914b430\";\n@import \"0ef2aba34cf241d8\";\n@import \"f86d9fb495210c39\";\n@import \"24a7cd4eab7f1ba0\";\n@import \"ce1f7d95b3ccf3fd\";\n@import \"70bbf6109092559b\";\n@import \"07833edfdb3bfcff\";\n@import \"ffbc1ae1f89af4e1\";\n@import \"c340d154a58b1eb0\";\n@import \"27e38777e711f6a4\";\n@import \"39f1002cc14ab33a\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from './ActionButton';\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagGroupProps as AriaTagGroupProps,\n TagProps as AriaTagProps,\n composeRenderProps,\n ContextValue,\n Provider,\n TextContext as RACTextContext,\n TagList,\n TagListProps,\n useLocale,\n useSlottedContext\n} from 'react-aria-components';\nimport {AvatarContext} from './Avatar';\nimport {CenterBaseline, centerBaseline} from './CenterBaseline';\nimport {ClearButton} from './ClearButton';\nimport {Collection, CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, HelpTextProps, Node, SpectrumLabelableProps} from '@react-types/shared';\nimport {field, focusRing, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldLabel} from './Field';\nimport {flushSync} from 'react-dom';\nimport {fontRelative, style} from '../style/spectrum-theme' with { type: 'macro' };\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {IconContext} from './Icon';\nimport {ImageContext, Text, TextContext} from './Content';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEffectEvent, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n// Get types from RSP and extend those?\nexport interface TagProps extends Omit<AriaTagProps, 'children' | 'style' | 'className'> {\n /** The children of the tag. */\n children?: ReactNode\n}\n\nexport interface TagGroupProps<T> extends Omit<AriaTagGroupProps, 'children' | 'style' | 'className'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'>, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, StyleProps, Omit<HelpTextProps, 'errorMessage'> {\n /** A description for the tag group. */\n description?: ReactNode,\n /**\n * The size of the tag group.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** Whether the tags are displayed in an emphasized style. */\n isEmphasized?: boolean,\n /** Provides content to display when there are no items in the tag group. */\n renderEmptyState?: () => ReactNode,\n /** Whether the tags are displayed in a error state. */\n isInvalid?: boolean,\n /** An error message for the field. */\n errorMessage?: ReactNode,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number,\n /** The label to display on the action button. */\n groupActionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onGroupAction?: () => void\n}\n\nexport const TagGroupContext = createContext<ContextValue<TagGroupProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: 'text'\n});\n\nconst InternalTagGroupContext = createContext<TagGroupProps<any>>({});\n\nfunction TagGroup<T extends object>(props: TagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TagGroupContext);\n props = useFormProps(props);\n let {onRemove} = props;\n return (\n <InternalTagGroupContext.Provider value={{onRemove}}>\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TagGroupInner props={props} forwardedRef={ref} collection={collection} />}\n </CollectionBuilder>\n </InternalTagGroupContext.Provider>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nlet _TagGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(TagGroup);\nexport {_TagGroup as TagGroup};\n\nfunction TagGroupInner<T>({\n props: {\n label,\n description,\n labelPosition = 'top',\n labelAlign = 'start',\n isEmphasized,\n isInvalid,\n errorMessage,\n UNSAFE_className = '',\n UNSAFE_style,\n size = 'M',\n ...props\n },\n forwardedRef: ref,\n collection\n}: {props: TagGroupProps<T>, forwardedRef: DOMRef<HTMLDivElement>, collection: any}) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n maxRows,\n groupActionLabel,\n onGroupAction,\n renderEmptyState = () => stringFormatter.format('tag.noTags'),\n ...otherProps\n } = props;\n let {direction} = useLocale();\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let actionsRef = useRef<HTMLDivElement | null>(null);\n let hiddenTagsRef = useRef<HTMLDivElement | null>(null);\n let [tagState, setTagState] = useState({visibleTagCount: collection.size, showCollapseButton: false});\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let {onRemove} = useContext(InternalTagGroupContext);\n let isEmpty = collection.size === 0;\n let showCollapseToggleButton = tagState.showCollapseButton || tagState.visibleTagCount < collection.size;\n let formContext = useContext(FormContext);\n let domRef = useDOMRef(ref);\n\n let allItems = useMemo(\n () => Array.from(collection) as Array<Node<T>>,\n [collection]\n );\n let items = useMemo(\n () => Array.from(collection).slice(0, !isCollapsed ? collection.size : tagState.visibleTagCount) as Array<Node<T>>,\n [collection, tagState.visibleTagCount, isCollapsed]\n );\n\n let updateVisibleTagCount = useEffectEvent(() => {\n if (maxRows == null) {\n setTagState({visibleTagCount: collection.size, showCollapseButton: false});\n }\n\n if (maxRows != null && maxRows > 0) {\n let computeVisibleTagCount = () => {\n let currContainerRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currTagsRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || collection.size === 0 || currContainerRef.parentElement == null) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n // I think this is still a safe assumption, and we don't need to queryAll for role=tag\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = currActionsRef ? [...currActionsRef.children] : [];\n if (buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n let margins = parseFloat(getComputedStyle(buttons[0]).marginInlineStart);\n buttonsWidth += margins * 2;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement?.getBoundingClientRect()[end] - margins;\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += margins;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth <= buttonsWidth && index > 0) {\n let tagWidth = tagWidths.pop();\n if (tagWidth != null) {\n availableWidth += tagWidth;\n }\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < collection.size\n };\n };\n let result = computeVisibleTagCount();\n flushSync(() => {\n setTagState(result);\n });\n }\n });\n\n useResizeObserver({ref: maxRows != null ? containerRef : undefined, onResize: updateVisibleTagCount});\n\n useLayoutEffect(() => {\n if (collection.size > 0 && (maxRows != null && maxRows > 0)) {\n queueMicrotask(updateVisibleTagCount);\n }\n }, [collection.size, updateVisibleTagCount, maxRows]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let handlePressCollapse = () => {\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let helpText: ReactNode = null;\n if (!isInvalid && description) {\n helpText = (\n <Text\n slot=\"description\"\n styles={helpTextStyles({size})}>\n {description}\n </Text>\n );\n } else if (isInvalid) {\n helpText = (\n <div\n className={helpTextStyles({size, isInvalid})}>\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n <Text slot=\"errorMessage\">\n {errorMessage}\n </Text>\n </div>\n );\n }\n\n return (\n <AriaTagGroup\n {...otherProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size,\n labelPosition: labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n <FieldLabel\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <div\n ref={containerRef}\n className={style({\n gridArea: 'input',\n minWidth: 'full',\n marginStart: {\n default: -4,\n isEmpty: 0\n },\n marginEnd: {\n default: 4,\n isEmpty: 0\n },\n position: 'relative'\n })({isEmpty})}>\n <FormContext.Provider value={{...formContext, size}}>\n <Provider\n values={[\n [RACTextContext, undefined],\n [TagGroupContext, {size, isEmphasized}]\n ]}>\n {/* invisible collection for measuring */}\n {maxRows != null && (\n <div\n // @ts-ignore\n inert=\"true\"\n ref={hiddenTagsRef}\n className={style({\n display: 'inline',\n flexWrap: 'wrap',\n fontFamily: 'sans',\n position: 'absolute',\n top: 0,\n bottom: 0,\n start: -4,\n end: 4,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {allItems.map(item => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, allowsRemoving: Boolean(onRemove)})}>\n {item.props.children({size, allowsRemoving: Boolean(onRemove), isInCtx: true})}\n </div>\n );\n })}\n </div>\n )}\n {/* real tag list */}\n <TagList\n ref={tagsRef}\n items={items}\n renderEmptyState={renderEmptyState}\n className={style({\n display: 'inline',\n minWidth: 'full',\n font: 'ui'\n })}>\n {item => <_Tag {...item.props} id={item.key} textValue={item.textValue} />}\n </TagList>\n {!isEmpty && (showCollapseToggleButton || groupActionLabel) &&\n <ActionGroup\n collection={collection}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n actionsRef={actionsRef}\n tagState={tagState}\n size={size}\n isCollapsed={isCollapsed}\n handlePressCollapse={handlePressCollapse}\n onGroupAction={onGroupAction}\n groupActionLabel={groupActionLabel} />\n }\n </Provider>\n </FormContext.Provider>\n </div>\n {helpText}\n </AriaTagGroup>\n );\n}\n\nfunction ActionGroup(props) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n actionsRef,\n tagState,\n size,\n isCollapsed,\n handlePressCollapse,\n onGroupAction,\n groupActionLabel,\n collection,\n // directly use aria-labelling from the TagGroup because we can't use the id from the TagList\n // and we can't supply an id to the TagList because it'll cause an issue where all the tag ids flip back\n // and forth with their prefix in an infinite loop\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n let actionsId = useId();\n // might need to localize the aria-label which concatenates with this label\n let actionGroupLabel = stringFormatter.format('tag.actions');\n return (\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={ariaLabel ? `${ariaLabel} ${actionGroupLabel}` : actionGroupLabel}\n aria-labelledby={ariaLabelledBy ? ariaLabelledBy : undefined}\n className={style({\n display: 'inline'\n })}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={handlePressCollapse}>\n {isCollapsed ?\n stringFormatter.format('tag.showAllButtonLabel', {tagCount: collection.size}) :\n stringFormatter.format('tag.hideButtonLabel')}\n </ActionButton>\n }\n {groupActionLabel && onGroupAction &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={() => onGroupAction?.()}>\n {groupActionLabel}\n </ActionButton>\n }\n </div>\n );\n}\n\nconst tagStyles = style({\n ...focusRing(),\n display: 'inline-flex',\n boxSizing: 'border-box',\n maxWidth: 'full',\n verticalAlign: 'middle',\n alignItems: 'center',\n justifyContent: 'center',\n font: 'control',\n height: 'control',\n transition: 'default',\n minWidth: 0,\n // maxWidth: '[calc(self(height) * 7)]', // s2 designs show a max width on tags but we pushed back on this in v3\n backgroundColor: {\n default: 'gray-100',\n isHovered: {\n default: 'gray-200'\n },\n isFocusVisible: {\n default: 'gray-200'\n },\n isSelected: {\n default: 'neutral',\n isEmphasized: {\n default: 'accent'\n }\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace',\n isSelected: 'Highlight'\n }\n },\n color: {\n default: 'neutral',\n isSelected: {\n default: 'gray-25',\n isEmphasized: 'white'\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isSelected: 'HighlightText',\n isDisabled: 'GrayText'\n }\n },\n borderStyle: 'none',\n paddingStart: {\n default: 'edge-to-text'\n },\n paddingEnd: {\n default: 'edge-to-text',\n allowsRemoving: 0\n },\n paddingY: 0,\n margin: 4,\n borderRadius: 'control',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2)\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst avatarSize = {\n S: 16,\n M: 20,\n L: 24\n} as const;\n\nfunction Tag({children, textValue, ...props}: TagProps, ref: DOMRef<HTMLDivElement>) {\n textValue ||= typeof children === 'string' ? children : undefined;\n let ctx = useSlottedContext(TagGroupContext);\n let isInRealDOM = Boolean(ctx?.size);\n let {size, isEmphasized} = ctx ?? {};\n let domRef = useDOMRef(ref);\n\n let backupRef = useRef(null);\n domRef = domRef || backupRef;\n let isLink = props.href != null;\n return (\n <AriaTag\n textValue={textValue}\n {...props}\n ref={domRef}\n style={pressScale(domRef)}\n className={renderProps => tagStyles({size, isEmphasized, isLink, ...renderProps})} >\n {composeRenderProps(children, (children, renderProps) => (\n <TagWrapper isInRealDOM={isInRealDOM} {...renderProps}>{typeof children === 'string' ? <Text>{children}</Text> : children}</TagWrapper>\n ))}\n </AriaTag>\n );\n}\n\n\n/** An individual Tag for TagGroups. */\nlet _Tag = /*#__PURE__*/ (forwardRef as forwardRefType)(Tag);\nexport {_Tag as Tag};\n\nfunction TagWrapper({children, isDisabled, allowsRemoving, isInRealDOM}) {\n let {size = 'M'} = useSlottedContext(TagGroupContext) ?? {};\n return (\n <>\n {isInRealDOM && (\n <div\n className={style({\n display: 'flex',\n minWidth: 0,\n alignItems: 'center',\n gap: 'text-to-visual',\n forcedColorAdjust: 'none',\n backgroundColor: 'transparent'\n })}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1, truncate: true})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }],\n [AvatarContext, {\n size: avatarSize[size],\n styles: style({order: 0})\n }],\n [ImageContext, {\n className: style({\n size: fontRelative(20),\n flexShrink: 0,\n order: 0,\n aspectRatio: 'square',\n objectFit: 'contain',\n borderRadius: 'sm'\n })\n }]\n ]}>\n {children}\n </Provider>\n </div>\n )}\n {!isInRealDOM && children}\n {allowsRemoving && isInRealDOM && (\n <ClearButton\n slot=\"remove\"\n size={size}\n isDisabled={isDisabled} />\n )}\n </>\n );\n}\n"],"names":[],"version":3,"file":"TagGroup.css.map"}
1
+ {"mappings":"ACoFuB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA2Ma;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA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;;;IAAA;;;;IAAA;;;;IAAA;;;;IAsEX;;;;IAqFP;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAkHC;;;;IAAA;;;;IAAA;;;;;;AAlHD;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAkHC","sources":["b7ca70995960d034","packages/@react-spectrum/s2/src/TagGroup.tsx"],"sourcesContent":["@import \"53ec8c3f8184f13f\";\n@import \"39511c3f261b5ed5\";\n@import \"0adf7c6cbf3a1f42\";\n@import \"05f90dba9e9f901e\";\n@import \"76f74241f914b430\";\n@import \"0ef2aba34cf241d8\";\n@import \"f86d9fb495210c39\";\n@import \"24a7cd4eab7f1ba0\";\n@import \"ce1f7d95b3ccf3fd\";\n@import \"70bbf6109092559b\";\n@import \"07833edfdb3bfcff\";\n@import \"ffbc1ae1f89af4e1\";\n@import \"c340d154a58b1eb0\";\n@import \"27e38777e711f6a4\";\n@import \"39f1002cc14ab33a\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from './ActionButton';\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagGroupProps as AriaTagGroupProps,\n TagProps as AriaTagProps,\n composeRenderProps,\n ContextValue,\n Provider,\n TextContext as RACTextContext,\n TagList,\n TagListProps,\n useLocale,\n useSlottedContext\n} from 'react-aria-components';\nimport {AvatarContext} from './Avatar';\nimport {CenterBaseline, centerBaseline} from './CenterBaseline';\nimport {ClearButton} from './ClearButton';\nimport {Collection, CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, HelpTextProps, Node, SpectrumLabelableProps} from '@react-types/shared';\nimport {field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldLabel} from './Field';\nimport {flushSync} from 'react-dom';\nimport {focusRing, fontRelative, style} from '../style' with { type: 'macro' };\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {IconContext} from './Icon';\nimport {ImageContext} from './Image';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEffectEvent, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n// Get types from RSP and extend those?\nexport interface TagProps extends Omit<AriaTagProps, 'children' | 'style' | 'className'> {\n /** The children of the tag. */\n children?: ReactNode\n}\n\nexport interface TagGroupProps<T> extends Omit<AriaTagGroupProps, 'children' | 'style' | 'className'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'>, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, StyleProps, Omit<HelpTextProps, 'errorMessage'> {\n /** A description for the tag group. */\n description?: ReactNode,\n /**\n * The size of the tag group.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** Whether the tags are displayed in an emphasized style. */\n isEmphasized?: boolean,\n /** Provides content to display when there are no items in the tag group. */\n renderEmptyState?: () => ReactNode,\n /** Whether the tags are displayed in a error state. */\n isInvalid?: boolean,\n /** An error message for the field. */\n errorMessage?: ReactNode,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number,\n /** The label to display on the action button. */\n groupActionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onGroupAction?: () => void\n}\n\nexport const TagGroupContext = createContext<ContextValue<TagGroupProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: 'text'\n});\n\nconst InternalTagGroupContext = createContext<TagGroupProps<any>>({});\n\nfunction TagGroup<T extends object>(props: TagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TagGroupContext);\n props = useFormProps(props);\n let {onRemove} = props;\n return (\n <InternalTagGroupContext.Provider value={{onRemove}}>\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TagGroupInner props={props} forwardedRef={ref} collection={collection} />}\n </CollectionBuilder>\n </InternalTagGroupContext.Provider>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nlet _TagGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(TagGroup);\nexport {_TagGroup as TagGroup};\n\nfunction TagGroupInner<T>({\n props: {\n label,\n description,\n labelPosition = 'top',\n labelAlign = 'start',\n isEmphasized,\n isInvalid,\n errorMessage,\n UNSAFE_className = '',\n UNSAFE_style,\n size = 'M',\n ...props\n },\n forwardedRef: ref,\n collection\n}: {props: TagGroupProps<T>, forwardedRef: DOMRef<HTMLDivElement>, collection: any}) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n maxRows,\n groupActionLabel,\n onGroupAction,\n renderEmptyState = () => stringFormatter.format('tag.noTags'),\n ...otherProps\n } = props;\n let {direction} = useLocale();\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let actionsRef = useRef<HTMLDivElement | null>(null);\n let hiddenTagsRef = useRef<HTMLDivElement | null>(null);\n let [tagState, setTagState] = useState({visibleTagCount: collection.size, showCollapseButton: false});\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let {onRemove} = useContext(InternalTagGroupContext);\n let isEmpty = collection.size === 0;\n let showCollapseToggleButton = tagState.showCollapseButton || tagState.visibleTagCount < collection.size;\n let formContext = useContext(FormContext);\n let domRef = useDOMRef(ref);\n\n let allItems = useMemo(\n () => Array.from(collection) as Array<Node<T>>,\n [collection]\n );\n let items = useMemo(\n () => Array.from(collection).slice(0, !isCollapsed ? collection.size : tagState.visibleTagCount) as Array<Node<T>>,\n [collection, tagState.visibleTagCount, isCollapsed]\n );\n\n let updateVisibleTagCount = useEffectEvent(() => {\n if (maxRows == null) {\n setTagState({visibleTagCount: collection.size, showCollapseButton: false});\n }\n\n if (maxRows != null && maxRows > 0) {\n let computeVisibleTagCount = () => {\n let currContainerRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currTagsRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || collection.size === 0 || currContainerRef.parentElement == null) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n // I think this is still a safe assumption, and we don't need to queryAll for role=tag\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = currActionsRef ? [...currActionsRef.children] : [];\n if (buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n let margins = parseFloat(getComputedStyle(buttons[0]).marginInlineStart);\n buttonsWidth += margins * 2;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement?.getBoundingClientRect()[end] - margins;\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += margins;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth <= buttonsWidth && index > 0) {\n let tagWidth = tagWidths.pop();\n if (tagWidth != null) {\n availableWidth += tagWidth;\n }\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < collection.size\n };\n };\n let result = computeVisibleTagCount();\n flushSync(() => {\n setTagState(result);\n });\n }\n });\n\n useResizeObserver({ref: maxRows != null ? containerRef : undefined, onResize: updateVisibleTagCount});\n\n useLayoutEffect(() => {\n if (collection.size > 0 && (maxRows != null && maxRows > 0)) {\n queueMicrotask(updateVisibleTagCount);\n }\n }, [collection.size, updateVisibleTagCount, maxRows]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let handlePressCollapse = () => {\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let helpText: ReactNode = null;\n if (!isInvalid && description) {\n helpText = (\n <Text\n slot=\"description\"\n styles={helpTextStyles({size})}>\n {description}\n </Text>\n );\n } else if (isInvalid) {\n helpText = (\n <div\n className={helpTextStyles({size, isInvalid})}>\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n <Text slot=\"errorMessage\">\n {errorMessage}\n </Text>\n </div>\n );\n }\n\n return (\n <AriaTagGroup\n {...otherProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size,\n labelPosition: labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n <FieldLabel\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <div\n ref={containerRef}\n className={style({\n gridArea: 'input',\n minWidth: 'full',\n marginStart: {\n default: -4,\n isEmpty: 0\n },\n marginEnd: {\n default: 4,\n isEmpty: 0\n },\n position: 'relative'\n })({isEmpty})}>\n <FormContext.Provider value={{...formContext, size}}>\n <Provider\n values={[\n [RACTextContext, undefined],\n [TagGroupContext, {size, isEmphasized}]\n ]}>\n {/* invisible collection for measuring */}\n {maxRows != null && (\n <div\n // @ts-ignore\n inert=\"true\"\n ref={hiddenTagsRef}\n className={style({\n display: 'inline',\n flexWrap: 'wrap',\n fontFamily: 'sans',\n position: 'absolute',\n top: 0,\n bottom: 0,\n start: -4,\n end: 4,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {allItems.map(item => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, allowsRemoving: Boolean(onRemove)})}>\n {item.props.children({size, allowsRemoving: Boolean(onRemove), isInCtx: true})}\n </div>\n );\n })}\n </div>\n )}\n {/* real tag list */}\n <TagList\n ref={tagsRef}\n items={items}\n renderEmptyState={renderEmptyState}\n className={style({\n display: 'inline',\n minWidth: 'full',\n font: 'ui'\n })}>\n {item => <_Tag {...item.props} id={item.key} textValue={item.textValue} />}\n </TagList>\n {!isEmpty && (showCollapseToggleButton || groupActionLabel) &&\n <ActionGroup\n collection={collection}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n actionsRef={actionsRef}\n tagState={tagState}\n size={size}\n isCollapsed={isCollapsed}\n handlePressCollapse={handlePressCollapse}\n onGroupAction={onGroupAction}\n groupActionLabel={groupActionLabel} />\n }\n </Provider>\n </FormContext.Provider>\n </div>\n {helpText}\n </AriaTagGroup>\n );\n}\n\nfunction ActionGroup(props) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n actionsRef,\n tagState,\n size,\n isCollapsed,\n handlePressCollapse,\n onGroupAction,\n groupActionLabel,\n collection,\n // directly use aria-labelling from the TagGroup because we can't use the id from the TagList\n // and we can't supply an id to the TagList because it'll cause an issue where all the tag ids flip back\n // and forth with their prefix in an infinite loop\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n let actionsId = useId();\n // might need to localize the aria-label which concatenates with this label\n let actionGroupLabel = stringFormatter.format('tag.actions');\n return (\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={ariaLabel ? `${ariaLabel} ${actionGroupLabel}` : actionGroupLabel}\n aria-labelledby={ariaLabelledBy ? ariaLabelledBy : undefined}\n className={style({\n display: 'inline'\n })}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={handlePressCollapse}>\n {isCollapsed ?\n stringFormatter.format('tag.showAllButtonLabel', {tagCount: collection.size}) :\n stringFormatter.format('tag.hideButtonLabel')}\n </ActionButton>\n }\n {groupActionLabel && onGroupAction &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={() => onGroupAction?.()}>\n {groupActionLabel}\n </ActionButton>\n }\n </div>\n );\n}\n\nconst tagStyles = style({\n ...focusRing(),\n display: 'inline-flex',\n boxSizing: 'border-box',\n maxWidth: 'full',\n verticalAlign: 'middle',\n alignItems: 'center',\n justifyContent: 'center',\n font: 'control',\n height: 'control',\n transition: 'default',\n minWidth: 0,\n // maxWidth: '[calc(self(height) * 7)]', // s2 designs show a max width on tags but we pushed back on this in v3\n backgroundColor: {\n default: 'gray-100',\n isHovered: {\n default: 'gray-200'\n },\n isFocusVisible: {\n default: 'gray-200'\n },\n isSelected: {\n default: 'neutral',\n isEmphasized: {\n default: 'accent'\n }\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace',\n isSelected: 'Highlight'\n }\n },\n color: {\n default: 'neutral',\n isSelected: {\n default: 'gray-25',\n isEmphasized: 'white'\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isSelected: 'HighlightText',\n isDisabled: 'GrayText'\n }\n },\n borderStyle: 'none',\n paddingStart: {\n default: 'edge-to-text'\n },\n paddingEnd: {\n default: 'edge-to-text',\n allowsRemoving: 0\n },\n paddingY: 0,\n margin: 4,\n borderRadius: 'control',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2)\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst avatarSize = {\n S: 16,\n M: 20,\n L: 24\n} as const;\n\nfunction Tag({children, textValue, ...props}: TagProps, ref: DOMRef<HTMLDivElement>) {\n textValue ||= typeof children === 'string' ? children : undefined;\n let ctx = useSlottedContext(TagGroupContext);\n let isInRealDOM = Boolean(ctx?.size);\n let {size, isEmphasized} = ctx ?? {};\n let domRef = useDOMRef(ref);\n\n let backupRef = useRef(null);\n domRef = domRef || backupRef;\n let isLink = props.href != null;\n return (\n <AriaTag\n textValue={textValue}\n {...props}\n ref={domRef}\n style={pressScale(domRef)}\n className={renderProps => tagStyles({size, isEmphasized, isLink, ...renderProps})} >\n {composeRenderProps(children, (children, renderProps) => (\n <TagWrapper isInRealDOM={isInRealDOM} {...renderProps}>{typeof children === 'string' ? <Text>{children}</Text> : children}</TagWrapper>\n ))}\n </AriaTag>\n );\n}\n\n\n/** An individual Tag for TagGroups. */\nlet _Tag = /*#__PURE__*/ (forwardRef as forwardRefType)(Tag);\nexport {_Tag as Tag};\n\nfunction TagWrapper({children, isDisabled, allowsRemoving, isInRealDOM}) {\n let {size = 'M'} = useSlottedContext(TagGroupContext) ?? {};\n return (\n <>\n {isInRealDOM && (\n <div\n className={style({\n display: 'flex',\n minWidth: 0,\n alignItems: 'center',\n gap: 'text-to-visual',\n forcedColorAdjust: 'none',\n backgroundColor: 'transparent'\n })}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1, truncate: true})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }],\n [AvatarContext, {\n size: avatarSize[size],\n styles: style({order: 0})\n }],\n [ImageContext, {\n styles: style({\n size: fontRelative(20),\n flexShrink: 0,\n order: 0,\n aspectRatio: 'square',\n objectFit: 'contain',\n borderRadius: 'sm'\n })\n }]\n ]}>\n {children}\n </Provider>\n </div>\n )}\n {!isInRealDOM && children}\n {allowsRemoving && isInRealDOM && (\n <ClearButton\n slot=\"remove\"\n size={size}\n isDisabled={isDisabled} />\n )}\n </>\n );\n}\n"],"names":[],"version":3,"file":"TagGroup.css.map"}
package/dist/TagGroup.mjs CHANGED
@@ -7,9 +7,10 @@ import {ClearButton as $f6a62e6e68437458$export$13ec83e50bf04290} from "./ClearB
7
7
  import {FieldLabel as $9afd80978c252040$export$1acdcf5a973a8414} from "./Field.mjs";
8
8
  import {FormContext as $9b916426527cebe7$export$c24727297075ec6a, useFormProps as $9b916426527cebe7$export$a6b5be5c6b451665} from "./Form.mjs";
9
9
  import {IconContext as $ac8c32e6775ddd1f$export$a49f528ae1a4d0ed} from "../icons/Icon.mjs";
10
- import {ImageContext as $8e847109a6ab556d$export$8151eb379fcf2442, Text as $8e847109a6ab556d$export$5f1af8db9871e1d6, TextContext as $8e847109a6ab556d$export$9afb8bc826b033ea} from "./Content.mjs";
10
+ import {ImageContext as $dbd6f0b2503b938c$export$8151eb379fcf2442} from "./Image.mjs";
11
11
  import $kY5I6$intlStringsmjs from "./intlStrings.mjs";
12
12
  import {pressScale as $10ea7662e51a285b$export$56e8cba416805d8d} from "./pressScale.mjs";
13
+ import {Text as $8e847109a6ab556d$export$5f1af8db9871e1d6, TextContext as $8e847109a6ab556d$export$9afb8bc826b033ea} from "./Content.mjs";
13
14
  import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "./useSpectrumContextProps.mjs";
14
15
  import {jsx as $kY5I6$jsx, jsxs as $kY5I6$jsxs, Fragment as $kY5I6$Fragment} from "react/jsx-runtime";
15
16
  import {useLocale as $kY5I6$useLocale, TagGroup as $kY5I6$TagGroup, Provider as $kY5I6$Provider, TextContext as $kY5I6$TextContext, TagList as $kY5I6$TagList, useSlottedContext as $kY5I6$useSlottedContext, Tag as $kY5I6$Tag, composeRenderProps as $kY5I6$composeRenderProps} from "react-aria-components";
@@ -54,6 +55,7 @@ function $parcel$interopDefault(a) {
54
55
 
55
56
 
56
57
 
58
+
57
59
  const $1d63bfab43d9ffe1$export$5b07b5dd2cbd96e3 = /*#__PURE__*/ (0, $kY5I6$createContext)(null);
58
60
  const $1d63bfab43d9ffe1$var$helpTextStyles = function anonymous(props) {
59
61
  let rules = " .";
@@ -661,9 +663,9 @@ function $1d63bfab43d9ffe1$var$TagWrapper({ children: children, isDisabled: isDi
661
663
  }
662
664
  ],
663
665
  [
664
- (0, $8e847109a6ab556d$export$8151eb379fcf2442),
666
+ (0, $dbd6f0b2503b938c$export$8151eb379fcf2442),
665
667
  {
666
- className: " . l-1sthc3k k-1sthc3k _8-3t1x __A-3t1x _bb __Na _vb _wb _xb _yb"
668
+ styles: " . l-1sthc3k k-1sthc3k _8-3t1x __A-3t1x _bb __Na _vb _wb _xb _yb"
667
669
  }
668
670
  ]
669
671
  ],
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AAuEM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAiE;AAE5G,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN,MAAM,8DAA0B,CAAA,GAAA,oBAAY,EAAsB,CAAC;AAEnE,SAAS,+BAA2B,KAAuB,EAAE,GAA2B;IACtF,CAAC,OAAO,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CAAU;sBAAC;8BAAM;wBAAc;gBAAQ,GAAG,WAAW;YAAA;kBAC9E,CAAA,GAAA,yBAAiB,EAAE,UAAU,CAAC,UAAU,4BACvC,gBAAC;gBAAW,aAAa;gBAAc,GAAG,WAAW;0BAAG,OAAO,aAAa,yBAAW,gBAAC,CAAA,GAAA,yCAAG;8BAAG;qBAAmB;;;AAIzH;AAGA,qCAAqC,GACrC,IAAI,4CAAqB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB;AAGxD,SAAS,iCAAW,YAAC,QAAQ,cAAE,UAAU,kBAAE,cAAc,eAAE,WAAW,EAAC;IACrE,IAAI,QAAC,OAAO,KAAI,GAAG,CAAA,GAAA,wBAAgB,EAAE,8CAAoB,CAAC;IAC1D,qBACE;;YACG,6BACD,gBAAC;gBACC,SAAS;0BAQT,cAAA,gBAAC,CAAA,GAAA,eAAO;oBACN,QAAQ;wBACN;4BAAC,CAAA,GAAA,yCAAU;4BAAG;gCAAC,MAAM;4BAAmC;yBAAE;wBAC1D;4BAAC,CAAA,GAAA,yCAAU;4BAAG;gCACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;oCAAC,MAAM;oCAAQ,MAAM;gCAAmB;gCAC/D,MAAM;4BACR;yBAAE;wBACF;4BAAC,CAAA,GAAA,yCAAY;4BAAG;gCACd,MAAM,gCAAU,CAAC,KAAK;gCACtB,MAAM;4BACR;yBAAE;wBACF;4BAAC,CAAA,GAAA,yCAAW;4BAAG;gCACb,SAAS;4BAQX;yBAAE;qBACH;8BACA;;;YAIJ,CAAC,eAAe;YAChB,kBAAkB,6BACjB,gBAAC,CAAA,GAAA,yCAAU;gBACT,MAAK;gBACL,MAAM;gBACN,YAAY;;;;AAItB","sources":["packages/@react-spectrum/s2/src/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from './ActionButton';\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagGroupProps as AriaTagGroupProps,\n TagProps as AriaTagProps,\n composeRenderProps,\n ContextValue,\n Provider,\n TextContext as RACTextContext,\n TagList,\n TagListProps,\n useLocale,\n useSlottedContext\n} from 'react-aria-components';\nimport {AvatarContext} from './Avatar';\nimport {CenterBaseline, centerBaseline} from './CenterBaseline';\nimport {ClearButton} from './ClearButton';\nimport {Collection, CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, HelpTextProps, Node, SpectrumLabelableProps} from '@react-types/shared';\nimport {field, focusRing, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldLabel} from './Field';\nimport {flushSync} from 'react-dom';\nimport {fontRelative, style} from '../style/spectrum-theme' with { type: 'macro' };\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {IconContext} from './Icon';\nimport {ImageContext, Text, TextContext} from './Content';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEffectEvent, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n// Get types from RSP and extend those?\nexport interface TagProps extends Omit<AriaTagProps, 'children' | 'style' | 'className'> {\n /** The children of the tag. */\n children?: ReactNode\n}\n\nexport interface TagGroupProps<T> extends Omit<AriaTagGroupProps, 'children' | 'style' | 'className'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'>, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, StyleProps, Omit<HelpTextProps, 'errorMessage'> {\n /** A description for the tag group. */\n description?: ReactNode,\n /**\n * The size of the tag group.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** Whether the tags are displayed in an emphasized style. */\n isEmphasized?: boolean,\n /** Provides content to display when there are no items in the tag group. */\n renderEmptyState?: () => ReactNode,\n /** Whether the tags are displayed in a error state. */\n isInvalid?: boolean,\n /** An error message for the field. */\n errorMessage?: ReactNode,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number,\n /** The label to display on the action button. */\n groupActionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onGroupAction?: () => void\n}\n\nexport const TagGroupContext = createContext<ContextValue<TagGroupProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: 'text'\n});\n\nconst InternalTagGroupContext = createContext<TagGroupProps<any>>({});\n\nfunction TagGroup<T extends object>(props: TagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TagGroupContext);\n props = useFormProps(props);\n let {onRemove} = props;\n return (\n <InternalTagGroupContext.Provider value={{onRemove}}>\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TagGroupInner props={props} forwardedRef={ref} collection={collection} />}\n </CollectionBuilder>\n </InternalTagGroupContext.Provider>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nlet _TagGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(TagGroup);\nexport {_TagGroup as TagGroup};\n\nfunction TagGroupInner<T>({\n props: {\n label,\n description,\n labelPosition = 'top',\n labelAlign = 'start',\n isEmphasized,\n isInvalid,\n errorMessage,\n UNSAFE_className = '',\n UNSAFE_style,\n size = 'M',\n ...props\n },\n forwardedRef: ref,\n collection\n}: {props: TagGroupProps<T>, forwardedRef: DOMRef<HTMLDivElement>, collection: any}) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n maxRows,\n groupActionLabel,\n onGroupAction,\n renderEmptyState = () => stringFormatter.format('tag.noTags'),\n ...otherProps\n } = props;\n let {direction} = useLocale();\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let actionsRef = useRef<HTMLDivElement | null>(null);\n let hiddenTagsRef = useRef<HTMLDivElement | null>(null);\n let [tagState, setTagState] = useState({visibleTagCount: collection.size, showCollapseButton: false});\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let {onRemove} = useContext(InternalTagGroupContext);\n let isEmpty = collection.size === 0;\n let showCollapseToggleButton = tagState.showCollapseButton || tagState.visibleTagCount < collection.size;\n let formContext = useContext(FormContext);\n let domRef = useDOMRef(ref);\n\n let allItems = useMemo(\n () => Array.from(collection) as Array<Node<T>>,\n [collection]\n );\n let items = useMemo(\n () => Array.from(collection).slice(0, !isCollapsed ? collection.size : tagState.visibleTagCount) as Array<Node<T>>,\n [collection, tagState.visibleTagCount, isCollapsed]\n );\n\n let updateVisibleTagCount = useEffectEvent(() => {\n if (maxRows == null) {\n setTagState({visibleTagCount: collection.size, showCollapseButton: false});\n }\n\n if (maxRows != null && maxRows > 0) {\n let computeVisibleTagCount = () => {\n let currContainerRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currTagsRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || collection.size === 0 || currContainerRef.parentElement == null) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n // I think this is still a safe assumption, and we don't need to queryAll for role=tag\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = currActionsRef ? [...currActionsRef.children] : [];\n if (buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n let margins = parseFloat(getComputedStyle(buttons[0]).marginInlineStart);\n buttonsWidth += margins * 2;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement?.getBoundingClientRect()[end] - margins;\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += margins;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth <= buttonsWidth && index > 0) {\n let tagWidth = tagWidths.pop();\n if (tagWidth != null) {\n availableWidth += tagWidth;\n }\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < collection.size\n };\n };\n let result = computeVisibleTagCount();\n flushSync(() => {\n setTagState(result);\n });\n }\n });\n\n useResizeObserver({ref: maxRows != null ? containerRef : undefined, onResize: updateVisibleTagCount});\n\n useLayoutEffect(() => {\n if (collection.size > 0 && (maxRows != null && maxRows > 0)) {\n queueMicrotask(updateVisibleTagCount);\n }\n }, [collection.size, updateVisibleTagCount, maxRows]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let handlePressCollapse = () => {\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let helpText: ReactNode = null;\n if (!isInvalid && description) {\n helpText = (\n <Text\n slot=\"description\"\n styles={helpTextStyles({size})}>\n {description}\n </Text>\n );\n } else if (isInvalid) {\n helpText = (\n <div\n className={helpTextStyles({size, isInvalid})}>\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n <Text slot=\"errorMessage\">\n {errorMessage}\n </Text>\n </div>\n );\n }\n\n return (\n <AriaTagGroup\n {...otherProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size,\n labelPosition: labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n <FieldLabel\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <div\n ref={containerRef}\n className={style({\n gridArea: 'input',\n minWidth: 'full',\n marginStart: {\n default: -4,\n isEmpty: 0\n },\n marginEnd: {\n default: 4,\n isEmpty: 0\n },\n position: 'relative'\n })({isEmpty})}>\n <FormContext.Provider value={{...formContext, size}}>\n <Provider\n values={[\n [RACTextContext, undefined],\n [TagGroupContext, {size, isEmphasized}]\n ]}>\n {/* invisible collection for measuring */}\n {maxRows != null && (\n <div\n // @ts-ignore\n inert=\"true\"\n ref={hiddenTagsRef}\n className={style({\n display: 'inline',\n flexWrap: 'wrap',\n fontFamily: 'sans',\n position: 'absolute',\n top: 0,\n bottom: 0,\n start: -4,\n end: 4,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {allItems.map(item => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, allowsRemoving: Boolean(onRemove)})}>\n {item.props.children({size, allowsRemoving: Boolean(onRemove), isInCtx: true})}\n </div>\n );\n })}\n </div>\n )}\n {/* real tag list */}\n <TagList\n ref={tagsRef}\n items={items}\n renderEmptyState={renderEmptyState}\n className={style({\n display: 'inline',\n minWidth: 'full',\n font: 'ui'\n })}>\n {item => <_Tag {...item.props} id={item.key} textValue={item.textValue} />}\n </TagList>\n {!isEmpty && (showCollapseToggleButton || groupActionLabel) &&\n <ActionGroup\n collection={collection}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n actionsRef={actionsRef}\n tagState={tagState}\n size={size}\n isCollapsed={isCollapsed}\n handlePressCollapse={handlePressCollapse}\n onGroupAction={onGroupAction}\n groupActionLabel={groupActionLabel} />\n }\n </Provider>\n </FormContext.Provider>\n </div>\n {helpText}\n </AriaTagGroup>\n );\n}\n\nfunction ActionGroup(props) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n actionsRef,\n tagState,\n size,\n isCollapsed,\n handlePressCollapse,\n onGroupAction,\n groupActionLabel,\n collection,\n // directly use aria-labelling from the TagGroup because we can't use the id from the TagList\n // and we can't supply an id to the TagList because it'll cause an issue where all the tag ids flip back\n // and forth with their prefix in an infinite loop\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n let actionsId = useId();\n // might need to localize the aria-label which concatenates with this label\n let actionGroupLabel = stringFormatter.format('tag.actions');\n return (\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={ariaLabel ? `${ariaLabel} ${actionGroupLabel}` : actionGroupLabel}\n aria-labelledby={ariaLabelledBy ? ariaLabelledBy : undefined}\n className={style({\n display: 'inline'\n })}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={handlePressCollapse}>\n {isCollapsed ?\n stringFormatter.format('tag.showAllButtonLabel', {tagCount: collection.size}) :\n stringFormatter.format('tag.hideButtonLabel')}\n </ActionButton>\n }\n {groupActionLabel && onGroupAction &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={() => onGroupAction?.()}>\n {groupActionLabel}\n </ActionButton>\n }\n </div>\n );\n}\n\nconst tagStyles = style({\n ...focusRing(),\n display: 'inline-flex',\n boxSizing: 'border-box',\n maxWidth: 'full',\n verticalAlign: 'middle',\n alignItems: 'center',\n justifyContent: 'center',\n font: 'control',\n height: 'control',\n transition: 'default',\n minWidth: 0,\n // maxWidth: '[calc(self(height) * 7)]', // s2 designs show a max width on tags but we pushed back on this in v3\n backgroundColor: {\n default: 'gray-100',\n isHovered: {\n default: 'gray-200'\n },\n isFocusVisible: {\n default: 'gray-200'\n },\n isSelected: {\n default: 'neutral',\n isEmphasized: {\n default: 'accent'\n }\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace',\n isSelected: 'Highlight'\n }\n },\n color: {\n default: 'neutral',\n isSelected: {\n default: 'gray-25',\n isEmphasized: 'white'\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isSelected: 'HighlightText',\n isDisabled: 'GrayText'\n }\n },\n borderStyle: 'none',\n paddingStart: {\n default: 'edge-to-text'\n },\n paddingEnd: {\n default: 'edge-to-text',\n allowsRemoving: 0\n },\n paddingY: 0,\n margin: 4,\n borderRadius: 'control',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2)\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst avatarSize = {\n S: 16,\n M: 20,\n L: 24\n} as const;\n\nfunction Tag({children, textValue, ...props}: TagProps, ref: DOMRef<HTMLDivElement>) {\n textValue ||= typeof children === 'string' ? children : undefined;\n let ctx = useSlottedContext(TagGroupContext);\n let isInRealDOM = Boolean(ctx?.size);\n let {size, isEmphasized} = ctx ?? {};\n let domRef = useDOMRef(ref);\n\n let backupRef = useRef(null);\n domRef = domRef || backupRef;\n let isLink = props.href != null;\n return (\n <AriaTag\n textValue={textValue}\n {...props}\n ref={domRef}\n style={pressScale(domRef)}\n className={renderProps => tagStyles({size, isEmphasized, isLink, ...renderProps})} >\n {composeRenderProps(children, (children, renderProps) => (\n <TagWrapper isInRealDOM={isInRealDOM} {...renderProps}>{typeof children === 'string' ? <Text>{children}</Text> : children}</TagWrapper>\n ))}\n </AriaTag>\n );\n}\n\n\n/** An individual Tag for TagGroups. */\nlet _Tag = /*#__PURE__*/ (forwardRef as forwardRefType)(Tag);\nexport {_Tag as Tag};\n\nfunction TagWrapper({children, isDisabled, allowsRemoving, isInRealDOM}) {\n let {size = 'M'} = useSlottedContext(TagGroupContext) ?? {};\n return (\n <>\n {isInRealDOM && (\n <div\n className={style({\n display: 'flex',\n minWidth: 0,\n alignItems: 'center',\n gap: 'text-to-visual',\n forcedColorAdjust: 'none',\n backgroundColor: 'transparent'\n })}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1, truncate: true})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }],\n [AvatarContext, {\n size: avatarSize[size],\n styles: style({order: 0})\n }],\n [ImageContext, {\n className: style({\n size: fontRelative(20),\n flexShrink: 0,\n order: 0,\n aspectRatio: 'square',\n objectFit: 'contain',\n borderRadius: 'sm'\n })\n }]\n ]}>\n {children}\n </Provider>\n </div>\n )}\n {!isInRealDOM && children}\n {allowsRemoving && isInRealDOM && (\n <ClearButton\n slot=\"remove\"\n size={size}\n isDisabled={isDisabled} />\n )}\n </>\n );\n}\n"],"names":[],"version":3,"file":"TagGroup.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;AAwEM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAiE;AAE5G,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN,MAAM,8DAA0B,CAAA,GAAA,oBAAY,EAAsB,CA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K;QACL,OAAO,CAAA,GAAA,yCAAS,EAAE;QAClB,WAAW,CAAA,cAAe,gCAAU;sBAAC;8BAAM;wBAAc;gBAAQ,GAAG,WAAW;YAAA;kBAC9E,CAAA,GAAA,yBAAiB,EAAE,UAAU,CAAC,UAAU,4BACvC,gBAAC;gBAAW,aAAa;gBAAc,GAAG,WAAW;0BAAG,OAAO,aAAa,yBAAW,gBAAC,CAAA,GAAA,yCAAG;8BAAG;qBAAmB;;;AAIzH;AAGA,qCAAqC,GACrC,IAAI,4CAAqB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB;AAGxD,SAAS,iCAAW,YAAC,QAAQ,cAAE,UAAU,kBAAE,cAAc,eAAE,WAAW,EAAC;IACrE,IAAI,QAAC,OAAO,KAAI,GAAG,CAAA,GAAA,wBAAgB,EAAE,8CAAoB,CAAC;IAC1D,qBACE;;YACG,6BACD,gBAAC;gBACC,SAAS;0BAQT,cAAA,gBAAC,CAAA,GAAA,eAAO;oBACN,QAAQ;wBACN;4BAAC,CAAA,GAAA,yCAAU;4BAAG;gCAAC,MAAM;4BAAmC;yBAAE;wBAC1D;4BAAC,CAAA,GAAA,yCAAU;4BAAG;gCACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;oCAAC,MAAM;oCAAQ,MAAM;gCAAmB;gCAC/D,MAAM;4BACR;yBAAE;wBACF;4BAAC,CAAA,GAAA,yCAAY;4BAAG;gCACd,MAAM,gCAAU,CAAC,KAAK;gCACtB,MAAM;4BACR;yBAAE;wBACF;4BAAC,CAAA,GAAA,yCAAW;4BAAG;gCACb,MAAM;4BAQR;yBAAE;qBACH;8BACA;;;YAIJ,CAAC,eAAe;YAChB,kBAAkB,6BACjB,gBAAC,CAAA,GAAA,yCAAU;gBACT,MAAK;gBACL,MAAM;gBACN,YAAY;;;;AAItB","sources":["packages/@react-spectrum/s2/src/TagGroup.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from './ActionButton';\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {\n Tag as AriaTag,\n TagGroup as AriaTagGroup,\n TagGroupProps as AriaTagGroupProps,\n TagProps as AriaTagProps,\n composeRenderProps,\n ContextValue,\n Provider,\n TextContext as RACTextContext,\n TagList,\n TagListProps,\n useLocale,\n useSlottedContext\n} from 'react-aria-components';\nimport {AvatarContext} from './Avatar';\nimport {CenterBaseline, centerBaseline} from './CenterBaseline';\nimport {ClearButton} from './ClearButton';\nimport {Collection, CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {DOMRef, DOMRefValue, HelpTextProps, Node, SpectrumLabelableProps} from '@react-types/shared';\nimport {field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldLabel} from './Field';\nimport {flushSync} from 'react-dom';\nimport {focusRing, fontRelative, style} from '../style' with { type: 'macro' };\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {IconContext} from './Icon';\nimport {ImageContext} from './Image';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEffectEvent, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n// Get types from RSP and extend those?\nexport interface TagProps extends Omit<AriaTagProps, 'children' | 'style' | 'className'> {\n /** The children of the tag. */\n children?: ReactNode\n}\n\nexport interface TagGroupProps<T> extends Omit<AriaTagGroupProps, 'children' | 'style' | 'className'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'>, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, StyleProps, Omit<HelpTextProps, 'errorMessage'> {\n /** A description for the tag group. */\n description?: ReactNode,\n /**\n * The size of the tag group.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** Whether the tags are displayed in an emphasized style. */\n isEmphasized?: boolean,\n /** Provides content to display when there are no items in the tag group. */\n renderEmptyState?: () => ReactNode,\n /** Whether the tags are displayed in a error state. */\n isInvalid?: boolean,\n /** An error message for the field. */\n errorMessage?: ReactNode,\n /** Limit the number of rows initially shown. This will render a button that allows the user to expand to show all tags. */\n maxRows?: number,\n /** The label to display on the action button. */\n groupActionLabel?: string,\n /** Handler that is called when the action button is pressed. */\n onGroupAction?: () => void\n}\n\nexport const TagGroupContext = createContext<ContextValue<TagGroupProps<any>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: 'text'\n});\n\nconst InternalTagGroupContext = createContext<TagGroupProps<any>>({});\n\nfunction TagGroup<T extends object>(props: TagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TagGroupContext);\n props = useFormProps(props);\n let {onRemove} = props;\n return (\n <InternalTagGroupContext.Provider value={{onRemove}}>\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TagGroupInner props={props} forwardedRef={ref} collection={collection} />}\n </CollectionBuilder>\n </InternalTagGroupContext.Provider>\n );\n}\n\n/** Tags allow users to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request. */\nlet _TagGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(TagGroup);\nexport {_TagGroup as TagGroup};\n\nfunction TagGroupInner<T>({\n props: {\n label,\n description,\n labelPosition = 'top',\n labelAlign = 'start',\n isEmphasized,\n isInvalid,\n errorMessage,\n UNSAFE_className = '',\n UNSAFE_style,\n size = 'M',\n ...props\n },\n forwardedRef: ref,\n collection\n}: {props: TagGroupProps<T>, forwardedRef: DOMRef<HTMLDivElement>, collection: any}) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n maxRows,\n groupActionLabel,\n onGroupAction,\n renderEmptyState = () => stringFormatter.format('tag.noTags'),\n ...otherProps\n } = props;\n let {direction} = useLocale();\n let containerRef = useRef(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let actionsRef = useRef<HTMLDivElement | null>(null);\n let hiddenTagsRef = useRef<HTMLDivElement | null>(null);\n let [tagState, setTagState] = useState({visibleTagCount: collection.size, showCollapseButton: false});\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let {onRemove} = useContext(InternalTagGroupContext);\n let isEmpty = collection.size === 0;\n let showCollapseToggleButton = tagState.showCollapseButton || tagState.visibleTagCount < collection.size;\n let formContext = useContext(FormContext);\n let domRef = useDOMRef(ref);\n\n let allItems = useMemo(\n () => Array.from(collection) as Array<Node<T>>,\n [collection]\n );\n let items = useMemo(\n () => Array.from(collection).slice(0, !isCollapsed ? collection.size : tagState.visibleTagCount) as Array<Node<T>>,\n [collection, tagState.visibleTagCount, isCollapsed]\n );\n\n let updateVisibleTagCount = useEffectEvent(() => {\n if (maxRows == null) {\n setTagState({visibleTagCount: collection.size, showCollapseButton: false});\n }\n\n if (maxRows != null && maxRows > 0) {\n let computeVisibleTagCount = () => {\n let currContainerRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currTagsRef: HTMLDivElement | null = hiddenTagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || collection.size === 0 || currContainerRef.parentElement == null) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n // I think this is still a safe assumption, and we don't need to queryAll for role=tag\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = currActionsRef ? [...currActionsRef.children] : [];\n if (buttons.length > 0 && rowCount >= maxRows) {\n let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);\n let margins = parseFloat(getComputedStyle(buttons[0]).marginInlineStart);\n buttonsWidth += margins * 2;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement?.getBoundingClientRect()[end] - margins;\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += margins;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth <= buttonsWidth && index > 0) {\n let tagWidth = tagWidths.pop();\n if (tagWidth != null) {\n availableWidth += tagWidth;\n }\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < collection.size\n };\n };\n let result = computeVisibleTagCount();\n flushSync(() => {\n setTagState(result);\n });\n }\n });\n\n useResizeObserver({ref: maxRows != null ? containerRef : undefined, onResize: updateVisibleTagCount});\n\n useLayoutEffect(() => {\n if (collection.size > 0 && (maxRows != null && maxRows > 0)) {\n queueMicrotask(updateVisibleTagCount);\n }\n }, [collection.size, updateVisibleTagCount, maxRows]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let handlePressCollapse = () => {\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let helpText: ReactNode = null;\n if (!isInvalid && description) {\n helpText = (\n <Text\n slot=\"description\"\n styles={helpTextStyles({size})}>\n {description}\n </Text>\n );\n } else if (isInvalid) {\n helpText = (\n <div\n className={helpTextStyles({size, isInvalid})}>\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n <Text slot=\"errorMessage\">\n {errorMessage}\n </Text>\n </div>\n );\n }\n\n return (\n <AriaTagGroup\n {...otherProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size,\n labelPosition: labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n <FieldLabel\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <div\n ref={containerRef}\n className={style({\n gridArea: 'input',\n minWidth: 'full',\n marginStart: {\n default: -4,\n isEmpty: 0\n },\n marginEnd: {\n default: 4,\n isEmpty: 0\n },\n position: 'relative'\n })({isEmpty})}>\n <FormContext.Provider value={{...formContext, size}}>\n <Provider\n values={[\n [RACTextContext, undefined],\n [TagGroupContext, {size, isEmphasized}]\n ]}>\n {/* invisible collection for measuring */}\n {maxRows != null && (\n <div\n // @ts-ignore\n inert=\"true\"\n ref={hiddenTagsRef}\n className={style({\n display: 'inline',\n flexWrap: 'wrap',\n fontFamily: 'sans',\n position: 'absolute',\n top: 0,\n bottom: 0,\n start: -4,\n end: 4,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {allItems.map(item => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, allowsRemoving: Boolean(onRemove)})}>\n {item.props.children({size, allowsRemoving: Boolean(onRemove), isInCtx: true})}\n </div>\n );\n })}\n </div>\n )}\n {/* real tag list */}\n <TagList\n ref={tagsRef}\n items={items}\n renderEmptyState={renderEmptyState}\n className={style({\n display: 'inline',\n minWidth: 'full',\n font: 'ui'\n })}>\n {item => <_Tag {...item.props} id={item.key} textValue={item.textValue} />}\n </TagList>\n {!isEmpty && (showCollapseToggleButton || groupActionLabel) &&\n <ActionGroup\n collection={collection}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n actionsRef={actionsRef}\n tagState={tagState}\n size={size}\n isCollapsed={isCollapsed}\n handlePressCollapse={handlePressCollapse}\n onGroupAction={onGroupAction}\n groupActionLabel={groupActionLabel} />\n }\n </Provider>\n </FormContext.Provider>\n </div>\n {helpText}\n </AriaTagGroup>\n );\n}\n\nfunction ActionGroup(props) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n actionsRef,\n tagState,\n size,\n isCollapsed,\n handlePressCollapse,\n onGroupAction,\n groupActionLabel,\n collection,\n // directly use aria-labelling from the TagGroup because we can't use the id from the TagList\n // and we can't supply an id to the TagList because it'll cause an issue where all the tag ids flip back\n // and forth with their prefix in an infinite loop\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n let actionsId = useId();\n // might need to localize the aria-label which concatenates with this label\n let actionGroupLabel = stringFormatter.format('tag.actions');\n return (\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={ariaLabel ? `${ariaLabel} ${actionGroupLabel}` : actionGroupLabel}\n aria-labelledby={ariaLabelledBy ? ariaLabelledBy : undefined}\n className={style({\n display: 'inline'\n })}>\n {tagState.showCollapseButton &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={handlePressCollapse}>\n {isCollapsed ?\n stringFormatter.format('tag.showAllButtonLabel', {tagCount: collection.size}) :\n stringFormatter.format('tag.hideButtonLabel')}\n </ActionButton>\n }\n {groupActionLabel && onGroupAction &&\n <ActionButton\n isQuiet\n size={size}\n styles={style({margin: 4})}\n UNSAFE_style={{display: 'inline-flex'}}\n onPress={() => onGroupAction?.()}>\n {groupActionLabel}\n </ActionButton>\n }\n </div>\n );\n}\n\nconst tagStyles = style({\n ...focusRing(),\n display: 'inline-flex',\n boxSizing: 'border-box',\n maxWidth: 'full',\n verticalAlign: 'middle',\n alignItems: 'center',\n justifyContent: 'center',\n font: 'control',\n height: 'control',\n transition: 'default',\n minWidth: 0,\n // maxWidth: '[calc(self(height) * 7)]', // s2 designs show a max width on tags but we pushed back on this in v3\n backgroundColor: {\n default: 'gray-100',\n isHovered: {\n default: 'gray-200'\n },\n isFocusVisible: {\n default: 'gray-200'\n },\n isSelected: {\n default: 'neutral',\n isEmphasized: {\n default: 'accent'\n }\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace',\n isSelected: 'Highlight'\n }\n },\n color: {\n default: 'neutral',\n isSelected: {\n default: 'gray-25',\n isEmphasized: 'white'\n },\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isSelected: 'HighlightText',\n isDisabled: 'GrayText'\n }\n },\n borderStyle: 'none',\n paddingStart: {\n default: 'edge-to-text'\n },\n paddingEnd: {\n default: 'edge-to-text',\n allowsRemoving: 0\n },\n paddingY: 0,\n margin: 4,\n borderRadius: 'control',\n cursor: {\n default: 'default',\n isLink: 'pointer'\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2)\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst avatarSize = {\n S: 16,\n M: 20,\n L: 24\n} as const;\n\nfunction Tag({children, textValue, ...props}: TagProps, ref: DOMRef<HTMLDivElement>) {\n textValue ||= typeof children === 'string' ? children : undefined;\n let ctx = useSlottedContext(TagGroupContext);\n let isInRealDOM = Boolean(ctx?.size);\n let {size, isEmphasized} = ctx ?? {};\n let domRef = useDOMRef(ref);\n\n let backupRef = useRef(null);\n domRef = domRef || backupRef;\n let isLink = props.href != null;\n return (\n <AriaTag\n textValue={textValue}\n {...props}\n ref={domRef}\n style={pressScale(domRef)}\n className={renderProps => tagStyles({size, isEmphasized, isLink, ...renderProps})} >\n {composeRenderProps(children, (children, renderProps) => (\n <TagWrapper isInRealDOM={isInRealDOM} {...renderProps}>{typeof children === 'string' ? <Text>{children}</Text> : children}</TagWrapper>\n ))}\n </AriaTag>\n );\n}\n\n\n/** An individual Tag for TagGroups. */\nlet _Tag = /*#__PURE__*/ (forwardRef as forwardRefType)(Tag);\nexport {_Tag as Tag};\n\nfunction TagWrapper({children, isDisabled, allowsRemoving, isInRealDOM}) {\n let {size = 'M'} = useSlottedContext(TagGroupContext) ?? {};\n return (\n <>\n {isInRealDOM && (\n <div\n className={style({\n display: 'flex',\n minWidth: 0,\n alignItems: 'center',\n gap: 'text-to-visual',\n forcedColorAdjust: 'none',\n backgroundColor: 'transparent'\n })}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1, truncate: true})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }],\n [AvatarContext, {\n size: avatarSize[size],\n styles: style({order: 0})\n }],\n [ImageContext, {\n styles: style({\n size: fontRelative(20),\n flexShrink: 0,\n order: 0,\n aspectRatio: 'square',\n objectFit: 'contain',\n borderRadius: 'sm'\n })\n }]\n ]}>\n {children}\n </Provider>\n </div>\n )}\n {!isInRealDOM && children}\n {allowsRemoving && isInRealDOM && (\n <ClearButton\n slot=\"remove\"\n size={size}\n isDisabled={isDisabled} />\n )}\n </>\n );\n}\n"],"names":[],"version":3,"file":"TagGroup.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,MAAM,0DAAmB,CAAA,GAAA,0BAAY,EAA8C;AAE1F,SAAS,gCAAU,KAAqB,EAAE,GAAsB;IAC9D,CAAC,OAAO,IAAI,GAAG,CA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nF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,mCAAW;QACV,KAAK;QACL,mDAAmD;QACnD,iDAAiD;QACjD,aAAY;QACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN","sources":["packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,MAAM,0DAAmB,CAAA,GAAA,0BAAY,EAA8C;AAE1F,SAAS,gCAAU,KAAqB,EAAE,GAAsB;IAC9D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,qBACE,gCAAC;QACE,GAAG,KAAK;QACT,KAAK;kBACL,cAAA,gCAAC,CAAA,GAAA,+BAAI;;AAGX;AAEA;;;;CAIC,GACD,IAAI,0DAAa,CAAA,GAAA,uBAAS,EAAE;AAKrB,M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K,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,mCAAW;QACV,KAAK;QACL,mDAAmD;QACnD,iDAAiD;QACjD,aAAY;QACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN","sources":["packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"AC0EqB;EAAA;;;;EAqDe;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAuEnB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5HI;EAqDe;;;;;AArDf;;AAqDe;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAuEnB;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA","sources":["b5f6eedb906c59d7","packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["@import \"ab36e6acf2667a8b\";\n@import \"67d58da798418a3e\";\n@import \"83cde29013713f83\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.css.map"}
1
+ {"mappings":"AC0EqB;EAAA;;;;EAqDe;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAuEnB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA5HI;EAqDe;;;;;AArDf;;AAqDe;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAuEnB;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA","sources":["b5f6eedb906c59d7","packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["@import \"ab36e6acf2667a8b\";\n@import \"67d58da798418a3e\";\n@import \"83cde29013713f83\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.css.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAA8C;AAE1F,SAAS,gCAAU,KAAqB,EAAE,GAAsB;IAC9D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,qBACE,gBAAC;QACE,GAAG,KAAK;QACT,KAAK;kBACL,cAAA,gBAAC,CAAA,GAAA,yCAAI;;AAGX;AAEA;;;;CAIC,GACD,IAAI,0DAAa,CAAA,GAAA,iBAAS,EAAE;AAKrB,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAkE;AAE7G,SAAS,+BAAS,KAAoB,EAAE,GAA2C;IACjF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,qBACE,gBAAC;QACE,GAAG,KAAK;QACT,KAAK;QACL,aAAa;kBAIb,cAAA,gBAAC;;AAGP;AAEA;;;;CAIC,GACD,IAAI,0DAAY,CAAA,GAAA,iBAAS,EAAE;AAG3B,SAAS,oCAAc,KAA0E,EAAE,GAA8D;IAC/J,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,aAAK,EAAkB;IACpC,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCA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K,CAAA,GAAA,gBAAQ,EAAG,KAAa,KAAK;wCAAS;kDAC/E;;;4BAIN,2BAAa,gBAAC,CAAA,GAAA,yCAAa;gCAAE,YAAY;;;;kCAE5C,gBAAC,CAAA,GAAA,yCAAO;wBACN,MAAM,MAAM,IAAI;wBAChB,YAAY;wBACZ,WAAW;wBACX,aAAa;kCACZ;;;;;AAKX;AAEA,IAAI,qDAAiB,CAAA,GAAA,iBAAS,EAAE;AAEhC,SAAS;IACP,8DAA8D;IAC9D,CAAA,GAAA,wBAAgB,EAAE,CAAA,GAAA,sBAAkB;IACpC,IAAI,iBAAiB,CAAC;QACpB,yDAAyD;QACzD,IAAI,OAAO;YACT,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MAAM,KAAK,CAAC,QAAQ;YACvC,6FAA6F;YAC7F,2EAA2E;YAC3E,mFAAmF;YACnF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF;IAEA,qBACE,gBAAC,CAAA,GAAA,eAAW;QACV,KAAK;QACL,mDAAmD;QACnD,iDAAiD;QACjD,aAAY;QACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN","sources":["packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.mjs.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAA8C;AAE1F,SAAS,gCAAU,KAAqB,EAAE,GAAsB;IAC9D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,qBACE,gBAAC;QACE,GAAG,KAAK;QACT,KAAK;kBACL,cAAA,gBAAC,CAAA,GAAA,yCAAI;;AAGX;AAEA;;;;CAIC,GACD,IAAI,0DAAa,CAAA,GAAA,iBAAS,EAAE;AAKrB,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAkE;AAE7G,SAAS,+BAAS,KAAoB,EAAE,GAA2C;IACjF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,qBACE,gBAAC;QACE,GAAG,KAAK;QACT,KAAK;QACL,aAAa;kBAIb,cAAA,gBAAC;;AAGP;AAEA;;;;CAIC,GACD,IAAI,0DAAY,CAAA,GAAA,iBAAS,EAAE;AAG3B,SAAS,oCAAc,KAA0E,EAAE,GAA8D;IAC/J,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,aAAK,EAAkB;IACpC,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAU;IACvC,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,SACF,KAAK,eACL,WAAW,gBACX,YAAY,sBACZ,kBAAkB,iBAClB,gBAAgB,mBAChB,aAAa,wBACb,aAAa,gBACb,YAAY,oBACZ,mBAAmB,IACnB,GAAG,gBACJ,GAAG;IAEJ,sCAAs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Aa;kCACZ;;;;;AAKX;AAEA,IAAI,qDAAiB,CAAA,GAAA,iBAAS,EAAE;AAEhC,SAAS;IACP,8DAA8D;IAC9D,CAAA,GAAA,wBAAgB,EAAE,CAAA,GAAA,sBAAkB;IACpC,IAAI,iBAAiB,CAAC;QACpB,yDAAyD;QACzD,IAAI,OAAO;YACT,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MAAM,KAAK,CAAC,QAAQ;YACvC,6FAA6F;YAC7F,2EAA2E;YAC3E,mFAAmF;YACnF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF;IAEA,qBACE,gBAAC,CAAA,GAAA,eAAW;QACV,KAAK;QACL,mDAAmD;QACnD,iDAAiD;QACjD,aAAY;QACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN","sources":["packages/@react-spectrum/s2/src/TextField.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TextArea as AriaTextArea,\n TextAreaContext as AriaTextAreaContext,\n TextField as AriaTextField,\n TextFieldProps as AriaTextFieldProps,\n composeRenderProps,\n ContextValue,\n InputContext,\n useSlottedContext\n} from 'react-aria-components';\nimport {centerPadding, field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {mergeRefs} from '@react-aria/utils';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the text field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const TextFieldContext = createContext<ContextValue<TextFieldProps, TextFieldRef>>(null);\n\nfunction TextField(props: TextFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextFieldContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}>\n <Input />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nlet _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n\nexport interface TextAreaProps extends Omit<TextFieldProps, 'type' | 'pattern'> {}\n\nexport const TextAreaContext = createContext<ContextValue<TextAreaProps, TextFieldRef<HTMLTextAreaElement>>>(null);\n\nfunction TextArea(props: TextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\n [props, ref] = useSpectrumContextProps(props, ref, TextAreaContext);\n return (\n <_TextFieldBase\n {...props}\n ref={ref}\n fieldGroupCss={style({\n alignItems: 'baseline',\n height: 'auto'\n })}>\n <TextAreaInput />\n </_TextFieldBase>\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = forwardRef(TextArea);\nexport {_TextArea as TextArea};\n\nfunction TextFieldBase(props: TextFieldProps & {children: ReactNode, fieldGroupCss?: StyleString}, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n fieldGroupCss,\n UNSAFE_style,\n UNSAFE_className = '',\n ...textFieldProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaTextField\n {...textFieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, props.styles)}>\n {composeRenderProps(props.children, (children, {isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n {/* TODO: set GroupContext in RAC TextField */}\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size} styles={fieldGroupCss}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n {children}\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>))}\n </AriaTextField>\n );\n}\n\nlet _TextFieldBase = forwardRef(TextFieldBase);\n\nfunction TextAreaInput() {\n // Force re-render when value changes so we update the height.\n useSlottedContext(AriaTextAreaContext) ?? {};\n let onHeightChange = (input: HTMLTextAreaElement) => {\n // TODO: only do this if an explicit height is not given?\n if (input) {\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n };\n\n return (\n <AriaTextArea\n ref={onHeightChange}\n // Workaround for baseline alignment bug in Safari.\n // https://bugs.webkit.org/show_bug.cgi?id=142968\n placeholder=\" \"\n className={style({\n paddingX: 0,\n paddingY: centerPadding(),\n minHeight: 'control',\n boxSizing: 'border-box',\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n lineHeight: '[inherit]',\n flexGrow: 1,\n minWidth: 0,\n outlineStyle: 'none',\n borderStyle: 'none',\n resize: 'none',\n overflowX: 'hidden'\n })} />\n );\n}\n"],"names":[],"version":3,"file":"TextField.mjs.map"}
@@ -55,7 +55,8 @@ function $d16e5203405a91b7$var$ToggleButton(props, ref) {
55
55
  staticColor: props.staticColor,
56
56
  size: props.size,
57
57
  isQuiet: props.isQuiet,
58
- isEmphasized: props.isEmphasized
58
+ isEmphasized: props.isEmphasized,
59
+ isPending: false
59
60
  }, props.styles),
60
61
  children: /*#__PURE__*/ (0, $kyLWK$reactjsxruntime.jsx)((0, $kyLWK$reactariacomponents.Provider), {
61
62
  values: [
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwBM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAAyE;AAExH,SAAS,mCAAa,KAAwB,EAAE,GAAoC;IAClF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,QAAQ,CAAA,GAAA,sCAAW,EAAE;IACrB,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,qBACE,gCAAC,CAAA,GAAA,uCAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,CAAA,GAAA,mCAAQ,EAAE;gBACnE,GAAG,WAAW;gBACd,aAAa,MAAM,WAAW;gBAC9B,MAAM,MAAM,IAAI;gBAChB,SAAS,MAAM,OAAO;gBACtB,cAAc,MAAM,YAAY;YAClC,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBAAC,MAAM;oBAA+C;iBAAE;gBACtE;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F;AAEA;;;CAGC,GACD,IAAI,0DAAgB,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwBM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAAyE;AAExH,SAAS,mCAAa,KAAwB,EAAE,GAAoC;IAClF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,QAAQ,CAAA,GAAA,sCAAW,EAAE;IACrB,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,qBACE,gCAAC,CAAA,GAAA,uCAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,CAAA,GAAA,mCAAQ,EAAE;gBACnE,GAAG,WAAW;gBACd,aAAa,MAAM,WAAW;gBAC9B,MAAM,MAAM,IAAI;gBAChB,SAAS,MAAM,OAAO;gBACtB,cAAc,MAAM,YAAY;gBAChC,WAAW;YACb,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBAAC,MAAM;oBAA+C;iBAAE;gBACtE;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F;AAEA;;;CAGC,GACD,IAAI,0DAAgB,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized,\n isPending: false\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"ACuDiC;EAAA;;;;EAAA;;;;EAAA;;;;EAEyB;;;;EACtC;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAHa;;AAEyB","sources":["bc1013d4d937a6f8","packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["@import \"2356498b79989caa\";\n@import \"00644bdfe594b970\";\n@import \"2645bae9c4681078\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.css.map"}
1
+ {"mappings":"ACwDiC;EAAA;;;;EAAA;;;;EAAA;;;;EAEyB;;;;EACtC;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAHa;;AAEyB","sources":["bc1013d4d937a6f8","packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["@import \"2356498b79989caa\";\n@import \"00644bdfe594b970\";\n@import \"2645bae9c4681078\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized,\n isPending: false\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.css.map"}
@@ -48,7 +48,8 @@ function $fe4c9df7420c3c9f$var$ToggleButton(props, ref) {
48
48
  staticColor: props.staticColor,
49
49
  size: props.size,
50
50
  isQuiet: props.isQuiet,
51
- isEmphasized: props.isEmphasized
51
+ isEmphasized: props.isEmphasized,
52
+ isPending: false
52
53
  }, props.styles),
53
54
  children: /*#__PURE__*/ (0, $fpet3$jsx)((0, $fpet3$Provider), {
54
55
  values: [
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwBM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAyE;AAExH,SAAS,mCAAa,KAAwB,EAAE,GAAoC;IAClF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,qBACE,gBAAC,CAAA,GAAA,mBAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,yCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,CAAA,GAAA,yCAAQ,EAAE;gBACnE,GAAG,WAAW;gBACd,aAAa,MAAM,WAAW;gBAC9B,MAAM,MAAM,IAAI;gBAChB,SAAS,MAAM,OAAO;gBACtB,cAAc,MAAM,YAAY;YAClC,GAAG,MAAM,MAAM;kBACf,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBAAC,MAAM;oBAA+C;iBAAE;gBACtE;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gBAAC,CAAA,GAAA,yCAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F;AAEA;;;CAGC,GACD,IAAI,0DAAgB,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwBM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAyE;AAExH,SAAS,mCAAa,KAAwB,EAAE,GAAoC;IAClF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,qBACE,gBAAC,CAAA,GAAA,mBAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,yCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,CAAA,GAAA,yCAAQ,EAAE;gBACnE,GAAG,WAAW;gBACd,aAAa,MAAM,WAAW;gBAC9B,MAAM,MAAM,IAAI;gBAChB,SAAS,MAAM,OAAO;gBACtB,cAAc,MAAM,YAAY;gBAChC,WAAW;YACb,GAAG,MAAM,MAAM;kBACf,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBAAC,MAAM;oBAA+C;iBAAE;gBACtE;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gBAAC,CAAA,GAAA,yCAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F;AAEA;;;CAGC,GACD,IAAI,0DAAgB,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/ToggleButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButtonStyleProps, btnStyles} from './ActionButton';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider, ToggleButton as RACToggleButton, ToggleButtonProps as RACToggleButtonProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {pressScale} from './pressScale';\nimport {SkeletonContext} from './Skeleton';\nimport {StyleProps} from './style-utils';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ToggleButtonProps extends Omit<RACToggleButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ActionButtonStyleProps {\n /** The content to display in the button. */\n children?: ReactNode,\n /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n isEmphasized?: boolean\n}\n\nexport const ToggleButtonContext = createContext<ContextValue<ToggleButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\n\nfunction ToggleButton(props: ToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ToggleButtonContext);\n props = useFormProps(props as any);\n let domRef = useFocusableRef(ref);\n return (\n <RACToggleButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + btnStyles({\n ...renderProps,\n staticColor: props.staticColor,\n size: props.size,\n isQuiet: props.isQuiet,\n isEmphasized: props.isEmphasized,\n isPending: false\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {styles: style({paddingY: '--labelPadding', order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACToggleButton>\n );\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nlet _ToggleButton = forwardRef(ToggleButton);\nexport {_ToggleButton as ToggleButton};\n"],"names":[],"version":3,"file":"ToggleButton.mjs.map"}