@rockshin/tao-ui 0.0.8 → 0.0.9
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/components/input/input.d.ts +2 -2
- package/dist/components/input/input.js +32 -29
- package/dist/components/input-number/input-number.d.ts +22 -0
- package/dist/components/input-number/input-number.js +104 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/number-input/index.d.ts +1 -2
- package/dist/number-input/index.js +1 -1
- package/dist/number-input/number-input.d.ts +9 -2
- package/dist/number-input/number-input.js +3 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
|
|
3
3
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
4
|
import './input.css';
|
|
@@ -12,4 +12,4 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
12
12
|
classNames?: SemanticClassNames<InputSemanticPart>;
|
|
13
13
|
styles?: SemanticStyles<InputSemanticPart>;
|
|
14
14
|
}
|
|
15
|
-
export declare
|
|
15
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
3
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
5
|
import { cx } from "../../utils/semantic.js";
|
|
5
6
|
import "./input.css";
|
|
6
|
-
|
|
7
|
-
const $ = c(
|
|
7
|
+
const input_Input = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
8
|
+
const $ = c(42);
|
|
8
9
|
let className;
|
|
9
10
|
let classNames;
|
|
10
11
|
let disabled;
|
|
@@ -84,36 +85,38 @@ function Input(t0) {
|
|
|
84
85
|
const t8 = styles?.input;
|
|
85
86
|
const t9 = error || void 0;
|
|
86
87
|
let t10;
|
|
87
|
-
if ($[22] !==
|
|
88
|
+
if ($[22] !== ref || $[23] !== resolvedDisabled || $[24] !== rest || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
|
|
88
89
|
t10 = /*#__PURE__*/ jsx("input", {
|
|
89
90
|
...rest,
|
|
91
|
+
ref: ref,
|
|
90
92
|
className: t7,
|
|
91
93
|
style: t8,
|
|
92
94
|
disabled: resolvedDisabled,
|
|
93
95
|
"aria-invalid": t9
|
|
94
96
|
});
|
|
95
|
-
$[22] =
|
|
96
|
-
$[23] =
|
|
97
|
-
$[24] =
|
|
98
|
-
$[25] =
|
|
99
|
-
$[26] =
|
|
100
|
-
$[27] =
|
|
101
|
-
|
|
97
|
+
$[22] = ref;
|
|
98
|
+
$[23] = resolvedDisabled;
|
|
99
|
+
$[24] = rest;
|
|
100
|
+
$[25] = t7;
|
|
101
|
+
$[26] = t8;
|
|
102
|
+
$[27] = t9;
|
|
103
|
+
$[28] = t10;
|
|
104
|
+
} else t10 = $[28];
|
|
102
105
|
let t11;
|
|
103
|
-
if ($[
|
|
106
|
+
if ($[29] !== classNames?.suffix || $[30] !== styles?.suffix || $[31] !== suffix) {
|
|
104
107
|
t11 = null != suffix && /*#__PURE__*/ jsx("span", {
|
|
105
108
|
className: classNames?.suffix,
|
|
106
109
|
style: styles?.suffix,
|
|
107
110
|
"data-tao-suffix": "",
|
|
108
111
|
children: suffix
|
|
109
112
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
} else t11 = $[
|
|
113
|
+
$[29] = classNames?.suffix;
|
|
114
|
+
$[30] = styles?.suffix;
|
|
115
|
+
$[31] = suffix;
|
|
116
|
+
$[32] = t11;
|
|
117
|
+
} else t11 = $[32];
|
|
115
118
|
let t12;
|
|
116
|
-
if ($[
|
|
119
|
+
if ($[33] !== resolvedSize || $[34] !== resolvedVariant || $[35] !== t10 || $[36] !== t11 || $[37] !== t2 || $[38] !== t4 || $[39] !== t5 || $[40] !== t6) {
|
|
117
120
|
t12 = /*#__PURE__*/ jsxs("div", {
|
|
118
121
|
className: t2,
|
|
119
122
|
style: t4,
|
|
@@ -128,16 +131,16 @@ function Input(t0) {
|
|
|
128
131
|
t11
|
|
129
132
|
]
|
|
130
133
|
});
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
} else t12 = $[
|
|
134
|
+
$[33] = resolvedSize;
|
|
135
|
+
$[34] = resolvedVariant;
|
|
136
|
+
$[35] = t10;
|
|
137
|
+
$[36] = t11;
|
|
138
|
+
$[37] = t2;
|
|
139
|
+
$[38] = t4;
|
|
140
|
+
$[39] = t5;
|
|
141
|
+
$[40] = t6;
|
|
142
|
+
$[41] = t12;
|
|
143
|
+
} else t12 = $[41];
|
|
141
144
|
return t12;
|
|
142
|
-
}
|
|
143
|
-
export { Input };
|
|
145
|
+
});
|
|
146
|
+
export { input_Input as Input };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type UseNumberInputOptions } from '../../number-input/use-number-input';
|
|
3
|
+
import type { TaoSize, TaoVariant } from '../../provider/tao-provider';
|
|
4
|
+
import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic';
|
|
5
|
+
import { type InputSemanticPart } from '../input/input';
|
|
6
|
+
export type InputNumberSemanticPart = InputSemanticPart;
|
|
7
|
+
export interface InputNumberProps extends UseNumberInputOptions {
|
|
8
|
+
prefix?: ReactNode;
|
|
9
|
+
suffix?: ReactNode;
|
|
10
|
+
size?: TaoSize;
|
|
11
|
+
variant?: TaoVariant;
|
|
12
|
+
error?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
classNames?: SemanticClassNames<InputNumberSemanticPart>;
|
|
20
|
+
styles?: SemanticStyles<InputNumberSemanticPart>;
|
|
21
|
+
}
|
|
22
|
+
export declare function InputNumber({ prefix, suffix, size, variant, error, disabled, placeholder, id, name, 'aria-label': ariaLabel, className, classNames, styles, ...hookOptions }: InputNumberProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useNumberInput } from "../../number-input/use-number-input.js";
|
|
4
|
+
import { Input } from "../input/input.js";
|
|
5
|
+
function InputNumber(t0) {
|
|
6
|
+
const $ = c(34);
|
|
7
|
+
let ariaLabel;
|
|
8
|
+
let className;
|
|
9
|
+
let classNames;
|
|
10
|
+
let disabled;
|
|
11
|
+
let error;
|
|
12
|
+
let hookOptions;
|
|
13
|
+
let id;
|
|
14
|
+
let name;
|
|
15
|
+
let placeholder;
|
|
16
|
+
let prefix;
|
|
17
|
+
let size;
|
|
18
|
+
let styles;
|
|
19
|
+
let suffix;
|
|
20
|
+
let variant;
|
|
21
|
+
if ($[0] !== t0) {
|
|
22
|
+
({ prefix, suffix, size, variant, error, disabled, placeholder, id, name, "aria-label": ariaLabel, className, classNames, styles, ...hookOptions } = t0);
|
|
23
|
+
$[0] = t0;
|
|
24
|
+
$[1] = ariaLabel;
|
|
25
|
+
$[2] = className;
|
|
26
|
+
$[3] = classNames;
|
|
27
|
+
$[4] = disabled;
|
|
28
|
+
$[5] = error;
|
|
29
|
+
$[6] = hookOptions;
|
|
30
|
+
$[7] = id;
|
|
31
|
+
$[8] = name;
|
|
32
|
+
$[9] = placeholder;
|
|
33
|
+
$[10] = prefix;
|
|
34
|
+
$[11] = size;
|
|
35
|
+
$[12] = styles;
|
|
36
|
+
$[13] = suffix;
|
|
37
|
+
$[14] = variant;
|
|
38
|
+
} else {
|
|
39
|
+
ariaLabel = $[1];
|
|
40
|
+
className = $[2];
|
|
41
|
+
classNames = $[3];
|
|
42
|
+
disabled = $[4];
|
|
43
|
+
error = $[5];
|
|
44
|
+
hookOptions = $[6];
|
|
45
|
+
id = $[7];
|
|
46
|
+
name = $[8];
|
|
47
|
+
placeholder = $[9];
|
|
48
|
+
prefix = $[10];
|
|
49
|
+
size = $[11];
|
|
50
|
+
styles = $[12];
|
|
51
|
+
suffix = $[13];
|
|
52
|
+
variant = $[14];
|
|
53
|
+
}
|
|
54
|
+
const { inputProps } = useNumberInput(hookOptions);
|
|
55
|
+
let inputRest;
|
|
56
|
+
let ref;
|
|
57
|
+
if ($[15] !== inputProps) {
|
|
58
|
+
({ ref, ...inputRest } = inputProps);
|
|
59
|
+
$[15] = inputProps;
|
|
60
|
+
$[16] = inputRest;
|
|
61
|
+
$[17] = ref;
|
|
62
|
+
} else {
|
|
63
|
+
inputRest = $[16];
|
|
64
|
+
ref = $[17];
|
|
65
|
+
}
|
|
66
|
+
let t1;
|
|
67
|
+
if ($[18] !== ariaLabel || $[19] !== className || $[20] !== classNames || $[21] !== disabled || $[22] !== error || $[23] !== id || $[24] !== inputRest || $[25] !== name || $[26] !== placeholder || $[27] !== prefix || $[28] !== ref || $[29] !== size || $[30] !== styles || $[31] !== suffix || $[32] !== variant) {
|
|
68
|
+
t1 = /*#__PURE__*/ jsx(Input, {
|
|
69
|
+
ref: ref,
|
|
70
|
+
prefix: prefix,
|
|
71
|
+
suffix: suffix,
|
|
72
|
+
size: size,
|
|
73
|
+
variant: variant,
|
|
74
|
+
error: error,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
placeholder: placeholder,
|
|
77
|
+
id: id,
|
|
78
|
+
name: name,
|
|
79
|
+
"aria-label": ariaLabel,
|
|
80
|
+
className: className,
|
|
81
|
+
classNames: classNames,
|
|
82
|
+
styles: styles,
|
|
83
|
+
...inputRest
|
|
84
|
+
});
|
|
85
|
+
$[18] = ariaLabel;
|
|
86
|
+
$[19] = className;
|
|
87
|
+
$[20] = classNames;
|
|
88
|
+
$[21] = disabled;
|
|
89
|
+
$[22] = error;
|
|
90
|
+
$[23] = id;
|
|
91
|
+
$[24] = inputRest;
|
|
92
|
+
$[25] = name;
|
|
93
|
+
$[26] = placeholder;
|
|
94
|
+
$[27] = prefix;
|
|
95
|
+
$[28] = ref;
|
|
96
|
+
$[29] = size;
|
|
97
|
+
$[30] = styles;
|
|
98
|
+
$[31] = suffix;
|
|
99
|
+
$[32] = variant;
|
|
100
|
+
$[33] = t1;
|
|
101
|
+
} else t1 = $[33];
|
|
102
|
+
return t1;
|
|
103
|
+
}
|
|
104
|
+
export { InputNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } fro
|
|
|
13
13
|
export { FormField, type FormFieldProps, type FormFieldSemanticPart, } from "./components/form-field/form-field";
|
|
14
14
|
export { FormSection, type FormSectionProps, type FormSectionSemanticPart, } from "./components/form-section/form-section";
|
|
15
15
|
export { Input, type InputProps, type InputSemanticPart, } from "./components/input/input";
|
|
16
|
+
export { InputNumber, type InputNumberProps, type InputNumberSemanticPart, } from "./components/input-number/input-number";
|
|
16
17
|
export { type ConfirmType, Modal, type ModalFooterRender, type ModalFuncProps, type ModalFuncReturn, type ModalHookApi, type ModalProps, type ModalSemanticPart, } from "./components/modal";
|
|
17
18
|
export { Pagination, type PaginationProps, type PaginationSemanticPart, } from "./components/pagination/pagination";
|
|
18
19
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, type RadioSemanticPart, } from "./components/radio/radio";
|
|
@@ -27,6 +28,6 @@ export { CheckableTag, type CheckableTagProps, Tag, type TagColor, type TagProps
|
|
|
27
28
|
export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from "./components/textarea/textarea";
|
|
28
29
|
export { FormLayout, type FormLayoutProps, } from "./layouts/form-layout/form-layout";
|
|
29
30
|
export { Stack, type StackProps } from "./layouts/stack/stack";
|
|
30
|
-
export { type FormatOptions, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from "./number-input";
|
|
31
|
+
export { type FormatOptions, HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from "./number-input";
|
|
31
32
|
export { TaoPortalScope, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoThemeConfig, type TaoVariant, useTaoConfig, } from "./provider/tao-provider";
|
|
32
33
|
export { cx, type SemanticClassNames, type SemanticStyles, } from "./utils/semantic";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { FormActions } from "./components/form-actions/form-actions.js";
|
|
|
13
13
|
export { FormField } from "./components/form-field/form-field.js";
|
|
14
14
|
export { FormSection } from "./components/form-section/form-section.js";
|
|
15
15
|
export { Input } from "./components/input/input.js";
|
|
16
|
+
export { InputNumber } from "./components/input-number/input-number.js";
|
|
16
17
|
export { Modal } from "./components/modal/index.js";
|
|
17
18
|
export { Pagination } from "./components/pagination/pagination.js";
|
|
18
19
|
export { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
@@ -27,6 +28,6 @@ export { CheckableTag, Tag } from "./components/tag/tag.js";
|
|
|
27
28
|
export { Textarea } from "./components/textarea/textarea.js";
|
|
28
29
|
export { FormLayout } from "./layouts/form-layout/form-layout.js";
|
|
29
30
|
export { Stack } from "./layouts/stack/stack.js";
|
|
30
|
-
export { NumberInput, useNumberInput } from "./number-input/index.js";
|
|
31
|
+
export { HeadlessInputNumber, NumberInput, useNumberInput } from "./number-input/index.js";
|
|
31
32
|
export { TaoPortalScope, TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
|
|
32
33
|
export { cx } from "./utils/semantic.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export { NumberInput } from './number-input';
|
|
1
|
+
export { HeadlessInputNumber, type HeadlessInputNumberProps, NumberInput, type NumberInputProps, } from './number-input';
|
|
3
2
|
export type { FormatOptions, PadDecimalsOnBlur } from './types';
|
|
4
3
|
export type { UseNumberInputOptions, UseNumberInputReturn, } from './use-number-input';
|
|
5
4
|
export { useNumberInput } from './use-number-input';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NumberInput } from "./number-input.js";
|
|
1
|
+
export { HeadlessInputNumber, NumberInput } from "./number-input.js";
|
|
2
2
|
export { useNumberInput } from "./use-number-input.js";
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { type UseNumberInputOptions } from './use-number-input';
|
|
3
|
-
export interface
|
|
3
|
+
export interface HeadlessInputNumberProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'min' | 'max' | 'prefix'>, UseNumberInputOptions {
|
|
4
4
|
prefix?: ReactNode;
|
|
5
5
|
suffix?: ReactNode;
|
|
6
6
|
containerClassName?: string;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function HeadlessInputNumber(props: HeadlessInputNumberProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Renamed to `HeadlessInputNumber` to avoid confusion with the
|
|
12
|
+
* styled `InputNumber`. This alias will be removed in a future release.
|
|
13
|
+
*/
|
|
14
|
+
export declare const NumberInput: typeof HeadlessInputNumber;
|
|
15
|
+
/** @deprecated Use `HeadlessInputNumberProps`. */
|
|
16
|
+
export type NumberInputProps = HeadlessInputNumberProps;
|
|
@@ -15,7 +15,7 @@ const HOOK_KEYS = [
|
|
|
15
15
|
'min',
|
|
16
16
|
'max'
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function HeadlessInputNumber(props) {
|
|
19
19
|
const $ = c(20);
|
|
20
20
|
let className;
|
|
21
21
|
let containerClassName;
|
|
@@ -98,4 +98,5 @@ function NumberInput(props) {
|
|
|
98
98
|
} else t3 = $[19];
|
|
99
99
|
return t3;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
const NumberInput = HeadlessInputNumber;
|
|
102
|
+
export { HeadlessInputNumber, NumberInput };
|