@nutui/nutui-react 2.0.0-alpha.7 → 2.0.0-alpha.9

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 (43) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/esm/Audio.js +12 -8
  3. package/dist/esm/Cascader.js +20 -12
  4. package/dist/esm/Elevator.js +6 -5
  5. package/dist/esm/Image.js +2 -5
  6. package/dist/esm/ImagePreview.js +9 -9
  7. package/dist/esm/Indicator.js +4 -4
  8. package/dist/esm/Notify.js +35 -46
  9. package/dist/esm/NumberKeyboard.js +137 -195
  10. package/dist/esm/Price.js +22 -23
  11. package/dist/esm/PullToRefresh.js +8 -8
  12. package/dist/esm/Radio.js +2 -0
  13. package/dist/esm/RadioGroup.js +31 -51
  14. package/dist/esm/Range/style/index.js +1 -1
  15. package/dist/esm/Range.js +119 -174
  16. package/dist/esm/Swiper.js +100 -111
  17. package/dist/esm/SwiperItem.js +1 -1
  18. package/dist/esm/radio2.js +52 -54
  19. package/dist/esm/tabs2.js +19 -8
  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 +1306 -1386
  27. package/dist/nutui.react.umd.js +1305 -1385
  28. package/dist/packages/imagepreview/imagepreview.scss +5 -0
  29. package/dist/packages/notify/notify.scss +1 -1
  30. package/dist/packages/numberkeyboard/numberkeyboard.scss +29 -77
  31. package/dist/packages/price/price.scss +8 -0
  32. package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -8
  33. package/dist/packages/radio/radio.scss +13 -32
  34. package/dist/packages/radiogroup/radiogroup.scss +17 -51
  35. package/dist/packages/range/range.scss +24 -49
  36. package/dist/packages/swiper/swiper.scss +0 -15
  37. package/dist/style.css +1 -1
  38. package/dist/style.mjs +1 -1
  39. package/dist/styles/variables-jmapp.scss +61 -61
  40. package/dist/styles/variables.scss +61 -60
  41. package/dist/types/index.d.ts +84 -106
  42. package/package.json +1 -1
  43. /package/dist/esm/{UserContext3.js → context2.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ # v2.0.0-alpha.9
2
+ `2023-05-17`
3
+
4
+ * :sparkles: feat: add createProperties.js (#1001) @Eiinu
5
+ * :sparkles: feat: cascader支持受控 (#1000) @xiaoyatong
6
+ * :sparkles: feat: elevator 支持右侧索引是否展示 (#1006) @拧巴的猫
7
+ * :bug: fix(image): lazy 优化观察对象数量 (#1015) @Eiinu
8
+ * :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
9
+ * :bug: fix: 格式化,删掉某些无用代码 (#1014) @xiaoyatong
10
+ * 🛠 refactor: notify (#983) @拧巴的猫
11
+ * 🛠 refactor: NumberKeyboard (#1012) @Eiinu
12
+ * 🛠 refactor: price (#989) @拧巴的猫
13
+ * 🛠 refactor: pulltorefresh (#1011) @oasis-cloud
14
+ * 🛠 refactor: radio (#1009) @oasis-cloud
15
+ * 🛠 refactor: Range (#991) @Eiinu
16
+ * 🛠 refactor: swiper 重构;indcator 的索引计算改为从 0 开始 (#1008) @oasis-cloud
17
+ * 🔨 chore: autoplay -> autoPlay (#1007) @Eiinu
18
+ * 📖 docs(tabbar): update description (#1004) @Eiinu
19
+
20
+
21
+ # v2.0.0-alpha.8
22
+ `2023-05-12`
23
+ * :sparkles:feat: cascader支持受控 (#1000) @xiaoyatong
24
+ * :bug: fix: tabs children 变更后需要展示新的 title (#999) @oasis-cloud
25
+ * 🛠 refactor: Range (#991) @Eiinu
26
+
1
27
  # v2.0.0-alpha.7
2
28
  `2023-05-12`
3
29
  * :bug: fix: tabs children 变化需要更新选中状态 @oasis-cloud
package/dist/esm/Audio.js CHANGED
@@ -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 = ["className", "src", "style", "muted", "autoplay", "loop", "preload", "type", "onBack", "onForward", "onPause", "onEnd", "onMute", "onCanPlay", "children"];
4
+ var _excluded = ["className", "src", "style", "muted", "autoPlay", "loop", "preload", "type", "onBack", "onForward", "onPause", "onEnd", "onMute", "onCanPlay", "children"];
5
5
  function ownKeys(object, enumerableOnly) {
6
6
  var keys = Object.keys(object);
7
7
  if (Object.getOwnPropertySymbols) {
@@ -33,7 +33,7 @@ import { C as ComponentDefaults } from "./typings.js";
33
33
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
34
34
  src: "",
35
35
  muted: false,
36
- autoplay: false,
36
+ autoPlay: false,
37
37
  loop: false,
38
38
  preload: "auto",
39
39
  type: "progress",
@@ -52,7 +52,7 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
52
52
  });
53
53
  var Audio = function Audio2(props) {
54
54
  var _useConfig = useConfig(), locale = _useConfig.locale;
55
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, src = _defaultProps$props.src, style = _defaultProps$props.style, muted = _defaultProps$props.muted, autoplay = _defaultProps$props.autoplay, loop = _defaultProps$props.loop, preload = _defaultProps$props.preload, type = _defaultProps$props.type, onBack2 = _defaultProps$props.onBack, onForward2 = _defaultProps$props.onForward, onPause2 = _defaultProps$props.onPause, onEnd2 = _defaultProps$props.onEnd, onMute2 = _defaultProps$props.onMute, onCanPlay2 = _defaultProps$props.onCanPlay, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
55
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, src = _defaultProps$props.src, style = _defaultProps$props.style, muted = _defaultProps$props.muted, autoPlay = _defaultProps$props.autoPlay, loop = _defaultProps$props.loop, preload = _defaultProps$props.preload, type = _defaultProps$props.type, onBack2 = _defaultProps$props.onBack, onForward2 = _defaultProps$props.onForward, onPause2 = _defaultProps$props.onPause, onEnd2 = _defaultProps$props.onEnd, onMute2 = _defaultProps$props.onMute, onCanPlay2 = _defaultProps$props.onCanPlay, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
56
56
  var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), playing = _useState2[0], setPlaying = _useState2[1];
57
57
  var _useState3 = useState(0), _useState4 = _slicedToArray(_useState3, 2), percent = _useState4[0], setPercent = _useState4[1];
58
58
  var _useState5 = useState(false), _useState6 = _slicedToArray(_useState5, 2), isCanPlay = _useState6[0], setIsCanPlay = _useState6[1];
@@ -65,7 +65,7 @@ var Audio = function Audio2(props) {
65
65
  duration: "00:00:00",
66
66
  second: 0,
67
67
  hanMuted: props.muted,
68
- playing: props.autoplay,
68
+ playing: props.autoPlay,
69
69
  handPlaying: false
70
70
  });
71
71
  var classPrefix = "nut-audio";
@@ -154,9 +154,13 @@ var Audio = function Audio2(props) {
154
154
  }, currentDuration), React__default.createElement("div", {
155
155
  className: "".concat(classPrefix, "__progress-bar-wrapper")
156
156
  }, React__default.createElement(Range, {
157
- modelValue: percent,
158
- hiddenTag: true,
159
- hiddenRange: true,
157
+ value: percent,
158
+ onChange: function onChange(val) {
159
+ return setPercent(val);
160
+ },
161
+ currentDescription: null,
162
+ maxDescription: null,
163
+ minDescription: null,
160
164
  "inactive-color": "#cccccc",
161
165
  "active-color": "#fa2c19"
162
166
  })), React__default.createElement("div", {
@@ -203,7 +207,7 @@ var Audio = function Audio2(props) {
203
207
  };
204
208
  var handleCanplay = function handleCanplay2(e) {
205
209
  setIsCanPlay(true);
206
- if (props.autoplay && !playing) {
210
+ if (props.autoPlay && !playing) {
207
211
  AudioRef && AudioRef.current && AudioRef.current.play();
208
212
  }
209
213
  if (AudioRef.current) {
@@ -49,9 +49,9 @@ import Popup from "./Popup.js";
49
49
  import { T as Tabs } from "./tabs2.js";
50
50
  import { Loading, Checklist } from "@nutui/icons-react";
51
51
  import { C as ComponentDefaults } from "./typings.js";
52
+ import { u as usePropsValue } from "./use-props-value.js";
52
53
  import "./TabPane.js";
53
54
  import "./raf.js";
54
- import "./use-props-value.js";
55
55
  var defaultProps$1 = {
56
56
  data: {
57
57
  text: "",
@@ -247,7 +247,6 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
247
247
  popup: true,
248
248
  visible: false,
249
249
  options: [],
250
- value: [],
251
250
  title: "",
252
251
  optionKey: {
253
252
  textKey: "text",
@@ -267,14 +266,23 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
267
266
  },
268
267
  onPathChange: function onPathChange() {
269
268
  }
270
- }, Popup.defaultProps);
269
+ });
271
270
  var InternalCascader = function InternalCascader2(props, ref) {
272
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, popup = _defaultProps$props.popup, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, title = _defaultProps$props.title, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
271
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, popup = _defaultProps$props.popup, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, title = _defaultProps$props.title, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
273
272
  var _useState = useState("c1"), _useState2 = _slicedToArray(_useState, 2), tabvalue = _useState2[0], setTabvalue = _useState2[1];
274
273
  var _useState3 = useState([]), _useState4 = _slicedToArray(_useState3, 2), optionsData = _useState4[0], setOptionsData = _useState4[1];
275
274
  var isLazy = function isLazy2() {
276
275
  return state.configs.lazy && Boolean(state.configs.onLoad);
277
276
  };
277
+ var _usePropsValue = usePropsValue({
278
+ value,
279
+ defaultValue,
280
+ finalValue: defaultValue,
281
+ onChange: function onChange3(val) {
282
+ var _props$onChange;
283
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, val);
284
+ }
285
+ }), _usePropsValue2 = _slicedToArray(_usePropsValue, 2), innerValue = _usePropsValue2[0], setInnerValue = _usePropsValue2[1];
278
286
  var _useState5 = useState({
279
287
  optionsData: [],
280
288
  panes: [{
@@ -282,7 +290,6 @@ var InternalCascader = function InternalCascader2(props, ref) {
282
290
  selectedNode: [],
283
291
  paneKey: ""
284
292
  }],
285
- innerValue: value,
286
293
  tree: new Tree$1([], {}),
287
294
  tabsCursor: 0,
288
295
  initLoading: false,
@@ -299,12 +306,12 @@ var InternalCascader = function InternalCascader2(props, ref) {
299
306
  var classesPane = classNames(_defineProperty({}, "".concat(classPrefix, "-pane"), true));
300
307
  useEffect(function() {
301
308
  initData();
302
- }, [options]);
309
+ }, [options, format]);
303
310
  useEffect(function() {
304
- if (value !== state.innerValue) {
305
- state.innerValue = value;
311
+ if (defaultValue && defaultValue !== innerValue) {
312
+ setInnerValue(defaultValue);
306
313
  }
307
- }, [value]);
314
+ }, [defaultValue]);
308
315
  var initData = /* @__PURE__ */ function() {
309
316
  var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee() {
310
317
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -358,8 +365,8 @@ var InternalCascader = function InternalCascader2(props, ref) {
358
365
  while (1)
359
366
  switch (_context3.prev = _context3.next) {
360
367
  case 0:
361
- currentValue = state.innerValue;
362
- if (!(currentValue === void 0 || !state.tree.nodes.length)) {
368
+ currentValue = innerValue;
369
+ if (!(currentValue === void 0 || currentValue !== defaultValue || !state.tree.nodes.length)) {
363
370
  _context3.next = 3;
364
371
  break;
365
372
  }
@@ -427,7 +434,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
427
434
  case 18:
428
435
  state.initLoading = false;
429
436
  case 19:
430
- if (needToSync.length && currentValue === value) {
437
+ if (needToSync.length && currentValue === defaultValue) {
431
438
  pathNodes = state.tree.getPathNodesByValue(needToSync);
432
439
  pathNodes.forEach(function(node, index) {
433
440
  state.tabsCursor = index;
@@ -536,6 +543,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
536
543
  });
537
544
  onChange2(optionParams, pathNodes);
538
545
  onPathChange2(optionParams, pathNodes);
546
+ setInnerValue(optionParams);
539
547
  }
540
548
  setOptionsData(state.panes);
541
549
  close();
@@ -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 = ["height", "floorKey", "list", "sticky", "spaceHeight", "titleHeight", "className", "style", "onClickItem", "onClickIndex", "children"];
4
+ var _excluded = ["height", "floorKey", "list", "sticky", "spaceHeight", "titleHeight", "showKeys", "className", "style", "onClickItem", "onClickIndex", "children"];
5
5
  function ownKeys(object, enumerableOnly) {
6
6
  var keys = Object.keys(object);
7
7
  if (Object.getOwnPropertySymbols) {
@@ -35,11 +35,12 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
35
35
  list: [],
36
36
  sticky: false,
37
37
  spaceHeight: 23,
38
- titleHeight: 35
38
+ titleHeight: 35,
39
+ showKeys: true
39
40
  });
40
41
  var Elevator = function Elevator2(props) {
41
42
  var _classNames2;
42
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), height = _defaultProps$props.height, floorKey = _defaultProps$props.floorKey, list = _defaultProps$props.list, sticky = _defaultProps$props.sticky, spaceHeight = _defaultProps$props.spaceHeight, titleHeight = _defaultProps$props.titleHeight, className = _defaultProps$props.className, style = _defaultProps$props.style, onClickItem = _defaultProps$props.onClickItem, onClickIndex = _defaultProps$props.onClickIndex, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
43
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), height = _defaultProps$props.height, floorKey = _defaultProps$props.floorKey, list = _defaultProps$props.list, sticky = _defaultProps$props.sticky, spaceHeight = _defaultProps$props.spaceHeight, titleHeight = _defaultProps$props.titleHeight, showKeys = _defaultProps$props.showKeys, className = _defaultProps$props.className, style = _defaultProps$props.style, onClickItem = _defaultProps$props.onClickItem, onClickIndex = _defaultProps$props.onClickIndex, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
43
44
  var classPrefix = "nut-elevator";
44
45
  var listview = useRef(null);
45
46
  var initData = {
@@ -192,7 +193,7 @@ var Elevator = function Elevator2(props) {
192
193
  value: subitem
193
194
  }, children)) : subitem.name);
194
195
  })));
195
- }))), list.length && scrollStart ? React__default.createElement("div", {
196
+ }))), showKeys ? React__default.createElement(React__default.Fragment, null, list.length && scrollStart ? React__default.createElement("div", {
196
197
  className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(classPrefix, "__code--current"), true), _defineProperty(_classNames2, "".concat(classPrefix, "__code--current--current"), true), _classNames2))
197
198
  }, list[codeIndex][floorKey]) : null, React__default.createElement("div", {
198
199
  className: "".concat(classPrefix, "__bars")
@@ -212,7 +213,7 @@ var Elevator = function Elevator2(props) {
212
213
  return handleClickIndex(item[floorKey]);
213
214
  }
214
215
  }, item[floorKey]);
215
- }))));
216
+ })))) : null);
216
217
  };
