@unicom-cloud/ui 0.8.101 → 0.8.103

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 (141) hide show
  1. package/Badge.js +7 -54
  2. package/Copy.js +6 -5
  3. package/LiquidFill.js +6 -5
  4. package/List.js +1 -1
  5. package/Marquee.js +6 -5
  6. package/QrCode.js +6 -5
  7. package/Tooltip.js +3 -4
  8. package/Tour.js +6 -5
  9. package/anchor/Anchor.js +12 -12
  10. package/anchor/util.js +10 -10
  11. package/back-top/index.js +7 -7
  12. package/badge/index.js +109 -162
  13. package/card/index.js +63 -43
  14. package/color-picker/InputHex.js +3 -4
  15. package/color-picker/InputRgb.js +7 -8
  16. package/color-picker/Palette.js +3 -4
  17. package/color-picker/Panel.js +3 -4
  18. package/color-picker/colors.js +5 -5
  19. package/color-picker/hooks/useColorPicker.js +3 -4
  20. package/color-picker/utils.js +14 -15
  21. package/components/common/space/index.js +24 -24
  22. package/components/common/utils/PqbCSSTransition.js +1 -1
  23. package/components/common/utils/constant.js +6 -3
  24. package/components/common/utils/reactDOM.js +6 -4
  25. package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
  26. package/components/common/utils/setPrimaryColor.js +18 -18
  27. package/components/common/utils/setTheme.js +8 -9
  28. package/copy/index.js +4 -3
  29. package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
  30. package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
  31. package/dist/scroll-into-view-if-needed/src/index.js +19 -19
  32. package/form/FormItem.js +69 -65
  33. package/form/context.js +6 -7
  34. package/grid/Col-.js +86 -0
  35. package/grid/Col.js +156 -73
  36. package/grid/Grid.js +71 -67
  37. package/grid/Row.js +53 -44
  38. package/grid/index.js +13 -13
  39. package/index.js +639 -662
  40. package/input/Textarea.js +1 -1
  41. package/input/autoSizeTextAreaHeight.js +7 -7
  42. package/liquid-fill/index.js +6 -5
  43. package/liquid-fill/interface.js +1 -0
  44. package/list/index.js +1 -1
  45. package/marquee/index.js +141 -223
  46. package/marquee/interface.js +1 -0
  47. package/marquee-/index.js +260 -0
  48. package/marquee-/interface.js +1 -0
  49. package/menu/Item.js +9 -9
  50. package/package.json +1 -1
  51. package/qr-code/index.js +6 -5
  52. package/splitter/SplitBar.js +81 -79
  53. package/splitter/Splitter.js +70 -78
  54. package/splitter/hooks/useResizable.js +9 -18
  55. package/splitter/hooks/useResize.js +10 -10
  56. package/splitter/hooks/useSizes.js +28 -28
  57. package/statistic/index.js +10 -10
  58. package/style.css +1 -1
  59. package/table/Table.js +369 -370
  60. package/table/hook/useThResizable.js +6 -5
  61. package/table/th-resizable/index.js +13 -12
  62. package/time-picker/util.js +8 -8
  63. package/tooltip/index.js +1 -2
  64. package/tour/index.js +6 -5
  65. package/tour/interface.js +1 -0
  66. package/tree/NodeList.js +1 -1
  67. package/types/common/utils/constant.d.ts +1 -0
  68. package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
  69. package/types/common/utils/tree.d.ts +1 -0
  70. package/types/common/utils/tween.d.ts +1 -0
  71. package/types/pc/anchor/util.d.ts +1 -1
  72. package/types/pc/badge/interface.d.ts +2 -0
  73. package/types/pc/card/interface.d.ts +8 -0
  74. package/types/pc/color-picker/hooks/useColorPicker.d.ts +7 -2
  75. package/types/pc/color-picker/utils.d.ts +6 -1
  76. package/types/pc/config-provider/interface.d.ts +8 -8
  77. package/types/pc/form/FormItem.d.ts +1 -1
  78. package/types/pc/grid/Col-.d.ts +4 -0
  79. package/types/pc/grid/Col.d.ts +3 -2
  80. package/types/pc/grid/Grid.d.ts +2 -2
  81. package/types/pc/grid/Item.d.ts +3 -3
  82. package/types/pc/grid/Row.d.ts +3 -2
  83. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  84. package/types/pc/grid/interface.d.ts +13 -7
  85. package/types/pc/index.d.ts +4 -4
  86. package/types/pc/liquid-fill/index.d.ts +2 -113
  87. package/types/pc/liquid-fill/interface.d.ts +113 -0
  88. package/types/pc/marquee/index.d.ts +3 -60
  89. package/types/pc/marquee/interface.d.ts +95 -0
  90. package/types/pc/marquee-/index.d.ts +8 -0
  91. package/types/pc/marquee-/interface.d.ts +56 -0
  92. package/types/pc/qr-code/index.d.ts +1 -31
  93. package/types/pc/qr-code/interface.d.ts +26 -33
  94. package/types/pc/splitter/SplitBar.d.ts +0 -1
  95. package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
  96. package/types/pc/splitter/hooks/useResize.d.ts +1 -2
  97. package/types/pc/splitter/interface.d.ts +0 -8
  98. package/types/pc/tour/index.d.ts +2 -45
  99. package/types/pc/tour/interface.d.ts +46 -0
  100. package/types/pc/upload/interface.d.ts +1 -0
  101. package/types/pc/utils/constant.d.ts +1 -2
  102. package/types/pc/utils/dayjs.d.ts +2 -1
  103. package/types/pc/utils/index.d.ts +2 -5
  104. package/types/pc/utils/responsiveObserve.d.ts +8 -4
  105. package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
  106. package/types/pc/utils/tree.d.ts +2 -1
  107. package/types/pc/utils/tween.d.ts +1 -1
  108. package/typography/Ellipsis.js +6 -5
  109. package/typography/Operations.js +6 -5
  110. package/upload/request.js +12 -13
  111. package/upload/request_.js +2 -3
  112. package/utils/constant.js +5 -5
  113. package/utils/dayjs.js +13 -12
  114. package/utils/index.js +261 -284
  115. package/utils/responsiveObserve.js +32 -25
  116. package/utils/scrollIntoViewIfNeeded.js +12 -0
  117. package/utils/tree.js +11 -9
  118. package/utils/tween.js +5 -5
  119. package/version/index.js +1 -1
  120. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  121. package/dist/compute-scroll-into-view/src/index.js +0 -126
  122. package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
  123. package/dist/tinycolor/customize/index.js +0 -12
  124. package/dist/tinycolor/src/conversion.js +0 -143
  125. package/dist/tinycolor/src/css-color-names.js +0 -153
  126. package/dist/tinycolor/src/format-input.js +0 -77
  127. package/dist/tinycolor/src/index.js +0 -388
  128. package/dist/tinycolor/src/util.js +0 -32
  129. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  130. package/types/common/utils/scrollIntoView.d.ts +0 -4
  131. package/types/common/utils/tinycolor.d.ts +0 -1
  132. package/types/pc/utils/color.d.ts +0 -1
  133. package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
  134. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  135. package/types/pc/utils/scrollIntoView.d.ts +0 -3
  136. package/types/pc/utils/tinycolor.d.ts +0 -1
  137. package/utils/color.js +0 -4
  138. package/utils/computeScrollIntoView.js +0 -6
  139. package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  140. package/utils/scrollIntoView.js +0 -6
  141. package/utils/tinycolor.js +0 -29
