@nutui/nutui-react 2.0.0-alpha.3 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/Avatar.js +30 -25
  3. package/dist/esm/AvatarGroup.js +10 -15
  4. package/dist/esm/Badge.js +4 -66
  5. package/dist/esm/Checkbox.js +1 -2
  6. package/dist/esm/CheckboxGroup.js +18 -20
  7. package/dist/esm/CircleProgress.js +20 -25
  8. package/dist/esm/Ellipsis.js +13 -12
  9. package/dist/esm/Empty.js +18 -26
  10. package/dist/esm/Input.js +87 -193
  11. package/dist/esm/Skeleton.js +1 -1
  12. package/dist/esm/Swipe.js +4 -10
  13. package/dist/esm/Tabbar/style/index.js +1 -1
  14. package/dist/esm/Tabbar.js +29 -33
  15. package/dist/esm/TabbarItem.js +5 -75
  16. package/dist/esm/badge2.js +69 -0
  17. package/dist/esm/cellgroup2.js +5 -4
  18. package/dist/esm/checkbox2.js +34 -47
  19. package/dist/esm/tabbaritem2.js +61 -0
  20. package/dist/locales/base.js +1 -1
  21. package/dist/locales/en-US.js +1 -1
  22. package/dist/locales/id-ID.js +1 -1
  23. package/dist/locales/zh-CN.js +1 -1
  24. package/dist/locales/zh-TW.js +1 -1
  25. package/dist/locales/zh-UG.js +1 -1
  26. package/dist/nutui.react.mjs +846 -997
  27. package/dist/nutui.react.umd.js +846 -997
  28. package/dist/packages/badge/badge.scss +0 -1
  29. package/dist/packages/cellgroup/cellgroup.scss +20 -16
  30. package/dist/packages/checkbox/checkbox.scss +8 -11
  31. package/dist/packages/circleprogress/circleprogress.scss +0 -9
  32. package/dist/packages/empty/empty.scss +0 -9
  33. package/dist/packages/input/input.scss +13 -180
  34. package/dist/packages/tabbar/tabbar.scss +16 -22
  35. package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
  36. package/dist/style.css +1 -1
  37. package/dist/style.mjs +1 -1
  38. package/dist/styles/themes/default.scss +0 -1
  39. package/dist/styles/variables-jmapp.scss +12 -16
  40. package/dist/styles/variables.scss +12 -16
  41. package/dist/types/index.d.ts +80 -126
  42. package/package.json +1 -1
  43. package/dist/esm/Icon.js +0 -83
  44. package/dist/packages/icon/icon.scss +0 -0
  45. /package/dist/esm/{AvatarContext.js → context.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v2.0.0-alpha.5
2
+ `2023-05-10`
3
+
4
+ * 🛠 refactor: checkbox (#974) @oasis-cloud
5
+ * 🛠 refactor: circleprogress-v2.0 (#949) @junjun666
6
+ * 🛠 refactor: ellipsis-v2.0 (#963) @junjun666
7
+ * 🛠 refactor: empty-v2.0 (#977) @junjun666
8
+ * 🛠 refactor: swipe (#958) @justExplore
9
+ * 🛠 refactor:avatar-v2.0 (#970) @junjun666
10
+ * 📖 docs: 增加 icon 的复制功能 (#973) @oasis-cloud
11
+ * :sparkles: feat: cellgroup组件增加单元格之间是否展示分割线props (#961) @拧巴的猫
12
+ * :bug: fix: tabbar 通过 Tabbar.Item 方式使用未加载 item 的样式 (#972) @oasis-cloud
13
+ * :bug: fix: 修复elevator小程序快速滑动后闪动问题 (#984) @拧巴的猫
14
+
15
+
16
+ # v2.0.0-alpha.4
17
+ `2023-05-05`
18
+
19
+ * 🛠 refactor: circleprogress-v2.0 (#949) @junjun666
20
+ * 🛠 refactor: input (#962) @oasis-cloud
21
+ * 🛠 refactor: Tabbar (#935) @Eiinu
22
+ * :bug: fix: badge 组件的默认样式中,去掉 margin-right (#967) @xiaoyatong
23
+ * 🎨 style: fix endLine display error (#964) @HaiTao
24
+
1
25
  # v2.0.0-alpha.3
2
26
  `2023-04-28`
3
27
 
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["children", "prefixCls", "size", "shape", "bgColor", "color", "url", "alt", "icon", "className", "style", "activeAvatar", "onActiveAvatar", "onError"];
4
+ var _excluded = ["children", "size", "shape", "background", "color", "src", "alt", "icon", "fit", "className", "style", "onClick", "onError"];
5
5
  function ownKeys(object, enumerableOnly) {
6
6
  var keys = Object.keys(object);
7
7
  if (Object.getOwnPropertySymbols) {
@@ -25,41 +25,42 @@ function _objectSpread(target) {
25
25
  }
26
26
  import React__default, { useState, useRef, useContext, useEffect } from "react";
27
27
  import classNames from "classnames";
28
- import { A as AvatarContext } from "./AvatarContext.js";
29
- import { c as cn } from "./bem.js";
28
+ import { A as AvatarContext } from "./context.js";
29
+ import { My } from "@nutui/icons-react";
30
+ import Image from "./Image.js";
30
31
  import { C as ComponentDefaults } from "./typings.js";
31
- import "@bem-react/classname";
32
32
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
33
33
  size: "",
34
+ shape: "round",
34
35
  icon: "",
35
- bgColor: "#eee",
36
+ background: "#eee",
36
37
  color: "#666",
37
- prefixCls: "nut-avatar",
38
- url: "",
38
+ fit: "cover",
39
+ src: "",
39
40
  alt: ""
40
41
  });
42
+ var classPrefix = "nut-avatar";
41
43
  var Avatar = function Avatar2(props) {
42
44
  var _parent$propAvatarGro, _parent$propAvatarGro2, _classNames, _parent$propAvatarGro3, _parent$propAvatarGro4, _parent$propAvatarGro5, _parent$propAvatarGro6, _parent$propAvatarGro7, _parent$propAvatarGro9, _parent$propAvatarGro10, _parent$propAvatarGro11, _parent$propAvatarGro12, _parent$propAvatarGro13, _parent$propAvatarGro14, _parent$propAvatarGro15;
43
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, prefixCls = _defaultProps$props.prefixCls, size = _defaultProps$props.size, shape = _defaultProps$props.shape, bgColor = _defaultProps$props.bgColor, color = _defaultProps$props.color, url = _defaultProps$props.url, alt = _defaultProps$props.alt, icon = _defaultProps$props.icon, className = _defaultProps$props.className, style = _defaultProps$props.style, activeAvatar = _defaultProps$props.activeAvatar, onActiveAvatar = _defaultProps$props.onActiveAvatar, onError = _defaultProps$props.onError, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
45
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, size = _defaultProps$props.size, shape = _defaultProps$props.shape, background = _defaultProps$props.background, color = _defaultProps$props.color, src = _defaultProps$props.src, alt = _defaultProps$props.alt, icon = _defaultProps$props.icon, fit = _defaultProps$props.fit, className = _defaultProps$props.className, style = _defaultProps$props.style, onClick = _defaultProps$props.onClick, onError = _defaultProps$props.onError, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
44
46
  var _useState = useState(0), _useState2 = _slicedToArray(_useState, 2), maxSum = _useState2[0], setMaxSum = _useState2[1];
45
47
  var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), showMax = _useState4[0], setShowMax = _useState4[1];
46
48
  var _useState5 = useState(1), _useState6 = _slicedToArray(_useState5, 2), avatarIndex = _useState6[0], setAvatarIndex = _useState6[1];
47
49
  var avatarRef = useRef(null);
48
50
  var parent = useContext(AvatarContext);
49
- var b = cn("avatar");
50
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat(size || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat(shape || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || "round"), true), _classNames));
51
- var cls = classNames(b(""), classes, className);
52
51
  var sizeValue = ["large", "normal", "small"];
52
+ var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || size || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || shape), true), _classNames));
53
+ var cls = classNames(classPrefix, classes, className);
53
54
  var styles = _objectSpread({
54
55
  width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
55
56
  height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
56
- backgroundColor: "".concat(bgColor),
57
+ backgroundColor: "".concat(background),
57
58
  color: "".concat(color),
58
- marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.span ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.span, "px") : "",
59
- zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.zIndex) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
59
+ marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.gap ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.gap, "px") : "",
60
+ zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
60
61
  }, style);
61
62
  var maxStyles = {
62
- backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
63
+ backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBackground),
63
64
  color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
64
65
  };
65
66
  useEffect(function() {
@@ -77,40 +78,44 @@ var Avatar = function Avatar2(props) {
77
78
  }
78
79
  }
79
80
  var index = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef$current = avatarRef.current) === null || _avatarRef$current === void 0 ? void 0 : (_avatarRef$current$da = _avatarRef$current.dataset) === null || _avatarRef$current$da === void 0 ? void 0 : _avatarRef$current$da.index);
80
- var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
81
+ var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.max;
81
82
  setMaxSum(children2.length);
82
83
  setAvatarIndex(index);
83
84
  if (index === children2.length && index !== maxCount && children2.length > maxCount) {
84
85
  setShowMax(true);
85
86
  }
86
87
  };
87
- var errorEvent = function errorEvent2(e) {
88
+ var errorEvent = function errorEvent2() {
88
89
  if (props.onError) {
89
- props.onError(e);
90
+ props.onError();
90
91
  }
91
92
  };
92
93
  var clickAvatar = function clickAvatar2(e) {
93
- activeAvatar && activeAvatar(e);
94
- onActiveAvatar && onActiveAvatar(e);
94
+ onClick && onClick(e);
95
95
  };
96
- return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.maxCount)) && React__default.createElement("div", _objectSpread(_objectSpread({
96
+ return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.max)) && React__default.createElement("div", _objectSpread(_objectSpread({
97
97
  className: cls
98
98
  }, rest), {}, {
99
99
  style: !showMax ? styles : maxStyles,
100
100
  onClick: clickAvatar,
101
101
  ref: avatarRef
102
- }), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.maxCount)) && React__default.createElement(React__default.Fragment, null, url && React__default.createElement("img", {
102
+ }), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.max)) && React__default.createElement(React__default.Fragment, null, src && React__default.createElement(Image, {
103
103
  className: "avatar-img",
104
- src: url,
104
+ src,
105
105
  alt,
106
+ style: {
107
+ objectFit: fit
108
+ },
106
109
  onError: errorEvent
107
110
  }), React__default.isValidElement(icon) ? React__default.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
108
111
  className: "".concat(icon.props.className || "", " icon")
109
112
  })) : null, children && React__default.createElement("span", {
110
113
  className: "text"
111
- }, children)), showMax && React__default.createElement("div", {
114
+ }, children), !src && !icon && !children && React__default.createElement(My, {
115
+ className: "icon"
116
+ })), showMax && React__default.createElement("div", {
112
117
  className: "text"
113
- }, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.maxCount)))));
118
+ }, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.max)))));
114
119
  };
