@baishuyun/ui-base 2.3.2 → 2.3.4
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.
- package/dist/Card/{Card-BE6v4I-A.js → Card-CaKTq_1y.js} +17 -17
- package/dist/Card/index.js +2 -2
- package/dist/CheckBox/CheckBox-Cz6KW9Lw.js +33 -0
- package/dist/CheckBox/{CheckBox--rXaUgMO.js → CheckBox-l__wOnmH.js} +25 -25
- package/dist/CheckBox/index.js +3 -3
- package/dist/ColorPicker/ColorPicker-C1kG_eI-.js +168 -0
- package/dist/ColorPicker/index.js +4 -5
- package/dist/DropDown/DropDown-BAPBTglm.js +162 -0
- package/dist/DropDown/index.js +6 -6
- package/dist/Editor/{Buttons--dMLPuk2.js → Buttons-CsKKYGbV.js} +207 -204
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -13
- package/dist/Editor/index.js +207 -196
- package/dist/Icon/Icon-CTZCSuVg.js +19 -0
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/{InputTag-B6N5MZA2.js → InputTag-V4UnUnGJ.js} +33 -33
- package/dist/InputTag/index.js +2 -2
- package/dist/Loading/index.js +1 -1
- package/dist/Modal/{Modal-FVJpbEgw.js → Modal-DQ5bptu_.js} +1 -1
- package/dist/Modal/index.js +2 -2
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Radio/{Radio-dyoBNiKF.js → Radio-CZOrtNyn.js} +25 -25
- package/dist/Radio/index.js +1 -1
- package/dist/Segmented/{Segmented-Dd8glDXI.js → Segmented-DEGgLO-b.js} +15 -15
- package/dist/Segmented/index.js +1 -1
- package/dist/Select/Select-BoNqxIRo.js +729 -0
- package/dist/Select/{SelectInputSearch-CIXBNLFi.js → SelectInputSearch-DMY6Y9B6.js} +2 -2
- package/dist/Select/index.js +10 -10
- package/dist/Tabs/{Tabs-C79GTyGd.js → Tabs-BqT-_eVo.js} +138 -138
- package/dist/Tabs/index.js +4 -5
- package/dist/Tree/index.js +4 -4
- package/dist/Tree/utils/index.js +1 -1
- package/dist/index.js +19 -20
- package/dist/vendors/Tree-nIRgDY2s.js +231 -0
- package/dist/vendors/{color-BPWy9DvT.js → color-CyuNdAfc.js} +2 -2
- package/package.json +4 -2
- package/dist/CheckBox/CheckBox-Db8X-pw9.js +0 -33
- package/dist/ColorPicker/ColorPicker-BBP-4-so.js +0 -168
- package/dist/DropDown/DropDown-CKXi9mXN.js +0 -162
- package/dist/Icon/Icon-DppVOyPK.js +0 -19
- package/dist/Select/Select-Bd2ECrB0.js +0 -729
- package/dist/vendors/Tree-CQR9fvpA.js +0 -231
- package/dist/vendors/clsx-DNOE4Gl8.js +0 -16
- package/dist/vendors/fuse.js-BKtvbTjL.js +0 -877
- package/dist/vendors/lexical-hZliMgDv.js +0 -6439
- package/dist/vendors/lodash-es-Bu9xU1fK.js +0 -334
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +0 -370
- package/dist/vendors/tinycolor2-DToeAEPD.js +0 -726
- /package/dist/Loading/{Loading-Bi5NO-Ky.js → Loading-Dy5A--HK.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-CTPpcZOt.js → NotFoundContent-1-41e1rN.js} +0 -0
- /package/dist/vendors/{animations-C5JKFkz4.js → animations-DvjIfVz9.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-BA6P5GxV.js → useFloatingPortal-W4pliYWU.js} +0 -0
- /package/dist/vendors/{useLocale-BfT0V1j4.js → useLocale-BXnqO-Ju.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "../Icon/Icon-
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { t as e } from "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as r, useMemo as i, useState as a } from "react";
|
|
4
|
+
import o from "clsx";
|
|
5
5
|
//#region src/components/Card/Card.module.scss
|
|
6
6
|
var s = {
|
|
7
7
|
"bsy-card": "_bsy-card_myftj_1",
|
|
@@ -14,23 +14,23 @@ var s = {
|
|
|
14
14
|
"bsy-card__content--expanded": "_bsy-card__content--expanded_myftj_52",
|
|
15
15
|
"bsy-card__content-inner": "_bsy-card__content-inner_myftj_55"
|
|
16
16
|
}, c = ({ title: c, children: l, minWidth: u = 240, defaultExpanded: d = !1, expanded: f, onExpandedChange: p, className: m, style: h, styles: g }) => {
|
|
17
|
-
let [_, v] =
|
|
17
|
+
let [_, v] = a(d), y = f ?? _, b = r(() => {
|
|
18
18
|
let e = !y;
|
|
19
19
|
f === void 0 && v(e), p?.(e);
|
|
20
20
|
}, [
|
|
21
21
|
y,
|
|
22
22
|
f,
|
|
23
23
|
p
|
|
24
|
-
]), x =
|
|
24
|
+
]), x = r((e) => {
|
|
25
25
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
26
|
-
}, [b]), S =
|
|
26
|
+
}, [b]), S = i(() => ({
|
|
27
27
|
minWidth: `${u}px`,
|
|
28
28
|
...h
|
|
29
29
|
}), [u, h]);
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
className:
|
|
30
|
+
return /* @__PURE__ */ n("div", {
|
|
31
|
+
className: o(s["bsy-card"], m),
|
|
32
32
|
style: S,
|
|
33
|
-
children: [/* @__PURE__ */
|
|
33
|
+
children: [/* @__PURE__ */ n("div", {
|
|
34
34
|
className: s["bsy-card__header"],
|
|
35
35
|
onClick: b,
|
|
36
36
|
onKeyDown: x,
|
|
@@ -39,24 +39,24 @@ var s = {
|
|
|
39
39
|
"aria-expanded": y,
|
|
40
40
|
"aria-controls": "card-content",
|
|
41
41
|
style: g?.header,
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ t("div", {
|
|
43
43
|
className: s["bsy-card__title"],
|
|
44
44
|
id: "card-title",
|
|
45
45
|
role: "heading",
|
|
46
46
|
children: c
|
|
47
|
-
}), /* @__PURE__ */
|
|
47
|
+
}), /* @__PURE__ */ t("div", {
|
|
48
48
|
className: s["bsy-card__icon-container"],
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ t(e, {
|
|
50
50
|
name: "xialakuangxiala1",
|
|
51
|
-
className:
|
|
51
|
+
className: o(s["bsy-card__icon"], y && s["bsy-card__icon--expanded"])
|
|
52
52
|
})
|
|
53
53
|
})]
|
|
54
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ t("div", {
|
|
55
55
|
id: "card-content",
|
|
56
56
|
role: "region",
|
|
57
57
|
"aria-labelledby": "card-title",
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
58
|
+
className: o(s["bsy-card__content"], y && s["bsy-card__content--expanded"]),
|
|
59
|
+
children: /* @__PURE__ */ t("div", {
|
|
60
60
|
className: s["bsy-card__content-inner"],
|
|
61
61
|
style: g?.body,
|
|
62
62
|
children: l
|
package/dist/Card/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../Icon/Icon-
|
|
2
|
-
import { t as e } from "./Card-
|
|
1
|
+
import "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import { t as e } from "./Card-CaKTq_1y.js";
|
|
3
3
|
export { e as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./CheckBox-l__wOnmH.js";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import i from "clsx";
|
|
4
|
+
import { useControllableValue as a } from "ahooks";
|
|
5
|
+
//#region src/components/CheckBox/Group.tsx
|
|
6
|
+
var o = ({ disabled: n, layout: o = e.NONE, children: s, className: c, ...l }) => {
|
|
7
|
+
let [u, d] = a(l, {
|
|
8
|
+
defaultValue: [],
|
|
9
|
+
valuePropName: "value",
|
|
10
|
+
defaultValuePropName: "defaultValue",
|
|
11
|
+
trigger: "onChange"
|
|
12
|
+
}), f = i("flex", {
|
|
13
|
+
"flex-col": o === e.NONE,
|
|
14
|
+
"flex-col gap-[10px]": o === e.VERTICAL,
|
|
15
|
+
"flex-row gap-y-[10px] gap-x-[20px] flex-wrap": o === e.HORIZONTAL,
|
|
16
|
+
[c || ""]: !!c
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ r(t.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
value: u,
|
|
21
|
+
onChange: d,
|
|
22
|
+
disabled: n,
|
|
23
|
+
layout: o
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ r("div", {
|
|
26
|
+
className: f,
|
|
27
|
+
children: s
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}, s = n;
|
|
31
|
+
s.Group = o;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { s as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as e } from "../
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { t as e } from "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import { uniqueId as t } from "lodash-es";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { createContext as i, forwardRef as a, useContext as o } from "react";
|
|
5
|
+
import s from "clsx";
|
|
6
6
|
//#region src/components/CheckBox/context/context.ts
|
|
7
|
-
var c =
|
|
7
|
+
var c = i(null), l = "_checkbox_vheru_1", u = "_checkbox__inner_vheru_32", d = {
|
|
8
8
|
checkbox: l,
|
|
9
9
|
"checkbox--checked": "_checkbox--checked_vheru_12",
|
|
10
10
|
"checkbox--unchecked": "_checkbox--unchecked_vheru_16",
|
|
@@ -12,19 +12,19 @@ var c = a(null), l = "_checkbox_vheru_1", u = "_checkbox__inner_vheru_32", d = {
|
|
|
12
12
|
"checkbox--disabled": "_checkbox--disabled_vheru_27",
|
|
13
13
|
checkbox__inner: u,
|
|
14
14
|
"checkbox__inner--disabled": "_checkbox__inner--disabled_vheru_38"
|
|
15
|
-
}, f = ({ isChecked:
|
|
16
|
-
let
|
|
17
|
-
[d["checkbox--checked"]]: !
|
|
18
|
-
[d["checkbox--unchecked"]]: !
|
|
19
|
-
[d["checkbox--indeterminate"]]: !
|
|
20
|
-
[d["checkbox--disabled"]]:
|
|
21
|
-
}), l =
|
|
22
|
-
return /* @__PURE__ */
|
|
15
|
+
}, f = ({ isChecked: t = !1, indeterminate: i = !1, disabled: a = !1 }) => {
|
|
16
|
+
let o = i ? "indeterminate" : t ? "checked" : "unchecked", c = s(d.checkbox, {
|
|
17
|
+
[d["checkbox--checked"]]: !a && o === "checked",
|
|
18
|
+
[d["checkbox--unchecked"]]: !a && o === "unchecked",
|
|
19
|
+
[d["checkbox--indeterminate"]]: !a && o === "indeterminate",
|
|
20
|
+
[d["checkbox--disabled"]]: a
|
|
21
|
+
}), l = s(d.checkbox__inner, { [d["checkbox__inner--disabled"]]: a });
|
|
22
|
+
return /* @__PURE__ */ r("div", {
|
|
23
23
|
className: c,
|
|
24
|
-
children: [
|
|
24
|
+
children: [o === "checked" && /* @__PURE__ */ n(e, {
|
|
25
25
|
name: "checkthebox",
|
|
26
|
-
color:
|
|
27
|
-
}),
|
|
26
|
+
color: a ? "#b8b8b8" : "#fff"
|
|
27
|
+
}), o === "indeterminate" && /* @__PURE__ */ n("div", { className: l })]
|
|
28
28
|
});
|
|
29
29
|
}, p = /* @__PURE__ */ function(e) {
|
|
30
30
|
return e.NONE = "none", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e;
|
|
@@ -38,24 +38,24 @@ var c = a(null), l = "_checkbox_vheru_1", u = "_checkbox__inner_vheru_32", d = {
|
|
|
38
38
|
"bsy-checkbox__button--checked": "_bsy-checkbox__button--checked_1372g_34",
|
|
39
39
|
"bsy-checkbox__button--unchecked": "_bsy-checkbox__button--unchecked_1372g_38",
|
|
40
40
|
"bsy-checkbox__button--left-label": "_bsy-checkbox__button--left-label_1372g_45"
|
|
41
|
-
}, h =
|
|
42
|
-
let { checked:
|
|
41
|
+
}, h = a((e, i) => {
|
|
42
|
+
let { checked: a, indeterminate: l = !1, onChange: u, value: d = t("checkbox"), disabled: h = !1, children: g, style: _, labelPosition: v = "right" } = e, y = o(c), b = y ? y.value?.includes(d) : a, x = (e) => {
|
|
43
43
|
if (!(h || y?.disabled)) if (y) {
|
|
44
44
|
let t = e ? [...y.value || [], d] : (y.value || []).filter((e) => e !== d);
|
|
45
45
|
t && y.onChange?.(t);
|
|
46
46
|
} else u?.(e);
|
|
47
47
|
}, S = h || y?.disabled;
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
className:
|
|
48
|
+
return /* @__PURE__ */ r("div", {
|
|
49
|
+
className: s(m["bsy-checkbox"], { [m["bsy-checkbox--full-width"]]: y?.layout === p.NONE || !y?.layout }),
|
|
50
50
|
onClick: () => x(!b),
|
|
51
51
|
style: _,
|
|
52
|
-
children: [/* @__PURE__ */
|
|
53
|
-
ref:
|
|
52
|
+
children: [/* @__PURE__ */ n("div", {
|
|
53
|
+
ref: i,
|
|
54
54
|
role: "checkbox",
|
|
55
55
|
"aria-checked": l ? "mixed" : b,
|
|
56
56
|
tabIndex: S ? -1 : 0,
|
|
57
|
-
className:
|
|
58
|
-
children: /* @__PURE__ */
|
|
57
|
+
className: s({ [m["bsy-checkbox__button--left-label"]]: v === "left" }),
|
|
58
|
+
children: /* @__PURE__ */ n(f, {
|
|
59
59
|
indeterminate: l,
|
|
60
60
|
isChecked: b,
|
|
61
61
|
disabled: S
|
package/dist/CheckBox/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../Icon/Icon-
|
|
2
|
-
import "./CheckBox
|
|
3
|
-
import { t as e } from "./CheckBox-
|
|
1
|
+
import "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import "./CheckBox-l__wOnmH.js";
|
|
3
|
+
import { t as e } from "./CheckBox-Cz6KW9Lw.js";
|
|
4
4
|
export { e as default };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import { t } from "../vendors/useLocale-BXnqO-Ju.js";
|
|
3
|
+
import { t as n } from "../vendors/color-CyuNdAfc.js";
|
|
4
|
+
import { n as r } from "../vendors/animations-DvjIfVz9.js";
|
|
5
|
+
import { isArray as i } from "lodash-es";
|
|
6
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { cloneElement as c, isValidElement as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import p from "clsx";
|
|
9
|
+
import { useControllableValue as m } from "ahooks";
|
|
10
|
+
import { ColorPicker as h } from "antd";
|
|
11
|
+
import { AnimatePresence as g, motion as _ } from "motion/react";
|
|
12
|
+
import { FloatingPortal as v, flip as y, offset as b, shift as x, useClick as S, useDismiss as C, useFloating as w, useInteractions as T } from "@floating-ui/react";
|
|
13
|
+
import E from "tinycolor2";
|
|
14
|
+
//#region src/components/ColorPicker/constants.ts
|
|
15
|
+
var D = [
|
|
16
|
+
"rgba(240, 102, 72, 1)",
|
|
17
|
+
"rgba(255, 197, 2, 1)",
|
|
18
|
+
"rgba(74, 204, 140, 1)",
|
|
19
|
+
"rgba(74, 192, 236, 1)",
|
|
20
|
+
"rgba(255, 153, 33, 1)",
|
|
21
|
+
"rgba(101, 101, 101, 1)",
|
|
22
|
+
"rgba(255, 156, 136, 1)",
|
|
23
|
+
"rgba(98, 98, 206, 1)",
|
|
24
|
+
"rgba(241, 104, 182, 1)",
|
|
25
|
+
"rgba(55, 103, 241, 1)",
|
|
26
|
+
"rgba(162, 206, 30, 1)",
|
|
27
|
+
"rgba(179, 179, 179, 1)",
|
|
28
|
+
"rgba(0, 0, 0, 1)",
|
|
29
|
+
"rgba(102, 102, 102, 1)",
|
|
30
|
+
"rgba(153, 153, 153, 1)",
|
|
31
|
+
"rgba(194, 194, 194, 1)",
|
|
32
|
+
"rgba(224, 224, 224, 1)",
|
|
33
|
+
"rgba(77, 96, 159, 1)"
|
|
34
|
+
], O = (e = "bottom-start") => {
|
|
35
|
+
let [t, n] = f(!1), { refs: r, floatingStyles: i, context: a } = w({
|
|
36
|
+
open: t,
|
|
37
|
+
onOpenChange: n,
|
|
38
|
+
placement: e,
|
|
39
|
+
middleware: [
|
|
40
|
+
b(4),
|
|
41
|
+
y(),
|
|
42
|
+
x({ padding: 8 })
|
|
43
|
+
]
|
|
44
|
+
}), { getReferenceProps: o, getFloatingProps: s } = T([S(a), C(a)]);
|
|
45
|
+
return {
|
|
46
|
+
isOpen: t,
|
|
47
|
+
refs: r,
|
|
48
|
+
floatingStyles: i,
|
|
49
|
+
getReferenceProps: o,
|
|
50
|
+
getFloatingProps: s,
|
|
51
|
+
setIsOpen: n
|
|
52
|
+
};
|
|
53
|
+
}, k = "_preview_11t7y_62", A = {
|
|
54
|
+
"bsy-color-picker__floating": "_bsy-color-picker__floating_11t7y_1",
|
|
55
|
+
"bsy-color-picker__content": "_bsy-color-picker__content_11t7y_4",
|
|
56
|
+
"bsy-color-picker__grid": "_bsy-color-picker__grid_11t7y_11",
|
|
57
|
+
"bsy-color-picker__preset-colors-title": "_bsy-color-picker__preset-colors-title_11t7y_15",
|
|
58
|
+
"bsy-color-picker__preset-colors-grid": "_bsy-color-picker__preset-colors-grid_11t7y_19",
|
|
59
|
+
"bsy-color-picker__preset-colors-item": "_bsy-color-picker__preset-colors-item_11t7y_24",
|
|
60
|
+
"bsy-color-picker__custom-color-title": "_bsy-color-picker__custom-color-title_11t7y_48",
|
|
61
|
+
"bsy-color-picker__custom-color-btn": "_bsy-color-picker__custom-color-btn_11t7y_52",
|
|
62
|
+
preview: k,
|
|
63
|
+
"bsy-color-picker__custom-color-btn--active": "_bsy-color-picker__custom-color-btn--active_11t7y_62",
|
|
64
|
+
"bsy-color-picker__custom-color-btn--preview": "_bsy-color-picker__custom-color-btn--preview_11t7y_66",
|
|
65
|
+
"bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_11t7y_69",
|
|
66
|
+
"bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_11t7y_73"
|
|
67
|
+
}, j = ({ currentColor: t, onColorSelect: r, options: i, style: a }) => /* @__PURE__ */ o("div", {
|
|
68
|
+
className: A["bsy-color-picker__preset-colors-grid"],
|
|
69
|
+
style: a,
|
|
70
|
+
children: i.map((i) => /* @__PURE__ */ o("div", {
|
|
71
|
+
className: A["bsy-color-picker__preset-colors-item"],
|
|
72
|
+
style: {
|
|
73
|
+
backgroundColor: i,
|
|
74
|
+
"--hover-color": E(i).setAlpha(.5).toRgbString()
|
|
75
|
+
},
|
|
76
|
+
onClick: () => r(i),
|
|
77
|
+
children: n(t, i) && /* @__PURE__ */ o(e, {
|
|
78
|
+
name: "checkthebox",
|
|
79
|
+
className: A["bsy-color-picker__check-icon"]
|
|
80
|
+
})
|
|
81
|
+
}, i))
|
|
82
|
+
}), M = (e) => {
|
|
83
|
+
let { children: f, placement: p = "bottom-start", disabled: h = !1, presetColors: y, getPopupContainer: b } = e, { t: x } = t(), [S, C] = m(e, { defaultValue: e.value }), { isOpen: w, refs: T, floatingStyles: E, getReferenceProps: k, getFloatingProps: M } = O(p), P = l(f) ? c(f, {
|
|
84
|
+
...k(),
|
|
85
|
+
ref: T.setReference,
|
|
86
|
+
disabled: h
|
|
87
|
+
}) : f, F = i(y) && y.length ? y : D, I = d(F.some((e) => n(e, S)) ? [] : [S]);
|
|
88
|
+
return /* @__PURE__ */ s(a, { children: [P, /* @__PURE__ */ o(v, {
|
|
89
|
+
root: u(() => w ? b?.() : void 0, [w, b]),
|
|
90
|
+
children: /* @__PURE__ */ o(g, { children: w && /* @__PURE__ */ o("div", {
|
|
91
|
+
ref: T.setFloating,
|
|
92
|
+
style: E,
|
|
93
|
+
...M(),
|
|
94
|
+
className: A["bsy-color-picker__floating"],
|
|
95
|
+
children: /* @__PURE__ */ o(_.div, {
|
|
96
|
+
...r,
|
|
97
|
+
children: /* @__PURE__ */ o("div", {
|
|
98
|
+
className: A["bsy-color-picker__content"],
|
|
99
|
+
children: /* @__PURE__ */ s("div", {
|
|
100
|
+
className: A["bsy-color-picker__grid"],
|
|
101
|
+
children: [/* @__PURE__ */ s("div", {
|
|
102
|
+
className: A["bsy-color-picker__preset-colors"],
|
|
103
|
+
children: [/* @__PURE__ */ o("div", {
|
|
104
|
+
className: A["bsy-color-picker__preset-colors-title"],
|
|
105
|
+
children: x("presetColors")
|
|
106
|
+
}), /* @__PURE__ */ o(j, {
|
|
107
|
+
currentColor: S,
|
|
108
|
+
onColorSelect: C,
|
|
109
|
+
options: F
|
|
110
|
+
})]
|
|
111
|
+
}), /* @__PURE__ */ o(N, {
|
|
112
|
+
value: S,
|
|
113
|
+
onChange: C,
|
|
114
|
+
onColorInput: e.onColorInput,
|
|
115
|
+
options: F,
|
|
116
|
+
list: I.current
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
}) })
|
|
122
|
+
})] });
|
|
123
|
+
}, N = (n) => {
|
|
124
|
+
let { list: r } = n, [i, a] = f(), [c, l] = f(!1), { t: u } = t();
|
|
125
|
+
return /* @__PURE__ */ s("div", {
|
|
126
|
+
className: A["bsy-color-picker__custom-color"],
|
|
127
|
+
children: [/* @__PURE__ */ o("div", {
|
|
128
|
+
className: A["bsy-color-picker__custom-color-title"],
|
|
129
|
+
children: u("customColor")
|
|
130
|
+
}), /* @__PURE__ */ s("div", {
|
|
131
|
+
className: A["bsy-color-picker__custom-color-content"],
|
|
132
|
+
children: [/* @__PURE__ */ o(h, {
|
|
133
|
+
value: i,
|
|
134
|
+
onChange: (e) => {
|
|
135
|
+
let t = e.toRgbString();
|
|
136
|
+
a(t), n.onColorInput?.(t);
|
|
137
|
+
},
|
|
138
|
+
open: c,
|
|
139
|
+
onOpenChange: (e) => {
|
|
140
|
+
l(e), !e && i && (r.includes(i) || r.unshift(i), n.onChange(i), a(void 0));
|
|
141
|
+
},
|
|
142
|
+
children: /* @__PURE__ */ o("div", {
|
|
143
|
+
className: p(A["bsy-color-picker__custom-color-btn"], {
|
|
144
|
+
[A["bsy-color-picker__custom-color-btn--active"]]: c && !i,
|
|
145
|
+
[A["bsy-color-picker__custom-color-btn--preview"]]: !!i
|
|
146
|
+
}),
|
|
147
|
+
role: "button",
|
|
148
|
+
style: { backgroundColor: i || void 0 },
|
|
149
|
+
onClick: () => {
|
|
150
|
+
l(!0);
|
|
151
|
+
},
|
|
152
|
+
children: /* @__PURE__ */ o(e, {
|
|
153
|
+
name: "add",
|
|
154
|
+
style: { visibility: i ? "hidden" : "visible" }
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}), /* @__PURE__ */ o(j, {
|
|
158
|
+
currentColor: n.value,
|
|
159
|
+
onColorSelect: n.onChange,
|
|
160
|
+
options: r.slice(0, 5),
|
|
161
|
+
style: { gridTemplateColumns: "repeat(5, 1fr)" }
|
|
162
|
+
})]
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
M.displayName = "BsyColorPicker";
|
|
167
|
+
//#endregion
|
|
168
|
+
export { D as n, M as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import "../Icon/Icon-
|
|
2
|
-
import "../vendors/useLocale-
|
|
3
|
-
import { n as e, t } from "./ColorPicker-
|
|
4
|
-
import "../vendors/
|
|
5
|
-
import "../vendors/color-BPWy9DvT.js";
|
|
1
|
+
import "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import "../vendors/useLocale-BXnqO-Ju.js";
|
|
3
|
+
import { n as e, t } from "./ColorPicker-C1kG_eI-.js";
|
|
4
|
+
import "../vendors/color-CyuNdAfc.js";
|
|
6
5
|
export { e as COLOR_OPTIONS_RGBA, t as default };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { t as e } from "../vendors/useLocale-BXnqO-Ju.js";
|
|
2
|
+
import { n as t } from "../vendors/animations-DvjIfVz9.js";
|
|
3
|
+
import { t as n } from "../Select/SelectInputSearch-DMY6Y9B6.js";
|
|
4
|
+
import { t as r } from "../NotFoundContent/NotFoundContent-1-41e1rN.js";
|
|
5
|
+
import { t as i } from "../vendors/useFloatingPortal-W4pliYWU.js";
|
|
6
|
+
import { isEmpty as a, isNumber as o } from "lodash-es";
|
|
7
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { cloneElement as u, isValidElement as d, memo as f, useMemo as p, useState as m } from "react";
|
|
9
|
+
import { clsx as h } from "clsx";
|
|
10
|
+
import { useControllableValue as g } from "ahooks";
|
|
11
|
+
import { AnimatePresence as _, motion as v } from "motion/react";
|
|
12
|
+
import { FloatingPortal as y } from "@floating-ui/react";
|
|
13
|
+
import b from "fuse.js";
|
|
14
|
+
import x from "simplebar-react";
|
|
15
|
+
//#region src/hooks/useDropdownSearch.ts
|
|
16
|
+
var S = ({ menus: e, searchValue: t, enableInternalFilter: n, searchKey: r }) => {
|
|
17
|
+
let i = p(() => new b(e, {
|
|
18
|
+
keys: [r],
|
|
19
|
+
ignoreLocation: !0,
|
|
20
|
+
threshold: .3,
|
|
21
|
+
getFn: (e, t) => {
|
|
22
|
+
let n = e[t];
|
|
23
|
+
return t === "label" && typeof n != "string" ? "" : String(n || "");
|
|
24
|
+
}
|
|
25
|
+
}), [e, r]), o = p(() => !n || a(t) ? e : i.search(t).map((e) => e.item), [
|
|
26
|
+
e,
|
|
27
|
+
t,
|
|
28
|
+
n,
|
|
29
|
+
i
|
|
30
|
+
]);
|
|
31
|
+
return {
|
|
32
|
+
filteredMenus: o,
|
|
33
|
+
hasNoResults: p(() => n && !a(t) && o.length === 0, [
|
|
34
|
+
n,
|
|
35
|
+
t,
|
|
36
|
+
o.length
|
|
37
|
+
])
|
|
38
|
+
};
|
|
39
|
+
}, C = "_dropdown__trigger_11n5z_1", w = "_dropdown__panel_11n5z_7", T = "_dropdown__search_11n5z_15", E = "_dropdown__menu_11n5z_19", D = {
|
|
40
|
+
dropdown__trigger: C,
|
|
41
|
+
"dropdown__trigger--disabled": "_dropdown__trigger--disabled_11n5z_4",
|
|
42
|
+
dropdown__panel: w,
|
|
43
|
+
dropdown__search: T,
|
|
44
|
+
dropdown__menu: E,
|
|
45
|
+
"dropdown__menu-item": "_dropdown__menu-item_11n5z_22",
|
|
46
|
+
"dropdown__menu-item--disabled": "_dropdown__menu-item--disabled_11n5z_34",
|
|
47
|
+
"dropdown__menu-item--active": "_dropdown__menu-item--active_11n5z_34",
|
|
48
|
+
"dropdown__menu-item-icon": "_dropdown__menu-item-icon_11n5z_41",
|
|
49
|
+
"system-field": "_system-field_11n5z_52",
|
|
50
|
+
"dropdown__menu-item-label": "_dropdown__menu-item-label_11n5z_63"
|
|
51
|
+
}, O = f(({ item: e, onClick: t, isActive: n = !1 }) => {
|
|
52
|
+
let r = () => {
|
|
53
|
+
e.disabled || t(e);
|
|
54
|
+
}, i = e.systemField || !1;
|
|
55
|
+
return /* @__PURE__ */ l("div", {
|
|
56
|
+
className: h(D["dropdown__menu-item"], {
|
|
57
|
+
[D["dropdown__menu-item--disabled"]]: e.disabled,
|
|
58
|
+
[D["dropdown__menu-item--active"]]: n && !e.disabled,
|
|
59
|
+
"text-[#4d609f]": i && !e.disabled && !n
|
|
60
|
+
}),
|
|
61
|
+
onClick: r,
|
|
62
|
+
children: [e.icon && /* @__PURE__ */ c("div", {
|
|
63
|
+
className: h(D["dropdown__menu-item-icon"], { [D["system-field"]]: i }),
|
|
64
|
+
children: e.icon
|
|
65
|
+
}), /* @__PURE__ */ c("div", {
|
|
66
|
+
className: h(D["dropdown__menu-item-label"], "truncate"),
|
|
67
|
+
children: e.label
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
O.displayName = "BsyDropDownMenuItem";
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/components/DropDown/MenuList/MenuList.tsx
|
|
74
|
+
var k = ({ menus: t, onClick: n, hasNoResults: i, activeKey: a = [] }) => {
|
|
75
|
+
let { t: o } = e();
|
|
76
|
+
return t.length === 0 ? /* @__PURE__ */ c(r, {
|
|
77
|
+
text: o("noData"),
|
|
78
|
+
className: "px-3 py-6"
|
|
79
|
+
}) : i ? /* @__PURE__ */ c(r, {
|
|
80
|
+
text: o("noDataFound"),
|
|
81
|
+
className: "px-3 py-6"
|
|
82
|
+
}) : /* @__PURE__ */ c("div", {
|
|
83
|
+
className: D.dropdown__menu,
|
|
84
|
+
children: t.map((e) => /* @__PURE__ */ c(O, {
|
|
85
|
+
item: e,
|
|
86
|
+
onClick: n,
|
|
87
|
+
isActive: a.includes(e.key)
|
|
88
|
+
}, e.key))
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
k.displayName = "BsyDropDownMenuList";
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/DropDown/DropDown.tsx
|
|
94
|
+
var A = (r) => {
|
|
95
|
+
let { t: a } = e(), { children: f, menus: p, onClick: h, onSearch: b, searchKey: C = "label", showSearch: w = !0, closeOnSelect: T = !0, searchPlaceholder: E = a("search"), offset: O = {
|
|
96
|
+
x: 0,
|
|
97
|
+
y: 0
|
|
98
|
+
}, zIndex: A = 1101, style: j, activeKey: M = [] } = r, [N, P] = g(r, {
|
|
99
|
+
valuePropName: "visible",
|
|
100
|
+
defaultValue: !1,
|
|
101
|
+
trigger: "onOpenChange"
|
|
102
|
+
}), [F, I] = m(""), L = () => {
|
|
103
|
+
P(!N);
|
|
104
|
+
}, R = () => {
|
|
105
|
+
P(!1);
|
|
106
|
+
}, z = (e) => {
|
|
107
|
+
e.disabled || (h?.(e), T && R());
|
|
108
|
+
}, B = (e) => {
|
|
109
|
+
I(e), b?.(e);
|
|
110
|
+
}, { filteredMenus: V, hasNoResults: H } = S({
|
|
111
|
+
menus: p,
|
|
112
|
+
searchValue: F,
|
|
113
|
+
enableInternalFilter: !b,
|
|
114
|
+
searchKey: C
|
|
115
|
+
}), { refs: U, floatingStyles: W, getReferenceProps: G, getFloatingProps: K } = i({
|
|
116
|
+
isOpen: N,
|
|
117
|
+
close: R,
|
|
118
|
+
showMask: !1,
|
|
119
|
+
zIndex: A,
|
|
120
|
+
offset: {
|
|
121
|
+
x: o(O.x) ? O.x : 0,
|
|
122
|
+
y: o(O.y) ? O.y : 0
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return /* @__PURE__ */ l(s, { children: [d(f) ? u(f, {
|
|
126
|
+
...G(),
|
|
127
|
+
ref: U.setReference,
|
|
128
|
+
onClick: (e) => {
|
|
129
|
+
L(), f.props.onClick?.(e);
|
|
130
|
+
}
|
|
131
|
+
}) : f, /* @__PURE__ */ c(y, { children: /* @__PURE__ */ c(_, { children: N && /* @__PURE__ */ c("div", {
|
|
132
|
+
ref: U.setFloating,
|
|
133
|
+
...K(),
|
|
134
|
+
style: W,
|
|
135
|
+
children: /* @__PURE__ */ c(v.div, {
|
|
136
|
+
...t,
|
|
137
|
+
children: /* @__PURE__ */ l("div", {
|
|
138
|
+
className: D.dropdown__panel,
|
|
139
|
+
style: j,
|
|
140
|
+
children: [w && /* @__PURE__ */ c("div", {
|
|
141
|
+
className: D.dropdown__search,
|
|
142
|
+
children: /* @__PURE__ */ c(n, {
|
|
143
|
+
value: F,
|
|
144
|
+
onChange: B,
|
|
145
|
+
searchPlaceholder: E
|
|
146
|
+
})
|
|
147
|
+
}), /* @__PURE__ */ c(x, {
|
|
148
|
+
style: { maxHeight: 300 },
|
|
149
|
+
children: /* @__PURE__ */ c(k, {
|
|
150
|
+
menus: V,
|
|
151
|
+
onClick: z,
|
|
152
|
+
hasNoResults: H,
|
|
153
|
+
activeKey: M
|
|
154
|
+
})
|
|
155
|
+
})]
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
}) }) })] });
|
|
159
|
+
};
|
|
160
|
+
A.displayName = "BsyDropDown";
|
|
161
|
+
//#endregion
|
|
162
|
+
export { A as t };
|
package/dist/DropDown/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../Icon/Icon-
|
|
2
|
-
import "../vendors/useLocale-
|
|
3
|
-
import "../Select/SelectInputSearch-
|
|
4
|
-
import "../NotFoundContent/NotFoundContent-
|
|
5
|
-
import "../vendors/useFloatingPortal-
|
|
6
|
-
import { t as e } from "./DropDown-
|
|
1
|
+
import "../Icon/Icon-CTZCSuVg.js";
|
|
2
|
+
import "../vendors/useLocale-BXnqO-Ju.js";
|
|
3
|
+
import "../Select/SelectInputSearch-DMY6Y9B6.js";
|
|
4
|
+
import "../NotFoundContent/NotFoundContent-1-41e1rN.js";
|
|
5
|
+
import "../vendors/useFloatingPortal-W4pliYWU.js";
|
|
6
|
+
import { t as e } from "./DropDown-BAPBTglm.js";
|
|
7
7
|
export { e as default };
|