@sanity/ui 2.6.6 → 2.6.7

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 (35) hide show
  1. package/dist/index.d.mts +9 -9
  2. package/dist/index.d.ts +9 -9
  3. package/dist/index.esm.js +47 -48
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +47 -47
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +47 -48
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/theme.d.mts +14 -14
  10. package/dist/theme.d.ts +14 -14
  11. package/dist/theme.esm.js.map +1 -1
  12. package/dist/theme.js.map +1 -1
  13. package/dist/theme.mjs.map +1 -1
  14. package/package.json +24 -25
  15. package/src/core/__workshop__/constants.ts +36 -36
  16. package/src/core/components/autocomplete/autocomplete.tsx +1 -1
  17. package/src/core/components/dialog/styles.ts +8 -8
  18. package/src/core/components/menu/menuButton.tsx +10 -10
  19. package/src/core/components/tab/tab.tsx +8 -8
  20. package/src/core/components/tab/tabPanel.tsx +1 -1
  21. package/src/core/primitives/avatar/styles.ts +42 -42
  22. package/src/core/primitives/badge/styles.ts +2 -2
  23. package/src/core/primitives/button/styles.ts +4 -4
  24. package/src/core/primitives/inline/styles.ts +2 -2
  25. package/src/core/primitives/popover/constants.ts +4 -4
  26. package/src/core/primitives/stack/styles.ts +2 -2
  27. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -1
  28. package/src/core/primitives/tooltip/constants.ts +4 -4
  29. package/src/core/primitives/tooltip/tooltip.tsx +49 -68
  30. package/src/core/styles/font/responsiveFont.ts +8 -8
  31. package/src/core/theme/__workshop__/debug/story.tsx +11 -11
  32. package/src/core/utils/portal/portalProvider.tsx +10 -5
  33. package/src/theme/build/buildColorTheme.test.ts +13 -13
  34. package/src/theme/config/tokens/color/types.ts +14 -14
  35. package/src/theme/defaults/colorTokens.ts +36 -36
@@ -20,11 +20,10 @@ import {
20
20
  useRef,
21
21
  useState,
22
22
  useId,
23
+ useSyncExternalStore,
23
24
  useImperativeHandle,
24
- useLayoutEffect,
25
25
  } from 'react'
26
26
  import {styled} from 'styled-components'
27
- import {useEffectEvent} from 'use-effect-event'
28
27
  import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
29
28
  import {useDelayedState} from '../../hooks/useDelayedState'
30
29
  import {origin} from '../../middleware/origin'
@@ -86,8 +85,9 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
86
85
  animate?: boolean
87
86
  }
88
87
 
89
- const Root = styled(Layer)`
88
+ const Root = styled(Layer)<{$maxWidth: number}>`
90
89
  pointer-events: none;
