@vygruppen/spor-react 13.2.0 → 13.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 +10 -10
- package/.turbo/turbo-postinstall.log +3 -4
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +145 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +145 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/alert/Alert.tsx +42 -1
- package/src/input/Field.tsx +4 -1
- package/src/input/NumericStepper.tsx +6 -1
- package/src/theme/recipes/badge.ts +19 -3
- package/src/theme/recipes/pressable-card.ts +3 -3
- package/src/theme/slot-recipes/numeric-stepper.ts +3 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vygruppen/spor-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "13.2.
|
|
4
|
+
"version": "13.2.1",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-stately": "^3.31.1",
|
|
48
48
|
"react-swipeable": "^7.0.1",
|
|
49
49
|
"usehooks-ts": "^3.1.0",
|
|
50
|
-
"@vygruppen/spor-design-tokens": "5.0.
|
|
50
|
+
"@vygruppen/spor-design-tokens": "5.0.3",
|
|
51
51
|
"@vygruppen/spor-icon-react": "5.0.0",
|
|
52
52
|
"@vygruppen/spor-loader": "0.7.0"
|
|
53
53
|
},
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"react-dom": "19.2.3",
|
|
65
65
|
"tsup": "^7.2.0",
|
|
66
66
|
"typescript": "^5.7.3",
|
|
67
|
-
"@vygruppen/
|
|
68
|
-
"@vygruppen/
|
|
67
|
+
"@vygruppen/eslint-config": "2.2.0",
|
|
68
|
+
"@vygruppen/tsconfig": "0.1.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"react": ">=19.0.0",
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { IconComponent } from "@vygruppen/spor-icon-react";
|
|
10
10
|
|
|
11
11
|
import { CloseButton } from "@/button";
|
|
12
|
+
import { createTexts, useTranslation } from "@/i18n";
|
|
12
13
|
|
|
13
14
|
import { AlertIcon } from "./AlertIcon";
|
|
14
15
|
|
|
@@ -58,6 +59,7 @@ export const Alert = ({
|
|
|
58
59
|
children,
|
|
59
60
|
} = props;
|
|
60
61
|
const { open, onClose } = useDisclosure({ defaultOpen: true });
|
|
62
|
+
const { t } = useTranslation();
|
|
61
63
|
|
|
62
64
|
const handleAlertClose = () => {
|
|
63
65
|
onClose();
|
|
@@ -67,9 +69,21 @@ export const Alert = ({
|
|
|
67
69
|
const recipe = useSlotRecipe({ key: "alert" });
|
|
68
70
|
const styles = recipe({ variant: props.variant });
|
|
69
71
|
|
|
72
|
+
const getAriaLabelText = () => {
|
|
73
|
+
const variant = props.variant;
|
|
74
|
+
if (variant === "important" || variant === "alt")
|
|
75
|
+
return texts.ariaLabelAlertWarning;
|
|
76
|
+
if (variant === "error" || variant === "error-secondary")
|
|
77
|
+
return texts.ariaLabelAlertError;
|
|
78
|
+
if (variant === "success") return texts.ariaLabelAlertSuccess;
|
|
79
|
+
return texts.ariaLabelAlertInformative;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const ariaLabel = t(getAriaLabelText());
|
|
83
|
+
|
|
70
84
|
if (!open) return null;
|
|
71
85
|
return (
|
|
72
|
-
<ChakraAlert.Root ref={ref} {...props}>
|
|
86
|
+
<ChakraAlert.Root ref={ref} role="alert" aria-label={ariaLabel} {...props}>
|
|
73
87
|
<ChakraAlert.Content
|
|
74
88
|
flexDirection={title ? "column" : "row"}
|
|
75
89
|
data-part="content"
|
|
@@ -114,3 +128,30 @@ export const Alert = ({
|
|
|
114
128
|
</ChakraAlert.Root>
|
|
115
129
|
);
|
|
116
130
|
};
|
|
131
|
+
|
|
132
|
+
const texts = createTexts({
|
|
133
|
+
ariaLabelAlertInformative: {
|
|
134
|
+
en: "Announcement",
|
|
135
|
+
nb: "Kunngjøring",
|
|
136
|
+
nn: "Kunngjering",
|
|
137
|
+
sv: "Meddelande",
|
|
138
|
+
},
|
|
139
|
+
ariaLabelAlertWarning: {
|
|
140
|
+
en: "Warning",
|
|
141
|
+
nb: "Advarsel",
|
|
142
|
+
nn: "Varsel",
|
|
143
|
+
sv: "Varning",
|
|
144
|
+
},
|
|
145
|
+
ariaLabelAlertError: {
|
|
146
|
+
en: "Error",
|
|
147
|
+
nb: "Feil",
|
|
148
|
+
nn: "Feil",
|
|
149
|
+
sv: "Fel",
|
|
150
|
+
},
|
|
151
|
+
ariaLabelAlertSuccess: {
|
|
152
|
+
en: "Success",
|
|
153
|
+
nb: "Suksess",
|
|
154
|
+
nn: "Suksess",
|
|
155
|
+
sv: "Framgång",
|
|
156
|
+
},
|
|
157
|
+
});
|
package/src/input/Field.tsx
CHANGED
|
@@ -54,6 +54,7 @@ export type FieldBaseProps = {
|
|
|
54
54
|
floatingLabel?: boolean;
|
|
55
55
|
shouldFloat?: boolean;
|
|
56
56
|
labelAsChild?: boolean;
|
|
57
|
+
gap?: string | number;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
export type FieldProps = Omit<
|
|
@@ -100,13 +101,14 @@ export const Field = ({
|
|
|
100
101
|
id,
|
|
101
102
|
shouldFloat,
|
|
102
103
|
labelAsChild,
|
|
104
|
+
gap,
|
|
103
105
|
...rest
|
|
104
106
|
} = props;
|
|
105
107
|
const recipe = useSlotRecipe({ key: "field" });
|
|
106
108
|
const styles = recipe();
|
|
107
109
|
|
|
108
110
|
return (
|
|
109
|
-
<Stack
|
|
111
|
+
<Stack ref={ref} width="100%" {...rest}>
|
|
110
112
|
<ChakraField.Root
|
|
111
113
|
disabled={disabled}
|
|
112
114
|
invalid={invalid}
|
|
@@ -115,6 +117,7 @@ export const Field = ({
|
|
|
115
117
|
css={styles.root}
|
|
116
118
|
direction={direction}
|
|
117
119
|
id={id}
|
|
120
|
+
gap={gap}
|
|
118
121
|
>
|
|
119
122
|
{label && !floatingLabel && (
|
|
120
123
|
<Label asChild={labelAsChild} aria-hidden>
|
|
@@ -87,6 +87,7 @@ export const NumericStepper = ({
|
|
|
87
87
|
label,
|
|
88
88
|
helperText,
|
|
89
89
|
errorText,
|
|
90
|
+
gap,
|
|
90
91
|
...rest
|
|
91
92
|
} = props;
|
|
92
93
|
|
|
@@ -116,6 +117,7 @@ export const NumericStepper = ({
|
|
|
116
117
|
invalid={invalid}
|
|
117
118
|
readOnly={readOnly}
|
|
118
119
|
required={required}
|
|
120
|
+
gap={gap}
|
|
119
121
|
>
|
|
120
122
|
<VerySmallButton
|
|
121
123
|
icon={<SubtractIcon stepLabel={clampedStepSize} />}
|
|
@@ -167,7 +169,10 @@ export const NumericStepper = ({
|
|
|
167
169
|
) : (
|
|
168
170
|
<Text
|
|
169
171
|
aria-live="assertive"
|
|
170
|
-
|
|
172
|
+
width={`${Math.max(value.toString().length + 1, 3)}ch`}
|
|
173
|
+
paddingX={0.5}
|
|
174
|
+
padding={0}
|
|
175
|
+
textAlign="center"
|
|
171
176
|
aria-label={
|
|
172
177
|
ariaLabelContext.plural === ""
|
|
173
178
|
? ""
|
|
@@ -66,24 +66,40 @@ export const badgeRecipie = defineRecipe({
|
|
|
66
66
|
color: "icon.critical",
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
|
+
brightRed: {
|
|
70
|
+
backgroundColor: {
|
|
71
|
+
_light: "brightRed",
|
|
72
|
+
_dark: "brightRed",
|
|
73
|
+
},
|
|
74
|
+
color: {
|
|
75
|
+
_light: "pink",
|
|
76
|
+
_dark: "pink",
|
|
77
|
+
},
|
|
78
|
+
"& svg": {
|
|
79
|
+
color: {
|
|
80
|
+
_light: "pink",
|
|
81
|
+
_dark: "pink",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
69
85
|
},
|
|
70
86
|
size: {
|
|
71
87
|
sm: {
|
|
72
|
-
fontSize: "desktop.
|
|
88
|
+
fontSize: "desktop.2xs",
|
|
73
89
|
paddingX: "0.5",
|
|
74
90
|
paddingY: "0",
|
|
75
91
|
fontWeight: "normal",
|
|
76
92
|
borderRadius: "xxs",
|
|
77
93
|
},
|
|
78
94
|
md: {
|
|
79
|
-
fontSize: "desktop.
|
|
95
|
+
fontSize: "desktop.2xs",
|
|
80
96
|
paddingX: "1",
|
|
81
97
|
paddingY: "0.5",
|
|
82
98
|
fontWeight: "bold",
|
|
83
99
|
borderRadius: "xs",
|
|
84
100
|
},
|
|
85
101
|
lg: {
|
|
86
|
-
fontSize: "desktop.
|
|
102
|
+
fontSize: "desktop.xs",
|
|
87
103
|
paddingX: "1.5",
|
|
88
104
|
paddingY: "0.5",
|
|
89
105
|
fontWeight: "bold",
|
|
@@ -64,13 +64,13 @@ export const pressableCardRecipe = defineRecipe({
|
|
|
64
64
|
accent: {
|
|
65
65
|
boxShadow: "0px 1px 3px 0px var(--shadow-color)",
|
|
66
66
|
shadowColor: "surface.disabled",
|
|
67
|
-
background: "surface.
|
|
67
|
+
background: "surface.accent",
|
|
68
68
|
_hover: {
|
|
69
|
-
background: "surface.
|
|
69
|
+
background: "surface.accent.hover",
|
|
70
70
|
|
|
71
71
|
boxShadow: "0px 2px 6px 0px var(--shadow-color)",
|
|
72
72
|
_active: {
|
|
73
|
-
background: "surface.
|
|
73
|
+
background: "surface.accent.active",
|
|
74
74
|
boxShadow: "none",
|
|
75
75
|
},
|
|
76
76
|
},
|
|
@@ -11,16 +11,17 @@ export const numericStepperRecipe = defineSlotRecipe({
|
|
|
11
11
|
display: "flex",
|
|
12
12
|
flexDirection: "row",
|
|
13
13
|
alignItems: "center",
|
|
14
|
+
gap: 1,
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
input: {
|
|
17
18
|
fontSize: "sm",
|
|
18
19
|
fontWeight: "bold",
|
|
19
|
-
marginX: 0.5,
|
|
20
20
|
padding: 0,
|
|
21
21
|
paddingX: 0.5,
|
|
22
22
|
borderRadius: "xs",
|
|
23
|
-
outline: "
|
|
23
|
+
outline: "1px solid",
|
|
24
|
+
outlineColor: "outline.core",
|
|
24
25
|
height: "auto",
|
|
25
26
|
textAlign: "center",
|
|
26
27
|
transitionProperty: "common",
|