@react-spectrum/s2 3.0.0-nightly-d87cc4422-250109 → 3.0.0-nightly-101d0772b-250111

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 (138) hide show
  1. package/dist/ActionBar.cjs +2 -2
  2. package/dist/ActionBar.css +2 -2
  3. package/dist/ActionBar.mjs +2 -2
  4. package/dist/ActionButton.css +1 -1
  5. package/dist/Breadcrumbs.css +1 -1
  6. package/dist/Button.cjs +133 -98
  7. package/dist/Button.cjs.map +1 -1
  8. package/dist/Button.css +118 -37
  9. package/dist/Button.css.map +1 -1
  10. package/dist/Button.mjs +134 -99
  11. package/dist/Button.mjs.map +1 -1
  12. package/dist/Card.cjs +15 -15
  13. package/dist/Card.css +19 -19
  14. package/dist/Card.mjs +15 -15
  15. package/dist/CardView.cjs.map +1 -1
  16. package/dist/CardView.css.map +1 -1
  17. package/dist/CardView.mjs.map +1 -1
  18. package/dist/Checkbox.cjs +1 -1
  19. package/dist/Checkbox.css +3 -3
  20. package/dist/Checkbox.mjs +1 -1
  21. package/dist/CheckboxGroup.cjs +12 -12
  22. package/dist/CheckboxGroup.css +12 -12
  23. package/dist/CheckboxGroup.mjs +12 -12
  24. package/dist/CloseButton.cjs +2 -0
  25. package/dist/CloseButton.cjs.map +1 -1
  26. package/dist/CloseButton.css +9 -1
  27. package/dist/CloseButton.css.map +1 -1
  28. package/dist/CloseButton.mjs +2 -0
  29. package/dist/CloseButton.mjs.map +1 -1
  30. package/dist/ColorField.cjs +8 -8
  31. package/dist/ColorField.css +8 -8
  32. package/dist/ColorField.mjs +8 -8
  33. package/dist/ColorSlider.cjs +10 -10
  34. package/dist/ColorSlider.css +10 -10
  35. package/dist/ColorSlider.mjs +10 -10
  36. package/dist/ComboBox.cjs +12 -12
  37. package/dist/ComboBox.css +13 -13
  38. package/dist/ComboBox.mjs +12 -12
  39. package/dist/Disclosure.css +1 -1
  40. package/dist/Field.cjs +12 -12
  41. package/dist/Field.css +13 -13
  42. package/dist/Field.mjs +12 -12
  43. package/dist/Form.cjs +2 -2
  44. package/dist/Form.css +2 -2
  45. package/dist/Form.mjs +2 -2
  46. package/dist/FullscreenDialog.cjs +5 -5
  47. package/dist/FullscreenDialog.css +22 -22
  48. package/dist/FullscreenDialog.mjs +5 -5
  49. package/dist/IllustratedMessage.cjs +19 -19
  50. package/dist/IllustratedMessage.css +22 -22
  51. package/dist/IllustratedMessage.mjs +19 -19
  52. package/dist/InlineAlert.cjs +13 -13
  53. package/dist/InlineAlert.css +15 -15
  54. package/dist/InlineAlert.mjs +13 -13
  55. package/dist/Link.css +1 -1
  56. package/dist/Menu.cjs +37 -37
  57. package/dist/Menu.css +38 -38
  58. package/dist/Menu.mjs +37 -37
  59. package/dist/Meter.cjs +12 -12
  60. package/dist/Meter.css +12 -12
  61. package/dist/Meter.mjs +12 -12
  62. package/dist/Modal.cjs +4 -4
  63. package/dist/Modal.css +2 -2
  64. package/dist/Modal.mjs +4 -4
  65. package/dist/NumberField.cjs +12 -12
  66. package/dist/NumberField.css +13 -13
  67. package/dist/NumberField.mjs +12 -12
  68. package/dist/Picker.cjs +16 -16
  69. package/dist/Picker.css +17 -17
  70. package/dist/Picker.mjs +16 -16
  71. package/dist/Popover.cjs +10 -10
  72. package/dist/Popover.css +5 -5
  73. package/dist/Popover.mjs +10 -10
  74. package/dist/ProgressBar.cjs +19 -19
  75. package/dist/ProgressBar.css +18 -18
  76. package/dist/ProgressBar.mjs +19 -19
  77. package/dist/Radio.cjs +1 -1
  78. package/dist/Radio.css +3 -3
  79. package/dist/Radio.mjs +1 -1
  80. package/dist/RadioGroup.cjs +12 -12
  81. package/dist/RadioGroup.css +12 -12
  82. package/dist/RadioGroup.mjs +12 -12
  83. package/dist/SearchField.cjs +8 -8
  84. package/dist/SearchField.css +8 -8
  85. package/dist/SearchField.mjs +8 -8
  86. package/dist/SegmentedControl.css +1 -1
  87. package/dist/Slider.cjs +27 -27
  88. package/dist/Slider.css +27 -27
  89. package/dist/Slider.mjs +27 -27
  90. package/dist/Switch.cjs +1 -1
  91. package/dist/Switch.css +3 -3
  92. package/dist/Switch.mjs +1 -1
  93. package/dist/TableView.cjs.map +1 -1
  94. package/dist/TableView.css.map +1 -1
  95. package/dist/TableView.mjs.map +1 -1
  96. package/dist/Tabs.cjs +14 -14
  97. package/dist/Tabs.cjs.map +1 -1
  98. package/dist/Tabs.css +1 -1
  99. package/dist/Tabs.css.map +1 -1
  100. package/dist/Tabs.mjs +14 -14
  101. package/dist/Tabs.mjs.map +1 -1
  102. package/dist/TabsPicker.cjs +14 -14
  103. package/dist/TabsPicker.cjs.map +1 -1
  104. package/dist/TabsPicker.css +10 -10
  105. package/dist/TabsPicker.css.map +1 -1
  106. package/dist/TabsPicker.mjs +14 -14
  107. package/dist/TabsPicker.mjs.map +1 -1
  108. package/dist/TagGroup.cjs +16 -16
  109. package/dist/TagGroup.css +17 -17
  110. package/dist/TagGroup.mjs +16 -16
  111. package/dist/TextField.cjs +8 -8
  112. package/dist/TextField.css +8 -8
  113. package/dist/TextField.mjs +8 -8
  114. package/dist/Tooltip.cjs +5 -5
  115. package/dist/Tooltip.css +4 -4
  116. package/dist/Tooltip.mjs +5 -5
  117. package/dist/types.d.ts +6 -2
  118. package/dist/types.d.ts.map +1 -1
  119. package/package.json +19 -19
  120. package/src/Button.tsx +107 -75
  121. package/src/CardView.tsx +1 -0
  122. package/src/CloseButton.tsx +4 -0
  123. package/src/TableView.tsx +1 -0
  124. package/src/Tabs.tsx +26 -18
  125. package/src/TabsPicker.tsx +11 -6
  126. package/style/dist/spectrum-theme.cjs +42 -4
  127. package/style/dist/spectrum-theme.cjs.map +1 -1
  128. package/style/dist/spectrum-theme.mjs +42 -4
  129. package/style/dist/spectrum-theme.mjs.map +1 -1
  130. package/style/dist/style-macro.cjs +1 -1
  131. package/style/dist/style-macro.cjs.map +1 -1
  132. package/style/dist/style-macro.mjs +1 -1
  133. package/style/dist/style-macro.mjs.map +1 -1
  134. package/style/dist/types.d.ts +8 -3
  135. package/style/dist/types.d.ts.map +1 -1
  136. package/style/spectrum-theme.ts +57 -6
  137. package/style/style-macro.ts +3 -3
  138. 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
- <Provider
354
- values={[
355
- [SkeletonContext, null],
356
- [TextContext, {
357
- styles: style({
358
- paddingY: '--labelPadding',
359
- order: 1,
360
- opacity: {
361
- default: 1,
362
- isProgressVisible: 0
363
- }
364
- })({isProgressVisible}),
365
- // @ts-ignore data-attributes allowed on all JSX elements, but adding to DOMProps has been problematic in the past
366
- 'data-rsp-slot': 'text'
367
- }],
368
- [IconContext, {
369
- render: centerBaseline({slot: 'icon', styles: style({order: 0})}),
370
- styles: style({
371
- size: fontRelative(20),
372
- marginStart: '--iconMargin',
373
- flexShrink: 0,
374
- opacity: {
375
- default: 1,
376
- isProgressVisible: 0
377
- }
378
- })({isProgressVisible})
379
- }]
380
- ]}>
381
- {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}
382
- {isPending &&
383
- <div
384
- className={style({
385
- position: 'absolute',
386
- top: '[50%]',
387
- left: '[50%]',
388
- transform: 'translate(-50%, -50%)',
389
- opacity: {
390
- default: 0,
391
- isProgressVisible: 1
392
- }
393
- })({isProgressVisible, isPending})}>
394
- <ProgressCircle
395
- isIndeterminate
396
- aria-label={stringFormatter.format('button.pending')}
397
- size="S"
398
- staticColor={staticColor}
399
- styles={style({
400
- size: {
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
- S: 14,
403
- M: 18,
404
- L: 20,
405
- XL: 24
432
+ size: {
433
+ S: 14,
434
+ M: 18,
435
+ L: 20,
436
+ XL: 24
437
+ }
406
438
  }
407
- }
408
- })({size})} />
409
- </div>
410
- }
411
- </Provider>
439
+ })({size})} />
440
+ </div>
441
+ }
442
+ </Provider>
443
+ </>)}
412
444
  </RACButton>
