@baishuyun/ui-base 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/Card/Card-F2t4Rv_v.js +69 -0
  2. package/dist/Card/index.js +3 -4
  3. package/dist/CheckBox/CheckBox-DFoMXJZz.js +67 -0
  4. package/dist/CheckBox/CheckBox-q2vu7qf7.js +33 -0
  5. package/dist/CheckBox/index.js +4 -39
  6. package/dist/ColorPicker/ColorPicker-Bh4KTHxh.js +168 -0
  7. package/dist/ColorPicker/index.js +6 -5
  8. package/dist/DropDown/DropDown-BEzloRRM.js +162 -0
  9. package/dist/DropDown/index.js +7 -4
  10. package/dist/Editor/Buttons-ClWtl3G-.js +595 -0
  11. package/dist/Editor/ToolbarPlugin/Buttons/index.js +14 -8
  12. package/dist/Editor/constants/index.js +53 -20
  13. package/dist/Editor/index.js +518 -576
  14. package/dist/Icon/Icon-DXmPqVzg.js +19 -0
  15. package/dist/Icon/index.js +2 -4
  16. package/dist/InputTag/InputTag-DbiyuWo9.js +139 -0
  17. package/dist/InputTag/index.js +3 -4
  18. package/dist/Loading/Loading-Bi5NO-Ky.js +15 -0
  19. package/dist/Loading/index.js +2 -4
  20. package/dist/Modal/Modal-BO1s8pJe.js +81 -0
  21. package/dist/Modal/index.js +3 -4
  22. package/dist/NotFoundContent/NotFoundContent-CTPpcZOt.js +9 -0
  23. package/dist/NotFoundContent/index.js +2 -4
  24. package/dist/Radio/Radio-dyoBNiKF.js +85 -0
  25. package/dist/Radio/index.js +2 -105
  26. package/dist/Segmented/Segmented-Dd8glDXI.js +62 -0
  27. package/dist/Segmented/index.js +2 -4
  28. package/dist/Select/Select-DoQO-Xi5.js +729 -0
  29. package/dist/Select/SelectInputSearch-gp6gcY3x.js +46 -0
  30. package/dist/Select/index.js +11 -6
  31. package/dist/Tabs/Tabs-Dsxn_7gF.js +410 -0
  32. package/dist/Tabs/index.js +6 -7
  33. package/dist/Tree/index.js +5 -4
  34. package/dist/Tree/utils/index.js +24 -39
  35. package/dist/components/Editor/context/EditorContainerContext.d.ts +8 -0
  36. package/dist/index.js +103 -81
  37. package/dist/style.css +2 -1
  38. package/dist/vendors/Tree-DgwG7Unx.js +231 -0
  39. package/dist/vendors/animations-C5JKFkz4.js +38 -0
  40. package/dist/vendors/clsx-DNOE4Gl8.js +16 -0
  41. package/dist/vendors/color-BPWy9DvT.js +12 -0
  42. package/dist/vendors/fuse.js-BKtvbTjL.js +877 -0
  43. package/dist/vendors/lexical-hZliMgDv.js +6439 -0
  44. package/dist/vendors/lodash-es-Bu9xU1fK.js +334 -0
  45. package/dist/vendors/simplebar-react-CFlS-Nm9.js +370 -0
  46. package/dist/vendors/tinycolor2-DToeAEPD.js +726 -0
  47. package/dist/vendors/useFloatingPortal-BA6P5GxV.js +45 -0
  48. package/dist/vendors/useLocale-BfT0V1j4.js +75 -0
  49. package/package.json +4 -4
  50. package/dist/Card/Card-Y1ISqAp9.js +0 -86
  51. package/dist/CheckBox/CheckBox-C9sXWSA5.js +0 -84
  52. package/dist/ColorPicker/ColorPicker-uPJOs52x.js +0 -215
  53. package/dist/DropDown/DropDown-DGkSeXQT.js +0 -166
  54. package/dist/Editor/index-D7tFsaxU.js +0 -846
  55. package/dist/Icon/Icon-CBlIwtp2.js +0 -24
  56. package/dist/InputTag/InputTag-C-rQUJnF.js +0 -155
  57. package/dist/Loading/Loading-CEB4PLUE.js +0 -9
  58. package/dist/Modal/Modal-z3TvEXwN.js +0 -80
  59. package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +0 -6
  60. package/dist/Segmented/Segmented-UgzW78Ey.js +0 -75
  61. package/dist/Select/Select-hwXXDuLU.js +0 -820
  62. package/dist/Select/SelectInputSearch-ChUpUgxa.js +0 -34
  63. package/dist/Tabs/TabSelect-DL8Bhehc.js +0 -445
  64. package/dist/vendors/Tree-CLEy-xqz.js +0 -235
  65. package/dist/vendors/clsx-OuTLNxxd.js +0 -16
  66. package/dist/vendors/color-VzwvCPhF.js +0 -21
  67. package/dist/vendors/fuse.js-D1DCbUBb.js +0 -1022
  68. package/dist/vendors/index-MTmG1Ezy.js +0 -15
  69. package/dist/vendors/lexical-DO7eMeC2.js +0 -5891
  70. package/dist/vendors/lodash-es-DFpaJB4Y.js +0 -305
  71. package/dist/vendors/simplebar-react-D68KzE44.js +0 -408
  72. package/dist/vendors/tinycolor2-Begv3Jc8.js +0 -711
  73. package/dist/vendors/useFloatingPortal-9VUFOAOG.js +0 -45
  74. package/dist/vendors/useLocale-DgqW9M3h.js +0 -47
