@vygruppen/spor-react 12.24.16 → 13.0.1

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.
Files changed (85) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/.turbo/turbo-postinstall.log +2 -2
  3. package/CHANGELOG.md +24 -0
  4. package/dist/index.cjs +2753 -2646
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +887 -601
  7. package/dist/index.d.ts +887 -601
  8. package/dist/index.mjs +2712 -2605
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +10 -10
  11. package/src/accordion/Accordion.tsx +34 -29
  12. package/src/accordion/Expandable.tsx +20 -21
  13. package/src/alert/Alert.tsx +7 -5
  14. package/src/alert/AlertIcon.tsx +19 -20
  15. package/src/alert/ExpandableAlert.tsx +65 -64
  16. package/src/alert/ServiceAlert.tsx +78 -78
  17. package/src/breadcrumb/Breadcrumb.tsx +37 -34
  18. package/src/button/Button.tsx +64 -57
  19. package/src/button/ButtonGroup.tsx +12 -10
  20. package/src/button/Clipboard.tsx +21 -18
  21. package/src/button/CloseButton.tsx +19 -17
  22. package/src/button/FloatingActionButton.tsx +41 -47
  23. package/src/button/IconButton.tsx +20 -18
  24. package/src/calendar/CalendarContext.tsx +1 -1
  25. package/src/color-mode/color-mode.tsx +7 -5
  26. package/src/datepicker/CalendarTriggerButton.tsx +11 -7
  27. package/src/datepicker/DateField.tsx +53 -51
  28. package/src/datepicker/DatePicker.tsx +127 -134
  29. package/src/datepicker/DateTimeSegment.tsx +44 -40
  30. package/src/datepicker/StyledField.tsx +39 -36
  31. package/src/dialog/Dialog.tsx +14 -11
  32. package/src/dialog/Drawer.tsx +74 -67
  33. package/src/input/AttachedInputs.tsx +35 -41
  34. package/src/input/Autocomplete.tsx +118 -129
  35. package/src/input/CardSelect.tsx +67 -65
  36. package/src/input/Checkbox.tsx +19 -17
  37. package/src/input/CheckboxGroup.tsx +0 -2
  38. package/src/input/ChoiceChip.tsx +42 -38
  39. package/src/input/Combobox.tsx +4 -4
  40. package/src/input/CountryCodeSelect.tsx +8 -8
  41. package/src/input/Field.tsx +78 -75
  42. package/src/input/FloatingLabel.tsx +6 -8
  43. package/src/input/Input.tsx +87 -92
  44. package/src/input/ListBox.tsx +3 -4
  45. package/src/input/Menu.tsx +149 -142
  46. package/src/input/NativeSelect.tsx +7 -5
  47. package/src/input/NumericStepper.tsx +15 -12
  48. package/src/input/PasswordInput.tsx +65 -61
  49. package/src/input/PhoneNumberInput.tsx +7 -7
  50. package/src/input/Popover.tsx +52 -55
  51. package/src/input/Radio.tsx +16 -11
  52. package/src/input/SearchInput.tsx +32 -31
  53. package/src/input/Select.tsx +106 -96
  54. package/src/input/Switch.tsx +43 -41
  55. package/src/input/Textarea.tsx +68 -66
  56. package/src/input/useFLoatingInputState.tsx +1 -1
  57. package/src/layout/PressableCard.tsx +11 -10
  58. package/src/layout/RadioCard.tsx +57 -53
  59. package/src/layout/Separator.tsx +8 -7
  60. package/src/layout/StaticCard.tsx +11 -10
  61. package/src/linjetag/LineIcon.tsx +48 -54
  62. package/src/linjetag/TravelTag.tsx +57 -59
  63. package/src/link/TextLink.tsx +50 -40
  64. package/src/loader/ProgressBar.tsx +41 -46
  65. package/src/loader/ProgressLoader.tsx +83 -86
  66. package/src/loader/Skeleton.tsx +56 -48
  67. package/src/logo/CargonetLogo.tsx +88 -87
  68. package/src/logo/VyLogo.tsx +80 -77
  69. package/src/logo/VyLogoPride.tsx +137 -135
  70. package/src/media-controller/JumpButton.tsx +30 -28
  71. package/src/media-controller/PlayPauseButton.tsx +8 -7
  72. package/src/media-controller/SkipButton.tsx +28 -26
  73. package/src/nudge/Nudge.tsx +66 -70
  74. package/src/pagination/Pagination.tsx +52 -46
  75. package/src/popover/index.tsx +46 -41
  76. package/src/progress-indicator/ProgressIndicator.tsx +10 -7
  77. package/src/stepper/Stepper.tsx +84 -81
  78. package/src/tab/Tabs.tsx +8 -4
  79. package/src/table/Table.tsx +89 -109
  80. package/src/tooltip.tsx +26 -22
  81. package/src/typography/Badge.tsx +8 -5
  82. package/src/typography/Code.tsx +8 -5
  83. package/src/typography/Heading.tsx +22 -23
  84. package/src/typography/Text.tsx +11 -9
  85. package/tsconfig.json +1 -0
@@ -5,7 +5,7 @@ import {
5
5
  BreadcrumbRootProps,
6
6
  } from "@chakra-ui/react";
7
7
  import { DropdownRightFill18Icon } from "@vygruppen/spor-icon-react";
8
- import React, { forwardRef } from "react";
8
+ import React from "react";
9
9
  /**
10
10
  * A breadcrumb component.
11
11
  *
@@ -20,40 +20,43 @@ import React, { forwardRef } from "react";
20
20
  * </Breadcrumb>
21
21
  * ```
22
22
  */
23
- export const Breadcrumb = forwardRef<HTMLDivElement, BreadcrumbRootProps>(
24
- ({ children, css, ...props }, ref) => {
25
- const validChildren = React.Children.toArray(children).filter((element) =>
26
- React.isValidElement(element),
27
- );
23
+ export const Breadcrumb = ({
24
+ ref,
25
+ children,
26
+ css,
27
+ ...props
28
+ }: BreadcrumbRootProps & {
29
+ ref?: React.Ref<HTMLDivElement>;
30
+ }) => {
31
+ const validChildren = React.Children.toArray(children).filter((element) =>
32
+ React.isValidElement(element),
33
+ );
28
34
 
29
- return (
30
- <ChakraBreadcrumb.Root ref={ref} {...props} css={css}>
31
- <ChakraBreadcrumb.List data-part="list">
32
- {validChildren.map((child, index) => {
33
- const isLast = index === validChildren.length - 1;
34
- return (
35
- <React.Fragment key={index}>
36
- <ChakraBreadcrumb.Item data-part="item">
37
- {child}
38
- </ChakraBreadcrumb.Item>
39
- {!isLast && (
40
- <ChakraBreadcrumb.Separator
41
- aria-hidden="true"
42
- data-part="separator"
43
- >
44
- <DropdownRightFill18Icon />
45
- </ChakraBreadcrumb.Separator>
46
- )}
47
- </React.Fragment>
48
- );
49
- })}
50
- </ChakraBreadcrumb.List>
51
- </ChakraBreadcrumb.Root>
52
- );
53
- },
54
- );
55
-
56
- Breadcrumb.displayName = "Breadcrumb";
35
+ return (
36
+ <ChakraBreadcrumb.Root ref={ref} css={css} {...props}>
37
+ <ChakraBreadcrumb.List data-part="list">
38
+ {validChildren.map((child, index) => {
39
+ const isLast = index === validChildren.length - 1;
40
+ return (
41
+ <React.Fragment key={index}>
42
+ <ChakraBreadcrumb.Item data-part="item">
43
+ {child}
44
+ </ChakraBreadcrumb.Item>
45
+ {!isLast && (
46
+ <ChakraBreadcrumb.Separator
47
+ aria-hidden="true"
48
+ data-part="separator"
49
+ >
50
+ <DropdownRightFill18Icon />
51
+ </ChakraBreadcrumb.Separator>
52
+ )}
53
+ </React.Fragment>
54
+ );
55
+ })}
56
+ </ChakraBreadcrumb.List>
57
+ </ChakraBreadcrumb.Root>
58
+ );
59
+ };
57
60
 
