@unicom-cloud/ui 0.8.106 → 0.8.108

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 (197) hide show
  1. package/App.js +7 -0
  2. package/BackTop.js +2 -4
  3. package/Calendar.js +2 -2
  4. package/ColorPicker.js +15 -14
  5. package/Constant.js +4 -0
  6. package/Copy.js +4 -3
  7. package/Countdown.js +25 -0
  8. package/Grid.js +8 -10
  9. package/LiquidFill.js +4 -3
  10. package/List.js +7 -6
  11. package/Marquee.js +4 -3
  12. package/Modal.js +4 -2
  13. package/PageHeader.js +3 -2
  14. package/QrCode.js +4 -3
  15. package/RowCol.js +8 -0
  16. package/Segmented.js +14 -4
  17. package/Statistic.js +5 -4
  18. package/Tour.js +4 -3
  19. package/Transfer.js +4 -2
  20. package/anchor/Link.js +1 -1
  21. package/app/App.js +26 -0
  22. package/app/context.js +9 -0
  23. package/app/index.js +9 -0
  24. package/app/interface.js +1 -0
  25. package/app/useApp.js +8 -0
  26. package/avatar/Group.js +1 -1
  27. package/back-top/index.js +44 -56
  28. package/button/index.js +52 -51
  29. package/calendar/Lunar.js +71 -0
  30. package/calendar/index.js +11 -11
  31. package/cascader/base/node.js +22 -20
  32. package/cascader/base/store.js +10 -10
  33. package/cascader/util.js +29 -27
  34. package/color-picker/Mode.js +8 -7
  35. package/color-picker/hooks/useColorPicker.js +56 -55
  36. package/color-picker/index.js +49 -48
  37. package/color-picker/utils.js +58 -57
  38. package/components/common/empty/index.js +2 -2
  39. package/components/common/flex/index.js +64 -55
  40. package/components/common/flex/interface.js +6 -6
  41. package/components/common/hooks/useInterval.js +6 -6
  42. package/components/common/icons/file/index.js +13 -11
  43. package/components/common/space/index.js +53 -53
  44. package/components/common/utils/dayjs.js +114 -126
  45. package/components/common/utils/is.js +98 -104
  46. package/components/common/utils/setDir.js +12 -0
  47. package/components/common/utils/setTheme.js +13 -13
  48. package/components/common/utils/toArray.js +7 -5
  49. package/config-provider/ConfigProvider.js +32 -30
  50. package/constant/index.js +4 -0
  51. package/copy/index.js +2 -1
  52. package/countdown/index.js +113 -0
  53. package/countdown/interface.js +1 -0
  54. package/countdown/util.js +29 -0
  55. package/descriptions/index.js +45 -45
  56. package/divider/index.js +28 -20
  57. package/dropdown/Button.js +1 -1
  58. package/empty/index.js +1 -1
  59. package/flex/index.js +30 -29
  60. package/form/FormItem.js +126 -122
  61. package/grid/Grid.js +56 -90
  62. package/grid/Item.js +44 -65
  63. package/grid/context.js +2 -6
  64. package/grid/index.js +6 -8
  65. package/grid/util.js +6 -44
  66. package/hooks/useResponsiveState.js +54 -0
  67. package/index.js +614 -605
  68. package/input/Button.js +12 -12
  69. package/input/Group.js +11 -12
  70. package/input/Input.js +112 -102
  71. package/input/InputElement.js +25 -24
  72. package/input/Search.js +24 -24
  73. package/layout/Sider.js +1 -1
  74. package/liquid-fill/index.js +4 -3
  75. package/list/Item.js +21 -21
  76. package/list/index.js +53 -52
  77. package/marquee/index.js +20 -19
  78. package/marquee-/index.js +4 -3
  79. package/mentions/util.js +9 -8
  80. package/modal/Confirm.js +17 -17
  81. package/modal/Modal.js +247 -237
  82. package/modal/index.js +4 -2
  83. package/modal/use-modal/index.js +2 -2
  84. package/package.json +1 -1
  85. package/page-header/index.js +57 -56
  86. package/pagination/Pagination.js +89 -92
  87. package/qr-code/index.js +4 -3
  88. package/radio/Group.js +1 -1
  89. package/row-col/Col-.js +88 -0
  90. package/row-col/Col.js +159 -0
  91. package/row-col/Row.js +73 -0
  92. package/row-col/context.js +5 -0
  93. package/row-col/index.js +11 -0
  94. package/row-col/interface.js +1 -0
  95. package/segmented/index.js +257 -206
  96. package/select/Select.js +191 -191
  97. package/select/util.js +50 -50
  98. package/select-view/Core.js +31 -28
  99. package/space/index.js +15 -13
  100. package/splitter/SplitBar.js +44 -46
  101. package/statistic/index.js +56 -55
  102. package/statistic/interface.js +4 -1
  103. package/style.css +1 -1
  104. package/table/Table.js +198 -210
  105. package/table/hook/useColumns.js +27 -26
  106. package/table/hook/useStickyClassNames.js +9 -8
  107. package/table/hook/useThResizable.js +4 -3
  108. package/table/th-resizable/index.js +2 -2
  109. package/table/thead/index.js +18 -16
  110. package/time-picker/util.js +20 -30
  111. package/timeline/Item.js +1 -1
  112. package/tour/index.js +4 -3
  113. package/transfer/index.js +93 -91
  114. package/trigger/index.js +66 -66
  115. package/types/common/development/interface.d.ts +3 -3
  116. package/types/common/flex/index.d.ts +3 -9
  117. package/types/common/flex/interface.d.ts +15 -4
  118. package/types/common/space/index.d.ts +3 -5
  119. package/types/common/space/interface.d.ts +2 -0
  120. package/types/common/utils/dayjs.d.ts +3 -1
  121. package/types/common/utils/is.d.ts +3 -4
  122. package/types/common/utils/setDir.d.ts +2 -0
  123. package/types/pc/app/App.d.ts +6 -0
  124. package/types/pc/app/context.d.ts +4 -0
  125. package/types/pc/app/index.d.ts +5 -0
  126. package/types/pc/app/interface.d.ts +17 -0
  127. package/types/pc/app/useApp.d.ts +3 -0
  128. package/types/pc/back-top/interface.d.ts +4 -17
  129. package/types/pc/button/interface.d.ts +2 -2
  130. package/types/pc/calendar/Lunar.d.ts +17 -0
  131. package/types/pc/calendar/index.d.ts +1 -1
  132. package/types/pc/config-provider/interface.d.ts +17 -12
  133. package/types/pc/constant/index.d.ts +1 -0
  134. package/types/pc/countdown/interface.d.ts +65 -0
  135. package/types/pc/countdown/util.d.ts +7 -0
  136. package/types/pc/divider/interface.d.ts +1 -0
  137. package/types/pc/flex/index.d.ts +8 -6
  138. package/types/pc/flex/interface.d.ts +3 -10
  139. package/types/pc/form/FormItem.d.ts +1 -1
  140. package/types/pc/form/interface.d.ts +1 -1
  141. package/types/pc/grid/Grid.d.ts +2 -4
  142. package/types/pc/grid/Item.d.ts +1 -5
  143. package/types/pc/grid/context.d.ts +4 -15
  144. package/types/pc/grid/index.d.ts +4 -6
  145. package/types/pc/grid/interface.d.ts +14 -142
  146. package/types/pc/grid/util.d.ts +1 -10
  147. package/types/pc/hooks/useResponsiveState.d.ts +3 -0
  148. package/types/pc/index.d.ts +10 -4
  149. package/types/pc/input/Button.d.ts +2 -2
  150. package/types/pc/list/interface.d.ts +2 -1
  151. package/types/pc/message/index.d.ts +1 -9
  152. package/types/pc/message/interface.d.ts +8 -0
  153. package/types/pc/message/useMessage.d.ts +1 -2
  154. package/types/pc/modal/Modal.d.ts +1 -0
  155. package/types/pc/modal/config.d.ts +1 -2
  156. package/types/pc/modal/index.d.ts +2 -1
  157. package/types/pc/modal/interface.d.ts +17 -5
  158. package/types/pc/notification/index.d.ts +2 -9
  159. package/types/pc/notification/interface.d.ts +7 -0
  160. package/types/pc/notification/useNotification.d.ts +1 -2
  161. package/types/pc/pagination/PageOption.d.ts +0 -1
  162. package/types/pc/pagination/interface.d.ts +5 -6
  163. package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
  164. package/types/pc/{grid → row-col}/Col.d.ts +1 -2
  165. package/types/pc/{grid → row-col}/Row.d.ts +1 -2
  166. package/types/pc/row-col/context.d.ts +6 -0
  167. package/types/pc/row-col/index.d.ts +7 -0
  168. package/types/pc/row-col/interface.d.ts +112 -0
  169. package/types/pc/segmented/index.d.ts +3 -7
  170. package/types/pc/segmented/interface.d.ts +38 -5
  171. package/types/pc/select-view/Core.d.ts +1 -8
  172. package/types/pc/select-view/index.d.ts +1 -8
  173. package/types/pc/select-view/interface.d.ts +9 -2
  174. package/types/pc/space/index.d.ts +5 -7
  175. package/types/pc/space/interface.d.ts +3 -10
  176. package/types/pc/statistic/index.d.ts +1 -1
  177. package/types/pc/statistic/interface.d.ts +1 -49
  178. package/types/pc/utils/is.d.ts +1 -1
  179. package/types/pc/utils/names.d.ts +422 -111
  180. package/types/pc/utils/responsiveObserve.d.ts +8 -8
  181. package/typography/Ellipsis.js +5 -4
  182. package/typography/Operations.js +4 -3
  183. package/utils/dayjs.js +13 -11
  184. package/utils/index.js +245 -244
  185. package/utils/is.js +65 -66
  186. package/utils/names.js +309 -150
  187. package/utils/responsiveObserve.js +43 -36
  188. package/version/index.js +1 -1
  189. package/grid/Col-.js +0 -86
  190. package/grid/Col.js +0 -169
  191. package/grid/Row.js +0 -96
  192. package/grid/hook/useResponsiveState.js +0 -38
  193. package/statistic/Countdown.js +0 -56
  194. package/statistic/util.js +0 -33
  195. package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
  196. package/types/pc/statistic/util.d.ts +0 -1
  197. /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
