@react-spectrum/s2 3.0.0-nightly-326f48154-241216 → 3.0.0-nightly-adae13c78-241218

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 (184) hide show
  1. package/dist/ActionButton.cjs +58 -80
  2. package/dist/ActionButton.cjs.map +1 -1
  3. package/dist/ActionButton.css +76 -96
  4. package/dist/ActionButton.css.map +1 -1
  5. package/dist/ActionButton.mjs +58 -80
  6. package/dist/ActionButton.mjs.map +1 -1
  7. package/dist/ActionButtonGroup.cjs.map +1 -1
  8. package/dist/ActionButtonGroup.css.map +1 -1
  9. package/dist/ActionButtonGroup.mjs.map +1 -1
  10. package/dist/Badge.cjs +66 -66
  11. package/dist/Badge.css +43 -43
  12. package/dist/Badge.mjs +66 -66
  13. package/dist/Breadcrumbs.cjs +6 -6
  14. package/dist/Breadcrumbs.css +4 -4
  15. package/dist/Breadcrumbs.mjs +6 -6
  16. package/dist/Button.cjs +89 -134
  17. package/dist/Button.cjs.map +1 -1
  18. package/dist/Button.css +102 -134
  19. package/dist/Button.css.map +1 -1
  20. package/dist/Button.mjs +89 -134
  21. package/dist/Button.mjs.map +1 -1
  22. package/dist/Card.cjs +4 -4
  23. package/dist/Card.css +3 -3
  24. package/dist/Card.mjs +4 -4
  25. package/dist/CardView.cjs +1 -1
  26. package/dist/CardView.css +1 -1
  27. package/dist/CardView.mjs +1 -1
  28. package/dist/Checkbox.cjs +10 -10
  29. package/dist/Checkbox.css +10 -10
  30. package/dist/Checkbox.mjs +10 -10
  31. package/dist/CloseButton.cjs +17 -28
  32. package/dist/CloseButton.cjs.map +1 -1
  33. package/dist/CloseButton.css +19 -31
  34. package/dist/CloseButton.css.map +1 -1
  35. package/dist/CloseButton.mjs +17 -28
  36. package/dist/CloseButton.mjs.map +1 -1
  37. package/dist/ColorArea.cjs +1 -1
  38. package/dist/ColorArea.css +1 -1
  39. package/dist/ColorArea.mjs +1 -1
  40. package/dist/ColorHandle.cjs +3 -3
  41. package/dist/ColorHandle.css +3 -3
  42. package/dist/ColorHandle.mjs +3 -3
  43. package/dist/ColorSlider.cjs +1 -1
  44. package/dist/ColorSlider.css +1 -1
  45. package/dist/ColorSlider.mjs +1 -1
  46. package/dist/ColorSwatchPicker.cjs +1 -1
  47. package/dist/ColorSwatchPicker.css +1 -1
  48. package/dist/ColorSwatchPicker.mjs +1 -1
  49. package/dist/ColorWheel.cjs +2 -2
  50. package/dist/ColorWheel.css +1 -1
  51. package/dist/ColorWheel.mjs +2 -2
  52. package/dist/ComboBox.cjs +5 -5
  53. package/dist/ComboBox.css +4 -4
  54. package/dist/ComboBox.mjs +5 -5
  55. package/dist/Disclosure.cjs +1 -1
  56. package/dist/Disclosure.css +1 -1
  57. package/dist/Disclosure.mjs +1 -1
  58. package/dist/Divider.cjs +8 -8
  59. package/dist/Divider.cjs.map +1 -1
  60. package/dist/Divider.css +13 -13
  61. package/dist/Divider.css.map +1 -1
  62. package/dist/Divider.mjs +8 -8
  63. package/dist/Divider.mjs.map +1 -1
  64. package/dist/DropZone.cjs +4 -4
  65. package/dist/DropZone.css +2 -2
  66. package/dist/DropZone.mjs +4 -4
  67. package/dist/Field.cjs +23 -18
  68. package/dist/Field.cjs.map +1 -1
  69. package/dist/Field.css +7 -15
  70. package/dist/Field.css.map +1 -1
  71. package/dist/Field.mjs +23 -18
  72. package/dist/Field.mjs.map +1 -1
  73. package/dist/InlineAlert.cjs +24 -29
  74. package/dist/InlineAlert.cjs.map +1 -1
  75. package/dist/InlineAlert.css +15 -19
  76. package/dist/InlineAlert.css.map +1 -1
  77. package/dist/InlineAlert.mjs +24 -29
  78. package/dist/InlineAlert.mjs.map +1 -1
  79. package/dist/Link.cjs +7 -6
  80. package/dist/Link.cjs.map +1 -1
  81. package/dist/Link.css +14 -14
  82. package/dist/Link.css.map +1 -1
  83. package/dist/Link.mjs +7 -6
  84. package/dist/Link.mjs.map +1 -1
  85. package/dist/Menu.cjs +28 -8
  86. package/dist/Menu.cjs.map +1 -1
  87. package/dist/Menu.css +3 -3
  88. package/dist/Menu.css.map +1 -1
  89. package/dist/Menu.mjs +29 -9
  90. package/dist/Menu.mjs.map +1 -1
  91. package/dist/Meter.cjs +13 -13
  92. package/dist/Meter.cjs.map +1 -1
  93. package/dist/Meter.css +18 -22
  94. package/dist/Meter.css.map +1 -1
  95. package/dist/Meter.mjs +13 -13
  96. package/dist/Meter.mjs.map +1 -1
  97. package/dist/Modal.cjs +1 -1
  98. package/dist/Modal.css +1 -1
  99. package/dist/Modal.mjs +1 -1
  100. package/dist/NumberField.cjs +4 -4
  101. package/dist/NumberField.css +4 -4
  102. package/dist/NumberField.mjs +4 -4
  103. package/dist/Picker.cjs +4 -4
  104. package/dist/Picker.css +4 -4
  105. package/dist/Picker.mjs +4 -4
  106. package/dist/Popover.cjs +3 -3
  107. package/dist/Popover.css +3 -3
  108. package/dist/Popover.mjs +3 -3
  109. package/dist/ProgressBar.cjs +20 -18
  110. package/dist/ProgressBar.cjs.map +1 -1
  111. package/dist/ProgressBar.css +20 -24
  112. package/dist/ProgressBar.css.map +1 -1
  113. package/dist/ProgressBar.mjs +20 -18
  114. package/dist/ProgressBar.mjs.map +1 -1
  115. package/dist/ProgressCircle.cjs +11 -9
  116. package/dist/ProgressCircle.cjs.map +1 -1
  117. package/dist/ProgressCircle.css +14 -14
  118. package/dist/ProgressCircle.css.map +1 -1
  119. package/dist/ProgressCircle.mjs +11 -9
  120. package/dist/ProgressCircle.mjs.map +1 -1
  121. package/dist/Provider.cjs +1 -1
  122. package/dist/Provider.css +1 -1
  123. package/dist/Provider.mjs +1 -1
  124. package/dist/Radio.cjs +6 -6
  125. package/dist/Radio.css +6 -6
  126. package/dist/Radio.mjs +6 -6
  127. package/dist/SearchField.cjs +1 -1
  128. package/dist/SearchField.css +1 -1
  129. package/dist/SearchField.mjs +1 -1
  130. package/dist/SegmentedControl.cjs +8 -8
  131. package/dist/SegmentedControl.css +8 -8
  132. package/dist/SegmentedControl.mjs +8 -8
  133. package/dist/Slider.cjs +8 -8
  134. package/dist/Slider.css +5 -5
  135. package/dist/Slider.mjs +8 -8
  136. package/dist/Switch.cjs +7 -7
  137. package/dist/Switch.css +6 -6
  138. package/dist/Switch.mjs +7 -7
  139. package/dist/TableView.cjs +17 -17
  140. package/dist/TableView.css +11 -11
  141. package/dist/TableView.mjs +17 -17
  142. package/dist/Tabs.cjs +5 -5
  143. package/dist/Tabs.css +5 -5
  144. package/dist/Tabs.mjs +5 -5
  145. package/dist/TabsPicker.cjs +1 -1
  146. package/dist/TabsPicker.css +1 -1
  147. package/dist/TabsPicker.mjs +1 -1
  148. package/dist/TagGroup.cjs +10 -10
  149. package/dist/TagGroup.css +8 -8
  150. package/dist/TagGroup.mjs +10 -10
  151. package/dist/ToggleButton.cjs +1 -0
  152. package/dist/ToggleButton.cjs.map +1 -1
  153. package/dist/ToggleButton.css.map +1 -1
  154. package/dist/ToggleButton.mjs +1 -0
  155. package/dist/ToggleButton.mjs.map +1 -1
  156. package/dist/Tooltip.cjs +1 -1
  157. package/dist/Tooltip.css +1 -1
  158. package/dist/Tooltip.mjs +1 -1
  159. package/dist/types.d.ts +9 -9
  160. package/dist/types.d.ts.map +1 -1
  161. package/package.json +18 -18
  162. package/src/ActionButton.tsx +19 -43
  163. package/src/ActionButtonGroup.tsx +1 -1
  164. package/src/Button.tsx +36 -79
  165. package/src/CloseButton.tsx +10 -20
  166. package/src/Divider.tsx +10 -16
  167. package/src/Field.tsx +19 -17
  168. package/src/InlineAlert.tsx +0 -1
  169. package/src/Link.tsx +7 -12
  170. package/src/Menu.tsx +24 -8
  171. package/src/Meter.tsx +7 -14
  172. package/src/ProgressBar.tsx +8 -15
  173. package/src/ProgressCircle.tsx +12 -15
  174. package/src/ToggleButton.tsx +1 -0
  175. package/src/bar-utils.ts +3 -10
  176. package/src/style-utils.ts +15 -8
  177. package/style/dist/spectrum-theme.cjs +15 -1
  178. package/style/dist/spectrum-theme.cjs.map +1 -1
  179. package/style/dist/spectrum-theme.mjs +15 -1
  180. package/style/dist/spectrum-theme.mjs.map +1 -1
  181. package/style/dist/types.d.ts +40 -27
  182. package/style/dist/types.d.ts.map +1 -1
  183. package/style/spectrum-theme.ts +4 -2
  184. package/style/tokens.ts +30 -0
