@react-spectrum/s2 3.0.0-nightly-d87cc4422-250109 → 3.0.0-nightly-e4497fdb6-250110
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/ActionBar.cjs +2 -2
- package/dist/ActionBar.css +2 -2
- package/dist/ActionBar.mjs +2 -2
- package/dist/ActionButton.css +1 -1
- package/dist/Breadcrumbs.css +1 -1
- package/dist/Button.cjs +133 -98
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +118 -37
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +134 -99
- package/dist/Button.mjs.map +1 -1
- package/dist/Card.cjs +15 -15
- package/dist/Card.css +19 -19
- package/dist/Card.mjs +15 -15
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.css +3 -3
- package/dist/Checkbox.mjs +1 -1
- package/dist/CheckboxGroup.cjs +12 -12
- package/dist/CheckboxGroup.css +12 -12
- package/dist/CheckboxGroup.mjs +12 -12
- package/dist/CloseButton.cjs +2 -0
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +9 -1
- package/dist/CloseButton.css.map +1 -1
- package/dist/CloseButton.mjs +2 -0
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorField.cjs +8 -8
- package/dist/ColorField.css +8 -8
- package/dist/ColorField.mjs +8 -8
- package/dist/ColorSlider.cjs +10 -10
- package/dist/ColorSlider.css +10 -10
- package/dist/ColorSlider.mjs +10 -10
- package/dist/ComboBox.cjs +12 -12
- package/dist/ComboBox.css +13 -13
- package/dist/ComboBox.mjs +12 -12
- package/dist/Disclosure.css +1 -1
- package/dist/Field.cjs +12 -12
- package/dist/Field.css +13 -13
- package/dist/Field.mjs +12 -12
- package/dist/Form.cjs +2 -2
- package/dist/Form.css +2 -2
- package/dist/Form.mjs +2 -2
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +22 -22
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +19 -19
- package/dist/IllustratedMessage.css +22 -22
- package/dist/IllustratedMessage.mjs +19 -19
- package/dist/InlineAlert.cjs +13 -13
- package/dist/InlineAlert.css +15 -15
- package/dist/InlineAlert.mjs +13 -13
- package/dist/Link.css +1 -1
- package/dist/Menu.cjs +37 -37
- package/dist/Menu.css +38 -38
- package/dist/Menu.mjs +37 -37
- package/dist/Meter.cjs +12 -12
- package/dist/Meter.css +12 -12
- package/dist/Meter.mjs +12 -12
- package/dist/Modal.cjs +4 -4
- package/dist/Modal.css +2 -2
- package/dist/Modal.mjs +4 -4
- package/dist/NumberField.cjs +12 -12
- package/dist/NumberField.css +13 -13
- package/dist/NumberField.mjs +12 -12
- package/dist/Picker.cjs +16 -16
- package/dist/Picker.css +17 -17
- package/dist/Picker.mjs +16 -16
- package/dist/Popover.cjs +10 -10
- package/dist/Popover.css +5 -5
- package/dist/Popover.mjs +10 -10
- package/dist/ProgressBar.cjs +19 -19
- package/dist/ProgressBar.css +18 -18
- package/dist/ProgressBar.mjs +19 -19
- package/dist/Radio.cjs +1 -1
- package/dist/Radio.css +3 -3
- package/dist/Radio.mjs +1 -1
- package/dist/RadioGroup.cjs +12 -12
- package/dist/RadioGroup.css +12 -12
- package/dist/RadioGroup.mjs +12 -12
- package/dist/SearchField.cjs +8 -8
- package/dist/SearchField.css +8 -8
- package/dist/SearchField.mjs +8 -8
- package/dist/SegmentedControl.css +1 -1
- package/dist/Slider.cjs +27 -27
- package/dist/Slider.css +27 -27
- package/dist/Slider.mjs +27 -27
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.css +3 -3
- package/dist/Switch.mjs +1 -1
- package/dist/Tabs.css +1 -1
- package/dist/TabsPicker.cjs +9 -9
- package/dist/TabsPicker.css +10 -10
- package/dist/TabsPicker.mjs +9 -9
- package/dist/TagGroup.cjs +16 -16
- package/dist/TagGroup.css +17 -17
- package/dist/TagGroup.mjs +16 -16
- package/dist/TextField.cjs +8 -8
- package/dist/TextField.css +8 -8
- package/dist/TextField.mjs +8 -8
- package/dist/Tooltip.cjs +5 -5
- package/dist/Tooltip.css +4 -4
- package/dist/Tooltip.mjs +5 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/Button.tsx +107 -75
- package/src/CloseButton.tsx +4 -0
- package/style/dist/spectrum-theme.cjs +42 -4
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +42 -4
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/style-macro.cjs +1 -1
- package/style/dist/style-macro.cjs.map +1 -1
- package/style/dist/style-macro.mjs +1 -1
- package/style/dist/style-macro.mjs.map +1 -1
- package/style/dist/types.d.ts +8 -3
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +57 -6
- package/style/style-macro.ts +3 -3
- package/style/types.ts +1 -1
package/src/Button.tsx
CHANGED
|
@@ -138,24 +138,6 @@ const button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: bool
|
|
|
138
138
|
isDisabled: 'GrayText'
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
-
backgroundImage: {
|
|
142
|
-
variant: {
|
|
143
|
-
premium: {
|
|
144
|
-
default: linearGradient('96deg', ['fuchsia-900', 0], ['indigo-900', 66], ['blue-900', 100]),
|
|
145
|
-
isHovered: linearGradient('96deg', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100]),
|
|
146
|
-
isPressed: linearGradient('96deg', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100]),
|
|
147
|
-
isFocusVisible: linearGradient('96deg', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100])
|
|
148
|
-
},
|
|
149
|
-
genai: {
|
|
150
|
-
default: linearGradient('96deg', ['red-900', 0], ['magenta-900', 33], ['indigo-900', 100]),
|
|
151
|
-
isHovered: linearGradient('96deg', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100]),
|
|
152
|
-
isPressed: linearGradient('96deg', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100]),
|
|
153
|
-
isFocusVisible: linearGradient('96deg', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100])
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
isDisabled: 'none',
|
|
157
|
-
forcedColors: 'none'
|
|
158
|
-
},
|
|
159
141
|
backgroundColor: {
|
|
160
142
|
fillStyle: {
|
|
161
143
|
fill: {
|
|
@@ -296,6 +278,42 @@ const button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: bool
|
|
|
296
278
|
disableTapHighlight: true
|
|
297
279
|
}, getAllowedOverrides());
|
|
298
280
|
|
|
281
|
+
// Put the gradient background on a separate element from the button to work around a Safari
|
|
282
|
+
// bug where transitions of custom properties cause layout flickering if any properties use rems. 🤣
|
|
283
|
+
// https://bugs.webkit.org/show_bug.cgi?id=285622
|
|
284
|
+
const gradient = style({
|
|
285
|
+
position: 'absolute',
|
|
286
|
+
inset: 0,
|
|
287
|
+
zIndex: -1,
|
|
288
|
+
transition: 'default',
|
|
289
|
+
borderRadius: '[inherit]',
|
|
290
|
+
backgroundImage: {
|
|
291
|
+
variant: {
|
|
292
|
+
premium: {
|
|
293
|
+
default: linearGradient('to bottom right', ['fuchsia-900', 0], ['indigo-900', 66], ['blue-900', 100]),
|
|
294
|
+
isHovered: linearGradient('to bottom right', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100]),
|
|
295
|
+
isPressed: linearGradient('to bottom right', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100]),
|
|
296
|
+
isFocusVisible: linearGradient('to bottom right', ['fuchsia-1000', 0], ['indigo-1000', 66], ['blue-1000', 100])
|
|
297
|
+
},
|
|
298
|
+
genai: {
|
|
299
|
+
default: linearGradient('to bottom right', ['red-900', 0], ['magenta-900', 33], ['indigo-900', 100]),
|
|
300
|
+
isHovered: linearGradient('to bottom right', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100]),
|
|
301
|
+
isPressed: linearGradient('to bottom right', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100]),
|
|
302
|
+
isFocusVisible: linearGradient('to bottom right', ['red-1000', 0], ['magenta-1000', 33], ['indigo-1000', 100])
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
isDisabled: 'none',
|
|
306
|
+
forcedColors: 'none'
|
|
307
|
+
},
|
|
308
|
+
// Force gradient colors to remain static between light and dark theme.
|
|
309
|
+
colorScheme: {
|
|
310
|
+
variant: {
|
|
311
|
+
premium: 'light',
|
|
312
|
+
genai: 'light'
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
299
317
|
/**
|
|
300
318
|
* Buttons allow users to perform an action.
|
|
301
319
|
* They have multiple styles for various needs, and are ideal for calling attention to
|
|
@@ -350,65 +368,79 @@ export const Button = forwardRef(function Button(props: ButtonProps, ref: Focusa
|
|
|
350
368
|
staticColor,
|
|
351
369
|
isStaticColor: !!staticColor
|
|
352
370
|
}, props.styles)}>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
371
|
+
{(renderProps) => (<>
|
|
372
|
+
{variant === 'genai' || variant === 'premium'
|
|
373
|
+
? (
|
|
374
|
+
<span
|
|
375
|
+
className={gradient({
|
|
376
|
+
...renderProps,
|
|
377
|
+
// Retain hover styles when an overlay is open.
|
|
378
|
+
isHovered: renderProps.isHovered || overlayTriggerState?.isOpen || false,
|
|
379
|
+
isDisabled: renderProps.isDisabled || isProgressVisible,
|
|
380
|
+
variant
|
|
381
|
+
})} />
|
|
382
|
+
)
|
|
383
|
+
: null}
|
|
384
|
+
<Provider
|
|
385
|
+
values={[
|
|
386
|
+
[SkeletonContext, null],
|
|
387
|
+
[TextContext, {
|
|
388
|
+
styles: style({
|
|
389
|
+
paddingY: '--labelPadding',
|
|
390
|
+
order: 1,
|
|
391
|
+
opacity: {
|
|
392
|
+
default: 1,
|
|
393
|
+
isProgressVisible: 0
|
|
394
|
+
}
|
|
395
|
+
})({isProgressVisible}),
|
|
396
|
+
// @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past
|
|
397
|
+
'data-rsp-slot': 'text'
|
|
398
|
+
}],
|
|
399
|
+
[IconContext, {
|
|
400
|
+
render: centerBaseline({slot: 'icon', styles: style({order: 0})}),
|
|
401
|
+
styles: style({
|
|
402
|
+
size: fontRelative(20),
|
|
403
|
+
marginStart: '--iconMargin',
|
|
404
|
+
flexShrink: 0,
|
|
405
|
+
opacity: {
|
|
406
|
+
default: 1,
|
|
407
|
+
isProgressVisible: 0
|
|
408
|
+
}
|
|
409
|
+
})({isProgressVisible})
|
|
410
|
+
}]
|
|
411
|
+
]}>
|
|
412
|
+
{typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}
|
|
413
|
+
{isPending &&
|
|
414
|
+
<div
|
|
415
|
+
className={style({
|
|
416
|
+
position: 'absolute',
|
|
417
|
+
top: '[50%]',
|
|
418
|
+
left: '[50%]',
|
|
419
|
+
transform: 'translate(-50%, -50%)',
|
|
420
|
+
opacity: {
|
|
421
|
+
default: 0,
|
|
422
|
+
isProgressVisible: 1
|
|
423
|
+
}
|
|
424
|
+
})({isProgressVisible, isPending})}>
|
|
425
|
+
<ProgressCircle
|
|
426
|
+
isIndeterminate
|
|
427
|
+
aria-label={stringFormatter.format('button.pending')}
|
|
428
|
+
size="S"
|
|
429
|
+
staticColor={staticColor}
|
|
430
|
+
styles={style({
|
|
401
431
|
size: {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
432
|
+
size: {
|
|
433
|
+
S: 14,
|
|
434
|
+
M: 18,
|
|
435
|
+
L: 20,
|
|
436
|
+
XL: 24
|
|
437
|
+
}
|
|
406
438
|
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
439
|
+
})({size})} />
|
|
440
|
+
</div>
|
|
441
|
+
}
|
|
442
|
+
</Provider>
|
|
443
|
+
</>)}
|
|
412
444
|
</RACButton>
|
|
413
445
|
);
|
|
414
446
|
});
|
package/src/CloseButton.tsx
CHANGED
|
@@ -492,7 +492,24 @@ function $7dddb03c6ef7d79c$export$9b476054b78b89cd(a, b, percent) {
|
|
|
492
492
|
return `[color-mix(in srgb, ${$7dddb03c6ef7d79c$var$parseColor(a)}, ${$7dddb03c6ef7d79c$var$parseColor(b)} ${percent}%)]`;
|
|
493
493
|
}
|
|
494
494
|
function $7dddb03c6ef7d79c$export$46def8197cf4dd4c(angle, ...tokens) {
|
|
495
|
-
|
|
495
|
+
// Generate @property rules for each gradient stop color. This allows the gradient to be animated.
|
|
496
|
+
let propertyDefinitions = [];
|
|
497
|
+
for(let i = 0; i < tokens.length; i++)propertyDefinitions.push(`@property --g${i} {
|
|
498
|
+
syntax: '<color>';
|
|
499
|
+
initial-value: #0000;
|
|
500
|
+
inherits: false;
|
|
501
|
+
}`);
|
|
502
|
+
if (this && typeof this.addAsset === 'function') this.addAsset({
|
|
503
|
+
type: 'css',
|
|
504
|
+
content: propertyDefinitions.join('\n\n')
|
|
505
|
+
});
|
|
506
|
+
return [
|
|
507
|
+
{
|
|
508
|
+
type: 'linear-gradient',
|
|
509
|
+
angle: angle,
|
|
510
|
+
stops: tokens
|
|
511
|
+
}
|
|
512
|
+
];
|
|
496
513
|
}
|
|
497
514
|
function $7dddb03c6ef7d79c$var$generateSpacing(px) {
|
|
498
515
|
let res = {};
|
|
@@ -671,8 +688,10 @@ let $7dddb03c6ef7d79c$var$gridTrackSize = (value)=>{
|
|
|
671
688
|
return value in $7dddb03c6ef7d79c$var$baseSpacing ? $7dddb03c6ef7d79c$var$baseSpacing[value] : value;
|
|
672
689
|
};
|
|
673
690
|
const $7dddb03c6ef7d79c$var$transitionProperty = {
|
|
674
|
-
|
|
675
|
-
|
|
691
|
+
// var(--gp) is generated by the backgroundImage property when setting a gradient.
|
|
692
|
+
// It includes a list of all of the custom properties used for each color stop.
|
|
693
|
+
default: 'color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter',
|
|
694
|
+
colors: 'color, background-color, var(--gp), border-color, text-decoration-color, fill, stroke',
|
|
676
695
|
opacity: 'opacity',
|
|
677
696
|
shadow: 'box-shadow',
|
|
678
697
|
transform: 'transform, translate, scale, rotate',
|
|
@@ -1343,7 +1362,26 @@ const $7dddb03c6ef7d79c$export$1d567c320f4763bc = (0, $b3643cb9d2948e30$exports.
|
|
|
1343
1362
|
'dark',
|
|
1344
1363
|
'light dark'
|
|
1345
1364
|
],
|
|
1346
|
-
backgroundImage: (0, $b3643cb9d2948e30$exports.createArbitraryProperty)()
|
|
1365
|
+
backgroundImage: (0, $b3643cb9d2948e30$exports.createArbitraryProperty)((value, property)=>{
|
|
1366
|
+
if (typeof value === 'string') return {
|
|
1367
|
+
[property]: value
|
|
1368
|
+
};
|
|
1369
|
+
else if (Array.isArray(value) && value[0]?.type === 'linear-gradient') {
|
|
1370
|
+
let values = {
|
|
1371
|
+
[property]: `linear-gradient(${value[0].angle}, ${value[0].stops.map(([, stop], i)=>`var(--g${i}) ${stop}%`)})`
|
|
1372
|
+
};
|
|
1373
|
+
// Create a CSS var for each color stop so the gradient can be transitioned.
|
|
1374
|
+
// These are registered via @property in the `linearGradient` macro.
|
|
1375
|
+
let properties = [];
|
|
1376
|
+
value[0].stops.forEach(([color], i)=>{
|
|
1377
|
+
properties.push(`--g${i}`);
|
|
1378
|
+
values[`--g${i}`] = $7dddb03c6ef7d79c$var$parseColor(color);
|
|
1379
|
+
});
|
|
1380
|
+
// This is used by transition-property so we automatically transition all of the color stops.
|
|
1381
|
+
values['--gp'] = properties.join(', ');
|
|
1382
|
+
return values;
|
|
1383
|
+
} else throw new Error('Unexpected backgroundImage value: ' + JSON.stringify(value));
|
|
1384
|
+
}),
|
|
1347
1385
|
// TODO: do we need separate x and y properties?
|
|
1348
1386
|
backgroundPosition: [
|
|
1349
1387
|
'bottom',
|