@nutui/nutui-react-taro 2.0.12 → 2.0.13

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 (112) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/Address.js +7 -5
  3. package/dist/esm/Audio.js +6 -4
  4. package/dist/esm/Calendar.js +6 -4
  5. package/dist/esm/CalendarItem.js +5 -3
  6. package/dist/esm/Cascader.js +4 -3
  7. package/dist/esm/Checkbox.js +3 -2
  8. package/dist/esm/CheckboxGroup.js +3 -2
  9. package/dist/esm/Collapse.js +3 -2
  10. package/dist/esm/ConfigProvider.js +3 -2
  11. package/dist/esm/CountDown.js +3 -2
  12. package/dist/esm/DatePicker.js +6 -4
  13. package/dist/esm/Dialog.js +6 -3
  14. package/dist/esm/Empty.js +3 -2
  15. package/dist/esm/FixedNav.js +3 -2
  16. package/dist/esm/Form.js +2 -2
  17. package/dist/esm/FormItem.js +1 -1
  18. package/dist/esm/Grid.js +4 -3
  19. package/dist/esm/GridItem.js +3 -2
  20. package/dist/esm/ImagePreview.js +3 -2
  21. package/dist/esm/InfiniteLoading.js +3 -2
  22. package/dist/esm/Input.js +5 -3
  23. package/dist/esm/InputNumber.js +3 -2
  24. package/dist/esm/Notify.js +4 -1
  25. package/dist/esm/NumberKeyboard.js +3 -2
  26. package/dist/esm/Pagination.js +5 -3
  27. package/dist/esm/Picker.js +5 -3
  28. package/dist/esm/PullToRefresh.js +3 -2
  29. package/dist/esm/Radio.js +3 -2
  30. package/dist/esm/RadioGroup.js +3 -2
  31. package/dist/esm/Range.js +3 -2
  32. package/dist/esm/Rate.js +3 -2
  33. package/dist/esm/SearchBar.js +3 -2
  34. package/dist/esm/ShortPassword.js +5 -3
  35. package/dist/esm/Switch.js +3 -2
  36. package/dist/esm/Tabbar.js +3 -2
  37. package/dist/esm/Table.js +3 -2
  38. package/dist/esm/Tabs.js +3 -2
  39. package/dist/esm/TextArea.js +5 -3
  40. package/dist/esm/TimeSelect.js +3 -2
  41. package/dist/esm/Toast.js +5 -1
  42. package/dist/esm/Uploader.js +3 -2
  43. package/dist/esm/WaterMark.js +3 -2
  44. package/dist/esm/{address.taro-fe8a0601.js → address.taro-b58603a5.js} +3 -3
  45. package/dist/esm/{audio.taro-e85bb3b8.js → audio.taro-ef39c1d9.js} +2 -2
  46. package/dist/esm/{calendar.taro-29726d55.js → calendar.taro-c8ddf452.js} +2 -2
  47. package/dist/esm/{calendaritem.taro-9b37d00c.js → calendaritem.taro-0bd17638.js} +2 -2
  48. package/dist/esm/{cascader.taro-e05fd966.js → cascader.taro-ec5179d6.js} +2 -2
  49. package/dist/esm/{checkbox.taro-07d5c9d5.js → checkbox.taro-22cd35c4.js} +1 -1
  50. package/dist/esm/{collapse.taro-bd6b2bb3.js → collapse.taro-4a3e417c.js} +1 -1
  51. package/dist/esm/configprovider.taro-c5ff4877.js +483 -0
  52. package/dist/esm/{countdown.taro-80f2110b.js → countdown.taro-7caa9578.js} +1 -1
  53. package/dist/esm/{datepicker.taro-b894c285.js → datepicker.taro-288d64bb.js} +3 -3
  54. package/dist/esm/{dialog.taro-51697911.js → dialog.taro-519e45af.js} +50 -46
  55. package/dist/esm/{empty.taro-cef66b01.js → empty.taro-05f15f93.js} +1 -1
  56. package/dist/esm/{fixednav.taro-04cf5ffb.js → fixednav.taro-0d998d65.js} +1 -1
  57. package/dist/esm/{form.taro-16cb71e2.js → form.taro-6166be06.js} +1 -1
  58. package/dist/esm/{formitem.taro-34af0204.js → formitem.taro-9e2d3898.js} +1 -1
  59. package/dist/esm/{grid.taro-6f1b764c.js → grid.taro-f72acab8.js} +1 -1
  60. package/dist/esm/{griditem.taro-0d03a061.js → griditem.taro-b7abc653.js} +1 -1
  61. package/dist/esm/{imagepreview.taro-167d1380.js → imagepreview.taro-bc96904b.js} +1 -1
  62. package/dist/esm/{configprovider.taro-3a23ea84.js → index-21e61675.js} +26 -504
  63. package/dist/esm/{infiniteloading.taro-590cfd4f.js → infiniteloading.taro-cb3b949e.js} +1 -1
  64. package/dist/esm/{input.taro-abe6d65e.js → input.taro-fbcb7090.js} +2 -2
  65. package/dist/esm/{inputnumber.taro-9c74cc1c.js → inputnumber.taro-2f6f30d7.js} +1 -1
  66. package/dist/esm/{notify.taro-687d6f8c.js → notify.taro-07e9ead7.js} +2 -24
  67. package/dist/esm/{numberkeyboard.taro-42950800.js → numberkeyboard.taro-f19c44a8.js} +1 -1
  68. package/dist/esm/nutui-react.es.js +44 -41
  69. package/dist/esm/{pagination.taro-c2521fdf.js → pagination.taro-47fad28d.js} +2 -2
  70. package/dist/esm/{picker.taro-bd10e4e7.js → picker.taro-0770a67f.js} +2 -2
  71. package/dist/esm/{pulltorefresh.taro-2b4a48be.js → pulltorefresh.taro-f3ab76c2.js} +1 -1
  72. package/dist/esm/{radio.taro-802db0e9.js → radio.taro-d1d370be.js} +1 -1
  73. package/dist/esm/{range.taro-70101605.js → range.taro-fbbf5522.js} +1 -1
  74. package/dist/esm/{rate.taro-f090e140.js → rate.taro-61bbf5a7.js} +1 -1
  75. package/dist/esm/{searchbar.taro-75cf9937.js → searchbar.taro-7daf43fc.js} +1 -1
  76. package/dist/esm/{shortpassword.taro-d400cd45.js → shortpassword.taro-86563915.js} +2 -2
  77. package/dist/esm/{switch.taro-9c344336.js → switch.taro-74b2bd0a.js} +1 -1
  78. package/dist/esm/{tabbar.taro-ac4f72b9.js → tabbar.taro-4397646a.js} +1 -1
  79. package/dist/esm/{table.taro-48e8265e.js → table.taro-072907bf.js} +1 -1
  80. package/dist/esm/{tabs.taro-eceaf324.js → tabs.taro-3ece2221.js} +2 -1
  81. package/dist/esm/{textarea.taro-115dc986.js → textarea.taro-6ebe789c.js} +2 -2
  82. package/dist/esm/{timeselect.taro-e115bfd7.js → timeselect.taro-6e9fc4d4.js} +1 -1
  83. package/dist/esm/{toast.taro-b6ecbca7.js → toast.taro-a907b5f5.js} +28 -9
  84. package/dist/esm/types/src/packages/dialog/config.d.ts +1 -0
  85. package/dist/esm/types/src/packages/dialog/content.taro.d.ts +1 -1
  86. package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +11 -3
  87. package/dist/esm/types/src/packages/toast/index.taro.d.ts +1 -1
  88. package/dist/esm/types/src/packages/toast/toast.taro.d.ts +12 -1
  89. package/dist/esm/types/src/utils/use-custom-event.d.ts +4 -0
  90. package/dist/esm/{uploader.taro-cdb38c18.js → uploader.taro-c0bcca89.js} +1 -1
  91. package/dist/esm/use-custom-event-e1689884.js +49 -0
  92. package/dist/esm/use-force-update-9cd7c164.js +8 -0
  93. package/dist/esm/{use-props-value-e8331e19.js → use-props-value-c78cbf9b.js} +2 -6
  94. package/dist/esm/{watermark.taro-cea2fceb.js → watermark.taro-311b59d2.js} +1 -1
  95. package/dist/locales/base.js +1 -1
  96. package/dist/locales/en-US.js +1 -1
  97. package/dist/locales/id-ID.js +1 -1
  98. package/dist/locales/tr-TR.js +1 -1
  99. package/dist/locales/zh-CN.js +1 -1
  100. package/dist/locales/zh-TW.js +1 -1
  101. package/dist/locales/zh-UG.js +1 -1
  102. package/dist/nutui.react.es.js +216 -179
  103. package/dist/nutui.react.umd.js +216 -179
  104. package/dist/style.mjs +1 -1
  105. package/dist/types/packages/dialog/config.d.ts +1 -0
  106. package/dist/types/packages/dialog/content.taro.d.ts +1 -1
  107. package/dist/types/packages/dialog/dialog.taro.d.ts +11 -3
  108. package/dist/types/packages/toast/index.taro.d.ts +1 -1
  109. package/dist/types/packages/toast/toast.taro.d.ts +12 -1
  110. package/dist/types/utils/use-custom-event.d.ts +4 -0
  111. package/package.json +5 -4
  112. package/dist/types/packages/dialog/dialogwrap.taro.d.ts +0 -14
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.12 Fri Aug 11 2023 10:39:33 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.13 Wed Aug 16 2023 13:44:44 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.12 Fri Aug 11 2023 10:39:33 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.13 Wed Aug 16 2023 13:44:44 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.12 Fri Aug 11 2023 10:39:33 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.13 Wed Aug 16 2023 13:44:44 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  /*!
8
- * @nutui/nutui-react-taro v2.0.12 Fri Aug 11 2023 10:38:48 GMT+0800 (China Standard Time)
8
+ * @nutui/nutui-react-taro v2.0.13 Wed Aug 16 2023 13:44:02 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -11017,7 +11017,7 @@ class FormItem extends React__default.Component {
11017
11017
  }
11018
11018
  const controlled = {
11019
11019
  ...children.props,
11020
- [this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
11020
+ [this.props.valuePropName || "value"]: getFieldValue(name) === void 0 ? this.props.initialValue : getFieldValue(name),
11021
11021
  [this.props.trigger || "onChange"]: (...args) => {
11022
11022
  const originOnChange = children.props[this.props.trigger || "onChange"];
11023
11023
  if (originOnChange) {
@@ -11653,18 +11653,18 @@ const MenuItem = forwardRef((props, ref) => {
11653
11653
  closeOnClickAway,
11654
11654
  children,
11655
11655
  activeColor,
11656
- show,
11656
+ show: show2,
11657
11657
  parent,
11658
11658
  index
11659
11659
  } = {
11660
11660
  ...defaultProps$U,
11661
11661
  ...props
11662
11662
  };
11663
- const [showPopup, setShowPopup] = useState(show);
11663
+ const [showPopup, setShowPopup] = useState(show2);
11664
11664
  const [innerValue, setValue] = useState(value);
11665
11665
  useEffect(() => {
11666
- setShowPopup(show);
11667
- }, [show]);
11666
+ setShowPopup(show2);
11667
+ }, [show2]);
11668
11668
  useEffect(() => {
11669
11669
  getParentOffset();
11670
11670
  }, [showPopup]);
@@ -14052,63 +14052,49 @@ const Content = (props) => {
14052
14052
  ));
14053
14053
  };
14054
14054
  Content.displayName = "NutContent";
14055
- const defaultDialogProps = {
14056
- ...ComponentDefaults,
14057
- overlay: true,
14058
- overlayStyle: {},
14059
- overlayClassName: "",
14060
- onCancel: () => {
14061
- },
14062
- onClose: () => {
14063
- },
14064
- onOverlayClick: (e) => true,
14065
- ...defaultOverlayProps
14066
- };
14067
- const DialogWrap = (props) => {
14068
- const {
14069
- visible,
14070
- overlay,
14071
- overlayStyle,
14072
- overlayClassName,
14073
- closeOnOverlayClick,
14074
- lockScroll,
14075
- onClose,
14076
- onCancel,
14077
- onOverlayClick
14078
- } = props;
14079
- const onHandleClickOverlay = (e) => {
14080
- console.log("onClose?.()", closeOnOverlayClick);
14081
- if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
14082
- const closed = onOverlayClick && onOverlayClick(e);
14083
- closed && (onClose == null ? void 0 : onClose());
14084
- closed && (onCancel == null ? void 0 : onCancel());
14085
- }
14055
+ const customEvents = new Events();
14056
+ function useCustomEventsPath(selector) {
14057
+ var _a;
14058
+ const path = (_a = getCurrentInstance().router) == null ? void 0 : _a.path;
14059
+ return path ? `${path}__${selector}` : selector;
14060
+ }
14061
+ function useCustomEvent(selector, cb) {
14062
+ const path = useCustomEventsPath(selector);
14063
+ useEffect(() => {
14064
+ customEvents.on(path, cb);
14065
+ return () => {
14066
+ customEvents.off(path);
14067
+ };
14068
+ }, []);
14069
+ const trigger = (args) => {
14070
+ customEvents.trigger(path, args);
14086
14071
  };
14087
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, overlay ? /* @__PURE__ */ React__default.createElement(
14088
- Overlay,
14089
- {
14090
- style: overlayStyle,
14091
- className: overlayClassName,
14092
- visible: true,
14093
- closeOnOverlayClick,
14094
- lockScroll,
14095
- onClick: onHandleClickOverlay
14096
- }
14097
- ) : null, /* @__PURE__ */ React__default.createElement(
14098
- CSSTransition$1,
14099
- {
14100
- in: visible,
14101
- timeout: 300,
14102
- classNames: "fadeDialog",
14103
- unmountOnExit: true,
14104
- appear: true
14105
- },
14106
- /* @__PURE__ */ React__default.createElement(Content, { ...props, visible })
14107
- ));
14108
- };
14109
- DialogWrap.defaultProps = defaultDialogProps;
14110
- DialogWrap.displayName = "NutDialogWrap";
14072
+ const off = () => {
14073
+ customEvents.off(path);
14074
+ };
14075
+ return [trigger, off];
14076
+ }
14077
+ function useParams(args) {
14078
+ const forceUpdate = useForceUpdate();
14079
+ const stateRef = useRef(args);
14080
+ const currentRef = useRef();
14081
+ const previousRef = useRef();
14082
+ if (!isequal(currentRef.current, args)) {
14083
+ previousRef.current = currentRef.current;
14084
+ currentRef.current = args;
14085
+ stateRef.current = args;
14086
+ }
14087
+ const setParams = (args2) => {
14088
+ stateRef.current = { ...stateRef.current, ...args2 };
14089
+ forceUpdate();
14090
+ };
14091
+ const params = stateRef.current;
14092
+ return { params, setParams };
14093
+ }
14111
14094
  const defaultProps$F = {
14095
+ title: "",
14096
+ content: "",
14097
+ footer: "",
14112
14098
  confirmText: "",
14113
14099
  cancelText: "",
14114
14100
  overlay: true,
@@ -14119,92 +14105,143 @@ const defaultProps$F = {
14119
14105
  footerDirection: "horizontal",
14120
14106
  lockScroll: true,
14121
14107
  beforeCancel: () => true,
14122
- beforeClose: () => true
14108
+ beforeClose: () => true,
14109
+ onOverlayClick: () => void 0
14123
14110
  };
14124
- const BaseDialog = forwardRef(
14125
- (props, ref) => {
14126
- const { locale } = useConfig$1();
14127
- const {
14111
+ const BaseDialog = (props) => {
14112
+ const classPrefix2 = "nut-dialog";
14113
+ const { locale } = useConfig$1();
14114
+ const {
14115
+ params: {
14116
+ id,
14128
14117
  visible,
14129
14118
  footer,
14119
+ title,
14120
+ footerDirection,
14130
14121
  hideConfirmButton,
14131
14122
  hideCancelButton,
14132
14123
  lockScroll,
14133
14124
  disableConfirmButton,
14134
14125
  closeOnOverlayClick,
14126
+ onOverlayClick,
14135
14127
  confirmText,
14136
14128
  cancelText,
14129
+ overlay,
14137
14130
  onClose,
14138
14131
  onCancel,
14139
14132
  onConfirm,
14140
14133
  beforeCancel,
14141
- beforeClose,
14142
- ...restProps
14143
- } = props;
14144
- const classPrefix2 = "nut-dialog";
14145
- const renderFooter = () => {
14146
- if (footer === null)
14147
- return "";
14148
- const handleCancel = (e) => {
14149
- e.stopPropagation();
14150
- if (!(beforeCancel == null ? void 0 : beforeCancel()))
14151
- return;
14152
- if (!(beforeClose == null ? void 0 : beforeClose()))
14153
- return;
14154
- onClose == null ? void 0 : onClose();
14155
- onCancel == null ? void 0 : onCancel();
14156
- };
14157
- const handleOk = (e) => {
14158
- e.stopPropagation();
14159
- onClose == null ? void 0 : onClose();
14160
- onConfirm == null ? void 0 : onConfirm(e);
14161
- };
14162
- return footer || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !hideCancelButton && /* @__PURE__ */ React__default.createElement(
14163
- Button,
14164
- {
14165
- size: "small",
14166
- fill: "outline",
14167
- type: "primary",
14168
- className: `${classPrefix2}__footer-cancel`,
14169
- onClick: (e) => handleCancel(e)
14170
- },
14171
- cancelText || locale.cancel
14172
- ), !hideConfirmButton && /* @__PURE__ */ React__default.createElement(
14173
- Button,
14174
- {
14175
- size: "small",
14176
- type: "primary",
14177
- className: classNames(`${classPrefix2}__footer-ok`, {
14178
- disabled: disableConfirmButton
14179
- }),
14180
- disabled: disableConfirmButton,
14181
- onClick: (e) => handleOk(e)
14182
- },
14183
- confirmText || locale.confirm
14184
- ));
14134
+ beforeClose
14135
+ },
14136
+ setParams
14137
+ } = useParams({ ...defaultProps$F, ...props });
14138
+ useCustomEvent(
14139
+ id,
14140
+ ({ status, options }) => {
14141
+ if (status) {
14142
+ setParams({ ...options, visible: true });
14143
+ } else {
14144
+ setParams({ ...options, visible: false });
14145
+ }
14146
+ }
14147
+ );
14148
+ const renderFooter = () => {
14149
+ if (footer === null)
14150
+ return "";
14151
+ const handleCancel = (e) => {
14152
+ e.stopPropagation();
14153
+ if (!(beforeCancel == null ? void 0 : beforeCancel()))
14154
+ return;
14155
+ if (!(beforeClose == null ? void 0 : beforeClose()))
14156
+ return;
14157
+ onClose == null ? void 0 : onClose();
14158
+ onCancel == null ? void 0 : onCancel();
14185
14159
  };
14186
- return /* @__PURE__ */ React__default.createElement(
14187
- View,
14160
+ const handleOk = (e) => {
14161
+ e.stopPropagation();
14162
+ onClose == null ? void 0 : onClose();
14163
+ onConfirm == null ? void 0 : onConfirm(e);
14164
+ };
14165
+ return footer || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !hideCancelButton && /* @__PURE__ */ React__default.createElement(
14166
+ Button,
14188
14167
  {
14189
- style: { display: visible ? "block" : "none" },
14190
- catchMove: lockScroll
14168
+ size: "small",
14169
+ fill: "outline",
14170
+ type: "primary",
14171
+ className: `${classPrefix2}__footer-cancel`,
14172
+ onClick: (e) => handleCancel(e)
14173
+ },
14174
+ cancelText || locale.cancel
14175
+ ), !hideConfirmButton && /* @__PURE__ */ React__default.createElement(
14176
+ Button,
14177
+ {
14178
+ size: "small",
14179
+ type: "primary",
14180
+ className: classNames(`${classPrefix2}__footer-ok`, {
14181
+ disabled: disableConfirmButton
14182
+ }),
14183
+ disabled: disableConfirmButton,
14184
+ onClick: (e) => handleOk(e)
14185
+ },
14186
+ confirmText || locale.confirm
14187
+ ));
14188
+ };
14189
+ const onHandleClickOverlay = (e) => {
14190
+ console.log("onClose?.()", closeOnOverlayClick);
14191
+ if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
14192
+ const closed = onOverlayClick && onOverlayClick();
14193
+ closed && (onClose == null ? void 0 : onClose());
14194
+ closed && (onCancel == null ? void 0 : onCancel());
14195
+ }
14196
+ };
14197
+ console.log("props", props, visible);
14198
+ return /* @__PURE__ */ React__default.createElement(
14199
+ View,
14200
+ {
14201
+ style: { display: visible ? "block" : "none" },
14202
+ catchMove: lockScroll
14203
+ },
14204
+ /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, overlay ? /* @__PURE__ */ React__default.createElement(
14205
+ Overlay,
14206
+ {
14207
+ visible: true,
14208
+ closeOnOverlayClick,
14209
+ lockScroll,
14210
+ onClick: onHandleClickOverlay
14211
+ }
14212
+ ) : null, /* @__PURE__ */ React__default.createElement(
14213
+ CSSTransition$1,
14214
+ {
14215
+ in: visible,
14216
+ timeout: 300,
14217
+ classNames: "fadeDialog",
14218
+ unmountOnExit: true,
14219
+ appear: true
14191
14220
  },
14192
14221
  /* @__PURE__ */ React__default.createElement(
14193
- DialogWrap,
14222
+ Content,
14194
14223
  {
14195
- ...props,
14196
- visible,
14197
- lockScroll,
14224
+ title,
14198
14225
  footer: renderFooter(),
14199
- onClose,
14200
- onCancel
14226
+ footerDirection,
14227
+ visible
14201
14228
  }
14202
14229
  )
14203
- );
14204
- }
14205
- );
14230
+ ))
14231
+ );
14232
+ };
14233
+ function open$1(selector, options) {
14234
+ const path = useCustomEventsPath(selector);
14235
+ customEvents.trigger(path, { status: true, options });
14236
+ }
14237
+ function close$1(selector) {
14238
+ const path = useCustomEventsPath(selector);
14239
+ customEvents.trigger(path, { status: false });
14240
+ }
14206
14241
  BaseDialog.defaultProps = defaultProps$F;
