@vygruppen/spor-react 13.4.0 → 13.4.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 +3 -4
- package/CHANGELOG.md +16 -0
- package/__tests__/accordion.test.tsx +110 -0
- package/dist/index.cjs +204 -244
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +139 -58
- package/dist/index.d.ts +139 -58
- package/dist/index.mjs +204 -244
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dialog/Dialog.tsx +3 -1
- package/src/input/AttachedInputs.tsx +24 -11
- package/src/linjetag/InfoTag.tsx +4 -2
- package/src/linjetag/LineIcon.tsx +1 -1
- package/src/linjetag/TravelTag.tsx +4 -4
- package/src/linjetag/types.ts +4 -0
- package/src/theme/slot-recipes/breadcrumb.ts +3 -6
- package/src/theme/slot-recipes/travel-tag.ts +15 -58
- package/src/typography/Badge.tsx +9 -1
package/package.json
CHANGED
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -9,6 +9,7 @@ interface DialogContentProps extends ChakraDialog.ContentProps {
|
|
|
9
9
|
portalRef?: React.RefObject<HTMLElement>;
|
|
10
10
|
backdrop?: boolean;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
|
+
positionerProps?: ChakraDialog.PositionerProps;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const DialogContent = ({
|
|
@@ -22,13 +23,14 @@ export const DialogContent = ({
|
|
|
22
23
|
portalled = true,
|
|
23
24
|
portalRef,
|
|
24
25
|
backdrop = true,
|
|
26
|
+
positionerProps,
|
|
25
27
|
...rest
|
|
26
28
|
} = props;
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
31
|
<Portal disabled={!portalled} container={portalRef}>
|
|
30
32
|
{backdrop && <ChakraDialog.Backdrop />}
|
|
31
|
-
<ChakraDialog.Positioner>
|
|
33
|
+
<ChakraDialog.Positioner {...positionerProps}>
|
|
32
34
|
<ChakraDialog.Content ref={ref} {...rest} asChild={false}>
|
|
33
35
|
{children}
|
|
34
36
|
</ChakraDialog.Content>
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
defineRecipe,
|
|
7
7
|
Group,
|
|
8
8
|
GroupProps,
|
|
9
|
+
IconButtonProps,
|
|
9
10
|
RecipeVariantProps,
|
|
10
11
|
useRecipe,
|
|
11
12
|
} from "@chakra-ui/react";
|
|
@@ -40,10 +41,22 @@ export type AttachedInputsProps = RecipeVariantProps<
|
|
|
40
41
|
onFlip: () => void;
|
|
41
42
|
flipAriaLabel: string;
|
|
42
43
|
}
|
|
43
|
-
)
|
|
44
|
+
) & {
|
|
45
|
+
flipButtonProps?: Omit<
|
|
46
|
+
IconButtonProps,
|
|
47
|
+
| "icon"
|
|
48
|
+
| "aria-label"
|
|
49
|
+
| "onClick"
|
|
50
|
+
| "variant"
|
|
51
|
+
| "size"
|
|
52
|
+
| "orientation"
|
|
53
|
+
| "spinner"
|
|
54
|
+
>;
|
|
55
|
+
};
|
|
44
56
|
|
|
45
57
|
export const AttachedInputs = ({
|
|
46
58
|
ref,
|
|
59
|
+
flipButtonProps,
|
|
47
60
|
...props
|
|
48
61
|
}: AttachedInputsProps & {
|
|
49
62
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -76,6 +89,10 @@ export const AttachedInputs = ({
|
|
|
76
89
|
size={["xs", null, "sm"]}
|
|
77
90
|
aria-label={flipAriaLabel}
|
|
78
91
|
onClick={onFlip}
|
|
92
|
+
position="absolute"
|
|
93
|
+
bg="bg"
|
|
94
|
+
outlineWidth="1px"
|
|
95
|
+
{...flipButtonProps}
|
|
79
96
|
/>
|
|
80
97
|
</Box>
|
|
81
98
|
);
|
|
@@ -85,24 +102,20 @@ const SwitchButton = chakra(
|
|
|
85
102
|
IconButton,
|
|
86
103
|
defineRecipe({
|
|
87
104
|
base: {
|
|
88
|
-
|
|
89
|
-
zIndex: "101 !important",
|
|
90
|
-
// eslint-disable-next-line spor/use-semantic-tokens
|
|
91
|
-
bg: "bg !important",
|
|
92
|
-
outlineWidth: "1px !important",
|
|
93
|
-
|
|
105
|
+
zIndex: "101",
|
|
94
106
|
_focus: {
|
|
95
|
-
outlineOffset: "0px
|
|
107
|
+
outlineOffset: "0px",
|
|
108
|
+
alignItems: "center",
|
|
96
109
|
},
|
|
97
110
|
},
|
|
98
111
|
variants: {
|
|
99
112
|
orientation: {
|
|
100
113
|
horizontal: {
|
|
101
|
-
top: "calc(50% -
|
|
102
|
-
right: "calc(50% -
|
|
114
|
+
top: "calc(50% - 1.1rem)",
|
|
115
|
+
right: "calc(50% - 1.1rem)",
|
|
103
116
|
},
|
|
104
117
|
vertical: {
|
|
105
|
-
top: "calc(50% -
|
|
118
|
+
top: "calc(50% - 1.1rem)",
|
|
106
119
|
right: "3rem",
|
|
107
120
|
transform: "rotate(90deg)",
|
|
108
121
|
},
|
package/src/linjetag/InfoTag.tsx
CHANGED
|
@@ -47,6 +47,8 @@ export const InfoTag = ({
|
|
|
47
47
|
size = "md",
|
|
48
48
|
title,
|
|
49
49
|
description,
|
|
50
|
+
descriptionProps,
|
|
51
|
+
titleProps,
|
|
50
52
|
...customProps
|
|
51
53
|
}: InfoTagProps) => {
|
|
52
54
|
const recipe = useSlotRecipe({ key: "infoTag" });
|
|
@@ -67,13 +69,13 @@ export const InfoTag = ({
|
|
|
67
69
|
/>
|
|
68
70
|
<Box css={styles.textContainer}>
|
|
69
71
|
{title && (
|
|
70
|
-
<Box as="span" css={styles.title}>
|
|
72
|
+
<Box as="span" css={styles.title} {...titleProps}>
|
|
71
73
|
{title}
|
|
72
74
|
</Box>
|
|
73
75
|
)}
|
|
74
76
|
{title && description && " "}
|
|
75
77
|
{description && (
|
|
76
|
-
<Box as="span" css={styles.description}>
|
|
78
|
+
<Box as="span" css={styles.description} {...descriptionProps}>
|
|
77
79
|
{description}
|
|
78
80
|
</Box>
|
|
79
81
|
)}
|
|
@@ -111,7 +111,7 @@ export const LineIcon = function LineIcon({
|
|
|
111
111
|
borderColor={variant === "walk" ? "outline.core" : "transparent"}
|
|
112
112
|
aria-label={label}
|
|
113
113
|
ref={ref}
|
|
114
|
-
className={clsx("light", rest.className)}
|
|
114
|
+
className={variant === "walk" ? undefined : clsx("light", rest.className)}
|
|
115
115
|
>
|
|
116
116
|
<LinjeTagIcon size={size} css={styles.icon} variant={getIconVariant()} />
|
|
117
117
|
</Box>
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
WarningFill18Icon,
|
|
15
15
|
WarningFill24Icon,
|
|
16
16
|
} from "@vygruppen/spor-icon-react";
|
|
17
|
-
import clsx from "clsx";
|
|
18
17
|
import { PropsWithChildren } from "react";
|
|
19
18
|
|
|
20
19
|
import { travelTagSlotRecipe } from "../theme/slot-recipes/travel-tag";
|
|
@@ -139,6 +138,8 @@ export const TravelTag = function TravelTag({
|
|
|
139
138
|
foregroundColor,
|
|
140
139
|
backgroundColor,
|
|
141
140
|
customIconVariant,
|
|
141
|
+
descriptionProps,
|
|
142
|
+
titleProps,
|
|
142
143
|
...rest
|
|
143
144
|
}: TravelTagProps & {
|
|
144
145
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -155,7 +156,6 @@ export const TravelTag = function TravelTag({
|
|
|
155
156
|
css={styles.container}
|
|
156
157
|
aria-disabled={disabled}
|
|
157
158
|
ref={ref}
|
|
158
|
-
className={clsx("light", rest.className)}
|
|
159
159
|
backgroundColor={backgroundColor}
|
|
160
160
|
{...rest}
|
|
161
161
|
>
|
|
@@ -172,13 +172,13 @@ export const TravelTag = function TravelTag({
|
|
|
172
172
|
/>
|
|
173
173
|
<Box css={styles.textContainer}>
|
|
174
174
|
{title && (
|
|
175
|
-
<Box as="span" css={styles.title}>
|
|
175
|
+
<Box as="span" css={styles.title} {...titleProps}>
|
|
176
176
|
{title}
|
|
177
177
|
</Box>
|
|
178
178
|
)}
|
|
179
179
|
{title && description && " "}
|
|
180
180
|
{description && (
|
|
181
|
-
<Box as="span" css={styles.description}>
|
|
181
|
+
<Box as="span" css={styles.description} {...descriptionProps}>
|
|
182
182
|
{description}
|
|
183
183
|
</Box>
|
|
184
184
|
)}
|
package/src/linjetag/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BoxProps } from "@chakra-ui/react";
|
|
2
|
+
|
|
1
3
|
export type Variant =
|
|
2
4
|
| "local-train"
|
|
3
5
|
| "region-train"
|
|
@@ -20,6 +22,8 @@ export type TagProps = VariantProps & {
|
|
|
20
22
|
size?: Size;
|
|
21
23
|
title: string;
|
|
22
24
|
description?: string;
|
|
25
|
+
descriptionProps?: BoxProps;
|
|
26
|
+
titleProps?: BoxProps;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
type DefaultVariantProps = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
|
2
|
-
import tokens from "@vygruppen/spor-design-tokens";
|
|
3
2
|
|
|
4
3
|
import { breadcrumbAnatomy } from "./anatomy";
|
|
5
4
|
|
|
@@ -15,9 +14,9 @@ export const breadcrumbSlotRecipe = defineSlotRecipe({
|
|
|
15
14
|
link: {
|
|
16
15
|
cursor: "pointer",
|
|
17
16
|
borderRadius: "xs",
|
|
17
|
+
textDecoration: "underline",
|
|
18
18
|
},
|
|
19
19
|
currentLink: {
|
|
20
|
-
borderRadius: "xs",
|
|
21
20
|
cursor: "default",
|
|
22
21
|
},
|
|
23
22
|
separator: {
|
|
@@ -32,12 +31,10 @@ export const breadcrumbSlotRecipe = defineSlotRecipe({
|
|
|
32
31
|
core: {
|
|
33
32
|
link: {
|
|
34
33
|
_hover: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
outlineStyle: "solid",
|
|
34
|
+
textDecoration: "none",
|
|
35
|
+
|
|
38
36
|
_active: {
|
|
39
37
|
backgroundColor: "surface.core.active",
|
|
40
|
-
outline: "none",
|
|
41
38
|
},
|
|
42
39
|
},
|
|
43
40
|
},
|
|
@@ -11,10 +11,7 @@ export const travelTagSlotRecipe = defineSlotRecipe({
|
|
|
11
11
|
display: "flex",
|
|
12
12
|
alignItems: "center",
|
|
13
13
|
padding: 0.5,
|
|
14
|
-
|
|
15
|
-
_disabled: {
|
|
16
|
-
background: "surface.disabled",
|
|
17
|
-
},
|
|
14
|
+
backgroundColor: "surface.disabled",
|
|
18
15
|
|
|
19
16
|
width: "fit-content",
|
|
20
17
|
transitionDuration: "fast",
|
|
@@ -79,62 +76,22 @@ export const travelTagSlotRecipe = defineSlotRecipe({
|
|
|
79
76
|
none: {},
|
|
80
77
|
},
|
|
81
78
|
variant: {
|
|
82
|
-
"local-train": {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
backgroundColor: "linjetag.regionEkspressLight",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
"long-distance-train": {
|
|
98
|
-
container: {
|
|
99
|
-
backgroundColor: "linjetag.fjerntogLight",
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
"airport-express-train": {
|
|
103
|
-
container: {
|
|
104
|
-
backgroundColor: "linjetag.flytogLight",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
"vy-bus": {
|
|
108
|
-
container: {
|
|
109
|
-
backgroundColor: "linjetag.vyBussLight",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
"local-bus": {
|
|
113
|
-
container: {
|
|
114
|
-
backgroundColor: "linjetag.lokalbussLight",
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
ferry: {
|
|
118
|
-
container: {
|
|
119
|
-
backgroundColor: "linjetag.fergeLight",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
subway: {
|
|
123
|
-
container: {
|
|
124
|
-
backgroundColor: "linjetag.tbaneLight",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
tram: {
|
|
128
|
-
container: {
|
|
129
|
-
backgroundColor: "linjetag.trikkLight",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
"alt-transport": {
|
|
79
|
+
"local-train": {},
|
|
80
|
+
"region-train": {},
|
|
81
|
+
"region-express-train": {},
|
|
82
|
+
"long-distance-train": {},
|
|
83
|
+
"airport-express-train": {},
|
|
84
|
+
"vy-bus": {},
|
|
85
|
+
"local-bus": {},
|
|
86
|
+
ferry: {},
|
|
87
|
+
subway: {},
|
|
88
|
+
tram: {},
|
|
89
|
+
"alt-transport": {},
|
|
90
|
+
walk: {
|
|
133
91
|
container: {
|
|
134
|
-
backgroundColor: "
|
|
92
|
+
backgroundColor: "none",
|
|
135
93
|
},
|
|
136
|
-
|
|
137
|
-
walk: {
|
|
94
|
+
|
|
138
95
|
textContainer: {
|
|
139
96
|
position: "absolute",
|
|
140
97
|
left: "0.875rem",
|
package/src/typography/Badge.tsx
CHANGED
|
@@ -3,10 +3,18 @@ import {
|
|
|
3
3
|
Badge as ChakraBadge,
|
|
4
4
|
BadgeProps as ChakraBadgeProps,
|
|
5
5
|
Box,
|
|
6
|
+
RecipeVariantProps,
|
|
6
7
|
} from "@chakra-ui/react";
|
|
7
8
|
import { IconComponent } from "@vygruppen/spor-icon-react";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
import { badgeRecipie } from "../theme/recipes/badge";
|
|
11
|
+
|
|
12
|
+
type BadgeVariantProps = RecipeVariantProps<typeof badgeRecipie>;
|
|
13
|
+
|
|
14
|
+
export type BadgeProps = ChakraBadgeProps & {
|
|
15
|
+
colorPalette?: BadgeVariantProps["colorPalette"];
|
|
16
|
+
icon?: IconComponent;
|
|
17
|
+
};
|
|
10
18
|
|
|
11
19
|
export const Badge = function Badge({
|
|
12
20
|
ref,
|