90
+ max-width: ${({$maxWidth}) => $maxWidth}px;
91
91
  `
92
92
 
93
93
  /**
@@ -127,7 +127,6 @@ export const Tooltip = forwardRef(function Tooltip(
127
127
  const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)
128
128
  const arrowRef = useRef<HTMLDivElement | null>(null)
129
129
  const rootBoundary: RootBoundary = 'viewport'
130
- const [tooltipMaxWidth, setTooltipMaxWidth] = useState(0)
131
130
 
132
131
  useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)
133
132
 
@@ -135,6 +134,24 @@ export const Tooltip = forwardRef(function Tooltip(
135
134
  const portalElement =
136
135
  typeof portalProp === 'string' ? portal.elements?.[portalProp] || null : portal.element
137
136
 
137
+ const documentBodyOffsetWidth = useSyncExternalStore(
138
+ emptySubscribe,
139
+ () => document.body.offsetWidth,
140
+ // We don't actually know what the width of the body is during SSR, so we'll just assume it's 800px or larger
141
+ () => 800,
142
+ )
143
+ // Get the maximum tooltip width (sans tooltip padding)
144
+ // Tooltip width should never exceed the width of either any supplied boundary or portal element.
145
+ // If both portal and boundary elements are provided, use the smaller width of the two.
146
+ const tooltipWidth = useMemo(() => {
147
+ const availableWidths = [
148
+ ...(boundaryElement ? [boundaryElement.offsetWidth] : []),
149
+ portalElement?.offsetWidth || documentBodyOffsetWidth,
150
+ ]
151
+
152
+ return Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2
153
+ }, [boundaryElement, documentBodyOffsetWidth, portalElement?.offsetWidth])
154
+
138
155
  const middleware = useMemo(() => {
139
156
  const ret: Middleware[] = []
140
157
 
@@ -268,8 +285,31 @@ export const Tooltip = forwardRef(function Tooltip(
268
285
  [childProp?.props, handleIsOpenChange],
269
286
  )
270
287
 
271
- // Handle closing the tooltip when the mouse leaves the referenceElement
272
- useCloseOnMouseLeave({handleIsOpenChange, referenceElement, showTooltip})
288
+ // Detect whether the mouse is moving outside of the reference element. This is sometimes
289
+ // necessary, because the tooltip might not always close as it should (e.g. when clicking
290
+ // the reference element triggers a CPU-heavy operation.)
291
+ useEffect(() => {
292
+ if (!showTooltip) return
293
+
294
+ function handleWindowMouseMove(event: MouseEvent) {
295
+ if (!referenceElement) return
296
+
297
+ const isHoveringReference =
298
+ referenceElement === event.target ||
299
+ (event.target instanceof Node && referenceElement.contains(event.target))
300
+
301
+ if (!isHoveringReference) {
302
+ handleIsOpenChange(false)
303
+ window.removeEventListener('mousemove', handleWindowMouseMove)
304
+ }
305
+ }
306
+
307
+ window.addEventListener('mousemove', handleWindowMouseMove)
308
+
309
+ return () => {
310
+ window.removeEventListener('mousemove', handleWindowMouseMove)
311
+ }
312
+ }, [showTooltip, referenceElement, handleIsOpenChange])
273
313
 
274
314
  // Close when `disabled` changes to `true`
275
315
  useEffect(() => {
@@ -300,20 +340,6 @@ export const Tooltip = forwardRef(function Tooltip(
300
340
  window.removeEventListener('keydown', handleWindowKeyDown)
301
341
  }
302
342
  }, [handleIsOpenChange, showTooltip])
303
-
304
- // // Set the max width of the tooltip based on boundaries and portals
305
- useLayoutEffect(() => {
306
- // Get the maximum tooltip width (sans tooltip padding)
307
- // Tooltip width should never exceed the width of either any supplied boundary or portal element.
308
- // If both portal and boundary elements are provided, use the smaller width of the two.
309
- const availableWidths = [
310
- ...(boundaryElement ? [boundaryElement.offsetWidth] : []),
311
- portalElement?.offsetWidth || document.body.offsetWidth,
312
- ]
313
-
314
- setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)
315
- }, [boundaryElement, portalElement])
316
-
317
343
  const setArrow = useCallback(
318
344
  (arrowEl: HTMLDivElement | null) => {
319
345
  arrowRef.current = arrowEl
@@ -376,11 +402,9 @@ export const Tooltip = forwardRef(function Tooltip(
376
402
  data-ui="Tooltip"
377
403
  {...restProps}
378
404
  ref={setFloating}
379
- style={{
380
- ...floatingStyles,
381
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,
382
- }}
405
+ style={floatingStyles}
383
406
  zOffset={zOffset}
407
+ $maxWidth={tooltipWidth}
384
408
  >
385
409
  <TooltipCard
386
410
  {...restProps}
@@ -430,47 +454,4 @@ export const Tooltip = forwardRef(function Tooltip(
430
454
  )
431
455
  })
432
456
 
433
- /**
434
- * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
435
- * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks
436
- */
437
- function useCloseOnMouseLeave({
438
- handleIsOpenChange,
439
- referenceElement,
440
- showTooltip,
441
- }: {
442
- handleIsOpenChange: (open: boolean, immediate?: boolean) => void
443
- referenceElement: HTMLElement | null
444
- showTooltip: boolean
445
- }) {
446
- // Since we don't want the `mouseevent` events to be attached and removed if the `referenceElement` is changed
447
- // we use a "effect event" (https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events)
448
- // in order to always see the latest `referenceElement` value inside the event handler itself.
449
- const onMouseMove = useEffectEvent((target: EventTarget | null, teardown: () => void) => {
450
- if (!referenceElement) return
451
-
452
- const isHoveringReference =
453
- referenceElement === target || (target instanceof Node && referenceElement.contains(target))
454
-
455
- if (!isHoveringReference) {
456
- handleIsOpenChange(false)
457
- // Allow removing the event listener eagerly, to avoid race conditions
458
- teardown()
459
- }
460
- })
461
-
462
- // Detect whether the mouse is moving outside of the reference element. This is sometimes
463
- // necessary, because the tooltip might not always close as it should (e.g. when clicking
464
- // the reference element triggers a CPU-heavy operation.)
465
- useEffect(() => {
466
- if (!showTooltip) return
467
-
468
- const handleMouseMove = (event: MouseEvent) => {
469
- onMouseMove(event.target, () => window.removeEventListener('mousemove', handleMouseMove))
470
- }
471
-
472
- window.addEventListener('mousemove', handleMouseMove)
473
-
474
- return () => window.removeEventListener('mousemove', handleMouseMove)
475
- }, [onMouseMove, showTooltip])
476
- }
457
+ const emptySubscribe = () => () => {}
@@ -21,11 +21,11 @@ export function responsiveFont(
21
21
  const defaultSize = sizes[2]
22
22
 
23
23
  const base: CSSObject = {
24
- 'position': 'relative',
25
- 'fontFamily': family,
24
+ position: 'relative',
25
+ fontFamily: family,
26
26
  fontWeight,
27
- 'padding': '1px 0',
28
- 'margin': 0,
27
+ padding: '1px 0',
28
+ margin: 0,
29
29
 
30
30
  '&:before': {
31
31
  content: '""',
@@ -75,10 +75,10 @@ export function fontSize(size: ThemeFontSize): CSSObject {
75
75
  const customIconOffset = (capHeight - customIconSize) / 2
76
76
 
77
77
  return {
78
- 'fontSize': rem(fontSize),
79
- 'lineHeight': `calc(${lineHeight} / ${fontSize})`,
80
- 'letterSpacing': rem(letterSpacing),
81
- 'transform': `translateY(${rem(descenderHeight)})`,
78
+ fontSize: rem(fontSize),
79
+ lineHeight: `calc(${lineHeight} / ${fontSize})`,
80
+ letterSpacing: rem(letterSpacing),
81
+ transform: `translateY(${rem(descenderHeight)})`,
82
82
 
83
83
  '&:before': {
84
84
  marginTop: `calc(${rem(0 - negHeight)} - 1px)`,
@@ -191,7 +191,7 @@ function DebugState() {
191
191
  style={
192
192
  {
193
193
  '--card-fg-color': 'var(--card-avatar-gray-fg-color)',
194
- 'backgroundColor': 'var(--card-avatar-gray-bg-color)',
194
+ backgroundColor: 'var(--card-avatar-gray-bg-color)',
195
195
  } as any
196
196
  }
197
197
  >
@@ -206,7 +206,7 @@ function DebugState() {
206
206
  style={
207
207
  {
208
208
  '--card-fg-color': 'var(--card-avatar-red-fg-color)',
209
- 'backgroundColor': 'var(--card-avatar-red-bg-color)',
209
+ backgroundColor: 'var(--card-avatar-red-bg-color)',
210
210
  } as any
211
211
  }
212
212
  >
@@ -221,7 +221,7 @@ function DebugState() {
221
221
  style={
222
222
  {
223
223
  '--card-fg-color': 'var(--card-avatar-orange-fg-color)',
224
- 'backgroundColor': 'var(--card-avatar-orange-bg-color)',
224
+ backgroundColor: 'var(--card-avatar-orange-bg-color)',
225
225
  } as any
226
226
  }
227
227
  >
@@ -236,7 +236,7 @@ function DebugState() {
236
236
  style={
237
237
  {
238
238
  '--card-fg-color': 'var(--card-avatar-yellow-fg-color)',
239
- 'backgroundColor': 'var(--card-avatar-yellow-bg-color)',
239
+ backgroundColor: 'var(--card-avatar-yellow-bg-color)',
240
240
  } as any
241
241
  }
242
242
  >
@@ -251,7 +251,7 @@ function DebugState() {
251
251
  style={
252
252
  {
253
253
  '--card-fg-color': 'var(--card-avatar-green-fg-color)',
254
- 'backgroundColor': 'var(--card-avatar-green-bg-color)',
254
+ backgroundColor: 'var(--card-avatar-green-bg-color)',
255
255
  } as any
256
256
  }
257
257
  >
@@ -266,7 +266,7 @@ function DebugState() {
266
266
  style={
267
267
  {
268
268
  '--card-fg-color': 'var(--card-avatar-cyan-fg-color)',
269
- 'backgroundColor': 'var(--card-avatar-cyan-bg-color)',
269
+ backgroundColor: 'var(--card-avatar-cyan-bg-color)',
270
270
  } as any
271
271
  }
272
272
  >
@@ -281,7 +281,7 @@ function DebugState() {
281
281
  style={
282
282
  {
283
283
  '--card-fg-color': 'var(--card-avatar-blue-fg-color)',
284
- 'backgroundColor': 'var(--card-avatar-blue-bg-color)',
284
+ backgroundColor: 'var(--card-avatar-blue-bg-color)',
285
285
  } as any
286
286
  }
287
287
  >
@@ -296,7 +296,7 @@ function DebugState() {
296
296
  style={
297
297
  {
298
298
  '--card-fg-color': 'var(--card-avatar-purple-fg-color)',
299
- 'backgroundColor': 'var(--card-avatar-purple-bg-color)',
299
+ backgroundColor: 'var(--card-avatar-purple-bg-color)',
300
300
  } as any
301
301
  }
302
302
  >
@@ -311,7 +311,7 @@ function DebugState() {
311
311
  style={
312
312
  {
313
313
  '--card-fg-color': 'var(--card-avatar-magenta-fg-color)',
314
- 'backgroundColor': 'var(--card-avatar-magenta-bg-color)',
314
+ backgroundColor: 'var(--card-avatar-magenta-bg-color)',
315
315
  } as any
316
316
  }
317
317
  >
@@ -395,7 +395,7 @@ function getStateVars(state: ThemeColorState_v2) {
395
395
  '--card-skeleton-from-color': state.skeleton.from,
396
396
  '--card-skeleton-to-color': state.skeleton.to,
397
397
 
398
- 'backgroundColor': 'var(--card-bg-color)',
399
- 'color': 'var(--card-fg-color)',
398
+ backgroundColor: 'var(--card-bg-color)',
399
+ color: 'var(--card-fg-color)',
400
400
  } as CSSProperties
401
401
  }
@@ -1,6 +1,5 @@
1
- import {useMemo} from 'react'
1
+ import {useMemo, useSyncExternalStore} from 'react'
2
2
  import {useUnique} from '../../hooks/_internal'
3
- import {useMounted} from '../../hooks/useMounted'
4
3
  import {PortalContext} from './portalContext'
5
4
  import {PortalContextValue} from './types'
6
5
 
@@ -26,16 +25,22 @@ export interface PortalProviderProps {
26
25
  export function PortalProvider(props: PortalProviderProps): React.ReactElement {
27
26
  const {boundaryElement, children, element, __unstable_elements: elementsProp} = props
28
27
  const elements = useUnique(elementsProp)
29
- const mounted = useMounted()
28
+ const fallbackElement = useSyncExternalStore(
29
+ emptySubscribe,
30
+ () => document.body,
31
+ () => null,
32
+ )
30
33
 
31
34
  const value: PortalContextValue = useMemo(() => {
32
35
  return {
33
36
  version: 0.0,
34
37
  boundaryElement: boundaryElement || null,
35
- element: element || mounted ? document.body : null,
38
+ element: element || fallbackElement,
36
39
  elements,
37
40
  }
38
- }, [boundaryElement, element, elements, mounted])
41
+ }, [boundaryElement, element, elements, fallbackElement])
39
42
 
40
43
  return <PortalContext.Provider value={value}>{children}</PortalContext.Provider>
41
44
  }
45
+
46
+ const emptySubscribe = () => () => {}
@@ -9,23 +9,23 @@ test('buildColorTheme: base', () => {
9
9
  bg: ['50', '900'],
10
10
  fg: ['800', '200'],
11
11
  },
12
- 'transparent': {
12
+ transparent: {
13
13
  bg: ['50', 'black'],
14
14
  },
15
- 'default': {
15
+ default: {
16
16
  bg: ['white', '950'],
17
17
  fg: ['black', '200'],
18
18
  },
19
- 'primary': {
19
+ primary: {
20
20
  _hue: 'purple',
21
21
  },
22
- 'positive': {
22
+ positive: {
23
23
  _hue: 'cyan',
24
24
  },
25
- 'caution': {
25
+ caution: {
26
26
  _hue: 'yellow',
27
27
  },
28
- 'critical': {
28
+ critical: {
29
29
  _hue: 'red',
30
30
  },
31
31
  },
@@ -100,23 +100,23 @@ test('buildColorTheme: button', () => {
100
100
  bg: ['50', '900'],
101
101
  fg: ['800', '200'],
102
102
  },
103
- 'transparent': {
103
+ transparent: {
104
104
  bg: ['50', 'black'],
105
105
  },
106
- 'default': {
106
+ default: {
107
107
  bg: ['white', '950'],
108
108
  fg: ['black', '200'],
109
109
  },
110
- 'primary': {
110
+ primary: {
111
111
  _hue: 'purple',
112
112
  },
113
- 'positive': {
113
+ positive: {
114
114
  _hue: 'cyan',
115
115
  },
116
- 'caution': {
116
+ caution: {
117
117
  _hue: 'yellow',
118
118
  },
119
- 'critical': {
119
+ critical: {
120
120
  _hue: 'red',
121
121
  },
122
122
  },
@@ -127,7 +127,7 @@ test('buildColorTheme: button', () => {
127
127
  bg: ['500', '400'],
128
128
  fg: ['white', 'black'],
129
129
  },
130
- 'hovered': {
130
+ hovered: {
131
131
  bg: ['600', '300'],
132
132
  },
133
133
  },
@@ -21,15 +21,15 @@ export interface ThemeColorAvatarHueTokens {
21
21
  /** @public */
22
22
  export interface ThemeColorAvatarTokens {
23
23
  '*'?: ThemeColorAvatarHueTokens
24
- 'gray'?: ThemeColorAvatarHueTokens
25
- 'blue'?: ThemeColorAvatarHueTokens
26
- 'purple'?: ThemeColorAvatarHueTokens
27
- 'magenta'?: ThemeColorAvatarHueTokens
28
- 'red'?: ThemeColorAvatarHueTokens
29
- 'orange'?: ThemeColorAvatarHueTokens
30
- 'yellow'?: ThemeColorAvatarHueTokens
31
- 'green'?: ThemeColorAvatarHueTokens
32
- 'cyan'?: ThemeColorAvatarHueTokens
24
+ gray?: ThemeColorAvatarHueTokens
25
+ blue?: ThemeColorAvatarHueTokens
26
+ purple?: ThemeColorAvatarHueTokens
27
+ magenta?: ThemeColorAvatarHueTokens
28
+ red?: ThemeColorAvatarHueTokens
29
+ orange?: ThemeColorAvatarHueTokens
30
+ yellow?: ThemeColorAvatarHueTokens
31
+ green?: ThemeColorAvatarHueTokens
32
+ cyan?: ThemeColorAvatarHueTokens
33
33
  }
34
34
 
35
35
  /** @public */
@@ -66,11 +66,11 @@ export interface ThemeColorBadgeToneTokens {
66
66
  /** @public */
67
67
  export interface ThemeColorBadgeTokens {
68
68
  '*'?: ThemeColorBadgeToneTokens
69
- 'default'?: ThemeColorBadgeToneTokens
70
- 'primary'?: ThemeColorBadgeToneTokens
71
- 'positive'?: ThemeColorBadgeToneTokens
72
- 'caution'?: ThemeColorBadgeToneTokens
73
- 'critical'?: ThemeColorBadgeToneTokens
69
+ default?: ThemeColorBadgeToneTokens
70
+ primary?: ThemeColorBadgeToneTokens
71
+ positive?: ThemeColorBadgeToneTokens
72
+ caution?: ThemeColorBadgeToneTokens
73
+ critical?: ThemeColorBadgeToneTokens
74
74
  }
75
75
 
76
76
  /** @public */
@@ -22,11 +22,11 @@ export const defaultColorTokens: ThemeColorTokens = {
22
22
  icon: ['500', '500'],
23
23
  dot: ['500', '500'],
24
24
  },
25
- 'positive': {
25
+ positive: {
26
26
  bg: ['200 50%', '900'],
27
27
  fg: ['600', '500'],
28
28
  },
29
- 'caution': {
29
+ caution: {
30
30
  bg: ['200 50%', '900'],
31
31
  fg: ['600', '500'],
32
32
  },
@@ -63,26 +63,26 @@ export const defaultColorTokens: ThemeColorTokens = {
63
63
  to: ['100 50%', '900 50%'],
64
64
  },
65
65
  },
66
- 'transparent': {
66
+ transparent: {
67
67
  bg: ['50', 'black'],
68
68
  },
69
- 'default': {
69
+ default: {
70
70
  bg: ['white', '950'],
71
71
  fg: ['800', '200'],
72
72
  muted: {
73
73
  fg: ['600', '400'],
74
74
  },
75
75
  },
76
- 'primary': {_hue: 'blue'},
77
- 'positive': {
76
+ primary: {_hue: 'blue'},
77
+ positive: {
78
78
  _hue: 'green',
79
79
  shadow: {outline: ['500/0.4', '500/0.4']},
80
80
  },
81
- 'caution': {
81
+ caution: {
82
82
  _hue: 'yellow',
83
83
  shadow: {outline: ['600/0.3', '500/0.4']},
84
84
  },
85
- 'critical': {_hue: 'red'},
85
+ critical: {_hue: 'red'},
86
86
  },
87
87
  button: {
88
88
  default: {
@@ -132,17 +132,17 @@ export const defaultColorTokens: ThemeColorTokens = {
132
132
  to: ['900 50%', '100 50%'],
133
133
  },
134
134
  },
135
- 'hovered': {
135
+ hovered: {
136
136
  bg: ['700', '300'],
137
137
  border: ['700/0', '300/0'],
138
138
  },
139
- 'pressed': {
139
+ pressed: {
140
140
  bg: ['700', '300'],
141
141
  },
142
- 'selected': {
142
+ selected: {
143
143
  bg: ['700', '300'],
144
144
  },
145
- 'disabled': {
145
+ disabled: {
146
146
  _hue: 'gray',
147
147
  accent: {
148
148
  fg: ['100 70%', '900 70%'],
@@ -182,7 +182,7 @@ export const defaultColorTokens: ThemeColorTokens = {
182
182
  },
183
183
  },
184
184
  },
185
- 'default': {
185
+ default: {
186
186
  '*': {
187
187
  avatar: {
188
188
  '*': {
@@ -197,13 +197,13 @@ export const defaultColorTokens: ThemeColorTokens = {
197
197
  fg: ['400', '600'],
198
198
  },
199
199
  },
200
- 'hovered': {
200
+ hovered: {
201
201
  bg: ['900', '100'],
202
202
  },
203
- 'pressed': {
203
+ pressed: {
204
204
  bg: ['black', 'white'],
205
205
  },
206
- 'selected': {
206
+ selected: {
207
207
  bg: ['black', 'white'],
208
208
  },
209
209
  },
@@ -255,19 +255,19 @@ export const defaultColorTokens: ThemeColorTokens = {
255
255
  to: ['100 50%', '900 50%'],
256
256
  },
257
257
  },
258
- 'hovered': {
258
+ hovered: {
259
259
  bg: ['100', '900'],
260
260
  fg: ['700', '300'],
261
261
  },
262
- 'pressed': {
262
+ pressed: {
263
263
  bg: ['100', '900'],
264
264
  fg: ['800', '200'],
265
265
  },
266
- 'selected': {
266
+ selected: {
267
267
  bg: ['100', '900'],
268
268
  fg: ['800', '200'],
269
269
  },
270
- 'disabled': {
270
+ disabled: {
271
271
  _hue: 'gray',
272
272
  accent: {
273
273
  fg: ['200', '800'],
@@ -308,12 +308,12 @@ export const defaultColorTokens: ThemeColorTokens = {
308
308
  },
309
309
  },
310
310
  },
311
- 'positive': {
311
+ positive: {
312
312
  '*': {
313
313
  border: ['600 20%', '800'],
314
314
  },
315
315
  },
316
- 'caution': {
316
+ caution: {
317
317
  '*': {
318
318
  border: ['600 20%', '800'],
319
319
  },
@@ -366,21 +366,21 @@ export const defaultColorTokens: ThemeColorTokens = {
366
366
  to: ['100 50%', '900 50%'],
367
367
  },
368
368
  },
369
- 'hovered': {
369
+ hovered: {
370
370
  bg: ['50', '950'],
371
371
  icon: ['700 70%', '400 70%'],
372
372
  },
373
- 'pressed': {
373
+ pressed: {
374
374
  bg: ['100', '900'],
375
375
  fg: ['800', '200'],
376
376
  icon: ['800 70%', '200 70%'],
377
377
  },
378
- 'selected': {
378
+ selected: {
379
379
  bg: ['100', '900'],
380
380
  fg: ['800', '200'],
381
381
  icon: ['800 60%', '200 60%'],
382
382
  },
383
- 'disabled': {
383
+ disabled: {
384
384
  _hue: 'gray',
385
385
  accent: {
386
386
  fg: ['200', '800'],
@@ -434,21 +434,21 @@ export const defaultColorTokens: ThemeColorTokens = {
434
434
  },
435
435
  placeholder: ['400', '600'],
436
436
  },
437
- 'hovered': {
437
+ hovered: {
438
438
  border: ['300', '700'],
439
439
  },
440
- 'readOnly': {
440
+ readOnly: {
441
441
  bg: ['50', '950'],
442
442
  border: ['200', '800'],
443
443
  fg: ['800', '200'],
444
444
  },
445
- 'disabled': {
445
+ disabled: {
446
446
  fg: ['400', '600'],
447
447
  border: ['100', '900'],
448
448
  placeholder: ['200', '800 50%'],
449
449
  },
450
450
  },
451
- 'invalid': {
451
+ invalid: {
452
452
  '*': {
453
453
  _hue: 'red',
454
454
  bg: ['100', '950'],
@@ -502,13 +502,13 @@ export const defaultColorTokens: ThemeColorTokens = {
502
502
  to: ['100 50%', '900 50%'],
503
503
  },
504
504
  },
505
- 'hovered': {
505
+ hovered: {
506
506
  bg: ['50', '950'],
507
507
  },
508
- 'pressed': {
508
+ pressed: {
509
509
  bg: ['100', '900'],
510
510
  },
511
- 'selected': {
511
+ selected: {
512
512
  _blend: ['screen', 'multiply'],
513
513
  accent: {
514
514
  fg: ['purple/300', 'purple/700'],
@@ -553,7 +553,7 @@ export const defaultColorTokens: ThemeColorTokens = {
553
553
  to: ['900 50%', '100 50%'],
554
554
  },
555
555
  },
556
- 'disabled': {
556
+ disabled: {
557
557
  _hue: 'gray',
558
558
  accent: {
559
559
  fg: ['200', '800'],
@@ -595,12 +595,12 @@ export const defaultColorTokens: ThemeColorTokens = {
595
595
  },
596
596
  },
597
597
  },
598
- 'default': {
598
+ default: {
599
599
  selected: {
600
600
  _hue: 'blue',
601
601
  },
602
602
  },
603
- 'critical': {
603
+ critical: {
604
604
  disabled: {
605
605
  bg: ['50 50%', '950 50%'],
606
606
  },