Package not found. Please check the package name and try again.
@kdcloudjs/kdesign 1.7.5 → 1.7.6
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/kdesign-complete.less +11 -3
- package/dist/kdesign.css +13 -10
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +12 -8
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +2 -2
- package/dist/kdesign.min.js +2 -2
- package/dist/kdesign.min.js.map +1 -1
- package/es/form/Field.js +1 -0
- package/es/input/ClearableLabeledInput.d.ts +1 -0
- package/es/input/ClearableLabeledInput.js +4 -3
- package/es/input/TextArea.d.ts +1 -0
- package/es/input/TextArea.js +3 -2
- package/es/input/input.d.ts +1 -0
- package/es/input/input.js +3 -2
- package/es/input/style/index.css +12 -9
- package/es/input/style/index.less +5 -1
- package/es/input/style/mixin.less +5 -2
- package/es/input/style/token.less +1 -0
- package/lib/form/Field.js +1 -0
- package/lib/input/ClearableLabeledInput.d.ts +1 -0
- package/lib/input/ClearableLabeledInput.js +4 -3
- package/lib/input/TextArea.d.ts +1 -0
- package/lib/input/TextArea.js +3 -2
- package/lib/input/input.d.ts +1 -0
- package/lib/input/input.js +3 -2
- package/lib/input/style/index.css +12 -9
- package/lib/input/style/index.less +5 -1
- package/lib/input/style/mixin.less +5 -2
- package/lib/input/style/token.less +1 -0
- package/package.json +1 -1
package/es/form/Field.js
CHANGED
|
@@ -289,6 +289,7 @@ var Field = function Field(props) {
|
|
|
289
289
|
}, _mapInstanceProperty(childrenArray).call(childrenArray, function (child, index) {
|
|
290
290
|
var keys = mergeProps(_extends(_extends({}, generateEventHandler(handleValueValidate, validateTrigger)), {
|
|
291
291
|
key: index,
|
|
292
|
+
status: typeof validateMessage !== 'undefined' ? 'error' : undefined,
|
|
292
293
|
id: customizeHtmlFor ? undefined : htmlFor
|
|
293
294
|
}), child);
|
|
294
295
|
return child ? /*#__PURE__*/React.cloneElement(child, keys) : child;
|
|
@@ -28,7 +28,8 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
28
28
|
focused = props.focused,
|
|
29
29
|
numberMark = props.numberMark,
|
|
30
30
|
inputCount = props.inputCount,
|
|
31
|
-
count = props.count
|
|
31
|
+
count = props.count,
|
|
32
|
+
status = props.status;
|
|
32
33
|
var _useState = useState(false),
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
35
|
isMouseEnter = _useState2[0],
|
|
@@ -80,7 +81,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
80
81
|
className: "".concat(prefixCls, "-prefix"),
|
|
81
82
|
onMouseDown: mouseDownHandle
|
|
82
83
|
}, prefix) : null;
|
|
83
|
-
var inputWrapperClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), _defineProperty(_classNames2,
|
|
84
|
+
var inputWrapperClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), _defineProperty(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _classNames2), _defineProperty({}, className, className && !addonBefore && !addonAfter));
|
|
84
85
|
return /*#__PURE__*/React.createElement("span", {
|
|
85
86
|
className: inputWrapperClasses,
|
|
86
87
|
style: style,
|
|
@@ -95,7 +96,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
95
96
|
if (!addonBefore && !addonAfter && !count) {
|
|
96
97
|
return originElement;
|
|
97
98
|
}
|
|
98
|
-
var addonClassName = classNames("".concat(prefixCls, "-group-addon"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-borderless"), borderType === 'none'), _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-underline"), borderType === 'underline'), _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-disabled"), disabled), _classNames4));
|
|
99
|
+
var addonClassName = classNames("".concat(prefixCls, "-group-addon"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-borderless"), borderType === 'none'), _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-underline"), borderType === 'underline'), _defineProperty(_classNames4, "".concat(prefixCls, "-error"), status === 'error'), _defineProperty(_classNames4, "".concat(prefixCls, "-group-addon-disabled"), disabled), _classNames4));
|
|
99
100
|
var addonBeforeNode = addonBefore ? /*#__PURE__*/React.createElement("span", {
|
|
100
101
|
className: addonClassName
|
|
101
102
|
}, addonBefore) : null;
|
package/es/input/TextArea.d.ts
CHANGED
package/es/input/TextArea.js
CHANGED
|
@@ -51,7 +51,8 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
51
51
|
placeholder = textAreaProps.placeholder,
|
|
52
52
|
style = textAreaProps.style,
|
|
53
53
|
size = textAreaProps.size,
|
|
54
|
-
|
|
54
|
+
status = textAreaProps.status,
|
|
55
|
+
others = __rest(textAreaProps, ["value", "allowClear", "borderType", "defaultValue", "count", "countPosition", "autoSize", "className", "prefixCls", "canResize", "maxLength", "disabled", "onBlur", "onFocus", "onChange", "placeholder", "style", "size", "status"]);
|
|
55
56
|
var textAreaPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // TextArea样式前缀
|
|
56
57
|
devWarning(BorderTypes.indexOf(borderType) === -1, 'textarea', "cannot found textarea borderType '".concat(borderType, "'"));
|
|
57
58
|
var _useMergedState = useMergedState('', {
|
|
@@ -172,7 +173,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
172
173
|
ref: textareaRef,
|
|
173
174
|
disabled: disabled,
|
|
174
175
|
style: _extends({}, textareaStyles, hadCount || !!allowClear ? otherStyles : style),
|
|
175
|
-
className: classNames("".concat(prefixCls, "-textarea"), (_classNames2 = {}, _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(prefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames2, "".concat(prefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames2, "".concat(prefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames2, "".concat(prefixCls, "-
|
|
176
|
+
className: classNames("".concat(prefixCls, "-textarea"), (_classNames2 = {}, _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(prefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames2, "".concat(prefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames2, "".concat(prefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames2, "".concat(prefixCls, "-no-resize"), canResize !== true), _defineProperty(_classNames2, "".concat(prefixCls, "-allowClear-spacing"), !!allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _classNames2), _defineProperty({}, className, className && !allowClear && !hadCount)),
|
|
176
177
|
onChange: handleChange,
|
|
177
178
|
onFocus: !disabled ? handleFocus : undefined,
|
|
178
179
|
onBlur: !disabled ? handleBlur : undefined,
|
package/es/input/input.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
22
22
|
value?: any;
|
|
23
23
|
readonly?: 'readonly';
|
|
24
24
|
count?: boolean;
|
|
25
|
+
status?: 'error';
|
|
25
26
|
}
|
|
26
27
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<unknown>>;
|
|
27
28
|
export default Input;
|
package/es/input/input.js
CHANGED
|
@@ -49,7 +49,8 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
49
49
|
className = inputProps.className,
|
|
50
50
|
maxLength = inputProps.maxLength,
|
|
51
51
|
count = inputProps.count,
|
|
52
|
-
|
|
52
|
+
status = inputProps.status,
|
|
53
|
+
others = __rest(inputProps, ["type", "size", "disabled", "onPressEnter", "borderType", "prefixCls", "onFocus", "onBlur", "onChange", "placeholderTobeValue", "defaultValue", "value", "className", "maxLength", "count", "status"]);
|
|
53
54
|
devWarning(InputSiteTypes.indexOf(size) === -1, 'input', "cannot found input size '".concat(size, "'"));
|
|
54
55
|
devWarning(BorderTypes.indexOf(borderType) === -1, 'input', "cannot found input borderType '".concat(borderType, "'"));
|
|
55
56
|
var _useMergedState = useMergedState('', {
|
|
@@ -72,7 +73,7 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
72
73
|
var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // 按钮样式前缀
|
|
73
74
|
var addonBefore = others.addonBefore,
|
|
74
75
|
addonAfter = others.addonAfter;
|
|
75
|
-
var inputClasses = classNames(inputPrefixCls, (_classNames = {}, _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(inputPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames, "".concat(inputPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames), _defineProperty({}, className, className && !hasPrefixSuffix(inputProps) && !addonBefore && !addonAfter));
|
|
76
|
+
var inputClasses = classNames(inputPrefixCls, (_classNames = {}, _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(inputPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames, "".concat(inputPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-error"), status === 'error'), _defineProperty(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames), _defineProperty({}, className, className && !hasPrefixSuffix(inputProps) && !addonBefore && !addonAfter));
|
|
76
77
|
var handleFocus = function handleFocus(event) {
|
|
77
78
|
setFocused(true);
|
|
78
79
|
onFocus && onFocus(event);
|
package/es/input/style/index.css
CHANGED
|
@@ -146,10 +146,10 @@ textarea {
|
|
|
146
146
|
box-shadow: none;
|
|
147
147
|
outline: none;
|
|
148
148
|
}
|
|
149
|
-
.kd-input:not(.kd-input-disabled):hover {
|
|
149
|
+
.kd-input:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
150
150
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
151
151
|
}
|
|
152
|
-
.kd-input:not(.kd-input-disabled):focus {
|
|
152
|
+
.kd-input:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
153
153
|
color: #212121;
|
|
154
154
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
155
155
|
}
|
|
@@ -193,10 +193,10 @@ textarea {
|
|
|
193
193
|
box-shadow: none;
|
|
194
194
|
outline: none;
|
|
195
195
|
}
|
|
196
|
-
.kd-input-textarea:not(.kd-input-disabled):hover {
|
|
196
|
+
.kd-input-textarea:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
197
197
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
198
198
|
}
|
|
199
|
-
.kd-input-textarea:not(.kd-input-disabled):focus {
|
|
199
|
+
.kd-input-textarea:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
200
200
|
color: #212121;
|
|
201
201
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
202
202
|
}
|
|
@@ -300,10 +300,10 @@ textarea {
|
|
|
300
300
|
box-shadow: none;
|
|
301
301
|
outline: none;
|
|
302
302
|
}
|
|
303
|
-
.kd-input-wrapper:not(.kd-input-wrapper-disabled):hover {
|
|
303
|
+
.kd-input-wrapper:not(.kd-input-wrapper-disabled):not(.kd-input-error):hover {
|
|
304
304
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
305
305
|
}
|
|
306
|
-
.kd-input-wrapper:not(.kd-input-wrapper-disabled):focus {
|
|
306
|
+
.kd-input-wrapper:not(.kd-input-wrapper-disabled):not(.kd-input-error):focus {
|
|
307
307
|
color: #212121;
|
|
308
308
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
309
309
|
}
|
|
@@ -363,7 +363,7 @@ textarea {
|
|
|
363
363
|
border-radius: 0 !important;
|
|
364
364
|
padding-left: 0;
|
|
365
365
|
}
|
|
366
|
-
.kd-input-wrapper-focused {
|
|
366
|
+
.kd-input-wrapper-focused:not(.kd-input-error) {
|
|
367
367
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
368
368
|
}
|
|
369
369
|
.kd-input-wrapper-disabled {
|
|
@@ -408,10 +408,10 @@ textarea {
|
|
|
408
408
|
box-shadow: none;
|
|
409
409
|
outline: none;
|
|
410
410
|
}
|
|
411
|
-
.kd-input-wrapper-textarea:not(.kd-input-disabled):hover {
|
|
411
|
+
.kd-input-wrapper-textarea:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
412
412
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
413
413
|
}
|
|
414
|
-
.kd-input-wrapper-textarea:not(.kd-input-disabled):focus {
|
|
414
|
+
.kd-input-wrapper-textarea:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
415
415
|
color: #212121;
|
|
416
416
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
417
417
|
}
|
|
@@ -537,3 +537,6 @@ textarea {
|
|
|
537
537
|
.kd-input-input-mark-inner {
|
|
538
538
|
color: var(--kd-c-input-placeholder-color-text, var(--kd-g-color-text-placeholder, #ccc));
|
|
539
539
|
}
|
|
540
|
+
.kd-input-error:not(.kd-input-disabled):not(.kd-input-wrapper-disabled):not(.kd-input-group-addon-disabled) {
|
|
541
|
+
border-color: var(--kd-c-input-color-error, var(--kd-g-color-error, #fb2323));
|
|
542
|
+
}
|
|
@@ -152,7 +152,7 @@ textarea {
|
|
|
152
152
|
.underline;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
&-focused {
|
|
155
|
+
&-focused:not(.@{input-prefix-cls}-error) {
|
|
156
156
|
border-color: @input-border-color-focused;
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -308,4 +308,8 @@ textarea {
|
|
|
308
308
|
&-input-mark-inner {
|
|
309
309
|
color: @input-placeholder-color-inner;
|
|
310
310
|
}
|
|
311
|
+
|
|
312
|
+
&-error:not(.@{input-prefix-cls}-disabled):not(.@{input-prefix-cls}-wrapper-disabled):not(.@{input-prefix-cls}-group-addon-disabled) {
|
|
313
|
+
border-color: @input-error-color;
|
|
314
|
+
}
|
|
311
315
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
@import '../../style/themes/index';
|
|
1
2
|
@import './token.less';
|
|
3
|
+
@input-prefix-cls: ~'@{kd-prefix}-input';
|
|
2
4
|
|
|
3
5
|
// 输入框默认样式Mixins
|
|
4
6
|
.input(@prefix) {
|
|
5
7
|
@disabled-prefix-cls: ~'@{prefix}-disabled';
|
|
8
|
+
@error-prefix-cls: ~'@{input-prefix-cls}-error';
|
|
6
9
|
width: 100%;
|
|
7
10
|
min-width: 0;
|
|
8
11
|
border: @input-border-width-inner solid @input-border-color-disabled-inner;
|
|
@@ -29,10 +32,10 @@
|
|
|
29
32
|
box-shadow: none;
|
|
30
33
|
outline: none;
|
|
31
34
|
}
|
|
32
|
-
&:not(.@{disabled-prefix-cls}):hover {
|
|
35
|
+
&:not(.@{disabled-prefix-cls}):not(.@{error-prefix-cls}):hover {
|
|
33
36
|
border-color: @input-border-color-focused;
|
|
34
37
|
}
|
|
35
|
-
&:not(.@{disabled-prefix-cls}):focus {
|
|
38
|
+
&:not(.@{disabled-prefix-cls}):not(.@{error-prefix-cls}):focus {
|
|
36
39
|
color: @input-focus-color;
|
|
37
40
|
border-color: @input-border-color-focused;
|
|
38
41
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
);
|
|
22
22
|
@input-color-disabled-inner: var(~'@{input-prefix}-color-disabled', @color-disabled);
|
|
23
23
|
@input-affix-color: var(~'@{input-prefix}-affix-color-text', #666);
|
|
24
|
+
@input-error-color: var(~'@{input-prefix}-color-error', @color-error);
|
|
24
25
|
|
|
25
26
|
// font
|
|
26
27
|
@input-small-font-size-inner: var(~'@{input-prefix}-font-size-small', @font-size-small);
|
package/lib/form/Field.js
CHANGED
|
@@ -301,6 +301,7 @@ var Field = function Field(props) {
|
|
|
301
301
|
}, (0, _map.default)(childrenArray).call(childrenArray, function (child, index) {
|
|
302
302
|
var keys = mergeProps((0, _extends3.default)((0, _extends3.default)({}, generateEventHandler(handleValueValidate, validateTrigger)), {
|
|
303
303
|
key: index,
|
|
304
|
+
status: typeof validateMessage !== 'undefined' ? 'error' : undefined,
|
|
304
305
|
id: customizeHtmlFor ? undefined : htmlFor
|
|
305
306
|
}), child);
|
|
306
307
|
return child ? /*#__PURE__*/_react.default.cloneElement(child, keys) : child;
|
|
@@ -41,7 +41,8 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
41
41
|
focused = props.focused,
|
|
42
42
|
numberMark = props.numberMark,
|
|
43
43
|
inputCount = props.inputCount,
|
|
44
|
-
count = props.count
|
|
44
|
+
count = props.count,
|
|
45
|
+
status = props.status;
|
|
45
46
|
var _useState = (0, _react.useState)(false),
|
|
46
47
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
48
|
isMouseEnter = _useState2[0],
|
|
@@ -93,7 +94,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
93
94
|
className: "".concat(prefixCls, "-prefix"),
|
|
94
95
|
onMouseDown: mouseDownHandle
|
|
95
96
|
}, prefix) : null;
|
|
96
|
-
var inputWrapperClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-
|
|
97
|
+
var inputWrapperClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _classNames2), (0, _defineProperty2.default)({}, className, className && !addonBefore && !addonAfter));
|
|
97
98
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
98
99
|
className: inputWrapperClasses,
|
|
99
100
|
style: style,
|
|
@@ -108,7 +109,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
108
109
|
if (!addonBefore && !addonAfter && !count) {
|
|
109
110
|
return originElement;
|
|
110
111
|
}
|
|
111
|
-
var addonClassName = (0, _classnames.default)("".concat(prefixCls, "-group-addon"), (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-disabled"), disabled), _classNames4));
|
|
112
|
+
var addonClassName = (0, _classnames.default)("".concat(prefixCls, "-group-addon"), (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames4, "".concat(prefixCls, "-group-addon-disabled"), disabled), _classNames4));
|
|
112
113
|
var addonBeforeNode = addonBefore ? /*#__PURE__*/_react.default.createElement("span", {
|
|
113
114
|
className: addonClassName
|
|
114
115
|
}, addonBefore) : null;
|
package/lib/input/TextArea.d.ts
CHANGED
package/lib/input/TextArea.js
CHANGED
|
@@ -63,7 +63,8 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
63
63
|
placeholder = textAreaProps.placeholder,
|
|
64
64
|
style = textAreaProps.style,
|
|
65
65
|
size = textAreaProps.size,
|
|
66
|
-
|
|
66
|
+
status = textAreaProps.status,
|
|
67
|
+
others = __rest(textAreaProps, ["value", "allowClear", "borderType", "defaultValue", "count", "countPosition", "autoSize", "className", "prefixCls", "canResize", "maxLength", "disabled", "onBlur", "onFocus", "onChange", "placeholder", "style", "size", "status"]);
|
|
67
68
|
var textAreaPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // TextArea样式前缀
|
|
68
69
|
(0, _devwarning.default)(_input.BorderTypes.indexOf(borderType) === -1, 'textarea', "cannot found textarea borderType '".concat(borderType, "'"));
|
|
69
70
|
var _useMergedState = (0, _hooks.useMergedState)('', {
|
|
@@ -184,7 +185,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
|
|
|
184
185
|
ref: textareaRef,
|
|
185
186
|
disabled: disabled,
|
|
186
187
|
style: (0, _extends2.default)({}, textareaStyles, hadCount || !!allowClear ? otherStyles : style),
|
|
187
|
-
className: (0, _classnames.default)("".concat(prefixCls, "-textarea"), (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-
|
|
188
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-textarea"), (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-no-resize"), canResize !== true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-allowClear-spacing"), !!allowClear), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _classNames2), (0, _defineProperty2.default)({}, className, className && !allowClear && !hadCount)),
|
|
188
189
|
onChange: handleChange,
|
|
189
190
|
onFocus: !disabled ? handleFocus : undefined,
|
|
190
191
|
onBlur: !disabled ? handleBlur : undefined,
|
package/lib/input/input.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
22
22
|
value?: any;
|
|
23
23
|
readonly?: 'readonly';
|
|
24
24
|
count?: boolean;
|
|
25
|
+
status?: 'error';
|
|
25
26
|
}
|
|
26
27
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<unknown>>;
|
|
27
28
|
export default Input;
|
package/lib/input/input.js
CHANGED
|
@@ -64,7 +64,8 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
64
64
|
className = inputProps.className,
|
|
65
65
|
maxLength = inputProps.maxLength,
|
|
66
66
|
count = inputProps.count,
|
|
67
|
-
|
|
67
|
+
status = inputProps.status,
|
|
68
|
+
others = __rest(inputProps, ["type", "size", "disabled", "onPressEnter", "borderType", "prefixCls", "onFocus", "onBlur", "onChange", "placeholderTobeValue", "defaultValue", "value", "className", "maxLength", "count", "status"]);
|
|
68
69
|
(0, _devwarning.default)(InputSiteTypes.indexOf(size) === -1, 'input', "cannot found input size '".concat(size, "'"));
|
|
69
70
|
(0, _devwarning.default)(BorderTypes.indexOf(borderType) === -1, 'input', "cannot found input borderType '".concat(borderType, "'"));
|
|
70
71
|
var _useMergedState = (0, _hooks.useMergedState)('', {
|
|
@@ -87,7 +88,7 @@ var InternalInput = function InternalInput(props, ref) {
|
|
|
87
88
|
var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // 按钮样式前缀
|
|
88
89
|
var addonBefore = others.addonBefore,
|
|
89
90
|
addonAfter = others.addonAfter;
|
|
90
|
-
var inputClasses = (0, _classnames.default)(inputPrefixCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(inputPrefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames), (0, _defineProperty2.default)({}, className, className && !(0, _ClearableLabeledInput.hasPrefixSuffix)(inputProps) && !addonBefore && !addonAfter));
|
|
91
|
+
var inputClasses = (0, _classnames.default)(inputPrefixCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(inputPrefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames), (0, _defineProperty2.default)({}, className, className && !(0, _ClearableLabeledInput.hasPrefixSuffix)(inputProps) && !addonBefore && !addonAfter));
|
|
91
92
|
var handleFocus = function handleFocus(event) {
|
|
92
93
|
setFocused(true);
|
|
93
94
|
onFocus && onFocus(event);
|
|
@@ -146,10 +146,10 @@ textarea {
|
|
|
146
146
|
box-shadow: none;
|
|
147
147
|
outline: none;
|
|
148
148
|
}
|
|
149
|
-
.kd-input:not(.kd-input-disabled):hover {
|
|
149
|
+
.kd-input:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
150
150
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
151
151
|
}
|
|
152
|
-
.kd-input:not(.kd-input-disabled):focus {
|
|
152
|
+
.kd-input:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
153
153
|
color: #212121;
|
|
154
154
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
155
155
|
}
|
|
@@ -193,10 +193,10 @@ textarea {
|
|
|
193
193
|
box-shadow: none;
|
|
194
194
|
outline: none;
|
|
195
195
|
}
|
|
196
|
-
.kd-input-textarea:not(.kd-input-disabled):hover {
|
|
196
|
+
.kd-input-textarea:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
197
197
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
198
198
|
}
|
|
199
|
-
.kd-input-textarea:not(.kd-input-disabled):focus {
|
|
199
|
+
.kd-input-textarea:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
200
200
|
color: #212121;
|
|
201
201
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
202
202
|
}
|
|
@@ -300,10 +300,10 @@ textarea {
|
|
|
300
300
|
box-shadow: none;
|
|
301
301
|
outline: none;
|
|
302
302
|
}
|
|
303
|
-
.kd-input-wrapper:not(.kd-input-wrapper-disabled):hover {
|
|
303
|
+
.kd-input-wrapper:not(.kd-input-wrapper-disabled):not(.kd-input-error):hover {
|
|
304
304
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
305
305
|
}
|
|
306
|
-
.kd-input-wrapper:not(.kd-input-wrapper-disabled):focus {
|
|
306
|
+
.kd-input-wrapper:not(.kd-input-wrapper-disabled):not(.kd-input-error):focus {
|
|
307
307
|
color: #212121;
|
|
308
308
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
309
309
|
}
|
|
@@ -363,7 +363,7 @@ textarea {
|
|
|
363
363
|
border-radius: 0 !important;
|
|
364
364
|
padding-left: 0;
|
|
365
365
|
}
|
|
366
|
-
.kd-input-wrapper-focused {
|
|
366
|
+
.kd-input-wrapper-focused:not(.kd-input-error) {
|
|
367
367
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
368
368
|
}
|
|
369
369
|
.kd-input-wrapper-disabled {
|
|
@@ -408,10 +408,10 @@ textarea {
|
|
|
408
408
|
box-shadow: none;
|
|
409
409
|
outline: none;
|
|
410
410
|
}
|
|
411
|
-
.kd-input-wrapper-textarea:not(.kd-input-disabled):hover {
|
|
411
|
+
.kd-input-wrapper-textarea:not(.kd-input-disabled):not(.kd-input-error):hover {
|
|
412
412
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
413
413
|
}
|
|
414
|
-
.kd-input-wrapper-textarea:not(.kd-input-disabled):focus {
|
|
414
|
+
.kd-input-wrapper-textarea:not(.kd-input-disabled):not(.kd-input-error):focus {
|
|
415
415
|
color: #212121;
|
|
416
416
|
border-color: var(--kd-c-input-color-border-focused, var(--kd-g-color-theme, #5582f3));
|
|
417
417
|
}
|
|
@@ -537,3 +537,6 @@ textarea {
|
|
|
537
537
|
.kd-input-input-mark-inner {
|
|
538
538
|
color: var(--kd-c-input-placeholder-color-text, var(--kd-g-color-text-placeholder, #ccc));
|
|
539
539
|
}
|
|
540
|
+
.kd-input-error:not(.kd-input-disabled):not(.kd-input-wrapper-disabled):not(.kd-input-group-addon-disabled) {
|
|
541
|
+
border-color: var(--kd-c-input-color-error, var(--kd-g-color-error, #fb2323));
|
|
542
|
+
}
|
|
@@ -152,7 +152,7 @@ textarea {
|
|
|
152
152
|
.underline;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
&-focused {
|
|
155
|
+
&-focused:not(.@{input-prefix-cls}-error) {
|
|
156
156
|
border-color: @input-border-color-focused;
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -308,4 +308,8 @@ textarea {
|
|
|
308
308
|
&-input-mark-inner {
|
|
309
309
|
color: @input-placeholder-color-inner;
|
|
310
310
|
}
|
|
311
|
+
|
|
312
|
+
&-error:not(.@{input-prefix-cls}-disabled):not(.@{input-prefix-cls}-wrapper-disabled):not(.@{input-prefix-cls}-group-addon-disabled) {
|
|
313
|
+
border-color: @input-error-color;
|
|
314
|
+
}
|
|
311
315
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
@import '../../style/themes/index';
|
|
1
2
|
@import './token.less';
|
|
3
|
+
@input-prefix-cls: ~'@{kd-prefix}-input';
|
|
2
4
|
|
|
3
5
|
// 输入框默认样式Mixins
|
|
4
6
|
.input(@prefix) {
|
|
5
7
|
@disabled-prefix-cls: ~'@{prefix}-disabled';
|
|
8
|
+
@error-prefix-cls: ~'@{input-prefix-cls}-error';
|
|
6
9
|
width: 100%;
|
|
7
10
|
min-width: 0;
|
|
8
11
|
border: @input-border-width-inner solid @input-border-color-disabled-inner;
|
|
@@ -29,10 +32,10 @@
|
|
|
29
32
|
box-shadow: none;
|
|
30
33
|
outline: none;
|
|
31
34
|
}
|
|
32
|
-
&:not(.@{disabled-prefix-cls}):hover {
|
|
35
|
+
&:not(.@{disabled-prefix-cls}):not(.@{error-prefix-cls}):hover {
|
|
33
36
|
border-color: @input-border-color-focused;
|
|
34
37
|
}
|
|
35
|
-
&:not(.@{disabled-prefix-cls}):focus {
|
|
38
|
+
&:not(.@{disabled-prefix-cls}):not(.@{error-prefix-cls}):focus {
|
|
36
39
|
color: @input-focus-color;
|
|
37
40
|
border-color: @input-border-color-focused;
|
|
38
41
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
);
|
|
22
22
|
@input-color-disabled-inner: var(~'@{input-prefix}-color-disabled', @color-disabled);
|
|
23
23
|
@input-affix-color: var(~'@{input-prefix}-affix-color-text', #666);
|
|
24
|
+
@input-error-color: var(~'@{input-prefix}-color-error', @color-error);
|
|
24
25
|
|
|
25
26
|
// font
|
|
26
27
|
@input-small-font-size-inner: var(~'@{input-prefix}-font-size-small', @font-size-small);
|