@vygruppen/spor-react 9.13.0 → 9.13.2
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 +13 -0
- package/dist/{CountryCodeSelect-MMRSNFMQ.mjs → CountryCodeSelect-QPCMMHSU.mjs} +1 -1
- package/dist/{chunk-KJYJYQBK.mjs → chunk-UOSLFTBE.mjs} +111 -77
- package/dist/index.d.mts +71 -48
- package/dist/index.d.ts +71 -48
- package/dist/index.js +110 -77
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/layout/RadioCard.tsx +45 -31
- package/src/layout/RadioCardGroup.tsx +5 -9
- package/src/modal/FullScreenDrawer.tsx +5 -1
- package/src/modal/SimpleDrawer.tsx +8 -1
- package/src/theme/components/radio-card.ts +41 -21
@@ -1,7 +1,6 @@
|
|
1
1
|
import { BoxProps, Stack } from "@chakra-ui/react";
|
2
2
|
import React, { useState } from "react";
|
3
3
|
import { FormLabel } from "../input";
|
4
|
-
import { RadioCard } from "./RadioCard";
|
5
4
|
|
6
5
|
/**
|
7
6
|
* RadioCardGroupContext is used to pass down the state and handlers to the RadioCard components.
|
@@ -15,6 +14,7 @@ type RadioGroupContextProps = {
|
|
15
14
|
onChange: (value: string) => void;
|
16
15
|
variant?: "base" | "floating";
|
17
16
|
defaultValue?: string;
|
17
|
+
value?: string;
|
18
18
|
};
|
19
19
|
|
20
20
|
export const RadioCardGroupContext =
|
@@ -27,6 +27,7 @@ type RadioCardGroupProps = BoxProps & {
|
|
27
27
|
direction?: "row" | "column";
|
28
28
|
groupLabel?: string;
|
29
29
|
defaultValue?: string;
|
30
|
+
onChange?: (value: string) => void;
|
30
31
|
};
|
31
32
|
|
32
33
|
export const RadioCardGroup: React.FC<RadioCardGroupProps> = ({
|
@@ -36,6 +37,7 @@ export const RadioCardGroup: React.FC<RadioCardGroupProps> = ({
|
|
36
37
|
direction = "row",
|
37
38
|
groupLabel,
|
38
39
|
defaultValue,
|
40
|
+
onChange,
|
39
41
|
...props
|
40
42
|
}: RadioCardGroupProps) => {
|
41
43
|
const [selectedValue, setSelectedValue] = useState<string>(
|
@@ -44,6 +46,7 @@ export const RadioCardGroup: React.FC<RadioCardGroupProps> = ({
|
|
44
46
|
|
45
47
|
const handleChange = (value: string) => {
|
46
48
|
setSelectedValue(value);
|
49
|
+
onChange && onChange(value);
|
47
50
|
};
|
48
51
|
|
49
52
|
return (
|
@@ -56,14 +59,7 @@ export const RadioCardGroup: React.FC<RadioCardGroupProps> = ({
|
|
56
59
|
defaultValue: defaultValue || "",
|
57
60
|
}}
|
58
61
|
>
|
59
|
-
<Stack
|
60
|
-
as="fieldset"
|
61
|
-
direction={direction}
|
62
|
-
aria-labelledby={groupLabel || name}
|
63
|
-
role="radiogroup"
|
64
|
-
tabIndex={0}
|
65
|
-
{...props}
|
66
|
-
>
|
62
|
+
<Stack as="fieldset" direction={direction} {...props}>
|
67
63
|
{groupLabel && (
|
68
64
|
<FormLabel as="legend" id={groupLabel}>
|
69
65
|
{groupLabel}
|
@@ -15,6 +15,7 @@ import React, { useEffect, useState } from "react";
|
|
15
15
|
import { Button, IconButton } from "../button";
|
16
16
|
import { createTexts, useTranslation } from "../i18n";
|
17
17
|
import { Drawer } from "./Drawer";
|
18
|
+
import { DrawerBodyProps } from "./SimpleDrawer";
|
18
19
|
|
19
20
|
type DrawerPlacement = "top" | "right" | "bottom" | "left";
|
20
21
|
|
@@ -33,6 +34,8 @@ type FullScreenDrawerProps = {
|
|
33
34
|
isOpen: boolean;
|
34
35
|
/** Function that will be called when the drawer closes */
|
35
36
|
onClose: () => void;
|
37
|
+
/** Props for drawer body */
|
38
|
+
body?: DrawerBodyProps;
|
36
39
|
};
|
37
40
|
|
38
41
|
export const FullScreenDrawer = ({
|
@@ -43,6 +46,7 @@ export const FullScreenDrawer = ({
|
|
43
46
|
rightButton = <DrawerCloseButton />,
|
44
47
|
isOpen,
|
45
48
|
onClose,
|
49
|
+
body,
|
46
50
|
}: FullScreenDrawerProps) => {
|
47
51
|
const [isContentBoxScrolled, setContentBoxScrolled] = useState(false);
|
48
52
|
|
@@ -75,7 +79,7 @@ export const FullScreenDrawer = ({
|
|
75
79
|
leftButton={leftButton}
|
76
80
|
rightButton={rightButton}
|
77
81
|
/>
|
78
|
-
<DrawerBody overflow="auto" onScroll={onContentScroll}>
|
82
|
+
<DrawerBody overflow="auto" onScroll={onContentScroll} {...body}>
|
79
83
|
{children}
|
80
84
|
</DrawerBody>
|
81
85
|
</DrawerContent>
|
@@ -8,12 +8,18 @@ import {
|
|
8
8
|
DrawerOverlay,
|
9
9
|
} from "./Drawer";
|
10
10
|
|
11
|
+
export type DrawerBodyProps = {
|
12
|
+
id?: string;
|
13
|
+
};
|
14
|
+
|
11
15
|
export type SimpleDrawerProps = {
|
12
16
|
children: React.ReactNode;
|
13
17
|
title?: React.ReactNode;
|
14
18
|
placement: "top" | "right" | "bottom" | "left";
|
15
19
|
isOpen: boolean;
|
16
20
|
onClose: () => void;
|
21
|
+
/** Props for drawer body */
|
22
|
+
body?: DrawerBodyProps;
|
17
23
|
};
|
18
24
|
/** A very basic drawer component that's easy to use
|
19
25
|
*
|
@@ -29,6 +35,7 @@ export const SimpleDrawer = ({
|
|
29
35
|
placement,
|
30
36
|
children,
|
31
37
|
title,
|
38
|
+
body,
|
32
39
|
...props
|
33
40
|
}: SimpleDrawerProps) => {
|
34
41
|
return (
|
@@ -37,7 +44,7 @@ export const SimpleDrawer = ({
|
|
37
44
|
<DrawerContent>
|
38
45
|
<DrawerCloseButton />
|
39
46
|
{title && <DrawerHeader>{title}</DrawerHeader>}
|
40
|
-
<DrawerBody>{children}</DrawerBody>
|
47
|
+
<DrawerBody {...body}>{children}</DrawerBody>
|
41
48
|
</DrawerContent>
|
42
49
|
</Drawer>
|
43
50
|
);
|
@@ -1,25 +1,29 @@
|
|
1
1
|
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
|
2
2
|
import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
|
3
3
|
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
4
|
-
import {
|
5
|
-
import { anatomy, mode } from "@chakra-ui/theme-tools";
|
4
|
+
import { anatomy } from "@chakra-ui/theme-tools";
|
6
5
|
import { outlineBorder } from "../utils/outline-utils";
|
7
6
|
|
8
|
-
const parts = anatomy("radio-card").parts(
|
7
|
+
const parts = anatomy("radio-card").parts(
|
8
|
+
"container",
|
9
|
+
"checked",
|
10
|
+
"radioInput",
|
11
|
+
"focused",
|
12
|
+
"focusedChecked",
|
13
|
+
);
|
9
14
|
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
10
15
|
|
11
16
|
const config = helpers.defineMultiStyleConfig({
|
12
17
|
baseStyle: (props: any) => ({
|
13
18
|
container: {
|
14
|
-
border: "none",
|
15
19
|
overflow: "hidden",
|
16
20
|
fontSize: "inherit",
|
17
21
|
display: "block",
|
18
22
|
cursor: "pointer",
|
19
23
|
borderRadius: "sm",
|
20
|
-
...focusVisibleStyles(props),
|
21
24
|
transitionProperty: "common",
|
22
25
|
transitionDuration: "fast",
|
26
|
+
|
23
27
|
_disabled: {
|
24
28
|
pointerEvents: "none",
|
25
29
|
...baseBackground("disabled", props),
|
@@ -53,9 +57,6 @@ const config = helpers.defineMultiStyleConfig({
|
|
53
57
|
...baseBackground("active", props),
|
54
58
|
...baseBorder("active", props),
|
55
59
|
},
|
56
|
-
_focus: {
|
57
|
-
...outlineBorder("focus", props),
|
58
|
-
},
|
59
60
|
},
|
60
61
|
checked: {
|
61
62
|
_hover: {
|
@@ -65,11 +66,22 @@ const config = helpers.defineMultiStyleConfig({
|
|
65
66
|
...baseBackground("active", props),
|
66
67
|
...baseBorder("active", props),
|
67
68
|
},
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
},
|
70
|
+
focusedChecked: {
|
71
|
+
outline: "4px solid",
|
72
|
+
outlineStyle: "double",
|
73
|
+
...outlineBorder("focus", props),
|
74
|
+
outlineOffset: "-1px",
|
75
|
+
},
|
76
|
+
focused: {
|
77
|
+
outline: "2px solid",
|
78
|
+
...outlineBorder("focus", props),
|
79
|
+
outlineOffset: "1px",
|
80
|
+
boxShadow: `inset 0 0 0 1px rgba(0, 0, 0, 0.40)`,
|
81
|
+
_hover: {
|
82
|
+
...baseBorder("hover", props),
|
83
|
+
boxShadow: "none",
|
84
|
+
outlineOffset: "0px",
|
73
85
|
},
|
74
86
|
},
|
75
87
|
}),
|
@@ -87,9 +99,6 @@ const config = helpers.defineMultiStyleConfig({
|
|
87
99
|
...floatingBackground("active", props),
|
88
100
|
...floatingBorder("active", props),
|
89
101
|
},
|
90
|
-
_focus: {
|
91
|
-
...outlineBorder("focus", props),
|
92
|
-
},
|
93
102
|
},
|
94
103
|
checked: {
|
95
104
|
_hover: {
|
@@ -100,11 +109,22 @@ const config = helpers.defineMultiStyleConfig({
|
|
100
109
|
...floatingBackground("active", props),
|
101
110
|
...floatingBorder("active", props),
|
102
111
|
},
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
112
|
+
},
|
113
|
+
focusedChecked: {
|
114
|
+
outline: "4px solid",
|
115
|
+
outlineStyle: "double",
|
116
|
+
...outlineBorder("focus", props),
|
117
|
+
outlineOffset: "-1px",
|
118
|
+
},
|
119
|
+
focused: {
|
120
|
+
outline: "2px solid",
|
121
|
+
...outlineBorder("focus", props),
|
122
|
+
outlineOffset: "1px",
|
123
|
+
boxShadow: `inset 0 0 0 1px rgba(0, 0, 0, 0.10)`,
|
124
|
+
_hover: {
|
125
|
+
...floatingBorder("hover", props),
|
126
|
+
boxShadow: "md",
|
127
|
+
outlineOffset: "0px",
|
108
128
|
},
|
109
129
|
},
|
110
130
|
}),
|