@nutui/nutui-react 1.2.0 → 1.2.1

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 (58) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/AnimatingNumbers.js +9 -11
  3. package/dist/esm/BackTop.js +8 -6
  4. package/dist/esm/Checkbox.js +54 -8
  5. package/dist/esm/CheckboxGroup.js +26 -4
  6. package/dist/esm/Elevator.js +129 -36
  7. package/dist/esm/Icon.js +5 -3
  8. package/dist/esm/Input.js +252 -57
  9. package/dist/esm/NavBar/style/index.js +1 -1
  10. package/dist/esm/NavBar.js +89 -32
  11. package/dist/esm/Step.js +20 -3
  12. package/dist/esm/TabPane.js +3 -2
  13. package/dist/esm/Tabs.js +13 -3
  14. package/dist/esm/Video/style/index.js +2 -0
  15. package/dist/esm/Video.js +97 -0
  16. package/dist/esm/nutui-react.es.js +1 -0
  17. package/dist/locales/base.js +1 -1
  18. package/dist/locales/en-US.js +1 -1
  19. package/dist/locales/id-ID.js +1 -1
  20. package/dist/locales/zh-CN.js +1 -1
  21. package/dist/locales/zh-TW.js +1 -1
  22. package/dist/nutui.react.es.js +770 -321
  23. package/dist/nutui.react.umd.js +18 -18
  24. package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -2
  25. package/dist/packages/animatingnumbers/countup.scss +10 -10
  26. package/dist/packages/backtop/backtop.scss +8 -0
  27. package/dist/packages/checkbox/checkbox.scss +21 -3
  28. package/dist/packages/col/col.scss +1 -1
  29. package/dist/packages/elevator/elevator.scss +71 -39
  30. package/dist/packages/input/input.scss +131 -3
  31. package/dist/packages/navbar/navbar.scss +114 -21
  32. package/dist/packages/price/price.scss +0 -1
  33. package/dist/packages/row/row.scss +14 -0
  34. package/dist/packages/tabpane/tabpane.scss +5 -0
  35. package/dist/packages/video/video.scss +18 -0
  36. package/dist/style.css +1 -1
  37. package/dist/style.es.js +1 -1
  38. package/dist/styles/themes/default.scss +1 -0
  39. package/dist/styles/variables.scss +94 -4
  40. package/dist/types/animatingnumbers/__tests__/animatingnumbers.spec.d.ts +1 -0
  41. package/dist/types/backtop/backtop.d.ts +4 -4
  42. package/dist/types/checkbox/checkbox.d.ts +4 -0
  43. package/dist/types/checkbox/demo.d.ts +1 -0
  44. package/dist/types/checkboxgroup/checkboxgroup.d.ts +1 -0
  45. package/dist/types/elevator/__tests__/elevator.spec.d.ts +1 -0
  46. package/dist/types/elevator/elevator.d.ts +6 -1
  47. package/dist/types/icon/icon.d.ts +1 -0
  48. package/dist/types/input/input.d.ts +42 -5
  49. package/dist/types/navbar/navbar.d.ts +9 -4
  50. package/dist/types/nutui.react.d.ts +2 -1
  51. package/dist/types/tabpane/tabpane.d.ts +1 -0
  52. package/dist/types/tabs/__test__/tabs.spec.d.ts +1 -0
  53. package/dist/types/tabs/tabs.d.ts +1 -0
  54. package/dist/types/video/__tests__/video.spec.d.ts +1 -0
  55. package/dist/types/video/demo.d.ts +4 -0
  56. package/dist/types/video/index.d.ts +2 -0
  57. package/dist/types/video/video.d.ts +21 -0
  58. package/package.json +2 -2
package/dist/esm/Tabs.js CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- var _excluded = ["value", "color", "background", "direction", "type", "titleScroll", "ellipsis", "animatedTime", "titleGutter", "size", "titleNode", "children", "onClick", "onChange", "className"];
6
+ var _excluded = ["value", "color", "background", "direction", "type", "titleScroll", "ellipsis", "animatedTime", "titleGutter", "size", "titleNode", "children", "onClick", "onChange", "className", "autoHeight"];
7
7
 
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
9
 
@@ -38,7 +38,8 @@ var defaultProps = {
38
38
  ellipsis: true,
39
39
  animatedTime: 300,
40
40
  titleGutter: 0,
41
- size: 'normal'
41
+ size: 'normal',
42
+ autoHeight: false
42
43
  };
43
44
 