package/dist/Button.cjs CHANGED
@@ -68,12 +68,13 @@ const $25d06cf8d4e72761$var$button = function anonymous(props, overrides) {
68
68
  }
69
69
  if (props.isFocusVisible) rules += ' _Lb';
70
70
  else rules += ' _La';
71
- rules += ' da_____z';
72
- if (props.staticColor === "black") rules += ' db';
73
- else if (props.staticColor === "white") rules += ' dc';
71
+ rules += ' da_____M';
72
+ if (props.isStaticColor) rules += ' d_____G';
74
73
  else rules += ' dx';
75
74
  rules += ' _Nc';
76
75
  rules += ' _M-3t1z';
76
+ if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
77
+ else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
77
78
  if (!$U) rules += ' Uc';
78
79
  rules += ' _Zd';
79
80
  rules += ' _1-soocicc';
@@ -110,41 +111,26 @@ const $25d06cf8d4e72761$var$button = function anonymous(props, overrides) {
110
111
  rules += ' _f-1x99dlob';
111
112
  rules += ' _fa';
112
113
  if (props.fillStyle === "outline") {
113
- if (props.isDisabled) rules += ' aa_____B';
114
- else rules += ' aa_____x';
114
+ if (props.isDisabled) rules += ' aa_____O';
115
+ else rules += ' aa_____K';
115
116
  } else if (props.fillStyle === "fill") {
116
- if (props.isDisabled) rules += ' aa_____A';
117
- else rules += ' aa_____w';
117
+ if (props.isDisabled) rules += ' aa_____N';
118
+ else rules += ' aa_____J';
118
119
  }
119
- if (props.staticColor === "black") {
120
- if (props.isDisabled) rules += ' a_____n';
120
+ if (props.isStaticColor) {
121
+ if (props.isDisabled) rules += ' a_____A';
121
122
  else if (props.fillStyle === "outline") {
122
- if (props.isPressed) rules += ' a_____s';
123
- else if (props.isFocusVisible) rules += ' a_____s';
124
- else if (props.isHovered) rules += ' a_____s';
125
- else rules += ' a_____r';
123
+ if (props.isPressed) rules += ' a_____F';
124
+ else if (props.isFocusVisible) rules += ' a_____F';
125
+ else if (props.isHovered) rules += ' a_____F';
126
+ else rules += ' a_____E';
126
127
  } else if (props.fillStyle === "fill") {
127
128
  if (props.variant === "secondary") {
128
- if (props.isPressed) rules += ' a_____s';
129
- else if (props.isFocusVisible) rules += ' a_____s';
130
- else if (props.isHovered) rules += ' a_____s';
131
- else rules += ' a_____r';
132
- } else if (props.variant === "primary") rules += ' ac';
133
- }
134
- } else if (props.staticColor === "white") {
135
- if (props.isDisabled) rules += ' a_____a';
136
- else if (props.fillStyle === "outline") {
137
- if (props.isPressed) rules += ' a_____f';
138
- else if (props.isFocusVisible) rules += ' a_____f';
139
- else if (props.isHovered) rules += ' a_____f';
140
- else rules += ' a_____e';
141
- } else if (props.fillStyle === "fill") {
142
- if (props.variant === "secondary") {
143
- if (props.isPressed) rules += ' a_____f';
144
- else if (props.isFocusVisible) rules += ' a_____f';
145
- else if (props.isHovered) rules += ' a_____f';
146
- else rules += ' a_____e';
147
- } else if (props.variant === "primary") rules += ' ab';
129
+ if (props.isPressed) rules += ' a_____F';
130
+ else if (props.isFocusVisible) rules += ' a_____F';
131
+ else if (props.isHovered) rules += ' a_____F';
132
+ else rules += ' a_____E';
133
+ } else if (props.variant === "primary") rules += ' a_____R';
148
134
  }
149
135
  } else if (props.fillStyle === "outline") {
150
136
  if (props.isDisabled) rules += ' aj';
@@ -201,34 +187,21 @@ const $25d06cf8d4e72761$var$button = function anonymous(props, overrides) {
201
187
  rules += ' -_1gogtue_E--1dbqcch';
202
188
  rules += ' -oelgqu_A--soocica';
203
189
  rules += ' -oelgqu_A--177861o';
204
- if (props.isDisabled) rules += ' ca_____B';
205
- else if (props.isHovered) rules += ' ca_____z';
206
- else rules += ' ca_____v';
207
- if (props.staticColor === "black") {
208
- if (props.isDisabled) rules += ' c_____m';
209
- else if (props.variant === "secondary") {
210
- if (props.isPressed) rules += ' c_____n';
211
- else if (props.isFocusVisible) rules += ' c_____n';
212
- else if (props.isHovered) rules += ' c_____n';
213
- else rules += ' c_____m';
214
- } else if (props.variant === "primary") {
215
- if (props.isPressed) rules += ' c_____s';
216
- else if (props.isFocusVisible) rules += ' c_____s';
217
- else if (props.isHovered) rules += ' c_____s';
218
- else rules += ' c_____r';
219
- }
220
- } else if (props.staticColor === "white") {
221
- if (props.isDisabled) rules += ' c____9';
190
+ if (props.isDisabled) rules += ' ca_____O';
191
+ else if (props.isHovered) rules += ' ca_____M';
192
+ else rules += ' ca_____I';
193
+ if (props.isStaticColor) {
194
+ if (props.isDisabled) rules += ' c_____z';
222
195
  else if (props.variant === "secondary") {
223
- if (props.isPressed) rules += ' c_____a';
224
- else if (props.isFocusVisible) rules += ' c_____a';
225
- else if (props.isHovered) rules += ' c_____a';
226
- else rules += ' c____9';
196
+ if (props.isPressed) rules += ' c_____A';
197
+ else if (props.isFocusVisible) rules += ' c_____A';
198
+ else if (props.isHovered) rules += ' c_____A';
199
+ else rules += ' c_____z';
227
200
  } else if (props.variant === "primary") {
228
- if (props.isPressed) rules += ' c_____f';
229
- else if (props.isFocusVisible) rules += ' c_____f';
230
- else if (props.isHovered) rules += ' c_____f';
231
- else rules += ' c_____e';
201
+ if (props.isPressed) rules += ' c_____F';
202
+ else if (props.isFocusVisible) rules += ' c_____F';
203
+ else if (props.isHovered) rules += ' c_____F';
204
+ else rules += ' c_____E';
232
205
  }
233
206
  } else if (props.isDisabled) rules += ' ci';
234
207
  else if (props.variant === "secondary") {
@@ -242,96 +215,76 @@ const $25d06cf8d4e72761$var$button = function anonymous(props, overrides) {
242
215
  else if (props.isHovered) rules += ' co';
243
216
  else rules += ' cn';
244
217
  }
245
- if (props.fillStyle === "outline") rules += ' ba_____w';
218
+ rules += ' b-375toh';
219
+ rules += ' -rwx0fg_e-b';
220
+ rules += ' _zb';
221
+ rules += ' __R-yksgrp';
222
+ if (props.size === "XL") rules += ' -_375tou_o-j';
223
+ else if (props.size === "L") rules += ' -_375tou_o-i';
224
+ else if (props.size === "S") rules += ' -_375tou_o-h';
225
+ else if (props.size === "XS") rules += ' -_375tou_o-g';
226
+ else rules += ' -_375tou_o-f';
227
+ if (props.fillStyle === "outline") rules += ' -_375tp0_u-c';
228
+ else if (props.fillStyle === "fill") rules += ' -_375tp0_u-a';
229
+ if (props.fillStyle === "outline") rules += ' -_375tp1_v-c';
230
+ else if (props.fillStyle === "fill") rules += ' -_375tp1_v-a';
231
+ if (props.fillStyle === "outline") rules += ' -_375toh_b-a_____J';
246
232
  else if (props.fillStyle === "fill") {
247
- if (props.isDisabled) rules += ' ba_____B';
248
- else if (props.isHovered) rules += ' ba_____z';
249
- else rules += ' ba_____x';
233
+ if (props.isDisabled) rules += ' -_375toh_b-a_____O';
234
+ else if (props.isHovered) rules += ' -_375toh_b-a_____M';
235
+ else rules += ' -_375toh_b-a_____K';
250
236
  }
251
- if (props.staticColor === "black") {
237
+ if (props.isStaticColor) {
252
238
  if (props.fillStyle === "outline") {
253
- if (props.isDisabled) rules += ' ba';
254
- else if (props.isFocusVisible) rules += ' b_____k';
255
- else if (props.isPressed) rules += ' b_____k';
256
- else if (props.isHovered) rules += ' b_____k';
257
- else rules += ' ba';
239
+ if (props.isDisabled) rules += ' -_375toh_b-a';
240
+ else if (props.isFocusVisible) rules += ' -_375toh_b-_____x';
241
+ else if (props.isPressed) rules += ' -_375toh_b-_____x';
242
+ else if (props.isHovered) rules += ' -_375toh_b-_____x';
243
+ else rules += ' -_375toh_b-a';
258
244
  } else if (props.fillStyle === "fill") {
259
- if (props.isDisabled) rules += ' b_____k';
245
+ if (props.isDisabled) rules += ' -_375toh_b-_____x';
260
246
  else if (props.variant === "secondary") {
261
- if (props.isPressed) rules += ' b_____l';
262
- else if (props.isFocusVisible) rules += ' b_____l';
263
- else if (props.isHovered) rules += ' b_____l';
264
- else rules += ' b_____k';
247
+ if (props.isPressed) rules += ' -_375toh_b-_____y';
248
+ else if (props.isFocusVisible) rules += ' -_375toh_b-_____y';
249
+ else if (props.isHovered) rules += ' -_375toh_b-_____y';
250
+ else rules += ' -_375toh_b-_____x';
265
251
  } else if (props.variant === "primary") {
266
- if (props.isPressed) rules += ' b_____s';
267
- else if (props.isFocusVisible) rules += ' b_____s';
268
- else if (props.isHovered) rules += ' b_____s';
269
- else rules += ' b_____r';
270
- }
271
- }
272
- } else if (props.staticColor === "white") {
273
- if (props.fillStyle === "outline") {
274
- if (props.isDisabled) rules += ' ba';
275
- else if (props.isFocusVisible) rules += ' b____7';
276
- else if (props.isPressed) rules += ' b____7';
277
- else if (props.isHovered) rules += ' b____7';
278
- else rules += ' ba';
279
- } else if (props.fillStyle === "fill") {
280
- if (props.isDisabled) rules += ' b____7';
281
- else if (props.variant === "secondary") {
282
- if (props.isPressed) rules += ' b____8';
283
- else if (props.isFocusVisible) rules += ' b____8';
284
- else if (props.isHovered) rules += ' b____8';
285
- else rules += ' b____7';
286
- } else if (props.variant === "primary") {
287
- if (props.isPressed) rules += ' b_____f';
288
- else if (props.isFocusVisible) rules += ' b_____f';
289
- else if (props.isHovered) rules += ' b_____f';
290
- else rules += ' b_____e';
252
+ if (props.isPressed) rules += ' -_375toh_b-_____F';
253
+ else if (props.isFocusVisible) rules += ' -_375toh_b-_____F';
254
+ else if (props.isHovered) rules += ' -_375toh_b-_____F';
255
+ else rules += ' -_375toh_b-_____E';
291
256
  }
292
257
  }
293
258
  } else if (props.fillStyle === "outline") {
294
- if (props.isDisabled) rules += ' ba';
295
- else if (props.isFocusVisible) rules += ' bg';
296
- else if (props.isPressed) rules += ' bg';
297
- else if (props.isHovered) rules += ' bg';
298
- else rules += ' ba';
259
+ if (props.isDisabled) rules += ' -_375toh_b-a';
260
+ else if (props.isFocusVisible) rules += ' -_375toh_b-g';
261
+ else if (props.isPressed) rules += ' -_375toh_b-g';
262
+ else if (props.isHovered) rules += ' -_375toh_b-g';
263
+ else rules += ' -_375toh_b-a';
299
264
  } else if (props.fillStyle === "fill") {
300
- if (props.isDisabled) rules += ' bg';
265
+ if (props.isDisabled) rules += ' -_375toh_b-g';
301
266
  else if (props.variant === "negative") {
302
- if (props.isPressed) rules += ' b_____L';
303
- else if (props.isFocusVisible) rules += ' b_____L';
304
- else if (props.isHovered) rules += ' b_____L';
305
- else rules += ' b_____K';
267
+ if (props.isPressed) rules += ' -_375toh_b-_____Y';
268
+ else if (props.isFocusVisible) rules += ' -_375toh_b-_____Y';
269
+ else if (props.isHovered) rules += ' -_375toh_b-_____Y';
270
+ else rules += ' -_375toh_b-_____X';
306
271
  } else if (props.variant === "accent") {
307
- if (props.isPressed) rules += ' b_____F';
308
- else if (props.isFocusVisible) rules += ' b_____F';
309
- else if (props.isHovered) rules += ' b_____F';
310
- else rules += ' b_____E';
272
+ if (props.isPressed) rules += ' -_375toh_b-_____S';
273
+ else if (props.isFocusVisible) rules += ' -_375toh_b-_____S';
274
+ else if (props.isHovered) rules += ' -_375toh_b-_____S';
275
+ else rules += ' -_375toh_b-_____R';
311
276
  } else if (props.variant === "secondary") {
312
- if (props.isPressed) rules += ' bh';
313
- else if (props.isFocusVisible) rules += ' bh';
314
- else if (props.isHovered) rules += ' bh';
315
- else rules += ' bg';
277
+ if (props.isPressed) rules += ' -_375toh_b-h';
278
+ else if (props.isFocusVisible) rules += ' -_375toh_b-h';
279
+ else if (props.isHovered) rules += ' -_375toh_b-h';
280
+ else rules += ' -_375toh_b-g';
316
281
  } else if (props.variant === "primary") {
317
- if (props.isPressed) rules += ' bo';
318
- else if (props.isFocusVisible) rules += ' bo';
319
- else if (props.isHovered) rules += ' bo';
320
- else rules += ' bn';
282
+ if (props.isPressed) rules += ' -_375toh_b-o';
283
+ else if (props.isFocusVisible) rules += ' -_375toh_b-o';
284
+ else if (props.isHovered) rules += ' -_375toh_b-o';
285
+ else rules += ' -_375toh_b-n';
321
286
  }
322
287
  }
323
- rules += ' -rwx0fg_e-b';
324
- rules += ' _zb';
325
- rules += ' __R-yksgrp';
326
- if (props.size === "XL") rules += ' -_375tou_o-j';
327
- else if (props.size === "L") rules += ' -_375tou_o-i';
328
- else if (props.size === "S") rules += ' -_375tou_o-h';
329
- else if (props.size === "XS") rules += ' -_375tou_o-g';
330
- else rules += ' -_375tou_o-f';
331
- if (props.fillStyle === "outline") rules += ' -_375tp0_u-c';
332
- else if (props.fillStyle === "fill") rules += ' -_375tp0_u-a';
333
- if (props.fillStyle === "outline") rules += ' -_375tp1_v-c';
334
- else if (props.fillStyle === "fill") rules += ' -_375tp1_v-a';
335
288
  return rules;
336
289
  };
337
290
  const $25d06cf8d4e72761$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $8owBJ$react.forwardRef)(function Button(props1, ref) {
@@ -369,7 +322,8 @@ const $25d06cf8d4e72761$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $8owBJ$react
369
322
  variant: variant,
370
323
  fillStyle: fillStyle,
371
324
  size: size,
372
- staticColor: staticColor
325
+ staticColor: staticColor,
326
+ isStaticColor: !!staticColor
373
327
  }, props1.styles),
374
328
  children: /*#__PURE__*/ (0, $8owBJ$reactjsxruntime.jsxs)((0, $8owBJ$reactariacomponents.Provider), {
375
329
  values: [
@@ -477,6 +431,7 @@ const $25d06cf8d4e72761$export$29d11c0fe2fc51d8 = /*#__PURE__*/ (0, $8owBJ$react
477
431
  fillStyle: props.fillStyle || 'fill',
478
432
  size: props.size || 'M',
479
433
  staticColor: props.staticColor,
434
+ isStaticColor: !!props.staticColor,
480
435
  isPending: false
481
436
  }, props.styles),
482
437
  children: /*#__PURE__*/ (0, $8owBJ$reactjsxruntime.jsx)((0, $8owBJ$reactariacomponents.Provider), {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAqDM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAmE;AACrG,MAAM,0DAAoB,CAAA,GAAA,0BAAY,EAAmE;AAEhH,MAAM,iCAAW;AACjB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,+BAAG;QACD,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,6BAAO;gBAChE,GAAG,WAAW;gBACd,+CAA+C;gBAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;gBACnE,SAAS,MAAM,OAAO,IAAI;gBAC1B,WAAW,MAAM,SAAS,IAAI;gBAC9B,MAAM,MAAM,IAAI,IAAI;gBACpB,aAAa,MAAM,WAAW;gBAC9B,WAAW;YACb,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,MAAM;wBACN,kHAAkH;wBAClH,iBAAiB;oBACnB;iBAAE;gBACF;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F","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, style} from '../style' with {type: 'macro'};\nimport {ButtonRenderProps, ContextValue, Link, LinkProps, OverlayTriggerStateContext, Provider, Button as RACButton, ButtonProps as RACButtonProps} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useState} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {ProgressCircle} from './ProgressCircle';\nimport {SkeletonContext} from './Skeleton';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\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',\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'\n}\n\nexport interface ButtonProps extends Omit<RACButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ButtonStyleProps {\n /** The content to display in the Button. */\n children?: ReactNode\n}\n\nexport interface LinkButtonProps extends Omit<LinkProps, 'className' | 'style' | 'children'>, StyleProps, ButtonStyleProps {\n /** The content to display in the Button. */\n children?: ReactNode\n}\n\nexport const ButtonContext = createContext<ContextValue<ButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\nexport const LinkButtonContext = createContext<ContextValue<ButtonProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst iconOnly = ':has([slot=icon]):not(:has([data-rsp-slot=text]))';\nconst button = style<ButtonRenderProps & ButtonStyleProps>({\n ...focusRing(),\n position: 'relative',\n display: 'flex',\n alignItems: {\n default: 'baseline',\n [iconOnly]: 'center'\n },\n justifyContent: 'center',\n textAlign: 'start',\n columnGap: 'text-to-visual',\n font: 'control',\n fontWeight: 'bold',\n userSelect: 'none',\n minHeight: 'control',\n minWidth: {\n [iconOnly]: 'control'\n },\n borderRadius: 'pill',\n boxSizing: 'border-box',\n width: 'fit',\n textDecoration: 'none', // for link buttons\n paddingX: {\n default: 'pill',\n [iconOnly]: 0\n },\n paddingY: 0,\n aspectRatio: {\n [iconOnly]: 'square'\n },\n transition: 'default',\n borderStyle: 'solid',\n borderWidth: {\n fillStyle: {\n fill: 0,\n outline: 2\n }\n },\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2),\n [iconOnly]: 0\n }\n },\n borderColor: {\n variant: {\n primary: baseColor('gray-800'),\n secondary: baseColor('gray-300')\n },\n isDisabled: 'disabled',\n staticColor: {\n white: {\n variant: {\n primary: baseColor('transparent-white-800'),\n secondary: baseColor('transparent-white-300')\n },\n isDisabled: 'transparent-white-300'\n },\n black: {\n variant: {\n primary: baseColor('transparent-black-800'),\n secondary: baseColor('transparent-black-300')\n },\n isDisabled: 'transparent-black-300'\n }\n },\n forcedColors: {\n default: 'ButtonBorder',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n backgroundColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'neutral',\n secondary: baseColor('gray-100'),\n accent: 'accent',\n negative: 'negative'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: 'transparent',\n isHovered: 'gray-100',\n isPressed: 'gray-100',\n isFocusVisible: 'gray-100',\n isDisabled: 'transparent'\n }\n },\n staticColor: {\n white: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('transparent-white-800'),\n secondary: baseColor('transparent-white-100')\n },\n isDisabled: 'transparent-white-100'\n },\n outline: {\n default: 'transparent',\n isHovered: 'transparent-white-100',\n isPressed: 'transparent-white-100',\n isFocusVisible: 'transparent-white-100',\n isDisabled: 'transparent'\n }\n }\n },\n black: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('transparent-black-800'),\n secondary: baseColor('transparent-black-100')\n },\n isDisabled: 'transparent-black-100'\n },\n outline: {\n default: 'transparent',\n isHovered: 'transparent-black-100',\n isPressed: 'transparent-black-100',\n isFocusVisible: 'transparent-black-100',\n isDisabled: 'transparent'\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: 'neutral',\n accent: 'white',\n negative: 'white'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: 'neutral',\n isDisabled: 'disabled'\n }\n },\n staticColor: {\n white: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'black',\n secondary: baseColor('transparent-white-800')\n }\n },\n outline: baseColor('transparent-white-800')\n },\n isDisabled: 'transparent-white-400'\n },\n black: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'white',\n secondary: baseColor('transparent-black-800')\n }\n },\n outline: baseColor('transparent-black-800')\n },\n isDisabled: 'transparent-black-400'\n }\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 staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'Highlight'\n },\n forcedColorAdjust: 'none',\n disableTapHighlight: true\n}, getAllowedOverrides());\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(props: ButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonContext);\n props = useFormProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isPending,\n variant = 'primary',\n fillStyle = 'fill',\n size = 'M',\n staticColor\n } = props;\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n return (\n <RACButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + button({\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 }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {\n styles: style({\n paddingY: '--labelPadding',\n order: 1,\n opacity: {\n default: 1,\n isProgressVisible: 0\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 [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0,\n opacity: {\n default: 1,\n isProgressVisible: 0\n }\n })({isProgressVisible})\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 opacity: {\n default: 0,\n isProgressVisible: 1\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 </div>\n }\n </Provider>\n </RACButton>\n );\n});\n\n/**\n * A LinkButton combines the functionality of a link with the appearance of a button. Useful for allowing users to navigate to another page.\n */\nexport const LinkButton = forwardRef(function LinkButton(props: LinkButtonProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkButtonContext);\n props = useFormProps(props);\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n return (\n <Link\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + button({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant: props.variant || 'primary',\n fillStyle: props.fillStyle || 'fill',\n size: props.size || 'M',\n staticColor: props.staticColor,\n isPending: false\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {\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 [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </Link>\n );\n});\n"],"names":[],"version":3,"file":"Button.cjs.map"}
1
+ {"mappings":";;;;;;;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iDAAsB,EAAE,OAAO,KAAK;IACnD,QAAQ,CAAA,GAAA,sCAAW,EAAE;IACrB,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,sBAAsB,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,qDAAyB;IAE9D,qBACE,gCAAC,CAAA,GAAA,+BAAG;QACD,GAAG,KAAK;QACT,KAAK;QACL,OAAO,CAAA,GAAA,oCAAS,EAAE,QAAQ,MAAM,YAAY;QAC5C,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,6BAAO;gBAChE,GAAG,WAAW;gBACd,+CAA+C;gBAC/C,WAAW,YAAY,SAAS,IAAI,qBAAqB,UAAU;gBACnE,SAAS,MAAM,OAAO,IAAI;gBAC1B,WAAW,MAAM,SAAS,IAAI;gBAC9B,MAAM,MAAM,IAAI,IAAI;gBACpB,aAAa,MAAM,WAAW;gBAC9B,eAAe,CAAC,CAAC,MAAM,WAAW;gBAClC,WAAW;YACb,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAc;oBAAG;iBAAK;gBACvB;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,MAAM;wBACN,kHAAkH;wBAClH,iBAAiB;oBACnB;iBAAE;gBACF;oBAAC,CAAA,GAAA,qCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,MAAM;oBACR;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,8BAAG;0BAAG,MAAM,QAAQ;iBAAW,MAAM,QAAQ;;;AAI5F","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, style} from '../style' with {type: 'macro'};\nimport {ButtonRenderProps, ContextValue, Link, LinkProps, OverlayTriggerStateContext, Provider, Button as RACButton, ButtonProps as RACButtonProps} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {centerPadding, getAllowedOverrides, staticColor, StyleProps} from './style-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode, useContext, useEffect, useState} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {pressScale} from './pressScale';\nimport {ProgressCircle} from './ProgressCircle';\nimport {SkeletonContext} from './Skeleton';\nimport {Text, TextContext} from './Content';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\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',\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 extends Omit<RACButtonProps, 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, ButtonStyleProps {\n /** The content to display in the Button. */\n children?: ReactNode\n}\n\nexport interface LinkButtonProps extends Omit<LinkProps, 'className' | 'style' | 'children'>, StyleProps, ButtonStyleProps {\n /** The content to display in the Button. */\n children?: ReactNode\n}\n\nexport const ButtonContext = createContext<ContextValue<ButtonProps, FocusableRefValue<HTMLButtonElement>>>(null);\nexport const LinkButtonContext = createContext<ContextValue<ButtonProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst iconOnly = ':has([slot=icon]):not(:has([data-rsp-slot=text]))';\nconst button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: boolean}>({\n ...focusRing(),\n ...staticColor(),\n position: 'relative',\n display: 'flex',\n alignItems: {\n default: 'baseline',\n [iconOnly]: 'center'\n },\n justifyContent: 'center',\n textAlign: 'start',\n columnGap: 'text-to-visual',\n font: 'control',\n fontWeight: 'bold',\n userSelect: 'none',\n minHeight: 'control',\n minWidth: {\n [iconOnly]: 'control'\n },\n borderRadius: 'pill',\n boxSizing: 'border-box',\n width: 'fit',\n textDecoration: 'none', // for link buttons\n paddingX: {\n default: 'pill',\n [iconOnly]: 0\n },\n paddingY: 0,\n aspectRatio: {\n [iconOnly]: 'square'\n },\n transition: 'default',\n borderStyle: 'solid',\n borderWidth: {\n fillStyle: {\n fill: 0,\n outline: 2\n }\n },\n '--labelPadding': {\n type: 'paddingTop',\n value: centerPadding()\n },\n '--iconMargin': {\n type: 'marginTop',\n value: {\n default: fontRelative(-2),\n [iconOnly]: 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: 'neutral',\n secondary: baseColor('gray-100'),\n accent: 'accent',\n negative: 'negative'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: 'transparent',\n isHovered: 'gray-100',\n isPressed: 'gray-100',\n isFocusVisible: 'gray-100',\n isDisabled: 'transparent'\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: baseColor('transparent-overlay-800'),\n secondary: baseColor('transparent-overlay-100')\n },\n isDisabled: 'transparent-overlay-100'\n },\n outline: {\n default: 'transparent',\n isHovered: 'transparent-overlay-100',\n isPressed: 'transparent-overlay-100',\n isFocusVisible: 'transparent-overlay-100',\n isDisabled: 'transparent'\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: 'neutral',\n accent: 'white',\n negative: 'white'\n },\n isDisabled: 'disabled'\n },\n outline: {\n default: 'neutral',\n isDisabled: 'disabled'\n }\n },\n isStaticColor: {\n fillStyle: {\n fill: {\n variant: {\n primary: 'auto',\n secondary: baseColor('transparent-overlay-800')\n }\n },\n outline: baseColor('transparent-overlay-800')\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}, getAllowedOverrides());\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(props: ButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ButtonContext);\n props = useFormProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isPending,\n variant = 'primary',\n fillStyle = 'fill',\n size = 'M',\n staticColor\n } = props;\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n return (\n <RACButton\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + button({\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 }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {\n styles: style({\n paddingY: '--labelPadding',\n order: 1,\n opacity: {\n default: 1,\n isProgressVisible: 0\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 [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({\n size: fontRelative(20),\n marginStart: '--iconMargin',\n flexShrink: 0,\n opacity: {\n default: 1,\n isProgressVisible: 0\n }\n })({isProgressVisible})\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 opacity: {\n default: 0,\n isProgressVisible: 1\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 </div>\n }\n </Provider>\n </RACButton>\n );\n});\n\n/**\n * A LinkButton combines the functionality of a link with the appearance of a button. Useful for allowing users to navigate to another page.\n */\nexport const LinkButton = forwardRef(function LinkButton(props: LinkButtonProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkButtonContext);\n props = useFormProps(props);\n let domRef = useFocusableRef(ref);\n let overlayTriggerState = useContext(OverlayTriggerStateContext);\n\n return (\n <Link\n {...props}\n ref={domRef}\n style={pressScale(domRef, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + button({\n ...renderProps,\n // Retain hover styles when an overlay is open.\n isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,\n variant: props.variant || 'primary',\n fillStyle: props.fillStyle || 'fill',\n size: props.size || 'M',\n staticColor: props.staticColor,\n isStaticColor: !!props.staticColor,\n isPending: false\n }, props.styles)}>\n <Provider\n values={[\n [SkeletonContext, null],\n [TextContext, {\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 [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: style({size: fontRelative(20), marginStart: '--iconMargin', flexShrink: 0})\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </Link>\n );\n});\n"],"names":[],"version":3,"file":"Button.cjs.map"}