@hi-ui/input 4.0.0-alpha.8 → 4.0.0-beta.10

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/lib/esm/Input.js CHANGED
@@ -8,17 +8,23 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import { __rest } from 'tslib';
11
- import React, { forwardRef, useRef, useCallback, useState, useMemo } from 'react';
11
+ import React, { forwardRef, useMemo, isValidElement, useRef, useCallback, useState } from 'react';
12
12
  import { getPrefixCls, cx } from '@hi-ui/classname';
13
13
  import { __DEV__ } from '@hi-ui/env';
14
- import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
15
14
  import { useMergeRefs } from '@hi-ui/use-merge-refs';
16
15
  import { CloseCircleFilled } from '@hi-ui/icons';
17
- var _role = 'input';
16
+ import { useInput } from './use-input.js';
18
17
 
19
- var _prefix = getPrefixCls(_role);
18
+ var _prefix = getPrefixCls('input');
20
19
  /**
21
- * TODO: What is Input
20
+ * 输入框
21
+ *
22
+ * @TODO:
23
+ * 1. size api 确认
24
+ * 2. 修改类名结构
25
+ * 3. 支持带数字展示
26
+ * 4. InputGroup 模式支持
27
+ * 5. 手动聚焦支持额外配置
22
28
  */
23
29
 
24
30
 
@@ -26,102 +32,114 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
26
32
  var _a$prefixCls = _a.prefixCls,
27
33
  prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
28
34
  _a$role = _a.role,
29
- role = _a$role === void 0 ? _role : _a$role,
35
+ role = _a$role === void 0 ? 'input' : _a$role,
30
36
  className = _a.className,
31
37
  style = _a.style,
32
- _a$autoFocus = _a.autoFocus,
33
- autoFocus = _a$autoFocus === void 0 ? false : _a$autoFocus,
34
- _a$disabled = _a.disabled,
35
- disabled = _a$disabled === void 0 ? false : _a$disabled,
36
- _a$readOnly = _a.readOnly,
37
- readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
38
- name = _a.name,
39
- maxLength = _a.maxLength,
40
- _a$type = _a.type,
41
- type = _a$type === void 0 ? 'text' : _a$type,
42
38
  _a$size = _a.size,
43
- size = _a$size === void 0 ? 'sm' : _a$size,
39
+ size = _a$size === void 0 ? 'md' : _a$size,
44
40
  _a$appearance = _a.appearance,
45
- appearance = _a$appearance === void 0 ? 'outline' : _a$appearance,
46
- placeholder = _a.placeholder,
41
+ appearance = _a$appearance === void 0 ? 'line' : _a$appearance,
47
42
  prepend = _a.prepend,
48
43
  append = _a.append,
49
44
  prefix = _a.prefix,
50
45
  suffix = _a.suffix,
51
- _a$defaultValue = _a.defaultValue,
52
- defaultValue = _a$defaultValue === void 0 ? '' : _a$defaultValue,
53
- valueProp = _a.value,
54
- onChange = _a.onChange,
55
- onFocus = _a.onFocus,
56
- onBlur = _a.onBlur,
57
46
  _a$clearableTrigger = _a.clearableTrigger,
58
47
  clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
59
48
  _a$clearable = _a.clearable,
60
49
  clearable = _a$clearable === void 0 ? false : _a$clearable,