413
445
  );
414
446
  });
package/src/CardView.tsx CHANGED
@@ -62,6 +62,7 @@ export interface CardViewProps<T> extends Omit<GridListProps<T>, 'layout' | 'key
62
62
  onLoadMore?: () => void,
63
63
  /** Spectrum-defined styles, returned by the `style()` macro. */
64
64
  styles?: StylesPropWithHeight,
65
+ /** Provides the ActionBar to render when cards are selected in the CardView. */
65
66
  renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement
66
67
  }
67
68
 
@@ -65,6 +65,10 @@ const styles = style({
65
65
  isStaticColor: {
66
66
  default: baseColor('transparent-overlay-800'),
67
67
  isDisabled: 'transparent-overlay-400'
68
+ },
69
+ forcedColors: {
70
+ default: 'ButtonText',
71
+ isDisabled: 'GrayText'
68
72
  }
69
73
  }
70
74
  },
package/src/TableView.tsx CHANGED
@@ -105,6 +105,7 @@ interface S2TableProps {
105
105
  loadingState?: LoadingState,
106
106
  /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
107
107
  onLoadMore?: () => any,
108
+ /** Provides the ActionBar to display when rows are selected in the TableView. */
108
109
  renderActionBar?: (selectedKeys: 'all' | Set<Key>) => ReactElement
109
110
  }
110
111
 
package/src/Tabs.tsx CHANGED
@@ -53,9 +53,11 @@ export interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | '
53
53
  */
54
54
  density?: 'compact' | 'regular',
55
55
  /**
56
- * If the tabs should only display icons and no text.
56
+ * Defines if the text within the tabs should be hidden and only the icon should be shown.
57
+ * The text is always visible when the item is collapsed into a picker.
58
+ * @default 'show'
57
59
  */
58
- isIconOnly?: boolean
60
+ labelBehavior?: 'show' | 'hide'
59
61
  }
60
62
 
61
63
  export interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className'>, StyleProps {