115
120
  Avatar.defaultProps = defaultProps;
116
121
  Avatar.displayName = "NutAvatar";
@@ -22,27 +22,22 @@ function _objectSpread(target) {
22
22
  }
23
23
  import React__default, { useRef } from "react";
24
24
  import classNames from "classnames";
25
- import { A as AvatarContext } from "./AvatarContext.js";
26
- import { c as cn } from "./bem.js";
27
- import { useConfig } from "./ConfigProvider.js";
28
- import "@bem-react/classname";
29
- var defaultProps = {
25
+ import { A as AvatarContext } from "./context.js";
26
+ import { C as ComponentDefaults } from "./typings.js";
27
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
30
28
  maxContent: "",
31
- maxCount: "",
32
- maxBgColor: "#eee",
29
+ max: "",
30
+ maxBackground: "#eee",
33
31
  maxColor: "#666",
34
- size: "",
35
- shape: "",
36
- span: "-8",
37
- zIndex: "left"
38
- };
32
+ gap: "-8",
33
+ level: "left"
34
+ });
35
+ var classPrefix = "nut-avatar-group";
39
36
  var AvatarGroup = function AvatarGroup2(props) {
40
- useConfig();
41
37
  var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
42
38
  var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
43
39
  var avatarGroupRef = useRef(null);
44
- var b = cn("avatar-group");
45
- var cls = classNames(b(""), className);
40
+ var cls = classNames(classPrefix, className);
46
41
  var parentAvatar = {
47
42
  propAvatarGroup,
48
43
  avatarGroupRef
package/dist/esm/Badge.js CHANGED
@@ -1,69 +1,7 @@
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";
1
+ import { B as Badge } from "./badge2.js";
2
+ import "react";
3
+ import "classnames";
4
+ import "./typings.js";
67
5
  export {
68
6
  Badge as default
69
7
  };
@@ -1,9 +1,8 @@
1
1
  import { C as Checkbox } from "./checkbox2.js";
2
2
  import "react";
3
3
  import "@nutui/icons-react";
4
+ import "classnames";
4
5
  import "./CheckboxGroup.js";
5
- import "./bem.js";
6
- import "@bem-react/classname";
7
6
  import "./typings.js";
8
7
  import "./use-props-value.js";
9
8
  export {
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- var _excluded = ["className", "disabled", "onChange", "value", "defaultValue", "max", "textPosition", "direction", "options"], _excluded2 = ["label", "value", "disabled", "onChange"];
5
+ var _excluded = ["className", "disabled", "onChange", "value", "defaultValue", "max", "labelPosition", "direction", "options"], _excluded2 = ["label", "value", "disabled", "onChange"];
6
6
  function ownKeys(object, enumerableOnly) {
7
7
  var keys = Object.keys(object);
8
8
  if (Object.getOwnPropertySymbols) {
@@ -25,52 +25,51 @@ function _objectSpread(target) {
25
25
  return target;
26
26
  }
27
27
  import React__default, { useImperativeHandle, useCallback } from "react";
28
- import { c as cn } from "./bem.js";
28
+ import classNames from "classnames";
29
29
  import { C as Checkbox, a as Context } from "./checkbox2.js";
30
30
  import { u as usePropsValue } from "./use-props-value.js";
31
- import "@bem-react/classname";
32
31
  import "@nutui/icons-react";
33
32
  import "./CheckboxGroup.js";
34
33
  import "./typings.js";
35
34
  var defaultProps = {
36
- disabled: false,
37
35
  max: void 0,
38
- textPosition: "right",
36
+ labelPosition: "right",
39
37
  direction: "vertical",
40
38
  onChange: function onChange(value) {
41
39
  },
42
40
  options: []
43
41
  };
42
+ var classPrefix = "nut-checkboxgroup";
44
43
  var CheckboxGroup = React__default.forwardRef(function(props, ref) {
44
+ var _classNames;
45
45
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children;
46
- var b = cn("checkboxgroup");
47
- var className = props.className, disabled = props.disabled, onChange2 = props.onChange, value = props.value, defaultValue = props.defaultValue, max = props.max, textPosition = props.textPosition, direction = props.direction, options = props.options, rest = _objectWithoutProperties(props, _excluded);
46
+ var className = props.className, disabled = props.disabled, onChange2 = props.onChange, value = props.value, defaultValue = props.defaultValue, max = props.max, labelPosition = props.labelPosition, direction = props.direction, options = props.options, rest = _objectWithoutProperties(props, _excluded);
48
47
  useImperativeHandle(ref, function() {
49
48
  return {
50
- toggleAll: function toggleAll(state) {
49
+ toggle: function toggle(state) {
51
50
  if (state === false) {
52
51
  setValue([]);
53
52
  } else {
54
53
  var childrenLabel = [];
55
54
  React__default.Children.map(children, function(child) {
56
55
  var childProps = child.props;
57
- childrenLabel.push(childProps.label || child.children);
56
+ childrenLabel.push(childProps.value);
58
57
  });
59
58
  setValue(childrenLabel);
60
59
  }
61
60
  },
62
- toggleReverse: function toggleReverse() {
61
+ reverse: function reverse() {
63
62
  var childrenLabel = [];
64
63
  React__default.Children.map(children, function(child) {
65
64
  var childProps = child.props;
66
- childrenLabel.push(childProps.label || child.children);
65
+ childrenLabel.push(childProps.value);
67
66
  });
68
- var reverse = childrenLabel.filter(function(c) {
67
+ var reverse2 = childrenLabel.filter(function(c) {
69
68
  return (_value === null || _value === void 0 ? void 0 : _value.findIndex(function(v) {
70
69
  return v === c;
71
70
  })) === -1;
72
71
  });
73
- setValue(reverse);
72
+ setValue(reverse2);
74
73
  }
75
74
  };
76
75
  });
@@ -85,32 +84,31 @@ var CheckboxGroup = React__default.forwardRef(function(props, ref) {
85
84
  var label = _ref.label, value2 = _ref.value, disabled2 = _ref.disabled, onChange22 = _ref.onChange, rest2 = _objectWithoutProperties(_ref, _excluded2);
86
85
  return React__default.createElement(Checkbox, _objectSpread({
87
86
  key: value2 === null || value2 === void 0 ? void 0 : value2.toString(),
88
- children: label,
89
- label: value2
87
+ label,
88
+ disabled: disabled2,
89
+ value: value2
90
90
  }, rest2));
91
91
  });
92
92
  }, [options, max]);
93
93
  return React__default.createElement(Context.Provider, {
94
94
  value: {
95
- textPosition: textPosition || "left",
95
+ labelPosition: labelPosition || "right",
96
96
  disabled,
97
97
  max,
98
- checkedValue: _value,
98
+ value: _value,
99
99
  check: function check(value2) {
100
100
  var combined = [].concat(_toConsumableArray(_value), [value2]);
101
101
  setValue(combined);
102
- onChange2 && onChange2(combined);
103
102
  },
104
103
  uncheck: function uncheck(value2) {
105
104
  var reduced = _value.filter(function(item) {
106
105
  return item !== value2;
107
106
  });
108
107
  setValue(reduced);
109
- onChange2 && onChange2(reduced);
110
108
  }
111
109
  }
112
110
  }, React__default.createElement("div", _objectSpread({
113
- className: "".concat(b(), " nut-checkboxgroup--").concat(props.direction, " ").concat(className || "")
111
+ className: classNames(classPrefix, (_classNames = {}, _defineProperty(_classNames, "nut-checkboxgroup--".concat(props.direction), props.direction), _defineProperty(_classNames, "className", className), _classNames))
114
112
  }, rest), options !== null && options !== void 0 && options.length ? renderOptions() : children));
115
113
  });
116
114
  CheckboxGroup.defaultProps = defaultProps;
@@ -1,6 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "progress", "className", "radius", "pathColor", "clockwise", "circleColor", "strokeWidth", "style", "strokeLinecap"];
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ var _excluded = ["children", "percent", "className", "radius", "clockwise", "strokeWidth", "color", "background", "style", "strokeLinecap"];
4
4
  function ownKeys(object, enumerableOnly) {
5
5
  var keys = Object.keys(object);
6
6
  if (Object.getOwnPropertySymbols) {
@@ -25,34 +25,33 @@ function _objectSpread(target) {
25
25
  import React__default from "react";
26
26
  import classNames from "classnames";
27
27
  import { a as isObject } from "./index.js";
28
- import { c as cn } from "./bem.js";
29
- import "@bem-react/classname";
30
- var defaultProps = {
28
+ import { C as ComponentDefaults } from "./typings.js";
29
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
31
30
  strokeWidth: 5,
32
31
  radius: 50,
33
32
  strokeLinecap: "round",
34
- circleColor: "",
35
- pathColor: "",
33
+ color: "#fa2c19",
34
+ background: "#e5e9f2",
36
35
  clockwise: true
37
- };
36
+ });
37
+ var classPrefix = "nut-circleprogress";
38
38
  var CircleProgress = function CircleProgress2(props) {
39
39
  var _stop;
40
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, progress = _defaultProps$props.progress, className = _defaultProps$props.className, radius = _defaultProps$props.radius, pathColor = _defaultProps$props.pathColor, clockwise = _defaultProps$props.clockwise, circleColor = _defaultProps$props.circleColor, strokeWidth = _defaultProps$props.strokeWidth, style = _defaultProps$props.style, strokeLinecap = _defaultProps$props.strokeLinecap, restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
41
- var b = cn("circleprogress");
42
- var classes = classNames(className, b(""));
40
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, percent = _defaultProps$props.percent, className = _defaultProps$props.className, radius = _defaultProps$props.radius, clockwise = _defaultProps$props.clockwise, strokeWidth = _defaultProps$props.strokeWidth, color = _defaultProps$props.color, background = _defaultProps$props.background, style = _defaultProps$props.style, strokeLinecap = _defaultProps$props.strokeLinecap, restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
41
+ var classes = classNames(className, classPrefix);
43
42
  var refRandomId = Math.random().toString(36).slice(-8);
44
43
  var styles = _objectSpread({
45
44
  height: "".concat(Number(radius) * 2, "px"),
46
45
  width: "".concat(Number(radius) * 2, "px")
47
46
  }, style);
48
47
  var pathStyle = {
49
- stroke: pathColor
48
+ stroke: background
50
49
  };
51
50
  var hoverStyle = function hoverStyle2() {
52
51
  var perimeter = 283;
53
- var offset = perimeter * Number(progress) / 100;
52
+ var offset = perimeter * Number(percent) / 100;
54
53
  return {
55
- stroke: isObject(circleColor) ? "url(#".concat(refRandomId, ")") : circleColor,
54
+ stroke: isObject(color) ? "url(#".concat(refRandomId, ")") : color,
56
55
  strokeDasharray: "".concat(offset, "px ").concat(perimeter, "px")
57
56
  };
58
57
  };
@@ -60,16 +59,13 @@ var CircleProgress = function CircleProgress2(props) {
60
59
  var isWise = clockwise ? 1 : 0;
61
60
  return "M 50 50 m -45 0 a 45 45 0 1 ".concat(isWise, " 90 0 a 45 45 0 1 ").concat(isWise, " -90 0");
62
61
  };
63
- var hoverColor = function hoverColor2() {
64
- return isObject(circleColor) ? "url(#".concat(refRandomId, ")") : circleColor;
65
- };
66
62
  var stop = function stop2() {
67
- if (!isObject(circleColor)) {
63
+ if (!isObject(props.color)) {
68
64
  return;
69
65
  }
70
- var color = circleColor;
71
- var colorArr = Object.keys(color).sort(function(a, b2) {
72
- return parseFloat(a) - parseFloat(b2);
66
+ var color2 = props.color;
67
+ var colorArr = Object.keys(color2).sort(function(a, b) {
68
+ return parseFloat(a) - parseFloat(b);
73
69
  });
74
70
  var stopArr = [];
75
71
  colorArr.map(function(item) {
@@ -78,7 +74,7 @@ var CircleProgress = function CircleProgress2(props) {
78
74
  value: ""
79
75
  };
80
76
  obj.key = item;
81
- obj.value = color[item];
77
+ obj.value = color2[item];
82
78
  stopArr.push(obj);
83
79
  });
84
80
  return stopArr;
@@ -102,8 +98,8 @@ var CircleProgress = function CircleProgress2(props) {
102
98
  });
103
99
  }))), React__default.createElement("path", {
104
100
  className: "nut-circleprogress-path",
105
- style: pathStyle,
106
101
  d: path(),
102
+ style: pathStyle,
107
103
  fill: "none",
108
104
  strokeWidth
109
105
  }), React__default.createElement("path", {
@@ -111,13 +107,12 @@ var CircleProgress = function CircleProgress2(props) {
111
107
  style: hoverStyle(),
112
108
  d: path(),
113
109
  fill: "none",
114
- stroke: hoverColor(),
115
110
  strokeLinecap,
116
111
  transform: "rotate(90,50,50)",
117
112
  strokeWidth
118
113
  })), React__default.createElement("div", {
119
114
  className: "nut-circleprogress-text"
120
- }, children || React__default.createElement("div", null, progress, "%")));
115
+ }, children));
121
116
  };
122
117
  CircleProgress.defaultProps = defaultProps;
123
118
  CircleProgress.displayName = "NutCircleProgress";
@@ -1,5 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["children", "content", "className", "direction", "rows", "expandText", "collapseText", "symbol", "lineHeight", "onClick", "onChange"];
3
5
  function ownKeys(object, enumerableOnly) {
4
6
  var keys = Object.keys(object);
5
7
  if (Object.getOwnPropertySymbols) {
@@ -21,9 +23,10 @@ function _objectSpread(target) {
21
23
  }
22
24
  return target;
23
25
  }
24
- import React__default, { useState, useRef, useLayoutEffect, useEffect } from "react";
25
- import { useConfig } from "./ConfigProvider.js";
26
- var defaultProps = {
26
+ import React__default, { useState, useRef, useLayoutEffect } from "react";
27
+ import classNames from "classnames";
28
+ import { C as ComponentDefaults } from "./typings.js";
29
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
27
30
  content: "",
28
31
  direction: "end",
29
32
  rows: 1,
@@ -31,21 +34,19 @@ var defaultProps = {
31
34
  collapseText: "",
32
35
  symbol: "...",
33
36
  lineHeight: "20"
34
- };
37
+ });
38
+ var classPrefix = "nut-ellipsis";
35
39
  var Ellipsis = function Ellipsis2(props) {
36
40
  var _ellipsis$current, _ellipsis$current2;
37
- useConfig();
38
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, content = _defaultProps$props.content, direction = _defaultProps$props.direction, rows = _defaultProps$props.rows, expandText = _defaultProps$props.expandText, collapseText = _defaultProps$props.collapseText, symbol = _defaultProps$props.symbol, lineHeight = _defaultProps$props.lineHeight, onClick = _defaultProps$props.onClick, onChange = _defaultProps$props.onChange;
41
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, content = _defaultProps$props.content, className = _defaultProps$props.className, direction = _defaultProps$props.direction, rows = _defaultProps$props.rows, expandText = _defaultProps$props.expandText, collapseText = _defaultProps$props.collapseText, symbol = _defaultProps$props.symbol, lineHeight = _defaultProps$props.lineHeight, onClick = _defaultProps$props.onClick, onChange = _defaultProps$props.onChange, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
39
42
  var container = null;
40
43
  var maxHeight = 0;
41
44
  var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), exceeded = _useState2[0], setExceeded = _useState2[1];
42
45
  var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), expanded = _useState4[0], setExpanded = _useState4[1];
43
46
  var ellipsis = useRef();
44
47
  var root = useRef(null);
48
+ var classes = classNames(classPrefix, className);
45
49
  useLayoutEffect(function() {
46
- createContainer();
47
- }, []);
48
- useEffect(function() {
49
50
  if (content) {
50
51
  createContainer();
51
52
  }
@@ -153,11 +154,11 @@ var Ellipsis = function Ellipsis2(props) {
153
154
  var handleClick = function handleClick2() {
154
155
  onClick && onClick();
155
156
  };
156
- return React__default.createElement("div", {
157
- className: "nut-ellipsis",
157
+ return React__default.createElement("div", _objectSpread({
158
+ className: classes,
158
159
  onClick: handleClick,
159
160
  ref: root
160
- }, React__default.createElement("div", null, !exceeded ? content : null, exceeded && !expanded ? React__default.createElement(React__default.Fragment, null, (_ellipsis$current = ellipsis.current) === null || _ellipsis$current === void 0 ? void 0 : _ellipsis$current.leading, expandText ? React__default.createElement("span", {
161
+ }, rest), React__default.createElement("div", null, !exceeded ? content : null, exceeded && !expanded ? React__default.createElement(React__default.Fragment, null, (_ellipsis$current = ellipsis.current) === null || _ellipsis$current === void 0 ? void 0 : _ellipsis$current.leading, expandText ? React__default.createElement("span", {
161
162
  className: "nut-ellipsis-text",
162
163
  onClick: function onClick2(e) {
163
164
  e.stopPropagation();