@vygruppen/spor-react 12.1.2 → 12.2.0

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 (118) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/.turbo/turbo-typegen.log +1 -1
  3. package/CHANGELOG.md +6 -0
  4. package/dist/index.d.mts +148 -151
  5. package/dist/index.d.ts +148 -151
  6. package/dist/index.js +2284 -1880
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +2169 -1774
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +3 -3
  11. package/src/accordion/Accordion.tsx +2 -1
  12. package/src/accordion/Expandable.tsx +3 -1
  13. package/src/accordion/helpers.ts +2 -1
  14. package/src/alert/Alert.tsx +3 -1
  15. package/src/alert/AlertIcon.tsx +17 -10
  16. package/src/alert/ExpandableAlert.tsx +3 -2
  17. package/src/alert/ServiceAlert.tsx +2 -1
  18. package/src/breadcrumb/Breadcrumb.tsx +9 -8
  19. package/src/button/Button.tsx +2 -1
  20. package/src/button/ButtonGroup.tsx +2 -1
  21. package/src/button/Clipboard.tsx +3 -0
  22. package/src/button/CloseButton.tsx +8 -4
  23. package/src/button/FloatingActionButton.tsx +5 -5
  24. package/src/button/IconButton.tsx +1 -0
  25. package/src/color-mode/color-mode.tsx +2 -2
  26. package/src/datepicker/Calendar.tsx +0 -1
  27. package/src/datepicker/CalendarCell.tsx +5 -5
  28. package/src/datepicker/CalendarGrid.tsx +3 -2
  29. package/src/datepicker/CalendarHeader.tsx +1 -4
  30. package/src/datepicker/CalendarTriggerButton.tsx +3 -4
  31. package/src/datepicker/DateField.tsx +13 -6
  32. package/src/datepicker/DatePicker.tsx +2 -1
  33. package/src/datepicker/DateRangePicker.tsx +1 -1
  34. package/src/datepicker/DateTimeSegment.tsx +2 -1
  35. package/src/datepicker/RangeCalendar.tsx +1 -1
  36. package/src/datepicker/StyledField.tsx +1 -1
  37. package/src/datepicker/TimeField.tsx +3 -3
  38. package/src/datepicker/TimePicker.tsx +4 -2
  39. package/src/datepicker/utils.ts +10 -5
  40. package/src/dialog/Dialog.tsx +1 -0
  41. package/src/dialog/Drawer.tsx +28 -26
  42. package/src/i18n/index.tsx +1 -0
  43. package/src/input/AttachedInputs.tsx +6 -3
  44. package/src/input/CardSelect.tsx +3 -1
  45. package/src/input/Checkbox.tsx +1 -0
  46. package/src/input/CheckboxGroup.tsx +3 -1
  47. package/src/input/ChoiceChip.tsx +1 -1
  48. package/src/input/Combobox.tsx +6 -4
  49. package/src/input/CountryCodeSelect.tsx +10 -4
  50. package/src/input/Field.tsx +2 -0
  51. package/src/input/Input.tsx +2 -3
  52. package/src/input/InputGroup.tsx +1 -1
  53. package/src/input/ListBox.tsx +9 -8
  54. package/src/input/NativeSelect.tsx +1 -2
  55. package/src/input/NumericStepper.tsx +22 -23
  56. package/src/input/PasswordInput.tsx +2 -1
  57. package/src/input/PhoneNumberInput.tsx +6 -2
  58. package/src/input/Popover.tsx +2 -0
  59. package/src/input/Radio.tsx +2 -0
  60. package/src/input/SearchInput.tsx +2 -1
  61. package/src/input/Select.tsx +8 -2
  62. package/src/input/Switch.tsx +22 -34
  63. package/src/input/Textarea.tsx +6 -4
  64. package/src/input/index.ts +1 -1
  65. package/src/layout/PressableCard.tsx +5 -2
  66. package/src/layout/RadioCard.tsx +3 -1
  67. package/src/layout/Separator.tsx +2 -1
  68. package/src/layout/StaticCard.tsx +6 -3
  69. package/src/linjetag/InfoTag.tsx +3 -2
  70. package/src/linjetag/LineIcon.tsx +5 -4
  71. package/src/linjetag/TravelTag.tsx +12 -8
  72. package/src/link/TextLink.tsx +1 -1
  73. package/src/loader/ColorInlineLoader.tsx +0 -1
  74. package/src/loader/ColorSpinner.tsx +0 -1
  75. package/src/loader/ContentLoader.tsx +0 -1
  76. package/src/loader/DarkFullScreenLoader.tsx +0 -1
  77. package/src/loader/DarkInlineLoader.tsx +0 -1
  78. package/src/loader/DarkSpinner.tsx +0 -1
  79. package/src/loader/LightFullScreenLoader.tsx +0 -1
  80. package/src/loader/LightInlineLoader.tsx +0 -1
  81. package/src/loader/LightSpinner.tsx +0 -1
  82. package/src/loader/Lottie.tsx +1 -2
  83. package/src/loader/ProgressBar.tsx +1 -2
  84. package/src/loader/ProgressLoader.tsx +2 -7
  85. package/src/logo/CargonetLogo.tsx +2 -1
  86. package/src/logo/VyLogo.tsx +3 -4
  87. package/src/logo/VyLogoPride.tsx +4 -1
  88. package/src/media-controller/JumpButton.tsx +2 -1
  89. package/src/media-controller/PlayPauseButton.tsx +2 -1
  90. package/src/media-controller/SkipButton.tsx +2 -1
  91. package/src/nudge/Nudge.tsx +7 -14
  92. package/src/pagination/Pagination.tsx +5 -0
  93. package/src/popover/index.tsx +2 -0
  94. package/src/progress-indicator/ProgressDot.tsx +1 -1
  95. package/src/progress-indicator/ProgressIndicator.tsx +4 -2
  96. package/src/provider/SporProvider.tsx +0 -1
  97. package/src/stepper/Stepper.tsx +1 -1
  98. package/src/tab/Tabs.tsx +1 -1
  99. package/src/table/Table.tsx +2 -1
  100. package/src/theme/slot-recipes/alert-expandable.ts +0 -4
  101. package/src/theme/slot-recipes/info-tag.ts +0 -1
  102. package/src/theme/slot-recipes/popover.ts +0 -1
  103. package/src/theme/slot-recipes/radio-card.ts +0 -3
  104. package/src/theme/utils/accent-utils.ts +12 -6
  105. package/src/theme/utils/bg-utils.ts +6 -3
  106. package/src/theme/utils/brand-utils.ts +7 -7
  107. package/src/theme/utils/core-utils.ts +23 -13
  108. package/src/theme/utils/floating-utils.ts +16 -8
  109. package/src/theme/utils/ghost-utils.ts +8 -4
  110. package/src/theme/utils/input-utils.ts +7 -4
  111. package/src/theme/utils/outline-utils.ts +6 -3
  112. package/src/theme/utils/surface-utils.ts +8 -4
  113. package/src/toast/toast.tsx +0 -1
  114. package/src/typography/Badge.tsx +8 -5
  115. package/src/typography/Heading.tsx +1 -1
  116. package/src/typography/Text.tsx +1 -1
  117. package/src/util/slugify.tsx +8 -8
  118. package/tsconfig.json +1 -0
