@pathscale/ui 1.1.25 → 1.1.27
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.
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
flex-shrink: 0;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
|
-
gap: 0.
|
|
7
|
+
gap: 0.25rem;
|
|
8
8
|
font-weight: 500;
|
|
9
9
|
|
|
10
10
|
min-height: 1.75rem;
|
|
11
11
|
min-width: 1.75rem;
|
|
12
|
-
|
|
12
|
+
padding-inline: 0.625rem;
|
|
13
|
+
border-radius: 9999px;
|
|
13
14
|
font-size: 0.75rem;
|
|
14
15
|
line-height: 1.34;
|
|
15
16
|
|
|
@@ -23,7 +24,6 @@
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.badge__label {
|
|
26
|
-
padding-inline: 0.125rem;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.badge-anchor {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
.badge--lg {
|
|
36
36
|
min-height: 2rem;
|
|
37
37
|
min-width: 2rem;
|
|
38
|
-
|
|
38
|
+
padding-inline: 0.75rem;
|
|
39
39
|
font-size: 0.875rem;
|
|
40
40
|
line-height: 1.43;
|
|
41
41
|
}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
.badge--sm {
|
|
48
48
|
min-height: 1rem;
|
|
49
49
|
min-width: 1rem;
|
|
50
|
-
|
|
50
|
+
padding-inline: 0.375rem;
|
|
51
51
|
font-size: 10px;
|
|
52
52
|
line-height: 1.34;
|
|
53
53
|
}
|
|
@@ -8,7 +8,7 @@ declare const BadgeAnchor: (props: BadgeAnchorProps) => JSX.Element;
|
|
|
8
8
|
type BadgeColor = "default" | "accent" | "success" | "warning" | "danger";
|
|
9
9
|
type BadgeVariant = "primary" | "secondary" | "soft";
|
|
10
10
|
type BadgeSize = "sm" | "md" | "lg";
|
|
11
|
-
type BadgePlacement = "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
11
|
+
type BadgePlacement = "none" | "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
12
12
|
interface BadgeRootProps extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, "color"> {
|
|
13
13
|
class?: string;
|
|
14
14
|
children?: JSX.Element;
|
|
@@ -39,6 +39,7 @@ const BADGE_VARIANT_CLASS = {
|
|
|
39
39
|
soft: "badge--soft"
|
|
40
40
|
};
|
|
41
41
|
const BADGE_PLACEMENT_CLASS = {
|
|
42
|
+
none: "",
|
|
42
43
|
"top-right": "badge--top-right",
|
|
43
44
|
"top-left": "badge--top-left",
|
|
44
45
|
"bottom-right": "badge--bottom-right",
|
|
@@ -57,7 +58,7 @@ const BadgeRoot = (props)=>{
|
|
|
57
58
|
const size = local.size ?? "md";
|
|
58
59
|
const color = local.color ?? "default";
|
|
59
60
|
const variant = local.variant ?? "primary";
|
|
60
|
-
const placement = local.placement ?? "
|
|
61
|
+
const placement = local.placement ?? "none";
|
|
61
62
|
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)((0, __WEBPACK_EXTERNAL_MODULE_clsx__.clsx)("badge", BADGE_SIZE_CLASS[size], BADGE_COLOR_CLASS[color], BADGE_VARIANT_CLASS[variant], BADGE_PLACEMENT_CLASS[placement], local.class));
|
|
62
63
|
};
|
|
63
64
|
const badgeChildren = ()=>{
|
|
@@ -26,6 +26,69 @@ const CONTENT_VARS = [
|
|
|
26
26
|
"--nf-on-accent",
|
|
27
27
|
"--color-nf-on-accent"
|
|
28
28
|
];
|
|
29
|
+
const BACKGROUND_VARS = {
|
|
30
|
+
light: [
|
|
31
|
+
{
|
|
32
|
+
name: "--color-base-100",
|
|
33
|
+
anchor: "oklch(98% 0.001 106.423)",
|
|
34
|
+
mix: 4
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "--color-base-200",
|
|
38
|
+
anchor: "oklch(97% 0.001 106.424)",
|
|
39
|
+
mix: 5
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "--color-base-300",
|
|
43
|
+
anchor: "oklch(92% 0.003 48.717)",
|
|
44
|
+
mix: 7
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "--gradient-start",
|
|
48
|
+
anchor: "#ffffff",
|
|
49
|
+
mix: 18
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "--gradient-end",
|
|
53
|
+
anchor: "#f5f5f5",
|
|
54
|
+
mix: 10
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
dark: [
|
|
58
|
+
{
|
|
59
|
+
name: "--color-base-100",
|
|
60
|
+
anchor: "oklch(13% 0.028 261.692)",
|
|
61
|
+
mix: 8
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "--color-base-200",
|
|
65
|
+
anchor: "oklch(21% 0.034 264.665)",
|
|
66
|
+
mix: 9
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "--color-base-300",
|
|
70
|
+
anchor: "oklch(27% 0.033 256.848)",
|
|
71
|
+
mix: 11
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "--gradient-start",
|
|
75
|
+
anchor: "#0f1420",
|
|
76
|
+
mix: 20
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "--gradient-end",
|
|
80
|
+
anchor: "#060910",
|
|
81
|
+
mix: 12
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
function getResolvedTheme() {
|
|
86
|
+
if ("undefined" == typeof document) return "light";
|
|
87
|
+
const dataTheme = document.documentElement.getAttribute("data-theme");
|
|
88
|
+
if ("dark" === dataTheme) return "dark";
|
|
89
|
+
if ("light" === dataTheme) return "light";
|
|
90
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
91
|
+
}
|
|
29
92
|
function parseHex(hex) {
|
|
30
93
|
let h = hex.trim();
|
|
31
94
|
if (h.startsWith("#")) h = h.slice(1);
|
|
@@ -62,14 +125,17 @@ function applyThemeColor(hex) {
|
|
|
62
125
|
if (!rgb) return;
|
|
63
126
|
const root = document.documentElement;
|
|
64
127
|
const content = pickContentColor(rgb.r, rgb.g, rgb.b);
|
|
128
|
+
const resolvedTheme = getResolvedTheme();
|
|
65
129
|
for (const varName of PRIMARY_VARS)root.style.setProperty(varName, hex);
|
|
66
130
|
for (const varName of CONTENT_VARS)root.style.setProperty(varName, content);
|
|
131
|
+
for (const { name, anchor, mix } of BACKGROUND_VARS[resolvedTheme])root.style.setProperty(name, `color-mix(in oklab, ${hex} ${mix}%, ${anchor})`);
|
|
67
132
|
}
|
|
68
133
|
function resetHueShift() {
|
|
69
134
|
if (!checkCspAllowsInlineStyles()) return;
|
|
70
135
|
const root = document.documentElement;
|
|
71
136
|
for (const varName of PRIMARY_VARS)root.style.removeProperty(varName);
|
|
72
137
|
for (const varName of CONTENT_VARS)root.style.removeProperty(varName);
|
|
138
|
+
for (const { name } of BACKGROUND_VARS.light)root.style.removeProperty(name);
|
|
73
139
|
}
|
|
74
140
|
function createHueShiftStore(storagePrefix) {
|
|
75
141
|
const STORAGE_KEY = `${storagePrefix}_theme_color`;
|