x-ui-design 1.0.24 → 1.0.26
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/esm/types/components/Input/Input.d.ts +26 -3
- package/dist/esm/types/index.d.ts +24 -1
- package/dist/esm/types/types/input.d.ts +1 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.esm.js +4 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -14
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +6 -16
- package/lib/types/input.ts +1 -2
- package/package.json +1 -1
- package/src/app/page.tsx +1 -6
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { KeyboardEvent } from 'react';
|
|
2
|
+
import { SyntheticBaseEvent } from '../../types';
|
|
3
3
|
import Textarea from './Textarea/Textarea';
|
|
4
4
|
import './style.css';
|
|
5
|
-
declare const InputComponent: React.ForwardRefExoticComponent<Omit<
|
|
5
|
+
declare const InputComponent: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & import("../../types").DefaultProps & {
|
|
6
|
+
addonBefore?: React.ReactNode;
|
|
7
|
+
addonAfter?: React.ReactNode;
|
|
8
|
+
size?: import("../../types").SizeType;
|
|
9
|
+
prefix?: React.ReactNode;
|
|
10
|
+
suffix?: React.ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
allowClear?: boolean;
|
|
13
|
+
error?: boolean;
|
|
14
|
+
bordered?: boolean;
|
|
15
|
+
iconRender?: (visible: boolean) => React.ReactElement;
|
|
16
|
+
onChange?: (event: SyntheticBaseEvent) => void;
|
|
17
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
18
|
+
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
|
19
|
+
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
|
20
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
|
|
21
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
22
|
+
onPressEnter?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
23
|
+
feedbackIcons?: boolean;
|
|
24
|
+
child?: React.ReactNode;
|
|
25
|
+
mask?: string;
|
|
26
|
+
maskChar?: string;
|
|
27
|
+
maskRegex?: RegExp;
|
|
28
|
+
} & React.RefAttributes<any>>;
|
|
6
29
|
declare const Input: typeof InputComponent & {
|
|
7
30
|
TextArea: typeof Textarea;
|
|
8
31
|
};
|
|
@@ -9,7 +9,30 @@ declare const RangePicker: import("react").ComponentType<import("@/types/datepic
|
|
|
9
9
|
declare const TimePicker: import("react").ComponentType<import("@/types/datepicker").TimePickerProps>;
|
|
10
10
|
declare const Form: import("react").ComponentType<import("@/types/form").FormProps>;
|
|
11
11
|
declare const FormItem: import("react").ComponentType<import("@/types/form").FormItemProps>;
|
|
12
|
-
declare const Input: import("react").ComponentType<Omit<import("
|
|
12
|
+
declare const Input: import("react").ComponentType<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & import("@/types").DefaultProps & {
|
|
13
|
+
addonBefore?: import("react").ReactNode;
|
|
14
|
+
addonAfter?: import("react").ReactNode;
|
|
15
|
+
size?: import("@/types").SizeType;
|
|
16
|
+
prefix?: import("react").ReactNode;
|
|
17
|
+
suffix?: import("react").ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
allowClear?: boolean;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
bordered?: boolean;
|
|
22
|
+
iconRender?: (visible: boolean) => import("react").ReactElement;
|
|
23
|
+
onChange?: (event: import("@/types").SyntheticBaseEvent) => void;
|
|
24
|
+
onClick?: import("react").MouseEventHandler<HTMLElement>;
|
|
25
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLElement>;
|
|
26
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLElement>;
|
|
27
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLElement>;
|
|
28
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLElement>;
|
|
29
|
+
onPressEnter?: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
|
|
30
|
+
feedbackIcons?: boolean;
|
|
31
|
+
child?: import("react").ReactNode;
|
|
32
|
+
mask?: string;
|
|
33
|
+
maskChar?: string;
|
|
34
|
+
maskRegex?: RegExp;
|
|
35
|
+
} & import("react").RefAttributes<any>>;
|
|
13
36
|
declare const Textarea: import("react").ComponentType<import("@/types/input").TextareaProps>;
|
|
14
37
|
declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
|
|
15
38
|
declare const RadioButton: import("react").ComponentType<import("@/types/radio").RadioButtonProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ForwardedRef, InputHTMLAttributes, KeyboardEvent, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
-
import { DefaultProps,
|
|
2
|
+
import { DefaultProps, SizeType, SyntheticBaseEvent } from '.';
|
|
3
3
|
export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> & DefaultProps & {
|
|
4
4
|
addonBefore?: ReactNode;
|
|
5
5
|
addonAfter?: ReactNode;
|
|
@@ -23,7 +23,6 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'p
|
|
|
23
23
|
mask?: string;
|
|
24
24
|
maskChar?: string;
|
|
25
25
|
maskRegex?: RegExp;
|
|
26
|
-
ref?: RuleType;
|
|
27
26
|
};
|
|
28
27
|
export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onResize'> & DefaultProps & {
|
|
29
28
|
value?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ import * as __types_radio from '@/types/radio';
|
|
|
14
14
|
export { RadioButtonProps, RadioGroupProps, RadioProps } from '@/types/radio';
|
|
15
15
|
import * as __types_input from '@/types/input';
|
|
16
16
|
export { InputProps, TextareaProps } from '@/types/input';
|
|
17
|
+
import * as __types from '@/types';
|
|
18
|
+
export { DefaultProps, MouseEventHandlerSelect, Placement, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
|
|
17
19
|
import * as __types_form from '@/types/form';
|
|
18
20
|
export { FieldData, FieldError, FieldInstancesInputRef, FormInstance, FormItemChildComponentProps, FormProps, RuleObject, RuleRender } from '@/types/form';
|
|
19
21
|
import * as __types_datepicker from '@/types/datepicker';
|
|
@@ -27,7 +29,6 @@ export { BaseButtonProps, ButtonProps, ButtonType } from '@/types/button';
|
|
|
27
29
|
export { ArrowIcon, CalendarIcon, CheckIcon, ClearIcon, DateDistanceIcon, ErrorIcon, LoadingIcon, SearchIcon, SpinerIcon, StampleIcon, SuccessIcon, TimeIcon, TrashIcon } from '@/components/Icons';
|
|
28
30
|
export { useForm } from '@/hooks/useForm';
|
|
29
31
|
export { useWatch } from '@/hooks/useWatch';
|
|
30
|
-
export { DefaultProps, MouseEventHandlerSelect, Placement, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
|
|
31
32
|
export { FormContext } from '@/components/Form/Form';
|
|
32
33
|
export { clsx, createArray, parseValue } from '@/helpers';
|
|
33
34
|
export { flattenChildren } from '@/helpers/flatten';
|
|
@@ -122,7 +123,30 @@ declare const RangePicker: react.ComponentType<__types_datepicker.TRangePickerPr
|
|
|
122
123
|
declare const TimePicker: react.ComponentType<__types_datepicker.TimePickerProps>;
|
|
123
124
|
declare const Form: react.ComponentType<__types_form.FormProps>;
|
|
124
125
|
declare const FormItem: react.ComponentType<__types_form.FormItemProps>;
|
|
125
|
-
declare const Input: react.ComponentType<Omit<
|
|
126
|
+
declare const Input: react.ComponentType<Omit<react.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & __types.DefaultProps & {
|
|
127
|
+
addonBefore?: react.ReactNode;
|
|
128
|
+
addonAfter?: react.ReactNode;
|
|
129
|
+
size?: __types.SizeType;
|
|
130
|
+
prefix?: react.ReactNode;
|
|
131
|
+
suffix?: react.ReactNode;
|
|
132
|
+
disabled?: boolean;
|
|
133
|
+
allowClear?: boolean;
|
|
134
|
+
error?: boolean;
|
|
135
|
+
bordered?: boolean;
|
|
136
|
+
iconRender?: (visible: boolean) => react.ReactElement;
|
|
137
|
+
onChange?: (event: __types.SyntheticBaseEvent) => void;
|
|
138
|
+
onClick?: react.MouseEventHandler<HTMLElement>;
|
|
139
|
+
onMouseEnter?: react.MouseEventHandler<HTMLElement>;
|
|
140
|
+
onMouseLeave?: react.MouseEventHandler<HTMLElement>;
|
|
141
|
+
onKeyPress?: react.KeyboardEventHandler<HTMLElement>;
|
|
142
|
+
onKeyDown?: react.KeyboardEventHandler<HTMLElement>;
|
|
143
|
+
onPressEnter?: (event: react.KeyboardEvent<HTMLInputElement>) => void;
|
|
144
|
+
feedbackIcons?: boolean;
|
|
145
|
+
child?: react.ReactNode;
|
|
146
|
+
mask?: string;
|
|
147
|
+
maskChar?: string;
|
|
148
|
+
maskRegex?: RegExp;
|
|
149
|
+
} & react.RefAttributes<any>>;
|
|
126
150
|
declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
|
|
127
151
|
declare const Radio: react.ComponentType<__types_radio.RadioProps>;
|
|
128
152
|
declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -3868,13 +3868,10 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
3868
3868
|
mask,
|
|
3869
3869
|
maskChar = MASK_CHAR,
|
|
3870
3870
|
maskRegex = MASK_REGEX,
|
|
3871
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3872
3871
|
// @ts-expect-error
|
|
3873
3872
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3874
3873
|
__injected,
|
|
3875
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3876
3874
|
defaultValue,
|
|
3877
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3878
3875
|
child,
|
|
3879
3876
|
...props
|
|
3880
3877
|
}, ref) => {
|
|
@@ -3885,21 +3882,14 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
3885
3882
|
const [iconRenderVisible, setIconRenderVisible] = useState(false);
|
|
3886
3883
|
const animationRef = useRef(null);
|
|
3887
3884
|
useImperativeHandle(ref, () => ({
|
|
3888
|
-
focus: () =>
|
|
3889
|
-
|
|
3890
|
-
inputRef.current?.focus();
|
|
3891
|
-
},
|
|
3892
|
-
blur: () => {
|
|
3893
|
-
inputRef.current?.blur();
|
|
3894
|
-
},
|
|
3885
|
+
focus: () => inputRef.current?.focus(),
|
|
3886
|
+
blur: () => inputRef.current?.blur(),
|
|
3895
3887
|
input: inputRef.current,
|
|
3896
3888
|
nativeElement: inputRef.current,
|
|
3897
3889
|
setSelectionRange: (start, end) => {
|
|
3898
|
-
|
|
3899
|
-
inputRef.current.setSelectionRange(start, end);
|
|
3900
|
-
}
|
|
3890
|
+
inputRef.current?.setSelectionRange(start, end);
|
|
3901
3891
|
}
|
|
3902
|
-
})
|
|
3892
|
+
}));
|
|
3903
3893
|
useEffect(() => {
|
|
3904
3894
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '');
|
|
3905
3895
|
}, [value, mask, maskChar]);
|