@baishuyun/ui-base 2.3.1 → 2.3.3

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 (74) hide show
  1. package/dist/Card/Card-F2t4Rv_v.js +69 -0
  2. package/dist/Card/index.js +3 -4
  3. package/dist/CheckBox/CheckBox-DFoMXJZz.js +67 -0
  4. package/dist/CheckBox/CheckBox-q2vu7qf7.js +33 -0
  5. package/dist/CheckBox/index.js +4 -39
  6. package/dist/ColorPicker/ColorPicker-Bh4KTHxh.js +168 -0
  7. package/dist/ColorPicker/index.js +6 -5
  8. package/dist/DropDown/DropDown-BEzloRRM.js +162 -0
  9. package/dist/DropDown/index.js +7 -4
  10. package/dist/Editor/Buttons-ClWtl3G-.js +595 -0
  11. package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
  12. package/dist/Editor/constants/index.js +53 -20
  13. package/dist/Editor/index.js +518 -576
  14. package/dist/Icon/Icon-DXmPqVzg.js +19 -0
  15. package/dist/Icon/index.js +2 -4
  16. package/dist/InputTag/InputTag-DbiyuWo9.js +139 -0
  17. package/dist/InputTag/index.js +3 -4
  18. package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
  19. package/dist/Loading/index.js +2 -4
  20. package/dist/Modal/Modal-BO1s8pJe.js +81 -0
  21. package/dist/Modal/index.js +3 -4
  22. package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
  23. package/dist/NotFoundContent/index.js +2 -4
  24. package/dist/Radio/Radio-dyoBNiKF.js +85 -0
  25. package/dist/Radio/index.js +2 -105
  26. package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
  27. package/dist/Segmented/index.js +2 -4
  28. package/dist/Select/Select-DoQO-Xi5.js +729 -0
  29. package/dist/Select/SelectInputSearch-gp6gcY3x.js +46 -0
  30. package/dist/Select/index.js +11 -6
  31. package/dist/Tabs/Tabs-Dsxn_7gF.js +410 -0
  32. package/dist/Tabs/index.js +6 -7
  33. package/dist/Tree/index.js +5 -4
  34. package/dist/Tree/utils/index.js +24 -39
  35. package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
  36. package/dist/index.js +103 -81
  37. package/dist/style.css +2 -1
  38. package/dist/vendors/Tree-DgwG7Unx.js +231 -0
  39. package/dist/vendors/animations-C5JKFkz4.js +38 -0
  40. package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
  41. package/dist/vendors/color-BPWy9DvT.js +12 -0
  42. package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
  43. package/dist/vendors/lexical-hZliMgDv.js +6439 -0
  44. package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
  45. package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
  46. package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
  47. package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
  48. package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
  49. package/package.json +4 -4
  50. package/dist/Card/Card-Y1ISqAp9.js +0 -86
  51. package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
  52. package/dist/ColorPicker/ColorPicker-uPJOs52x.js +0 -215
  53. package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
  54. package/dist/Editor/index-D7tFsaxU.js +0 -846
  55. package/dist/Icon/Icon-CBlIwtp2.js +0 -24
  56. package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
  57. package/dist/Loading/Loading-CEB4PLUE.js +0 -9
  58. package/dist/Modal/Modal-z3TvEXwN.js +0 -80
  59. package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
  60. package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
  61. package/dist/Select/Select-hwXXDuLU.js +0 -820
  62. package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
  63. package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
  64. package/dist/vendors/Tree-CLEy-xqz.js +0 -235
  65. package/dist/vendors/clsx-OuTLNxxd.js +0 -16
  66. package/dist/vendors/color-VzwvCPhF.js +0 -21
  67. package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
  68. package/dist/vendors/index-MTmG1Ezy.js +0 -15
  69. package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
  70. package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
  71. package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
  72. package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
  73. package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
  74. package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
