@vygruppen/spor-react 12.8.5 → 12.8.7
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 +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +33 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +33 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/datepicker/CalendarTriggerButton.tsx +3 -3
- package/src/datepicker/DateField.tsx +4 -6
- package/src/datepicker/DatePicker.tsx +0 -4
- package/src/datepicker/StyledField.tsx +1 -4
- package/src/datepicker/TimeField.tsx +5 -1
- 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/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.7",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -67,8 +67,8 @@
|
|
67
67
|
"vitest": "^0.26.3",
|
68
68
|
"vitest-axe": "^0.1.0",
|
69
69
|
"vitest-canvas-mock": "^0.2.2",
|
70
|
-
"@vygruppen/
|
71
|
-
"@vygruppen/
|
70
|
+
"@vygruppen/tsconfig": "0.1.1",
|
71
|
+
"@vygruppen/eslint-config": "1.1.1"
|
72
72
|
},
|
73
73
|
"peerDependencies": {
|
74
74
|
"react": ">=18.0.0 <19.0.0",
|
@@ -18,12 +18,13 @@ type CalendarTriggerButtonProps = AriaButtonProps<"button"> &
|
|
18
18
|
BoxProps &
|
19
19
|
CalendarVariants & {
|
20
20
|
disabled?: boolean;
|
21
|
-
ariaLabelledby?: string;
|
22
21
|
};
|
23
22
|
export const CalendarTriggerButton = forwardRef<
|
24
23
|
HTMLDivElement,
|
25
24
|
CalendarTriggerButtonProps
|
26
|
-
|
25
|
+
// onPress is extracted because it is not supported by chakra.
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
27
|
+
>(({ variant, disabled, onPress: _, ...buttonProps }, ref) => {
|
27
28
|
const { t } = useTranslation();
|
28
29
|
|
29
30
|
const recipe = useSlotRecipe({
|
@@ -39,7 +40,6 @@ export const CalendarTriggerButton = forwardRef<
|
|
39
40
|
css={styles.calendarTriggerButton}
|
40
41
|
variant="ghost"
|
41
42
|
disabled={disabled}
|
42
|
-
aria-labelledby={ariaLabelledby}
|
43
43
|
/>
|
44
44
|
</PopoverAnchor>
|
45
45
|
);
|
@@ -27,10 +27,9 @@ type DateFieldProps = AriaDateFieldProps<DateValue> &
|
|
27
27
|
label?: React.ReactNode;
|
28
28
|
labelProps?: DOMAttributes<FocusableElement>;
|
29
29
|
name?: string;
|
30
|
-
labelId?: string;
|
31
30
|
};
|
32
31
|
export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
33
|
-
(
|
32
|
+
(props, externalRef) => {
|
34
33
|
const locale = useCurrentLocale();
|
35
34
|
|
36
35
|
const recipe = useSlotRecipe({
|
@@ -57,13 +56,12 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
57
56
|
<Box minWidth="6rem" width="100%">
|
58
57
|
{props.label && (
|
59
58
|
<Box
|
60
|
-
|
59
|
+
asChild
|
61
60
|
css={styles.inputLabel}
|
62
61
|
position="absolute"
|
63
62
|
paddingTop="2px"
|
64
|
-
id={labelId}
|
65
63
|
>
|
66
|
-
{props.label}
|
64
|
+
<label {...props.labelProps}>{props.label}</label>
|
67
65
|
</Box>
|
68
66
|
)}
|
69
67
|
<Flex {...fieldProps} ref={ref} paddingTop="3" paddingBottom="0.5">
|
@@ -72,7 +70,6 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
72
70
|
key={i}
|
73
71
|
segment={segment}
|
74
72
|
ariaDescription={t(getAriaLabel(segment.type))}
|
75
|
-
ariaLabel={labelId}
|
76
73
|
state={state}
|
77
74
|
/>
|
78
75
|
))}
|
@@ -81,6 +78,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
81
78
|
type="hidden"
|
82
79
|
value={state.value?.toString() ?? ""}
|
83
80
|
name={props.name}
|
81
|
+
id={props.id}
|
84
82
|
/>
|
85
83
|
</Box>
|
86
84
|
);
|
@@ -88,7 +88,6 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
88
88
|
ref as React.MutableRefObject<HTMLDivElement>,
|
89
89
|
);
|
90
90
|
|
91
|
-
const labelId = `label-${useId()}`;
|
92
91
|
const inputGroupId = `input-group-${useId()}`;
|
93
92
|
|
94
93
|
const recipe = useSlotRecipe({
|
@@ -128,7 +127,6 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
128
127
|
<Field
|
129
128
|
display="inline-flex"
|
130
129
|
id={inputGroupId}
|
131
|
-
aria-labelledby={labelId}
|
132
130
|
errorText={errorText}
|
133
131
|
invalid={invalid}
|
134
132
|
helperText={helperText}
|
@@ -140,7 +138,6 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
140
138
|
paddingX={3}
|
141
139
|
minHeight={minHeight}
|
142
140
|
isDisabled={props.isDisabled}
|
143
|
-
ariaLabelledby={labelId}
|
144
141
|
>
|
145
142
|
<ChakraPopover.Trigger asChild>
|
146
143
|
<CalendarTriggerButton
|
@@ -154,7 +151,6 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
154
151
|
<DateField
|
155
152
|
label={props.label}
|
156
153
|
labelProps={labelProps}
|
157
|
-
labelId={labelId}
|
158
154
|
name={props.name}
|
159
155
|
{...fieldProps}
|
160
156
|
/>
|
@@ -14,12 +14,10 @@ type StyledFieldProps = BoxProps &
|
|
14
14
|
PropsWithChildren<DatePickerVariantProps> &
|
15
15
|
CalendarVariants & {
|
16
16
|
isDisabled?: boolean;
|
17
|
-
ariaLabelledby?: string;
|
18
17
|
};
|
19
18
|
export const StyledField = forwardRef<HTMLDivElement, StyledFieldProps>(
|
20
19
|
function StyledField(props, ref) {
|
21
|
-
const { children, variant, isDisabled,
|
22
|
-
props;
|
20
|
+
const { children, variant, isDisabled, ...otherProps } = props;
|
23
21
|
const { invalid } = useFieldContext() ?? {
|
24
22
|
isInvalid: false,
|
25
23
|
};
|
@@ -36,7 +34,6 @@ export const StyledField = forwardRef<HTMLDivElement, StyledFieldProps>(
|
|
36
34
|
ref={ref}
|
37
35
|
aria-invalid={invalid}
|
38
36
|
aria-disabled={isDisabled}
|
39
|
-
aria-labelledby={ariaLabelledby}
|
40
37
|
>
|
41
38
|
{children}
|
42
39
|
</Box>
|
@@ -39,7 +39,11 @@ export const TimeField = ({ state, ...props }: TimeFieldProps) => {
|
|
39
39
|
</label>
|
40
40
|
<Flex {...fieldProps} ref={ref} paddingTop="3" paddingBottom="0.5">
|
41
41
|
{state.segments.map((segment: DateSegment) => (
|
42
|
-
<DateTimeSegment
|
42
|
+
<DateTimeSegment
|
43
|
+
key={JSON.stringify(segment)}
|
44
|
+
segment={segment}
|
45
|
+
state={state}
|
46
|
+
/>
|
43
47
|
))}
|
44
48
|
</Flex>
|
45
49
|
<input
|
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
|
},
|