61
- rest = __rest(_a, ["prefixCls", "role", "className", "style", "autoFocus", "disabled", "readOnly", "name", "maxLength", "type", "size", "appearance", "floatLabel", "placeholder", "prepend", "append", "prefix", "suffix", "defaultValue", "value", "onChange", "onFocus", "onBlur", "clearableTrigger", "clearable"]);
50
+ _a$invalid = _a.invalid,
51
+ invalid = _a$invalid === void 0 ? false : _a$invalid,
52
+ name = _a.name,
53
+ autoFocus = _a.autoFocus,
54
+ disabled = _a.disabled,
55
+ readOnly = _a.readOnly,
56
+ maxLength = _a.maxLength,
57
+ placeholder = _a.placeholder,
58
+ defaultValue = _a.defaultValue,
59
+ valueProp = _a.value,
60
+ onChange = _a.onChange,
61
+ onFocus = _a.onFocus,
62
+ onBlur = _a.onBlur,
63
+ trimValueOnBlur = _a.trimValueOnBlur,
64
+ onClear = _a.onClear,
65
+ type = _a.type,
66
+ containerRef = _a.containerRef,
67
+ rest = __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", "trimValueOnBlur", "onClear", "type", "containerRef"]); // @TODO: 临时方案,后面迁移至 InputGroup
68
+
69
+
70
+ var _useMemo = useMemo(function () {
71
+ var shouldUnset = [false, false]; // @ts-ignore
72
+ // @ts-ignore
73
+
74
+ if ( /*#__PURE__*/isValidElement(prepend) && ['Select', 'Button'].includes(prepend.type.HiName)) {
75
+ shouldUnset[0] = true;
76
+ } // @ts-ignore
77
+ // @ts-ignore
62
78
 
63
- var inputRef = useRef(null);
79
+
80
+ if ( /*#__PURE__*/isValidElement(append) && ['Select', 'Button'].includes(append.type.HiName)) {
81
+ shouldUnset[1] = true;
82
+ }
83
+
84
+ return shouldUnset;
85
+ }, [prepend, append]),
86
+ unsetPrepend = _useMemo[0],
87
+ unsetAppend = _useMemo[1];
88
+
89
+ var inputElementRef = useRef(null);
64
90
  var proxyOnChange = useCallback(function (value, evt) {
65
91
  if (!onChange) return;
66
- onChangeMock(onChange, evt, inputRef.current, value);
92
+ onChangeMock(onChange, evt, inputElementRef.current, value);
67
93
  }, [onChange]);
94
+ var clearElementRef = useRef(null);
95
+
96
+ var _useInput = useInput({
97
+ clearElementRef: clearElementRef,
98
+ name: name,
99
+ autoFocus: autoFocus,
100
+ disabled: disabled,
101
+ readOnly: readOnly,
102
+ maxLength: maxLength,
103
+ placeholder: placeholder,
104
+ defaultValue: defaultValue,
105
+ value: valueProp,
106
+ onChange: proxyOnChange,
107
+ onFocus: onFocus,
108
+ onBlur: onBlur,
109
+ trimValueOnBlur: trimValueOnBlur,
110
+ type: type
111
+ }),
112
+ tryChangeValue = _useInput.tryChangeValue,
113
+ focused = _useInput.focused,
114
+ value = _useInput.value,
115
+ getInputProps = _useInput.getInputProps;
68
116
 
69
- var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, proxyOnChange),
70
- value = _useUncontrolledState[0],
71
- tryChangeValue = _useUncontrolledState[1];
72
-
73
- var handleChange = useCallback(function (evt) {
74
- var nextValue = evt.target.value;
75
- tryChangeValue(nextValue, evt);
76
- }, [tryChangeValue]);
77
-
78
- var _useState = useState(autoFocus),
79
- focused = _useState[0],
80
- setFocused = _useState[1];
81
-
82
- var handleFocus = useCallback(function (evt) {
83
- setFocused(true);
84
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);
85
- }, [onFocus]);
86
- var handleBlur = useCallback(function (event) {
87
- setFocused(false);
88
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
89
- }, [onBlur]);
90
117
  var focus = useCallback(function () {
91
118
  var _a;
92
119
 
93
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
120
+ (_a = inputElementRef.current) === null || _a === void 0 ? void 0 : _a.focus();
94
121
  }, []);
95
- var handleReset = useCallback(function (evt) {
96
- tryChangeValue('', evt);
97
- focus();
98
- }, [tryChangeValue, focus]);
99
- var nativeInputProps = useMemo(function () {
100
- return {
101
- name: name,
102
- disabled: disabled,
103
- readOnly: readOnly,
104
- autoFocus: autoFocus,
105
- placeholder: placeholder,
106
- maxLength: maxLength
107
- };
108
- }, [disabled, readOnly, autoFocus, placeholder, maxLength, name]);
109
-
110
- var _useState2 = useState(false),
111
- hover = _useState2[0],
112
- setHover = _useState2[1]; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清楚
122
+
123
+ var _useState = useState(false),
124
+ hover = _useState[0],
125
+ setHover = _useState[1]; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清楚
113
126
 
114
127
 
115
128
  var showClearableIcon = clearable && !!value && !disabled;