@@ -0,0 +1,260 @@
1
+ import { jsxs as z, jsx as m, Fragment as x } from "react/jsx-runtime";
2
+ import { useContext as V, useRef as C, useState as d, useEffect as F } from "react";
3
+ import "../config-provider/ConfigProvider.js";
4
+ import "lodash/isEqualWith";
5
+ import "../components/common/utils/is.js";
6
+ import "@unicom-cloud/utils/constant/keyboardCode";
7
+ import "lodash/isNumber";
8
+ import Z from "lodash/merge";
9
+ import "../components/common/utils/dom.js";
10
+ import "../components/common/hooks/useIntersectionObserver.js";
11
+ import _ from "../components/common/hooks/useMergeProps.js";
12
+ import "../components/common/utils/reactDOM.js";
13
+ import "@unicom-cloud/utils/constant";
14
+ import "lodash/debounce";
15
+ import "@unicom-cloud/utils/date";
16
+ import "@unicom-cloud/utils/case-name";
17
+ import tt from "@unicom-cloud/utils/class-name";
18
+ import "@unicom-cloud/utils/constant/ui";
19
+ import "../utils/contextHolder.js";
20
+ import "@unicom-cloud/utils/clipboard-copy";
21
+ import "../components/common/utils/dayjs.js";
22
+ import "@unicom-cloud/utils/file/fileToURL";
23
+ import "lodash/escapeRegExp";
24
+ import "lodash/isArray";
25
+ import "lodash/isString";
26
+ import "lodash/isFunction";
27
+ import "lodash/throttle";
28
+ import "lodash/camelCase";
29
+ import "lodash/capitalize";
30
+ import "lodash/cloneDeep";
31
+ import "lodash/get";
32
+ import "lodash/has";
33
+ import "lodash/kebabCase";
34
+ import "lodash/mergeWith";
35
+ import "lodash/set";
36
+ import "lodash/setWith";
37
+ import "lodash/snakeCase";
38
+ import "lodash/startCase";
39
+ import "lodash/uniq";
40
+ import "lodash/upperFirst";
41
+ import "@unicom-cloud/utils/math";
42
+ import "lodash/isPlainObject";
43
+ import "../dist/react-transition-group/src/CSSTransition.js";
44
+ import "../dist/react-transition-group/src/ReplaceTransition.js";
45
+ import "../dist/react-transition-group/src/SwitchTransition.js";
46
+ import "../dist/react-transition-group/chunk/CPfP7aNL.js";
47
+ import "../dist/react-transition-group/src/TransitionGroup.js";
48
+ import { resizeObserver as et } from "../components/common/utils/resizeObserver.js";
49
+ import "uuid";
50
+ import "@unicom-cloud/utils/file/saveAs";
51
+ import "@unicom-cloud/utils/screenfull";
52
+ import "@unicom-cloud/utils/tinycolor";
53
+ import "@unicom-cloud/utils/ui-color";
54
+ import "@unicom-cloud/utils/constant/ui.js";
55
+ import "react-is";
56
+ import "@unicom-cloud/utils/tree";
57
+ import { isPlainObject as q } from "@unicom-cloud/utils/is";
58
+ import "../dist/validate/src/index.js";
59
+ import rt from "../config-provider/context.js";
60
+ const ot = {
61
+ speed: 50,
62
+ direction: "left",
63
+ pauseOnHover: !1,
64
+ loop: 0
65
+ }, me = (R) => {
66
+ const { getPrefixCls: L, componentConfig: D } = V(rt), s = L?.("marquee"), E = _(
67
+ R,
68
+ ot,
69
+ D?.Marquee
70
+ ), {
71
+ children: N,
72
+ style: W,
73
+ className: j,
74
+ speed: A = 50,
75
+ direction: l = "left",
76
+ pauseOnHover: P = !1,
77
+ loop: a = 0,
78
+ gradient: T = { color: "#fff" },
79
+ onComplete: h
80
+ } = E, g = C(null), B = C(null), $ = C(null), c = C(), [S, I] = d({ width: 0, height: 0 }), [it, X] = d({ width: 0, height: 0 }), [y, Y] = d(!1), [H, p] = d(!0), [k, f] = d(0), [M, b] = d(0), i = l === "left" || l === "right";
81
+ let o = T;
82
+ q(o) && (o = Z(
83
+ { size: i ? 50 : 20, color: "#fff" },
84
+ o
85
+ ));
86
+ const O = () => {
87
+ if ($.current && g.current) {
88
+ const r = $.current.scrollWidth, t = $.current.scrollHeight, n = g.current.offsetWidth, e = g.current.offsetHeight;
89
+ I({ width: r, height: t }), X({ width: n, height: e });
90
+ const u = i ? r > n : t > e;
91
+ if (Y(u), u) {
92
+ const v = l === "right" ? -r : l === "down" ? -t : 0;
93
+ f(v);
94
+ }
95
+ }
96
+ };
97
+ F(() => {
98
+ const r = g.current;
99
+ if (!r)
100
+ return;
101
+ const t = et([r], O);
102
+ return () => t();
103
+ }, []), F(() => {
104
+ O(), b(0);
105
+ }, [N]), F(() => {
106
+ if (!H || !y)
107
+ return;
108
+ let r = null, t = k;
109
+ const n = i ? S.width : S.height;
110
+ let e = M;
111
+ const u = (v) => {
112
+ if (!r) {
113
+ r = v, c.current = requestAnimationFrame(u);
114
+ return;
115
+ }
116
+ const U = (v - r) / 1e3;
117
+ r = v;
118
+ const w = A * U;
119
+ switch (l) {
120
+ case "left":
121
+ if (t -= w, t <= -n && (t += n, e += 1, b(e), a > 0 && e >= a)) {
122
+ cancelAnimationFrame(c.current), p(!1), f(0), h?.();
123
+ return;
124
+ }
125
+ break;
126
+ case "right":
127
+ if (t += w, t >= 0 && (t -= n, e += 1, b(e), a > 0 && e >= a)) {
128
+ cancelAnimationFrame(c.current), p(!1), f(-n), h?.();
129
+ return;
130
+ }
131
+ break;
132
+ case "up":
133
+ if (t -= w, t <= -n && (t += n, e += 1, b(e), a > 0 && e >= a)) {
134
+ cancelAnimationFrame(c.current), p(!1), f(0), h?.();
135
+ return;
136
+ }
137
+ break;
138
+ case "down":
139
+ if (t += w, t >= 0 && (t -= n, e += 1, b(e), a > 0 && e >= a)) {
140
+ cancelAnimationFrame(c.current), p(!1), f(-n), h?.();
141
+ return;
142
+ }
143
+ break;
144
+ }
145
+ f(t), c.current = requestAnimationFrame(u);
146
+ };
147
+ return c.current = requestAnimationFrame(u), () => {
148
+ c.current && cancelAnimationFrame(c.current);
149
+ };
150
+ }, [
151
+ H,
152
+ A,
153
+ l,
154
+ S,
155
+ y,
156
+ a,
157
+ M,
158
+ k,
159
+ i,
160
+ h
161
+ ]);
162
+ const G = () => {
163
+ P && p(!1);
164
+ }, J = () => {
165
+ P && p(!0);
166
+ }, K = () => i ? `translateX(${k}px)` : `translateY(${k}px)`, Q = () => {
167
+ const r = {
168
+ display: i ? "inline-block" : "block",
169
+ whiteSpace: i ? "nowrap" : "normal",
170
+ marginRight: i ? 0 : void 0,
171
+ marginBottom: i ? void 0 : 0
172
+ }, t = /* @__PURE__ */ m(
173
+ "div",
174
+ {
175
+ ref: $,
176
+ style: r,
177
+ className: `${s}-children`,
178
+ children: N
179
+ }
180
+ );
181
+ return y ? /* @__PURE__ */ z(x, { children: [
182
+ t,
183
+ /* @__PURE__ */ m("div", { style: r, className: `${s}-children`, children: N })
184
+ ] }) : t;
185
+ };
186
+ return /* @__PURE__ */ z(
187
+ "div",
188
+ {
189
+ ref: g,
190
+ style: W,
191
+ className: tt(
192
+ s,
193
+ `${s}-${l}`,
194
+ j
195
+ ),
196
+ onMouseEnter: G,
197
+ onMouseLeave: J,
198
+ children: [
199
+ /* @__PURE__ */ m(
200
+ "div",
201
+ {
202
+ ref: B,
203
+ style: {
204
+ display: i ? "inline-block" : "block",
205
+ transform: K()
206
+ },
207
+ className: `${s}-content`,
208
+ children: Q()
209
+ }
210
+ ),
211
+ q(o) && y && (i ? /* @__PURE__ */ z(x, { children: [
212
+ /* @__PURE__ */ m(
213
+ "div",
214
+ {
215
+ style: {
216
+ width: o.size,
217
+ background: `linear-gradient(to right, ${o.color}, transparent)`
218
+ },
219
+ className: `${s}-linear-gradient-to-right`
220
+ }
221
+ ),
222
+ /* @__PURE__ */ m(
223
+ "div",
224
+ {
225
+ style: {
226
+ width: o.size,
227
+ background: `linear-gradient(to left, ${o.color}, transparent)`
228
+ },
229
+ className: `${s}-linear-gradient-to-left`
230
+ }
231
+ )
232
+ ] }) : /* @__PURE__ */ z(x, { children: [
233
+ /* @__PURE__ */ m(
234
+ "div",
235
+ {
236
+ style: {
237
+ height: o.size,
238
+ background: `linear-gradient(to top, ${o.color}, transparent)`
239
+ },
240
+ className: `${s}-linear-gradient-to-bottom`
241
+ }
242
+ ),
243
+ /* @__PURE__ */ m(
244
+ "div",
245
+ {
246
+ style: {
247
+ height: o.size,
248
+ background: `linear-gradient(to bottom, ${o.color}, transparent)`
249
+ },
250
+ className: `${s}-linear-gradient-to-top`
251
+ }
252
+ )
253
+ ] }))
254
+ ]
255
+ }
256
+ );
257
+ };
258
+ export {
259
+ me as default
260
+ };
@@ -0,0 +1 @@
1
+
package/menu/Item.js CHANGED
@@ -5,11 +5,11 @@ import U from "../components/common/hooks/useIsFirstRender.js";
5
5
  import z from "../tooltip/index.js";
