@vygruppen/spor-react 12.7.1 → 12.8.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
3
  "type": "module",
4
- "version": "12.7.1",
4
+ "version": "12.8.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -1,21 +1,10 @@
1
- import {
2
- CheckboxGroup as ChakraCheckboxGroup,
3
- CheckboxGroupProps as ChakraCheckboxGroupProps,
4
- Stack,
5
- } from "@chakra-ui/react";
6
- import React, { forwardRef } from "react";
1
+ import { CheckboxGroup as ChakraCheckboxGroup, Stack } from "@chakra-ui/react";
2
+ import React from "react";
7
3
 
8
- export type CheckboxGroupProps = Exclude<
9
- ChakraCheckboxGroupProps,
10
- "colorPalette" | "size" | "variant"
4
+ export type CheckboxGroupProps = React.ComponentProps<
5
+ typeof ChakraCheckboxGroup
11
6
  > & {
12
- /* Defaults to row */
13
- direction?: "row" | "column";
14
- children: React.ReactNode;
15
- /* Defaults to 1 */
16
- gap?: number | string;
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- [key: string]: any; //Find a way to not use type any
7
+ direction: "row" | "column"; // Defaults to row
19
8
  };
20
9
  /**
21
10
  * Used to group several checkboxes together. You can pass the default value, as well as whether or not they're all disabled
@@ -36,19 +25,19 @@ export type CheckboxGroupProps = Exclude<
36
25
  * <Checkbox>Business</Checkbox>
37
26
  * <Checkbox>First Class</Checkbox>
38
27
  * </CheckboxGroup>
28
+ * ```
39
29
  */
40
30
 
41
- export const CheckboxGroup = forwardRef<HTMLDivElement, CheckboxGroupProps>(
42
- (props, ref) => {
43
- const { direction = "row", children, gap = 1, ...rest } = props;
31
+ export const CheckboxGroup = (props: CheckboxGroupProps) => {
32
+ // Forwardref caues issue with prop types not working. Forwardref is unessessary here, as ChakraCheckbox already has a ref prop and is deprecated in react 19.
33
+ const { direction = "row", children, gap = 1, ...rest } = props;
44
34
 
45
- return (
46
- <ChakraCheckboxGroup ref={ref} {...rest}>
47
- <Stack direction={direction} gap={gap}>
48
- {children}
49
- </Stack>
50
- </ChakraCheckboxGroup>
51
- );
52
- },
53
- );
35
+ return (
36
+ <ChakraCheckboxGroup {...rest}>
37
+ <Stack direction={direction} gap={gap}>
38
+ {children}
39
+ </Stack>
40
+ </ChakraCheckboxGroup>
41
+ );
42
+ };
54
43
  CheckboxGroup.displayName = "CheckboxGroup";
@@ -56,10 +56,10 @@ export const Combobox = (props: ComboboxProps<object>) => {
56
56
  loading,
57
57
  leftIcon,
58
58
  rightIcon,
59
- borderBottomLeftRadius = "sm",
60
- borderBottomRightRadius = "sm",
61
- borderTopLeftRadius = "sm",
62
- borderTopRightRadius = "sm",
59
+ borderBottomLeftRadius,
60
+ borderBottomRightRadius,
61
+ borderTopLeftRadius,
62
+ borderTopRightRadius,
63
63
  marginBottom,
64
64
  marginTop,
65
65
  marginX,
@@ -171,6 +171,7 @@ export const Combobox = (props: ComboboxProps<object>) => {
171
171
  )
172
172
  }
173
173
  placeholder=""
174
+ data-attachable
174
175
  />
175
176
  <span aria-hidden="true" data-trigger="multiselect"></span>
176
177
  {state.isOpen && !loading && (
@@ -55,7 +55,7 @@ export const CountryCodeSelect = forwardRef<
55
55
  collection={callingCodes}
56
56
  lazyMount
57
57
  aria-label={t(texts.countryCode)}
58
- variant={"rightSideSquare"}
58
+ sideRadiusVariant={"rightSideSquare"}
59
59
  >
60
60
  {callingCodes.items.map((code) => (
61
61
  <SelectItem as={"option"} key={code.label} item={code}>
@@ -28,7 +28,10 @@ export type FieldBaseProps = {
28
28
  floatingLabel?: boolean;
29
29
  };
30
30
 
31
- export type FieldProps = Omit<ChakraField.RootProps, "label" | "onChange"> &
31
+ export type FieldProps = Omit<
32
+ ChakraField.RootProps,
33
+ "label" | "onChange" | "onBlur" | "onFocus" | "onClick" | "children"
34
+ > &
32
35
  React.PropsWithChildren<FieldVariantProps> &
33
36
  FieldBaseProps;
34
37
 
@@ -68,7 +71,7 @@ export const Field = React.forwardRef<HTMLDivElement, FieldProps>(
68
71
  const styles = recipe();
69
72
 
70
73
  return (
71
- <Stack gap="2" ref={ref} {...rest}>
74
+ <Stack gap="2" ref={ref} width="100%" {...rest}>
72
75
  <ChakraField.Root
73
76
  disabled={disabled}
74
77
  invalid={invalid}
@@ -30,8 +30,9 @@ export type SelectProps = ChakraSelectRootProps &
30
30
  /**
31
31
  * A Select component.
32
32
  *
33
- * This component is useful to choose an item from a dropdown list of items. The list has four different variants, core, floating, rightSideSquare, leftSideSquare.
34
- * The last two variants are useful in attachecdInput for example in the PhoneNumberInput and CountryCodeSelect components.
33
+ * This component is useful to choose an item from a dropdown list of items. The list has two different variants, core, floating and floating.
34
+ * It also has a sideRadiusVariant that can be used to make the sides square, rightSideSquare, leftSideSquare.
35
+ * The sideRadiusVariant is useful in attachecdInput for example in the PhoneNumberInput and CountryCodeSelect components.
35
36
  *
36
37
  * @example
37
38
  * ```tsx
@@ -31,7 +31,7 @@ export const fieldSlotRecipe = defineSlotRecipe({
31
31
  textStyle: "xs",
32
32
  width: "fit-content",
33
33
  position: "absolute",
34
- bottom: -5,
34
+ top: "100%", // position below parent
35
35
  left: 3,
36
36
  zIndex: "dropdown",
37
37
  maxWidth: "50ch",
@@ -227,6 +227,8 @@ export const selectSlotRecipe = defineSlotRecipe({
227
227
  outlineColor: "floating.outline",
228
228
  },
229
229
  },
230
+ },
231
+ sideRadiusVariant: {
230
232
  rightSideSquare: {
231
233
  control: {
232
234
  outline: "1px solid",