@@ -34,6 +34,7 @@ export const DialogContent = React.forwardRef<
34
34
  </Portal>
35
35
  );
36
36
  });
37
+ DialogContent.displayName = "DialogContent";
37
38
 
38
39
  export const DialogCloseTrigger = React.forwardRef<
39
40
  HTMLButtonElement,
@@ -12,7 +12,7 @@ import {
12
12
  ArrowLeftFill24Icon,
13
13
  CloseFill24Icon,
14
14
  } from "@vygruppen/spor-icon-react";
15
- import React, { forwardRef } from "react";
15
+ import { forwardRef } from "react";
16
16
 
17
17
  import { Button, CloseButton } from "../button";
18
18
  import { createTexts, useTranslation } from "../i18n";
@@ -70,32 +70,32 @@ export const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(
70
70
  );
71
71
  },
72
72
  );
73
+ DrawerContent.displayName = "DrawerContent";
73
74
 
74
- export const CloseDrawerLine = forwardRef<HTMLButtonElement, {}>(
75
- (props, ref) => {
76
- const { t } = useTranslation();
77
- return (
78
- <ChakraDrawer.CloseTrigger
79
- {...props}
80
- ref={ref}
81
- position="relative"
82
- insetEnd="unset"
83
- aria-label={t(texts.close)}
84
- cursor="pointer"
85
- top={0}
86
- paddingY={2}
87
- >
88
- <Box
89
- width={7}
90
- height={1}
91
- backgroundColor="silver"
92
- borderRadius="xs"
93
- marginX="auto"
94
- />
95
- </ChakraDrawer.CloseTrigger>
96
- );
97
- },
98
- );
75
+ export const CloseDrawerLine = forwardRef<HTMLButtonElement>((props, ref) => {
76
+ const { t } = useTranslation();
77
+ return (
78
+ <ChakraDrawer.CloseTrigger
79
+ {...props}
80
+ ref={ref}
81
+ position="relative"
82
+ insetEnd="unset"
83
+ aria-label={t(texts.close)}
84
+ cursor="pointer"
85
+ top={0}
86
+ paddingY={2}
87
+ >
88
+ <Box
89
+ width={7}
90
+ height={1}
91
+ backgroundColor="silver"
92
+ borderRadius="xs"
93
+ marginX="auto"
94
+ />
95
+ </ChakraDrawer.CloseTrigger>
96
+ );
97
+ });
98
+ CloseDrawerLine.displayName = "CloseDrawerLine";
99
99
 
100
100
  export const DrawerCloseTrigger = forwardRef<
101
101
  HTMLButtonElement,
@@ -129,6 +129,7 @@ export const DrawerBackTrigger = forwardRef<
129
129
  </ChakraDrawer.CloseTrigger>
130
130
  );
131
131
  });
132
+ DrawerBackTrigger.displayName = "DrawerBackTrigger";
132
133
 
133
134
  export const DrawerFullScreenHeader = forwardRef<
134
135
  HTMLDivElement,
@@ -151,6 +152,7 @@ export const DrawerFullScreenHeader = forwardRef<
151
152
  </ChakraDrawer.Header>
152
153
  );
153
154
  });
155
+ DrawerFullScreenHeader.displayName = "DrawerFullScreenHeader";
154
156
 
155
157
  export const Drawer = (props: DrawerProps) => {
156
158
  const { children, placement, size = "md", ...rest } = props;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-irregular-whitespace */
1
2
  import React, { createContext, useContext } from "react";
2
3
 
3
4
  export enum Language {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
- import { chakra, Group, RecipeVariantProps, useRecipe } from "@chakra-ui/react";
4
- import React, { forwardRef, PropsWithChildren } from "react";
3
+ import { chakra, Group, RecipeVariantProps } from "@chakra-ui/react";
4
+ import { forwardRef } from "react";
5
5
 
6
6
  import { attachedInputsRecipe } from "@/theme/recipes/attached-inputs";
7
7
 
@@ -28,5 +28,8 @@ export type AttachedInputsProps = RecipeVariantProps<
28
28
  const StyledGroup = chakra(Group, attachedInputsRecipe);
29
29
 
30
30
  export const AttachedInputs = forwardRef<HTMLDivElement, AttachedInputsProps>(
31
- (props, ref) => <StyledGroup ref={ref} attached {...props} />,
31
+ (props, ref) => {
32
+ return <StyledGroup ref={ref} attached {...props} />;
33
+ },
32
34
  );
35
+ AttachedInputs.displayName = "AttachedInputs";
@@ -9,7 +9,7 @@ import {
9
9
  DropdownDownFill18Icon,
10
10
  DropdownDownFill24Icon,
11
11
  } from "@vygruppen/spor-icon-react";
12
- import React, { forwardRef, ReactNode } from "react";
12
+ import { forwardRef, ReactNode } from "react";
13
13
 
14
14
  import { Button, ButtonProps, StaticCard, StaticCardProps } from "..";
15
15
 
@@ -40,6 +40,7 @@ export const CardSelectContent = forwardRef<HTMLDivElement, StaticCardProps>(
40
40
  );
41
41
  },
42
42
  );
43
+ CardSelectContent.displayName = "CardSelectContent";
43
44
 
