@vygruppen/spor-react 12.8.6 → 12.8.8
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 +8 -8
- package/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +65 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +65 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/datepicker/DatePicker.tsx +1 -0
- package/src/datepicker/DateRangePicker.tsx +1 -0
- package/src/input/Field.tsx +12 -2
- package/src/input/Input.tsx +2 -0
- package/src/input/Select.tsx +6 -1
- package/src/input/Switch.tsx +1 -0
- package/src/link/TextLink.tsx +2 -2
- package/src/theme/recipes/link.ts +14 -23
- package/src/theme/slot-recipes/checkbox.ts +3 -1
- package/src/theme/slot-recipes/field.ts +3 -0
- package/src/typography/Heading.tsx +13 -6
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "12.8.
|
4
|
+
"version": "12.8.8",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -47,8 +47,8 @@
|
|
47
47
|
"react-swipeable": "^7.0.1",
|
48
48
|
"usehooks-ts": "^3.1.0",
|
49
49
|
"@vygruppen/spor-design-tokens": "4.0.7",
|
50
|
-
"@vygruppen/spor-
|
51
|
-
"@vygruppen/spor-
|
50
|
+
"@vygruppen/spor-loader": "0.7.0",
|
51
|
+
"@vygruppen/spor-icon-react": "4.2.1"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|
54
54
|
"@react-types/datepicker": "^3.10.0",
|
package/src/input/Field.tsx
CHANGED
@@ -80,11 +80,21 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
80
80
|
css={styles.root}
|
81
81
|
direction={direction}
|
82
82
|
>
|
83
|
-
{label && !floatingLabel &&
|
83
|
+
{label && !floatingLabel && (
|
84
|
+
<Label>
|
85
|
+
{label}
|
86
|
+
<ChakraField.RequiredIndicator />
|
87
|
+
</Label>
|
88
|
+
)}
|
84
89
|
|
85
90
|
{children}
|
86
91
|
|
87
|
-
{label && floatingLabel &&
|
92
|
+
{label && floatingLabel && (
|
93
|
+
<FloatingLabel>
|
94
|
+
{label}
|
95
|
+
<ChakraField.RequiredIndicator />
|
96
|
+
</FloatingLabel>
|
97
|
+
)}
|
88
98
|
{errorText && (
|
89
99
|
<ChakraField.ErrorText>{errorText}</ChakraField.ErrorText>
|
90
100
|
)}
|
package/src/input/Input.tsx
CHANGED
@@ -64,6 +64,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
64
64
|
invalid,
|
65
65
|
helperText,
|
66
66
|
errorText,
|
67
|
+
required,
|
67
68
|
...props
|
68
69
|
},
|
69
70
|
ref,
|
@@ -76,6 +77,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
76
77
|
<Field
|
77
78
|
invalid={invalid}
|
78
79
|
helperText={helperText}
|
80
|
+
required={required}
|
79
81
|
errorText={errorText}
|
80
82
|
label={
|
81
83
|
// Render startElement invisibly to align label text with input content when an icon is present
|
package/src/input/Select.tsx
CHANGED
@@ -72,7 +72,12 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
72
72
|
const styles = recipe({ variant });
|
73
73
|
|
74
74
|
return (
|
75
|
-
<Field
|
75
|
+
<Field
|
76
|
+
errorText={errorText}
|
77
|
+
invalid={invalid}
|
78
|
+
helperText={helperText}
|
79
|
+
required={props.required}
|
80
|
+
>
|
76
81
|
<ChakraSelect.Root
|
77
82
|
{...rest}
|
78
83
|
ref={ref}
|
package/src/input/Switch.tsx
CHANGED
package/src/link/TextLink.tsx
CHANGED
@@ -37,9 +37,9 @@ const ExternalIcon = ({
|
|
37
37
|
}) => (
|
38
38
|
<>
|
39
39
|
{size === "lg" || size === "md" ? (
|
40
|
-
<LinkOutOutline24Icon aria-hidden />
|
40
|
+
<LinkOutOutline24Icon aria-hidden display="inline" />
|
41
41
|
) : (
|
42
|
-
<LinkOutOutline18Icon aria-hidden />
|
42
|
+
<LinkOutOutline18Icon aria-hidden display="inline" />
|
43
43
|
)}
|
44
44
|
{/* Visually hidden text for screen readers */}
|
45
45
|
<VisuallyHidden>{label}</VisuallyHidden>
|
@@ -2,34 +2,25 @@ import { defineRecipe } from "@chakra-ui/react";
|
|
2
2
|
|
3
3
|
export const linkRecipe = defineRecipe({
|
4
4
|
base: {
|
5
|
-
|
6
|
-
transitionDuration: "fast",
|
7
|
-
transitionTimingFunction: "ease-out",
|
8
|
-
cursor: "pointer",
|
9
|
-
backgroundImage: "linear-gradient(currentColor, currentColor)",
|
10
|
-
backgroundSize: "100% 1px",
|
11
|
-
backgroundPosition: "0 100%",
|
12
|
-
backgroundRepeat: "no-repeat",
|
13
|
-
borderRadius: "none",
|
14
|
-
paddingX: "2px",
|
15
|
-
paddingY: "0",
|
5
|
+
display: "inline",
|
16
6
|
color: "inherit",
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
7
|
+
cursor: "pointer",
|
8
|
+
textDecorationLine: "underline",
|
9
|
+
textDecorationSkipInk: "none",
|
10
|
+
textUnderlineOffset: "auto",
|
11
|
+
textUnderlinePosition: "from-font",
|
12
|
+
|
13
|
+
gap: "0.5",
|
14
|
+
borderRadius: "xs",
|
15
|
+
paddingX: "0.5",
|
16
|
+
whiteSpace: "normal",
|
17
|
+
wordBreak: "break-word",
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
backgroundSize: "100%",
|
27
|
-
outline: "none",
|
28
|
-
borderRadius: "xs",
|
19
|
+
_hover: {
|
20
|
+
textDecoration: "none",
|
29
21
|
},
|
30
22
|
|
31
23
|
"& svg": {
|
32
|
-
display: "inline-block",
|
33
24
|
width: "1.125em",
|
34
25
|
height: "1.125em",
|
35
26
|
position: "relative",
|
@@ -8,6 +8,8 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
8
8
|
slots: checkboxAnatomy.keys(),
|
9
9
|
base: {
|
10
10
|
root: {
|
11
|
+
whiteSpace: "normal",
|
12
|
+
wordBreak: "break-word",
|
11
13
|
display: "flex",
|
12
14
|
gap: 1.5,
|
13
15
|
_hover: {
|
@@ -35,6 +37,7 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
35
37
|
control: {
|
36
38
|
width: 4,
|
37
39
|
height: 4,
|
40
|
+
flexShrink: 0,
|
38
41
|
transitionProperty: "background, border-color",
|
39
42
|
transitionDuration: "moderate",
|
40
43
|
border: "2px solid",
|
@@ -77,7 +80,6 @@ export const checkboxSlotRecipe = defineSlotRecipe({
|
|
77
80
|
},
|
78
81
|
},
|
79
82
|
label: {
|
80
|
-
userSelect: "none",
|
81
83
|
_disabled: { opacity: 0.4 },
|
82
84
|
},
|
83
85
|
},
|
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
HeadingProps as ChakraHeadingProps,
|
5
5
|
Text,
|
6
6
|
} from "@chakra-ui/react";
|
7
|
-
import { forwardRef } from "react";
|
7
|
+
import { forwardRef, useId } from "react";
|
8
8
|
|
9
9
|
import { slugify } from "..";
|
10
10
|
|
@@ -52,11 +52,18 @@ export const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(
|
|
52
52
|
...rest
|
53
53
|
} = props;
|
54
54
|
|
55
|
-
const
|
56
|
-
(externalId ?? (autoId && typeof rest.children === "string"))
|
57
|
-
? slugify(rest.children as string)
|
58
|
-
: undefined;
|
55
|
+
const reactId = useId();
|
59
56
|
|
60
|
-
|
57
|
+
function getId() {
|
58
|
+
if (externalId !== undefined) return externalId;
|
59
|
+
if (!autoId) return;
|
60
|
+
return typeof rest.children === "string"
|
61
|
+
? slugify(rest.children)
|
62
|
+
: reactId;
|
63
|
+
}
|
64
|
+
|
65
|
+
return (
|
66
|
+
<Text as={as} textStyle={variant} id={getId()} ref={ref} {...rest} />
|
67
|
+
);
|
61
68
|
},
|
62
69
|
);
|