@baishuyun/ui-base 2.0.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.
- package/dist/Card/Card-DMXtN2pu.js +74 -0
- package/dist/Card/index.js +4 -0
- package/dist/ColorPicker/ColorPicker-CpPLwHR2.js +253 -0
- package/dist/ColorPicker/index.js +5 -0
- package/dist/Icon/Icon-C0bjP9U6.js +24 -0
- package/dist/Icon/index.js +4 -0
- package/dist/InputTag/index.js +137 -0
- package/dist/Modal/Modal-C1LEJ6Y0.js +80 -0
- package/dist/Modal/index.js +4 -0
- package/dist/animations/index.d.ts +118 -0
- package/dist/components/Card/Card.d.ts +4 -0
- package/dist/components/Card/Card.type.d.ts +42 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPalettes.d.ts +15 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -0
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +25 -0
- package/dist/components/ColorPicker/constants.d.ts +2 -0
- package/dist/components/ColorPicker/index.d.ts +3 -0
- package/dist/components/ColorPicker/useFloatingColorPicker.d.ts +25 -0
- package/dist/components/DropDown/interface.d.ts +121 -0
- package/dist/components/Icon/Icon.d.ts +24 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/InputTag/InputTag.d.ts +3 -0
- package/dist/components/InputTag/constants.d.ts +7 -0
- package/dist/components/InputTag/index.d.ts +2 -0
- package/dist/components/InputTag/interface.d.ts +32 -0
- package/dist/components/Modal/Modal.d.ts +4 -0
- package/dist/components/Modal/Modal.type.d.ts +22 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/hooks/useDropdownSearch.d.ts +17 -0
- package/dist/hooks/useFloatingPortal.d.ts +20 -0
- package/dist/hooks/useLocale.d.ts +12 -0
- package/dist/hooks/useTagScrollWidth.d.ts +3 -0
- package/dist/index.js +61 -0
- package/dist/locale/LocaleContext.d.ts +9 -0
- package/dist/locale/LocaleProvider.d.ts +6 -0
- package/dist/locale/index.d.ts +1 -0
- package/dist/locale/lang/en-US.json.d.ts +64 -0
- package/dist/locale/lang/zh-CN.json.d.ts +64 -0
- package/dist/style.css +1 -0
- package/dist/utils/color.d.ts +9 -0
- package/dist/vendors/clsx-OuTLNxxd.js +16 -0
- package/dist/vendors/fuse.js-l0sNRNKZ.js +1 -0
- package/dist/vendors/lexical-Bz4mqKs6.js +3 -0
- package/dist/vendors/lodash-es-DP1ViCXF.js +262 -0
- package/dist/vendors/simplebar-react-svBEsTVC.js +408 -0
- package/dist/vendors/tinycolor2-Begv3Jc8.js +711 -0
- package/dist/vite-env.d.ts +3 -0
- package/package.json +102 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs as e, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l } from "react";
|
|
3
|
+
import { c as n } from "../vendors/clsx-OuTLNxxd.js";
|
|
4
|
+
import { I as p } from "../Icon/Icon-C0bjP9U6.js";
|
|
5
|
+
const _ = {
|
|
6
|
+
"bsy-card": "_bsy-card_myftj_1",
|
|
7
|
+
"bsy-card__header": "_bsy-card__header_myftj_6",
|
|
8
|
+
"bsy-card__title": "_bsy-card__title_myftj_13",
|
|
9
|
+
"bsy-card__icon-container": "_bsy-card__icon-container_myftj_24",
|
|
10
|
+
"bsy-card__icon": "_bsy-card__icon_myftj_24",
|
|
11
|
+
"bsy-card__icon--expanded": "_bsy-card__icon--expanded_myftj_43",
|
|
12
|
+
"bsy-card__content": "_bsy-card__content_myftj_46",
|
|
13
|
+
"bsy-card__content--expanded": "_bsy-card__content--expanded_myftj_52",
|
|
14
|
+
"bsy-card__content-inner": "_bsy-card__content-inner_myftj_55"
|
|
15
|
+
}, x = ({
|
|
16
|
+
title: r,
|
|
17
|
+
children: t,
|
|
18
|
+
minWidth: s = 240,
|
|
19
|
+
defaultExpanded: i = !1,
|
|
20
|
+
className: o,
|
|
21
|
+
style: y,
|
|
22
|
+
styles: a
|
|
23
|
+
}) => {
|
|
24
|
+
const [d, b] = l(i), m = () => {
|
|
25
|
+
b(!d);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ e(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: n(_["bsy-card"], o),
|
|
31
|
+
style: {
|
|
32
|
+
minWidth: `${s}px`,
|
|
33
|
+
...y
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: _["bsy-card__header"],
|
|
40
|
+
onClick: m,
|
|
41
|
+
style: a == null ? void 0 : a.header,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ c("h3", { className: _["bsy-card__title"], children: r }),
|
|
44
|
+
/* @__PURE__ */ c("div", { className: _["bsy-card__icon-container"], children: /* @__PURE__ */ c(
|
|
45
|
+
p,
|
|
46
|
+
{
|
|
47
|
+
name: "xialakuangxiala1",
|
|
48
|
+
className: n(
|
|
49
|
+
_["bsy-card__icon"],
|
|
50
|
+
d && _["bsy-card__icon--expanded"]
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
) })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ c(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: n(
|
|
61
|
+
_["bsy-card__content"],
|
|
62
|
+
d && _["bsy-card__content--expanded"]
|
|
63
|
+
),
|
|
64
|
+
children: /* @__PURE__ */ c("div", { className: _["bsy-card__content-inner"], style: a == null ? void 0 : a.body, children: t })
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
x.displayName = "BsyCard";
|
|
72
|
+
export {
|
|
73
|
+
x as C
|
|
74
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { ColorPicker as I } from "antd";
|
|
3
|
+
import { AnimatePresence as R, motion as U } from "motion/react";
|
|
4
|
+
import { useFloating as L, offset as A, flip as x, shift as F, useClick as O, useDismiss as w, useInteractions as T, FloatingPortal as E } from "@floating-ui/react";
|
|
5
|
+
import { createContext as z, useState as g, useContext as B, isValidElement as D, cloneElement as V, useRef as M } from "react";
|
|
6
|
+
import { useControllableValue as j } from "ahooks";
|
|
7
|
+
import { I as k } from "../Icon/Icon-C0bjP9U6.js";
|
|
8
|
+
import { c as q } from "../vendors/clsx-OuTLNxxd.js";
|
|
9
|
+
import { t as d } from "../vendors/tinycolor2-Begv3Jc8.js";
|
|
10
|
+
import { a as u, b as G } from "../vendors/lodash-es-DP1ViCXF.js";
|
|
11
|
+
const $ = "请选择", H = "搜索", J = "未搜索到任何数据", K = "全选", Q = "请输入内容", W = "没有可选择的数据", X = "未搜索到任何数据", Y = "数据搜索中...", Z = "搜索结果全选", oo = "左对齐", eo = "居中对齐", ro = "右对齐", to = "下划线", co = "链接", so = "超链接", lo = "显示文本", no = "链接地址", io = "在新页面打开", ao = "确认", _o = "取消", mo = "取消链接", po = "预设颜色", go = { linkTip: "支持https://链接 或者@表单别名", bold: "加粗", italic: "倾斜", fontSize: "字号", fontColor: "颜色", fill: "填充", alignment: "对齐方式", centerAlign: "居中对齐", rightAlign: "右对齐", uploadImage: "上传图片", imageUrl: "图片URL", imageUrlPlaceholder: "请输入图片URL", imageUrlRequired: "请输入图片URL", imageUrlInvalid: "请输入有效的图片URL", imageUrlNote: "注:输入图片URL即可插入图片", inputImageUrl: "输入图片URL", uploadImageNote: "注:单个图片大小不能超过1MB", uploadImageText: "点击或拖拽上传图片", previewImage: "预览图片", underline: "下划线", imageFormatOnly: "只支持图片格式", imageSizeNote: "注:图片大小不能超过 1MB", uploadImageFirst: "请先上传图片", imageAddSuccess: "图片添加成功", operationFailed: "操作失败", onlyImageFormatsSupported: "仅支持图片格式", pleaseUploadImageFirst: "请先上传图片", clickOrDragToUpload: "点击或拖拽上传图片", enterImageUrl: "输入图片URL", pleaseEnterImageUrl: "请输入图片URL", pleaseEnterValidImageUrl: "请输入有效的图片URL", linkAddressEmpty: "链接地址不能为空" }, bo = "图片", uo = "添加图片", ko = "自定义颜色", yo = {
|
|
12
|
+
select: $,
|
|
13
|
+
search: H,
|
|
14
|
+
noFindData: J,
|
|
15
|
+
allSelect: K,
|
|
16
|
+
context: Q,
|
|
17
|
+
noData: W,
|
|
18
|
+
noDataFound: X,
|
|
19
|
+
dataSearching: Y,
|
|
20
|
+
allSelectedBySearch: Z,
|
|
21
|
+
leftAlign: oo,
|
|
22
|
+
centerAlign: eo,
|
|
23
|
+
rightAlign: ro,
|
|
24
|
+
underline: to,
|
|
25
|
+
link: co,
|
|
26
|
+
hyperLink: so,
|
|
27
|
+
showContent: lo,
|
|
28
|
+
linkAddress: no,
|
|
29
|
+
openInNewTab: io,
|
|
30
|
+
confirm: ao,
|
|
31
|
+
cancel: _o,
|
|
32
|
+
cancelLink: mo,
|
|
33
|
+
presetColors: po,
|
|
34
|
+
editor: go,
|
|
35
|
+
picture: bo,
|
|
36
|
+
addPicture: uo,
|
|
37
|
+
customColor: ko
|
|
38
|
+
}, fo = (e) => {
|
|
39
|
+
const o = e.split(".");
|
|
40
|
+
let r = yo;
|
|
41
|
+
try {
|
|
42
|
+
for (const l of o)
|
|
43
|
+
r = r[l];
|
|
44
|
+
return typeof r == "string" ? r : e;
|
|
45
|
+
} catch {
|
|
46
|
+
return e;
|
|
47
|
+
}
|
|
48
|
+
}, Co = z({
|
|
49
|
+
locale: "zh-CN",
|
|
50
|
+
t: fo
|
|
51
|
+
}), ho = [
|
|
52
|
+
"rgba(240, 102, 72, 1)",
|
|
53
|
+
// #F06648
|
|
54
|
+
"rgba(255, 197, 2, 1)",
|
|
55
|
+
// #FFC502
|
|
56
|
+
"rgba(74, 204, 140, 1)",
|
|
57
|
+
// #4ACC8C
|
|
58
|
+
"rgba(74, 192, 236, 1)",
|
|
59
|
+
// #4AC0EC
|
|
60
|
+
"rgba(255, 153, 33, 1)",
|
|
61
|
+
// #ff9921
|
|
62
|
+
"rgba(101, 101, 101, 1)",
|
|
63
|
+
// #656565
|
|
64
|
+
"rgba(255, 156, 136, 1)",
|
|
65
|
+
// #ff9c88
|
|
66
|
+
"rgba(98, 98, 206, 1)",
|
|
67
|
+
// #6262ce
|
|
68
|
+
"rgba(241, 104, 182, 1)",
|
|
69
|
+
// #f168b6
|
|
70
|
+
"rgba(55, 103, 241, 1)",
|
|
71
|
+
// #3767f1
|
|
72
|
+
"rgba(162, 206, 30, 1)",
|
|
73
|
+
// #a2ce1e
|
|
74
|
+
"rgba(179, 179, 179, 1)",
|
|
75
|
+
// #b3b3b3
|
|
76
|
+
"rgba(0, 0, 0, 1)",
|
|
77
|
+
// #000000
|
|
78
|
+
"rgba(102, 102, 102, 1)",
|
|
79
|
+
// #666
|
|
80
|
+
"rgba(153, 153, 153, 1)",
|
|
81
|
+
// #999
|
|
82
|
+
"rgba(194, 194, 194, 1)",
|
|
83
|
+
// #c2c2c2
|
|
84
|
+
"rgba(224, 224, 224, 1)",
|
|
85
|
+
// #e0e0e0
|
|
86
|
+
"rgba(77, 96, 159, 1)"
|
|
87
|
+
// #4d609f
|
|
88
|
+
], vo = (e = "bottom-start") => {
|
|
89
|
+
const [o, r] = g(!1), { refs: l, floatingStyles: c, context: a } = L({
|
|
90
|
+
open: o,
|
|
91
|
+
onOpenChange: r,
|
|
92
|
+
placement: e,
|
|
93
|
+
middleware: [
|
|
94
|
+
A(4),
|
|
95
|
+
// 浮层与触发器间距
|
|
96
|
+
x(),
|
|
97
|
+
// 超出边界时自动翻转
|
|
98
|
+
F({ padding: 8 })
|
|
99
|
+
// 自动避开边界
|
|
100
|
+
]
|
|
101
|
+
}), i = O(a), _ = w(a), { getReferenceProps: n, getFloatingProps: p } = T([i, _]);
|
|
102
|
+
return {
|
|
103
|
+
isOpen: o,
|
|
104
|
+
refs: l,
|
|
105
|
+
floatingStyles: c,
|
|
106
|
+
getReferenceProps: n,
|
|
107
|
+
getFloatingProps: p,
|
|
108
|
+
setIsOpen: r
|
|
109
|
+
};
|
|
110
|
+
}, s = {
|
|
111
|
+
"bsy-color-picker__floating": "_bsy-color-picker__floating_1kfi6_1",
|
|
112
|
+
"bsy-color-picker__content": "_bsy-color-picker__content_1kfi6_4",
|
|
113
|
+
"bsy-color-picker__grid": "_bsy-color-picker__grid_1kfi6_11",
|
|
114
|
+
"bsy-color-picker__preset-colors-title": "_bsy-color-picker__preset-colors-title_1kfi6_15",
|
|
115
|
+
"bsy-color-picker__preset-colors-grid": "_bsy-color-picker__preset-colors-grid_1kfi6_19",
|
|
116
|
+
"bsy-color-picker__preset-colors-item": "_bsy-color-picker__preset-colors-item_1kfi6_24",
|
|
117
|
+
"bsy-color-picker__custom-color-title": "_bsy-color-picker__custom-color-title_1kfi6_47",
|
|
118
|
+
"bsy-color-picker__custom-color-btn": "_bsy-color-picker__custom-color-btn_1kfi6_51",
|
|
119
|
+
"bsy-color-picker__custom-color-btn--active": "_bsy-color-picker__custom-color-btn--active_1kfi6_61",
|
|
120
|
+
"bsy-color-picker__custom-color-btn--preview": "_bsy-color-picker__custom-color-btn--preview_1kfi6_65",
|
|
121
|
+
"bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_1kfi6_68",
|
|
122
|
+
"bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_1kfi6_72"
|
|
123
|
+
}, y = () => B(Co), f = (e, o) => {
|
|
124
|
+
if (u(e) || u(o))
|
|
125
|
+
return !1;
|
|
126
|
+
const r = d(e).toRgbString(), l = d(o).toRgbString();
|
|
127
|
+
return r === l;
|
|
128
|
+
}, C = ({
|
|
129
|
+
currentColor: e,
|
|
130
|
+
onColorSelect: o,
|
|
131
|
+
options: r,
|
|
132
|
+
style: l
|
|
133
|
+
}) => /* @__PURE__ */ t("div", { className: s["bsy-color-picker__preset-colors-grid"], style: l, children: r.map((c) => /* @__PURE__ */ t(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: s["bsy-color-picker__preset-colors-item"],
|
|
137
|
+
style: {
|
|
138
|
+
backgroundColor: c,
|
|
139
|
+
"--hover-color": d(c).setAlpha(0.5).toRgbString()
|
|
140
|
+
},
|
|
141
|
+
onClick: () => o(c),
|
|
142
|
+
children: f(e, c) && /* @__PURE__ */ t(k, { name: "checkthebox", className: s["bsy-color-picker__check-icon"] })
|
|
143
|
+
},
|
|
144
|
+
c
|
|
145
|
+
)) }), No = {
|
|
146
|
+
initial: { opacity: 0, scale: 0.95, y: -4 },
|
|
147
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
148
|
+
exit: { opacity: 0, scale: 0.95, y: -4 },
|
|
149
|
+
transition: { duration: 0.2, ease: "easeOut" }
|
|
150
|
+
}, Po = (e) => {
|
|
151
|
+
const { children: o, placement: r = "bottom-start", disabled: l = !1, presetColors: c } = e, { t: a } = y(), [i, _] = j(e, {
|
|
152
|
+
defaultValue: e.value
|
|
153
|
+
}), { isOpen: n, refs: p, floatingStyles: h, getReferenceProps: v, getFloatingProps: N } = vo(r), P = D(o) ? V(o, {
|
|
154
|
+
...v(),
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
ref: p.setReference,
|
|
157
|
+
disabled: l
|
|
158
|
+
}) : o, b = G(c) && c.length ? c : ho;
|
|
159
|
+
return /* @__PURE__ */ m(S, { children: [
|
|
160
|
+
P,
|
|
161
|
+
/* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(R, { children: n && /* @__PURE__ */ t(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
ref: p.setFloating,
|
|
165
|
+
style: h,
|
|
166
|
+
...N(),
|
|
167
|
+
className: s["bsy-color-picker__floating"],
|
|
168
|
+
children: /* @__PURE__ */ t(U.div, { ...No, children: /* @__PURE__ */ t("div", { className: s["bsy-color-picker__content"], children: /* @__PURE__ */ m("div", { className: s["bsy-color-picker__grid"], children: [
|
|
169
|
+
/* @__PURE__ */ m("div", { className: s["bsy-color-picker__preset-colors"], children: [
|
|
170
|
+
/* @__PURE__ */ t("div", { className: s["bsy-color-picker__preset-colors-title"], children: a("presetColors") }),
|
|
171
|
+
/* @__PURE__ */ t(
|
|
172
|
+
C,
|
|
173
|
+
{
|
|
174
|
+
currentColor: i,
|
|
175
|
+
onColorSelect: _,
|
|
176
|
+
options: b
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ t(
|
|
181
|
+
So,
|
|
182
|
+
{
|
|
183
|
+
value: i,
|
|
184
|
+
onChange: _,
|
|
185
|
+
options: b
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }) }) })
|
|
189
|
+
}
|
|
190
|
+
) }) })
|
|
191
|
+
] });
|
|
192
|
+
}, So = (e) => {
|
|
193
|
+
const [o, r] = g(), [l, c] = g(!1), a = e.options.some((n) => f(n, e.value)), i = M(a ? [] : [e.value]), { t: _ } = y();
|
|
194
|
+
return /* @__PURE__ */ m("div", { className: s["bsy-color-picker__custom-color"], children: [
|
|
195
|
+
/* @__PURE__ */ t("div", { className: s["bsy-color-picker__custom-color-title"], children: _("customColor") }),
|
|
196
|
+
/* @__PURE__ */ m("div", { className: s["bsy-color-picker__custom-color-content"], children: [
|
|
197
|
+
/* @__PURE__ */ t(
|
|
198
|
+
I,
|
|
199
|
+
{
|
|
200
|
+
value: o,
|
|
201
|
+
onChange: (n) => r(n.toRgbString()),
|
|
202
|
+
open: l,
|
|
203
|
+
onOpenChange: (n) => {
|
|
204
|
+
c(n), !n && o && (i.current.includes(o) || i.current.unshift(o), e.onChange(o), r(void 0));
|
|
205
|
+
},
|
|
206
|
+
children: /* @__PURE__ */ t(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: q(s["bsy-color-picker__custom-color-btn"], {
|
|
210
|
+
[s["bsy-color-picker__custom-color-btn--active"]]: l && !o,
|
|
211
|
+
[s["bsy-color-picker__custom-color-btn--preview"]]: !!o
|
|
212
|
+
}),
|
|
213
|
+
role: "button",
|
|
214
|
+
style: {
|
|
215
|
+
backgroundColor: o || void 0
|
|
216
|
+
},
|
|
217
|
+
onClick: () => {
|
|
218
|
+
c(!0);
|
|
219
|
+
},
|
|
220
|
+
children: /* @__PURE__ */ t(
|
|
221
|
+
k,
|
|
222
|
+
{
|
|
223
|
+
name: "add",
|
|
224
|
+
style: {
|
|
225
|
+
visibility: o ? "hidden" : "visible"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ t(
|
|
234
|
+
C,
|
|
235
|
+
{
|
|
236
|
+
currentColor: e.value,
|
|
237
|
+
onColorSelect: e.onChange,
|
|
238
|
+
options: i.current.slice(0, 5),
|
|
239
|
+
style: {
|
|
240
|
+
gridTemplateColumns: "repeat(5, 1fr)"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] })
|
|
245
|
+
] });
|
|
246
|
+
};
|
|
247
|
+
Po.displayName = "BsyColorPicker";
|
|
248
|
+
export {
|
|
249
|
+
Po as C,
|
|
250
|
+
Co as L,
|
|
251
|
+
ho as a,
|
|
252
|
+
yo as z
|
|
253
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { createFromIconfontCN as e } from "@ant-design/icons";
|
|
3
|
+
import { i as a } from "../vendors/lodash-es-DP1ViCXF.js";
|
|
4
|
+
const f = e({
|
|
5
|
+
scriptUrl: "https://at.alicdn.com/t/c/font_4786625_jgu2jvbpehp.js"
|
|
6
|
+
}), I = ({ name: o, style: n, className: r, onClick: c, color: s, size: t = 16 }) => {
|
|
7
|
+
const m = {
|
|
8
|
+
color: s,
|
|
9
|
+
fontSize: a(t) ? `${t}px` : t,
|
|
10
|
+
...n
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ p(
|
|
13
|
+
f,
|
|
14
|
+
{
|
|
15
|
+
onClick: c,
|
|
16
|
+
type: `icon-${o}`,
|
|
17
|
+
style: m,
|
|
18
|
+
className: `${r || ""}`
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
I
|
|
24
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsxs as C, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableValue as A } from "ahooks";
|
|
3
|
+
import { useState as S, useLayoutEffect as k, useRef as p, useEffect as D } from "react";
|
|
4
|
+
import { c as h } from "../vendors/clsx-OuTLNxxd.js";
|
|
5
|
+
import { I as M } from "../Icon/Icon-C0bjP9U6.js";
|
|
6
|
+
import { motion as O } from "motion/react";
|
|
7
|
+
import { S as V } from "../vendors/simplebar-react-svBEsTVC.js";
|
|
8
|
+
const g = {
|
|
9
|
+
"bsy-inputTag": "_bsy-inputTag_46spj_11",
|
|
10
|
+
"bsy-inputTag__container": "_bsy-inputTag__container_46spj_22",
|
|
11
|
+
"bsy-inputTag__inputContainer": "_bsy-inputTag__inputContainer_46spj_27",
|
|
12
|
+
"bsy-inputTag__inputContainer--zeroMargin": "_bsy-inputTag__inputContainer--zeroMargin_46spj_37",
|
|
13
|
+
"bsy-inputTag__input": "_bsy-inputTag__input_46spj_27"
|
|
14
|
+
}, d = {
|
|
15
|
+
GAP: 4,
|
|
16
|
+
OFFSET: 3,
|
|
17
|
+
CONTAINER_PADDING: 10,
|
|
18
|
+
INPUT_MARGIN: 4
|
|
19
|
+
}, z = (s, _) => {
|
|
20
|
+
const [a, f] = S(0);
|
|
21
|
+
return k(() => {
|
|
22
|
+
if (s.current) {
|
|
23
|
+
const i = s.current.children;
|
|
24
|
+
let e = 0;
|
|
25
|
+
for (let r = 0; r < i.length; r++)
|
|
26
|
+
e += i[r].clientWidth;
|
|
27
|
+
const u = (i.length - 1) * d.GAP;
|
|
28
|
+
f(e + u + d.OFFSET);
|
|
29
|
+
}
|
|
30
|
+
}, [_, s]), a;
|
|
31
|
+
}, B = (s) => {
|
|
32
|
+
const { defaultValue: _, enableActive: a = !1, defaultActiveIndex: f, onActiveIndexChange: i } = s, [e, u] = A(s, {
|
|
33
|
+
defaultValue: _ || []
|
|
34
|
+
}), [r, w] = A(
|
|
35
|
+
s,
|
|
36
|
+
{
|
|
37
|
+
valuePropName: "activeIndex",
|
|
38
|
+
trigger: "onActiveIndexChange",
|
|
39
|
+
defaultValue: f
|
|
40
|
+
}
|
|
41
|
+
), [T, x] = S(""), m = p(null), c = p(null), y = p(null), b = p(!1), E = () => {
|
|
42
|
+
if (c.current && c.current.children.length > 0) {
|
|
43
|
+
const t = c.current.children.length - 1;
|
|
44
|
+
c.current.children[t].scrollIntoView({
|
|
45
|
+
behavior: "smooth",
|
|
46
|
+
block: "nearest",
|
|
47
|
+
inline: "end"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
D(() => {
|
|
52
|
+
b.current && e.length > 0 && (E(), b.current = !1);
|
|
53
|
+
}, [e.length]);
|
|
54
|
+
const W = (t) => {
|
|
55
|
+
x(t.currentTarget.value);
|
|
56
|
+
}, N = () => {
|
|
57
|
+
const t = T.trim();
|
|
58
|
+
if (t !== "") {
|
|
59
|
+
const n = t;
|
|
60
|
+
b.current = !0, u([...e, n]), x("");
|
|
61
|
+
}
|
|
62
|
+
}, G = (t, n) => {
|
|
63
|
+
if (!a) return;
|
|
64
|
+
const o = r === t ? void 0 : t;
|
|
65
|
+
w(o), i == null || i(o ?? -1, n);
|
|
66
|
+
}, P = (t) => {
|
|
67
|
+
t.key === "Enter" || t.key === "NumpadEnter" ? N() : t.key === "Backspace" && T === "" && e.length > 0 && u(e.slice(0, -1));
|
|
68
|
+
}, j = (t) => {
|
|
69
|
+
u(e.filter((n, o) => o !== t));
|
|
70
|
+
}, I = p(0), v = z(c, e.length);
|
|
71
|
+
k(() => {
|
|
72
|
+
m.current && y.current && (I.current = m.current.clientWidth - y.current.clientWidth - d.INPUT_MARGIN - d.CONTAINER_PADDING);
|
|
73
|
+
}, []);
|
|
74
|
+
const R = v > I.current ? I.current : v;
|
|
75
|
+
return /* @__PURE__ */ C("div", { className: g["bsy-inputTag"], ref: m, children: [
|
|
76
|
+
/* @__PURE__ */ l("div", { className: g["bsy-inputTag__container"], children: e.length ? /* @__PURE__ */ l(V, { style: { width: R + "px" }, children: /* @__PURE__ */ l("div", { className: "flex gap-1 py-[3px]", ref: c, children: e.map((t, n) => /* @__PURE__ */ C(
|
|
77
|
+
O.div,
|
|
78
|
+
{
|
|
79
|
+
className: h(
|
|
80
|
+
"rounded-[2px] gap-1 px-[6px] h-[26px] flex items-center flex-shrink-0",
|
|
81
|
+
{
|
|
82
|
+
"cursor-pointer": a,
|
|
83
|
+
"hover:bg-[#e0e0e0]": a && r !== n,
|
|
84
|
+
"bg-[#0265ff] text-white": a && r === n,
|
|
85
|
+
"bg-[#eee] text-black": !a || r !== n
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
onClick: () => G(n, t),
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ l("span", { children: t }),
|
|
91
|
+
/* @__PURE__ */ l(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: h(
|
|
95
|
+
"cursor-pointer",
|
|
96
|
+
a && r === n ? "text-white hover:text-gray-200" : "text-[#666] hover:text-[#0265ff]"
|
|
97
|
+
),
|
|
98
|
+
onClick: (o) => {
|
|
99
|
+
o.stopPropagation(), j(n);
|
|
100
|
+
},
|
|
101
|
+
children: /* @__PURE__ */ l(M, { name: "close", size: 12 })
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
n
|
|
107
|
+
)) }) }) : null }),
|
|
108
|
+
/* @__PURE__ */ l(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
ref: y,
|
|
112
|
+
className: h(
|
|
113
|
+
g["bsy-inputTag__inputContainer"],
|
|
114
|
+
{
|
|
115
|
+
[g["bsy-inputTag__inputContainer--zeroMargin"]]: e.length === 0
|
|
116
|
+
},
|
|
117
|
+
"py-[3px]"
|
|
118
|
+
),
|
|
119
|
+
children: /* @__PURE__ */ l(
|
|
120
|
+
"input",
|
|
121
|
+
{
|
|
122
|
+
value: T,
|
|
123
|
+
onChange: W,
|
|
124
|
+
onKeyDown: P,
|
|
125
|
+
onBlur: N,
|
|
126
|
+
className: h(g["bsy-inputTag__input"], "placeholder:text-[#999]"),
|
|
127
|
+
placeholder: "输入标签"
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] });
|
|
133
|
+
};
|
|
134
|
+
B.displayName = "BsyInputTag";
|
|
135
|
+
export {
|
|
136
|
+
B as default
|
|
137
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableValue as c } from "ahooks";
|
|
3
|
+
import { Modal as r } from "antd";
|
|
4
|
+
import { useState as u } from "react";
|
|
5
|
+
import { I as n } from "../Icon/Icon-C0bjP9U6.js";
|
|
6
|
+
const f = "_modal__title_klsxr_1", b = "_modal__button_groups_klsxr_18", h = "_modal__button_klsxr_18", g = "_modal__icon_klsxr_38", l = {
|
|
7
|
+
modal__title: f,
|
|
8
|
+
modal__button_groups: b,
|
|
9
|
+
modal__button: h,
|
|
10
|
+
modal__icon: g
|
|
11
|
+
}, p = (e) => {
|
|
12
|
+
const { fullSwitch: _ = !1 } = e, [d, a] = c(e, {
|
|
13
|
+
valuePropName: "open",
|
|
14
|
+
defaultValue: !1,
|
|
15
|
+
defaultValuePropName: "defaultOpen",
|
|
16
|
+
trigger: "onOpenChange"
|
|
17
|
+
}), [t, i] = u(!1), m = e.title ? /* @__PURE__ */ s("div", { className: l.modal__title, children: [
|
|
18
|
+
/* @__PURE__ */ o("div", { className: l.modal__titleText, children: e.title }),
|
|
19
|
+
_ ? /* @__PURE__ */ s("div", { className: l.modal__button_groups, children: [
|
|
20
|
+
/* @__PURE__ */ o(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
"aria-label": "toggle fullscreen",
|
|
24
|
+
role: "button",
|
|
25
|
+
onClick: () => i(!t),
|
|
26
|
+
className: l.modal__button,
|
|
27
|
+
children: /* @__PURE__ */ o(
|
|
28
|
+
n,
|
|
29
|
+
{
|
|
30
|
+
name: t ? "quanpingsuoxiao" : "quanpingfangda",
|
|
31
|
+
className: l.modal__icon
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ o(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
role: "button",
|
|
40
|
+
"aria-label": "close",
|
|
41
|
+
onClick: () => a(!1),
|
|
42
|
+
className: l.modal__button,
|
|
43
|
+
children: /* @__PURE__ */ o(n, { name: "close", className: l.modal__icon })
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] }) : /* @__PURE__ */ o(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
role: "button",
|
|
50
|
+
"aria-label": "close",
|
|
51
|
+
onClick: () => a(!1),
|
|
52
|
+
className: l.modal__button,
|
|
53
|
+
children: /* @__PURE__ */ o(n, { name: "close", className: l.modal__icon })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] }) : null;
|
|
57
|
+
return /* @__PURE__ */ o(
|
|
58
|
+
r,
|
|
59
|
+
{
|
|
60
|
+
destroyOnHidden: !0,
|
|
61
|
+
open: d,
|
|
62
|
+
onCancel: () => a(!1),
|
|
63
|
+
footer: null,
|
|
64
|
+
title: m,
|
|
65
|
+
closable: !1,
|
|
66
|
+
width: t ? "100%" : e.width,
|
|
67
|
+
style: { transition: "width 0.3s ease" },
|
|
68
|
+
maskClosable: !1,
|
|
69
|
+
styles: {
|
|
70
|
+
header: { marginBottom: 0 },
|
|
71
|
+
content: { padding: 0, borderRadius: "10px", overflow: "hidden" }
|
|
72
|
+
},
|
|
73
|
+
children: e.children
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
p.displayName = "BsyModal";
|
|
78
|
+
export {
|
|
79
|
+
p as M
|
|
80
|
+
};
|