@nutui/nutui-react 1.2.1 → 1.2.2-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.
- package/dist/esm/ConfigProvider.js +11 -0
- package/dist/esm/DatePicker.js +148 -106
- package/dist/esm/Icon.js +4 -72
- package/dist/esm/NumberKeyboard/style/index.js +2 -0
- package/dist/esm/NumberKeyboard.js +277 -0
- package/dist/esm/Picker.js +294 -195
- package/dist/esm/Progress/style/index.js +2 -0
- package/dist/esm/Progress.js +130 -0
- package/dist/esm/Range.js +186 -129
- package/dist/esm/SearchBar/style/index.js +2 -0
- package/dist/esm/SearchBar.js +247 -0
- package/dist/esm/Signature.js +3 -0
- package/dist/esm/Tabbar.js +6 -3
- package/dist/esm/TabbarItem.js +14 -5
- package/dist/esm/Tag.js +18 -9
- package/dist/esm/icon-62bd7379.js +72 -0
- package/dist/esm/nutui-react.es.js +3 -0
- package/dist/esm/useTouch-a2ea68c6.js +119 -0
- package/dist/locales/base.d.ts +11 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +12 -1
- package/dist/locales/id-ID.js +12 -1
- package/dist/locales/zh-CN.js +12 -1
- package/dist/locales/zh-TW.js +12 -1
- package/dist/nutui.react.es.js +1308 -590
- package/dist/nutui.react.umd.js +15 -15
- package/dist/packages/numberkeyboard/numberkeyboard.scss +106 -0
- package/dist/packages/picker/picker.scss +35 -16
- package/dist/packages/progress/progress.scss +81 -0
- package/dist/packages/range/range.scss +141 -13
- package/dist/packages/searchbar/searchbar.scss +106 -0
- package/dist/packages/signature/signature.scss +4 -4
- package/dist/packages/tabbar/tabbar.scss +10 -3
- package/dist/packages/tabbaritem/tabbaritem.scss +26 -8
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +3 -0
- package/dist/styles/variables.scss +73 -6
- package/dist/types/datepicker/__test__/datepicker.spec.d.ts +1 -0
- package/dist/types/datepicker/datepicker.d.ts +16 -5
- package/dist/types/divider/__test__/divider.spec.d.ts +1 -0
- package/dist/types/navbar/__test__/navbar.spec.d.ts +1 -0
- package/dist/types/numberkeyboard/_test_/index.spec.d.ts +1 -0
- package/dist/types/numberkeyboard/demo.d.ts +3 -0
- package/dist/types/numberkeyboard/index.d.ts +2 -0
- package/dist/types/numberkeyboard/numberkeyboard.d.ts +20 -0
- package/dist/types/nutui.react.d.ts +4 -1
- package/dist/types/picker/picker.d.ts +17 -13
- package/dist/types/picker/pickerSlot.d.ts +4 -3
- package/dist/types/progress/__tests__/progress.spec.d.ts +1 -0
- package/dist/types/progress/demo.d.ts +3 -0
- package/dist/types/progress/index.d.ts +2 -0
- package/dist/types/progress/progress.d.ts +26 -0
- package/dist/types/range/demo.d.ts +1 -0
- package/dist/types/range/range.d.ts +3 -1
- package/dist/types/searchbar/demo.d.ts +3 -0
- package/dist/types/searchbar/index.d.ts +2 -0
- package/dist/types/searchbar/searchbar.d.ts +60 -0
- package/dist/types/signature/__test__/signature.spec.d.ts +2 -0
- package/dist/types/tabbar/__tests__/tabbar.spec.d.ts +1 -0
- package/dist/types/tabbar/tabbar.d.ts +2 -2
- package/dist/types/tabbaritem/tabbaritem.d.ts +4 -1
- package/dist/types/tag/tag.d.ts +1 -1
- package/package.json +2 -1
- package/dist/packages/range/custom.scss +0 -9
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
|
|
8
|
+
import React__default, { useRef, useState, useEffect } from 'react';
|
|
9
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
10
|
+
import { useConfig } from './ConfigProvider.js';
|
|
11
|
+
import Icon from './Icon.js';
|
|
12
|
+
import '@bem-react/classname';
|
|
13
|
+
var defaultProps = {
|
|
14
|
+
placeholder: '',
|
|
15
|
+
shape: 'square',
|
|
16
|
+
disabled: false,
|
|
17
|
+
maxLength: 9999,
|
|
18
|
+
clearable: true,
|
|
19
|
+
align: 'left',
|
|
20
|
+
readonly: true,
|
|
21
|
+
autoFocus: false,
|
|
22
|
+
label: '',
|
|
23
|
+
leftinIcon: React__default.createElement(Icon, {
|
|
24
|
+
name: "search",
|
|
25
|
+
size: "12"
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var SearchBar = function SearchBar(props) {
|
|
30
|
+
var searchbarBem = cn('searchbar');
|
|
31
|
+
|
|
32
|
+
var _useConfig = useConfig(),
|
|
33
|
+
locale = _useConfig.locale;
|
|
34
|
+
|
|
35
|
+
var searchRef = useRef(null);
|
|
36
|
+
|
|
37
|
+
var _useState = useState(function () {
|
|
38
|
+
return props.value;
|
|
39
|
+
}),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
value = _useState2[0],
|
|
42
|
+
setValue = _useState2[1];
|
|
43
|
+
|
|
44
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
45
|
+
placeholder = _defaultProps$props.placeholder,
|
|
46
|
+
shape = _defaultProps$props.shape,
|
|
47
|
+
className = _defaultProps$props.className,
|
|
48
|
+
disabled = _defaultProps$props.disabled,
|
|
49
|
+
maxLength = _defaultProps$props.maxLength,
|
|
50
|
+
clearable = _defaultProps$props.clearable,
|
|
51
|
+
align = _defaultProps$props.align,
|
|
52
|
+
readOnly = _defaultProps$props.readOnly,
|
|
53
|
+
autoFocus = _defaultProps$props.autoFocus,
|
|
54
|
+
label = _defaultProps$props.label,
|
|
55
|
+
actionText = _defaultProps$props.actionText,
|
|
56
|
+
leftinIcon = _defaultProps$props.leftinIcon,
|
|
57
|
+
rightinIcon = _defaultProps$props.rightinIcon,
|
|
58
|
+
leftoutIcon = _defaultProps$props.leftoutIcon,
|
|
59
|
+
rightoutIcon = _defaultProps$props.rightoutIcon,
|
|
60
|
+
onChange = _defaultProps$props.onChange,
|
|
61
|
+
onFocus = _defaultProps$props.onFocus,
|
|
62
|
+
onBlur = _defaultProps$props.onBlur,
|
|
63
|
+
onClear = _defaultProps$props.onClear,
|
|
64
|
+
onSearch = _defaultProps$props.onSearch,
|
|
65
|
+
onClickInput = _defaultProps$props.onClickInput,
|
|
66
|
+
onClickLeftinIcon = _defaultProps$props.onClickLeftinIcon,
|
|
67
|
+
onClickLeftoutIcon = _defaultProps$props.onClickLeftoutIcon,
|
|
68
|
+
onClickRightinIcon = _defaultProps$props.onClickRightinIcon,
|
|
69
|
+
onClickRightoutIcon = _defaultProps$props.onClickRightoutIcon;
|
|
70
|
+
|
|
71
|
+
var alignClass = "".concat(align);
|
|
72
|
+
|
|
73
|
+
var change = function change(event) {
|
|
74
|
+
var value = event.target.value;
|
|
75
|
+
onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(value, event));
|
|
76
|
+
setValue(value);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var focus = function focus(event) {
|
|
80
|
+
var value = event.target.value;
|
|
81
|
+
onFocus && (onFocus === null || onFocus === void 0 ? void 0 : onFocus(value, event));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var blur = function blur(event) {
|
|
85
|
+
var searchSelf = searchRef.current;
|
|
86
|
+
searchSelf && searchSelf.blur();
|
|
87
|
+
var value = event.target.value;
|
|
88
|
+
onBlur && (onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, event));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
setValue(props.value);
|
|
93
|
+
}, [props.value]);
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
if (autoFocus) {
|
|
96
|
+
var searchSelf = searchRef.current;
|
|
97
|
+
searchSelf && searchSelf.focus();
|
|
98
|
+
}
|
|
99
|
+
}, [autoFocus]);
|
|
100
|
+
|
|
101
|
+
var renderField = function renderField() {
|
|
102
|
+
return React__default.createElement("input", {
|
|
103
|
+
className: "".concat(searchbarBem('input'), " ").concat(searchbarBem(alignClass), " ").concat(shape === 'round' ? searchbarBem('round') : '', " ").concat(clearable ? searchbarBem('input-clear') : ''),
|
|
104
|
+
ref: searchRef,
|
|
105
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
106
|
+
background: props.inputBackground
|
|
107
|
+
}),
|
|
108
|
+
value: value || '',
|
|
109
|
+
placeholder: placeholder || locale.placeholder,
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
readOnly: readOnly,
|
|
112
|
+
maxLength: maxLength,
|
|
113
|
+
onChange: function onChange(e) {
|
|
114
|
+
return change(e);
|
|
115
|
+
},
|
|
116
|
+
onFocus: function onFocus(e) {
|
|
117
|
+
return focus(e);
|
|
118
|
+
},
|
|
119
|
+
onBlur: function onBlur(e) {
|
|
120
|
+
return blur(e);
|
|
121
|
+
},
|
|
122
|
+
onClick: function onClick(e) {
|
|
123
|
+
return clickInput(e);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var clickInput = function clickInput(e) {
|
|
129
|
+
onClickInput && onClickInput(e);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var renderLeftinIcon = function renderLeftinIcon() {
|
|
133
|
+
if (!leftinIcon) return null;
|
|
134
|
+
return React__default.createElement("div", {
|
|
135
|
+
className: "".concat(searchbarBem('leftin-icon'), " ").concat(searchbarBem('icon')),
|
|
136
|
+
onClick: function onClick(e) {
|
|
137
|
+
return clickLeftIcon('in-left', e);
|
|
138
|
+
}
|
|
139
|
+
}, leftinIcon);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
var renderLeftoutIcon = function renderLeftoutIcon() {
|
|
143
|
+
if (!leftoutIcon) return null;
|
|
144
|
+
return React__default.createElement("div", {
|
|
145
|
+
className: "".concat(searchbarBem('leftout-icon')),
|
|
146
|
+
onClick: function onClick(e) {
|
|
147
|
+
return clickLeftIcon('out-left', e);
|
|
148
|
+
}
|
|
149
|
+
}, leftoutIcon);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var clickLeftIcon = function clickLeftIcon(flag, event) {
|
|
153
|
+
if (flag === 'in-left') {
|
|
154
|
+
onClickLeftinIcon && onClickLeftinIcon(value, event);
|
|
155
|
+
} else {
|
|
156
|
+
onClickLeftoutIcon && onClickLeftoutIcon(value, event);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var renderRightinIcon = function renderRightinIcon() {
|
|
161
|
+
if (!rightinIcon) return null;
|
|
162
|
+
return React__default.createElement("div", {
|
|
163
|
+
className: "".concat(searchbarBem('rightin-icon'), " ").concat(searchbarBem('icon')),
|
|
164
|
+
onClick: function onClick(e) {
|
|
165
|
+
return clickRightIcon('in-right', e);
|
|
166
|
+
}
|
|
167
|
+
}, rightinIcon);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
var renderRightoutIcon = function renderRightoutIcon() {
|
|
171
|
+
if (!rightoutIcon) return null;
|
|
172
|
+
return React__default.createElement("div", {
|
|
173
|
+
className: "".concat(searchbarBem('rightout-icon')),
|
|
174
|
+
onClick: function onClick(e) {
|
|
175
|
+
return clickRightIcon('out-right', e);
|
|
176
|
+
}
|
|
177
|
+
}, rightoutIcon);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
var clickRightIcon = function clickRightIcon(flag, event) {
|
|
181
|
+
if (flag === 'in-left') {
|
|
182
|
+
onClickRightinIcon && onClickRightinIcon(value, event);
|
|
183
|
+
} else {
|
|
184
|
+
onClickRightoutIcon && onClickRightoutIcon(value, event);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
var handleClear = function handleClear() {
|
|
189
|
+
return React__default.createElement("div", {
|
|
190
|
+
className: "".concat(searchbarBem('clear'), " ").concat(rightinIcon ? 'pos-right' : ''),
|
|
191
|
+
onClick: function onClick(e) {
|
|
192
|
+
return clearaVal(e);
|
|
193
|
+
}
|
|
194
|
+
}, React__default.createElement(Icon, {
|
|
195
|
+
name: "circle-close",
|
|
196
|
+
size: "12",
|
|
197
|
+
color: "#555"
|
|
198
|
+
}));
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var clearaVal = function clearaVal(event) {
|
|
202
|
+
if (disabled || readOnly) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
setValue('');
|
|
207
|
+
onClear && onClear(event);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
var renderRightLabel = function renderRightLabel() {
|
|
211
|
+
if (actionText) {
|
|
212
|
+
return React__default.createElement("div", {
|
|
213
|
+
className: searchbarBem('action-text'),
|
|
214
|
+
onClick: search
|
|
215
|
+
}, actionText);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return null;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
var search = function search() {
|
|
222
|
+
onSearch && onSearch(value);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
var renderLabel = function renderLabel() {
|
|
226
|
+
if (label) {
|
|
227
|
+
return React__default.createElement("div", {
|
|
228
|
+
className: searchbarBem('label')
|
|
229
|
+
}, label);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return null;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return React__default.createElement("div", {
|
|
236
|
+
className: "".concat(searchbarBem(), " ").concat(disabled ? searchbarBem('disabled') : '', " ").concat(className || ''),
|
|
237
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
238
|
+
background: props.background
|
|
239
|
+
})
|
|
240
|
+
}, renderLeftoutIcon(), renderLabel(), React__default.createElement("div", {
|
|
241
|
+
className: "".concat(searchbarBem('content'))
|
|
242
|
+
}, renderLeftinIcon(), renderField(), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
SearchBar.defaultProps = defaultProps;
|
|
246
|
+
SearchBar.displayName = 'NutSearchBar';
|
|
247
|
+
export { SearchBar as default };
|
package/dist/esm/Signature.js
CHANGED
package/dist/esm/Tabbar.js
CHANGED
|
@@ -11,10 +11,10 @@ import '@bem-react/classname';
|
|
|
11
11
|
var defaultProps = {
|
|
12
12
|
visible: 0,
|
|
13
13
|
bottom: false,
|
|
14
|
-
|
|
15
|
-
size: '',
|
|
14
|
+
size: 20,
|
|
16
15
|
unactiveColor: '',
|
|
17
16
|
activeColor: '',
|
|
17
|
+
safeAreaInsetBottom: false,
|
|
18
18
|
className: '',
|
|
19
19
|
style: {},
|
|
20
20
|
tabSwitch: function tabSwitch() {}
|
|
@@ -25,8 +25,10 @@ var Tabbar = function Tabbar(props) {
|
|
|
25
25
|
children = _defaultProps$props.children,
|
|
26
26
|
visible = _defaultProps$props.visible,
|
|
27
27
|
bottom = _defaultProps$props.bottom,
|
|
28
|
+
size = _defaultProps$props.size,
|
|
28
29
|
activeColor = _defaultProps$props.activeColor,
|
|
29
30
|
unactiveColor = _defaultProps$props.unactiveColor,
|
|
31
|
+
safeAreaInsetBottom = _defaultProps$props.safeAreaInsetBottom,
|
|
30
32
|
className = _defaultProps$props.className,
|
|
31
33
|
style = _defaultProps$props.style,
|
|
32
34
|
tabSwitch = _defaultProps$props.tabSwitch;
|
|
@@ -43,7 +45,7 @@ var Tabbar = function Tabbar(props) {
|
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
return React__default.createElement("div", {
|
|
46
|
-
className: ["".concat(b()), bottom ? "".concat(b('bottom')) : '', className].join(' '),
|
|
48
|
+
className: ["".concat(b()), bottom ? "".concat(b('bottom')) : '', safeAreaInsetBottom ? "".concat(b('safebottom')) : '', className].join(' '),
|
|
47
49
|
style: style
|
|
48
50
|
}, React__default.Children.map(children, function (child, idx) {
|
|
49
51
|
if (!React__default.isValidElement(child)) {
|
|
@@ -55,6 +57,7 @@ var Tabbar = function Tabbar(props) {
|
|
|
55
57
|
index: idx,
|
|
56
58
|
unactiveColor: unactiveColor,
|
|
57
59
|
activeColor: activeColor,
|
|
60
|
+
size: size,
|
|
58
61
|
handleClick: function handleClick() {
|
|
59
62
|
_handleClick(idx);
|
|
60
63
|
|
package/dist/esm/TabbarItem.js
CHANGED
|
@@ -10,6 +10,9 @@ import { c as cn } from './bem-893ad28d.js';
|
|
|
10
10
|
import Icon from './Icon.js';
|
|
11
11
|
import '@bem-react/classname';
|
|
12
12
|
var defaultProps = {
|
|
13
|
+
dot: false,
|
|
14
|
+
size: '',
|
|
15
|
+
classPrefix: 'nutui-iconfont',
|
|
13
16
|
tabTitle: '',
|
|
14
17
|
icon: '',
|
|
15
18
|
href: '',
|
|
@@ -24,6 +27,9 @@ var defaultProps = {
|
|
|
24
27
|
|
|
25
28
|
var TabbarItem = function TabbarItem(props) {
|
|
26
29
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
30
|
+
dot = _defaultProps$props.dot,
|
|
31
|
+
size = _defaultProps$props.size,
|
|
32
|
+
classPrefix = _defaultProps$props.classPrefix,
|
|
27
33
|
tabTitle = _defaultProps$props.tabTitle,
|
|
28
34
|
icon = _defaultProps$props.icon,
|
|
29
35
|
href = _defaultProps$props.href,
|
|
@@ -47,7 +53,7 @@ var TabbarItem = function TabbarItem(props) {
|
|
|
47
53
|
if (active && to) {
|
|
48
54
|
history.push(to);
|
|
49
55
|
}
|
|
50
|
-
}, [active]);
|
|
56
|
+
}, [active, history, href, to]);
|
|
51
57
|
return React__default.createElement("div", {
|
|
52
58
|
className: "".concat(b({
|
|
53
59
|
active: active
|
|
@@ -60,13 +66,16 @@ var TabbarItem = function TabbarItem(props) {
|
|
|
60
66
|
}
|
|
61
67
|
}, React__default.createElement("div", {
|
|
62
68
|
className: "".concat(bIcon())
|
|
63
|
-
}, num && num <= 99 && React__default.createElement("div", {
|
|
69
|
+
}, !dot ? React__default.createElement(React__default.Fragment, null, num && num <= 99 && React__default.createElement("div", {
|
|
64
70
|
className: "".concat(bIcon('tips', [bIcon('num')]))
|
|
65
71
|
}, num), num && num >= 100 && React__default.createElement("div", {
|
|
66
72
|
className: "".concat(bIcon('tips', [bIcon('nums')]))
|
|
67
|
-
}, "99+")
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
}, "99+")) : React__default.createElement("div", {
|
|
74
|
+
className: "".concat(bIcon('dot'))
|
|
75
|
+
}), icon && React__default.createElement("div", null, React__default.createElement(Icon, {
|
|
76
|
+
size: size,
|
|
77
|
+
name: icon,
|
|
78
|
+
classPrefix: classPrefix
|
|
70
79
|
})), React__default.createElement("div", {
|
|
71
80
|
className: bIcon({
|
|
72
81
|
'nav-word': true
|
package/dist/esm/Tag.js
CHANGED
|
@@ -15,8 +15,8 @@ var defaultProps = {
|
|
|
15
15
|
round: false,
|
|
16
16
|
mark: false,
|
|
17
17
|
closeable: false,
|
|
18
|
-
isShow: true,
|
|
19
18
|
prefixCls: 'nut-tag',
|
|
19
|
+
onClose: function onClose(e) {},
|
|
20
20
|
onClick: function onClick(e) {}
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -31,17 +31,22 @@ var Tag = function Tag(props) {
|
|
|
31
31
|
mark = _defaultProps$props.mark,
|
|
32
32
|
closeable = _defaultProps$props.closeable,
|
|
33
33
|
textColor = _defaultProps$props.textColor,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
onClick = _defaultProps$props.onClick,
|
|
35
|
+
onClose = _defaultProps$props.onClose;
|
|
36
36
|
|
|
37
37
|
var _useState = useState(''),
|
|
38
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
39
|
btnName = _useState2[0],
|
|
40
40
|
setBtnName = _useState2[1];
|
|
41
41
|
|
|
42
|
+
var _useState3 = useState(true),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
isTagShow = _useState4[0],
|
|
45
|
+
setIsTagShow = _useState4[1];
|
|
46
|
+
|
|
42
47
|
useEffect(function () {
|
|
43
48
|
setBtnName(classes());
|
|
44
|
-
}, [type, color, textColor, plain, round, mark, closeable, prefixCls,
|
|
49
|
+
}, [type, color, textColor, plain, round, mark, closeable, prefixCls, onClick, onClose]);
|
|
45
50
|
|
|
46
51
|
var classes = function classes() {
|
|
47
52
|
var prefixCls = 'nut-tag';
|
|
@@ -73,7 +78,7 @@ var Tag = function Tag(props) {
|
|
|
73
78
|
return style;
|
|
74
79
|
};
|
|
75
80
|
|
|
76
|
-
return React__default.createElement("div", null, closeable ?
|
|
81
|
+
return React__default.createElement("div", null, closeable ? isTagShow && React__default.createElement("div", {
|
|
77
82
|
className: "".concat(btnName),
|
|
78
83
|
style: getStyle(),
|
|
79
84
|
onClick: function onClick(e) {
|
|
@@ -81,14 +86,18 @@ var Tag = function Tag(props) {
|
|
|
81
86
|
}
|
|
82
87
|
}, children && React__default.createElement("span", {
|
|
83
88
|
className: "text"
|
|
84
|
-
}, children),
|
|
89
|
+
}, children), React__default.createElement(Icon, {
|
|
85
90
|
className: "_icon",
|
|
86
91
|
name: "close",
|
|
87
92
|
size: "12",
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
click: function click(e) {
|
|
94
|
+
setIsTagShow(false);
|
|
95
|
+
|
|
96
|
+
if (props.onClose) {
|
|
97
|
+
props.onClose(e);
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
|
-
})) :
|
|
100
|
+
})) : React__default.createElement("div", {
|
|
92
101
|
className: "".concat(btnName),
|
|
93
102
|
style: getStyle(),
|
|
94
103
|
onClick: function onClick(e) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["name", "size", "classPrefix", "color", "tag", "children", "className", "fontClassName", "style", "click"];
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
|
|
9
|
+
import React__default from 'react';
|
|
10
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
11
|
+
var defaultProps = {
|
|
12
|
+
name: '',
|
|
13
|
+
size: '',
|
|
14
|
+
classPrefix: 'nutui-icon',
|
|
15
|
+
fontClassName: 'nutui-iconfont',
|
|
16
|
+
color: '',
|
|
17
|
+
tag: 'i',
|
|
18
|
+
click: function click(e) {},
|
|
19
|
+
className: ''
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function pxCheck(value) {
|
|
23
|
+
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var Icon = function Icon(props) {
|
|
27
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
28
|
+
name = _defaultProps$props.name,
|
|
29
|
+
size = _defaultProps$props.size,
|
|
30
|
+
classPrefix = _defaultProps$props.classPrefix,
|
|
31
|
+
color = _defaultProps$props.color,
|
|
32
|
+
tag = _defaultProps$props.tag,
|
|
33
|
+
children = _defaultProps$props.children,
|
|
34
|
+
className = _defaultProps$props.className,
|
|
35
|
+
fontClassName = _defaultProps$props.fontClassName,
|
|
36
|
+
style = _defaultProps$props.style,
|
|
37
|
+
click = _defaultProps$props.click,
|
|
38
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
39
|
+
|
|
40
|
+
var isImage = name ? name.indexOf('/') !== -1 : false;
|
|
41
|
+
var type = isImage ? 'img' : tag;
|
|
42
|
+
var b = cn('icon');
|
|
43
|
+
|
|
44
|
+
var handleClick = function handleClick(e) {
|
|
45
|
+
if (props.click) {
|
|
46
|
+
props.click(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var hasSrc = function hasSrc() {
|
|
51
|
+
if (isImage) return {
|
|
52
|
+
src: name
|
|
53
|
+
};
|
|
54
|
+
return {};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return React__default.createElement(type, _objectSpread(_objectSpread({
|
|
58
|
+
className: isImage ? "".concat(className || '', " ").concat(b('img')) : "".concat(className || '', " ").concat(fontClassName, " ").concat(b(null, [classPrefix]), " nut-icon-").concat(name, " "),
|
|
59
|
+
style: _objectSpread({
|
|
60
|
+
color: color,
|
|
61
|
+
fontSize: pxCheck(size),
|
|
62
|
+
width: pxCheck(size),
|
|
63
|
+
height: pxCheck(size)
|
|
64
|
+
}, style)
|
|
65
|
+
}, rest), {}, {
|
|
66
|
+
onClick: handleClick
|
|
67
|
+
}, hasSrc()), children);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
Icon.defaultProps = defaultProps;
|
|
71
|
+
Icon.displayName = 'NutIcon';
|
|
72
|
+
export { Icon as I };
|
|
@@ -33,6 +33,8 @@ export { default as Picker } from './Picker.js';
|
|
|
33
33
|
export { default as ShortPassword } from './ShortPassword.js';
|
|
34
34
|
export { default as TextArea } from './TextArea.js';
|
|
35
35
|
export { default as Uploader } from './Uploader.js';
|
|
36
|
+
export { default as SearchBar } from './SearchBar.js';
|
|
37
|
+
export { default as NumberKeyboard } from './NumberKeyboard.js';
|
|
36
38
|
export { default as ActionSheet } from './ActionSheet.js';
|
|
37
39
|
export { default as BackTop } from './BackTop.js';
|
|
38
40
|
export { default as Drag } from './Drag.js';
|
|
@@ -61,6 +63,7 @@ export { default as AnimatingNumbers } from './AnimatingNumbers.js';
|
|
|
61
63
|
export { default as Empty } from './Empty.js';
|
|
62
64
|
export { default as VirtualList } from './VirtualList.js';
|
|
63
65
|
export { default as Video } from './Video.js';
|
|
66
|
+
export { default as Progress } from './Progress.js';
|
|
64
67
|
export { default as Address } from './Address.js';
|
|
65
68
|
export { default as Barrage } from './Barrage.js';
|
|
66
69
|
export { default as Signature } from './Signature.js';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
var MIN_DISTANCE = 10;
|
|
4
|
+
|
|
5
|
+
function getDirection(x, y) {
|
|
6
|
+
if (x > y && x > MIN_DISTANCE) {
|
|
7
|
+
return 'horizontal';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (y > x && y > MIN_DISTANCE) {
|
|
11
|
+
return 'vertical';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function useTouch() {
|
|
18
|
+
var _useState = useState(0),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
startX = _useState2[0],
|
|
21
|
+
SetStartX = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var _useState3 = useState(0),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
startY = _useState4[0],
|
|
26
|
+
SetStartY = _useState4[1];
|
|
27
|
+
|
|
28
|
+
var _useState5 = useState(0),
|
|
29
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
|
+
moveX = _useState6[0],
|
|
31
|
+
SetMoveX = _useState6[1];
|
|
32
|
+
|
|
33
|
+
var _useState7 = useState(0),
|
|
34
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
35
|
+
moveY = _useState8[0],
|
|
36
|
+
SetMoveY = _useState8[1];
|
|
37
|
+
|
|
38
|
+
var _useState9 = useState(0),
|
|
39
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
40
|
+
deltaX = _useState10[0],
|
|
41
|
+
SetDeltaX = _useState10[1];
|
|
42
|
+
|
|
43
|
+
var _useState11 = useState(0),
|
|
44
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
45
|
+
deltaY = _useState12[0],
|
|
46
|
+
SetDeltaY = _useState12[1];
|
|
47
|
+
|
|
48
|
+
var _useState13 = useState(0),
|
|
49
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
50
|
+
offsetX = _useState14[0],
|
|
51
|
+
SetOffsetX = _useState14[1];
|
|
52
|
+
|
|
53
|
+
var _useState15 = useState(0),
|
|
54
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
55
|
+
offsetY = _useState16[0],
|
|
56
|
+
SetOffsetY = _useState16[1];
|
|
57
|
+
|
|
58
|
+
var _useState17 = useState(''),
|
|
59
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
60
|
+
direction = _useState18[0],
|
|
61
|
+
SetDirection = _useState18[1];
|
|
62
|
+
|
|
63
|
+
var isVertical = function isVertical() {
|
|
64
|
+
return direction === 'vertical';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var isHorizontal = function isHorizontal() {
|
|
68
|
+
return direction === 'horizontal';
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var reset = function reset() {
|
|
72
|
+
SetDeltaX(0);
|
|
73
|
+
SetDeltaY(0);
|
|
74
|
+
SetOffsetX(0);
|
|
75
|
+
SetOffsetY(0);
|
|
76
|
+
SetDirection('');
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var start = function start(event) {
|
|
80
|
+
reset();
|
|
81
|
+
SetStartX(event.touches[0].clientX);
|
|
82
|
+
SetStartY(event.touches[0].clientY);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var move = function move(event) {
|
|
86
|
+
var touch = event.touches[0];
|
|
87
|
+
var dX = touch.clientX - startX;
|
|
88
|
+
var dY = touch.clientY - startY;
|
|
89
|
+
SetDeltaX(dX);
|
|
90
|
+
SetDeltaY(dY);
|
|
91
|
+
SetMoveX(touch.clientX);
|
|
92
|
+
SetMoveY(touch.clientY);
|
|
93
|
+
SetOffsetX(Math.abs(dX));
|
|
94
|
+
SetOffsetY(Math.abs(dY));
|
|
95
|
+
|
|
96
|
+
if (!direction) {
|
|
97
|
+
SetDirection(getDirection(offsetX, offsetY));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
move: move,
|
|
103
|
+
start: start,
|
|
104
|
+
reset: reset,
|
|
105
|
+
startX: startX,
|
|
106
|
+
startY: startY,
|
|
107
|
+
moveX: moveX,
|
|
108
|
+
moveY: moveY,
|
|
109
|
+
deltaX: deltaX,
|
|
110
|
+
deltaY: deltaY,
|
|
111
|
+
offsetX: offsetX,
|
|
112
|
+
offsetY: offsetY,
|
|
113
|
+
direction: direction,
|
|
114
|
+
isVertical: isVertical,
|
|
115
|
+
isHorizontal: isHorizontal
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { useTouch as u };
|
package/dist/locales/base.d.ts
CHANGED
|
@@ -89,4 +89,15 @@ export interface BaseLang {
|
|
|
89
89
|
additionalReview: Function;
|
|
90
90
|
additionalImages: Function;
|
|
91
91
|
};
|
|
92
|
+
searchbar: {
|
|
93
|
+
basePlaceholder: string;
|
|
94
|
+
text: string;
|
|
95
|
+
test: string;
|
|
96
|
+
title1: string;
|
|
97
|
+
title2: string;
|
|
98
|
+
title3: string;
|
|
99
|
+
title4: string;
|
|
100
|
+
title5: string;
|
|
101
|
+
title6: string;
|
|
102
|
+
};
|
|
92
103
|
}
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.2.1 Wed Aug
|
|
2
|
+
* @nutui/nutui-react v1.2.1 Wed Aug 10 2022 14:06:51 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -91,6 +91,17 @@ const enUS = {
|
|
|
91
91
|
complaintsText: "I have a complaint",
|
|
92
92
|
additionalReview: (day) => `Review after ${day} days of purchase`,
|
|
93
93
|
additionalImages: (length) => `There are ${length} follow-up comments`
|
|
94
|
+
},
|
|
95
|
+
searchbar: {
|
|
96
|
+
basePlaceholder: "Go to jd.com and buy good things",
|
|
97
|
+
text: "text",
|
|
98
|
+
test: "test",
|
|
99
|
+
title1: "basic usage",
|
|
100
|
+
title2: "search box shape and maximum length",
|
|
101
|
+
title3: "background settings inside and outside the search box",
|
|
102
|
+
title4: "search box text settings",
|
|
103
|
+
title5: "custom icon settings",
|
|
104
|
+
title6: "data change monitoring"
|
|
94
105
|
}
|
|
95
106
|
};
|
|
96
107
|
export { enUS as default };
|