@vygruppen/spor-react 12.8.5 → 12.8.6

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": "12.8.5",
4
+ "version": "12.8.6",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -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
- >(({ variant, disabled, ariaLabelledby, ...buttonProps }, ref) => {
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
- ({ labelId, ...props }, externalRef) => {
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
- as="label"
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, ariaLabelledby, ...otherProps } =
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 key={segment.type} segment={segment} state={state} />
42
+ <DateTimeSegment
43
+ key={JSON.stringify(segment)}
44
+ segment={segment}
45
+ state={state}
46
+ />
43
47
  ))}
44
48
  </Flex>
45
49
  <input