217
218
  Elevator.defaultProps = defaultProps;
218
219
  Elevator.displayName = "NutElevator";
package/dist/esm/Image.js CHANGED
@@ -71,7 +71,6 @@ var Image = function Image2(props) {
71
71
  }, style);
72
72
  var observer = useRef(null);
73
73
  var initObserver = function initObserver2() {
74
- var images = document.querySelectorAll(".nut-img.lazyload");
75
74
  var options = {
76
75
  threshold: [0],
77
76
  rootMargin: "0px"
@@ -86,14 +85,12 @@ var Image = function Image2(props) {
86
85
  img.src = img.dataset.src;
87
86
  img.removeAttribute("data-src");
88
87
  }
89
- observer.current.unobserve(item.target);
88
+ resetObserver();
90
89
  }, 300);
91
90
  }
92
91
  });
93
92
  }, options);
94
- images.forEach(function(item) {
95
- observer.current.observe(item);
96
- });
93
+ observer.current.observe(imgRef.current);
97
94
  };
98
95
  var resetObserver = function resetObserver2() {
99
96
  observer.current.disconnect && observer.current.disconnect();
@@ -30,16 +30,16 @@ var defaultProps = {
30
30
  images: [],
31
31
  videos: [],
32
32
  show: false,
33
- autoplay: 3e3,
33
+ autoPlay: 3e3,
34
34
  initNo: 1,
35
35
  contentClose: false,
36
- paginationVisible: false,
36
+ indicator: false,
37
37
  paginationColor: "#fff",
38
38
  onClose: function onClose() {
39
39
  }
40
40
  };
41
41
  var ImagePreview = function ImagePreview2(props) {
42
- var images = props.images, videos = props.videos, show = props.show, initNo = props.initNo, paginationColor = props.paginationColor, paginationVisible = props.paginationVisible, autoplay = props.autoplay, contentClose = props.contentClose, onClose2 = props.onClose;
42
+ var images = props.images, videos = props.videos, show = props.show, initNo = props.initNo, paginationColor = props.paginationColor, indicator = props.indicator, autoPlay = props.autoPlay, contentClose = props.contentClose, onClose2 = props.onClose;
43
43
  var nutImagePreview = useRef(null);
44
44
  var _useState = useState(initNo), _useState2 = _slicedToArray(_useState, 2), innerNo = _useState2[0], setInnerNo = _useState2[1];
45
45
  var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), showPop = _useState4[0], setShowPop = _useState4[1];
@@ -170,18 +170,18 @@ var ImagePreview = function ImagePreview2(props) {
170
170
  onClick: closeOnImg,
171
171
  onTouchStart
172
172
  }, React__default.createElement(Swiper, {
173
- autoPlay: autoplay,
173
+ autoPlay,
174
174
  className: "nut-imagepreview-swiper",
175
175
  loop: true,
176
- isPreventDefault: false,
176
+ preventDefault: false,
177
177
  style: {
178
- display: showPop ? "block" : "none"
178
+ display: showPop ? "block" : "none",
179
+ "--nutui-indicator-color": paginationColor
179
180
  },
180
181
  direction: "horizontal",
181
182
  onChange: slideChangeEnd,
182
- initPage: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
183
- paginationColor,
184
- paginationVisible
183
+ defaultValue: innerNo && (innerNo > maxNo ? maxNo - 1 : innerNo - 1),
184
+ indicator
185
185
  }, (videos && videos.length > 0 ? videos.map(function(item, index) {
186
186
  return React__default.createElement(SwiperItem, {
187
187
  key: index
@@ -26,7 +26,7 @@ import React__default from "react";
26
26
  import classNames from "classnames";
27
27
  var defaultProps = {
28
28
  total: 3,
29
- current: 1,
29
+ current: 0,
30
30
  direction: "horizontal"
31
31
  };
32
32
  var classPrefix = "nut-indicator";
@@ -35,11 +35,11 @@ var Indicator = function Indicator2(props) {
35
35
  var classes = classNames(_defineProperty({}, "".concat(classPrefix, "__vertical"), direction === "vertical"));
36
36
  var renderElement = function renderElement2() {
37
37
  var childs = [];
38
- for (var item = 1; item <= total; item++) {
39
- childs.push(item === current ? React__default.createElement(React__default.Fragment, null, children || React__default.createElement("div", {
38
+ for (var item = 0; item < total; item++) {
39
+ childs.push(item === current ? children || React__default.createElement("div", {
40
40
  key: item,
41
41
  className: "".concat(classPrefix, "__dot ").concat(classPrefix, "__active")
42
- })) : React__default.createElement("div", {
42
+ }) : React__default.createElement("div", {
43
43
  key: item,
44
44
  className: "".concat(classPrefix, "__dot")
45
45
  }));
@@ -55,12 +55,12 @@ function _isNativeReflectConstruct() {
55
55
  }
56
56
  }
57
57
  import * as React from "react";
58
- import * as ReactDOM from "react-dom";
59
58
  import classNames from "classnames";
60
59
  import { CSSTransition } from "react-transition-group";
61
- import { c as cn } from "./bem.js";
62
- import { r as render } from "./render.js";
63
- import "@bem-react/classname";
60
+ import { r as render, u as unmount } from "./render.js";
61
+ import { C as ComponentDefaults } from "./typings.js";
62
+ import "react-dom";
63
+ var classPrefix = "nut-notify";
64
64
  var Notification = /* @__PURE__ */ function(_React$PureComponent) {
65
65
  _inherits(Notification2, _React$PureComponent);
66
66
  var _super = _createSuper(Notification2);
@@ -89,7 +89,7 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
89
89
  var element = document.getElementById(this.props.id);
90
90
  element && element.parentNode && element.parentNode.removeChild(element);
91
91
  }
92
- this.props.onClosed();
92
+ this.props.onClose();
93
93
  }
94
94
  }, {
95
95
  key: "startCloseTimer",
@@ -128,30 +128,22 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
128
128
  }, {
129
129
  key: "render",
130
130
  value: function render2() {
131
- var _this$props = this.props, children = _this$props.children, style = _this$props.style, msg = _this$props.msg, color = _this$props.color, background = _this$props.background, type = _this$props.type, className = _this$props.className, position = _this$props.position, isWrapTeleport = _this$props.isWrapTeleport;
132
- this.state;
133
- cn("notify");
134
- var classes = classNames(_defineProperty({
135
- "nut-notify--popup-top": position === "top",
136
- "nut-notify--popup-bottom": position === "bottom",
137
- "nut-notify": true
138
- }, "nut-notify--".concat(type), true));
131
+ var _classNames;
132
+ var _this$props = this.props, style = _this$props.style, message = _this$props.message, type = _this$props.type, className = _this$props.className, position = _this$props.position;
133
+ var show = this.state.show;
134
+ var classes = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(classPrefix, "--popup-top"), position === "top"), _defineProperty(_classNames, "".concat(classPrefix, "--popup-bottom"), position === "bottom"), _defineProperty(_classNames, "".concat(classPrefix), true), _defineProperty(_classNames, "".concat(classPrefix, "--").concat(type), true), _classNames));
139
135
  return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
140
- "in": this.state.show,
136
+ "in": show,
141
137
  timeout: 300,
142
138
  classNames: "fade",
143
139
  unmountOnExit: true,
144
140
  appear: true,
145
- position,
146
- isWrapTeleport
141
+ position
147
142
  }, React.createElement("div", {
148
143
  className: "".concat(classes, " ").concat(className),
149
- style: {
150
- color: "".concat(color || ""),
151
- background: "".concat(background || "")
152
- },
144
+ style,
153
145
  onClick: this.clickCover
154
- }, children || msg)));
146
+ }, message)));
155
147
  }
156
148
  }]);
