@unicom-cloud/ui 0.8.98 → 0.8.99

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 (71) hide show
  1. package/Badge.js +53 -7
  2. package/LiquidFill.js +59 -2
  3. package/Marquee.js +61 -0
  4. package/QrCode.js +13 -9
  5. package/Segmented.js +11 -0
  6. package/Space.js +14 -6
  7. package/Splitter.js +7 -0
  8. package/Tour.js +13 -9
  9. package/badge/index.js +177 -84
  10. package/collapse/Collapse.js +54 -48
  11. package/components/common/space/index.js +90 -106
  12. package/index.js +356 -353
  13. package/liquid-fill/index.js +255 -2
  14. package/marquee/index.js +282 -0
  15. package/menu/Item.js +17 -16
  16. package/package.json +1 -1
  17. package/qr-code/index.js +53 -36
  18. package/rate/index.js +8 -8
  19. package/segmented/index.js +217 -0
  20. package/space/index.js +28 -29
  21. package/splitter/index.js +117 -0
  22. package/splitter/interface.js +1 -0
  23. package/style.css +1 -1
  24. package/tour/index.js +110 -88
  25. package/types/common/hooks/useMergeProps.d.ts +1 -1
  26. package/types/common/space/index.d.ts +6 -5
  27. package/types/common/space/interface.d.ts +29 -16
  28. package/types/pc/badge/index.d.ts +4 -4
  29. package/types/pc/badge/interface.d.ts +26 -0
  30. package/types/pc/collapse/interface.d.ts +4 -0
  31. package/types/pc/config-provider/interface.d.ts +7 -1
  32. package/types/pc/date-picker/RangePicker.d.ts +1 -1
  33. package/types/pc/index.d.ts +10 -4
  34. package/types/pc/liquid-fill/index.d.ts +114 -1
  35. package/types/pc/marquee/index.d.ts +61 -0
  36. package/types/pc/menu/context.d.ts +1 -1
  37. package/types/pc/qr-code/index.d.ts +1 -1
  38. package/types/pc/rate/index.d.ts +2 -2
  39. package/types/pc/segmented/index.d.ts +8 -0
  40. package/types/pc/segmented/interface.d.ts +88 -0
  41. package/types/pc/space/index.d.ts +3 -1
  42. package/types/pc/space/interface.d.ts +6 -10
  43. package/types/pc/splitter/index.d.ts +4 -0
  44. package/types/pc/splitter/interface.d.ts +70 -0
  45. package/types/pc/tour/index.d.ts +6 -1
  46. package/types/pc/utils/names.d.ts +18 -0
  47. package/typography/Ellipsis.js +1 -1
  48. package/utils/names.js +12 -0
  49. package/version/index.js +1 -1
  50. package/_virtual/_commonjsHelpers.js +0 -6
  51. package/_virtual/index.js +0 -7
  52. package/_virtual/index2.js +0 -4
  53. package/liquid-fill/LiquidFill.js +0 -226
  54. package/liquid-fill/LiquidFill2.js +0 -3
  55. package/space-/index.js +0 -93
  56. package/types/common/utils/color.d.ts +0 -1
  57. package/types/common/utils/computeScrollIntoView.d.ts +0 -1
  58. package/types/common/utils/index.d.ts +0 -45
  59. package/types/common/utils/math.d.ts +0 -1
  60. package/types/common/utils/reactTransitionGroup.d.ts +0 -1
  61. package/types/common/utils/tree.d.ts +0 -1
  62. package/types/common/utils/tween.d.ts +0 -1
  63. package/types/common/utils/uuid.d.ts +0 -1
  64. package/types/common/utils/validate.d.ts +0 -1
  65. package/types/pc/liquid-fill/LiquidFill.d.ts +0 -115
  66. package/types/pc/liquid-fill/LiquidFill2.d.ts +0 -1
  67. package/types/pc/space-/index.d.ts +0 -6
  68. package/types/pc/space-/interface.d.ts +0 -38
  69. /package/{space- → components/common/space}/toArray.js +0 -0
  70. /package/{space- → segmented}/interface.js +0 -0
  71. /package/types/{pc/space- → common/space}/toArray.d.ts +0 -0