116
- var cls = cx(className, prefixCls + "__outer", prepend && prefixCls + "__outer--prepend", append && prefixCls + "__outer--append", prefixCls + "--appearance-" + appearance, prefixCls + "--size-" + size);
129
+ var mergedRef = useMergeRefs(ref, inputElementRef);
130
+ var cls = cx(prefixCls, className, prefixCls + "--size-" + size, prefixCls + "--appearance-" + appearance);
131
+ var outerCls = cx(prefixCls + "__outer", prepend && prefixCls + "__outer--prepend", prepend && unsetPrepend && prefixCls + "__outer--prepend-unset", append && prefixCls + "__outer--append", append && unsetAppend && prefixCls + "__outer--append-unset");
117
132
  return /*#__PURE__*/React.createElement("div", {
118
133
  role: role,
119
134
  className: cls,
120
- style: style
135
+ style: style,
136
+ ref: containerRef
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: outerCls
121
139
  }, prepend ? /*#__PURE__*/React.createElement("div", {
122
140
  className: prefixCls + "__prepend"
123
141
  }, prepend) : null, /*#__PURE__*/React.createElement("div", {
124
- className: cx(prefixCls + "__inner", prefix && prefixCls + "__inner--prefix", suffix && prefixCls + "__inner--suffix", focused && "focused", disabled && 'disabled', readOnly && 'readonly'),
142
+ 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"),
125
143
  onMouseOver: function onMouseOver(e) {
126
144
  setHover(true);
127
145
  },
@@ -131,30 +149,30 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
131
149
  }, prefix ? /*#__PURE__*/React.createElement("span", {
132
150
  className: prefixCls + "__prefix"
133
151
  }, prefix) : null, /*#__PURE__*/React.createElement("input", Object.assign({
134
- ref: useMergeRefs(ref, inputRef),
135
- className: cx(prefixCls, focused && "focused", disabled && 'disabled', readOnly && 'readonly'),
136
- type: type,
137
- value: value,
138
- onChange: handleChange,
139
- onFocus: handleFocus,
140
- onBlur: handleBlur
141
- }, rest, nativeInputProps)), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
152
+ ref: mergedRef,
153
+ className: prefixCls + "__text"
154
+ }, getInputProps(), rest)), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
142
155
  className: prefixCls + "__suffix"
143
156
  }, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
144
- className: cx(prefixCls + "__clear", (clearableTrigger === 'always' || hover) && 'active'),
157
+ ref: clearElementRef,
158
+ className: cx(prefixCls + "__clear", (clearableTrigger === 'always' || hover) && prefixCls + "__clear--active"),
145
159
  role: "button",
146
160
  tabIndex: -1,
147
- onClick: handleReset
161
+ onClick: function onClick(evt) {
162
+ tryChangeValue('', evt);
163
+ onClear === null || onClear === void 0 ? void 0 : onClear();
164
+ focus();
165
+ }
148
166
  }, /*#__PURE__*/React.createElement(CloseCircleFilled, null)) : null, suffix) : null), append ? /*#__PURE__*/React.createElement("div", {
149
167
  className: prefixCls + "__append"
150
- }, append) : null);
168
+ }, append) : null));
151
169
  });
152
170
 
153
171
  if (__DEV__) {
154
172
  Input.displayName = 'Input';
155
173
  }