@@ -1,235 +0,0 @@
1
- import { jsx as l, jsxs as N, Fragment as O } from "react/jsx-runtime";
2
- import M, { useMemo as j, useCallback as P, createContext as A, useContext as V, useEffect as R } from "react";
3
- import { I as $ } from "../Icon/Icon-CBlIwtp2.js";
4
- import { c as E } from "./clsx-OuTLNxxd.js";
5
- import { n as _ } from "./lodash-es-DFpaJB4Y.js";
6
- import { B as z } from "../CheckBox/CheckBox-C9sXWSA5.js";
7
- import F from "../Radio/index.js";
8
- import { AnimatePresence as W, motion as q } from "motion/react";
9
- import { useControllableValue as B } from "ahooks";
10
- import { getMatchingNodesPaths as G, getNodePath as J } from "../Tree/utils/index.js";
11
- const L = ({ text: e, highlight: s, truncate: c = !0 }) => {
12
- const [i, x] = j(
13
- () => e && s ? [e.toLowerCase(), s.toLowerCase()] : [],
14
- [e, s]
15
- ), d = P(() => {
16
- if (!s.trim())
17
- return [{ text: e, isMatch: !1 }];
18
- const t = x ? i == null ? void 0 : i.indexOf(x) : -1;
19
- return t === -1 || t === void 0 ? [{ text: e, isMatch: !1 }] : [
20
- { text: e.slice(0, t), isMatch: !1 },
21
- { text: e.slice(t, t + s.length), isMatch: !0 },
22
- { text: e.slice(t + s.length), isMatch: !1 }
23
- ].filter((o) => o.text);
24
- }, [e, s, i, x])(), y = {
25
- color: "#0265ff",
26
- fontWeight: 500
27
- };
28
- return /* @__PURE__ */ l(
29
- "div",
30
- {
31
- className: c ? "select-none text-ellipsis overflow-hidden whitespace-nowrap truncate w-full" : "select-none whitespace-nowrap w-full",
32
- children: d.map(
33
- (t, o) => t.isMatch ? /* @__PURE__ */ l("span", { style: y, children: t.text }, o) : /* @__PURE__ */ l("span", { children: t.text }, o)
34
- )
35
- }
36
- );
37
- };
38
- L.displayName = "HighlightText";
39
- const Q = M.memo(L), I = A({
40
- searchValue: "",
41
- selectedKeys: [],
42
- expandedKeys: [],
43
- parentCheckable: !1,
44
- onSelect: _,
45
- onExpand: _,
46
- icon: void 0,
47
- switcherIcon: void 0,
48
- checkType: "default",
49
- showSwitcher: !0
50
- }), U = 22, H = ({ node: e, level: s = 0, fieldNames: c }) => {
51
- var n;
52
- const i = V(I), {
53
- searchValue: x,
54
- selectedKeys: v,
55
- expandedKeys: d,
56
- onSelect: y,
57
- onExpand: t,
58
- onDeSelect: o,
59
- parentCheckable: w,
60
- checkType: f,
61
- showSwitcher: k
62
- } = V(I), h = e[c.children] && e[c.children].length > 0, m = v.includes(e[c.value]), p = h ? d.includes(e[c.value]) : !1, g = () => {
63
- if (e.checkable === !1) {
64
- h && (t == null || t(e[c.value], !p));
65
- return;
66
- }
67
- if (h) {
68
- w ? C() : t == null || t(e[c.value], !p);
69
- return;
70
- }
71
- C();
72
- }, C = () => {
73
- m ? o == null || o(e[c.value]) : y == null || y(e[c.value], e);
74
- }, K = (r) => {
75
- r.stopPropagation(), h && (t == null || t(e[c.value], !p));
76
- }, S = (r = !1) => {
77
- const a = e.icon || i.icon;
78
- if (!a) return null;
79
- const u = typeof a == "function" ? a(e) : a;
80
- return M.isValidElement(u) ? /* @__PURE__ */ l(
81
- "span",
82
- {
83
- className: E({
84
- "text-[#0265ff]": r,
85
- "text-[#73819c]": !r
86
- }),
87
- children: u
88
- }
89
- ) : null;
90
- }, b = (r) => h ? i.switcherIcon ? i.switcherIcon(r) : /* @__PURE__ */ l(
91
- $,
92
- {
93
- name: "arrow-right",
94
- className: E("transition-transform duration-300 ease-in-out text-[#666]", {
95
- "rotate-90": r
96
- })
97
- }
98
- ) : null, T = () => h && !w || f === "default" || e.checkable === !1 ? null : /* @__PURE__ */ N("div", { className: "ml-auto shrink-0", children: [
99
- f === "radio" && /* @__PURE__ */ l(F, { checked: m }),
100
- f === "checkbox" && /* @__PURE__ */ l(z, { checked: m })
101
- ] });
102
- return /* @__PURE__ */ N(O, { children: [
103
- /* @__PURE__ */ l(
104
- "div",
105
- {
106
- className: E("rounded-[4px] cursor-pointer", {
107
- "text-[#0265ff] bg-[#f0f6ff]": m && f === "default",
108
- "hover:bg-[#f3f3f3]": !m || f !== "default"
109
- }),
110
- onClick: g,
111
- children: /* @__PURE__ */ N(
112
- "div",
113
- {
114
- className: "flex items-center px-[10px] py-[7px] gap-x-[6px]",
115
- style: { marginLeft: `${s * U}px` },
116
- children: [
117
- /* @__PURE__ */ l(
118
- "div",
119
- {
120
- className: E("w-4 h-4 flex items-center justify-center flex-shrink-0", {
121
- hidden: !k
122
- }),
123
- onClick: K,
124
- children: b(p)
125
- }
126
- ),
127
- S(m),
128
- M.isValidElement(e[c.title]) ? e[c.title] : /* @__PURE__ */ l(Q, { text: e[c.title], highlight: x, truncate: !1 }),
129
- T()
130
- ]
131
- }
132
- )
133
- }
134
- ),
135
- h && /* @__PURE__ */ l(W, { initial: !1, children: p ? /* @__PURE__ */ l(
136
- q.div,
137
- {
138
- initial: { height: 0, opacity: 0 },
139
- animate: { height: "auto", opacity: 1 },
140
- exit: { height: 0, opacity: 0 },
141
- transition: { duration: 0.2, ease: [0.4, 0, 0.2, 1] },
142
- children: /* @__PURE__ */ l("div", { className: "min-w-max", children: (n = e[c.children]) == null ? void 0 : n.map((r) => /* @__PURE__ */ l(
143
- H,
144
- {
145
- node: r,
146
- level: s + 1,
147
- fieldNames: c
148
- },
149
- r[c.value]
150
- )) })
151
- },
152
- "children"
153
- ) : null })
154
- ] });
155
- }, X = (e) => {
156
- const {
157
- data: s,
158
- searchValue: c = "",
159
- fieldNames: i = { title: "title", value: "value", children: "children" },
160
- icon: x,
161
- switcherIcon: v,
162
- onSelect: d,
163
- parentCheckable: y = !1,
164
- checkType: t = "default",
165
- defaultExpandedKeys: o,
166
- showSwitcher: w = !0,
167
- onDeSelect: f
168
- } = e, [k, h] = B(e, {
169
- defaultValuePropName: "defaultSelectedKeys",
170
- valuePropName: "selectedKeys",
171
- defaultValue: [],
172
- trigger: "__DO_NOT_CALLED__"
173
- }), m = () => {
174
- var r;
175
- const n = /* @__PURE__ */ new Set();
176
- return (r = e.selectedKeys) != null && r.length ? (e.selectedKeys.forEach((a) => {
177
- const u = J(s, a, i);
178
- u && u.length > 1 && u.slice(0, -1).forEach((D) => n.add(D));
179
- }), [...n]) : [];
180
- }, [p, g] = B(e, {
181
- valuePropName: "expandedKeys",
182
- defaultValuePropName: "defaultExpandedKeys",
183
- defaultValue: m(),
184
- trigger: "onExpand"
185
- });
186
- R(() => {
187
- if (!c) {
188
- if (k.length || o != null && o.length) return;
189
- g([]);
190
- return;
191
- }
192
- const n = /* @__PURE__ */ new Set(), r = G(s, c, i);
193
- if (r.length === 0) {
194
- g([]);
195
- return;
196
- }
197
- r.forEach((a) => a.slice(0, -1).forEach((u) => n.add(u))), n.size !== 0 && g([...n]);
198
- }, [c]);
199
- const C = P(
200
- (n, r) => {
201
- h((a) => t === "checkbox" ? [.../* @__PURE__ */ new Set([...a, n])] : [n]), d && (d == null || d(n, r));
202
- },
203
- [d, h, t]
204
- ), K = (n, r) => {
205
- C(n, r);
206
- }, S = P(
207
- (n) => {
208
- h((r) => r.filter((a) => a !== n)), f == null || f(n);
209
- },
210
- [h, f]
211
- ), b = (n, r) => {
212
- const a = r ? [...p, n] : p.filter((u) => u !== n);
213
- g(a);
214
- };
215
- if (!(s != null && s.length)) return null;
216
- const T = {
217
- searchValue: c,
218
- selectedKeys: k,
219
- expandedKeys: p,
220
- onSelect: K,
221
- onDeSelect: S,
222
- onExpand: b,
223
- icon: x,
224
- switcherIcon: v,
225
- checkType: t,
226
- parentCheckable: y,
227
- showSwitcher: w
228
- };
229
- return /* @__PURE__ */ l(I.Provider, { value: T, children: /* @__PURE__ */ l("div", { className: "bsy-tree text-sm", children: s.map((n) => /* @__PURE__ */ l(H, { node: n, fieldNames: i }, n[i.value])) }) });
230
- };
231
- X.displayName = "BsyTree";
232
- export {
233
- Q as H,
234
- X as T
235
- };
@@ -1,16 +0,0 @@
1
- function a(r) {
2
- var f, n, t = "";
3
- if (typeof r == "string" || typeof r == "number") t += r;
4
- else if (typeof r == "object") if (Array.isArray(r)) {
5
- var o = r.length;
6
- for (f = 0; f < o; f++) r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
7
- } else for (n in r) r[n] && (t && (t += " "), t += n);
8
- return t;
9
- }
10
- function i() {
11
- for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
12
- return t;
13
- }
14
- export {
15
- i as c
16
- };
@@ -1,21 +0,0 @@
1
- import { t as f } from "./tinycolor2-Begv3Jc8.js";
2
- import { a as c } from "./lodash-es-DFpaJB4Y.js";
3
- function u(r, a) {
4
- const n = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
5
- r = r.replace(n, (l, o, s, e) => o + o + s + s + e + e);
6
- const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);
7
- if (!t)
8
- return console.error("Invalid HEX color format."), null;
9
- const i = parseInt(t[1], 16), g = parseInt(t[2], 16), d = parseInt(t[3], 16);
10
- return `rgba(${i}, ${g}, ${d}, ${a})`;
11
- }
12
- const b = (r, a) => {
13
- if (c(r) || c(a))
14
- return !1;
15
- const n = f(r).toRgbString(), t = f(a).toRgbString();
16
- return n === t;
17
- };
18
- export {
19
- b as a,
20
- u as h
21
- };