@koobiq/react-primitives 0.0.1-beta.3 → 0.0.1-beta.31

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 (50) hide show
  1. package/dist/behaviors/index.d.ts +0 -2
  2. package/dist/behaviors/useButton.d.ts +6 -6
  3. package/dist/behaviors/useButton.js +10 -21
  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/useToggle.d.ts +309 -37
  11. package/dist/behaviors/useToggle.js +12 -33
  12. package/dist/components/Button/Button.js +17 -13
  13. package/dist/components/Button/ButtonContext.js +1 -0
  14. package/dist/components/Button/types.d.ts +7 -7
  15. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  16. package/dist/components/Checkbox/Checkbox.js +36 -19
  17. package/dist/components/Checkbox/types.d.ts +8 -8
  18. package/dist/components/Group/Group.js +7 -7
  19. package/dist/components/Group/GroupContext.js +1 -0
  20. package/dist/components/Group/types.d.ts +8 -8
  21. package/dist/components/Input/InputContext.js +1 -0
  22. package/dist/components/Label/LabelContext.js +1 -0
  23. package/dist/components/Link/Link.js +30 -9
  24. package/dist/components/Link/types.d.ts +8 -6
  25. package/dist/components/NumberField/NumberField.d.ts +1 -1
  26. package/dist/components/NumberField/NumberField.js +9 -9
  27. package/dist/components/NumberField/types.d.ts +4 -4
  28. package/dist/components/Radio/Radio.d.ts +1 -1
  29. package/dist/components/Radio/Radio.js +1 -1
  30. package/dist/components/Radio/RadioContext.js +1 -0
  31. package/dist/components/Radio/RadioGroup.d.ts +1 -1
  32. package/dist/components/Text/TextContext.js +1 -0
  33. package/dist/components/TextField/TextField.d.ts +2 -1
  34. package/dist/components/TextField/TextField.js +58 -57
  35. package/dist/components/TextField/types.d.ts +11 -8
  36. package/dist/components/Textarea/Textarea.d.ts +2 -4
  37. package/dist/components/Textarea/Textarea.js +6 -2
  38. package/dist/components/Textarea/TextareaContext.js +1 -0
  39. package/dist/components/Textarea/types.d.ts +2 -1
  40. package/dist/components/Toggle/Toggle.d.ts +1 -1
  41. package/dist/components/Toggle/Toggle.js +14 -14
  42. package/dist/components/Toggle/types.d.ts +7 -7
  43. package/dist/index.d.ts +21 -3
  44. package/dist/index.js +61 -6
  45. package/dist/types.d.ts +3 -6
  46. package/package.json +29 -8
  47. package/dist/behaviors/useNumberFieldState.d.ts +0 -25
  48. package/dist/behaviors/useNumberFieldState.js +0 -13
  49. package/dist/behaviors/useTextField.d.ts +0 -19
  50. package/dist/behaviors/useTextField.js +0 -24
@@ -3,14 +3,14 @@ import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { UseCheckboxProps } from '../../behaviors';
4
4
  import type { RenderProps } from '../../utils';
5
5
  export type CheckboxRenderProps = {
6
- error?: boolean;
7
- pressed?: boolean;
8
- checked?: boolean;
9
- hovered?: boolean;
10
- focused?: boolean;
11
- disabled?: boolean;
12
- focusVisible?: boolean;
13
- indeterminate?: boolean;
6
+ isInvalid?: boolean;
7
+ isPressed?: boolean;
8
+ isSelected?: boolean;
9
+ isHovered?: boolean;
10
+ isFocused?: boolean;
11
+ isDisabled?: boolean;
12
+ isFocusVisible?: boolean;
13
+ isIndeterminate?: boolean;
14
14
  };
