x-ui-design 1.0.12 → 1.0.15
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 +8 -4
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +13 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +19 -9
- package/lib/components/Select/Option/Option.tsx +2 -0
- package/lib/components/Select/Option/style.css +5 -0
- package/lib/index.ts +1 -1
- package/package.json +1 -1
- package/src/app/page.tsx +11 -9
|
@@ -2,10 +2,14 @@ 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
|
-
|
|
5
|
+
interface InputHandle {
|
|
6
|
+
focus: () => void;
|
|
7
|
+
input: HTMLInputElement | null;
|
|
8
|
+
blur: () => void;
|
|
9
|
+
nativeElement: HTMLInputElement | null;
|
|
10
|
+
setSelectionRange: (start: number, end: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const InputComponent: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<InputHandle>>;
|
|
9
13
|
declare const Input: typeof InputComponent & {
|
|
10
14
|
TextArea: typeof Textarea;
|
|
11
15
|
};
|
|
@@ -9,7 +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("
|
|
12
|
+
declare const Input: typeof import("@/components/Input/Input").default;
|
|
13
13
|
declare const Textarea: import("react").ComponentType<import("@/types/input").TextareaProps>;
|
|
14
14
|
declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
|
|
15
15
|
declare const RadioButton: import("react").ComponentType<import("@/types/radio").RadioButtonProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ 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 __components_Input_Input from '@/components/Input/Input';
|
|
17
18
|
import * as __types_form from '@/types/form';
|
|
18
19
|
export { FieldData, FieldError, FieldInstancesInputRef, FormInstance, FormItemChildComponentProps, FormProps, RuleObject, RuleRender } from '@/types/form';
|
|
19
20
|
import * as __types_datepicker from '@/types/datepicker';
|
|
@@ -122,7 +123,7 @@ 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:
|
|
126
|
+
declare const Input: typeof __components_Input_Input.default;
|
|
126
127
|
declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
|
|
127
128
|
declare const Radio: react.ComponentType<__types_radio.RadioProps>;
|
|
128
129
|
declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -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 = /*#__PURE__*/React.forwardRef(({
|
|
3852
3852
|
size = 'large',
|
|
3853
3853
|
error,
|
|
3854
3854
|
suffix,
|
|
@@ -3876,9 +3876,8 @@ const InputComponent = ({
|
|
|
3876
3876
|
defaultValue,
|
|
3877
3877
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3878
3878
|
child,
|
|
3879
|
-
ref,
|
|
3880
3879
|
...props
|
|
3881
|
-
}) => {
|
|
3880
|
+
}, ref) => {
|
|
3882
3881
|
const inputRef = useRef(null);
|
|
3883
3882
|
const lastKeyPressed = useRef(null);
|
|
3884
3883
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -3886,18 +3885,20 @@ const InputComponent = ({
|
|
|
3886
3885
|
const [iconRenderVisible, setIconRenderVisible] = useState(false);
|
|
3887
3886
|
const animationRef = useRef(null);
|
|
3888
3887
|
useImperativeHandle(ref, () => ({
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3888
|
+
focus: () => {
|
|
3889
|
+
inputRef.current?.focus();
|
|
3890
|
+
},
|
|
3892
3891
|
input: inputRef.current,
|
|
3893
|
-
blur:
|
|
3892
|
+
blur: () => {
|
|
3893
|
+
inputRef.current?.blur();
|
|
3894
|
+
},
|
|
3894
3895
|
nativeElement: inputRef.current,
|
|
3895
3896
|
setSelectionRange: (start, end) => {
|
|
3896
3897
|
if (inputRef.current) {
|
|
3897
3898
|
inputRef.current.setSelectionRange(start, end);
|
|
3898
3899
|
}
|
|
3899
3900
|
}
|
|
3900
|
-
}));
|
|
3901
|
+
}), []);
|
|
3901
3902
|
useEffect(() => {
|
|
3902
3903
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '');
|
|
3903
3904
|
}, [value, mask, maskChar]);
|
|
@@ -3989,7 +3990,7 @@ const InputComponent = ({
|
|
|
3989
3990
|
} : {}), suffix || iconRender?.(iconRenderVisible), error && feedbackIcons ? /*#__PURE__*/React.createElement(ErrorIcon, null) : null)), addonAfter ? /*#__PURE__*/React.createElement("span", {
|
|
3990
3991
|
className: `${prefixCls}-addon ${prefixCls}-after ${prefixClsV3}-addon ${prefixClsV3}-after`
|
|
3991
3992
|
}, addonAfter) : null);
|
|
3992
|
-
};
|
|
3993
|
+
});
|
|
3993
3994
|
InputComponent.displayName = 'Input';
|
|
3994
3995
|
const Input$1 = InputComponent;
|
|
3995
3996
|
Input$1.TextArea = Textarea;
|
|
@@ -4169,7 +4170,7 @@ var Group = /*#__PURE__*/Object.freeze({
|
|
|
4169
4170
|
default: RadioGroup
|
|
4170
4171
|
});
|
|
4171
4172
|
|
|
4172
|
-
var css_248z$b = ".xUi-select-options{list-style:none;margin:0;padding:4px}.xUi-select-option,.xUi-select-options{border-radius:var(--xui-border-radius-sm)}.xUi-select-option{align-items:center;color:var(--xui-text-color);cursor:pointer;display:flex;font-size:var(--xui-font-size-md);margin-bottom:2px;padding:8px 16px}.xUi-select-option.xUi-select-focused,.xUi-select-option:hover{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.xUi-select-focused{align-items:center;display:flex;font-weight:600;justify-content:space-between}.xUi-select-option.xUi-select-disabled{color:rgba(0,0,0,.25);cursor:not-allowed}.xUi-select-option.selected{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.selected:hover{background-color:var(--xui-primary-color-light)}";
|
|
4173
|
+
var css_248z$b = ".xUi-select-options{list-style:none;margin:0;padding:4px}.xUi-select-option,.xUi-select-options{border-radius:var(--xui-border-radius-sm)}.xUi-select-option{align-items:center;color:var(--xui-text-color);cursor:pointer;display:flex;font-size:var(--xui-font-size-md);margin-bottom:2px;padding:8px 16px;&[tabindex=\"0\"]:focus-visible{background-color:var(--xui-primary-color);color:var(--xui-background-color)}}.xUi-select-option.xUi-select-focused,.xUi-select-option:hover{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.xUi-select-focused{align-items:center;display:flex;font-weight:600;justify-content:space-between}.xUi-select-option.xUi-select-disabled{color:rgba(0,0,0,.25);cursor:not-allowed}.xUi-select-option.selected{background-color:var(--xui-primary-color);color:var(--xui-background-color)}.xUi-select-option.selected:hover{background-color:var(--xui-primary-color-light)}";
|
|
4173
4174
|
styleInject(css_248z$b);
|
|
4174
4175
|
|
|
4175
4176
|
const Option = ({
|
|
@@ -4192,6 +4193,8 @@ const Option = ({
|
|
|
4192
4193
|
onClick?.(e);
|
|
4193
4194
|
};
|
|
4194
4195
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
4196
|
+
tabIndex: 0,
|
|
4197
|
+
role: "button",
|
|
4195
4198
|
className: clsx([`${prefixCls}-option ${prefixClsV3}-option ${className} `, {
|
|
4196
4199
|
selected: selected,
|
|
4197
4200
|
disabled: disabled
|