@@ -0,0 +1,45 @@
1
+ import { useMemo as e } from "react";
2
+ import { autoUpdate as t, flip as n, offset as r, shift as i, size as a, useClick as o, useDismiss as s, useFloating as c, useInteractions as l } from "@floating-ui/react";
3
+ //#region src/hooks/useFloatingPortal.ts
4
+ var u = (u) => {
5
+ let { isOpen: d, close: f, showMask: p, zIndex: m, zIndexMask: h, offset: g, popupMinWidth: _ } = u, { refs: v, floatingStyles: y, context: b } = c({
6
+ open: d,
7
+ onOpenChange: (e) => {
8
+ e || f();
9
+ },
10
+ placement: "bottom-start",
11
+ whileElementsMounted: t,
12
+ middleware: [
13
+ n(),
14
+ i({ padding: 8 }),
15
+ r({
16
+ mainAxis: g?.y || 0,
17
+ crossAxis: g?.x || 0
18
+ }),
19
+ a({ apply({ rects: e, elements: t }) {
20
+ Object.assign(t.floating.style, {
21
+ minWidth: _,
22
+ width: `${e.reference.width}px`,
23
+ zIndex: m
24
+ });
25
+ } })
26
+ ]
27
+ }), { getReferenceProps: x, getFloatingProps: S } = l([o(b), s(b, { outsidePress: !0 })]);
28
+ return {
29
+ refs: v,
30
+ floatingStyles: y,
31
+ context: b,
32
+ getReferenceProps: x,
33
+ getFloatingProps: S,
34
+ referenceStyle: e(() => p && d && h !== void 0 ? {
35
+ zIndex: h + 1,
36
+ position: "relative"
37
+ } : {}, [
38
+ p,
39
+ d,
40
+ h
41
+ ])
42
+ };
43
+ };
44
+ //#endregion
45
+ export { u as t };
@@ -0,0 +1,75 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ var n = {
3
+ select: "请选择",
4
+ search: "搜索",
5
+ noFindData: "未搜索到任何数据",
6
+ allSelect: "全选",
7
+ context: "请输入内容",
8
+ noData: "没有可选择的数据",
9
+ noDataFound: "未搜索到任何数据",
10
+ dataSearching: "数据搜索中...",
11
+ allSelectedBySearch: "搜索结果全选",
12
+ leftAlign: "左对齐",
13
+ centerAlign: "居中对齐",
14
+ rightAlign: "右对齐",
15
+ underline: "下划线",
16
+ link: "链接",
17
+ hyperLink: "超链接",
18
+ showContent: "显示文本",
19
+ linkAddress: "链接地址",
20
+ openInNewTab: "在新页面打开",
21
+ confirm: "确认",
22
+ cancel: "取消",
23
+ cancelLink: "取消链接",
24
+ presetColors: "预设颜色",
25
+ editor: {
26
+ linkTip: "支持https://链接 或者@表单别名",
27
+ bold: "加粗",
28
+ italic: "倾斜",
29
+ fontSize: "字号",
30
+ fontColor: "颜色",
31
+ fill: "填充",
32
+ alignment: "对齐方式",
33
+ centerAlign: "居中对齐",
34
+ rightAlign: "右对齐",
35
+ uploadImage: "上传图片",
36
+ imageUrl: "图片URL",
37
+ imageUrlPlaceholder: "请输入图片URL",
38
+ imageUrlRequired: "请输入图片URL",
39
+ imageUrlInvalid: "请输入有效的图片URL",
40
+ imageUrlNote: "注:输入图片URL即可插入图片",
41
+ inputImageUrl: "输入图片URL",
42
+ uploadImageNote: "注:单个图片大小不能超过1MB",
43
+ uploadImageText: "点击或拖拽上传图片",
44
+ previewImage: "预览图片",
45
+ underline: "下划线",
46
+ imageFormatOnly: "只支持图片格式",
47
+ imageSizeNote: "注:图片大小不能超过 1MB",
48
+ uploadImageFirst: "请先上传图片",
49
+ imageAddSuccess: "图片添加成功",
50
+ operationFailed: "操作失败",
51
+ onlyImageFormatsSupported: "仅支持图片格式",
52
+ pleaseUploadImageFirst: "请先上传图片",
53
+ clickOrDragToUpload: "点击或拖拽上传图片",
54
+ enterImageUrl: "输入图片URL",
55
+ pleaseEnterImageUrl: "请输入图片URL",
56
+ pleaseEnterValidImageUrl: "请输入有效的图片URL",
57
+ linkAddressEmpty: "链接地址不能为空"
58
+ },
59
+ picture: "图片",
60
+ addPicture: "添加图片",
61
+ customColor: "自定义颜色"
62
+ }, r = e({
63
+ locale: "zh-CN",
64
+ t: (e) => {
65
+ let t = e.split("."), r = n;
66
+ try {
67
+ for (let e of t) r = r[e];
68
+ return typeof r == "string" ? r : e;
69
+ } catch {
70
+ return e;
71
+ }
72
+ }
73
+ }), i = () => t(r);
74
+ //#endregion
75
+ export { r as n, n as r, i as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-base",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "type": "module",
5
5
  "description": "百数云低代码平台通用组件库",
6
6
  "author": "bsy-fe team",
@@ -69,7 +69,7 @@
69
69
  "@types/react": "^18.3.1",
70
70
  "@types/react-dom": "^18.3.0",
71
71
  "@types/tinycolor2": "^1.4.6",
72
- "@vitejs/plugin-react": "^4.4.1",
72
+ "@vitejs/plugin-react": "^6.0.0",
73
73
  "ahooks": "^3.8.5",
74
74
  "antd": "^5.26.2",
75
75
  "glob": "^11.0.3",
@@ -79,13 +79,13 @@
79
79
  "react-dom": "^18.3.1",
80
80
  "sass": "^1.89.2",
81
81
  "tailwindcss": "^3.0.0",
82
- "vite": "^6.3.5",
82
+ "vite": "^8.0.0",
83
83
  "vite-plugin-dts": "^4.5.3",
84
84
  "zustand": "4.5.6"
85
85
  },