6
6
  import A from "@unicom-cloud/utils/class-name";
7
7
  import { Enter as H } from "@unicom-cloud/utils/constant/keyboardCode";
8
- import { omit as h } from "../components/common/utils/omit.js";
8
+ import { omit as b } from "../components/common/utils/omit.js";
9
9
  import V from "./Indent.js";
10
10
  import W from "./context.js";
11
11
  import { PROPS_NEED_TO_BE_PASSED_IN_SUBMENU as q } from "./util.js";
12
- function G(b, c) {
12
+ function G(C, c) {
13
13
  const {
14
14
  _key: a,
15
15
  children: i,
@@ -21,7 +21,7 @@ function G(b, c) {
21
21
  onClick: _,
22
22
  renderItemInTooltip: d,
23
23
  ...$
24
- } = b, {
24
+ } = C, {
25
25
  prefixCls: t,
26
26
  mode: p,
27
27
  collapse: m,
@@ -74,7 +74,7 @@ function G(b, c) {
74
74
  onKeyDown: (e) => {
75
75
  e.key === H.key && k(e);
76
76
  },
77
- ...h(
77
+ ...b(
78
78
  $,
79
79
  ["key", "_key"].concat(q)
80
80
  ),
@@ -113,14 +113,14 @@ function G(b, c) {
113
113
  className: `${t}-item-tooltip`,
114
114
  ...y?.triggerProps || {}
115
115
  },
116
- ...h(y, ["triggerProps"]),
116
+ ...b(y, ["triggerProps"]),
117
117
  children: g
118
118
  }
119
119
  ) : g;
120
120
  }
121
- const J = O(G), C = J;
122
- C.displayName = "MenuItem";
123
- C.menuType = "MenuItem";
121
+ const J = O(G), h = J;
122
+ h.displayName = "MenuItem";
123
+ h.menuType = "MenuItem";
124
124
  export {
125
- C as default
125
+ h as default
126
126
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui","version":"0.8.101","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.10","lodash":"^4.17.21","react":"^18.3.1","react-dom":"^18.3.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui","version":"0.8.103","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"react":"^18.3.1","react-dom":"^18.3.1","dayjs":"^1.11.10","lodash":"^4.17.21","uuid":"^11.1.0","qrcode.react":"^4.2.0"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
package/qr-code/index.js CHANGED
@@ -13,12 +13,11 @@ import R from "../components/common/hooks/useMergeProps.js";
13
13
  import "../components/common/utils/reactDOM.js";
14
14
  import "@unicom-cloud/utils/constant";
15
15
  import "lodash/debounce";
16
+ import "@unicom-cloud/utils/date";
16
17
  import "@unicom-cloud/utils/case-name";
17
18
  import S from "@unicom-cloud/utils/class-name";
18
- import "../dist/tinycolor/chunk/BOzCVdr0.js";
19
19
  import "@unicom-cloud/utils/constant/ui";
20
20
  import "../utils/contextHolder.js";
21
- import "@unicom-cloud/utils/dayjs";
22
21
  import "@unicom-cloud/utils/clipboard-copy";
23
22
  import "../components/common/utils/dayjs.js";
24
23
  import "@unicom-cloud/utils/file/fileToURL";
@@ -47,13 +46,15 @@ import "../dist/react-transition-group/src/ReplaceTransition.js";
47
46
  import "../dist/react-transition-group/src/SwitchTransition.js";
48
47
  import "../dist/react-transition-group/chunk/CPfP7aNL.js";
49
48
  import "../dist/react-transition-group/src/TransitionGroup.js";
49
+ import "uuid";
50
50
  import "@unicom-cloud/utils/file/saveAs";
51
51
  import "@unicom-cloud/utils/screenfull";
52
+ import "@unicom-cloud/utils/tinycolor";
53
+ import "@unicom-cloud/utils/ui-color";
52
54
  import "@unicom-cloud/utils/constant/ui.js";
53
55
  import "react-is";
54
56
  import "@unicom-cloud/utils/tree";
55
57
  import "@unicom-cloud/utils/is";
56
- import "uuid";
57
58
  import "../dist/validate/src/index.js";
58
59
  import h from "../config-provider/context.js";
59
60
  const q = {
@@ -65,7 +66,7 @@ const q = {
65
66
  bgColor: "#ffffff",
66
67
  marginSize: 0,
67
68
  value: "qr-code"
68
- }, $o = (e) => {
69
+ }, jo = (e) => {
69
70
  const { getPrefixCls: s, componentConfig: n } = Q(h), d = R(
70
71
  e,
71
72
  q,
@@ -113,5 +114,5 @@ const q = {
113
114
  );
114
115
  };
115
116
  export {
116
- $o as default
117
+ jo as default
117
118
  };
@@ -1,127 +1,129 @@
1
- import { jsxs as H, jsx as l } from "react/jsx-runtime";
2
- import J from "@unicom-cloud/icons/IconUiDown";
3
- import K from "@unicom-cloud/icons/IconUiLeft";
4
- import Q from "@unicom-cloud/icons/IconUiRight";
5
- import W from "@unicom-cloud/icons/IconUiUp";
6
- import x from "react";
1
+ import { jsxs as G, jsx as l } from "react/jsx-runtime";
2
+ import H from "@unicom-cloud/icons/IconUiDown";
3
+ import J from "@unicom-cloud/icons/IconUiLeft";
4
+ import K from "@unicom-cloud/icons/IconUiRight";
5
+ import Q from "@unicom-cloud/icons/IconUiUp";
6
+ import E from "react";
7
7
  import "../config-provider/ConfigProvider.js";
8
- import d from "@unicom-cloud/utils/class-name";
9
- import y from "./hooks/useEvent.js";
10
- import Z from "../config-provider/context.js";
11
- function L(f) {
12
- return typeof f == "number" && !Number.isNaN(f) ? Math.round(f) : 0;
8
+ import f from "@unicom-cloud/utils/class-name";
9
+ import Y from "./hooks/useEvent.js";
10
+ import W from "../config-provider/context.js";
11
+ function O(d) {
12
+ return typeof d == "number" && !Number.isNaN(d) ? Math.round(d) : 0;
13
13
  }
14
- const le = (f) => {
15
- const { getPrefixCls: z } = x.useContext(Z), {
14
+ const ie = (d) => {
15
+ const { getPrefixCls: y } = E.useContext(W), {
16
16
  prefixCls: I,
17
- vertical: n,
18
- index: s,
19
- active: T,
17
+ vertical: s,
18
+ index: n,
19
+ active: z,
20
20
  ariaNow: $,
21
- ariaMin: C,
22
- ariaMax: E,
23
- resizable: M,
24
- startCollapsible: j,
25
- endCollapsible: k,
26
- onOffsetStart: O,
27
- onOffsetUpdate: N,
28
- onOffsetEnd: b,
29
- onCollapse: S,
21
+ ariaMin: M,
22
+ ariaMax: N,
23
+ startCollapsible: T,
24
+ endCollapsible: j,
25
+ onOffsetStart: S,
26
+ onOffsetUpdate: v,
27
+ onOffsetEnd: h,
28
+ onCollapse: P,
30
29
  lazy: a,
31
30
  containerSize: m
32
- } = f, e = z?.("bar", I), [r, v] = x.useState(
31
+ } = d, e = y?.("bar", I), [r, w] = E.useState(
33
32
  null
34
- ), [h, P] = x.useState(0), A = n ? 0 : h, D = n ? h : 0, R = (t) => {
35
- M && t.currentTarget && (v([t.pageX, t.pageY]), O(s));
36
- }, V = (t) => {
37
- if (M && t.touches.length === 1) {
33
+ ), [g, U] = E.useState(0), k = s ? 0 : g, A = s ? g : 0, D = (t) => {
34
+ t.currentTarget && (w([t.pageX, t.pageY]), S(n));
35
+ }, R = (t) => {
36
+ if (t.touches.length === 1) {
38
37
  const o = t.touches[0];
39
- v([o.pageX, o.pageY]), O(s);
38
+ w([o.pageX, o.pageY]), S(n);
40
39
  }
41
- }, B = (t) => {
42
- const o = m * $ / 100, c = o + t, w = Math.max(0, m * C / 100), i = Math.min(m, m * E / 100);
43
- return Math.max(w, Math.min(i, c)) - o;
44
- }, U = y((t, o) => {
45
- const c = B(
46
- n ? o : t
40
+ }, V = (t) => {
41
+ const o = m * $ / 100, c = o + t, x = Math.max(0, m * M / 100), i = Math.min(m, m * N / 100);
42
+ return Math.max(x, Math.min(i, c)) - o;
43
+ }, L = Y((t, o) => {
44
+ const c = V(
45
+ s ? o : t
47
46
  );
48
- P(c);
49
- }), X = y(() => {
50
- N(s, A, D, !0), P(0), b(!0);
47
+ U(c);
48
+ }), b = Y(() => {
49
+ v(n, k, A, !0), U(0), h(!0);
51
50
  });
52
- x.useEffect(() => {
51
+ E.useEffect(() => {
53
52
  if (r) {
54
53
  const t = (i) => {
55
- const { pageX: u, pageY: g } = i, p = u - r[0], Y = g - r[1];
56
- a ? U(p, Y) : N(s, p, Y);
54
+ const { pageX: u, pageY: C } = i, p = u - r[0], X = C - r[1];
55
+ a ? L(p, X) : v(n, p, X);
57
56
  }, o = () => {
58
- a ? X() : b(), v(null);
57
+ a ? b() : h(), w(null);
59
58
  }, c = (i) => {
60
59
  if (i.touches.length === 1) {
61
- const u = i.touches[0], g = u.pageX - r[0], p = u.pageY - r[1];
62
- a ? U(g, p) : N(s, g, p);
60
+ const u = i.touches[0], C = u.pageX - r[0], p = u.pageY - r[1];
61
+ a ? L(C, p) : v(n, C, p);
63
62
  }
64
- }, w = () => {
65
- a ? X() : b(), v(null);
63
+ }, x = () => {
64
+ a ? b() : h(), w(null);
66
65
  };
67
- return window.addEventListener("touchmove", c), window.addEventListener("touchend", w), window.addEventListener("mousemove", t), window.addEventListener("mouseup", o), () => {
68
- window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", w);
66
+ return window.addEventListener("touchmove", c), window.addEventListener("touchend", x), window.addEventListener("mousemove", t), window.addEventListener("mouseup", o), () => {
67
+ window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", x);
69
68
  };
70
69
  }
71
70
  }, [
72
71
  r,
73
72
  a,
74
- n,
75
73
  s,
74
+ n,
76
75
  m,
77
76
  $,
78
- C,
79
- E
77
+ M,
78
+ N,
79
+ L,
80
+ v,
81
+ b,
82
+ h
80
83
  ]);
81
- const q = {
82
- [`--${e}-preview-offset`]: `${h}px`
83
- }, F = n ? W : K, G = n ? J : Q;
84
- return /* @__PURE__ */ H(
84
+ const B = {
85
+ [`--${e}-preview-offset`]: `${g}px`
86
+ }, q = s ? Q : J, F = s ? H : K;
87
+ return /* @__PURE__ */ G(
85
88
  "div",
86
89
  {
87
90
  className: e,
88
91
  role: "separator",
89
- "aria-valuenow": L($),
90
- "aria-valuemin": L(C),
91
- "aria-valuemax": L(E),
92
+ "aria-valuenow": O($),
93
+ "aria-valuemin": O(M),
94
+ "aria-valuemax": O(N),
92
95
  children: [
93
96
  a && /* @__PURE__ */ l(
94
97
  "div",
95
98
  {
96
- className: d(`${e}-preview`, {
97
- [`${e}-preview-active`]: !!h
99
+ className: f(`${e}-preview`, {
100
+ [`${e}-preview-active`]: !!g
98
101
  }),
99
- style: q
102
+ style: B
100
103
  }
101
104
  ),
102
105
  /* @__PURE__ */ l(
103
106
  "div",
104
107
  {
105
- className: d(`${e}-dragger`, {
106
- [`${e}-dragger-disabled`]: !M,
107
- [`${e}-dragger-active`]: T
108
+ className: f(`${e}-dragger`, {
109
+ [`${e}-dragger-active`]: z
108
110
  }),
109
- onMouseDown: R,
110
- onTouchStart: V
111
+ onMouseDown: D,
112
+ onTouchStart: R
111
113
  }
112
114
  ),
113
- j && /* @__PURE__ */ l(
115
+ T && /* @__PURE__ */ l(
114
116
  "div",
115
117
  {
116
- className: d(
118
+ className: f(
117
119
  `${e}-collapse-bar`,
118
120
  `${e}-collapse-bar-start`
119
121
  ),
120
- onClick: () => S(s, "start"),
122
+ onClick: () => P(n, "start"),
121
123
  children: /* @__PURE__ */ l(
122
- F,
124
+ q,
123
125
  {
124
- className: d(
126
+ className: f(
125
127
  `${e}-collapse-icon`,
126
128
  `${e}-collapse-start`
127
129
  )
@@ -129,18 +131,18 @@ const le = (f) => {
129
131
  )
130
132
  }
131
133
  ),
132
- k && /* @__PURE__ */ l(
134
+ j && /* @__PURE__ */ l(
133
135
  "div",
134
136
  {
135
- className: d(
137
+ className: f(
136
138
  `${e}-collapse-bar`,
137
139
  `${e}-collapse-bar-end`
138
140
  ),
139
- onClick: () => S(s, "end"),
141
+ onClick: () => P(n, "end"),
140
142
  children: /* @__PURE__ */ l(
141
- G,
143
+ F,
142
144
  {
143
- className: d(
145
+ className: f(
144
146
  `${e}-collapse-icon`,
145
147
  `${e}-collapse-end`
146
148
  )
@@ -153,5 +155,5 @@ const le = (f) => {
153
155
  );
154
156
  };
155
157
  export {
156
- le as default
158
+ ie as default
157
159
  };