@hi-ui/input 4.0.9 → 4.0.11
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/CHANGELOG.md +24 -0
- package/lib/cjs/Input.js +89 -133
- package/lib/cjs/MockInput.js +44 -75
- package/lib/cjs/index.js +0 -6
- package/lib/cjs/styles/index.scss.js +2 -5
- package/lib/cjs/use-input-cursor.js +22 -42
- package/lib/cjs/use-input.js +40 -63
- package/lib/cjs/utils/index.js +0 -40
- package/lib/esm/Input.js +80 -104
- package/lib/esm/MockInput.js +38 -49
- package/lib/esm/styles/index.scss.js +2 -4
- package/lib/esm/use-input-cursor.js +22 -36
- package/lib/esm/use-input.js +40 -52
- package/lib/esm/utils/index.js +0 -37
- package/lib/types/Input.d.ts +0 -7
- package/package.json +13 -14
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# @hi-ui/input
|
2
2
|
|
3
|
+
## 4.0.11
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2672](https://github.com/XiaoMi/hiui/pull/2672) [`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e) Thanks [@zyprepare](https://github.com/zyprepare)! - build: 升级到 rollup3,重新构建发布组件
|
8
|
+
|
9
|
+
- Updated dependencies [[`1ebe27830`](https://github.com/XiaoMi/hiui/commit/1ebe2783098b3a8cd980bd10076d67635463800e)]:
|
10
|
+
- @hi-ui/core@4.0.6
|
11
|
+
- @hi-ui/use-latest@4.0.2
|
12
|
+
- @hi-ui/use-merge-refs@4.0.2
|
13
|
+
- @hi-ui/use-uncontrolled-state@4.0.2
|
14
|
+
- @hi-ui/icons@4.0.16
|
15
|
+
- @hi-ui/classname@4.0.2
|
16
|
+
- @hi-ui/dom-utils@4.0.5
|
17
|
+
- @hi-ui/env@4.0.2
|
18
|
+
- @hi-ui/func-utils@4.0.2
|
19
|
+
- @hi-ui/type-assertion@4.0.2
|
20
|
+
|
21
|
+
## 4.0.10
|
22
|
+
|
23
|
+
### Patch Changes
|
24
|
+
|
25
|
+
- [#2653](https://github.com/XiaoMi/hiui/pull/2653) [`b477d91db`](https://github.com/XiaoMi/hiui/commit/b477d91db15bbc92c8712a9a771af5b332779315) Thanks [@zyprepare](https://github.com/zyprepare)! - chore: 更新使用到的 G40 颜色值
|
26
|
+
|
3
27
|
## 4.0.9
|
4
28
|
|
5
29
|
### Patch Changes
|
package/lib/cjs/Input.js
CHANGED
@@ -9,161 +9,122 @@
|
|
9
9
|
*/
|
10
10
|
'use strict';
|
11
11
|
|
12
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
13
|
-
|
14
|
-
Object.defineProperty(exports, '__esModule', {
|
15
|
-
value: true
|
16
|
-
});
|
17
|
-
|
18
12
|
var tslib = require('tslib');
|
19
|
-
|
20
13
|
var React = require('react');
|
21
|
-
|
22
14
|
var classname = require('@hi-ui/classname');
|
23
|
-
|
24
15
|
var env = require('@hi-ui/env');
|
25
|
-
|
26
16
|
var useMergeRefs = require('@hi-ui/use-merge-refs');
|
27
|
-
|
28
17
|
var icons = require('@hi-ui/icons');
|
29
|
-
|
30
18
|
var useInput = require('./use-input.js');
|
31
|
-
|
32
|
-
function _interopDefaultLegacy(e) {
|
33
|
-
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
34
|
-
'default': e
|
35
|
-
};
|
36
|
-
}
|
37
|
-
|
38
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
39
|
-
|
40
19
|
var _prefix = classname.getPrefixCls('input');
|
41
20
|
/**
|
42
21
|
* 输入框
|
43
|
-
*
|
44
|
-
* @TODO:
|
45
|
-
* 1. size api 确认
|
46
|
-
* 2. 修改类名结构
|
47
|
-
* 3. 支持带数字展示
|
48
|
-
* 4. InputGroup 模式支持
|
49
|
-
* 5. 手动聚焦支持额外配置
|
50
22
|
*/
|
51
|
-
|
52
|
-
|
53
23
|
var Input = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
54
24
|
var _a$prefixCls = _a.prefixCls,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
25
|
+
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
26
|
+
_a$role = _a.role,
|
27
|
+
role = _a$role === void 0 ? 'input' : _a$role,
|
28
|
+
className = _a.className,
|
29
|
+
style = _a.style,
|
30
|
+
_a$size = _a.size,
|
31
|
+
size = _a$size === void 0 ? 'md' : _a$size,
|
32
|
+
_a$appearance = _a.appearance,
|
33
|
+
appearance = _a$appearance === void 0 ? 'line' : _a$appearance,
|
34
|
+
prepend = _a.prepend,
|
35
|
+
append = _a.append,
|
36
|
+
prefix = _a.prefix,
|
37
|
+
suffix = _a.suffix,
|
38
|
+
_a$clearableTrigger = _a.clearableTrigger,
|
39
|
+
clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
|
40
|
+
_a$clearable = _a.clearable,
|
41
|
+
clearable = _a$clearable === void 0 ? false : _a$clearable,
|
42
|
+
_a$invalid = _a.invalid,
|
43
|
+
invalid = _a$invalid === void 0 ? false : _a$invalid,
|
44
|
+
name = _a.name,
|
45
|
+
autoFocus = _a.autoFocus,
|
46
|
+
disabled = _a.disabled,
|
47
|
+
readOnly = _a.readOnly,
|
48
|
+
maxLength = _a.maxLength,
|
49
|
+
placeholder = _a.placeholder,
|
50
|
+
defaultValue = _a.defaultValue,
|
51
|
+
valueProp = _a.value,
|
52
|
+
onChange = _a.onChange,
|
53
|
+
onFocus = _a.onFocus,
|
54
|
+
onBlur = _a.onBlur,
|
55
|
+
onKeyDown = _a.onKeyDown,
|
56
|
+
trimValueOnBlur = _a.trimValueOnBlur,
|
57
|
+
onClear = _a.onClear,
|
58
|
+
type = _a.type,
|
59
|
+
containerRef = _a.containerRef,
|
60
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "style", "size", "appearance", "prepend", "append", "prefix", "suffix", "clearableTrigger", "clearable", "invalid", "name", "autoFocus", "disabled", "readOnly", "maxLength", "placeholder", "defaultValue", "value", "onChange", "onFocus", "onBlur", "onKeyDown", "trimValueOnBlur", "onClear", "type", "containerRef"]);
|
61
|
+
// @TODO: 临时方案,后面迁移至 InputGroup
|
93
62
|
var _useMemo = React.useMemo(function () {
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
unsetPrepend = _useMemo[0],
|
110
|
-
unsetAppend = _useMemo[1];
|
111
|
-
|
63
|
+
var shouldUnset = [false, false];
|
64
|
+
// @ts-ignore
|
65
|
+
// @ts-ignore
|
66
|
+
if ( /*#__PURE__*/React.isValidElement(prepend) && ['Select', 'Button'].includes(prepend.type.HiName)) {
|
67
|
+
shouldUnset[0] = true;
|
68
|
+
}
|
69
|
+
// @ts-ignore
|
70
|
+
// @ts-ignore
|
71
|
+
if ( /*#__PURE__*/React.isValidElement(append) && ['Select', 'Button'].includes(append.type.HiName)) {
|
72
|
+
shouldUnset[1] = true;
|
73
|
+
}
|
74
|
+
return shouldUnset;
|
75
|
+
}, [prepend, append]),
|
76
|
+
unsetPrepend = _useMemo[0],
|
77
|
+
unsetAppend = _useMemo[1];
|
112
78
|
var inputElementRef = React.useRef(null);
|
113
79
|
var proxyOnChange = React.useCallback(function (value, evt) {
|
114
80
|
if (!onChange) return;
|
115
81
|
onChangeMock(onChange, evt, inputElementRef.current, value);
|
116
82
|
}, [onChange]);
|
117
83
|
var clearElementRef = React.useRef(null);
|
118
|
-
|
119
84
|
var _useInput = useInput.useInput({
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
85
|
+
clearElementRef: clearElementRef,
|
86
|
+
inputElementRef: inputElementRef,
|
87
|
+
name: name,
|
88
|
+
autoFocus: autoFocus,
|
89
|
+
disabled: disabled,
|
90
|
+
readOnly: readOnly,
|
91
|
+
maxLength: maxLength,
|
92
|
+
placeholder: placeholder,
|
93
|
+
defaultValue: defaultValue,
|
94
|
+
value: valueProp,
|
95
|
+
onChange: proxyOnChange,
|
96
|
+
onFocus: onFocus,
|
97
|
+
onBlur: onBlur,
|
98
|
+
onKeyDown: onKeyDown,
|
99
|
+
trimValueOnBlur: trimValueOnBlur,
|
100
|
+
type: type
|
101
|
+
}),
|
102
|
+
tryChangeValue = _useInput.tryChangeValue,
|
103
|
+
focused = _useInput.focused,
|
104
|
+
value = _useInput.value,
|
105
|
+
getInputProps = _useInput.getInputProps;
|
142
106
|
var focus = React.useCallback(function () {
|
143
107
|
var _a;
|
144
|
-
|
145
108
|
(_a = inputElementRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
146
109
|
}, []);
|
147
|
-
|
148
110
|
var _useState = React.useState(false),
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
111
|
+
hover = _useState[0],
|
112
|
+
setHover = _useState[1];
|
113
|
+
// 在开启 clearable 下展示 清除内容按钮,可点击进行内容清楚
|
153
114
|
var showClearableIcon = clearable && !!value && !disabled;
|
154
115
|
var mergedRef = useMergeRefs.useMergeRefs(ref, inputElementRef);
|
155
116
|
var cls = classname.cx(prefixCls, className, prefixCls + "--size-" + size, prefixCls + "--appearance-" + appearance);
|
156
117
|
var outerCls = classname.cx(prefixCls + "__outer", prepend && prefixCls + "__outer--prepend", prepend && unsetPrepend && prefixCls + "__outer--prepend-unset", append && prefixCls + "__outer--append", append && unsetAppend && prefixCls + "__outer--append-unset");
|
157
|
-
return /*#__PURE__*/
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
158
119
|
role: role,
|
159
120
|
className: cls,
|
160
121
|
style: style,
|
161
122
|
ref: containerRef
|
162
|
-
}, /*#__PURE__*/
|
123
|
+
}, /*#__PURE__*/React.createElement("div", {
|
163
124
|
className: outerCls
|
164
|
-
}, prepend ? /*#__PURE__*/
|
125
|
+
}, prepend ? /*#__PURE__*/React.createElement("div", {
|
165
126
|
className: prefixCls + "__prepend"
|
166
|
-
}, prepend) : null, /*#__PURE__*/
|
127
|
+
}, prepend) : null, /*#__PURE__*/React.createElement("div", {
|
167
128
|
className: classname.cx(prefixCls + "__inner", prefix && prefixCls + "__inner--prefix", suffix && prefixCls + "__inner--suffix", focused && prefixCls + "__inner--focused", disabled && prefixCls + "__inner--disabled", readOnly && prefixCls + "__inner--readonly", invalid && prefixCls + "__inner--invalid"),
|
168
129
|
onMouseOver: function onMouseOver(e) {
|
169
130
|
setHover(true);
|
@@ -171,14 +132,14 @@ var Input = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
171
132
|
onMouseLeave: function onMouseLeave(e) {
|
172
133
|
setHover(false);
|
173
134
|
}
|
174
|
-
}, prefix ? /*#__PURE__*/
|
135
|
+
}, prefix ? /*#__PURE__*/React.createElement("span", {
|
175
136
|
className: prefixCls + "__prefix"
|
176
|
-
}, prefix) : null, /*#__PURE__*/
|
137
|
+
}, prefix) : null, /*#__PURE__*/React.createElement("input", Object.assign({
|
177
138
|
ref: mergedRef,
|
178
139
|
className: prefixCls + "__text"
|
179
|
-
}, getInputProps(), rest)), suffix || showClearableIcon ? /*#__PURE__*/
|
140
|
+
}, getInputProps(), rest)), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
180
141
|
className: prefixCls + "__suffix"
|
181
|
-
}, showClearableIcon ? /*#__PURE__*/
|
142
|
+
}, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
182
143
|
ref: clearElementRef,
|
183
144
|
className: classname.cx(prefixCls + "__clear", (clearableTrigger === 'always' || hover) && prefixCls + "__clear--active"),
|
184
145
|
role: "button",
|
@@ -188,11 +149,10 @@ var Input = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
188
149
|
onClear === null || onClear === void 0 ? void 0 : onClear();
|
189
150
|
focus();
|
190
151
|
}
|
191
|
-
}, /*#__PURE__*/
|
152
|
+
}, /*#__PURE__*/React.createElement(icons.CloseCircleFilled, null)) : null, suffix) : null), append ? /*#__PURE__*/React.createElement("div", {
|
192
153
|
className: prefixCls + "__append"
|
193
154
|
}, append) : null));
|
194
155
|
});
|
195
|
-
|
196
156
|
if (env.__DEV__) {
|
197
157
|
Input.displayName = 'Input';
|
198
158
|
}
|
@@ -205,11 +165,9 @@ if (env.__DEV__) {
|
|
205
165
|
* @param targetValue
|
206
166
|
* @returns
|
207
167
|
*/
|
208
|
-
|
209
|
-
|
210
168
|
function onChangeMock(onChange, evt, target, targetValue) {
|
211
|
-
var event = evt;
|
212
|
-
|
169
|
+
var event = evt;
|
170
|
+
// 点击 clearIcon 或者 失焦 trim 时,都会代理 onChange 的事件对象 target 指向 input.target
|
213
171
|
if (evt.type !== 'change') {
|
214
172
|
if (!target) return;
|
215
173
|
var originalTargetValue = target.value;
|
@@ -217,14 +175,12 @@ function onChangeMock(onChange, evt, target, targetValue) {
|
|
217
175
|
event.target = target;
|
218
176
|
event.currentTarget = target;
|
219
177
|
target.value = targetValue;
|
220
|
-
onChange(event, targetValue);
|
221
|
-
|
178
|
+
onChange(event, targetValue);
|
179
|
+
// 重置为之前值
|
222
180
|
target.value = originalTargetValue;
|
223
181
|
return;
|
224
182
|
}
|
225
|
-
|
226
183
|
onChange(event, targetValue);
|
227
184
|
}
|
228
|
-
|
229
185
|
exports.Input = Input;
|
230
186
|
exports.onChangeMock = onChangeMock;
|
package/lib/cjs/MockInput.js
CHANGED
@@ -9,81 +9,56 @@
|
|
9
9
|
*/
|
10
10
|
'use strict';
|
11
11
|
|
12
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
13
|
-
|
14
|
-
Object.defineProperty(exports, '__esModule', {
|
15
|
-
value: true
|
16
|
-
});
|
17
|
-
|
18
12
|
var tslib = require('tslib');
|
19
|
-
|
20
13
|
var React = require('react');
|
21
|
-
|
22
14
|
var classname = require('@hi-ui/classname');
|
23
|
-
|
24
15
|
var env = require('@hi-ui/env');
|
25
|
-
|
26
16
|
var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
|
27
|
-
|
28
17
|
var icons = require('@hi-ui/icons');
|
29
|
-
|
30
|
-
function _interopDefaultLegacy(e) {
|
31
|
-
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
32
|
-
'default': e
|
33
|
-
};
|
34
|
-
}
|
35
|
-
|
36
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
37
|
-
|
38
18
|
var _role = 'mock-input';
|
39
|
-
|
40
19
|
var _prefix = classname.getPrefixCls(_role);
|
41
|
-
|
42
20
|
var NOOP_VALUE = '';
|
43
21
|
var NOOP_ARRAY = [];
|
44
22
|
/**
|
45
23
|
* 支持自定义渲染输入框内容,暂时仅供内部 Picker 类组件使用,不对外提供
|
46
24
|
*/
|
47
|
-
|
48
25
|
var MockInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
49
26
|
var _a$prefixCls = _a.prefixCls,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
27
|
+
prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
|
28
|
+
_a$role = _a.role,
|
29
|
+
role = _a$role === void 0 ? _role : _a$role,
|
30
|
+
className = _a.className,
|
31
|
+
_a$data = _a.data,
|
32
|
+
data = _a$data === void 0 ? NOOP_ARRAY : _a$data,
|
33
|
+
_a$defaultValue = _a.defaultValue,
|
34
|
+
defaultValue = _a$defaultValue === void 0 ? NOOP_VALUE : _a$defaultValue,
|
35
|
+
valueProp = _a.value,
|
36
|
+
onChange = _a.onChange,
|
37
|
+
placeholder = _a.placeholder,
|
38
|
+
_a$disabled = _a.disabled,
|
39
|
+
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
40
|
+
_a$clearable = _a.clearable,
|
41
|
+
clearable = _a$clearable === void 0 ? false : _a$clearable,
|
42
|
+
_a$focused = _a.focused,
|
43
|
+
focused = _a$focused === void 0 ? false : _a$focused,
|
44
|
+
_a$invalid = _a.invalid,
|
45
|
+
invalid = _a$invalid === void 0 ? false : _a$invalid,
|
46
|
+
_a$readOnly = _a.readOnly,
|
47
|
+
readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
|
48
|
+
_a$size = _a.size,
|
49
|
+
size = _a$size === void 0 ? 'md' : _a$size,
|
50
|
+
_a$appearance = _a.appearance,
|
51
|
+
appearance = _a$appearance === void 0 ? 'line' : _a$appearance,
|
52
|
+
_a$clearableTrigger = _a.clearableTrigger,
|
53
|
+
clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
|
54
|
+
displayRender = _a.displayRender,
|
55
|
+
suffix = _a.suffix,
|
56
|
+
_onMouseOver = _a.onMouseOver,
|
57
|
+
_onMouseLeave = _a.onMouseLeave,
|
58
|
+
rest = tslib.__rest(_a, ["prefixCls", "role", "className", "data", "defaultValue", "value", "onChange", "placeholder", "disabled", "clearable", "focused", "invalid", "readOnly", "size", "appearance", "clearableTrigger", "displayRender", "suffix", "onMouseOver", "onMouseLeave"]);
|
83
59
|
var _useUncontrolledState = useUncontrolledState.useUncontrolledState(defaultValue, valueProp, onChange),
|
84
|
-
|
85
|
-
|
86
|
-
|
60
|
+
value = _useUncontrolledState[0],
|
61
|
+
tryChangeValue = _useUncontrolledState[1];
|
87
62
|
var displayItem = React.useMemo(function () {
|
88
63
|
if (value === '') return null;
|
89
64
|
var displayItem = data.find(function (item) {
|
@@ -93,11 +68,9 @@ var MockInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
93
68
|
}, [value, data]);
|
94
69
|
var displayValue = React.useMemo(function () {
|
95
70
|
if (!displayItem) return '';
|
96
|
-
|
97
71
|
if (displayRender) {
|
98
72
|
return displayRender(displayItem);
|
99
73
|
}
|
100
|
-
|
101
74
|
return displayItem.title;
|
102
75
|
}, [displayItem, displayRender]);
|
103
76
|
var handleClear = React.useCallback(function (evt) {
|
@@ -105,22 +78,20 @@ var MockInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
105
78
|
evt.stopPropagation();
|
106
79
|
tryChangeValue(NOOP_VALUE, displayItem);
|
107
80
|
}, [tryChangeValue, disabled, displayItem]);
|
108
|
-
|
109
81
|
var _useState = React.useState(false),
|
110
|
-
|
111
|
-
|
112
|
-
|
82
|
+
hover = _useState[0],
|
83
|
+
setHover = _useState[1];
|
113
84
|
var trySetHover = React.useCallback(function (hovered) {
|
114
85
|
if (disabled) return;
|
115
86
|
setHover(hovered);
|
116
87
|
}, [disabled]);
|
117
|
-
var hasValue = !!displayValue;
|
118
|
-
|
88
|
+
var hasValue = !!displayValue;
|
89
|
+
// 在开启 clearable 下展示 清除内容按钮,可点击进行内容清除
|
119
90
|
var showClearableIcon = React.useMemo(function () {
|
120
91
|
return clearable && hasValue && !disabled && (clearableTrigger === 'always' || hover);
|
121
92
|
}, [clearable, hasValue, disabled, clearableTrigger, hover]);
|
122
93
|
var cls = classname.cx(prefixCls, className, prefixCls + "--appearance-" + appearance, prefixCls + "--size-" + size, focused && "focused", disabled && 'disabled', readOnly && 'readonly', invalid && 'invalid');
|
123
|
-
return /*#__PURE__*/
|
94
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
124
95
|
ref: ref,
|
125
96
|
role: role,
|
126
97
|
className: cls,
|
@@ -132,22 +103,20 @@ var MockInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
132
103
|
trySetHover(false);
|
133
104
|
_onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(evt);
|
134
105
|
}
|
135
|
-
}, rest), hasValue ? /*#__PURE__*/
|
106
|
+
}, rest), hasValue ? /*#__PURE__*/React.createElement("span", {
|
136
107
|
className: prefixCls + "__value"
|
137
|
-
}, displayValue) : /*#__PURE__*/
|
108
|
+
}, displayValue) : /*#__PURE__*/React.createElement("span", {
|
138
109
|
className: prefixCls + "__placeholder"
|
139
|
-
}, placeholder), suffix || showClearableIcon ? /*#__PURE__*/
|
110
|
+
}, placeholder), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
140
111
|
className: prefixCls + "__suffix"
|
141
|
-
}, showClearableIcon ? /*#__PURE__*/
|
112
|
+
}, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
|
142
113
|
role: "button",
|
143
114
|
tabIndex: -1,
|
144
115
|
className: classname.cx(prefixCls + "__clear", 'active'),
|
145
116
|
onClick: handleClear
|
146
|
-
}, /*#__PURE__*/
|
117
|
+
}, /*#__PURE__*/React.createElement(icons.CloseCircleFilled, null)) : suffix) : null);
|
147
118
|
});
|
148
|
-
|
149
119
|
if (env.__DEV__) {
|
150
120
|
MockInput.displayName = 'MockInput';
|
151
121
|
}
|
152
|
-
|
153
122
|
exports.MockInput = MockInput;
|
package/lib/cjs/index.js
CHANGED
@@ -12,17 +12,11 @@
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
|
16
15
|
require('./styles/index.scss.js');
|
17
|
-
|
18
16
|
var Input = require('./Input.js');
|
19
|
-
|
20
17
|
var useInput = require('./use-input.js');
|
21
|
-
|
22
18
|
var useInputCursor = require('./use-input-cursor.js');
|
23
|
-
|
24
19
|
var MockInput = require('./MockInput.js');
|
25
|
-
|
26
20
|
exports.Input = Input.Input;
|
27
21
|
exports["default"] = Input.Input;
|
28
22
|
exports.onChangeMock = Input.onChangeMock;
|