15
15
  type CheckboxBaseProps = RenderProps<CheckboxRenderProps> & {
16
16
  inputRef?: RefObject<HTMLInputElement | null>;
@@ -7,19 +7,19 @@ import { useGroupContext } from "./GroupContext.js";
7
7
  const Group = forwardRef((props, ref) => {
8
8
  const defaultProps = useGroupContext();
9
9
  const commonProps = mergeProps(defaultProps, props);
10
- const { error = false, disabled = false, ...other } = commonProps;
11
- const { hoverProps, isHovered } = useHover({ isDisabled: disabled });
10
+ const { isInvalid = false, isDisabled = false, ...other } = commonProps;
11
+ const { hoverProps, isHovered } = useHover({ isDisabled });
12
12
  const { isFocused, isFocusVisible, focusProps } = useFocusRing({
13
13
  within: true
14
14
  });
15
15
  const renderProps = useRenderProps({
16
16
  ...props,
17
17
  values: {
18
- hovered: isHovered,
19
- focusWithin: isFocused,
20
- focusVisible: isFocusVisible,
21
- disabled,
22
- error
18
+ isHovered,
19
+ isFocusWithin: isFocused,
20
+ isFocusVisible,
21
+ isDisabled,
22
+ isInvalid
23
23
  }
24
24
  });
25
25
  const innerRef = useMultiRef([
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useContext } from "react";
2
3
  const GroupContext = createContext({});
3
4
  const useGroupContext = () => useContext(GroupContext);
@@ -2,17 +2,17 @@ import type { ComponentRef } from 'react';
2
2
  import type { ExtendableComponentPropsWithRef, ExtendableProps } from '@koobiq/react-core';
3
3
  import type { RenderProps } from '../../utils';
4
4
  export type GroupBaseProps = ExtendableComponentPropsWithRef<{
5
- disabled?: boolean;
6
- error?: boolean;
5
+ isDisabled?: boolean;
6
+ isInvalid?: boolean;
7
7
  }, 'div'>;
8
8
  export type GroupRef = ComponentRef<'div'>;
9
9
  export type GroupRenderProps = {
10
- indeterminate?: boolean;
10
+ isIndeterminate?: boolean;
11
11
  percentage?: number;
12
- hovered: boolean;
13
- focusWithin: boolean;
14
- focusVisible: boolean;
15
- disabled: boolean;
16
- error: boolean;
12
+ isHovered: boolean;
13
+ isFocusWithin: boolean;
14
+ isFocusVisible: boolean;
15
+ isDisabled: boolean;
16
+ isInvalid: boolean;
17
17
  };
18
18
  export type GroupProps = ExtendableProps<RenderProps<GroupRenderProps>, GroupBaseProps>;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useContext } from "react";
2
3
  const InputContext = createContext({});
3
4
  const useInputContext = () => useContext(InputContext);
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext } from "react";
2
3
  const LabelContext = createContext({});
3
4
  export {
@@ -4,24 +4,45 @@ import { polymorphicForwardRef, useDOMRef, mergeProps } from "@koobiq/react-core
4
4
  import { useRenderProps } from "../../utils/index.js";
5
5
  import { useLink } from "../../behaviors/useLink.js";
6
6
  const Link = polymorphicForwardRef((props, ref) => {
7
- const { as: Tag = "a", ...commonProps } = props;
7
+ const { as: Tag = "a", ...other } = props;
8
8
  const domRef = useDOMRef(ref);
9
- const { hovered, pressed, focused, focusVisible, linkProps } = useLink(
10
- commonProps,
9
+ const { isHovered, isPressed, isFocusVisible, isFocused, linkProps } = useLink(
10
+ {
11
+ ...other,
12
+ ...other.isDisabled && {
13
+ onPress: void 0,
14
+ onPressStart: void 0,
15
+ onPressEnd: void 0,
16
+ onPressChange: void 0,
17
+ onPressUp: void 0,
18
+ onKeyDown: void 0,
19
+ onKeyUp: void 0,
20
+ onClick: void 0,
21
+ href: void 0
22
+ }
23
+ },
11
24
  domRef
12
25
  );
13
26
  const renderValues = {
14
- hovered,
15
- pressed,
16
- focused,
17
- focusVisible,
18
- disabled: props.disabled || false
27
+ isHovered,
28
+ isPressed,
29
+ isFocused,
30
+ isFocusVisible,
31
+ isDisabled: props.isDisabled || false
19
32
  };
20
33
  const renderProps = useRenderProps({
21
34
  ...props,
22
35
  values: renderValues
23
36
  });
24
- return /* @__PURE__ */ jsx(Tag, { ...mergeProps(linkProps, renderProps), ref, children: renderProps.children });
37
+ return /* @__PURE__ */ jsx(
38
+ Tag,
39
+ {
40
+ ...mergeProps(linkProps, renderProps),
41
+ tabIndex: props.tabIndex || linkProps.tabIndex,
42
+ ref: domRef,
43
+ children: renderProps.children
44
+ }
45
+ );
25
46
  });
26
47
  Link.displayName = "Link";
27
48
  export {
@@ -2,10 +2,12 @@ import type { ExtendableProps } from '@koobiq/react-core';
2
2
  import type { UseLinkProps } from '../../behaviors';
3
3
  import type { RenderProps } from '../../utils';
4
4
  export type LinkRenderProps = {
5
- hovered: boolean;
6
- focused: boolean;
7
- pressed: boolean;
8
- disabled: boolean;
9
- focusVisible: boolean;
5
+ isHovered: boolean;
6
+ isFocused: boolean;
7
+ isPressed: boolean;
8
+ isDisabled: boolean;
9
+ isFocusVisible: boolean;
10
10
  };
11
- export type LinkBaseProps = ExtendableProps<RenderProps<LinkRenderProps>, UseLinkProps>;
11
+ export type LinkBaseProps = ExtendableProps<RenderProps<LinkRenderProps> & {
12
+ tabIndex?: number;
13
+ }, UseLinkProps>;
@@ -1 +1 @@
1
- export declare const NumberField: import("react").ForwardRefExoticComponent<Omit<import("../..").UseNumberFieldProps, keyof import("../../utils").RenderProps<import("./types").NumberFieldRenderProps>> & import("../../utils").RenderProps<import("./types").NumberFieldRenderProps> & import("react").RefAttributes<HTMLDivElement>>;
1
+ export declare const NumberField: import("react").ForwardRefExoticComponent<Omit<import("@react-types/numberfield").AriaNumberFieldProps, keyof import("../..").RenderProps<import("./types").NumberFieldRenderProps>> & import("../..").RenderProps<import("./types").NumberFieldRenderProps> & import("react").RefAttributes<HTMLDivElement>>;
@@ -11,7 +11,7 @@ import { InputContext } from "../Input/InputContext.js";
11
11
  import { TextContext } from "../Text/TextContext.js";
12
12
  const NumberField = forwardRef(
13
13
  (props, ref) => {
14
- const { disabled, readonly, required, error } = props;
14
+ const { isDisabled, isReadOnly, isRequired, isInvalid } = props;
15
15
  const inputRef = useRef(null);
16
16
  const {
17
17
  labelProps,
@@ -27,10 +27,10 @@ const NumberField = forwardRef(
27
27
  const renderProps = useRenderProps({
28
28
  ...props,
29
29
  values: {
30
- error: error || false,
31
- disabled: disabled || false,
32
- readonly: readonly || false,
33
- required: required || false
30
+ isInvalid: isInvalid || false,
31
+ isDisabled: isDisabled || false,
32
+ isReadonly: isReadOnly || false,
33
+ isRequired: isRequired || false
34
34
  }
35
35
  });
36
36
  return /* @__PURE__ */ jsx(
@@ -38,10 +38,10 @@ const NumberField = forwardRef(
38
38
  {
39
39
  ...DOMProps,
40
40
  ...renderProps,
41
- "data-error": error || void 0,
42
- "data-readonly": readonly || void 0,
43
- "data-required": required || void 0,
44
- "data-disabled": props.disabled || void 0,
41
+ "data-invalid": isInvalid || void 0,
42
+ "data-readonly": isReadOnly || void 0,
43
+ "data-required": isRequired || void 0,
44
+ "data-disabled": isDisabled || void 0,
45
45
  ref,
46
46
  children: /* @__PURE__ */ jsx(
47
47
  Provider,
@@ -7,22 +7,22 @@ export type NumberFieldRenderProps = {
7
7
  * Whether the text field is disabled.
8
8
  * @selector [data-disabled]
9
9
  */
10
- disabled: boolean;
10
+ isDisabled: boolean;
11
11
  /**
12
12
  * Whether the value is invalid.
13
13
  * @selector [data-error]
14
14
  */
15
- error: boolean;
15
+ isInvalid: boolean;
16
16
  /**
17
17
  * Whether the text field is read only.
18
18
  * @selector [data-readonly]
19
19
  */
20
- readonly: boolean;
20
+ isReadonly: boolean;
21
21
  /**
22
22
  * Whether the text field is required.
23
23
  * @selector [data-required]
24
24
  */
25
- required: boolean;
25
+ isRequired: boolean;
26
26
  };
27
27
  type NumberFieldBaseProps = RenderProps<NumberFieldRenderProps>;
28
28
  export type NumberFieldProps = ExtendableProps<NumberFieldBaseProps, UseNumberFieldProps>;
@@ -1,3 +1,3 @@
1
- export declare const Radio: import("react").ForwardRefExoticComponent<Omit<import("../..").UseRadioProps, "inputRef" | keyof import("../../utils").RenderProps<import("./types").RadioRenderProps>> & import("../../utils").RenderProps<import("./types").RadioRenderProps> & {
1
+ export declare const Radio: import("react").ForwardRefExoticComponent<Omit<import("../..").UseRadioProps, "inputRef" | keyof import("../..").RenderProps<import("./types").RadioRenderProps>> & import("../..").RenderProps<import("./types").RadioRenderProps> & {
2
2
  inputRef?: import("react").RefObject<HTMLInputElement | null>;
3
3
  } & import("react").RefAttributes<HTMLLabelElement>>;
@@ -38,7 +38,7 @@ const Radio = forwardRef(
38
38
  const DOMProps = filterDOMProps(props);
39
39
  delete DOMProps.id;
40
40
  return /* @__PURE__ */ jsxs("label", { ...mergeProps(DOMProps, labelProps, renderProps), ref, children: [
41
- /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", { ...inputProps, ref: domRef }) }),
41
+ /* @__PURE__ */ jsx(VisuallyHidden, { elementType: "span", children: /* @__PURE__ */ jsx("input", { ...inputProps, ref: domRef }) }),
42
42
  renderProps.children
43
43
  ] });
44
44
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext } from "react";
2
3
  const RadioContext = createContext(
3
4
  {}
@@ -1 +1 @@
1
- export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<import("../..").UseRadioGroupProps, keyof import("../../utils").RenderProps<import("./types").RadioGroupRenderProps>> & import("../../utils").RenderProps<import("./types").RadioGroupRenderProps> & import("react").RefAttributes<HTMLDivElement>>;
1
+ export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<import("../..").UseRadioGroupProps, keyof import("../..").RenderProps<import("./types").RadioGroupRenderProps>> & import("../..").RenderProps<import("./types").RadioGroupRenderProps> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext } from "react";
2
3
  const TextContext = createContext({});
3
4
  export {
@@ -1 +1,2 @@
1
- export declare const TextField: import("react").ForwardRefExoticComponent<Omit<import("../..").UseTextFieldProps, keyof import("../../utils").RenderProps<import("./types").TextFieldRenderProps>> & import("../../utils").RenderProps<import("./types").TextFieldRenderProps> & import("react").RefAttributes<HTMLDivElement>>;
1
+ import type { TextFieldComponentProps } from './index';
2
+ export declare const TextField: TextFieldComponentProps;
@@ -2,69 +2,70 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { forwardRef, useRef } from "react";
4
4
  import { filterDOMProps } from "@koobiq/react-core";
5
+ import { useTextField } from "@react-aria/textfield";
5
6
  import { removeDataAttributes, useRenderProps, Provider } from "../../utils/index.js";
6
- import { useTextField } from "../../behaviors/useTextField.js";
7
7
  import { InputContext } from "../Input/InputContext.js";
8
8
  import { TextareaContext } from "../Textarea/TextareaContext.js";
9
9
  import { LabelContext } from "../Label/LabelContext.js";
10
10
  import { TextContext } from "../Text/TextContext.js";
11
- const TextField = forwardRef(
12
- (props, ref) => {
13
- const { disabled, readonly, required } = props;
14
- const inputRef = useRef(null);
15
- const {
16
- error,
17
- labelProps,
18
- inputProps,
19
- descriptionProps,
20
- errorMessageProps
21
- } = useTextField({ ...removeDataAttributes(props) }, inputRef);
22
- const DOMProps = filterDOMProps(props);
23
- delete DOMProps.id;
24
- const renderProps = useRenderProps({
25
- ...props,
26
- values: {
27
- error: error || false,
28
- disabled: disabled || false,
29
- readonly: readonly || false,
30
- required: required || false
31
- }
32
- });
33
- return /* @__PURE__ */ jsx(
34
- "div",
35
- {
36
- ...DOMProps,
37
- ...renderProps,
38
- "data-error": error || void 0,
39
- "data-readonly": readonly || void 0,
40
- "data-required": required || void 0,
41
- "data-disabled": props.disabled || void 0,
42
- ref,
43
- children: /* @__PURE__ */ jsx(
44
- Provider,
45
- {
46
- values: [
47
- [LabelContext, labelProps],
48
- [InputContext, { ...inputProps, ref: inputRef }],
49
- [TextareaContext, inputProps],
50
- [
51
- TextContext,
52
- {
53
- slots: {
54
- description: descriptionProps,
55
- errorMessage: errorMessageProps
56
- }
11
+ function TextFieldRender(props, ref) {
12
+ const { isDisabled, isReadOnly, isRequired } = props;
13
+ const inputRef = useRef(null);
14
+ const {
15
+ isInvalid,
16
+ labelProps,
17
+ inputProps,
18
+ descriptionProps,
19
+ errorMessageProps
20
+ } = useTextField(
21
+ { ...removeDataAttributes(props) },
22
+ inputRef
23
+ );
24
+ const DOMProps = filterDOMProps(props);
25
+ delete DOMProps.id;
26
+ const renderProps = useRenderProps({
27
+ ...props,
28
+ values: {
29
+ isInvalid: isInvalid || false,
30
+ isDisabled: isDisabled || false,
31
+ isReadOnly: isReadOnly || false,
32
+ isRequired: isRequired || false
33
+ }
34
+ });
35
+ return /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ ...DOMProps,
39
+ ...renderProps,
40
+ "data-invalid": isInvalid || void 0,
41
+ "data-readonly": isReadOnly || void 0,
42
+ "data-required": isRequired || void 0,
43
+ "data-disabled": isDisabled || void 0,
44
+ ref,
45
+ children: /* @__PURE__ */ jsx(
46
+ Provider,
47
+ {
48
+ values: [
49
+ [LabelContext, labelProps],
50
+ [InputContext, { ...inputProps, ref: inputRef }],
51
+ [TextareaContext, { ...inputProps, ref: inputRef }],
52
+ [
53
+ TextContext,
54
+ {
55
+ slots: {
56
+ description: descriptionProps,
57
+ errorMessage: errorMessageProps
57
58
  }
58
- ]
59
- ],
60
- children: renderProps.children
61
- }
62
- )
63
- }
64
- );
65
- }
66
- );
67
- TextField.displayName = "TextField";
59
+ }
60
+ ]
61
+ ],
62
+ children: renderProps.children
63
+ }
64
+ )
65
+ }
66
+ );
67
+ }
68
+ const TextField = forwardRef(TextFieldRender);
68
69
  export {
69
70
  TextField
70
71
  };
@@ -1,30 +1,33 @@
1
- import type { ComponentRef } from 'react';
1
+ import type { ComponentRef, ReactElement } from 'react';
2
2
  import type { ExtendableProps } from '@koobiq/react-core';
3
- import type { UseTextFieldProps } from '../../behaviors';
3
+ import type { AriaTextFieldProps } from '@react-aria/textfield';
4
4
  import type { RenderProps } from '../../utils';
5
5
  export type TextFieldRenderProps = {
6
6
  /**
7
7
  * Whether the text field is disabled.
8
8
  * @selector [data-disabled]
9
9
  */
10
- disabled: boolean;
10
+ isDisabled: boolean;
11
11
  /**
12
12
  * Whether the value is invalid.
13
13
  * @selector [data-error]
14
14
  */
15
- error: boolean;
15
+ isInvalid: boolean;
16
16
  /**
17
17
  * Whether the text field is read only.
18
18
  * @selector [data-readonly]
19
19
  */
20
- readonly: boolean;
20
+ isReadOnly: boolean;
21
21
  /**
22
22
  * Whether the text field is required.
23
23
  * @selector [data-required]
24
24
  */
25
- required: boolean;
25
+ isRequired: boolean;
26
26
  };
27
- type TextFieldBaseProps = RenderProps<TextFieldRenderProps>;
28
- export type TextFieldProps = ExtendableProps<TextFieldBaseProps, UseTextFieldProps>;
27
+ type TextFieldBaseProps = RenderProps<TextFieldRenderProps> & {
28
+ inputElementType?: 'input' | 'textarea';
29
+ };
30
+ export type TextFieldProps<T = HTMLInputElement> = ExtendableProps<TextFieldBaseProps, AriaTextFieldProps<T>>;
31
+ export type TextFieldComponentProps = <T = HTMLInputElement>(props: TextFieldProps<T>) => ReactElement | null;
29
32
  export type TextFieldRef = ComponentRef<'div'>;
30
33
  export {};
@@ -1,4 +1,2 @@
1
- export declare const Textarea: import("react").ForwardRefExoticComponent<{
2
- children?: import("react").ReactNode;
3
- value?: string | number | readonly string[];
4
- } & import("react").HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
1
+ import { type TextareaProps } from './index';
2
+ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -1,13 +1,17 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
- import { mergeProps } from "@koobiq/react-core";
4
+ import { mergeProps, useMultiRef } from "@koobiq/react-core";
5
5
  import { useTextareaContext } from "./TextareaContext.js";
6
6
  const Textarea = forwardRef((props, ref) => {
7
7
  const { children, ...other } = props;
8
8
  const defaultProps = useTextareaContext();
9
9
  const commonProps = mergeProps(defaultProps, other);
10
- return /* @__PURE__ */ jsx("textarea", { ...commonProps, ref, children });
10
+ const innerRef = useMultiRef([
11
+ ref,
12
+ ...defaultProps.ref ? [defaultProps.ref] : []
13
+ ]);
14
+ return /* @__PURE__ */ jsx("textarea", { ...commonProps, ref: innerRef, children });
11
15
  });
12
16
  Textarea.displayName = "Textarea";
13
17
  export {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useContext } from "react";
2
3
  const TextareaContext = createContext({});
3
4
  const useTextareaContext = () => useContext(TextareaContext);
@@ -1,6 +1,7 @@
1
- import type { ComponentRef, HTMLAttributes, ReactNode } from 'react';
1
+ import type { ComponentRef, HTMLAttributes, ReactNode, Ref } from 'react';
2
2
  export type TextareaProps = {
3
3
  children?: ReactNode;
4
4
  value?: string | number | readonly string[];
5
+ ref?: Ref<HTMLTextAreaElement>;
5
6
  } & HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
6
7
  export type TextareaRef = ComponentRef<'textarea'>;
@@ -1,3 +1,3 @@
1
- export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<import("../..").UseToggleProps, "inputRef" | keyof import("../../utils").RenderProps<import("./types").ToggleRenderProps>> & import("../../utils").RenderProps<import("./types").ToggleRenderProps> & {
1
+ export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<import("../..").UseToggleProps, "inputRef" | keyof import("../..").RenderProps<import("./types").ToggleRenderProps>> & import("../..").RenderProps<import("./types").ToggleRenderProps> & {
2
2
  inputRef?: import("react").RefObject<HTMLInputElement | null>;
3
3
  } & import("react").RefAttributes<HTMLLabelElement>>;
@@ -10,12 +10,12 @@ const Toggle = forwardRef(
10
10
  const { children, inputRef } = props;
11
11
  const domRef = useDOMRef(inputRef);
12
12
  const {
13
- hovered,
14
- error,
15
- checked,
16
- focused,
17
- pressed,
18
- focusVisible,
13
+ isHovered,
14
+ isInvalid,
15
+ isSelected,
16
+ isFocused,
17
+ isPressed,
18
+ isFocusVisible,
19
19
  labelProps,
20
20
  inputProps
21
21
  } = useToggle(
@@ -26,13 +26,13 @@ const Toggle = forwardRef(
26
26
  domRef
27
27
  );
28
28
  const renderValues = {
29
- hovered,
30
- error,
31
- checked,
32
- focused,
33
- pressed,
34
- focusVisible,
35
- disabled: props.disabled || false
29
+ isHovered,
30
+ isInvalid,
31
+ isSelected,
32
+ isFocused,
33
+ isPressed,
34
+ isFocusVisible,
35
+ isDisabled: props.isDisabled || false
36
36
  };
37
37
  const renderProps = useRenderProps({
38
38
  ...props,
@@ -41,7 +41,7 @@ const Toggle = forwardRef(
41
41
  const DOMProps = filterDOMProps(props);
42
42
  delete DOMProps.id;
43
43
  return /* @__PURE__ */ jsxs("label", { ...mergeProps(DOMProps, labelProps, renderProps), ref, children: [
44
- /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", { ...inputProps, ref: domRef }) }),
44
+ /* @__PURE__ */ jsx(VisuallyHidden, { elementType: "span", children: /* @__PURE__ */ jsx("input", { ...inputProps, ref: domRef }) }),
45
45
  renderProps.children
46
46
  ] });
47
47
  }
@@ -3,13 +3,13 @@ import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { UseToggleProps } from '../../behaviors';
4
4
  import type { RenderProps } from '../../utils';
5
5
  export type ToggleRenderProps = {
6
- error?: boolean;
7
- pressed?: boolean;
8
- checked?: boolean;
9
- hovered?: boolean;
10
- focused?: boolean;
11
- disabled?: boolean;
12
- focusVisible?: boolean;
6
+ isInvalid?: boolean;
7
+ isPressed?: boolean;
8
+ isSelected?: boolean;
9
+ isHovered?: boolean;
10
+ isFocused?: boolean;
11
+ isDisabled?: boolean;
12
+ isFocusVisible?: boolean;
13
13
  };
14
14
  type ToggleBaseProps = RenderProps<ToggleRenderProps> & {
15
15
  inputRef?: RefObject<HTMLInputElement | null>;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,33 @@
1
+ import { useToggleButtonGroup, useToggleButtonGroupItem, type AriaToggleButtonGroupProps, type AriaToggleButtonGroupItemProps } from '@react-aria/button';
2
+ import { useCalendar, useCalendarCell, useCalendarGrid, type AriaCalendarProps, type AriaCalendarCellProps, type AriaCalendarGridProps, type DateValue, type CalendarAria } from '@react-aria/calendar';
1
3
  import { useDialog, type AriaDialogProps } from '@react-aria/dialog';
2
- import { useLocale, I18nProvider, useLocalizedStringFormatter, type I18nProviderProps } from '@react-aria/i18n';
4
+ import { useLocale, I18nProvider, useDateFormatter, useLocalizedStringFormatter, type I18nProviderProps } from '@react-aria/i18n';
3
5
  import { useListBox, useOption, useListBoxSection, type AriaListBoxProps } from '@react-aria/listbox';
6
+ import { useMenu, useMenuItem, useMenuSection, useMenuTrigger, type AriaMenuOptions, type AriaMenuProps } from '@react-aria/menu';
4
7
  import { Overlay, usePopover, useModalOverlay, useOverlayTrigger, useOverlayPosition, type AriaModalOverlayProps } from '@react-aria/overlays';
8
+ import { useSelect, HiddenSelect } from '@react-aria/select';
9
+ import { useSeparator } from '@react-aria/separator';
10
+ import { useTable, useTableCell, useTableRow, useTableHeaderRow, useTableSelectAllCheckbox, useTableSelectionCheckbox, useTableColumnHeader, useTableRowGroup, type AriaTableProps, type AriaTableCellProps, type GridRowProps, type AriaTableColumnHeaderProps } from '@react-aria/table';
11
+ import { useTag, useTagGroup, type AriaTagGroupProps, type AriaTagProps } from '@react-aria/tag';
5
12
  import { useTooltip, useTooltipTrigger } from '@react-aria/tooltip';
13
+ import { RouterProvider, useRouter } from '@react-aria/utils';
14
+ import { VisuallyHidden } from '@react-aria/visually-hidden';
15
+ import { useCalendarState, type CalendarState } from '@react-stately/calendar';
6
16
  import { Item, Section } from '@react-stately/collections';
17
+ import { useListData } from '@react-stately/data';
7
18
  import { useListState, type ListState } from '@react-stately/list';
19
+ import { useMenuTriggerState } from '@react-stately/menu';
8
20
  import { useOverlayTriggerState, type OverlayTriggerState } from '@react-stately/overlays';
21
+ import { useSelectState } from '@react-stately/select';
22
+ import { Cell, Column, Row, TableBody, TableHeader, useTableState, type TableStateProps, type TableState, type CellProps, type ColumnProps, type RowProps, type TableHeaderProps, type TableBodyProps } from '@react-stately/table';
23
+ import { useToggleGroupState, type ToggleGroupState } from '@react-stately/toggle';
9
24
  import type { TooltipTriggerProps } from '@react-stately/tooltip';
10
25
  import { useTooltipTriggerState } from '@react-stately/tooltip';
11
- import type { HoverEvent, Node, ItemProps, SectionProps, LinkDOMProps } from '@react-types/shared';
26
+ import { useTreeState, type TreeState } from '@react-stately/tree';
27
+ import type { Node, PressEvent, HoverEvent, ItemProps, SectionProps, LinkDOMProps, FocusableElement } from '@react-types/shared';
28
+ export * from '@internationalized/date';
12
29
  export * from './behaviors/index.js';
13
30
  export * from './components/index.js';
14
- export { Overlay, useLocale, useDialog, useOption, usePopover, useListBox, useTooltip, I18nProvider, useListState, useModalOverlay, useOverlayTrigger, useTooltipTrigger, useListBoxSection, useOverlayPosition, useOverlayTriggerState, useTooltipTriggerState, useLocalizedStringFormatter, Item, Section, type ListState, type Node, type ItemProps, type LinkDOMProps, type SectionProps, type HoverEvent, type AriaDialogProps, type I18nProviderProps, type AriaListBoxProps, type TooltipTriggerProps, type OverlayTriggerState, type AriaModalOverlayProps, };
31
+ export { Item, Overlay, Section, useMenu, Cell, Column, Row, TableBody, TableHeader, useLocale, useDialog, useOption, useSelect, usePopover, useListBox, useTooltip, useTag, useTable, useTagGroup, useListState, HiddenSelect, I18nProvider, useMenuItem, useListData, useCalendar, useCalendarCell, useCalendarGrid, useTreeState, useSeparator, useTableState, useMenuSection, useMenuTrigger, useSelectState, useModalOverlay, useOverlayTrigger, useTooltipTrigger, useListBoxSection, useOverlayPosition, useTableCell, useTableRow, useDateFormatter, useCalendarState, useTableHeaderRow, useTableColumnHeader, useTableSelectAllCheckbox, useTableSelectionCheckbox, useTableRowGroup, useMenuTriggerState, useToggleGroupState, useToggleButtonGroup, useOverlayTriggerState, useTooltipTriggerState, useToggleButtonGroupItem, useLocalizedStringFormatter, RouterProvider, useRouter, VisuallyHidden, type Node, type CalendarAria, type DateValue, type TableState, type TreeState, type TableHeaderProps, type TableBodyProps, type ItemProps, type CellProps, type ColumnProps, type RowProps, type GridRowProps, type AriaCalendarGridProps, type AriaCalendarCellProps, type AriaTableColumnHeaderProps, type AriaTableCellProps, type AriaTableProps, type TableStateProps, type AriaTagGroupProps, type AriaTagProps, type ListState, type PressEvent, type HoverEvent, type CalendarState, type AriaCalendarProps, type LinkDOMProps, type FocusableElement, type SectionProps, type ToggleGroupState, type AriaMenuProps, type AriaDialogProps, type AriaMenuOptions, type AriaListBoxProps, type I18nProviderProps, type TooltipTriggerProps, type OverlayTriggerState, type AriaModalOverlayProps, type AriaToggleButtonGroupProps, type AriaToggleButtonGroupItemProps, };
15
32
  export * from './types';
33
+ export * from './utils';