x-ui-design 1.0.31 → 1.0.33
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 +3 -7
- package/dist/esm/types/index.d.ts +1 -7
- package/dist/esm/types/types/input.d.ts +2 -2
- package/dist/index.d.ts +1 -7
- package/dist/index.esm.js +26 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +9 -19
- package/lib/components/Select/Select.tsx +3 -3
- package/lib/components/Switch/Switch.tsx +2 -2
- package/lib/types/input.ts +2 -2
- package/package.json +5 -5
- package/src/app/page.tsx +14 -13
|
@@ -2,14 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { InputProps } from '../../types/input';
|
|
3
3
|
import Textarea from './Textarea/Textarea';
|
|
4
4
|
import './style.css';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
blur: () => void;
|
|
9
|
-
nativeElement: HTMLInputElement | null;
|
|
10
|
-
setSelectionRange: (start: number, end: number) => void;
|
|
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;
|
|
11
8
|
};
|
|
12
|
-
declare const InputComponent: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<InputHandle>>;
|
|
13
9
|
declare const Input: typeof InputComponent & {
|
|
14
10
|
TextArea: typeof Textarea;
|
|
15
11
|
};
|
|
@@ -9,13 +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
|
-
focus: () => void;
|
|
14
|
-
input: HTMLInputElement | null;
|
|
15
|
-
blur: () => void;
|
|
16
|
-
nativeElement: HTMLInputElement | null;
|
|
17
|
-
setSelectionRange: (start: number, end: number) => void;
|
|
18
|
-
}>>;
|
|
12
|
+
declare const Input: import("react").ComponentType<import("@/types/input").InputProps>;
|
|
19
13
|
declare const Textarea: import("react").ComponentType<import("@/types/input").TextareaProps>;
|
|
20
14
|
declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
|
|
21
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,
|
|
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,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'p
|
|
|
23
23
|
mask?: string;
|
|
24
24
|
maskChar?: string;
|
|
25
25
|
maskRegex?: RegExp;
|
|
26
|
-
ref?:
|
|
26
|
+
ref?: ForwardedRef<HTMLInputElement>;
|
|
27
27
|
};
|
|
28
28
|
export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onResize'> & DefaultProps & {
|
|
29
29
|
value?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -122,13 +122,7 @@ declare const RangePicker: react.ComponentType<__types_datepicker.TRangePickerPr
|
|
|
122
122
|
declare const TimePicker: react.ComponentType<__types_datepicker.TimePickerProps>;
|
|
123
123
|
declare const Form: react.ComponentType<__types_form.FormProps>;
|
|
124
124
|
declare const FormItem: react.ComponentType<__types_form.FormItemProps>;
|
|
125
|
-
declare const Input: react.ComponentType<
|
|
126
|
-
focus: () => void;
|
|
127
|
-
input: HTMLInputElement | null;
|
|
128
|
-
blur: () => void;
|
|
129
|
-
nativeElement: HTMLInputElement | null;
|
|
130
|
-
setSelectionRange: (start: number, end: number) => void;
|
|
131
|
-
}>>;
|
|
125
|
+
declare const Input: react.ComponentType<__types_input.InputProps>;
|
|
132
126
|
declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
|
|
133
127
|
declare const Radio: react.ComponentType<__types_radio.RadioProps>;
|
|
134
128
|
declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -2296,11 +2296,11 @@ const Switch = ({
|
|
|
2296
2296
|
}
|
|
2297
2297
|
}, [checked]);
|
|
2298
2298
|
return /*#__PURE__*/React.createElement("div", {
|
|
2299
|
+
tabIndex: 0,
|
|
2300
|
+
role: "button",
|
|
2299
2301
|
className: `${prefixCls}-wrapper ${prefixClsV3}-wrapper ${className} ${disabled ? `${prefixCls}__disabled ${prefixClsV3}__disabled` : ''}`,
|
|
2300
2302
|
style: style
|
|
2301
2303
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2302
|
-
tabIndex: 0,
|
|
2303
|
-
role: "button",
|
|
2304
2304
|
className: `${prefixCls} ${prefixClsV3} ${internalChecked ? `${prefixCls}__checked ${prefixClsV3}__checked` : ''}`,
|
|
2305
2305
|
onClick: handleClick
|
|
2306
2306
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -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,
|
|
@@ -3876,8 +3876,9 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3876
3876
|
defaultValue,
|
|
3877
3877
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3878
3878
|
child,
|
|
3879
|
+
ref,
|
|
3879
3880
|
...props
|
|
3880
|
-
}
|
|
3881
|
+
}) => {
|
|
3881
3882
|
const inputRef = useRef(null);
|
|
3882
3883
|
const lastKeyPressed = useRef(null);
|
|
3883
3884
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -3885,20 +3886,18 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3885
3886
|
const [iconRenderVisible, setIconRenderVisible] = useState(false);
|
|
3886
3887
|
const animationRef = useRef(null);
|
|
3887
3888
|
useImperativeHandle(ref, () => ({
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3889
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3890
|
+
// @ts-expect-error
|
|
3891
|
+
focus: inputRef.current?.focus,
|
|
3891
3892
|
input: inputRef.current,
|
|
3892
|
-
blur:
|
|
3893
|
-
inputRef.current?.blur();
|
|
3894
|
-
},
|
|
3893
|
+
blur: inputRef.current.blur,
|
|
3895
3894
|
nativeElement: inputRef.current,
|
|
3896
3895
|
setSelectionRange: (start, end) => {
|
|
3897
3896
|
if (inputRef.current) {
|
|
3898
3897
|
inputRef.current.setSelectionRange(start, end);
|
|
3899
3898
|
}
|
|
3900
3899
|
}
|
|
3901
|
-
})
|
|
3900
|
+
}));
|
|
3902
3901
|
useEffect(() => {
|
|
3903
3902
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '');
|
|
3904
3903
|
}, [value, mask, maskChar]);
|
|
@@ -3990,7 +3989,7 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3990
3989
|
} : {}), suffix || iconRender?.(iconRenderVisible), error && feedbackIcons ? /*#__PURE__*/React.createElement(ErrorIcon, null) : null)), addonAfter ? /*#__PURE__*/React.createElement("span", {
|
|
3991
3990
|
className: `${prefixCls}-addon ${prefixCls}-after ${prefixClsV3}-addon ${prefixClsV3}-after`
|
|
3992
3991
|
}, addonAfter) : null);
|
|
3993
|
-
}
|
|
3992
|
+
};
|
|
3994
3993
|
InputComponent.displayName = 'Input';
|
|
3995
3994
|
const Input$1 = InputComponent;
|
|
3996
3995
|
Input$1.TextArea = Textarea;
|
|
@@ -4761,18 +4760,30 @@ const Select = ({
|
|
|
4761
4760
|
} : {}, {
|
|
4762
4761
|
id: `${prefixCls}-search-tag-input`,
|
|
4763
4762
|
className: `${prefixCls}-tag-input`
|
|
4764
|
-
})), !hasMode && !searchQuery.length ? selected === '' ?
|
|
4763
|
+
})), !hasMode && !searchQuery.length ? selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4764
|
+
style: {
|
|
4765
|
+
display: 'contents'
|
|
4766
|
+
}
|
|
4767
|
+
}, placeholder) : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4765
4768
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4766
4769
|
style: {
|
|
4767
4770
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4768
4771
|
}
|
|
4769
|
-
}, selected === '' ?
|
|
4772
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4773
|
+
style: {
|
|
4774
|
+
display: 'contents'
|
|
4775
|
+
}
|
|
4776
|
+
}, placeholder) : selectedOption) : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4770
4777
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4771
4778
|
onClick: () => !disabled && setIsOpen(!isOpen || defaultOpen),
|
|
4772
4779
|
style: {
|
|
4773
4780
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4774
4781
|
}
|
|
4775
|
-
}, selected === '' ?
|
|
4782
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4783
|
+
style: {
|
|
4784
|
+
display: 'contents'
|
|
4785
|
+
}
|
|
4786
|
+
}, placeholder) : selectedOption) : null, isHover && !loading ? allowClear && selected ? /*#__PURE__*/React.createElement("button", {
|
|
4776
4787
|
className: `${prefixCls}-clear-btn ${prefixClsV3}-clear-btn`,
|
|
4777
4788
|
onClick: handleClear
|
|
4778
4789
|
}, removeIcon || /*#__PURE__*/React.createElement(ClearIcon, null)) : /*#__PURE__*/React.createElement("span", {
|