@nutui/nutui-react-taro 3.0.11-patch.0 → 3.0.12

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  3. package/dist/cjs/packages/progress/progress.js +69 -33
  4. package/dist/cjs/packages/progress/style/progress.scss +5 -21
  5. package/dist/cjs/packages/progress/style/style.css +5 -19
  6. package/dist/cjs/packages/progress/style/style.harmony.css +5 -19
  7. package/dist/cjs/packages/progress/style-jmapp/progress.scss +5 -21
  8. package/dist/cjs/packages/progress/style-jmapp/style.css +4 -18
  9. package/dist/cjs/packages/progress/style-jrkf/progress.scss +5 -21
  10. package/dist/cjs/packages/progress/style-jrkf/style.css +4 -18
  11. package/dist/cjs/packages/range/range.js +163 -175
  12. package/dist/cjs/packages/range/style/range.scss +6 -2
  13. package/dist/cjs/packages/range/style/style.css +3 -1
  14. package/dist/cjs/packages/range/style/style.harmony.css +3 -1
  15. package/dist/cjs/packages/range/style-jmapp/range.scss +6 -2
  16. package/dist/cjs/packages/range/style-jmapp/style.css +3 -1
  17. package/dist/cjs/packages/range/style-jrkf/range.scss +6 -2
  18. package/dist/cjs/packages/range/style-jrkf/style.css +3 -1
  19. package/dist/cjs/packages/range/utils.d.ts +3 -0
  20. package/dist/cjs/packages/searchbar/searchbar.js +181 -77
  21. package/dist/cjs/packages/searchbar/style/searchbar.scss +99 -25
  22. package/dist/cjs/packages/searchbar/style/style.css +102 -38
  23. package/dist/cjs/packages/searchbar/style/style.harmony.css +127 -68
  24. package/dist/cjs/packages/searchbar/style-jmapp/searchbar.scss +99 -25
  25. package/dist/cjs/packages/searchbar/style-jmapp/style.css +85 -21
  26. package/dist/cjs/packages/searchbar/style-jrkf/searchbar.scss +99 -25
  27. package/dist/cjs/packages/searchbar/style-jrkf/style.css +85 -21
  28. package/dist/cjs/packages/step/step.d.ts +2 -2
  29. package/dist/cjs/packages/step/step.js +80 -45
  30. package/dist/cjs/packages/step/style/step.scss +104 -195
  31. package/dist/cjs/packages/step/style/style.css +85 -159
  32. package/dist/cjs/packages/step/style/style.harmony.css +103 -159
  33. package/dist/cjs/packages/step/style-jmapp/step.scss +104 -195
  34. package/dist/cjs/packages/step/style-jmapp/style.css +88 -162
  35. package/dist/cjs/packages/step/style-jrkf/step.scss +104 -195
  36. package/dist/cjs/packages/step/style-jrkf/style.css +88 -162
  37. package/dist/cjs/packages/steps/steps.js +23 -8
  38. package/dist/cjs/packages/steps/style/steps.scss +328 -4
  39. package/dist/cjs/packages/steps/style/style.css +219 -2
  40. package/dist/cjs/packages/steps/style/style.harmony.css +256 -2
  41. package/dist/cjs/packages/steps/style-jmapp/steps.scss +328 -4
  42. package/dist/cjs/packages/steps/style-jmapp/style.css +219 -2
  43. package/dist/cjs/packages/steps/style-jrkf/steps.scss +328 -4
  44. package/dist/cjs/packages/steps/style-jrkf/style.css +219 -2
  45. package/dist/cjs/packages/uploader/uploader.js +21 -27
  46. package/dist/cjs/types/spec/progress/base.d.ts +6 -0
  47. package/dist/cjs/types/spec/progress/taro.d.ts +4 -0
  48. package/dist/cjs/types/spec/searchbar/base.d.ts +3 -0
  49. package/dist/cjs/types/spec/steps/base.d.ts +11 -2
  50. package/dist/es/packages/configprovider/types.d.ts +1 -1
  51. package/dist/es/packages/progress/progress.js +70 -34
  52. package/dist/es/packages/progress/style/progress.scss +5 -21
  53. package/dist/es/packages/progress/style/style.css +5 -19
  54. package/dist/es/packages/progress/style/style.harmony.css +5 -19
  55. package/dist/es/packages/progress/style-jmapp/progress.scss +5 -21
  56. package/dist/es/packages/progress/style-jmapp/style.css +4 -18
  57. package/dist/es/packages/progress/style-jrkf/progress.scss +5 -21
  58. package/dist/es/packages/progress/style-jrkf/style.css +4 -18
  59. package/dist/es/packages/range/range.js +163 -175
  60. package/dist/es/packages/range/style/range.scss +6 -2
  61. package/dist/es/packages/range/style/style.css +3 -1
  62. package/dist/es/packages/range/style/style.harmony.css +3 -1
  63. package/dist/es/packages/range/style-jmapp/range.scss +6 -2
  64. package/dist/es/packages/range/style-jmapp/style.css +3 -1
  65. package/dist/es/packages/range/style-jrkf/range.scss +6 -2
  66. package/dist/es/packages/range/style-jrkf/style.css +3 -1
  67. package/dist/es/packages/range/utils.d.ts +3 -0
  68. package/dist/es/packages/searchbar/searchbar.js +183 -79
  69. package/dist/es/packages/searchbar/style/searchbar.scss +99 -25
  70. package/dist/es/packages/searchbar/style/style.css +102 -38
  71. package/dist/es/packages/searchbar/style/style.harmony.css +127 -68
  72. package/dist/es/packages/searchbar/style-jmapp/searchbar.scss +99 -25
  73. package/dist/es/packages/searchbar/style-jmapp/style.css +85 -21
  74. package/dist/es/packages/searchbar/style-jrkf/searchbar.scss +99 -25
  75. package/dist/es/packages/searchbar/style-jrkf/style.css +85 -21
  76. package/dist/es/packages/step/step.d.ts +2 -2
  77. package/dist/es/packages/step/step.js +81 -46
  78. package/dist/es/packages/step/style/step.scss +104 -195
  79. package/dist/es/packages/step/style/style.css +85 -159
  80. package/dist/es/packages/step/style/style.harmony.css +103 -159
  81. package/dist/es/packages/step/style-jmapp/step.scss +104 -195
  82. package/dist/es/packages/step/style-jmapp/style.css +88 -162
  83. package/dist/es/packages/step/style-jrkf/step.scss +104 -195
  84. package/dist/es/packages/step/style-jrkf/style.css +88 -162
  85. package/dist/es/packages/steps/steps.js +23 -8
  86. package/dist/es/packages/steps/style/steps.scss +328 -4
  87. package/dist/es/packages/steps/style/style.css +219 -2
  88. package/dist/es/packages/steps/style/style.harmony.css +256 -2
  89. package/dist/es/packages/steps/style-jmapp/steps.scss +328 -4
  90. package/dist/es/packages/steps/style-jmapp/style.css +219 -2
  91. package/dist/es/packages/steps/style-jrkf/steps.scss +328 -4
  92. package/dist/es/packages/steps/style-jrkf/style.css +219 -2
  93. package/dist/es/packages/uploader/uploader.js +21 -27
  94. package/dist/es/types/spec/progress/base.d.ts +24 -0
  95. package/dist/es/types/spec/progress/taro.d.ts +4 -0
  96. package/dist/es/types/spec/searchbar/base.d.ts +10 -1
  97. package/dist/es/types/spec/steps/base.d.ts +26 -5
  98. package/dist/nutui.react.umd.js +530 -391
  99. package/dist/style-jmapp.css +1 -1
  100. package/dist/style-jmapp.scss +42 -42
  101. package/dist/style-jrkf.css +1 -1
  102. package/dist/style-jrkf.scss +41 -41
  103. package/dist/style.css +1 -1
  104. package/dist/style.scss +37 -37
  105. package/dist/styles/variables-jmapp.scss +133 -79
  106. package/dist/styles/variables-jrkf.scss +134 -80
  107. package/dist/styles/variables.scss +148 -89
  108. package/package.json +1 -1