44
45
  export type CardSelectTriggerProps = {
45
46
  /** The design of the trigger button.
@@ -101,3 +102,4 @@ export const CardSelectTrigger = forwardRef<
101
102
  );
102
103
  },
103
104
  );
105
+ CardSelectTrigger.displayName = "CardSelectTrigger";
@@ -45,3 +45,4 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
45
45
  );
46
46
  },
47
47
  );
48
+ Checkbox.displayName = "Checkbox";
@@ -14,7 +14,8 @@ export type CheckboxGroupProps = Exclude<
14
14
  children: React.ReactNode;
15
15
  /* Defaults to 1 */
16
16
  gap?: number | string;
17
- [key: string]: any;
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ [key: string]: any; //Find a way to not use type any
18
19
  };
19
20
  /**
20
21
  * Used to group several checkboxes together. You can pass the default value, as well as whether or not they're all disabled
@@ -50,3 +51,4 @@ export const CheckboxGroup = forwardRef<HTMLDivElement, CheckboxGroupProps>(
50
51
  );
51
52
  },
52
53
  );
54
+ CheckboxGroup.displayName = "CheckboxGroup";
@@ -6,7 +6,7 @@ import {
6
6
  useCheckbox,
7
7
  } from "@chakra-ui/react";
8
8
  import { CloseOutline24Icon } from "@vygruppen/spor-icon-react";
9
- import React, { ChangeEvent, PropsWithChildren, useId } from "react";
9
+ import React, { ChangeEvent, PropsWithChildren } from "react";
10
10
 
11
11
  import { choiceChipRecipe } from "@/theme/recipes/choice-chip";
12
12
 
@@ -82,7 +82,6 @@ export const Combobox = forwardRef<HTMLDivElement, ComboboxProps<object>>(
82
82
  paddingY,
83
83
  emptyContent,
84
84
  inputRef: externalInputRef,
85
- allowsEmptyCollection /* Is this being used? */,
86
85
  children,
87
86
  variant,
88
87
  } = props;
@@ -122,7 +121,7 @@ export const Combobox = forwardRef<HTMLDivElement, ComboboxProps<object>>(
122
121
  };
123
122
 
124
123
  const {
125
- inputProps: { size, ...inputProps },
124
+ inputProps: { ...inputProps },
126
125
  listBoxProps,
127
126
  } = useComboBox(
128
127
  {
@@ -177,7 +176,8 @@ export const Combobox = forwardRef<HTMLDivElement, ComboboxProps<object>>(
177
176
  {state.isOpen && !loading && (
178
177
  <Popover
179
178
  state={state}
180
- triggerRef={inputRef as any}
179
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
180
+ triggerRef={inputRef as any} /* Find a way to not use type any */
181
181
  ref={popoverRef}
182
182
  isNonModal
183
183
  placement="bottom start"
@@ -209,6 +209,7 @@ export const Combobox = forwardRef<HTMLDivElement, ComboboxProps<object>>(
209
209
  );
210
210
  },
211
211
  );
212
+ Combobox.displayName = "Combobox";
212
213
 
213
214
  const useInputWidth = (inputRef: React.RefObject<HTMLInputElement>) => {
214
215
  const [inputWidth, setInputWidth] = useState("auto");
@@ -220,7 +221,7 @@ const useInputWidth = (inputRef: React.RefObject<HTMLInputElement>) => {
220
221
  }, 67);
221
222
  window.addEventListener("resize", onResize);
222
223
  return () => window.removeEventListener("resize", onResize);
223
- }, []);
224
+ }, [inputRef]);
224
225
  return inputWidth;
225
226
  };
226
227
 
@@ -231,6 +232,7 @@ function styleProps(obj: Record<string, unknown>): Record<string, unknown> {
231
232
  }
232
233
 