156
174
  /**
157
- * 伪造目标事件 target
175
+ * 模拟伪装目标事件 target
158
176
  *
159
177
  * @param target
160
178
  * @param evt
@@ -165,23 +183,22 @@ if (__DEV__) {
165
183
 
166
184
 
167
185
  function onChangeMock(onChange, evt, target, targetValue) {
168
- var event = evt; // 点击 clearIcon 时,代理 onChange 的事件对象 target 指向 input.target
186
+ var event = evt; // 点击 clearIcon 或者 失焦 trim 时,都会代理 onChange 的事件对象 target 指向 input.target
169
187
 
170
- if (evt.type === 'click') {
188
+ if (evt.type !== 'change') {
171
189
  if (!target) return;
172
190
  var originalTargetValue = target.value;
173
191
  event = Object.create(evt);
174
192
  event.target = target;
175
193
  event.currentTarget = target;
176
194
  target.value = targetValue;
177
- onChange(event); // 重置为之前值
195
+ onChange(event, targetValue); // 重置为之前值
178
196
 
179
197
  target.value = originalTargetValue;
180
198
  return;
181
199
  }
182
200
 
183
- onChange(event);
201
+ onChange(event, targetValue);
184
202
  }
185
203
 
186
204
  export { Input, onChangeMock };
187
- //# sourceMappingURL=Input.js.map
@@ -0,0 +1,131 @@
1
+ /** @LICENSE
2
+ * @hi-ui/input
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
4
+ *
5
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { __rest } from 'tslib';
11
+ import React, { forwardRef, useMemo, useCallback, useState } from 'react';
12
+ import { getPrefixCls, cx } from '@hi-ui/classname';
13
+ import { __DEV__ } from '@hi-ui/env';
14
+ import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
15
+ import { CloseCircleFilled } from '@hi-ui/icons';
16
+ var _role = 'mock-input';
17
+
18
+ var _prefix = getPrefixCls(_role);
19
+
20
+ var NOOP_VALUE = '';
21
+ var NOOP_ARRAY = [];
22
+ /**
23
+ * 支持自定义渲染输入框内容,暂时仅供内部 Picker 类组件使用,不对外提供
24
+ */
25
+
26
+ var MockInput = /*#__PURE__*/forwardRef(function (_a, ref) {
27
+ var _a$prefixCls = _a.prefixCls,
28
+ prefixCls = _a$prefixCls === void 0 ? _prefix : _a$prefixCls,
29
+ _a$role = _a.role,
30
+ role = _a$role === void 0 ? _role : _a$role,
31
+ className = _a.className,
32
+ _a$data = _a.data,
33
+ data = _a$data === void 0 ? NOOP_ARRAY : _a$data,
34
+ _a$defaultValue = _a.defaultValue,
35
+ defaultValue = _a$defaultValue === void 0 ? NOOP_VALUE : _a$defaultValue,
36
+ valueProp = _a.value,
37
+ onChange = _a.onChange,
38
+ placeholder = _a.placeholder,
39
+ _a$disabled = _a.disabled,
40
+ disabled = _a$disabled === void 0 ? false : _a$disabled,
41
+ _a$clearable = _a.clearable,
42
+ clearable = _a$clearable === void 0 ? false : _a$clearable,
43
+ _a$focused = _a.focused,
44
+ focused = _a$focused === void 0 ? false : _a$focused,
45
+ _a$invalid = _a.invalid,
46
+ invalid = _a$invalid === void 0 ? false : _a$invalid,
47
+ _a$readOnly = _a.readOnly,
48
+ readOnly = _a$readOnly === void 0 ? false : _a$readOnly,
49
+ _a$size = _a.size,
50
+ size = _a$size === void 0 ? 'md' : _a$size,
51
+ _a$appearance = _a.appearance,
52
+ appearance = _a$appearance === void 0 ? 'line' : _a$appearance,
53
+ _a$clearableTrigger = _a.clearableTrigger,
54
+ clearableTrigger = _a$clearableTrigger === void 0 ? 'hover' : _a$clearableTrigger,
55
+ displayRender = _a.displayRender,
56
+ suffix = _a.suffix,
57
+ _onMouseOver = _a.onMouseOver,
58
+ _onMouseLeave = _a.onMouseLeave,
59
+ rest = __rest(_a, ["prefixCls", "role", "className", "data", "defaultValue", "value", "onChange", "placeholder", "disabled", "clearable", "focused", "invalid", "readOnly", "size", "appearance", "clearableTrigger", "displayRender", "suffix", "onMouseOver", "onMouseLeave"]);
60
+
61
+ var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange),
62
+ value = _useUncontrolledState[0],
63
+ tryChangeValue = _useUncontrolledState[1];
64
+
65
+ var displayItem = useMemo(function () {
66
+ if (value === '') return null;
67
+ var displayItem = data.find(function (item) {
68
+ return item.id === value;
69
+ });
70
+ return displayItem || null;
71
+ }, [value, data]);
72
+ var displayValue = useMemo(function () {
73
+ if (!displayItem) return '';
74
+
75
+ if (displayRender) {
76
+ return displayRender(displayItem);
77
+ }
78
+
79
+ return displayItem.title;
80
+ }, [displayItem, displayRender]);
81
+ var handleClear = useCallback(function (evt) {
82
+ if (disabled) return;
83
+ evt.stopPropagation();
84
+ tryChangeValue(NOOP_VALUE, displayItem);
85
+ }, [tryChangeValue, disabled, displayItem]);
86
+
87
+ var _useState = useState(false),
88
+ hover = _useState[0],
89
+ setHover = _useState[1];
90
+
91
+ var trySetHover = useCallback(function (hovered) {
92
+ if (disabled) return;
93
+ setHover(hovered);
94
+ }, [disabled]);
95
+ var hasValue = !!displayValue; // 在开启 clearable 下展示 清除内容按钮,可点击进行内容清除
96
+
97
+ var showClearableIcon = useMemo(function () {
98
+ return clearable && hasValue && !disabled && (clearableTrigger === 'always' || hover);
99
+ }, [clearable, hasValue, disabled, clearableTrigger, hover]);
100
+ var cls = cx(prefixCls, className, prefixCls + "--appearance-" + appearance, prefixCls + "--size-" + size, focused && "focused", disabled && 'disabled', readOnly && 'readonly', invalid && 'invalid');
101
+ return /*#__PURE__*/React.createElement("div", Object.assign({
102
+ ref: ref,
103
+ role: role,
104
+ className: cls,
105
+ onMouseOver: function onMouseOver(evt) {
106
+ trySetHover(true);
107
+ _onMouseOver === null || _onMouseOver === void 0 ? void 0 : _onMouseOver(evt);
108
+ },
109
+ onMouseLeave: function onMouseLeave(evt) {
110
+ trySetHover(false);
111
+ _onMouseLeave === null || _onMouseLeave === void 0 ? void 0 : _onMouseLeave(evt);
112
+ }
113
+ }, rest), hasValue ? /*#__PURE__*/React.createElement("span", {
114
+ className: prefixCls + "__value"
115
+ }, displayValue) : /*#__PURE__*/React.createElement("span", {
116
+ className: prefixCls + "__placeholder"
117
+ }, placeholder), suffix || showClearableIcon ? /*#__PURE__*/React.createElement("span", {
118
+ className: prefixCls + "__suffix"
119
+ }, showClearableIcon ? /*#__PURE__*/React.createElement("span", {
120
+ role: "button",
121
+ tabIndex: -1,
122
+ className: cx(prefixCls + "__clear", 'active'),
123
+ onClick: handleClear
124
+ }, /*#__PURE__*/React.createElement(CloseCircleFilled, null)) : suffix) : null);
125
+ });
126
+
127
+ if (__DEV__) {
128
+ MockInput.displayName = 'MockInput';
129
+ }
130
+
131
+ export { MockInput };
package/lib/esm/index.js CHANGED
@@ -9,4 +9,5 @@
9
9
  */
