@nutui/nutui-react 2.0.0-alpha.3 → 2.0.0-alpha.4
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/Badge.js +4 -66
- package/dist/esm/CircleProgress.js +20 -25
- package/dist/esm/Input.js +87 -193
- package/dist/esm/Tabbar.js +29 -33
- package/dist/esm/TabbarItem.js +5 -75
- package/dist/esm/badge2.js +69 -0
- package/dist/esm/tabbaritem2.js +61 -0
- 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 +630 -837
- package/dist/nutui.react.umd.js +630 -837
- package/dist/packages/badge/badge.scss +0 -1
- package/dist/packages/circleprogress/circleprogress.scss +0 -9
- package/dist/packages/input/input.scss +13 -180
- package/dist/packages/tabbar/tabbar.scss +16 -23
- package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +12 -16
- package/dist/styles/variables.scss +12 -16
- package/dist/types/index.d.ts +46 -80
- package/package.json +1 -1
package/dist/esm/TabbarItem.js
CHANGED
|
@@ -1,78 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
7
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8
|
-
})), keys.push.apply(keys, symbols);
|
|
9
|
-
}
|
|
10
|
-
return keys;
|
|
11
|
-
}
|
|
12
|
-
function _objectSpread(target) {
|
|
13
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
15
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
16
|
-
_defineProperty(target, key, source[key]);
|
|
17
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
18
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
}
|
|
23
|
-
import React__default, { useEffect } from "react";
|
|
24
|
-
import { c as cn } from "./bem.js";
|
|
25
|
-
import { C as ComponentDefaults } from "./typings.js";
|
|
26
|
-
import "@bem-react/classname";
|
|
27
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
28
|
-
dot: false,
|
|
29
|
-
className: "",
|
|
30
|
-
tabTitle: "",
|
|
31
|
-
icon: null,
|
|
32
|
-
href: "",
|
|
33
|
-
num: "",
|
|
34
|
-
active: false,
|
|
35
|
-
activeColor: "",
|
|
36
|
-
unactiveColor: "",
|
|
37
|
-
index: 0,
|
|
38
|
-
handleClick: function handleClick(idx) {
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
var TabbarItem = function TabbarItem2(props) {
|
|
42
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), dot = _defaultProps$props.dot, className = _defaultProps$props.className, style = _defaultProps$props.style, tabTitle = _defaultProps$props.tabTitle, icon = _defaultProps$props.icon, href = _defaultProps$props.href, num = _defaultProps$props.num, active = _defaultProps$props.active, activeColor = _defaultProps$props.activeColor, unactiveColor = _defaultProps$props.unactiveColor, index = _defaultProps$props.index, handleClick2 = _defaultProps$props.handleClick;
|
|
43
|
-
var b = cn("tabbar-item");
|
|
44
|
-
var bIcon = cn("tabbar-item__icon-box");
|
|
45
|
-
useEffect(function() {
|
|
46
|
-
if (active && href) {
|
|
47
|
-
window.location.href = href;
|
|
48
|
-
}
|
|
49
|
-
}, [active, href]);
|
|
50
|
-
return React__default.createElement("div", {
|
|
51
|
-
className: "".concat(b({
|
|
52
|
-
active
|
|
53
|
-
}), " ").concat(className),
|
|
54
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
55
|
-
color: active ? activeColor : unactiveColor
|
|
56
|
-
}),
|
|
57
|
-
onClick: function onClick() {
|
|
58
|
-
handleClick2(index);
|
|
59
|
-
}
|
|
60
|
-
}, React__default.createElement("div", {
|
|
61
|
-
className: "".concat(bIcon())
|
|
62
|
-
}, !dot ? React__default.createElement(React__default.Fragment, null, num && num <= 99 && React__default.createElement("div", {
|
|
63
|
-
className: "".concat(bIcon("tips", [bIcon("num")]))
|
|
64
|
-
}, num), num && num >= 100 && React__default.createElement("div", {
|
|
65
|
-
className: "".concat(bIcon("tips", [bIcon("nums")]))
|
|
66
|
-
}, "99+")) : React__default.createElement("div", {
|
|
67
|
-
className: "".concat(bIcon("tips", [bIcon("dot")]))
|
|
68
|
-
}), icon || null), tabTitle && React__default.createElement("div", {
|
|
69
|
-
className: bIcon({
|
|
70
|
-
"nav-word": true
|
|
71
|
-
}, [bIcon({
|
|
72
|
-
"big-word": !icon
|
|
73
|
-
})])
|
|
74
|
-
}, tabTitle));
|
|
75
|
-
};
|
|
1
|
+
import { T as TabbarItem } from "./tabbaritem2.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "classnames";
|
|
4
|
+
import "./typings.js";
|
|
5
|
+
import "./badge2.js";
|
|
76
6
|
export {
|
|
77
7
|
TabbarItem as default
|
|
78
8
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(object, enumerableOnly) {
|
|
4
|
+
var keys = Object.keys(object);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
9
|
+
})), keys.push.apply(keys, symbols);
|
|
10
|
+
}
|
|
11
|
+
return keys;
|
|
12
|
+
}
|
|
13
|
+
function _objectSpread(target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
16
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
17
|
+
_defineProperty(target, key, source[key]);
|
|
18
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
19
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
import React__default from "react";
|
|
25
|
+
import classNames from "classnames";
|
|
26
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
27
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
28
|
+
value: "",
|
|
29
|
+
dot: false,
|
|
30
|
+
max: 99,
|
|
31
|
+
top: "0",
|
|
32
|
+
right: "5",
|
|
33
|
+
color: ""
|
|
34
|
+
});
|
|
35
|
+
var Badge = function Badge2(props) {
|
|
36
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, value = _defaultProps$props.value, max = _defaultProps$props.max, children = _defaultProps$props.children, dot = _defaultProps$props.dot, top = _defaultProps$props.top, right = _defaultProps$props.right, color = _defaultProps$props.color;
|
|
37
|
+
var classPrefix = "nut-badge";
|
|
38
|
+
var classes = classNames(classPrefix, className);
|
|
39
|
+
var contentClasses = classNames(_defineProperty({}, "".concat(classPrefix, "__dot"), dot), "".concat(classPrefix, "__content"), "".concat(classPrefix, "__sup"));
|
|
40
|
+
function content() {
|
|
41
|
+
if (dot || _typeof(value) === "object")
|
|
42
|
+
return null;
|
|
43
|
+
if (typeof value === "number" && typeof max === "number") {
|
|
44
|
+
return max < value ? "".concat(max, "+") : value;
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
var getStyle = function getStyle2() {
|
|
49
|
+
var style2 = {};
|
|
50
|
+
style2.top = "".concat(Number(top) || parseFloat(top) || 0, "px");
|
|
51
|
+
style2.right = "".concat(Number(right) || parseFloat(right) || 0, "px");
|
|
52
|
+
style2.background = color;
|
|
53
|
+
return style2;
|
|
54
|
+
};
|
|
55
|
+
return React__default.createElement("div", {
|
|
56
|
+
className: classes,
|
|
57
|
+
style
|
|
58
|
+
}, _typeof(value) === "object" && value && React__default.createElement("div", {
|
|
59
|
+
className: "".concat(classPrefix, "__icon")
|
|
60
|
+
}, value), React__default.createElement("div", null, children), React__default.createElement("div", {
|
|
61
|
+
className: contentClasses,
|
|
62
|
+
style: getStyle()
|
|
63
|
+
}, content()));
|
|
64
|
+
};
|
|
65
|
+
Badge.defaultProps = defaultProps;
|
|
66
|
+
Badge.displayName = "NutBadge";
|
|
67
|
+
export {
|
|
68
|
+
Badge as B
|
|
69
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["className", "style", "title", "icon", "active", "activeColor", "inactiveColor", "index", "handleClick"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) {
|
|
5
|
+
var keys = Object.keys(object);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
|
+
})), keys.push.apply(keys, symbols);
|
|
11
|
+
}
|
|
12
|
+
return keys;
|
|
13
|
+
}
|
|
14
|
+
function _objectSpread(target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
18
|
+
_defineProperty(target, key, source[key]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
20
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return target;
|
|
24
|
+
}
|
|
25
|
+
import React__default from "react";
|
|
26
|
+
import classNames from "classnames";
|
|
27
|
+
import { C as ComponentDefaults } from "./typings.js";
|
|
28
|
+
import { B as Badge } from "./badge2.js";
|
|
29
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
30
|
+
title: "",
|
|
31
|
+
icon: null,
|
|
32
|
+
active: false,
|
|
33
|
+
index: 0,
|
|
34
|
+
handleClick: function handleClick(idx) {
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var TabbarItem = function TabbarItem2(props) {
|
|
38
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, title = _defaultProps$props.title, icon = _defaultProps$props.icon, active = _defaultProps$props.active, activeColor = _defaultProps$props.activeColor, inactiveColor = _defaultProps$props.inactiveColor, index = _defaultProps$props.index, handleClick2 = _defaultProps$props.handleClick, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
39
|
+
var classPrefix = "nut-tabbar-item";
|
|
40
|
+
var tabbarItemClass = classNames(className, classPrefix, _defineProperty({}, "".concat(classPrefix, "-active"), active));
|
|
41
|
+
var boxPrefix = "".concat(classPrefix, "__icon-box");
|
|
42
|
+
var titleClass = classNames(boxPrefix, "".concat(boxPrefix, "-nav"), _defineProperty({}, "".concat(boxPrefix, "-large"), !icon));
|
|
43
|
+
return React__default.createElement("div", {
|
|
44
|
+
className: tabbarItemClass,
|
|
45
|
+
style: _objectSpread({
|
|
46
|
+
color: active ? activeColor : inactiveColor
|
|
47
|
+
}, style),
|
|
48
|
+
onClick: function onClick() {
|
|
49
|
+
return handleClick2(index);
|
|
50
|
+
}
|
|
51
|
+
}, icon ? React__default.createElement(React__default.Fragment, null, React__default.createElement(Badge, _objectSpread({}, rest), React__default.createElement("div", {
|
|
52
|
+
className: boxPrefix
|
|
53
|
+
}, icon)), React__default.createElement("div", {
|
|
54
|
+
className: titleClass
|
|
55
|
+
}, title)) : React__default.createElement(Badge, _objectSpread({}, rest), React__default.createElement("div", {
|
|
56
|
+
className: titleClass
|
|
57
|
+
}, title)));
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
TabbarItem as T
|
|
61
|
+
};
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED