@sanity/ui 2.9.0-canary.6 → 2.9.0
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/_chunks-cjs/getTheme_v2.js +26 -0
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +26 -0
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +26 -0
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.esm.js +652 -1048
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +651 -1047
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +652 -1048
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +22 -28
- package/dist/theme.d.ts +22 -28
- package/dist/theme.esm.js +124 -260
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +124 -260
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +124 -260
- package/dist/theme.mjs.map +1 -1
- package/package.json +60 -53
- package/src/core/__workshop__/constants.ts +27 -31
- package/src/core/components/autocomplete/autocomplete.tsx +31 -42
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +47 -35
- package/src/core/components/dialog/dialog.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +5 -6
- package/src/core/components/menu/useMenuController.ts +21 -18
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +15 -18
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +2 -2
- package/src/core/hooks/useMatchMedia.ts +22 -12
- package/src/core/primitives/badge/__workshop__/tones.tsx +6 -13
- package/src/core/primitives/button/__workshop__/custom.tsx +4 -3
- package/src/core/primitives/card/__workshop__/allTones.tsx +6 -8
- package/src/core/primitives/card/__workshop__/asButton.tsx +42 -24
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +17 -7
- package/src/core/primitives/card/__workshop__/interactive.tsx +10 -3
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +5 -3
- package/src/core/primitives/card/__workshop__/props.tsx +7 -5
- package/src/core/primitives/card/__workshop__/selected.tsx +4 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +6 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +3 -3
- package/src/core/primitives/grid/__workshop__/responsive.tsx +12 -12
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +13 -25
- package/src/core/primitives/inline/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +6 -6
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +140 -74
- package/src/core/primitives/popover/popoverCard.tsx +4 -1
- package/src/core/primitives/radio/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +6 -6
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +11 -21
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -2
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +6 -2
- package/src/core/primitives/textInput/__workshop__/tones.tsx +38 -0
- package/src/core/primitives/tooltip/tooltip.tsx +17 -47
- package/src/core/styles/card/_cardColorStyle.ts +8 -0
- package/src/core/theme/__workshop__/debug/story.tsx +18 -11
- package/src/core/utils/portal/portalProvider.tsx +5 -5
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +47 -37
- package/src/theme/build/renderColorTheme.ts +26 -30
- package/src/theme/build/resolveColorTokens.ts +51 -115
- package/src/theme/config/tokens/color/types.ts +4 -18
- package/src/theme/defaults/colorTokens.ts +8 -5
- package/src/theme/getScopedTheme.ts +9 -2
- package/src/theme/system/color/_constants.ts +6 -2
- package/src/theme/system/color/badge.ts +3 -7
- package/src/theme/system/v0/color/_system.ts +8 -4
- package/src/theme/system/v0/color/color.ts +3 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -0
- package/src/theme/versioning/v0_v2.ts +4 -0
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
package/dist/theme.mjs
CHANGED
|
@@ -1354,7 +1354,9 @@ function v0_v2(v0) {
|
|
|
1354
1354
|
light: {
|
|
1355
1355
|
transparent: themeColor_v0_v2(color2.light.transparent),
|
|
1356
1356
|
default: themeColor_v0_v2(color2.light.default),
|
|
1357
|
+
neutral: themeColor_v0_v2(color2.light.transparent),
|
|
1357
1358
|
primary: themeColor_v0_v2(color2.light.primary),
|
|
1359
|
+
suggest: themeColor_v0_v2(color2.light.primary),
|
|
1358
1360
|
positive: themeColor_v0_v2(color2.light.positive),
|
|
1359
1361
|
caution: themeColor_v0_v2(color2.light.caution),
|
|
1360
1362
|
critical: themeColor_v0_v2(color2.light.critical)
|
|
@@ -1362,7 +1364,9 @@ function v0_v2(v0) {
|
|
|
1362
1364
|
dark: {
|
|
1363
1365
|
transparent: themeColor_v0_v2(color2.dark.transparent),
|
|
1364
1366
|
default: themeColor_v0_v2(color2.dark.default),
|
|
1367
|
+
neutral: themeColor_v0_v2(color2.dark.transparent),
|
|
1365
1368
|
primary: themeColor_v0_v2(color2.dark.primary),
|
|
1369
|
+
suggest: themeColor_v0_v2(color2.dark.primary),
|
|
1366
1370
|
positive: themeColor_v0_v2(color2.dark.positive),
|
|
1367
1371
|
caution: themeColor_v0_v2(color2.dark.caution),
|
|
1368
1372
|
critical: themeColor_v0_v2(color2.dark.critical)
|
|
@@ -1502,7 +1506,26 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1502
1506
|
placeholder: t.placeholder
|
|
1503
1507
|
};
|
|
1504
1508
|
}
|
|
1505
|
-
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1509
|
+
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1510
|
+
"transparent",
|
|
1511
|
+
"default",
|
|
1512
|
+
"neutral",
|
|
1513
|
+
"primary",
|
|
1514
|
+
// deprecated
|
|
1515
|
+
"suggest",
|
|
1516
|
+
"positive",
|
|
1517
|
+
"caution",
|
|
1518
|
+
"critical"
|
|
1519
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1520
|
+
"default",
|
|
1521
|
+
"neutral",
|
|
1522
|
+
"primary",
|
|
1523
|
+
// deprecated
|
|
1524
|
+
"suggest",
|
|
1525
|
+
"positive",
|
|
1526
|
+
"caution",
|
|
1527
|
+
"critical"
|
|
1528
|
+
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1506
1529
|
function isColorBlendModeValue(str) {
|
|
1507
1530
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1508
1531
|
}
|
|
@@ -1768,6 +1791,9 @@ const defaultColorTokens = {
|
|
|
1768
1791
|
primary: {
|
|
1769
1792
|
_hue: "blue"
|
|
1770
1793
|
},
|
|
1794
|
+
suggest: {
|
|
1795
|
+
_hue: "purple"
|
|
1796
|
+
},
|
|
1771
1797
|
positive: {
|
|
1772
1798
|
_hue: "green",
|
|
1773
1799
|
shadow: {
|
|
@@ -1833,7 +1859,7 @@ const defaultColorTokens = {
|
|
|
1833
1859
|
}
|
|
1834
1860
|
},
|
|
1835
1861
|
hovered: {
|
|
1836
|
-
bg: ["
|
|
1862
|
+
bg: ["600", "300"],
|
|
1837
1863
|
border: ["700/0", "300/0"]
|
|
1838
1864
|
},
|
|
1839
1865
|
pressed: {
|
|
@@ -1960,11 +1986,11 @@ const defaultColorTokens = {
|
|
|
1960
1986
|
fg: ["700", "300"]
|
|
1961
1987
|
},
|
|
1962
1988
|
pressed: {
|
|
1963
|
-
bg: ["
|
|
1989
|
+
bg: ["200", "800"],
|
|
1964
1990
|
fg: ["800", "200"]
|
|
1965
1991
|
},
|
|
1966
1992
|
selected: {
|
|
1967
|
-
bg: ["
|
|
1993
|
+
bg: ["200", "800"],
|
|
1968
1994
|
fg: ["800", "200"]
|
|
1969
1995
|
},
|
|
1970
1996
|
disabled: {
|
|
@@ -2068,7 +2094,8 @@ const defaultColorTokens = {
|
|
|
2068
2094
|
},
|
|
2069
2095
|
hovered: {
|
|
2070
2096
|
bg: ["50", "950"],
|
|
2071
|
-
|
|
2097
|
+
fg: ["800", "200"],
|
|
2098
|
+
icon: ["800 70%", "300 70%"]
|
|
2072
2099
|
},
|
|
2073
2100
|
pressed: {
|
|
2074
2101
|
bg: ["100", "900"],
|
|
@@ -2127,7 +2154,7 @@ const defaultColorTokens = {
|
|
|
2127
2154
|
"*": {
|
|
2128
2155
|
_blend: ["multiply", "screen"],
|
|
2129
2156
|
bg: ["white", "black"],
|
|
2130
|
-
border: ["200", "
|
|
2157
|
+
border: ["200", "700"],
|
|
2131
2158
|
fg: ["black", "200"],
|
|
2132
2159
|
muted: {
|
|
2133
2160
|
bg: ["50", "950"]
|
|
@@ -2143,6 +2170,7 @@ const defaultColorTokens = {
|
|
|
2143
2170
|
fg: ["800", "200"]
|
|
2144
2171
|
},
|
|
2145
2172
|
disabled: {
|
|
2173
|
+
bg: ["50", "950"],
|
|
2146
2174
|
fg: ["400", "600"],
|
|
2147
2175
|
border: ["100", "900"],
|
|
2148
2176
|
placeholder: ["200", "800 50%"]
|
|
@@ -2378,62 +2406,20 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2378
2406
|
return {
|
|
2379
2407
|
...spec,
|
|
2380
2408
|
_hue: hue,
|
|
2381
|
-
avatar: {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
magenta: merge({
|
|
2392
|
-
_hue: "magenta"
|
|
2393
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2394
|
-
red: merge({
|
|
2395
|
-
_hue: "red"
|
|
2396
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2397
|
-
orange: merge({
|
|
2398
|
-
_hue: "orange"
|
|
2399
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2400
|
-
yellow: merge({
|
|
2401
|
-
_hue: "yellow"
|
|
2402
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2403
|
-
green: merge({
|
|
2404
|
-
_hue: "green"
|
|
2405
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2406
|
-
cyan: merge({
|
|
2407
|
-
_hue: "cyan"
|
|
2408
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2409
|
-
},
|
|
2410
|
-
badge: {
|
|
2411
|
-
default: {
|
|
2412
|
-
_hue: inputTokens?.base?.default?._hue || hue,
|
|
2413
|
-
...spec.badge?.["*"],
|
|
2414
|
-
...spec.badge?.default
|
|
2415
|
-
},
|
|
2416
|
-
primary: {
|
|
2417
|
-
_hue: inputTokens?.base?.primary?._hue || hue,
|
|
2418
|
-
...spec.badge?.["*"],
|
|
2419
|
-
...spec.badge?.primary
|
|
2420
|
-
},
|
|
2421
|
-
positive: {
|
|
2422
|
-
_hue: inputTokens?.base?.positive?._hue || hue,
|
|
2409
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2410
|
+
...acc,
|
|
2411
|
+
[hue2]: merge({
|
|
2412
|
+
_hue: hue2
|
|
2413
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2414
|
+
}), {}),
|
|
2415
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2416
|
+
...acc,
|
|
2417
|
+
[tone2]: {
|
|
2418
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2423
2419
|
...spec.badge?.["*"],
|
|
2424
|
-
...spec.badge?.
|
|
2425
|
-
},
|
|
2426
|
-
caution: {
|
|
2427
|
-
_hue: inputTokens?.base?.caution?._hue || hue,
|
|
2428
|
-
...spec.badge?.["*"],
|
|
2429
|
-
...spec.badge?.caution
|
|
2430
|
-
},
|
|
2431
|
-
critical: {
|
|
2432
|
-
_hue: inputTokens?.base?.critical?._hue || hue,
|
|
2433
|
-
...spec.badge?.["*"],
|
|
2434
|
-
...spec.badge?.critical
|
|
2420
|
+
...spec.badge?.[tone2]
|
|
2435
2421
|
}
|
|
2436
|
-
}
|
|
2422
|
+
}), {})
|
|
2437
2423
|
};
|
|
2438
2424
|
}
|
|
2439
2425
|
function resolveButtonColorTokens(inputTokens) {
|
|
@@ -2459,62 +2445,20 @@ function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
|
2459
2445
|
return {
|
|
2460
2446
|
...spec,
|
|
2461
2447
|
_hue: hue,
|
|
2462
|
-
avatar: {
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
magenta: merge({
|
|
2473
|
-
_hue: "magenta"
|
|
2474
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2475
|
-
red: merge({
|
|
2476
|
-
_hue: "red"
|
|
2477
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2478
|
-
orange: merge({
|
|
2479
|
-
_hue: "orange"
|
|
2480
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2481
|
-
yellow: merge({
|
|
2482
|
-
_hue: "yellow"
|
|
2483
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2484
|
-
green: merge({
|
|
2485
|
-
_hue: "green"
|
|
2486
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2487
|
-
cyan: merge({
|
|
2488
|
-
_hue: "cyan"
|
|
2489
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2490
|
-
},
|
|
2491
|
-
badge: {
|
|
2492
|
-
default: {
|
|
2493
|
-
_hue: inputTokens?.base?.default?._hue,
|
|
2494
|
-
...spec.badge?.["*"],
|
|
2495
|
-
...spec.badge?.default
|
|
2496
|
-
},
|
|
2497
|
-
primary: {
|
|
2498
|
-
_hue: inputTokens?.base?.primary?._hue,
|
|
2448
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2449
|
+
...acc,
|
|
2450
|
+
[hue2]: merge({
|
|
2451
|
+
_hue: hue2
|
|
2452
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2453
|
+
}), {}),
|
|
2454
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2455
|
+
...acc,
|
|
2456
|
+
[tone2]: {
|
|
2457
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2499
2458
|
...spec.badge?.["*"],
|
|
2500
|
-
...spec.badge?.
|
|
2501
|
-
},
|
|
2502
|
-
positive: {
|
|
2503
|
-
_hue: inputTokens?.base?.positive?._hue,
|
|
2504
|
-
...spec.badge?.["*"],
|
|
2505
|
-
...spec.badge?.positive
|
|
2506
|
-
},
|
|
2507
|
-
caution: {
|
|
2508
|
-
_hue: inputTokens?.base?.caution?._hue,
|
|
2509
|
-
...spec.badge?.["*"],
|
|
2510
|
-
...spec.badge?.caution
|
|
2511
|
-
},
|
|
2512
|
-
critical: {
|
|
2513
|
-
_hue: inputTokens?.base?.critical?._hue,
|
|
2514
|
-
...spec.badge?.["*"],
|
|
2515
|
-
...spec.badge?.critical
|
|
2459
|
+
...spec.badge?.[tone2]
|
|
2516
2460
|
}
|
|
2517
|
-
}
|
|
2461
|
+
}), {})
|
|
2518
2462
|
};
|
|
2519
2463
|
}
|
|
2520
2464
|
function resolveInputColorTokens(inputTokens) {
|
|
@@ -2555,62 +2499,20 @@ function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
|
2555
2499
|
return {
|
|
2556
2500
|
...spec,
|
|
2557
2501
|
_hue: hue,
|
|
2558
|
-
avatar: {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
magenta: merge({
|
|
2569
|
-
_hue: "magenta"
|
|
2570
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2571
|
-
red: merge({
|
|
2572
|
-
_hue: "red"
|
|
2573
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2574
|
-
orange: merge({
|
|
2575
|
-
_hue: "orange"
|
|
2576
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2577
|
-
yellow: merge({
|
|
2578
|
-
_hue: "yellow"
|
|
2579
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2580
|
-
green: merge({
|
|
2581
|
-
_hue: "green"
|
|
2582
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2583
|
-
cyan: merge({
|
|
2584
|
-
_hue: "cyan"
|
|
2585
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2586
|
-
},
|
|
2587
|
-
badge: {
|
|
2588
|
-
default: {
|
|
2589
|
-
_hue: inputTokens?.base?.default?._hue,
|
|
2590
|
-
...spec.badge?.["*"],
|
|
2591
|
-
...spec.badge?.default
|
|
2592
|
-
},
|
|
2593
|
-
primary: {
|
|
2594
|
-
_hue: inputTokens?.base?.primary?._hue,
|
|
2595
|
-
...spec.badge?.["*"],
|
|
2596
|
-
...spec.badge?.primary
|
|
2597
|
-
},
|
|
2598
|
-
positive: {
|
|
2599
|
-
_hue: inputTokens?.base?.positive?._hue,
|
|
2600
|
-
...spec.badge?.["*"],
|
|
2601
|
-
...spec.badge?.positive
|
|
2602
|
-
},
|
|
2603
|
-
caution: {
|
|
2604
|
-
_hue: inputTokens?.base?.caution?._hue,
|
|
2605
|
-
...spec.badge?.["*"],
|
|
2606
|
-
...spec.badge?.caution
|
|
2607
|
-
},
|
|
2608
|
-
critical: {
|
|
2609
|
-
_hue: inputTokens?.base?.critical?._hue,
|
|
2502
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2503
|
+
...acc,
|
|
2504
|
+
[hue2]: merge({
|
|
2505
|
+
_hue: hue2
|
|
2506
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2507
|
+
}), {}),
|
|
2508
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2509
|
+
...acc,
|
|
2510
|
+
[tone2]: {
|
|
2511
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2610
2512
|
...spec.badge?.["*"],
|
|
2611
|
-
...spec.badge?.
|
|
2513
|
+
...spec.badge?.[tone2]
|
|
2612
2514
|
}
|
|
2613
|
-
}
|
|
2515
|
+
}), {})
|
|
2614
2516
|
};
|
|
2615
2517
|
}
|
|
2616
2518
|
function buildColorTheme(config) {
|
|
@@ -2630,33 +2532,13 @@ function buildColorTheme(config) {
|
|
|
2630
2532
|
function buildColorScheme(options, config) {
|
|
2631
2533
|
const {
|
|
2632
2534
|
scheme
|
|
2633
|
-
} = options;
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
scheme,
|
|
2637
|
-
tone: "transparent"
|
|
2638
|
-
}, config),
|
|
2639
|
-
default: buildCardColorTheme({
|
|
2640
|
-
scheme,
|
|
2641
|
-
tone: "default"
|
|
2642
|
-
}, config),
|
|
2643
|
-
primary: buildCardColorTheme({
|
|
2644
|
-
scheme,
|
|
2645
|
-
tone: "primary"
|
|
2646
|
-
}, config),
|
|
2647
|
-
positive: buildCardColorTheme({
|
|
2648
|
-
scheme,
|
|
2649
|
-
tone: "positive"
|
|
2650
|
-
}, config),
|
|
2651
|
-
caution: buildCardColorTheme({
|
|
2652
|
-
scheme,
|
|
2653
|
-
tone: "caution"
|
|
2654
|
-
}, config),
|
|
2655
|
-
critical: buildCardColorTheme({
|
|
2535
|
+
} = options, colorScheme = {};
|
|
2536
|
+
for (const tone of THEME_COLOR_CARD_TONES)
|
|
2537
|
+
colorScheme[tone] = buildCardColorTheme({
|
|
2656
2538
|
scheme,
|
|
2657
|
-
tone
|
|
2658
|
-
}, config)
|
|
2659
|
-
|
|
2539
|
+
tone
|
|
2540
|
+
}, config);
|
|
2541
|
+
return colorScheme;
|
|
2660
2542
|
}
|
|
2661
2543
|
function buildCardColorTheme(options, config) {
|
|
2662
2544
|
const {
|
|
@@ -2682,7 +2564,8 @@ function buildCardColorTheme(options, config) {
|
|
|
2682
2564
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2683
2565
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2684
2566
|
button: buildButtonColorTheme({
|
|
2685
|
-
scheme
|
|
2567
|
+
scheme,
|
|
2568
|
+
tone
|
|
2686
2569
|
}, config),
|
|
2687
2570
|
code: {
|
|
2688
2571
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
@@ -2708,7 +2591,8 @@ function buildCardColorTheme(options, config) {
|
|
|
2708
2591
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2709
2592
|
},
|
|
2710
2593
|
selectable: buildSelectableColorTheme({
|
|
2711
|
-
scheme
|
|
2594
|
+
scheme,
|
|
2595
|
+
tone
|
|
2712
2596
|
}, config),
|
|
2713
2597
|
shadow: buildShadowColorTheme({
|
|
2714
2598
|
scheme,
|
|
@@ -2798,29 +2682,13 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2798
2682
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2799
2683
|
const {
|
|
2800
2684
|
scheme
|
|
2801
|
-
} = options;
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
scheme,
|
|
2805
|
-
tone: "default"
|
|
2806
|
-
}, config),
|
|
2807
|
-
primary: _buildBadgeColorTheme(tokens, {
|
|
2808
|
-
scheme,
|
|
2809
|
-
tone: "primary"
|
|
2810
|
-
}, config),
|
|
2811
|
-
positive: _buildBadgeColorTheme(tokens, {
|
|
2812
|
-
scheme,
|
|
2813
|
-
tone: "positive"
|
|
2814
|
-
}, config),
|
|
2815
|
-
caution: _buildBadgeColorTheme(tokens, {
|
|
2816
|
-
scheme,
|
|
2817
|
-
tone: "caution"
|
|
2818
|
-
}, config),
|
|
2819
|
-
critical: _buildBadgeColorTheme(tokens, {
|
|
2685
|
+
} = options, colorBadge = {};
|
|
2686
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2687
|
+
colorBadge[tone] = _buildBadgeColorTheme(tokens, {
|
|
2820
2688
|
scheme,
|
|
2821
|
-
tone
|
|
2822
|
-
}, config)
|
|
2823
|
-
|
|
2689
|
+
tone
|
|
2690
|
+
}, config);
|
|
2691
|
+
return colorBadge;
|
|
2824
2692
|
}
|
|
2825
2693
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2826
2694
|
const {
|
|
@@ -2839,10 +2707,12 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2839
2707
|
}
|
|
2840
2708
|
function buildButtonColorTheme(options, config) {
|
|
2841
2709
|
const {
|
|
2842
|
-
scheme
|
|
2710
|
+
scheme,
|
|
2711
|
+
tone: cardTone
|
|
2843
2712
|
} = options, modes = {};
|
|
2844
2713
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2845
2714
|
modes[mode] = buildButtonTonesColorTheme({
|
|
2715
|
+
cardTone,
|
|
2846
2716
|
scheme,
|
|
2847
2717
|
mode
|
|
2848
2718
|
}, config);
|
|
@@ -2850,11 +2720,13 @@ function buildButtonColorTheme(options, config) {
|
|
|
2850
2720
|
}
|
|
2851
2721
|
function buildButtonTonesColorTheme(options, config) {
|
|
2852
2722
|
const {
|
|
2723
|
+
cardTone,
|
|
2853
2724
|
mode,
|
|
2854
2725
|
scheme
|
|
2855
2726
|
} = options, tones2 = {};
|
|
2856
2727
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2857
2728
|
tones2[tone] = buildButtonStatesColorTheme({
|
|
2729
|
+
cardTone,
|
|
2858
2730
|
mode,
|
|
2859
2731
|
scheme,
|
|
2860
2732
|
tone
|
|
@@ -2863,12 +2735,14 @@ function buildButtonTonesColorTheme(options, config) {
|
|
|
2863
2735
|
}
|
|
2864
2736
|
function buildButtonStatesColorTheme(options, config) {
|
|
2865
2737
|
const {
|
|
2738
|
+
cardTone,
|
|
2866
2739
|
mode,
|
|
2867
2740
|
scheme,
|
|
2868
2741
|
tone
|
|
2869
2742
|
} = options, states = {};
|
|
2870
2743
|
for (const state of THEME_COLOR_STATES)
|
|
2871
2744
|
states[state] = buildButtonStateColorTheme({
|
|
2745
|
+
cardTone,
|
|
2872
2746
|
mode,
|
|
2873
2747
|
tone,
|
|
2874
2748
|
scheme,
|
|
@@ -2878,11 +2752,12 @@ function buildButtonStatesColorTheme(options, config) {
|
|
|
2878
2752
|
}
|
|
2879
2753
|
function buildButtonStateColorTheme(options, config) {
|
|
2880
2754
|
const {
|
|
2755
|
+
cardTone,
|
|
2881
2756
|
mode,
|
|
2882
2757
|
tone,
|
|
2883
2758
|
scheme,
|
|
2884
2759
|
state
|
|
2885
|
-
} = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2760
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2886
2761
|
hue,
|
|
2887
2762
|
scheme
|
|
2888
2763
|
};
|
|
@@ -2952,35 +2827,35 @@ function buildInputStatesColorTheme(options, config) {
|
|
|
2952
2827
|
mode,
|
|
2953
2828
|
scheme,
|
|
2954
2829
|
state: "enabled",
|
|
2955
|
-
tone
|
|
2830
|
+
cardTone: tone
|
|
2956
2831
|
}, config),
|
|
2957
2832
|
hovered: buildInputStateColorTheme({
|
|
2958
2833
|
mode,
|
|
2959
2834
|
scheme,
|
|
2960
2835
|
state: "hovered",
|
|
2961
|
-
tone
|
|
2836
|
+
cardTone: tone
|
|
2962
2837
|
}, config),
|
|
2963
2838
|
readOnly: buildInputStateColorTheme({
|
|
2964
2839
|
mode,
|
|
2965
2840
|
scheme,
|
|
2966
2841
|
state: "readOnly",
|
|
2967
|
-
tone
|
|
2842
|
+
cardTone: tone
|
|
2968
2843
|
}, config),
|
|
2969
2844
|
disabled: buildInputStateColorTheme({
|
|
2970
2845
|
mode,
|
|
2971
2846
|
scheme,
|
|
2972
2847
|
state: "disabled",
|
|
2973
|
-
tone
|
|
2848
|
+
cardTone: tone
|
|
2974
2849
|
}, config)
|
|
2975
2850
|
};
|
|
2976
2851
|
}
|
|
2977
2852
|
function buildInputStateColorTheme(options, config) {
|
|
2978
2853
|
const {
|
|
2854
|
+
cardTone,
|
|
2979
2855
|
mode,
|
|
2980
|
-
tone,
|
|
2981
2856
|
scheme,
|
|
2982
2857
|
state
|
|
2983
|
-
} = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue ||
|
|
2858
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2984
2859
|
hue,
|
|
2985
2860
|
scheme
|
|
2986
2861
|
};
|
|
@@ -2997,10 +2872,12 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2997
2872
|
}
|
|
2998
2873
|
function buildSelectableColorTheme(options, config) {
|
|
2999
2874
|
const {
|
|
3000
|
-
scheme
|
|
2875
|
+
scheme,
|
|
2876
|
+
tone: cardTone
|
|
3001
2877
|
} = options, tones2 = {};
|
|
3002
2878
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3003
2879
|
tones2[tone] = buildSelectableStatesColorTheme({
|
|
2880
|
+
cardTone,
|
|
3004
2881
|
scheme,
|
|
3005
2882
|
tone
|
|
3006
2883
|
}, config);
|
|
@@ -3008,11 +2885,13 @@ function buildSelectableColorTheme(options, config) {
|
|
|
3008
2885
|
}
|
|
3009
2886
|
function buildSelectableStatesColorTheme(options, config) {
|
|
3010
2887
|
const {
|
|
2888
|
+
cardTone,
|
|
3011
2889
|
scheme,
|
|
3012
2890
|
tone
|
|
3013
2891
|
} = options, states = {};
|
|
3014
2892
|
for (const state of THEME_COLOR_STATES)
|
|
3015
2893
|
states[state] = buildSelectableStateColorTheme({
|
|
2894
|
+
cardTone,
|
|
3016
2895
|
tone,
|
|
3017
2896
|
scheme,
|
|
3018
2897
|
state
|
|
@@ -3021,10 +2900,11 @@ function buildSelectableStatesColorTheme(options, config) {
|
|
|
3021
2900
|
}
|
|
3022
2901
|
function buildSelectableStateColorTheme(options, config) {
|
|
3023
2902
|
const {
|
|
2903
|
+
cardTone,
|
|
3024
2904
|
scheme,
|
|
3025
2905
|
state,
|
|
3026
2906
|
tone
|
|
3027
|
-
} = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2907
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3028
2908
|
hue,
|
|
3029
2909
|
scheme
|
|
3030
2910
|
};
|
|
@@ -3468,17 +3348,10 @@ function renderThemeColorKBD(value, options) {
|
|
|
3468
3348
|
};
|
|
3469
3349
|
}
|
|
3470
3350
|
function renderThemeColorAvatar(value, options) {
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
magenta: renderThemeColorAvatarColor(value.magenta, options),
|
|
3476
|
-
red: renderThemeColorAvatarColor(value.red, options),
|
|
3477
|
-
orange: renderThemeColorAvatarColor(value.orange, options),
|
|
3478
|
-
yellow: renderThemeColorAvatarColor(value.yellow, options),
|
|
3479
|
-
green: renderThemeColorAvatarColor(value.green, options),
|
|
3480
|
-
cyan: renderThemeColorAvatarColor(value.cyan, options)
|
|
3481
|
-
};
|
|
3351
|
+
const colorAvatar = {};
|
|
3352
|
+
for (const hue of COLOR_HUES)
|
|
3353
|
+
colorAvatar[hue] = renderThemeColorAvatarColor(value[hue], options);
|
|
3354
|
+
return colorAvatar;
|
|
3482
3355
|
}
|
|
3483
3356
|
function renderThemeColorAvatarColor(value, options) {
|
|
3484
3357
|
const {
|
|
@@ -3501,13 +3374,10 @@ function renderThemeColorAvatarColor(value, options) {
|
|
|
3501
3374
|
};
|
|
3502
3375
|
}
|
|
3503
3376
|
function renderThemeColorBadge(value, options) {
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
caution: renderThemeColorBadgeColor(value.caution, options),
|
|
3509
|
-
critical: renderThemeColorBadgeColor(value.critical, options)
|
|
3510
|
-
};
|
|
3377
|
+
const colorBadge = {};
|
|
3378
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3379
|
+
colorBadge[tone] = renderThemeColorBadgeColor(value[tone], options);
|
|
3380
|
+
return colorBadge;
|
|
3511
3381
|
}
|
|
3512
3382
|
function renderThemeColorBadgeColor(value, options) {
|
|
3513
3383
|
const {
|
|
@@ -3538,13 +3408,10 @@ function renderThemeColorButton(value, options) {
|
|
|
3538
3408
|
};
|
|
3539
3409
|
}
|
|
3540
3410
|
function renderThemeColorButtonTones(value, options) {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
caution: renderThemeColorButtonStates(value.caution, options),
|
|
3546
|
-
critical: renderThemeColorButtonStates(value.critical, options)
|
|
3547
|
-
};
|
|
3411
|
+
const colorButtonMode = {};
|
|
3412
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3413
|
+
colorButtonMode[tone] = renderThemeColorButtonStates(value[tone], options);
|
|
3414
|
+
return colorButtonMode;
|
|
3548
3415
|
}
|
|
3549
3416
|
function renderThemeColorButtonStates(value, options) {
|
|
3550
3417
|
return {
|
|
@@ -3650,13 +3517,10 @@ function renderInputStateColorTheme(value, options) {
|
|
|
3650
3517
|
};
|
|
3651
3518
|
}
|
|
3652
3519
|
function renderThemeColorSelectable(value, options) {
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
caution: renderThemeColorSelectableStates(value.caution, options),
|
|
3658
|
-
critical: renderThemeColorSelectableStates(value.critical, options)
|
|
3659
|
-
};
|
|
3520
|
+
const colorSelectable = {};
|
|
3521
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3522
|
+
colorSelectable[tone] = renderThemeColorSelectableStates(value[tone], options);
|
|
3523
|
+
return colorSelectable;
|
|
3660
3524
|
}
|
|
3661
3525
|
function renderThemeColorSelectableStates(value, options) {
|
|
3662
3526
|
return {
|