@baishuyun/ui-base 2.3.0 → 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-D0D5azon.js +0 -216
- package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
- package/dist/Editor/index-C0Rjz8DK.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,19 @@
|
|
|
1
|
+
import { i as e } from "../vendors/lodash-es-Bu9xU1fK.js";
|
|
2
|
+
import { createFromIconfontCN as t } from "@ant-design/icons";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Icon/Icon.tsx
|
|
5
|
+
var r = t({ scriptUrl: "https://at.alicdn.com/t/c/font_4786625_djm4gsgobsp.js" }), i = ({ name: t, style: i, className: a, onClick: o, color: s, size: c = 16 }) => {
|
|
6
|
+
let l = {
|
|
7
|
+
color: s,
|
|
8
|
+
fontSize: e(c) ? `${c}px` : c,
|
|
9
|
+
...i
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ n(r, {
|
|
12
|
+
onClick: o,
|
|
13
|
+
type: `icon-${t}`,
|
|
14
|
+
style: l,
|
|
15
|
+
className: `${a || ""}`
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { i as t };
|
package/dist/Icon/index.js
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t } from "../vendors/clsx-DNOE4Gl8.js";
|
|
3
|
+
import { t as n } from "../vendors/simplebar-react-CFlS-Nm9.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { useCallback as a, useEffect as o, useLayoutEffect as s, useRef as c, useState as l } from "react";
|
|
6
|
+
import { useControllableValue as u } from "ahooks";
|
|
7
|
+
import { motion as d } from "motion/react";
|
|
8
|
+
//#region src/components/InputTag/input-tag.module.scss
|
|
9
|
+
var f = {
|
|
10
|
+
"bsy-inputTag": "_bsy-inputTag_46spj_11",
|
|
11
|
+
"bsy-inputTag__container": "_bsy-inputTag__container_46spj_22",
|
|
12
|
+
"bsy-inputTag__inputContainer": "_bsy-inputTag__inputContainer_46spj_27",
|
|
13
|
+
"bsy-inputTag__inputContainer--zeroMargin": "_bsy-inputTag__inputContainer--zeroMargin_46spj_37",
|
|
14
|
+
"bsy-inputTag__input": "_bsy-inputTag__input_46spj_27",
|
|
15
|
+
"scale-in": "_scale-in_46spj_1"
|
|
16
|
+
}, p = {
|
|
17
|
+
GAP: 4,
|
|
18
|
+
OFFSET: 3,
|
|
19
|
+
INPUT_MIN_WIDTH: 80,
|
|
20
|
+
CONTAINER_PADDING: 10,
|
|
21
|
+
INPUT_MARGIN: 4
|
|
22
|
+
}, m = (e, t) => {
|
|
23
|
+
let [n, r] = l(0);
|
|
24
|
+
return s(() => {
|
|
25
|
+
let t = e.current;
|
|
26
|
+
if (!t) return;
|
|
27
|
+
let n = () => {
|
|
28
|
+
let e = t.children, n = 0;
|
|
29
|
+
for (let t = 0; t < e.length; t++) n += e[t].clientWidth;
|
|
30
|
+
let i = Math.max(0, e.length - 1) * p.GAP, a = Math.max(0, n + i + p.OFFSET);
|
|
31
|
+
r((e) => e === a ? e : a);
|
|
32
|
+
};
|
|
33
|
+
n();
|
|
34
|
+
let i = new ResizeObserver(n);
|
|
35
|
+
return i.observe(t), () => {
|
|
36
|
+
i.disconnect();
|
|
37
|
+
};
|
|
38
|
+
}, [t, e]), n;
|
|
39
|
+
}, h = (h) => {
|
|
40
|
+
let { defaultValue: g, enableActive: _ = !1, defaultActiveIndex: v, onActiveIndexChange: y } = h, [b, x] = u(h, { defaultValue: g || [] }), [S, C] = u(h, {
|
|
41
|
+
valuePropName: "activeIndex",
|
|
42
|
+
trigger: "onActiveIndexChange",
|
|
43
|
+
defaultValue: v
|
|
44
|
+
}), [w, T] = l(""), E = c(null), D = c(null), O = c(null), k = c(!1), A = () => {
|
|
45
|
+
if (D.current && D.current.children.length > 0) {
|
|
46
|
+
let e = D.current.children.length - 1;
|
|
47
|
+
D.current.children[e].scrollIntoView({
|
|
48
|
+
behavior: "smooth",
|
|
49
|
+
block: "nearest",
|
|
50
|
+
inline: "end"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
o(() => {
|
|
55
|
+
k.current && b.length > 0 && (A(), k.current = !1);
|
|
56
|
+
}, [b.length]);
|
|
57
|
+
let j = (e) => {
|
|
58
|
+
T(e.currentTarget.value);
|
|
59
|
+
}, M = () => {
|
|
60
|
+
let e = w.trim();
|
|
61
|
+
if (e !== "") {
|
|
62
|
+
let t = e;
|
|
63
|
+
k.current = !0, x([...b, t]), T("");
|
|
64
|
+
}
|
|
65
|
+
}, N = (e, t) => {
|
|
66
|
+
if (!_) return;
|
|
67
|
+
let n = S === e ? void 0 : e;
|
|
68
|
+
C(n), y?.(n ?? -1, t);
|
|
69
|
+
}, P = (e) => {
|
|
70
|
+
e.key === "Enter" || e.key === "NumpadEnter" ? M() : e.key === "Backspace" && w === "" && b.length > 0 && x(b.slice(0, -1));
|
|
71
|
+
}, F = (e) => {
|
|
72
|
+
x(b.filter((t, n) => n !== e));
|
|
73
|
+
}, [I, L] = l(0), R = m(D, b.length), z = a(() => {
|
|
74
|
+
if (!E.current || !O.current) return;
|
|
75
|
+
let e = E.current.clientWidth - O.current.clientWidth - p.INPUT_MARGIN - p.CONTAINER_PADDING, t = Math.max(0, e);
|
|
76
|
+
L((e) => e === t ? e : t);
|
|
77
|
+
}, []);
|
|
78
|
+
s(() => {
|
|
79
|
+
if (!E.current || !O.current) return;
|
|
80
|
+
z();
|
|
81
|
+
let e = new ResizeObserver(() => {
|
|
82
|
+
z();
|
|
83
|
+
});
|
|
84
|
+
return e.observe(E.current), e.observe(O.current), () => {
|
|
85
|
+
e.disconnect();
|
|
86
|
+
};
|
|
87
|
+
}, [z]);
|
|
88
|
+
let B = Math.min(R, I);
|
|
89
|
+
return /* @__PURE__ */ i("div", {
|
|
90
|
+
className: f["bsy-inputTag"],
|
|
91
|
+
ref: E,
|
|
92
|
+
children: [/* @__PURE__ */ r("div", {
|
|
93
|
+
className: f["bsy-inputTag__container"],
|
|
94
|
+
children: b.length ? /* @__PURE__ */ r(n, {
|
|
95
|
+
style: { width: B + "px" },
|
|
96
|
+
children: /* @__PURE__ */ r("div", {
|
|
97
|
+
className: "flex gap-1 py-[3px]",
|
|
98
|
+
ref: D,
|
|
99
|
+
children: b.map((n, a) => /* @__PURE__ */ i(d.div, {
|
|
100
|
+
className: t("rounded-[2px] gap-1 px-[6px] h-[26px] flex items-center flex-shrink-0", {
|
|
101
|
+
"cursor-pointer": _,
|
|
102
|
+
"hover:bg-[#e0e0e0]": _ && S !== a,
|
|
103
|
+
"bg-[#0265ff] text-white": _ && S === a,
|
|
104
|
+
"bg-[#eee] text-black": !_ || S !== a
|
|
105
|
+
}),
|
|
106
|
+
onClick: () => N(a, n),
|
|
107
|
+
children: [/* @__PURE__ */ r("span", { children: n }), /* @__PURE__ */ r("div", {
|
|
108
|
+
className: t("cursor-pointer", _ && S === a ? "text-white hover:text-gray-200" : "text-[#666] hover:text-[#0265ff]"),
|
|
109
|
+
onClick: (e) => {
|
|
110
|
+
e.stopPropagation(), F(a);
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ r(e, {
|
|
113
|
+
name: "close",
|
|
114
|
+
size: 12
|
|
115
|
+
})
|
|
116
|
+
})]
|
|
117
|
+
}, a))
|
|
118
|
+
})
|
|
119
|
+
}) : null
|
|
120
|
+
}), /* @__PURE__ */ r("div", {
|
|
121
|
+
ref: O,
|
|
122
|
+
className: t(f["bsy-inputTag__inputContainer"], { [f["bsy-inputTag__inputContainer--zeroMargin"]]: b.length === 0 }, "py-[3px]"),
|
|
123
|
+
children: /* @__PURE__ */ r("input", {
|
|
124
|
+
value: w,
|
|
125
|
+
onChange: j,
|
|
126
|
+
onKeyDown: P,
|
|
127
|
+
onBlur: M,
|
|
128
|
+
className: t(f["bsy-inputTag__input"], "placeholder:text-[#999]"),
|
|
129
|
+
placeholder: "输入标签"
|
|
130
|
+
})
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
h.displayName = "BsyInputTag";
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/components/InputTag/index.ts
|
|
137
|
+
var g = h;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { g as t };
|
package/dist/InputTag/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t as e } from "./InputTag-B6N5MZA2.js";
|
|
3
|
+
export { e as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LoadingOutlined as e } from "@ant-design/icons";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Loading/Loading.tsx
|
|
4
|
+
var r = ({ tip: r = "加载中..." }) => /* @__PURE__ */ n("div", {
|
|
5
|
+
className: "flex flex-col justify-center items-center h-full min-h-[100px] text-slate-500",
|
|
6
|
+
children: [/* @__PURE__ */ t(e, {
|
|
7
|
+
style: {
|
|
8
|
+
fontSize: 24,
|
|
9
|
+
marginBottom: 8
|
|
10
|
+
},
|
|
11
|
+
spin: !0
|
|
12
|
+
}), /* @__PURE__ */ t("span", { children: r })]
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as t };
|
package/dist/Loading/index.js
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { useState as r } from "react";
|
|
4
|
+
import { useControllableValue as i } from "ahooks";
|
|
5
|
+
import { Modal as a } from "antd";
|
|
6
|
+
//#region src/components/Modal/modal.module.scss
|
|
7
|
+
var o = "_modal__title_klsxr_1", s = "_modal__actions_klsxr_14", c = "_modal__button_groups_klsxr_18", l = "_modal__button_klsxr_18", u = "_modal__icon_klsxr_38", d = {
|
|
8
|
+
modal__title: o,
|
|
9
|
+
"modal__title-text": "_modal__title-text_klsxr_10",
|
|
10
|
+
modal__actions: s,
|
|
11
|
+
modal__button_groups: c,
|
|
12
|
+
modal__button: l,
|
|
13
|
+
"modal__button--fullscreen": "_modal__button--fullscreen_klsxr_35",
|
|
14
|
+
modal__icon: u
|
|
15
|
+
}, f = (o) => {
|
|
16
|
+
let { fullSwitch: s = !1 } = o, [c, l] = i(o, {
|
|
17
|
+
valuePropName: "open",
|
|
18
|
+
defaultValue: !1,
|
|
19
|
+
defaultValuePropName: "defaultOpen",
|
|
20
|
+
trigger: "onOpenChange"
|
|
21
|
+
}), [u, f] = r(!1);
|
|
22
|
+
return /* @__PURE__ */ t(a, {
|
|
23
|
+
destroyOnHidden: !0,
|
|
24
|
+
open: c,
|
|
25
|
+
onCancel: () => l(!1),
|
|
26
|
+
footer: null,
|
|
27
|
+
title: o.title ? /* @__PURE__ */ n("div", {
|
|
28
|
+
className: d.modal__title,
|
|
29
|
+
children: [/* @__PURE__ */ t("div", {
|
|
30
|
+
className: d.modal__titleText,
|
|
31
|
+
children: o.title
|
|
32
|
+
}), s ? /* @__PURE__ */ n("div", {
|
|
33
|
+
className: d.modal__button_groups,
|
|
34
|
+
children: [/* @__PURE__ */ t("div", {
|
|
35
|
+
"aria-label": "toggle fullscreen",
|
|
36
|
+
role: "button",
|
|
37
|
+
onClick: () => f(!u),
|
|
38
|
+
className: d.modal__button,
|
|
39
|
+
children: /* @__PURE__ */ t(e, {
|
|
40
|
+
name: u ? "quanpingsuoxiao" : "quanpingfangda",
|
|
41
|
+
className: d.modal__icon
|
|
42
|
+
})
|
|
43
|
+
}), /* @__PURE__ */ t("div", {
|
|
44
|
+
role: "button",
|
|
45
|
+
"aria-label": "close",
|
|
46
|
+
onClick: () => l(!1),
|
|
47
|
+
className: d.modal__button,
|
|
48
|
+
children: /* @__PURE__ */ t(e, {
|
|
49
|
+
name: "close",
|
|
50
|
+
className: d.modal__icon
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
}) : /* @__PURE__ */ t("div", {
|
|
54
|
+
role: "button",
|
|
55
|
+
"aria-label": "close",
|
|
56
|
+
onClick: () => l(!1),
|
|
57
|
+
className: d.modal__button,
|
|
58
|
+
children: /* @__PURE__ */ t(e, {
|
|
59
|
+
name: "close",
|
|
60
|
+
className: d.modal__icon
|
|
61
|
+
})
|
|
62
|
+
})]
|
|
63
|
+
}) : null,
|
|
64
|
+
closable: !1,
|
|
65
|
+
width: u ? "100%" : o.width,
|
|
66
|
+
style: { transition: "width 0.3s ease" },
|
|
67
|
+
maskClosable: !1,
|
|
68
|
+
styles: {
|
|
69
|
+
header: { marginBottom: 0 },
|
|
70
|
+
content: {
|
|
71
|
+
padding: 0,
|
|
72
|
+
borderRadius: "10px",
|
|
73
|
+
overflow: "hidden"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: o.children
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
f.displayName = "BsyModal";
|
|
80
|
+
//#endregion
|
|
81
|
+
export { f as t };
|
package/dist/Modal/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
import "../Icon/Icon-DppVOyPK.js";
|
|
2
|
+
import { t as e } from "./Modal-FVJpbEgw.js";
|
|
3
|
+
export { e as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/NotFoundContent/NotFoundContent.tsx
|
|
3
|
+
var t = ({ text: t, className: n = "" }) => /* @__PURE__ */ e("div", {
|
|
4
|
+
className: `text-center text-sm line-height-normal text-[#999] py-[7px] ${n}`,
|
|
5
|
+
children: /* @__PURE__ */ e("span", { children: t })
|
|
6
|
+
});
|
|
7
|
+
t.displayName = "BsyNotFoundContent";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { t as e } from "../vendors/lodash-es-Bu9xU1fK.js";
|
|
2
|
+
import { t } from "../vendors/clsx-DNOE4Gl8.js";
|
|
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 { useControllableValue as s } from "ahooks";
|
|
6
|
+
//#region src/components/Radio/context/context.ts
|
|
7
|
+
var c = i(null), l = /* @__PURE__ */ function(e) {
|
|
8
|
+
return e.NONE = "none", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e;
|
|
9
|
+
}({}), u = {
|
|
10
|
+
"bsy-radio": "_bsy-radio_q02xg_1",
|
|
11
|
+
"bsy-radio--disabled": "_bsy-radio--disabled_q02xg_8",
|
|
12
|
+
"bsy-radio--full-width": "_bsy-radio--full-width_q02xg_11",
|
|
13
|
+
"bsy-radio__input": "_bsy-radio__input_q02xg_14",
|
|
14
|
+
"bsy-radio__input--checked": "_bsy-radio__input--checked_q02xg_38",
|
|
15
|
+
"bsy-radio__input--disabled": "_bsy-radio__input--disabled_q02xg_45",
|
|
16
|
+
"bsy-radio__label": "_bsy-radio__label_q02xg_60",
|
|
17
|
+
"bsy-radio__label--left": "_bsy-radio__label--left_q02xg_65",
|
|
18
|
+
"bsy-radio-group": "_bsy-radio-group_q02xg_75",
|
|
19
|
+
"bsy-radio-group--none": "_bsy-radio-group--none_q02xg_78",
|
|
20
|
+
"bsy-radio-group--vertical": "_bsy-radio-group--vertical_q02xg_81",
|
|
21
|
+
"bsy-radio-group--horizontal": "_bsy-radio-group--horizontal_q02xg_85"
|
|
22
|
+
}, d = a((i, a) => {
|
|
23
|
+
let { checked: s, onChange: d, value: f = e("radio"), disabled: p = !1, children: m, style: h, labelPosition: g = "right", className: _ } = i, v = o(c), y = v ? v.value === f : s, b = () => {
|
|
24
|
+
p || v?.disabled || (v ? y ? v.onDeselect?.(f) : v.onChange?.(f) : d?.(!y));
|
|
25
|
+
}, x = p || v?.disabled, S = v?.layout === l.NONE || !v?.layout, C = t(u["bsy-radio"], {
|
|
26
|
+
[u["bsy-radio--disabled"]]: x,
|
|
27
|
+
[u["bsy-radio--full-width"]]: S
|
|
28
|
+
}, _), w = t(u["bsy-radio__input"], {
|
|
29
|
+
[u["bsy-radio__input--checked"]]: y,
|
|
30
|
+
[u["bsy-radio__input--disabled"]]: x
|
|
31
|
+
}), T = t(u["bsy-radio__label"], { [u["bsy-radio__label--left"]]: g === "left" });
|
|
32
|
+
return /* @__PURE__ */ r("div", {
|
|
33
|
+
role: "radio",
|
|
34
|
+
className: C,
|
|
35
|
+
onClick: b,
|
|
36
|
+
style: h,
|
|
37
|
+
children: [/* @__PURE__ */ n("div", {
|
|
38
|
+
ref: a,
|
|
39
|
+
role: "radio",
|
|
40
|
+
"aria-checked": y,
|
|
41
|
+
tabIndex: x ? -1 : 0,
|
|
42
|
+
className: w,
|
|
43
|
+
"data-layout": v?.layout
|
|
44
|
+
}), m && /* @__PURE__ */ n("span", {
|
|
45
|
+
className: T,
|
|
46
|
+
children: m
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
d.displayName = "BsyRadio";
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/Radio/Group.tsx
|
|
53
|
+
var f = ({ disabled: e, layout: r = l.NONE, children: i, className: a, style: o, onDeselect: d, ...f }) => {
|
|
54
|
+
let [p, m] = s(f, {
|
|
55
|
+
defaultValue: "",
|
|
56
|
+
valuePropName: "value",
|
|
57
|
+
defaultValuePropName: "defaultValue",
|
|
58
|
+
trigger: "onChange"
|
|
59
|
+
}), h = t(u["bsy-radio-group"], {
|
|
60
|
+
[u["bsy-radio-group--none"]]: r === l.NONE,
|
|
61
|
+
[u["bsy-radio-group--vertical"]]: r === l.VERTICAL,
|
|
62
|
+
[u["bsy-radio-group--horizontal"]]: r === l.HORIZONTAL
|
|
63
|
+
}, a);
|
|
64
|
+
return /* @__PURE__ */ n(c.Provider, {
|
|
65
|
+
value: {
|
|
66
|
+
value: p,
|
|
67
|
+
onChange: m,
|
|
68
|
+
disabled: e,
|
|
69
|
+
layout: r,
|
|
70
|
+
onDeselect: d
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ n("div", {
|
|
73
|
+
className: h,
|
|
74
|
+
style: o,
|
|
75
|
+
children: i
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
f.displayName = "BsyRadioGroup";
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/components/Radio/index.ts
|
|
82
|
+
var p = d;
|
|
83
|
+
p.Group = f;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { p as t };
|
package/dist/Radio/index.js
CHANGED
|
@@ -1,105 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { c as n } from "../vendors/clsx-OuTLNxxd.js";
|
|
4
|
-
import { u as w } from "../vendors/lodash-es-DFpaJB4Y.js";
|
|
5
|
-
import { useControllableValue as z } from "ahooks";
|
|
6
|
-
const N = I(null);
|
|
7
|
-
var o = /* @__PURE__ */ ((i) => (i.NONE = "none", i.HORIZONTAL = "horizontal", i.VERTICAL = "vertical", i))(o || {});
|
|
8
|
-
const s = {
|
|
9
|
-
"bsy-radio": "_bsy-radio_q02xg_1",
|
|
10
|
-
"bsy-radio--disabled": "_bsy-radio--disabled_q02xg_8",
|
|
11
|
-
"bsy-radio--full-width": "_bsy-radio--full-width_q02xg_11",
|
|
12
|
-
"bsy-radio__input": "_bsy-radio__input_q02xg_14",
|
|
13
|
-
"bsy-radio__input--checked": "_bsy-radio__input--checked_q02xg_38",
|
|
14
|
-
"bsy-radio__input--disabled": "_bsy-radio__input--disabled_q02xg_45",
|
|
15
|
-
"bsy-radio__label": "_bsy-radio__label_q02xg_60",
|
|
16
|
-
"bsy-radio__label--left": "_bsy-radio__label--left_q02xg_65",
|
|
17
|
-
"bsy-radio-group": "_bsy-radio-group_q02xg_75",
|
|
18
|
-
"bsy-radio-group--none": "_bsy-radio-group--none_q02xg_78",
|
|
19
|
-
"bsy-radio-group--vertical": "_bsy-radio-group--vertical_q02xg_81",
|
|
20
|
-
"bsy-radio-group--horizontal": "_bsy-radio-group--horizontal_q02xg_85"
|
|
21
|
-
}, g = O((i, e) => {
|
|
22
|
-
const {
|
|
23
|
-
checked: c,
|
|
24
|
-
onChange: d,
|
|
25
|
-
value: l = w("radio"),
|
|
26
|
-
disabled: r = !1,
|
|
27
|
-
children: _,
|
|
28
|
-
style: u,
|
|
29
|
-
labelPosition: y = "right",
|
|
30
|
-
className: p
|
|
31
|
-
} = i, a = P(N), b = a ? a.value === l : c, q = () => {
|
|
32
|
-
var f, m;
|
|
33
|
-
r || a != null && a.disabled || (a ? b ? (m = a.onDeselect) == null || m.call(a, l) : (f = a.onChange) == null || f.call(a, l) : d == null || d(!b));
|
|
34
|
-
}, h = r || (a == null ? void 0 : a.disabled), R = (a == null ? void 0 : a.layout) === o.NONE || !(a != null && a.layout), k = n(
|
|
35
|
-
s["bsy-radio"],
|
|
36
|
-
{
|
|
37
|
-
[s["bsy-radio--disabled"]]: h,
|
|
38
|
-
[s["bsy-radio--full-width"]]: R
|
|
39
|
-
},
|
|
40
|
-
p
|
|
41
|
-
), x = n(s["bsy-radio__input"], {
|
|
42
|
-
[s["bsy-radio__input--checked"]]: b,
|
|
43
|
-
[s["bsy-radio__input--disabled"]]: h
|
|
44
|
-
}), V = n(s["bsy-radio__label"], {
|
|
45
|
-
[s["bsy-radio__label--left"]]: y === "left"
|
|
46
|
-
});
|
|
47
|
-
return /* @__PURE__ */ E("div", { role: "radio", className: k, onClick: q, style: u, children: [
|
|
48
|
-
/* @__PURE__ */ t(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
ref: e,
|
|
52
|
-
role: "radio",
|
|
53
|
-
"aria-checked": b,
|
|
54
|
-
tabIndex: h ? -1 : 0,
|
|
55
|
-
className: x,
|
|
56
|
-
"data-layout": a == null ? void 0 : a.layout
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
_ && /* @__PURE__ */ t("span", { className: V, children: _ })
|
|
60
|
-
] });
|
|
61
|
-
});
|
|
62
|
-
g.displayName = "BsyRadio";
|
|
63
|
-
const v = ({
|
|
64
|
-
disabled: i,
|
|
65
|
-
layout: e = o.NONE,
|
|
66
|
-
children: c,
|
|
67
|
-
className: d,
|
|
68
|
-
style: l,
|
|
69
|
-
onDeselect: r,
|
|
70
|
-
..._
|
|
71
|
-
}) => {
|
|
72
|
-
const [u, y] = z(_, {
|
|
73
|
-
defaultValue: "",
|
|
74
|
-
valuePropName: "value",
|
|
75
|
-
defaultValuePropName: "defaultValue",
|
|
76
|
-
trigger: "onChange"
|
|
77
|
-
}), p = n(
|
|
78
|
-
s["bsy-radio-group"],
|
|
79
|
-
{
|
|
80
|
-
[s["bsy-radio-group--none"]]: e === o.NONE,
|
|
81
|
-
[s["bsy-radio-group--vertical"]]: e === o.VERTICAL,
|
|
82
|
-
[s["bsy-radio-group--horizontal"]]: e === o.HORIZONTAL
|
|
83
|
-
},
|
|
84
|
-
d
|
|
85
|
-
);
|
|
86
|
-
return /* @__PURE__ */ t(
|
|
87
|
-
N.Provider,
|
|
88
|
-
{
|
|
89
|
-
value: {
|
|
90
|
-
value: u,
|
|
91
|
-
onChange: y,
|
|
92
|
-
disabled: i,
|
|
93
|
-
layout: e,
|
|
94
|
-
onDeselect: r
|
|
95
|
-
},
|
|
96
|
-
children: /* @__PURE__ */ t("div", { className: p, style: l, children: c })
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
v.displayName = "BsyRadioGroup";
|
|
101
|
-
const G = g;
|
|
102
|
-
G.Group = v;
|
|
103
|
-
export {
|
|
104
|
-
G as default
|
|
105
|
-
};
|
|
1
|
+
import { t as e } from "./Radio-dyoBNiKF.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { t as e } from "../vendors/clsx-DNOE4Gl8.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
4
|
+
import { useControllableValue as s } from "ahooks";
|
|
5
|
+
import { motion as c } from "motion/react";
|
|
6
|
+
//#region src/components/Segmented/Segmented.module.scss
|
|
7
|
+
var l = {
|
|
8
|
+
"bsy-segmented": "_bsy-segmented_ia83v_1",
|
|
9
|
+
"bsy-segmented--block": "_bsy-segmented--block_ia83v_12",
|
|
10
|
+
"bsy-segmented__item": "_bsy-segmented__item_ia83v_17",
|
|
11
|
+
"bsy-segmented__item--disabled": "_bsy-segmented__item--disabled_ia83v_31",
|
|
12
|
+
"bsy-segmented__item--block": "_bsy-segmented__item--block_ia83v_36",
|
|
13
|
+
"bsy-segmented__item--active": "_bsy-segmented__item--active_ia83v_44",
|
|
14
|
+
"bsy-segmented__item--inactive": "_bsy-segmented__item--inactive_ia83v_48",
|
|
15
|
+
"bsy-segmented__slider": "_bsy-segmented__slider_ia83v_53"
|
|
16
|
+
}, u = (u) => {
|
|
17
|
+
let { options: d, block: f = !1, disabled: p = !1 } = u, [m, h] = s(u), [g, _] = o({
|
|
18
|
+
width: 0,
|
|
19
|
+
left: 0
|
|
20
|
+
}), [v, y] = o(!1), b = a(null), x = a(/* @__PURE__ */ new Map()), S = r(() => {
|
|
21
|
+
let e = x.current.get(m), t = b.current;
|
|
22
|
+
if (e && t) {
|
|
23
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
24
|
+
_({
|
|
25
|
+
width: r.width,
|
|
26
|
+
left: r.left - n.left
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [m]);
|
|
30
|
+
return i(() => {
|
|
31
|
+
S();
|
|
32
|
+
let e = new ResizeObserver(S);
|
|
33
|
+
return b.current && e.observe(b.current), () => {
|
|
34
|
+
e.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [S]), /* @__PURE__ */ n("div", {
|
|
37
|
+
ref: b,
|
|
38
|
+
className: e(l["bsy-segmented"], f && l["bsy-segmented--block"]),
|
|
39
|
+
style: f ? { gridTemplateColumns: `repeat(${d.length}, 1fr)` } : void 0,
|
|
40
|
+
children: [/* @__PURE__ */ t(c.div, {
|
|
41
|
+
className: l["bsy-segmented__slider"],
|
|
42
|
+
animate: g,
|
|
43
|
+
transition: v ? {
|
|
44
|
+
type: "spring",
|
|
45
|
+
stiffness: 350,
|
|
46
|
+
damping: 35
|
|
47
|
+
} : { duration: 0 }
|
|
48
|
+
}), d.map((n) => /* @__PURE__ */ t("button", {
|
|
49
|
+
ref: (e) => {
|
|
50
|
+
e ? x.current.set(n.value, e) : x.current.delete(n.value);
|
|
51
|
+
},
|
|
52
|
+
onClick: () => {
|
|
53
|
+
p || (h(n.value), y(!0));
|
|
54
|
+
},
|
|
55
|
+
className: e(l["bsy-segmented__item"], f && l["bsy-segmented__item--block"], m === n.value ? l["bsy-segmented__item--active"] : l["bsy-segmented__item--inactive"], { [l["bsy-segmented__item--disabled"]]: p }),
|
|
56
|
+
children: n.label
|
|
57
|
+
}, n.value))]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
u.displayName = "BsySegmented";
|
|
61
|
+
//#endregion
|
|
62
|
+
export { u as t };
|
package/dist/Segmented/index.js
CHANGED