@react-spectrum/s2 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/dist/exports/CenterBaseline.cjs +12 -0
  2. package/dist/exports/CenterBaseline.cjs.map +1 -0
  3. package/dist/exports/CenterBaseline.mjs +7 -0
  4. package/dist/exports/CenterBaseline.mjs.map +1 -0
  5. package/dist/exports/Skeleton.cjs +1 -0
  6. package/dist/exports/Skeleton.cjs.map +1 -1
  7. package/dist/exports/Skeleton.mjs +2 -2
  8. package/dist/exports/Skeleton.mjs.map +1 -1
  9. package/dist/exports/index.cjs +3 -0
  10. package/dist/exports/index.cjs.map +1 -1
  11. package/dist/exports/index.mjs +3 -1
  12. package/dist/exports/index.mjs.map +1 -1
  13. package/dist/private/Accordion.cjs +2 -2
  14. package/dist/private/Accordion.css +2 -2
  15. package/dist/private/Accordion.mjs +2 -2
  16. package/dist/private/ActionBar.cjs +59 -59
  17. package/dist/private/ActionBar.cjs.map +1 -1
  18. package/dist/private/ActionBar.css +58 -58
  19. package/dist/private/ActionBar.css.map +1 -1
  20. package/dist/private/ActionBar.mjs +59 -59
  21. package/dist/private/ActionBar.mjs.map +1 -1
  22. package/dist/private/ActionButton.cjs +247 -247
  23. package/dist/private/ActionButton.cjs.map +1 -1
  24. package/dist/private/ActionButton.css +169 -169
  25. package/dist/private/ActionButton.css.map +1 -1
  26. package/dist/private/ActionButton.mjs +247 -247
  27. package/dist/private/ActionButton.mjs.map +1 -1
  28. package/dist/private/ActionButtonGroup.cjs +15 -15
  29. package/dist/private/ActionButtonGroup.css +9 -9
  30. package/dist/private/ActionButtonGroup.mjs +15 -15
  31. package/dist/private/ActionMenu.cjs.map +1 -1
  32. package/dist/private/ActionMenu.mjs.map +1 -1
  33. package/dist/private/Add.cjs +10 -10
  34. package/dist/private/Add.css +6 -6
  35. package/dist/private/Add.mjs +10 -10
  36. package/dist/private/AlertDialog.cjs +3 -3
  37. package/dist/private/AlertDialog.cjs.map +1 -1
  38. package/dist/private/AlertDialog.css +3 -3
  39. package/dist/private/AlertDialog.css.map +1 -1
  40. package/dist/private/AlertDialog.mjs +3 -3
  41. package/dist/private/AlertDialog.mjs.map +1 -1
  42. package/dist/private/Asterisk.cjs +6 -6
  43. package/dist/private/Asterisk.css +4 -4
  44. package/dist/private/Asterisk.mjs +6 -6
  45. package/dist/private/Avatar.cjs +16 -16
  46. package/dist/private/Avatar.css +16 -16
  47. package/dist/private/Avatar.mjs +16 -16
  48. package/dist/private/AvatarGroup.cjs +120 -120
  49. package/dist/private/AvatarGroup.css +31 -31
  50. package/dist/private/AvatarGroup.mjs +120 -120
  51. package/dist/private/Badge.cjs +197 -197
  52. package/dist/private/Badge.css +125 -125
  53. package/dist/private/Badge.mjs +197 -197
  54. package/dist/private/Breadcrumbs.cjs +234 -234
  55. package/dist/private/Breadcrumbs.cjs.map +1 -1
  56. package/dist/private/Breadcrumbs.css +100 -100
  57. package/dist/private/Breadcrumbs.css.map +1 -1
  58. package/dist/private/Breadcrumbs.mjs +234 -234
  59. package/dist/private/Breadcrumbs.mjs.map +1 -1
  60. package/dist/private/Button.cjs +326 -326
  61. package/dist/private/Button.cjs.map +1 -1
  62. package/dist/private/Button.css +172 -172
  63. package/dist/private/Button.css.map +1 -1
  64. package/dist/private/Button.mjs +326 -326
  65. package/dist/private/Button.mjs.map +1 -1
  66. package/dist/private/ButtonGroup.cjs +23 -20
  67. package/dist/private/ButtonGroup.cjs.map +1 -1
  68. package/dist/private/ButtonGroup.css +19 -15
  69. package/dist/private/ButtonGroup.css.map +1 -1
  70. package/dist/private/ButtonGroup.mjs +23 -20
  71. package/dist/private/ButtonGroup.mjs.map +1 -1
  72. package/dist/private/Calendar.cjs +232 -232
  73. package/dist/private/Calendar.cjs.map +1 -1
  74. package/dist/private/Calendar.css +149 -149
  75. package/dist/private/Calendar.css.map +1 -1
  76. package/dist/private/Calendar.mjs +232 -232
  77. package/dist/private/Calendar.mjs.map +1 -1
  78. package/dist/private/Card.cjs +309 -309
  79. package/dist/private/Card.css +206 -206
  80. package/dist/private/Card.mjs +309 -309
  81. package/dist/private/CardView.cjs +17 -17
  82. package/dist/private/CardView.css +17 -17
  83. package/dist/private/CardView.mjs +17 -17
  84. package/dist/private/CenterBaseline.cjs +1 -1
  85. package/dist/private/CenterBaseline.cjs.map +1 -1
  86. package/dist/private/CenterBaseline.css +2 -2
  87. package/dist/private/CenterBaseline.css.map +1 -1
  88. package/dist/private/CenterBaseline.mjs +1 -1
  89. package/dist/private/CenterBaseline.mjs.map +1 -1
  90. package/dist/private/Checkbox.cjs +188 -188
  91. package/dist/private/Checkbox.css +110 -110
  92. package/dist/private/Checkbox.mjs +188 -188
  93. package/dist/private/CheckboxGroup.cjs +43 -43
  94. package/dist/private/CheckboxGroup.css +37 -37
  95. package/dist/private/CheckboxGroup.mjs +43 -43
  96. package/dist/private/Checkmark.cjs +12 -12
  97. package/dist/private/Checkmark.css +8 -8
  98. package/dist/private/Checkmark.mjs +12 -12
  99. package/dist/private/Chevron.cjs +12 -12
  100. package/dist/private/Chevron.css +10 -10
  101. package/dist/private/Chevron.mjs +12 -12
  102. package/dist/private/ClearButton.cjs +30 -30
  103. package/dist/private/ClearButton.css +30 -30
  104. package/dist/private/ClearButton.mjs +30 -30
  105. package/dist/private/CloseButton.cjs +52 -52
  106. package/dist/private/CloseButton.cjs.map +1 -1
  107. package/dist/private/CloseButton.css +46 -46
  108. package/dist/private/CloseButton.css.map +1 -1
  109. package/dist/private/CloseButton.mjs +52 -52
  110. package/dist/private/CloseButton.mjs.map +1 -1
  111. package/dist/private/ColorArea.cjs +16 -16
  112. package/dist/private/ColorArea.css +16 -16
  113. package/dist/private/ColorArea.mjs +16 -16
  114. package/dist/private/ColorField.cjs +31 -31
  115. package/dist/private/ColorField.css +27 -27
  116. package/dist/private/ColorField.mjs +31 -31
  117. package/dist/private/ColorHandle.cjs +27 -27
  118. package/dist/private/ColorHandle.css +42 -42
  119. package/dist/private/ColorHandle.mjs +27 -27
  120. package/dist/private/ColorSlider.cjs +108 -108
  121. package/dist/private/ColorSlider.css +52 -52
  122. package/dist/private/ColorSlider.mjs +108 -108
  123. package/dist/private/ColorSwatch.cjs +29 -29
  124. package/dist/private/ColorSwatch.css +29 -29
  125. package/dist/private/ColorSwatch.mjs +29 -29
  126. package/dist/private/ColorSwatchPicker.cjs +29 -29
  127. package/dist/private/ColorSwatchPicker.css +48 -48
  128. package/dist/private/ColorSwatchPicker.mjs +29 -29
  129. package/dist/private/ColorWheel.cjs +26 -26
  130. package/dist/private/ColorWheel.css +17 -17
  131. package/dist/private/ColorWheel.mjs +26 -26
  132. package/dist/private/ComboBox.cjs +381 -381
  133. package/dist/private/ComboBox.cjs.map +1 -1
  134. package/dist/private/ComboBox.css +188 -188
  135. package/dist/private/ComboBox.css.map +1 -1
  136. package/dist/private/ComboBox.mjs +381 -381
  137. package/dist/private/ComboBox.mjs.map +1 -1
  138. package/dist/private/ContextualHelp.cjs +5 -5
  139. package/dist/private/ContextualHelp.cjs.map +1 -1
  140. package/dist/private/ContextualHelp.css +50 -50
  141. package/dist/private/ContextualHelp.css.map +1 -1
  142. package/dist/private/ContextualHelp.mjs +5 -5
  143. package/dist/private/ContextualHelp.mjs.map +1 -1
  144. package/dist/private/CornerTriangle.cjs +8 -8
  145. package/dist/private/CornerTriangle.css +6 -6
  146. package/dist/private/CornerTriangle.mjs +8 -8
  147. package/dist/private/Cross.cjs +14 -14
  148. package/dist/private/Cross.css +10 -10
  149. package/dist/private/Cross.mjs +14 -14
  150. package/dist/private/CustomDialog.cjs +25 -25
  151. package/dist/private/CustomDialog.css +25 -25
  152. package/dist/private/CustomDialog.mjs +25 -25
  153. package/dist/private/Dash.cjs +10 -10
  154. package/dist/private/Dash.css +6 -6
  155. package/dist/private/Dash.mjs +10 -10
  156. package/dist/private/DateField.cjs +73 -73
  157. package/dist/private/DateField.css +77 -77
  158. package/dist/private/DateField.mjs +73 -73
  159. package/dist/private/DatePicker.cjs +172 -172
  160. package/dist/private/DatePicker.cjs.map +1 -1
  161. package/dist/private/DatePicker.css +128 -128
  162. package/dist/private/DatePicker.css.map +1 -1
  163. package/dist/private/DatePicker.mjs +172 -172
  164. package/dist/private/DatePicker.mjs.map +1 -1
  165. package/dist/private/DateRangePicker.cjs +55 -55
  166. package/dist/private/DateRangePicker.cjs.map +1 -1
  167. package/dist/private/DateRangePicker.css +59 -59
  168. package/dist/private/DateRangePicker.css.map +1 -1
  169. package/dist/private/DateRangePicker.mjs +55 -55
  170. package/dist/private/DateRangePicker.mjs.map +1 -1
  171. package/dist/private/Dialog.cjs +17 -17
  172. package/dist/private/Dialog.css +70 -70
  173. package/dist/private/Dialog.mjs +17 -17
  174. package/dist/private/Disclosure.cjs +144 -122
  175. package/dist/private/Disclosure.cjs.map +1 -1
  176. package/dist/private/Disclosure.css +112 -112
  177. package/dist/private/Disclosure.css.map +1 -1
  178. package/dist/private/Disclosure.mjs +144 -122
  179. package/dist/private/Disclosure.mjs.map +1 -1
  180. package/dist/private/Divider.cjs +25 -25
  181. package/dist/private/Divider.css +25 -25
  182. package/dist/private/Divider.mjs +25 -25
  183. package/dist/private/DragHandle.cjs +8 -8
  184. package/dist/private/DragHandle.css +6 -6
  185. package/dist/private/DragHandle.mjs +8 -8
  186. package/dist/private/DragPreview.cjs +154 -154
  187. package/dist/private/DragPreview.css +106 -106
  188. package/dist/private/DragPreview.mjs +154 -154
  189. package/dist/private/DropZone.cjs +61 -61
  190. package/dist/private/DropZone.cjs.map +1 -1
  191. package/dist/private/DropZone.css +57 -57
  192. package/dist/private/DropZone.css.map +1 -1
  193. package/dist/private/DropZone.mjs +61 -61
  194. package/dist/private/DropZone.mjs.map +1 -1
  195. package/dist/private/Field.cjs +360 -360
  196. package/dist/private/Field.cjs.map +1 -1
  197. package/dist/private/Field.css +160 -160
  198. package/dist/private/Field.css.map +1 -1
  199. package/dist/private/Field.mjs +360 -360
  200. package/dist/private/Field.mjs.map +1 -1
  201. package/dist/private/Form.cjs +9 -9
  202. package/dist/private/Form.css +9 -9
  203. package/dist/private/Form.mjs +9 -9
  204. package/dist/private/FullscreenDialog.cjs +5 -5
  205. package/dist/private/FullscreenDialog.css +78 -78
  206. package/dist/private/FullscreenDialog.mjs +5 -5
  207. package/dist/private/IllustratedMessage.cjs +228 -228
  208. package/dist/private/IllustratedMessage.css +72 -72
  209. package/dist/private/IllustratedMessage.mjs +228 -228
  210. package/dist/private/Image.cjs +14 -14
  211. package/dist/private/Image.css +14 -14
  212. package/dist/private/Image.mjs +14 -14
  213. package/dist/private/InlineAlert.cjs +100 -100
  214. package/dist/private/InlineAlert.cjs.map +1 -1
  215. package/dist/private/InlineAlert.css +76 -76
  216. package/dist/private/InlineAlert.css.map +1 -1
  217. package/dist/private/InlineAlert.mjs +100 -100
  218. package/dist/private/InlineAlert.mjs.map +1 -1
  219. package/dist/private/LabeledValue.cjs +134 -134
  220. package/dist/private/LabeledValue.css +63 -63
  221. package/dist/private/LabeledValue.mjs +134 -134
  222. package/dist/private/Link.cjs +49 -49
  223. package/dist/private/Link.css +41 -41
  224. package/dist/private/Link.mjs +49 -49
  225. package/dist/private/LinkOut.cjs +8 -8
  226. package/dist/private/LinkOut.css +8 -8
  227. package/dist/private/LinkOut.mjs +8 -8
  228. package/dist/private/ListView.cjs +245 -245
  229. package/dist/private/ListView.cjs.map +1 -1
  230. package/dist/private/ListView.css +177 -177
  231. package/dist/private/ListView.css.map +1 -1
  232. package/dist/private/ListView.mjs +245 -245
  233. package/dist/private/ListView.mjs.map +1 -1
  234. package/dist/private/Menu.cjs +446 -446
  235. package/dist/private/Menu.cjs.map +1 -1
  236. package/dist/private/Menu.css +196 -196
  237. package/dist/private/Menu.css.map +1 -1
  238. package/dist/private/Menu.mjs +446 -446
  239. package/dist/private/Menu.mjs.map +1 -1
  240. package/dist/private/Meter.cjs +153 -153
  241. package/dist/private/Meter.css +91 -91
  242. package/dist/private/Meter.mjs +153 -153
  243. package/dist/private/Modal.cjs +74 -74
  244. package/dist/private/Modal.css +59 -59
  245. package/dist/private/Modal.mjs +74 -74
  246. package/dist/private/NotificationBadge.cjs +56 -56
  247. package/dist/private/NotificationBadge.cjs.map +1 -1
  248. package/dist/private/NotificationBadge.css +49 -49
  249. package/dist/private/NotificationBadge.css.map +1 -1
  250. package/dist/private/NotificationBadge.mjs +56 -56
  251. package/dist/private/NotificationBadge.mjs.map +1 -1
  252. package/dist/private/NumberField.cjs +114 -114
  253. package/dist/private/NumberField.css +99 -99
  254. package/dist/private/NumberField.mjs +114 -114
  255. package/dist/private/Picker.cjs +275 -275
  256. package/dist/private/Picker.cjs.map +1 -1
  257. package/dist/private/Picker.css +173 -173
  258. package/dist/private/Picker.css.map +1 -1
  259. package/dist/private/Picker.mjs +275 -275
  260. package/dist/private/Picker.mjs.map +1 -1
  261. package/dist/private/Popover.cjs +95 -95
  262. package/dist/private/Popover.cjs.map +1 -1
  263. package/dist/private/Popover.css +75 -75
  264. package/dist/private/Popover.css.map +1 -1
  265. package/dist/private/Popover.mjs +95 -95
  266. package/dist/private/Popover.mjs.map +1 -1
  267. package/dist/private/ProgressBar.cjs +163 -163
  268. package/dist/private/ProgressBar.css +99 -99
  269. package/dist/private/ProgressBar.mjs +163 -163
  270. package/dist/private/ProgressCircle.cjs +34 -31
  271. package/dist/private/ProgressCircle.cjs.map +1 -1
  272. package/dist/private/ProgressCircle.css +24 -24
  273. package/dist/private/ProgressCircle.css.map +1 -1
  274. package/dist/private/ProgressCircle.mjs +34 -31
  275. package/dist/private/ProgressCircle.mjs.map +1 -1
  276. package/dist/private/Provider.cjs +19 -19
  277. package/dist/private/Provider.css +15 -15
  278. package/dist/private/Provider.mjs +19 -19
  279. package/dist/private/RadioGroup.cjs +208 -208
  280. package/dist/private/RadioGroup.css +113 -113
  281. package/dist/private/RadioGroup.mjs +208 -208
  282. package/dist/private/RangeCalendar.cjs +16 -16
  283. package/dist/private/RangeCalendar.cjs.map +1 -1
  284. package/dist/private/RangeCalendar.css +17 -17
  285. package/dist/private/RangeCalendar.css.map +1 -1
  286. package/dist/private/RangeCalendar.mjs +16 -16
  287. package/dist/private/RangeCalendar.mjs.map +1 -1
  288. package/dist/private/RangeSlider.cjs.map +1 -1
  289. package/dist/private/RangeSlider.mjs.map +1 -1
  290. package/dist/private/SearchField.cjs +41 -41
  291. package/dist/private/SearchField.css +45 -45
  292. package/dist/private/SearchField.mjs +41 -41
  293. package/dist/private/SegmentedControl.cjs +178 -178
  294. package/dist/private/SegmentedControl.css +123 -123
  295. package/dist/private/SegmentedControl.mjs +178 -178
  296. package/dist/private/SelectBoxGroup.cjs +142 -142
  297. package/dist/private/SelectBoxGroup.css +120 -120
  298. package/dist/private/SelectBoxGroup.mjs +142 -142
  299. package/dist/private/Slider.cjs +292 -292
  300. package/dist/private/Slider.css +159 -159
  301. package/dist/private/Slider.mjs +292 -292
  302. package/dist/private/StatusLight.cjs +115 -115
  303. package/dist/private/StatusLight.css +59 -59
  304. package/dist/private/StatusLight.mjs +115 -115
  305. package/dist/private/Switch.cjs +171 -171
  306. package/dist/private/Switch.css +85 -85
  307. package/dist/private/Switch.mjs +171 -171
  308. package/dist/private/TableView.cjs +551 -534
  309. package/dist/private/TableView.cjs.map +1 -1
  310. package/dist/private/TableView.css +329 -303
  311. package/dist/private/TableView.css.map +1 -1
  312. package/dist/private/TableView.mjs +551 -534
  313. package/dist/private/TableView.mjs.map +1 -1
  314. package/dist/private/Tabs.cjs +131 -125
  315. package/dist/private/Tabs.cjs.map +1 -1
  316. package/dist/private/Tabs.css +105 -105
  317. package/dist/private/Tabs.css.map +1 -1
  318. package/dist/private/Tabs.mjs +131 -125
  319. package/dist/private/Tabs.mjs.map +1 -1
  320. package/dist/private/TabsPicker.cjs +127 -127
  321. package/dist/private/TabsPicker.css +108 -108
  322. package/dist/private/TabsPicker.mjs +127 -127
  323. package/dist/private/TagGroup.cjs +203 -203
  324. package/dist/private/TagGroup.cjs.map +1 -1
  325. package/dist/private/TagGroup.css +146 -146
  326. package/dist/private/TagGroup.css.map +1 -1
  327. package/dist/private/TagGroup.mjs +203 -203
  328. package/dist/private/TagGroup.mjs.map +1 -1
  329. package/dist/private/TextField.cjs +58 -58
  330. package/dist/private/TextField.css +54 -54
  331. package/dist/private/TextField.mjs +58 -58
  332. package/dist/private/TimeField.cjs +51 -51
  333. package/dist/private/TimeField.css +47 -47
  334. package/dist/private/TimeField.mjs +51 -51
  335. package/dist/private/Toast.cjs +120 -120
  336. package/dist/private/Toast.cjs.map +1 -1
  337. package/dist/private/Toast.css +110 -110
  338. package/dist/private/Toast.css.map +1 -1
  339. package/dist/private/Toast.mjs +120 -120
  340. package/dist/private/Toast.mjs.map +1 -1
  341. package/dist/private/ToggleButton.cjs +16 -16
  342. package/dist/private/ToggleButton.css +23 -23
  343. package/dist/private/ToggleButton.mjs +16 -16
  344. package/dist/private/Tooltip.cjs +86 -86
  345. package/dist/private/Tooltip.css +70 -70
  346. package/dist/private/Tooltip.mjs +86 -86
  347. package/dist/private/TreeView.cjs +229 -229
  348. package/dist/private/TreeView.cjs.map +1 -1
  349. package/dist/private/TreeView.css +184 -184
  350. package/dist/private/TreeView.css.map +1 -1
  351. package/dist/private/TreeView.mjs +229 -229
  352. package/dist/private/TreeView.mjs.map +1 -1
  353. package/dist/private/dnd-utils.cjs +42 -42
  354. package/dist/private/dnd-utils.css +39 -39
  355. package/dist/private/dnd-utils.mjs +42 -42
  356. package/dist/types/exports/CenterBaseline.d.ts +1 -0
  357. package/dist/types/exports/Skeleton.d.ts +1 -1
  358. package/dist/types/exports/index.d.ts +1 -0
  359. package/dist/types/src/CenterBaseline.d.ts +17 -0
  360. package/dist/types/src/ContextualHelp.d.ts +1 -1
  361. package/dist/types/src/Disclosure.d.ts +6 -1
  362. package/dist/types/src/ListView.d.ts +1 -1
  363. package/dist/types/src/Menu.d.ts +1 -1
  364. package/dist/types/src/Popover.d.ts +2 -2
  365. package/dist/types/src/style-utils.d.ts +4 -1
  366. package/exports/CenterBaseline.ts +1 -0
  367. package/exports/Skeleton.ts +1 -1
  368. package/exports/index.ts +2 -0
  369. package/icons/Icon.cjs +10 -10
  370. package/icons/Icon.css +9 -9
  371. package/icons/Icon.mjs +10 -10
  372. package/icons/Skeleton.cjs +2 -2
  373. package/icons/Skeleton.cjs.map +1 -1
  374. package/icons/Skeleton.css +6 -6
  375. package/icons/Skeleton.mjs +2 -2
  376. package/icons/Skeleton.mjs.map +1 -1
  377. package/package.json +6 -6
  378. package/src/ActionBar.tsx +0 -1
  379. package/src/ActionButton.tsx +0 -1
  380. package/src/ActionMenu.tsx +0 -1
  381. package/src/AlertDialog.tsx +0 -1
  382. package/src/Breadcrumbs.tsx +0 -4
  383. package/src/Button.tsx +0 -1
  384. package/src/ButtonGroup.tsx +1 -0
  385. package/src/Calendar.tsx +0 -1
  386. package/src/CenterBaseline.tsx +17 -0
  387. package/src/CloseButton.tsx +0 -1
  388. package/src/ComboBox.tsx +0 -1
  389. package/src/ContextualHelp.tsx +1 -2
  390. package/src/DatePicker.tsx +0 -1
  391. package/src/DateRangePicker.tsx +0 -1
  392. package/src/Disclosure.tsx +92 -79
  393. package/src/DropZone.tsx +0 -1
  394. package/src/Field.tsx +0 -1
  395. package/src/InlineAlert.tsx +0 -1
  396. package/src/ListView.tsx +0 -2
  397. package/src/Menu.tsx +1 -8
  398. package/src/NotificationBadge.tsx +0 -1
  399. package/src/Picker.tsx +0 -1
  400. package/src/Popover.tsx +2 -1
  401. package/src/ProgressCircle.tsx +1 -1
  402. package/src/RangeCalendar.tsx +0 -1
  403. package/src/RangeSlider.tsx +0 -1
  404. package/src/TableView.tsx +75 -37
  405. package/src/Tabs.tsx +9 -2
  406. package/src/TagGroup.tsx +0 -1
  407. package/src/Toast.tsx +0 -3
  408. package/src/TreeView.tsx +0 -1
  409. package/src/style-utils.ts +13 -2
  410. package/style/__tests__/style-macro.test.js +71 -71
  411. package/style/dist/main.cjs +25 -25
  412. package/style/dist/module.mjs +13 -13
  413. package/style/dist/properties.mjs +3 -3
  414. package/style/dist/spectrum-theme.cjs +224 -224
  415. package/style/dist/spectrum-theme.mjs +217 -217
  416. package/style/dist/style-macro.cjs +100 -100
  417. package/style/dist/style-macro.mjs +94 -94
  418. package/style/dist/style-utils.cjs +51 -39
  419. package/style/dist/style-utils.cjs.map +1 -1
  420. package/style/dist/style-utils.mjs +50 -38
  421. package/style/dist/style-utils.mjs.map +1 -1
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AAyFM,MAAM,0DACX,CAAA,GAAA,oBAAY,EAA4E;AACnF,MAAM,0DACX,CAAA,GAAA,oBAAY,EAA4E;AAE1F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmMN,4FAA4F;AAC5F,oGAAoG;AACpG,iDAAiD;AACjD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEC,SAAS,0CAAgB,SAAkB;IAChD,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,eAAO,EAAE;IACzD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI;QACJ,IAAI,WACF,UAAU,WAAW;YACnB,qBAAqB;QACvB,GAAG;aAEH,qBAAqB;QAEvB,OAAO;YACL,aAAa;QACf;IACF,GAAG;QAAC;KAAU;IACd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6BACE;gBACE,GAAG,WAAW;gBACd,+CAA+C;gBAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;yBACnE;2BACA;sBACA;6BACA;gBACA,eAAe,CAAC,CAAC;gBACjB,WAAW;YACb,GACA;kBAGH,CAAA,4BACC;;oBACG,YAAY,WAAW,YAAY,0BAClC,gBAAC;wBACC,WAAW,+BAAS;4BAClB,GAAG,WAAW;4BACd,+CAA+C;4BAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;qCACnE;wBACF;yBAEA;kCACJ,gBAAC,CAAA,GAAA,eAAO;wBACN,QAAQ;4BACN;gCAAC,CAAA,GAAA,yCAAc;gCAAG;6BAAK;4BACvB;gCACE,CAAA,GAAA,yCAAU;gCACV;oCACE,MAAM;oCACN,kHAAkH;oCAClH,iBAAiB;gCACnB;6BACD;4BACD;gCACE,CAAA,GAAA,yCAAU;gCACV;oCACE,QAAQ,CAAA,GAAA,yCAAa,EAAE;wCAAC,MAAM;wCAAQ,MAAM;oCAAmB;oCAC/D,MAAM;gCAKR;6BACD;yBACF;kCACA,OAAO,aAAa,yBAAW,gBAAC,CAAA,GAAA,yCAAG;sCAAG;6BAAmB;;;;;AAMtE","sources":["packages/@react-spectrum/s2/src/Button.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 {baseColor, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {\n ButtonRenderProps,\n Button as RACButton,\n ButtonProps as RACButtonProps\n} from 'react-aria-components/Button';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider} from 'react-aria-components/slots';\nimport {\n control,\n getAllowedOverrides,\n staticColor,\n StyleProps\n} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useState} from 'react';\nimport {FocusableRef, FocusableRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {IconContext} from './Icon';\nimport intlMessages from '../intl/*.json';\nimport {linearGradient} from '../style/spectrum-theme' with {type: 'macro'};\n// @ts-ignore\nimport {Link, LinkProps} from 'react-aria-components/Link';\nimport {OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {pressScale} from './pressScale';\nimport {ProgressCircle} from './ProgressCircle';\nimport {SkeletonContext} from './Skeleton';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from './useDOMRef';\nimport {useFormProps} from './Form';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ButtonStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button.\n *\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary' | 'accent' | 'negative' | 'premium' | 'genai';\n /**\n * The background style of the Button.\n *\n * @default 'fill'\n */\n fillStyle?: 'fill' | 'outline';\n /**\n * The size of the Button.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n /** The static color style to apply. Useful when the Button appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto';\n}\n\nexport interface ButtonProps\n extends\n Omit<\n RACButtonProps,\n | 'className'\n | 'style'\n | 'render'\n | 'children'\n | 'onHover'\n | 'onHoverStart'\n | 'onHoverEnd'\n | 'onHoverChange'\n | 'onClick'\n | keyof GlobalDOMAttributes\n >,\n StyleProps,\n ButtonStyleProps {\n /** The content to display in the Button. */\n children: ReactNode;\n}\n\nexport interface LinkButtonProps\n extends\n Omit<\n LinkProps,\n 'className' | 'style' | 'render' | 'children' | 'onClick' | keyof GlobalDOMAttributes\n >,\n StyleProps,\n ButtonStyleProps {\n /** The content to display in the Button. */\n children: ReactNode;\n}\n\nexport const ButtonContext =\n createContext<ContextValue<Partial<ButtonProps>, FocusableRefValue<HTMLButtonElement>>>(null);\nexport const LinkButtonContext =\n createContext<ContextValue<Partial<ButtonProps>, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: boolean}>(\n {\n ...focusRing(),\n ...staticColor(),\n ...control({shape: 'pill', wrap: true, icon: true}),\n position: 'relative',\n justifyContent: 'center',\n textAlign: 'start',\n fontWeight: 'bold',\n userSelect: 'none',\n width: 'fit',\n textDecoration: 'none', // for link buttons\n transition: 'default',\n borderStyle: 'solid',\n borderWidth: {\n fillStyle: {\n fill: 0,\n outline: 2\n },\n variant: {\n premium: 0,\n genai: 0\n }\n },\n borderColor: {\n variant: {\n primary: baseColor('gray-800'),\n secondary: baseColor('gray-300')\n },\n isDisabled: 'disabled',\n isStaticColor: {\n variant: {\n primary: baseColor('transparent-overlay-800'),\n secondary: baseColor('transparent-overlay-300')\n },\n isDisabled: 'transparent-overlay-300'\n },\n forcedColors: {\n default: 'ButtonBorder',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n backgroundColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('neutral'),\n secondary: baseColor('gray-100'),\n accent: {\n default: lightDark('accent-900', 'accent-700'),\n isHovered: lightDark('accent-1000', 'accent-600'),\n isPressed: lightDark('accent-1000', 'accent-600'),\n isFocusVisible: lightDark('accent-1000', 'accent-600')\n },\n negative: {\n default: lightDark('negative-900', 'negative-700'),\n isHovered: lightDark('negative-1000', 'negative-600'),\n isPressed: lightDark('negative-1000', 'negative-600'),\n isFocusVisible: lightDark('negative-1000', 'negative-600')\n },\n premium: 'gray-100',\n genai: 'gray-100'\n },\n isDisabled: 'disabled'\n },\n outline: {\n variant: {\n premium: 'gray-100',\n genai: 'gray-100'\n },\n default: 'transparent',\n isHovered: 'gray-100',\n isPressed: 'gray-100',\n isFocusVisible: 'gray-100',\n isDisabled: {\n default: 'transparent',\n variant: {\n premium: 'gray-100',\n genai: 'gray-100'\n }\n }\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('transparent-overlay-800'),\n secondary: baseColor('transparent-overlay-100'),\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n },\n isDisabled: 'transparent-overlay-100'\n },\n outline: {\n variant: {\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n },\n default: 'transparent',\n isHovered: 'transparent-overlay-100',\n isPressed: 'transparent-overlay-100',\n isFocusVisible: 'transparent-overlay-100',\n isDisabled: {\n default: 'transparent',\n variant: {\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n }\n }\n }\n }\n },\n forcedColors: {\n fillStyle: {\n fill: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n },\n outline: 'ButtonFace'\n }\n }\n },\n color: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'gray-25',\n secondary: baseColor('neutral'),\n accent: 'white',\n negative: 'white',\n premium: 'white',\n genai: 'white'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: baseColor('neutral'),\n variant: {\n premium: 'white',\n genai: 'white'\n },\n isDisabled: 'disabled'\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'auto',\n secondary: 'white',\n premium: 'white',\n genai: 'white'\n }\n },\n outline: {\n variant: {\n premium: 'white',\n genai: 'white'\n },\n default: 'white'\n }\n },\n isDisabled: 'transparent-overlay-400'\n },\n forcedColors: {\n fillStyle: {\n fill: {\n default: 'ButtonFace',\n isDisabled: 'HighlightText'\n },\n outline: {\n default: 'ButtonText',\n isDisabled: 'GrayText'\n }\n }\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n outlineColor: {\n default: 'focus-ring',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'Highlight'\n },\n forcedColorAdjust: 'none',\n disableTapHighlight: true\n },\n getAllowedOverrides()\n);\n\n// Put the gradient background on a separate element from the button to work around a Safari\n// bug where transitions of custom properties cause layout flickering if any properties use rems. 🤣\n// https://bugs.webkit.org/show_bug.cgi?id=285622\nconst gradient = style({\n position: 'absolute',\n inset: 0,\n zIndex: -1,\n transition: 'default',\n borderRadius: 'inherit',\n backgroundImage: {\n variant: {\n premium: {\n default: linearGradient(\n 'to bottom right',\n ['fuchsia-900', 0],\n ['indigo-900', 66],\n ['blue-900', 100]\n ),\n isHovered: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n ),\n isPressed: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n ),\n isFocusVisible: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n )\n },\n genai: {\n default: linearGradient(\n 'to bottom right',\n ['red-900', 0],\n ['magenta-900', 33],\n ['indigo-900', 100]\n ),\n isHovered: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n ),\n isPressed: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n ),\n isFocusVisible: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n )\n }\n },\n isDisabled: 'none',\n forcedColors: 'none'\n },\n // Force gradient colors to remain static between light and dark theme.\n colorScheme: {\n variant: {\n premium: 'light',\n genai: 'light'\n }\n }\n});\n\nexport function usePendingState(isPending: boolean) {\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n if (isPending) {\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n setIsProgressVisible(false);\n }\n return () => {\n clearTimeout(timeout);\n };\n }, [isPending]);\n return {isProgressVisible};\n}\n\n/**\n * Buttons allow users to perform an action.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonContext);\n props = useFormProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {isPending = false, variant = 'primary', fillStyle = 'fill', size = 'M', staticColor} = props;\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n let {isProgressVisible} = usePendingState(isPending);\n\n return (\n <RACButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps =>\n (props.UNSAFE_className || '') +\n button(\n {\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n isDisabled: renderProps.isDisabled || isProgressVisible,\n variant,\n fillStyle,\n size,\n staticColor,\n isStaticColor: !!staticColor\n },\n props.styles\n )\n }>\n {renderProps => (\n <>\n {variant === 'genai' || variant === 'premium' ? (\n <span\n className={gradient({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n isDisabled: renderProps.isDisabled || isProgressVisible,\n variant\n })}\n />\n ) : null}\n <Provider\n values={[\n [SkeletonContext, null],\n [\n TextContext,\n {\n styles: style({\n paddingY: '--labelPadding',\n order: 1,\n visibility: {\n isProgressVisible: 'hidden'\n }\n })({isProgressVisible}),\n // @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past\n 'data-rsp-slot': 'text'\n }\n ],\n [\n IconContext,\n {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0,\n visibility: {\n isProgressVisible: 'hidden'\n }\n })({isProgressVisible})\n }\n ]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n {isPending && (\n <div\n className={style({\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n visibility: {\n default: 'hidden',\n isProgressVisible: 'visible'\n }\n })({isProgressVisible, isPending})}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('button.pending')}\n size=\"S\"\n staticColor={staticColor}\n styles={style({\n size: {\n size: {\n S: 14,\n M: 18,\n L: 20,\n XL: 24\n }\n }\n })({size})}\n />\n </div>\n )}\n </Provider>\n </>\n )}\n </RACButton>\n );\n});\n\n/**\n * A LinkButton combines the functionality of a link with the appearance of a button. Useful for\n * allowing users to navigate to another page.\n */\nexport const LinkButton = forwardRef(function LinkButton(\n props: LinkButtonProps,\n ref: FocusableRef<HTMLAnchorElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkButtonContext);\n props = useFormProps(props);\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n let {fillStyle = 'fill', size = 'M', variant = 'primary', staticColor, styles, children} = props;\n\n return (\n <Link\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps =>\n (props.UNSAFE_className || '') +\n button(\n {\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant,\n fillStyle,\n size,\n staticColor,\n isStaticColor: !!staticColor,\n isPending: false\n },\n styles\n )\n }>\n {renderProps => (\n <>\n {variant === 'genai' || variant === 'premium' ? (\n <span\n className={gradient({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant\n })}\n />\n ) : null}\n <Provider\n values={[\n [SkeletonContext, null],\n [\n TextContext,\n {\n styles: style({paddingY: '--labelPadding', order: 1}),\n // @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past\n 'data-rsp-slot': 'text'\n }\n ],\n [\n IconContext,\n {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0\n })\n }\n ]\n ]}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n </Provider>\n </>\n )}\n </Link>\n );\n});\n"],"names":[],"version":3,"file":"Button.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AAwFM,MAAM,0DACX,CAAA,GAAA,oBAAY,EAA4E;AACnF,MAAM,0DACX,CAAA,GAAA,oBAAY,EAA4E;AAE1F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmMN,4FAA4F;AAC5F,oGAAoG;AACpG,iDAAiD;AACjD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEC,SAAS,0CAAgB,SAAkB;IAChD,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,eAAO,EAAE;IACzD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI;QACJ,IAAI,WACF,UAAU,WAAW;YACnB,qBAAqB;QACvB,GAAG;aAEH,qBAAqB;QAEvB,OAAO;YACL,aAAa;QACf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gBAAgB,IAAI,EAAC,IAC5B,6BACE;gBACE,GAAG,WAAW;gBACd,+CAA+C;gBAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;yBACnE;2BACA;sBACA;6BACA;gBACA,eAAe,CAAC,CAAC;gBACjB,WAAW;YACb,GACA;kBAGH,CAAA,4BACC;;oBACG,YAAY,WAAW,YAAY,0BAClC,gBAAC;wBACC,WAAW,+BAAS;4BAClB,GAAG,WAAW;4BACd,+CAA+C;4BAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;qCACnE;wBACF;yBAEA;kCACJ,gBAAC,CAAA,GAAA,eAAO;wBACN,QAAQ;4BACN;gCAAC,CAAA,GAAA,yCAAc;gCAAG;6BAAK;4BACvB;gCACE,CAAA,GAAA,yCAAU;gCACV;oCACE,MAAM;oCACN,kHAAkH;oCAClH,iBAAiB;gCACnB;6BACD;4BACD;gCACE,CAAA,GAAA,yCAAU;gCACV;oCACE,QAAQ,CAAA,GAAA,yCAAa,EAAE;wCAAC,MAAM;wCAAQ,MAAM;oCAAmB;oCAC/D,MAAM;gCAKR;6BACD;yBACF;kCACA,OAAO,aAAa,yBAAW,gBAAC,CAAA,GAAA,yCAAG;sCAAG;6BAAmB;;;;;AAMtE","sources":["packages/@react-spectrum/s2/src/Button.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 {baseColor, focusRing, fontRelative, lightDark, style} from '../style' with {type: 'macro'};\nimport {\n ButtonRenderProps,\n Button as RACButton,\n ButtonProps as RACButtonProps\n} from 'react-aria-components/Button';\nimport {centerBaseline} from './CenterBaseline';\nimport {ContextValue, Provider} from 'react-aria-components/slots';\nimport {\n control,\n getAllowedOverrides,\n staticColor,\n StyleProps\n} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useState} from 'react';\nimport {FocusableRef, FocusableRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {IconContext} from './Icon';\nimport intlMessages from '../intl/*.json';\nimport {linearGradient} from '../style/spectrum-theme' with {type: 'macro'};\nimport {Link, LinkProps} from 'react-aria-components/Link';\nimport {OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {pressScale} from './pressScale';\nimport {ProgressCircle} from './ProgressCircle';\nimport {SkeletonContext} from './Skeleton';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from './useDOMRef';\nimport {useFormProps} from './Form';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ButtonStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button.\n *\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary' | 'accent' | 'negative' | 'premium' | 'genai';\n /**\n * The background style of the Button.\n *\n * @default 'fill'\n */\n fillStyle?: 'fill' | 'outline';\n /**\n * The size of the Button.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n /** The static color style to apply. Useful when the Button appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto';\n}\n\nexport interface ButtonProps\n extends\n Omit<\n RACButtonProps,\n | 'className'\n | 'style'\n | 'render'\n | 'children'\n | 'onHover'\n | 'onHoverStart'\n | 'onHoverEnd'\n | 'onHoverChange'\n | 'onClick'\n | keyof GlobalDOMAttributes\n >,\n StyleProps,\n ButtonStyleProps {\n /** The content to display in the Button. */\n children: ReactNode;\n}\n\nexport interface LinkButtonProps\n extends\n Omit<\n LinkProps,\n 'className' | 'style' | 'render' | 'children' | 'onClick' | keyof GlobalDOMAttributes\n >,\n StyleProps,\n ButtonStyleProps {\n /** The content to display in the Button. */\n children: ReactNode;\n}\n\nexport const ButtonContext =\n createContext<ContextValue<Partial<ButtonProps>, FocusableRefValue<HTMLButtonElement>>>(null);\nexport const LinkButtonContext =\n createContext<ContextValue<Partial<ButtonProps>, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: boolean}>(\n {\n ...focusRing(),\n ...staticColor(),\n ...control({shape: 'pill', wrap: true, icon: true}),\n position: 'relative',\n justifyContent: 'center',\n textAlign: 'start',\n fontWeight: 'bold',\n userSelect: 'none',\n width: 'fit',\n textDecoration: 'none', // for link buttons\n transition: 'default',\n borderStyle: 'solid',\n borderWidth: {\n fillStyle: {\n fill: 0,\n outline: 2\n },\n variant: {\n premium: 0,\n genai: 0\n }\n },\n borderColor: {\n variant: {\n primary: baseColor('gray-800'),\n secondary: baseColor('gray-300')\n },\n isDisabled: 'disabled',\n isStaticColor: {\n variant: {\n primary: baseColor('transparent-overlay-800'),\n secondary: baseColor('transparent-overlay-300')\n },\n isDisabled: 'transparent-overlay-300'\n },\n forcedColors: {\n default: 'ButtonBorder',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n backgroundColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('neutral'),\n secondary: baseColor('gray-100'),\n accent: {\n default: lightDark('accent-900', 'accent-700'),\n isHovered: lightDark('accent-1000', 'accent-600'),\n isPressed: lightDark('accent-1000', 'accent-600'),\n isFocusVisible: lightDark('accent-1000', 'accent-600')\n },\n negative: {\n default: lightDark('negative-900', 'negative-700'),\n isHovered: lightDark('negative-1000', 'negative-600'),\n isPressed: lightDark('negative-1000', 'negative-600'),\n isFocusVisible: lightDark('negative-1000', 'negative-600')\n },\n premium: 'gray-100',\n genai: 'gray-100'\n },\n isDisabled: 'disabled'\n },\n outline: {\n variant: {\n premium: 'gray-100',\n genai: 'gray-100'\n },\n default: 'transparent',\n isHovered: 'gray-100',\n isPressed: 'gray-100',\n isFocusVisible: 'gray-100',\n isDisabled: {\n default: 'transparent',\n variant: {\n premium: 'gray-100',\n genai: 'gray-100'\n }\n }\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('transparent-overlay-800'),\n secondary: baseColor('transparent-overlay-100'),\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n },\n isDisabled: 'transparent-overlay-100'\n },\n outline: {\n variant: {\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n },\n default: 'transparent',\n isHovered: 'transparent-overlay-100',\n isPressed: 'transparent-overlay-100',\n isFocusVisible: 'transparent-overlay-100',\n isDisabled: {\n default: 'transparent',\n variant: {\n premium: 'transparent-overlay-100',\n genai: 'transparent-overlay-100'\n }\n }\n }\n }\n },\n forcedColors: {\n fillStyle: {\n fill: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n },\n outline: 'ButtonFace'\n }\n }\n },\n color: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'gray-25',\n secondary: baseColor('neutral'),\n accent: 'white',\n negative: 'white',\n premium: 'white',\n genai: 'white'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: baseColor('neutral'),\n variant: {\n premium: 'white',\n genai: 'white'\n },\n isDisabled: 'disabled'\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'auto',\n secondary: 'white',\n premium: 'white',\n genai: 'white'\n }\n },\n outline: {\n variant: {\n premium: 'white',\n genai: 'white'\n },\n default: 'white'\n }\n },\n isDisabled: 'transparent-overlay-400'\n },\n forcedColors: {\n fillStyle: {\n fill: {\n default: 'ButtonFace',\n isDisabled: 'HighlightText'\n },\n outline: {\n default: 'ButtonText',\n isDisabled: 'GrayText'\n }\n }\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n outlineColor: {\n default: 'focus-ring',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'Highlight'\n },\n forcedColorAdjust: 'none',\n disableTapHighlight: true\n },\n getAllowedOverrides()\n);\n\n// Put the gradient background on a separate element from the button to work around a Safari\n// bug where transitions of custom properties cause layout flickering if any properties use rems. 🤣\n// https://bugs.webkit.org/show_bug.cgi?id=285622\nconst gradient = style({\n position: 'absolute',\n inset: 0,\n zIndex: -1,\n transition: 'default',\n borderRadius: 'inherit',\n backgroundImage: {\n variant: {\n premium: {\n default: linearGradient(\n 'to bottom right',\n ['fuchsia-900', 0],\n ['indigo-900', 66],\n ['blue-900', 100]\n ),\n isHovered: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n ),\n isPressed: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n ),\n isFocusVisible: linearGradient(\n 'to bottom right',\n ['fuchsia-1000', 0],\n ['indigo-1000', 66],\n ['blue-1000', 100]\n )\n },\n genai: {\n default: linearGradient(\n 'to bottom right',\n ['red-900', 0],\n ['magenta-900', 33],\n ['indigo-900', 100]\n ),\n isHovered: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n ),\n isPressed: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n ),\n isFocusVisible: linearGradient(\n 'to bottom right',\n ['red-1000', 0],\n ['magenta-1000', 33],\n ['indigo-1000', 100]\n )\n }\n },\n isDisabled: 'none',\n forcedColors: 'none'\n },\n // Force gradient colors to remain static between light and dark theme.\n colorScheme: {\n variant: {\n premium: 'light',\n genai: 'light'\n }\n }\n});\n\nexport function usePendingState(isPending: boolean) {\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n if (isPending) {\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n setIsProgressVisible(false);\n }\n return () => {\n clearTimeout(timeout);\n };\n }, [isPending]);\n return {isProgressVisible};\n}\n\n/**\n * Buttons allow users to perform an action.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = forwardRef(function Button(\n props: ButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonContext);\n props = useFormProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {isPending = false, variant = 'primary', fillStyle = 'fill', size = 'M', staticColor} = props;\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n let {isProgressVisible} = usePendingState(isPending);\n\n return (\n <RACButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps =>\n (props.UNSAFE_className || '') +\n button(\n {\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n isDisabled: renderProps.isDisabled || isProgressVisible,\n variant,\n fillStyle,\n size,\n staticColor,\n isStaticColor: !!staticColor\n },\n props.styles\n )\n }>\n {renderProps => (\n <>\n {variant === 'genai' || variant === 'premium' ? (\n <span\n className={gradient({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n isDisabled: renderProps.isDisabled || isProgressVisible,\n variant\n })}\n />\n ) : null}\n <Provider\n values={[\n [SkeletonContext, null],\n [\n TextContext,\n {\n styles: style({\n paddingY: '--labelPadding',\n order: 1,\n visibility: {\n isProgressVisible: 'hidden'\n }\n })({isProgressVisible}),\n // @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past\n 'data-rsp-slot': 'text'\n }\n ],\n [\n IconContext,\n {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0,\n visibility: {\n isProgressVisible: 'hidden'\n }\n })({isProgressVisible})\n }\n ]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n {isPending && (\n <div\n className={style({\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n visibility: {\n default: 'hidden',\n isProgressVisible: 'visible'\n }\n })({isProgressVisible, isPending})}>\n <ProgressCircle\n isIndeterminate\n aria-label={stringFormatter.format('button.pending')}\n size=\"S\"\n staticColor={staticColor}\n styles={style({\n size: {\n size: {\n S: 14,\n M: 18,\n L: 20,\n XL: 24\n }\n }\n })({size})}\n />\n </div>\n )}\n </Provider>\n </>\n )}\n </RACButton>\n );\n});\n\n/**\n * A LinkButton combines the functionality of a link with the appearance of a button. Useful for\n * allowing users to navigate to another page.\n */\nexport const LinkButton = forwardRef(function LinkButton(\n props: LinkButtonProps,\n ref: FocusableRef<HTMLAnchorElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkButtonContext);\n props = useFormProps(props);\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n let {fillStyle = 'fill', size = 'M', variant = 'primary', staticColor, styles, children} = props;\n\n return (\n <Link\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps =>\n (props.UNSAFE_className || '') +\n button(\n {\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant,\n fillStyle,\n size,\n staticColor,\n isStaticColor: !!staticColor,\n isPending: false\n },\n styles\n )\n }>\n {renderProps => (\n <>\n {variant === 'genai' || variant === 'premium' ? (\n <span\n className={gradient({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant\n })}\n />\n ) : null}\n <Provider\n values={[\n [SkeletonContext, null],\n [\n TextContext,\n {\n styles: style({paddingY: '--labelPadding', order: 1}),\n // @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past\n 'data-rsp-slot': 'text'\n }\n ],\n [\n IconContext,\n {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0\n })\n }\n ]\n ]}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n </Provider>\n </>\n )}\n </Link>\n );\n});\n"],"names":[],"version":3,"file":"Button.mjs.map"}
@@ -41,32 +41,35 @@ const $e1016b8947dbadb8$export$4c574c91bb0be0e2 = /*#__PURE__*/ (0, $5rFNy$react
41
41
  const $e1016b8947dbadb8$var$buttongroup = function anonymous(props, overrides) {
42
42
  let rules = " ";
43
43
  let position = false;
44
+ let maxWidth = false;
44
45
  let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
45
46
  for (let p of matches){
46
47
  if (p[1] === "_P") position = true;
48
+ if (p[1] === "L") maxWidth = true;
47
49
  rules += p[0];
48
50
  }
49
- rules += ' sh131';
50
- if (!position) rules += ' _Pc131';
51
- if (props.size === "XL") rules += ' Ug131';
52
- else if (props.size === "L") rules += ' Ug131';
53
- else if (props.size === "M") rules += ' Ug131';
54
- else if (props.size === "S") rules += ' Ue131';
55
- if (props.size === "XL") rules += ' qg131';
56
- else if (props.size === "L") rules += ' qg131';
57
- else if (props.size === "M") rules += ' qg131';
58
- else if (props.size === "S") rules += ' qe131';
59
- if (props.orientation === "vertical") rules += ' _ta131';
60
- else rules += ' _tc131';
51
+ rules += ' sh15';
52
+ if (!position) rules += ' _Pc15';
53
+ if (!maxWidth) rules += ' La15';
54
+ if (props.size === "XL") rules += ' Ug15';
55
+ else if (props.size === "L") rules += ' Ug15';
56
+ else if (props.size === "M") rules += ' Ug15';
57
+ else if (props.size === "S") rules += ' Ue15';
58
+ if (props.size === "XL") rules += ' qg15';
59
+ else if (props.size === "L") rules += ' qg15';
60
+ else if (props.size === "M") rules += ' qg15';
61
+ else if (props.size === "S") rules += ' qe15';
62
+ if (props.orientation === "vertical") rules += ' _ta15';
63
+ else rules += ' _tc15';
61
64
  if (props.orientation === "vertical") {
62
- if (props.align === "center") rules += ' eb131';
63
- else if (props.align === "end") rules += ' ec131';
64
- else rules += ' ed131';
65
- } else rules += ' eb131';
65
+ if (props.align === "center") rules += ' eb15';
66
+ else if (props.align === "end") rules += ' ec15';
67
+ else rules += ' ed15';
68
+ } else rules += ' eb15';
66
69
  if (props.orientation === "vertical") {
67
- if (props.align === "center") rules += ' _Ca131';
68
- else if (props.align === "end") rules += ' _Cb131';
69
- else rules += ' _Cg131';
70
+ if (props.align === "center") rules += ' _Ca15';
71
+ else if (props.align === "end") rules += ' _Cb15';
72
+ else rules += ' _Cg15';
70
73
  }
71
74
  return rules;
72
75
  };
@@ -120,7 +123,7 @@ const $e1016b8947dbadb8$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $5rFNy$react
120
123
  });
