@nutui/nutui-react 3.0.11 → 3.0.13-beta.0

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 (148) hide show
  1. package/CHANGELOG.md +19 -7
  2. package/dist/cjs/packages/address/style/address.scss +114 -0
  3. package/dist/cjs/packages/address/style/style.css +103 -0
  4. package/dist/cjs/packages/address/style-jmapp/address.scss +114 -0
  5. package/dist/cjs/packages/address/style-jmapp/style.css +103 -0
  6. package/dist/cjs/packages/address/style-jrkf/address.scss +114 -0
  7. package/dist/cjs/packages/address/style-jrkf/style.css +103 -0
  8. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  9. package/dist/cjs/packages/elevator/style/css.js +0 -2
  10. package/dist/cjs/packages/elevator/style/elevator.scss +116 -95
  11. package/dist/cjs/packages/elevator/style/index.js +0 -2
  12. package/dist/cjs/packages/elevator/style/style.css +98 -83
  13. package/dist/cjs/packages/elevator/style-jmapp/css.js +0 -2
  14. package/dist/cjs/packages/elevator/style-jmapp/elevator.scss +116 -95
  15. package/dist/cjs/packages/elevator/style-jmapp/index.js +0 -2
  16. package/dist/cjs/packages/elevator/style-jmapp/style.css +98 -83
  17. package/dist/cjs/packages/elevator/style-jrkf/css.js +0 -2
  18. package/dist/cjs/packages/elevator/style-jrkf/elevator.scss +116 -95
  19. package/dist/cjs/packages/elevator/style-jrkf/index.js +0 -2
  20. package/dist/cjs/packages/elevator/style-jrkf/style.css +98 -83
  21. package/dist/cjs/packages/input/input.js +3 -0
  22. package/dist/cjs/packages/progress/progress.js +38 -17
  23. package/dist/cjs/packages/progress/style/progress.scss +5 -21
  24. package/dist/cjs/packages/progress/style/style.css +5 -19
  25. package/dist/cjs/packages/progress/style-jmapp/progress.scss +5 -21
  26. package/dist/cjs/packages/progress/style-jmapp/style.css +4 -18
  27. package/dist/cjs/packages/progress/style-jrkf/progress.scss +5 -21
  28. package/dist/cjs/packages/progress/style-jrkf/style.css +4 -18
  29. package/dist/cjs/packages/range/range.js +5 -11
  30. package/dist/cjs/packages/range/style/range.scss +6 -2
  31. package/dist/cjs/packages/range/style/style.css +3 -1
  32. package/dist/cjs/packages/range/style-jmapp/range.scss +6 -2
  33. package/dist/cjs/packages/range/style-jmapp/style.css +3 -1
  34. package/dist/cjs/packages/range/style-jrkf/range.scss +6 -2
  35. package/dist/cjs/packages/range/style-jrkf/style.css +3 -1
  36. package/dist/cjs/packages/range/utils.d.ts +3 -0
  37. package/dist/cjs/packages/range/utils.js +24 -0
  38. package/dist/cjs/packages/searchbar/searchbar.js +162 -87
  39. package/dist/cjs/packages/searchbar/style/searchbar.scss +99 -25
  40. package/dist/cjs/packages/searchbar/style/style.css +102 -38
  41. package/dist/cjs/packages/searchbar/style-jmapp/searchbar.scss +99 -25
  42. package/dist/cjs/packages/searchbar/style-jmapp/style.css +85 -21
  43. package/dist/cjs/packages/searchbar/style-jrkf/searchbar.scss +99 -25
  44. package/dist/cjs/packages/searchbar/style-jrkf/style.css +85 -21
  45. package/dist/cjs/packages/step/step.js +74 -33
  46. package/dist/cjs/packages/step/style/step.scss +104 -195
  47. package/dist/cjs/packages/step/style/style.css +85 -159
  48. package/dist/cjs/packages/step/style-jmapp/step.scss +104 -195
  49. package/dist/cjs/packages/step/style-jmapp/style.css +88 -162
  50. package/dist/cjs/packages/step/style-jrkf/step.scss +104 -195
  51. package/dist/cjs/packages/step/style-jrkf/style.css +88 -162
  52. package/dist/cjs/packages/steps/steps.js +23 -8
  53. package/dist/cjs/packages/steps/style/steps.scss +328 -4
  54. package/dist/cjs/packages/steps/style/style.css +219 -2
  55. package/dist/cjs/packages/steps/style-jmapp/steps.scss +328 -4
  56. package/dist/cjs/packages/steps/style-jmapp/style.css +219 -2
  57. package/dist/cjs/packages/steps/style-jrkf/steps.scss +328 -4
  58. package/dist/cjs/packages/steps/style-jrkf/style.css +219 -2
  59. package/dist/cjs/packages/swiper/swiper.js +52 -43
  60. package/dist/cjs/packages/textarea/textarea.d.ts +2 -2
  61. package/dist/cjs/packages/textarea/textarea.js +25 -8
  62. package/dist/cjs/packages/uploader/uploader.js +20 -9
  63. package/dist/cjs/types/spec/lottie/taro.d.ts +1 -0
  64. package/dist/cjs/types/spec/progress/base.d.ts +6 -0
  65. package/dist/cjs/types/spec/progress/taro.d.ts +4 -0
  66. package/dist/cjs/types/spec/searchbar/base.d.ts +3 -0
  67. package/dist/cjs/types/spec/steps/base.d.ts +11 -2
  68. package/dist/cjs/types/spec/swiper/base.d.ts +4 -0
  69. package/dist/cjs/types/spec/swiper/taro.d.ts +4 -0
  70. package/dist/es/packages/address/style/address.scss +114 -0
  71. package/dist/es/packages/address/style/style.css +103 -0
  72. package/dist/es/packages/address/style-jmapp/address.scss +114 -0
  73. package/dist/es/packages/address/style-jmapp/style.css +103 -0
  74. package/dist/es/packages/address/style-jrkf/address.scss +114 -0
  75. package/dist/es/packages/address/style-jrkf/style.css +103 -0
  76. package/dist/es/packages/configprovider/types.d.ts +1 -1
  77. package/dist/es/packages/elevator/style/css.js +0 -2
  78. package/dist/es/packages/elevator/style/elevator.scss +116 -95
  79. package/dist/es/packages/elevator/style/index.js +0 -2
  80. package/dist/es/packages/elevator/style/style.css +98 -83
  81. package/dist/es/packages/elevator/style-jmapp/css.js +0 -2
  82. package/dist/es/packages/elevator/style-jmapp/elevator.scss +116 -95
  83. package/dist/es/packages/elevator/style-jmapp/index.js +0 -2
  84. package/dist/es/packages/elevator/style-jmapp/style.css +98 -83
  85. package/dist/es/packages/elevator/style-jrkf/css.js +0 -2
  86. package/dist/es/packages/elevator/style-jrkf/elevator.scss +116 -95
  87. package/dist/es/packages/elevator/style-jrkf/index.js +0 -2
  88. package/dist/es/packages/elevator/style-jrkf/style.css +98 -83
  89. package/dist/es/packages/input/input.js +3 -0
  90. package/dist/es/packages/progress/progress.js +38 -17
  91. package/dist/es/packages/progress/style/progress.scss +5 -21
  92. package/dist/es/packages/progress/style/style.css +5 -19
  93. package/dist/es/packages/progress/style-jmapp/progress.scss +5 -21
  94. package/dist/es/packages/progress/style-jmapp/style.css +4 -18
  95. package/dist/es/packages/progress/style-jrkf/progress.scss +5 -21
  96. package/dist/es/packages/progress/style-jrkf/style.css +4 -18
  97. package/dist/es/packages/range/range.js +5 -11
  98. package/dist/es/packages/range/style/range.scss +6 -2
  99. package/dist/es/packages/range/style/style.css +3 -1
  100. package/dist/es/packages/range/style-jmapp/range.scss +6 -2
  101. package/dist/es/packages/range/style-jmapp/style.css +3 -1
  102. package/dist/es/packages/range/style-jrkf/range.scss +6 -2
  103. package/dist/es/packages/range/style-jrkf/style.css +3 -1
  104. package/dist/es/packages/range/utils.d.ts +3 -0
  105. package/dist/es/packages/range/utils.js +6 -0
  106. package/dist/es/packages/searchbar/searchbar.js +163 -89
  107. package/dist/es/packages/searchbar/style/searchbar.scss +99 -25
  108. package/dist/es/packages/searchbar/style/style.css +102 -38
  109. package/dist/es/packages/searchbar/style-jmapp/searchbar.scss +99 -25
  110. package/dist/es/packages/searchbar/style-jmapp/style.css +85 -21
  111. package/dist/es/packages/searchbar/style-jrkf/searchbar.scss +99 -25
  112. package/dist/es/packages/searchbar/style-jrkf/style.css +85 -21
  113. package/dist/es/packages/step/step.js +75 -34
  114. package/dist/es/packages/step/style/step.scss +104 -195
  115. package/dist/es/packages/step/style/style.css +85 -159
  116. package/dist/es/packages/step/style-jmapp/step.scss +104 -195
  117. package/dist/es/packages/step/style-jmapp/style.css +88 -162
  118. package/dist/es/packages/step/style-jrkf/step.scss +104 -195
  119. package/dist/es/packages/step/style-jrkf/style.css +88 -162
  120. package/dist/es/packages/steps/steps.js +23 -8
  121. package/dist/es/packages/steps/style/steps.scss +328 -4
  122. package/dist/es/packages/steps/style/style.css +219 -2
  123. package/dist/es/packages/steps/style-jmapp/steps.scss +328 -4
  124. package/dist/es/packages/steps/style-jmapp/style.css +219 -2
  125. package/dist/es/packages/steps/style-jrkf/steps.scss +328 -4
  126. package/dist/es/packages/steps/style-jrkf/style.css +219 -2
  127. package/dist/es/packages/swiper/swiper.js +53 -44
  128. package/dist/es/packages/textarea/textarea.d.ts +2 -2
  129. package/dist/es/packages/textarea/textarea.js +26 -9
  130. package/dist/es/packages/uploader/uploader.js +20 -9
  131. package/dist/es/types/spec/lottie/taro.d.ts +1 -0
  132. package/dist/es/types/spec/progress/base.d.ts +24 -0
  133. package/dist/es/types/spec/progress/taro.d.ts +4 -0
  134. package/dist/es/types/spec/searchbar/base.d.ts +10 -1
  135. package/dist/es/types/spec/steps/base.d.ts +26 -5
  136. package/dist/es/types/spec/swiper/base.d.ts +5 -1
  137. package/dist/es/types/spec/swiper/taro.d.ts +4 -0
  138. package/dist/nutui.react.umd.js +399 -223
  139. package/dist/style-jmapp.css +1 -1
  140. package/dist/style-jmapp.scss +44 -44
  141. package/dist/style-jrkf.css +1 -1
  142. package/dist/style-jrkf.scss +37 -37
  143. package/dist/style.css +1 -1
  144. package/dist/style.scss +37 -37
  145. package/dist/styles/variables-jmapp.scss +133 -79
  146. package/dist/styles/variables-jrkf.scss +134 -80
  147. package/dist/styles/variables.scss +148 -89
  148. 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[];
