@nutui/nutui-react 2.0.0-alpha.0 → 2.0.0-alpha.10
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 +137 -638
- package/dist/esm/Address.js +1 -1
- package/dist/esm/Animate.js +6 -7
- package/dist/esm/Audio.js +28 -27
- package/dist/esm/Avatar.js +30 -25
- package/dist/esm/AvatarGroup.js +10 -15
- package/dist/esm/Badge.js +4 -73
- package/dist/esm/CalendarItem.js +2 -12
- package/dist/esm/Cascader.js +67 -69
- package/dist/esm/Checkbox.js +1 -2
- package/dist/esm/CheckboxGroup.js +18 -20
- package/dist/esm/CircleProgress.js +20 -25
- package/dist/esm/Col.js +4 -3
- package/dist/esm/DatePicker.js +10 -10
- package/dist/esm/Dialog.js +162 -171
- package/dist/esm/Divider.js +4 -3
- package/dist/esm/Drag.js +7 -9
- package/dist/esm/Elevator.js +39 -41
- package/dist/esm/Ellipsis.js +13 -12
- package/dist/esm/Empty.js +18 -26
- package/dist/esm/Image.js +5 -10
- package/dist/esm/ImagePreview.js +67 -58
- package/dist/esm/Indicator.js +4 -4
- package/dist/esm/Input.js +87 -193
- package/dist/esm/Menu.js +75 -73
- package/dist/esm/MenuItem.js +29 -27
- package/dist/esm/NavBar.js +17 -48
- package/dist/esm/NoticeBar.js +50 -87
- package/dist/esm/Notify.js +35 -46
- package/dist/esm/NumberKeyboard.js +137 -195
- package/dist/esm/Picker.js +175 -160
- package/dist/esm/Popup.js +24 -33
- package/dist/esm/Price.js +22 -23
- package/dist/esm/Progress.js +74 -67
- package/dist/esm/PullToRefresh.js +8 -8
- package/dist/esm/Radio.js +2 -0
- package/dist/esm/RadioGroup.js +31 -51
- package/dist/esm/Range/style/index.js +1 -1
- package/dist/esm/Range.js +119 -174
- package/dist/esm/Row.js +6 -5
- package/dist/esm/SideNavBar.js +0 -2
- package/dist/esm/Skeleton.js +1 -1
- package/dist/esm/Step.js +23 -28
- package/dist/esm/Steps/style/index.js +1 -1
- package/dist/esm/Steps.js +10 -11
- package/dist/esm/Swipe.js +4 -10
- package/dist/esm/Swiper.js +86 -91
- package/dist/esm/SwiperItem.js +1 -1
- package/dist/esm/Switch.js +16 -30
- package/dist/esm/TabPane.js +39 -5
- package/dist/esm/Tabbar/style/index.js +1 -1
- package/dist/esm/Tabbar.js +29 -33
- package/dist/esm/TabbarItem.js +5 -75
- package/dist/esm/Table.js +20 -34
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/TextArea.js +53 -81
- package/dist/esm/Uploader.js +49 -52
- package/dist/esm/badge2.js +69 -0
- package/dist/esm/cellgroup2.js +5 -4
- package/dist/esm/checkbox2.js +34 -47
- package/dist/esm/nutui-react.es.js +170 -170
- package/dist/esm/overlay2.js +12 -14
- package/dist/esm/radio2.js +52 -54
- package/dist/esm/raf.js +16 -0
- package/dist/esm/tabbaritem2.js +61 -0
- package/dist/esm/tabs2.js +126 -95
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +23562 -24489
- package/dist/nutui.react.umd.js +23560 -24487
- package/dist/packages/audio/audio.scss +2 -15
- package/dist/packages/badge/badge.scss +8 -18
- package/dist/packages/calendar/calendar.scss +0 -30
- package/dist/packages/cascader/cascader.scss +0 -26
- package/dist/packages/cellgroup/cellgroup.scss +20 -16
- package/dist/packages/checkbox/checkbox.scss +8 -11
- package/dist/packages/circleprogress/circleprogress.scss +0 -9
- package/dist/packages/dialog/dialog.scss +36 -65
- package/dist/packages/elevator/elevator.scss +2 -28
- package/dist/packages/empty/empty.scss +0 -9
- package/dist/packages/imagepreview/imagepreview.scss +52 -16
- package/dist/packages/input/input.scss +13 -180
- package/dist/packages/menu/menu.scss +44 -55
- package/dist/packages/menuitem/menuitem.scss +16 -26
- package/dist/packages/navbar/navbar.scss +16 -115
- package/dist/packages/noticebar/noticebar.scss +18 -19
- package/dist/packages/notify/notify.scss +1 -1
- package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
- package/dist/packages/overlay/overlay.scss +11 -4
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/popup/popup.scss +0 -16
- package/dist/packages/price/price.scss +8 -0
- package/dist/packages/progress/progress.scss +19 -58
- package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
- package/dist/packages/radio/radio.scss +13 -32
- package/dist/packages/radiogroup/radiogroup.scss +17 -51
- package/dist/packages/range/range.scss +24 -49
- package/dist/packages/row/row.scss +13 -31
- package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
- package/dist/packages/step/step.scss +9 -62
- package/dist/packages/steps/steps.scss +2 -0
- package/dist/packages/swiper/swiper.scss +3 -18
- package/dist/packages/switch/switch.scss +13 -31
- package/dist/packages/tabbar/tabbar.scss +16 -22
- package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
- package/dist/packages/table/table.scss +0 -56
- package/dist/packages/tabs/tabs.scss +196 -225
- package/dist/packages/textarea/textarea.scss +5 -12
- package/dist/packages/uploader/uploader.scss +2 -28
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +17 -18
- package/dist/styles/variables-jmapp.scss +120 -240
- package/dist/styles/variables.scss +139 -252
- package/dist/types/index.d.ts +565 -708
- package/package.json +2 -2
- package/dist/esm/Icon.js +0 -83
- package/dist/esm/tabpane2.js +0 -44
- package/dist/packages/icon/icon.scss +0 -0
- /package/dist/esm/{AvatarContext.js → context.js} +0 -0
- /package/dist/esm/{UserContext2.js → context2.js} +0 -0
- /package/dist/esm/{UserContext3.js → context3.js} +0 -0
package/dist/esm/Price.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["price", "symbol", "digits", "thousands", "position", "size", "line", "className", "style"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
6
6
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -23,24 +23,22 @@ function _objectSpread(target) {
|
|
|
23
23
|
return target;
|
|
24
24
|
}
|
|
25
25
|
import React__default from "react";
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
var defaultProps = {
|
|
26
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
29
28
|
price: 0,
|
|
30
|
-
needSymbol: true,
|
|
31
29
|
symbol: "¥",
|
|
32
|
-
|
|
30
|
+
digits: 2,
|
|
33
31
|
thousands: false,
|
|
34
32
|
position: "before",
|
|
35
33
|
size: "large",
|
|
36
|
-
|
|
37
|
-
};
|
|
34
|
+
line: false
|
|
35
|
+
});
|
|
38
36
|
var Price = function Price2(props) {
|
|
39
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), price = _defaultProps$props.price,
|
|
40
|
-
var
|
|
37
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), price = _defaultProps$props.price, symbol = _defaultProps$props.symbol, digits = _defaultProps$props.digits, thousands = _defaultProps$props.thousands, position = _defaultProps$props.position, size = _defaultProps$props.size, line = _defaultProps$props.line, className = _defaultProps$props.className, style = _defaultProps$props.style, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
38
|
+
var classPrefix = "nut-price";
|
|
41
39
|
var showSymbol = function showSymbol2() {
|
|
42
40
|
return {
|
|
43
|
-
__html:
|
|
41
|
+
__html: symbol || ""
|
|
44
42
|
};
|
|
45
43
|
};
|
|
46
44
|
var checkPoint = function checkPoint2(price2) {
|
|
@@ -51,7 +49,7 @@ var Price = function Price2(props) {
|
|
|
51
49
|
num = 0;
|
|
52
50
|
}
|
|
53
51
|
if (checkPoint(num)) {
|
|
54
|
-
num = Number(num).toFixed(
|
|
52
|
+
num = Number(num).toFixed(digits);
|
|
55
53
|
num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
|
|
56
54
|
} else {
|
|
57
55
|
num = num.toString();
|
|
@@ -66,30 +64,31 @@ var Price = function Price2(props) {
|
|
|
66
64
|
decimalNum = 0;
|
|
67
65
|
}
|
|
68
66
|
if (checkPoint(decimalNum)) {
|
|
69
|
-
decimalNum = Number(decimalNum).toFixed(
|
|
67
|
+
decimalNum = Number(decimalNum).toFixed(digits);
|
|
70
68
|
decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] || 0;
|
|
71
69
|
} else {
|
|
72
70
|
decimalNum = 0;
|
|
73
71
|
}
|
|
74
72
|
var result = "0.".concat(decimalNum);
|
|
75
|
-
var resultFixed = Number(result).toFixed(
|
|
73
|
+
var resultFixed = Number(result).toFixed(digits);
|
|
76
74
|
return String(resultFixed).substring(2, resultFixed.length);
|
|
77
75
|
};
|
|
78
76
|
var renderSymbol = function renderSymbol2() {
|
|
79
77
|
return React__default.createElement("div", {
|
|
80
|
-
className: "".concat(
|
|
78
|
+
className: "".concat(classPrefix, "__symbol ").concat(classPrefix, "__symbol-").concat(size),
|
|
81
79
|
dangerouslySetInnerHTML: showSymbol()
|
|
82
80
|
});
|
|
83
81
|
};
|
|
84
82
|
return React__default.createElement("div", _objectSpread({
|
|
85
|
-
className: "".concat(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
className: "".concat(classPrefix, " ").concat(className, " ").concat(line ? "".concat(classPrefix, "--line") : ""),
|
|
84
|
+
style
|
|
85
|
+
}, rest), symbol && position === "before" ? renderSymbol() : null, React__default.createElement("div", {
|
|
86
|
+
className: "".concat(classPrefix, "__integer ").concat(classPrefix, "__integer-").concat(size)
|
|
87
|
+
}, formatThousands(price)), digits !== 0 ? React__default.createElement("div", {
|
|
88
|
+
className: "".concat(classPrefix, "__decimal ").concat(classPrefix, "__decimal-").concat(size)
|
|
90
89
|
}, ".") : null, React__default.createElement("div", {
|
|
91
|
-
className: "".concat(
|
|
92
|
-
}, formatDecimal(price)),
|
|
90
|
+
className: "".concat(classPrefix, "__decimal ").concat(classPrefix, "__decimal-").concat(size)
|
|
91
|
+
}, formatDecimal(price)), symbol && position === "after" ? renderSymbol() : null);
|
|
93
92
|
};
|
|
94
93
|
Price.defaultProps = defaultProps;
|
|
95
94
|
Price.displayName = "NutPrice";
|
package/dist/esm/Progress.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _excluded = ["className", "style", "
|
|
4
|
+
var _excluded = ["className", "style", "percent", "background", "color", "strokeWidth", "showText", "animated", "children", "lazy", "delay"];
|
|
4
5
|
function ownKeys(object, enumerableOnly) {
|
|
5
6
|
var keys = Object.keys(object);
|
|
6
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -22,95 +23,101 @@ function _objectSpread(target) {
|
|
|
22
23
|
}
|
|
23
24
|
return target;
|
|
24
25
|
}
|
|
25
|
-
import React__default from "react";
|
|
26
|
+
import React__default, { useState, useEffect, useRef } from "react";
|
|
26
27
|
import classNames from "classnames";
|
|
27
|
-
import { Checked } from "@nutui/icons-react";
|
|
28
|
-
import { c as cn } from "./bem.js";
|
|
29
28
|
import { C as ComponentDefaults } from "./typings.js";
|
|
30
|
-
import "@bem-react/classname";
|
|
31
29
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
strokeColor: "linear-gradient(135deg, #fa2c19 0%, #fa6419 100%)",
|
|
38
|
-
strokeWidth: "",
|
|
39
|
-
textColor: "",
|
|
40
|
-
textWidth: "",
|
|
41
|
-
showText: true,
|
|
42
|
-
textInside: false,
|
|
43
|
-
textBackground: "linear-gradient(135deg, #fa2c19 0%, #fa6419 100%)",
|
|
44
|
-
textType: "text",
|
|
45
|
-
status: false,
|
|
46
|
-
icon: null,
|
|
47
|
-
children: void 0
|
|
30
|
+
percent: 0,
|
|
31
|
+
showText: false,
|
|
32
|
+
animated: false,
|
|
33
|
+
lazy: false,
|
|
34
|
+
delay: 0
|
|
48
35
|
});
|
|
49
36
|
var Progress = function Progress2(props) {
|
|
50
|
-
var _classNames
|
|
51
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style,
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var classesOuter = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b(""), "-outer"), true), _defineProperty(_classNames, "".concat(b(""), "-").concat(size || "base"), true), _classNames));
|
|
55
|
-
var classesInner = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(b(""), "-inner"), true), _defineProperty(_classNames2, "".concat(b(""), "-active"), status), _classNames2));
|
|
56
|
-
var classesText = classNames(_defineProperty({}, "".concat(b(""), "-text"), true));
|
|
57
|
-
var classesInsideText = classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(b(""), "-text"), true), _defineProperty(_classNames4, "".concat(b(""), "-insidetext"), true), _classNames4));
|
|
58
|
-
var classesTextInner = classNames(_defineProperty({}, "".concat(b(""), "-text__inner"), true));
|
|
37
|
+
var _classNames;
|
|
38
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, percent = _defaultProps$props.percent, background = _defaultProps$props.background, color = _defaultProps$props.color, strokeWidth = _defaultProps$props.strokeWidth, showText = _defaultProps$props.showText, animated = _defaultProps$props.animated, children = _defaultProps$props.children, lazy = _defaultProps$props.lazy, delay = _defaultProps$props.delay, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
39
|
+
var classPrefix = "nut-progress";
|
|
40
|
+
var classesInner = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(classPrefix, "-inner"), true), _defineProperty(_classNames, "".concat(classPrefix, "-active"), animated), _classNames));
|
|
59
41
|
var stylesOuter = {
|
|
60
42
|
height: "".concat(strokeWidth, "px"),
|
|
61
|
-
|
|
62
|
-
background: "".concat(fillColor)
|
|
43
|
+
background
|
|
63
44
|
};
|
|
45
|
+
var _useState = useState(0), _useState2 = _slicedToArray(_useState, 2), displayPercent = _useState2[0], setDispalyPercent = _useState2[1];
|
|
64
46
|
var stylesInner = {
|
|
65
|
-
width: "".concat(
|
|
66
|
-
|
|
67
|
-
background: "".concat(strokeColor)
|
|
47
|
+
width: "".concat(displayPercent, "%"),
|
|
48
|
+
background: color
|
|
68
49
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
50
|
+
useEffect(function() {
|
|
51
|
+
setDispalyPercent(percent);
|
|
52
|
+
}, [percent]);
|
|
53
|
+
var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), intersecting = _useState4[0], setIntersecting = _useState4[1];
|
|
54
|
+
var progressRef = useRef(null);
|
|
55
|
+
var observer = useRef(null);
|
|
56
|
+
var initObserver = function initObserver2() {
|
|
57
|
+
var options = {
|
|
58
|
+
threshold: [0],
|
|
59
|
+
rootMargin: "0px"
|
|
60
|
+
};
|
|
61
|
+
observer.current = new IntersectionObserver(function(entires, self) {
|
|
62
|
+
entires.forEach(function(item) {
|
|
63
|
+
if (item.isIntersecting) {
|
|
64
|
+
setIntersecting(true);
|
|
65
|
+
} else {
|
|
66
|
+
setIntersecting(false);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}, options);
|
|
70
|
+
observer.current.observe(progressRef.current);
|
|
73
71
|
};
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
left: "".concat(percentage, "%")
|
|
77
|
-
};
|
|
78
|
-
var stylesText = {
|
|
79
|
-
width: "".concat(textWidth, "px")
|
|
72
|
+
var resetObserver = function resetObserver2() {
|
|
73
|
+
observer.current.disconnect && observer.current.disconnect();
|
|
80
74
|
};
|
|
75
|
+
useEffect(function() {
|
|
76
|
+
if (lazy) {
|
|
77
|
+
setTimeout(function() {
|
|
78
|
+
if (intersecting) {
|
|
79
|
+
setDispalyPercent(percent);
|
|
80
|
+
} else {
|
|
81
|
+
setDispalyPercent(0);
|
|
82
|
+
}
|
|
83
|
+
}, delay);
|
|
84
|
+
}
|
|
85
|
+
}, [intersecting]);
|
|
86
|
+
useEffect(function() {
|
|
87
|
+
lazy && initObserver();
|
|
88
|
+
var timer = null;
|
|
89
|
+
if (delay) {
|
|
90
|
+
setDispalyPercent(0);
|
|
91
|
+
timer = setTimeout(function() {
|
|
92
|
+
setDispalyPercent(percent);
|
|
93
|
+
}, delay);
|
|
94
|
+
}
|
|
95
|
+
return function() {
|
|
96
|
+
lazy && resetObserver();
|
|
97
|
+
timer && clearTimeout(timer);
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
81
100
|
return React__default.createElement("div", _objectSpread({
|
|
82
|
-
|
|
101
|
+
ref: progressRef,
|
|
102
|
+
className: classNames(classPrefix, className),
|
|
83
103
|
style
|
|
84
104
|
}, rest), React__default.createElement("div", {
|
|
85
|
-
className:
|
|
105
|
+
className: "".concat(classPrefix, "-outer"),
|
|
86
106
|
style: stylesOuter
|
|
87
107
|
}, React__default.createElement("div", {
|
|
88
108
|
className: classesInner,
|
|
89
109
|
style: stylesInner
|
|
90
|
-
}, showText &&
|
|
91
|
-
className:
|
|
92
|
-
style: stylesInsideIcon
|
|
93
|
-
}, children) : React__default.createElement("div", {
|
|
94
|
-
className: classesInsideText,
|
|
95
|
-
style: stylesInsideText
|
|
96
|
-
}, React__default.createElement("span", {
|
|
97
|
-
className: classesTextInner,
|
|
110
|
+
}, showText && React__default.createElement("div", {
|
|
111
|
+
className: "".concat(classPrefix, "-text"),
|
|
98
112
|
style: {
|
|
99
|
-
|
|
113
|
+
left: "".concat(displayPercent, "%")
|
|
100
114
|
}
|
|
101
|
-
},
|
|
102
|
-
className:
|
|
103
|
-
style: stylesText
|
|
104
|
-
}, textType === "text" && React__default.createElement("span", {
|
|
105
|
-
className: classesTextInner,
|
|
115
|
+
}, children || React__default.createElement("div", {
|
|
116
|
+
className: "".concat(classPrefix, "-text__inner"),
|
|
106
117
|
style: {
|
|
107
|
-
|
|
118
|
+
background: color
|
|
108
119
|
}
|
|
109
|
-
},
|
|
110
|
-
width: 16,
|
|
111
|
-
height: 16,
|
|
112
|
-
color: "#439422"
|
|
113
|
-
}))));
|
|
120
|
+
}, percent, "%")))));
|
|
114
121
|
};
|
|
115
122
|
Progress.defaultProps = defaultProps;
|
|
116
123
|
Progress.displayName = "NutProgress";
|
|
@@ -28,6 +28,7 @@ import { useDrag } from "@use-gesture/react";
|
|
|
28
28
|
import { useSpring, animated } from "@react-spring/web";
|
|
29
29
|
import { useConfig } from "./ConfigProvider.js";
|
|
30
30
|
import { c as canUseDom, g as getScrollParent } from "./get-scroll-parent.js";
|
|
31
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
31
32
|
function bound(position, min, max) {
|
|
32
33
|
var ret = position;
|
|
33
34
|
if (min !== void 0) {
|
|
@@ -69,9 +70,7 @@ if (canUseDom) {
|
|
|
69
70
|
console.log(e);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
var defaultProps = {
|
|
73
|
-
className: "",
|
|
74
|
-
style: {},
|
|
73
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
75
74
|
pullingText: "",
|
|
76
75
|
canReleaseText: "",
|
|
77
76
|
refreshingText: "",
|
|
@@ -82,8 +81,9 @@ var defaultProps = {
|
|
|
82
81
|
threshold: 60,
|
|
83
82
|
onRefresh: function onRefresh() {
|
|
84
83
|
}
|
|
85
|
-
};
|
|
84
|
+
});
|
|
86
85
|
var PullToRefresh = function PullToRefresh2(p) {
|
|
86
|
+
var classPrefix = "nut-pulltorefresh";
|
|
87
87
|
var _useConfig = useConfig(), locale = _useConfig.locale;
|
|
88
88
|
var props = _objectSpread(_objectSpread(_objectSpread({}, defaultProps), p), {
|
|
89
89
|
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
@@ -280,18 +280,18 @@ var PullToRefresh = function PullToRefresh2(p) {
|
|
|
280
280
|
};
|
|
281
281
|
return React__default.createElement(animated.div, {
|
|
282
282
|
ref: elementRef,
|
|
283
|
-
className: "
|
|
283
|
+
className: "".concat(classPrefix, " ").concat(props.className),
|
|
284
284
|
style: props.style
|
|
285
285
|
}, React__default.createElement(animated.div, {
|
|
286
286
|
style: springStyles,
|
|
287
|
-
className: "
|
|
287
|
+
className: "".concat(classPrefix, "-head")
|
|
288
288
|
}, React__default.createElement("div", {
|
|
289
|
-
className: "
|
|
289
|
+
className: "".concat(classPrefix, "-head-content"),
|
|
290
290
|
style: {
|
|
291
291
|
height: headHeight
|
|
292
292
|
}
|
|
293
293
|
}, renderStatusText())), React__default.createElement("div", {
|
|
294
|
-
className: "
|
|
294
|
+
className: "".concat(classPrefix, "-content")
|
|
295
295
|
}, props.children));
|
|
296
296
|
};
|
|
297
297
|
PullToRefresh.defaultProps = defaultProps;
|
package/dist/esm/Radio.js
CHANGED
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "className", "value", "defaultValue", "onChange", "labelPosition", "direction", "options", "disabled"], _excluded2 = ["label", "value", "disabled", "onChange"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -23,78 +23,58 @@ function _objectSpread(target) {
|
|
|
23
23
|
}
|
|
24
24
|
return target;
|
|
25
25
|
}
|
|
26
|
-
import React__default, {
|
|
26
|
+
import React__default, { useCallback } from "react";
|
|
27
|
+
import classNames from "classnames";
|
|
27
28
|
import { R as Radio, a as RadioContext } from "./radio2.js";
|
|
28
|
-
import {
|
|
29
|
+
import { u as usePropsValue } from "./use-props-value.js";
|
|
29
30
|
import "@nutui/icons-react";
|
|
30
31
|
import "./RadioGroup.js";
|
|
31
32
|
import "./typings.js";
|
|
32
|
-
import "@bem-react/classname";
|
|
33
33
|
var defaultProps = {
|
|
34
|
-
|
|
35
|
-
textPosition: "right",
|
|
34
|
+
labelPosition: "right",
|
|
36
35
|
onChange: function onChange(value) {
|
|
37
36
|
},
|
|
38
37
|
direction: "vertical",
|
|
39
38
|
options: []
|
|
40
39
|
};
|
|
40
|
+
var classPrefix = "nut-radiogroup";
|
|
41
41
|
var RadioGroup = React__default.forwardRef(function(props, ref) {
|
|
42
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
function validateChildChecked(child) {
|
|
50
|
-
if (val2State === null)
|
|
51
|
-
return false;
|
|
52
|
-
return val2State === child.props.value;
|
|
53
|
-
}
|
|
54
|
-
function validateChecked(value2) {
|
|
55
|
-
if (val2State === null)
|
|
56
|
-
return false;
|
|
57
|
-
return val2State === value2;
|
|
58
|
-
}
|
|
59
|
-
function cloneChildren() {
|
|
60
|
-
return React__default.Children.map(children, function(child, index) {
|
|
61
|
-
var childChecked = validateChildChecked(child);
|
|
62
|
-
if (child.type.displayName !== "NutRadio") {
|
|
63
|
-
return React__default.cloneElement(child);
|
|
64
|
-
}
|
|
65
|
-
return React__default.cloneElement(child, {
|
|
66
|
-
textPosition,
|
|
67
|
-
checked: childChecked
|
|
68
|
-
// onChange: handleChildChange,
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
42
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, onChange2 = _defaultProps$props.onChange, labelPosition = _defaultProps$props.labelPosition, direction = _defaultProps$props.direction, options = _defaultProps$props.options, disabled = _defaultProps$props.disabled, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
43
|
+
var _usePropsValue = usePropsValue({
|
|
44
|
+
defaultValue: props.defaultValue,
|
|
45
|
+
value: props.value,
|
|
46
|
+
finalValue: "",
|
|
47
|
+
onChange: onChange2
|
|
48
|
+
}), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), val2State = _usePropsValue2[0], setVal2State = _usePropsValue2[1];
|
|
72
49
|
var renderOptionsChildren = useCallback(function() {
|
|
73
50
|
return options === null || options === void 0 ? void 0 : options.map(function(_ref) {
|
|
74
|
-
var label = _ref.label, value2 = _ref.value,
|
|
75
|
-
|
|
76
|
-
return React__default.createElement(Radio, _objectSpread(_objectSpread({
|
|
51
|
+
var label = _ref.label, value2 = _ref.value, disabled2 = _ref.disabled, onChange22 = _ref.onChange, rest2 = _objectWithoutProperties(_ref, _excluded2);
|
|
52
|
+
return React__default.createElement(Radio, _objectSpread(_objectSpread({}, rest2), {}, {
|
|
77
53
|
key: value2 === null || value2 === void 0 ? void 0 : value2.toString(),
|
|
78
54
|
children: label,
|
|
79
55
|
value: value2,
|
|
80
|
-
disabled,
|
|
81
|
-
onChange:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
checked: childChecked
|
|
56
|
+
disabled: disabled2,
|
|
57
|
+
onChange: onChange22,
|
|
58
|
+
labelPosition,
|
|
59
|
+
checked: value2 === val2State
|
|
85
60
|
}));
|
|
86
61
|
});
|
|
87
|
-
}, [
|
|
62
|
+
}, [options]);
|
|
88
63
|
return React__default.createElement(RadioContext.Provider, {
|
|
89
64
|
value: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
65
|
+
labelPosition: labelPosition || "right",
|
|
66
|
+
disabled,
|
|
67
|
+
value: val2State,
|
|
68
|
+
check: function check(value2) {
|
|
69
|
+
setVal2State(value2);
|
|
70
|
+
},
|
|
71
|
+
uncheck: function uncheck() {
|
|
72
|
+
setVal2State("");
|
|
93
73
|
}
|
|
94
74
|
}
|
|
95
75
|
}, React__default.createElement("div", _objectSpread({
|
|
96
|
-
className:
|
|
97
|
-
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() :
|
|
76
|
+
className: classNames(classPrefix, className, _defineProperty({}, "".concat(classPrefix, "--").concat(props.direction), props.direction))
|
|
77
|
+
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() : children));
|
|
98
78
|
});
|
|
99
79
|
RadioGroup.defaultProps = defaultProps;
|
|
100
80
|
RadioGroup.displayName = "NutRadioGroup";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import '../../../packages/range/range.scss'
|