@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[];
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "SearchBar", {
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ var _define_property = require("@swc/helpers/_/_define_property");
13
14
  var _object_spread = require("@swc/helpers/_/_object_spread");
14
15
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
15
16
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
@@ -17,8 +18,10 @@ var _taro = /*#__PURE__*/ _interop_require_default._(require("@tarojs/taro"));
17
18
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
19
  var _components = require("@tarojs/components");
19
20
  var _iconsreacttaro = require("@nutui/icons-react-taro");
21
+ var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
22
  var _index = require("../configprovider/index");
21
23
  var _typings = require("../../utils/typings");
24
+ var _usepropsvalue = require("../../hooks/use-props-value");
22
25
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
23
26
  placeholder: '',
24
27
  shape: 'square',
@@ -31,127 +34,228 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
31
34
  left: '',
32
35
  right: '',
33
36
  rightIn: '',
34
- leftIn: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Search, {
35
- size: "16"
36
- })
37
+ leftIn: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Search, null),
38
+ tag: false
37
39
  });
38
40
  var SearchBar = function SearchBar(props) {
39
41
  var classPrefix = 'nut-searchbar';
40
42
  var locale = (0, _index.useConfig)().locale;
41
- var searchRef = (0, _react.useRef)(null);
42
- var _$_object_spread = (0, _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;
43
- var _useState = (0, _sliced_to_array._)((0, _react.useState)(function() {
44
- return outerValue;
45
- }), 2), value = _useState[0], setValue = _useState[1];
46
- var forceFocus = function forceFocus() {
47
- var searchSelf = searchRef.current;
48
- searchSelf && searchSelf.focus();
49
- };
50
- var onInput = function onInput(event) {
43
+ var searchInputRef = (0, _react.useRef)(null);
44
+ var _$_object_spread = (0, _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;
45
+ var _usePropsValue = (0, _sliced_to_array._)((0, _usepropsvalue.usePropsValue)({
46
+ value: outerValue,
47
+ defaultValue: defaultValue,
48
+ finalValue: ''
49
+ }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
50
+ var _useState = (0, _sliced_to_array._)((0, _react.useState)(tag), 2), innerTag = _useState[0], setInnerTag = _useState[1];
51
+ var forceFocus = (0, _react.useCallback)(function() {
52
+ var _searchInputRef_current;
53
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.focus();
54
+ }, []);
55
+ var handleInput = (0, _react.useCallback)(function(event) {
51
56
  var _event_detail;
52
- var eventValue = event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
57
+ var eventValue = (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
53
58
  if (value === eventValue) return;
54
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(eventValue, event));
59
+ onChange && onChange(eventValue, event);
55
60
  setValue(eventValue);
56
61
  eventValue === '' && forceFocus();
57
- };
58
- var focus = function focus(event) {
59
- var _event_detail;
60
- onFocus && onFocus(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
61
- };
62
- var blur = function blur(event) {
62
+ }, [
63
+ onChange,
64
+ setValue,
65
+ forceFocus,
66
+ value
67
+ ]);
68
+ var handleFocus = (0, _react.useCallback)(function(event) {
63
69
  var _event_detail;
64
- var searchSelf = searchRef.current;
65
- searchSelf && searchSelf.blur();
66
- onBlur && onBlur(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
67
- };
70
+ onFocus && onFocus((_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
71
+ if (tag) setInnerTag(false);
72
+ }, [
73
+ onFocus
74
+ ]);
75
+ var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(null), 2), blurTimer = _useState1[0], setBlurTimer = _useState1[1];
76
+ var handleBlur = (0, _react.useCallback)(function(event) {
77
+ var _searchInputRef_current, _event_detail;
78
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.blur();
79
+ onBlur && onBlur((_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
80
+ if (tag) {
81
+ var timer = setTimeout(function() {
82
+ if (_taro.default.getEnv() === 'WEB') {
83
+ var _event_target;
84
+ setInnerTag(((_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.value) ? tag : false);
85
+ } else {
86
+ setInnerTag(tag);
87
+ }
88
+ }, 200);
89
+ setBlurTimer(timer);
90
+ }
91
+ }, [
92
+ onBlur,
93
+ tag,
94
+ value
95
+ ]);
68
96
  (0, _react.useEffect)(function() {
69
- setValue(outerValue || '');
97
+ return function() {
98
+ if (blurTimer) clearTimeout(blurTimer);
99
+ };
70
100
  }, [
71
- outerValue
101
+ blurTimer
102
+ ]);
103
+ var clearaVal = (0, _react.useCallback)(function(event) {
104
+ if (disabled || readOnly) return;
105
+ setValue('');
106
+ forceFocus();
107
+ onChange && onChange('');
108
+ onClear && onClear(event);
109
+ }, [
110
+ disabled,
111
+ readOnly,
112
+ onChange,
113
+ onClear,
114
+ setValue
115
+ ]);
116
+ var cls = (0, _react.useMemo)(function() {
117
+ var _obj;
118
+ return (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-disabled"), disabled), (0, _define_property._)(_obj, "".concat(classPrefix, "-focus"), left || backable), _obj), className);
119
+ }, [
120
+ disabled,
121
+ backable,
122
+ left,
123
+ className
72
124
  ]);
73
125
  (0, _react.useEffect)(function() {
74
- if (_taro.default.getEnv() === 'WEB') {
75
- autoFocus && forceFocus();
126
+ if (autoFocus) {
127
+ forceFocus();
128
+ }
129
+ if (tag && !innerTag) {
130
+ forceFocus();
76
131
  }
77
132
  }, [
78
- autoFocus
133
+ autoFocus,
134
+ forceFocus,
135
+ innerTag
79
136
  ]);
80
137
  var renderField = function renderField() {
81
- return /*#__PURE__*/ _react.default.createElement(_components.Input, {
82
- className: "".concat(classPrefix, "-input ").concat(clearable ? "".concat(classPrefix, "-input-clear") : ''),
83
- ref: searchRef,
84
- style: style,
85
- value: (value || '').toString(),
138
+ var inputCls = (0, _classnames.default)("".concat(classPrefix, "-input"));
139
+ return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, _taro.default.getEnv() === 'WEB' ? /*#__PURE__*/ _react.default.createElement(_components.Input, {
140
+ className: inputCls,
141
+ ref: searchInputRef,
142
+ style: (0, _object_spread._)({}, style, {
143
+ color: "".concat(innerTag ? 'transparent' : '#333')
144
+ }),
145
+ value: value,
86
146
  placeholder: placeholder || locale.placeholder,
87
147
  disabled: disabled || readOnly,
88
148
  maxlength: maxLength,
89
149
  autoFocus: autoFocus,
90
- onInput: onInput,
91
- onFocus: focus,
92
- onBlur: blur,
93
- onClick: clickInput,
150
+ onInput: handleInput,
151
+ onFocus: handleFocus,
152
+ onBlur: handleBlur,
153
+ onClick: onInputClick,
94
154
  onConfirm: onConfirm
95
- });
96
- };
97
- var clickInput = function clickInput(e) {
98
- onInputClick && onInputClick(e);
155
+ }) : /*#__PURE__*/ _react.default.createElement(_components.Input, {
156
+ className: inputCls,
157
+ ref: searchInputRef,
158
+ style: (0, _object_spread._)({}, style, {
159
+ color: "".concat(innerTag ? 'transparent' : '#333')
160
+ }),
161
+ value: value,
162
+ placeholder: placeholder || locale.placeholder,
163
+ disabled: disabled || readOnly,
164
+ maxlength: maxLength,
165
+ focus: autoFocus,
166
+ onInput: handleInput,
167
+ onFocus: handleFocus,
168
+ onBlur: handleBlur,
169
+ onClick: onInputClick,
170
+ onConfirm: onConfirm
171
+ }));
99
172
  };
100
- var renderLeftIn = function renderLeftIn() {
173
+ var renderValueByTags = (0, _react.useCallback)(function() {
174
+ if (!innerTag) return null;
175
+ if (!value) {
176
+ setTimeout(function() {
177
+ forceFocus();
178
+ }, 0);
179
+ return null;
180
+ }
181
+ var list = value.split(',');
182
+ if (!list) return null;
183
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
184
+ className: "nut-searchbar-values"
185
+ }, list.map(function(item, index) {
186
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
187
+ key: "def-".concat(index),
188
+ className: "nut-searchbar-value",
189
+ onClick: function onClick(e) {
190
+ return onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, e);
191
+ }
192
+ }, item, /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, null));
193
+ }));
194
+ }, [
195
+ value,
196
+ onItemClick,
197
+ innerTag
198
+ ]);
199
+ var renderLeftIn = (0, _react.useCallback)(function() {
101
200
  if (!leftIn) return null;
102
201
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
103
202
  className: "".concat(classPrefix, "-leftin ").concat(classPrefix, "-icon")
104
203
  }, leftIn);
105
- };
106
- var renderLeft = function renderLeft() {
204
+ }, [
205
+ leftIn
206
+ ]);
207
+ var renderLeft = (0, _react.useCallback)(function() {
107
208
  if (!backable && !left) return null;
108
209
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
109
210
  className: "".concat(classPrefix, "-left")
110
- }, backable ? /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.ArrowLeft, {
111
- size: "16"
112
- }) : left);
113
- };
114
- var renderRightIn = function renderRightIn() {
211
+ }, backable ? /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.ArrowLeft, null) : left);
212
+ }, [
213
+ backable,
214
+ left
215
+ ]);
216
+ var renderRightIn = (0, _react.useCallback)(function() {
115
217
  if (!rightIn) return null;
116
- return /*#__PURE__*/ _react.default.createElement(_components.View, {
218
+ return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.isValidElement(rightIn) ? /*#__PURE__*/ _react.default.createElement(_components.View, {
117
219
  className: "".concat(classPrefix, "-rightin ").concat(classPrefix, "-icon")
118
- }, rightIn);
119
- };
120
- var renderRight = function renderRight() {
220
+ }, rightIn) : /*#__PURE__*/ _react.default.createElement(_components.View, {
221
+ className: "".concat(classPrefix, "-rightin")
222
+ }, rightIn));
223
+ }, [
224
+ rightIn
225
+ ]);
226
+ var renderRight = (0, _react.useCallback)(function() {
121
227
  if (!right) return null;
122
228
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
123
229
  className: "".concat(classPrefix, "-right")
124
230
  }, right);
