@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.
Files changed (126) hide show
  1. package/CHANGELOG.md +137 -638
  2. package/dist/esm/Address.js +1 -1
  3. package/dist/esm/Animate.js +6 -7
  4. package/dist/esm/Audio.js +28 -27
  5. package/dist/esm/Avatar.js +30 -25
  6. package/dist/esm/AvatarGroup.js +10 -15
  7. package/dist/esm/Badge.js +4 -73
  8. package/dist/esm/CalendarItem.js +2 -12
  9. package/dist/esm/Cascader.js +67 -69
  10. package/dist/esm/Checkbox.js +1 -2
  11. package/dist/esm/CheckboxGroup.js +18 -20
  12. package/dist/esm/CircleProgress.js +20 -25
  13. package/dist/esm/Col.js +4 -3
  14. package/dist/esm/DatePicker.js +10 -10
  15. package/dist/esm/Dialog.js +162 -171
  16. package/dist/esm/Divider.js +4 -3
  17. package/dist/esm/Drag.js +7 -9
  18. package/dist/esm/Elevator.js +39 -41
  19. package/dist/esm/Ellipsis.js +13 -12
  20. package/dist/esm/Empty.js +18 -26
  21. package/dist/esm/Image.js +5 -10
  22. package/dist/esm/ImagePreview.js +67 -58
  23. package/dist/esm/Indicator.js +4 -4
  24. package/dist/esm/Input.js +87 -193
  25. package/dist/esm/Menu.js +75 -73
  26. package/dist/esm/MenuItem.js +29 -27
  27. package/dist/esm/NavBar.js +17 -48
  28. package/dist/esm/NoticeBar.js +50 -87
  29. package/dist/esm/Notify.js +35 -46
  30. package/dist/esm/NumberKeyboard.js +137 -195
  31. package/dist/esm/Picker.js +175 -160
  32. package/dist/esm/Popup.js +24 -33
  33. package/dist/esm/Price.js +22 -23
  34. package/dist/esm/Progress.js +74 -67
  35. package/dist/esm/PullToRefresh.js +8 -8
  36. package/dist/esm/Radio.js +2 -0
  37. package/dist/esm/RadioGroup.js +31 -51
  38. package/dist/esm/Range/style/index.js +1 -1
  39. package/dist/esm/Range.js +119 -174
  40. package/dist/esm/Row.js +6 -5
  41. package/dist/esm/SideNavBar.js +0 -2
  42. package/dist/esm/Skeleton.js +1 -1
  43. package/dist/esm/Step.js +23 -28
  44. package/dist/esm/Steps/style/index.js +1 -1
  45. package/dist/esm/Steps.js +10 -11
  46. package/dist/esm/Swipe.js +4 -10
  47. package/dist/esm/Swiper.js +86 -91
  48. package/dist/esm/SwiperItem.js +1 -1
  49. package/dist/esm/Switch.js +16 -30
  50. package/dist/esm/TabPane.js +39 -5
  51. package/dist/esm/Tabbar/style/index.js +1 -1
  52. package/dist/esm/Tabbar.js +29 -33
  53. package/dist/esm/TabbarItem.js +5 -75
  54. package/dist/esm/Table.js +20 -34
  55. package/dist/esm/Tabs.js +2 -2
  56. package/dist/esm/TextArea.js +53 -81
  57. package/dist/esm/Uploader.js +49 -52
  58. package/dist/esm/badge2.js +69 -0
  59. package/dist/esm/cellgroup2.js +5 -4
  60. package/dist/esm/checkbox2.js +34 -47
  61. package/dist/esm/nutui-react.es.js +170 -170
  62. package/dist/esm/overlay2.js +12 -14
  63. package/dist/esm/radio2.js +52 -54
  64. package/dist/esm/raf.js +16 -0
  65. package/dist/esm/tabbaritem2.js +61 -0
  66. package/dist/esm/tabs2.js +126 -95
  67. package/dist/locales/base.js +1 -1
  68. package/dist/locales/en-US.js +1 -1
  69. package/dist/locales/id-ID.js +1 -1
  70. package/dist/locales/zh-CN.js +1 -1
  71. package/dist/locales/zh-TW.js +1 -1
  72. package/dist/locales/zh-UG.js +1 -1
  73. package/dist/nutui.react.mjs +23562 -24489
  74. package/dist/nutui.react.umd.js +23560 -24487
  75. package/dist/packages/audio/audio.scss +2 -15
  76. package/dist/packages/badge/badge.scss +8 -18
  77. package/dist/packages/calendar/calendar.scss +0 -30
  78. package/dist/packages/cascader/cascader.scss +0 -26
  79. package/dist/packages/cellgroup/cellgroup.scss +20 -16
  80. package/dist/packages/checkbox/checkbox.scss +8 -11
  81. package/dist/packages/circleprogress/circleprogress.scss +0 -9
  82. package/dist/packages/dialog/dialog.scss +36 -65
  83. package/dist/packages/elevator/elevator.scss +2 -28
  84. package/dist/packages/empty/empty.scss +0 -9
  85. package/dist/packages/imagepreview/imagepreview.scss +52 -16
  86. package/dist/packages/input/input.scss +13 -180
  87. package/dist/packages/menu/menu.scss +44 -55
  88. package/dist/packages/menuitem/menuitem.scss +16 -26
  89. package/dist/packages/navbar/navbar.scss +16 -115
  90. package/dist/packages/noticebar/noticebar.scss +18 -19
  91. package/dist/packages/notify/notify.scss +1 -1
  92. package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
  93. package/dist/packages/overlay/overlay.scss +11 -4
  94. package/dist/packages/picker/picker.scss +66 -137
  95. package/dist/packages/popup/popup.scss +0 -16
  96. package/dist/packages/price/price.scss +8 -0
  97. package/dist/packages/progress/progress.scss +19 -58
  98. package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
  99. package/dist/packages/radio/radio.scss +13 -32
  100. package/dist/packages/radiogroup/radiogroup.scss +17 -51
  101. package/dist/packages/range/range.scss +24 -49
  102. package/dist/packages/row/row.scss +13 -31
  103. package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
  104. package/dist/packages/step/step.scss +9 -62
  105. package/dist/packages/steps/steps.scss +2 -0
  106. package/dist/packages/swiper/swiper.scss +3 -18
  107. package/dist/packages/switch/switch.scss +13 -31
  108. package/dist/packages/tabbar/tabbar.scss +16 -22
  109. package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
  110. package/dist/packages/table/table.scss +0 -56
  111. package/dist/packages/tabs/tabs.scss +196 -225
  112. package/dist/packages/textarea/textarea.scss +5 -12
  113. package/dist/packages/uploader/uploader.scss +2 -28
  114. package/dist/style.css +1 -1
  115. package/dist/style.mjs +1 -1
  116. package/dist/styles/themes/default.scss +17 -18
  117. package/dist/styles/variables-jmapp.scss +120 -240
  118. package/dist/styles/variables.scss +139 -252
  119. package/dist/types/index.d.ts +565 -708
  120. package/package.json +2 -2
  121. package/dist/esm/Icon.js +0 -83
  122. package/dist/esm/tabpane2.js +0 -44
  123. package/dist/packages/icon/icon.scss +0 -0
  124. /package/dist/esm/{AvatarContext.js → context.js} +0 -0
  125. /package/dist/esm/{UserContext2.js → context2.js} +0 -0
  126. /package/dist/esm/{UserContext3.js → context3.js} +0 -0
