@vygruppen/spor-react 12.1.2 → 12.2.1
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 +31 -12
- package/.turbo/turbo-typegen.log +19 -1
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +189 -243
- package/dist/index.d.ts +189 -243
- package/dist/index.js +2485 -2072
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2376 -1972
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +2 -1
- package/src/accordion/Expandable.tsx +3 -1
- package/src/accordion/helpers.ts +2 -1
- package/src/alert/Alert.tsx +3 -1
- package/src/alert/AlertIcon.tsx +17 -10
- package/src/alert/ExpandableAlert.tsx +3 -2
- package/src/alert/ServiceAlert.tsx +2 -1
- package/src/breadcrumb/Breadcrumb.tsx +9 -8
- package/src/button/Button.tsx +2 -1
- package/src/button/ButtonGroup.tsx +2 -1
- package/src/button/Clipboard.tsx +3 -0
- package/src/button/CloseButton.tsx +8 -4
- package/src/button/FloatingActionButton.tsx +5 -5
- package/src/button/IconButton.tsx +1 -0
- package/src/color-mode/color-mode.tsx +2 -2
- package/src/datepicker/Calendar.tsx +0 -1
- package/src/datepicker/CalendarCell.tsx +5 -5
- package/src/datepicker/CalendarGrid.tsx +3 -2
- package/src/datepicker/CalendarHeader.tsx +1 -4
- package/src/datepicker/CalendarTriggerButton.tsx +3 -4
- package/src/datepicker/DateField.tsx +13 -6
- package/src/datepicker/DatePicker.tsx +2 -1
- package/src/datepicker/DateRangePicker.tsx +1 -1
- package/src/datepicker/DateTimeSegment.tsx +2 -1
- package/src/datepicker/RangeCalendar.tsx +1 -1
- package/src/datepicker/StyledField.tsx +1 -1
- package/src/datepicker/TimeField.tsx +3 -3
- package/src/datepicker/TimePicker.tsx +4 -2
- package/src/datepicker/utils.ts +10 -5
- package/src/dialog/Dialog.tsx +1 -0
- package/src/dialog/Drawer.tsx +28 -26
- package/src/i18n/index.tsx +1 -0
- package/src/input/AttachedInputs.tsx +6 -3
- package/src/input/CardSelect.tsx +3 -1
- package/src/input/Checkbox.tsx +1 -0
- package/src/input/CheckboxGroup.tsx +3 -1
- package/src/input/ChoiceChip.tsx +39 -66
- package/src/input/Combobox.tsx +6 -4
- package/src/input/CountryCodeSelect.tsx +10 -4
- package/src/input/Field.tsx +2 -0
- package/src/input/Input.tsx +2 -3
- package/src/input/InputGroup.tsx +1 -1
- package/src/input/ListBox.tsx +9 -8
- package/src/input/NativeSelect.tsx +1 -2
- package/src/input/NumericStepper.tsx +22 -23
- package/src/input/PasswordInput.tsx +2 -1
- package/src/input/PhoneNumberInput.tsx +6 -2
- package/src/input/Popover.tsx +2 -0
- package/src/input/Radio.tsx +2 -0
- package/src/input/SearchInput.tsx +2 -1
- package/src/input/Select.tsx +8 -2
- package/src/input/Switch.tsx +22 -34
- package/src/input/Textarea.tsx +6 -4
- package/src/input/index.ts +1 -1
- package/src/layout/PressableCard.tsx +5 -2
- package/src/layout/RadioCard.tsx +3 -1
- package/src/layout/Separator.tsx +2 -1
- package/src/layout/StaticCard.tsx +6 -3
- package/src/linjetag/InfoTag.tsx +3 -2
- package/src/linjetag/LineIcon.tsx +5 -4
- package/src/linjetag/TravelTag.tsx +12 -8
- package/src/link/TextLink.tsx +1 -1
- package/src/loader/ColorInlineLoader.tsx +0 -1
- package/src/loader/ColorSpinner.tsx +0 -1
- package/src/loader/ContentLoader.tsx +0 -1
- package/src/loader/DarkFullScreenLoader.tsx +0 -1
- package/src/loader/DarkInlineLoader.tsx +0 -1
- package/src/loader/DarkSpinner.tsx +0 -1
- package/src/loader/LightFullScreenLoader.tsx +0 -1
- package/src/loader/LightInlineLoader.tsx +0 -1
- package/src/loader/LightSpinner.tsx +0 -1
- package/src/loader/Lottie.tsx +1 -2
- package/src/loader/ProgressBar.tsx +1 -2
- package/src/loader/ProgressLoader.tsx +2 -7
- package/src/logo/CargonetLogo.tsx +2 -1
- package/src/logo/VyLogo.tsx +3 -4
- package/src/logo/VyLogoPride.tsx +4 -1
- package/src/media-controller/JumpButton.tsx +2 -1
- package/src/media-controller/PlayPauseButton.tsx +2 -1
- package/src/media-controller/SkipButton.tsx +2 -1
- package/src/nudge/Nudge.tsx +7 -14
- package/src/pagination/Pagination.tsx +5 -0
- package/src/popover/index.tsx +2 -0
- package/src/progress-indicator/ProgressDot.tsx +1 -1
- package/src/progress-indicator/ProgressIndicator.tsx +4 -2
- package/src/provider/SporProvider.tsx +0 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/tab/Tabs.tsx +1 -1
- package/src/table/Table.tsx +2 -1
- package/src/theme/slot-recipes/alert-expandable.ts +0 -4
- package/src/theme/slot-recipes/anatomy.ts +10 -0
- package/src/theme/slot-recipes/choice-chip.ts +183 -0
- package/src/theme/slot-recipes/index.ts +2 -0
- package/src/theme/slot-recipes/info-tag.ts +0 -1
- package/src/theme/slot-recipes/popover.ts +0 -1
- package/src/theme/slot-recipes/radio-card.ts +0 -3
- package/src/theme/utils/accent-utils.ts +12 -6
- package/src/theme/utils/bg-utils.ts +6 -3
- package/src/theme/utils/brand-utils.ts +7 -7
- package/src/theme/utils/core-utils.ts +23 -13
- package/src/theme/utils/floating-utils.ts +16 -8
- package/src/theme/utils/ghost-utils.ts +8 -4
- package/src/theme/utils/input-utils.ts +7 -4
- package/src/theme/utils/outline-utils.ts +6 -3
- package/src/theme/utils/surface-utils.ts +8 -4
- package/src/toast/toast.tsx +0 -1
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Text.tsx +1 -1
- package/src/util/slugify.tsx +8 -8
- package/tsconfig.json +1 -0
- package/src/theme/recipes/choice-chip.ts +0 -144
@@ -8,26 +8,30 @@ type FloatingBackgroundState = Subset<
|
|
8
8
|
|
9
9
|
export function floatingBackground(state: FloatingBackgroundState) {
|
10
10
|
switch (state) {
|
11
|
-
case "focus":
|
11
|
+
case "focus": {
|
12
12
|
return brandBackground("default");
|
13
|
-
|
13
|
+
}
|
14
|
+
case "active": {
|
14
15
|
return {
|
15
16
|
backgroundColor: "floating.surface.active",
|
16
17
|
};
|
17
|
-
|
18
|
+
}
|
19
|
+
case "hover": {
|
18
20
|
return {
|
19
21
|
backgroundColor: {
|
20
22
|
_light: "floating.surface.hover",
|
21
23
|
_dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
|
22
24
|
},
|
23
25
|
};
|
24
|
-
|
26
|
+
}
|
27
|
+
case "default": {
|
25
28
|
return {
|
26
29
|
backgroundColor: {
|
27
30
|
_light: "bg",
|
28
31
|
_dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
|
29
32
|
},
|
30
33
|
};
|
34
|
+
}
|
31
35
|
}
|
32
36
|
}
|
33
37
|
|
@@ -37,25 +41,29 @@ type FloatingBorderState = Subset<
|
|
37
41
|
>;
|
38
42
|
export function floatingBorder(state: FloatingBorderState) {
|
39
43
|
switch (state) {
|
40
|
-
case "hover":
|
44
|
+
case "hover": {
|
41
45
|
return {
|
42
46
|
outline: "1px solid",
|
43
47
|
outlineColor: "floating.outline.hover",
|
44
48
|
};
|
45
|
-
|
49
|
+
}
|
50
|
+
case "focus": {
|
46
51
|
return {
|
47
52
|
outline: "1px solid",
|
48
53
|
outlineColor: "outline.focus",
|
49
54
|
};
|
50
|
-
|
55
|
+
}
|
56
|
+
case "active": {
|
51
57
|
return {
|
52
58
|
outline: "1px solid",
|
53
59
|
outlineColor: "floating.outline.active",
|
54
60
|
};
|
55
|
-
|
61
|
+
}
|
62
|
+
default: {
|
56
63
|
return {
|
57
64
|
outline: "1px solid",
|
58
65
|
outlineColor: "floating.outline",
|
59
66
|
};
|
67
|
+
}
|
60
68
|
}
|
61
69
|
}
|
@@ -13,19 +13,21 @@ export function ghostBackground(state: GhostBackgroundState) {
|
|
13
13
|
backgroundColor: "ghost.surface.hover",
|
14
14
|
};
|
15
15
|
}
|
16
|
-
case "active":
|
16
|
+
case "active": {
|
17
17
|
return {
|
18
18
|
backgroundColor: "ghost.surface.active",
|
19
19
|
};
|
20
|
+
}
|
20
21
|
case "selected": {
|
21
22
|
return {
|
22
23
|
backgroundColor: "ghost.surface.selected",
|
23
24
|
};
|
24
25
|
}
|
25
|
-
case "default":
|
26
|
+
case "default": {
|
26
27
|
return {
|
27
28
|
backgroundColor: "transparent",
|
28
29
|
};
|
30
|
+
}
|
29
31
|
}
|
30
32
|
}
|
31
33
|
|
@@ -33,13 +35,15 @@ type GhostTextState = Subset<State, "default" | "selected">;
|
|
33
35
|
|
34
36
|
export function ghostText(state: GhostTextState) {
|
35
37
|
switch (state) {
|
36
|
-
case "selected":
|
38
|
+
case "selected": {
|
37
39
|
return {
|
38
40
|
color: "ghost.text",
|
39
41
|
};
|
40
|
-
|
42
|
+
}
|
43
|
+
default: {
|
41
44
|
return {
|
42
45
|
color: "ghost.text",
|
43
46
|
};
|
47
|
+
}
|
44
48
|
}
|
45
49
|
}
|
@@ -5,7 +5,7 @@ import { InputState } from "./types";
|
|
5
5
|
|
6
6
|
export function inputVariant(state: InputState) {
|
7
7
|
switch (state) {
|
8
|
-
case "base":
|
8
|
+
case "base": {
|
9
9
|
return {
|
10
10
|
...coreBackground("default"),
|
11
11
|
...coreBorder("default"),
|
@@ -21,7 +21,8 @@ export function inputVariant(state: InputState) {
|
|
21
21
|
...coreBorder("selected"),
|
22
22
|
},
|
23
23
|
};
|
24
|
-
|
24
|
+
}
|
25
|
+
case "floating": {
|
25
26
|
return {
|
26
27
|
boxShadow: "sm",
|
27
28
|
...floatingBackground("default"),
|
@@ -40,8 +41,9 @@ export function inputVariant(state: InputState) {
|
|
40
41
|
borderColor: "floating.border.selected",
|
41
42
|
},
|
42
43
|
};
|
43
|
-
|
44
|
-
|
44
|
+
}
|
45
|
+
|
46
|
+
default: {
|
45
47
|
return {
|
46
48
|
...coreBackground("default"),
|
47
49
|
...coreBorder("default"),
|
@@ -57,6 +59,7 @@ export function inputVariant(state: InputState) {
|
|
57
59
|
...coreBorder("selected"),
|
58
60
|
},
|
59
61
|
};
|
62
|
+
}
|
60
63
|
}
|
61
64
|
}
|
62
65
|
|
@@ -3,17 +3,20 @@ import { State, Subset } from "./types";
|
|
3
3
|
type OutlineBorderState = Subset<State, "default" | "error" | "focus">;
|
4
4
|
export function outlineBorder(state: OutlineBorderState) {
|
5
5
|
switch (state) {
|
6
|
-
case "error":
|
6
|
+
case "error": {
|
7
7
|
return {
|
8
8
|
outlineColor: "outline.error",
|
9
9
|
};
|
10
|
-
|
10
|
+
}
|
11
|
+
case "focus": {
|
11
12
|
return {
|
12
13
|
outlineColor: "outline.focus",
|
13
14
|
};
|
14
|
-
|
15
|
+
}
|
16
|
+
default: {
|
15
17
|
return {
|
16
18
|
outlineColor: "outline",
|
17
19
|
};
|
20
|
+
}
|
18
21
|
}
|
19
22
|
}
|
@@ -1,21 +1,25 @@
|
|
1
1
|
type Surface = "default" | "secondary" | "tertiary" | "disabled";
|
2
2
|
export const surface = (surface: Surface) => {
|
3
3
|
switch (surface) {
|
4
|
-
case "default":
|
4
|
+
case "default": {
|
5
5
|
return {
|
6
6
|
backgroundColor: "surface",
|
7
7
|
};
|
8
|
-
|
8
|
+
}
|
9
|
+
case "secondary": {
|
9
10
|
return {
|
10
11
|
backgroundColor: "surface.secondary",
|
11
12
|
};
|
12
|
-
|
13
|
+
}
|
14
|
+
case "tertiary": {
|
13
15
|
return {
|
14
16
|
backgroundColor: "surface.tertiary",
|
15
17
|
};
|
16
|
-
|
18
|
+
}
|
19
|
+
case "disabled": {
|
17
20
|
return {
|
18
21
|
backgroundColor: "surface.disabled",
|
19
22
|
};
|
23
|
+
}
|
20
24
|
}
|
21
25
|
};
|
package/src/toast/toast.tsx
CHANGED
package/src/typography/Badge.tsx
CHANGED
@@ -5,17 +5,20 @@ import {
|
|
5
5
|
Box,
|
6
6
|
} from "@chakra-ui/react";
|
7
7
|
import { IconComponent } from "@vygruppen/spor-icon-react";
|
8
|
-
import
|
8
|
+
import { forwardRef } from "react";
|
9
9
|
|
10
10
|
export type BadgeProps = ChakraBadgeProps & {
|
11
11
|
icon?: IconComponent;
|
12
12
|
};
|
13
13
|
|
14
|
-
export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(
|
15
|
-
|
14
|
+
export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(
|
15
|
+
{ icon, children, ...props },
|
16
|
+
ref,
|
17
|
+
) {
|
18
|
+
return (
|
16
19
|
<ChakraBadge ref={ref} {...props}>
|
17
20
|
{children}
|
18
21
|
{icon && <Box as={icon} />}
|
19
22
|
</ChakraBadge>
|
20
|
-
)
|
21
|
-
);
|
23
|
+
);
|
24
|
+
});
|
package/src/typography/Text.tsx
CHANGED
@@ -3,7 +3,7 @@ import {
|
|
3
3
|
Text as ChakraText,
|
4
4
|
TextProps as ChakraTextProps,
|
5
5
|
} from "@chakra-ui/react";
|
6
|
-
import
|
6
|
+
import { forwardRef } from "react";
|
7
7
|
|
8
8
|
export type TextProps = Omit<ChakraTextProps, "textStyle"> & {
|
9
9
|
/** The size and style of the text.
|
package/src/util/slugify.tsx
CHANGED
@@ -20,17 +20,17 @@ export function slugify(text: string | string[], maxLength = 50): string {
|
|
20
20
|
return (
|
21
21
|
text
|
22
22
|
.normalize("NFD") // Normalize to NFD Unicode form
|
23
|
-
.
|
24
|
-
.
|
25
|
-
.
|
26
|
-
.
|
23
|
+
.replaceAll(/[\u0300-\u036F]/g, "") // Remove diacritics
|
24
|
+
.replaceAll(/[\u00C6\u00E6]/g, "ae") // Replace Æ, æ
|
25
|
+
.replaceAll(/[\u00D8\u00F8]/g, "oe") // Replace Ø, ø
|
26
|
+
.replaceAll(/[\u00C5\u00E5]/g, "aa") // Replace Å, å
|
27
27
|
// Extend the replacement rules as needed
|
28
28
|
.toLowerCase()
|
29
|
-
.
|
30
|
-
.
|
31
|
-
.
|
29
|
+
.replaceAll(/\s+/g, "-") // Replace spaces with -
|
30
|
+
.replaceAll(/[^\w-]+/g, "") // Remove all non-word chars
|
31
|
+
.replaceAll(/--+/g, "-") // Replace multiple - with single -
|
32
32
|
.replace(/^-+/, "") // Trim - from start of text
|
33
33
|
.replace(/-+$/, "")
|
34
|
-
.
|
34
|
+
.slice(0, Math.max(0, maxLength))
|
35
35
|
);
|
36
36
|
}
|
package/tsconfig.json
CHANGED
@@ -1,144 +0,0 @@
|
|
1
|
-
import { defineRecipe } from "@chakra-ui/react";
|
2
|
-
|
3
|
-
export const choiceChipRecipe = defineRecipe({
|
4
|
-
base: {
|
5
|
-
display: "inline-flex",
|
6
|
-
alignItems: "center",
|
7
|
-
boxAlign: "center",
|
8
|
-
fontSize: "xs",
|
9
|
-
cursor: "pointer",
|
10
|
-
transitionProperty: "all",
|
11
|
-
borderRadius: "xl",
|
12
|
-
transitionDuration: "fast",
|
13
|
-
height: 6,
|
14
|
-
paddingInlineStart: "2",
|
15
|
-
paddingInlineEnd: "2",
|
16
|
-
|
17
|
-
outline: "1px solid",
|
18
|
-
outlineColor: "base.outline",
|
19
|
-
_checked: {
|
20
|
-
backgroundColor: "brand.surface",
|
21
|
-
borderRadius: "sm",
|
22
|
-
outline: "none",
|
23
|
-
color: "brand.text",
|
24
|
-
_hover: {
|
25
|
-
backgroundColor: "brand.surface.hover",
|
26
|
-
_active: {
|
27
|
-
backgroundColor: "brand.surface.active",
|
28
|
-
},
|
29
|
-
},
|
30
|
-
},
|
31
|
-
|
32
|
-
_focusVisible: {
|
33
|
-
outline: "2px solid",
|
34
|
-
outlineColor: "outline.focus",
|
35
|
-
outlineOffset: "1px",
|
36
|
-
},
|
37
|
-
|
38
|
-
_disabled: {
|
39
|
-
pointerEvents: "none",
|
40
|
-
boxShadow: "none",
|
41
|
-
backgroundColor: "surface.disabled",
|
42
|
-
color: "text.disabled",
|
43
|
-
outline: "none",
|
44
|
-
|
45
|
-
_hover: {
|
46
|
-
backgroundColor: "core.surface.disabled",
|
47
|
-
boxShadow: "none",
|
48
|
-
color: "core.text.disabled",
|
49
|
-
},
|
50
|
-
_checked: {
|
51
|
-
cursor: "not-allowed",
|
52
|
-
boxShadow: "none",
|
53
|
-
color: "core.text.disabled",
|
54
|
-
backgroundColor: "core.surface.disabled",
|
55
|
-
_hover: {
|
56
|
-
backgroundColor: "core.surface.disabled",
|
57
|
-
boxShadow: "none",
|
58
|
-
color: "core.text.disabled",
|
59
|
-
},
|
60
|
-
},
|
61
|
-
},
|
62
|
-
},
|
63
|
-
variants: {
|
64
|
-
variant: {
|
65
|
-
core: {
|
66
|
-
color: "core.text",
|
67
|
-
outlineColor: "core.outline",
|
68
|
-
|
69
|
-
_hover: {
|
70
|
-
outline: "2px solid",
|
71
|
-
outlineColor: "core.outline.hover",
|
72
|
-
|
73
|
-
_active: {
|
74
|
-
outline: "1px solid",
|
75
|
-
outlineColor: "core.outline",
|
76
|
-
backgroundColor: "core.surface.active",
|
77
|
-
},
|
78
|
-
},
|
79
|
-
},
|
80
|
-
accent: {
|
81
|
-
backgroundColor: "accent.surface",
|
82
|
-
color: "accent.text",
|
83
|
-
outline: "none",
|
84
|
-
|
85
|
-
_hover: {
|
86
|
-
backgroundColor: "accent.surface.hover",
|
87
|
-
|
88
|
-
_active: {
|
89
|
-
backgroundColor: "accent.surface.active",
|
90
|
-
},
|
91
|
-
},
|
92
|
-
},
|
93
|
-
floating: {
|
94
|
-
backgroundColor: "floating.surface",
|
95
|
-
outline: "1px solid",
|
96
|
-
outlineColor: "floating.outline",
|
97
|
-
color: "floating.text",
|
98
|
-
|
99
|
-
boxShadow: "sm",
|
100
|
-
_hover: {
|
101
|
-
backgroundColor: "floating.surface.hover",
|
102
|
-
outline: "1px solid",
|
103
|
-
outlineColor: "floating.outline.hover",
|
104
|
-
|
105
|
-
_active: {
|
106
|
-
backgroundColor: "floating.surface.active",
|
107
|
-
outline: "1px solid",
|
108
|
-
outlineColor: "floating.outline",
|
109
|
-
},
|
110
|
-
},
|
111
|
-
},
|
112
|
-
},
|
113
|
-
size: {
|
114
|
-
xs: {
|
115
|
-
_checked: {
|
116
|
-
borderRadius: "0.563rem",
|
117
|
-
},
|
118
|
-
height: 5,
|
119
|
-
paddingX: 1.5,
|
120
|
-
},
|
121
|
-
sm: {
|
122
|
-
_checked: {
|
123
|
-
borderRadius: "sm",
|
124
|
-
},
|
125
|
-
height: 6,
|
126
|
-
paddingX: 2,
|
127
|
-
},
|
128
|
-
md: {
|
129
|
-
_checked: {
|
130
|
-
borderRadius: "sm",
|
131
|
-
},
|
132
|
-
height: 7,
|
133
|
-
paddingX: 2,
|
134
|
-
},
|
135
|
-
lg: {
|
136
|
-
_checked: {
|
137
|
-
borderRadius: "md",
|
138
|
-
},
|
139
|
-
height: 8,
|
140
|
-
paddingX: 3,
|
141
|
-
},
|
142
|
-
},
|
143
|
-
},
|
144
|
-
});
|