10
10
  import './styles/index.scss.js';
11
11
  export { Input, Input as default, onChangeMock } from './Input.js';
12
- //# sourceMappingURL=index.js.map
12
+ export { useInput } from './use-input.js';
13
+ export { MockInput } from './MockInput.js';
@@ -7,11 +7,10 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- var css_248z = ".hi-v4-input {\n margin: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n height: inherit;\n background-color: transparent;\n cursor: text;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n display: inline-block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transition: all .3s;\n transition: all .3s;\n width: 100%;\n font-size: inherit;\n color: var(--color-black);\n line-height: 22px; }\n .hi-v4-input::-webkit-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::-moz-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::-ms-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input:-ms-input-placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input::placeholder {\n color: var(--color-gray-50); }\n .hi-v4-input:disabled {\n cursor: not-allowed; }\n .hi-v4-input__inner {\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n height: auto;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: inherit;\n border: 1px solid transparent;\n background-color: var(--color-white);\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n outline: 2px solid transparent; }\n .hi-v4-input__inner:not(.disabled):hover {\n z-index: 1; }\n .hi-v4-input__inner:not(.disabled).focused {\n z-index: 1; }\n .hi-v4-input__outer {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n margin: 0;\n padding: 0;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n height: auto;\n width: 100%; }\n .hi-v4-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: auto;\n font-size: 14px;\n text-align: center;\n color: var(--color-gray-50);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n visibility: hidden;\n opacity: 0; }\n .hi-v4-input__clear:hover {\n color: var(--color-black); }\n .hi-v4-input__clear.active {\n visibility: visible;\n opacity: 1; }\n .hi-v4-input__inner--suffix .hi-v4-input__clear {\n margin-right: 4px; }\n .hi-v4-input__prefix, .hi-v4-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--color-black);\n font-size: inherit;\n text-align: center; }\n .hi-v4-input__prefix {\n padding-left: 11px; }\n .hi-v4-input__suffix {\n padding-right: 11px; }\n .hi-v4-input__prepend, .hi-v4-input__append {\n position: relative;\n color: var(--color-black);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n font-size: inherit;\n text-align: center;\n -webkit-transition: all .3s;\n transition: all .3s;\n padding: 0 11px;\n border: 1px solid transparent;\n white-space: nowrap; }\n .hi-v4-input__prepend, .hi-v4-input__append {\n background-color: #f8f8f8; }\n .hi-v4-input__prepend {\n border-right-width: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .hi-v4-input__append {\n border-left-width: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n .hi-v4-input--size-sm {\n font-size: 14px; }\n .hi-v4-input--size-sm .hi-v4-input {\n padding: 4px 11px; }\n .hi-v4-input--size-sm .hi-v4-input__inner {\n border-radius: 4px; }\n .hi-v4-input--size-sm .hi-v4-input__prepend {\n border-top-left-radius: 2px;\n border-bottom-left-radius: 2px; }\n .hi-v4-input--size-sm .hi-v4-input__append {\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px; }\n .hi-v4-input--size-md {\n font-size: 16px; }\n .hi-v4-input--size-md .hi-v4-input {\n padding: 8px 11px; }\n .hi-v4-input--size-md .hi-v4-input__inner {\n border-radius: 6px; }\n .hi-v4-input--size-md .hi-v4-input__prepend {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px; }\n .hi-v4-input--size-md .hi-v4-input__append {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px; }\n .hi-v4-input--size-lg {\n font-size: 18px; }\n .hi-v4-input--size-lg .hi-v4-input {\n padding: 12px 11px; }\n .hi-v4-input--size-lg .hi-v4-input__inner {\n border-radius: 8px; }\n .hi-v4-input--size-lg .hi-v4-input__prepend {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px; }\n .hi-v4-input--size-lg .hi-v4-input__append {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px; }\n .hi-v4-input--appearance-outline .hi-v4-input__inner {\n border-color: var(--color-gray-30); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner:not(.disabled):hover {\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-outline .hi-v4-input__inner.disabled {\n color: var(--color-gray-50);\n background-color: var(--color-gray-10); }\n .hi-v4-input--appearance-outline .hi-v4-input__prepend,\n .hi-v4-input--appearance-outline .hi-v4-input__append {\n border-color: var(--color-gray-30); }\n .hi-v4-input--appearance-unset .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n .hi-v4-input--appearance-unset.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: 11px; }\n .hi-v4-input--appearance-unset.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: 11px; }\n .hi-v4-input--appearance-unset .hi-v4-input__inner {\n border-radius: 0; }\n .hi-v4-input--appearance-filled .hi-v4-input__inner {\n background-color: #f8f8f8; }\n .hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled):hover {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary); }\n .hi-v4-input--appearance-filled .hi-v4-input__inner:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary);\n background-color: var(--color-white); }\n .hi-v4-input--appearance-underline .hi-v4-input {\n padding-left: 0;\n padding-right: 0; }\n .hi-v4-input--appearance-underline.hi-v4-input__outer--prepend .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--prefix .hi-v4-input {\n padding-left: 11px; }\n .hi-v4-input--appearance-underline.hi-v4-input__outer--append .hi-v4-input,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--suffix .hi-v4-input {\n padding-right: 11px; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner {\n border-radius: 0; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid var(--color-gray-30);\n -webkit-transition: all .3s;\n transition: all .3s; }\n .hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled):hover::after {\n border-bottom-color: var(--color-primary); }\n .hi-v4-input--appearance-underline .hi-v4-input__inner:not(.disabled).focused::after {\n border-bottom-color: var(--color-primary);\n -webkit-box-shadow: 0 1px 0 0 var(--color-primary);\n box-shadow: 0 1px 0 0 var(--color-primary); }\n .hi-v4-input__outer--prepend .hi-v4-input__inner {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n .hi-v4-input__outer--append .hi-v4-input__inner {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n";
10
+ var css_248z = "@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-mock-input {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n overflow: hidden;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n height: auto;\n z-index: auto;\n font-size: inherit;\n line-height: inherit;\n color: var(--hi-v4-color-gray-700, #1f2733);\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input:not(.disabled):hover {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input:not(.disabled).focused {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input.disabled {\n cursor: not-allowed; }\n.hi-v4-mock-input__suffix, .hi-v4-mock-input__placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 16px;\n height: 16px;\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n text-align: center;\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n visibility: hidden;\n opacity: 0;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)); }\n.hi-v4-mock-input__clear:hover {\n color: var(--hi-v4-color-static-black, #000); }\n.hi-v4-mock-input__clear.active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-mock-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--hi-v4-color-gray-400, #c9ced6);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n padding-left: var(--hi-v4-spacing-4, 8px);\n text-align: center; }\n.hi-v4-mock-input__value {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: inline-block;\n width: auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; }\n.hi-v4-mock-input--size-sm.hi-v4-mock-input {\n height: var(--hi-v4-height-6, 24px);\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-md.hi-v4-mock-input {\n height: var(--hi-v4-height-8, 32px);\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-md, 1.375rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-lg.hi-v4-mock-input {\n height: var(--hi-v4-height-10, 40px);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: var(--hi-v4-text-lineheight-lg, 1.5rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled):hover {\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input {\n width: auto;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n border-color: transparent; }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled):hover {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled):hover {\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-line.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-unset.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-filled.disabled.hi-v4-mock-input {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input--appearance-line.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-filled.disabled.hi-v4-mock-input {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-input {\n position: relative;\n display: inline-block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%; }\n.hi-v4-input__outer {\n margin: 0;\n padding: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n height: 100%;\n width: 100%; }\n.hi-v4-input__text {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n display: inline-block;\n box-sizing: border-box;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n font-size: inherit;\n line-height: inherit;\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input__text::-webkit-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::-moz-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::-ms-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text:-ms-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text:disabled {\n cursor: not-allowed; }\n.hi-v4-input__inner {\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n height: auto;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: inherit;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: var(--hi-v4-color-static-white, #fff);\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n outline: none;\n z-index: auto; }\n.hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: auto;\n text-align: center;\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n visibility: hidden;\n opacity: 0; }\n.hi-v4-input__clear:hover {\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input__clear.hi-v4-input__clear--active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-input__inner--suffix .hi-v4-input__clear {\n -webkit-margin-end: var(--hi-v4-spacing-2, 4px);\n margin-inline-end: var(--hi-v4-spacing-2, 4px); }\n.hi-v4-input__prefix, .hi-v4-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--hi-v4-color-gray-700, #1f2733);\n font-size: inherit;\n text-align: center; }\n.hi-v4-input__prefix {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__suffix {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__prepend, .hi-v4-input__append {\n position: relative;\n color: var(--hi-v4-color-gray-700, #1f2733);\n background-color: var(--hi-v4-color-gray-50, #f5f7fa);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n font-size: inherit;\n text-align: center;\n padding: 0 calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n white-space: nowrap;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n z-index: var(--hi-v4-zindex-absolute, 1); }\n.hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n margin-right: -1px; }\n.hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin-left: -1px; }\n.hi-v4-input--size-sm {\n height: var(--hi-v4-height-6, 24px);\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: var(--hi-v4-text-lineheight-sm, 1.25rem); }\n.hi-v4-input--size-sm .hi-v4-input__text {\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-sm .hi-v4-input__inner,\n .hi-v4-input--size-sm .hi-v4-input__prepend,\n .hi-v4-input--size-sm .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-sm .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-sm .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-md {\n height: var(--hi-v4-height-8, 32px);\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-md, 1.375rem); }\n.hi-v4-input--size-md .hi-v4-input__text {\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-md .hi-v4-input__inner,\n .hi-v4-input--size-md .hi-v4-input__prepend,\n .hi-v4-input--size-md .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-md .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-md .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-lg {\n height: var(--hi-v4-height-10, 40px);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: var(--hi-v4-text-lineheight-lg, 1.5rem); }\n.hi-v4-input--size-lg .hi-v4-input__text {\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-lg .hi-v4-input__inner,\n .hi-v4-input--size-lg .hi-v4-input__prepend,\n .hi-v4-input--size-lg .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-lg .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-lg .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--appearance-line .hi-v4-input__inner {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid:hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-input--appearance-line .hi-v4-input__prepend,\n .hi-v4-input--appearance-line .hi-v4-input__append {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-unset .hi-v4-input__text {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--prepend .hi-v4-input__text,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--prefix .hi-v4-input__text {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--append .hi-v4-input__text,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--suffix .hi-v4-input__text {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-filled .hi-v4-input__inner {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid:hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-input--appearance-underline .hi-v4-input__text {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--prepend .hi-v4-input__text,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--prefix .hi-v4-input__text {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--append .hi-v4-input__text,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--suffix .hi-v4-input__text {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid var(--hi-v4-color-gray-300, #dfe2e8);\n -webkit-transition: all 0.3s;\n transition: all 0.3s; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover::after {\n border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused::after {\n border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid::after {\n border-bottom-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hover::after {\n border-bottom-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner.hi-v4-input__inner--disabled, .hi-v4-input--appearance-filled .hi-v4-input__inner.hi-v4-input__inner--disabled {\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: var(--hi-v4-color-gray-200, #ebedf0); }\n.hi-v4-input--appearance-line .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text, .hi-v4-input--appearance-filled .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input--appearance-unset .hi-v4-input__inner.hi-v4-input__inner--disabled, .hi-v4-input--appearance-underline .hi-v4-input__inner.hi-v4-input__inner--disabled {\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: transparent; }\n.hi-v4-input--appearance-unset .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text, .hi-v4-input--appearance-underline .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__outer--prepend .hi-v4-input__inner {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-mock-input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-button {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append .hi-v4-input__inner {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-mock-input {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-button {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n";
11
11
 
