@vygruppen/spor-react 12.14.0 → 12.14.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 +12 -12
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +110 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +111 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alert/ServiceAlert.tsx +4 -11
- package/src/button/ResponsiveButton.tsx +27 -0
- package/src/datepicker/CalendarHeader.tsx +6 -4
- package/src/datepicker/DateField.tsx +1 -5
- package/src/dialog/Drawer.tsx +18 -24
- package/src/input/Field.tsx +1 -1
- package/src/input/ListBox.tsx +6 -2
- package/src/input/Switch.tsx +1 -1
- package/src/stepper/StepperStep.tsx +0 -1
- package/src/theme/slot-recipes/accordion.ts +6 -6
- package/src/theme/slot-recipes/alert-service.ts +23 -8
- package/src/theme/slot-recipes/choice-chip.ts +17 -3
- package/src/theme/slot-recipes/datepicker.ts +1 -1
- package/src/theme/slot-recipes/drawer.ts +2 -1
- package/src/theme/slot-recipes/line-icon.ts +4 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "12.14.
|
4
|
+
"version": "12.14.2",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -68,8 +68,8 @@
|
|
68
68
|
"vitest": "^0.26.3",
|
69
69
|
"vitest-axe": "^0.1.0",
|
70
70
|
"vitest-canvas-mock": "^0.2.2",
|
71
|
-
"@vygruppen/
|
72
|
-
"@vygruppen/
|
71
|
+
"@vygruppen/tsconfig": "0.1.1",
|
72
|
+
"@vygruppen/eslint-config": "1.2.3"
|
73
73
|
},
|
74
74
|
"peerDependencies": {
|
75
75
|
"react": ">=18.0.0 <19.0.0",
|
@@ -6,7 +6,6 @@ import {
|
|
6
6
|
HStack,
|
7
7
|
RecipeVariantProps,
|
8
8
|
Span,
|
9
|
-
Stack,
|
10
9
|
Text,
|
11
10
|
useSlotRecipe,
|
12
11
|
} from "@chakra-ui/react";
|
@@ -127,16 +126,10 @@ export const ServiceAlert = forwardRef<HTMLDivElement, ServiceAlertProps>(
|
|
127
126
|
</HStack>
|
128
127
|
</Accordion.ItemTrigger>
|
129
128
|
|
130
|
-
<Accordion.ItemContent
|
131
|
-
<
|
132
|
-
|
133
|
-
|
134
|
-
width={contentWidth}
|
135
|
-
css={styles.itemBody}
|
136
|
-
>
|
137
|
-
{children}
|
138
|
-
</Accordion.ItemBody>
|
139
|
-
</Stack>
|
129
|
+
<Accordion.ItemContent css={styles.itemContent}>
|
130
|
+
<Accordion.ItemBody maxWidth={contentWidth} css={styles.itemBody}>
|
131
|
+
{children}
|
132
|
+
</Accordion.ItemBody>
|
140
133
|
</Accordion.ItemContent>
|
141
134
|
</Accordion.Item>
|
142
135
|
</Accordion.Root>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { Button, ButtonProps } from "./Button";
|
2
|
+
import { IconButton, IconButtonProps } from "./IconButton";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* For internal use
|
6
|
+
*/
|
7
|
+
|
8
|
+
type Props = IconButtonProps &
|
9
|
+
Omit<ButtonProps, "leftIcon" | "rightIcon"> & {
|
10
|
+
label: string;
|
11
|
+
};
|
12
|
+
|
13
|
+
export const ResponsiveButton = ({ label, icon, ...props }: Props) => {
|
14
|
+
return (
|
15
|
+
<>
|
16
|
+
<Button display={["none", "flex"]} leftIcon={icon} {...props}>
|
17
|
+
{label}
|
18
|
+
</Button>
|
19
|
+
<IconButton
|
20
|
+
display={["flex", "none"]}
|
21
|
+
aria-label={label}
|
22
|
+
icon={icon}
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
</>
|
26
|
+
);
|
27
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import {
|
2
|
+
import { Flex } from "@chakra-ui/react";
|
3
3
|
import { getLocalTimeZone } from "@internationalized/date";
|
4
4
|
import {
|
5
5
|
ArrowLeftOutline24Icon,
|
@@ -7,6 +7,8 @@ import {
|
|
7
7
|
} from "@vygruppen/spor-icon-react";
|
8
8
|
import { CalendarState, RangeCalendarState } from "react-stately";
|
9
9
|
|
10
|
+
import { Text } from "@/typography";
|
11
|
+
|
10
12
|
import { createTexts, useTranslation } from "../i18n";
|
11
13
|
import { CalendarNavigationButton } from "./CalendarNavigationButton";
|
12
14
|
import { useCurrentLocale } from "./utils";
|
@@ -103,16 +105,16 @@ export const CalendarNavigator = ({
|
|
103
105
|
icon={<ArrowLeftOutline24Icon />}
|
104
106
|
aria-label={`${t(texts.previous)} ${t(texts[unit])}`}
|
105
107
|
/>
|
106
|
-
<
|
108
|
+
<Text
|
107
109
|
role="heading"
|
108
|
-
|
110
|
+
variant="md"
|
109
111
|
fontWeight="bold"
|
110
112
|
flex="1"
|
111
113
|
textAlign="center"
|
112
114
|
color={"core.text"}
|
113
115
|
>
|
114
116
|
{capitalize(title)}
|
115
|
-
</
|
117
|
+
</Text>
|
116
118
|
<CalendarNavigationButton
|
117
119
|
onPress={onNext}
|
118
120
|
isDisabled={isNextDisabled}
|
@@ -63,11 +63,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
63
63
|
position="absolute"
|
64
64
|
paddingTop="2px"
|
65
65
|
>
|
66
|
-
<Label
|
67
|
-
padding="0"
|
68
|
-
fontSize={["mobile.xs", "desktop.xs"]}
|
69
|
-
{...props.labelProps}
|
70
|
-
>
|
66
|
+
<Label padding="0" {...props.labelProps}>
|
71
67
|
{props.label} <Field.RequiredIndicator />
|
72
68
|
</Label>
|
73
69
|
</Box>
|
package/src/dialog/Drawer.tsx
CHANGED
@@ -4,8 +4,6 @@ import {
|
|
4
4
|
Box,
|
5
5
|
createContext,
|
6
6
|
Drawer as ChakraDrawer,
|
7
|
-
Grid,
|
8
|
-
GridItem,
|
9
7
|
Portal,
|
10
8
|
useDialogContext,
|
11
9
|
} from "@chakra-ui/react";
|
@@ -16,7 +14,9 @@ import {
|
|
16
14
|
import { forwardRef } from "react";
|
17
15
|
import { useSwipeable } from "react-swipeable";
|
18
16
|
|
19
|
-
import {
|
17
|
+
import { ResponsiveButton } from "@/button/ResponsiveButton";
|
18
|
+
|
19
|
+
import { CloseButton } from "../button";
|
20
20
|
import { createTexts, useTranslation } from "../i18n";
|
21
21
|
import {
|
22
22
|
DrawerContentProps,
|
@@ -116,9 +116,11 @@ export const DrawerCloseTrigger = forwardRef<
|
|
116
116
|
return (
|
117
117
|
<ChakraDrawer.CloseTrigger ref={ref} {...props} asChild>
|
118
118
|
{size === "full" ? (
|
119
|
-
<
|
120
|
-
|
121
|
-
|
119
|
+
<ResponsiveButton
|
120
|
+
variant="ghost"
|
121
|
+
icon={<CloseFill24Icon />}
|
122
|
+
label={t(texts.close)}
|
123
|
+
/>
|
122
124
|
) : (
|
123
125
|
<CloseButton size="md" />
|
124
126
|
)}
|
@@ -132,10 +134,12 @@ export const DrawerBackTrigger = forwardRef<
|
|
132
134
|
>((props, ref) => {
|
133
135
|
const { t } = useTranslation();
|
134
136
|
return (
|
135
|
-
<ChakraDrawer.CloseTrigger asChild {...props} ref={ref}
|
136
|
-
<
|
137
|
-
|
138
|
-
|
137
|
+
<ChakraDrawer.CloseTrigger asChild {...props} ref={ref}>
|
138
|
+
<ResponsiveButton
|
139
|
+
variant="ghost"
|
140
|
+
icon={<ArrowLeftFill24Icon />}
|
141
|
+
label={t(texts.back)}
|
142
|
+
/>
|
139
143
|
</ChakraDrawer.CloseTrigger>
|
140
144
|
);
|
141
145
|
});
|
@@ -147,20 +151,10 @@ export const DrawerFullScreenHeader = forwardRef<
|
|
147
151
|
>((props, ref) => {
|
148
152
|
const { backTrigger = true, closeTrigger = true, children } = props;
|
149
153
|
return (
|
150
|
-
<ChakraDrawer.Header {...props} ref={ref}
|
151
|
-
<
|
152
|
-
|
153
|
-
|
154
|
-
</GridItem>
|
155
|
-
<GridItem width="full" alignSelf="end" asChild>
|
156
|
-
{children && <DrawerTitle>{children}</DrawerTitle>}
|
157
|
-
</GridItem>
|
158
|
-
{closeTrigger && (
|
159
|
-
<GridItem width="full" alignSelf="end">
|
160
|
-
<DrawerCloseTrigger justifySelf="end" top="0" />
|
161
|
-
</GridItem>
|
162
|
-
)}
|
163
|
-
</Grid>
|
154
|
+
<ChakraDrawer.Header {...props} ref={ref}>
|
155
|
+
<Box>{backTrigger && <DrawerBackTrigger />}</Box>
|
156
|
+
{<DrawerTitle>{children}</DrawerTitle>}
|
157
|
+
<Box> {closeTrigger && <DrawerCloseTrigger />}</Box>
|
164
158
|
</ChakraDrawer.Header>
|
165
159
|
);
|
166
160
|
});
|
package/src/input/Field.tsx
CHANGED
package/src/input/ListBox.tsx
CHANGED
@@ -127,7 +127,11 @@ export function ItemDescription({ children }: { children: React.ReactNode }) {
|
|
127
127
|
const recipe = useSlotRecipe({ key: "listbox" });
|
128
128
|
const styles = recipe({});
|
129
129
|
return (
|
130
|
-
<Box
|
130
|
+
<Box
|
131
|
+
{...descriptionProps}
|
132
|
+
css={styles}
|
133
|
+
fontSize={["mobile.xs", "desktop.xs"]}
|
134
|
+
>
|
131
135
|
{children}
|
132
136
|
</Box>
|
133
137
|
);
|
@@ -233,7 +237,7 @@ function ListBoxSection({ section, state }: ListBoxSectionProps) {
|
|
233
237
|
>
|
234
238
|
{section.rendered && (
|
235
239
|
<Box
|
236
|
-
fontSize="mobile.
|
240
|
+
fontSize={["mobile.sm", "desktop.sm"]}
|
237
241
|
color={titleColor}
|
238
242
|
paddingTop={1}
|
239
243
|
marginTop={isFirstSection ? 0 : 2}
|
package/src/input/Switch.tsx
CHANGED
@@ -78,7 +78,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
78
78
|
<ChakraSwitch.Control css={styles.control}>
|
79
79
|
<ChakraSwitch.Thumb />
|
80
80
|
</ChakraSwitch.Control>
|
81
|
-
<ChakraSwitch.Label>{label}</ChakraSwitch.Label>
|
81
|
+
{label && <ChakraSwitch.Label>{label}</ChakraSwitch.Label>}
|
82
82
|
</ChakraSwitch.Root>
|
83
83
|
</Field>
|
84
84
|
);
|
@@ -22,13 +22,13 @@ export const accordionSlotRecipe = defineSlotRecipe({
|
|
22
22
|
textAlign: "left",
|
23
23
|
width: "full",
|
24
24
|
alignItems: "center",
|
25
|
-
fontSize: ["mobile.sm",
|
25
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
26
26
|
fontFamily: "body",
|
27
27
|
fontWeight: "bold",
|
28
28
|
outlineOffset: "-2px",
|
29
|
-
paddingX: [2,
|
30
|
-
paddingY: [1,
|
31
|
-
minHeight: [6,
|
29
|
+
paddingX: [2, 3],
|
30
|
+
paddingY: [1, 1.5],
|
31
|
+
minHeight: [6, 7],
|
32
32
|
cursor: "pointer",
|
33
33
|
_disabled: {
|
34
34
|
pointerEvents: "none",
|
@@ -37,7 +37,7 @@ export const accordionSlotRecipe = defineSlotRecipe({
|
|
37
37
|
},
|
38
38
|
itemContent: {
|
39
39
|
borderBottomRadius: "sm",
|
40
|
-
fontSize: ["mobile.sm",
|
40
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
41
41
|
color: "text",
|
42
42
|
height: "auto",
|
43
43
|
overflow: "hidden",
|
@@ -52,7 +52,7 @@ export const accordionSlotRecipe = defineSlotRecipe({
|
|
52
52
|
},
|
53
53
|
itemBody: {
|
54
54
|
paddingY: 2,
|
55
|
-
paddingX: [2,
|
55
|
+
paddingX: [2, 3],
|
56
56
|
},
|
57
57
|
itemIndicator: {
|
58
58
|
transition: "rotate 0.2s",
|
@@ -22,7 +22,8 @@ export const alertServiceSlotRecipe = defineSlotRecipe({
|
|
22
22
|
display: "flex",
|
23
23
|
flexDirection: "column",
|
24
24
|
justifyContent: "center",
|
25
|
-
padding: [2,
|
25
|
+
padding: ["2", "3"],
|
26
|
+
paddingBottom: "1",
|
26
27
|
borderBottomRadius: "md",
|
27
28
|
borderTopRadius: "none",
|
28
29
|
width: "full",
|
@@ -39,27 +40,41 @@ export const alertServiceSlotRecipe = defineSlotRecipe({
|
|
39
40
|
},
|
40
41
|
},
|
41
42
|
itemTriggerTitle: {
|
42
|
-
fontSize: ["
|
43
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
43
44
|
},
|
44
45
|
notificationText: {
|
45
46
|
fontWeight: "400",
|
46
|
-
fontSize: ["
|
47
|
+
fontSize: ["mobile.xs", "desktop.xs"],
|
47
48
|
textWrap: "nowrap",
|
49
|
+
color: "alert.service.text.secondary",
|
48
50
|
},
|
51
|
+
|
52
|
+
itemContent: {
|
53
|
+
paddingX: ["2", "3"],
|
54
|
+
paddingBottom: ["2", "3"],
|
55
|
+
paddingTop: ["1", "2"],
|
56
|
+
},
|
57
|
+
|
49
58
|
itemBody: {
|
50
59
|
marginX: "auto",
|
51
60
|
padding: "0 !important",
|
52
|
-
|
53
|
-
|
61
|
+
color: "alert.service.text.secondary",
|
62
|
+
gap: 0,
|
63
|
+
flexDirection: "column",
|
64
|
+
display: "flex",
|
54
65
|
"& > p": {
|
55
|
-
gap: 2,
|
56
66
|
width: "full",
|
57
67
|
borderBottom: "1px dashed",
|
58
68
|
borderColor: "outline.inverted",
|
59
|
-
|
60
|
-
|
69
|
+
|
70
|
+
paddingY: ["1", "1.5"],
|
71
|
+
|
72
|
+
_first: {
|
73
|
+
paddingTop: 0,
|
74
|
+
},
|
61
75
|
_last: {
|
62
76
|
borderBottom: "none",
|
77
|
+
paddingBottom: 0,
|
63
78
|
},
|
64
79
|
},
|
65
80
|
},
|
@@ -10,7 +10,6 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
10
10
|
display: "inline-flex",
|
11
11
|
alignItems: "center",
|
12
12
|
boxAlign: "center",
|
13
|
-
fontSize: "xs",
|
14
13
|
cursor: "pointer",
|
15
14
|
transitionProperty: "all",
|
16
15
|
borderRadius: "xl",
|
@@ -69,7 +68,6 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
69
68
|
display: "flex",
|
70
69
|
alignItems: "center",
|
71
70
|
gap: "1",
|
72
|
-
fontSize: "xs",
|
73
71
|
},
|
74
72
|
},
|
75
73
|
|
@@ -83,6 +81,10 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
83
81
|
height: 5,
|
84
82
|
paddingX: 1.5,
|
85
83
|
},
|
84
|
+
label: {
|
85
|
+
fontSize: { base: "mobile.sm", sm: "desktop.sm" },
|
86
|
+
fontWeight: "medium",
|
87
|
+
},
|
86
88
|
},
|
87
89
|
sm: {
|
88
90
|
root: {
|
@@ -92,6 +94,10 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
92
94
|
height: 6,
|
93
95
|
paddingX: 2,
|
94
96
|
},
|
97
|
+
label: {
|
98
|
+
fontSize: { base: "mobile.sm", sm: "desktop.sm" },
|
99
|
+
fontWeight: "bold",
|
100
|
+
},
|
95
101
|
},
|
96
102
|
md: {
|
97
103
|
root: {
|
@@ -101,6 +107,10 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
101
107
|
height: 7,
|
102
108
|
paddingX: 2,
|
103
109
|
},
|
110
|
+
label: {
|
111
|
+
fontSize: { base: "mobile.md", sm: "desktop.md" },
|
112
|
+
fontWeight: "bold",
|
113
|
+
},
|
104
114
|
},
|
105
115
|
lg: {
|
106
116
|
root: {
|
@@ -110,6 +120,10 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
110
120
|
height: 8,
|
111
121
|
paddingX: 3,
|
112
122
|
},
|
123
|
+
label: {
|
124
|
+
fontSize: { base: "mobile.md", sm: "desktop.md" },
|
125
|
+
fontWeight: "bold",
|
126
|
+
},
|
113
127
|
},
|
114
128
|
},
|
115
129
|
|
@@ -176,7 +190,7 @@ export const choiceChipSlotRecipe = defineSlotRecipe({
|
|
176
190
|
},
|
177
191
|
|
178
192
|
defaultVariants: {
|
179
|
-
size: "
|
193
|
+
size: "sm",
|
180
194
|
variant: "core",
|
181
195
|
chipType: "choice",
|
182
196
|
},
|
@@ -59,7 +59,8 @@ export const drawerSlotRecipe = defineSlotRecipe({
|
|
59
59
|
display: "flex",
|
60
60
|
alignItems: "center",
|
61
61
|
justifyContent: "space-between",
|
62
|
-
paddingX: ["
|
62
|
+
paddingX: ["2", null, null, "5"],
|
63
|
+
gap: "1",
|
63
64
|
paddingBottom: "1",
|
64
65
|
},
|
65
66
|
body: {
|