233
234
  const debounce = (fn: () => void, ms = 100) => {
235
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
234
236
  let timer: any;
235
237
  return () => {
236
238
  clearTimeout(timer);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { createListCollection } from "@chakra-ui/react";
4
4
  import { getSupportedCallingCodes } from "awesome-phonenumber";
5
- import React, { forwardRef } from "react";
5
+ import { forwardRef } from "react";
6
6
 
7
7
  import {
8
8
  createTexts,
@@ -33,15 +33,20 @@ export const callingCodes = createListCollection({
33
33
  items: [...prioritizedCountryCodes, ...sortedCallingCodes],
34
34
  });
35
35
 
36
- type CountryCodeSelectProps = Omit<SelectProps, "label" | "collection">;
36
+ type CountryCodeSelectProps = Omit<SelectProps, "label" | "collection"> & {
37
+ allowedCountryCodes?: string[];
38
+ };
37
39
 
38
40
  export const CountryCodeSelect = forwardRef<
39
41
  HTMLDivElement,
40
42
  CountryCodeSelectProps
41
43
  >((props, ref) => {
42
44
  const { t } = useTranslation();
43
- const invalid = props.invalid;
44
-
45
+ if (props.allowedCountryCodes) {
46
+ callingCodes.items = callingCodes.items.filter((callingCode) =>
47
+ props.allowedCountryCodes?.some((code) => code === callingCode.label),
48
+ );
49
+ }
45
50
  return (
46
51
  <Select
47
52
  {...props}
@@ -60,6 +65,7 @@ export const CountryCodeSelect = forwardRef<
60
65
  </Select>
61
66
  );
62
67
  });
68
+ CountryCodeSelect.displayName = "CountryCodeSelect";
63
69
 
64
70
  const texts = createTexts({
65
71
  countryCode: {
@@ -59,6 +59,7 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
59
59
  );
60
60
  },
61
61
  );
62
+ Field.displayName = "Field";
62
63
 
63
64
  export const FieldErrorText = React.forwardRef<
64
65
  HTMLDivElement,
@@ -68,5 +69,6 @@ export const FieldErrorText = React.forwardRef<
68
69
  <ChakraField.ErrorText ref={ref}>{props.children}</ChakraField.ErrorText>
69
70
  );
70
71
  });
72
+ FieldErrorText.displayName = "FieldErrorText";
71
73
 
72
74
  export const FieldLabel = ChakraField.Label;
@@ -4,10 +4,8 @@ import {
4
4
  chakra,
5
5
  Input as ChakraInput,
6
6
  InputProps as ChakraInputProps,
7
- type RecipeVariantProps,
8
- useRecipe,
9
7
  } from "@chakra-ui/react";
10
- import React, { forwardRef, PropsWithChildren } from "react";
8
+ import React, { forwardRef } from "react";
11
9
 
12
10
  import { inputRecipe } from "@/theme/recipes/input";
13
11
 
@@ -95,3 +93,4 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
95
93
  );
96
94
  },
97
95
  );
96
+ Input.displayName = "Input";
@@ -32,7 +32,6 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
32
32
  endElementProps,
33
33
  label,
34
34
  children,
35
- attached,
36
35
  ...rest
37
36
  } = props;
38
37
 
@@ -65,3 +64,4 @@ export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
65
64
  );
66
65
  },
67
66
  );
67
+ InputGroup.displayName = "InputGroup";
@@ -40,7 +40,7 @@ type ListBoxProps<T> = AriaListBoxProps<T> &
40
40
  /** Whether or not the listbox is waiting on new data, i.e. through a autosuggest search */
41
41
  loading?: boolean;
42
42
  /** The state of the listbox, provided externally somehow. */
43
- state: ListState<T> | SelectState<T>;
43
+ state: ListState<T> | SelectState<unknown>;
44
44
  /** UI to render if the collection is empty */
45
45
  emptyContent?: React.ReactNode;
46
46
  maxWidth?: BoxProps["maxWidth"];
@@ -72,7 +72,7 @@ type ListBoxProps<T> = AriaListBoxProps<T> &
72
72
  *
73
73
  * @example
