@unicom-cloud/ui 0.8.96 → 0.8.98

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 (302) hide show
  1. package/Affix.js +1 -1
  2. package/Carousel.js +1 -1
  3. package/LiquidFill.js +4 -0
  4. package/OverflowEllipsis.js +1 -1
  5. package/PageHeader.js +1 -1
  6. package/QrCode.js +57 -0
  7. package/Tour.js +63 -0
  8. package/Trigger.js +1 -1
  9. package/_virtual/_commonjsHelpers.js +6 -0
  10. package/_virtual/index.js +7 -0
  11. package/_virtual/index2.js +4 -0
  12. package/affix/index.js +70 -72
  13. package/alert/index.js +56 -56
  14. package/anchor/Anchor.js +55 -55
  15. package/anchor/Link.js +34 -34
  16. package/anchor/util.js +5 -5
  17. package/auto-complete/index.js +116 -122
  18. package/avatar/Avatar.js +33 -33
  19. package/avatar/Group.js +26 -26
  20. package/back-top/index.js +58 -61
  21. package/badge/index.js +46 -46
  22. package/breadcrumb/Item.js +42 -43
  23. package/breadcrumb/index.js +47 -47
  24. package/button/Group.js +6 -6
  25. package/button/index.js +91 -91
  26. package/calendar/Month.js +75 -75
  27. package/calendar/Year.js +35 -35
  28. package/calendar/header/index.js +25 -25
  29. package/calendar/index.js +103 -103
  30. package/card/Grid.js +8 -8
  31. package/card/Meta.js +16 -16
  32. package/card/index.js +49 -49
  33. package/carousel/Arrow.js +19 -19
  34. package/carousel/Indicator.js +26 -26
  35. package/carousel/index.js +108 -108
  36. package/cascader/Cascader.js +178 -191
  37. package/cascader/base/node.js +133 -136
  38. package/cascader/base/store.js +82 -85
  39. package/cascader/panel/List.js +125 -129
  40. package/cascader/panel/Search.js +79 -81
  41. package/cascader/util.js +13 -13
  42. package/checkbox/Checkbox.js +94 -96
  43. package/checkbox/Group.js +54 -56
  44. package/checkbox/GroupBlock.js +28 -29
  45. package/collapse/Collapse.js +45 -45
  46. package/collapse/Item.js +53 -55
  47. package/color-picker/ControlBar.js +43 -43
  48. package/color-picker/InputAlpha.js +12 -12
  49. package/color-picker/InputHex.js +30 -31
  50. package/color-picker/InputRgb.js +24 -24
  51. package/color-picker/Palette.js +18 -18
  52. package/color-picker/Panel.js +122 -125
  53. package/color-picker/hooks/useColorPicker.js +85 -88
  54. package/color-picker/hooks/useControlBlock.js +38 -40
  55. package/color-picker/index.js +47 -47
  56. package/comment/index.js +29 -29
  57. package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
  58. package/components/common/hooks/useId.js +8 -8
  59. package/components/common/hooks/useInView.js +16 -16
  60. package/components/common/hooks/useIntersectionObserver.js +1 -1
  61. package/components/common/hooks/useKeyboardEvent.js +9 -10
  62. package/components/common/hooks/useOverflowHidden.js +1 -4
  63. package/components/common/hooks/usePersistCallback.js +7 -7
  64. package/components/common/hooks/useStateCallback.js +9 -10
  65. package/components/common/hooks/useWindowSize.js +8 -8
  66. package/components/common/space/index.js +9 -7
  67. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  68. package/components/common/utils/dom.js +27 -29
  69. package/components/common/utils/findScrollParent.js +17 -0
  70. package/components/common/utils/intersectionObserver.js +21 -0
  71. package/components/common/utils/is.js +99 -109
  72. package/components/common/utils/mutationObserver.js +19 -0
  73. package/components/common/utils/reactDOM.js +34 -34
  74. package/components/common/utils/resizeObserver.js +21 -0
  75. package/copy/index.js +38 -40
  76. package/date-picker/Picker.js +290 -295
  77. package/date-picker/RangePicker.js +367 -372
  78. package/date-picker/index.js +33 -35
  79. package/date-picker/panel/Body.js +46 -47
  80. package/date-picker/panel/Header.js +33 -33
  81. package/date-picker/panel/Shortcut.js +31 -31
  82. package/date-picker/panel/date/index.js +85 -85
  83. package/date-picker/panel/month/index.js +59 -59
  84. package/date-picker/panel/quarter/index.js +67 -70
  85. package/date-picker/panel/range/index.js +101 -101
  86. package/date-picker/panel/year/index.js +39 -39
  87. package/date-picker/util.js +17 -18
  88. package/descriptions/index.js +62 -62
  89. package/details/index.js +53 -55
  90. package/development/index.js +9 -9
  91. package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
  92. package/dist/validate/src/index.js +5 -5
  93. package/dist/validate/src/util.js +1 -1
  94. package/divider/index.js +21 -21
  95. package/draggable/Item.js +35 -35
  96. package/draggable/index.js +22 -22
  97. package/drawer/Drawer.js +142 -147
  98. package/dropdown/Button.js +48 -48
  99. package/dropdown/index.js +88 -92
  100. package/empty/index.js +16 -16
  101. package/form/Control.js +211 -225
  102. package/form/Form.js +109 -113
  103. package/form/FormItem.js +118 -120
  104. package/form/FormList.js +60 -66
  105. package/form/FormProvider.js +31 -34
  106. package/form/hook/useContext.js +17 -19
  107. package/form/hook/useState.js +22 -23
  108. package/form/hook/useWatch.js +26 -27
  109. package/form/promisify.js +14 -18
  110. package/form/store.js +304 -316
  111. package/form/util.js +14 -15
  112. package/grid/Col.js +64 -64
  113. package/grid/Grid.js +51 -51
  114. package/grid/GridItem.js +48 -48
  115. package/grid/Row.js +39 -39
  116. package/hooks/useVerificationCode.js +41 -43
  117. package/hooks/useWatermark.js +89 -92
  118. package/icon/index.js +23 -24
  119. package/icon-hover/index.js +16 -16
  120. package/icons/file.js +11 -11
  121. package/image/Image.js +140 -141
  122. package/image/ImagePreview.js +252 -255
  123. package/image/ImagePreviewArrow.js +25 -25
  124. package/image/ImagePreviewGroup.js +62 -62
  125. package/image/util/getScale.js +25 -28
  126. package/index.js +684 -675
  127. package/input/Button.js +48 -50
  128. package/input/Group.js +9 -9
  129. package/input/Input.js +145 -154
  130. package/input/InputElement.js +108 -115
  131. package/input/Password.js +38 -38
  132. package/input/Search.js +51 -55
  133. package/input/Textarea.js +80 -81
  134. package/input/useComposition.js +23 -23
  135. package/input-number/decimal.js +59 -62
  136. package/input-number/index.js +139 -141
  137. package/input-tag/InputTag.js +222 -230
  138. package/layout/Content.js +6 -6
  139. package/layout/Footer.js +8 -8
  140. package/layout/Header.js +7 -7
  141. package/layout/Sider.js +88 -90
  142. package/layout/index.js +30 -30
  143. package/link/index.js +45 -46
  144. package/liquid-fill/LiquidFill.js +226 -0
  145. package/liquid-fill/LiquidFill2.js +3 -0
  146. package/liquid-fill/index.js +4 -0
  147. package/list/Item.js +28 -28
  148. package/list/Meta.js +12 -12
  149. package/list/index.js +146 -148
  150. package/mentions/index.js +75 -76
  151. package/menu/Item.js +58 -58
  152. package/menu/Menu.js +125 -127
  153. package/menu/OverflowWrap.js +39 -40
  154. package/menu/sub-menu/Inline.js +45 -45
  155. package/menu/util.js +26 -28
  156. package/message/index.js +96 -99
  157. package/message/useMessage.js +26 -27
  158. package/modal/Confirm.js +47 -49
  159. package/modal/Modal.js +250 -257
  160. package/modal/use-modal/Hook.js +26 -28
  161. package/modal/use-modal/index.js +46 -49
  162. package/notice/index.js +89 -90
  163. package/notification/index.js +60 -65
  164. package/notification/withNotification.js +35 -35
  165. package/overflow-ellipsis/OverflowItem.js +19 -20
  166. package/overflow-ellipsis/index.js +45 -46
  167. package/package.json +1 -1
  168. package/page-header/index.js +45 -45
  169. package/pagination/PageItem.js +87 -91
  170. package/pagination/PageJumper.js +40 -41
  171. package/pagination/PageOption.js +31 -35
  172. package/pagination/Pagination.js +162 -163
  173. package/picker/Input.js +90 -96
  174. package/picker/InputRange.js +115 -122
  175. package/popconfirm/index.js +98 -100
  176. package/popover/index.js +28 -28
  177. package/portal/Portal.js +10 -11
  178. package/progress/index.js +36 -36
  179. package/qr-code/index.js +99 -0
  180. package/qr-code/interface.js +1 -0
  181. package/radio/Group.js +48 -48
  182. package/radio/GroupBlock.js +32 -33
  183. package/radio/Radio.js +62 -64
  184. package/rate/index.js +88 -88
  185. package/resize-box/ResizeTrigger.js +39 -39
  186. package/resize-box/Split.js +92 -96
  187. package/resize-box/SplitGroup.js +116 -122
  188. package/resize-box/index.js +112 -115
  189. package/result/index.js +44 -44
  190. package/select/Option.js +53 -56
  191. package/select/Select.js +365 -381
  192. package/select/util.js +95 -99
  193. package/select-view/Core.js +159 -160
  194. package/skeleton/index.js +23 -23
  195. package/slider/Button.js +84 -92
  196. package/slider/Input.js +47 -49
  197. package/slider/Tick.js +28 -31
  198. package/slider/index.js +107 -107
  199. package/space/index.js +26 -26
  200. package/space-/index.js +51 -51
  201. package/spin/DotLoading.js +8 -8
  202. package/spin/index.js +47 -47
  203. package/statistic/Countdown.js +37 -37
  204. package/statistic/index.js +58 -58
  205. package/steps/Step.js +42 -42
  206. package/steps/index.js +54 -54
  207. package/style.css +1 -1
  208. package/switch/index.js +77 -78
  209. package/table/ColGroup.js +36 -37
  210. package/table/Table.js +447 -450
  211. package/table/hook/useExpand.js +24 -24
  212. package/table/hook/useRowSelection.js +62 -62
  213. package/table/summary/Row.js +16 -17
  214. package/table/tbody/Td.js +119 -118
  215. package/table/tbody/Tr.js +119 -121
  216. package/table/tbody/index.js +62 -63
  217. package/table/th-resizable/index.js +30 -30
  218. package/table/thead/Column.js +148 -148
  219. package/table/thead/index.js +87 -88
  220. package/tabs/Tab.js +55 -55
  221. package/tabs/TabContent.js +8 -8
  222. package/tabs/TabPane.js +15 -15
  223. package/tabs/hook/useHeaderScroll.js +36 -36
  224. package/tabs/tab-header/TabInk.js +31 -33
  225. package/tabs/tab-header/TabNavIcon.js +34 -35
  226. package/tabs/tab-header/index.js +192 -195
  227. package/tag/index.js +94 -97
  228. package/time-picker/Picker.js +167 -172
  229. package/time-picker/RangePicker.js +28 -28
  230. package/time-picker/TimePicker.js +146 -146
  231. package/timeline/Item.js +46 -46
  232. package/timeline/Timeline.js +52 -52
  233. package/tooltip/index.js +89 -95
  234. package/tour/index.js +289 -0
  235. package/transfer/Item.js +54 -54
  236. package/transfer/List.js +134 -136
  237. package/transfer/index.js +91 -91
  238. package/tree/Animation.js +49 -52
  239. package/tree/Node.js +114 -122
  240. package/tree/NodeList.js +51 -51
  241. package/tree/Tree.js +386 -393
  242. package/tree-select/List.js +71 -72
  243. package/tree-select/Select.js +135 -143
  244. package/tree-select/hook/useKeyCache.js +39 -39
  245. package/tree-select/hook/useStateValue.js +12 -12
  246. package/trigger/getPopupStyle.js +60 -61
  247. package/trigger/index.js +337 -346
  248. package/types/common/space/interface.d.ts +1 -1
  249. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  250. package/types/common/utils/findScrollParent.d.ts +2 -0
  251. package/types/common/utils/index.d.ts +5 -0
  252. package/types/common/utils/intersectionObserver.d.ts +2 -0
  253. package/types/common/utils/mutationObserver.d.ts +2 -0
  254. package/types/common/utils/resizeObserver.d.ts +2 -0
  255. package/types/pc/config-provider/interface.d.ts +6 -0
  256. package/types/pc/index.d.ts +3 -0
  257. package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
  258. package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
  259. package/types/pc/liquid-fill/index.d.ts +2 -0
  260. package/types/pc/qr-code/index.d.ts +34 -0
  261. package/types/pc/qr-code/interface.d.ts +39 -0
  262. package/types/pc/table/interface.d.ts +2 -2
  263. package/types/pc/tour/index.d.ts +42 -0
  264. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  265. package/types/pc/utils/findScrollParent.d.ts +2 -0
  266. package/types/pc/utils/index.d.ts +5 -0
  267. package/types/pc/utils/intersectionObserver.d.ts +2 -0
  268. package/types/pc/utils/mutationObserver.d.ts +2 -0
  269. package/types/pc/utils/names.d.ts +18 -0
  270. package/types/pc/utils/resizeObserver.d.ts +2 -0
  271. package/typography/Base.js +79 -81
  272. package/typography/EditContent.js +30 -33
  273. package/typography/Ellipsis.js +77 -73
  274. package/typography/Operations.js +50 -52
  275. package/typography/Paragraph.js +7 -7
  276. package/typography/Typography.js +7 -7
  277. package/typography/useEllipsis.js +105 -106
  278. package/upload/TriggerNode.js +69 -76
  279. package/upload/Upload.js +84 -87
  280. package/upload/Uploader.js +115 -118
  281. package/upload/list/PictureItem.js +61 -71
  282. package/upload/list/TextItem.js +61 -67
  283. package/upload/list/UploadProgress.js +42 -49
  284. package/upload/list/index.js +48 -49
  285. package/upload/request_.js +37 -38
  286. package/upload/util.js +39 -39
  287. package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  288. package/utils/findScrollParent.js +4 -0
  289. package/utils/index.js +281 -278
  290. package/utils/intersectionObserver.js +4 -0
  291. package/utils/mutationObserver.js +4 -0
  292. package/utils/names.js +12 -0
  293. package/utils/resizeObserver.js +4 -0
  294. package/verification-code/VerificationCode.js +50 -51
  295. package/version/index.js +1 -1
  296. package/virtual-list/VirtualList.js +243 -244
  297. package/virtual-list/util/item.js +3 -4
  298. package/watermark/Watermark.js +27 -31
  299. package/components/common/utils/resizeObserverEffect.js +0 -23
  300. package/types/common/utils/resizeObserverEffect.d.ts +0 -2
  301. package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
  302. package/utils/resizeObserverEffect.js +0 -4