58
61
  export {
59
62
  BreadcrumbCurrentLink,
@@ -7,7 +7,13 @@ import {
7
7
  type RecipeVariantProps,
8
8
  Span,
9
9
  } from "@chakra-ui/react";
10
- import React, { cloneElement, forwardRef, PropsWithChildren } from "react";
10
+ import React, {
11
+ cloneElement,
12
+ isValidElement,
13
+ PropsWithChildren,
14
+ ReactElement,
15
+ ReactNode,
16
+ } from "react";
11
17
 
12
18
  import { createTexts, useTranslation } from "../i18n";
13
19
  import { ColorInlineLoader } from "../loader";
@@ -92,72 +98,73 @@ const LoadingContent = ({
92
98
  </>
93
99
  );
94
100
 
95
- export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
96
- (
97
- {
98
- loading,
99
- disabled,
100
- loadingText,
101
- variant = "primary",
102
- size = "md",
103
- leftIcon,
104
- rightIcon,
105
- type = "button",
106
- children,
107
- ...rest
108
- },
109
- ref,
110
- ) => {
111
- const { t } = useTranslation();
101
+ const getChildContent = (child: ReactNode): ReactNode => {
102
+ if (isValidElement(child)) {
103
+ return (child.props as { children?: ReactNode }).children;
104
+ }
105
+ return child;
106
+ };
112
107
 
113
- const ariaLabel = loading
114
- ? String(loadingText ?? t(texts.loadingText))
115
- : (rest["aria-label"] as string);
108
+ export const Button = ({
109
+ ref,
110
+ loading,
111
+ disabled,
112
+ loadingText,
113
+ variant = "primary",
114
+ size = "md",
115
+ leftIcon,
116
+ rightIcon,
117
+ type = "button",
118
+ children,
119
+ ...rest
120
+ }: ButtonProps & {
121
+ ref?: React.Ref<HTMLButtonElement>;
122
+ }) => {
123
+ const { t } = useTranslation();
116
124
 
117
- const renderContent = () => {
118
- const content = rest.asChild
119
- ? (children as React.ReactElement).props.children
120
- : children;
125
+ const ariaLabel = loading
126
+ ? String(loadingText ?? t(texts.loadingText))
127
+ : (rest["aria-label"] as string);
121
128
 
122
- if (loading)
123
- return (
124
- <LoadingContent size={size} loadingText={loadingText}>
125
- <ButtonContent leftIcon={leftIcon} rightIcon={rightIcon}>
126
- {content}
127
- </ButtonContent>
128
- </LoadingContent>
129
- );
129
+ const renderContent = () => {
130
+ const content = rest.asChild ? getChildContent(children) : children;
130
131
 
132
+ if (loading)
131
133
  return (
132
- <ButtonContent leftIcon={leftIcon} rightIcon={rightIcon}>
133
- {content}
134
- </ButtonContent>
134
+ <LoadingContent size={size} loadingText={loadingText}>
135
+ <ButtonContent leftIcon={leftIcon} rightIcon={rightIcon}>
136
+ {content}
137
+ </ButtonContent>
138
+ </LoadingContent>
135
139
  );
136
- };
137
140
 
138
141
  return (
139
- <ChakraButton
140
- type={type}
141
- ref={ref}
142
- aria-label={ariaLabel}
143
- aria-busy={loading}
144
- disabled={disabled || loading}
145
- position="relative"
146
- variant={variant}
147
- size={size}
148
- {...rest}
149
- >
150
- {rest.asChild
151
- ? cloneElement(children as React.ReactElement, {
152
- children: renderContent(),
153
- })
154
- : renderContent()}
155
- </ChakraButton>
142
+ <ButtonContent leftIcon={leftIcon} rightIcon={rightIcon}>
143
+ {content}
144
+ </ButtonContent>
156
145
  );
157
- },
158
- );
146
+ };
159
147
 
160
- Button.displayName = "Button";
148
+ return (
149
+ <ChakraButton
150
+ type={type}
151
+ ref={ref}
152
+ aria-label={ariaLabel}
153
+ aria-busy={loading}
154
+ disabled={disabled || loading}
155
+ position="relative"
156
+ variant={variant}
157
+ size={size}
158
+ {...rest}
159
+ >
160
+ {rest.asChild && isValidElement(children)
161
+ ? cloneElement(children as ReactElement<{ children: ReactNode }>, {
162
+ children: renderContent(),
163
+ })
164
+ : renderContent()}
165
+ </ChakraButton>
166
+ );
167
+ };
161
168
 
162
169
  const texts = createTexts({
163
170
  loadingText: {
@@ -6,7 +6,7 @@ import {
6
6
  type RecipeVariantProps,
7
7
  useRecipe,
8
8
  } from "@chakra-ui/react";
9
- import { forwardRef, PropsWithChildren } from "react";
9
+ import { PropsWithChildren } from "react";
10
10
 
11
11
  import { groupRecipe } from "../theme/recipes/group";
12
12
 
@@ -48,13 +48,15 @@ export type ButtonGroupProps = ChakraGroupProps &
48
48
  * </ButtonGroup>
49
49
  */
50
50
 
51
- export const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(
52
- (props, ref) => {
53
- const recipe = useRecipe({ key: "buttonGroup" });
54
- const [recipeProps, restProps] = recipe.splitVariantProps(props);
55
- const styles = recipe(recipeProps);
51
+ export const ButtonGroup = ({
52
+ ref,
53
+ ...props
54
+ }: ButtonGroupProps & {
55
+ ref?: React.Ref<HTMLDivElement>;
56
+ }) => {
57
+ const recipe = useRecipe({ key: "buttonGroup" });
58
+ const [recipeProps, restProps] = recipe.splitVariantProps(props);
59
+ const styles = recipe(recipeProps);
56
60
 
57
- return <ChakraGroup {...restProps} ref={ref} css={styles} />;
58
- },
59
- );
60
- ButtonGroup.displayName = "ButtonGroup";
61
+ return <ChakraGroup {...restProps} ref={ref} css={styles} />;
62
+ };
@@ -20,10 +20,12 @@ import { Button, ButtonProps } from "./Button";
20
20
  * </Clipboard>
21
21
  */
22
22
 
23
- const ClipboardIcon = React.forwardRef<
24
- HTMLDivElement,
25
- ChakraClipboard.IndicatorProps
26
- >((props, ref) => {
23
+ const ClipboardIcon = ({
24
+ ref,
25
+ ...props
26
+ }: ChakraClipboard.IndicatorProps & {
27
+ ref?: React.Ref<HTMLDivElement>;
28
+ }) => {
27
29
  return (
28
30
  <ChakraClipboard.Indicator
29
31
  copied={<CheckmarkFill18Icon />}
@@ -33,13 +35,14 @@ const ClipboardIcon = React.forwardRef<
33
35
  <CopyOutline18Icon />
34
36
  </ChakraClipboard.Indicator>
35
37
  );
36
- });
37
- ClipboardIcon.displayName = "ClipboardIcon";
38
+ };
38
39
 
39
- const ClipboardCopyText = React.forwardRef<
40
- HTMLDivElement,
41
- ChakraClipboard.IndicatorProps
42
- >((props, ref) => {
40
+ const ClipboardCopyText = ({
41
+ ref,
42
+ ...props
43
+ }: ChakraClipboard.IndicatorProps & {
44
+ ref?: React.Ref<HTMLDivElement>;
45
+ }) => {
43
46
  const { t } = useTranslation();
44
47
  return (
45
48
  <ChakraClipboard.Indicator
@@ -50,15 +53,16 @@ const ClipboardCopyText = React.forwardRef<
50
53
  <Text variant="xs">{t(texts.copy)}</Text>
51
54
  </ChakraClipboard.Indicator>
52
55
  );
53
- });
54
- ClipboardCopyText.displayName = "ClipboardCopyText";
56
+ };
55
57
 
56
58
  type ClipboardButtonProps = ButtonProps;
57
59
 
58
- export const ClipboardButton = React.forwardRef<
59
- HTMLButtonElement,
60
- ClipboardButtonProps
61
- >((props, ref) => {
60
+ export const ClipboardButton = ({
61
+ ref,
62
+ ...props
63
+ }: ClipboardButtonProps & {
64
+ ref?: React.Ref<HTMLButtonElement>;
65
+ }) => {
62
66
  return (
63
67
  <ChakraClipboard.Trigger asChild>
64
68
  <Button ref={ref} size="xs" leftIcon={<ClipboardIcon />} {...props}>
@@ -66,8 +70,7 @@ export const ClipboardButton = React.forwardRef<
66
70
  </Button>
67
71
  </ChakraClipboard.Trigger>
68
72
  );
69
- });
70
- ClipboardButton.displayName = "ClipboardButton";
73
+ };
71
74
 
72
75
  export const Clipboard = ChakraClipboard.Root;
73
76
 
@@ -5,7 +5,6 @@ import {
5
5
  CloseFill24Icon,
6
6
  CloseFill30Icon,
7
7
  } from "@vygruppen/spor-icon-react";
8
- import { forwardRef } from "react";
9
8
 
10
9
  import { createTexts, useTranslation } from "../i18n";
11
10
  import { IconButton, IconButtonProps } from "./IconButton";
@@ -27,22 +26,25 @@ export type CloseButtonProps = Omit<
27
26
  * <CloseButton onClick={closeModal} />
28
27
  * ```
29
28
  */
30
- export const CloseButton = forwardRef<HTMLButtonElement, CloseButtonProps>(
31
- ({ size = "sm", ...props }, ref) => {
32
- const { t } = useTranslation();
33
- return (
34
- <IconButton
35
- variant="ghost"
36
- icon={<CloseIcon size={size} />}
37
- size={size}
38
- aria-label={props["aria-label"] || t(texts.close)}
39
- {...props}
40
- ref={ref}
41
- />
42
- );
43
- },
44
- );
45
- CloseButton.displayName = "CloseButton";
29
+ export const CloseButton = ({
30
+ ref,
31
+ size = "sm",
32
+ ...props
33
+ }: CloseButtonProps & {
34
+ ref?: React.Ref<HTMLButtonElement | null>;
35
+ }) => {
36
+ const { t } = useTranslation();
37
+ return (
38
+ <IconButton
39
+ variant="ghost"
40
+ icon={<CloseIcon size={size} />}
41
+ size={size}
42
+ aria-label={props["aria-label"] || t(texts.close)}
43
+ {...props}
44
+ ref={ref}
45
+ />
46
+ );
47
+ };
46
48
 
47
49
  const CloseIcon = ({ size }: { size: CloseButtonProps["size"] }) => {
48
50
  switch (size) {
@@ -7,7 +7,7 @@ import {
7
7
  Text,
8
8
  useSlotRecipe,
9
9
  } from "@chakra-ui/react";
10
- import React, { forwardRef, PropsWithChildren } from "react";
10
+ import React, { PropsWithChildren } from "react";
11
11
 
12
12
  import { floatingActionButtonSlotRecipe } from "../theme/slot-recipes/floating-action-button";
13
13
 
@@ -36,55 +36,49 @@ type FloatingActionButtonProps = BoxProps &
36
36
  * placement="bottom right"
37
37
  * />
38
38
  */
39
- export const FloatingActionButton = forwardRef<
40
- HTMLButtonElement,
41
- FloatingActionButtonProps
42
- >(
43
- (
44
- {
45
- children,
46
- icon,
47
- variant,
48
- isTextVisible: externalIsTextVisible,
49
- placement = "bottom right",
50
- ...props
51
- },
52
- ref,
53
- ) => {
54
- const scrollDirection = useScrollDirection();
39
+ export const FloatingActionButton = ({
40
+ ref,
41
+ children,
42
+ icon,
43
+ variant,
44
+ isTextVisible: externalIsTextVisible,
45
+ placement = "bottom right",
46
+ ...props
47
+ }: FloatingActionButtonProps & {
48
+ ref?: React.Ref<HTMLButtonElement>;
49
+ }) => {
50
+ const scrollDirection = useScrollDirection();
55
51
 
56
- // Use derived value instead of setState in effect
57
- const isTextVisible =
58
- externalIsTextVisible === undefined
59
- ? scrollDirection !== "down"
60
- : !!externalIsTextVisible;
52
+ // Use derived value instead of setState in effect
53
+ const isTextVisible =
54
+ externalIsTextVisible === undefined
55
+ ? scrollDirection !== "down"
56
+ : !!externalIsTextVisible;
61
57
 
62
- const recipe = useSlotRecipe({ key: "floatingActionButton" });
63
- const style = recipe({
64
- variant,
65
- placement,
66
- });
58
+ const recipe = useSlotRecipe({ key: "floatingActionButton" });
59
+ const style = recipe({
60
+ variant,
61
+ placement,
62
+ });
67
63
 
68
- return (
69
- <Box
70
- css={style.root}
71
- as="button"
72
- aria-label={typeof children === "string" ? children : undefined}
73
- ref={ref}
74
- {...props}
75
- aria-expanded={isTextVisible}
76
- >
77
- <Box css={style.icon}>{icon}</Box>
78
- {isTextVisible && (
79
- <Text data-state="open" css={style.text}>
80
- {children}
81
- </Text>
82
- )}
83
- </Box>
84
- );
85
- },
86
- );
87
- FloatingActionButton.displayName = "FloatingActionButton";
64
+ return (
65
+ <Box
66
+ css={style.root}
67
+ as="button"
68
+ aria-label={typeof children === "string" ? children : undefined}
69
+ ref={ref}
70
+ {...props}
71
+ aria-expanded={isTextVisible}
72
+ >
73
+ <Box css={style.icon}>{icon}</Box>
74
+ {isTextVisible && (
75
+ <Text data-state="open" css={style.text}>
76
+ {children}
77
+ </Text>
78
+ )}
79
+ </Box>
80
+ );
81
+ };
88
82
 
89
83
  type ScrollDirection = "up" | "down" | null;
90
84
  const useScrollDirection = () => {
@@ -2,7 +2,7 @@ import {
2
2
  IconButton as ChakraIconButton,
3
3
  type IconButtonProps as ChakraIconButtonProps,
4
4
  } from "@chakra-ui/react";
5
- import React, { forwardRef, PropsWithChildren } from "react";
5
+ import React, { PropsWithChildren } from "react";
6
6
 
7
7
  import { ButtonVariantProps, ColorSpinner } from "..";
8
8
 
@@ -56,20 +56,22 @@ export type IconButtonProps = Exclude<
56
56
  * />
57
57
  * ```
58
58
  */
59
- export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
60
- (props, ref) => {
61
- const { icon, size = "sm", loading = false, ...rest } = props;
62
- return (
63
- <ChakraIconButton
64
- aria-label={props["aria-label"]}
65
- size={size}
66
- position="relative"
67
- {...rest}
68
- ref={ref}
69
- >
70
- {loading ? <ColorSpinner width="2em" height="2em" margin={1} /> : icon}
71
- </ChakraIconButton>
72
- );
73
- },
74
- );
75
- IconButton.displayName = "IconButton";
59
+ export const IconButton = ({
60
+ ref,
61
+ ...props
62
+ }: IconButtonProps & {
63
+ ref?: React.Ref<HTMLButtonElement | null>;
64
+ }) => {
65
+ const { icon, size = "sm", loading = false, ...rest } = props;
66
+ return (
67
+ <ChakraIconButton
68
+ aria-label={props["aria-label"]}
69
+ size={size}
70
+ position="relative"
71
+ {...rest}
72
+ ref={ref}
73
+ >
74
+ {loading ? <ColorSpinner width="2em" height="2em" margin={1} /> : icon}
75
+ </ChakraIconButton>
76
+ );
77
+ };
@@ -34,7 +34,7 @@ type BaseCalendarState = {
34
34
  prevButtonProps: AriaButtonProps<"button">;
35
35
  startValue: CalendarDate | null;
36
36
  isSelectingRange: boolean;
37
- ref: React.RefObject<HTMLDivElement>;
37
+ ref?: React.Ref<HTMLDivElement | null>;
38
38
  };
39
39
 
40
40
  type SingleCalendarState = BaseCalendarState & {
@@ -47,10 +47,12 @@ export function ColorModeIcon() {
47
47
 
48
48
  type ColorModeButtonProps = Omit<IconButtonProps, "aria-label">;
49
49
 
50
- export const ColorModeButton = React.forwardRef<
51
- HTMLButtonElement,
52
- ColorModeButtonProps
53
- >(function ColorModeButton(props, ref) {
50
+ export const ColorModeButton = function ColorModeButton({
51
+ ref,
52
+ ...props
53
+ }: ColorModeButtonProps & {
54
+ ref?: React.Ref<HTMLButtonElement>;
55
+ }) {
54
56
  const { toggleColorMode } = useColorMode();
55
57
  return (
56
58
  <ClientOnly fallback={<Skeleton boxSize="8" />}>
@@ -72,4 +74,4 @@ export const ColorModeButton = React.forwardRef<
72
74
  </IconButton>
73
75
  </ClientOnly>
74
76
  );
75
- });
77
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { BoxProps, PopoverAnchor, useSlotRecipe } from "@chakra-ui/react";
4
4
  import { CalendarOutline24Icon } from "@vygruppen/spor-icon-react";
5
- import { forwardRef, PropsWithChildren } from "react";
5
+ import { PropsWithChildren } from "react";
6
6
  import { AriaButtonProps } from "react-aria";
7
7
 
8
8
  import {
@@ -19,12 +19,17 @@ type CalendarTriggerButtonProps = AriaButtonProps<"button"> &
19
19
  CalendarVariants & {
20
20
  disabled?: boolean;
21
21
  };
22
- export const CalendarTriggerButton = forwardRef<
23
- HTMLDivElement,
24
- CalendarTriggerButtonProps
22
+ export const CalendarTriggerButton = ({
23
+ ref,
24
+ variant,
25
+ disabled,
25
26
  // onPress is extracted because it is not supported by chakra.
26
27
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
- >(({ variant, disabled, onPress: _, ...buttonProps }, ref) => {
28
+ onPress: _,
29
+ ...buttonProps
30
+ }: CalendarTriggerButtonProps & {
31
+ ref?: React.Ref<HTMLDivElement | null>;
32
+ }) => {
28
33
  const { t } = useTranslation();
29
34
 
30
35
  const recipe = useSlotRecipe({
@@ -43,8 +48,7 @@ export const CalendarTriggerButton = forwardRef<
43
48
  />
44
49
  </PopoverAnchor>
45
50
  );
46
- });
47
- CalendarTriggerButton.displayName = "CalendarTriggerButton";
51
+ };
48
52
 
49
53
  const texts = createTexts({
50
54
  openCalendar: {