x-ui-design 1.0.26 → 1.0.27
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 +6 -26
- package/dist/esm/types/index.d.ts +1 -24
- package/dist/esm/types/types/input.d.ts +2 -1
- package/dist/index.d.ts +2 -26
- package/dist/index.esm.js +11 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +10 -5
- package/lib/types/input.ts +2 -1
- package/package.json +1 -1
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputProps } from '../../types/input';
|
|
3
3
|
import Textarea from './Textarea/Textarea';
|
|
4
4
|
import './style.css';
|
|
5
|
-
declare const InputComponent:
|
|
6
|
-
addonBefore
|
|
7
|
-
|
|
8
|
-
|
|
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>>;
|
|
5
|
+
declare const InputComponent: {
|
|
6
|
+
({ size, error, suffix, prefix, addonAfter, addonBefore, onPressEnter, disabled, allowClear, prefixCls, prefixClsV3, className, value, iconRender, noStyle, feedbackIcons, mask, maskChar, maskRegex, __injected, defaultValue, child, ref, ...props }: InputProps): React.JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
29
9
|
declare const Input: typeof InputComponent & {
|
|
30
10
|
TextArea: typeof Textarea;
|
|
31
11
|
};
|
|
@@ -9,30 +9,7 @@ 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<
|
|
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>>;
|
|
12
|
+
declare const Input: import("react").ComponentType<import("@/types/input").InputProps>;
|
|
36
13
|
declare const Textarea: import("react").ComponentType<import("@/types/input").TextareaProps>;
|
|
37
14
|
declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
|
|
38
15
|
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, SizeType, SyntheticBaseEvent } from '.';
|
|
2
|
+
import { DefaultProps, RuleType, SizeType, SyntheticBaseEvent } from '.';
|
|
3
3
|
export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> & DefaultProps & {
|
|
4
4
|
addonBefore?: ReactNode;
|
|
5
5
|
addonAfter?: ReactNode;
|
|
@@ -23,6 +23,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'p
|
|
|
23
23
|
mask?: string;
|
|
24
24
|
maskChar?: string;
|
|
25
25
|
maskRegex?: RegExp;
|
|
26
|
+
ref?: RuleType;
|
|
26
27
|
};
|
|
27
28
|
export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onResize'> & DefaultProps & {
|
|
28
29
|
value?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ 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';
|
|
19
17
|
import * as __types_form from '@/types/form';
|
|
20
18
|
export { FieldData, FieldError, FieldInstancesInputRef, FormInstance, FormItemChildComponentProps, FormProps, RuleObject, RuleRender } from '@/types/form';
|
|
21
19
|
import * as __types_datepicker from '@/types/datepicker';
|
|
@@ -29,6 +27,7 @@ export { BaseButtonProps, ButtonProps, ButtonType } from '@/types/button';
|
|
|
29
27
|
export { ArrowIcon, CalendarIcon, CheckIcon, ClearIcon, DateDistanceIcon, ErrorIcon, LoadingIcon, SearchIcon, SpinerIcon, StampleIcon, SuccessIcon, TimeIcon, TrashIcon } from '@/components/Icons';
|
|
30
28
|
export { useForm } from '@/hooks/useForm';
|
|
31
29
|
export { useWatch } from '@/hooks/useWatch';
|
|
30
|
+
export { DefaultProps, MouseEventHandlerSelect, Placement, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
|
|
32
31
|
export { FormContext } from '@/components/Form/Form';
|
|
33
32
|
export { clsx, createArray, parseValue } from '@/helpers';
|
|
34
33
|
export { flattenChildren } from '@/helpers/flatten';
|
|
@@ -123,30 +122,7 @@ declare const RangePicker: react.ComponentType<__types_datepicker.TRangePickerPr
|
|
|
123
122
|
declare const TimePicker: react.ComponentType<__types_datepicker.TimePickerProps>;
|
|
124
123
|
declare const Form: react.ComponentType<__types_form.FormProps>;
|
|
125
124
|
declare const FormItem: react.ComponentType<__types_form.FormItemProps>;
|
|
126
|
-
declare const Input: react.ComponentType<
|
|
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>>;
|
|
125
|
+
declare const Input: react.ComponentType<__types_input.InputProps>;
|
|
150
126
|
declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
|
|
151
127
|
declare const Radio: react.ComponentType<__types_radio.RadioProps>;
|
|
152
128
|
declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$1 from 'react/jsx-runtime';
|
|
2
|
-
import React, { useRef, useState, Children, isValidElement, Fragment, Suspense, useEffect, useContext, useMemo, useCallback, createContext,
|
|
2
|
+
import React, { useRef, useState, Children, isValidElement, Fragment, Suspense, useEffect, useContext, useMemo, useCallback, createContext, useImperativeHandle, useLayoutEffect, cloneElement } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import ReactDOMServer from 'react-dom/server';
|
|
5
5
|
|
|
@@ -3848,7 +3848,7 @@ function applyMask(raw, mask, maskChar = MASK_CHAR) {
|
|
|
3848
3848
|
var css_248z$f = ".xUi-input-container{align-items:center;background-color:transparent;border:1px solid var(--xui-border-color);border-radius:var(--xui-border-radius-sm);display:flex;overflow:hidden}.xUi-input-container:not(.xUi-input-error):not(.xUi-input-disabled):has(.xUi-input):hover,.xUi-input-container:not(.xUi-input-error):not(.xUi-input-disabled):has(.xUi-input:focus){border:1px solid var(--xui-primary-color)}.xUi-input-container.xUi-input-error{border-color:var(--xui-error-color)}.xUi-input-container.xUi-input-error .error-svg-icon,.xUi-input-suffix .error-svg-icon{color:var(--xui-error-color)}.xUi-input-wrapper{align-items:center;display:flex;flex-grow:1;position:relative;transition:border .3s}.xUi-input,.xUi-input-wrapper{background-color:transparent;height:-webkit-fill-available}.xUi-input{border:none;color:var(--xui-text-color);flex:1;outline:none;padding:.1px 7px;width:100%}.xUi-input:placeholder-shown{text-overflow:ellipsis}.xUi-input::placeholder{color:var(--xui-text-color);opacity:.6}.xUi-input-prefix,.xUi-input-suffix{background-color:transparent;gap:4px}.xUi-input-addon,.xUi-input-prefix,.xUi-input-suffix{align-items:center;color:var(--xui-text-color);display:flex;height:-webkit-fill-available;padding:0 7px}.xUi-input-addon.xUi-input-after{border-left:1px solid var(--xui-border-color)}.xUi-input-addon.xUi-input-before{border-right:1px solid var(--xui-border-color)}.xUi-input-large .xUi-input-addon{padding:0 10px}.xUi-input-clear{align-items:center;cursor:pointer;display:flex;margin:0 5px;position:relative;width:16px}.xUi-input-clear svg{color:var(--xui-text-color)}.xUi-input-disabled,.xUi-input-disabled .xUi-input,.xUi-input-disabled .xUi-input-suffix{background-color:var(--xui-color-disabled);cursor:not-allowed}.xUi-input-small{height:22px}.xUi-input-large .xUi-input-clear,.xUi-input-small .xUi-input,.xUi-input-small .xUi-input::placeholder{font-size:var(--xui-font-size-md)}.xUi-input-middle{border-radius:var(--xui-border-radius-md);height:30px}.xUi-input-large .xUi-input-clear,.xUi-input-middle .xUi-input,.xUi-input-middle .xUi-input::placeholder{font-size:var(--xui-font-size-md)}.xUi-input-large{border-radius:var(--xui-border-radius-lg);height:44px}.xUi-input-large .xUi-input,.xUi-input-large .xUi-input-clear,.xUi-input-large .xUi-input::placeholder{font-size:var(--xui-font-size-lg)}";
|
|
3849
3849
|
styleInject(css_248z$f);
|
|
3850
3850
|
|
|
3851
|
-
const InputComponent =
|
|
3851
|
+
const InputComponent = ({
|
|
3852
3852
|
size = 'large',
|
|
3853
3853
|
error,
|
|
3854
3854
|
suffix,
|
|
@@ -3868,13 +3868,17 @@ 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
|
|
3871
3872
|
// @ts-expect-error
|
|
3872
3873
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3873
3874
|
__injected,
|
|
3875
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3874
3876
|
defaultValue,
|
|
3877
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3875
3878
|
child,
|
|
3879
|
+
ref,
|
|
3876
3880
|
...props
|
|
3877
|
-
}
|
|
3881
|
+
}) => {
|
|
3878
3882
|
const inputRef = useRef(null);
|
|
3879
3883
|
const lastKeyPressed = useRef(null);
|
|
3880
3884
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -3887,7 +3891,9 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
3887
3891
|
input: inputRef.current,
|
|
3888
3892
|
nativeElement: inputRef.current,
|
|
3889
3893
|
setSelectionRange: (start, end) => {
|
|
3890
|
-
inputRef.current
|
|
3894
|
+
if (inputRef.current) {
|
|
3895
|
+
inputRef.current.setSelectionRange(start, end);
|
|
3896
|
+
}
|
|
3891
3897
|
}
|
|
3892
3898
|
}));
|
|
3893
3899
|
useEffect(() => {
|
|
@@ -3981,7 +3987,7 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
3981
3987
|
} : {}), suffix || iconRender?.(iconRenderVisible), error && feedbackIcons ? /*#__PURE__*/React.createElement(ErrorIcon, null) : null)), addonAfter ? /*#__PURE__*/React.createElement("span", {
|
|
3982
3988
|
className: `${prefixCls}-addon ${prefixCls}-after ${prefixClsV3}-addon ${prefixClsV3}-after`
|
|
3983
3989
|
}, addonAfter) : null);
|
|
3984
|
-
}
|
|
3990
|
+
};
|
|
3985
3991
|
InputComponent.displayName = 'Input';
|
|
3986
3992
|
const Input$1 = InputComponent;
|
|
3987
3993
|
Input$1.TextArea = Textarea;
|