@@ -0,0 +1,6 @@
1
+ export var isSameValue = function(newValue, oldValue) {
2
+ return JSON.stringify(newValue) === JSON.stringify(oldValue);
3
+ };
4
+ export var handleOverlap = function(value) {
5
+ return value[0] > value[1] ? value.slice(0).reverse() : value;
6
+ };
@@ -1,10 +1,13 @@
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
- import React, { useEffect, useRef, useState } from "react";
5
- import { ArrowLeft, MaskClose, Search } from "@nutui/icons-react";
5
+ import React, { useCallback, useEffect, useRef, useState, useMemo } from "react";
6
+ import { ArrowLeft, Close, MaskClose, Search } from "@nutui/icons-react";
7
+ import classNames from "classnames";
6
8
  import { useConfig } from "../configprovider";
7
9
  import { ComponentDefaults } from "../../utils/typings";
10
+ import { usePropsValue } from "../../hooks/use-props-value";
8
11
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
9
12
  placeholder: '',
10
13
  shape: 'square',
@@ -17,133 +20,204 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
17
20
  left: '',
18
21
  right: '',
19
22
  rightIn: '',
20
- leftIn: /*#__PURE__*/ React.createElement(Search, {
21
- width: "16",
22
- height: "16"
23
- })
23
+ leftIn: /*#__PURE__*/ React.createElement(Search, null),
24
+ tag: false
24
25
  });
