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
package/dist/index.js
CHANGED
|
@@ -2298,11 +2298,11 @@ const Switch = ({
|
|
|
2298
2298
|
}
|
|
2299
2299
|
}, [checked]);
|
|
2300
2300
|
return /*#__PURE__*/React.createElement("div", {
|
|
2301
|
+
tabIndex: 0,
|
|
2302
|
+
role: "button",
|
|
2301
2303
|
className: `${prefixCls}-wrapper ${prefixClsV3}-wrapper ${className} ${disabled ? `${prefixCls}__disabled ${prefixClsV3}__disabled` : ''}`,
|
|
2302
2304
|
style: style
|
|
2303
2305
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2304
|
-
tabIndex: 0,
|
|
2305
|
-
role: "button",
|
|
2306
2306
|
className: `${prefixCls} ${prefixClsV3} ${internalChecked ? `${prefixCls}__checked ${prefixClsV3}__checked` : ''}`,
|
|
2307
2307
|
onClick: handleClick
|
|
2308
2308
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3850,7 +3850,7 @@ function applyMask(raw, mask, maskChar = MASK_CHAR) {
|
|
|
3850
3850
|
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)}";
|
|
3851
3851
|
styleInject(css_248z$f);
|
|
3852
3852
|
|
|
3853
|
-
const InputComponent =
|
|
3853
|
+
const InputComponent = ({
|
|
3854
3854
|
size = 'large',
|
|
3855
3855
|
error,
|
|
3856
3856
|
suffix,
|
|
@@ -3878,8 +3878,9 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3878
3878
|
defaultValue,
|
|
3879
3879
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3880
3880
|
child,
|
|
3881
|
+
ref,
|
|
3881
3882
|
...props
|
|
3882
|
-
}
|
|
3883
|
+
}) => {
|
|
3883
3884
|
const inputRef = React.useRef(null);
|
|
3884
3885
|
const lastKeyPressed = React.useRef(null);
|
|
3885
3886
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -3887,20 +3888,18 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3887
3888
|
const [iconRenderVisible, setIconRenderVisible] = React.useState(false);
|
|
3888
3889
|
const animationRef = React.useRef(null);
|
|
3889
3890
|
React.useImperativeHandle(ref, () => ({
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3891
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3892
|
+
// @ts-expect-error
|
|
3893
|
+
focus: inputRef.current?.focus,
|
|
3893
3894
|
input: inputRef.current,
|
|
3894
|
-
blur:
|
|
3895
|
-
inputRef.current?.blur();
|
|
3896
|
-
},
|
|
3895
|
+
blur: inputRef.current.blur,
|
|
3897
3896
|
nativeElement: inputRef.current,
|
|
3898
3897
|
setSelectionRange: (start, end) => {
|
|
3899
3898
|
if (inputRef.current) {
|
|
3900
3899
|
inputRef.current.setSelectionRange(start, end);
|
|
3901
3900
|
}
|
|
3902
3901
|
}
|
|
3903
|
-
})
|
|
3902
|
+
}));
|
|
3904
3903
|
React.useEffect(() => {
|
|
3905
3904
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '');
|
|
3906
3905
|
}, [value, mask, maskChar]);
|
|
@@ -3992,7 +3991,7 @@ const InputComponent = /*#__PURE__*/React.forwardRef(({
|
|
|
3992
3991
|
} : {}), suffix || iconRender?.(iconRenderVisible), error && feedbackIcons ? /*#__PURE__*/React.createElement(ErrorIcon, null) : null)), addonAfter ? /*#__PURE__*/React.createElement("span", {
|
|
3993
3992
|
className: `${prefixCls}-addon ${prefixCls}-after ${prefixClsV3}-addon ${prefixClsV3}-after`
|
|
3994
3993
|
}, addonAfter) : null);
|
|
3995
|
-
}
|
|
3994
|
+
};
|
|
3996
3995
|
InputComponent.displayName = 'Input';
|
|
3997
3996
|
const Input$1 = InputComponent;
|
|
3998
3997
|
Input$1.TextArea = Textarea;
|
|
@@ -4763,18 +4762,30 @@ const Select = ({
|
|
|
4763
4762
|
} : {}, {
|
|
4764
4763
|
id: `${prefixCls}-search-tag-input`,
|
|
4765
4764
|
className: `${prefixCls}-tag-input`
|
|
4766
|
-
})), !hasMode && !searchQuery.length ? selected === '' ?
|
|
4765
|
+
})), !hasMode && !searchQuery.length ? selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4766
|
+
style: {
|
|
4767
|
+
display: 'contents'
|
|
4768
|
+
}
|
|
4769
|
+
}, placeholder) : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4767
4770
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4768
4771
|
style: {
|
|
4769
4772
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4770
4773
|
}
|
|
4771
|
-
}, selected === '' ?
|
|
4774
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4775
|
+
style: {
|
|
4776
|
+
display: 'contents'
|
|
4777
|
+
}
|
|
4778
|
+
}, placeholder) : selectedOption) : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4772
4779
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4773
4780
|
onClick: () => !disabled && setIsOpen(!isOpen || defaultOpen),
|
|
4774
4781
|
style: {
|
|
4775
4782
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4776
4783
|
}
|
|
4777
|
-
}, selected === '' ?
|
|
4784
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4785
|
+
style: {
|
|
4786
|
+
display: 'contents'
|
|
4787
|
+
}
|
|
4788
|
+
}, placeholder) : selectedOption) : null, isHover && !loading ? allowClear && selected ? /*#__PURE__*/React.createElement("button", {
|
|
4778
4789
|
className: `${prefixCls}-clear-btn ${prefixClsV3}-clear-btn`,
|
|
4779
4790
|
onClick: handleClear
|
|
4780
4791
|
}, removeIcon || /*#__PURE__*/React.createElement(ClearIcon, null)) : /*#__PURE__*/React.createElement("span", {
|