@vygruppen/spor-react 12.24.9 → 12.24.11
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 +2 -2
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +26 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/accordion/Accordion.tsx +8 -3
- package/src/input/Autocomplete.tsx +9 -10
- package/src/layout/RadioCard.tsx +16 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vygruppen/spor-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.24.
|
|
4
|
+
"version": "12.24.11",
|
|
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-icon-react": "4.5.
|
|
50
|
-
"@vygruppen/spor-
|
|
51
|
-
"@vygruppen/spor-
|
|
49
|
+
"@vygruppen/spor-icon-react": "4.5.3",
|
|
50
|
+
"@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",
|
|
@@ -106,14 +106,19 @@ export const AccordionItemContent = forwardRef<
|
|
|
106
106
|
HTMLDivElement,
|
|
107
107
|
AccordionItemContentProps
|
|
108
108
|
>(function AccordionItemContent(props, ref) {
|
|
109
|
-
const { children } = props;
|
|
109
|
+
const { children, "aria-labelledby": ariaLabelledBy, ...otherProps } = props;
|
|
110
110
|
|
|
111
111
|
const recipe = useSlotRecipe({ key: "accordion" });
|
|
112
112
|
const styles = recipe();
|
|
113
113
|
|
|
114
|
+
// We need to be able to override aria-labelledby here to prevent an issue on voiceover on iPhone where the related AccordionItemTrigger
|
|
115
|
+
// is announced after announcing the ItemContent. This issue occurs because the default aria-labelledby is set to the id of the AccordionItemTrigger.
|
|
114
116
|
return (
|
|
115
|
-
<ChakraAccordion.ItemContent
|
|
116
|
-
|
|
117
|
+
<ChakraAccordion.ItemContent
|
|
118
|
+
css={styles.itemContent}
|
|
119
|
+
aria-labelledby={ariaLabelledBy}
|
|
120
|
+
>
|
|
121
|
+
<ChakraAccordion.ItemBody {...otherProps} ref={ref}>
|
|
117
122
|
{children}
|
|
118
123
|
</ChakraAccordion.ItemBody>
|
|
119
124
|
</ChakraAccordion.ItemContent>
|
|
@@ -73,7 +73,7 @@ export const Autocomplete = ({
|
|
|
73
73
|
|
|
74
74
|
const combobox = useCombobox({
|
|
75
75
|
collection,
|
|
76
|
-
openOnClick,
|
|
76
|
+
openOnClick: filteredChildren.length > 0 ? openOnClick : false,
|
|
77
77
|
onInputValueChange: (event) => {
|
|
78
78
|
if (!filteredExternally) {
|
|
79
79
|
filter(event.inputValue);
|
|
@@ -107,26 +107,25 @@ export const Autocomplete = ({
|
|
|
107
107
|
required={required}
|
|
108
108
|
onFocus={(event) => {
|
|
109
109
|
onFocus?.(event);
|
|
110
|
-
if (openOnFocus
|
|
110
|
+
if (openOnFocus && filteredChildren.length > 0)
|
|
111
|
+
combobox.setOpen(true);
|
|
111
112
|
}}
|
|
112
113
|
/>
|
|
113
114
|
</Combobox.Input>
|
|
114
115
|
<Combobox.IndicatorGroup>
|
|
115
116
|
<Combobox.ClearTrigger asChild aria-label={t(texts.clearValue)}>
|
|
116
|
-
<CloseButton size="xs" />
|
|
117
|
+
<CloseButton size="xs" tabIndex={0} />
|
|
117
118
|
</Combobox.ClearTrigger>
|
|
118
119
|
</Combobox.IndicatorGroup>
|
|
119
120
|
</Combobox.Control>
|
|
120
121
|
<Combobox.Positioner>
|
|
121
122
|
<Combobox.Content>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<ColorSpinner width="1.5rem" p="2" />
|
|
127
|
-
) : (
|
|
128
|
-
<>{filteredChildren}</>
|
|
123
|
+
{!loading && (
|
|
124
|
+
<Combobox.Empty>
|
|
125
|
+
{emptyLabel ?? t(texts.noItemsFound)}
|
|
126
|
+
</Combobox.Empty>
|
|
129
127
|
)}
|
|
128
|
+
{loading ? <ColorSpinner width="1.5rem" p="2" /> : filteredChildren}
|
|
130
129
|
</Combobox.Content>
|
|
131
130
|
</Combobox.Positioner>
|
|
132
131
|
</Combobox.RootProvider>
|
package/src/layout/RadioCard.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
RecipeVariantProps,
|
|
5
5
|
useSlotRecipe,
|
|
6
6
|
} from "@chakra-ui/react";
|
|
7
|
-
import React, { forwardRef } from "react";
|
|
7
|
+
import React, { forwardRef, useId } from "react";
|
|
8
8
|
|
|
9
9
|
import { radioCardSlotRecipe } from "../theme/slot-recipes/radio-card";
|
|
10
10
|
|
|
@@ -41,12 +41,24 @@ type RadioCardItemProps = Exclude<
|
|
|
41
41
|
export const RadioCard = forwardRef<HTMLInputElement, RadioCardItemProps>(
|
|
42
42
|
(props, ref) => {
|
|
43
43
|
const { inputProps, children } = props;
|
|
44
|
+
const uniqueId = useId();
|
|
45
|
+
const itemControlId = `radio-card-item-control-${uniqueId}`;
|
|
46
|
+
|
|
47
|
+
const inputHasAriaLabel =
|
|
48
|
+
inputProps?.["aria-labelledby"] || inputProps?.["aria-label"];
|
|
44
49
|
|
|
45
50
|
return (
|
|
46
51
|
<ChakraRadioCard.Item {...props}>
|
|
47
|
-
<ChakraRadioCard.ItemHiddenInput
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
<ChakraRadioCard.ItemHiddenInput
|
|
53
|
+
aria-labelledby={
|
|
54
|
+
inputHasAriaLabel ? inputProps?.["aria-labelledby"] : itemControlId
|
|
55
|
+
}
|
|
56
|
+
ref={ref}
|
|
57
|
+
{...inputProps}
|
|
58
|
+
/>
|
|
59
|
+
<ChakraRadioCard.ItemControl id={itemControlId} aria-hidden>
|
|
60
|
+
{children}
|
|
61
|
+
</ChakraRadioCard.ItemControl>
|
|
50
62
|
</ChakraRadioCard.Item>
|
|
51
63
|
);
|
|
52
64
|
},
|