@nutui/nutui-react 2.0.0-alpha.15 → 2.0.0-alpha.16

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 (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/esm/DatePicker.js +54 -58
  3. package/dist/esm/Dialog/style/index.js +1 -0
  4. package/dist/esm/Dialog/style/style.css +1 -1
  5. package/dist/esm/Menu/style/style.css +1 -1
  6. package/dist/esm/Menu.js +5 -3
  7. package/dist/esm/MenuItem/style/style.css +1 -1
  8. package/dist/esm/MenuItem.js +31 -44
  9. package/dist/esm/NoticeBar.js +2 -2
  10. package/dist/esm/Picker.js +1 -1
  11. package/dist/esm/Popover.js +3 -40
  12. package/dist/esm/Popup.js +1 -1
  13. package/dist/esm/Toast.js +16 -7
  14. package/dist/esm/Uploader.js +1 -1
  15. package/dist/esm/index.js +2 -2
  16. package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +11 -17
  17. package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +11 -17
  18. package/dist/esm/types/src/packages/datepicker/index.d.ts +1 -0
  19. package/dist/esm/types/src/packages/datepicker/index.taro.d.ts +1 -0
  20. package/dist/esm/types/src/packages/nutui.react.taro.d.ts +2 -2
  21. package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -2
  22. package/dist/esm/types/src/packages/toast/Notification.d.ts +4 -1
  23. package/dist/esm/use-click-away.js +43 -0
  24. package/dist/locales/base.js +1 -1
  25. package/dist/locales/en-US.js +1 -1
  26. package/dist/locales/id-ID.js +1 -1
  27. package/dist/locales/tr-TR.js +1 -1
  28. package/dist/locales/zh-CN.js +1 -1
  29. package/dist/locales/zh-TW.js +1 -1
  30. package/dist/locales/zh-UG.js +1 -1
  31. package/dist/nutui.react.es.js +210 -224
  32. package/dist/nutui.react.umd.js +210 -224
  33. package/dist/packages/menuitem/menuitem.scss +1 -1
  34. package/dist/packages/noticebar/noticebar.scss +0 -3
  35. package/dist/style.css +1 -1
  36. package/dist/style.mjs +1 -1
  37. package/dist/types/packages/datepicker/datepicker.d.ts +79 -25
  38. package/dist/types/packages/datepicker/index.d.ts +1 -0
  39. package/dist/types/packages/toast/Notification.d.ts +4 -1
  40. package/package.json +1 -1
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v2.0.0-alpha.15 Wed Jun 07 2023 16:11:56 GMT+0800 (China Standard Time)
9
+ * @nutui/nutui-react v2.0.0-alpha.16 Fri Jun 09 2023 18:29:35 GMT+0800 (China Standard Time)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
@@ -11203,7 +11203,7 @@ const Popup = (props) => {
11203
11203
  {
11204
11204
  classNames: transitionName,
11205
11205
  unmountOnExit: true,
11206
- timeout: 500,
11206
+ timeout: 300,
11207
11207
  in: innerVisible,
11208
11208
  onEntered: onHandleOpened,
11209
11209
  onExited: onHandleClosed
@@ -14531,7 +14531,7 @@ const InternalPicker = (props, ref) => {
14531
14531
  {
14532
14532
  visible,
14533
14533
  position: "bottom",
14534
- onClose: () => {
14534
+ afterClose: () => {
14535
14535
  closePicker();
14536
14536
  }
14537
14537
  },
@@ -14556,29 +14556,29 @@ const Picker = React__default.forwardRef(InternalPicker);
14556
14556
  const Picker$1 = Picker;
14557
14557
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
14558
14558
  const defaultProps$V = {
14559
- modelValue: null,
14559
+ ...ComponentDefaults,
14560
14560
  visible: false,
14561
14561
  title: "",
14562
14562
  type: "date",
14563
- isShowChinese: false,
14563
+ showChinese: false,
14564
14564
  threeDimensional: true,
14565
14565
  minuteStep: 1,
14566
- minDate: new Date(currentYear - 10, 0, 1),
14567
- maxDate: new Date(currentYear + 10, 11, 31)
14566
+ startDate: new Date(currentYear - 10, 0, 1),
14567
+ endDate: new Date(currentYear + 10, 11, 31)
14568
14568
  };
14569
14569
  const DatePicker = (props) => {
14570
14570
  const {
14571
- minDate,
14572
- maxDate,
14571
+ startDate,
14572
+ endDate,
14573
14573
  type: type4,
14574
- isShowChinese,
14574
+ showChinese,
14575
14575
  minuteStep,
14576
- modelValue,
14577
14576
  visible,
14578
14577
  title,
14578
+ defaultValue,
14579
14579
  formatter,
14580
- onCloseDatePicker,
14581
- onConfirmDatePicker,
14580
+ onClose,
14581
+ onConfirm,
14582
14582
  filter,
14583
14583
  onChange,
14584
14584
  threeDimensional,
@@ -14590,14 +14590,6 @@ const DatePicker = (props) => {
14590
14590
  ...props
14591
14591
  };
14592
14592
  const { locale } = useConfig();
14593
- const [show2, setShow] = useState(false);
14594
- const [currentDate, setCurrentDate] = useState(modelValue);
14595
- const [defaultValue, setDefaultValue] = useState([]);
14596
- const [options2, setListData] = useState([]);
14597
- const pickerRef = useRef(null);
14598
- const isDate = (val) => {
14599
- return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
14600
- };
14601
14593
  const datepickerLang = locale.datepicker;
14602
14594
  const zhCNType = {
14603
14595
  day: datepickerLang.day,
@@ -14607,20 +14599,32 @@ const DatePicker = (props) => {
14607
14599
  minute: datepickerLang.min,
14608
14600
  seconds: datepickerLang.seconds
14609
14601
  };
14602
+ const [defaultValueOfPicker, setDefaultValueOfPicker] = useState([]);
14603
+ const [options2, setOptions] = useState([]);
14604
+ const isDate = (val) => {
14605
+ return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
14606
+ };
14610
14607
  const formatValue = (value) => {
14611
14608
  let cvalue = value;
14612
14609
  if (!cvalue || cvalue && !isDate(cvalue)) {
14613
- cvalue = minDate;
14610
+ cvalue = startDate;
14614
14611
  }
14615
- let timestmp = Math.max(cvalue.getTime(), minDate.getTime());
14616
- timestmp = Math.min(timestmp, maxDate.getTime());
14612
+ let timestmp = Math.max(cvalue.getTime(), startDate.getTime());
14613
+ timestmp = Math.min(timestmp, endDate.getTime());
14617
14614
  return new Date(timestmp);
14618
14615
  };
14616
+ const [currentDate, setCurrentDate] = usePropsValue({
14617
+ value: props.value && formatValue(props.value),
14618
+ defaultValue: formatValue(props.defaultValue || null),
14619
+ finalValue: null,
14620
+ onChange: (val) => {
14621
+ }
14622
+ });
14619
14623
  function getMonthEndDay(year, month) {
14620
14624
  return new Date(year, month, 0).getDate();
14621
14625
  }
14622
14626
  const getBoundary = (type22, value) => {
14623
- const boundary = type22 === "min" ? minDate : maxDate;
14627
+ const boundary = type22 === "min" ? startDate : endDate;
14624
14628
  const year = boundary.getFullYear();
14625
14629
  let month = 1;
14626
14630
  let date4 = 1;
@@ -14654,12 +14658,12 @@ const DatePicker = (props) => {
14654
14658
  [`${type22}Seconds`]: seconds
14655
14659
  };
14656
14660
  };
14657
- const ranges = (date4) => {
14658
- const curDate = date4 || currentDate;
14661
+ const ranges = () => {
14662
+ const curDate = currentDate;
14659
14663
  if (!curDate)
14660
14664
  return [];
14661
- const { maxYear, maxDate: maxDate2, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
14662
- const { minYear, minDate: minDate2, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", curDate);
14665
+ const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
14666
+ const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", curDate);
14663
14667
  let result = [
14664
14668
  {
14665
14669
  type: "year",
@@ -14671,7 +14675,7 @@ const DatePicker = (props) => {
14671
14675
  },
14672
14676
  {
14673
14677
  type: "day",
14674
- range: [minDate2, maxDate2]
14678
+ range: [minDate, maxDate]
14675
14679
  },
14676
14680
  {
14677
14681
  type: "hour",
@@ -14711,7 +14715,7 @@ const DatePicker = (props) => {
14711
14715
  }
14712
14716
  return result;
14713
14717
  };
14714
- const updateChooseValueCustmer = (cacheValueData, selectedValue, index) => {
14718
+ const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
14715
14719
  if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
14716
14720
  type4.toLocaleLowerCase()
14717
14721
  )) {
@@ -14721,11 +14725,13 @@ const DatePicker = (props) => {
14721
14725
  });
14722
14726
  if (type4.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
14723
14727
  formatDate.unshift(
14724
- new Date(modelValue || minDate || maxDate).getFullYear()
14728
+ new Date(defaultValue || startDate || endDate).getFullYear()
14725
14729
  );
14726
14730
  }
14727
14731
  if (type4.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
14728
- formatDate.push(new Date(modelValue || minDate || maxDate).getDate());
14732
+ formatDate.push(
14733
+ new Date(defaultValue || startDate || endDate).getDate()
14734
+ );
14729
14735
  }
14730
14736
  const year = Number(formatDate[0]);
14731
14737
  const month = Number(formatDate[1]) - 1;
@@ -14750,7 +14756,7 @@ const DatePicker = (props) => {
14750
14756
  const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
14751
14757
  date4 && isDate(date4) && !isEqual2 && setCurrentDate(formatValue(date4));
14752
14758
  }
14753
- props.onChange && props.onChange(cacheValueData, selectedValue, index);
14759
+ props.onChange && props.onChange(selectedOptions, selectedValue, index);
14754
14760
  };
14755
14761
  const padZero = (num, targetLength = 2) => {
14756
14762
  let str = `${num}`;
@@ -14768,12 +14774,13 @@ const DatePicker = (props) => {
14768
14774
  });
14769
14775
  } else {
14770
14776
  const padMin = padZero(value, 2);
14771
- const fatter = isShowChinese ? zhCNType[type22] : "";
14777
+ const fatter = showChinese ? zhCNType[type22] : "";
14772
14778
  fOption = { text: padMin + fatter, value: padMin };
14773
14779
  }
14774
14780
  return fOption;
14775
14781
  };
14776
14782
  const generateValue = (min, max, val, type22, columnIndex) => {
14783
+ var _a2;
14777
14784
  let cmin = min;
14778
14785
  const arr = [];
14779
14786
  let index = 0;
@@ -14788,8 +14795,8 @@ const DatePicker = (props) => {
14788
14795
  index++;
14789
14796
  }
14790
14797
  }
14791
- defaultValue[columnIndex] = arr[index].value;
14792
- setDefaultValue([...defaultValue]);
14798
+ defaultValueOfPicker[columnIndex] = (_a2 = arr[index]) == null ? void 0 : _a2.value;
14799
+ setDefaultValueOfPicker([...defaultValueOfPicker]);
14793
14800
  if (props.filter && props.filter(type22, arr)) {
14794
14801
  return props.filter(type22, arr);
14795
14802
  }
@@ -14814,8 +14821,8 @@ const DatePicker = (props) => {
14814
14821
  }
14815
14822
  return d;
14816
14823
  };
14817
- const columns = (date4) => {
14818
- const val = ranges(date4).map((res, columnIndex) => {
14824
+ const columns = () => {
14825
+ const val = ranges().map((res, columnIndex) => {
14819
14826
  return generateValue(
14820
14827
  res.range[0],
14821
14828
  res.range[1],
@@ -14826,42 +14833,24 @@ const DatePicker = (props) => {
14826
14833
  });
14827
14834
  return val || [];
14828
14835
  };
14829
- useEffect(() => {
14830
- setCurrentDate(formatValue(modelValue));
14831
- }, []);
14832
- useEffect(() => {
14833
- setCurrentDate(formatValue(modelValue));
14834
- }, [modelValue]);
14835
- useEffect(() => {
14836
- setShow(visible);
14837
- }, [visible]);
14838
14836
  useEffect(() => {
14839
14837
  if (currentDate) {
14840
- setListData(columns());
14838
+ setOptions(columns());
14841
14839
  }
14842
- }, [currentDate]);
14843
- return /* @__PURE__ */ React__default.createElement(
14844
- "div",
14840
+ }, []);
14841
+ return /* @__PURE__ */ React__default.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React__default.createElement(
14842
+ Picker$1,
14845
14843
  {
14846
- className: `nut-datepicker ${className || ""}`,
14847
- style,
14848
- ...rest
14849
- },
14850
- options2.length > 0 && /* @__PURE__ */ React__default.createElement(
14851
- Picker$1,
14852
- {
14853
- title,
14854
- visible: show2,
14855
- options: options2,
14856
- onClose: onCloseDatePicker,
14857
- defaultValue,
14858
- onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
14859
- onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
14860
- threeDimensional,
14861
- ref: pickerRef
14862
- }
14863
- )
14864
- );
14844
+ title,
14845
+ visible,
14846
+ options: options2,
14847
+ onClose,
14848
+ defaultValue: defaultValueOfPicker,
14849
+ onConfirm: (options22, value) => onConfirm && onConfirm(options22, value),
14850
+ onChange: (options22, value, index) => updateChooseValueCustmer(options22, value, index),
14851
+ threeDimensional
14852
+ }
14853
+ ));
14865
14854
  };
14866
14855
  DatePicker.defaultProps = defaultProps$V;
14867
14856
  DatePicker.displayName = "NutDatePicker";
@@ -16727,6 +16716,7 @@ const Menu = (props) => {
16727
16716
  };
16728
16717
  const hideMenuItem = (index) => {
16729
16718
  showMenuItem[index] = false;
16719
+ console.log([...showMenuItem]);
16730
16720
  setShowMenuItem([...showMenuItem]);
16731
16721
  };
16732
16722
  const updateTitle = (text, index) => {
@@ -16736,6 +16726,7 @@ const Menu = (props) => {
16736
16726
  const cloneChildren = () => {
16737
16727
  return React__default.Children.map(children, (child, index) => {
16738
16728
  return React__default.cloneElement(child, {
16729
+ ...child.props,
16739
16730
  show: showMenuItem[index],
16740
16731
  index,
16741
16732
  activeColor,
@@ -16775,7 +16766,8 @@ const Menu = (props) => {
16775
16766
  }),
16776
16767
  style: { color: showMenuItem[index] ? activeColor : "" },
16777
16768
  key: index,
16778
- onClick: () => {
16769
+ onClick: (e) => {
16770
+ e.stopPropagation();
16779
16771
  !disabled && toggleMenuItem(index);
16780
16772
  }
16781
16773
  },
@@ -16817,12 +16809,59 @@ const Menu = (props) => {
16817
16809
  };
16818
16810
  Menu.defaultProps = defaultProps$Q;
16819
16811
  Menu.displayName = "NutMenu";
16812
+ const isObject = (val) => val !== null && typeof val === "object";
16813
+ const isFunction = (val) => typeof val === "function";
16814
+ const isPromise = (val) => {
16815
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
16816
+ };
16817
+ const upperCaseFirst = (str) => {
16818
+ var str = str.toLowerCase();
16819
+ str = str.replace(
16820
+ /\b\w+\b/g,
16821
+ (word) => word.substring(0, 1).toUpperCase() + word.substring(1)
16822
+ );
16823
+ return str;
16824
+ };
16825
+ const getTargetElement = (target) => {
16826
+ let targetElement;
16827
+ if (isFunction(target)) {
16828
+ targetElement = target();
16829
+ } else if ("current" in target) {
16830
+ targetElement = target.current;
16831
+ } else {
16832
+ targetElement = target;
16833
+ }
16834
+ return targetElement;
16835
+ };
16836
+ function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
16837
+ const handler = (event) => {
16838
+ const targets = Array.isArray(target) ? target : [target];
16839
+ if (targets.some((item) => {
16840
+ const targetElement = getTargetElement(item);
16841
+ return !targetElement || targetElement.contains(event.target);
16842
+ })) {
16843
+ return;
16844
+ }
16845
+ if (outerVar) {
16846
+ onClickAway();
16847
+ }
16848
+ };
16849
+ useEffect(() => {
16850
+ if (isListener) {
16851
+ window.addEventListener(eventName, handler, false);
16852
+ } else {
16853
+ window.removeEventListener(eventName, handler, false);
16854
+ }
16855
+ return () => {
16856
+ window.removeEventListener(eventName, handler, true);
16857
+ };
16858
+ }, [target]);
16859
+ }
16820
16860
  const defaultProps$P = {
16821
16861
  ...ComponentDefaults,
16822
16862
  columns: 1,
16823
16863
  direction: "down",
16824
16864
  icon: null,
16825
- closeOnClickAway: false,
16826
16865
  activeTitleClass: "",
16827
16866
  inactiveTitleClass: "",
16828
16867
  onChange: (value) => void 0
@@ -16855,9 +16894,6 @@ const MenuItem = forwardRef((props, ref) => {
16855
16894
  useEffect(() => {
16856
16895
  setShowPopup(show2);
16857
16896
  }, [show2]);
16858
- useEffect(() => {
16859
- getParentOffset();
16860
- }, [_showPopup]);
16861
16897
  useImperativeHandle(ref, () => ({
16862
16898
  toggle: parent.toggleMenuItem
16863
16899
  }));
@@ -16878,119 +16914,108 @@ const MenuItem = forwardRef((props, ref) => {
16878
16914
  setValue(item.value);
16879
16915
  onChange && onChange(item);
16880
16916
  };
16881
- const [position, setPosition] = useState({
16882
- top: 0,
16883
- height: 0
16884
- });
16885
- const getParentOffset = () => {
16886
- setTimeout(() => {
16887
- const p = parent.menuRef.current;
16888
- const rect = p.getBoundingClientRect();
16889
- setPosition({
16890
- height: rect.height,
16891
- top: rect.top
16892
- });
16893
- });
16894
- };
16895
16917
  const isShow = () => {
16896
16918
  if (_showPopup)
16897
16919
  return {};
16898
16920
  return { display: "none" };
16899
16921
  };
16900
16922
  const getPosition = () => {
16901
- return direction === "down" ? { top: `${position.top + position.height}px` } : { bottom: `${window.innerHeight - position.top}px`, top: "auto" };
16902
- };
16903
- const placeholderStyle = () => {
16904
- if (direction === "down") {
16905
- return {
16906
- height: `${position.top + position.height}px`,
16907
- top: 0,
16908
- ...isShow()
16909
- };
16910
- }
16911
- return {
16912
- height: `${window.innerHeight - position.top}px`,
16913
- bottom: `0px`,
16923
+ return direction === "down" ? { position: "absolute", height: `${window.innerHeight}px` } : {
16924
+ position: "absolute",
16925
+ bottom: "100%",
16914
16926
  top: "auto",
16915
- ...isShow()
16927
+ height: `${window.innerHeight}px`
16916
16928
  };
16917
16929
  };
16918
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, closeOnClickAway ? /* @__PURE__ */ React__default.createElement(
16919
- "div",
16920
- {
16921
- className: `placeholder-element ${classNames({
16922
- up: direction === "up"
16923
- })}`,
16924
- style: placeholderStyle(),
16925
- onClick: () => parent.toggleMenuItem(index)
16926
- }
16927
- ) : null, /* @__PURE__ */ React__default.createElement(
16928
- Overlay,
16929
- {
16930
- className: "nut-menu__overlay",
16931
- style: getPosition(),
16932
- lockScroll: parent.lockScroll,
16933
- visible: _showPopup,
16934
- closeOnOverlayClick: parent.closeOnOverlayClick,
16935
- onClick: () => {
16936
- parent.closeOnOverlayClick && parent.toggleMenuItem(index);
16937
- }
16938
- }
16939
- ), /* @__PURE__ */ React__default.createElement(
16930
+ const micRef = useRef(null);
16931
+ const targetSet = [micRef.current];
16932
+ useClickAway(
16933
+ () => {
16934
+ parent.hideMenuItem(index);
16935
+ },
16936
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16937
+ // @ts-ignore
16938
+ targetSet,
16939
+ "click",
16940
+ _showPopup,
16941
+ closeOnClickAway
16942
+ );
16943
+ return /* @__PURE__ */ React__default.createElement(
16940
16944
  "div",
16941
16945
  {
16942
- className: classNames(className, {
16943
- "nut-menu-item__wrap": direction === "down",
16944
- "nut-menu-item__wrap-up": direction !== "down"
16945
- }),
16946
- style: {
16947
- ...style,
16948
- ...isShow()
16949
- }
16946
+ className: "nut-menu-item-container",
16947
+ ref: micRef,
16948
+ style: { position: "absolute", left: 0, right: 0 }
16950
16949
  },
16951
16950
  /* @__PURE__ */ React__default.createElement(
16952
- CSSTransition$1,
16951
+ Overlay,
16953
16952
  {
16954
- in: _showPopup,
16955
- timeout: 100,
16956
- classNames: direction === "down" ? "menu-item" : "menu-item-up"
16953
+ className: "nut-menu__overlay",
16954
+ style: getPosition(),
16955
+ lockScroll: parent.lockScroll,
16956
+ visible: _showPopup,
16957
+ closeOnOverlayClick: parent.closeOnOverlayClick,
16958
+ onClick: () => {
16959
+ parent.closeOnOverlayClick && parent.toggleMenuItem(index);
16960
+ }
16961
+ }
16962
+ ),
16963
+ /* @__PURE__ */ React__default.createElement(
16964
+ "div",
16965
+ {
16966
+ className: classNames(className, {
16967
+ "nut-menu-item__wrap": direction === "down",
16968
+ "nut-menu-item__wrap-up": direction !== "down"
16969
+ }),
16970
+ style: {
16971
+ ...style,
16972
+ ...isShow()
16973
+ }
16957
16974
  },
16958
- /* @__PURE__ */ React__default.createElement("div", { className: "nut-menu-item__content" }, options2 == null ? void 0 : options2.map((item, index2) => {
16959
- return /* @__PURE__ */ React__default.createElement(
16960
- "div",
16961
- {
16962
- className: `nut-menu-item__option ${classNames({
16963
- active: item.value === _value
16964
- })}`,
16965
- key: item.text,
16966
- style: {
16967
- flexBasis: `${100 / columns}%`
16968
- },
16969
- onClick: () => {
16970
- handleClick2(item);
16971
- }
16972
- },
16973
- item.value === _value ? /* @__PURE__ */ React__default.createElement("i", null, icon || /* @__PURE__ */ React__default.createElement(
16974
- x$f,
16975
- {
16976
- color: activeColor,
16977
- className: getIconCName(item.value, value)
16978
- }
16979
- )) : null,
16980
- /* @__PURE__ */ React__default.createElement(
16975
+ /* @__PURE__ */ React__default.createElement(
16976
+ CSSTransition$1,
16977
+ {
16978
+ in: _showPopup,
16979
+ timeout: 100,
16980
+ classNames: direction === "down" ? "menu-item" : "menu-item-up"
16981
+ },
16982
+ /* @__PURE__ */ React__default.createElement("div", { className: "nut-menu-item__content" }, options2 == null ? void 0 : options2.map((item) => {
16983
+ return /* @__PURE__ */ React__default.createElement(
16981
16984
  "div",
16982
16985
  {
16983
- className: getIconCName(item.value, value),
16986
+ className: `nut-menu-item__option ${classNames({
16987
+ active: item.value === _value
16988
+ })}`,
16989
+ key: item.text,
16984
16990
  style: {
16985
- color: `${item.value === _value ? activeColor : ""}`
16991
+ flexBasis: `${100 / columns}%`
16992
+ },
16993
+ onClick: () => {
16994
+ handleClick2(item);
16986
16995
  }
16987
16996
  },
16988
- item.text
16989
- )
16990
- );
16991
- }), children)
16997
+ item.value === _value ? /* @__PURE__ */ React__default.createElement("i", null, icon || /* @__PURE__ */ React__default.createElement(
16998
+ x$f,
16999
+ {
17000
+ color: activeColor,
17001
+ className: getIconCName(item.value, value)
17002
+ }
17003
+ )) : null,
17004
+ /* @__PURE__ */ React__default.createElement(
17005
+ "div",
17006
+ {
17007
+ className: getIconCName(item.value, value),
17008
+ style: {
17009
+ color: `${item.value === _value ? activeColor : ""}`
17010
+ }
17011
+ },
17012
+ item.text
17013
+ )
17014
+ );
17015
+ }), children)
17016
+ )
16992
17017
  )
16993
- ));
17018
+ );
16994
17019
  });
16995
17020
  MenuItem.defaultProps = defaultProps$P;
16996
17021
  MenuItem.displayName = "NutMenuItem";
@@ -18456,19 +18481,6 @@ class Upload {
18456
18481
  }
18457
18482
  }
18458
18483
  }
18459
- const isObject = (val) => val !== null && typeof val === "object";
18460
- const isFunction = (val) => typeof val === "function";
18461
- const isPromise = (val) => {
18462
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
18463
- };
18464
- const upperCaseFirst = (str) => {
18465
- var str = str.toLowerCase();
18466
- str = str.replace(
18467
- /\b\w+\b/g,
18468
- (word) => word.substring(0, 1).toUpperCase() + word.substring(1)
18469
- );
18470
- return str;
18471
- };
18472
18484
  const funcInterceptor = (interceptor, {
18473
18485
  args = [],
18474
18486
  done,
@@ -19963,7 +19975,7 @@ const NoticeBar = (props) => {
19963
19975
  onClick: handleClick2
19964
19976
  },
19965
19977
  leftIcon ? /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon) : null,
19966
- children ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "nut-noticebar__inner", ref: innerRef }, scrollList.current.map((item, index) => {
19978
+ children ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-noticebar__inner", ref: innerRef }, scrollList.current.map((item, index) => {
19967
19979
  return /* @__PURE__ */ React__default.createElement(
19968
19980
  "div",
19969
19981
  {
@@ -19976,7 +19988,7 @@ const NoticeBar = (props) => {
19976
19988
  },
19977
19989
  item
19978
19990
  );
19979
- }))) : /* @__PURE__ */ React__default.createElement("div", { className: "horseLamp_list", style: horseLampStyle }, scrollList.current.map((item, index) => {
19991
+ })) : /* @__PURE__ */ React__default.createElement("div", { className: "horseLamp_list", style: horseLampStyle }, scrollList.current.map((item, index) => {
19980
19992
  return (
19981
19993
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
19982
19994
  /* @__PURE__ */ React__default.createElement(
@@ -20170,41 +20182,6 @@ const Notify = {
20170
20182
  }
20171
20183
  }
20172
20184
  };
20173
- const getTargetElement = (target) => {
20174
- let targetElement;
20175
- if (isFunction(target)) {
20176
- targetElement = target();
20177
- } else if ("current" in target) {
20178
- targetElement = target.current;
20179
- } else {
20180
- targetElement = target;
20181
- }
20182
- return targetElement;
20183
- };
20184
- function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
20185
- const handler = (event) => {
20186
- const targets = Array.isArray(target) ? target : [target];
20187
- if (targets.some((item) => {
20188
- const targetElement = getTargetElement(item);
20189
- return !targetElement || targetElement.contains(event.target);
20190
- })) {
20191
- return;
20192
- }
20193
- if (outerVar) {
20194
- onClickAway();
20195
- }
20196
- };
20197
- useEffect(() => {
20198
- if (isListener) {
20199
- window.addEventListener(eventName, handler, true);
20200
- } else {
20201
- window.removeEventListener(eventName, handler, true);
20202
- }
20203
- return () => {
20204
- window.removeEventListener(eventName, handler, true);
20205
- };
20206
- }, [target]);
20207
- }
20208
20185
  const defaultProps$w = {
20209
20186
  ...ComponentDefaults,
20210
20187
  list: [],
@@ -21021,11 +20998,20 @@ class Notification extends React.PureComponent {
21021
20998
  this.close = this.close.bind(this);
21022
20999
  this.startCloseTimer = this.startCloseTimer.bind(this);
21023
21000
  this.clearCloseTimer = this.clearCloseTimer.bind(this);
21024
- this.close = this.close.bind(this);
21025
21001
  this.clickCover = this.clickCover.bind(this);
21002
+ this.state = {
21003
+ show: true
21004
+ };
21026
21005
  }
21027
21006
  close() {
21007
+ this.setState({
21008
+ show: false
21009
+ });
21028
21010
  this.clearCloseTimer();
21011
+ if (this.props.id) {
21012
+ const element = document.getElementById(this.props.id);
21013
+ element && element.parentNode && element.parentNode.removeChild(element);
21014
+ }
21029
21015
  this.props.onClose();
21030
21016
  }
21031
21017
  startCloseTimer() {
@@ -21090,6 +21076,7 @@ class Notification extends React.PureComponent {
21090
21076
  contentClassName,
21091
21077
  contentStyle
21092
21078
  } = this.props;
21079
+ const { show: show2 } = this.state;
21093
21080
  const classes = classNames({
21094
21081
  "nut-toast-has-icon": icon,
21095
21082
  [`nut-toast-${size}`]: true
@@ -21097,11 +21084,10 @@ class Notification extends React.PureComponent {
21097
21084
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
21098
21085
  Overlay,
21099
21086
  {
21100
- visible: true,
21087
+ visible: show2,
21101
21088
  style,
21102
21089
  className: `${classPrefix$7}__overlay-default ${className}`,
21103
21090
  onClick: () => {
21104
- console.log("onclick");
21105
21091
  this.clickCover();
21106
21092
  },
21107
21093
  closeOnOverlayClick
@@ -21122,9 +21108,9 @@ class Notification extends React.PureComponent {
21122
21108
  __publicField(Notification, "newInstance");
21123
21109
  Notification.newInstance = (properties, callback) => {
21124
21110
  const element = document.createElement("div");
21125
- if (properties.id) {
21126
- element.setAttribute("id", `${properties.id}`);
21127
- }
21111
+ const id = properties.id ? properties.id : `${(/* @__PURE__ */ new Date()).getTime()}`;
21112
+ element.id = id;
21113
+ properties.id = id;
21128
21114
  document.body.appendChild(element);
21129
21115
  let called = false;
21130
21116
  function ref(instance) {