74
74
  * ```jsx
75
- * const { data, isLoading } = useSWR('/api/options')
75
+ * const { data, isLoading } = useSWR('/api/options')
76
76
  * const state = useListState({ items: data });
77
77
  * const ref = useRef(null);
78
78
  *
@@ -99,7 +99,7 @@ export const ListBox = forwardRef<HTMLDivElement, ListBoxProps<object>>(
99
99
  maxWidth={maxWidth}
100
100
  >
101
101
  {state.collection.size === 0 && props.emptyContent}
102
- {Array.from(state.collection).map((item) =>
102
+ {[...state.collection].map((item) =>
103
103
  item.type === "section" ? (
104
104
  <ListBoxSection key={item.key} section={item} state={state} />
105
105
  ) : (
@@ -111,6 +111,7 @@ export const ListBox = forwardRef<HTMLDivElement, ListBoxProps<object>>(
111
111
  );
112
112
  },
113
113
  );
114
+ ListBox.displayName = "ListBox";
114
115
 
115
116
  /**
116
117
  * Renders a label for a listbox item.
@@ -140,7 +141,7 @@ export function ItemDescription({ children }: { children: React.ReactNode }) {
140
141
 
141
142
  type OptionProps = {
142
143
  item: Node<unknown>;
143
- state: SelectState<any> | ListState<unknown>;
144
+ state: SelectState<unknown> | ListState<unknown>;
144
145
  };
145
146
  function Option({ item, state }: OptionProps) {
146
147
  const ref = useRef(null);
@@ -177,7 +178,7 @@ function Option({ item, state }: OptionProps) {
177
178
  TODO: Follow up with react-spectrum to see if they can solve it on their end
178
179
  */
179
180
  useEffect(() => {
180
- (ref as any)?.current?.addEventListener(
181
+ (ref as React.RefObject<HTMLDivElement>)?.current?.addEventListener(
181
182
  "touchend",
182
183
  (event: TouchEvent) => {
183
184
  event.preventDefault();
@@ -210,7 +211,7 @@ const useOptionContext = () => {
210
211
 
211
212
  type ListBoxSectionProps = {
212
213
  section: Node<unknown>;
213
- state: any;
214
+ state: ListState<unknown> | SelectState<unknown>;
214
215
  };
215
216
  function ListBoxSection({ section, state }: ListBoxSectionProps) {
216
217
  const { itemProps, headingProps, groupProps } = useListBoxSection({
@@ -239,8 +240,8 @@ function ListBoxSection({ section, state }: ListBoxSectionProps) {
239
240
  </Box>
240
241
  )}
241
242
  <List {...groupProps} padding={0} listStyleType="none">
242
- {Array.from(state.collection.getChildren(section.key)).map(
243
- (item: any) => (
243
+ {[...(state.collection.getChildren?.(section.key) ?? [])].map(
244
+ (item: Node<unknown>) => (
244
245
  <Option key={item.key} item={item} state={state} />
245
246
  ),
246
247
  )}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  NativeSelect as ChakraNativeSelect,
4
+ NativeSelectFieldProps as ChakraNativeSelectFieldProps,
4
5
  RecipeVariantProps,
5
6
  useSlotRecipe,
6
- NativeSelectFieldProps as ChakraNativeSelectFieldProps,
7
7
  } from "@chakra-ui/react";
8
8
  import { DropdownDownFill18Icon } from "@vygruppen/spor-icon-react";
9
9
  import * as React from "react";
@@ -46,7 +46,6 @@ export const NativeSelect = React.forwardRef<
46
46
  NativeSelectdProps
47
47
  >(function NativeSelect(props, ref) {
48
48
  const {
49
- icon,
50
49
  children,
51
50
  variant = "core",
52
51
  label,
@@ -68,23 +68,20 @@ export const NumericStepper = React.forwardRef<
68
68
  HTMLDivElement,
69
69
  NumericStepperProps
70
70
  >(
71
- (
72
- {
73
- name: nameProp,
74
- id: idProp,
75
- value: valueProp,
76
- defaultValue = 1,
77
- onChange: onChangeProp,
78
- minValue = 0,
79
- maxValue = 99,
80
- disabled,
81
- withInput = true,
82
- stepSize = 1,
83
- showZero = false,
84
- ariaLabelContext = { singular: "", plural: "" },
85
- }: NumericStepperProps,
86
- ref,
87
- ) => {
71
+ ({
72
+ name: nameProp,
73
+ id: idProp,
74
+ value: valueProp,
75
+ defaultValue = 1,
76
+ onChange: onChangeProp,
77
+ minValue = 0,
78
+ maxValue = 99,
79
+ disabled,
80
+ withInput = true,
81
+ stepSize = 1,
82
+ showZero = false,
83
+ ariaLabelContext = { singular: "", plural: "" },
84
+ }: NumericStepperProps) => {
88
85
  const addButtonRef = useRef<HTMLButtonElement>(null);
89
86
  const { t } = useTranslation();
90
87
  const recipe = useSlotRecipe({ recipe: numericStepperRecipe });
@@ -135,9 +132,9 @@ export const NumericStepper = React.forwardRef<
135
132
  visibility={!showZero && value === 0 ? "hidden" : "visible"}
136
133
  aria-live="assertive"
137
134
  aria-label={
138
- ariaLabelContext.plural !== ""
139
- ? t(texts.currentNumberAriaLabel(ariaLabelContext.plural))
140
- : ""
135
+ ariaLabelContext.plural === ""
136
+ ? ""
137
+ : t(texts.currentNumberAriaLabel(ariaLabelContext.plural))
141
138
  }
142
139
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
143
140
  const numericInput = Number(e.target.value);
@@ -159,9 +156,9 @@ export const NumericStepper = React.forwardRef<
159
156
  visibility={!showZero && value === 0 ? "hidden" : "visible"}
160
157
  aria-live="assertive"
161
158
  aria-label={
162
- ariaLabelContext.plural !== ""
163
- ? t(texts.currentNumberAriaLabel(ariaLabelContext.plural))
164
- : ""
159
+ ariaLabelContext.plural === ""
160
+ ? ""
161
+ : t(texts.currentNumberAriaLabel(ariaLabelContext.plural))
165
162
  }
166
163
  >
167
164
  {value}
@@ -187,6 +184,7 @@ export const NumericStepper = React.forwardRef<
187
184
  );
188
185
  },
189
186
  );
187
+ NumericStepper.displayName = "NumericStepper";
190
188
 
191
189
  type VerySmallButtonProps = {
192
190
  /** The icon to render */
@@ -220,6 +218,7 @@ const VerySmallButton = React.forwardRef<
220
218
  />
221
219
  );
222
220
  });
221
+ VerySmallButton.displayName = "VerySmallButton";
223
222
 
224
223
  type IconPropTypes = BoxProps & { stepLabel: number };
225
224
 
@@ -47,7 +47,6 @@ export interface PasswordInputProps
47
47
  export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
48
48
  (props, ref) => {
49
49
  const {
50
- rootProps,
51
50
  defaultVisible,
52
51
  visible: visibleProp,
53
52
  onVisibleChange,
@@ -89,6 +88,7 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
89
88
  );
90
89
  },
91
90
  );
91
+ PasswordInput.displayName = "PasswordInput";
92
92
 
93
93
  const VisibilityTrigger = React.forwardRef<HTMLButtonElement, ButtonProps>(
94
94
  (props, ref) => {
@@ -107,6 +107,7 @@ const VisibilityTrigger = React.forwardRef<HTMLButtonElement, ButtonProps>(
107
107
  );
108
108
  },
109
109
  );
110
+ VisibilityTrigger.displayName = "VisibilityTrigger";
110
111
 
111
112
  const texts = createTexts({
112
113
  showPassword: {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useControllableState } from "@chakra-ui/react";
3
- import React, { forwardRef } from "react";
3
+ import { forwardRef } from "react";
4
4
 
5
5
  import { createTexts, Input, InputProps, useTranslation } from "..";
6
6
  import { AttachedInputs } from "./AttachedInputs";
@@ -20,6 +20,7 @@ type PhoneNumberInputProps = InputProps & {
20
20
  value?: CountryCodeAndPhoneNumber;
21
21
  /** Returns an extra optional text when true */
22
22
  optional?: boolean;
23
+ allowedCountryCodes?: string[];
23
24
  invalid?: boolean;
24
25
  errorText?: string;
25
26
  };
@@ -51,6 +52,7 @@ export const PhoneNumberInput = forwardRef<
51
52
  onValueChange: externalOnChange,
52
53
  variant,
53
54
  optional,
55
+ allowedCountryCodes,
54
56
  invalid,
55
57
  errorText,
56
58
  } = props;
@@ -92,6 +94,7 @@ export const PhoneNumberInput = forwardRef<
92
94
  height="100%"
93
95
  width="6.25rem"
94
96
  variant={variant}
97
+ allowedCountryCodes={allowedCountryCodes}
95
98
  data-state="on"
96
99
  />
97
100
  <Input
@@ -103,7 +106,7 @@ export const PhoneNumberInput = forwardRef<
103
106
  onChange={(e) => {
104
107
  const target = e.target as HTMLInputElement;
105
108
  // Removes everything but numbers, spaces and dashes
106
- const strippedValue = target.value.replace(/[^\d\s-]/g, "");
109
+ const strippedValue = target.value.replaceAll(/[^\d\s-]/g, "");
107
110
  onChange({
108
111
  countryCode: value.countryCode,
109
112
  nationalNumber: strippedValue,
@@ -118,6 +121,7 @@ export const PhoneNumberInput = forwardRef<
118
121
  </AttachedInputs>
119
122
  );
120
123
  });
124
+ PhoneNumberInput.displayName = "PhoneNumberInput";
121
125
 
122
126
  const texts = createTexts({
123
127
  phoneNumber: {
@@ -73,6 +73,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
73
73
  ref,
74
74
  ) => {
75
75
  const internalRef = useRef<HTMLDivElement>(null);
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
77
  const popoverRef = ref ?? (internalRef as any);
77
78
 
78
79
  const { popoverProps, underlayProps } = usePopover(
@@ -112,3 +113,4 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
112
113
  );
113
114
  },
114
115
  );
116
+ Popover.displayName = "Popover";
@@ -41,6 +41,7 @@ export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
41
41
  </ChakraRadioGroup.Item>
42
42
  );
43
43
  });
44
+ Radio.displayName = "Radio";
44
45
 
45
46
  type RadioGroupProps = Omit<
46
47
  ChakraRadioGroup.RootProps,
@@ -52,3 +53,4 @@ export const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(
52
53
  return <ChakraRadioGroup.Root ref={ref} {...props} aria-labelledby="" />;
53
54
  },
54
55
  );
56
+ RadioGroup.displayName = "RadioGroup";
@@ -4,7 +4,7 @@ import {
4
4
  CloseOutline24Icon,
5
5
  SearchOutline24Icon,
6
6
  } from "@vygruppen/spor-icon-react";
7
- import React, { forwardRef } from "react";
7
+ import { forwardRef } from "react";
8
8
 
9
9
  import { createTexts, Input, InputProps, useTranslation } from "..";
10
10
  import { IconButton } from "../button/IconButton";
@@ -49,6 +49,7 @@ export const SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(
49
49
  );
50
50
  },
51
51
  );
52
+ SearchInput.displayName = "SearchInput";
52
53
 
53
54
  const texts = createTexts({
54
55
  label: {
@@ -80,6 +80,7 @@ export const Select = React.forwardRef<HTMLDivElement, SelectProps>(
80
80
  );
81
81
  },
82
82
  );
83
+ Select.displayName = "Select";
83
84
 
84
85
  type SelectItemProps = ChakraSelect.ItemProps &
85
86
  React.PropsWithChildren<SelectVariantProps> & {
@@ -108,6 +109,7 @@ export const SelectItem = React.forwardRef<HTMLDivElement, SelectItemProps>(
108
109
  );
109
110
  },
110
111
  );
112
+ SelectItem.displayName = "SelectItem";
111
113
 
112
114
  type SelectItemGroupProps = ChakraSelect.ItemGroupProps &
113
115
  React.PropsWithChildren<SelectVariantProps> & {
@@ -218,8 +220,12 @@ export const SelectValueText = React.forwardRef<
218
220
  >
219
221
  <ChakraSelect.Context>
220
222
  {(select: {
221
- selectedItems: any;
222
- collection: { stringifyItem: (arg0: any) => any };
223
+ selectedItems: CollectionItem[];
224
+
225
+ collection: {
226
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
+ stringifyItem: (arg0: any) => any;
228
+ } /* Find a way to not use any */;
223
229
  }) => {
224
230
  const items = select.selectedItems;
225
231
  if (items.length === 0) return placeholder;