@vygruppen/spor-react 12.24.4 → 12.24.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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +211 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.mjs +211 -192
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/input/Autocomplete.tsx +8 -1
- package/src/input/Select.tsx +20 -6
- package/src/theme/slot-recipes/switch.ts +14 -15
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.6",
|
|
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.3.3",
|
|
50
|
-
"@vygruppen/spor-
|
|
51
|
-
"@vygruppen/spor-
|
|
50
|
+
"@vygruppen/spor-loader": "0.7.0",
|
|
51
|
+
"@vygruppen/spor-icon-react": "4.5.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@react-types/datepicker": "^3.10.0",
|
|
@@ -116,7 +116,14 @@ export const Autocomplete = ({
|
|
|
116
116
|
</Combobox.IndicatorGroup>
|
|
117
117
|
</Combobox.Control>
|
|
118
118
|
<Combobox.Positioner>
|
|
119
|
-
<Combobox.Content
|
|
119
|
+
<Combobox.Content
|
|
120
|
+
onBlur={(event) => {
|
|
121
|
+
// Close if focus moves outside the content, necessary for iPhone VoiceOver
|
|
122
|
+
if (!event.currentTarget.contains(event.relatedTarget as Node)) {
|
|
123
|
+
combobox.setOpen(false);
|
|
124
|
+
}
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
120
127
|
<Combobox.Empty>
|
|
121
128
|
{!loading && (emptyLabel ?? t(texts.noItemsFound))}
|
|
122
129
|
</Combobox.Empty>
|
package/src/input/Select.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
CollectionItem,
|
|
5
5
|
SelectLabelProps,
|
|
6
6
|
SelectRootProps as ChakraSelectRootProps,
|
|
7
|
+
SystemStyleObject,
|
|
7
8
|
} from "@chakra-ui/react";
|
|
8
9
|
import {
|
|
9
10
|
Box,
|
|
@@ -66,6 +67,7 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
|
66
67
|
errorText,
|
|
67
68
|
invalid,
|
|
68
69
|
helperText,
|
|
70
|
+
css,
|
|
69
71
|
...rest
|
|
70
72
|
} = props;
|
|
71
73
|
const recipe = useSlotRecipe({ key: "select" });
|
|
@@ -78,6 +80,7 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
|
78
80
|
helperText={helperText}
|
|
79
81
|
required={props.required}
|
|
80
82
|
id={rest.id}
|
|
83
|
+
css={css}
|
|
81
84
|
>
|
|
82
85
|
<ChakraSelect.Root
|
|
83
86
|
{...rest}
|
|
@@ -91,7 +94,9 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
|
|
|
91
94
|
<SelectValueText withPlaceholder={label ? true : false} />
|
|
92
95
|
</SelectTrigger>
|
|
93
96
|
{label && <SelectLabel css={styles.label}>{label}</SelectLabel>}
|
|
94
|
-
<SelectContent css={styles.selectContent}
|
|
97
|
+
<SelectContent css={styles.selectContent} baseStyle={css}>
|
|
98
|
+
{children}
|
|
99
|
+
</SelectContent>
|
|
95
100
|
</ChakraSelect.Root>
|
|
96
101
|
</Field>
|
|
97
102
|
);
|
|
@@ -127,7 +132,11 @@ export const SelectItem = React.forwardRef<HTMLDivElement, SelectItemProps>(
|
|
|
127
132
|
<ChakraSelect.ItemText display="flex">
|
|
128
133
|
{children}
|
|
129
134
|
</ChakraSelect.ItemText>
|
|
130
|
-
{description &&
|
|
135
|
+
{description && (
|
|
136
|
+
<Box data-part="item-description" css={styles.itemDescription}>
|
|
137
|
+
{description}
|
|
138
|
+
</Box>
|
|
139
|
+
)}
|
|
131
140
|
</Box>
|
|
132
141
|
|
|
133
142
|
<ChakraSelect.ItemIndicator>
|
|
@@ -174,9 +183,12 @@ export const SelectTrigger = React.forwardRef<
|
|
|
174
183
|
<ChakraSelect.Trigger ref={ref} css={styles.trigger}>
|
|
175
184
|
{children}
|
|
176
185
|
</ChakraSelect.Trigger>
|
|
177
|
-
<ChakraSelect.IndicatorGroup
|
|
186
|
+
<ChakraSelect.IndicatorGroup
|
|
187
|
+
css={styles.indicatorGroup}
|
|
188
|
+
data-part="indicator-group"
|
|
189
|
+
>
|
|
178
190
|
{clearable && <SelectClearTrigger />}
|
|
179
|
-
<Box css={styles.indicator}>
|
|
191
|
+
<Box css={styles.indicator} data-part="indicator">
|
|
180
192
|
<DropdownDownFill24Icon />
|
|
181
193
|
</Box>
|
|
182
194
|
</ChakraSelect.IndicatorGroup>
|
|
@@ -207,16 +219,18 @@ const SelectClearTrigger = React.forwardRef<
|
|
|
207
219
|
type SelectContentProps = ChakraSelect.ContentProps & {
|
|
208
220
|
portalled?: boolean;
|
|
209
221
|
portalRef?: React.RefObject<HTMLElement>;
|
|
222
|
+
baseStyle?: SystemStyleObject;
|
|
210
223
|
};
|
|
211
224
|
|
|
212
225
|
export const SelectContent = React.forwardRef<
|
|
213
226
|
HTMLDivElement,
|
|
214
227
|
SelectContentProps
|
|
215
228
|
>(function SelectContent(props, ref) {
|
|
216
|
-
const { portalled = true, portalRef, ...rest } = props;
|
|
229
|
+
const { portalled = true, portalRef, baseStyle, ...rest } = props;
|
|
230
|
+
|
|
217
231
|
return (
|
|
218
232
|
<Portal disabled={!portalled} container={portalRef}>
|
|
219
|
-
<ChakraSelect.Positioner>
|
|
233
|
+
<ChakraSelect.Positioner css={baseStyle}>
|
|
220
234
|
<ChakraSelect.Content {...rest} ref={ref} />
|
|
221
235
|
</ChakraSelect.Positioner>
|
|
222
236
|
</Portal>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
|
2
|
-
import tokens from "@vygruppen/spor-design-tokens";
|
|
3
2
|
|
|
4
3
|
import { switchAnatomy } from "./anatomy";
|
|
5
4
|
|
|
@@ -57,7 +56,6 @@ export const switchSlotRecipe = defineSlotRecipe({
|
|
|
57
56
|
control: {
|
|
58
57
|
boxSizing: "content-box",
|
|
59
58
|
padding: 0.5,
|
|
60
|
-
|
|
61
59
|
display: "inline-flex",
|
|
62
60
|
gap: 1.5,
|
|
63
61
|
flexShrink: 0,
|
|
@@ -69,7 +67,8 @@ export const switchSlotRecipe = defineSlotRecipe({
|
|
|
69
67
|
height: "var(--switch-height)",
|
|
70
68
|
transitionProperty: "common",
|
|
71
69
|
transitionDuration: "fast",
|
|
72
|
-
outline: "
|
|
70
|
+
outline: "1px solid",
|
|
71
|
+
outlineOffset: "-1px",
|
|
73
72
|
outlineColor: "core.outline",
|
|
74
73
|
_hover: {
|
|
75
74
|
outline: "2px solid",
|
|
@@ -83,14 +82,17 @@ export const switchSlotRecipe = defineSlotRecipe({
|
|
|
83
82
|
_focusVisible: {
|
|
84
83
|
outlineWidth: "2px",
|
|
85
84
|
outlineColor: "outline.focus",
|
|
86
|
-
outlineStyle: "
|
|
85
|
+
outlineStyle: "double",
|
|
87
86
|
},
|
|
88
87
|
|
|
89
88
|
_checked: {
|
|
90
89
|
backgroundColor: "brand.surface",
|
|
90
|
+
outline: "none",
|
|
91
91
|
_focusVisible: {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
outlineOffset: "1px",
|
|
93
|
+
outlineStyle: "solid",
|
|
94
|
+
outlineColor: "outline.focus",
|
|
95
|
+
outlineWidth: "2px",
|
|
94
96
|
},
|
|
95
97
|
},
|
|
96
98
|
_disabled: {
|
|
@@ -113,32 +115,29 @@ export const switchSlotRecipe = defineSlotRecipe({
|
|
|
113
115
|
size: {
|
|
114
116
|
sm: {
|
|
115
117
|
root: {
|
|
116
|
-
"--switch-width": "
|
|
117
|
-
"--switch-height": "1.
|
|
118
|
+
"--switch-width": "3rem",
|
|
119
|
+
"--switch-height": "1.125rem",
|
|
118
120
|
},
|
|
119
121
|
control: {
|
|
120
122
|
borderRadius: "lg",
|
|
121
|
-
padding: "0.12rem",
|
|
122
123
|
},
|
|
123
124
|
},
|
|
124
125
|
md: {
|
|
125
126
|
root: {
|
|
126
|
-
"--switch-width": "
|
|
127
|
-
"--switch-height": "1.
|
|
127
|
+
"--switch-width": "3.75rem",
|
|
128
|
+
"--switch-height": "1.5rem",
|
|
128
129
|
},
|
|
129
130
|
control: {
|
|
130
131
|
borderRadius: "xl",
|
|
131
|
-
padding: 0.5,
|
|
132
132
|
},
|
|
133
133
|
},
|
|
134
134
|
lg: {
|
|
135
135
|
root: {
|
|
136
|
-
"--switch-width": "4.
|
|
137
|
-
"--switch-height": "
|
|
136
|
+
"--switch-width": "4.5rem",
|
|
137
|
+
"--switch-height": "1.875rem",
|
|
138
138
|
},
|
|
139
139
|
control: {
|
|
140
140
|
borderRadius: "2xl",
|
|
141
|
-
padding: 0.5,
|
|
142
141
|
},
|
|
143
142
|
},
|
|
144
143
|
},
|