12
12
  var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
13
13
 
14
14
  __styleInject__(css_248z);
15
15
 
16
- export default css_248z;
17
- //# sourceMappingURL=index.scss.js.map
16
+ export { css_248z as default };
@@ -0,0 +1,118 @@
1
+ /** @LICENSE
2
+ * @hi-ui/input
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
4
+ *
5
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { useCallback, useState, useMemo } from 'react';
11
+ import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
12
+ import { useLatestCallback } from '@hi-ui/use-latest';
13
+ import { setAttrStatus } from '@hi-ui/dom-utils';
14
+ import { pure, format, formatAmount } from './utils/index.js';
15
+
16
+ var useInput = function useInput(_ref) {
17
+ var name = _ref.name,
18
+ _ref$autoFocus = _ref.autoFocus,
19
+ autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
20
+ _ref$disabled = _ref.disabled,
21
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
22
+ _ref$readOnly = _ref.readOnly,
23
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
24
+ maxLength = _ref.maxLength,
25
+ placeholder = _ref.placeholder,
26
+ _ref$defaultValue = _ref.defaultValue,
27
+ defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
28
+ valueProp = _ref.value,
29
+ onChange = _ref.onChange,
30
+ onFocus = _ref.onFocus,
31
+ onBlur = _ref.onBlur,
32
+ _ref$trimValueOnBlur = _ref.trimValueOnBlur,
33
+ trimValueOnBlur = _ref$trimValueOnBlur === void 0 ? false : _ref$trimValueOnBlur,
34
+ _ref$type = _ref.type,
35
+ type = _ref$type === void 0 ? 'text' : _ref$type,
36
+ clearElementRef = _ref.clearElementRef; // Object.is 避免 trimValueOnBlur 和 点击 clearIcon 触发 2 次相同的 onCHange
37
+
38
+ var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange, Object.is),
39
+ value = _useUncontrolledState[0],
40
+ tryChangeValue = _useUncontrolledState[1];
41
+
42
+ var handleChange = useCallback(function (evt, trim) {
43
+ if (trim === void 0) {
44
+ trim = false;
45
+ }
46
+
47
+ evt.persist();
48
+ var nextValue = evt.target.value;
49
+ var valueTrue = pure(nextValue, type); // 防溢出,保证 onChange 拿到的是值是最新的 formatted value
50
+
51
+ var value = format(nextValue, type);
52
+
53
+ if (trim) {
54
+ valueTrue = valueTrue.trim();
55
+ value = value.trim();
56
+ }
57
+
58
+ var event = Object.create(evt);
59
+ event.target = Object.assign(Object.assign({}, evt.target), {
60
+ value: value
61
+ });
62
+ tryChangeValue(valueTrue, event);
63
+ }, [tryChangeValue, type]);
64
+
65
+ var _useState = useState(autoFocus),
66
+ focused = _useState[0],
67
+ setFocused = _useState[1];
68
+
69
+ var handleFocus = useLatestCallback(function (evt) {
70
+ setFocused(true);
71
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);
72
+ });
73
+ var handleBlur = useLatestCallback(function (event) {
74
+ var relatedTarget = event.relatedTarget; // 拦截 clearIcon 点击清空,阻止其触发 input 失焦
75
+
76
+ if (clearElementRef && clearElementRef.current && clearElementRef.current === relatedTarget) {
77
+ return;
78
+ }
79
+
80
+ setFocused(false); // amount 自动添加小数
81
+
82
+ if (type === 'amount') {
83
+ event.target.value = formatAmount(value, true);
84
+ handleChange(event, trimValueOnBlur);
85
+ } else if (trimValueOnBlur) {
86
+ handleChange(event, true);
87
+ }
88
+
89
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
90
+ });
91
+ var nativeInputProps = useMemo(function () {
92
+ return {
93
+ name: name,
94
+ disabled: disabled,
95
+ readOnly: readOnly,
96
+ autoFocus: autoFocus,
97
+ placeholder: placeholder,
98
+ maxLength: maxLength,
99
+ 'data-focused': setAttrStatus(focused)
100
+ };
101
+ }, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
102
+ var getInputProps = useCallback(function () {
103
+ return Object.assign(Object.assign({}, nativeInputProps), {
104
+ value: format(value, type),
105
+ onChange: handleChange,
106
+ onFocus: handleFocus,
107
+ onBlur: handleBlur
108
+ });
109
+ }, [value, type, handleChange, handleFocus, handleBlur, nativeInputProps]);
110
+ return {
111
+ focused: focused,
112
+ value: value,
113
+ tryChangeValue: tryChangeValue,
114
+ getInputProps: getInputProps
115
+ };
116
+ };
117
+
118
+ export { useInput };