121
124
  if (props.isHidden) return null;
122
125
  let context = {
123
- styles: " _va131",
126
+ styles: " _va15",
124
127
  size: size,
125
128
  isDisabled: isDisabled
126
129
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAiDM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAE5C,CAAC;AAEH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDC,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAC7C,KAAuB,EACvB,GAA2B;IAE3B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,QACF,OAAO,kBACP,cAAc,qBACd,QAAQ,mBACR,QAAQ,cACR,UAAU,EACV,GAAG,YACJ,GAAG;IAE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AC,IAC5B,kCACE;mBACE;YACA,aAAa,gBAAgB,cAAc,cAAc,aAAa;kBACtE;QACF,GACA,MAAM,MAAM;kBAGhB,cAAA,gCAAC,CAAA,GAAA,wCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,uCAAY;oBAAG;iBAAQ;gBACxB;oBAAC,CAAA,GAAA,2CAAgB;oBAAG;iBAAQ;aAC7B;sBACA;;;AAIT","sources":["packages/@react-spectrum/s2/src/ButtonGroup.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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAiDM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAE5C,CAAC;AAEH,MAAM;;;;;;;;;;;;;;;;;;;;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AC;IACnB,CAAA,GAAA,+DAAgB,EAAE;QAAC,KAAK;QAAQ,UAAU;IAAgB;IAE1D,IAAI,AAAC,MAAkC,QAAQ,EAC7C,OAAO;IAGT,IAAI,UAAU;QAAC,MAAM;cAA0B;oBAAM;IAAU;IAC/D,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,6CAAa,EAAE,WAAW;QAC9B,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WACE,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAC5B,kCACE;mBACE;YACA,aAAa,gBAAgB,cAAc,cAAc,aAAa;kBACtE;QACF,GACA,MAAM,MAAM;kBAGhB,cAAA,gCAAC,CAAA,GAAA,wCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,uCAAY;oBAAG;iBAAQ;gBACxB;oBAAC,CAAA,GAAA,2CAAgB;oBAAG;iBAAQ;aAC7B;sBACA;;;AAIT","sources":["packages/@react-spectrum/s2/src/ButtonGroup.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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n maxWidth: 'full',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.cjs.map"}
@@ -1,61 +1,65 @@
1
1
  @layer _.a {
2
- .sh131 {
2
+ .sh15 {
3
3
  display: inline-flex;
4
4
  }
5
5
 
6
- ._Pc131 {
6
+ ._Pc15 {
7
7
  position: relative;
8
8
  }
9
9
 
10
- .Ue131 {
10
+ .La15 {
11
+ max-width: 100%;
12
+ }
13
+
14
+ .Ue15 {
11
15
  row-gap: .5rem;
12
16
  }
13
17
 
14
- .Ug131 {
18
+ .Ug15 {
15
19
  row-gap: .75rem;
16
20
  }
17
21
 
18
- .qe131 {
22
+ .qe15 {
19
23
  column-gap: .5rem;
20
24
  }
21
25
 
22
- .qg131 {
26
+ .qg15 {
23
27
  column-gap: .75rem;
24
28
  }
25
29
 
26
- ._tc131 {
30
+ ._tc15 {
27
31
  flex-direction: row;
28
32
  }
29
33
 
30
- ._ta131 {
34
+ ._ta15 {
31
35
  flex-direction: column;
32
36
  }
33
37
 
34
- .ed131 {
38
+ .ed15 {
35
39
  align-items: start;
36
40
  }
37
41
 
38
- .ec131 {
42
+ .ec15 {
39
43
  align-items: end;
40
44
  }
41
45
 
42
- .eb131 {
46
+ .eb15 {
43
47
  align-items: center;
44
48
  }
45
49
 
46
- ._Cg131 {
50
+ ._Cg15 {
47
51
  justify-content: start;
48
52
  }
49
53
 
50
- ._Cb131 {
54
+ ._Cb15 {
51
55
  justify-content: end;
52
56
  }
53
57
 
54
- ._Ca131 {
58
+ ._Ca15 {
55
59
  justify-content: center;
56
60
  }
57
61
 
58
- ._va131 {
62
+ ._va15 {
59
63
  flex-shrink: 0;
60
64
  }
61
65
  }
@@ -1 +1 @@
1
- {"mappings":"AC+DoB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkHK","sources":["46da5d9d2ee61a4a","packages/@react-spectrum/s2/src/ButtonGroup.tsx"],"sourcesContent":["@import \"8be38106edd06864\";\n@import \"d77a01524490dd5a\";\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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.css.map"}
1
+ {"mappings":"AC+DoB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmHK","sources":["46da5d9d2ee61a4a","packages/@react-spectrum/s2/src/ButtonGroup.tsx"],"sourcesContent":["@import \"8be38106edd06864\";\n@import \"d77a01524490dd5a\";\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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n maxWidth: 'full',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.css.map"}
@@ -34,32 +34,35 @@ const $472eaa9a9b344b9a$export$4c574c91bb0be0e2 = /*#__PURE__*/ (0, $bnJX2$creat
34
34
  const $472eaa9a9b344b9a$var$buttongroup = function anonymous(props, overrides) {
35
35
  let rules = " ";
36
36
  let position = false;
37
+ let maxWidth = false;
37
38
  let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
38
39
  for (let p of matches){
39
40
  if (p[1] === "_P") position = true;
41
+ if (p[1] === "L") maxWidth = true;
40
42
  rules += p[0];
41
43
  }
42
- rules += ' sh131';
43
- if (!position) rules += ' _Pc131';
44
- if (props.size === "XL") rules += ' Ug131';
45
- else if (props.size === "L") rules += ' Ug131';
46
- else if (props.size === "M") rules += ' Ug131';
47
- else if (props.size === "S") rules += ' Ue131';
48
- if (props.size === "XL") rules += ' qg131';
49
- else if (props.size === "L") rules += ' qg131';
50
- else if (props.size === "M") rules += ' qg131';
51
- else if (props.size === "S") rules += ' qe131';
52
- if (props.orientation === "vertical") rules += ' _ta131';
53
- else rules += ' _tc131';
44
+ rules += ' sh15';
45
+ if (!position) rules += ' _Pc15';
46
+ if (!maxWidth) rules += ' La15';
47
+ if (props.size === "XL") rules += ' Ug15';
48
+ else if (props.size === "L") rules += ' Ug15';
49
+ else if (props.size === "M") rules += ' Ug15';
50
+ else if (props.size === "S") rules += ' Ue15';
51
+ if (props.size === "XL") rules += ' qg15';
52
+ else if (props.size === "L") rules += ' qg15';
53
+ else if (props.size === "M") rules += ' qg15';
54
+ else if (props.size === "S") rules += ' qe15';
55
+ if (props.orientation === "vertical") rules += ' _ta15';
56
+ else rules += ' _tc15';
54
57
  if (props.orientation === "vertical") {
55
- if (props.align === "center") rules += ' eb131';
56
- else if (props.align === "end") rules += ' ec131';
57
- else rules += ' ed131';
58
- } else rules += ' eb131';
58
+ if (props.align === "center") rules += ' eb15';
59
+ else if (props.align === "end") rules += ' ec15';
60
+ else rules += ' ed15';
61
+ } else rules += ' eb15';
59
62
  if (props.orientation === "vertical") {
60
- if (props.align === "center") rules += ' _Ca131';
61
- else if (props.align === "end") rules += ' _Cb131';
62
- else rules += ' _Cg131';
63
+ if (props.align === "center") rules += ' _Ca15';
64
+ else if (props.align === "end") rules += ' _Cb15';
65
+ else rules += ' _Cg15';
63
66
  }
64
67
  return rules;
65
68
  };
@@ -113,7 +116,7 @@ const $472eaa9a9b344b9a$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $bnJX2$forwa
113
116
  });
114
117
  if (props.isHidden) return null;
115
118
  let context = {
116
- styles: " _va131",
119
+ styles: " _va15",
117
120
  size: size,
118
121
  isDisabled: isDisabled
119
122
  };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,EAAsB;IACxC,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,OAAO,OAAO,GAAG,OAAO,OAAO,CAAC,aAAa;IAE/C,uDAAuD;IACzD,GAAG;QAAC,OAAO,OAAO;KAAC;IACnB,CAAA,GAAA,wBAAgB,EAAE;QAAC,KAAK;QAAQ,UAAU;IAAgB;IAE1D,IAAI,AAAC,MAAkC,QAAQ,EAC7C,OAAO;IAGT,IAAI,UAAU;QAAC,MAAM;cAA0B;oBAAM;IAAU;IAC/D,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAC9B,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WACE,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAC5B,kCACE;mBACE;YACA,aAAa,gBAAgB,cAAc,cAAc,aAAa;kBACtE;QACF,GACA,MAAM,MAAM;kBAGhB,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAY;oBAAG;iBAAQ;gBACxB;oBAAC,CAAA,GAAA,yCAAgB;oBAAG;iBAAQ;aAC7B;sBACA;;;AAIT","sources":["packages/@react-spectrum/s2/src/ButtonGroup.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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAiDM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAE5C,CAAC;AAEH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDC,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAC7C,KAAuB,EACvB,GAA2B;IAE3B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,yCAAQ,EAAE;IACvB,IAAI,QACF,OAAO,kBACP,cAAc,qBACd,QAAQ,mBACR,QAAQ,cACR,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,qBAAa,EAAE;IAEnD,IAAI,mBAAmB,CAAA,GAAA,kBAAU,EAAE;QACjC,IAAI,qBAAqB;YACvB,IAAI,OAAO,OAAO,IAAI,gBAAgB,cAAc;gBAClD,IAAI,sBAAsB,MAAM,IAAI,CAAC,OAAO,OAAO,CAAC,QAAQ;gBAC5D,IAAI,OAAO,OAAO,OAAO,CAAC,WAAW,GAAG,GAAG,qCAAqC;gBAChF,0EAA0E;gBAC1E,0EAA0E;gBAC1E,IACE,oBAAoB,IAAI,CACtB,CAAA,QAAS,MAAM,UAAU,GAAG,KAAK,MAAM,UAAU,GAAG,MAAM,WAAW,GAAG,OAG1E,OAAO;gBAET,OAAO;YACT;QACF;QACA,IAAI,gBAAgB,cAClB,eAAe;YACb,uCAAuC;YACvC,MAAM;YAEN,4CAA4C;YAC5C,MAAM;QACR;IAEF,uDAAuD;IACzD,GAAG;QAAC;QAAQ;QAAa;QAAgB;KAAS;IAElD,mDAAmD;IACnD,8HAA8H;IAC9H,CAAA,GAAA,sBAAc,EAAE;QACd;IACF,GAAG;QAAC;KAAiB;IAErB,wKAAwK;IACxK,IAAI,SAAS,CAAA,GAAA,aAAK,EAAsB;IACxC,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,OAAO,OAAO,GAAG,OAAO,OAAO,CAAC,aAAa;IAE/C,uDAAuD;IACzD,GAAG;QAAC,OAAO,OAAO;KAAC;IACnB,CAAA,GAAA,wBAAgB,EAAE;QAAC,KAAK;QAAQ,UAAU;IAAgB;IAE1D,IAAI,AAAC,MAAkC,QAAQ,EAC7C,OAAO;IAGT,IAAI,UAAU;QAAC,MAAM;cAA0B;oBAAM;IAAU;IAC/D,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAC9B,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WACE,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAC5B,kCACE;mBACE;YACA,aAAa,gBAAgB,cAAc,cAAc,aAAa;kBACtE;QACF,GACA,MAAM,MAAM;kBAGhB,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAY;oBAAG;iBAAQ;gBACxB;oBAAC,CAAA,GAAA,yCAAgB;oBAAG;iBAAQ;aAC7B;sBACA;;;AAIT","sources":["packages/@react-spectrum/s2/src/ButtonGroup.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 {ButtonContext, LinkButtonContext} from './Button';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components/slots';\nimport {createContext, forwardRef, ReactNode, useCallback, useRef} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\ninterface ButtonGroupStyleProps {\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * The alignment of the Buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: 'start' | 'end' | 'center';\n /**\n * The size of the Buttons within the ButtonGroup.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL';\n}\n\nexport interface ButtonGroupProps extends ButtonGroupStyleProps, SlotProps, StyleProps, DOMProps {\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n}\n\ninterface ButtonGroupContextValue extends Partial<ButtonGroupProps> {\n /** Whether the ButtonGroup shouldn't be rendered. */\n isHidden?: boolean;\n}\n\nexport const ButtonGroupContext = createContext<\n ContextValue<Partial<ButtonGroupContextValue>, DOMRefValue<HTMLDivElement>>\n>({});\n\nconst buttongroup = style<ButtonGroupStyleProps>(\n {\n display: 'inline-flex',\n position: 'relative',\n maxWidth: 'full',\n gap: {\n size: {\n S: 8,\n M: 12,\n L: 12,\n XL: 12\n }\n },\n flexDirection: {\n default: 'row',\n orientation: {\n vertical: 'column'\n }\n },\n alignItems: {\n default: 'center',\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n },\n justifyContent: {\n orientation: {\n vertical: {\n default: 'start',\n align: {\n end: 'end',\n center: 'center'\n }\n }\n }\n }\n },\n getAllowedOverrides()\n);\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = forwardRef(function ButtonGroup(\n props: ButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonGroupContext);\n let domRef = useDOMRef(ref);\n let {\n size = 'M',\n orientation = 'horizontal',\n align = 'start',\n children,\n isDisabled,\n ...otherProps\n } = props;\n\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef, orientation, setHasOverflow, children]);\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [domRef.current]);\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n if ((props as ButtonGroupContextValue).isHidden) {\n return null;\n }\n\n let context = {styles: style({flexShrink: 0}), size, isDisabled};\n return (\n <div\n {...filterDOMProps(otherProps)}\n ref={domRef}\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n buttongroup(\n {\n align,\n orientation: orientation === 'vertical' || hasOverflow ? 'vertical' : 'horizontal',\n size\n },\n props.styles\n )\n }>\n <Provider\n values={[\n [ButtonContext, context],\n [LinkButtonContext, context]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.mjs.map"}