@@ -96,7 +98,7 @@ export const Tabs = forwardRef(function Tabs(props: TabsProps, ref: DOMRef<HTMLD
96
98
  isDisabled,
97
99
  disabledKeys,
98
100
  orientation = 'horizontal',
99
- isIconOnly = false
101
+ labelBehavior = 'show'
100
102
  } = props;
101
103
  let domRef = useDOMRef(ref);
102
104
  let [value, setValue] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null!, props.onSelectionChange);
@@ -112,7 +114,7 @@ export const Tabs = forwardRef(function Tabs(props: TabsProps, ref: DOMRef<HTMLD
112
114
  disabledKeys,
113
115
  selectedKey: value,
114
116
  onSelectionChange: setValue,
115
- isIconOnly,
117
+ labelBehavior,
116
118
  onFocus: () => pickerRef.current?.focus(),
117
119
  pickerRef
118
120
  }]
@@ -141,10 +143,12 @@ const tablist = style({
141
143
  compact: 24,
142
144
  regular: 32
143
145
  },
144
- isIconOnly: {
145
- density: {
146
- compact: 16,
147
- regular: 24
146
+ labelBehavior: {
147
+ hide: {
148
+ density: {
149
+ compact: 16,
150
+ regular: 24
151
+ }
148
152
  }
149
153
  }
150
154
  }
@@ -170,7 +174,7 @@ const tablist = style({
170
174
  });
171
175
 
172
176
  export function TabList<T extends object>(props: TabListProps<T>) {
173
- let {density, isDisabled, disabledKeys, orientation, isIconOnly, onFocus} = useContext(InternalTabsContext) ?? {};
177
+ let {density, isDisabled, disabledKeys, orientation, labelBehavior, onFocus} = useContext(InternalTabsContext) ?? {};
174
178
  let {showItems} = useContext(CollapseContext) ?? {};
175
179
  let state = useContext(TabListStateContext);
176
180
  let [selectedTab, setSelectedTab] = useState<HTMLElement | undefined>(undefined);
@@ -208,7 +212,7 @@ export function TabList<T extends object>(props: TabListProps<T>) {
208
212
  <RACTabList
209
213
  {...props}
210
214
  ref={tablistRef}
211
- className={renderProps => tablist({...renderProps, isIconOnly, density})} />
215
+ className={renderProps => tablist({...renderProps, labelBehavior, density})} />
212
216
  {orientation === 'horizontal' &&
213
217
  <TabLine showItems={showItems} disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}
214
218
  </div>
@@ -255,7 +259,7 @@ const selectedIndicator = style({
255
259
  transitionTimingFunction: 'in-out'
256
260
  });
257
261
 
258
- function TabLine(props: TabLineProps & {isIconOnly?: boolean}) {
262
+ function TabLine(props: TabLineProps) {
259
263
  let {
260
264
  disabledKeys,
261
265
  isDisabled: isTabsDisabled,
@@ -342,7 +346,9 @@ const tab = style({
342
346
  flexShrink: 0,
343
347
  transition: 'default',
344
348
  paddingX: {
345
- isIconOnly: size(6)
349
+ labelBehavior: {
350
+ hide: size(6)
351
+ }
346
352
  }
347
353
  }, getAllowedOverrides());
348
354
 
@@ -356,7 +362,7 @@ const icon = style({
356
362
  });
357
363
 
358
364
  export function Tab(props: TabProps) {
359
- let {density, isIconOnly} = useContext(InternalTabsContext) ?? {};
365
+ let {density, labelBehavior} = useContext(InternalTabsContext) ?? {};
360
366
 
361
367
  return (
362
368
  <RACTab
@@ -364,7 +370,7 @@ export function Tab(props: TabProps) {
364
370
  // @ts-ignore
365
371
  originalProps={props}
366
372
  style={props.UNSAFE_style}
367
- className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density, isIconOnly}, props.styles)}>
373
+ className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density, labelBehavior}, props.styles)}>
368
374
  {({
369
375
  // @ts-ignore
370
376
  isMenu
@@ -380,9 +386,11 @@ export function Tab(props: TabProps) {
380
386
  style({
381
387
  order: 1,
382
388
  display: {
383
- isIconOnly: 'none'
389
+ labelBehavior: {
390
+ hide: 'none'
391
+ }
384
392
  }
385
- })({isIconOnly})
393
+ })({labelBehavior})
386
394
  }],
387
395
  [IconContext, {
388
396
  render: centerBaseline({slot: 'icon', styles: style({order: 0})}),
@@ -479,7 +487,7 @@ let HiddenTabs = function (props: {
479
487
  let TabsMenu = (props: {items: Array<Node<any>>, onSelectionChange: TabsProps['onSelectionChange']}) => {
480
488
  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');
481
489
  let {items} = props;
482
- let {density, onSelectionChange, selectedKey, isDisabled, disabledKeys, pickerRef, isIconOnly} = useContext(InternalTabsContext);
490
+ let {density, onSelectionChange, selectedKey, isDisabled, disabledKeys, pickerRef, labelBehavior} = useContext(InternalTabsContext);
483
491
  let state = useContext(TabListStateContext);
484
492
  let allKeysDisabled = useMemo(() => {
485
493
  return isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());
@@ -501,7 +509,7 @@ let TabsMenu = (props: {items: Array<Node<any>>, onSelectionChange: TabsProps['o
501
509
  ref={pickerRef ? pickerRef : undefined}
502
510
  isDisabled={isDisabled || allKeysDisabled}
503
511
  density={density!}
504
- isIconOnly={isIconOnly}
512
+ labelBehavior={labelBehavior}
505
513
  items={items}
506
514
  disabledKeys={disabledKeys}
507
515
  selectedKey={selectedKey}
@@ -88,8 +88,9 @@ export interface PickerProps<T extends object> extends
88
88
  density: 'compact' | 'regular',
89
89
  /**
90
90
  * If the tab picker should only display icon and no text for the button label.
91
+ * @default 'show
91
92
  */
92
- isIconOnly?: boolean
93
+ labelBehavior?: 'show' | 'hide'
93
94
  }
94
95
 
95
96
  export const PickerContext = createContext<ContextValue<Partial<PickerProps<any>>, FocusableRefValue<HTMLButtonElement>>>(null);
@@ -162,7 +163,9 @@ const iconCenterWrapper = style({
162
163
  display: 'flex',
163
164
  gridArea: 'icon',
164
165
  paddingStart: {
165
- isIconOnly: size(6)
166
+ labelBehavior: {
167
+ hide: size(6)
168
+ }
166
169
  }
167
170
  });
168
171
 
@@ -181,7 +184,7 @@ function Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLB
181
184
  items,
182
185
  placeholder = stringFormatter.format('picker.placeholder'),
183
186
  density,
184
- isIconOnly,
187
+ labelBehavior = 'show',
185
188
  ...pickerProps
186
189
  } = props;
187
190
  let isQuiet = true;
@@ -217,7 +220,7 @@ function Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLB
217
220
  [IconContext, {
218
221
  slots: {
219
222
  icon: {
220
- render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({isIconOnly})}),
223
+ render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({labelBehavior})}),
221
224
  styles: icon
222
225
  }
223
226
  }
@@ -228,11 +231,13 @@ function Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLB
228
231
  [DEFAULT_SLOT]: {styles: style({
229
232
  display: {
230
233
  default: 'block',
231
- isIconOnly: 'none'
234
+ labelBehavior: {
235
+ hide: 'none'
236
+ }
232
237
  },
233
238
  flexGrow: 1,
234
239
  truncate: true
235
- })({isIconOnly})}
240
+ })({labelBehavior})}
236
241
  }
237
242
  }],
238
243
  [InsideSelectValueContext, true]
@@ -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
- return `linear-gradient(${angle}, ${tokens.map(([color, stop])=>`${$7dddb03c6ef7d79c$var$parseColor(color)} ${stop}%`)})`;
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
- default: 'color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter',
675
- colors: 'color, background-color, border-color, text-decoration-color, fill, stroke',
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',