@@ -45,6 +45,8 @@
45
45
  max-height: 100%;
46
46
  background: var(--nutui-range-active-color, var(--nutui-color-primary));
47
47
  border-radius: 2px;
48
+ }
49
+ .nut-range-bar-animate {
48
50
  transition: all 0.2s;
49
51
  }
50
52
  .nut-range-button {
@@ -173,7 +175,7 @@
173
175
  position: absolute;
174
176
  width: 36px;
175
177
  height: 100%;
176
- top: initial;
178
+ top: 0px;
177
179
  right: 50%;
178
180
  overflow: visible;
179
181
  font-size: 12px;
@@ -46,7 +46,10 @@
46
46
  max-height: 100%;
47
47
  background: $range-active-color;
48
48
  border-radius: 2px;
49
- transition: all 0.2s;
49
+
50
+ &-animate {
51
+ transition: all 0.2s;
52
+ }
50
53
  }
51
54
 
52
55
  &-button {
@@ -204,7 +207,8 @@
204
207
  position: absolute;
205
208
  width: 36px;
206
209
  height: 100%;
207
- top: initial;
210
+ // top: initial;
211
+ top: 0px;
208
212
  right: 50%;
209
213
  overflow: visible;
210
214
  font-size: 12px;
@@ -45,6 +45,8 @@
45
45
  max-height: 100%;
46
46
  background: var(--nutui-range-active-color, var(--nutui-color-primary, #ff6666));
47
47
  border-radius: 2px;
48
+ }
49
+ .nut-range-bar-animate {
48
50
  transition: all 0.2s;
49
51
  }
50
52
  .nut-range-button {
@@ -173,7 +175,7 @@
173
175
  position: absolute;
174
176
  width: 36px;
175
177
  height: 100%;
176
- top: initial;
178
+ top: 0px;
177
179
  right: 50%;
178
180
  overflow: visible;
179
181
  font-size: 12px;
@@ -0,0 +1,3 @@
1
+ import { RangeValue } from "../../types";
2
+ export declare const isSameValue: (newValue: RangeValue, oldValue: RangeValue) => boolean;
3
+ export declare const handleOverlap: (value: number[]) => number[];
@@ -1,12 +1,15 @@
1
+ import { _ as _define_property } from "@swc/helpers/_/_define_property";
1
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
5
  import Taro from "@tarojs/taro";
5
- import React, { useEffect, useRef, useState } from "react";
6
+ import React, { useCallback, useEffect, useRef, useState, useMemo } from "react";
6
7
  import { Input as TaroInput, View } from "@tarojs/components";
7
- import { ArrowLeft, MaskClose, Search } from "@nutui/icons-react-taro";
8
+ import { ArrowLeft, Close, MaskClose, Search } from "@nutui/icons-react-taro";
9
+ import classNames from "classnames";
8
10
  import { useConfig } from "../configprovider/index";
9
11
  import { ComponentDefaults } from "../../utils/typings";
12
+ import { usePropsValue } from "../../hooks/use-props-value";
10
13
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
11
14
  placeholder: '',
12
15
  shape: 'square',
@@ -19,127 +22,228 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
19
22
  left: '',
20
23
  right: '',
21
24
  rightIn: '',
22
- leftIn: /*#__PURE__*/ React.createElement(Search, {
23
- size: "16"
24
- })
25
+ leftIn: /*#__PURE__*/ React.createElement(Search, null),
26
+ tag: false
25
27
  });
26
28
  export var SearchBar = function(props) {
27
29
  var classPrefix = 'nut-searchbar';
28
30
  var locale = useConfig().locale;
29
- var searchRef = useRef(null);
30
- var _$_object_spread = _object_spread({}, defaultProps, props), outerValue = _$_object_spread.value, style = _$_object_spread.style, placeholder = _$_object_spread.placeholder, shape = _$_object_spread.shape, className = _$_object_spread.className, disabled = _$_object_spread.disabled, maxLength = _$_object_spread.maxLength, clearable = _$_object_spread.clearable, readOnly = _$_object_spread.readOnly, autoFocus = _$_object_spread.autoFocus, backable = _$_object_spread.backable, right = _$_object_spread.right, left = _$_object_spread.left, leftIn = _$_object_spread.leftIn, rightIn = _$_object_spread.rightIn, onChange = _$_object_spread.onChange, onFocus = _$_object_spread.onFocus, onBlur = _$_object_spread.onBlur, onClear = _$_object_spread.onClear, onSearch = _$_object_spread.onSearch, onInputClick = _$_object_spread.onInputClick;
31
- var _useState = _sliced_to_array(useState(function() {
32
- return outerValue;
33
- }), 2), value = _useState[0], setValue = _useState[1];
34
- var forceFocus = function() {
35
- var searchSelf = searchRef.current;
36
- searchSelf && searchSelf.focus();
37
- };
38
- var onInput = function(event) {
31
+ var searchInputRef = useRef(null);
32
+ var _$_object_spread = _object_spread({}, defaultProps, props), outerValue = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, style = _$_object_spread.style, placeholder = _$_object_spread.placeholder, shape = _$_object_spread.shape, className = _$_object_spread.className, disabled = _$_object_spread.disabled, maxLength = _$_object_spread.maxLength, clearable = _$_object_spread.clearable, readOnly = _$_object_spread.readOnly, autoFocus = _$_object_spread.autoFocus, backable = _$_object_spread.backable, right = _$_object_spread.right, left = _$_object_spread.left, leftIn = _$_object_spread.leftIn, rightIn = _$_object_spread.rightIn, tag = _$_object_spread.tag, onChange = _$_object_spread.onChange, onFocus = _$_object_spread.onFocus, onBlur = _$_object_spread.onBlur, onClear = _$_object_spread.onClear, onSearch = _$_object_spread.onSearch, onInputClick = _$_object_spread.onInputClick, onItemClick = _$_object_spread.onItemClick;
33
+ var _usePropsValue = _sliced_to_array(usePropsValue({
34
+ value: outerValue,
35
+ defaultValue: defaultValue,
36
+ finalValue: ''
37
+ }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
38
+ var _useState = _sliced_to_array(useState(tag), 2), innerTag = _useState[0], setInnerTag = _useState[1];
39
+ var forceFocus = useCallback(function() {
40
+ var _searchInputRef_current;
41
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.focus();
42
+ }, []);
43
+ var handleInput = useCallback(function(event) {
39
44
  var _event_detail;
40
- var eventValue = event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
45
+ var eventValue = (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
41
46
  if (value === eventValue) return;
42
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(eventValue, event));
47
+ onChange && onChange(eventValue, event);
43
48
  setValue(eventValue);
44
49
  eventValue === '' && forceFocus();
45
- };
46
- var focus = function(event) {
47
- var _event_detail;
48
- onFocus && onFocus(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
49
- };
50
- var blur = function(event) {
50
+ }, [
51
+ onChange,
52
+ setValue,
53
+ forceFocus,
54
+ value
55
+ ]);
56
+ var handleFocus = useCallback(function(event) {
51
57
  var _event_detail;
52
- var searchSelf = searchRef.current;
53
- searchSelf && searchSelf.blur();
54
- onBlur && onBlur(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
55
- };
58
+ onFocus && onFocus((_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
59
+ if (tag) setInnerTag(false);
60
+ }, [
61
+ onFocus
62
+ ]);
63
+ var _useState1 = _sliced_to_array(useState(null), 2), blurTimer = _useState1[0], setBlurTimer = _useState1[1];
64
+ var handleBlur = useCallback(function(event) {
65
+ var _searchInputRef_current, _event_detail;
66
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.blur();
67
+ onBlur && onBlur((_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
68
+ if (tag) {
69
+ var timer = setTimeout(function() {
70
+ if (Taro.getEnv() === 'WEB') {
71
+ var _event_target;
72
+ setInnerTag(((_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.value) ? tag : false);
73
+ } else {
74
+ setInnerTag(tag);
75
+ }
76
+ }, 200);
77
+ setBlurTimer(timer);
78
+ }
79
+ }, [
80
+ onBlur,
81
+ tag,
82
+ value
83
+ ]);
56
84
  useEffect(function() {
57
- setValue(outerValue || '');
85
+ return function() {
86
+ if (blurTimer) clearTimeout(blurTimer);
87
+ };
58
88
  }, [
59
- outerValue
89
+ blurTimer
90
+ ]);
91
+ var clearaVal = useCallback(function(event) {
92
+ if (disabled || readOnly) return;
93
+ setValue('');
94
+ forceFocus();
95
+ onChange && onChange('');
96
+ onClear && onClear(event);
97
+ }, [
98
+ disabled,
99
+ readOnly,
100
+ onChange,
101
+ onClear,
102
+ setValue
103
+ ]);
104
+ var cls = useMemo(function() {
105
+ var _obj;
106
+ return classNames(classPrefix, (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix, "-focus"), left || backable), _obj), className);
107
+ }, [
108
+ disabled,
109
+ backable,
110
+ left,
111
+ className
60
112
  ]);
61
113
  useEffect(function() {
62
- if (Taro.getEnv() === 'WEB') {
63
- autoFocus && forceFocus();
114
+ if (autoFocus) {
115
+ forceFocus();
116
+ }
117
+ if (tag && !innerTag) {
118
+ forceFocus();
64
119
  }
65
120
  }, [
66
- autoFocus
121
+ autoFocus,
122
+ forceFocus,
123
+ innerTag
67
124
  ]);
68
125
  var renderField = function() {
69
- return /*#__PURE__*/ React.createElement(TaroInput, {
70
- className: "".concat(classPrefix, "-input ").concat(clearable ? "".concat(classPrefix, "-input-clear") : ''),
71
- ref: searchRef,
72
- style: style,
73
- value: (value || '').toString(),
126
+ var inputCls = classNames("".concat(classPrefix, "-input"));
127
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, Taro.getEnv() === 'WEB' ? /*#__PURE__*/ React.createElement(TaroInput, {
128
+ className: inputCls,
129
+ ref: searchInputRef,
130
+ style: _object_spread({}, style, {
131
+ color: "".concat(innerTag ? 'transparent' : '#333')
132
+ }),
133
+ value: value,
74
134
  placeholder: placeholder || locale.placeholder,
75
135
  disabled: disabled || readOnly,
76
136
  maxlength: maxLength,
77
137
  autoFocus: autoFocus,
78
- onInput: onInput,
79
- onFocus: focus,
80
- onBlur: blur,
81
- onClick: clickInput,
138
+ onInput: handleInput,
139
+ onFocus: handleFocus,
140
+ onBlur: handleBlur,
141
+ onClick: onInputClick,
82
142
  onConfirm: onConfirm
83
- });
84
- };
85
- var clickInput = function(e) {
86
- onInputClick && onInputClick(e);
143
+ }) : /*#__PURE__*/ React.createElement(TaroInput, {
144
+ className: inputCls,
145
+ ref: searchInputRef,
146
+ style: _object_spread({}, style, {
147
+ color: "".concat(innerTag ? 'transparent' : '#333')
148
+ }),
149
+ value: value,
150
+ placeholder: placeholder || locale.placeholder,
151
+ disabled: disabled || readOnly,
152
+ maxlength: maxLength,
153
+ focus: autoFocus,
154
+ onInput: handleInput,
155
+ onFocus: handleFocus,
156
+ onBlur: handleBlur,
157
+ onClick: onInputClick,
158
+ onConfirm: onConfirm
159
+ }));
87
160
  };
88
- var renderLeftIn = function() {
161
+ var renderValueByTags = useCallback(function() {
162
+ if (!innerTag) return null;
163
+ if (!value) {
164
+ setTimeout(function() {
165
+ forceFocus();
166
+ }, 0);
167
+ return null;
168
+ }
169
+ var list = value.split(',');
170
+ if (!list) return null;
171
+ return /*#__PURE__*/ React.createElement(View, {
172
+ className: "nut-searchbar-values"
173
+ }, list.map(function(item, index) {
174
+ return /*#__PURE__*/ React.createElement(View, {
175
+ key: "def-".concat(index),
176
+ className: "nut-searchbar-value",
177
+ onClick: function(e) {
178
+ return onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, e);
179
+ }
180
+ }, item, /*#__PURE__*/ React.createElement(Close, null));
181
+ }));
182
+ }, [
183
+ value,
184
+ onItemClick,
185
+ innerTag
186
+ ]);
187
+ var renderLeftIn = useCallback(function() {
89
188
  if (!leftIn) return null;
90
189
  return /*#__PURE__*/ React.createElement(View, {
91
190
  className: "".concat(classPrefix, "-leftin ").concat(classPrefix, "-icon")
92
191
  }, leftIn);
93
- };
94
- var renderLeft = function() {
192
+ }, [
193
+ leftIn
194
+ ]);
195
+ var renderLeft = useCallback(function() {
95
196
  if (!backable && !left) return null;
96
197
  return /*#__PURE__*/ React.createElement(View, {
97
198
  className: "".concat(classPrefix, "-left")
98
- }, backable ? /*#__PURE__*/ React.createElement(ArrowLeft, {
99
- size: "16"
100
- }) : left);
101
- };
102
- var renderRightIn = function() {
199
+ }, backable ? /*#__PURE__*/ React.createElement(ArrowLeft, null) : left);
200
+ }, [
201
+ backable,
202
+ left
203
+ ]);
204
+ var renderRightIn = useCallback(function() {
103
205
  if (!rightIn) return null;
104
- return /*#__PURE__*/ React.createElement(View, {
206
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.isValidElement(rightIn) ? /*#__PURE__*/ React.createElement(View, {
105
207
  className: "".concat(classPrefix, "-rightin ").concat(classPrefix, "-icon")
106
- }, rightIn);
107
- };
108
- var renderRight = function() {
208
+ }, rightIn) : /*#__PURE__*/ React.createElement(View, {
209
+ className: "".concat(classPrefix, "-rightin")
210
+ }, rightIn));
211
+ }, [
212
+ rightIn
213
+ ]);
214
+ var renderRight = useCallback(function() {
109
215
  if (!right) return null;
110
216
  return /*#__PURE__*/ React.createElement(View, {
111
217
  className: "".concat(classPrefix, "-right")
112
218
  }, right);
113
- };
114
- var handleClear = function() {
219
+ }, [
220
+ right
221
+ ]);
222
+ var renderClear = useCallback(function() {
115
223
  return /*#__PURE__*/ React.createElement(View, {
116
- className: "".concat(classPrefix, "-clear ").concat(classPrefix, "-icon"),
117
- onClick: function(e) {
118
- return clearaVal(e);
119
- }
120
- }, /*#__PURE__*/ React.createElement(MaskClose, {
121
- size: 16
122
- }));
123
- };
124
- var clearaVal = function(event) {
125
- if (disabled || readOnly) {
126
- return;
127
- }
128
- setValue('');
129
- forceFocus();
130
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(''));
131
- onClear && onClear(event);
132
- };
224
+ className: "".concat(classPrefix, "-clear ").concat(classPrefix, "-icon"),
225
+ style: {
226
+ visibility: "".concat(!innerTag && value && clearable ? 'visible' : 'hidden')
227
+ },
228
+ onClick: clearaVal,
229
+ "aria-label": "清除"
230
+ }, /*#__PURE__*/ React.createElement(MaskClose, null));
231
+ }, [
232
+ value,
233
+ clearable,
234
+ clearaVal,
235
+ innerTag
236
+ ]);
133
237
  var onConfirm = function() {
134
238
  onSearch && onSearch(value);
135
239
  };
136
240
  return /*#__PURE__*/ React.createElement(View, {
137
- className: "".concat(classPrefix, " ").concat(disabled ? "".concat(classPrefix, "-disabled") : '', " ").concat(className || ''),
241
+ className: cls,
138
242
  style: style
139
243
  }, renderLeft(), /*#__PURE__*/ React.createElement(View, {
140
- className: "".concat(classPrefix, "-content ").concat(shape === 'round' ? "".concat(classPrefix, "-round") : '')
244
+ className: classNames("".concat(classPrefix, "-content"), _define_property({}, "".concat(classPrefix, "-round"), shape === 'round'))
141
245
  }, renderLeftIn(), /*#__PURE__*/ React.createElement(View, {
142
246
  className: "nut-searchbar-input-box"
143
- }, renderField()), clearable && !value && renderRightIn(), clearable && value && handleClear()), renderRight());
247
+ }, renderField()), renderValueByTags(), renderClear(), renderRightIn()), renderRight());
144
248
  };