157
149
  return Notification2;
@@ -173,7 +165,7 @@ Notification.newInstance = function(properties, callback) {
173
165
  component: instance,
174
166
  destroy: function destroy() {
175
167
  setTimeout(function() {
176
- ReactDOM.unmountComponentAtNode(element);
168
+ unmount(element);
177
169
  element && element.parentNode && element.parentNode.removeChild(element);
178
170
  }, 300);
179
171
  }
@@ -184,19 +176,16 @@ Notification.newInstance = function(properties, callback) {
184
176
  })), element);
185
177
  };
186
178
  var messageInstance = null;
187
- var options = {
188
- msg: "",
179
+ var options = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
189
180
  id: "",
190
181
  duration: 3e3,
191
- color: "",
192
182
  type: "danger",
193
- className: "",
194
183
  position: "top",
195
- onClosed: function onClosed() {
184
+ onClose: function onClose() {
196
185
  },
197
186
  onClick: function onClick() {
198
187
  }
199
- };
188
+ });
200
189
  function getInstance(props, callback) {
201
190
  if (messageInstance) {
202
191
  messageInstance.destroy();
@@ -212,49 +201,49 @@ function notice(opts) {
212
201
  messageInstance = notification;
213
202
  });
214
203
  }
215
- var errorMsg = function errorMsg2(msg) {
216
- if (!msg) {
217
- console.warn("[NutUI Notify]: msg不能为空");
204
+ var errorMsg = function errorMsg2(message) {
205
+ if (!message) {
206
+ console.warn("[NutUI Notify]: message不能为空");
218
207
  }
219
208
  };
220
209
  var Notify = {
221
- text: function text(msg) {
210
+ text: function text(message) {
222
211
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
223
- errorMsg(msg);
212
+ errorMsg(message);
224
213
  return notice(_objectSpread({
225
- msg,
214
+ message,
226
215
  type: "base"
227
216
  }, option));
228
217
  },
229
- success: function success(msg) {
218
+ success: function success(message) {
230
219
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
231
- errorMsg(msg);
220
+ errorMsg(message);
232
221
  return notice(_objectSpread({
233
- msg,
222
+ message,
234
223
  type: "success"
235
224
  }, option));
236
225
  },
237
- primary: function primary(msg) {
226
+ primary: function primary(message) {
238
227
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
239
- errorMsg(msg);
228
+ errorMsg(message);
240
229
  return notice(_objectSpread({
241
- msg,
230
+ message,
242
231
  type: "primary"
243
232
  }, option));
244
233
  },
245
- danger: function danger(msg) {
234
+ danger: function danger(message) {
246
235
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
247
- errorMsg(msg);
236
+ errorMsg(message);
248
237
  return notice(_objectSpread({
249
- msg,
238
+ message,
250
239
  type: "danger"
251
240
  }, option));
252
241
  },
253
- warn: function warn(msg) {
242
+ warn: function warn(message) {
254
243
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
255
- errorMsg(msg);
244
+ errorMsg(message);
256
245
  return notice(_objectSpread({
257
- msg,
246
+ message,
258
247
  type: "warning"
259
248
  }, option));
260
249
  },