44
45
  var pxCheck = function pxCheck(value) {
@@ -64,6 +65,7 @@ var Tabs = function Tabs(props) {
64
65
  onClick = _defaultProps$props.onClick,
65
66
  onChange = _defaultProps$props.onChange,
66
67
  className = _defaultProps$props.className,
68
+ autoHeight = _defaultProps$props.autoHeight,
67
69
  rest = _objectWithoutProperties(_defaultProps$props, _excluded);
68
70
 
69
71
  var _useState = useState({
@@ -148,7 +150,7 @@ var Tabs = function Tabs(props) {
148
150
  return tabChange(item);
149
151
  },
150
152
  className: classNames({
151
- active: item.paneKey === value,
153
+ active: String(item.paneKey) === String(value),
152
154
  disabled: item.disabled
153
155
  }, "".concat(b(''), "__titles-item")),
154
156
  key: item.paneKey
@@ -170,6 +172,8 @@ var Tabs = function Tabs(props) {
170
172
  className: "".concat(b(''), "__content"),
171
173
  style: contentStyle
172
174
  }, React__default.Children.map(children, function (child, idx) {
175
+ var _child$props6;
176
+
173
177
  if (!React__default.isValidElement(child)) {
174
178
  return null;
175
179
  }
@@ -178,6 +182,12 @@ var Tabs = function Tabs(props) {
178
182
  activeKey: value
179
183
  });
180
184
 
185
+ if (String(value) !== String(((_child$props6 = child.props) === null || _child$props6 === void 0 ? void 0 : _child$props6.paneKey) || idx) && autoHeight) {
186
+ childProps = _objectSpread(_objectSpread({}, childProps), {}, {
187
+ autoHeightClassName: 'inactive'
188
+ });
189
+ }
190
+
181
191
  return React__default.cloneElement(child, childProps);
182
192
  })));
183
193
  };
@@ -0,0 +1,2 @@
1
+
2
+ require('../../../packages/video/video.scss')
@@ -0,0 +1,97 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "source", "options", "className", "play", "pause", "playend"];
4
+
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+
9
+ import React__default, { useRef, useEffect } from 'react';
10
+ import classNames from 'classnames';
11
+ import { c as cn } from './bem-893ad28d.js';
12
+ import '@bem-react/classname';
13
+ var defaultProps = {
14
+ source: {
15
+ type: {},
16
+ src: ''
17
+ },
18
+ options: {
19
+ controls: true,
20
+ muted: false,
21
+ autoplay: false,
22
+ poster: '',
23
+ playsinline: false,
24
+ loop: false
25
+ }
26
+ };
27
+
28
+ var Video = function Video(props) {
29
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
30
+ children = _defaultProps$props.children,
31
+ source = _defaultProps$props.source,
32
+ options = _defaultProps$props.options,
33
+ className = _defaultProps$props.className,
34
+ play = _defaultProps$props.play,
35
+ pause = _defaultProps$props.pause,
36
+ playend = _defaultProps$props.playend,
37
+ restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
38
+
39
+ var rootRef = useRef(null);
40
+ var b = cn('video');
41
+ var classes = classNames(className, b(''));
42
+ useEffect(function () {
43
+ init();
44
+ }, []);
45
+
46
+ var init = function init() {
47
+ if (rootRef.current) {
48
+ var videoRef = rootRef.current;
49
+
50
+ if (options.autoplay) {
51
+ setTimeout(function () {
52
+ videoRef.play();
53
+ }, 200);
54
+ }
55
+
56
+ if (options.playsinline) {
57
+ videoRef.setAttribute('playsinline', String(options.playsinline));
58
+ videoRef.setAttribute('webkit-playsinline', String(options.playsinline));
59
+ videoRef.setAttribute('x5-video-player-type', 'h5-page');
60
+ videoRef.setAttribute('x5-video-player-fullscreen', 'false');
61
+ }
62
+
63
+ videoRef.addEventListener('play', function () {
64
+ play && play(videoRef);
65
+ });
66
+ videoRef.addEventListener('pause', function () {
67
+ pause && pause(videoRef);
68
+ });
69
+ videoRef.addEventListener('ended', function () {
70
+ videoRef.currentTime = 0;
71
+ playend && playend(videoRef);
72
+ });
73
+ }
74
+ };
75
+
76
+ return React__default.createElement("div", _objectSpread({
77
+ className: classes
78
+ }, restProps), React__default.createElement("video", {
79
+ className: "nut-video-player",
80
+ muted: options.muted,
81
+ autoPlay: options.autoplay,
82
+ loop: options.loop,
83
+ poster: options.poster,
84
+ controls: options.controls,
85
+ ref: rootRef,
86
+ src: source.src
87
+ }, React__default.createElement("source", {
88
+ src: source.src,
89
+ type: source.type
90
+ }), React__default.createElement("track", {
91
+ kind: "captions"
92
+ })));
93
+ };
94
+
95
+ Video.defaultProps = defaultProps;
96
+ Video.displayName = 'NutVideo';
97
+ export { Video as default };
@@ -60,6 +60,7 @@ export { default as CollapseItem } from './CollapseItem.js';
60
60
  export { default as AnimatingNumbers } from './AnimatingNumbers.js';
61
61
  export { default as Empty } from './Empty.js';
62
62
  export { default as VirtualList } from './VirtualList.js';
63
+ export { default as Video } from './Video.js';
63
64
  export { default as Address } from './Address.js';
64
65
  export { default as Barrage } from './Barrage.js';
65
66
  export { default as Signature } from './Signature.js';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.0 Wed Jul 27 2022 11:40:41 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.1 Wed Aug 03 2022 16:27:01 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.0 Wed Jul 27 2022 11:40:41 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.1 Wed Aug 03 2022 16:27:01 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.0 Wed Jul 27 2022 11:40:41 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.1 Wed Aug 03 2022 16:27:01 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.0 Wed Jul 27 2022 11:40:41 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.1 Wed Aug 03 2022 16:27:01 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.2.0 Wed Jul 27 2022 11:40:41 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.2.1 Wed Aug 03 2022 16:27:01 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */