@vygruppen/spor-react 9.7.0 → 9.8.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 +10 -0
- package/dist/{CountryCodeSelect-FPOWUHQG.mjs → CountryCodeSelect-EKYAUNTI.mjs} +1 -1
- package/dist/{chunk-QGMF2EAE.mjs → chunk-3P7NVQKW.mjs} +48 -145
- package/dist/index.d.mts +151 -701
- package/dist/index.d.ts +151 -701
- package/dist/index.js +56 -154
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/card/Card.tsx +7 -0
- package/src/card/index.tsx +0 -2
- package/src/layout/PressableCard.tsx +57 -0
- package/src/layout/StaticCard.tsx +77 -0
- package/src/layout/index.tsx +2 -0
- package/src/theme/components/pressable-card.ts +13 -131
- package/src/theme/components/static-card.ts +2 -12
- package/src/theme/utils/base-utils.ts +8 -1
- package/src/card/PressableCard.tsx +0 -52
- package/src/card/StaticCard.tsx +0 -25
@@ -1,7 +1,5 @@
|
|
1
1
|
import { defineStyleConfig } from "@chakra-ui/react";
|
2
|
-
import { mode } from "@chakra-ui/theme-tools";
|
3
2
|
import { colors } from "../foundations";
|
4
|
-
import { baseBorder, baseText } from "../utils/base-utils";
|
5
3
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
6
4
|
|
7
5
|
const config = defineStyleConfig({
|
@@ -12,7 +10,6 @@ const config = defineStyleConfig({
|
|
12
10
|
fontSize: "inherit",
|
13
11
|
display: "block",
|
14
12
|
borderRadius: "md",
|
15
|
-
// Except for white cards, all cards are light mode always
|
16
13
|
color: "text.default.light",
|
17
14
|
...focusVisibleStyles(props),
|
18
15
|
...getColorSchemeBaseProps(props),
|
@@ -33,20 +30,14 @@ type CardThemeProps = {
|
|
33
30
|
| "darkBlue"
|
34
31
|
| "darkGreen"
|
35
32
|
| "darkYellow";
|
36
|
-
theme: any;
|
37
|
-
colorMode: "light" | "dark";
|
38
33
|
};
|
39
34
|
|
40
35
|
const getColorSchemeBaseProps = (props: CardThemeProps) => {
|
41
36
|
switch (props.colorScheme) {
|
42
37
|
case "white":
|
43
38
|
return {
|
44
|
-
|
45
|
-
|
46
|
-
"white",
|
47
|
-
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`,
|
48
|
-
)(props),
|
49
|
-
color: "inherit",
|
39
|
+
backgroundColor: "white",
|
40
|
+
color: "darkGrey",
|
50
41
|
};
|
51
42
|
case "grey":
|
52
43
|
return {
|
@@ -82,7 +73,6 @@ const getColorSchemeBaseProps = (props: CardThemeProps) => {
|
|
82
73
|
default:
|
83
74
|
return {
|
84
75
|
backgroundColor: colors[props.colorScheme]?.[100] ?? "default",
|
85
|
-
...baseText("default", props),
|
86
76
|
};
|
87
77
|
}
|
88
78
|
};
|
@@ -22,6 +22,7 @@ export function baseBackground(
|
|
22
22
|
};
|
23
23
|
case "selected":
|
24
24
|
return brandBackground("default", props);
|
25
|
+
|
25
26
|
case "disabled":
|
26
27
|
return surface("disabled", props);
|
27
28
|
case "hover":
|
@@ -32,7 +33,7 @@ export function baseBackground(
|
|
32
33
|
|
33
34
|
type BorderState = Subset<
|
34
35
|
State,
|
35
|
-
"hover" | "focus" | "disabled" | "selected" | "invalid" | "default"
|
36
|
+
"hover" | "focus" | "active" | "disabled" | "selected" | "invalid" | "default"
|
36
37
|
>;
|
37
38
|
|
38
39
|
export function baseBorder(state: BorderState, props: StyleFunctionProps) {
|
@@ -57,6 +58,12 @@ export function baseBorder(state: BorderState, props: StyleFunctionProps) {
|
|
57
58
|
)(props),
|
58
59
|
};
|
59
60
|
}
|
61
|
+
case "active": {
|
62
|
+
return {
|
63
|
+
outline: "2px solid",
|
64
|
+
outlineColor: mode("base.outline.light", "base.outline.dark")(props),
|
65
|
+
};
|
66
|
+
}
|
60
67
|
case "invalid": {
|
61
68
|
return {
|
62
69
|
outline: "2px solid",
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { Box, BoxProps, useStyleConfig } from "@chakra-ui/react";
|
3
|
-
|
4
|
-
type PressableCardProps = Omit<BoxProps, "as"> & {
|
5
|
-
variant: "floating" | "accent" | "base";
|
6
|
-
size?: "sm" | "lg";
|
7
|
-
as: "button" | "a" | "label";
|
8
|
-
};
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Renders a Pressable card.
|
12
|
-
*
|
13
|
-
* The most basic version looks like this:
|
14
|
-
*
|
15
|
-
* ```tsx
|
16
|
-
* <PressableCard>
|
17
|
-
* Content
|
18
|
-
* </PressableCard>
|
19
|
-
* ```
|
20
|
-
*
|
21
|
-
* There are lots of color schemes available. You can also set the size as either `sm` or `lg`. The default is `sm`.
|
22
|
-
*
|
23
|
-
* ```tsx
|
24
|
-
* <PressableCard colorScheme="orange" size="lg">
|
25
|
-
* A smaller card
|
26
|
-
* </PressableCard>
|
27
|
-
* ```
|
28
|
-
*
|
29
|
-
* Pressable cards can also be rendered as button, link or label – like a li (list item) or an article.
|
30
|
-
* You do this by specifying the `as` prop. If no `as` is specified, button is chosen as default:
|
31
|
-
*
|
32
|
-
*
|
33
|
-
* ```tsx
|
34
|
-
* <PressableCard colorScheme="green" as="section">
|
35
|
-
* This is now a <section /> element
|
36
|
-
* </PressableCard>
|
37
|
-
* ```
|
38
|
-
*/
|
39
|
-
export const PressableCard = ({
|
40
|
-
children,
|
41
|
-
as = "button",
|
42
|
-
size = "sm",
|
43
|
-
variant = "base",
|
44
|
-
...props
|
45
|
-
}: PressableCardProps) => {
|
46
|
-
const styles = useStyleConfig("PressableCard", { variant, size });
|
47
|
-
return (
|
48
|
-
<Box as={as} __css={styles} {...props}>
|
49
|
-
{children}
|
50
|
-
</Box>
|
51
|
-
);
|
52
|
-
};
|
package/src/card/StaticCard.tsx
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { Box, useStyleConfig } from "@chakra-ui/react";
|
3
|
-
/**
|
4
|
-
* Renders a static card.
|
5
|
-
*
|
6
|
-
* The most basic version looks like this:
|
7
|
-
*
|
8
|
-
* ```tsx
|
9
|
-
* <StaticCard colorScheme="white">
|
10
|
-
* Content
|
11
|
-
* </StaticCard>
|
12
|
-
* ```
|
13
|
-
*
|
14
|
-
* Static cards can also be rendered as whatever DOM element you want – like a li (list item) or an article. You do this by specifying the `as` prop:
|
15
|
-
*
|
16
|
-
* ```tsx
|
17
|
-
* <StaticCard colorScheme="green" as="section">
|
18
|
-
* This is now a <section /> element
|
19
|
-
* </StaticCard>
|
20
|
-
* ```
|
21
|
-
*/
|
22
|
-
export const StaticCard = ({ colorScheme, ...props }: any) => {
|
23
|
-
const styles = useStyleConfig("StaticCard", { colorScheme });
|
24
|
-
return <Box __css={styles} {...props} />;
|
25
|
-
};
|