145
249
  SearchBar.displayName = 'NutSearchBar';
@@ -9,28 +9,114 @@
9
9
  box-sizing: border-box;
10
10
  justify-content: center;
11
11
 
12
+ .nut-icon {
13
+ width: $searchbar-icon-size;
14
+ height: $searchbar-icon-size;
15
+ font-size: $searchbar-icon-size;
16
+ }
17
+
12
18
  &-content {
19
+ position: relative;
13
20
  flex: 1;
14
21
  display: flex;
15
22
  align-items: center;
16
23
  justify-content: center;
17
- padding: $searchbar-content-padding;
24
+ padding: 0 $searchbar-gap;
18
25
  height: $searchbar-input-height;
19
26
  background: $searchbar-content-background;
20
27
  border-radius: $searchbar-content-border-radius;
28
+ border: 1px solid $color-primary;
21
29
  }
22
30
 
23
31
  &-icon {
24
32
  display: flex;
25
33
  justify-content: center;
26
34
  align-items: center;
35
+ color: $color-primary;
36
+ }
37
+
38
+ &-leftin {
39
+ margin-right: $searchbar-inner-gap;
27
40
  }
28
41
 
29
- &-clear,
30
42
  &-rightin {
31
- width: 16px;
32
- height: 16px;
33
- color: var(--nutui-black-5);
43
+ font-size: 15px;
44
+ font-weight: 500;
45
+ color: $color-primary;
46
+
47
+ &.nut-searchbar-icon {
48
+ color: var(--nutui-black-5);
49
+ }
50
+ }
51
+
52
+ &-input-box,
53
+ &-input {
54
+ display: flex;
55
+ align-items: center;
56
+ flex: 1;
57
+ }
58
+
59
+ &-input {
60
+ border: 0;
61
+ outline: 0;
62
+ box-sizing: border-box;
63
+ width: 100%;
64
+ padding: 0;
65
+ margin: 0;
66
+ font-size: $searchbar-font-size;
67
+ color: $searchbar-input-text-color;
68
+ caret-color: $searchbar-input-curror-color;
69
+ background: transparent;
70
+ text-align: $searchbar-input-text-align;
71
+ }
72
+
73
+ &-clear {
74
+ &.nut-searchbar-icon {
75
+ position: relative;
76
+ .nut-icon {
77
+ width: 12px;
78
+ height: 12px;
79
+ color: var(--nutui-black-5);
80
+ margin-right: $searchbar-inner-gap;
81
+ }
82
+ &::after {
83
+ content: '';
84
+ position: absolute;
85
+ width: 100%;
86
+ height: 200%;
87
+ left: -20%;
88
+ }
89
+ }
90
+ }
91
+
92
+ &-values {
93
+ position: absolute;
94
+ display: flex;
95
+ flex-direction: row;
96
+ z-index: 2;
97
+ background-color: #fff;
98
+ top: 9px;
99
+ left: 6px;
100
+ font-size: 12px;
101
+ line-height: 12px;
102
+
103
+ .nut-searchbar-value {
104
+ display: flex;
105
+ flex-direction: row;
106
+ align-items: center;
107
+ padding: 4px 8px;
108
+ background-color: #f7f8fc;
109
+ border-radius: 4px;
110
+ margin-right: 2px;
111
+ }
112
+
113
+ .nut-icon {
114
+ width: 6px;
115
+ height: 6px;
116
+ font-size: 6px;
117
+ color: #c2c4cc;
118
+ margin-left: 4px;
119
+ }
34
120
  }
35
121
 
36
122
  &-left,
@@ -93,26 +179,6 @@
93
179
  }
94
180
  }
95
181
 
96
- &-input-box,
97
- &-input {
98
- display: flex;
99
- align-items: center;
100
- flex: 1;
101
- }
102
-
103
- &-input {
104
- border: 0;
105
- outline: 0;
106
- box-sizing: border-box;
107
- width: 100%;
108
- padding: $searchbar-input-padding;
109
- font-size: $searchbar-font-size;
110
- color: $searchbar-input-text-color;
111
- caret-color: $searchbar-input-curror-color;
112
- background: transparent;
113
- text-align: $searchbar-input-text-align;
114
- }
115
-
116
182
  &-round {
117
183
  border-radius: $searchbar-content-round-border-radius;
118
184
  }
@@ -120,6 +186,14 @@
120
186
  &-disabled {
121
187
  cursor: not-allowed;
122
188
  }
189
+
190
+ &-focus {
191
+ padding: 5px $searchbar-gap;
192
+
193
+ .nut-searchbar-content {
194
+ border: 0.5px solid #ff5c67;
195
+ }
196
+ }
123
197
  }
124
198
 
125
199
  [dir='rtl'] .nut-searchbar,