@sanity/ui 2.6.7 → 2.6.8
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/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.esm.js +36 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +35 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -31
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +14 -14
- package/dist/theme.d.ts +14 -14
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs.map +1 -1
- package/package.json +25 -24
- package/src/core/__workshop__/constants.ts +36 -36
- package/src/core/components/autocomplete/autocomplete.tsx +1 -1
- package/src/core/components/dialog/styles.ts +8 -8
- package/src/core/components/menu/menuButton.tsx +10 -10
- package/src/core/components/tab/tab.tsx +8 -8
- package/src/core/components/tab/tabPanel.tsx +1 -1
- package/src/core/primitives/avatar/styles.ts +42 -42
- package/src/core/primitives/badge/styles.ts +2 -2
- package/src/core/primitives/button/styles.ts +4 -4
- package/src/core/primitives/inline/styles.ts +2 -2
- package/src/core/primitives/popover/constants.ts +4 -4
- package/src/core/primitives/stack/styles.ts +2 -2
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -1
- package/src/core/primitives/tooltip/constants.ts +4 -4
- package/src/core/primitives/tooltip/tooltip.tsx +68 -49
- package/src/core/styles/font/responsiveFont.ts +8 -8
- package/src/core/theme/__workshop__/debug/story.tsx +11 -11
- package/src/theme/build/buildColorTheme.test.ts +13 -13
- package/src/theme/config/tokens/color/types.ts +14 -14
- package/src/theme/defaults/colorTokens.ts +36 -36
|
@@ -20,10 +20,11 @@ import {
|
|
|
20
20
|
useRef,
|
|
21
21
|
useState,
|
|
22
22
|
useId,
|
|
23
|
-
useSyncExternalStore,
|
|
24
23
|
useImperativeHandle,
|
|
24
|
+
useLayoutEffect,
|
|
25
25
|
} from 'react'
|
|
26
26
|
import {styled} from 'styled-components'
|
|
27
|
+
import {useEffectEvent} from 'use-effect-event'
|
|
27
28
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
28
29
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
29
30
|
import {origin} from '../../middleware/origin'
|
|
@@ -85,9 +86,8 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
85
86
|
animate?: boolean
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
const Root = styled(Layer)
|
|
89
|
+
const Root = styled(Layer)`
|
|
89
90
|
pointer-events: none;
|
|
90
|
-
max-width: ${({$maxWidth}) => $maxWidth}px;
|
|
91
91
|
`
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -127,6 +127,7 @@ 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)
|
|
130
131
|
|
|
131
132
|
useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)
|
|
132
133
|
|
|
@@ -134,24 +135,6 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
134
135
|
const portalElement =
|
|
135
136
|
typeof portalProp === 'string' ? portal.elements?.[portalProp] || null : portal.element
|
|
136
137
|
|
|
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
|
-
|
|
155
138
|
const middleware = useMemo(() => {
|
|
156
139
|
const ret: Middleware[] = []
|
|
157
140
|
|
|
@@ -285,31 +268,8 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
285
268
|
[childProp?.props, handleIsOpenChange],
|
|
286
269
|
)
|
|
287
270
|
|
|
288
|
-
//
|
|
289
|
-
|
|
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])
|
|
271
|
+
// Handle closing the tooltip when the mouse leaves the referenceElement
|
|
272
|
+
useCloseOnMouseLeave({handleIsOpenChange, referenceElement, showTooltip})
|
|
313
273
|
|
|
314
274
|
// Close when `disabled` changes to `true`
|
|
315
275
|
useEffect(() => {
|
|
@@ -340,6 +300,20 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
340
300
|
window.removeEventListener('keydown', handleWindowKeyDown)
|
|
341
301
|
}
|
|
342
302
|
}, [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
|
+
|
|
343
317
|
const setArrow = useCallback(
|
|
344
318
|
(arrowEl: HTMLDivElement | null) => {
|
|
345
319
|
arrowRef.current = arrowEl
|
|
@@ -402,9 +376,11 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
402
376
|
data-ui="Tooltip"
|
|
403
377
|
{...restProps}
|
|
404
378
|
ref={setFloating}
|
|
405
|
-
style={
|
|
379
|
+
style={{
|
|
380
|
+
...floatingStyles,
|
|
381
|
+
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,
|
|
382
|
+
}}
|
|
406
383
|
zOffset={zOffset}
|
|
407
|
-
$maxWidth={tooltipWidth}
|
|
408
384
|
>
|
|
409
385
|
<TooltipCard
|
|
410
386
|
{...restProps}
|
|
@@ -454,4 +430,47 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
454
430
|
)
|
|
455
431
|
})
|
|
456
432
|
|
|
457
|
-
|
|
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
|
+
}
|
|
@@ -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
|
}
|
|
@@ -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
|
},
|