86
86
  "project": {
87
87
  "iconfont": {
88
- "scriptUrl": "https://at.alicdn.com/t/c/font_4786625_djm4gsgobsp.js"
88
+ "scriptUrl": "https://at.alicdn.com/t/c/font_4786625_ofg0ibxfhle.js"
89
89
  }
90
90
  },
91
91
  "scripts": {
@@ -1,86 +0,0 @@
1
- import { jsxs as y, jsx as r } from "react/jsx-runtime";
2
- import { useState as N, useCallback as b, useMemo as h } from "react";
3
- import { c as i } from "../vendors/clsx-OuTLNxxd.js";
4
- import { I as k } from "../Icon/Icon-CBlIwtp2.js";
5
- const a = {
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
- }, I = ({
16
- title: l,
17
- children: m,
18
- minWidth: s = 240,
19
- defaultExpanded: f = !1,
20
- expanded: d,
21
- onExpandedChange: n,
22
- className: p,
23
- style: o,
24
- styles: c
25
- }) => {
26
- const [x, j] = N(f), e = d ?? x, t = b(() => {
27
- const _ = !e;
28
- d === void 0 && j(_), n == null || n(_);
29
- }, [e, d, n]), u = b(
30
- (_) => {
31
- (_.key === "Enter" || _.key === " ") && (_.preventDefault(), t());
32
- },
33
- [t]
34
- ), v = h(
35
- () => ({
36
- minWidth: `${s}px`,
37
- ...o
38
- }),
39
- [s, o]
40
- );
41
- return /* @__PURE__ */ y("div", { className: i(a["bsy-card"], p), style: v, children: [
42
- /* @__PURE__ */ y(
43
- "div",
44
- {
45
- className: a["bsy-card__header"],
46
- onClick: t,
47
- onKeyDown: u,
48
- role: "button",
49
- tabIndex: 0,
50
- "aria-expanded": e,
51
- "aria-controls": "card-content",
52
- style: c == null ? void 0 : c.header,
53
- children: [
54
- /* @__PURE__ */ r("div", { className: a["bsy-card__title"], id: "card-title", role: "heading", children: l }),
55
- /* @__PURE__ */ r("div", { className: a["bsy-card__icon-container"], children: /* @__PURE__ */ r(
56
- k,
57
- {
58
- name: "xialakuangxiala1",
59
- className: i(
60
- a["bsy-card__icon"],
61
- e && a["bsy-card__icon--expanded"]
62
- )
63
- }
64
- ) })
65
- ]
66
- }
67
- ),
68
- /* @__PURE__ */ r(
69
- "div",
70
- {
71
- id: "card-content",
72
- role: "region",
73
- "aria-labelledby": "card-title",
74
- className: i(
75
- a["bsy-card__content"],
76
- e && a["bsy-card__content--expanded"]
77
- ),
78
- children: /* @__PURE__ */ r("div", { className: a["bsy-card__content-inner"], style: c == null ? void 0 : c.body, children: m })
79
- }
80
- )
81
- ] });
82
- };
83
- I.displayName = "BsyCard";
84
- export {
85
- I as C
86
- };
@@ -1,84 +0,0 @@
1
- import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
- import { createContext as B, forwardRef as E, useContext as R } from "react";
3
- import { I as j } from "../Icon/Icon-CBlIwtp2.js";
4
- import { c as i } from "../vendors/clsx-OuTLNxxd.js";
5
- import { u as O } from "../vendors/lodash-es-DFpaJB4Y.js";
6
- const P = B(null), V = "_checkbox_vheru_1", q = "_checkbox__inner_vheru_32", o = {
7
- checkbox: V,
8
- "checkbox--checked": "_checkbox--checked_vheru_12",
9
- "checkbox--unchecked": "_checkbox--unchecked_vheru_16",
10
- "checkbox--indeterminate": "_checkbox--indeterminate_vheru_23",
11
- "checkbox--disabled": "_checkbox--disabled_vheru_27",
12
- checkbox__inner: q,
13
- "checkbox__inner--disabled": "_checkbox__inner--disabled_vheru_38"
14
- }, z = ({ isChecked: c = !1, indeterminate: a = !1, disabled: h = !1 }) => {
15
- const n = a ? "indeterminate" : c ? "checked" : "unchecked", s = i(o.checkbox, {
16
- [o["checkbox--checked"]]: !h && n === "checked",
17
- [o["checkbox--unchecked"]]: !h && n === "unchecked",
18
- [o["checkbox--indeterminate"]]: !h && n === "indeterminate",
19
- [o["checkbox--disabled"]]: h
20
- }), b = i(o.checkbox__inner, {
21
- [o["checkbox__inner--disabled"]]: h
22
- });
23
- return /* @__PURE__ */ m("div", { className: s, children: [
24
- n === "checked" && /* @__PURE__ */ l(j, { name: "checkthebox", color: h ? "#b8b8b8" : "#fff" }),
25
- n === "indeterminate" && /* @__PURE__ */ l("div", { className: b })
26
- ] });
27
- };
28
- var v = /* @__PURE__ */ ((c) => (c.NONE = "none", c.HORIZONTAL = "horizontal", c.VERTICAL = "vertical", c))(v || {});
29
- const t = {
30
- "bsy-checkbox": "_bsy-checkbox_1372g_1",
31
- "bsy-checkbox--full-width": "_bsy-checkbox--full-width_1372g_8",
32
- "bsy-checkbox__button--left-label": "_bsy-checkbox__button--left-label_1372g_45"
33
- }, $ = E((c, a) => {
34
- var r;
35
- const {
36
- checked: h,
37
- indeterminate: n = !1,
38
- onChange: s,
39
- value: b = O("checkbox"),
40
- disabled: d = !1,
41
- children: y,
42
- style: N,
43
- labelPosition: I = "right"
44
- } = c, e = R(P), k = e ? (r = e.value) == null ? void 0 : r.includes(b) : h, w = (x) => {
45
- var u;
46
- if (!(d || e != null && e.disabled))
47
- if (e) {
48
- const f = x ? [...e.value || [], b] : (e.value || []).filter((C) => C !== b);
49
- f && ((u = e.onChange) == null || u.call(e, f));
50
- } else
51
- s == null || s(x);
52
- }, _ = d || (e == null ? void 0 : e.disabled);
53
- return /* @__PURE__ */ m(
54
- "div",
55
- {
56
- className: i(t["bsy-checkbox"], {
57
- [t["bsy-checkbox--full-width"]]: (e == null ? void 0 : e.layout) === v.NONE || !(e != null && e.layout)
58
- }),
59
- onClick: () => w(!k),
60
- style: N,
61
- children: [
62
- /* @__PURE__ */ l(
63
- "div",
64
- {
65
- ref: a,
66
- role: "checkbox",
67
- "aria-checked": n ? "mixed" : k,
68
- tabIndex: _ ? -1 : 0,
69
- className: i({
70
- [t["bsy-checkbox__button--left-label"]]: I === "left"
71
- }),
72
- children: /* @__PURE__ */ l(z, { indeterminate: n, isChecked: k, disabled: _ })
73
- }
74
- ),
75
- y
76
- ]
77
- }
78
- );
79
- });
80
- export {
81
- $ as B,
82
- P as C,
83
- v as L
84
- };
@@ -1,215 +0,0 @@
1
- import { jsx as e, jsxs as b, Fragment as O } from "react/jsx-runtime";
2
- import { ColorPicker as R } from "antd";
3
- import { AnimatePresence as A, motion as F } from "motion/react";
4
- import { useFloating as x, offset as L, flip as E, shift as T, useClick as V, useDismiss as j, useInteractions as B, FloatingPortal as M } from "@floating-ui/react";
5
- import { useState as y, isValidElement as D, cloneElement as G, useRef as $, useMemo as q } from "react";
6
- import { useControllableValue as z } from "ahooks";
7
- import { I as k } from "../Icon/Icon-CBlIwtp2.js";
8
- import { u } from "../vendors/useLocale-DgqW9M3h.js";
9
- import { c as H } from "../vendors/clsx-OuTLNxxd.js";
10
- import { a as g } from "../vendors/color-VzwvCPhF.js";
11
- import { t as J } from "../vendors/tinycolor2-Begv3Jc8.js";
12
- import { P as K } from "../vendors/index-MTmG1Ezy.js";
13
- import { c as Q } from "../vendors/lodash-es-DFpaJB4Y.js";
14
- const U = [
15
- "rgba(240, 102, 72, 1)",
16
- // #F06648
17
- "rgba(255, 197, 2, 1)",
18
- // #FFC502
19
- "rgba(74, 204, 140, 1)",
20
- // #4ACC8C
21
- "rgba(74, 192, 236, 1)",
22
- // #4AC0EC
23
- "rgba(255, 153, 33, 1)",
24
- // #ff9921
25
- "rgba(101, 101, 101, 1)",
26
- // #656565
27
- "rgba(255, 156, 136, 1)",
28
- // #ff9c88
29
- "rgba(98, 98, 206, 1)",
30
- // #6262ce
31
- "rgba(241, 104, 182, 1)",
32
- // #f168b6
33
- "rgba(55, 103, 241, 1)",
34
- // #3767f1
35
- "rgba(162, 206, 30, 1)",
36
- // #a2ce1e
37
- "rgba(179, 179, 179, 1)",
38
- // #b3b3b3
39
- "rgba(0, 0, 0, 1)",
40
- // #000000
41
- "rgba(102, 102, 102, 1)",
42
- // #666
43
- "rgba(153, 153, 153, 1)",
44
- // #999
45
- "rgba(194, 194, 194, 1)",
46
- // #c2c2c2
47
- "rgba(224, 224, 224, 1)",
48
- // #e0e0e0
49
- "rgba(77, 96, 159, 1)"
50
- // #4d609f
51
- ], W = (o = "bottom-start") => {
52
- const [s, r] = y(!1), { refs: n, floatingStyles: c, context: i } = x({
53
- open: s,
54
- onOpenChange: r,
55
- placement: o,
56
- middleware: [
57
- L(4),
58
- // 浮层与触发器间距
59
- E(),
60
- // 超出边界时自动翻转
61
- T({ padding: 8 })
62
- // 自动避开边界
63
- ]
64
- }), m = V(i), l = j(i), { getReferenceProps: _, getFloatingProps: a } = B([m, l]);
65
- return {
66
- isOpen: s,
67
- refs: n,
68
- floatingStyles: c,
69
- getReferenceProps: _,
70
- getFloatingProps: a,
71
- setIsOpen: r
72
- };
73
- }, t = {
74
- "bsy-color-picker__floating": "_bsy-color-picker__floating_11t7y_1",
75
- "bsy-color-picker__content": "_bsy-color-picker__content_11t7y_4",
76
- "bsy-color-picker__grid": "_bsy-color-picker__grid_11t7y_11",
77
- "bsy-color-picker__preset-colors-title": "_bsy-color-picker__preset-colors-title_11t7y_15",
78
- "bsy-color-picker__preset-colors-grid": "_bsy-color-picker__preset-colors-grid_11t7y_19",
79
- "bsy-color-picker__preset-colors-item": "_bsy-color-picker__preset-colors-item_11t7y_24",
80
- "bsy-color-picker__custom-color-title": "_bsy-color-picker__custom-color-title_11t7y_48",
81
- "bsy-color-picker__custom-color-btn": "_bsy-color-picker__custom-color-btn_11t7y_52",
82
- "bsy-color-picker__custom-color-btn--active": "_bsy-color-picker__custom-color-btn--active_11t7y_62",
83
- "bsy-color-picker__custom-color-btn--preview": "_bsy-color-picker__custom-color-btn--preview_11t7y_66",
84
- "bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_11t7y_69",
85
- "bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_11t7y_73"
86
- }, C = ({
87
- currentColor: o,
88
- onColorSelect: s,
89
- options: r,
90
- style: n
91
- }) => /* @__PURE__ */ e("div", { className: t["bsy-color-picker__preset-colors-grid"], style: n, children: r.map((c) => /* @__PURE__ */ e(
92
- "div",
93
- {
94
- className: t["bsy-color-picker__preset-colors-item"],
95
- style: {
96
- backgroundColor: c,
97
- "--hover-color": J(c).setAlpha(0.5).toRgbString()
98
- },
99
- onClick: () => s(c),
100
- children: g(o, c) && /* @__PURE__ */ e(k, { name: "checkthebox", className: t["bsy-color-picker__check-icon"] })
101
- },
102
- c
103
- )) }), X = (o) => {
104
- const {
105
- children: s,
106
- placement: r = "bottom-start",
107
- disabled: n = !1,
108
- presetColors: c,
109
- getPopupContainer: i
110
- } = o, { t: m } = u(), [l, _] = z(o, {
111
- defaultValue: o.value
112
- }), { isOpen: a, refs: d, floatingStyles: f, getReferenceProps: h, getFloatingProps: v } = W(r), P = D(s) ? G(s, {
113
- ...h(),
114
- ref: d.setReference,
115
- disabled: n
116
- }) : s, p = Q(c) && c.length ? c : U, N = p.some((I) => g(I, l)), S = $(N ? [] : [l]), w = q(() => a ? i == null ? void 0 : i() : void 0, [a, i]);
117
- return /* @__PURE__ */ b(O, { children: [
118
- P,
119
- /* @__PURE__ */ e(M, { root: w, children: /* @__PURE__ */ e(A, { children: a && /* @__PURE__ */ e(
120
- "div",
121
- {
122
- ref: d.setFloating,
123
- style: f,
124
- ...v(),
125
- className: t["bsy-color-picker__floating"],
126
- children: /* @__PURE__ */ e(F.div, { ...K, children: /* @__PURE__ */ e("div", { className: t["bsy-color-picker__content"], children: /* @__PURE__ */ b("div", { className: t["bsy-color-picker__grid"], children: [
127
- /* @__PURE__ */ b("div", { className: t["bsy-color-picker__preset-colors"], children: [
128
- /* @__PURE__ */ e("div", { className: t["bsy-color-picker__preset-colors-title"], children: m("presetColors") }),
129
- /* @__PURE__ */ e(
130
- C,
131
- {
132
- currentColor: l,
133
- onColorSelect: _,
134
- options: p
135
- }
136
- )
137
- ] }),
138
- /* @__PURE__ */ e(
139
- Y,
140
- {
141
- value: l,
142
- onChange: _,
143
- onColorInput: o.onColorInput,
144
- options: p,
145
- list: S.current
146
- }
147
- )
148
- ] }) }) })
149
- }
150
- ) }) })
151
- ] });
152
- }, Y = (o) => {
153
- const { list: s } = o, [r, n] = y(), [c, i] = y(!1), { t: m } = u();
154
- return /* @__PURE__ */ b("div", { className: t["bsy-color-picker__custom-color"], children: [
155
- /* @__PURE__ */ e("div", { className: t["bsy-color-picker__custom-color-title"], children: m("customColor") }),
156
- /* @__PURE__ */ b("div", { className: t["bsy-color-picker__custom-color-content"], children: [
157
- /* @__PURE__ */ e(
158
- R,
159
- {
160
- value: r,
161
- onChange: (l) => {
162
- var a;
163
- const _ = l.toRgbString();
164
- n(_), (a = o.onColorInput) == null || a.call(o, _);
165
- },
166
- open: c,
167
- onOpenChange: (l) => {
168
- i(l), !l && r && (s.includes(r) || s.unshift(r), o.onChange(r), n(void 0));
169
- },
170
- children: /* @__PURE__ */ e(
171
- "div",
172
- {
173
- className: H(t["bsy-color-picker__custom-color-btn"], {
174
- [t["bsy-color-picker__custom-color-btn--active"]]: c && !r,
175
- [t["bsy-color-picker__custom-color-btn--preview"]]: !!r
176
- }),
177
- role: "button",
178
- style: {
179
- backgroundColor: r || void 0
180
- },
181
- onClick: () => {
182
- i(!0);
183
- },
184
- children: /* @__PURE__ */ e(
185
- k,
186
- {
187
- name: "add",
188
- style: {
189
- visibility: r ? "hidden" : "visible"
190
- }
191
- }
192
- )
193
- }
194
- )
195
- }
196
- ),
197
- /* @__PURE__ */ e(
198
- C,
199
- {
200
- currentColor: o.value,
201
- onColorSelect: o.onChange,
202
- options: s.slice(0, 5),
203
- style: {
204
- gridTemplateColumns: "repeat(5, 1fr)"
205
- }
206
- }
207
- )
208
- ] })
209
- ] });
210
- };
211
- X.displayName = "BsyColorPicker";
212
- export {
213
- X as C,
214
- U as a
215
- };