package/cascader/util.js CHANGED
@@ -17,7 +17,7 @@ function A(e, t) {
17
17
  const n = t ? Array.isArray(t[0]) ? t : [t] : [];
18
18
  return new k(e.options || [], n, C(e));
19
19
  }
20
- const V = (e) => (e || []).reduce((c, s) => (c.add([].concat(s).join(a)), c), /* @__PURE__ */ new Set()), i = (e, t) => {
20
+ const V = (e) => (e || []).reduce((c, o) => (c.add([].concat(o).join(a)), c), /* @__PURE__ */ new Set()), i = (e, t) => {
21
21
  const n = t || [];
22
22
  return e.has(n.join(a));
23
23
  }, v = (e, t) => {
@@ -26,29 +26,29 @@ const V = (e) => (e || []).reduce((c, s) => (c.add([].concat(s).join(a)), c), /*
26
26
  }, E = (e, t, n) => {
27
27
  let c = [];
28
28
  if (e === void 0 ? c = [] : t ? c = e : c = [e], n && n.config.showParent) {
29
- const s = n.getCheckedNodes(), h = V(
30
- s.map((o) => o.pathValue)
31
- ), f = [], l = {};
32
- return c.map((o, S, r) => {
33
- o.some((u, m, g) => {
29
+ const o = n.getCheckedNodes(), h = V(
30
+ o.map((l) => l.pathValue)
31
+ ), f = [], s = {};
32
+ return c.map((l, S, r) => {
33
+ l.some((u, m, g) => {
34
34
  const d = g.slice(0, m + 1), _ = i(h, d);
35
- return _ && !l[d.join(a)] && (f.push(d), l[d.join(a)] = 1), _;
35
+ return _ && !s[d.join(a)] && (f.push(d), s[d.join(a)] = 1), _;
36
36
  });
37
37
  }), f;
38
38
  }
39
39
  return c;
40
40
  }, N = (e) => {
41
41
  const t = (n) => Array.isArray(n) ? n.every((c) => c._checked || c.disabled ? !0 : t(c.children)) : !1;
42
- return e._halfChecked && t(e == null ? void 0 : e.children);
42
+ return e._halfChecked && t(e?.children);
43
43
  }, P = (e, t, n, c) => {
44
- const s = c && N(n) ? !1 : c, h = t.getCheckedNodes().reduce((r, u) => (r.add(u.pathValue.join(a)), r), /* @__PURE__ */ new Set());
45
- n.setCheckedState(s);
46
- const l = t.getCheckedNodes().map((r) => r.pathValue), o = V(l), S = /* @__PURE__ */ new Set();
44
+ const o = c && N(n) ? !1 : c, h = t.getCheckedNodes().reduce((r, u) => (r.add(u.pathValue.join(a)), r), /* @__PURE__ */ new Set());
45
+ n.setCheckedState(o);
46
+ const s = t.getCheckedNodes().map((r) => r.pathValue), l = V(s), S = /* @__PURE__ */ new Set();
47
47
  return e.filter((r, u, m) => {
48
- if (!i(h, r) || i(o, r))
48
+ if (!i(h, r) || i(l, r))
49
49
  return S.add(r.join(a)), !0;
50
50
  }).concat(
51
- l.filter((r, u, m) => !i(S, r))
51
+ s.filter((r, u, m) => !i(S, r))
52
52
  );
53
53
  };
54
54
  export {
@@ -1,127 +1,125 @@
1
- import { jsxs as N, jsx as r, Fragment as B } from "react/jsx-runtime";
2
- import F from "@unicom-cloud/icons/IconUiCheck";
3
- import U from "@unicom-cloud/icons/IconUiMinus";
4
- import $ from "lodash/isFunction";
5
- import D from "lodash/isNil";
6
- import h, { useRef as H, useContext as G, useEffect as L, useCallback as O } from "react";
1
+ import { jsxs as b, jsx as t, Fragment as w } from "react/jsx-runtime";
2
+ import B from "@unicom-cloud/icons/IconUiCheck";
3
+ import F from "@unicom-cloud/icons/IconUiMinus";
4
+ import x from "lodash/isFunction";
5
+ import U from "lodash/isNil";
6
+ import d, { useRef as D, useContext as g, useEffect as H, useCallback as L } from "react";
7
7
  import "../config-provider/ConfigProvider.js";
8
- import S from "../components/common/hooks/useMergeProps.js";
9
- import W from "../components/common/hooks/useMergeValue.js";
10
- import q from "../icon-hover/index.js";
11
- import z from "@unicom-cloud/utils/class-name";
12
- import { omit as A } from "../components/common/utils/omit.js";
13
- import J, { CheckboxGroupContext as K } from "./Group.js";
14
- import Q from "./GroupBlock.js";
15
- import T from "./useCheckbox.js";
16
- import X from "../config-provider/context.js";
17
- function Y(v, y) {
18
- const C = H(null), { getPrefixCls: b, componentConfig: x, rtl: V } = G(X), e = S(
19
- v,
8
+ import O from "../components/common/hooks/useMergeProps.js";
9
+ import S from "../components/common/hooks/useMergeValue.js";
10
+ import W from "../icon-hover/index.js";
11
+ import q from "@unicom-cloud/utils/class-name";
12
+ import { omit as z } from "../components/common/utils/omit.js";
13
+ import A, { CheckboxGroupContext as J } from "./Group.js";
14
+ import K from "./GroupBlock.js";
15
+ import Q from "./useCheckbox.js";
16
+ import T from "../config-provider/context.js";
17
+ function X(N, G) {
18
+ const k = D(null), { getPrefixCls: $, componentConfig: v, rtl: y } = g(T), c = O(
19
+ N,
20
20
  {},
21
- x == null ? void 0 : x.Checkbox
22
- ), t = G(K), o = b == null ? void 0 : b("checkbox"), { onGroupChange: n } = t, s = { ...e };
23
- t.isCheckboxGroup && (s.checked = t.checkboxGroupValue.indexOf(e.value) !== -1, s.disabled = "disabled" in e ? e.disabled : t.disabled);
21
+ v?.Checkbox
22
+ ), s = g(J), e = $?.("checkbox"), { onGroupChange: C } = s, r = { ...c };
23
+ s.isCheckboxGroup && (r.checked = s.checkboxGroupValue.indexOf(c.value) !== -1, r.disabled = "disabled" in c ? c.disabled : s.disabled);
24
24
  const {
25
- disabled: l,
26
- children: m,
27
- className: R,
28
- value: d,
29
- style: E,
30
- indeterminate: u,
31
- error: I,
32
- ...i
33
- } = s, [k, M] = W(!1, {
34
- value: s.checked,
35
- defaultValue: s.defaultChecked
36
- }), P = z(
37
- o,
25
+ disabled: i,
26
+ children: n,
27
+ className: V,
28
+ value: a,
29
+ style: P,
30
+ indeterminate: l,
31
+ error: R,
32
+ ...f
33
+ } = r, [m, E] = S(!1, {
34
+ value: r.checked,
35
+ defaultValue: r.defaultChecked
36
+ }), I = q(
37
+ e,
38
38
  {
39
- [`${o}-disabled`]: !!l,
40
- [`${o}-indeterminate`]: !!u,
41
- [`${o}-checked`]: k,
42
- [`${o}-rtl`]: V,
43
- error: I
39
+ [`${e}-disabled`]: !!i,
40
+ [`${e}-indeterminate`]: !!l,
41
+ [`${e}-checked`]: m,
42
+ [`${e}-rtl`]: y,
43
+ error: R
44
44
  },
45
- R
45
+ V
46
46
  );
47
- L(() => (t.registerValue(d), () => {
48
- t.unRegisterValue(d);
49
- }), [d]);
50
- const j = O(
51
- (c) => {
52
- var a;
53
- c.persist(), c.stopPropagation(), M(c.target.checked), t.isCheckboxGroup && (n == null || n(e.value, c.target.checked, c)), (a = e.onChange) == null || a.call(e, c.target.checked, c);
47
+ H(() => (s.registerValue(a), () => {
48
+ s.unRegisterValue(a);
49
+ }), [a]);
50
+ const M = L(
51
+ (o) => {
52
+ o.persist(), o.stopPropagation(), E(o.target.checked), s.isCheckboxGroup && C?.(c.value, o.target.checked, o), c.onChange?.(o.target.checked, o);
54
53
  },
55
- [n, t.isCheckboxGroup, e.onChange, e.value]
56
- ), w = h.useCallback(
57
- (c) => {
58
- var a;
59
- $(e.children) && (c.preventDefault(), C.current && C.current.click()), (a = i.onClick) == null || a.call(i, c);
54
+ [C, s.isCheckboxGroup, c.onChange, c.value]
55
+ ), j = d.useCallback(
56
+ (o) => {
57
+ x(c.children) && (o.preventDefault(), k.current && k.current.click()), f.onClick?.(o);
60
58
  },
61
- [e.children, i.onClick]
62
- ), g = { strokeWidth: 10 };
63
- let p = /* @__PURE__ */ r(
64
- F,
59
+ [c.children, f.onClick]
60
+ ), h = { strokeWidth: 10 };
61
+ let p = /* @__PURE__ */ t(
62
+ B,
65
63
  {
66
- className: `${o}-mask-icon`,
67
- style: { ...g }
64
+ className: `${e}-mask-icon`,
65
+ style: { ...h }
68
66
  }
69
67
  );
70
- return s.icon && (h.isValidElement(s.icon) ? p = h.cloneElement(s.icon, {
71
- className: `${o}-mask-icon`,
72
- style: { ...g }
73
- }) : p = s.icon), u && (p = /* @__PURE__ */ r(
74
- U,
68
+ return r.icon && (d.isValidElement(r.icon) ? p = d.cloneElement(r.icon, {
69
+ className: `${e}-mask-icon`,
70
+ style: { ...h }
71
+ }) : p = r.icon), l && (p = /* @__PURE__ */ t(
72
+ F,
75
73
  {
76
- className: `${o}-mask-icon`,
77
- style: { ...g }
74
+ className: `${e}-mask-icon`,
75
+ style: { ...h }
78
76
  }
79
- )), /* @__PURE__ */ N(
77
+ )), /* @__PURE__ */ b(
80
78
  "label",
81
79
  {
82
- ref: y,
83
- "aria-disabled": l,
84
- ...A(i, ["onChange"]),
85
- onClick: w,
86
- className: P,
87
- style: E,
80
+ ref: G,
81
+ "aria-disabled": i,
82
+ ...z(f, ["onChange"]),
83
+ onClick: j,
84
+ className: I,
85
+ style: P,
88
86
  children: [
89
- /* @__PURE__ */ r(
87
+ /* @__PURE__ */ t(
90
88
  "input",
91
89
  {
92
- value: d,
93
- disabled: !!l,
94
- ref: C,
95
- checked: !!k,
96
- onChange: j,
97
- onClick: (c) => c.stopPropagation(),
90
+ value: a,
91
+ disabled: !!i,
92
+ ref: k,
93
+ checked: !!m,
94
+ onChange: M,
95
+ onClick: (o) => o.stopPropagation(),
98
96
  type: "checkbox"
99
97
  }
100
98
  ),
101
- $(m) ? m({ checked: k, indeterminate: u }) : /* @__PURE__ */ N(B, { children: [
102
- /* @__PURE__ */ r(
103
- q,
99
+ x(n) ? n({ checked: m, indeterminate: l }) : /* @__PURE__ */ b(w, { children: [
100
+ /* @__PURE__ */ t(
101
+ W,
104
102
  {
105
- prefix: o,
106
- className: `${o}-mask-wrapper`,
107
- disabled: k || l || u,
108
- children: /* @__PURE__ */ r("div", { className: `${o}-mask`, children: p })
103
+ prefix: e,
104
+ className: `${e}-mask-wrapper`,
105
+ disabled: m || i || l,
106
+ children: /* @__PURE__ */ t("div", { className: `${e}-mask`, children: p })
109
107
  }
110
108
  ),
111
- !D(m) && /* @__PURE__ */ r("span", { className: `${o}-text`, children: m })
109
+ !U(n) && /* @__PURE__ */ t("span", { className: `${e}-text`, children: n })
112
110
  ] })
113
111
  ]
114
112
  }
115
113
  );
116
114
  }
117
- const f = h.forwardRef(Y);
118
- f.displayName = "Checkbox";
119
- f.Group = J;
120
- f.GroupBlock = Q;
121
- f.useCheckbox = T;
115
+ const u = d.forwardRef(X);
116
+ u.displayName = "Checkbox";
117
+ u.Group = A;
118
+ u.GroupBlock = K;
119
+ u.useCheckbox = Q;
122
120
  export {
123
- J as CheckboxGroup,
124
- Q as CheckboxGroupBlock,
125
- f as default,
126
- T as useCheckbox
121
+ A as CheckboxGroup,
122
+ K as CheckboxGroupBlock,
123
+ u as default,
124
+ Q as useCheckbox
127
125
  };
package/checkbox/Group.js CHANGED
@@ -1,14 +1,14 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import y from "lodash/isArray";
3
- import n from "lodash/isPlainObject";
4
- import { createContext as A, useState as P, useContext as R, useCallback as j } from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import O from "lodash/isArray";
3
+ import s from "lodash/isPlainObject";
4
+ import { createContext as P, useState as y, useContext as A, useCallback as R } from "react";
5
5
  import "../config-provider/ConfigProvider.js";
6
- import w from "../components/common/hooks/useMergeValue.js";
7
- import S from "@unicom-cloud/utils/class-name";
8
- import { pickTriggerPropsFromRest as z } from "../utils/constant.js";
9
- import F from "./Checkbox.js";
10
- import M from "../config-provider/context.js";
11
- const x = {
6
+ import j from "../components/common/hooks/useMergeValue.js";
7
+ import w from "@unicom-cloud/utils/class-name";
8
+ import { pickTriggerPropsFromRest as S } from "../utils/constant.js";
9
+ import z from "./Checkbox.js";
10
+ import F from "../config-provider/context.js";
11
+ const C = {
12
12
  isCheckboxGroup: !1,
13
13
  checkboxGroupValue: [],
14
14
  onGroupChange: () => {
@@ -17,83 +17,81 @@ const x = {
17
17
  },
18
18
  unRegisterValue: () => {
19
19
  }
20
- }, b = A(x), X = ({
20
+ }, h = P(C), W = ({
21
21
  children: r
22
- }) => /* @__PURE__ */ c(b.Provider, { value: x, children: r });
23
- function T(r) {
24
- const [o, g] = w([], {
22
+ }) => /* @__PURE__ */ n(h.Provider, { value: C, children: r });
23
+ function M(r) {
24
+ const [t, x] = j([], {
25
25
  defaultValue: "defaultValue" in r ? r.defaultValue || [] : void 0,
26
26
  value: "value" in r ? r.value || [] : void 0
27
- }), [s, m] = P([]), { getPrefixCls: i, rtl: V } = R(M), {
28
- disabled: d,
29
- options: f,
30
- style: v,
31
- className: k,
32
- error: G,
33
- children: N,
34
- direction: h = "horizontal"
35
- } = r, u = i == null ? void 0 : i("checkbox"), $ = S(
27
+ }), [i, c] = y([]), { getPrefixCls: g, rtl: b } = A(F), {
28
+ disabled: m,
29
+ options: d,
30
+ style: V,
31
+ className: p,
32
+ error: v,
33
+ children: k,
34
+ direction: f = "horizontal"
35
+ } = r, u = g?.("checkbox"), G = w(
36
36
  `${u}-group`,
37
37
  {
38
- [`${u}-group-is-error`]: G,
39
- [`${u}-group-direction-${h}`]: h,
40
- [`${u}-group-rtl`]: V
38
+ [`${u}-group-is-error`]: v,
39
+ [`${u}-group-direction-${f}`]: f,
40
+ [`${u}-group-rtl`]: b
41
41
  },
42
- k
43
- ), p = j(
42
+ p
43
+ ), N = R(
44
44
  (e, a, l) => {
45
- var C;
46
- const t = o.slice();
47
- a ? t.push(e) : t.splice(o.indexOf(e), 1), g(t), (C = r.onChange) == null || C.call(
48
- r,
49
- t.filter((O, q, B) => s.indexOf(O) > -1),
45
+ const o = t.slice();
46
+ a ? o.push(e) : o.splice(t.indexOf(e), 1), x(o), r.onChange?.(
47
+ o.filter(($, T, q) => i.indexOf($) > -1),
50
48
  l
51
49
  );
52
50
  },
53
- [o, r.onChange, s]
51
+ [t, r.onChange, i]
54
52
  );
55
- return /* @__PURE__ */ c(
53
+ return /* @__PURE__ */ n(
56
54
  "span",
57
55
  {
58
- className: $,
59
- style: v,
60
- ...z(r),
61
- children: /* @__PURE__ */ c(
62
- b.Provider,
56
+ className: G,
57
+ style: V,
58
+ ...S(r),
59
+ children: /* @__PURE__ */ n(
60
+ h.Provider,
63
61
  {
64
62
  value: {
65
63
  isCheckboxGroup: !0,
66
- checkboxGroupValue: o,
67
- onGroupChange: p,
68
- disabled: d,
64
+ checkboxGroupValue: t,
65
+ onGroupChange: N,
66
+ disabled: m,
69
67
  registerValue: (e) => {
70
- m((a) => Array.from(/* @__PURE__ */ new Set([...a, e])));
68
+ c((a) => Array.from(/* @__PURE__ */ new Set([...a, e])));
71
69
  },
72
70
  unRegisterValue: (e) => {
73
- m((a) => a.filter((l) => l !== e));
71
+ c((a) => a.filter((l) => l !== e));
74
72
  }
75
73
  },
76
- children: y(f) ? f.map((e) => {
77
- const a = n(e) ? e.label : e, l = n(e) ? e.value : e, t = n(e) ? e.icon : void 0;
78
- return /* @__PURE__ */ c(
79
- F,
74
+ children: O(d) ? d.map((e) => {
75
+ const a = s(e) ? e.label : e, l = s(e) ? e.value : e, o = s(e) ? e.icon : void 0;
76
+ return /* @__PURE__ */ n(
77
+ z,
80
78
  {
81
- disabled: d || n(e) && e.disabled,
79
+ disabled: m || s(e) && e.disabled,
82
80
  value: l,
83
- icon: t,
81
+ icon: o,
84
82
  children: a
85
83
  },
86
84
  l
87
85
  );
88
- }) : N
86
+ }) : k
89
87
  }
90
88
  )
91
89
  }
92
90
  );
93
91
  }
94
- T.displayName = "CheckboxGroup";
92
+ M.displayName = "CheckboxGroup";
95
93
  export {
96
- b as CheckboxGroupContext,
97
- X as ClearCheckboxGroupContext,
98
- T as default
94
+ h as CheckboxGroupContext,
95
+ W as ClearCheckboxGroupContext,
96
+ M as default
99
97
  };
@@ -1,34 +1,33 @@
1
- import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
- import { useContext as f } from "react";
1
+ import { jsx as a, jsxs as t } from "react/jsx-runtime";
2
+ import { useContext as u } from "react";
3
3
  import "../config-provider/ConfigProvider.js";
4
- import n from "../typography/index.js";
5
- import i from "@unicom-cloud/utils/class-name";
6
- import d from "./Checkbox.js";
7
- import N from "../config-provider/context.js";
8
- function k(c) {
9
- const { getPrefixCls: t, rtl: C } = f(N), { className: m, options: h, ...p } = c, e = t == null ? void 0 : t("checkbox-group-block");
10
- return /* @__PURE__ */ o(
11
- d.Group,
4
+ import c from "../typography/index.js";
5
+ import l from "@unicom-cloud/utils/class-name";
6
+ import n from "./Checkbox.js";
7
+ import f from "../config-provider/context.js";
8
+ function C(s) {
9
+ const { getPrefixCls: i, rtl: N } = u(f), { className: d, options: m, ...p } = s, e = i?.("checkbox-group-block");
10
+ return /* @__PURE__ */ a(
11
+ n.Group,
12
12
  {
13
- className: i(`${e}`, m),
13
+ className: l(`${e}`, d),
14
14
  ...p,
15
- onChange: (a, r) => {
16
- var s;
17
- (s = c.onChange) == null || s.call(c, a, r);
15
+ onChange: (o, r) => {
16
+ s.onChange?.(o, r);
18
17
  },
19
- children: h.map((a, r, s) => /* @__PURE__ */ o(d, { value: a.value, children: ({ checked: u }) => /* @__PURE__ */ l(
18
+ children: m.map((o, r, k) => /* @__PURE__ */ a(n, { value: o.value, children: ({ checked: h }) => /* @__PURE__ */ t(
20
19
  "div",
21
20
  {
22
- style: { width: a.width },
23
- className: i(
21
+ style: { width: o.width },
22
+ className: l(
24
23
  `${e}-card`,
25
- u && `${e}-card-checked`
24
+ h && `${e}-card-checked`
26
25
  ),
27
26
  children: [
28
- /* @__PURE__ */ o("div", { className: `${e}-card-mask`, children: /* @__PURE__ */ o("div", { className: `${e}-card-mask-dot` }) }),
29
- /* @__PURE__ */ l("div", { className: `${e}-card-content`, children: [
30
- /* @__PURE__ */ o(
31
- n.Ellipsis,
27
+ /* @__PURE__ */ a("div", { className: `${e}-card-mask`, children: /* @__PURE__ */ a("div", { className: `${e}-card-mask-dot` }) }),
28
+ /* @__PURE__ */ t("div", { className: `${e}-card-content`, children: [
29
+ /* @__PURE__ */ a(
30
+ c.Ellipsis,
32
31
  {
33
32
  className: `${e}-card-content-title`,
34
33
  rows: 1,
@@ -36,11 +35,11 @@ function k(c) {
36
35
  expandable: !1,
37
36
  onExpand: (x) => {
38
37
  },
39
- children: a.title
38
+ children: o.title
40
39
  }
41
40
  ),
42
- /* @__PURE__ */ o(
43
- n.Ellipsis,
41
+ /* @__PURE__ */ a(
42
+ c.Ellipsis,
44
43
  {
45
44
  className: `${e}-card-content-desc`,
46
45
  rows: 1,
@@ -48,17 +47,17 @@ function k(c) {
48
47
  expandable: !1,
49
48
  onExpand: (x) => {
50
49
  },
51
- children: a.desc
50
+ children: o.desc
52
51
  }
53
52
  )
54
53
  ] })
55
54
  ]
56
55
  }
57
- ) }, a.title))
56
+ ) }, o.title))
58
57
  }
59
58
  );
60
59
  }
61
- k.displayName = "CheckboxGroupBlock";
60
+ C.displayName = "CheckboxGroupBlock";
62
61
  export {
63
- k as default
62
+ C as default
64
63
  };
@@ -1,6 +1,6 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import z from "@unicom-cloud/icons/IconUiCaretLeft";
3
- import u from "@unicom-cloud/icons/IconUiCaretRight";
3
+ import f from "@unicom-cloud/icons/IconUiCaretRight";
4
4
  import F from "lodash/isFunction";
5
5
  import M, { createContext as O, useContext as T } from "react";
6
6
  import "../config-provider/ConfigProvider.js";
@@ -10,81 +10,81 @@ import j from "@unicom-cloud/utils/class-name";
10
10
  import { omit as H } from "../components/common/utils/omit.js";
11
11
  import L from "./Item.js";
12
12
  import q from "../config-provider/context.js";
13
- const f = (s, a) => {
14
- const o = [].concat(s);
15
- return a ? o.slice(0, 1) : o;
13
+ const m = (i, s) => {
14
+ const n = [].concat(i);
15
+ return s ? n.slice(0, 1) : n;
16
16
  }, B = {
17
17
  bordered: !0,
18
18
  lazyload: !0,
19
19
  expandIconPosition: "left"
20
20
  }, D = O({
21
21
  expandIconPosition: "left",
22
- expandIcon: /* @__PURE__ */ n(u, {}),
22
+ expandIcon: /* @__PURE__ */ t(f, {}),
23
23
  activeKeys: [],
24
24
  onToggle: () => {
25
25
  }
26
26
  });
27
- function E(s, a) {
28
- const { getPrefixCls: o, componentConfig: c, rtl: C } = T(q), e = U(
29
- s,
27
+ function E(i, s) {
28
+ const { getPrefixCls: n, componentConfig: C, rtl: v } = T(q), e = U(
29
+ i,
30
30
  B,
31
- c == null ? void 0 : c.Collapse
32
- ), [t, x] = V([], {
33
- defaultValue: "defaultActiveKey" in e ? f(e.defaultActiveKey, e.accordion) : void 0,
34
- value: "activeKey" in e ? f(e.activeKey, e.accordion) : void 0
31
+ C?.Collapse
32
+ ), [a, x] = V([], {
33
+ defaultValue: "defaultActiveKey" in e ? m(e.defaultActiveKey, e.accordion) : void 0,
34
+ value: "activeKey" in e ? m(e.activeKey, e.accordion) : void 0
35
35
  }), {
36
- children: I,
37
- className: g,
38
- style: y,
36
+ children: g,
37
+ className: y,
38
+ style: I,
39
39
  bordered: K,
40
- lazyload: h,
41
- expandIcon: A,
42
- expandIconPosition: d,
43
- destroyOnHide: R,
44
- accordion: N,
45
- triggerRegion: P,
40
+ lazyload: P,
41
+ expandIcon: h,
42
+ expandIconPosition: l,
43
+ destroyOnHide: A,
44
+ accordion: R,
45
+ triggerRegion: N,
46
46
  onChange: p,
47
47
  ...b
48
- } = e, l = o == null ? void 0 : o("collapse"), $ = (i, w) => {
49
- let r = [...t || []];
50
- const m = t == null ? void 0 : t.indexOf(i);
51
- m > -1 ? r.splice(m, 1) : N ? r = [i] : r.push(i), "activeKey" in e || x(r), F(p) && p(i, r, w);
48
+ } = e, c = n?.("collapse"), $ = (r, w) => {
49
+ let o = [...a || []];
50
+ const d = a?.indexOf(r);
51
+ d > -1 ? o.splice(d, 1) : R ? o = [r] : o.push(r), "activeKey" in e || x(o), F(p) && p(r, o, w);
52
52
  };
53
- return /* @__PURE__ */ n(
53
+ return /* @__PURE__ */ t(
54
54
  D.Provider,
55
55
  {
56
56
  value: {
57
- activeKeys: t,
58
- triggerRegion: P,
59
- lazyload: h,
60
- destroyOnHide: R,
61
- expandIconPosition: d,
57
+ activeKeys: a,
58
+ triggerRegion: N,
59
+ lazyload: P,
60
+ destroyOnHide: A,
61
+ expandIconPosition: l,
62
62
  onToggle: $,
63
- expandIcon: "expandIcon" in e ? A : d === "right" ? /* @__PURE__ */ n(z, {}) : /* @__PURE__ */ n(u, {})
63
+ expandIcon: "expandIcon" in e ? h : l === "right" ? /* @__PURE__ */ t(z, {}) : /* @__PURE__ */ t(f, {})
64
64
  },
65
- children: /* @__PURE__ */ n(
65
+ children: /* @__PURE__ */ t(
66
66
  "div",
67
67
  {
68
- ref: a,
68
+ ref: s,
69
69
  ...H(b, ["activeKey", "defaultActiveKey"]),
70
70
  className: j(
71
- l,
72
- `${l}-${K ? "border" : "borderless"}`,
73
- { [`${l}-rtl`]: C },
74
- g
71
+ c,
72
+ `${c}-${K ? "border" : "borderless"}`,
73
+ { [`${c}-rtl`]: v },
74
+ y
75
75
  ),
76
- style: y,
77
- children: I
76
+ style: I,
77
+ children: g
78
78
  }
79
79
  )
80
80
  }
81
81
  );
82
82
  }
83
- const G = M.forwardRef(E), v = G;
84
- v.displayName = "Collapse";
85
- v.Item = L;
83
+ const G = M.forwardRef(E), u = G;
84
+ u.displayName = "Collapse";
85
+ u.Item = L;
86
86
  export {
87
87
  D as CollapseContext,
88
88
  L as CollapseItem,
89
- v as default
89
+ u as default
90
90
  };