@baishuyun/ui-base 6.20.1 → 6.21.0

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 (41) hide show
  1. package/dist/Amap/index.js +1 -1
  2. package/dist/Calendar/{Calendar-qL5eoYtX.js → Calendar-DYI9CWYE.js} +1 -1
  3. package/dist/Calendar/index.js +3 -3
  4. package/dist/Card/index.js +1 -1
  5. package/dist/CheckBox/index.js +1 -1
  6. package/dist/ColorPicker/index.js +1 -1
  7. package/dist/ConfigProvider/index.js +1 -1
  8. package/dist/DatePicker/{DatePicker-zoV0C8jf.js → DatePicker-CopVj7KA.js} +1 -1
  9. package/dist/DatePicker/{DatePickerPanel-BZJJDbjG.js → DatePickerPanel-CLCEPUcL.js} +1 -1
  10. package/dist/DatePicker/index.js +2 -2
  11. package/dist/DropDown/index.js +1 -1
  12. package/dist/Editor/index.js +1 -1
  13. package/dist/Gantt/index.js +1 -1
  14. package/dist/Icon/index.js +1 -1
  15. package/dist/InputTag/index.js +1 -1
  16. package/dist/Loading/index.js +1 -1
  17. package/dist/Modal/index.js +1 -1
  18. package/dist/NotFoundContent/index.js +1 -1
  19. package/dist/Overlay/index.js +1 -1
  20. package/dist/Radio/index.js +1 -1
  21. package/dist/ScrollBar/index.js +1 -1
  22. package/dist/Segmented/index.js +1 -1
  23. package/dist/Select/index.js +1 -1
  24. package/dist/Table/index.js +1 -1
  25. package/dist/Tabs/Tabs-Imowx4vq.js +401 -0
  26. package/dist/Tabs/index.js +2 -2
  27. package/dist/Tooltip/index.js +1 -1
  28. package/dist/Tree/index.js +1 -1
  29. package/dist/components/Tabs/Tab/Tab.d.ts +1 -2
  30. package/dist/components/Tabs/TabSelect/interface.d.ts +8 -1
  31. package/dist/components/Tabs/context/TabContext.d.ts +0 -1
  32. package/dist/components/Tabs/index.d.ts +1 -0
  33. package/dist/components/Tabs/interface.d.ts +70 -2
  34. package/dist/components/Tabs/style/index.d.ts +1 -0
  35. package/dist/components/Tabs/style/resolveTabsThemeVars.d.ts +2 -0
  36. package/dist/components/index.d.ts +1 -0
  37. package/dist/index.js +4 -4
  38. package/dist/style.css +1 -1
  39. package/dist/vendors/{version-CkTjB1Kb.js → version-BVdbN53a.js} +1 -1
  40. package/package.json +1 -1
  41. package/dist/Tabs/Tabs-DnoZ8BO0.js +0 -413
@@ -1,6 +1,6 @@
1
1
  //#region src/version.ts
2
2
  if (typeof window < "u") {
3
3
  let e = window.__BSY_UI__ ??= {};
4
- e["@baishuyun/ui-base"] = "6.20.1";
4
+ e["@baishuyun/ui-base"] = "6.21.0";
5
5
  }
6
6
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-base",
3
- "version": "6.20.1",
3
+ "version": "6.21.0",
4
4
  "type": "module",
5
5
  "description": "百数云低代码平台通用组件库",
6
6
  "author": "bsy-fe team",
