@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.
@@ -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
- }
@@ -1,117 +0,0 @@
1
- import { coreBackground, coreBorder, coreText } from "./core-utils";
2
- import { floatingBackground, floatingBorder } from "./floating-utils";
3
- import { surface } from "./surface-utils";
4
- import { InputState } from "./types";
5
-
6
- export function inputVariant(state: InputState) {
7
- switch (state) {
8
- case "base": {
9
- return {
10
- ...coreBackground("default"),
11
- ...coreBorder("default"),
12
- _hover: {
13
- ...coreBorder("hover"),
14
- },
15
- _active: {
16
- backgroundColor: "core.surface.active",
17
- ...coreBorder("default"),
18
- },
19
- _selected: {
20
- ...coreBackground("selected"),
21
- ...coreBorder("selected"),
22
- },
23
- };
24
- }
25
- case "floating": {
26
- return {
27
- boxShadow: "sm",
28
- ...floatingBackground("default"),
29
- ...floatingBorder("default"),
30
-
31
- _hover: {
32
- ...floatingBorder("hover"),
33
- ...floatingBackground("hover"),
34
- },
35
- _active: {
36
- ...floatingBorder("active"),
37
- backgroundColor: "core.surface.active",
38
- },
39
- _selected: {
40
- backgroundColor: "floating.surface.selected",
41
- borderColor: "floating.border.selected",
42
- },
43
- };
44
- }
45
-
46
- default: {
47
- return {
48
- ...coreBackground("default"),
49
- ...coreBorder("default"),
50
- _hover: {
51
- ...coreBorder("hover"),
52
- },
53
- _active: {
54
- backgroundColor: "core.surface.active",
55
- ...coreBorder("default"),
56
- },
57
- _selected: {
58
- ...coreBackground("selected"),
59
- ...coreBorder("selected"),
60
- },
61
- };
62
- }
63
- }
64
- }
65
-
66
- export const inputBaseStyle = () => ({
67
- field: {
68
- appearance: "none",
69
- width: "100%",
70
- outline: "none",
71
- border: 0,
72
- borderRadius: "sm",
73
- transitionProperty: "common",
74
- transitionDuration: "fast",
75
- position: "relative",
76
- paddingX: 3,
77
- height: 8,
78
- fontSize: "mobile.md",
79
-
80
- _disabled: {
81
- ...surface("disabled"),
82
- ...coreBorder("disabled"),
83
- pointerEvents: "none",
84
- },
85
- _invalid: {
86
- ...coreBorder("invalid"),
87
- _hover: {
88
- ...coreBorder("hover"),
89
- },
90
- },
91
- " + label, + div[data-lastpass-icon-root] + label": {
92
- fontSize: ["mobile.sm", "desktop.sm"],
93
- top: "2px",
94
- left: 3,
95
- zIndex: 2,
96
- position: "absolute",
97
- marginY: 2,
98
- transition: ".1s ease-out",
99
- transformOrigin: "top left",
100
- cursor: "text",
101
- },
102
- "&:not(:placeholder-shown)": {
103
- paddingTop: "1rem",
104
- "& + label, & + div[data-lastpass-icon-root] + label": {
105
- transform: "scale(0.825) translateY(-10px)",
106
- },
107
- },
108
- },
109
- element: {
110
- height: "100%",
111
- },
112
- group: {
113
- ":has(:disabled)": {
114
- ...coreText("disabled"),
115
- },
116
- },
117
- });
@@ -1,22 +0,0 @@
1
- import { State, Subset } from "./types";
2
-
3
- type OutlineBorderState = Subset<State, "default" | "error" | "focus">;
4
- export function outlineBorder(state: OutlineBorderState) {
5
- switch (state) {
6
- case "error": {
7
- return {
8
- outlineColor: "outline.error",
9
- };
10
- }
11
- case "focus": {
12
- return {
13
- outlineColor: "outline.focus",
14
- };
15
- }
16
- default: {
17
- return {
18
- outlineColor: "outline",
19
- };
20
- }
21
- }
22
- }
@@ -1,13 +0,0 @@
1
- /** All the styles you need to hide something visually, while still making it available for screen readers */
2
- export const srOnly = {
3
- border: "0 !important",
4
- clip: "rect(1px, 1px, 1px, 1px) !important",
5
- clipPath: "inset(50%) !important",
6
- height: "1px !important",
7
- margin: "-1px !important",
8
- overflow: "hidden !important",
9
- padding: "0 !important",
10
- position: "absolute !important",
11
- width: "1px !important",
12
- whiteSpace: "nowrap !important",
13
- };
@@ -1,25 +0,0 @@
1
- type Surface = "default" | "secondary" | "tertiary" | "disabled";
2
- export const surface = (surface: Surface) => {
3
- switch (surface) {
4
- case "default": {
5
- return {
6
- backgroundColor: "surface",
7
- };
8
- }
9
- case "secondary": {
10
- return {
11
- backgroundColor: "surface.secondary",
12
- };
13
- }
14
- case "tertiary": {
15
- return {
16
- backgroundColor: "surface.tertiary",
17
- };
18
- }
19
- case "disabled": {
20
- return {
21
- backgroundColor: "surface.disabled",
22
- };
23
- }
24
- }
25
- };