@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.
- package/dist/ActionButton.cjs +58 -80
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +76 -96
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +58 -80
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/ActionButtonGroup.cjs.map +1 -1
- package/dist/ActionButtonGroup.css.map +1 -1
- package/dist/ActionButtonGroup.mjs.map +1 -1
- package/dist/Badge.cjs +66 -66
- package/dist/Badge.css +43 -43
- package/dist/Badge.mjs +66 -66
- package/dist/Breadcrumbs.cjs +6 -6
- package/dist/Breadcrumbs.css +4 -4
- package/dist/Breadcrumbs.mjs +6 -6
- package/dist/Button.cjs +89 -134
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +102 -134
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +89 -134
- package/dist/Button.mjs.map +1 -1
- package/dist/Card.cjs +4 -4
- package/dist/Card.css +3 -3
- package/dist/Card.mjs +4 -4
- package/dist/CardView.cjs +1 -1
- package/dist/CardView.css +1 -1
- package/dist/CardView.mjs +1 -1
- package/dist/Checkbox.cjs +10 -10
- package/dist/Checkbox.css +10 -10
- package/dist/Checkbox.mjs +10 -10
- package/dist/CloseButton.cjs +17 -28
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +19 -31
- package/dist/CloseButton.css.map +1 -1
- package/dist/CloseButton.mjs +17 -28
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorArea.cjs +1 -1
- package/dist/ColorArea.css +1 -1
- package/dist/ColorArea.mjs +1 -1
- package/dist/ColorHandle.cjs +3 -3
- package/dist/ColorHandle.css +3 -3
- package/dist/ColorHandle.mjs +3 -3
- package/dist/ColorSlider.cjs +1 -1
- package/dist/ColorSlider.css +1 -1
- package/dist/ColorSlider.mjs +1 -1
- package/dist/ColorSwatchPicker.cjs +1 -1
- package/dist/ColorSwatchPicker.css +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorWheel.cjs +2 -2
- package/dist/ColorWheel.css +1 -1
- package/dist/ColorWheel.mjs +2 -2
- package/dist/ComboBox.cjs +5 -5
- package/dist/ComboBox.css +4 -4
- package/dist/ComboBox.mjs +5 -5
- package/dist/Disclosure.cjs +1 -1
- package/dist/Disclosure.css +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/Divider.cjs +8 -8
- package/dist/Divider.cjs.map +1 -1
- package/dist/Divider.css +13 -13
- package/dist/Divider.css.map +1 -1
- package/dist/Divider.mjs +8 -8
- package/dist/Divider.mjs.map +1 -1
- package/dist/DropZone.cjs +4 -4
- package/dist/DropZone.css +2 -2
- package/dist/DropZone.mjs +4 -4
- package/dist/Field.cjs +23 -18
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +7 -15
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +23 -18
- package/dist/Field.mjs.map +1 -1
- package/dist/InlineAlert.cjs +24 -29
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +15 -19
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +24 -29
- package/dist/InlineAlert.mjs.map +1 -1
- package/dist/Link.cjs +7 -6
- package/dist/Link.cjs.map +1 -1
- package/dist/Link.css +14 -14
- package/dist/Link.css.map +1 -1
- package/dist/Link.mjs +7 -6
- package/dist/Link.mjs.map +1 -1
- package/dist/Menu.cjs +28 -8
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +3 -3
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +29 -9
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +13 -13
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +18 -22
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +13 -13
- package/dist/Meter.mjs.map +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.css +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NumberField.cjs +4 -4
- package/dist/NumberField.css +4 -4
- package/dist/NumberField.mjs +4 -4
- package/dist/Picker.cjs +4 -4
- package/dist/Picker.css +4 -4
- package/dist/Picker.mjs +4 -4
- package/dist/Popover.cjs +3 -3
- package/dist/Popover.css +3 -3
- package/dist/Popover.mjs +3 -3
- package/dist/ProgressBar.cjs +20 -18
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +20 -24
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +20 -18
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/ProgressCircle.cjs +11 -9
- package/dist/ProgressCircle.cjs.map +1 -1
- package/dist/ProgressCircle.css +14 -14
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/ProgressCircle.mjs +11 -9
- package/dist/ProgressCircle.mjs.map +1 -1
- package/dist/Provider.cjs +1 -1
- package/dist/Provider.css +1 -1
- package/dist/Provider.mjs +1 -1
- package/dist/Radio.cjs +6 -6
- package/dist/Radio.css +6 -6
- package/dist/Radio.mjs +6 -6
- package/dist/SearchField.cjs +1 -1
- package/dist/SearchField.css +1 -1
- package/dist/SearchField.mjs +1 -1
- package/dist/SegmentedControl.cjs +8 -8
- package/dist/SegmentedControl.css +8 -8
- package/dist/SegmentedControl.mjs +8 -8
- package/dist/Slider.cjs +8 -8
- package/dist/Slider.css +5 -5
- package/dist/Slider.mjs +8 -8
- package/dist/Switch.cjs +7 -7
- package/dist/Switch.css +6 -6
- package/dist/Switch.mjs +7 -7
- package/dist/TableView.cjs +17 -17
- package/dist/TableView.css +11 -11
- package/dist/TableView.mjs +17 -17
- package/dist/Tabs.cjs +5 -5
- package/dist/Tabs.css +5 -5
- package/dist/Tabs.mjs +5 -5
- package/dist/TabsPicker.cjs +1 -1
- package/dist/TabsPicker.css +1 -1
- package/dist/TabsPicker.mjs +1 -1
- package/dist/TagGroup.cjs +10 -10
- package/dist/TagGroup.css +8 -8
- package/dist/TagGroup.mjs +10 -10
- package/dist/ToggleButton.cjs +1 -0
- package/dist/ToggleButton.cjs.map +1 -1
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs +1 -0
- package/dist/ToggleButton.mjs.map +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.css +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/ActionButton.tsx +19 -43
- package/src/ActionButtonGroup.tsx +1 -1
- package/src/Button.tsx +36 -79
- package/src/CloseButton.tsx +10 -20
- package/src/Divider.tsx +10 -16
- package/src/Field.tsx +19 -17
- package/src/InlineAlert.tsx +0 -1
- package/src/Link.tsx +7 -12
- package/src/Menu.tsx +24 -8
- package/src/Meter.tsx +7 -14
- package/src/ProgressBar.tsx +8 -15
- package/src/ProgressCircle.tsx +12 -15
- package/src/ToggleButton.tsx +1 -0
- package/src/bar-utils.ts +3 -10
- package/src/style-utils.ts +15 -8
- package/style/dist/spectrum-theme.cjs +15 -1
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +15 -1
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +40 -27
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +4 -2
- 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 += '
|
|
72
|
-
if (props.
|
|
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 += '
|
|
114
|
-
else rules += '
|
|
114
|
+
if (props.isDisabled) rules += ' aa_____O';
|
|
115
|
+
else rules += ' aa_____K';
|
|
115
116
|
} else if (props.fillStyle === "fill") {
|
|
116
|
-
if (props.isDisabled) rules += '
|
|
117
|
-
else rules += '
|
|
117
|
+
if (props.isDisabled) rules += ' aa_____N';
|
|
118
|
+
else rules += ' aa_____J';
|
|
118
119
|
}
|
|
119
|
-
if (props.
|
|
120
|
-
if (props.isDisabled) rules += '
|
|
120
|
+
if (props.isStaticColor) {
|
|
121
|
+
if (props.isDisabled) rules += ' a_____A';
|
|
121
122
|
else if (props.fillStyle === "outline") {
|
|
122
|
-
if (props.isPressed) rules += '
|
|
123
|
-
else if (props.isFocusVisible) rules += '
|
|
124
|
-
else if (props.isHovered) rules += '
|
|
125
|
-
else rules += '
|
|
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 += '
|
|
129
|
-
else if (props.isFocusVisible) rules += '
|
|
130
|
-
else if (props.isHovered) rules += '
|
|
131
|
-
else rules += '
|
|
132
|
-
} else if (props.variant === "primary") rules += '
|
|
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 += '
|
|
205
|
-
else if (props.isHovered) rules += '
|
|
206
|
-
else rules += '
|
|
207
|
-
if (props.
|
|
208
|
-
if (props.isDisabled) rules += '
|
|
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 += '
|
|
224
|
-
else if (props.isFocusVisible) rules += '
|
|
225
|
-
else if (props.isHovered) rules += '
|
|
226
|
-
else rules += '
|
|
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 += '
|
|
229
|
-
else if (props.isFocusVisible) rules += '
|
|
230
|
-
else if (props.isHovered) rules += '
|
|
231
|
-
else rules += '
|
|
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
|
-
|
|
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 += '
|
|
248
|
-
else if (props.isHovered) rules += '
|
|
249
|
-
else rules += '
|
|
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.
|
|
237
|
+
if (props.isStaticColor) {
|
|
252
238
|
if (props.fillStyle === "outline") {
|
|
253
|
-
if (props.isDisabled) rules += '
|
|
254
|
-
else if (props.isFocusVisible) rules += '
|
|
255
|
-
else if (props.isPressed) rules += '
|
|
256
|
-
else if (props.isHovered) rules += '
|
|
257
|
-
else rules += '
|
|
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 += '
|
|
245
|
+
if (props.isDisabled) rules += ' -_375toh_b-_____x';
|
|
260
246
|
else if (props.variant === "secondary") {
|
|
261
|
-
if (props.isPressed) rules += '
|
|
262
|
-
else if (props.isFocusVisible) rules += '
|
|
263
|
-
else if (props.isHovered) rules += '
|
|
264
|
-
else rules += '
|
|
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 += '
|
|
267
|
-
else if (props.isFocusVisible) rules += '
|
|
268
|
-
else if (props.isHovered) rules += '
|
|
269
|
-
else rules += '
|
|
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 += '
|
|
295
|
-
else if (props.isFocusVisible) rules += '
|
|
296
|
-
else if (props.isPressed) rules += '
|
|
297
|
-
else if (props.isHovered) rules += '
|
|
298
|
-
else rules += '
|
|
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 += '
|
|
265
|
+
if (props.isDisabled) rules += ' -_375toh_b-g';
|
|
301
266
|
else if (props.variant === "negative") {
|
|
302
|
-
if (props.isPressed) rules += '
|
|
303
|
-
else if (props.isFocusVisible) rules += '
|
|
304
|
-
else if (props.isHovered) rules += '
|
|
305
|
-
else rules += '
|
|
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 += '
|
|
308
|
-
else if (props.isFocusVisible) rules += '
|
|
309
|
-
else if (props.isHovered) rules += '
|
|
310
|
-
else rules += '
|
|
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 += '
|
|
313
|
-
else if (props.isFocusVisible) rules += '
|
|
314
|
-
else if (props.isHovered) rules += '
|
|
315
|
-
else rules += '
|
|
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 += '
|
|
318
|
-
else if (props.isFocusVisible) rules += '
|
|
319
|
-
else if (props.isHovered) rules += '
|
|
320
|
-
else rules += '
|
|
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), {
|
package/dist/Button.cjs.map
CHANGED
|
@@ -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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,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,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
|
+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AAG,CAAA,GAAA,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"}
|