@koobiq/react-primitives 0.0.1-beta.30 → 0.0.1-beta.32
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/dist/behaviors/index.d.ts +0 -2
- package/dist/behaviors/useNumberField.d.ts +1 -22
- package/dist/behaviors/useNumberField.js +2 -13
- package/dist/components/Group/Group.js +7 -7
- package/dist/components/Group/types.d.ts +8 -8
- package/dist/components/NumberField/NumberField.d.ts +1 -1
- package/dist/components/NumberField/NumberField.js +9 -9
- package/dist/components/NumberField/types.d.ts +4 -4
- package/dist/components/TextField/TextField.d.ts +2 -1
- package/dist/components/TextField/TextField.js +58 -57
- package/dist/components/TextField/types.d.ts +11 -8
- package/dist/components/Textarea/Textarea.d.ts +2 -4
- package/dist/components/Textarea/Textarea.js +6 -2
- package/dist/components/Textarea/types.d.ts +2 -1
- package/dist/index.js +0 -4
- package/package.json +4 -4
- package/dist/behaviors/useNumberFieldState.d.ts +0 -25
- package/dist/behaviors/useNumberFieldState.js +0 -13
- package/dist/behaviors/useTextField.d.ts +0 -19
- package/dist/behaviors/useTextField.js +0 -24
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export * from './useButton.js';
|
|
2
2
|
export * from './useCheckbox.js';
|
|
3
3
|
export * from './useLink.js';
|
|
4
|
-
export * from './useTextField.js';
|
|
5
4
|
export * from './useToggle.js';
|
|
6
5
|
export * from './useRadio.js';
|
|
7
6
|
export * from './useRadioGroup.js';
|
|
8
7
|
export * from './useRadioGroupState.js';
|
|
9
8
|
export * from './useProgressBar.js';
|
|
10
9
|
export * from './useNumberField.js';
|
|
11
|
-
export * from './useNumberFieldState.js';
|
|
@@ -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 =
|
|
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 "
|
|
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
|
|
@@ -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 {
|
|
11
|
-
const { hoverProps, isHovered } = useHover({ isDisabled
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
isHovered,
|
|
19
|
+
isFocusWithin: isFocused,
|
|
20
|
+
isFocusVisible,
|
|
21
|
+
isDisabled,
|
|
22
|
+
isInvalid
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const innerRef = useMultiRef([
|
|
@@ -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
|
-
|
|
6
|
-
|
|
5
|
+
isDisabled?: boolean;
|
|
6
|
+
isInvalid?: boolean;
|
|
7
7
|
}, 'div'>;
|
|
8
8
|
export type GroupRef = ComponentRef<'div'>;
|
|
9
9
|
export type GroupRenderProps = {
|
|
10
|
-
|
|
10
|
+
isIndeterminate?: boolean;
|
|
11
11
|
percentage?: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 +1 @@
|
|
|
1
|
-
export declare const NumberField: import("react").ForwardRefExoticComponent<Omit<import("
|
|
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 {
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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-
|
|
42
|
-
"data-readonly":
|
|
43
|
-
"data-required":
|
|
44
|
-
"data-disabled":
|
|
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
|
-
|
|
10
|
+
isDisabled: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Whether the value is invalid.
|
|
13
13
|
* @selector [data-error]
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
isInvalid: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Whether the text field is read only.
|
|
18
18
|
* @selector [data-readonly]
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
isReadonly: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Whether the text field is required.
|
|
23
23
|
* @selector [data-required]
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
isRequired: boolean;
|
|
26
26
|
};
|
|
27
27
|
type NumberFieldBaseProps = RenderProps<NumberFieldRenderProps>;
|
|
28
28
|
export type NumberFieldProps = ExtendableProps<NumberFieldBaseProps, UseNumberFieldProps>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
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 {
|
|
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
|
-
|
|
10
|
+
isDisabled: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Whether the value is invalid.
|
|
13
13
|
* @selector [data-error]
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
isInvalid: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Whether the text field is read only.
|
|
18
18
|
* @selector [data-readonly]
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
isReadOnly: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Whether the text field is required.
|
|
23
23
|
* @selector [data-required]
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
isRequired: boolean;
|
|
26
26
|
};
|
|
27
|
-
type TextFieldBaseProps = RenderProps<TextFieldRenderProps
|
|
28
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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,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'>;
|
package/dist/index.js
CHANGED
|
@@ -28,14 +28,12 @@ import { Provider, removeDataAttributes, useRenderProps } from "./utils/index.js
|
|
|
28
28
|
import { useButton } from "./behaviors/useButton.js";
|
|
29
29
|
import { useCheckbox } from "./behaviors/useCheckbox.js";
|
|
30
30
|
import { useLink } from "./behaviors/useLink.js";
|
|
31
|
-
import { useTextField } from "./behaviors/useTextField.js";
|
|
32
31
|
import { useToggle } from "./behaviors/useToggle.js";
|
|
33
32
|
import { useRadio } from "./behaviors/useRadio.js";
|
|
34
33
|
import { useRadioGroup } from "./behaviors/useRadioGroup.js";
|
|
35
34
|
import { useRadioGroupState } from "./behaviors/useRadioGroupState.js";
|
|
36
35
|
import { useProgressBar } from "./behaviors/useProgressBar.js";
|
|
37
36
|
import { useNumberField } from "./behaviors/useNumberField.js";
|
|
38
|
-
import { useNumberFieldState } from "./behaviors/useNumberFieldState.js";
|
|
39
37
|
import { Text } from "./components/Text/Text.js";
|
|
40
38
|
import { TextContext } from "./components/Text/TextContext.js";
|
|
41
39
|
import { Group } from "./components/Group/Group.js";
|
|
@@ -117,7 +115,6 @@ export {
|
|
|
117
115
|
useMenuTriggerState,
|
|
118
116
|
useModalOverlay,
|
|
119
117
|
useNumberField,
|
|
120
|
-
useNumberFieldState,
|
|
121
118
|
useOption,
|
|
122
119
|
useOverlayPosition,
|
|
123
120
|
useOverlayTrigger,
|
|
@@ -143,7 +140,6 @@ export {
|
|
|
143
140
|
useTableState,
|
|
144
141
|
useTag,
|
|
145
142
|
useTagGroup,
|
|
146
|
-
useTextField,
|
|
147
143
|
useTextareaContext,
|
|
148
144
|
useToggle,
|
|
149
145
|
useToggleButtonGroup,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koobiq/react-primitives",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.32",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@react-aria/switch": "^3.7.5",
|
|
42
42
|
"@react-aria/table": "^3.17.3",
|
|
43
43
|
"@react-aria/tag": "^3.6.0",
|
|
44
|
-
"@react-aria/textfield": "^3.
|
|
44
|
+
"@react-aria/textfield": "^3.17.5",
|
|
45
45
|
"@react-aria/toggle": "^3.10.10",
|
|
46
46
|
"@react-aria/tooltip": "^3.8.5",
|
|
47
47
|
"@react-aria/utils": "^3.29.1",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@react-stately/toggle": "^3.7.0",
|
|
60
60
|
"@react-stately/tooltip": "^3.5.5",
|
|
61
61
|
"@react-stately/tree": "^3.8.9",
|
|
62
|
-
"@koobiq/logger": "0.0.1-beta.
|
|
63
|
-
"@koobiq/react-core": "0.0.1-beta.
|
|
62
|
+
"@koobiq/logger": "0.0.1-beta.32",
|
|
63
|
+
"@koobiq/react-core": "0.0.1-beta.32"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "18.x || 19.x",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ExtendableProps } from '@koobiq/react-core';
|
|
2
|
-
import type { NumberFieldStateOptions } from '@react-stately/numberfield';
|
|
3
|
-
export type UseNumberFieldStateProps = 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<NumberFieldStateOptions, 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid'>>;
|
|
24
|
-
export declare function useNumberFieldState(props: UseNumberFieldStateProps): import("@react-stately/numberfield").NumberFieldState;
|
|
25
|
-
export type UseNumberFieldStateReturn = ReturnType<typeof useNumberFieldState>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useNumberFieldState as useNumberFieldState$1 } from "@react-stately/numberfield";
|
|
2
|
-
function useNumberFieldState(props) {
|
|
3
|
-
return useNumberFieldState$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
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
useNumberFieldState
|
|
13
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { RefObject } from 'react';
|
|
2
|
-
import type { AriaTextFieldOptions } from '@react-aria/textfield';
|
|
3
|
-
export type UseTextFieldProps = {
|
|
4
|
-
error?: boolean;
|
|
5
|
-
readonly?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
inputElementType?: 'input' | 'textarea';
|
|
9
|
-
} & Omit<AriaTextFieldOptions<'input' | 'textarea'>, 'isDisabled' | 'isInvalid' | 'isRequired' | 'isReadOnly'>;
|
|
10
|
-
export declare function useTextField(props: UseTextFieldProps, ref: RefObject<HTMLInputElement | HTMLTextAreaElement | null>): {
|
|
11
|
-
inputProps: import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> | import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
|
|
12
|
-
labelProps: import("@react-types/shared").DOMAttributes | import("react").LabelHTMLAttributes<HTMLLabelElement>;
|
|
13
|
-
descriptionProps: import("@react-types/shared").DOMAttributes;
|
|
14
|
-
errorMessageProps: import("@react-types/shared").DOMAttributes;
|
|
15
|
-
validationErrors: string[];
|
|
16
|
-
validationDetails: ValidityState;
|
|
17
|
-
error: boolean;
|
|
18
|
-
};
|
|
19
|
-
export type UseTextFieldReturn = ReturnType<typeof useTextField>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useTextField as useTextField$1 } from "@react-aria/textfield";
|
|
3
|
-
function useTextField(props, ref) {
|
|
4
|
-
const { disabled, error, label, readonly, required, ...other } = props;
|
|
5
|
-
const { isInvalid, ...textFieldProps } = useTextField$1(
|
|
6
|
-
{
|
|
7
|
-
isDisabled: disabled,
|
|
8
|
-
isReadOnly: readonly,
|
|
9
|
-
isRequired: required,
|
|
10
|
-
isInvalid: error,
|
|
11
|
-
label,
|
|
12
|
-
errorMessage: error ? label : void 0,
|
|
13
|
-
...other
|
|
14
|
-
},
|
|
15
|
-
ref
|
|
16
|
-
);
|
|
17
|
-
return {
|
|
18
|
-
error: isInvalid,
|
|
19
|
-
...textFieldProps
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
useTextField
|
|
24
|
-
};
|