@vygruppen/spor-react 9.8.3 → 9.10.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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +23 -0
- package/dist/{CountryCodeSelect-C2XKHNTP.mjs → CountryCodeSelect-FVCL47RT.mjs} +1 -1
- package/dist/{chunk-ZDOSE4VD.mjs → chunk-WZYWSOJB.mjs} +241 -120
- package/dist/index.d.mts +207 -94
- package/dist/index.d.ts +207 -94
- package/dist/index.js +2903 -2780
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/alert/BaseAlert.tsx +2 -0
- package/src/alert/ClosableAlert.tsx +11 -2
- package/src/alert/ExpandableAlert.tsx +3 -1
- package/src/alert/StaticAlert.tsx +10 -2
- package/src/input/InfoSelect.tsx +33 -14
- package/src/input/ListBox.tsx +1 -0
- package/src/layout/PressableCard.tsx +2 -2
- package/src/layout/RadioCard.tsx +44 -35
- package/src/layout/RadioCardGroup.tsx +9 -5
- package/src/layout/StaticCard.tsx +0 -1
- package/src/theme/components/alert.ts +1 -0
- package/src/theme/components/info-select.ts +12 -1
- package/src/theme/components/listbox.ts +5 -5
- package/src/theme/components/pressable-card.ts +10 -2
- package/src/theme/components/radio-card.ts +79 -40
- package/src/theme/utils/base-utils.ts +5 -2
- package/src/theme/utils/floating-utils.ts +3 -3
- package/src/theme/utils/ghost-utils.ts +19 -1
- package/src/theme/utils/outline-utils.ts +26 -0
- package/src/theme/utils/types.ts +3 -1
@@ -1,60 +1,99 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
createMultiStyleConfigHelpers,
|
3
|
+
defineStyleConfig,
|
4
|
+
} from "@chakra-ui/react";
|
2
5
|
import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
|
3
6
|
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
4
7
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
8
|
+
import { anatomy } from "@chakra-ui/theme-tools";
|
9
|
+
import { outlineBorder } from "../utils/outline-utils";
|
5
10
|
|
6
|
-
const
|
11
|
+
const parts = anatomy("radio-card").parts("container", "checked", "radioInput");
|
12
|
+
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
13
|
+
|
14
|
+
const config = helpers.defineMultiStyleConfig({
|
7
15
|
baseStyle: (props: any) => ({
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
container: {
|
17
|
+
appearance: "none",
|
18
|
+
border: "none",
|
19
|
+
overflow: "hidden",
|
20
|
+
fontSize: "inherit",
|
21
|
+
display: "block",
|
22
|
+
cursor: "pointer",
|
23
|
+
borderRadius: "sm",
|
24
|
+
...focusVisibleStyles(props),
|
25
|
+
transitionProperty: "common",
|
26
|
+
transitionDuration: "fast",
|
27
|
+
_disabled: {
|
28
|
+
pointerEvents: "none",
|
29
|
+
...baseBackground("disabled", props),
|
30
|
+
...baseBorder("disabled", props),
|
31
|
+
...baseText("disabled", props),
|
21
32
|
},
|
22
33
|
},
|
23
|
-
|
24
|
-
|
25
|
-
...
|
26
|
-
...
|
27
|
-
|
34
|
+
checked: {
|
35
|
+
outline: "2px solid",
|
36
|
+
...outlineBorder("focus", props),
|
37
|
+
...floatingBackground("active", props),
|
38
|
+
},
|
39
|
+
radioInput: {
|
40
|
+
appearance: "none",
|
41
|
+
position: "absolute",
|
42
|
+
opacity: 0,
|
43
|
+
zIndex: -1,
|
28
44
|
},
|
29
45
|
}),
|
30
46
|
variants: {
|
31
47
|
base: (props) => ({
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
...
|
36
|
-
|
48
|
+
container: {
|
49
|
+
...baseText("default", props),
|
50
|
+
...baseBackground("default", props),
|
51
|
+
...baseBorder("default", props),
|
52
|
+
_hover: {
|
53
|
+
...baseBackground("hover", props),
|
54
|
+
...baseBorder("hover", props),
|
55
|
+
},
|
56
|
+
_active: {
|
57
|
+
...baseBackground("active", props),
|
58
|
+
...baseBorder("active", props),
|
59
|
+
},
|
37
60
|
},
|
38
|
-
|
39
|
-
|
61
|
+
checked: {
|
62
|
+
_hover: {
|
63
|
+
...baseBorder("hover", props),
|
64
|
+
},
|
65
|
+
_active: {
|
66
|
+
...baseBackground("active", props),
|
67
|
+
...baseBorder("active", props),
|
68
|
+
},
|
40
69
|
},
|
41
70
|
}),
|
42
71
|
floating: (props) => ({
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
...floatingBackground("
|
47
|
-
...floatingBorder("
|
48
|
-
boxShadow: "
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
72
|
+
container: {
|
73
|
+
...baseText("default", props),
|
74
|
+
...baseBackground("default", props),
|
75
|
+
...floatingBackground("default", props),
|
76
|
+
...floatingBorder("default", props),
|
77
|
+
boxShadow: "sm",
|
78
|
+
_hover: {
|
79
|
+
...floatingBackground("hover", props),
|
80
|
+
...floatingBorder("hover", props),
|
81
|
+
boxShadow: "md",
|
82
|
+
},
|
83
|
+
_active: {
|
84
|
+
...floatingBackground("active", props),
|
85
|
+
...floatingBorder("active", props),
|
86
|
+
},
|
53
87
|
},
|
54
|
-
|
88
|
+
checked: {
|
89
|
+
cursor: "normal",
|
90
|
+
|
55
91
|
_hover: {
|
56
|
-
|
57
|
-
|
92
|
+
...floatingBorder("hover", props),
|
93
|
+
},
|
94
|
+
_active: {
|
95
|
+
...floatingBackground("active", props),
|
96
|
+
...floatingBorder("active", props),
|
58
97
|
},
|
59
98
|
},
|
60
99
|
}),
|
@@ -60,8 +60,11 @@ export function baseBorder(state: BorderState, props: StyleFunctionProps) {
|
|
60
60
|
}
|
61
61
|
case "active": {
|
62
62
|
return {
|
63
|
-
outline: "
|
64
|
-
outlineColor: mode(
|
63
|
+
outline: "1px solid",
|
64
|
+
outlineColor: mode(
|
65
|
+
"base.outline.default.light",
|
66
|
+
"base.outline.default.dark",
|
67
|
+
)(props),
|
65
68
|
};
|
66
69
|
}
|
67
70
|
case "invalid": {
|
@@ -25,14 +25,14 @@ export function floatingBackground(
|
|
25
25
|
return {
|
26
26
|
backgroundColor: mode(
|
27
27
|
"floating.surface.hover.light",
|
28
|
-
|
28
|
+
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`,
|
29
29
|
)(props),
|
30
30
|
};
|
31
31
|
case "default":
|
32
32
|
return {
|
33
33
|
backgroundColor: mode(
|
34
|
-
"
|
35
|
-
|
34
|
+
"white",
|
35
|
+
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`,
|
36
36
|
)(props),
|
37
37
|
};
|
38
38
|
}
|
@@ -29,7 +29,10 @@ export function ghostBackground(
|
|
29
29
|
};
|
30
30
|
case "selected": {
|
31
31
|
return {
|
32
|
-
backgroundColor: mode(
|
32
|
+
backgroundColor: mode(
|
33
|
+
"ghost.surface.selected.light",
|
34
|
+
"ghost.surface.selected.dark",
|
35
|
+
)(props),
|
33
36
|
};
|
34
37
|
}
|
35
38
|
case "default":
|
@@ -38,3 +41,18 @@ export function ghostBackground(
|
|
38
41
|
};
|
39
42
|
}
|
40
43
|
}
|
44
|
+
|
45
|
+
type GhostTextState = Subset<State, "default" | "selected">;
|
46
|
+
|
47
|
+
export function ghostText(state: GhostTextState, props: StyleFunctionProps) {
|
48
|
+
switch (state) {
|
49
|
+
case "selected":
|
50
|
+
return {
|
51
|
+
color: mode("ghost.text.light", "ghost.text.dark")(props),
|
52
|
+
};
|
53
|
+
default:
|
54
|
+
return {
|
55
|
+
color: mode("ghost.text.light", "ghost.text.dark")(props),
|
56
|
+
};
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { mode, StyleFunctionProps } from "@chakra-ui/theme-tools";
|
2
|
+
import { State, Subset } from "./types";
|
3
|
+
|
4
|
+
type OutlineBorderState = Subset<State, "default" | "error" | "focus">;
|
5
|
+
export function outlineBorder(
|
6
|
+
state: OutlineBorderState,
|
7
|
+
props: StyleFunctionProps,
|
8
|
+
) {
|
9
|
+
switch (state) {
|
10
|
+
case "error":
|
11
|
+
return {
|
12
|
+
outlineColor: mode("outline.error.light", "outline.error.dark")(props),
|
13
|
+
};
|
14
|
+
case "focus":
|
15
|
+
return {
|
16
|
+
outlineColor: mode("outline.focus.light", "outline.focus.dark")(props),
|
17
|
+
};
|
18
|
+
default:
|
19
|
+
return {
|
20
|
+
outlineColor: mode(
|
21
|
+
"outline.default.light",
|
22
|
+
"outline.default.dark",
|
23
|
+
)(props),
|
24
|
+
};
|
25
|
+
}
|
26
|
+
}
|
package/src/theme/utils/types.ts
CHANGED