@unicom-cloud/ui 0.8.95 → 0.8.97

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 (326) hide show
  1. package/Affix.js +1 -1
  2. package/Carousel.js +1 -1
  3. package/LiquidFill.js +4 -0
  4. package/Message.js +1 -1
  5. package/Notification.js +1 -1
  6. package/OverflowEllipsis.js +1 -1
  7. package/PageHeader.js +1 -1
  8. package/QrCode.js +57 -0
  9. package/Switch.js +1 -1
  10. package/Tour.js +63 -0
  11. package/Trigger.js +2 -2
  12. package/_virtual/_commonjsHelpers.js +6 -0
  13. package/_virtual/index.js +7 -0
  14. package/_virtual/index2.js +4 -0
  15. package/affix/index.js +70 -72
  16. package/alert/index.js +52 -51
  17. package/anchor/Anchor.js +55 -55
  18. package/anchor/Link.js +34 -34
  19. package/anchor/util.js +5 -5
  20. package/auto-complete/index.js +116 -122
  21. package/avatar/Avatar.js +33 -33
  22. package/avatar/Group.js +26 -26
  23. package/back-top/index.js +58 -61
  24. package/badge/index.js +46 -46
  25. package/breadcrumb/Item.js +42 -43
  26. package/breadcrumb/index.js +47 -47
  27. package/button/Group.js +6 -6
  28. package/button/index.js +91 -91
  29. package/calendar/Month.js +75 -75
  30. package/calendar/Year.js +35 -35
  31. package/calendar/header/index.js +25 -25
  32. package/calendar/index.js +103 -103
  33. package/card/Grid.js +8 -8
  34. package/card/Meta.js +16 -16
  35. package/card/index.js +49 -49
  36. package/carousel/Arrow.js +19 -19
  37. package/carousel/Indicator.js +26 -26
  38. package/carousel/index.js +108 -108
  39. package/cascader/Cascader.js +178 -191
  40. package/cascader/base/node.js +133 -136
  41. package/cascader/base/store.js +82 -85
  42. package/cascader/panel/List.js +126 -130
  43. package/cascader/panel/Search.js +79 -81
  44. package/cascader/util.js +13 -13
  45. package/checkbox/Checkbox.js +94 -96
  46. package/checkbox/Group.js +54 -56
  47. package/checkbox/GroupBlock.js +28 -29
  48. package/collapse/Collapse.js +45 -45
  49. package/collapse/Item.js +53 -55
  50. package/color-picker/ControlBar.js +43 -43
  51. package/color-picker/InputAlpha.js +12 -12
  52. package/color-picker/InputHex.js +30 -31
  53. package/color-picker/InputRgb.js +24 -24
  54. package/color-picker/Palette.js +18 -18
  55. package/color-picker/Panel.js +122 -125
  56. package/color-picker/hooks/useColorPicker.js +85 -88
  57. package/color-picker/hooks/useControlBlock.js +38 -40
  58. package/color-picker/index.js +47 -47
  59. package/comment/index.js +29 -29
  60. package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
  61. package/components/common/hooks/useForceUpdate.js +6 -2
  62. package/components/common/hooks/useId.js +4 -4
  63. package/components/common/hooks/useInView.js +16 -16
  64. package/components/common/hooks/useIntersectionObserver.js +1 -1
  65. package/components/common/hooks/useKeyboardEvent.js +9 -10
  66. package/components/common/hooks/useOverflowHidden.js +1 -4
  67. package/components/common/hooks/usePersistCallback.js +7 -7
  68. package/components/common/hooks/useStateCallback.js +9 -10
  69. package/components/common/hooks/useWindowSize.js +8 -8
  70. package/components/common/space/index.js +11 -10
  71. package/components/common/utils/PqbCSSTransition.js +1 -1
  72. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  73. package/components/common/utils/dom.js +27 -29
  74. package/components/common/utils/findScrollParent.js +17 -0
  75. package/components/common/utils/intersectionObserver.js +21 -0
  76. package/components/common/utils/is.js +99 -109
  77. package/components/common/utils/mutationObserver.js +19 -0
  78. package/components/common/utils/reactDOM.js +34 -34
  79. package/components/common/utils/resizeObserver.js +21 -0
  80. package/copy/index.js +38 -40
  81. package/date-picker/Picker.js +290 -295
  82. package/date-picker/RangePicker.js +367 -372
  83. package/date-picker/index.js +33 -35
  84. package/date-picker/panel/Body.js +46 -47
  85. package/date-picker/panel/Header.js +33 -33
  86. package/date-picker/panel/Shortcut.js +31 -31
  87. package/date-picker/panel/date/index.js +85 -85
  88. package/date-picker/panel/month/index.js +59 -59
  89. package/date-picker/panel/quarter/index.js +67 -70
  90. package/date-picker/panel/range/index.js +101 -101
  91. package/date-picker/panel/year/index.js +39 -39
  92. package/date-picker/util.js +17 -18
  93. package/descriptions/index.js +62 -62
  94. package/details/index.js +55 -56
  95. package/development/index.js +9 -9
  96. package/dist/react-transition-group/src/CSSTransition.js +1 -1
  97. package/dist/react-transition-group/src/SwitchTransition.js +1 -1
  98. package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
  99. package/dist/tween/src/tween.js +24 -25
  100. package/dist/validate/src/index.js +5 -5
  101. package/dist/validate/src/util.js +1 -1
  102. package/divider/index.js +21 -21
  103. package/draggable/Item.js +35 -35
  104. package/draggable/index.js +22 -22
  105. package/drawer/Drawer.js +142 -147
  106. package/dropdown/Button.js +48 -48
  107. package/dropdown/index.js +88 -92
  108. package/empty/index.js +16 -16
  109. package/form/Control.js +211 -225
  110. package/form/Form.js +109 -113
  111. package/form/FormItem.js +118 -120
  112. package/form/FormList.js +60 -66
  113. package/form/FormProvider.js +31 -34
  114. package/form/hook/useContext.js +17 -19
  115. package/form/hook/useState.js +22 -23
  116. package/form/hook/useWatch.js +26 -27
  117. package/form/promisify.js +14 -18
  118. package/form/store.js +304 -316
  119. package/form/util.js +14 -15
  120. package/grid/Col.js +64 -64
  121. package/grid/Grid.js +51 -51
  122. package/grid/GridItem.js +48 -48
  123. package/grid/Row.js +39 -39
  124. package/hooks/index.js +50 -52
  125. package/hooks/useVerificationCode.js +41 -43
  126. package/hooks/useWatermark.js +89 -92
  127. package/icon/index.js +23 -24
  128. package/icon-hover/index.js +16 -16
  129. package/icons/file.js +11 -11
  130. package/image/Image.js +140 -141
  131. package/image/ImagePreview.js +252 -255
  132. package/image/ImagePreviewArrow.js +25 -25
  133. package/image/ImagePreviewGroup.js +62 -62
  134. package/image/util/getScale.js +25 -28
  135. package/index.js +682 -679
  136. package/input/Button.js +48 -50
  137. package/input/Group.js +9 -9
  138. package/input/Input.js +145 -154
  139. package/input/InputElement.js +108 -115
  140. package/input/Password.js +38 -38
  141. package/input/Search.js +51 -55
  142. package/input/Textarea.js +80 -81
  143. package/input/useComposition.js +23 -23
  144. package/input-number/decimal.js +59 -62
  145. package/input-number/index.js +139 -141
  146. package/input-tag/InputTag.js +223 -231
  147. package/layout/Content.js +6 -6
  148. package/layout/Footer.js +8 -8
  149. package/layout/Header.js +7 -7
  150. package/layout/Sider.js +88 -90
  151. package/layout/index.js +30 -30
  152. package/link/index.js +45 -46
  153. package/liquid-fill/LiquidFill.js +189 -0
  154. package/liquid-fill/LiquidFill2.js +3 -0
  155. package/liquid-fill/index.js +4 -0
  156. package/liquid-fill/interface.js +1 -0
  157. package/list/Item.js +28 -28
  158. package/list/Meta.js +12 -12
  159. package/list/index.js +146 -148
  160. package/mentions/index.js +75 -76
  161. package/menu/Item.js +58 -58
  162. package/menu/Menu.js +125 -127
  163. package/menu/OverflowWrap.js +39 -40
  164. package/menu/sub-menu/Inline.js +45 -45
  165. package/menu/util.js +26 -28
  166. package/message/index.js +97 -100
  167. package/message/useMessage.js +26 -27
  168. package/modal/Confirm.js +47 -49
  169. package/modal/Modal.js +250 -257
  170. package/modal/use-modal/Hook.js +26 -28
  171. package/modal/use-modal/index.js +46 -49
  172. package/notice/index.js +89 -90
  173. package/notification/index.js +61 -66
  174. package/notification/withNotification.js +35 -35
  175. package/overflow-ellipsis/OverflowItem.js +19 -20
  176. package/overflow-ellipsis/index.js +45 -46
  177. package/package.json +1 -1
  178. package/page-header/index.js +45 -45
  179. package/pagination/PageItem.js +87 -91
  180. package/pagination/PageJumper.js +40 -41
  181. package/pagination/PageOption.js +31 -35
  182. package/pagination/Pagination.js +162 -163
  183. package/picker/Input.js +90 -96
  184. package/picker/InputRange.js +115 -122
  185. package/popconfirm/index.js +98 -100
  186. package/popover/index.js +28 -28
  187. package/portal/Portal.js +10 -11
  188. package/progress/index.js +36 -36
  189. package/qr-code/index.js +99 -0
  190. package/qr-code/interface.js +1 -0
  191. package/radio/Group.js +48 -48
  192. package/radio/GroupBlock.js +32 -33
  193. package/radio/Radio.js +62 -64
  194. package/rate/index.js +88 -88
  195. package/resize-box/ResizeTrigger.js +39 -39
  196. package/resize-box/Split.js +92 -96
  197. package/resize-box/SplitGroup.js +116 -122
  198. package/resize-box/index.js +112 -115
  199. package/result/index.js +44 -44
  200. package/select/Option.js +53 -56
  201. package/select/Select.js +365 -381
  202. package/select/util.js +95 -99
  203. package/select-view/Core.js +159 -160
  204. package/skeleton/index.js +23 -23
  205. package/slider/Button.js +84 -92
  206. package/slider/Input.js +47 -49
  207. package/slider/Tick.js +28 -31
  208. package/slider/index.js +108 -108
  209. package/slider/util.js +1 -1
  210. package/space/index.js +26 -26
  211. package/space-/index.js +51 -51
  212. package/spin/DotLoading.js +8 -8
  213. package/spin/index.js +47 -47
  214. package/statistic/Countdown.js +37 -37
  215. package/statistic/index.js +61 -61
  216. package/steps/Step.js +42 -42
  217. package/steps/index.js +54 -54
  218. package/style.css +1 -1
  219. package/switch/index.js +78 -79
  220. package/table/ColGroup.js +36 -37
  221. package/table/Table.js +447 -450
  222. package/table/hook/useExpand.js +24 -24
  223. package/table/hook/useRowSelection.js +62 -62
  224. package/table/summary/Row.js +16 -17
  225. package/table/tbody/Td.js +119 -118
  226. package/table/tbody/Tr.js +119 -121
  227. package/table/tbody/index.js +62 -63
  228. package/table/th-resizable/index.js +30 -30
  229. package/table/thead/Column.js +148 -148
  230. package/table/thead/index.js +87 -88
  231. package/tabs/Tab.js +55 -55
  232. package/tabs/TabContent.js +8 -8
  233. package/tabs/TabPane.js +15 -15
  234. package/tabs/hook/useHeaderScroll.js +36 -36
  235. package/tabs/tab-header/TabInk.js +31 -33
  236. package/tabs/tab-header/TabNavIcon.js +34 -35
  237. package/tabs/tab-header/index.js +192 -195
  238. package/tag/index.js +94 -97
  239. package/time-picker/Picker.js +167 -172
  240. package/time-picker/RangePicker.js +28 -28
  241. package/time-picker/TimePicker.js +146 -146
  242. package/time-picker/util.js +4 -4
  243. package/timeline/Item.js +46 -46
  244. package/timeline/Timeline.js +52 -52
  245. package/tooltip/index.js +89 -95
  246. package/tour/index.js +289 -0
  247. package/transfer/Item.js +54 -54
  248. package/transfer/List.js +134 -136
  249. package/transfer/index.js +91 -91
  250. package/tree/Animation.js +49 -52
  251. package/tree/Node.js +114 -122
  252. package/tree/NodeList.js +51 -51
  253. package/tree/Tree.js +386 -393
  254. package/tree-select/List.js +71 -72
  255. package/tree-select/Select.js +135 -143
  256. package/tree-select/hook/useKeyCache.js +39 -39
  257. package/tree-select/hook/useStateValue.js +12 -12
  258. package/trigger/getPopupStyle.js +60 -61
  259. package/trigger/index.js +338 -347
  260. package/types/common/space/interface.d.ts +1 -1
  261. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  262. package/types/common/utils/findScrollParent.d.ts +2 -0
  263. package/types/common/utils/index.d.ts +5 -0
  264. package/types/common/utils/intersectionObserver.d.ts +2 -0
  265. package/types/common/utils/math.d.ts +1 -1
  266. package/types/common/utils/mutationObserver.d.ts +2 -0
  267. package/types/common/utils/resizeObserver.d.ts +2 -0
  268. package/types/pc/alert/interface.d.ts +2 -2
  269. package/types/pc/details/interface.d.ts +2 -2
  270. package/types/pc/hooks/index.d.ts +0 -1
  271. package/types/pc/index.d.ts +3 -0
  272. package/types/pc/liquid-fill/LiquidFill.d.ts +30 -0
  273. package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
  274. package/types/pc/liquid-fill/index.d.ts +4 -0
  275. package/types/pc/liquid-fill/interface.d.ts +0 -0
  276. package/types/pc/qr-code/index.d.ts +34 -0
  277. package/types/pc/qr-code/interface.d.ts +39 -0
  278. package/types/pc/table/interface.d.ts +2 -2
  279. package/types/pc/tour/index.d.ts +42 -0
  280. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  281. package/types/pc/utils/findScrollParent.d.ts +2 -0
  282. package/types/pc/utils/index.d.ts +5 -0
  283. package/types/pc/utils/intersectionObserver.d.ts +2 -0
  284. package/types/pc/utils/math.d.ts +1 -1
  285. package/types/pc/utils/mutationObserver.d.ts +2 -0
  286. package/types/pc/utils/names.d.ts +18 -0
  287. package/types/pc/utils/resizeObserver.d.ts +2 -0
  288. package/typography/Base.js +79 -81
  289. package/typography/EditContent.js +30 -33
  290. package/typography/Ellipsis.js +78 -75
  291. package/typography/Operations.js +50 -52
  292. package/typography/Paragraph.js +7 -7
  293. package/typography/Typography.js +7 -7
  294. package/typography/useEllipsis.js +105 -106
  295. package/upload/TriggerNode.js +69 -76
  296. package/upload/Upload.js +84 -87
  297. package/upload/Uploader.js +115 -118
  298. package/upload/list/PictureItem.js +61 -71
  299. package/upload/list/TextItem.js +61 -67
  300. package/upload/list/UploadProgress.js +42 -49
  301. package/upload/list/index.js +49 -50
  302. package/upload/request_.js +37 -38
  303. package/upload/util.js +39 -39
  304. package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  305. package/utils/findScrollParent.js +4 -0
  306. package/utils/index.js +274 -275
  307. package/utils/intersectionObserver.js +4 -0
  308. package/utils/math.js +7 -11
  309. package/utils/mutationObserver.js +4 -0
  310. package/utils/names.js +12 -0
  311. package/utils/reactTransitionGroup.js +1 -1
  312. package/utils/resizeObserver.js +4 -0
  313. package/verification-code/VerificationCode.js +50 -51
  314. package/version/index.js +1 -1
  315. package/virtual-list/VirtualList.js +243 -244
  316. package/virtual-list/util/item.js +3 -4
  317. package/watermark/Watermark.js +27 -31
  318. package/components/common/hooks/useComputedState.js +0 -11
  319. package/components/common/utils/resizeObserverEffect.js +0 -23
  320. package/hooks/useComputedState.js +0 -4
  321. package/types/common/hooks/useComputedState.d.ts +0 -4
  322. package/types/common/utils/resizeObserverEffect.d.ts +0 -2
  323. package/types/pc/hooks/useComputedState.d.ts +0 -1
  324. package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
  325. package/utils/resizeObserverEffect.js +0 -4
  326. /package/dist/react-transition-group/chunk/{C6QwjD4L.js → CPfP7aNL.js} +0 -0