package/dist/esm/Steps.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- var _excluded = ["children", "current", "direction", "className", "progressDot", "clickStep", "onClickStep"];
3
+ var _excluded = ["children", "value", "direction", "className", "dot", "onStepClick"];
4
4
  function ownKeys(object, enumerableOnly) {
5
5
  var keys = Object.keys(object);
6
6
  if (Object.getOwnPropertySymbols) {
@@ -24,23 +24,22 @@ function _objectSpread(target) {
24
24
  }
25
25
  import React__default from "react";
26
26
  import classNames from "classnames";
27
- import { D as DataContext } from "./UserContext2.js";
28
- import { c as cn } from "./bem.js";
29
- import "@bem-react/classname";
30
- var defaultProps = {
31
- current: 0,
27
+ import { D as DataContext } from "./context2.js";
28
+ import { C as ComponentDefaults } from "./typings.js";
29
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
30
+ value: 0,
32
31
  direction: "horizontal",
33
- progressDot: false
34
- };
32
+ dot: false
33
+ });
35
34
  var Steps = function Steps2(props) {
36
35
  var _classNames;
37
36
  var propSteps = _objectSpread(_objectSpread({}, defaultProps), props);
38
- var children = propSteps.children, current = propSteps.current, direction = propSteps.direction, className = propSteps.className, progressDot = propSteps.progressDot, clickStep = propSteps.clickStep, onClickStep = propSteps.onClickStep, restProps = _objectWithoutProperties(propSteps, _excluded);
37
+ var children = propSteps.children, value = propSteps.value, direction = propSteps.direction, className = propSteps.className, dot = propSteps.dot, onStepClick = propSteps.onStepClick, restProps = _objectWithoutProperties(propSteps, _excluded);
39
38
  var parentSteps = {
40
39
  propSteps
41
40
  };
42
- var b = cn("steps");
43
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b(""), "-").concat(direction), true), _defineProperty(_classNames, "".concat(b(""), "-dot"), !!props.progressDot), _classNames), className, b(""));
41
+ var classPrefix = "nut-steps";
42
+ var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(classPrefix, "-").concat(direction), true), _defineProperty(_classNames, "".concat(classPrefix, "-dot"), !!props.dot), _classNames), className, classPrefix);
44
43
  return React__default.createElement(DataContext.Provider, {
45
44
  value: parentSteps
46
45
  }, React__default.createElement("div", _objectSpread({
package/dist/esm/Swipe.js CHANGED
@@ -21,7 +21,7 @@ function _objectSpread(target) {
21
21
  }
22
22
  return target;
23
23
  }
24
- import React__default, { forwardRef, useRef, useState, useMemo, useCallback, useImperativeHandle, useEffect } from "react";
24
+ import React__default, { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from "react";
25
25
  import classNames from "classnames";
26
26
  import { c as cn } from "./bem.js";
27
27
  import { u as useTouch } from "./use-touch.js";
@@ -36,9 +36,7 @@ function preventDefault(event, isStopPropagation) {
36
36
  }
37
37
  }
38
38
  var defaultProps = {
39
- name: "",
40
- leftWidth: 0,
41
- rightWidth: 0
39
+ name: ""
42
40
  };
43
41
  var Swipe = forwardRef(function(props, instanceRef) {
44
42
  var swipeBem = cn("swipe");
@@ -60,12 +58,8 @@ var Swipe = forwardRef(function(props, instanceRef) {
60
58
  transform: "translate3d(".concat(state.offset, "px, 0, 0)"),
61
59
  transitionDuration: state.dragging ? "0s" : ".6s"
62
60
  };
63
- var leftWidth = useMemo(function() {
64
- return props.leftWidth ? props.leftWidth : actionWidth.left;
65
- }, [props.leftWidth, actionWidth.left]);
66
- var rightWidth = useMemo(function() {
67
- return props.rightWidth ? props.rightWidth : actionWidth.right;
68
- }, [props.rightWidth, actionWidth.right]);
61
+ var leftWidth = actionWidth.left;
62
+ var rightWidth = actionWidth.right;
69
63
  var _onTouchStart = function onTouchStart(event) {
70
64
  if (!props.disabled) {
71
65
  startOffset.current = state.offset;
@@ -2,7 +2,7 @@ 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
4
  import _typeof from "@babel/runtime/helpers/typeof";
5
- var _excluded = ["children", "direction", "className", "pageContent", "onChange", "initPage", "paginationColor", "paginationVisible", "touchable", "isPreventDefault", "isStopPropagation", "autoPlay", "isCenter", "paginationBgColor"];
5
+ var _excluded = ["children", "direction", "className", "onChange", "defaultValue", "indicator", "touchable", "preventDefault", "stopPropagation", "autoPlay", "center"];
6
6
  function ownKeys(object, enumerableOnly) {
7
7
  var keys = Object.keys(object);
8
8
  if (Object.getOwnPropertySymbols) {
@@ -26,35 +26,32 @@ function _objectSpread(target) {
26
26
  }
27
27
  import React__default, { useRef, useState, useMemo, useEffect } from "react";
28
28
  import classNames from "classnames";
29
- import { D as DataContext } from "./UserContext3.js";
30
- import { c as cn } from "./bem.js";
29
+ import { D as DataContext } from "./context3.js";
31
30
  import { g as getRect } from "./use-client-rect.js";
32
- import "@bem-react/classname";
31
+ import Indicator from "./Indicator.js";
33
32
  var defaultProps = {
34
33
  width: (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window.innerWidth : 375,
35
34
  height: 0,
36
35
  duration: 500,
37
- initPage: 0,
36
+ defaultValue: 0,
38
37
  autoPlay: 0,
39
38
  direction: "horizontal",
40
- paginationColor: "#fff",
41
- paginationBgColor: "#ddd",
42
- paginationVisible: false,
43
- loop: true,
39
+ indicator: false,
40
+ loop: false,
44
41
  touchable: true,
45
- isPreventDefault: true,
46
- isStopPropagation: true,
47
- isCenter: false,
42
+ preventDefault: true,
43
+ stopPropagation: true,
44
+ center: false,
48
45
  className: ""
49
46
  };
50
47
  var DISTANCE = 5;
51
48
  var Swiper = React__default.forwardRef(function(props, ref) {
52
- var _classNames, _classNames2;
49
+ var _classNames;
53
50
  var propSwiper = _objectSpread(_objectSpread({}, defaultProps), props);
54
- var children = propSwiper.children, direction = propSwiper.direction, className = propSwiper.className, pageContent = propSwiper.pageContent, onChange = propSwiper.onChange, initPage = propSwiper.initPage, paginationColor = propSwiper.paginationColor, paginationVisible = propSwiper.paginationVisible, touchable = propSwiper.touchable, isPreventDefault = propSwiper.isPreventDefault, isStopPropagation = propSwiper.isStopPropagation, autoPlay = propSwiper.autoPlay, isCenter = propSwiper.isCenter, paginationBgColor = propSwiper.paginationBgColor, rest = _objectWithoutProperties(propSwiper, _excluded);
51
+ var children = propSwiper.children, direction = propSwiper.direction, className = propSwiper.className, onChange = propSwiper.onChange, defaultValue = propSwiper.defaultValue, indicator = propSwiper.indicator, touchable = propSwiper.touchable, preventDefault = propSwiper.preventDefault, stopPropagation = propSwiper.stopPropagation, autoPlay = propSwiper.autoPlay, center = propSwiper.center, rest = _objectWithoutProperties(propSwiper, _excluded);
55
52
  var container = useRef(null);
56
53
  var innerRef = useRef(null);
57
- var _swiper = useRef({
54
+ var swiperRef = useRef({
58
55
  moving: false,
59
56
  autoplayTimer: null,
60
57
  width: 0,
@@ -81,7 +78,7 @@ var Swiper = React__default.forwardRef(function(props, ref) {
81
78
  stateDirection: "",
82
79
  delta: 0,
83
80
  touchTime: 0
84
- }), _useState16 = _slicedToArray(_useState15, 2), touch = _useState16[0], setTouch = _useState16[1];
81
+ }), _useState16 = _slicedToArray(_useState15, 1), touch = _useState16[0];
85
82
  var _useMemo = useMemo(function() {
86
83
  var childCount2 = 0;
87
84
  var childs2 = React__default.Children.map(props.children, function(child) {
@@ -108,20 +105,20 @@ var Swiper = React__default.forwardRef(function(props, ref) {
108
105
  return 0;
109
106
  }();
110
107
  var stopAutoPlay = function stopAutoPlay2() {
111
- clearTimeout(_swiper.current.autoplayTimer);
112
- _swiper.current.autoplayTimer = null;
108
+ clearTimeout(swiperRef.current.autoplayTimer);
109
+ swiperRef.current.autoplayTimer = null;
113
110
  };
114
- var autoplay = function autoplay2() {
111
+ var startPlay = function startPlay2() {
115
112
  if (propSwiper.autoPlay <= 0 || childCount <= 1)
116
113
  return;
117
114
  stopAutoPlay();
118
- _swiper.current.autoplayTimer = setTimeout(function() {
115
+ swiperRef.current.autoplayTimer = setTimeout(function() {
119
116
  next();
120
- autoplay2();
117
+ startPlay2();
121
118
  }, Number(propSwiper.autoPlay));
122
119
  };
123
- var resettPosition = function resettPosition2() {
124
- _swiper.current.moving = true;
120
+ var resetPosition = function resetPosition2() {
121
+ swiperRef.current.moving = true;
125
122
  if (active <= -1) {
126
123
  move({
127
124
  pace: childCount
@@ -134,11 +131,11 @@ var Swiper = React__default.forwardRef(function(props, ref) {
134
131
  }
135
132
  };
136
133
  var prev = function prev2() {
137
- resettPosition();
138
- touchReset();
134
+ resetPosition();
135
+ resetTouchDetails();
139
136
  requestFrame(function() {
140
137
  requestFrame(function() {
141
- _swiper.current.moving = false;
138
+ swiperRef.current.moving = false;
142
139
  move({
143
140
  pace: -1,
144
141
  isEmit: true
@@ -147,11 +144,11 @@ var Swiper = React__default.forwardRef(function(props, ref) {
147
144
  });
148
145
  };
149
146
  var next = function next2() {
150
- resettPosition();
151
- touchReset();
147
+ resetPosition();
148
+ resetTouchDetails();
152
149
  requestFrame(function() {
153
150
  requestFrame(function() {
154
- _swiper.current.moving = false;
151
+ swiperRef.current.moving = false;
155
152
  move({
156
153
  pace: 1,
157
154
  isEmit: true
@@ -160,11 +157,11 @@ var Swiper = React__default.forwardRef(function(props, ref) {
160
157
  });
161
158
  };
162
159
  var to = function to2(index) {
163
- resettPosition();
164
- touchReset();
160
+ resetPosition();
161
+ resetTouchDetails();
165
162
  requestFrame(function() {
166
163
  requestFrame(function() {
167
- _swiper.current.moving = false;
164
+ swiperRef.current.moving = false;
168
165
  var targetIndex;
169
166
  if (props.loop && childCount === index) {
170
167
  targetIndex = active === 0 ? 0 : index;
@@ -241,7 +238,7 @@ var Swiper = React__default.forwardRef(function(props, ref) {
241
238
  return "vertical";
242
239
  return "";
243
240
  };
244
- var touchReset = function touchReset2() {
241
+ var resetTouchDetails = function resetTouchDetails2() {
245
242
  touch.startX = 0;
246
243
  touch.startY = 0;
247
244
  touch.deltaX = 0;
@@ -253,11 +250,11 @@ var Swiper = React__default.forwardRef(function(props, ref) {
253
250
  touch.touchTime = 0;
254
251
  };
255
252
  var touchStart = function touchStart2(e) {
256
- touchReset();
253
+ resetTouchDetails();
257
254
  touch.startX = e.touches[0].clientX;
258
255
  touch.startY = e.touches[0].clientY;
259
256
  };
260
- var touchMove = function touchMove2(e) {
257
+ var handleTouchMove = function handleTouchMove2(e) {
261
258
  touch.deltaX = e.touches[0].clientX - touch.startX;
262
259
  touch.deltaY = e.touches[0].clientY - touch.startY;
263
260
  touch.offsetX = Math.abs(touch.deltaX);
@@ -267,40 +264,39 @@ var Swiper = React__default.forwardRef(function(props, ref) {
267
264
  touch.stateDirection = getDirection(touch.offsetX, touch.offsetY);
268
265
  }
269
266
  };
270
- var b = cn("swiper");
271
- var classes = classNames(b(""));
272
- var contentClass = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b("inner")), true), _defineProperty(_classNames, "".concat(b("vertical")), isVertical), _classNames));
267
+ var classPrefix = "nut-swiper";
268
+ var contentClass = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(classPrefix, "__inner"), true), _defineProperty(_classNames, "".concat(classPrefix, "__vertical"), isVertical), _classNames));
273
269
  var getStyle = function getStyle2() {
274
270
  var moveOffset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : offset;
275
271
  var target = innerRef.current;
276
272
  var _offset = 0;
277
- if (!isCenter) {
273
+ if (!center) {
278
274
  _offset = moveOffset;
279
275
  } else {
280
276
  var _size = isVertical ? height : width;
281
277
  var val = isVertical ? rect.height - _size : rect.width - _size;
282
278
  _offset = moveOffset + (active === childCount - 1 && !props.loop ? -val / 2 : val / 2);
283
279
  }
284
- target.style.transitionDuration = "".concat(_swiper.current.moving ? 0 : props.duration, "ms");
280
+ target.style.transitionDuration = "".concat(swiperRef.current.moving ? 0 : props.duration, "ms");
285
281
  target.style[isVertical ? "height" : "width"] = "".concat(Number(size) * childCount, "px");
286
282
  target.style[isVertical ? "width" : "height"] = "".concat(isVertical ? width : height, "px");
287
283
  target.style.transform = "translate3D".concat(!isVertical ? "(".concat(_offset, "px,0,0)") : "(0,".concat(_offset, "px,0)"));
288
284
  };
289
285
  var onTouchStart = function onTouchStart2(e) {
290
- if (props.isPreventDefault)
286
+ if (props.preventDefault)
291
287
  e.preventDefault();
292
- if (props.isStopPropagation)
288
+ if (props.stopPropagation)
293
289
  e.stopPropagation();
294
290
  if (!props.touchable)
295
291
  return;
296
292
  touchStart(e);
297
293
  touch.touchTime = Date.now();
298
294
  stopAutoPlay();
299
- resettPosition();
295
+ resetPosition();
300
296
  };
301
297
  var onTouchMove = function onTouchMove2(e) {
302
- if (props.touchable && _swiper.current.moving) {
303
- touchMove(e);
298
+ if (props.touchable && swiperRef.current.moving) {
299
+ handleTouchMove(e);
304
300
  if (touch.stateDirection === props.direction) {
305
301
  move({
306
302
  offset: touch.delta
@@ -309,12 +305,12 @@ var Swiper = React__default.forwardRef(function(props, ref) {
309
305
  }
310
306
  };
311
307
  var onTouchEnd = function onTouchEnd2(e) {
312
- if (!props.touchable || !_swiper.current.moving)
308
+ if (!props.touchable || !swiperRef.current.moving)
313
309
  return;
314
310
  var speed = touch.delta / (Date.now() - touch.touchTime);
315
- var isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > +(size / 2).toFixed(2);
311
+ var isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > Number((size / 2).toFixed(2));
316
312
  var pace = 0;
317
- _swiper.current.moving = false;
313
+ swiperRef.current.moving = false;
318
314
  if (isShouldMove && touch.stateDirection === props.direction) {
319
315
  var offset2 = isVertical ? touch.offsetY : touch.offsetX;
320
316
  if (props.loop) {
@@ -337,28 +333,28 @@ var Swiper = React__default.forwardRef(function(props, ref) {
337
333
  } else {
338
334
  getStyle();
339
335
  }
340
- autoplay();
336
+ startPlay();
341
337
  };
342
338
  useEffect(function() {
343
- _swiper.current.activePagination = (active + childCount) % childCount;
339
+ swiperRef.current.activeIndicator = (active + childCount) % childCount;
344
340
  }, [active]);
345
341
  var init = function init2() {
346
- var active2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : +propSwiper.initPage;
342
+ var active2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : +propSwiper.defaultValue;
347
343
  var rect2 = getRect(container === null || container === void 0 ? void 0 : container.current);
348
- var _active = Math.max(Math.min(childCount - 1, active2), 0);
349
- var _width = propSwiper.width ? +propSwiper.width : rect2.width;
350
- var _height = propSwiper.height ? +propSwiper.height : rect2.height;
351
- size = isVertical ? _height : _width;
344
+ var currentIndex = Math.max(Math.min(childCount - 1, active2), 0);
345
+ var width2 = +propSwiper.width || rect2.width;
346
+ var height2 = +propSwiper.height || rect2.height;
347
+ size = isVertical ? height2 : width2;
352
348
  trackSize = childCount * Number(size);
353
- var targetOffset = getOffset(_active);
354
- _swiper.current.moving = true;
349
+ var targetOffset = getOffset(currentIndex);
350
+ swiperRef.current.moving = true;
355
351
  if (ready) {
356
- _swiper.current.moving = false;
352
+ swiperRef.current.moving = false;
357
353
  }
358
354
  setRect(rect2);
359
- setActive(_active);
360
- setWidth(_width);
361
- setHeight(_height);
355
+ setActive(currentIndex);
356
+ setWidth(width2);
357
+ setHeight(height2);
362
358
  setOffset(targetOffset);
363
359
  setReady(true);
364
360
  };
@@ -370,19 +366,19 @@ var Swiper = React__default.forwardRef(function(props, ref) {
370
366
  useEffect(function() {
371
367
  if (ready) {
372
368
  stopAutoPlay();
373
- autoplay();
369
+ startPlay();
374
370
  }
375
371
  return function() {
376
- setReady(false);
372
+ return setReady(false);
377
373
  };
378
374
  }, [ready]);
379
375
  useEffect(function() {
380
376
  stopAutoPlay();
381
- autoplay();
377
+ startPlay();
382
378
  }, [children]);
383
379
  useEffect(function() {
384
- init();
385
- }, [propSwiper.initPage]);
380
+ return init();
381
+ }, [propSwiper.defaultValue]);
386
382
  useEffect(function() {
387
383
  var target = container.current;
388
384
  target.addEventListener("touchstart", onTouchStart, false);
@@ -396,19 +392,17 @@ var Swiper = React__default.forwardRef(function(props, ref) {
396
392
  });
397
393
  useEffect(function() {
398
394
  return function() {
399
- stopAutoPlay();
395
+ return stopAutoPlay();
400
396
  };
401
397
  }, []);
402
- var itemStyle = function itemStyle2(index) {
398
+ var getItemStyle = function getItemStyle2(index) {
403
399
  var style = {};
404
- var _direction = propSwiper.direction || direction;
405
- var _size = size;
406
- if (_size) {
407
- style[_direction === "horizontal" ? "width" : "height"] = "".concat(_size, "px");
400
+ if (size) {
401
+ style[direction === "horizontal" ? "width" : "height"] = "".concat(size, "px");
408
402
  }
409
403
  var offset2 = childOffset[index];
410
404
  if (offset2) {
411
- style.transform = "translate3D".concat(_direction === "horizontal" ? "(".concat(offset2, "px,0,0)") : "(0,".concat(offset2, "px,0)"));
405
+ style.transform = "translate3D".concat(direction === "horizontal" ? "(".concat(offset2, "px,0,0)") : "(0,".concat(offset2, "px,0)"));
412
406
  }
413
407
  return style;
414
408
  };
@@ -420,35 +414,36 @@ var Swiper = React__default.forwardRef(function(props, ref) {
420
414
  resize
421
415
  };
422
416
  });
417
+ var renderIndicator = function renderIndicator2() {
418
+ if (React__default.isValidElement(indicator))
419
+ return indicator;
420
+ if (indicator === true) {
421
+ var _classNames2;
422
+ return React__default.createElement("div", {
423
+ className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(classPrefix, "__indicator"), true), _defineProperty(_classNames2, "".concat(classPrefix, "__indicator-vertical"), isVertical), _classNames2))
424
+ }, React__default.createElement(Indicator, {
425
+ current: (active + childCount) % childCount,
426
+ total: childs === null || childs === void 0 ? void 0 : childs.length,
427
+ direction
428
+ }));
429
+ }
430
+ return null;
431
+ };
423
432
  return React__default.createElement(DataContext.Provider, {
424
433
  value: parent
425
434
  }, React__default.createElement("div", _objectSpread({
426
- className: "".concat(classes, " ").concat(className),
435
+ className: classNames(classPrefix, className),
427
436
  ref: container
428
437
  }, rest), React__default.createElement("div", {
429
438
  className: contentClass,
430
439
  ref: innerRef
431
440
  }, React__default.Children.map(childs, function(child, index) {
432
441
  return React__default.createElement("div", {
433
- className: b("item-wrapper"),
434
- style: itemStyle(index),
442
+ className: "".concat(classPrefix, "__item-wrapper"),
443
+ style: getItemStyle(index),
435
444
  key: index
436
445
  }, child);
437
- })), propSwiper.paginationVisible && !("pageContent" in propSwiper) ? React__default.createElement("div", {
438
- className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(b("pagination")), true), _defineProperty(_classNames2, "".concat(b("pagination-vertical")), isVertical), _classNames2))
439
- }, React__default.Children.map(childs, function(item, index) {
440
- return React__default.createElement("i", {
441
- style: (active + childCount) % childCount === index ? {
442
- backgroundColor: propSwiper.paginationColor
443
- } : {
444
- backgroundColor: propSwiper.paginationBgColor
445
- },
446
- className: classNames({
447
- active: (active + childCount) % childCount === index
448
- }),
449
- key: index
450
- });
451
- })) : React__default.createElement("div", null, pageContent)));
446
+ })), renderIndicator()));
452
447
  });
453
448
  Swiper.defaultProps = defaultProps;
454
449
  Swiper.displayName = "NutSwiper";
@@ -22,7 +22,7 @@ function _objectSpread(target) {
22
22
  }
23
23
  import React__default, { useContext } from "react";
24
24
  import classNames from "classnames";
25
- import { D as DataContext } from "./UserContext3.js";
25
+ import { D as DataContext } from "./context3.js";
26
26
  import { c as cn } from "./bem.js";
27
27
  import "@bem-react/classname";
28
28
  var defaultProps = {
@@ -21,58 +21,44 @@ function _objectSpread(target) {
21
21
  }
22
22
  return target;
23
23
  }
24
- import React__default, { useState, useEffect } from "react";
25
- import { c as cn } from "./bem.js";
24
+ import React__default from "react";
26
25
  import { C as ComponentDefaults } from "./typings.js";
27
- import "@bem-react/classname";
26
+ import { u as usePropsValue } from "./use-props-value.js";
28
27
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
29
- isAsync: false,
30
- checked: false,
31
- disable: false,
32
- activeColor: "",
33
- inactiveColor: "",
28
+ disabled: false,
34
29
  activeText: "",
35
- inactiveText: "",
36
- className: ""
30
+ inactiveText: ""
37
31
  });
38
32
  var Switch = function Switch2(props) {
39
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), isAsync = _defaultProps$props.isAsync, checked = _defaultProps$props.checked, disable = _defaultProps$props.disable, activeColor = _defaultProps$props.activeColor, inactiveColor = _defaultProps$props.inactiveColor, activeText = _defaultProps$props.activeText, inactiveText = _defaultProps$props.inactiveText, onChange = _defaultProps$props.onChange, className = _defaultProps$props.className, style = _defaultProps$props.style;
40
- var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), value = _useState2[0], setValue = _useState2[1];
41
- var b = cn("switch");
42
- useEffect(function() {
43
- setValue(checked);
44
- }, [checked]);
33
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), checked = _defaultProps$props.checked, defaultChecked = _defaultProps$props.defaultChecked, disabled = _defaultProps$props.disabled, activeText = _defaultProps$props.activeText, inactiveText = _defaultProps$props.inactiveText, className = _defaultProps$props.className, style = _defaultProps$props.style, onChange = _defaultProps$props.onChange;
34
+ var classPrefix = "nut-switch";
35
+ var _usePropsValue = usePropsValue({
36
+ value: checked,
37
+ defaultValue: defaultChecked
38
+ }), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), value = _usePropsValue2[0], setValue = _usePropsValue2[1];
45
39
  var classes = function classes2() {
46
- return "".concat(b(), " ").concat(value ? "switch-open" : "switch-close", " ").concat(disable ? "".concat(b(), "-disable") : "", " ", "".concat(b(), "-base"), " ").concat(className);
47
- };
48
- var styles = function styles2() {
49
- var myStyle = _objectSpread({
50
- backgroundColor: value ? activeColor : inactiveColor
51
- }, style || {});
52
- return myStyle;
40
+ return "".concat(classPrefix, " ").concat(value ? "switch-open" : "switch-close", " ").concat(disabled ? "".concat(classPrefix, "-disabled") : "", " ", "".concat(classPrefix, "-base"), " ").concat(className);
53
41
  };
54
42
  var _onClick = function onClick(event) {
55
- if (disable)
43
+ if (disabled)
56
44
  return;
57
- if (!isAsync) {
58
- setValue(!value);
59
- }
60
45
  onChange && onChange(!value, event);
46
+ setValue(!value);
61
47
  };
62
48
  return React__default.createElement("div", {
63
49
  className: classes(),
64
50
  onClick: function onClick(e) {
65
51
  return _onClick(e);
66
52
  },
67
- style: styles()
53
+ style
68
54
  }, React__default.createElement("div", {
69
55
  className: "switch-button"
70
56
  }, !value && React__default.createElement("div", {
71
57
  className: "close-line"
72
58
  }), activeText && React__default.createElement(React__default.Fragment, null, value ? React__default.createElement("div", {
73
- className: "".concat(b("label"), " open")
59
+ className: "".concat(classPrefix, "__label open")
74
60
  }, activeText) : React__default.createElement("div", {
75
- className: "".concat(b("label"), " close")
61
+ className: "".concat(classPrefix, "__label close")
76
62
  }, inactiveText))));
77
63
  };
78
64
  Switch.defaultProps = defaultProps;
@@ -1,8 +1,42 @@
1
- import { T as TabPane } from "./tabpane2.js";
2
- import "react";
3
- import "classnames";
4
- import "./bem.js";
5
- import "@bem-react/classname";
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) {
3
+ var keys = Object.keys(object);
4
+ if (Object.getOwnPropertySymbols) {
5
+ var symbols = Object.getOwnPropertySymbols(object);
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 from "react";
24
+ import classNames from "classnames";
25
+ var defaultProps = {
26
+ title: "",
27
+ value: "",
28
+ disabled: false
29
+ };
30
+ var TabPane = function TabPane2(props) {
31
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, autoHeightClassName = _defaultProps$props.autoHeightClassName, className = _defaultProps$props.className, disabled = _defaultProps$props.disabled;
32
+ var classPrefix = "nut-tabpane";
33
+ var classes = classNames({
34
+ active: !disabled && props.active
35
+ }, classPrefix, autoHeightClassName, className);
36
+ return children ? React__default.createElement("div", {
37
+ className: classes
38
+ }, !disabled && children) : null;
39
+ };
6
40
  export {
7
41
  TabPane as default
8
42
  };
@@ -1,2 +1,2 @@
1
-
1
+ import '../../TabbarItem/style'
2
2
  import '../../../packages/tabbar/tabbar.scss'