@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.
- package/dist/Card/Card-BE6v4I-A.js +69 -0
- package/dist/Card/index.js +3 -4
- package/dist/CheckBox/CheckBox--rXaUgMO.js +67 -0
- package/dist/CheckBox/CheckBox-Db8X-pw9.js +33 -0
- package/dist/CheckBox/index.js +4 -39
- package/dist/ColorPicker/ColorPicker-BBP-4-so.js +168 -0
- package/dist/ColorPicker/index.js +6 -5
- package/dist/DropDown/DropDown-CKXi9mXN.js +162 -0
- package/dist/DropDown/index.js +7 -4
- package/dist/Editor/Buttons--dMLPuk2.js +595 -0
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
- package/dist/Editor/constants/index.js +53 -20
- package/dist/Editor/index.js +518 -576
- package/dist/Icon/Icon-DppVOyPK.js +19 -0
- package/dist/Icon/index.js +2 -4
- package/dist/InputTag/InputTag-B6N5MZA2.js +139 -0
- package/dist/InputTag/index.js +3 -4
- package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
- package/dist/Loading/index.js +2 -4
- package/dist/Modal/Modal-FVJpbEgw.js +81 -0
- package/dist/Modal/index.js +3 -4
- package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
- package/dist/NotFoundContent/index.js +2 -4
- package/dist/Radio/Radio-dyoBNiKF.js +85 -0
- package/dist/Radio/index.js +2 -105
- package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
- package/dist/Segmented/index.js +2 -4
- package/dist/Select/Select-Bd2ECrB0.js +729 -0
- package/dist/Select/SelectInputSearch-CIXBNLFi.js +46 -0
- package/dist/Select/index.js +11 -6
- package/dist/Tabs/Tabs-C79GTyGd.js +410 -0
- package/dist/Tabs/index.js +6 -7
- package/dist/Tree/index.js +5 -4
- package/dist/Tree/utils/index.js +24 -39
- package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
- package/dist/index.js +103 -81
- package/dist/style.css +2 -1
- package/dist/vendors/Tree-CQR9fvpA.js +231 -0
- package/dist/vendors/animations-C5JKFkz4.js +38 -0
- package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
- package/dist/vendors/color-BPWy9DvT.js +12 -0
- package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
- package/dist/vendors/lexical-hZliMgDv.js +6439 -0
- package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
- package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
- package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
- package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
- package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
- package/package.json +3 -3
- package/dist/Card/Card-Y1ISqAp9.js +0 -86
- package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
- package/dist/ColorPicker/ColorPicker-uPJOs52x.js +0 -215
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-D7tFsaxU.js +0 -846
- package/dist/Icon/Icon-CBlIwtp2.js +0 -24
- package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
- package/dist/Loading/Loading-CEB4PLUE.js +0 -9
- package/dist/Modal/Modal-z3TvEXwN.js +0 -80
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
- package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
- package/dist/Select/Select-hwXXDuLU.js +0 -820
- package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
- package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
- package/dist/vendors/Tree-CLEy-xqz.js +0 -235
- package/dist/vendors/clsx-OuTLNxxd.js +0 -16
- package/dist/vendors/color-VzwvCPhF.js +0 -21
- package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
- package/dist/vendors/index-MTmG1Ezy.js +0 -15
- package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
- package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
- package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
- package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
- package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
- package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t } from "../vendors/clsx-DNOE4Gl8.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { useCallback as i, useMemo as a, useState as o } from "react";
|
|
5
|
+
//#region src/components/Card/Card.module.scss
|
|
6
|
+
var s = {
|
|
7
|
+
"bsy-card": "_bsy-card_myftj_1",
|
|
8
|
+
"bsy-card__header": "_bsy-card__header_myftj_6",
|
|
9
|
+
"bsy-card__title": "_bsy-card__title_myftj_13",
|
|
10
|
+
"bsy-card__icon-container": "_bsy-card__icon-container_myftj_24",
|
|
11
|
+
"bsy-card__icon": "_bsy-card__icon_myftj_24",
|
|
12
|
+
"bsy-card__icon--expanded": "_bsy-card__icon--expanded_myftj_43",
|
|
13
|
+
"bsy-card__content": "_bsy-card__content_myftj_46",
|
|
14
|
+
"bsy-card__content--expanded": "_bsy-card__content--expanded_myftj_52",
|
|
15
|
+
"bsy-card__content-inner": "_bsy-card__content-inner_myftj_55"
|
|
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] = o(d), y = f ?? _, b = i(() => {
|
|
18
|
+
let e = !y;
|
|
19
|
+
f === void 0 && v(e), p?.(e);
|
|
20
|
+
}, [
|
|
21
|
+
y,
|
|
22
|
+
f,
|
|
23
|
+
p
|
|
24
|
+
]), x = i((e) => {
|
|
25
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
26
|
+
}, [b]), S = a(() => ({
|
|
27
|
+
minWidth: `${u}px`,
|
|
28
|
+
...h
|
|
29
|
+
}), [u, h]);
|
|
30
|
+
return /* @__PURE__ */ r("div", {
|
|
31
|
+
className: t(s["bsy-card"], m),
|
|
32
|
+
style: S,
|
|
33
|
+
children: [/* @__PURE__ */ r("div", {
|
|
34
|
+
className: s["bsy-card__header"],
|
|
35
|
+
onClick: b,
|
|
36
|
+
onKeyDown: x,
|
|
37
|
+
role: "button",
|
|
38
|
+
tabIndex: 0,
|
|
39
|
+
"aria-expanded": y,
|
|
40
|
+
"aria-controls": "card-content",
|
|
41
|
+
style: g?.header,
|
|
42
|
+
children: [/* @__PURE__ */ n("div", {
|
|
43
|
+
className: s["bsy-card__title"],
|
|
44
|
+
id: "card-title",
|
|
45
|
+
role: "heading",
|
|
46
|
+
children: c
|
|
47
|
+
}), /* @__PURE__ */ n("div", {
|
|
48
|
+
className: s["bsy-card__icon-container"],
|
|
49
|
+
children: /* @__PURE__ */ n(e, {
|
|
50
|
+
name: "xialakuangxiala1",
|
|
51
|
+
className: t(s["bsy-card__icon"], y && s["bsy-card__icon--expanded"])
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
}), /* @__PURE__ */ n("div", {
|
|
55
|
+
id: "card-content",
|
|
56
|
+
role: "region",
|
|
57
|
+
"aria-labelledby": "card-title",
|
|
58
|
+
className: t(s["bsy-card__content"], y && s["bsy-card__content--expanded"]),
|
|
59
|
+
children: /* @__PURE__ */ n("div", {
|
|
60
|
+
className: s["bsy-card__content-inner"],
|
|
61
|
+
style: g?.body,
|
|
62
|
+
children: l
|
|
63
|
+
})
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
c.displayName = "BsyCard";
|
|
68
|
+
//#endregion
|
|
69
|
+
export { c as t };
|
package/dist/Card/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t as e } from "./Card-BE6v4I-A.js";
|
|
3
|
+
export { e as default };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { t as e } from "../vendors/lodash-es-Bu9xU1fK.js";
|
|
2
|
+
import { t } from "../Icon/Icon-DppVOyPK.js";
|
|
3
|
+
import { t as n } from "../vendors/clsx-DNOE4Gl8.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as a, forwardRef as o, useContext as s } from "react";
|
|
6
|
+
//#region src/components/CheckBox/context/context.ts
|
|
7
|
+
var c = a(null), l = "_checkbox_vheru_1", u = "_checkbox__inner_vheru_32", d = {
|
|
8
|
+
checkbox: l,
|
|
9
|
+
"checkbox--checked": "_checkbox--checked_vheru_12",
|
|
10
|
+
"checkbox--unchecked": "_checkbox--unchecked_vheru_16",
|
|
11
|
+
"checkbox--indeterminate": "_checkbox--indeterminate_vheru_23",
|
|
12
|
+
"checkbox--disabled": "_checkbox--disabled_vheru_27",
|
|
13
|
+
checkbox__inner: u,
|
|
14
|
+
"checkbox__inner--disabled": "_checkbox__inner--disabled_vheru_38"
|
|
15
|
+
}, f = ({ isChecked: e = !1, indeterminate: a = !1, disabled: o = !1 }) => {
|
|
16
|
+
let s = a ? "indeterminate" : e ? "checked" : "unchecked", c = n(d.checkbox, {
|
|
17
|
+
[d["checkbox--checked"]]: !o && s === "checked",
|
|
18
|
+
[d["checkbox--unchecked"]]: !o && s === "unchecked",
|
|
19
|
+
[d["checkbox--indeterminate"]]: !o && s === "indeterminate",
|
|
20
|
+
[d["checkbox--disabled"]]: o
|
|
21
|
+
}), l = n(d.checkbox__inner, { [d["checkbox__inner--disabled"]]: o });
|
|
22
|
+
return /* @__PURE__ */ i("div", {
|
|
23
|
+
className: c,
|
|
24
|
+
children: [s === "checked" && /* @__PURE__ */ r(t, {
|
|
25
|
+
name: "checkthebox",
|
|
26
|
+
color: o ? "#b8b8b8" : "#fff"
|
|
27
|
+
}), s === "indeterminate" && /* @__PURE__ */ r("div", { className: l })]
|
|
28
|
+
});
|
|
29
|
+
}, p = /* @__PURE__ */ function(e) {
|
|
30
|
+
return e.NONE = "none", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e;
|
|
31
|
+
}({}), m = {
|
|
32
|
+
"bsy-checkbox": "_bsy-checkbox_1372g_1",
|
|
33
|
+
"bsy-checkbox--full-width": "_bsy-checkbox--full-width_1372g_8",
|
|
34
|
+
"bsy-checkbox__button": "_bsy-checkbox__button_1372g_11",
|
|
35
|
+
"bsy-checkbox__button--disabled": "_bsy-checkbox__button--disabled_1372g_22",
|
|
36
|
+
"bsy-checkbox__button--enabled": "_bsy-checkbox__button--enabled_1372g_27",
|
|
37
|
+
"bsy-checkbox__button--indeterminate": "_bsy-checkbox__button--indeterminate_1372g_30",
|
|
38
|
+
"bsy-checkbox__button--checked": "_bsy-checkbox__button--checked_1372g_34",
|
|
39
|
+
"bsy-checkbox__button--unchecked": "_bsy-checkbox__button--unchecked_1372g_38",
|
|
40
|
+
"bsy-checkbox__button--left-label": "_bsy-checkbox__button--left-label_1372g_45"
|
|
41
|
+
}, h = o((t, a) => {
|
|
42
|
+
let { checked: o, indeterminate: l = !1, onChange: u, value: d = e("checkbox"), disabled: h = !1, children: g, style: _, labelPosition: v = "right" } = t, y = s(c), b = y ? y.value?.includes(d) : o, x = (e) => {
|
|
43
|
+
if (!(h || y?.disabled)) if (y) {
|
|
44
|
+
let t = e ? [...y.value || [], d] : (y.value || []).filter((e) => e !== d);
|
|
45
|
+
t && y.onChange?.(t);
|
|
46
|
+
} else u?.(e);
|
|
47
|
+
}, S = h || y?.disabled;
|
|
48
|
+
return /* @__PURE__ */ i("div", {
|
|
49
|
+
className: n(m["bsy-checkbox"], { [m["bsy-checkbox--full-width"]]: y?.layout === p.NONE || !y?.layout }),
|
|
50
|
+
onClick: () => x(!b),
|
|
51
|
+
style: _,
|
|
52
|
+
children: [/* @__PURE__ */ r("div", {
|
|
53
|
+
ref: a,
|
|
54
|
+
role: "checkbox",
|
|
55
|
+
"aria-checked": l ? "mixed" : b,
|
|
56
|
+
tabIndex: S ? -1 : 0,
|
|
57
|
+
className: n({ [m["bsy-checkbox__button--left-label"]]: v === "left" }),
|
|
58
|
+
children: /* @__PURE__ */ r(f, {
|
|
59
|
+
indeterminate: l,
|
|
60
|
+
isChecked: b,
|
|
61
|
+
disabled: S
|
|
62
|
+
})
|
|
63
|
+
}), g]
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
export { p as n, c as r, h as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { t as e } from "../vendors/clsx-DNOE4Gl8.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "./CheckBox--rXaUgMO.js";
|
|
3
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
|
+
import { useControllableValue as a } from "ahooks";
|
|
5
|
+
//#region src/components/CheckBox/Group.tsx
|
|
6
|
+
var o = ({ disabled: r, layout: o = t.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 = e("flex", {
|
|
13
|
+
"flex-col": o === t.NONE,
|
|
14
|
+
"flex-col gap-[10px]": o === t.VERTICAL,
|
|
15
|
+
"flex-row gap-y-[10px] gap-x-[20px] flex-wrap": o === t.HORIZONTAL,
|
|
16
|
+
[c || ""]: !!c
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ i(n.Provider, {
|
|
19
|
+
value: {
|
|
20
|
+
value: u,
|
|
21
|
+
onChange: d,
|
|
22
|
+
disabled: r,
|
|
23
|
+
layout: o
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ i("div", {
|
|
26
|
+
className: f,
|
|
27
|
+
children: s
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}, s = r;
|
|
31
|
+
s.Group = o;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { s as t };
|
package/dist/CheckBox/index.js
CHANGED
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const m = ({
|
|
6
|
-
disabled: l,
|
|
7
|
-
layout: e = o.NONE,
|
|
8
|
-
children: p,
|
|
9
|
-
className: a,
|
|
10
|
-
...s
|
|
11
|
-
}) => {
|
|
12
|
-
const [t, x] = f(s, {
|
|
13
|
-
defaultValue: [],
|
|
14
|
-
valuePropName: "value",
|
|
15
|
-
defaultValuePropName: "defaultValue",
|
|
16
|
-
trigger: "onChange"
|
|
17
|
-
}), u = C("flex", {
|
|
18
|
-
"flex-col": e === o.NONE,
|
|
19
|
-
"flex-col gap-[10px]": e === o.VERTICAL,
|
|
20
|
-
"flex-row gap-y-[10px] gap-x-[20px] flex-wrap": e === o.HORIZONTAL,
|
|
21
|
-
[a || ""]: !!a
|
|
22
|
-
});
|
|
23
|
-
return /* @__PURE__ */ r(
|
|
24
|
-
c.Provider,
|
|
25
|
-
{
|
|
26
|
-
value: {
|
|
27
|
-
value: t,
|
|
28
|
-
onChange: x,
|
|
29
|
-
disabled: l,
|
|
30
|
-
layout: e
|
|
31
|
-
},
|
|
32
|
-
children: /* @__PURE__ */ r("div", { className: u, children: p })
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}, i = n;
|
|
36
|
-
i.Group = m;
|
|
37
|
-
export {
|
|
38
|
-
i as default
|
|
39
|
-
};
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import "./CheckBox--rXaUgMO.js";
|
|
3
|
+
import { t as e } from "./CheckBox-Db8X-pw9.js";
|
|
4
|
+
export { e as default };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { u as e } from "../vendors/lodash-es-Bu9xU1fK.js";
|
|
2
|
+
import { t } from "../Icon/Icon-DppVOyPK.js";
|
|
3
|
+
import { t as n } from "../vendors/useLocale-BfT0V1j4.js";
|
|
4
|
+
import { t as r } from "../vendors/clsx-DNOE4Gl8.js";
|
|
5
|
+
import { t as i } from "../vendors/tinycolor2-DToeAEPD.js";
|
|
6
|
+
import { t as a } from "../vendors/color-BPWy9DvT.js";
|
|
7
|
+
import { n as o } from "../vendors/animations-C5JKFkz4.js";
|
|
8
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import { cloneElement as u, isValidElement as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
10
|
+
import { useControllableValue as h } from "ahooks";
|
|
11
|
+
import { ColorPicker as g } from "antd";
|
|
12
|
+
import { AnimatePresence as _, motion as v } from "motion/react";
|
|
13
|
+
import { FloatingPortal as y, flip as b, offset as x, shift as S, useClick as C, useDismiss as w, useFloating as T, useInteractions as E } from "@floating-ui/react";
|
|
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] = m(!1), { refs: r, floatingStyles: i, context: a } = T({
|
|
36
|
+
open: t,
|
|
37
|
+
onOpenChange: n,
|
|
38
|
+
placement: e,
|
|
39
|
+
middleware: [
|
|
40
|
+
x(4),
|
|
41
|
+
b(),
|
|
42
|
+
S({ padding: 8 })
|
|
43
|
+
]
|
|
44
|
+
}), { getReferenceProps: o, getFloatingProps: s } = E([C(a), w(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: e, onColorSelect: n, options: r, style: o }) => /* @__PURE__ */ c("div", {
|
|
68
|
+
className: A["bsy-color-picker__preset-colors-grid"],
|
|
69
|
+
style: o,
|
|
70
|
+
children: r.map((r) => /* @__PURE__ */ c("div", {
|
|
71
|
+
className: A["bsy-color-picker__preset-colors-item"],
|
|
72
|
+
style: {
|
|
73
|
+
backgroundColor: r,
|
|
74
|
+
"--hover-color": i(r).setAlpha(.5).toRgbString()
|
|
75
|
+
},
|
|
76
|
+
onClick: () => n(r),
|
|
77
|
+
children: a(e, r) && /* @__PURE__ */ c(t, {
|
|
78
|
+
name: "checkthebox",
|
|
79
|
+
className: A["bsy-color-picker__check-icon"]
|
|
80
|
+
})
|
|
81
|
+
}, r))
|
|
82
|
+
}), M = (t) => {
|
|
83
|
+
let { children: r, placement: i = "bottom-start", disabled: m = !1, presetColors: g, getPopupContainer: b } = t, { t: x } = n(), [S, C] = h(t, { defaultValue: t.value }), { isOpen: w, refs: T, floatingStyles: E, getReferenceProps: k, getFloatingProps: M } = O(i), P = d(r) ? u(r, {
|
|
84
|
+
...k(),
|
|
85
|
+
ref: T.setReference,
|
|
86
|
+
disabled: m
|
|
87
|
+
}) : r, F = e(g) && g.length ? g : D, I = p(F.some((e) => a(e, S)) ? [] : [S]);
|
|
88
|
+
return /* @__PURE__ */ l(s, { children: [P, /* @__PURE__ */ c(y, {
|
|
89
|
+
root: f(() => w ? b?.() : void 0, [w, b]),
|
|
90
|
+
children: /* @__PURE__ */ c(_, { children: w && /* @__PURE__ */ c("div", {
|
|
91
|
+
ref: T.setFloating,
|
|
92
|
+
style: E,
|
|
93
|
+
...M(),
|
|
94
|
+
className: A["bsy-color-picker__floating"],
|
|
95
|
+
children: /* @__PURE__ */ c(v.div, {
|
|
96
|
+
...o,
|
|
97
|
+
children: /* @__PURE__ */ c("div", {
|
|
98
|
+
className: A["bsy-color-picker__content"],
|
|
99
|
+
children: /* @__PURE__ */ l("div", {
|
|
100
|
+
className: A["bsy-color-picker__grid"],
|
|
101
|
+
children: [/* @__PURE__ */ l("div", {
|
|
102
|
+
className: A["bsy-color-picker__preset-colors"],
|
|
103
|
+
children: [/* @__PURE__ */ c("div", {
|
|
104
|
+
className: A["bsy-color-picker__preset-colors-title"],
|
|
105
|
+
children: x("presetColors")
|
|
106
|
+
}), /* @__PURE__ */ c(j, {
|
|
107
|
+
currentColor: S,
|
|
108
|
+
onColorSelect: C,
|
|
109
|
+
options: F
|
|
110
|
+
})]
|
|
111
|
+
}), /* @__PURE__ */ c(N, {
|
|
112
|
+
value: S,
|
|
113
|
+
onChange: C,
|
|
114
|
+
onColorInput: t.onColorInput,
|
|
115
|
+
options: F,
|
|
116
|
+
list: I.current
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
}) })
|
|
122
|
+
})] });
|
|
123
|
+
}, N = (e) => {
|
|
124
|
+
let { list: i } = e, [a, o] = m(), [s, u] = m(!1), { t: d } = n();
|
|
125
|
+
return /* @__PURE__ */ l("div", {
|
|
126
|
+
className: A["bsy-color-picker__custom-color"],
|
|
127
|
+
children: [/* @__PURE__ */ c("div", {
|
|
128
|
+
className: A["bsy-color-picker__custom-color-title"],
|
|
129
|
+
children: d("customColor")
|
|
130
|
+
}), /* @__PURE__ */ l("div", {
|
|
131
|
+
className: A["bsy-color-picker__custom-color-content"],
|
|
132
|
+
children: [/* @__PURE__ */ c(g, {
|
|
133
|
+
value: a,
|
|
134
|
+
onChange: (t) => {
|
|
135
|
+
let n = t.toRgbString();
|
|
136
|
+
o(n), e.onColorInput?.(n);
|
|
137
|
+
},
|
|
138
|
+
open: s,
|
|
139
|
+
onOpenChange: (t) => {
|
|
140
|
+
u(t), !t && a && (i.includes(a) || i.unshift(a), e.onChange(a), o(void 0));
|
|
141
|
+
},
|
|
142
|
+
children: /* @__PURE__ */ c("div", {
|
|
143
|
+
className: r(A["bsy-color-picker__custom-color-btn"], {
|
|
144
|
+
[A["bsy-color-picker__custom-color-btn--active"]]: s && !a,
|
|
145
|
+
[A["bsy-color-picker__custom-color-btn--preview"]]: !!a
|
|
146
|
+
}),
|
|
147
|
+
role: "button",
|
|
148
|
+
style: { backgroundColor: a || void 0 },
|
|
149
|
+
onClick: () => {
|
|
150
|
+
u(!0);
|
|
151
|
+
},
|
|
152
|
+
children: /* @__PURE__ */ c(t, {
|
|
153
|
+
name: "add",
|
|
154
|
+
style: { visibility: a ? "hidden" : "visible" }
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}), /* @__PURE__ */ c(j, {
|
|
158
|
+
currentColor: e.value,
|
|
159
|
+
onColorSelect: e.onChange,
|
|
160
|
+
options: i.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,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import "../vendors/useLocale-BfT0V1j4.js";
|
|
3
|
+
import { n as e, t } from "./ColorPicker-BBP-4-so.js";
|
|
4
|
+
import "../vendors/tinycolor2-DToeAEPD.js";
|
|
5
|
+
import "../vendors/color-BPWy9DvT.js";
|
|
6
|
+
export { e as COLOR_OPTIONS_RGBA, t as default };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { a as e, i as t } from "../vendors/lodash-es-Bu9xU1fK.js";
|
|
2
|
+
import { t as n } from "../vendors/useLocale-BfT0V1j4.js";
|
|
3
|
+
import { t as r } from "../vendors/clsx-DNOE4Gl8.js";
|
|
4
|
+
import { n as i } from "../vendors/animations-C5JKFkz4.js";
|
|
5
|
+
import { t as a } from "../Select/SelectInputSearch-CIXBNLFi.js";
|
|
6
|
+
import { t as o } from "../NotFoundContent/NotFoundContent-CTPpcZOt.js";
|
|
7
|
+
import { t as s } from "../vendors/fuse.js-BKtvbTjL.js";
|
|
8
|
+
import { t as c } from "../vendors/simplebar-react-CFlS-Nm9.js";
|
|
9
|
+
import { t as l } from "../vendors/useFloatingPortal-BA6P5GxV.js";
|
|
10
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import { cloneElement as p, isValidElement as m, memo as h, useMemo as g, useState as _ } from "react";
|
|
12
|
+
import { useControllableValue as v } from "ahooks";
|
|
13
|
+
import { AnimatePresence as y, motion as b } from "motion/react";
|
|
14
|
+
import { FloatingPortal as x } from "@floating-ui/react";
|
|
15
|
+
//#region src/hooks/useDropdownSearch.ts
|
|
16
|
+
var S = ({ menus: t, searchValue: n, enableInternalFilter: r, searchKey: i }) => {
|
|
17
|
+
let a = g(() => new s(t, {
|
|
18
|
+
keys: [i],
|
|
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
|
+
}), [t, i]), o = g(() => !r || e(n) ? t : a.search(n).map((e) => e.item), [
|
|
26
|
+
t,
|
|
27
|
+
n,
|
|
28
|
+
r,
|
|
29
|
+
a
|
|
30
|
+
]);
|
|
31
|
+
return {
|
|
32
|
+
filteredMenus: o,
|
|
33
|
+
hasNoResults: g(() => r && !e(n) && o.length === 0, [
|
|
34
|
+
r,
|
|
35
|
+
n,
|
|
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 = h(({ item: e, onClick: t, isActive: n = !1 }) => {
|
|
52
|
+
let i = () => {
|
|
53
|
+
e.disabled || t(e);
|
|
54
|
+
}, a = e.systemField || !1;
|
|
55
|
+
return /* @__PURE__ */ f("div", {
|
|
56
|
+
className: r(D["dropdown__menu-item"], {
|
|
57
|
+
[D["dropdown__menu-item--disabled"]]: e.disabled,
|
|
58
|
+
[D["dropdown__menu-item--active"]]: n && !e.disabled,
|
|
59
|
+
"text-[#4d609f]": a && !e.disabled && !n
|
|
60
|
+
}),
|
|
61
|
+
onClick: i,
|
|
62
|
+
children: [e.icon && /* @__PURE__ */ d("div", {
|
|
63
|
+
className: r(D["dropdown__menu-item-icon"], { [D["system-field"]]: a }),
|
|
64
|
+
children: e.icon
|
|
65
|
+
}), /* @__PURE__ */ d("div", {
|
|
66
|
+
className: r(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: e, onClick: t, hasNoResults: r, activeKey: i = [] }) => {
|
|
75
|
+
let { t: a } = n();
|
|
76
|
+
return e.length === 0 ? /* @__PURE__ */ d(o, {
|
|
77
|
+
text: a("noData"),
|
|
78
|
+
className: "px-3 py-6"
|
|
79
|
+
}) : r ? /* @__PURE__ */ d(o, {
|
|
80
|
+
text: a("noDataFound"),
|
|
81
|
+
className: "px-3 py-6"
|
|
82
|
+
}) : /* @__PURE__ */ d("div", {
|
|
83
|
+
className: D.dropdown__menu,
|
|
84
|
+
children: e.map((e) => /* @__PURE__ */ d(O, {
|
|
85
|
+
item: e,
|
|
86
|
+
onClick: t,
|
|
87
|
+
isActive: i.includes(e.key)
|
|
88
|
+
}, e.key))
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
k.displayName = "BsyDropDownMenuList";
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/DropDown/DropDown.tsx
|
|
94
|
+
var A = (e) => {
|
|
95
|
+
let { t: r } = n(), { children: o, menus: s, onClick: h, onSearch: g, searchKey: C = "label", showSearch: w = !0, closeOnSelect: T = !0, searchPlaceholder: E = r("search"), offset: O = {
|
|
96
|
+
x: 0,
|
|
97
|
+
y: 0
|
|
98
|
+
}, zIndex: A = 1101, style: j, activeKey: M = [] } = e, [N, P] = v(e, {
|
|
99
|
+
valuePropName: "visible",
|
|
100
|
+
defaultValue: !1,
|
|
101
|
+
trigger: "onOpenChange"
|
|
102
|
+
}), [F, I] = _(""), 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), g?.(e);
|
|
110
|
+
}, { filteredMenus: V, hasNoResults: H } = S({
|
|
111
|
+
menus: s,
|
|
112
|
+
searchValue: F,
|
|
113
|
+
enableInternalFilter: !g,
|
|
114
|
+
searchKey: C
|
|
115
|
+
}), { refs: U, floatingStyles: W, getReferenceProps: G, getFloatingProps: K } = l({
|
|
116
|
+
isOpen: N,
|
|
117
|
+
close: R,
|
|
118
|
+
showMask: !1,
|
|
119
|
+
zIndex: A,
|
|
120
|
+
offset: {
|
|
121
|
+
x: t(O.x) ? O.x : 0,
|
|
122
|
+
y: t(O.y) ? O.y : 0
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return /* @__PURE__ */ f(u, { children: [m(o) ? p(o, {
|
|
126
|
+
...G(),
|
|
127
|
+
ref: U.setReference,
|
|
128
|
+
onClick: (e) => {
|
|
129
|
+
L(), o.props.onClick?.(e);
|
|
130
|
+
}
|
|
131
|
+
}) : o, /* @__PURE__ */ d(x, { children: /* @__PURE__ */ d(y, { children: N && /* @__PURE__ */ d("div", {
|
|
132
|
+
ref: U.setFloating,
|
|
133
|
+
...K(),
|
|
134
|
+
style: W,
|
|
135
|
+
children: /* @__PURE__ */ d(b.div, {
|
|
136
|
+
...i,
|
|
137
|
+
children: /* @__PURE__ */ f("div", {
|
|
138
|
+
className: D.dropdown__panel,
|
|
139
|
+
style: j,
|
|
140
|
+
children: [w && /* @__PURE__ */ d("div", {
|
|
141
|
+
className: D.dropdown__search,
|
|
142
|
+
children: /* @__PURE__ */ d(a, {
|
|
143
|
+
value: F,
|
|
144
|
+
onChange: B,
|
|
145
|
+
searchPlaceholder: E
|
|
146
|
+
})
|
|
147
|
+
}), /* @__PURE__ */ d(c, {
|
|
148
|
+
style: { maxHeight: 300 },
|
|
149
|
+
children: /* @__PURE__ */ d(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,4 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import "../vendors/useLocale-BfT0V1j4.js";
|
|
3
|
+
import "../Select/SelectInputSearch-CIXBNLFi.js";
|
|
4
|
+
import "../NotFoundContent/NotFoundContent-CTPpcZOt.js";
|
|
5
|
+
import "../vendors/useFloatingPortal-BA6P5GxV.js";
|
|
6
|
+
import { t as e } from "./DropDown-CKXi9mXN.js";
|
|
7
|
+
export { e as default };
|