@vygruppen/spor-react 12.24.5 → 12.24.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
3
  "type": "module",
4
- "version": "12.24.5",
4
+ "version": "12.24.7",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -68,8 +68,8 @@
68
68
  "vitest": "^0.26.3",
69
69
  "vitest-axe": "^0.1.0",
70
70
  "vitest-canvas-mock": "^0.2.2",
71
- "@vygruppen/eslint-config": "2.1.0",
72
- "@vygruppen/tsconfig": "0.1.1"
71
+ "@vygruppen/tsconfig": "0.1.1",
72
+ "@vygruppen/eslint-config": "2.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "react": ">=18.0.0 <19.0.0",
@@ -33,7 +33,7 @@ export const CalendarTriggerButton = forwardRef<
33
33
  const styles = recipe({ variant });
34
34
 
35
35
  return (
36
- <PopoverAnchor {...buttonProps} ref={ref}>
36
+ <PopoverAnchor {...buttonProps} ref={ref} asChild>
37
37
  <IconButton
38
38
  icon={<CalendarOutline24Icon />}
39
39
  aria-label={t(texts.openCalendar)}
@@ -51,7 +51,7 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
51
51
  borderRadius="xs"
52
52
  fontSize={["mobile.sm", "desktop.sm"]}
53
53
  css={styles.dateTimeSegment}
54
- aria-description={ariaDescription}
54
+ aria-label={ariaDescription}
55
55
  aria-labelledby={ariaLabel}
56
56
  >
57
57
  {isPaddable(segment.type)
@@ -44,6 +44,7 @@ export const Autocomplete = ({
44
44
  loading,
45
45
  disabled,
46
46
  emptyLabel,
47
+ onFocus,
47
48
  openOnClick = true,
48
49
  openOnFocus = true,
49
50
  ...rest
@@ -104,7 +105,8 @@ export const Autocomplete = ({
104
105
  helperText={helperText}
105
106
  errorText={errorText}
106
107
  required={required}
107
- onFocus={() => {
108
+ onFocus={(event) => {
109
+ onFocus?.(event);
108
110
  if (openOnFocus) combobox.setOpen(true);
109
111
  }}
110
112
  />
@@ -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,
@@ -93,7 +94,9 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
93
94
  <SelectValueText withPlaceholder={label ? true : false} />
94
95
  </SelectTrigger>
95
96
  {label && <SelectLabel css={styles.label}>{label}</SelectLabel>}
96
- <SelectContent css={styles.selectContent}>{children}</SelectContent>
97
+ <SelectContent css={styles.selectContent} baseStyle={css}>
98
+ {children}
99
+ </SelectContent>
97
100
  </ChakraSelect.Root>
98
101
  </Field>
99
102
  );
@@ -129,7 +132,11 @@ export const SelectItem = React.forwardRef<HTMLDivElement, SelectItemProps>(
129
132
  <ChakraSelect.ItemText display="flex">
130
133
  {children}
131
134
  </ChakraSelect.ItemText>
132
- {description && <Box css={styles.itemDescription}>{description}</Box>}
135
+ {description && (
136
+ <Box data-part="item-description" css={styles.itemDescription}>
137
+ {description}
138
+ </Box>
139
+ )}
133
140
  </Box>
134
141
 
135
142
  <ChakraSelect.ItemIndicator>
@@ -176,9 +183,12 @@ export const SelectTrigger = React.forwardRef<
176
183
  <ChakraSelect.Trigger ref={ref} css={styles.trigger}>
177
184
  {children}
178
185
  </ChakraSelect.Trigger>
179
- <ChakraSelect.IndicatorGroup css={styles.indicatorGroup}>
186
+ <ChakraSelect.IndicatorGroup
187
+ css={styles.indicatorGroup}
188
+ data-part="indicator-group"
189
+ >
180
190
  {clearable && <SelectClearTrigger />}
181
- <Box css={styles.indicator}>
191
+ <Box css={styles.indicator} data-part="indicator">
182
192
  <DropdownDownFill24Icon />
183
193
  </Box>
184
194
  </ChakraSelect.IndicatorGroup>
@@ -209,16 +219,18 @@ const SelectClearTrigger = React.forwardRef<
209
219
  type SelectContentProps = ChakraSelect.ContentProps & {
210
220
  portalled?: boolean;
211
221
  portalRef?: React.RefObject<HTMLElement>;
222
+ baseStyle?: SystemStyleObject;
212
223
  };
213
224
 
214
225
  export const SelectContent = React.forwardRef<
215
226
  HTMLDivElement,
216
227
  SelectContentProps
217
228
  >(function SelectContent(props, ref) {
218
- const { portalled = true, portalRef, ...rest } = props;
229
+ const { portalled = true, portalRef, baseStyle, ...rest } = props;
230
+
219
231
  return (
220
232
  <Portal disabled={!portalled} container={portalRef}>
221
- <ChakraSelect.Positioner>
233
+ <ChakraSelect.Positioner css={baseStyle}>
222
234
  <ChakraSelect.Content {...rest} ref={ref} />
223
235
  </ChakraSelect.Positioner>
224
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: "2px solid",
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: "solid",
85
+ outlineStyle: "double",
87
86
  },
88
87
 
89
88
  _checked: {
90
89
  backgroundColor: "brand.surface",
90
+ outline: "none",
91
91
  _focusVisible: {
92
- outlineStyle: "double",
93
- outlineWidth: `calc(3 * ${tokens.size.stroke.md})`, // space for double outline
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": "3.3rem",
117
- "--switch-height": "1.5rem",
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": "4.1rem",
127
- "--switch-height": "1.8rem",
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.8rem",
137
- "--switch-height": "2.25rem",
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
  },