@vygruppen/spor-react 12.4.4 → 12.4.6
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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/index.d.mts +33 -29
- package/dist/index.d.ts +33 -29
- package/dist/index.js +197 -458
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +197 -458
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/linjetag/InfoTag.tsx +0 -1
- package/src/linjetag/LineIcon.tsx +1 -1
- package/src/linjetag/types.ts +1 -1
- package/src/theme/recipes/close-button.ts +2 -4
- package/src/theme/recipes/link.ts +3 -5
- package/src/theme/slot-recipes/accordion.ts +23 -19
- package/src/theme/slot-recipes/checkbox.ts +9 -15
- package/src/theme/slot-recipes/info-tag.ts +11 -7
- package/src/theme/slot-recipes/native-select.ts +1 -2
- package/src/theme/slot-recipes/pagination.ts +3 -6
- package/src/theme/slot-recipes/stepper.ts +4 -7
- package/src/theme/utils/accent-utils.ts +0 -47
- package/src/theme/utils/bg-utils.ts +0 -20
- package/src/theme/utils/brand-utils.ts +0 -29
- package/src/theme/utils/core-utils.ts +0 -101
- package/src/theme/utils/floating-utils.ts +0 -69
- package/src/theme/utils/ghost-utils.ts +0 -49
- package/src/theme/utils/input-utils.ts +0 -117
- package/src/theme/utils/outline-utils.ts +0 -22
- package/src/theme/utils/sr-utils.ts +0 -13
- package/src/theme/utils/surface-utils.ts +0 -25
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
|
-
"version": "12.4.
|
3
|
+
"version": "12.4.6",
|
4
4
|
"exports": {
|
5
5
|
".": {
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"vitest": "^0.26.3",
|
67
67
|
"vitest-axe": "^0.1.0",
|
68
68
|
"vitest-canvas-mock": "^0.2.2",
|
69
|
-
"@vygruppen/eslint-config": "1.0
|
69
|
+
"@vygruppen/eslint-config": "1.1.0",
|
70
70
|
"@vygruppen/tsconfig": "0.1.0"
|
71
71
|
},
|
72
72
|
"peerDependencies": {
|
package/src/linjetag/InfoTag.tsx
CHANGED
@@ -24,7 +24,7 @@ type VariantProps = DefaultVariantProps | CustomVariantProps;
|
|
24
24
|
export type LineIconProps = Exclude<BoxProps, "variant"> &
|
25
25
|
VariantProps &
|
26
26
|
PropsWithChildren<LineIconVariantProps> & {
|
27
|
-
size
|
27
|
+
size?: TagProps["size"];
|
28
28
|
foregroundColor?: string;
|
29
29
|
backgroundColor?: string;
|
30
30
|
disabled?: boolean;
|
package/src/linjetag/types.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import { defineRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
|
-
import { ghostBackground } from "../utils/ghost-utils";
|
4
|
-
|
5
3
|
export const closeButtonRecipe = defineRecipe({
|
6
4
|
base: {
|
7
5
|
transitionProperty: "common",
|
@@ -11,12 +9,12 @@ export const closeButtonRecipe = defineRecipe({
|
|
11
9
|
color: "darkGrey",
|
12
10
|
fontWeight: "normal",
|
13
11
|
_hover: {
|
14
|
-
|
12
|
+
background: "ghost.surface.hover",
|
15
13
|
_disabled: {
|
16
14
|
color: "dimGrey",
|
17
15
|
},
|
18
16
|
_active: {
|
19
|
-
|
17
|
+
background: "ghost.surface.active",
|
20
18
|
},
|
21
19
|
},
|
22
20
|
},
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { defineRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
|
-
import { coreText } from "../utils/core-utils";
|
4
|
-
|
5
3
|
export const linkRecipe = defineRecipe({
|
6
4
|
base: {
|
7
5
|
transitionProperty: "common",
|
@@ -42,7 +40,7 @@ export const linkRecipe = defineRecipe({
|
|
42
40
|
variants: {
|
43
41
|
variant: {
|
44
42
|
primary: {
|
45
|
-
|
43
|
+
color: "core.text",
|
46
44
|
_hover: {
|
47
45
|
color: "text.default",
|
48
46
|
_active: {
|
@@ -51,10 +49,10 @@ export const linkRecipe = defineRecipe({
|
|
51
49
|
},
|
52
50
|
},
|
53
51
|
secondary: {
|
54
|
-
|
52
|
+
color: "text.hightlight",
|
55
53
|
padding: "2px",
|
56
54
|
_hover: {
|
57
|
-
|
55
|
+
color: "text.hightlight",
|
58
56
|
_active: {
|
59
57
|
color: "text.disabled",
|
60
58
|
},
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
|
+
import tokens from "@vygruppen/spor-design-tokens";
|
2
3
|
|
3
|
-
import { coreBorder, coreText } from "../utils/core-utils";
|
4
|
-
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
5
|
-
import { ghostBackground } from "../utils/ghost-utils";
|
6
4
|
import { accordionAnatomy } from "./anatomy";
|
7
5
|
|
8
6
|
export const accordionSlotRecipe = defineSlotRecipe({
|
@@ -20,7 +18,7 @@ export const accordionSlotRecipe = defineSlotRecipe({
|
|
20
18
|
borderRadius: "sm",
|
21
19
|
display: "flex",
|
22
20
|
justifyContent: "space-between",
|
23
|
-
|
21
|
+
color: "core.text",
|
24
22
|
textAlign: "left",
|
25
23
|
width: "full",
|
26
24
|
alignItems: "center",
|
@@ -72,58 +70,64 @@ export const accordionSlotRecipe = defineSlotRecipe({
|
|
72
70
|
variants: {
|
73
71
|
variant: {
|
74
72
|
ghost: {
|
75
|
-
|
73
|
+
item: {
|
76
74
|
outline: "none",
|
77
75
|
},
|
78
76
|
itemTrigger: {
|
79
77
|
"&:hover": {
|
80
|
-
|
78
|
+
background: "ghost.surface.hover",
|
81
79
|
},
|
82
80
|
"&:active": {
|
83
|
-
|
81
|
+
backgroundColor: "ghost.surface.active",
|
84
82
|
},
|
85
83
|
},
|
86
84
|
},
|
87
85
|
core: {
|
88
86
|
item: {
|
89
|
-
|
87
|
+
outline: "solid",
|
88
|
+
outlineWidth: tokens.size.stroke.sm,
|
89
|
+
outlineColor: "core.outline",
|
90
90
|
},
|
91
91
|
itemTrigger: {
|
92
92
|
_expanded: {
|
93
93
|
borderBottomRadius: "none",
|
94
94
|
},
|
95
95
|
"&:hover": {
|
96
|
-
|
96
|
+
outlineWidth: tokens.size.stroke.md,
|
97
|
+
outlineColor: "core.outline",
|
98
|
+
outline: "2px solid",
|
99
|
+
|
97
100
|
outlineOffset: 0,
|
98
101
|
},
|
99
102
|
"&:active": {
|
100
103
|
backgroundColor: "core.surface.active",
|
101
|
-
|
104
|
+
outlineWidth: tokens.size.stroke.sm,
|
105
|
+
outline: "none",
|
102
106
|
},
|
103
107
|
},
|
104
108
|
},
|
105
109
|
floating: {
|
106
110
|
item: {
|
107
|
-
|
108
|
-
|
111
|
+
outline: "1px solid",
|
112
|
+
outlineWidth: tokens.size.stroke.sm,
|
109
113
|
boxShadow: "sm",
|
114
|
+
outlineColor: "floating.outline",
|
110
115
|
},
|
111
116
|
itemTrigger: {
|
112
117
|
_expanded: {
|
113
118
|
borderBottomRadius: "none",
|
114
119
|
},
|
115
120
|
"&:hover": {
|
121
|
+
outlineWidth: tokens.size.stroke.md,
|
122
|
+
outline: "1px solid",
|
123
|
+
outlineColor: "floating.outline.hover",
|
124
|
+
|
116
125
|
outlineOffset: 1,
|
117
|
-
...floatingBackground("hover"),
|
118
|
-
...floatingBorder("hover"),
|
119
|
-
"&:active": {
|
120
|
-
backgroundColor: "floating.surface.active",
|
121
|
-
...floatingBorder("default"),
|
122
|
-
},
|
123
126
|
},
|
124
127
|
"&:active": {
|
125
128
|
backgroundColor: "floating.surface.active",
|
126
|
-
|
129
|
+
outlineWidth: tokens.size.stroke.sm,
|
130
|
+
outline: "none",
|
127
131
|
},
|
128
132
|
},
|
129
133
|
},
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
import tokens from "@vygruppen/spor-design-tokens";
|
3
3
|
|
4
|
-
import { brandBackground, brandText } from "../utils/brand-utils";
|
5
|
-
import { coreBackground, coreText } from "../utils/core-utils";
|
6
4
|
import { checkboxAnatomy } from "./anatomy";
|
7
5
|
|
8
6
|
export const checkboxSlotRecipe = defineSlotRecipe({
|
@@ -14,13 +12,11 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
14
12
|
gap: 1.5,
|
15
13
|
_hover: {
|
16
14
|
"& > input:enabled:not([aria-invalid]) + .spor-checkbox__control": {
|
17
|
-
|
18
|
-
borderColor: brandBackground("hover").backgroundColor,
|
15
|
+
borderColor: "core.outline.hover",
|
19
16
|
},
|
20
17
|
"& > input:enabled:checked:not([aria-invalid]) + .spor-checkbox__control":
|
21
18
|
{
|
22
|
-
|
23
|
-
borderColor: brandBackground("hover").backgroundColor,
|
19
|
+
background: "brand.surface.hover",
|
24
20
|
},
|
25
21
|
},
|
26
22
|
},
|
@@ -44,19 +40,18 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
44
40
|
border: "2px solid",
|
45
41
|
borderColor: "core.outline",
|
46
42
|
borderRadius: "xs",
|
47
|
-
...coreBackground("default"),
|
48
43
|
|
49
44
|
_checked: {
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
color: "brand.icon",
|
46
|
+
borderColor: "brand.surface",
|
47
|
+
background: "brand.surface",
|
53
48
|
_focus: {
|
54
49
|
borderColor: "brand.surface.active",
|
55
50
|
},
|
56
51
|
|
57
52
|
_disabled: {
|
58
|
-
|
59
|
-
|
53
|
+
background: "surface.disabled",
|
54
|
+
color: "text.disabled",
|
60
55
|
borderColor: "currentColor",
|
61
56
|
},
|
62
57
|
|
@@ -66,11 +61,10 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
66
61
|
},
|
67
62
|
},
|
68
63
|
_disabled: {
|
69
|
-
|
70
|
-
borderColor:
|
64
|
+
// borderColor: coreText("disabled").color,
|
65
|
+
borderColor: "text.disabled",
|
71
66
|
},
|
72
67
|
_invalid: {
|
73
|
-
...coreBackground("default"),
|
74
68
|
borderColor: "outline.error",
|
75
69
|
},
|
76
70
|
_focus: {
|
@@ -26,13 +26,17 @@ export const infoTagSlotRecipe = defineSlotRecipe({
|
|
26
26
|
},
|
27
27
|
variants: {
|
28
28
|
variant: {
|
29
|
-
walk: {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
},
|
29
|
+
walk: {},
|
30
|
+
ferry: {},
|
31
|
+
subway: {},
|
32
|
+
tram: {},
|
33
|
+
"local-train": {},
|
34
|
+
"region-train": {},
|
35
|
+
"region-express-train": {},
|
36
|
+
"long-distance-train": {},
|
37
|
+
"airport-express-train": {},
|
38
|
+
"vy-bus": {},
|
39
|
+
"local-bus": {},
|
36
40
|
},
|
37
41
|
size: {
|
38
42
|
...travelTagSlotRecipe.variants?.size,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
3
|
import { inputRecipe } from "../recipes/input";
|
4
|
-
import { coreText } from "../utils/core-utils";
|
5
4
|
import { NativeSelectAnatomy } from "./anatomy";
|
6
5
|
|
7
6
|
export const nativeSelectSlotRecipe = defineSlotRecipe({
|
@@ -34,7 +33,7 @@ export const nativeSelectSlotRecipe = defineSlotRecipe({
|
|
34
33
|
color: "currentColor",
|
35
34
|
fontSize: "sm",
|
36
35
|
_disabled: {
|
37
|
-
|
36
|
+
color: "text.disabled",
|
38
37
|
},
|
39
38
|
},
|
40
39
|
},
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
|
-
import { coreBackground, coreText } from "../utils/core-utils";
|
4
|
-
import { ghostBackground } from "../utils/ghost-utils";
|
5
3
|
import { paginationAnatomy } from "./anatomy";
|
6
4
|
|
7
5
|
export const paginationSlotRecipe = defineSlotRecipe({
|
@@ -16,13 +14,12 @@ export const paginationSlotRecipe = defineSlotRecipe({
|
|
16
14
|
width: "5",
|
17
15
|
fontSize: "xs",
|
18
16
|
borderRadius: "xl",
|
19
|
-
|
17
|
+
color: "core.text",
|
20
18
|
cursor: "pointer",
|
21
|
-
...coreBackground("default"),
|
22
19
|
_hover: {
|
23
|
-
|
20
|
+
background: "ghost.surface.hover",
|
24
21
|
_active: {
|
25
|
-
|
22
|
+
background: "ghost.surface.active",
|
26
23
|
},
|
27
24
|
},
|
28
25
|
_selected: {
|
@@ -1,8 +1,5 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
|
-
import { accentBackground, accentText } from "../utils/accent-utils";
|
4
|
-
import { brandBackground } from "../utils/brand-utils";
|
5
|
-
import { coreText } from "../utils/core-utils";
|
6
3
|
import { stepperAnatomy } from "./anatomy";
|
7
4
|
|
8
5
|
export const stepperSlotRecipe = defineSlotRecipe({
|
@@ -70,13 +67,13 @@ export const stepperSlotRecipe = defineSlotRecipe({
|
|
70
67
|
_dark: "whiteAlpha.900",
|
71
68
|
},
|
72
69
|
_disabled: {
|
73
|
-
color:
|
70
|
+
color: "core.text",
|
74
71
|
},
|
75
72
|
_currentStep: {
|
76
|
-
color:
|
73
|
+
color: "accent.text",
|
77
74
|
},
|
78
75
|
_hover: {
|
79
|
-
backgroundColor:
|
76
|
+
backgroundColor: "accent.surface.hover",
|
80
77
|
_disabled: {
|
81
78
|
backgroundColor: "transparent",
|
82
79
|
},
|
@@ -84,7 +81,7 @@ export const stepperSlotRecipe = defineSlotRecipe({
|
|
84
81
|
},
|
85
82
|
backButton: {
|
86
83
|
_hover: {
|
87
|
-
|
84
|
+
backgroundColor: "brand.surface.hover",
|
88
85
|
},
|
89
86
|
},
|
90
87
|
},
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { brandBackground } from "./brand-utils";
|
2
|
-
import { State, Subset } from "./types";
|
3
|
-
|
4
|
-
type AccentBackgroundState = Subset<
|
5
|
-
State,
|
6
|
-
"default" | "hover" | "active" | "selected"
|
7
|
-
>;
|
8
|
-
|
9
|
-
export function accentBackground(state: AccentBackgroundState) {
|
10
|
-
switch (state) {
|
11
|
-
case "selected": {
|
12
|
-
return brandBackground("default");
|
13
|
-
}
|
14
|
-
case "active": {
|
15
|
-
return {
|
16
|
-
backgroundColor: "accent.surface.active",
|
17
|
-
};
|
18
|
-
}
|
19
|
-
case "hover": {
|
20
|
-
return {
|
21
|
-
backgroundColor: "accent.surface.hover",
|
22
|
-
};
|
23
|
-
}
|
24
|
-
default: {
|
25
|
-
return {
|
26
|
-
backgroundColor: "accent.surface",
|
27
|
-
};
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
type AccentTextState = Subset<State, "default" | "selected">;
|
33
|
-
|
34
|
-
export function accentText(state: AccentTextState) {
|
35
|
-
switch (state) {
|
36
|
-
case "selected": {
|
37
|
-
return {
|
38
|
-
color: "brand.text",
|
39
|
-
};
|
40
|
-
}
|
41
|
-
default: {
|
42
|
-
return {
|
43
|
-
color: "accent.text",
|
44
|
-
};
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
type Bg = "default" | "secondary" | "tertiary";
|
2
|
-
export const bg = (bg: Bg) => {
|
3
|
-
switch (bg) {
|
4
|
-
case "default": {
|
5
|
-
return {
|
6
|
-
backgroundColor: "bg",
|
7
|
-
};
|
8
|
-
}
|
9
|
-
case "secondary": {
|
10
|
-
return {
|
11
|
-
backgroundColor: "bg.secondary",
|
12
|
-
};
|
13
|
-
}
|
14
|
-
case "tertiary": {
|
15
|
-
return {
|
16
|
-
backgroundColor: "bg.tertiary",
|
17
|
-
};
|
18
|
-
}
|
19
|
-
}
|
20
|
-
};
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { State, Subset } from "./types";
|
2
|
-
|
3
|
-
type BrandBackgroundState = Subset<State, "default" | "hover" | "active">;
|
4
|
-
|
5
|
-
export function brandBackground(state: BrandBackgroundState) {
|
6
|
-
switch (state) {
|
7
|
-
case "active": {
|
8
|
-
return {
|
9
|
-
backgroundColor: "brand.surface.active",
|
10
|
-
};
|
11
|
-
}
|
12
|
-
case "hover": {
|
13
|
-
return {
|
14
|
-
backgroundColor: "brand.surface.hover",
|
15
|
-
};
|
16
|
-
}
|
17
|
-
default: {
|
18
|
-
return {
|
19
|
-
backgroundColor: "brand.surface",
|
20
|
-
};
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
export function brandText() {
|
26
|
-
return {
|
27
|
-
color: "brand.text",
|
28
|
-
};
|
29
|
-
}
|
@@ -1,101 +0,0 @@
|
|
1
|
-
import { brandBackground } from "./brand-utils";
|
2
|
-
import { surface } from "./surface-utils";
|
3
|
-
import { State, Subset } from "./types";
|
4
|
-
|
5
|
-
type coreBackgroundState = Subset<
|
6
|
-
State,
|
7
|
-
"default" | "active" | "selected" | "hover" | "disabled"
|
8
|
-
>;
|
9
|
-
export function coreBackground(state: coreBackgroundState) {
|
10
|
-
switch (state) {
|
11
|
-
case "active": {
|
12
|
-
return brandBackground("active");
|
13
|
-
}
|
14
|
-
case "selected": {
|
15
|
-
return brandBackground("default");
|
16
|
-
}
|
17
|
-
|
18
|
-
case "disabled": {
|
19
|
-
return surface("disabled");
|
20
|
-
}
|
21
|
-
|
22
|
-
default: {
|
23
|
-
return { backgroundColor: "transparent" };
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
type BorderState = Subset<
|
29
|
-
State,
|
30
|
-
"hover" | "focus" | "active" | "disabled" | "selected" | "invalid" | "default"
|
31
|
-
>;
|
32
|
-
|
33
|
-
export function coreBorder(state: BorderState) {
|
34
|
-
switch (state) {
|
35
|
-
case "hover": {
|
36
|
-
return {
|
37
|
-
outline: "2px solid",
|
38
|
-
outlineColor: "core.outline",
|
39
|
-
};
|
40
|
-
}
|
41
|
-
|
42
|
-
case "disabled": {
|
43
|
-
return {
|
44
|
-
outline: "1px solid",
|
45
|
-
outlineColor: "outline.disabled",
|
46
|
-
};
|
47
|
-
}
|
48
|
-
case "active": {
|
49
|
-
return {
|
50
|
-
outline: "1px solid",
|
51
|
-
outlineColor: "core.outline",
|
52
|
-
};
|
53
|
-
}
|
54
|
-
case "invalid": {
|
55
|
-
return {
|
56
|
-
outline: "2px solid",
|
57
|
-
outlineColor: "outline.error",
|
58
|
-
};
|
59
|
-
}
|
60
|
-
default: {
|
61
|
-
return {
|
62
|
-
outline: "1px solid",
|
63
|
-
outlineColor: "core.outline",
|
64
|
-
};
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
type coreTextState = Subset<
|
70
|
-
State,
|
71
|
-
"default" | "selected" | "disabled" | "highlight" | "active"
|
72
|
-
>;
|
73
|
-
export function coreText(state: coreTextState) {
|
74
|
-
switch (state) {
|
75
|
-
case "selected": {
|
76
|
-
return {
|
77
|
-
color: "brand.text",
|
78
|
-
};
|
79
|
-
}
|
80
|
-
case "active": {
|
81
|
-
return {
|
82
|
-
color: "brand.text",
|
83
|
-
};
|
84
|
-
}
|
85
|
-
case "highlight": {
|
86
|
-
return {
|
87
|
-
color: "text.highlight",
|
88
|
-
};
|
89
|
-
}
|
90
|
-
case "disabled": {
|
91
|
-
return {
|
92
|
-
color: "text.disabled",
|
93
|
-
};
|
94
|
-
}
|
95
|
-
default: {
|
96
|
-
return {
|
97
|
-
color: "core.text",
|
98
|
-
};
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import { brandBackground } from "./brand-utils";
|
2
|
-
import { State, Subset } from "./types";
|
3
|
-
|
4
|
-
type FloatingBackgroundState = Subset<
|
5
|
-
State,
|
6
|
-
"default" | "hover" | "active" | "focus"
|
7
|
-
>;
|
8
|
-
|
9
|
-
export function floatingBackground(state: FloatingBackgroundState) {
|
10
|
-
switch (state) {
|
11
|
-
case "focus": {
|
12
|
-
return brandBackground("default");
|
13
|
-
}
|
14
|
-
case "active": {
|
15
|
-
return {
|
16
|
-
backgroundColor: "floating.surface.active",
|
17
|
-
};
|
18
|
-
}
|
19
|
-
case "hover": {
|
20
|
-
return {
|
21
|
-
backgroundColor: {
|
22
|
-
_light: "floating.surface.hover",
|
23
|
-
_dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
|
24
|
-
},
|
25
|
-
};
|
26
|
-
}
|
27
|
-
case "default": {
|
28
|
-
return {
|
29
|
-
backgroundColor: {
|
30
|
-
_light: "bg",
|
31
|
-
_dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
|
32
|
-
},
|
33
|
-
};
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
type FloatingBorderState = Subset<
|
39
|
-
State,
|
40
|
-
"default" | "hover" | "active" | "focus"
|
41
|
-
>;
|
42
|
-
export function floatingBorder(state: FloatingBorderState) {
|
43
|
-
switch (state) {
|
44
|
-
case "hover": {
|
45
|
-
return {
|
46
|
-
outline: "1px solid",
|
47
|
-
outlineColor: "floating.outline.hover",
|
48
|
-
};
|
49
|
-
}
|
50
|
-
case "focus": {
|
51
|
-
return {
|
52
|
-
outline: "1px solid",
|
53
|
-
outlineColor: "outline.focus",
|
54
|
-
};
|
55
|
-
}
|
56
|
-
case "active": {
|
57
|
-
return {
|
58
|
-
outline: "1px solid",
|
59
|
-
outlineColor: "floating.outline.active",
|
60
|
-
};
|
61
|
-
}
|
62
|
-
default: {
|
63
|
-
return {
|
64
|
-
outline: "1px solid",
|
65
|
-
outlineColor: "floating.outline",
|
66
|
-
};
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { State, Subset } from "./types";
|
2
|
-
|
3
|
-
type GhostBackgroundState = Subset<
|
4
|
-
State,
|
5
|
-
"default" | "hover" | "active" | "selected"
|
6
|
-
>;
|
7
|
-
|
8
|
-
/** 👻👻👻👻👻👻👻👻👻👻👻👻👻👻 */
|
9
|
-
export function ghostBackground(state: GhostBackgroundState) {
|
10
|
-
switch (state) {
|
11
|
-
case "hover": {
|
12
|
-
return {
|
13
|
-
backgroundColor: "ghost.surface.hover",
|
14
|
-
};
|
15
|
-
}
|
16
|
-
case "active": {
|
17
|
-
return {
|
18
|
-
backgroundColor: "ghost.surface.active",
|
19
|
-
};
|
20
|
-
}
|
21
|
-
case "selected": {
|
22
|
-
return {
|
23
|
-
backgroundColor: "ghost.surface.selected",
|
24
|
-
};
|
25
|
-
}
|
26
|
-
case "default": {
|
27
|
-
return {
|
28
|
-
backgroundColor: "transparent",
|
29
|
-
};
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
type GhostTextState = Subset<State, "default" | "selected">;
|
35
|
-
|
36
|
-
export function ghostText(state: GhostTextState) {
|
37
|
-
switch (state) {
|
38
|
-
case "selected": {
|
39
|
-
return {
|
40
|
-
color: "ghost.text",
|
41
|
-
};
|
42
|
-
}
|
43
|
-
default: {
|
44
|
-
return {
|
45
|
-
color: "ghost.text",
|
46
|
-
};
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|