@koobiq/react-primitives 0.0.1-beta.9 → 0.1.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 (63) hide show
  1. package/dist/behaviors/index.d.ts +8 -11
  2. package/dist/behaviors/useButton.d.ts +12 -10
  3. package/dist/behaviors/useButton.js +11 -22
  4. package/dist/behaviors/useCheckbox.d.ts +10 -45
  5. package/dist/behaviors/useCheckbox.js +15 -38
  6. package/dist/behaviors/useLink.d.ts +5 -9
  7. package/dist/behaviors/useLink.js +8 -17
  8. package/dist/behaviors/useNumberField.d.ts +1 -22
  9. package/dist/behaviors/useNumberField.js +2 -13
  10. package/dist/behaviors/useRadio.d.ts +8 -35
  11. package/dist/behaviors/useRadio.js +12 -16
  12. package/dist/behaviors/useRadioGroup.d.ts +2 -55
  13. package/dist/behaviors/useRadioGroup.js +1 -18
  14. package/dist/behaviors/useRadioGroupState.d.ts +2 -42
  15. package/dist/behaviors/useRadioGroupState.js +1 -16
  16. package/dist/behaviors/useSwitch.d.ts +316 -0
  17. package/dist/behaviors/useSwitch.js +33 -0
  18. package/dist/components/Button/Button.js +17 -13
  19. package/dist/components/Button/types.d.ts +14 -16
  20. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  21. package/dist/components/Checkbox/Checkbox.js +36 -19
  22. package/dist/components/Checkbox/types.d.ts +8 -8
  23. package/dist/components/Group/Group.js +7 -7
  24. package/dist/components/Group/types.d.ts +8 -8
  25. package/dist/components/Link/Link.js +21 -8
  26. package/dist/components/Link/types.d.ts +5 -5
  27. package/dist/components/NumberField/NumberField.d.ts +1 -1
  28. package/dist/components/NumberField/NumberField.js +9 -9
  29. package/dist/components/NumberField/types.d.ts +4 -4
  30. package/dist/components/ProgressBar/ProgressBar.js +4 -4
  31. package/dist/components/ProgressBar/types.d.ts +2 -3
  32. package/dist/components/Radio/Radio.d.ts +1 -1
  33. package/dist/components/Radio/Radio.js +20 -13
  34. package/dist/components/Radio/RadioContext.d.ts +2 -17
  35. package/dist/components/Radio/RadioGroup.d.ts +1 -1
  36. package/dist/components/Radio/RadioGroup.js +4 -4
  37. package/dist/components/Radio/types.d.ts +16 -14
  38. package/dist/components/Switch/Switch.d.ts +3 -0
  39. package/dist/components/{Toggle/Toggle.js → Switch/Switch.js} +19 -19
  40. package/dist/components/Switch/index.d.ts +2 -0
  41. package/dist/components/Switch/types.d.ts +18 -0
  42. package/dist/components/TextField/TextField.d.ts +2 -1
  43. package/dist/components/TextField/TextField.js +58 -57
  44. package/dist/components/TextField/types.d.ts +11 -8
  45. package/dist/components/Textarea/Textarea.d.ts +2 -4
  46. package/dist/components/Textarea/Textarea.js +6 -2
  47. package/dist/components/Textarea/types.d.ts +2 -1
  48. package/dist/components/index.d.ts +12 -12
  49. package/dist/index.d.ts +31 -15
  50. package/dist/index.js +39 -36
  51. package/package.json +32 -11
  52. package/dist/behaviors/useNumberFieldState.d.ts +0 -25
  53. package/dist/behaviors/useNumberFieldState.js +0 -13
  54. package/dist/behaviors/useProgressBar.d.ts +0 -7
  55. package/dist/behaviors/useProgressBar.js +0 -9
  56. package/dist/behaviors/useTextField.d.ts +0 -19
  57. package/dist/behaviors/useTextField.js +0 -24
  58. package/dist/behaviors/useToggle.d.ts +0 -44
  59. package/dist/behaviors/useToggle.js +0 -54
  60. package/dist/components/Toggle/Toggle.d.ts +0 -3
  61. package/dist/components/Toggle/index.d.ts +0 -2
  62. package/dist/components/Toggle/types.d.ts +0 -18
  63. package/dist/types.d.ts +0 -8
@@ -1,11 +1,8 @@
1
- export * from './useButton.js';
2
- export * from './useCheckbox.js';
3
- export * from './useLink.js';
4
- export * from './useTextField.js';
5
- export * from './useToggle.js';
6
- export * from './useRadio.js';
7
- export * from './useRadioGroup.js';
8
- export * from './useRadioGroupState.js';
9
- export * from './useProgressBar.js';
10
- export * from './useNumberField.js';
11
- export * from './useNumberFieldState.js';
1
+ export * from './useButton';
2
+ export * from './useCheckbox';
3
+ export * from './useLink';
4
+ export * from './useSwitch';
5
+ export * from './useRadio';
6
+ export * from './useRadioGroup';
7
+ export * from './useRadioGroupState';
8
+ export * from './useNumberField';
@@ -1,12 +1,14 @@
1
- import type { RefObject } from 'react';
2
- import type { ButtonOptions } from '../types';
3
- export type UseButtonProps = ButtonOptions;
4
- export declare function useButton(props: UseButtonProps, ref: RefObject<Element | null>): {
5
- pressed: boolean;
6
- hovered: boolean;
7
- focused: boolean;
8
- disabled: boolean | undefined;
1
+ import type { ElementType, RefObject } from 'react';
2
+ import { type HoverEvents } from '@koobiq/react-core';
3
+ import { type AriaButtonOptions } from '@react-aria/button';
4
+ export type UseButtonProps<E extends ElementType> = AriaButtonOptions<E> & HoverEvents;
5
+ export type ButtonOptions = AriaButtonOptions<ElementType>;
6
+ export declare function useButton<E extends ElementType>(props: UseButtonProps<E>, ref: RefObject<Element | null>): {
7
+ isPressed: boolean;
8
+ isHovered: boolean;
9
+ isFocused: boolean;
10
+ isDisabled: boolean | undefined;
9
11
  buttonProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
10
- focusVisible: boolean;
12
+ isFocusVisible: boolean;
11
13
  };
12
- export type UseButtonReturn = ReturnType<typeof useButton>;
14
+ export type UseButtonReturn<E extends ElementType> = ReturnType<typeof useButton<E>>;
@@ -2,34 +2,23 @@
2
2
  import { useFocusRing, useHover, mergeProps } from "@koobiq/react-core";
3
3
  import { useButton as useButton$1 } from "@react-aria/button";
4
4
  function useButton(props, ref) {
5
- const { onClick, onPress, disabled, ...otherProps } = props;
6
- const {
7
- focusProps,
8
- isFocused: focused,
9
- isFocusVisible: focusVisible
10
- } = useFocusRing({
5
+ const { isDisabled } = props;
6
+ const { focusProps, isFocused, isFocusVisible } = useFocusRing({
11
7
  within: true
12
8
  });
13
- const { hoverProps, isHovered: hovered } = useHover({
14
- ...props,
15
- isDisabled: disabled
16
- });
17
- const { buttonProps: commonButtonProps, isPressed: pressed } = useButton$1(
18
- {
19
- ...otherProps,
20
- onPress: onPress || onClick,
21
- isDisabled: disabled
22
- },
9
+ const { hoverProps, isHovered } = useHover(props);
10
+ const { buttonProps: buttonPropsReactAria, isPressed } = useButton$1(
11
+ props,
23
12
  ref
24
13
  );
25
- const buttonProps = mergeProps(commonButtonProps, focusProps, hoverProps);
14
+ const buttonProps = mergeProps(buttonPropsReactAria, focusProps, hoverProps);
26
15
  return {
27
- pressed,
28
- hovered,
29
- focused,
30
- disabled,
16
+ isPressed,
17
+ isHovered,
18
+ isFocused,
19
+ isDisabled,
31
20
  buttonProps,
32
- focusVisible
21
+ isFocusVisible
33
22
  };
34
23
  }
35
24
  export {
@@ -1,56 +1,21 @@
1
1
  import type { RefObject } from 'react';
2
- import type { ExtendableProps } from '@koobiq/react-core';
3
2
  import type { AriaCheckboxProps } from '@react-aria/checkbox';
4
- export type UseCheckboxProps = ExtendableProps<{
5
- /**
6
- * If `true`, the component will indicate an error.
7
- * @default false
8
- * */
9
- error?: boolean;
10
- /**
11
- * If `true`, the component is checked.
12
- * @default false
13
- * */
14
- checked?: boolean;
15
- /** It prevents the user from changing the value of the checkbox.
16
- * @default false
17
- */
18
- readonly?: boolean;
19
- /**
20
- * If `true`, the component is disabled.
21
- * @default false
22
- * */
23
- disabled?: boolean;
24
- /**
25
- * If `true`, the input element is required.
26
- * @default false
27
- * */
28
- required?: boolean;
29
- /**
30
- * If `true`, the component appears indeterminate.
31
- * @default false
32
- * */
33
- indeterminate?: boolean;
34
- /** The default checked state. Use when the component is not controlled. */
35
- defaultChecked?: boolean;
36
- /** Callback fired when the state is changed. */
37
- onChange?: (checked: boolean) => void;
38
- }, Omit<AriaCheckboxProps, 'onChange' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'isSelected' | 'isDisabled' | 'isIndeterminate' | 'defaultSelected'>>;
3
+ export type UseCheckboxProps = AriaCheckboxProps;
39
4
  export declare function useCheckbox(props: UseCheckboxProps, inputRef: RefObject<HTMLInputElement | null>): {
40
5
  validationErrors: string[];
41
6
  validationDetails: ValidityState;
7
+ isInvalid: boolean;
8
+ isPressed: boolean;
9
+ isHovered: boolean;
10
+ isFocused: boolean;
11
+ isSelected: boolean;
12
+ isDisabled: boolean;
13
+ isReadOnly: boolean;
42
14
  labelProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement> & import("react").LabelHTMLAttributes<HTMLLabelElement>;
43
15
  inputProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
44
16
  ref: RefObject<HTMLInputElement | null>;
45
17
  };
46
- indeterminate: boolean | undefined;
47
- error: boolean;
48
- pressed: boolean;
49
- hovered: boolean;
50
- focused: boolean;
51
- checked: boolean;
52
- disabled: boolean;
53
- readonly: boolean;
54
- focusVisible: boolean;
18
+ isFocusVisible: boolean;
19
+ isIndeterminate: boolean | undefined;
55
20
  };
56
21
  export type UseCheckboxReturn = ReturnType<typeof useCheckbox>;
@@ -1,24 +1,12 @@
1
1
  "use client";
2
- import { useToggleState, useHover, useFocusRing, mergeProps } from "@koobiq/react-core";
2
+ import { useHover, useFocusRing, mergeProps } from "@koobiq/react-core";
3
3
  import { useCheckbox as useCheckbox$1 } from "@react-aria/checkbox";
4
+ import { useToggleState } from "@react-stately/toggle";
4
5
  function useCheckbox(props, inputRef) {
5
- const {
6
- error,
7
- checked,
8
- disabled,
9
- readonly,
10
- required,
11
- indeterminate,
12
- defaultChecked,
13
- onChange
14
- } = props;
15
- const state = useToggleState({
16
- isSelected: checked,
17
- defaultSelected: defaultChecked,
18
- onChange
19
- });
6
+ const { isDisabled: isDisabledProp, isIndeterminate: isIndeterminateProp } = props;
7
+ const state = useToggleState(props);
20
8
  const { hoverProps, isHovered } = useHover({
21
- isDisabled: disabled
9
+ isDisabled: isDisabledProp
22
10
  });
23
11
  const { focusProps, isFocused, isFocusVisible } = useFocusRing();
24
12
  const {
@@ -30,34 +18,23 @@ function useCheckbox(props, inputRef) {
30
18
  isReadOnly,
31
19
  isPressed,
32
20
  ...other
33
- } = useCheckbox$1(
34
- {
35
- ...props,
36
- isInvalid: error,
37
- isDisabled: disabled,
38
- isIndeterminate: indeterminate,
39
- isReadOnly: readonly,
40
- isRequired: required
41
- },
42
- state,
43
- inputRef
44
- );
21
+ } = useCheckbox$1(props, state, inputRef);
45
22
  const labelProps = mergeProps(hoverProps, commonLabelProps);
46
23
  const inputProps = mergeProps(focusProps, commonInputProps, {
47
24
  ref: inputRef
48
25
  });
49
26
  return {
27
+ isInvalid,
28
+ isPressed,
29
+ isHovered,
30
+ isFocused,
31
+ isSelected,
32
+ isDisabled,
33
+ isReadOnly,
50
34
  labelProps,
51
35
  inputProps,
52
- indeterminate,
53
- error: isInvalid,
54
- pressed: isPressed,
55
- hovered: isHovered,
56
- focused: isFocused,
57
- checked: isSelected,
58
- disabled: isDisabled,
59
- readonly: isReadOnly,
60
- focusVisible: isFocusVisible,
36
+ isFocusVisible,
37
+ isIndeterminate: isIndeterminateProp,
61
38
  ...other
62
39
  };
63
40
  }
@@ -1,15 +1,11 @@
1
1
  import type { RefObject } from 'react';
2
- import type { ExtendableProps } from '@koobiq/react-core';
3
2
  import type { AriaLinkOptions } from '@react-aria/link';
4
- export type UseLinkProps = ExtendableProps<{
5
- disabled?: boolean;
6
- onClick?: AriaLinkOptions['onPress'];
7
- }, Omit<AriaLinkOptions, 'isDisabled'>>;
3
+ export type UseLinkProps = AriaLinkOptions;
8
4
  export declare function useLink(props: UseLinkProps, ref: RefObject<HTMLElement | null>): {
9
5
  linkProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
10
- pressed: boolean;
11
- hovered: boolean;
12
- focused: boolean;
13
- focusVisible: boolean;
6
+ isPressed: boolean;
7
+ isHovered: boolean;
8
+ isFocused: boolean;
9
+ isFocusVisible: boolean;
14
10
  };
15
11
  export type UseLinkReturn = ReturnType<typeof useLink>;
@@ -2,32 +2,23 @@
2
2
  import { useHover, useFocusRing, mergeProps } from "@koobiq/react-core";
3
3
  import { useLink as useLink$1 } from "@react-aria/link";
4
4
  function useLink(props, ref) {
5
- const { disabled, onClick, ...otherProps } = props;
6
- const { hoverProps, isHovered } = useHover({
7
- ...otherProps,
8
- isDisabled: disabled
9
- });
5
+ const { hoverProps, isHovered } = useHover(props);
10
6
  const { focusProps, isFocused, isFocusVisible } = useFocusRing();
11
7
  const { linkProps: commonLinkProps, isPressed } = useLink$1(
12
- {
13
- ...otherProps,
14
- onPress: onClick,
15
- isDisabled: disabled
16
- },
8
+ props,
17
9
  ref
18
10
  );
19
11
  const linkProps = mergeProps(
20
- { disabled },
12
+ commonLinkProps,
21
13
  focusProps,
22
- hoverProps,
23
- commonLinkProps
14
+ hoverProps
24
15
  );
25
16
  return {
26
17
  linkProps,
27
- pressed: isPressed,
28
- hovered: isHovered,
29
- focused: isFocused,
30
- focusVisible: isFocusVisible
18
+ isPressed,
19
+ isHovered,
20
+ isFocused,
21
+ isFocusVisible
31
22
  };
32
23
  }
33
24
  export {
@@ -1,26 +1,5 @@
1
1
  import type { RefObject } from 'react';
2
- import type { ExtendableProps } from '@koobiq/react-core';
3
2
  import type { AriaNumberFieldProps } from '@react-aria/numberfield';
4
- export type UseNumberFieldProps = ExtendableProps<{
5
- /**
6
- * If `true`, the component is disabled.
7
- * @default false
8
- * */
9
- disabled?: boolean;
10
- /** It prevents the user from changing the value of the checkbox.
11
- * @default false
12
- */
13
- readonly?: boolean;
14
- /**
15
- * If `true`, the input element is required.
16
- * @default false
17
- * */
18
- required?: boolean;
19
- /**
20
- * If `true`, the component will indicate an error.
21
- * @default false
22
- * */
23
- error?: boolean;
24
- }, Omit<AriaNumberFieldProps, 'isDisabled' | 'isInvalid' | 'isRequired' | 'isReadOnly' | 'isWheelDisabled'>>;
3
+ export type UseNumberFieldProps = AriaNumberFieldProps;
25
4
  export declare function useNumberField(props: UseNumberFieldProps, ref: RefObject<HTMLInputElement | null>): import("@react-aria/numberfield").NumberFieldAria;
26
5
  export type UseNumberFieldReturn = ReturnType<typeof useNumberField>;
@@ -1,21 +1,10 @@
1
1
  import { useLocale } from "@react-aria/i18n";
2
2
  import { useNumberField as useNumberField$1 } from "@react-aria/numberfield";
3
- import { useNumberFieldState } from "./useNumberFieldState.js";
3
+ import { useNumberFieldState } from "@react-stately/numberfield";
4
4
  function useNumberField(props, ref) {
5
- const { disabled, error, readonly, required, ...other } = props;
6
5
  const { locale } = useLocale();
7
6
  const state = useNumberFieldState({ ...props, locale });
8
- return useNumberField$1(
9
- {
10
- isDisabled: disabled,
11
- isReadOnly: readonly,
12
- isRequired: required,
13
- isInvalid: error,
14
- ...other
15
- },
16
- state,
17
- ref
18
- );
7
+ return useNumberField$1(props, state, ref);
19
8
  }
20
9
  export {
21
10
  useNumberField
@@ -1,45 +1,18 @@
1
1
  import type { RefObject } from 'react';
2
- import type { ExtendableProps } from '@koobiq/react-core';
3
2
  import type { AriaRadioProps } from '@react-aria/radio';
4
3
  import type { RadioGroupState } from '@react-stately/radio';
5
- export type UseRadioProps = ExtendableProps<{
6
- /**
7
- * If `true`, the component is disabled.
8
- * @default false
9
- * */
10
- disabled?: boolean;
11
- }, Omit<AriaRadioProps, 'isDisabled'>>;
12
- export type UseRadioState = ExtendableProps<{
13
- /**
14
- * If `true`, the component is disabled.
15
- * @default false
16
- * */
17
- disabled?: boolean;
18
- /** It prevents the user from changing the value of the checkbox.
19
- * @default false
20
- */
21
- readonly?: boolean;
22
- /**
23
- * If `true`, the input element is required.
24
- * @default false
25
- * */
26
- required?: boolean;
27
- /**
28
- * If `true`, the component will indicate an error.
29
- * @default false
30
- * */
31
- error?: boolean;
32
- }, Omit<RadioGroupState, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid'>>;
4
+ export type UseRadioProps = AriaRadioProps;
5
+ export type UseRadioState = RadioGroupState;
33
6
  export declare function useRadio(props: UseRadioProps, state: UseRadioState, ref: RefObject<HTMLInputElement | null>): {
34
7
  labelProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement> & import("react").LabelHTMLAttributes<HTMLLabelElement>;
35
8
  inputProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
36
9
  ref: RefObject<HTMLInputElement | null>;
37
10
  };
38
- pressed: boolean;
39
- hovered: boolean;
40
- focused: boolean;
41
- checked: boolean;
42
- disabled: boolean;
43
- focusVisible: boolean;
11
+ isPressed: boolean;
12
+ isHovered: boolean;
13
+ isFocused: boolean;
14
+ isSelected: boolean;
15
+ isDisabled: boolean;
16
+ isFocusVisible: boolean;
44
17
  };
45
18
  export type UseRadioReturn = ReturnType<typeof useRadio>;
@@ -2,7 +2,6 @@
2
2
  import { useHover, mergeProps, useFocusRing } from "@koobiq/react-core";
3
3
  import { useRadio as useRadio$1 } from "@react-aria/radio";
4
4
  function useRadio(props, state, ref) {
5
- const { disabled } = props;
6
5
  const {
7
6
  inputProps: commonInputProps,
8
7
  labelProps: commonLabelProps,
@@ -10,20 +9,17 @@ function useRadio(props, state, ref) {
10
9
  isSelected,
11
10
  isPressed
12
11
  } = useRadio$1(
13
- {
14
- ...props,
15
- isDisabled: disabled
16
- },
12
+ props,
17
13
  Object.assign(state, {
18
- isInvalid: state.error || false,
19
- isReadOnly: state.readonly || false,
20
- isDisabled: state.disabled || false,
21
- isRequired: state.required || false
14
+ isInvalid: state.isInvalid || false,
15
+ isReadOnly: state.isReadOnly || false,
16
+ isDisabled: state.isDisabled || false,
17
+ isRequired: state.isRequired || false
22
18
  }),
23
19
  ref
24
20
  );
25
21
  const { hoverProps, isHovered } = useHover({
26
- isDisabled: disabled
22
+ isDisabled
27
23
  });
28
24
  const labelProps = mergeProps(hoverProps, commonLabelProps);
29
25
  const { focusProps, isFocused, isFocusVisible } = useFocusRing();
@@ -33,12 +29,12 @@ function useRadio(props, state, ref) {
33
29
  return {
34
30
  labelProps,
35
31
  inputProps,
36
- pressed: isPressed,
37
- hovered: isHovered,
38
- focused: isFocused,
39
- checked: isSelected,
40
- disabled: isDisabled,
41
- focusVisible: isFocusVisible
32
+ isPressed,
33
+ isHovered,
34
+ isFocused,
35
+ isSelected,
36
+ isDisabled,
37
+ isFocusVisible
42
38
  };
43
39
  }
44
40
  export {
@@ -1,55 +1,2 @@
1
- import type { ExtendableProps } from '@koobiq/react-core';
2
- import { type AriaRadioGroupProps } from '@react-aria/radio';
3
- import type { RadioGroupState } from '@react-stately/radio';
4
- export type UseRadioGroupProps = ExtendableProps<{
5
- /**
6
- * If `true`, the component is disabled.
7
- * @default false
8
- * */
9
- disabled?: boolean;
10
- /** It prevents the user from changing the value of the checkbox.
11
- * @default false
12
- */
13
- readonly?: boolean;
14
- /**
15
- * If `true`, the input element is required.
16
- * @default false
17
- * */
18
- required?: boolean;
19
- /**
20
- * If `true`, the component will indicate an error.
21
- * @default false
22
- * */
23
- error?: boolean;
24
- }, Omit<AriaRadioGroupProps, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid'>>;
25
- export type UseRadioGroupState = ExtendableProps<{
26
- /**
27
- * If `true`, the component is disabled.
28
- * @default false
29
- * */
30
- disabled?: boolean;
31
- /** It prevents the user from changing the value of the checkbox.
32
- * @default false
33
- */
34
- readonly?: boolean;
35
- /**
36
- * If `true`, the input element is required.
37
- * @default false
38
- * */
39
- required?: boolean;
40
- /**
41
- * If `true`, the component will indicate an error.
42
- * @default false
43
- * */
44
- error?: boolean;
45
- }, Omit<RadioGroupState, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid'>>;
46
- export declare function useRadioGroup(props: UseRadioGroupProps, state: UseRadioGroupState): {
47
- radioGroupProps: import("@react-types/shared").DOMAttributes;
48
- labelProps: import("@react-types/shared").DOMAttributes;
49
- descriptionProps: import("@react-types/shared").DOMAttributes;
50
- errorMessageProps: import("@react-types/shared").DOMAttributes;
51
- validationErrors: string[];
52
- validationDetails: ValidityState;
53
- error: boolean;
54
- };
55
- export type UseRadioGroupReturn = ReturnType<typeof useRadioGroup>;
1
+ import { useRadioGroup as useRadioGroupReactAria } from '@react-aria/radio';
2
+ export declare const useRadioGroup: typeof useRadioGroupReactAria;
@@ -1,22 +1,5 @@
1
1
  import { useRadioGroup as useRadioGroup$1 } from "@react-aria/radio";
2
- function useRadioGroup(props, state) {
3
- const { isInvalid, ...other } = useRadioGroup$1(
4
- {
5
- ...props,
6
- isInvalid: props.error || false,
7
- isReadOnly: props.readonly || false,
8
- isDisabled: props.disabled || false,
9
- isRequired: props.required || false
10
- },
11
- Object.assign(state, {
12
- isInvalid: state.error || false,
13
- isReadOnly: state.readonly || false,
14
- isDisabled: state.disabled || false,
15
- isRequired: state.required || false
16
- })
17
- );
18
- return { error: isInvalid, ...other };
19
- }
2
+ const useRadioGroup = useRadioGroup$1;
20
3
  export {
21
4
  useRadioGroup
22
5
  };
@@ -1,42 +1,2 @@
1
- import type { ExtendableProps } from '@koobiq/react-core';
2
- import type { RadioGroupProps } from '@react-stately/radio';
3
- export type UseRadioGroupStateProps = ExtendableProps<{
4
- /**
5
- * If `true`, the component is disabled.
6
- * @default false
7
- * */
8
- disabled?: boolean;
9
- /** It prevents the user from changing the value of the checkbox.
10
- * @default false
11
- */
12
- readonly?: boolean;
13
- /**
14
- * If `true`, the input element is required.
15
- * @default false
16
- * */
17
- required?: boolean;
18
- /**
19
- * If `true`, the component will indicate an error.
20
- * @default false
21
- * */
22
- error?: boolean;
23
- }, Omit<RadioGroupProps, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid'>>;
24
- export declare function useRadioGroupState(props: UseRadioGroupStateProps): {
25
- name: string;
26
- validationState: import("@react-types/shared").ValidationState | null;
27
- selectedValue: string | null;
28
- setSelectedValue(value: string | null): void;
29
- lastFocusedValue: string | null;
30
- setLastFocusedValue(value: string | null): void;
31
- realtimeValidation: import("@react-types/shared").ValidationResult;
32
- displayValidation: import("@react-types/shared").ValidationResult;
33
- updateValidation(result: import("@react-types/shared").ValidationResult): void;
34
- resetValidation(): void;
35
- commitValidation(): void;
36
- error: boolean;
37
- readonly: boolean;
38
- required: boolean;
39
- disabled: boolean;
40
- };
41
- export type UseRadioGroupStateReturn = ReturnType<typeof useRadioGroupState>;
42
- export type RadioGroupState = UseRadioGroupStateReturn;
1
+ import { useRadioGroupState as useRadioGroupStateReactAria } from '@react-stately/radio';
2
+ export declare const useRadioGroupState: typeof useRadioGroupStateReactAria;
@@ -1,20 +1,5 @@
1
1
  import { useRadioGroupState as useRadioGroupState$1 } from "@react-stately/radio";
2
- function useRadioGroupState(props) {
3
- const { isDisabled, isInvalid, isReadOnly, isRequired, ...other } = useRadioGroupState$1({
4
- ...props,
5
- isInvalid: props.error || false,
6
- isReadOnly: props.readonly || false,
7
- isDisabled: props.disabled || false,
8
- isRequired: props.required || false
9
- });
10
- return {
11
- error: isInvalid,
12
- readonly: isReadOnly,
13
- required: isRequired,
14
- disabled: isDisabled,
15
- ...other
16
- };
17
- }
2
+ const useRadioGroupState = useRadioGroupState$1;
18
3
  export {
19
4
  useRadioGroupState
20
5
  };