@vygruppen/spor-react 13.0.1 → 13.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
3
  "type": "module",
4
- "version": "13.0.1",
4
+ "version": "13.0.2",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -46,9 +46,9 @@
46
46
  "react-stately": "^3.31.1",
47
47
  "react-swipeable": "^7.0.1",
48
48
  "usehooks-ts": "^3.1.0",
49
+ "@vygruppen/spor-design-tokens": "4.3.3",
49
50
  "@vygruppen/spor-icon-react": "5.0.0",
50
- "@vygruppen/spor-loader": "0.7.0",
51
- "@vygruppen/spor-design-tokens": "4.3.3"
51
+ "@vygruppen/spor-loader": "0.7.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@react-types/datepicker": "^3.10.0",
@@ -12,9 +12,7 @@ import {
12
12
  SuccessFill24Icon,
13
13
  WarningFill24Icon,
14
14
  } from "@vygruppen/spor-icon-react";
15
- import { VisuallyHidden } from "react-aria";
16
15
 
17
- import { createTexts, useTranslation } from "../i18n";
18
16
  import { AlertProps } from "./Alert";
19
17
 
20
18
  type AlertIconProps = {
@@ -32,11 +30,8 @@ export const AlertIcon = ({
32
30
  }: AlertIconProps & {
33
31
  ref?: React.Ref<SVGSVGElement>;
34
32
  }) => {
35
- const { t } = useTranslation();
36
-
37
33
  return (
38
34
  <Box ref={ref}>
39
- <VisuallyHidden>{t(texts[variant as keyof typeof texts])}</VisuallyHidden>
40
35
  {CustomAlertIcon ? (
41
36
  <CustomAlertIcon color={`alert.${variant}.icon`} />
42
37
  ) : (
@@ -90,54 +85,3 @@ export const BaseAlertIcon = ({
90
85
  }
91
86
  }
92
87
  };
93
-
94
- const texts = createTexts({
95
- info: {
96
- nb: "Informasjon",
97
- nn: "Informasjon",
98
- sv: "Information",
99
- en: "Information",
100
- },
101
- success: {
102
- nb: "Suksess",
103
- nn: "Suksess",
104
- sv: "Succé",
105
- en: "Success",
106
- },
107
- important: {
108
- nb: "Viktig",
109
- nn: "Viktig",
110
- sv: "Viktig",
111
- en: "Important",
112
- },
113
- alt: {
114
- nb: "Alternativ",
115
- nn: "Alternativ",
116
- sv: "Alternativ",
117
- en: "Alternative",
118
- },
119
- error: {
120
- nb: "Feil",
121
- nn: "Feil",
122
- sv: "Fel",
123
- en: "Error",
124
- },
125
- "error-secondary": {
126
- nb: "Feil",
127
- nn: "Feil",
128
- sv: "Fel",
129
- en: "Error",
130
- },
131
- neutral: {
132
- nb: "Nøytral",
133
- nn: "Nøytral",
134
- sv: "Neutral",
135
- en: "Neutral",
136
- },
137
- service: {
138
- nb: "Service",
139
- nn: "Service",
140
- sv: "Service",
141
- en: "Service",
142
- },
143
- });
@@ -59,6 +59,9 @@ export const Switch = ({
59
59
  errorText,
60
60
  helperText,
61
61
  css,
62
+ "aria-label": ariaLabel,
63
+ "aria-labelledby": ariaLabelledby,
64
+ "aria-describedby": ariaDescribedby,
62
65
  ...rest
63
66
  } = props;
64
67
  const recipe = useSlotRecipe({ key: "switch" });
@@ -80,7 +83,12 @@ export const Switch = ({
80
83
  checked={props.checked}
81
84
  css={styles.root}
82
85
  >
83
- <ChakraSwitch.HiddenInput ref={ref} />
86
+ <ChakraSwitch.HiddenInput
87
+ ref={ref}
88
+ aria-label={ariaLabel}
89
+ aria-labelledby={ariaLabelledby}
90
+ aria-describedby={ariaDescribedby}
91
+ />
84
92
  <ChakraSwitch.Control css={styles.control}>
85
93
  <ChakraSwitch.Thumb />
86
94
  </ChakraSwitch.Control>
@@ -11,5 +11,5 @@ export const Separator = ({
11
11
  }: ChakraSeparatorProps & {
12
12
  ref?: React.Ref<HTMLDivElement>;
13
13
  }) => {
14
- return <ChakraSeparator {...props} ref={ref} data- />;
14
+ return <ChakraSeparator aria-hidden="true" {...props} ref={ref} data- />;
15
15
  };
@@ -15,6 +15,7 @@ export const linkRecipe = defineRecipe({
15
15
  paddingX: "0.5",
16
16
  whiteSpace: "normal",
17
17
  wordBreak: "break-word",
18
+ paddingInline: 0,
18
19
 
19
20
  _hover: {
20
21
  textDecoration: "none",
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import {
4
+ BoxProps,
4
5
  createToaster,
5
6
  Portal,
6
7
  Stack,
@@ -22,19 +23,21 @@ type ToastProps = {
22
23
  text: string;
23
24
  variant: Variant;
24
25
  id?: string;
25
- };
26
+ } & Pick<BoxProps, "width">;
26
27
 
27
28
  export const createToast = ({
28
29
  text,
29
30
  variant,
30
31
  id,
31
32
  duration = 6000,
33
+ width = "sm",
32
34
  }: ToastProps) =>
33
35
  toaster.create({
34
36
  description: text,
35
37
  type: variant,
36
38
  id: id ?? crypto.randomUUID(),
37
39
  duration,
40
+ meta: { width },
38
41
  });
39
42
 
40
43
  export const Toaster = () => {
@@ -42,7 +45,7 @@ export const Toaster = () => {
42
45
  <Portal>
43
46
  <ChakraToaster toaster={toaster} insetInline={{ mdDown: "4" }}>
44
47
  {(toast) => (
45
- <Toast.Root width={{ md: "sm" }} role="alert">
48
+ <Toast.Root width={{ md: toast.meta?.width }} role="alert">
46
49
  <AlertIcon variant={toast.type as Variant} />
47
50
  <Stack gap="1" flex="1" maxWidth="100%">
48
51
  <Toast.Description>{toast.description}</Toast.Description>