14207
14242
  BaseDialog.displayName = "NutDialog";
14243
+ BaseDialog.open = open$1;
14244
+ BaseDialog.close = close$1;
14208
14245
  const defaultProps$E = {
14209
14246
  ...ComponentDefaults,
14210
14247
  attract: false,
@@ -14942,28 +14979,6 @@ const NoticeBar = (props) => {
14942
14979
  };
14943
14980
  NoticeBar.defaultProps = defaultProps$A;
14944
14981
  NoticeBar.displayName = "NutNoticeBar";
14945
- const customEvents = new Events();
14946
- function useCustomEventsPath(selector) {
14947
- var _a;
14948
- const path = (_a = getCurrentInstance().router) == null ? void 0 : _a.path;
14949
- return path ? `${path}__${selector}` : selector;
14950
- }
14951
- function useCustomEvent(selector, cb) {
14952
- const path = useCustomEventsPath(selector);
14953
- useEffect(() => {
14954
- customEvents.on(path, cb);
14955
- return () => {
14956
- customEvents.off(path);
14957
- };
14958
- }, []);
14959
- const trigger = (args) => {
14960
- customEvents.trigger(path, args);
14961
- };
14962
- const off = () => {
14963
- customEvents.off(path);
14964
- };
14965
- return [trigger, off];
14966
- }
14967
14982
  const defaultProps$z = {
14968
14983
  ...ComponentDefaults,
14969
14984
  id: "",
@@ -14992,26 +15007,26 @@ const Notify = (props) => {
14992
15007
  onClick
14993
15008
  } = { ...defaultProps$z, ...props };
14994
15009
  useCustomEvent(id, (status) => {
14995
- status ? show() : hide();
15010
+ status ? show2() : hide2();
14996
15011
  });
14997
15012
  let timer;
14998
15013
  const [showNotify, setShowNotify] = useState(false);
14999
15014
  useEffect(() => {
15000
15015
  if (visible) {
15001
- show();
15016
+ show2();
15002
15017
  } else {
15003
- hide();
15018
+ hide2();
15004
15019
  }
15005
15020
  }, [visible]);
15006
15021
  const clickHandle = () => {
15007
15022
  onClick();
15008
15023
  };
15009
- const show = () => {
15024
+ const show2 = () => {
15010
15025
  setShowNotify(true);
15011
15026
  clearTimer();
15012
15027
  if (duration) {
15013
15028
  timer = window.setTimeout(() => {
15014
- hide();
15029
+ hide2();
15015
15030
  }, duration);
15016
15031
  }
15017
15032
  };
@@ -15021,7 +15036,7 @@ const Notify = (props) => {
15021
15036
  timer = null;
15022
15037
  }
15023
15038
  };
15024
- const hide = () => {
15039
+ const hide2 = () => {
15025
15040
  setShowNotify(false);
15026
15041
  onClose();
15027
15042
  };
@@ -15889,57 +15904,69 @@ const defaultProps$s = {
15889
15904
  const classPrefix$8 = "nut-toast";
15890
15905
  const Toast = (props) => {
15891
15906
  const {
15892
- children,
15893
- id,
15894
- position,
15895
- contentStyle,
15896
- icon,
15897
- iconSize,
15898
- msg,
15899
- duration,
15900
- type: type4,
15901
- title,
15902
- closeOnOverlayClick,
15903
- lockScroll,
15904
- contentClassName,
15905
- size,
15906
- visible,
15907
- className,
15908
- style,
15909
- onClose,
15910
- ...rest
15911
- } = { ...defaultProps$s, ...props };
15907
+ params: {
15908
+ id,
15909
+ position,
15910
+ contentStyle,
15911
+ icon,
15912
+ iconSize,
15913
+ msg,
15914
+ duration,
15915
+ type: type4,
15916
+ title,
15917
+ closeOnOverlayClick,
15918
+ lockScroll,
15919
+ contentClassName,
15920
+ size,
15921
+ visible,
15922
+ className,
15923
+ style,
15924
+ onClose
15925
+ },
15926
+ setParams
15927
+ } = useParams({ ...defaultProps$s, ...props });
15912
15928
  let timer;
15913
15929
  const [openState, SetOpenState] = useState(false);
15914
15930
  useEffect(() => {
15915
15931
  if (visible) {
15916
- SetOpenState(true);
15917
- show();
15932
+ show2();
15918
15933
  } else {
15919
- hide();
15934
+ hide2();
15920
15935
  }
15921
15936
  }, [visible]);
15937
+ useCustomEvent(
15938
+ id,
15939
+ ({ status, options }) => {
15940
+ if (status) {
15941
+ setParams(options);
15942
+ show2();
15943
+ } else {
15944
+ hide2();
15945
+ }
15946
+ }
15947
+ );
15922
15948
  const clearTimer = () => {
15923
15949
  if (timer) {
15924
15950
  clearTimeout(timer);
15925
15951
  timer = null;
15926
15952
  }
15927
15953
  };
15928
- const hide = () => {
15954
+ const hide2 = () => {
15929
15955
  SetOpenState(false);
15930
- onClose();
15956
+ onClose == null ? void 0 : onClose();
15931
15957
  };
15932
- const show = () => {
15958
+ const show2 = () => {
15933
15959
  clearTimer();
15960
+ SetOpenState(true);
15934
15961
  if (duration) {
15935
15962
  timer = window.setTimeout(() => {
15936
- hide();
15963
+ hide2();
15937
15964
  }, duration * 1e3);
15938
15965
  }
15939
15966
  };
15940
15967
  const clickCover = () => {
15941
15968
  if (closeOnOverlayClick) {
15942
- hide();
15969
+ hide2();
15943
15970
  }
15944
15971
  };
15945
15972
  const hasIcon = () => {
@@ -15987,8 +16014,18 @@ const Toast = (props) => {
15987
16014
  ))
15988
16015
  ) : null);
15989
16016
  };
16017
+ function show(selector, options) {
16018
+ const path = useCustomEventsPath(selector);
16019
+ customEvents.trigger(path, { status: true, options });
16020
+ }
16021
+ function hide(selector) {
16022
+ const path = useCustomEventsPath(selector);
16023
+ customEvents.trigger(path, { status: false });
16024
+ }
15990
16025
  Toast.defaultProps = defaultProps$s;
15991
16026
  Toast.displayName = "NutToast";
16027
+ Toast.show = show;
16028
+ Toast.hide = hide;
15992
16029
  const defaultProps$r = {
15993
16030
  ...ComponentDefaults,
15994
16031
  type: "shake",