@baishuyun/ui-base 2.3.1 → 2.3.2

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-BE6v4I-A.js +69 -0
  2. package/dist/Card/index.js +3 -4
  3. package/dist/CheckBox/CheckBox--rXaUgMO.js +67 -0
  4. package/dist/CheckBox/CheckBox-Db8X-pw9.js +33 -0
  5. package/dist/CheckBox/index.js +4 -39
  6. package/dist/ColorPicker/ColorPicker-BBP-4-so.js +168 -0
  7. package/dist/ColorPicker/index.js +6 -5
  8. package/dist/DropDown/DropDown-CKXi9mXN.js +162 -0
  9. package/dist/DropDown/index.js +7 -4
  10. package/dist/Editor/Buttons--dMLPuk2.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-DppVOyPK.js +19 -0
  15. package/dist/Icon/index.js +2 -4
  16. package/dist/InputTag/InputTag-B6N5MZA2.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-FVJpbEgw.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-Bd2ECrB0.js +729 -0
  29. package/dist/Select/SelectInputSearch-CIXBNLFi.js +46 -0
  30. package/dist/Select/index.js +11 -6
  31. package/dist/Tabs/Tabs-C79GTyGd.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-CQR9fvpA.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 +3 -3
  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,34 +0,0 @@
1
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { I as t } from "../Icon/Icon-CBlIwtp2.js";
3
- import { u as o } from "../vendors/useLocale-DgqW9M3h.js";
4
- const p = (r) => {
5
- const { t: a } = o(), { searchPlaceholder: l = a("search"), value: c = "", onChange: s } = r;
6
- return /* @__PURE__ */ e("div", { className: "bsy-select-input-search", children: /* @__PURE__ */ n("div", { className: "bsy-select-input-search-input", children: [
7
- /* @__PURE__ */ e("div", { className: "bsy-select-input-search-input__icon flex items-center justify-center", children: /* @__PURE__ */ e(t, { name: "search", style: { color: "#666", fontSize: 16 } }) }),
8
- /* @__PURE__ */ e("div", { className: "bsy-select-input-search-input__container", children: /* @__PURE__ */ e(
9
- "input",
10
- {
11
- type: "text",
12
- placeholder: l,
13
- value: c,
14
- onChange: (i) => s == null ? void 0 : s(i.target.value),
15
- role: "searchbox",
16
- "aria-label": "search options"
17
- }
18
- ) }),
19
- c && /* @__PURE__ */ e(
20
- "div",
21
- {
22
- className: "bsy-select-input-search-input__icon flex items-center justify-center cursor-pointer",
23
- onClick: () => s == null ? void 0 : s(""),
24
- role: "button",
25
- "aria-label": "clear search",
26
- children: /* @__PURE__ */ e(t, { name: "close" })
27
- }
28
- )
29
- ] }) });
30
- };
31
- p.displayName = "BsySelectInputSearch";
32
- export {
33
- p as S
34
- };
@@ -1,445 +0,0 @@
1
- import { jsx as t, jsxs as k, Fragment as O } from "react/jsx-runtime";
2
- import { FloatingPortal as G } from "@floating-ui/react";
3
- import { AnimatePresence as V, motion as z } from "motion/react";
4
- import { useEventListener as K, useMutationObserver as q, useControllableValue as B, useToggle as Y } from "ahooks";
5
- import { u as H } from "../vendors/useFloatingPortal-9VUFOAOG.js";
6
- import { createContext as J, useContext as W, useRef as P, useState as A, useCallback as F, useLayoutEffect as M } from "react";
7
- import { c as m } from "../vendors/clsx-OuTLNxxd.js";
8
- import { h as Q } from "../vendors/color-VzwvCPhF.js";
9
- import { i as U } from "../vendors/lodash-es-DFpaJB4Y.js";
10
- import { I as Z } from "../Icon/Icon-CBlIwtp2.js";
11
- import { P as ee } from "../vendors/index-MTmG1Ezy.js";
12
- const c = {
13
- LINE: "line",
14
- CARD: "card",
15
- FILLED_CARD: "filled-card",
16
- BADGE_CARD: "badge-card"
17
- }, D = J({
18
- color: "#0269ff",
19
- type: c.LINE
20
- }), te = "_active_1oc43_18", ae = "_disabled_1oc43_26", se = "_line_1oc43_44", le = "_card_1oc43_53", u = {
21
- "bsy-tab": "_bsy-tab_1oc43_1",
22
- "badge-card": "_badge-card_1oc43_9",
23
- active: te,
24
- disabled: ae,
25
- line: se,
26
- card: le,
27
- "filled-card": "_filled-card_1oc43_78"
28
- }, re = (e, n = 24) => e.length <= n ? e : e.slice(0, n) + "...", w = (e) => typeof e == "string" ? re(e) : e, X = ({ label: e, active: n = !1, onClick: r, tabKey: l }) => {
29
- const { type: d = c.LINE, disabled: s, color: f } = W(D), a = U(e) ? e : "", y = () => {
30
- s || r == null || r(l);
31
- }, i = {
32
- "data-tab-item": !0,
33
- "data-tab-key": l,
34
- role: "tab",
35
- "aria-selected": n,
36
- "aria-controls": `panel-${l}`,
37
- onClick: y
38
- };
39
- return d === c.LINE ? /* @__PURE__ */ t(
40
- "div",
41
- {
42
- ...i,
43
- className: m(u["bsy-tab"], u.line, {
44
- [u.disabled]: s,
45
- [u.active]: n
46
- }),
47
- title: a,
48
- children: w(e)
49
- }
50
- ) : d === c.CARD ? /* @__PURE__ */ t(
51
- "div",
52
- {
53
- ...i,
54
- className: m(u["bsy-tab"], u.card, {
55
- [u.active]: n,
56
- [u.disabled]: s
57
- }),
58
- title: a,
59
- style: {
60
- "--theme-bg-color": Q(f, 0.1)
61
- },
62
- children: /* @__PURE__ */ t("span", { children: w(e) })
63
- }
64
- ) : d === c.FILLED_CARD ? /* @__PURE__ */ t(
65
- "div",
66
- {
67
- ...i,
68
- className: m(u["bsy-tab"], u["filled-card"], {
69
- [u.active]: n,
70
- [u.disabled]: s
71
- }),
72
- title: a,
73
- children: w(e)
74
- }
75
- ) : d === c.BADGE_CARD ? /* @__PURE__ */ t(
76
- "div",
77
- {
78
- ...i,
79
- className: m(u["bsy-tab"], u["badge-card"], {
80
- [u.active]: n,
81
- [u.disabled]: s
82
- }),
83
- title: a,
84
- children: /* @__PURE__ */ t("span", { children: w(e) })
85
- }
86
- ) : null;
87
- };
88
- X.displayName = "BsyTab";
89
- const ne = ({ disabled: e, children: n }) => {
90
- const r = P(null), l = P(null), [d, s] = A(!1), [f, a] = A(!1), [y, i] = A(!1), [o, _] = A(0), h = F(() => {
91
- const g = r.current, N = l.current;
92
- if (!g || !N) return;
93
- const v = g.clientWidth, C = N.scrollWidth, L = C > v;
94
- if (s(L), L) {
95
- const x = o < 0;
96
- a(x);
97
- const I = -(C - v), T = o > I;
98
- i(T);
99
- } else
100
- a(!1), i(!1), _(0);
101
- }, [o]), b = () => {
102
- if (!f || e) return;
103
- const g = r.current;
104
- if (!g) return;
105
- const N = g.clientWidth * 0.6, v = Math.min(0, o + N);
106
- _(v);
107
- }, E = () => {
108
- if (!y || e) return;
109
- const g = r.current, N = l.current;
110
- if (!g || !N) return;
111
- const v = g.clientWidth * 0.6, C = g.clientWidth, L = -(N.scrollWidth - C), x = Math.max(L, o - v);
112
- _(x);
113
- };
114
- return K("resize", () => h()), M(() => {
115
- h();
116
- }, [o, n, h]), {
117
- listRef: r,
118
- wrapperRef: l,
119
- showControls: d,
120
- canScrollLeft: f,
121
- canScrollRight: y,
122
- translateX: o,
123
- scrollLeft: b,
124
- scrollRight: E
125
- };
126
- }, ce = ({
127
- activeKey: e,
128
- type: n,
129
- showIndicator: r,
130
- wrapperRef: l,
131
- items: d
132
- }) => {
133
- const [s, f] = A({
134
- width: 0,
135
- left: 0,
136
- ready: !1
137
- }), a = F(
138
- (i) => {
139
- if (!r || !l.current) return;
140
- const o = l.current.getBoundingClientRect(), _ = i.getBoundingClientRect(), h = _.left - o.left, b = _.width;
141
- f({
142
- width: b,
143
- left: h,
144
- ready: !0
145
- });
146
- },
147
- [r, l]
148
- ), y = (i) => {
149
- a(i);
150
- };
151
- return M(() => {
152
- if (!e || !l.current) return;
153
- const i = l.current.querySelector(
154
- `[data-tab-key="${e}"]`
155
- );
156
- i && r && a(i);
157
- }, [e, r, l, a, n, d]), q(
158
- () => {
159
- var o;
160
- if (!r) return;
161
- const i = (o = l.current) == null ? void 0 : o.querySelector('[aria-selected="true"]');
162
- i && a(i);
163
- },
164
- l,
165
- {
166
- subtree: !0,
167
- characterData: !0
168
- }
169
- ), {
170
- indicatorStyle: s,
171
- handleTabClick: y
172
- };
173
- }, $ = ({ children: e, activeKey: n, className: r, style: l, items: d }) => {
174
- const { type: s = c.LINE, color: f, disabled: a } = W(D), y = [c.LINE, c.CARD].includes(s), {
175
- listRef: i,
176
- wrapperRef: o,
177
- showControls: _,
178
- canScrollLeft: h,
179
- canScrollRight: b,
180
- translateX: E,
181
- scrollLeft: g,
182
- scrollRight: N
183
- } = ne({
184
- disabled: a,
185
- children: e
186
- }), { indicatorStyle: v, handleTabClick: C } = ce({
187
- activeKey: n,
188
- type: s,
189
- showIndicator: y,
190
- wrapperRef: o,
191
- items: d
192
- }), L = v.ready, x = (S) => {
193
- if (a) return;
194
- const T = S.target.closest("[data-tab-item]");
195
- T && C(T);
196
- };
197
- return /* @__PURE__ */ k("div", { className: m("relative max-h-[36px]", r), style: l, children: [
198
- _ && /* @__PURE__ */ t(
199
- "button",
200
- {
201
- className: m(
202
- "absolute left-0 top-0 bottom-0 z-10 w-8 flex items-center justify-center",
203
- {
204
- "text-gray-400 cursor-not-allowed": !h || a,
205
- "text-gray-600": h && !a
206
- }
207
- ),
208
- onClick: g,
209
- disabled: !h || a,
210
- "aria-label": "向左滚动",
211
- children: /* @__PURE__ */ t("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t(
212
- "path",
213
- {
214
- strokeLinecap: "round",
215
- strokeLinejoin: "round",
216
- strokeWidth: 2,
217
- d: "M15 19l-7-7 7-7"
218
- }
219
- ) })
220
- }
221
- ),
222
- /* @__PURE__ */ t(
223
- "div",
224
- {
225
- className: m({
226
- "pl-8": _,
227
- "pr-8": _
228
- }),
229
- children: /* @__PURE__ */ t(
230
- "div",
231
- {
232
- ref: i,
233
- className: m("overflow-hidden", {
234
- "border-b border-[#e0e0e0]": s === c.LINE,
235
- "border-b-2": s === c.FILLED_CARD || s === c.BADGE_CARD,
236
- "pb-[2px]": s === c.BADGE_CARD
237
- }),
238
- style: {
239
- borderColor: s !== c.LINE ? f : void 0
240
- },
241
- children: /* @__PURE__ */ k(
242
- "div",
243
- {
244
- ref: o,
245
- role: "tablist",
246
- className: m("relative text-sm flex flex-nowrap", {
247
- "gap-x-[26px]": s === c.LINE,
248
- "gap-x-[10px]": s === c.FILLED_CARD || s === c.BADGE_CARD,
249
- "bg-[#f0f0f0]": s === c.CARD
250
- }),
251
- onClick: x,
252
- style: {
253
- "--theme-color": f,
254
- transform: `translateX(${E}px)`,
255
- transition: "transform 0.3s ease-in-out"
256
- },
257
- children: [
258
- e,
259
- y && v.ready && /* @__PURE__ */ t(
260
- "div",
261
- {
262
- className: m("absolute h-0.5", {
263
- "bottom-0": s === c.LINE,
264
- "top-0": s === c.CARD,
265
- "transition-all duration-300 ease-in-out": L
266
- }),
267
- style: {
268
- backgroundColor: f,
269
- width: `${v.width}px`,
270
- left: `${v.left}px`
271
- }
272
- }
273
- )
274
- ]
275
- }
276
- )
277
- }
278
- )
279
- }
280
- ),
281
- _ && /* @__PURE__ */ t(
282
- "button",
283
- {
284
- className: m(
285
- "absolute right-0 top-0 bottom-0 z-10 w-8 flex items-center justify-center",
286
- {
287
- "text-gray-400 cursor-not-allowed": !b || a,
288
- "text-gray-600": b && !a
289
- }
290
- ),
291
- onClick: N,
292
- disabled: !b || a,
293
- "aria-label": "向右滚动",
294
- children: /* @__PURE__ */ t("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
295
- }
296
- )
297
- ] });
298
- };
299
- $.displayName = "BsyTabList";
300
- const j = ({ items: e, activeKey: n, className: r }) => {
301
- const l = e.find((d) => d.key === n);
302
- return !l || !l.children ? null : /* @__PURE__ */ t("div", { className: r, role: "tabpanel", "aria-labelledby": `tab-${n}`, children: l.children });
303
- };
304
- j.displayName = "BsyTabPanel";
305
- const R = (e) => {
306
- var s, f;
307
- const [n, r] = B(e, {
308
- defaultValuePropName: "defaultActiveKey",
309
- valuePropName: "activeKey",
310
- trigger: "onChange"
311
- }), l = (s = e.items) == null ? void 0 : s.some((a) => a.children), d = e.color || "#0265ff";
312
- return /* @__PURE__ */ t(D.Provider, { value: { color: d, type: e.type, disabled: e.disabled }, children: /* @__PURE__ */ k("div", { className: "bsy-tabs", children: [
313
- /* @__PURE__ */ t($, { items: e.items, activeKey: n, children: (f = e.items) == null ? void 0 : f.map((a) => /* @__PURE__ */ t(
314
- X,
315
- {
316
- tabKey: a.key,
317
- label: a.label,
318
- active: n === a.key,
319
- onClick: (y) => r(y)
320
- },
321
- a.key
322
- )) }),
323
- l && e.items && /* @__PURE__ */ t(j, { items: e.items, activeKey: n, className: "bsy-tabs__content" })
324
- ] }) });
325
- };
326
- R.displayName = "BsyTabs";
327
- const ie = "_active_5a1wn_11", oe = "_icon_5a1wn_45", p = {
328
- "bsy-tabs-select__trigger": "_bsy-tabs-select__trigger_5a1wn_1",
329
- active: ie,
330
- "bsy-tabs-select__trigger-icon": "_bsy-tabs-select__trigger-icon_5a1wn_14",
331
- "bsy-tabs-select__trigger-input": "_bsy-tabs-select__trigger-input_5a1wn_17",
332
- "bsy-tabs-select__panel": "_bsy-tabs-select__panel_5a1wn_21",
333
- "bsy-tabs-select__panel-item": "_bsy-tabs-select__panel-item_5a1wn_32",
334
- icon: oe
335
- }, de = (e) => {
336
- const { color: n = "#0269ff" } = e, [r, { toggle: l, setLeft: d }] = Y(!1), { refs: s, floatingStyles: f, getFloatingProps: a, getReferenceProps: y, referenceStyle: i } = H({
337
- isOpen: r,
338
- close: d,
339
- offset: {
340
- x: 0,
341
- y: 4
342
- },
343
- zIndex: 1e3
344
- }), [o, _] = B(e, {
345
- trigger: "onChange",
346
- defaultValuePropName: "defaultValue",
347
- valuePropName: "value",
348
- defaultValue: c.LINE
349
- }), h = Object.values(c).map((b) => ({
350
- label: b,
351
- value: b
352
- }));
353
- return /* @__PURE__ */ k("div", { className: p["bsy-tabs-select"], children: [
354
- /* @__PURE__ */ k(
355
- "div",
356
- {
357
- className: m(p["bsy-tabs-select__trigger"], {
358
- [p.active]: r
359
- }),
360
- ref: s.setReference,
361
- ...y(),
362
- style: i,
363
- onClick: () => l(),
364
- children: [
365
- /* @__PURE__ */ t(
366
- "div",
367
- {
368
- className: m(p["bsy-tabs-select__trigger-input"], {
369
- [p.active]: o
370
- }),
371
- children: o && /* @__PURE__ */ t(
372
- R,
373
- {
374
- activeKey: "1",
375
- type: o,
376
- color: n,
377
- disabled: !0,
378
- items: [
379
- {
380
- label: "标签页1",
381
- key: "1"
382
- },
383
- {
384
- label: "标签页2",
385
- key: "2"
386
- },
387
- {
388
- label: "标签页3",
389
- key: "3"
390
- }
391
- ]
392
- },
393
- o
394
- )
395
- }
396
- ),
397
- /* @__PURE__ */ t("div", { className: p["bsy-tabs-select__trigger-icon"], children: /* @__PURE__ */ t(Z, { name: "arrow-down", className: m(p.icon, { active: r }) }) })
398
- ]
399
- }
400
- ),
401
- /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(V, { children: r && /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t("div", { ref: s.setFloating, style: f, ...a(), children: /* @__PURE__ */ t(z.div, { ...ee, children: /* @__PURE__ */ t("div", { className: p["bsy-tabs-select__panel"], children: h.map((b) => /* @__PURE__ */ t(
402
- "div",
403
- {
404
- className: m(p["bsy-tabs-select__panel-item"], {
405
- [p.active]: o === b.value
406
- }),
407
- onClick: () => {
408
- _(b.value), d();
409
- },
410
- children: /* @__PURE__ */ t(
411
- R,
412
- {
413
- activeKey: "1",
414
- type: b.value,
415
- disabled: !0,
416
- color: n,
417
- items: [
418
- {
419
- label: "标签页1",
420
- key: "1"
421
- },
422
- {
423
- label: "标签页2",
424
- key: "2"
425
- },
426
- {
427
- label: "标签页3",
428
- key: "3"
429
- }
430
- ]
431
- },
432
- b.value
433
- )
434
- },
435
- b.value
436
- )) }) }) }) }) }) })
437
- ] });
438
- };
439
- de.displayName = "BsyTabSelect";
440
- export {
441
- R as T,
442
- de as a,
443
- j as b,
444
- c
445
- };