package/badge/index.js CHANGED
@@ -1,13 +1,59 @@
1
- import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
- import R from "lodash/isPlainObject";
3
- import { forwardRef as G, useContext as _ } from "react";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import q from "lodash/isPlainObject";
3
+ import { forwardRef as z, useContext as H, useRef as O, useImperativeHandle as L } from "react";
4
4
  import "../config-provider/ConfigProvider.js";
5
- import k from "../components/common/hooks/useMergeProps.js";
6
- import { PqbCSSTransition as q } from "../components/common/utils/PqbCSSTransition.js";
7
- import n from "@unicom-cloud/utils/class-name";
8
- import $ from "./Count.js";
9
- import z from "../config-provider/context.js";
10
- const x = [
5
+ import M from "../components/common/hooks/useMergeProps.js";
6
+ import "@unicom-cloud/utils/case-name";
7
+ import i from "@unicom-cloud/utils/class-name";
8
+ import "../dist/tinycolor/chunk/BOzCVdr0.js";
9
+ import "@unicom-cloud/utils/constant/ui";
10
+ import "../utils/contextHolder.js";
11
+ import "@unicom-cloud/utils/dayjs";
12
+ import "@unicom-cloud/utils/clipboard-copy";
13
+ import "../components/common/utils/dayjs.js";
14
+ import "../components/common/utils/dom.js";
15
+ import "@unicom-cloud/utils/file/fileToURL";
16
+ import "lodash/escapeRegExp";
17
+ import "lodash/isArray";
18
+ import "lodash/isNumber";
19
+ import "lodash/isString";
20
+ import "lodash/isFunction";
21
+ import "lodash/throttle";
22
+ import "../components/common/utils/is.js";
23
+ import "lodash/camelCase";
24
+ import "lodash/capitalize";
25
+ import "lodash/cloneDeep";
26
+ import "lodash/debounce";
27
+ import "lodash/get";
28
+ import "lodash/has";
29
+ import "lodash/kebabCase";
30
+ import "lodash/merge";
31
+ import "lodash/mergeWith";
32
+ import "lodash/set";
33
+ import "lodash/setWith";
34
+ import "lodash/snakeCase";
35
+ import "lodash/startCase";
36
+ import "lodash/uniq";
37
+ import "lodash/upperFirst";
38
+ import "@unicom-cloud/utils/math";
39
+ import { PqbCSSTransition as U } from "../components/common/utils/PqbCSSTransition.js";
40
+ import "../components/common/utils/reactDOM.js";
41
+ import "../dist/react-transition-group/src/CSSTransition.js";
42
+ import "../dist/react-transition-group/src/ReplaceTransition.js";
43
+ import "../dist/react-transition-group/src/SwitchTransition.js";
44
+ import "../dist/react-transition-group/chunk/CPfP7aNL.js";
45
+ import "../dist/react-transition-group/src/TransitionGroup.js";
46
+ import "@unicom-cloud/utils/file/saveAs";
47
+ import "@unicom-cloud/utils/screenfull";
48
+ import "@unicom-cloud/utils/constant/ui.js";
49
+ import "@unicom-cloud/utils/tree";
50
+ import "@unicom-cloud/utils/is";
51
+ import { v4 as F } from "uuid";
52
+ import "../dist/validate/src/index.js";
53
+ import "@unicom-cloud/utils/constant/keyboardCode";
54
+ import B from "./Count.js";
55
+ import J from "../config-provider/context.js";
56
+ const f = [
11
57
  "red",
12
58
  "orangered",
13
59
  "orange",
@@ -19,132 +65,179 @@ const x = [
19
65
  "purple",
20
66
  "magenta",
21
67
  "gray"
22
- ], I = {
68
+ ], K = {
23
69
  count: 0,
24
- maxCount: 99
70
+ maxCount: 99,
71
+ dotAnimation: !0
72
+ // 默认开启 dot 动画
25
73
  };
26
- function L(y, N) {
27
- const { getPrefixCls: h, componentConfig: S, rtl: b } = _(z), O = k(
28
- y,
29
- I,
30
- S?.Badge
74
+ function Q(P, v) {
75
+ const { getPrefixCls: A, componentConfig: R, rtl: $ } = H(J), T = M(
76
+ P,
77
+ K,
78
+ R?.Badge
31
79
  ), {
32
- count: o,
33
- prefixText: c,
34
- text: m,
35
- className: B,
36
- dotClassName: a,
37
- dot: p,
38
- dotAnimation: P = !0,
39
- maxCount: T,
40
- color: e,
41
- dotStyle: A,
42
- offset: D,
43
- style: E,
44
- status: l,
80
+ ribbon: o,
81
+ count: s,
82
+ prefixText: g,
83
+ text: l,
84
+ className: w,
85
+ dotClassName: m,
86
+ dot: b,
87
+ dotAnimation: x,
88
+ maxCount: E,
89
+ color: r,
90
+ dotStyle: j,
91
+ offset: I,
92
+ style: N,
93
+ status: p,
45
94
  children: u,
46
- ...j
47
- } = O, t = h?.("badge"), r = { ...A || {} }, [f, d] = D || [];
48
- f && (r.marginRight = -f), d && (r.marginTop = d);
49
- const w = () => {
50
- if (R(o))
51
- return /* @__PURE__ */ s(
95
+ ...y
96
+ } = T, d = O(null), C = O(F()), t = A?.("badge"), n = { ...j || {} }, [h, S] = I || [];
97
+ h && (n.marginRight = -h), S && (n.marginTop = S), L(v, () => ({
98
+ dom: d.current
99
+ }));
100
+ const k = () => {
101
+ if (q(s))
102
+ return /* @__PURE__ */ e(
52
103
  "span",
53
104
  {
54
- className: n(`${t}-custom-dot`, a),
55
- style: r,
56
- children: o
105
+ className: i(`${t}-custom-dot`, m),
106
+ style: n,
107
+ children: s
57
108
  }
58
109
  );
59
- const i = !e || x.indexOf(e) > -1 ? {} : { backgroundColor: e };
60
- return m && !e && !l ? /* @__PURE__ */ s(
110
+ const a = !r || f.indexOf(r) > -1 ? {} : { backgroundColor: r };
111
+ return l && !r && !p ? /* @__PURE__ */ e(
61
112
  "span",
62
113
  {
63
- className: n(`${t}-text`, a),
64
- style: r,
65
- children: m
114
+ className: i(`${t}-text`, m),
115
+ style: n,
116
+ children: l
66
117
  }
67
- ) : l || e && typeof o == "number" && o <= 0 ? /* @__PURE__ */ g("span", { className: `${t}-status-wrapper`, children: [
68
- !!c && /* @__PURE__ */ s("span", { className: `${t}-status-prefix-text`, children: c }),
69
- /* @__PURE__ */ s(
118
+ ) : p || r && typeof s == "number" && s <= 0 ? /* @__PURE__ */ c("span", { className: `${t}-status-wrapper`, children: [
119
+ !!g && /* @__PURE__ */ e("span", { className: `${t}-status-prefix-text`, children: g }),
120
+ /* @__PURE__ */ e(
70
121
  "span",
71
122
  {
72
- className: n(
123
+ className: i(
73
124
  `${t}-status-dot`,
74
125
  {
75
- [`${t}-status-dot-animation`]: P,
76
- [`${t}-status-${l}`]: l,
77
- [`${t}-color-${e}`]: e
126
+ [`${t}-dot-pulse`]: x,
127
+ [`${t}-status-${p}`]: p,
128
+ [`${t}-color-${r}`]: r
78
129
  },
79
- a
130
+ m
80
131
  ),
81
- style: { ...i, ...r }
132
+ style: { ...a, ...n }
82
133
  }
83
134
  ),
84
- !!m && /* @__PURE__ */ s("span", { className: `${t}-status-text`, children: m })
85
- ] }) : (p || e) && typeof o == "number" && o > 0 ? /* @__PURE__ */ s(
86
- q,
135
+ !!l && /* @__PURE__ */ e("span", { className: `${t}-status-text`, children: l })
136
+ ] }) : (b || r) && typeof s == "number" && s > 0 ? /* @__PURE__ */ e(
137
+ U,
87
138
  {
88
139
  classNames: "badge-zoom",
89
- in: p || !!e,
140
+ in: b || !!r,
90
141
  timeout: 200,
91
142
  appear: !0,
92
143
  mountOnEnter: !0,
93
144
  unmountOnExit: !0,
94
- children: /* @__PURE__ */ s(
145
+ children: /* @__PURE__ */ e(
95
146
  "span",
96
147
  {
97
- className: n(
148
+ className: i(
98
149
  `${t}-dot`,
99
150
  {
100
- [`${t}-color-${e}`]: e
151
+ [`${t}-dot-pulse`]: x,
152
+ [`${t}-color-${r}`]: r
101
153
  },
102
- a
154
+ m
103
155
  ),
104
- style: { ...i, ...r }
156
+ style: { ...a, ...n }
105
157
  }
106
158
  )
107
159
  }
108
- ) : /* @__PURE__ */ s(
109
- $,
160
+ ) : /* @__PURE__ */ e(
161
+ B,
110
162
  {
111
163
  prefixCls: t,
112
- className: n(`${t}-number`, a),
113
- style: { ...i, ...r },
114
- maxCount: T,
115
- count: o
164
+ className: i(`${t}-number`, m),
165
+ style: { ...a, ...n },
166
+ maxCount: E,
167
+ count: s
168
+ }
169
+ );
170
+ }, G = () => {
171
+ if (!o || !o.text) return null;
172
+ const a = o.color ? { backgroundColor: o.color } : {}, _ = o.placement || "end";
173
+ return /* @__PURE__ */ c(
174
+ "div",
175
+ {
176
+ className: i(
177
+ `${t}-ribbon`,
178
+ `${t}-ribbon-${_}`,
179
+ {
180
+ [`${t}-rtl`]: $,
181
+ [`${t}-color-${o.color}`]: o.color && f.includes(o.color)
182
+ }
183
+ ),
184
+ style: a,
185
+ children: [
186
+ /* @__PURE__ */ e("span", { className: `${t}-ribbon-text`, children: o.text }),
187
+ /* @__PURE__ */ e("div", { className: `${t}-ribbon-corner` })
188
+ ]
116
189
  }
117
190
  );
118
191
  };
119
- return /* @__PURE__ */ g(
192
+ return o ? /* @__PURE__ */ c(
193
+ "div",
194
+ {
195
+ className: `${t}-ribbon-wrapper`,
196
+ ref: d,
197
+ style: N,
198
+ id: C.current,
199
+ ...y,
200
+ children: [
201
+ u,
202
+ G()
203
+ ]
204
+ }
205
+ ) : /* @__PURE__ */ c(
120
206
  "span",
121
207
  {
122
- className: n(
208
+ className: i(
123
209
  t,
124
210
  {
125
- [`${t}-status`]: l,
211
+ [`${t}-status`]: p,
126
212
  [`${t}-no-children`]: !u,
127
- [`${t}-rtl`]: b
213
+ [`${t}-rtl`]: $
128
214
  },
129
- B
215
+ w
130
216
  ),
131
- ref: N,
132
- style: E,
133
- ...j,
217
+ ref: d,
218
+ style: N,
219
+ id: C.current,
220
+ ...y,
134
221
  children: [
135
222
  u,
136
- w()
223
+ k()
137
224
  ]
138
225
  }
139
226
  );
140
227
  }
141
- const C = G(L);
142
- C.displayName = "Badge";
143
- C.Count = $;
144
- const W = x, X = ["default", "processing", "success", "warning", "error"];
228
+ const D = z(Q);
229
+ D.displayName = "Badge";
230
+ D.Count = B;
231
+ const Wt = f, Xt = [
232
+ "default",
233
+ "processing",
234
+ "success",
235
+ "warning",
236
+ "error"
237
+ ];
145
238
  export {
146
- W as BADGE_COLORS,
147
- X as BADGE_STATUS,
148
- $ as BadgeCount,
149
- C as default
239
+ Wt as BADGE_COLORS,
240
+ Xt as BADGE_STATUS,
241
+ B as BadgeCount,
242
+ D as default
150
243
  };
@@ -1,90 +1,96 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import z from "@unicom-cloud/icons/IconUiCaretLeft";
3
- import f from "@unicom-cloud/icons/IconUiCaretRight";
4
- import F from "lodash/isFunction";
5
- import M, { createContext as O, useContext as T } from "react";
3
+ import m from "@unicom-cloud/icons/IconUiCaretRight";
4
+ import B from "lodash/isFunction";
5
+ import F, { createContext as M, useContext as O } from "react";
6
6
  import "../config-provider/ConfigProvider.js";
7
- import U from "../components/common/hooks/useMergeProps.js";
8
- import V from "../components/common/hooks/useMergeValue.js";
9
- import j from "@unicom-cloud/utils/class-name";
10
- import { omit as H } from "../components/common/utils/omit.js";
11
- import L from "./Item.js";
12
- import q from "../config-provider/context.js";
13
- const m = (i, s) => {
14
- const n = [].concat(i);
15
- return s ? n.slice(0, 1) : n;
16
- }, B = {
7
+ import T from "../components/common/hooks/useMergeProps.js";
8
+ import U from "../components/common/hooks/useMergeValue.js";
9
+ import V from "@unicom-cloud/utils/class-name";
10
+ import { omit as j } from "../components/common/utils/omit.js";
11
+ import k from "./Item.js";
12
+ import L from "../config-provider/context.js";
13
+ const f = (s, a) => {
14
+ const n = [].concat(s);
15
+ return a ? n.slice(0, 1) : n;
16
+ }, q = {
17
17
  bordered: !0,
18
18
  lazyload: !0,
19
- expandIconPosition: "left"
20
- }, D = O({
21
19
  expandIconPosition: "left",
22
- expandIcon: /* @__PURE__ */ t(f, {}),
20
+ invertHeaderContentBackgrounds: !1
21
+ // 潘启宝添加
22
+ }, D = M({
23
+ expandIconPosition: "left",
24
+ expandIcon: /* @__PURE__ */ t(m, {}),
23
25
  activeKeys: [],
24
26
  onToggle: () => {
25
27
  }
26
28
  });
27
- function E(i, s) {
28
- const { getPrefixCls: n, componentConfig: C, rtl: v } = T(q), e = U(
29
- i,
30
- B,
29
+ function E(s, a) {
30
+ const { getPrefixCls: n, componentConfig: C, rtl: v } = O(L), e = T(
31
+ s,
32
+ q,
31
33
  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
34
+ ), [c, g] = U([], {
35
+ defaultValue: "defaultActiveKey" in e ? f(e.defaultActiveKey, e.accordion) : void 0,
36
+ value: "activeKey" in e ? f(e.activeKey, e.accordion) : void 0
35
37
  }), {
36
- children: g,
38
+ children: x,
37
39
  className: y,
38
40
  style: I,
39
41
  bordered: K,
40
- lazyload: P,
41
- expandIcon: h,
42
+ lazyload: h,
43
+ expandIcon: P,
42
44
  expandIconPosition: l,
43
45
  destroyOnHide: A,
44
46
  accordion: R,
45
- triggerRegion: N,
46
- onChange: p,
47
- ...b
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);
47
+ triggerRegion: b,
48
+ invertHeaderContentBackgrounds: N,
49
+ // 潘启宝添加
50
+ onChange: d,
51
+ ...$
52
+ } = e, r = n?.("collapse"), w = (i, H) => {
53
+ let o = [...c || []];
54
+ const p = c?.indexOf(i);
55
+ p > -1 ? o.splice(p, 1) : R ? o = [i] : o.push(i), "activeKey" in e || g(o), B(d) && d(i, o, H);
52
56
  };
53
57
  return /* @__PURE__ */ t(
54
58
  D.Provider,
55
59
  {
56
60
  value: {
57
- activeKeys: a,
58
- triggerRegion: N,
59
- lazyload: P,
61
+ activeKeys: c,
62
+ triggerRegion: b,
63
+ lazyload: h,
60
64
  destroyOnHide: A,
61
65
  expandIconPosition: l,
62
- onToggle: $,
63
- expandIcon: "expandIcon" in e ? h : l === "right" ? /* @__PURE__ */ t(z, {}) : /* @__PURE__ */ t(f, {})
66
+ onToggle: w,
67
+ expandIcon: "expandIcon" in e ? P : l === "right" ? /* @__PURE__ */ t(z, {}) : /* @__PURE__ */ t(m, {})
64
68
  },
65
69
  children: /* @__PURE__ */ t(
66
70
  "div",
67
71
  {
68
- ref: s,
69
- ...H(b, ["activeKey", "defaultActiveKey"]),
70
- className: j(
71
- c,
72
- `${c}-${K ? "border" : "borderless"}`,
73
- { [`${c}-rtl`]: v },
72
+ ref: a,
73
+ ...j($, ["activeKey", "defaultActiveKey"]),
74
+ className: V(
75
+ r,
76
+ `${r}-${K ? "border" : "borderless"}`,
77
+ { [`${r}-rtl`]: v },
78
+ N && `${r}-invert-header-content-backgrounds`,
79
+ // 潘启宝添加
74
80
  y
75
81
  ),
76
82
  style: I,
77
- children: g
83
+ children: x
78
84
  }
79
85
  )
80
86
  }
81
87
  );
82
88
  }
83
- const G = M.forwardRef(E), u = G;
89
+ const G = F.forwardRef(E), u = G;
84
90
  u.displayName = "Collapse";
85
- u.Item = L;
91
+ u.Item = k;
86
92
  export {
87
93
  D as CollapseContext,
88
- L as CollapseItem,
94
+ k as CollapseItem,
89
95
  u as default
90
96
  };
@@ -1,112 +1,96 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { UI_COMMON_PREFIX as C } from "@unicom-cloud/utils/constant/ui";
3
- import { forwardRef as c } from "react";
4
- import "@unicom-cloud/utils/case-name";
5
- import _ from "@unicom-cloud/utils/class-name";
6
- import "../../../dist/tinycolor/chunk/BOzCVdr0.js";
7
- import "@unicom-cloud/utils/dayjs";
8
- import "@unicom-cloud/utils/clipboard-copy";
9
- import "../utils/dayjs.js";
10
- import "../utils/dom.js";
11
- import "@unicom-cloud/utils/file/fileToURL";
12
- import "lodash/escapeRegExp";
13
- import "lodash/isArray";
14
- import "lodash/isNumber";
15
- import "lodash/isString";
16
- import "lodash/isFunction";
17
- import "lodash/throttle";
18
- import "../utils/is.js";
19
- import "lodash/camelCase";
20
- import "lodash/capitalize";
21
- import "lodash/cloneDeep";
22
- import "lodash/debounce";
23
- import "lodash/get";
24
- import "lodash/has";
25
- import "lodash/kebabCase";
26
- import "lodash/merge";
27
- import "lodash/mergeWith";
28
- import "lodash/set";
29
- import "lodash/setWith";
30
- import "lodash/snakeCase";
31
- import "lodash/startCase";
32
- import "lodash/uniq";
33
- import "lodash/upperFirst";
34
- import "@unicom-cloud/utils/math";
35
- import "lodash/isPlainObject";
36
- import "../../../dist/react-transition-group/src/CSSTransition.js";
37
- import "../../../dist/react-transition-group/src/ReplaceTransition.js";
38
- import "../../../dist/react-transition-group/src/SwitchTransition.js";
39
- import "../../../dist/react-transition-group/chunk/CPfP7aNL.js";
40
- import "../../../dist/react-transition-group/src/TransitionGroup.js";
41
- import "../utils/reactDOM.js";
42
- import "@unicom-cloud/utils/file/saveAs";
43
- import "@unicom-cloud/utils/screenfull";
44
- import "@unicom-cloud/utils/tree";
45
- import { isArray as l, isNumber as I } from "@unicom-cloud/utils/is";
46
- import "uuid";
47
- import "../../../dist/validate/src/index.js";
48
- import "@unicom-cloud/utils/constant/keyboardCode";
49
- function f(t = 8) {
50
- if (I(t))
51
- return t;
52
- if (l(t))
53
- return t.map((i, r, e) => f(i));
54
- switch (t) {
55
- case "mini":
56
- return 4;
57
- case "small":
58
- return 8;
59
- case "medium":
60
- return 16;
61
- case "large":
62
- return 24;
63
- default:
64
- return 8;
65
- }
66
- }
67
- function S(t, i) {
68
- const r = `${C}-space`, {
69
- className: e,
70
- style: d,
71
- children: $,
72
- inline: y,
73
- gap: N = "small",
74
- direction: n = "horizontal",
75
- wrap: h,
76
- justifyContent: a,
77
- alignItems: g,
78
- ...w
79
- } = t;
80
- let p = g;
81
- n === "horizontal" && (p ||= "center");
82
- const o = f(N), m = { ...d };
83
- return l(o) ? (m.rowGap = o[0], m.columnGap = o[1]) : m.gap = o, /* @__PURE__ */ s(
84
- "div",
1
+ import { jsx as c, jsxs as L } from "react/jsx-runtime";
2
+ import { UI_COMMON_PREFIX as O } from "@unicom-cloud/utils/constant/ui";
3
+ import P from "lodash/isArray";
4
+ import _ from "lodash/isNumber";
5
+ import { forwardRef as N, Fragment as b } from "react";
6
+ import k from "../hooks/useMergeProps.js";
7
+ import x from "@unicom-cloud/utils/class-name";
8
+ import F from "./toArray.js";
9
+ const D = {
10
+ size: "small",
11
+ direction: "horizontal"
12
+ };
13
+ function E(a, m) {
14
+ const S = k(a, D, {}), {
15
+ className: z,
16
+ style: C,
17
+ children: M,
18
+ gap: j,
19
+ size: w,
20
+ direction: s,
21
+ align: B,
22
+ alignItems: R,
23
+ justifyContent: d,
24
+ wrap: l,
25
+ split: p,
26
+ rtl: $,
27
+ ...V
28
+ } = S, r = `${O}-space`, h = R ?? (B || (s === "horizontal" ? "center" : "")), i = j ?? w, A = x(
29
+ r,
85
30
  {
86
- ref: i,
87
- className: _(
88
- `${r}`,
89
- y && `${r}-inline`,
90
- h && `${r}-wrap`,
91
- `${r}-${n}`,
92
- a && `${r}-justify-content-${a}`,
93
- p && `${r}-align-items-${p}`,
94
- e
95
- ),
96
- style: m,
97
- ...w,
98
- children: $
99
- }
31
+ [`${r}-${s}`]: s,
32
+ [`${r}-justify-content-${d}`]: d,
33
+ [`${r}-align-items-${h}`]: h,
34
+ [`${r}-wrap`]: l,
35
+ [`${r}-rtl`]: $
36
+ },
37
+ z
100
38
  );
39
+ function f(e) {
40
+ if (_(e))
41
+ return e;
42
+ switch (e) {
43
+ case "mini":
44
+ return 4;
45
+ case "small":
46
+ return 8;
47
+ case "medium":
48
+ return 16;
49
+ case "large":
50
+ return 24;
51
+ default:
52
+ return 8;
53
+ }
54
+ }
55
+ const y = F(M);
56
+ function I(e) {
57
+ const n = y.length === e + 1, o = $ ? "marginLeft" : "marginRight";
58
+ if (typeof i == "string" || typeof i == "number") {
59
+ const t = f(i);
60
+ return l ? n ? { marginBottom: t } : {
61
+ [`${o}`]: t,
62
+ marginBottom: t
63
+ } : n ? {} : {
64
+ [s === "vertical" ? "marginBottom" : o]: t
65
+ };
66
+ }
67
+ if (P(i)) {
68
+ const t = f(i[0]), u = f(i[1]);
69
+ return l ? n ? { marginBottom: u } : {
70
+ [`${o}`]: t,
71
+ marginBottom: u
72
+ } : s === "vertical" ? { marginBottom: u } : { [`${o}`]: t };
73
+ }
74
+ }
75
+ return /* @__PURE__ */ c("div", { ref: m, className: A, style: C, ...V, children: y.map((e, n) => {
76
+ const o = e?.key || n, t = p != null && n > 0;
77
+ return /* @__PURE__ */ L(b, { children: [
78
+ t && /* @__PURE__ */ c("div", { className: `${r}-item-split`, children: p }),
79
+ /* @__PURE__ */ c("div", { className: `${r}-item`, style: I(n), children: e })
80
+ ] }, o);
81
+ }) });
101
82
  }
102
- const u = c(S);
103
- u.displayName = "Space";
104
- function j(t, i) {
105
- return /* @__PURE__ */ s(u, { ref: i, ...t, direction: "vertical", children: t.children });
83
+ const g = N(
84
+ E
85
+ );
86
+ g.displayName = "Space";
87
+ function H(a, m) {
88
+ return /* @__PURE__ */ c(g, { ref: m, ...a, direction: "vertical", children: a.children });
106
89
  }
107
- const x = c(j);
108
- x.displayName = "SpaceVertical";
90
+ const v = N(H);
91
+ v.displayName = "SpaceVertical";
92
+ g.Vertical = v;
109
93
  export {
110
- x as SpaceVertical,
111
- u as default
94
+ v as SpaceVertical,
95
+ g as default
112
96
  };