@@ -1,86 +1,87 @@
1
1
  import P from "@unicom-cloud/utils/tinycolor";
2
- import { useState as C, useRef as k, useMemo as G, useCallback as F, useEffect as M } from "react";
3
- import Z from "../../components/common/hooks/useIsFirstRender.js";
4
- import q from "../../components/common/hooks/useMergeValue.js";
5
- import { ColorPickerMode as y } from "../interface.js";
6
- import { getModeByValue as $, isGradientMode as H, isSingleMode as w } from "../Mode.js";
7
- import { mapValueToGradientColor as ee, getColorFromHsv as E, formatRgba as oe, formatHex as te, isEqualsColors as re, equalsHsv as ne, getRandomId as T } from "../utils.js";
8
- const ge = (s) => {
2
+ import k from "lodash/isArray";
3
+ import { useState as C, useRef as F, useMemo as G, useCallback as q, useEffect as M } from "react";
4
+ import $ from "../../components/common/hooks/useIsFirstRender.js";
5
+ import E from "../../components/common/hooks/useMergeValue.js";
6
+ import { ColorPickerMode as H } from "../interface.js";
7
+ import { getModeByValue as w, isGradientMode as R, isSingleMode as ee } from "../Mode.js";
8
+ import { mapValueToGradientColor as oe, getColorFromHsv as T, formatRgba as te, formatHex as re, isEqualsColors as ne, equalsHsv as se, getRandomId as B } from "../utils.js";
9
+ const ve = (s) => {
9
10
  const {
10
- mode: B = y.Single,
11
- defaultValue: j,
12
- format: R,
13
- onChange: z,
11
+ mode: j = H.Single,
12
+ defaultValue: z,
13
+ format: _,
14
+ onChange: D,
14
15
  disabledAlpha: h
15
- } = s, D = Z(), [p, J] = q(!1, {
16
+ } = s, J = $(), [p, K] = E(!1, {
16
17
  defaultValue: s.defaultPopupVisible,
17
18
  value: s.popupVisible
18
- }), [i, K] = C(
19
- $(
19
+ }), [i, L] = C(
20
+ w(
20
21
  s.value,
21
- j,
22
- B
22
+ z,
23
+ j
23
24
  )
24
- ), [r, L] = q(
25
- i === y.Gradient ? void 0 : "",
25
+ ), [r, N] = E(
26
+ i === H.Gradient ? void 0 : "",
26
27
  s
27
- ), [_, N] = C(
28
- H(i) && Array.isArray(r) ? ee(r, h) : []
29
- ), [O, Q] = C(_[0]?.id), v = k(_), b = k(O), o = v.current, A = b.current, m = (e) => {
30
- N(e), v.current = typeof e == "function" ? e(v.current) : e;
31
- }, x = (e) => {
32
- Q(e), b.current = e;
28
+ ), [x, O] = C(
29
+ R(i) && k(r) ? oe(r, h) : []
30
+ ), [Q, U] = C(x[0]?.id), v = F(x), b = F(Q), o = v.current, V = b.current, m = (e) => {
31
+ O(e), v.current = typeof e == "function" ? e(v.current) : e;
32
+ }, S = (e) => {
33
+ U(e), b.current = e;
33
34
  }, c = G(() => {
34
35
  const e = o.findIndex(
35
- (t) => t.id === A
36
+ (t) => t.id === V
36
37
  );
37
38
  return e !== -1 ? e : 0;
38
- }, [o, A]), u = Array.isArray(r) ? new P(r[c].color).toHsv_() : new P(r).toHsv_(), [d, S] = C({
39
+ }, [o, V]), u = k(r) ? new P(r[c].color).toHsv_() : new P(r).toHsv_(), [d, y] = C({
39
40
  h: u.h,
40
41
  s: u.s,
41
42
  v: u.v
42
- }), [n, V] = C(u.a), f = G(() => E(d), [d]), I = F(
43
- (e, t, a, l) => R === "rgb" ? oe(e, t, a, l) : te(e, t, a, l),
44
- [R]
43
+ }), [n, I] = C(u.a), f = G(() => T(d), [d]), A = q(
44
+ (e, t, a, l) => _ === "rgb" ? te(e, t, a, l) : re(e, t, a, l),
45
+ [_]
45
46
  ), g = G(() => {
46
- if (w(i)) {
47
+ if (ee(i)) {
47
48
  const { r: e, g: t, b: a } = f.rgb;
48
- return I(e, t, a, n);
49
+ return A(e, t, a, n);
49
50
  }
50
51
  return o.map((e) => {
51
52
  const { r: t, g: a, b: l } = e.color.rgb;
52
53
  return {
53
- color: I(t, a, l, e.alpha),
54
+ color: A(t, a, l, e.alpha),
54
55
  percent: e.percent
55
56
  };
56
57
  });
57
- }, [i, o, f.rgb, I, n]);
58
+ }, [i, o, f.rgb, A, n]);
58
59
  M(() => {
59
- L(g), !D && !re(r, g) && z?.(g);
60
+ N(g), !J && !ne(r, g) && D?.(g);
60
61
  }, [g]);
61
- const U = F(
62
+ const W = q(
62
63
  (e) => {
63
64
  if (e && r !== g) {
64
- const { h: t, s: a, v: l, a: Y } = u;
65
- S({ h: t, s: a, v: l }), V(Y);
65
+ const { h: t, s: a, v: l, a: Z } = u;
66
+ y({ h: t, s: a, v: l }), I(Z);
66
67
  }
67
- e !== p && (s.onVisibleChange?.(e), "popupVisible" in s || J(e));
68
+ e !== p && (s.onVisibleChange?.(e), "popupVisible" in s || K(e));
68
69
  },
69
70
  [s.onVisibleChange, p, r]
70
- ), W = (e) => {
71
- S(e), h && n !== 100 && V(100);
72
- }, X = (e) => {
73
- V(e);
71
+ ), X = (e) => {
72
+ y(e), h && n !== 100 && I(100);
73
+ }, Y = (e) => {
74
+ I(e);
74
75
  };
75
76
  return M(() => {
76
- if (!H(i) || !o.length || ne(o[c].color.hsv, d)) return;
77
+ if (!R(i) || !o.length || se(o[c].color.hsv, d)) return;
77
78
  const e = [...o];
78
79
  e[c] = {
79
80
  ...e[c],
80
- color: E(d)
81
+ color: T(d)
81
82
  }, m(e);
82
83
  }, [d]), M(() => {
83
- if (!H(i) || !o.length || o[c].alpha === n) return;
84
+ if (!R(i) || !o.length || o[c].alpha === n) return;
84
85
  const e = [...o];
85
86
  e[c] = {
86
87
  ...e[c],
@@ -91,34 +92,34 @@ const ge = (s) => {
91
92
  activeMode: i,
92
93
  gradientColors: o,
93
94
  gradientColorsRef: v,
94
- activeColorId: A,
95
+ activeColorId: V,
95
96
  activeColorIdRef: b,
96
97
  popupVisible: p,
97
98
  color: f,
98
99
  alpha: n,
99
- onHsvChange: W,
100
- onAlphaChange: X,
101
- onVisibleChange: U,
100
+ onHsvChange: X,
101
+ onAlphaChange: Y,
102
+ onVisibleChange: W,
102
103
  onActiveModeChange: (e) => {
103
- e !== i && (e === y.Single ? x(o[0]?.id) : m([
104
+ e !== i && (e === H.Single ? S(o[0]?.id) : m([
104
105
  {
105
- id: T(),
106
+ id: B(),
106
107
  color: f,
107
108
  alpha: n,
108
109
  percent: 0
109
110
  },
110
111
  {
111
- id: T(),
112
+ id: B(),
112
113
  color: f,
113
114
  alpha: n,
114
115
  percent: 100
115
116
  }
116
- ]), K(e));
117
+ ]), L(e));
117
118
  },
118
- onActiveColorIdChange: x,
119
+ onActiveColorIdChange: S,
119
120
  onGradientColorsChange: m
120
121
  };
121
122
  };
122
123
  export {
123
- ge as useColorPicker
124
+ ve as useColorPicker
124
125
  };
@@ -1,32 +1,33 @@
1
1
  import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import G from "lodash/isFunction";
3
- import S from "lodash/isNil";
4
- import D, { useContext as q } from "react";
2
+ import G from "lodash/isArray";
3
+ import S from "lodash/isFunction";
4
+ import D from "lodash/isNil";
5
+ import q, { useContext as J } from "react";
5
6
  import "../config-provider/ConfigProvider.js";
6
- import J from "../copy/index.js";
7
- import K from "../components/common/hooks/useMergeProps.js";
8
- import L from "../trigger/index.js";
9
- import Q from "@unicom-cloud/utils/class-name";
10
- import { colors as U } from "./colors.js";
11
- import { ControlBar as vo } from "./ControlBar.js";
12
- import { useColorPicker as W } from "./hooks/useColorPicker.js";
13
- import { InputAlpha as Io } from "./InputAlpha.js";
14
- import { InputHex as Ao } from "./InputHex.js";
15
- import { InputRgb as $o } from "./InputRgb.js";
16
- import { Palette as wo } from "./Palette.js";
17
- import { Panel as X } from "./Panel.js";
18
- import { getGradientString as Y, renderBackground as Z } from "./utils.js";
19
- import _ from "../config-provider/context.js";
7
+ import K from "../copy/index.js";
8
+ import L from "../components/common/hooks/useMergeProps.js";
9
+ import Q from "../trigger/index.js";
10
+ import U from "@unicom-cloud/utils/class-name";
11
+ import { colors as W } from "./colors.js";
12
+ import { ControlBar as Io } from "./ControlBar.js";
13
+ import { useColorPicker as X } from "./hooks/useColorPicker.js";
14
+ import { InputAlpha as bo } from "./InputAlpha.js";
15
+ import { InputHex as $o } from "./InputHex.js";
16
+ import { InputRgb as wo } from "./InputRgb.js";
17
+ import { Palette as Ro } from "./Palette.js";
18
+ import { Panel as Y } from "./Panel.js";
19
+ import { getGradientString as Z, renderBackground as _ } from "./utils.js";
20
+ import oo from "../config-provider/context.js";
20
21
  const c = {
21
22
  size: "default",
22
- presetColors: U
23
+ presetColors: W
23
24
  };
24
- function oo(t, m) {
25
+ function ro(t, m) {
25
26
  const {
26
27
  getPrefixCls: d,
27
28
  componentConfig: g,
28
29
  size: u
29
- } = q(_), n = K(
30
+ } = J(oo), n = L(
30
31
  t,
31
32
  { ...c, size: u || c.size },
32
33
  g?.ColorPicker
@@ -43,8 +44,8 @@ function oo(t, m) {
43
44
  historyColors: y,
44
45
  presetColors: I,
45
46
  showHistory: N,
46
- showPreset: A,
47
- renderFooter: b
47
+ showPreset: b,
48
+ renderFooter: A
48
49
  } = n, r = d?.("color-picker"), {
49
50
  value: o,
50
51
  activeMode: $,
@@ -52,20 +53,20 @@ function oo(t, m) {
52
53
  activeColorId: w,
53
54
  activeColorIdRef: E,
54
55
  popupVisible: R,
55
- color: B,
56
- alpha: H,
56
+ color: H,
57
+ alpha: B,
57
58
  onHsvChange: M,
58
59
  onAlphaChange: O,
59
60
  onVisibleChange: T,
60
61
  onActiveModeChange: V,
61
62
  onGradientColorsChange: j,
62
63
  onActiveColorIdChange: F
63
- } = W(n);
64
+ } = X(n);
64
65
  return /* @__PURE__ */ e(
65
- L,
66
+ Q,
66
67
  {
67
68
  popup: () => /* @__PURE__ */ e(
68
- X,
69
+ Y,
69
70
  {
70
71
  value: o,
71
72
  mode: h,
@@ -73,19 +74,19 @@ function oo(t, m) {
73
74
  gradientColors: z,
74
75
  activeColorId: w,
75
76
  activeColorIdRef: E,
76
- color: B,
77
- alpha: H,
77
+ color: H,
78
+ alpha: B,
78
79
  historyColors: y,
79
80
  presetColors: I,
80
81
  showHistory: N,
81
- showPreset: A,
82
+ showPreset: b,
82
83
  onHsvChange: M,
83
84
  onAlphaChange: O,
84
85
  onActiveModeChange: V,
85
86
  onGradientColorsChange: j,
86
87
  onActiveColorIdChange: F,
87
88
  disabledAlpha: x,
88
- renderFooter: b
89
+ renderFooter: A
89
90
  }
90
91
  ),
91
92
  trigger: "click",
@@ -103,14 +104,14 @@ function oo(t, m) {
103
104
  ...P,
104
105
  onVisibleChange: T,
105
106
  children: (() => {
106
- const a = G(t.triggerElement) ? t.triggerElement({ value: o }) : t.triggerElement;
107
- if (!S(a))
107
+ const a = S(t.triggerElement) ? t.triggerElement({ value: o }) : t.triggerElement;
108
+ if (!D(a))
108
109
  return a;
109
- const s = typeof o == "string" ? o : Y(o);
110
+ const s = typeof o == "string" ? o : Z(o);
110
111
  return /* @__PURE__ */ p(
111
112
  "div",
112
113
  {
113
- className: Q(r, f, {
114
+ className: U(r, f, {
114
115
  [`${r}-size-${l}`]: l,
115
116
  [`${r}-disabled`]: i
116
117
  }),
@@ -121,14 +122,14 @@ function oo(t, m) {
121
122
  "div",
122
123
  {
123
124
  className: `${r}-preview`,
124
- style: Array.isArray(o) ? {
125
- background: Z(o)
125
+ style: G(o) ? {
126
+ background: _(o)
126
127
  } : { backgroundColor: o }
127
128
  }
128
129
  ),
129
130
  !!v && /* @__PURE__ */ p("div", { className: `${r}-value`, children: [
130
131
  s,
131
- !i && /* @__PURE__ */ e(J, { text: s, className: `${r}-copy` })
132
+ !i && /* @__PURE__ */ e(K, { text: s, className: `${r}-copy` })
132
133
  ] }),
133
134
  /* @__PURE__ */ e(
134
135
  "input",
@@ -147,16 +148,16 @@ function oo(t, m) {
147
148
  }
148
149
  );
149
150
  }
150
- const ro = D.forwardRef(
151
- oo
151
+ const eo = q.forwardRef(
152
+ ro
152
153
  );
153
- ro.displayName = "ColorPicker";
154
+ eo.displayName = "ColorPicker";
154
155
  export {
155
- vo as ColorPickerControlBar,
156
- Io as ColorPickerInputAlpha,
157
- Ao as ColorPickerInputHex,
158
- $o as ColorPickerInputRgb,
159
- wo as ColorPickerPalette,
160
- X as ColorPickerPanel,
161
- ro as default
156
+ Io as ColorPickerControlBar,
157
+ bo as ColorPickerInputAlpha,
158
+ $o as ColorPickerInputHex,
159
+ wo as ColorPickerInputRgb,
160
+ Ro as ColorPickerPalette,
161
+ Y as ColorPickerPanel,
162
+ eo as default
162
163
  };
@@ -1,89 +1,90 @@
1
1
  import s from "@unicom-cloud/utils/tinycolor";
2
- const R = (t) => t.sort((r, n) => r.percent - n.percent), H = (t, r, n) => Object.keys(t).reduce(
2
+ import c from "lodash/isArray";
3
+ const k = (t) => t.sort((n, r) => n.percent - r.percent), w = (t, n, r) => Object.keys(t).reduce(
3
4
  (e, o) => ({
4
5
  ...e,
5
- [o]: t[o] + (r[o] - t[o]) * n
6
+ [o]: t[o] + (n[o] - t[o]) * r
6
7
  }),
7
8
  { ...t }
8
- ), b = (t) => t.map(({ color: r, percent: n }) => `${r} ${n}%`).join(", "), w = (t) => `linear-gradient(to right, ${b(t)})`, G = (t) => Array.isArray(t) ? w(t) : t, k = (t, r, n, e) => e < 1 ? `rgba(${t}, ${r}, ${n}, ${e.toFixed(2)})` : `rgb(${t}, ${r}, ${n})`, q = (t, r, n, e) => e < 1 ? new s({ r: t, g: r, b: n, a: e }).toHexString() : new s({ r: t, g: r, b: n }).toHexString(), p = (t) => {
9
- const r = new s({
9
+ ), C = (t) => t.map(({ color: n, percent: r }) => `${n} ${r}%`).join(", "), I = (t) => `linear-gradient(to right, ${C(t)})`, q = (t) => c(t) ? I(t) : t, F = (t, n, r, e) => e < 1 ? `rgba(${t}, ${n}, ${r}, ${e.toFixed(2)})` : `rgb(${t}, ${n}, ${r})`, S = (t, n, r, e) => e < 1 ? new s({ r: t, g: n, b: r, a: e }).toHexString() : new s({ r: t, g: n, b: r }).toHexString(), l = (t) => {
10
+ const n = new s({
10
11
  h: t.h * 360,
11
12
  s: t.s * 100,
12
13
  v: t.v * 100
13
- }), n = r.toRgb(), e = r.toHex();
14
+ }), r = n.toRgb(), e = n.toHex();
14
15
  return {
15
16
  hsv: t,
16
- rgb: n,
17
+ rgb: r,
17
18
  hex: e
18
19
  };
19
- }, c = () => Math.random().toFixed(10).slice(2), A = (t, r) => t.map((n) => {
20
- const e = new s(n.color).toHsv_();
20
+ }, i = () => Math.random().toFixed(10).slice(2), j = (t, n) => t.map((r) => {
21
+ const e = new s(r.color).toHsv_();
21
22
  return {
22
- id: c(),
23
- color: p(e),
24
- alpha: r ? 100 : e.a,
25
- percent: n.percent
23
+ id: i(),
24
+ color: l(e),
25
+ alpha: n ? 100 : e.a,
26
+ percent: r.percent
26
27
  };
27
- }), F = (t, r, n) => {
28
- const e = t.findIndex((a) => a.percent === r);
28
+ }), P = (t, n, r) => {
29
+ const e = t.findIndex((a) => a.percent === n);
29
30
  if (e !== -1)
30
31
  return {
31
32
  ...t[e],
32
- id: n ?? c()
33
+ id: r ?? i()
33
34
  };
34
35
  const o = t.findIndex(
35
- (a) => a.percent > r
36
- ), l = o - 1, {
37
- color: d,
38
- alpha: g,
39
- percent: i
40
- } = t[l], {
41
- color: u,
42
- alpha: x,
43
- percent: f
44
- } = t[o], h = H(
36
+ (a) => a.percent > n
37
+ ), d = o - 1, {
38
+ color: g,
39
+ alpha: u,
40
+ percent: p
41
+ } = t[d], {
42
+ color: x,
43
+ alpha: f,
44
+ percent: m
45
+ } = t[o], h = w(
45
46
  {
46
- ...d.rgb,
47
- a: g
47
+ ...g.rgb,
48
+ a: u
48
49
  },
49
50
  {
50
- ...u.rgb,
51
- a: x
51
+ ...x.rgb,
52
+ a: f
52
53
  },
53
- (r - i) / (f - i)
54
- ), { r: m, g: $, b: y, a: v } = h;
54
+ (n - p) / (m - p)
55
+ ), { r: $, g: v, b: H, a: b } = h;
55
56
  return {
56
- id: n ?? c(),
57
- color: p(
57
+ id: r ?? i(),
58
+ color: l(
58
59
  new s({
59
- r: m,
60
- g: $,
61
- b: y
60
+ r: $,
61
+ g: v,
62
+ b: H
62
63
  }).toHsv_()
63
64
  ),
64
- alpha: v,
65
- percent: r
65
+ alpha: b,
66
+ percent: n
66
67
  };
67
- }, S = (t, r) => t.h === r.h && t.s === r.s && t.v === r.v, C = (t, r) => t.r === r.r && t.g === r.g && t.b === r.b && t.a === r.a, j = (t, r) => typeof t == "string" && typeof r == "string" ? t === r : Array.isArray(t) && Array.isArray(r) ? t.length === r.length && t.every((n, e) => {
68
- const o = r[e];
69
- return C(
70
- new s(n.color).toRgba(),
68
+ }, T = (t, n) => t.h === n.h && t.s === n.s && t.v === n.v, R = (t, n) => t.r === n.r && t.g === n.g && t.b === n.b && t.a === n.a, _ = (t, n) => typeof t == "string" && typeof n == "string" ? t === n : c(t) && c(n) ? t.length === n.length && t.every((r, e) => {
69
+ const o = n[e];
70
+ return R(
71
+ new s(r.color).toRgba(),
71
72
  new s(o.color).toRgba()
72
- ) && n.percent === o.percent;
73
+ ) && r.percent === o.percent;
73
74
  }) : !1;
74
75
  export {
75
- S as equalsHsv,
76
- C as equalsRgba,
77
- q as formatHex,
78
- k as formatRgba,
79
- F as getColorByGradients,
80
- p as getColorFromHsv,
81
- b as getGradientString,
82
- c as getRandomId,
83
- j as isEqualsColors,
84
- A as mapValueToGradientColor,
85
- H as mix,
86
- G as renderBackground,
87
- w as renderGradientBackground,
88
- R as sortGradientColors
76
+ T as equalsHsv,
77
+ R as equalsRgba,
78
+ S as formatHex,
79
+ F as formatRgba,
80
+ P as getColorByGradients,
81
+ l as getColorFromHsv,
82
+ C as getGradientString,
83
+ i as getRandomId,
84
+ _ as isEqualsColors,
85
+ j as mapValueToGradientColor,
86
+ w as mix,
87
+ q as renderBackground,
88
+ I as renderGradientBackground,
89
+ k as sortGradientColors
89
90
  };
@@ -2,7 +2,7 @@ import { jsxs as N, jsx as s } from "react/jsx-runtime";
2
2
  import $ from "@unicom-cloud/icons/IconUiEmpty";
3
3
  import { UI_COMMON_PREFIX as g } from "@unicom-cloud/utils/constant/ui";
4
4
  import { memo as x, forwardRef as u } from "react";
5
- import { SpaceVertical as C } from "../space/index.js";
5
+ import C from "../space/index.js";
6
6
  import r from "@unicom-cloud/utils/class-name";
7
7
  const E = (n, c) => {
8
8
  const {
@@ -24,7 +24,7 @@ const E = (n, c) => {
24
24
  }
25
25
  ) : o ? /* @__PURE__ */ s("div", { className: r(`${e}-icon`, `${t}-icon`), children: o }) : /* @__PURE__ */ s($, { className: r(`${e}-icon`, `${t}-icon`) });
26
26
  return /* @__PURE__ */ N(
27
- C,
27
+ C.Vertical,
28
28
  {
29
29
  ref: c,
30
30
  className: r(e, t, p),
@@ -1,64 +1,73 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
- import { UI_COMMON_PREFIX as j } from "@unicom-cloud/utils/constant/ui";
3
- import { forwardRef as x, useMemo as C } from "react";
4
- import I from "../hooks/useMergeProps.js";
5
- import P from "@unicom-cloud/utils/class-name";
2
+ import { UI_COMMON_PREFIX as G } from "@unicom-cloud/utils/constant/ui";
3
+ import { forwardRef as y } from "react";
4
+ import O from "../hooks/useMergeProps.js";
5
+ import I from "@unicom-cloud/utils/class-name";
6
6
  import "../utils/is.js";
7
- import { GAP_SIZE_MAP as y } from "./interface.js";
8
- import { isBoolean as V, isArray as _, isString as A } from "@unicom-cloud/utils/is";
9
- const O = (o) => A(o) && Object.keys(y).includes(o), m = (o, r, t) => {
10
- t !== void 0 && (O(t) ? o[r] = y[t] : o[r] = typeof t == "number" ? `${t}px` : t);
11
- }, S = (o = {}, r, t = "gap") => (r === void 0 || (_(r) ? (m(o, "rowGap", r[0]), m(o, "columnGap", r[1])) : m(o, t, r)), o), b = {
7
+ import { GAP_SIZE_MAP as x } from "./interface.js";
8
+ import { isBoolean as M, isArray as P, isString as S } from "@unicom-cloud/utils/is";
9
+ function p(e, i, t) {
10
+ if (t === void 0)
11
+ return;
12
+ S(t) && Object.keys(x).includes(t) ? e[i] = x[t] : e[i] = t;
13
+ }
14
+ function V(e = {}, i, t = "gap") {
15
+ return i === void 0 || (P(i) ? (p(e, "rowGap", i[0]), p(e, "columnGap", i[1] ?? i[0])) : p(e, t, i)), e;
16
+ }
17
+ const _ = {
12
18
  component: "div",
13
19
  gap: "small"
14
- }, a = x((o, r) => {
15
- const t = I(o, b, {}), {
16
- className: g,
17
- style: c,
18
- flex: l,
19
- gap: f,
20
- children: u,
21
- direction: e,
22
- justify: i,
23
- align: n,
24
- component: N = "div",
25
- wrap: s,
26
- rtl: w,
27
- ...F
28
- } = t, p = `${j}-flex`, G = C(() => {
29
- const M = {
30
- display: "flex",
31
- ...S({}, f),
32
- ...s !== void 0 && {
33
- flexWrap: V(s) ? s ? "wrap" : "nowrap" : s
34
- },
35
- ...n && { alignItems: n },
36
- ...i && { justifyContent: i },
37
- ...e && { flexDirection: e },
38
- ...l && { flex: l }
39
- };
40
- return { ...c, ...M };
41
- }, [f, s, n, i, e, l, c]);
42
- return /* @__PURE__ */ d(
43
- N,
20
+ }, m = y((e, i) => {
21
+ const t = O(e, _, {}), {
22
+ className: r,
23
+ style: $,
24
+ flex: u,
25
+ gap: j,
26
+ children: N,
27
+ direction: s,
28
+ justify: l,
29
+ align: f,
30
+ component: w = "div",
31
+ wrap: a,
32
+ rtl: F,
33
+ inline: c,
34
+ ...C
35
+ } = t, o = `${G}-flex`, n = {
36
+ display: c ? "inline-flex" : "flex"
37
+ };
38
+ return "wrap" in t && (n.flexWrap = M(a) ? a ? "wrap" : "nowrap" : a), "flex" in t && (n.flex = u), f && (n.alignItems = f), l && (n.justifyContent = l), s && (n.flexDirection = s), Object.assign(n, V({}, j), $), /* @__PURE__ */ d(
39
+ w,
44
40
  {
45
- ref: r,
46
- style: G,
47
- className: P(p, g, {
48
- [`${p}-rtl`]: w,
49
- [`${p}-${e}`]: e,
50
- [`${p}-${i}`]: i,
51
- [`${p}-${n}`]: n
52
- }),
53
- ...F,
54
- children: u
41
+ ref: i,
42
+ style: n,
43
+ className: I(
44
+ o,
45
+ {
46
+ [`${o}-rtl`]: F,
47
+ [`${o}-inline`]: c
48
+ },
49
+ !!s && `${o}-flex-direction-${s}`,
50
+ !!l && `${o}-justify-content-${l}`,
51
+ !!f && `${o}-align-items-${f}`,
52
+ r
53
+ ),
54
+ ...C,
55
+ children: N
55
56
  }
56
57
  );
57
- }), $ = x((o, r) => /* @__PURE__ */ d(a, { ref: r, ...o, direction: "column" }));
58
- a.Vertical = $;
59
- a.displayName = "Flex";
60
- $.displayName = "Flex.Vertical";
58
+ });
59
+ m.displayName = "Flex";
60
+ const g = y(
61
+ (e, i) => {
62
+ const { direction: t = "column", ...r } = e;
63
+ return /* @__PURE__ */ d(m, { ...r, ref: i, direction: t });
64
+ }
65
+ );
66
+ g.displayName = "FlexVertical";
67
+ const U = Object.assign(m, {
68
+ Vertical: g
69
+ });
61
70
  export {
62
- $ as FlexVertical,
63
- a as default
71
+ g as FlexVertical,
72
+ U as default
64
73
  };