125
- };
126
- var handleClear = function handleClear() {
231
+ }, [
232
+ right
233
+ ]);
234
+ var renderClear = (0, _react.useCallback)(function() {
127
235
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
128
- className: "".concat(classPrefix, "-clear ").concat(classPrefix, "-icon"),
129
- onClick: function onClick(e) {
130
- return clearaVal(e);
131
- }
132
- }, /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.MaskClose, {
133
- size: 16
134
- }));
135
- };
136
- var clearaVal = function clearaVal(event) {
137
- if (disabled || readOnly) {
138
- return;
139
- }
140
- setValue('');
141
- forceFocus();
142
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(''));
143
- onClear && onClear(event);
144
- };
236
+ className: "".concat(classPrefix, "-clear ").concat(classPrefix, "-icon"),
237
+ style: {
238
+ visibility: "".concat(!innerTag && value && clearable ? 'visible' : 'hidden')
239
+ },
240
+ onClick: clearaVal,
241
+ "aria-label": "清除"
242
+ }, /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.MaskClose, null));
243
+ }, [
244
+ value,
245
+ clearable,
246
+ clearaVal,
247
+ innerTag
248
+ ]);
145
249
  var onConfirm = function onConfirm() {
146
250
  onSearch && onSearch(value);
147
251
  };
148
252
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
149
- className: "".concat(classPrefix, " ").concat(disabled ? "".concat(classPrefix, "-disabled") : '', " ").concat(className || ''),
253
+ className: cls,
150
254
  style: style
151
255
  }, renderLeft(), /*#__PURE__*/ _react.default.createElement(_components.View, {
152
- className: "".concat(classPrefix, "-content ").concat(shape === 'round' ? "".concat(classPrefix, "-round") : '')
256
+ className: (0, _classnames.default)("".concat(classPrefix, "-content"), (0, _define_property._)({}, "".concat(classPrefix, "-round"), shape === 'round'))
153
257
  }, renderLeftIn(), /*#__PURE__*/ _react.default.createElement(_components.View, {
154
258
  className: "nut-searchbar-input-box"
155
- }, renderField()), clearable && !value && renderRightIn(), clearable && value && handleClear()), renderRight());
259
+ }, renderField()), renderValueByTags(), renderClear(), renderRightIn()), renderRight());
156
260
  };
157
261
  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,