@@ -1,413 +0,0 @@
1
- import { t as e } from "../Icon/Icon-DrdQOEJE.js";
2
- import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
3
- import { t as r } from "../vendors/useLocale-Be4e7Xfn.js";
4
- import { r as i } from "../vendors/animations-ISccYUE3.js";
5
- import { t as a } from "../vendors/useFloatingPortal-DJ1iKmW-.js";
6
- import { isString as o } from "lodash-es";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- import { createContext as l, useCallback as u, useContext as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
9
- import g from "clsx";
10
- import { useControllableValue as _, useEventListener as v, useMutationObserver as y, useToggle as b } from "ahooks";
11
- import { AnimatePresence as x, motion as S } from "motion/react";
12
- import { FloatingPortal as C } from "@floating-ui/react";
13
- import "tinycolor2";
14
- //#region src/components/Tabs/constants.ts
15
- var w = {
16
- LINE: "line",
17
- CARD: "card",
18
- FILLED_CARD: "filled-card",
19
- BADGE_CARD: "badge-card"
20
- }, T = l({
21
- color: "#0269ff",
22
- type: w.LINE
23
- }), E = "_active_1oc43_18", D = "_disabled_1oc43_26", O = "_line_1oc43_44", k = "_card_1oc43_53", A = {
24
- "bsy-tab": "_bsy-tab_1oc43_1",
25
- "badge-card": "_badge-card_1oc43_9",
26
- active: E,
27
- disabled: D,
28
- line: O,
29
- card: k,
30
- "filled-card": "_filled-card_1oc43_78"
31
- };
32
- //#endregion
33
- //#region src/utils/color.ts
34
- function j(e, t) {
35
- if (t < 0 || t > 1) return console.error("Alpha value must be between 0 and 1."), null;
36
- e = e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (e, t, n, r) => t + t + n + n + r + r);
37
- let n = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
38
- return n ? `rgba(${parseInt(n[1], 16)}, ${parseInt(n[2], 16)}, ${parseInt(n[3], 16)}, ${t})` : (console.error("Invalid HEX color format."), null);
39
- }
40
- //#endregion
41
- //#region src/components/Tabs/Tab/Tab.tsx
42
- var M = (e, t = 24) => e.length <= t ? e : e.slice(0, t) + "...", N = (e) => typeof e == "string" ? M(e) : e, P = ({ label: e, active: t = !1, onClick: n, tabKey: r }) => {
43
- let { type: i = w.LINE, disabled: a, color: c } = d(T), l = o(e) ? e : "", u = () => {
44
- a || n?.(r);
45
- }, f = {
46
- "data-tab-item": !0,
47
- "data-tab-key": r,
48
- role: "tab",
49
- "aria-selected": t,
50
- "aria-controls": `panel-${r}`,
51
- onClick: u
52
- };
53
- return i === w.LINE ? /* @__PURE__ */ s("div", {
54
- ...f,
55
- className: g(A["bsy-tab"], A.line, {
56
- [A.disabled]: a,
57
- [A.active]: t
58
- }),
59
- title: l,
60
- children: N(e)
61
- }) : i === w.CARD ? /* @__PURE__ */ s("div", {
62
- ...f,
63
- className: g(A["bsy-tab"], A.card, {
64
- [A.active]: t,
65
- [A.disabled]: a
66
- }),
67
- title: l,
68
- style: { "--theme-bg-color": j(c, .1) },
69
- children: /* @__PURE__ */ s("span", { children: N(e) })
70
- }) : i === w.FILLED_CARD ? /* @__PURE__ */ s("div", {
71
- ...f,
72
- className: g(A["bsy-tab"], A["filled-card"], {
73
- [A.active]: t,
74
- [A.disabled]: a
75
- }),
76
- title: l,
77
- children: N(e)
78
- }) : i === w.BADGE_CARD ? /* @__PURE__ */ s("div", {
79
- ...f,
80
- className: g(A["bsy-tab"], A["badge-card"], {
81
- [A.active]: t,
82
- [A.disabled]: a
83
- }),
84
- title: l,
85
- children: /* @__PURE__ */ s("span", { children: N(e) })
86
- }) : null;
87
- };
88
- P.displayName = "BsyTab";
89
- //#endregion
90
- //#region src/components/Tabs/TabList/useTabScroll.ts
91
- var F = ({ disabled: e, children: t }) => {
92
- let n = m(null), r = m(null), [i, a] = h(!1), [o, s] = h(!1), [c, l] = h(!1), [d, p] = h(0), g = u(() => {
93
- let e = n.current, t = r.current;
94
- if (!e || !t) return;
95
- let i = e.clientWidth, o = t.scrollWidth, c = o > i;
96
- a(c), c ? (s(d < 0), l(d > -(o - i))) : (s(!1), l(!1), p(0));
97
- }, [d]);
98
- return v("resize", () => g()), f(() => {
99
- g();
100
- }, [
101
- d,
102
- t,
103
- g
104
- ]), {
105
- listRef: n,
106
- wrapperRef: r,
107
- showControls: i,
108
- canScrollLeft: o,
109
- canScrollRight: c,
110
- translateX: d,
111
- scrollLeft: () => {
112
- if (!o || e) return;
113
- let t = n.current;
114
- if (!t) return;
115
- let r = t.clientWidth * .6;
116
- p(Math.min(0, d + r));
117
- },
118
- scrollRight: () => {
119
- if (!c || e) return;
120
- let t = n.current, i = r.current;
121
- if (!t || !i) return;
122
- let a = t.clientWidth * .6, o = t.clientWidth, s = -(i.scrollWidth - o);
123
- p(Math.max(s, d - a));
124
- }
125
- };
126
- }, I = ({ activeKey: e, type: t, showIndicator: n, wrapperRef: r, items: i }) => {
127
- let [a, o] = h({
128
- width: 0,
129
- left: 0,
130
- ready: !1
131
- }), s = u((e) => {
132
- if (!n || !r.current) return;
133
- let t = r.current.getBoundingClientRect(), i = e.getBoundingClientRect(), a = i.left - t.left, s = i.width;
134
- o({
135
- width: s,
136
- left: a,
137
- ready: !0
138
- });
139
- }, [n, r]);
140
- return f(() => {
141
- if (!e || !r.current) return;
142
- let t = r.current.querySelector(`[data-tab-key="${e}"]`);
143
- t && n && s(t);
144
- }, [
145
- e,
146
- n,
147
- r,
148
- s,
149
- t,
150
- i
151
- ]), y(() => {
152
- if (!n) return;
153
- let e = r.current?.querySelector("[aria-selected=\"true\"]");
154
- e && s(e);
155
- }, r, {
156
- subtree: !0,
157
- characterData: !0
158
- }), {
159
- indicatorStyle: a,
160
- handleTabClick: (e) => {
161
- s(e);
162
- }
163
- };
164
- }, L = ({ children: e, activeKey: t, className: n, style: i, items: a }) => {
165
- let { t: o } = r(), { type: l = w.LINE, color: u, disabled: f } = d(T), p = [w.LINE, w.CARD].includes(l), { listRef: m, wrapperRef: h, showControls: _, canScrollLeft: v, canScrollRight: y, translateX: b, scrollLeft: x, scrollRight: S } = F({
166
- disabled: f,
167
- children: e
168
- }), { indicatorStyle: C, handleTabClick: E } = I({
169
- activeKey: t,
170
- type: l,
171
- showIndicator: p,
172
- wrapperRef: h,
173
- items: a
174
- }), D = C.ready, O = (e) => {
175
- if (f) return;
176
- let t = e.target.closest("[data-tab-item]");
177
- t && E(t);
178
- };
179
- return /* @__PURE__ */ c("div", {
180
- className: g("relative max-h-[36px]", n),
181
- style: i,
182
- children: [
183
- _ && /* @__PURE__ */ s("button", {
184
- className: g("absolute left-0 top-0 bottom-0 z-10 w-8 flex items-center justify-center", {
185
- "text-gray-400 cursor-not-allowed": !v || f,
186
- "text-gray-600": v && !f
187
- }),
188
- onClick: x,
189
- disabled: !v || f,
190
- "aria-label": o("tabs.scrollPrev"),
191
- children: /* @__PURE__ */ s("svg", {
192
- className: "w-4 h-4",
193
- fill: "none",
194
- stroke: "currentColor",
195
- viewBox: "0 0 24 24",
196
- children: /* @__PURE__ */ s("path", {
197
- strokeLinecap: "round",
198
- strokeLinejoin: "round",
199
- strokeWidth: 2,
200
- d: "M15 19l-7-7 7-7"
201
- })
202
- })
203
- }),
204
- /* @__PURE__ */ s("div", {
205
- className: g({
206
- "pl-8": _,
207
- "pr-8": _
208
- }),
209
- children: /* @__PURE__ */ s("div", {
210
- ref: m,
211
- className: g("overflow-hidden", {
212
- "border-b border-[#e0e0e0]": l === w.LINE,
213
- "border-b-2": l === w.FILLED_CARD || l === w.BADGE_CARD,
214
- "pb-[2px]": l === w.BADGE_CARD
215
- }),
216
- style: { borderColor: l === w.LINE ? void 0 : u },
217
- children: /* @__PURE__ */ c("div", {
218
- ref: h,
219
- role: "tablist",
220
- className: g("relative text-sm flex flex-nowrap", {
221
- "gap-x-[26px]": l === w.LINE,
222
- "gap-x-[10px]": l === w.FILLED_CARD || l === w.BADGE_CARD,
223
- "bg-[#f0f0f0]": l === w.CARD
224
- }),
225
- onClick: O,
226
- style: {
227
- "--theme-color": u,
228
- transform: `translateX(${b}px)`,
229
- transition: "transform 0.3s ease-in-out"
230
- },
231
- children: [e, p && C.ready && /* @__PURE__ */ s("div", {
232
- className: g("absolute h-0.5", {
233
- "bottom-0": l === w.LINE,
234
- "top-0": l === w.CARD,
235
- "transition-all duration-300 ease-in-out": D
236
- }),
237
- style: {
238
- backgroundColor: u,
239
- width: `${C.width}px`,
240
- left: `${C.left}px`
241
- }
242
- })]
243
- })
244
- })
245
- }),
246
- _ && /* @__PURE__ */ s("button", {
247
- className: g("absolute right-0 top-0 bottom-0 z-10 w-8 flex items-center justify-center", {
248
- "text-gray-400 cursor-not-allowed": !y || f,
249
- "text-gray-600": y && !f
250
- }),
251
- onClick: S,
252
- disabled: !y || f,
253
- "aria-label": o("tabs.scrollNext"),
254
- children: /* @__PURE__ */ s("svg", {
255
- className: "w-4 h-4",
256
- fill: "none",
257
- stroke: "currentColor",
258
- viewBox: "0 0 24 24",
259
- children: /* @__PURE__ */ s("path", {
260
- strokeLinecap: "round",
261
- strokeLinejoin: "round",
262
- strokeWidth: 2,
263
- d: "M9 5l7 7-7 7"
264
- })
265
- })
266
- })
267
- ]
268
- });
269
- };
270
- L.displayName = "BsyTabList";
271
- //#endregion
272
- //#region src/components/Tabs/TabPanel/TabPanel.tsx
273
- var R = ({ items: e, activeKey: t, className: n }) => {
274
- let r = e.find((e) => e.key === t);
275
- return !r || !r.children ? null : /* @__PURE__ */ s("div", {
276
- className: n,
277
- role: "tabpanel",
278
- "aria-labelledby": `tab-${t}`,
279
- children: r.children
280
- });
281
- };
282
- R.displayName = "BsyTabPanel";
283
- //#endregion
284
- //#region src/components/Tabs/Tabs.tsx
285
- var z = (e) => {
286
- let [t, n] = _(e, {
287
- defaultValuePropName: "defaultActiveKey",
288
- valuePropName: "activeKey",
289
- trigger: "onChange"
290
- }), r = e.items?.some((e) => e.children), i = e.color || "#0265ff";
291
- return /* @__PURE__ */ s(T.Provider, {
292
- value: {
293
- color: i,
294
- type: e.type,
295
- disabled: e.disabled
296
- },
297
- children: /* @__PURE__ */ c("div", {
298
- className: "bsy-tabs",
299
- children: [/* @__PURE__ */ s(L, {
300
- items: e.items,
301
- activeKey: t,
302
- children: e.items?.map((e) => /* @__PURE__ */ s(P, {
303
- tabKey: e.key,
304
- label: e.label,
305
- active: t === e.key,
306
- onClick: (e) => n(e)
307
- }, e.key))
308
- }), r && e.items && /* @__PURE__ */ s(R, {
309
- items: e.items,
310
- activeKey: t,
311
- className: "bsy-tabs__content"
312
- })]
313
- })
314
- });
315
- };
316
- z.displayName = "BsyTabs";
317
- //#endregion
318
- //#region src/components/Tabs/TabSelect/tabSelect.module.scss
319
- var B = "_active_5a1wn_11", V = "_icon_5a1wn_45", H = {
320
- "bsy-tabs-select__trigger": "_bsy-tabs-select__trigger_5a1wn_1",
321
- active: B,
322
- "bsy-tabs-select__trigger-icon": "_bsy-tabs-select__trigger-icon_5a1wn_14",
323
- "bsy-tabs-select__trigger-input": "_bsy-tabs-select__trigger-input_5a1wn_17",
324
- "bsy-tabs-select__panel": "_bsy-tabs-select__panel_5a1wn_21",
325
- "bsy-tabs-select__panel-item": "_bsy-tabs-select__panel-item_5a1wn_32",
326
- icon: V
327
- }, U = (o) => {
328
- let { color: l = "#0269ff" } = o, { t: u } = r(), d = t(), [f, { toggle: m, setLeft: h }] = b(!1), { refs: v, floatingStyles: y, getFloatingProps: T, getReferenceProps: E, referenceStyle: D } = a({
329
- isOpen: f,
330
- close: h,
331
- offset: {
332
- x: 0,
333
- y: 4
334
- },
335
- zIndex: d
336
- }), [O, k] = _(o, {
337
- trigger: "onChange",
338
- defaultValuePropName: "defaultValue",
339
- valuePropName: "value",
340
- defaultValue: w.LINE
341
- }), A = Object.values(w).map((e) => ({
342
- label: e,
343
- value: e
344
- })), j = p(() => [
345
- {
346
- label: u("tabs.previewTab1"),
347
- key: "1"
348
- },
349
- {
350
- label: u("tabs.previewTab2"),
351
- key: "2"
352
- },
353
- {
354
- label: u("tabs.previewTab3"),
355
- key: "3"
356
- }
357
- ], [u]);
358
- return /* @__PURE__ */ c("div", {
359
- className: H["bsy-tabs-select"],
360
- children: [/* @__PURE__ */ c("div", {
361
- className: g(H["bsy-tabs-select__trigger"], { [H.active]: f }),
362
- ref: v.setReference,
363
- ...E(),
364
- style: D,
365
- onClick: () => m(),
366
- children: [/* @__PURE__ */ s("div", {
367
- className: g(H["bsy-tabs-select__trigger-input"], { [H.active]: O }),
368
- children: O && /* @__PURE__ */ s(z, {
369
- activeKey: "1",
370
- type: O,
371
- color: l,
372
- disabled: !0,
373
- items: j
374
- }, O)
375
- }), /* @__PURE__ */ s("div", {
376
- className: H["bsy-tabs-select__trigger-icon"],
377
- children: /* @__PURE__ */ s(e, {
378
- name: "arrow-down",
379
- className: g(H.icon, { active: f })
380
- })
381
- })]
382
- }), /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(n, {
383
- zIndex: d,
384
- children: /* @__PURE__ */ s(x, { children: f && /* @__PURE__ */ s("div", {
385
- ref: v.setFloating,
386
- style: y,
387
- ...T(),
388
- children: /* @__PURE__ */ s(S.div, {
389
- ...i,
390
- children: /* @__PURE__ */ s("div", {
391
- className: H["bsy-tabs-select__panel"],
392
- children: A.map((e) => /* @__PURE__ */ s("div", {
393
- className: g(H["bsy-tabs-select__panel-item"], { [H.active]: O === e.value }),
394
- onClick: () => {
395
- k(e.value), h();
396
- },
397
- children: /* @__PURE__ */ s(z, {
398
- activeKey: "1",
399
- type: e.value,
400
- disabled: !0,
401
- color: l,
402
- items: j
403
- }, e.value)
404
- }, e.value))
405
- })
406
- })
407
- }) })
408
- }) })]
409
- });
410
- };
411
- U.displayName = "BsyTabSelect";
412
- //#endregion
413
- export { w as i, z as n, R as r, U as t };