@vygruppen/spor-react 12.4.3 → 12.4.5
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 +10 -10
- package/.turbo/turbo-postinstall.log +1 -19
- package/CHANGELOG.md +22 -0
- package/dist/index.d.mts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +241 -500
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +238 -492
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/nudge/Nudge.tsx +2 -1
- package/src/theme/recipes/close-button.ts +2 -4
- package/src/theme/recipes/link.ts +3 -5
- package/src/theme/semantic-tokens/colors.ts +4 -6
- package/src/theme/slot-recipes/accordion.ts +26 -21
- package/src/theme/slot-recipes/checkbox.ts +9 -15
- 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/tokens/colors.ts +4 -6
- package/src/toast/toast.tsx +1 -1
- package/tsup.config.ts +0 -9
- 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.5",
|
4
4
|
"exports": {
|
5
5
|
".": {
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -45,9 +45,9 @@
|
|
45
45
|
"react-stately": "^3.31.1",
|
46
46
|
"react-swipeable": "^7.0.1",
|
47
47
|
"usehooks-ts": "^3.1.0",
|
48
|
-
"@vygruppen/spor-design-tokens": "4.0.
|
49
|
-
"@vygruppen/spor-
|
50
|
-
"@vygruppen/spor-
|
48
|
+
"@vygruppen/spor-design-tokens": "4.0.7",
|
49
|
+
"@vygruppen/spor-icon-react": "4.1.0",
|
50
|
+
"@vygruppen/spor-loader": "0.6.0"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@react-types/datepicker": "^3.10.0",
|
@@ -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/nudge/Nudge.tsx
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
"use client";
|
2
|
-
import { PopoverCloseTrigger, usePopoverContext } from "@ark-ui/react";
|
3
2
|
import {
|
4
3
|
Box,
|
5
4
|
BoxProps,
|
6
5
|
chakra,
|
7
6
|
Popover as ChakraPopover,
|
7
|
+
PopoverCloseTrigger,
|
8
8
|
PopoverRootProps,
|
9
|
+
usePopoverContext,
|
9
10
|
} from "@chakra-ui/react";
|
10
11
|
import { ArrowRightFill18Icon } from "@vygruppen/spor-icon-react";
|
11
12
|
import React, {
|
@@ -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,7 +1,5 @@
|
|
1
1
|
import { defineSemanticTokens } from "@chakra-ui/react";
|
2
|
-
import
|
3
|
-
import vyDigitalJson from "@vygruppen/spor-design-tokens/tokens/color/vy-digital.json" assert { type: "json" };
|
4
|
-
import VyUtviklingJson from "@vygruppen/spor-design-tokens/tokens/color/vy-utvikling.json" assert { type: "json" };
|
2
|
+
import tokens from "@vygruppen/spor-design-tokens/raw-tokens";
|
5
3
|
|
6
4
|
export enum Brand {
|
7
5
|
VyDigital = "VyDigital",
|
@@ -10,13 +8,13 @@ export enum Brand {
|
|
10
8
|
}
|
11
9
|
|
12
10
|
export const vyDigitalColors = defineSemanticTokens.colors({
|
13
|
-
...
|
11
|
+
...tokens.color["vy-digital"].color.vyDigital,
|
14
12
|
});
|
15
13
|
|
16
14
|
export const vyUtviklingColors = defineSemanticTokens.colors({
|
17
|
-
...
|
15
|
+
...tokens.color["vy-utvikling"].color.vyUtvikling,
|
18
16
|
});
|
19
17
|
|
20
18
|
export const cargonetColors = defineSemanticTokens.colors({
|
21
|
-
...
|
19
|
+
...tokens.color.cargonet.color.cargonet,
|
22
20
|
});
|
@@ -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,65 @@ 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.hover",
|
98
|
+
outline: "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
|
+
outlineColor: "core.outline.active",
|
106
|
+
outline: "solid",
|
102
107
|
},
|
103
108
|
},
|
104
109
|
},
|
105
110
|
floating: {
|
106
111
|
item: {
|
107
|
-
|
108
|
-
|
109
|
-
|
112
|
+
outline: "solid",
|
113
|
+
outlineWidth: tokens.size.stroke.sm,
|
114
|
+
outlineColor: "core.outline",
|
110
115
|
},
|
111
116
|
itemTrigger: {
|
112
117
|
_expanded: {
|
113
118
|
borderBottomRadius: "none",
|
114
119
|
},
|
115
120
|
"&:hover": {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
...floatingBorder("default"),
|
122
|
-
},
|
121
|
+
outlineWidth: tokens.size.stroke.md,
|
122
|
+
outlineColor: "floating.outline.hover",
|
123
|
+
outline: "solid",
|
124
|
+
|
125
|
+
outlineOffset: 0,
|
123
126
|
},
|
124
127
|
"&:active": {
|
125
128
|
backgroundColor: "floating.surface.active",
|
126
|
-
|
129
|
+
outlineWidth: tokens.size.stroke.sm,
|
130
|
+
outlineColor: "floating.outline.active",
|
131
|
+
outline: "solid",
|
127
132
|
},
|
128
133
|
},
|
129
134
|
},
|
@@ -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: {
|
@@ -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,10 +1,8 @@
|
|
1
1
|
import { defineTokens } from "@chakra-ui/react";
|
2
|
-
import
|
3
|
-
import linjetagJson from "@vygruppen/spor-design-tokens/tokens/color/linjetag.json" assert { type: "json" };
|
4
|
-
import paletteJson from "@vygruppen/spor-design-tokens/tokens/color/palette.json" assert { type: "json" };
|
2
|
+
import tokens from "@vygruppen/spor-design-tokens/raw-tokens";
|
5
3
|
|
6
4
|
export const colors = defineTokens.colors({
|
7
|
-
...
|
8
|
-
...
|
9
|
-
linjetag:
|
5
|
+
...tokens.color.alias.color.alias,
|
6
|
+
...tokens.color.palette.color.palette,
|
7
|
+
linjetag: tokens.color.linjetag.color.linjetag,
|
10
8
|
});
|
package/src/toast/toast.tsx
CHANGED
package/tsup.config.ts
CHANGED
@@ -6,13 +6,4 @@ export default defineConfig({
|
|
6
6
|
dts: true,
|
7
7
|
treeshake: true,
|
8
8
|
sourcemap: true,
|
9
|
-
esbuildOptions(options) {
|
10
|
-
// Ensure JSON files are treated as JSON modules
|
11
|
-
options.loader = {
|
12
|
-
...options.loader,
|
13
|
-
".json": "json",
|
14
|
-
};
|
15
|
-
options.target = "esnext";
|
16
|
-
options.platform = "node";
|
17
|
-
},
|
18
9
|
});
|
@@ -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
|
-
}
|