25
26
  export var SearchBar = function(props) {
26
27
  var classPrefix = 'nut-searchbar';
27
28
  var locale = useConfig().locale;
28
- var searchRef = useRef(null);
29
- 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;
30
- var _useState = _sliced_to_array(useState(function() {
31
- return outerValue;
32
- }), 2), value = _useState[0], setValue = _useState[1];
33
- var forceFocus = function() {
34
- var searchSelf = searchRef.current;
35
- searchSelf && searchSelf.focus();
36
- };
37
- var change = function(event) {
29
+ var searchInputRef = useRef(null);
30
+ 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;
31
+ var _usePropsValue = _sliced_to_array(usePropsValue({
32
+ value: outerValue,
33
+ defaultValue: defaultValue,
34
+ finalValue: ''
35
+ }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
36
+ var _useState = _sliced_to_array(useState(tag), 2), innerTag = _useState[0], setInnerTag = _useState[1];
37
+ var forceFocus = useCallback(function() {
38
+ var _searchInputRef_current;
39
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.focus();
40
+ }, []);
41
+ var handleChange = useCallback(function(event) {
38
42
  var value = event.target.value;
39
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(value, event));
43
+ onChange && onChange(value, event);
40
44
  setValue(value);
41
- };
42
- var focus = function(event) {
43
- var value = event.target.value;
44
- onFocus && (onFocus === null || onFocus === void 0 ? void 0 : onFocus(value, event));
45
- };
46
- var blur = function(event) {
47
- var searchSelf = searchRef.current;
48
- searchSelf && searchSelf.blur();
49
- var value = event.target.value;
50
- onBlur && (onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, event));
51
- };
45
+ }, [
46
+ onChange,
47
+ setValue
48
+ ]);
49
+ var handleInputClick = useCallback(function(event) {
50
+ onInputClick === null || onInputClick === void 0 ? void 0 : onInputClick(event);
51
+ }, [
52
+ onInputClick
53
+ ]);
54
+ var handleFocus = useCallback(function(event) {
55
+ var _event_target;
56
+ onFocus && onFocus((_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.value, event);
57
+ if (tag) setInnerTag(false);
58
+ }, [
59
+ onFocus,
60
+ tag
61
+ ]);
62
+ var _useState1 = _sliced_to_array(useState(null), 2), blurTimer = _useState1[0], setBlurTimer = _useState1[1];
63
+ var handleBlur = useCallback(function(event) {
64
+ var _searchInputRef_current, _event_target;
65
+ (_searchInputRef_current = searchInputRef.current) === null || _searchInputRef_current === void 0 ? void 0 : _searchInputRef_current.blur();
66
+ onBlur && onBlur((_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.value, event);
67
+ if (tag) {
68
+ var timer = setTimeout(function() {
69
+ var _event_target;
70
+ setInnerTag(((_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.value) ? tag : false);
71
+ }, 150);
72
+ setBlurTimer(timer);
73
+ }
74
+ }, [
75
+ onBlur,
76
+ tag
77
+ ]);
52
78
  useEffect(function() {
53
- setValue(outerValue);
79
+ return function() {
80
+ if (blurTimer) clearTimeout(blurTimer);
81
+ };
82
+ }, [
83
+ blurTimer
84
+ ]);
85
+ var clearaVal = useCallback(function(event) {
86
+ if (disabled || readOnly) return;
87
+ setValue('');
88
+ forceFocus();
89
+ onChange && onChange('');
90
+ onClear && onClear(event);
54
91
  }, [
55
- outerValue
92
+ disabled,
93
+ readOnly,
94
+ onChange,
95
+ onClear,
96
+ setValue,
97
+ forceFocus
98
+ ]);
99
+ var onKeydown = useCallback(function(e) {
100
+ if (e.key === 'Enter') {
101
+ var event = e.nativeEvent;
102
+ if (typeof event.cancelable !== 'boolean' || event.cancelable) {
103
+ event.preventDefault();
104
+ }
105
+ onSearch && onSearch(value);
106
+ }
107
+ }, [
108
+ onSearch,
109
+ value
110
+ ]);
111
+ var cls = useMemo(function() {
112
+ var _obj;
113
+ return classNames(classPrefix, (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix, "-focus"), left || backable), _obj), className);
114
+ }, [
115
+ disabled,
116
+ backable,
117
+ left,
118
+ className
56
119
  ]);
57
120
  useEffect(function() {
58
- autoFocus && forceFocus();
121
+ if (autoFocus) {
122
+ forceFocus();
123
+ }
59
124
  }, [
60
- autoFocus
125
+ autoFocus,
126
+ forceFocus
61
127
  ]);
62
128
  var renderField = function() {
129
+ var inputCls = classNames("".concat(classPrefix, "-input"));
63
130
  return /*#__PURE__*/ React.createElement("input", {
64
- className: "".concat(classPrefix, "-input ").concat(clearable ? "".concat(classPrefix, "-input-clear") : ''),
65
- ref: searchRef,
131
+ className: inputCls,
132
+ ref: searchInputRef,
66
133
  value: value || '',
67
134
  placeholder: placeholder || locale.placeholder,
68
135
  disabled: disabled,
69
136
  readOnly: readOnly,
70
137
  maxLength: maxLength,
71
138
  onKeyDown: onKeydown,
72
- onChange: function(e) {
73
- return change(e);
74
- },
75
- onFocus: function(e) {
76
- return focus(e);
77
- },
78
- onBlur: function(e) {
79
- return blur(e);
80
- },
81
- onClick: function(e) {
82
- return clickInput(e);
83
- }
139
+ onChange: handleChange,
140
+ onFocus: handleFocus,
141
+ onBlur: handleBlur,
142
+ onClick: handleInputClick
84
143
  });
85
144
  };
86
- var clickInput = function(e) {
87
- onInputClick && onInputClick(e);
88
- };
89
- var renderLeftIn = function() {
145
+ var renderValueByTags = useCallback(function() {
146
+ if (!value) {
147
+ setTimeout(function() {
148
+ forceFocus();
149
+ }, 0);
150
+ return null;
151
+ }
152
+ var list = value.split(',');
153
+ if (!list) return null;
154
+ return /*#__PURE__*/ React.createElement("div", {
155
+ className: "nut-searchbar-values"
156
+ }, list.map(function(item, index) {
157
+ return /*#__PURE__*/ React.createElement("div", {
158
+ key: "def-".concat(index),
159
+ className: "nut-searchbar-value",
160
+ onClick: function(e) {
161
+ return onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, e);
162
+ }
163
+ }, item, /*#__PURE__*/ React.createElement(Close, null));
164
+ }));
165
+ }, [
166
+ value,
167
+ onItemClick
168
+ ]);
169
+ var renderLeftIn = useCallback(function() {
90
170
  if (!leftIn) return null;
91
171
  return /*#__PURE__*/ React.createElement("div", {
92
172
  className: "".concat(classPrefix, "-leftin ").concat(classPrefix, "-icon")
93
173
  }, leftIn);
94
- };
95
- var renderLeft = function() {
174
+ }, [
175
+ leftIn
176
+ ]);
177
+ var renderLeft = useCallback(function() {
96
178
  if (!backable && !left) return null;
97
179
  return /*#__PURE__*/ React.createElement("div", {
98
180
  className: "".concat(classPrefix, "-left")
99
- }, backable ? /*#__PURE__*/ React.createElement(ArrowLeft, {
100
- width: "16",
101
- height: "16"
102
- }) : left);
103
- };
104
- var renderRightIn = function() {
181
+ }, backable ? /*#__PURE__*/ React.createElement(ArrowLeft, null) : left);
182
+ }, [
183
+ backable,
184
+ left
185
+ ]);
186
+ var renderRightIn = useCallback(function() {
105
187
  if (!rightIn) return null;
106
- return /*#__PURE__*/ React.createElement("div", {
188
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.isValidElement(rightIn) ? /*#__PURE__*/ React.createElement("div", {
107
189
  className: "".concat(classPrefix, "-rightin ").concat(classPrefix, "-icon")
108
- }, rightIn);
109
- };
110
- var renderRight = function() {
190
+ }, rightIn) : /*#__PURE__*/ React.createElement("div", {
191
+ className: "".concat(classPrefix, "-rightin")
192
+ }, rightIn));
193
+ }, [
194
+ rightIn
195
+ ]);
196
+ var renderRight = useCallback(function() {
111
197
  if (!right) return null;
112
198
  return /*#__PURE__*/ React.createElement("div", {
113
199
  className: "".concat(classPrefix, "-right")
114
200
  }, right);
115
- };
116
- var handleClear = function() {
201
+ }, [
202
+ right
203
+ ]);
204
+ var renderClear = useCallback(function() {
205
+ if (!value || !clearable) return null;
117
206
  return /*#__PURE__*/ React.createElement("div", {
118
207
  className: "".concat(classPrefix, "-clear ").concat(classPrefix, "-icon"),
119
- onClick: function(e) {
120
- return clearaVal(e);
121
- }
208
+ onClick: clearaVal,
209
+ "aria-label": "清除"
122
210
  }, /*#__PURE__*/ React.createElement(MaskClose, null));
123
- };
124
- var clearaVal = function(event) {
125
- if (disabled || readOnly) {
126
- return;
127
- }
128
- setValue('');
129
- onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(''));
130
- onClear && onClear(event);
131
- forceFocus();
132
- };
133
- var onKeydown = function(e) {
134
- if (e.key === 'Enter') {
135
- var event = e.nativeEvent;
136
- if (typeof event.cancelable !== 'boolean' || event.cancelable) {
137
- event.preventDefault();
138
- }
139
- onSearch && onSearch(value);
140
- }
141
- };
211
+ }, [
212
+ value,
213
+ clearable,
214
+ clearaVal
215
+ ]);
142
216
  return /*#__PURE__*/ React.createElement("div", {
143
- className: "".concat(classPrefix, " ").concat(disabled ? "".concat(classPrefix, "-disabled") : '', " ").concat(className || ''),
217
+ className: cls,
144
218
  style: style
145
219
  }, renderLeft(), /*#__PURE__*/ React.createElement("div", {
146
- className: "".concat(classPrefix, "-content ").concat(shape === 'round' ? "".concat(classPrefix, "-round") : '')
147
- }, renderLeftIn(), renderField(), clearable && !value && renderRightIn(), clearable && value && handleClear()), renderRight());
220
+ className: classNames("".concat(classPrefix, "-content"), _define_property({}, "".concat(classPrefix, "-round"), shape === 'round'))
221
+ }, renderLeftIn(), renderField(), innerTag ? renderValueByTags() : renderClear(), renderRightIn()), renderRight());
148
222
  };
149
223
  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,