@nutui/nutui-react 1.1.0 → 1.1.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/CHANGELOG.md +9 -0
- package/dist/esm/Address.js +11 -11
- package/dist/esm/AnimatingNumbers.js +1 -1
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/BackTop.js +7 -7
- package/dist/esm/Barrage.js +2 -2
- package/dist/esm/Calendar.js +1 -1
- package/dist/esm/CalendarItem.js +33 -35
- package/dist/esm/Card/style/css.js +1 -0
- package/dist/esm/Card/style/index.js +1 -0
- package/dist/esm/Card.js +68 -0
- package/dist/esm/Cell.js +4 -4
- package/dist/esm/CircleProgress.js +2 -2
- package/dist/esm/Col.js +4 -3
- package/dist/esm/Collapse.js +3 -3
- package/dist/esm/CollapseItem.js +4 -4
- package/dist/esm/DatePicker/style/css.js +1 -0
- package/dist/esm/DatePicker/style/index.js +1 -0
- package/dist/esm/DatePicker.js +322 -0
- package/dist/esm/Divider.js +1 -1
- package/dist/esm/Drag.js +1 -1
- package/dist/esm/Elevator.js +2 -2
- package/dist/esm/FixedNav.js +3 -3
- package/dist/esm/Infiniteloading.js +5 -5
- package/dist/esm/Input.js +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/NoticeBar.js +12 -12
- package/dist/esm/Notify.js +7 -7
- package/dist/esm/Overlay.js +3 -3
- package/dist/esm/Pagination.js +10 -10
- package/dist/esm/Picker.js +13 -6
- package/dist/esm/Popover.js +8 -8
- package/dist/esm/Popup.js +7 -5
- package/dist/esm/Price.js +3 -3
- package/dist/esm/Range.js +3 -3
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/Skeleton/style/css.js +1 -0
- package/dist/esm/Skeleton/style/index.js +1 -0
- package/dist/esm/Skeleton.js +102 -0
- package/dist/esm/Step.js +1 -1
- package/dist/esm/Steps.js +1 -1
- package/dist/esm/Swiper.js +2 -2
- package/dist/esm/SwiperItem.js +2 -2
- package/dist/esm/Switch.js +2 -1
- package/dist/esm/TabPane/style/css.js +1 -0
- package/dist/esm/TabPane/style/index.js +1 -0
- package/dist/esm/TabPane.js +33 -0
- package/dist/esm/Tabs/style/css.js +1 -0
- package/dist/esm/Tabs/style/index.js +1 -0
- package/dist/esm/Tabs.js +187 -0
- package/dist/esm/Tag.js +4 -8
- package/dist/esm/TextArea.js +1 -1
- package/dist/esm/Toast.js +11 -7
- package/dist/esm/Uploader.js +3 -3
- package/dist/esm/{date-649fe493.js → date-b4847376.js} +2 -2
- package/dist/esm/nutui-react.es.js +5 -0
- package/dist/esm/{overlay-418bcf84.js → overlay-ed3eb37d.js} +1 -1
- package/dist/nutui.react.es.js +1250 -567
- package/dist/nutui.react.umd.js +19 -19
- package/dist/packages/card/card.scss +75 -0
- package/dist/packages/datepicker/datepicker.scss +2 -0
- package/dist/packages/skeleton/skeleton.scss +65 -0
- package/dist/packages/tabpane/tabpane.scss +12 -0
- package/dist/packages/tabs/tabs.scss +192 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +5 -0
- package/dist/styles/variables.scss +25 -0
- package/dist/types/address/address.d.ts +1 -1
- package/dist/types/address/existRender.d.ts +1 -1
- package/dist/types/badge/badge.d.ts +1 -1
- package/dist/types/card/card.d.ts +17 -0
- package/dist/types/card/index.d.ts +2 -0
- package/dist/types/datepicker/datepicker.d.ts +16 -0
- package/dist/types/datepicker/index.d.ts +2 -0
- package/dist/types/nutui.react.d.ts +6 -1
- package/dist/types/signature/signature.d.ts +4 -4
- package/dist/types/skeleton/index.d.ts +2 -0
- package/dist/types/skeleton/skeleton.d.ts +18 -0
- package/dist/types/tabpane/index.d.ts +2 -0
- package/dist/types/tabpane/tabpane.d.ts +8 -0
- package/dist/types/tabs/index.d.ts +2 -0
- package/dist/types/tabs/tabs.d.ts +28 -0
- package/package.json +6 -1
package/dist/esm/Picker.js
CHANGED
|
@@ -64,9 +64,9 @@ var InternalPickerSlot = function InternalPickerSlot(props, ref) {
|
|
|
64
64
|
var isHidden = function isHidden(index) {
|
|
65
65
|
if (index >= currIndex + 8 || index <= currIndex - 8) {
|
|
66
66
|
return true;
|
|
67
|
-
} else {
|
|
68
|
-
return false;
|
|
69
67
|
}
|
|
68
|
+
|
|
69
|
+
return false;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
var setTransform = function setTransform() {
|
|
@@ -151,8 +151,8 @@ var InternalPickerSlot = function InternalPickerSlot(props, ref) {
|
|
|
151
151
|
var moveTime = lastTime - touchParams.startTime;
|
|
152
152
|
|
|
153
153
|
if (moveTime <= 300) {
|
|
154
|
-
move
|
|
155
|
-
moveTime
|
|
154
|
+
move *= 2;
|
|
155
|
+
moveTime += 1000;
|
|
156
156
|
setMove(move, 'end', moveTime);
|
|
157
157
|
} else {
|
|
158
158
|
setMove(move, 'end', moveTime);
|
|
@@ -170,6 +170,13 @@ var InternalPickerSlot = function InternalPickerSlot(props, ref) {
|
|
|
170
170
|
return true;
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
|
+
} else if (value && !value.value) {
|
|
174
|
+
listData.some(function (item, idx) {
|
|
175
|
+
if (item == value) {
|
|
176
|
+
index = idx;
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
173
180
|
} else {
|
|
174
181
|
index = listData.indexOf(defaultValue);
|
|
175
182
|
}
|
|
@@ -356,7 +363,7 @@ var InternalPicker = function InternalPicker(props, ref) {
|
|
|
356
363
|
_onClose && _onClose();
|
|
357
364
|
}
|
|
358
365
|
}, React__default.createElement("div", _objectSpread({
|
|
359
|
-
className: "".concat(b(), " ").concat(className
|
|
366
|
+
className: "".concat(b(), " ").concat(className || ''),
|
|
360
367
|
style: style
|
|
361
368
|
}, rest), React__default.createElement("div", {
|
|
362
369
|
className: b('control')
|
|
@@ -367,7 +374,7 @@ var InternalPicker = function InternalPicker(props, ref) {
|
|
|
367
374
|
}
|
|
368
375
|
}, "\u53D6\u6D88"), React__default.createElement("div", {
|
|
369
376
|
className: b('title')
|
|
370
|
-
}, title
|
|
377
|
+
}, title || ''), React__default.createElement("span", {
|
|
371
378
|
className: b('confirm-btn'),
|
|
372
379
|
onClick: function onClick() {
|
|
373
380
|
return confirm();
|
package/dist/esm/Popover.js
CHANGED
|
@@ -213,10 +213,10 @@ var Popover = function Popover(props) {
|
|
|
213
213
|
style.left = 0;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
style.top
|
|
217
|
-
style.left
|
|
218
|
-
style.bottom
|
|
219
|
-
style.right
|
|
216
|
+
style.top += 'px';
|
|
217
|
+
style.left += 'px';
|
|
218
|
+
style.bottom += 'px';
|
|
219
|
+
style.right += 'px';
|
|
220
220
|
return style;
|
|
221
221
|
};
|
|
222
222
|
|
|
@@ -237,10 +237,10 @@ var Popover = function Popover(props) {
|
|
|
237
237
|
style.top = -20;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
style.top
|
|
241
|
-
style.left
|
|
242
|
-
style.bottom
|
|
243
|
-
style.right
|
|
240
|
+
style.top += 'px';
|
|
241
|
+
style.left += 'px';
|
|
242
|
+
style.bottom += 'px';
|
|
243
|
+
style.right += 'px';
|
|
244
244
|
return style;
|
|
245
245
|
};
|
|
246
246
|
|
package/dist/esm/Popup.js
CHANGED
|
@@ -7,10 +7,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import React__default, { useState, useEffect } from 'react';
|
|
9
9
|
import { CSSTransition } from 'react-transition-group';
|
|
10
|
-
import
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import { d as defaultOverlayProps } from './overlay-ed3eb37d.js';
|
|
11
12
|
import Icon from './Icon.js';
|
|
12
13
|
import Overlay from './Overlay.js';
|
|
13
|
-
import classNames from 'classnames';
|
|
14
14
|
import { c as cn } from './bem-893ad28d.js';
|
|
15
15
|
import '@bem-react/classname';
|
|
16
16
|
|
|
@@ -65,7 +65,7 @@ var Popup = function Popup(props) {
|
|
|
65
65
|
onClosed = props.onClosed,
|
|
66
66
|
onClick = props.onClick;
|
|
67
67
|
|
|
68
|
-
var _useState = useState(zIndex
|
|
68
|
+
var _useState = useState(zIndex || _zIndex),
|
|
69
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
70
70
|
index = _useState2[0],
|
|
71
71
|
setIndex = _useState2[1];
|
|
@@ -95,7 +95,9 @@ var Popup = function Popup(props) {
|
|
|
95
95
|
|
|
96
96
|
var popStyles = _objectSpread(_objectSpread({}, style), baseStyle);
|
|
97
97
|
|
|
98
|
-
var classes = classNames((_classNames = {
|
|
98
|
+
var classes = classNames((_classNames = {
|
|
99
|
+
round: round
|
|
100
|
+
}, _defineProperty(_classNames, "popup-".concat(position), true), _defineProperty(_classNames, "".concat(popClass), true), _defineProperty(_classNames, "".concat(className), true), _classNames), b(''));
|
|
99
101
|
var closeClasses = classNames(_defineProperty({
|
|
100
102
|
'nutui-popup__close-icon': true
|
|
101
103
|
}, "nutui-popup__close-icon--".concat(closeIconPosition), true));
|
|
@@ -158,7 +160,7 @@ var Popup = function Popup(props) {
|
|
|
158
160
|
!visible && close();
|
|
159
161
|
}, [visible]);
|
|
160
162
|
useEffect(function () {
|
|
161
|
-
setTransitionName(transition
|
|
163
|
+
setTransitionName(transition || "popup-slide-".concat(position));
|
|
162
164
|
}, [position]);
|
|
163
165
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(Overlay, {
|
|
164
166
|
style: overlayStyles,
|
package/dist/esm/Price.js
CHANGED
|
@@ -54,9 +54,9 @@ var Price = function Price(props) {
|
|
|
54
54
|
|
|
55
55
|
if (thousands) {
|
|
56
56
|
return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
|
|
57
|
-
} else {
|
|
58
|
-
return num;
|
|
59
57
|
}
|
|
58
|
+
|
|
59
|
+
return num;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var formatDecimal = function formatDecimal(decimalNum) {
|
|
@@ -71,7 +71,7 @@ var Price = function Price(props) {
|
|
|
71
71
|
decimalNum = 0;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
var result =
|
|
74
|
+
var result = "0.".concat(decimalNum);
|
|
75
75
|
var resultFixed = Number(result).toFixed(decimalDigits);
|
|
76
76
|
return String(resultFixed).substring(2, resultFixed.length);
|
|
77
77
|
};
|
package/dist/esm/Range.js
CHANGED
|
@@ -362,7 +362,7 @@ var Range = function Range(props) {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
return React__default.createElement("div", {
|
|
365
|
-
className: "nut-range-container ".concat(className
|
|
365
|
+
className: "nut-range-container ".concat(className || '')
|
|
366
366
|
}, !hiddenRange ? React__default.createElement("div", {
|
|
367
367
|
className: "min"
|
|
368
368
|
}, +min) : null, React__default.createElement("div", {
|
|
@@ -404,7 +404,7 @@ var Range = function Range(props) {
|
|
|
404
404
|
onClick: function onClick(e) {
|
|
405
405
|
e.stopPropagation();
|
|
406
406
|
}
|
|
407
|
-
}, button
|
|
407
|
+
}, button || React__default.createElement("div", {
|
|
408
408
|
className: "nut-range-button",
|
|
409
409
|
style: buttonStyle()
|
|
410
410
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
@@ -433,7 +433,7 @@ var Range = function Range(props) {
|
|
|
433
433
|
onClick: function onClick(e) {
|
|
434
434
|
e.stopPropagation();
|
|
435
435
|
}
|
|
436
|
-
}, button
|
|
436
|
+
}, button || React__default.createElement("div", {
|
|
437
437
|
className: "nut-range-button",
|
|
438
438
|
style: buttonStyle()
|
|
439
439
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
@@ -101,9 +101,9 @@ var ShortPassword = function ShortPassword(props) {
|
|
|
101
101
|
|
|
102
102
|
var systemStyle = function systemStyle() {
|
|
103
103
|
var u = navigator.userAgent;
|
|
104
|
-
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
|
|
104
|
+
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // g
|
|
105
105
|
|
|
106
|
-
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
|
106
|
+
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
107
107
|
|
|
108
108
|
if (isIOS) {
|
|
109
109
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/skeleton/skeleton.css')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/skeleton/skeleton.scss')
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "width", "height", "animated", "row", "title", "avatar", "avatarSize", "round", "loading", "children", "avatarShape"];
|
|
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 classNames from 'classnames';
|
|
11
|
+
import Avatar from './Avatar.js';
|
|
12
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
13
|
+
import '@bem-react/classname';
|
|
14
|
+
var defaultProps = {
|
|
15
|
+
width: 100,
|
|
16
|
+
height: 100,
|
|
17
|
+
row: 1,
|
|
18
|
+
animated: false,
|
|
19
|
+
title: false,
|
|
20
|
+
avatar: false,
|
|
21
|
+
round: false,
|
|
22
|
+
avatarSize: '50px',
|
|
23
|
+
loading: false,
|
|
24
|
+
avatarShape: 'round'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var Skeleton = function Skeleton(props) {
|
|
28
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
29
|
+
className = _defaultProps$props.className,
|
|
30
|
+
width = _defaultProps$props.width,
|
|
31
|
+
height = _defaultProps$props.height,
|
|
32
|
+
animated = _defaultProps$props.animated,
|
|
33
|
+
row = _defaultProps$props.row,
|
|
34
|
+
title = _defaultProps$props.title,
|
|
35
|
+
avatar = _defaultProps$props.avatar,
|
|
36
|
+
avatarSize = _defaultProps$props.avatarSize,
|
|
37
|
+
round = _defaultProps$props.round,
|
|
38
|
+
loading = _defaultProps$props.loading,
|
|
39
|
+
children = _defaultProps$props.children,
|
|
40
|
+
avatarShape = _defaultProps$props.avatarShape,
|
|
41
|
+
restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
42
|
+
|
|
43
|
+
var b = cn('skeleton');
|
|
44
|
+
var classes = classNames(className, b());
|
|
45
|
+
var blockClass = classNames({
|
|
46
|
+
blockClass: true,
|
|
47
|
+
'blockClass--round': round
|
|
48
|
+
});
|
|
49
|
+
var avatarClass = classNames(_defineProperty({
|
|
50
|
+
avatarClass: true
|
|
51
|
+
}, "avatarClass--".concat(avatarShape), avatarShape));
|
|
52
|
+
|
|
53
|
+
var repeatLines = function repeatLines(num) {
|
|
54
|
+
return Array.from({
|
|
55
|
+
length: num
|
|
56
|
+
}, function (v, i) {
|
|
57
|
+
return i;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var getStyle = function getStyle() {
|
|
62
|
+
return {
|
|
63
|
+
width: avatarSize,
|
|
64
|
+
height: avatarSize
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return React__default.createElement(React__default.Fragment, null, loading ? React__default.createElement("div", null, children) : React__default.createElement("div", _objectSpread({
|
|
69
|
+
className: classes
|
|
70
|
+
}, restProps), React__default.createElement("div", {
|
|
71
|
+
className: "skeleton-animation"
|
|
72
|
+
}), React__default.createElement("div", {
|
|
73
|
+
className: "nut-skeleton-content"
|
|
74
|
+
}, avatar && React__default.createElement(Avatar, {
|
|
75
|
+
className: avatarClass,
|
|
76
|
+
bgColor: "rgb(239, 239, 239)",
|
|
77
|
+
style: getStyle()
|
|
78
|
+
}), row === 1 ? React__default.createElement("div", {
|
|
79
|
+
className: blockClass,
|
|
80
|
+
style: {
|
|
81
|
+
width: "".concat(width, "px"),
|
|
82
|
+
height: "".concat(height, "px")
|
|
83
|
+
}
|
|
84
|
+
}) : React__default.createElement("div", {
|
|
85
|
+
className: "skeleton-content-line"
|
|
86
|
+
}, title && React__default.createElement("div", {
|
|
87
|
+
className: "skeleton-title"
|
|
88
|
+
}), repeatLines(row).map(function (item, index) {
|
|
89
|
+
return React__default.createElement("div", {
|
|
90
|
+
className: "".concat(blockClass, " skeleton-lines"),
|
|
91
|
+
key: index,
|
|
92
|
+
style: {
|
|
93
|
+
width: "".concat(width, "px"),
|
|
94
|
+
height: "".concat(height, "px")
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
})))));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
Skeleton.defaultProps = defaultProps;
|
|
101
|
+
Skeleton.displayName = 'NutSkeleton';
|
|
102
|
+
export { Skeleton as default };
|
package/dist/esm/Step.js
CHANGED
|
@@ -7,9 +7,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
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
8
|
|
|
9
9
|
import React__default, { useContext } from 'react';
|
|
10
|
+
import classNames from 'classnames';
|
|
10
11
|
import { D as DataContext } from './UserContext-68f62e66.js';
|
|
11
12
|
import { c as cn } from './bem-893ad28d.js';
|
|
12
|
-
import classNames from 'classnames';
|
|
13
13
|
import Icon from './Icon.js';
|
|
14
14
|
import '@bem-react/classname';
|
|
15
15
|
var defaultProps = {
|
package/dist/esm/Steps.js
CHANGED
|
@@ -7,9 +7,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
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
8
|
|
|
9
9
|
import React__default from 'react';
|
|
10
|
+
import classNames from 'classnames';
|
|
10
11
|
import { D as DataContext } from './UserContext-68f62e66.js';
|
|
11
12
|
import { c as cn } from './bem-893ad28d.js';
|
|
12
|
-
import classNames from 'classnames';
|
|
13
13
|
import '@bem-react/classname';
|
|
14
14
|
var defaultProps = {
|
|
15
15
|
current: 0,
|
package/dist/esm/Swiper.js
CHANGED
|
@@ -8,9 +8,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
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; }
|
|
9
9
|
|
|
10
10
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
11
|
+
import classNames from 'classnames';
|
|
11
12
|
import { D as DataContext } from './UserContext-b4181162.js';
|
|
12
13
|
import { c as cn } from './bem-893ad28d.js';
|
|
13
|
-
import classNames from 'classnames';
|
|
14
14
|
import '@bem-react/classname';
|
|
15
15
|
var defaultProps = {
|
|
16
16
|
width: window.innerWidth,
|
|
@@ -129,7 +129,7 @@ var Swiper = React__default.forwardRef(function (props, ref) {
|
|
|
129
129
|
if (child.type && child.type.displayName === 'NutSwiperItem') {
|
|
130
130
|
childs.push(React__default.cloneElement(child, {
|
|
131
131
|
ref: childsRefs[index],
|
|
132
|
-
key:
|
|
132
|
+
key: "item_".concat(index)
|
|
133
133
|
}));
|
|
134
134
|
}
|
|
135
135
|
});
|
package/dist/esm/SwiperItem.js
CHANGED
|
@@ -6,9 +6,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
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
7
|
|
|
8
8
|
import React__default, { useContext, useState, useImperativeHandle } from 'react';
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
import { D as DataContext } from './UserContext-b4181162.js';
|
|
10
11
|
import { c as cn } from './bem-893ad28d.js';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
12
|
import '@bem-react/classname';
|
|
13
13
|
var defaultProps = {
|
|
14
14
|
direction: 'horizontal'
|
|
@@ -48,7 +48,7 @@ var SwiperItem = React__default.forwardRef(function (props, ref) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (offset) {
|
|
51
|
-
style
|
|
51
|
+
style.transform = "translate3D".concat(_direction === 'horizontal' ? "(".concat(offset, "px,0,0)") : "(0,".concat(offset, "px,0)"));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
return style;
|
package/dist/esm/Switch.js
CHANGED
|
@@ -47,9 +47,10 @@ var Switch = function Switch(props) {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
var styles = function styles() {
|
|
50
|
-
var myStyle =
|
|
50
|
+
var myStyle = _objectSpread({
|
|
51
51
|
backgroundColor: value ? activeColor : inactiveColor
|
|
52
52
|
}, style || {});
|
|
53
|
+
|
|
53
54
|
return myStyle;
|
|
54
55
|
};
|
|
55
56
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/tabpane/tabpane.css')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/tabpane/tabpane.scss')
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
10
|
+
import '@bem-react/classname';
|
|
11
|
+
var defaultProps = {
|
|
12
|
+
title: '',
|
|
13
|
+
paneKey: '',
|
|
14
|
+
activeKey: '',
|
|
15
|
+
disabled: false
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var TabPane = function TabPane(props) {
|
|
19
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
20
|
+
children = _defaultProps$props.children,
|
|
21
|
+
paneKey = _defaultProps$props.paneKey,
|
|
22
|
+
activeKey = _defaultProps$props.activeKey;
|
|
23
|
+
|
|
24
|
+
var b = cn('tabpane');
|
|
25
|
+
var classes = classNames({
|
|
26
|
+
active: paneKey === activeKey
|
|
27
|
+
}, b(''));
|
|
28
|
+
return React__default.createElement("div", {
|
|
29
|
+
className: classes
|
|
30
|
+
}, children);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { TabPane as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/tabs/tabs.css')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../../../packages/tabs/tabs.scss')
|
package/dist/esm/Tabs.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
var _excluded = ["value", "color", "background", "direction", "type", "titleScroll", "ellipsis", "animatedTime", "titleGutter", "size", "titleNode", "children", "onClick", "onChange", "className"];
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
15
|
+
import Icon from './Icon.js';
|
|
16
|
+
import '@bem-react/classname';
|
|
17
|
+
|
|
18
|
+
var Title = /*#__PURE__*/_createClass( // eslint-disable-next-line no-useless-constructor
|
|
19
|
+
function Title() {
|
|
20
|
+
_classCallCheck(this, Title);
|
|
21
|
+
|
|
22
|
+
_defineProperty(this, "title", '');
|
|
23
|
+
|
|
24
|
+
_defineProperty(this, "paneKey", '');
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "disabled", false);
|
|
27
|
+
|
|
28
|
+
_defineProperty(this, "index", 0);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var defaultProps = {
|
|
32
|
+
value: 0,
|
|
33
|
+
color: '',
|
|
34
|
+
background: '',
|
|
35
|
+
direction: 'horizontal',
|
|
36
|
+
type: 'line',
|
|
37
|
+
titleScroll: false,
|
|
38
|
+
ellipsis: true,
|
|
39
|
+
animatedTime: 300,
|
|
40
|
+
titleGutter: 0,
|
|
41
|
+
size: 'normal'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var pxCheck = function pxCheck(value) {
|
|
45
|
+
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var Tabs = function Tabs(props) {
|
|
49
|
+
var _classNames;
|
|
50
|
+
|
|
51
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
52
|
+
value = _defaultProps$props.value,
|
|
53
|
+
color = _defaultProps$props.color,
|
|
54
|
+
background = _defaultProps$props.background,
|
|
55
|
+
direction = _defaultProps$props.direction,
|
|
56
|
+
type = _defaultProps$props.type,
|
|
57
|
+
titleScroll = _defaultProps$props.titleScroll,
|
|
58
|
+
ellipsis = _defaultProps$props.ellipsis,
|
|
59
|
+
animatedTime = _defaultProps$props.animatedTime,
|
|
60
|
+
titleGutter = _defaultProps$props.titleGutter,
|
|
61
|
+
size = _defaultProps$props.size,
|
|
62
|
+
titleNode = _defaultProps$props.titleNode,
|
|
63
|
+
children = _defaultProps$props.children,
|
|
64
|
+
onClick = _defaultProps$props.onClick,
|
|
65
|
+
onChange = _defaultProps$props.onChange,
|
|
66
|
+
className = _defaultProps$props.className,
|
|
67
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
68
|
+
|
|
69
|
+
var _useState = useState({
|
|
70
|
+
index: 0
|
|
71
|
+
}),
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
currentItem = _useState2[0],
|
|
74
|
+
setCurrentItem = _useState2[1];
|
|
75
|
+
|
|
76
|
+
var titles = useRef([]);
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
var currentIndex = 0;
|
|
79
|
+
titles.current = []; // eslint-disable-next-line consistent-return
|
|
80
|
+
|
|
81
|
+
React__default.Children.forEach(children, function (child, idx) {
|
|
82
|
+
var _child$props, _child$props2;
|
|
83
|
+
|
|
84
|
+
if (!React__default.isValidElement(child)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var title = new Title();
|
|
89
|
+
|
|
90
|
+
if ((_child$props = child.props) !== null && _child$props !== void 0 && _child$props.title || (_child$props2 = child.props) !== null && _child$props2 !== void 0 && _child$props2.paneKey) {
|
|
91
|
+
var _child$props3, _child$props4, _child$props5;
|
|
92
|
+
|
|
93
|
+
title.title = (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.title;
|
|
94
|
+
title.paneKey = ((_child$props4 = child.props) === null || _child$props4 === void 0 ? void 0 : _child$props4.paneKey) || idx;
|
|
95
|
+
title.disabled = (_child$props5 = child.props) === null || _child$props5 === void 0 ? void 0 : _child$props5.disabled;
|
|
96
|
+
title.index = idx;
|
|
97
|
+
|
|
98
|
+
if (title.paneKey === value) {
|
|
99
|
+
currentIndex = idx;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
titles.current.push(title);
|
|
104
|
+
});
|
|
105
|
+
setCurrentItem(titles.current[currentIndex]);
|
|
106
|
+
}, [children]);
|
|
107
|
+
var b = cn('tabs');
|
|
108
|
+
var classes = classNames(direction, b(''), className);
|
|
109
|
+
var classesTitle = classNames((_classNames = {}, _defineProperty(_classNames, type, type), _defineProperty(_classNames, "scrollable", titleScroll), _defineProperty(_classNames, size, size), _classNames), "".concat(b(''), "__titles"));
|
|
110
|
+
var titleStyle = {
|
|
111
|
+
marginLeft: pxCheck(titleGutter),
|
|
112
|
+
marginRight: pxCheck(titleGutter)
|
|
113
|
+
};
|
|
114
|
+
var tabsActiveStyle = {
|
|
115
|
+
color: type === 'smile' ? color : '',
|
|
116
|
+
background: type === 'line' ? color : ''
|
|
117
|
+
};
|
|
118
|
+
var index = titles.current.findIndex(function (t) {
|
|
119
|
+
return t.paneKey === value;
|
|
120
|
+
});
|
|
121
|
+
var contentStyle = {
|
|
122
|
+
transform: direction === 'horizontal' ? "translate3d(-".concat(index * 100, "%, 0, 0)") : "translate3d( 0,-".concat(index * 100, "%, 0)"),
|
|
123
|
+
transitionDuration: "".concat(animatedTime, "ms")
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var tabChange = function tabChange(item, index) {
|
|
127
|
+
onClick && onClick(item);
|
|
128
|
+
|
|
129
|
+
if (item.disabled) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
setCurrentItem(item);
|
|
134
|
+
onChange && onChange(item);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return React__default.createElement("div", _objectSpread({
|
|
138
|
+
className: classes
|
|
139
|
+
}, rest), React__default.createElement("div", {
|
|
140
|
+
className: classesTitle,
|
|
141
|
+
style: {
|
|
142
|
+
background: background
|
|
143
|
+
}
|
|
144
|
+
}, !!titleNode && typeof titleNode === 'function' ? titleNode() : titles.current.map(function (item, index) {
|
|
145
|
+
return React__default.createElement("div", {
|
|
146
|
+
style: titleStyle,
|
|
147
|
+
onClick: function onClick(e) {
|
|
148
|
+
return tabChange(item);
|
|
149
|
+
},
|
|
150
|
+
className: classNames({
|
|
151
|
+
active: item.paneKey === value,
|
|
152
|
+
disabled: item.disabled
|
|
153
|
+
}, "".concat(b(''), "__titles-item")),
|
|
154
|
+
key: item.paneKey
|
|
155
|
+
}, type === 'line' && React__default.createElement("div", {
|
|
156
|
+
className: "".concat(b(''), "__titles-item__line"),
|
|
157
|
+
style: tabsActiveStyle
|
|
158
|
+
}), type === 'smile' && React__default.createElement("div", {
|
|
159
|
+
className: "".concat(b(''), "__titles-item__smile"),
|
|
160
|
+
style: tabsActiveStyle
|
|
161
|
+
}, React__default.createElement(Icon, {
|
|
162
|
+
color: color,
|
|
163
|
+
name: "joy-smile"
|
|
164
|
+
})), React__default.createElement("div", {
|
|
165
|
+
className: classNames({
|
|
166
|
+
ellipsis: ellipsis && !titleScroll && direction === 'horizontal'
|
|
167
|
+
}, "".concat(b(''), "__titles-item__text"))
|
|
168
|
+
}, item.title));
|
|
169
|
+
})), React__default.createElement("div", {
|
|
170
|
+
className: "".concat(b(''), "__content"),
|
|
171
|
+
style: contentStyle
|
|
172
|
+
}, React__default.Children.map(children, function (child, idx) {
|
|
173
|
+
if (!React__default.isValidElement(child)) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var childProps = _objectSpread(_objectSpread({}, child.props), {}, {
|
|
178
|
+
activeKey: value
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return React__default.cloneElement(child, childProps);
|
|
182
|
+
})));
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
Tabs.defaultProps = defaultProps;
|
|
186
|
+
Tabs.displayName = 'NutTabs';
|
|
187
|
+
export { Tabs as default };
|
package/dist/esm/Tag.js
CHANGED
|
@@ -62,16 +62,12 @@ var Tag = function Tag(props) {
|
|
|
62
62
|
|
|
63
63
|
if (plain) {
|
|
64
64
|
style.background = '#fff';
|
|
65
|
-
} else {
|
|
66
|
-
if (color) {
|
|
67
|
-
style.background = color;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
if (color) {
|
|
72
|
-
style.color = '#fff';
|
|
65
|
+
} else if (color) {
|
|
73
66
|
style.background = color;
|
|
74
67
|
}
|
|
68
|
+
} else if (color) {
|
|
69
|
+
style.color = '#fff';
|
|
70
|
+
style.background = color;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
return style;
|
package/dist/esm/TextArea.js
CHANGED
|
@@ -94,7 +94,7 @@ var TextArea = function TextArea(props) {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
return React__default.createElement("div", {
|
|
97
|
-
className: "".concat(textareaBem(), " ").concat(disabled ? textareaBem('disabled') : '', " ").concat(className
|
|
97
|
+
className: "".concat(textareaBem(), " ").concat(disabled ? textareaBem('disabled') : '', " ").concat(className || '')
|
|
98
98
|
}, React__default.createElement("textarea", {
|
|
99
99
|
className: textareaBem('textarea'),
|
|
100
100
|
style: _objectSpread({
|