@@ -1,52 +1,50 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as p, useState as a, useImperativeHandle as k } from "react";
3
- import x from "../Modal.js";
4
- function C(l, i) {
5
- const [f, t] = a(!0), [o, n] = a(l);
6
- k(i, () => ({
7
- update: (e) => {
8
- n(e);
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { forwardRef as d, useState as i, useImperativeHandle as p } from "react";
3
+ import g from "../Modal.js";
4
+ function k(s, f) {
5
+ const [a, e] = i(!0), [n, t] = i(s);
6
+ p(f, () => ({
7
+ update: (o) => {
8
+ t(o);
9
9
  },
10
10
  close: () => {
11
- t(!1);
11
+ e(!1);
12
12
  }
13
13
  }));
14
- function u() {
15
- var s;
16
- const e = (s = o.onOk) == null ? void 0 : s.call(o);
17
- e && e.then && (n((r) => ({
14
+ function l() {
15
+ const o = n.onOk?.();
16
+ o && o.then && (t((r) => ({
18
17
  ...r,
19
18
  confirmLoading: !0
20
- })), e.then(
19
+ })), o.then(
21
20
  () => {
22
- t(!1);
21
+ e(!1);
23
22
  },
24
23
  (r) => {
25
- console.error(r), n((m) => ({
26
- ...m,
24
+ console.error(r), t((u) => ({
25
+ ...u,
27
26
  confirmLoading: !1
28
27
  }));
29
28
  }
30
- )), e || t(!1);
29
+ )), o || e(!1);
31
30
  }
32
31
  function c() {
33
- var e;
34
- (e = o.onCancel) == null || e.call(o), t(!1);
32
+ n.onCancel?.(), e(!1);
35
33
  }
36
- return /* @__PURE__ */ d(
37
- x,
34
+ return /* @__PURE__ */ m(
35
+ g,
38
36
  {
39
37
  unmountOnExit: !0,
40
38
  simple: !0,
41
- ...o,
42
- visible: f,
43
- onOk: u,
39
+ ...n,
40
+ visible: a,
41
+ onOk: l,
44
42
  onCancel: c,
45
- children: o.content
43
+ children: n.content
46
44
  }
47
45
  );
48
46
  }
49
- const O = p(C);
47
+ const H = d(k);
50
48
  export {
51
- O as default
49
+ H as default
52
50
  };
@@ -1,68 +1,65 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as M } from "react";
3
- import { normalizeConfig as d } from "../Confirm.js";
4
- import { destroyList as w } from "../config.js";
5
- import { ContextHolderElement as E } from "../../utils/contextHolder.js";
6
- import H from "./Hook.js";
7
- function z() {
8
- const t = M(), p = /* @__PURE__ */ m(E, { ref: t });
9
- let u = 0;
10
- function s(e) {
11
- var f;
12
- u += 1;
13
- let o, n = { ...e };
14
- function C() {
15
- var r;
16
- (r = e.afterClose) == null || r.call(e), h();
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { useRef as x } from "react";
3
+ import { normalizeConfig as m } from "../Confirm.js";
4
+ import { destroyList as M } from "../config.js";
5
+ import { ContextHolderElement as w } from "../../utils/contextHolder.js";
6
+ import E from "./Hook.js";
7
+ function j() {
8
+ const r = x(), d = /* @__PURE__ */ l(w, { ref: r });
9
+ let c = 0;
10
+ function u(o) {
11
+ c += 1;
12
+ let e, t = { ...o };
13
+ function p() {
14
+ o.afterClose?.(), C();
17
15
  }
18
- const a = /* @__PURE__ */ m(
19
- H,
16
+ const i = /* @__PURE__ */ l(
17
+ E,
20
18
  {
21
- ref: (r) => {
22
- o = r;
19
+ ref: (n) => {
20
+ e = n;
23
21
  },
24
- ...d({ ...e }),
25
- afterClose: C
22
+ ...m({ ...o }),
23
+ afterClose: p
26
24
  },
27
- u
25
+ c
28
26
  );
29
- (f = t.current) == null || f.addInstance(a);
30
- function h() {
31
- var r;
32
- (r = t.current) == null || r.removeInstance(a);
27
+ r.current?.addInstance(i);
28
+ function C() {
29
+ r.current?.removeInstance(i);
33
30
  }
34
- function l() {
35
- o == null || o.close();
31
+ function a() {
32
+ e?.close();
36
33
  }
37
- function x(r) {
38
- n = {
39
- ...n,
40
- ...r
41
- }, o == null || o.update(d({ ...n }));
34
+ function h(n) {
35
+ t = {
36
+ ...t,
37
+ ...n
38
+ }, e?.update(m({ ...t }));
42
39
  }
43
- return w.push(l), {
44
- close: l,
45
- update: x
40
+ return M.push(a), {
41
+ close: a,
42
+ update: h
46
43
  };
47
44
  }
48
- function c(e) {
49
- return s({
50
- ...e
45
+ function f(o) {
46
+ return u({
47
+ ...o
51
48
  });
52
49
  }
53
- const i = {
54
- confirm: c,
55
- show: c
50
+ const s = {
51
+ confirm: f,
52
+ show: f
56
53
  // 潘启宝添加于 2023年10月18日 星期三 10时31分58秒 CST
57
54
  };
58
- return ["info", "success", "warning", "error"].forEach((e) => {
59
- i[e] = (o) => s({
60
- ...o,
55
+ return ["info", "success", "warning", "error"].forEach((o) => {
56
+ s[o] = (e) => u({
57
+ ...e,
61
58
  isNotice: !0,
62
- noticeType: e
59
+ noticeType: o
63
60
  });
64
- }), [i, p];
61
+ }), [s, d];
65
62
  }
66
63
  export {
67
- z as default
64
+ j as default
68
65
  };
package/notice/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { jsxs as $, Fragment as R, jsx as e } from "react/jsx-runtime";
2
- import E from "@unicom-cloud/icons/context";
1
+ import { jsxs as N, Fragment as F, jsx as e } from "react/jsx-runtime";
2
+ import M from "@unicom-cloud/icons/context";
3
3
  import Z from "@unicom-cloud/icons/IconUiCheckCircleFill";
4
- import j from "@unicom-cloud/icons/IconUiClose";
4
+ import R from "@unicom-cloud/icons/IconUiClose";
5
5
  import ee from "@unicom-cloud/icons/IconUiCloseCircleFill";
6
6
  import oe from "@unicom-cloud/icons/IconUiExclamationCircleFill";
7
- import re from "@unicom-cloud/icons/IconUiInfoCircleFill";
8
- import ne from "@unicom-cloud/icons/IconUiLoading";
9
- import { forwardRef as ie, useContext as D, useRef as f, useImperativeHandle as te, useEffect as H } from "react";
7
+ import ne from "@unicom-cloud/icons/IconUiInfoCircleFill";
8
+ import re from "@unicom-cloud/icons/IconUiLoading";
9
+ import { forwardRef as ie, useContext as E, useRef as f, useImperativeHandle as te, useEffect as j } from "react";
10
10
  import ce from "../config-provider/ConfigProvider.js";
11
- import L from "../config-provider/context.js";
11
+ import D from "../config-provider/context.js";
12
12
  import "lodash/isEqualWith";
13
13
  import "../components/common/utils/is.js";
14
14
  import "@unicom-cloud/utils/constant/keyboardCode";
@@ -20,7 +20,7 @@ import se from "../components/common/hooks/useMergeProps.js";
20
20
  import "../components/common/utils/reactDOM.js";
21
21
  import "@unicom-cloud/utils/constant";
22
22
  import "lodash/debounce";
23
- import O from "../icon-hover/index.js";
23
+ import H from "../icon-hover/index.js";
24
24
  import le from "@unicom-cloud/utils/class-name";
25
25
  const ae = {
26
26
  type: "info",
@@ -28,150 +28,149 @@ const ae = {
28
28
  noticeType: "message",
29
29
  duration: 3e3
30
30
  };
31
- function me(_, q) {
31
+ function me(L, O) {
32
32
  const {
33
- getPrefixCls: d,
34
- componentConfig: p,
33
+ getPrefixCls: _,
34
+ componentConfig: q,
35
35
  rtl: z
36
- } = D(L), r = se(
37
- _,
36
+ } = E(D), n = se(
37
+ L,
38
38
  ae,
39
- p == null ? void 0 : p.Notice
40
- ), A = D(L), B = d == null ? void 0 : d("notice");
39
+ q?.Notice
40
+ ), A = E(D), B = _?.("notice");
41
41
  f();
42
- const l = f(), I = f(), b = f(), {
43
- title: w,
44
- content: g,
42
+ const s = f(), v = f(), $ = f(), {
43
+ title: I,
44
+ content: b,
45
45
  showIcon: G,
46
46
  className: J,
47
47
  style: K,
48
- type: k,
49
- btn: P,
48
+ type: g,
49
+ btn: w,
50
50
  icon: Q,
51
51
  prefixCls: o,
52
- closable: u,
53
- noticeType: h,
54
- iconPrefix: y,
52
+ closable: p,
53
+ noticeType: d,
54
+ iconPrefix: P,
55
55
  rtl: S = z,
56
- closeIcon: a,
57
- classPrefixCls: T
58
- } = r, V = le(
56
+ closeIcon: l,
57
+ classPrefixCls: k
58
+ } = n, V = le(
59
59
  o,
60
- `${o}-${k}`,
60
+ `${o}-${g}`,
61
61
  {
62
- [`${o}-closable`]: u,
62
+ [`${o}-closable`]: p,
63
63
  [`${o}-rtl`]: S
64
64
  },
65
65
  J
66
66
  );
67
- let C = "closable" in r ? u : !0, x = G;
68
- k === "normal" && !Q && (x = !1);
69
- const U = { ...A };
70
- T && (U.prefixCls = T);
67
+ let u = "closable" in n ? p : !0, C = G;
68
+ g === "normal" && !Q && (C = !1);
69
+ const y = { ...A };
70
+ k && (y.prefixCls = k);
71
71
  function W() {
72
- return I.current;
72
+ return v.current;
73
73
  }
74
- function N() {
75
- const { duration: n, onClose: c, id: v } = r;
76
- n !== 0 && (l.current = window.setTimeout(() => {
77
- c == null || c(v), s();
78
- }, n));
74
+ function h() {
75
+ const { duration: i, onClose: m, id: x } = n;
76
+ i !== 0 && (s.current = window.setTimeout(() => {
77
+ m?.(x), c();
78
+ }, i));
79
79
  }
80
- function s() {
81
- l.current && (window.clearTimeout(l.current), l.current = null);
80
+ function c() {
81
+ s.current && (window.clearTimeout(s.current), s.current = null);
82
82
  }
83
- function m() {
84
- var n;
85
- (n = r.onClose) == null || n.call(r, r.id);
83
+ function a() {
84
+ n.onClose?.(n.id);
86
85
  }
87
- function F() {
88
- const { showIcon: n, icon: c, type: v, iconPrefix: M } = r;
89
- let i;
90
- if (c)
91
- i = c;
92
- else if (n) {
93
- switch (v) {
86
+ function T() {
87
+ const { showIcon: i, icon: m, type: x, iconPrefix: U } = n;
88
+ let r;
89
+ if (m)
90
+ r = m;
91
+ else if (i) {
92
+ switch (x) {
94
93
  case "info":
95
- i = /* @__PURE__ */ e(re, {});
94
+ r = /* @__PURE__ */ e(ne, {});
96
95
  break;
97
96
  case "success":
98
- i = /* @__PURE__ */ e(Z, {});
97
+ r = /* @__PURE__ */ e(Z, {});
99
98
  break;
100
99
  case "error":
101
- i = /* @__PURE__ */ e(ee, {});
100
+ r = /* @__PURE__ */ e(ee, {});
102
101
  break;
103
102
  case "warning":
104
- i = /* @__PURE__ */ e(oe, {});
103
+ r = /* @__PURE__ */ e(oe, {});
105
104
  break;
106
105
  case "loading":
107
- i = /* @__PURE__ */ e(ne, {});
106
+ r = /* @__PURE__ */ e(re, {});
108
107
  break;
109
108
  }
110
- i = /* @__PURE__ */ e(
111
- E.Provider,
109
+ r = /* @__PURE__ */ e(
110
+ M.Provider,
112
111
  {
113
- value: M ? { prefixCls: M } : {},
114
- children: i
112
+ value: U ? { prefixCls: U } : {},
113
+ children: r
115
114
  }
116
115
  );
117
116
  }
118
- return /* @__PURE__ */ e("span", { className: `${o}-icon`, children: i });
117
+ return /* @__PURE__ */ e("span", { className: `${o}-icon`, children: r });
119
118
  }
120
119
  function X() {
121
- s();
120
+ c();
122
121
  }
123
122
  function Y() {
124
- s(), N();
123
+ c(), h();
125
124
  }
126
- te(q, () => ({
125
+ te(O, () => ({
127
126
  getRootDOMNode: W
128
- }), []), H(() => {
129
- const n = b.current;
130
- return (n && (n == null ? void 0 : n.duration) !== r.duration || r.update) && (s(), N()), b.current = r, () => {
127
+ }), []), j(() => {
128
+ const i = $.current;
129
+ return (i && i?.duration !== n.duration || n.update) && (c(), h()), $.current = n, () => {
131
130
  };
132
- }, [r.duration, r.update]), H(() => (N(), () => {
133
- s();
131
+ }, [n.duration, n.update]), j(() => (h(), () => {
132
+ c();
134
133
  }), []);
135
134
  let t;
136
- return h === "message" && (C = u, t = /* @__PURE__ */ $(R, { children: [
137
- x && F(),
138
- /* @__PURE__ */ e("span", { className: `${o}-content`, children: g }),
139
- C && (a !== void 0 ? /* @__PURE__ */ e("span", { onClick: m, className: `${o}-close-btn`, children: a }) : /* @__PURE__ */ e(
140
- O,
135
+ return d === "message" && (u = p, t = /* @__PURE__ */ N(F, { children: [
136
+ C && T(),
137
+ /* @__PURE__ */ e("span", { className: `${o}-content`, children: b }),
138
+ u && (l !== void 0 ? /* @__PURE__ */ e("span", { onClick: a, className: `${o}-close-btn`, children: l }) : /* @__PURE__ */ e(
139
+ H,
141
140
  {
142
141
  prefix: o,
143
142
  className: `${o}-close-btn`,
144
- onClick: m,
145
- children: /* @__PURE__ */ e(j, {})
143
+ onClick: a,
144
+ children: /* @__PURE__ */ e(R, {})
146
145
  }
147
146
  ))
148
- ] })), h === "notification" && (t = /* @__PURE__ */ $(R, { children: [
149
- x && /* @__PURE__ */ e("div", { className: `${o}-left`, children: F() }),
150
- /* @__PURE__ */ $("div", { className: `${o}-right`, children: [
151
- w && /* @__PURE__ */ e("div", { className: `${o}-title`, children: w }),
152
- /* @__PURE__ */ e("div", { className: `${o}-content`, children: g }),
153
- P && /* @__PURE__ */ e("div", { className: `${o}-btn-wrapper`, children: P })
147
+ ] })), d === "notification" && (t = /* @__PURE__ */ N(F, { children: [
148
+ C && /* @__PURE__ */ e("div", { className: `${o}-left`, children: T() }),
149
+ /* @__PURE__ */ N("div", { className: `${o}-right`, children: [
150
+ I && /* @__PURE__ */ e("div", { className: `${o}-title`, children: I }),
151
+ /* @__PURE__ */ e("div", { className: `${o}-content`, children: b }),
152
+ w && /* @__PURE__ */ e("div", { className: `${o}-btn-wrapper`, children: w })
154
153
  ] }),
155
- C && (a !== void 0 ? /* @__PURE__ */ e("span", { onClick: m, className: `${o}-close-btn`, children: a }) : /* @__PURE__ */ e(
156
- O,
154
+ u && (l !== void 0 ? /* @__PURE__ */ e("span", { onClick: a, className: `${o}-close-btn`, children: l }) : /* @__PURE__ */ e(
155
+ H,
157
156
  {
158
157
  prefix: o,
159
158
  className: `${o}-close-btn`,
160
- onClick: m,
159
+ onClick: a,
161
160
  children: /* @__PURE__ */ e(
162
- E.Provider,
161
+ M.Provider,
163
162
  {
164
- value: y ? { prefixCls: y } : {},
165
- children: /* @__PURE__ */ e(j, {})
163
+ value: P ? { prefixCls: P } : {},
164
+ children: /* @__PURE__ */ e(R, {})
166
165
  }
167
166
  )
168
167
  }
169
168
  ))
170
- ] })), t && (t = /* @__PURE__ */ e(ce, { ...U, childrenName: "notice", children: /* @__PURE__ */ e(
169
+ ] })), t && (t = /* @__PURE__ */ e(ce, { ...y, childrenName: "notice", children: /* @__PURE__ */ e(
171
170
  "div",
172
171
  {
173
- ref: I,
174
- className: `${B}-${h}`,
172
+ ref: v,
173
+ className: `${B}-${d}`,
175
174
  onMouseEnter: X,
176
175
  onMouseLeave: Y,
177
176
  children: /* @__PURE__ */ e("div", { className: V, style: K, role: "alert", children: t })
@@ -1,11 +1,11 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as m } from "react/jsx-runtime";
2
2
  import "../dist/react-transition-group/src/CSSTransition.js";
3
3
  import "../dist/react-transition-group/src/ReplaceTransition.js";
4
4
  import "../dist/react-transition-group/src/SwitchTransition.js";
5
- import "../dist/react-transition-group/chunk/C6QwjD4L.js";
5
+ import "../dist/react-transition-group/chunk/CPfP7aNL.js";
6
6
  import L from "../dist/react-transition-group/src/TransitionGroup.js";
7
- import b from "lodash/isNumber";
8
- import y from "lodash/isUndefined";
7
+ import v from "lodash/isNumber";
8
+ import b from "lodash/isUndefined";
9
9
  import { useEffect as R } from "react";
10
10
  import { createPortal as T } from "react-dom";
11
11
  import { createRoot as _ } from "react-dom/client";
@@ -22,32 +22,32 @@ const Q = [
22
22
  "loading",
23
23
  "normal"
24
24
  ];
25
- let a = {}, x = [], E, $, w, g, u;
26
- function P(t, e) {
27
- return y(t) && (t = e || u ? "topLeft" : "topRight"), t;
25
+ let a = {}, h = [], y, E, $, g, d;
26
+ function w(t, e) {
27
+ return b(t) && (t = e || d ? "topLeft" : "topRight"), t;
28
28
  }
29
29
  function U(t) {
30
- const { prefixCls: e, rtl: r, getContainer: o, notices: l } = t, d = y(r) ? u : r, f = P(t.position, d), n = e || $, h = n ? `${n}-notification` : "pqb-notification";
30
+ const { prefixCls: e, rtl: o, getContainer: u, notices: r } = t, c = b(o) ? d : o, n = w(t.position, c), l = e || E, p = l ? `${l}-notification` : "pqb-notification";
31
31
  let C;
32
- f === "topLeft" || f === "bottomLeft" ? C = "slideNoticeLeft" : C = "slideNoticeRight";
33
- const j = S(
34
- `${h}-wrapper`,
35
- `${h}-wrapper-${f}`,
36
- { [`${h}-wrapper-rtl`]: u }
37
- ), N = o == null ? void 0 : o();
38
- function I(m) {
39
- const i = l.find((p) => p.id === m);
32
+ n === "topLeft" || n === "bottomLeft" ? C = "slideNoticeLeft" : C = "slideNoticeRight";
33
+ const P = S(
34
+ `${p}-wrapper`,
35
+ `${p}-wrapper-${n}`,
36
+ { [`${p}-wrapper-rtl`]: d }
37
+ ), x = u?.();
38
+ function j(s) {
39
+ const i = r.find((I) => I.id === s);
40
40
  i && t.update({
41
41
  ...i,
42
42
  style: { ...i.style, opacity: 0 }
43
43
  }), setTimeout(() => {
44
- t.remove(m);
44
+ t.remove(s);
45
45
  }, 200);
46
46
  }
47
47
  R(() => (t.add(t), () => {
48
48
  t.clear();
49
49
  }), []);
50
- const v = /* @__PURE__ */ s("div", { className: j, children: /* @__PURE__ */ s(L, { component: null, children: l.map((m) => /* @__PURE__ */ s(
50
+ const N = /* @__PURE__ */ m("div", { className: P, children: /* @__PURE__ */ m(L, { component: null, children: r.map((s) => /* @__PURE__ */ m(
51
51
  q,
52
52
  {
53
53
  timeout: {
@@ -62,73 +62,68 @@ function U(t) {
62
62
  i && (i.style.height = 0);
63
63
  },
64
64
  onExited: (i) => {
65
- var p;
66
- i && (i.style.height = 0, (p = m.onClose) == null || p.call(m));
65
+ i && (i.style.height = 0, s.onClose?.());
67
66
  },
68
- children: /* @__PURE__ */ s(
67
+ children: /* @__PURE__ */ m(
69
68
  O,
70
69
  {
71
- ...m,
72
- onClose: I,
73
- prefixCls: h,
74
- iconPrefix: n,
75
- classPrefixCls: n,
70
+ ...s,
71
+ onClose: j,
72
+ prefixCls: p,
73
+ iconPrefix: l,
74
+ classPrefixCls: l,
76
75
  noticeType: "notification",
77
- rtl: d
76
+ rtl: c
78
77
  }
79
78
  )
80
79
  },
81
- m.id
80
+ s.id
82
81
  )) }) });
83
- return N ? T(v, N) : v;
82
+ return x ? T(N, x) : N;
84
83
  }
85
- const c = H(U);
86
- c.useNotification = k;
87
- c.config = (t = {}) => {
88
- var e;
89
- b(t.maxCount) && (E = t.maxCount), t.prefixCls && ($ = t.prefixCls), b(t.duration) && (w = t.duration), typeof t.rtl == "boolean" && (u = t.rtl), t.getContainer && ((e = t.getContainer) == null ? void 0 : e.call(t)) !== g && (g = t.getContainer(), Object.values(a).forEach(
90
- (r) => {
91
- var o;
92
- return (o = r == null ? void 0 : r.clear) == null ? void 0 : o.call(r);
93
- }
84
+ const f = H(U);
85
+ f.useNotification = k;
86
+ f.config = (t = {}) => {
87
+ v(t.maxCount) && (y = t.maxCount), t.prefixCls && (E = t.prefixCls), v(t.duration) && ($ = t.duration), typeof t.rtl == "boolean" && (d = t.rtl), t.getContainer && t.getContainer?.() !== g && (g = t.getContainer(), Object.values(a).forEach(
88
+ (e) => e?.clear?.()
94
89
  ), a = {});
95
90
  };
96
- c.clear = () => {
91
+ f.clear = () => {
97
92
  Object.values(a).forEach((t) => {
98
- t == null || t.clear();
93
+ t?.clear();
99
94
  });
100
95
  };
101
- c.remove = (t) => {
96
+ f.remove = (t) => {
102
97
  Object.values(a).forEach((e) => {
103
- e == null || e.remove(t);
98
+ e?.remove(t);
104
99
  });
105
100
  };
106
- c.addInstance = (t) => {
107
- const e = P(t.position, u), r = a[e], o = {
108
- duration: w,
101
+ f.addInstance = (t) => {
102
+ const e = w(t.position, d), o = a[e], u = {
103
+ duration: $,
109
104
  ...t
110
105
  };
111
- if (r) {
112
- const l = r.notices.find(
113
- (f) => f.id === t.id
114
- ), d = {
115
- ...o,
116
- update: l
106
+ if (o) {
107
+ const r = o.notices.find(
108
+ (n) => n.id === t.id
109
+ ), c = {
110
+ ...u,
111
+ update: r
117
112
  };
118
- r.notices.length >= E && (l ? d.id = l.id : r.shift()), r.add({ ...d });
113
+ o.notices.length >= y && (r ? c.id = r.id : o.shift()), o.add({ ...c });
119
114
  }
120
- if (r === null && x.push(t), r === void 0) {
121
- const l = document.createElement("div");
122
- (g || document.body).appendChild(l), _(l).render(
123
- /* @__PURE__ */ s(
124
- c,
115
+ if (o === null && h.push(t), o === void 0) {
116
+ const r = document.createElement("div");
117
+ (g || document.body).appendChild(r), _(r).render(
118
+ /* @__PURE__ */ m(
119
+ f,
125
120
  {
126
- ...o,
127
- ref: (f) => {
128
- if (f) {
129
- for (let n = 0; n < x.length; n++)
130
- f.add(x[n]);
131
- x = [], a[e] = f;
121
+ ...u,
122
+ ref: (n) => {
123
+ if (n) {
124
+ for (let l = 0; l < h.length; l++)
125
+ n.add(h[l]);
126
+ h = [], a[e] = n;
132
127
  }
133
128
  }
134
129
  }
@@ -138,14 +133,14 @@ c.addInstance = (t) => {
138
133
  return a[e];
139
134
  };
140
135
  Q.forEach((t) => {
141
- c[t] = (e) => c.addInstance({
136
+ f[t] = (e) => f.addInstance({
142
137
  ...e,
143
138
  type: t
144
139
  });
145
140
  });
146
141
  export {
147
- c as default,
148
- P as getPosition,
142
+ f as default,
143
+ w as getPosition,
149
144
  Q as notificationTypes,
150
145
  k as useNotification
151
146
  };