@layers-app/shared 0.3.0 → 0.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/assets/default-workspace-avatar.jpg.js +4 -0
- package/dist/assets/layers-logo-full.svg.js +2 -3
- package/dist/assets/layers-logo-full.svg2.js +3 -2
- package/dist/assets/layers-logo-icon.svg.js +2 -3
- package/dist/assets/layers-logo-icon.svg2.js +3 -2
- package/dist/assets/projects/figureA.svg.js +4 -0
- package/dist/assets/projects/figureB.svg.js +4 -0
- package/dist/assets/qwebchannel.d.ts +15 -0
- package/dist/assets/qwebchannel.d.ts.map +1 -0
- package/dist/assets/taskPriorities/high.svg.js +5 -0
- package/dist/assets/taskPriorities/low.svg.js +5 -0
- package/dist/assets/taskPriorities/none.svg.js +5 -0
- package/dist/assets/taskPriorities/normal.svg.js +5 -0
- package/dist/assets/taskPriorities/urgent.svg.js +5 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts +3 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.js +69 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +27 -0
- package/dist/components/AnimatedFigurePage/types.d.ts +15 -0
- package/dist/components/AnimatedFigurePage/types.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/useParallax.d.ts +6 -0
- package/dist/components/AnimatedFigurePage/useParallax.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/useParallax.js +29 -0
- package/dist/components/AppContainer/AppContainer.d.ts +1 -1
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +37 -36
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +80 -45
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +60 -69
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.js +57 -51
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +3 -1
- package/dist/components/AppContainer/types.d.ts +3 -0
- package/dist/components/AppContainer/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +88 -74
- package/dist/components/ColorPicker/ColorPicker.module.css.js +31 -0
- package/dist/components/ColorPicker/ColorPickerList.d.ts +6 -0
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPickerList.js +134 -0
- package/dist/components/ColorPicker/ColorPickerPopover.d.ts +6 -6
- package/dist/components/ColorPicker/ColorPickerPopover.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerPopover.js +29 -31
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts +13 -0
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPickerToolbar.js +132 -0
- package/dist/components/ColorPicker/icons.d.ts +11 -0
- package/dist/components/ColorPicker/icons.d.ts.map +1 -0
- package/dist/components/ColorPicker/icons.js +71 -0
- package/dist/components/ColorPicker/types.d.ts +49 -0
- package/dist/components/ColorPicker/types.d.ts.map +1 -0
- package/dist/components/ColorPicker/types.js +10 -0
- package/dist/components/ColorPicker/useRecentColors.d.ts +13 -0
- package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -0
- package/dist/components/ColorPicker/useRecentColors.js +39 -0
- package/dist/components/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +115 -111
- package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.js +12 -10
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +3 -1
- package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.js +49 -46
- package/dist/components/EmojiPicker/IconsPanel.d.ts +2 -1
- package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/IconsPanel.js +47 -45
- package/dist/components/EmojiPicker/custom-icons/customIcons.d.ts.map +1 -1
- package/dist/components/EmojiPicker/custom-icons/customIcons.js +66 -31
- package/dist/components/EntityIcon.d.ts +3 -3
- package/dist/components/EntityIcon.d.ts.map +1 -1
- package/dist/components/EntityIcon.js +59 -35
- package/dist/components/EntityTitle/EntityTitle.d.ts +1 -1
- package/dist/components/EntityTitle/EntityTitle.d.ts.map +1 -1
- package/dist/components/EntityTitle/EntityTitle.js +34 -34
- package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +111 -123
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +41 -39
- package/dist/components/FormViewer/components/fields/UploadField/UploadField.d.ts.map +1 -1
- package/dist/components/FormViewer/components/fields/UploadField/UploadField.js +34 -33
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +3 -3
- package/dist/components/Logotype.d.ts +2 -1
- package/dist/components/Logotype.d.ts.map +1 -1
- package/dist/components/Logotype.js +58 -49
- package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuItem.js +122 -107
- package/dist/components/NavMenu/types.d.ts +1 -0
- package/dist/components/NavMenu/types.d.ts.map +1 -1
- package/dist/components/ProjectIcon/ProjectIcon.js +13 -13
- package/dist/components/TreeIndent/TreeIndent.d.ts +9 -0
- package/dist/components/TreeIndent/TreeIndent.d.ts.map +1 -0
- package/dist/components/TreeIndent/TreeIndent.js +15 -0
- package/dist/components/TreeIndent/TreeIndent.module.css.js +11 -0
- package/dist/components/TreeIndent/index.d.ts +2 -0
- package/dist/components/TreeIndent/index.d.ts.map +1 -0
- package/dist/components/WorkspaceAvatar/WorkspaceAvatar.js +11 -11
- package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
- package/dist/components/WorkspaceMenu/WorkspaceMenu.js +97 -101
- package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
- package/dist/config/brand.d.ts +1 -0
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +42 -34
- package/dist/config/envConfig.d.ts +40 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/config/envConfig.js +29 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -4
- package/dist/helpers/getFileIcons.d.ts.map +1 -1
- package/dist/helpers/getFileIcons.js +34 -29
- package/dist/helpers/getFileType.d.ts +1 -1
- package/dist/helpers/getFileType.d.ts.map +1 -1
- package/dist/helpers/getFileType.js +3 -3
- package/dist/helpers/hotjar.d.ts.map +1 -1
- package/dist/helpers/hotjar.js +11 -7
- package/dist/helpers/platform.js +4 -4
- package/dist/helpers/showNotifications.d.ts +3 -0
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +79 -44
- package/dist/hooks/useDateFnsLocale.d.ts +2 -0
- package/dist/hooks/useDateFnsLocale.d.ts.map +1 -1
- package/dist/hooks/useDateFnsLocale.js +9 -8
- package/dist/hooks/useDateUtils.d.ts.map +1 -1
- package/dist/hooks/useDateUtils.js +19 -19
- package/dist/hooks/useFormatDistance.d.ts.map +1 -1
- package/dist/hooks/useFormatDistance.js +6 -6
- package/dist/hooks/useNumberQueryParam.d.ts +1 -1
- package/dist/hooks/useNumberQueryParam.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +516 -494
- package/dist/lang/locales/ui_en.json.js +7 -7
- package/dist/lang/locales/ui_es.json.js +1 -1
- package/dist/lang/locales/ui_ru.json.js +11 -11
- package/dist/utils/formatStorage.d.ts +9 -0
- package/dist/utils/formatStorage.d.ts.map +1 -1
- package/dist/utils/formatStorage.js +14 -10
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsxs as C, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D, useState as M, useCallback as w, useMemo as T } from "react";
|
|
3
|
+
import { useMantineColorScheme as z, Box as u, Flex as x, UnstyledButton as H } from "@mantine/core";
|
|
4
|
+
import { TextColorIcon as F, HighlightSwatch as N } from "./icons.js";
|
|
5
|
+
import { isDefaultColor as I, normalizeColorItem as L } from "./types.js";
|
|
6
|
+
import { useRecentColors as j } from "./useRecentColors.js";
|
|
7
|
+
import t from "./ColorPicker.module.css.js";
|
|
8
|
+
function k({
|
|
9
|
+
isActive: i,
|
|
10
|
+
round: m,
|
|
11
|
+
disabled: a,
|
|
12
|
+
onClick: h,
|
|
13
|
+
children: c
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ o(
|
|
16
|
+
H,
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
className: `${t.inlineSwatch}${m ? ` ${t.inlineSwatchRound}` : ""}${i ? ` ${t.inlineSwatchActive}` : ""}`,
|
|
20
|
+
onMouseDown: (p) => p.preventDefault(),
|
|
21
|
+
onClick: h,
|
|
22
|
+
disabled: a,
|
|
23
|
+
children: c
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const Q = D(({ sections: i, onChange: m, withRecentColors: a, maxRecentColors: h = 9, disabled: c, recentColorsLabel: p = "Recently used" }, R) => {
|
|
28
|
+
const { colorScheme: y } = z(), S = y === "dark", { recentColors: B, addRecent: g } = j({ maxItems: h }), [v, K] = M(B), d = w(
|
|
29
|
+
(e, r, n) => {
|
|
30
|
+
a && (g(e, r, n), K((l) => {
|
|
31
|
+
const f = l.filter(
|
|
32
|
+
(s) => !(s.value === e && s.sectionKey === r)
|
|
33
|
+
);
|
|
34
|
+
return [{ value: e, sectionKey: r, border: n }, ...f].slice(0, h);
|
|
35
|
+
})), m(e, r);
|
|
36
|
+
},
|
|
37
|
+
[m, a, g]
|
|
38
|
+
), A = T(() => {
|
|
39
|
+
const e = {};
|
|
40
|
+
for (const r of i) e[r.key] = r;
|
|
41
|
+
return e;
|
|
42
|
+
}, [i]), b = w(
|
|
43
|
+
(e) => I(e) ? S ? "#FFFFFF" : "#000000" : e,
|
|
44
|
+
[S]
|
|
45
|
+
);
|
|
46
|
+
return /* @__PURE__ */ C(u, { ref: R, children: [
|
|
47
|
+
a && v.length > 0 && /* @__PURE__ */ C(u, { className: t.inlineSection, children: [
|
|
48
|
+
/* @__PURE__ */ o(u, { className: t.inlineSectionLabel, children: p }),
|
|
49
|
+
/* @__PURE__ */ o(x, { className: t.inlineRow, gap: 2, children: v.map((e, r) => {
|
|
50
|
+
const n = e.sectionKey ? A[e.sectionKey] : void 0;
|
|
51
|
+
return n?.key === "textColor" || n?.key === "color" || e.sectionKey === "color" ? /* @__PURE__ */ o(
|
|
52
|
+
k,
|
|
53
|
+
{
|
|
54
|
+
isActive: !1,
|
|
55
|
+
disabled: c,
|
|
56
|
+
onClick: () => d(e.value, e.sectionKey ?? ""),
|
|
57
|
+
children: /* @__PURE__ */ o(
|
|
58
|
+
F,
|
|
59
|
+
{
|
|
60
|
+
size: 20,
|
|
61
|
+
color: b(e.value),
|
|
62
|
+
showBorder: !0
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
},
|
|
66
|
+
`${e.sectionKey}-${e.value}-${r}`
|
|
67
|
+
) : /* @__PURE__ */ o(
|
|
68
|
+
k,
|
|
69
|
+
{
|
|
70
|
+
isActive: !1,
|
|
71
|
+
round: !0,
|
|
72
|
+
disabled: c,
|
|
73
|
+
onClick: () => d(e.value, e.sectionKey ?? ""),
|
|
74
|
+
children: /* @__PURE__ */ o(
|
|
75
|
+
N,
|
|
76
|
+
{
|
|
77
|
+
bgColor: e.value,
|
|
78
|
+
borderColor: e.border || "var(--mantine-color-default-border)"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
`${e.sectionKey}-${e.value}-${r}`
|
|
83
|
+
);
|
|
84
|
+
}) })
|
|
85
|
+
] }),
|
|
86
|
+
i.map((e) => {
|
|
87
|
+
const r = e.key === "highlight" || e.key === "background" || e.key === "textHighlight";
|
|
88
|
+
return /* @__PURE__ */ C(u, { className: t.inlineSection, children: [
|
|
89
|
+
e.label && /* @__PURE__ */ o(u, { className: t.inlineSectionLabel, children: e.label }),
|
|
90
|
+
/* @__PURE__ */ o(x, { className: t.inlineRow, gap: 2, children: e.colors.map((n) => {
|
|
91
|
+
const { value: l, border: f } = L(n), s = l === e.value, $ = b(l);
|
|
92
|
+
return r ? /* @__PURE__ */ o(
|
|
93
|
+
k,
|
|
94
|
+
{
|
|
95
|
+
isActive: s,
|
|
96
|
+
round: !0,
|
|
97
|
+
disabled: c,
|
|
98
|
+
onClick: () => d(l, e.key, f),
|
|
99
|
+
children: /* @__PURE__ */ o(
|
|
100
|
+
N,
|
|
101
|
+
{
|
|
102
|
+
bgColor: l,
|
|
103
|
+
borderColor: f || $
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
},
|
|
107
|
+
l
|
|
108
|
+
) : /* @__PURE__ */ o(
|
|
109
|
+
k,
|
|
110
|
+
{
|
|
111
|
+
isActive: s,
|
|
112
|
+
disabled: c,
|
|
113
|
+
onClick: () => d(l, e.key),
|
|
114
|
+
children: /* @__PURE__ */ o(
|
|
115
|
+
F,
|
|
116
|
+
{
|
|
117
|
+
size: 20,
|
|
118
|
+
color: $,
|
|
119
|
+
showBorder: !0
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
},
|
|
123
|
+
l
|
|
124
|
+
);
|
|
125
|
+
}) })
|
|
126
|
+
] }, e.key);
|
|
127
|
+
})
|
|
128
|
+
] });
|
|
129
|
+
});
|
|
130
|
+
export {
|
|
131
|
+
Q as ColorPickerToolbar
|
|
132
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function TextColorIcon({ size, color, showBorder, }: {
|
|
2
|
+
size?: number;
|
|
3
|
+
color?: string;
|
|
4
|
+
showBorder?: boolean;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function HighlightSwatch({ size, bgColor, borderColor, }: {
|
|
7
|
+
size?: number;
|
|
8
|
+
bgColor: string;
|
|
9
|
+
borderColor: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/icons.tsx"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,EAC5B,IAAS,EACT,KAAoC,EACpC,UAAU,GACX,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,2CAgCA;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAS,EACT,OAAO,EACP,WAAW,GACZ,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,2CA4BA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as n, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
function s({
|
|
3
|
+
size: t = 20,
|
|
4
|
+
color: r = "var(--mantine-color-white)",
|
|
5
|
+
showBorder: e
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ c(
|
|
8
|
+
"svg",
|
|
9
|
+
{
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
width: t,
|
|
12
|
+
height: t,
|
|
13
|
+
viewBox: "0 0 20 20",
|
|
14
|
+
fill: "none",
|
|
15
|
+
children: [
|
|
16
|
+
e && /* @__PURE__ */ n(
|
|
17
|
+
"rect",
|
|
18
|
+
{
|
|
19
|
+
x: "0.5",
|
|
20
|
+
y: "0.5",
|
|
21
|
+
width: "19",
|
|
22
|
+
height: "19",
|
|
23
|
+
rx: "5.5",
|
|
24
|
+
stroke: "var(--mantine-color-default-border)",
|
|
25
|
+
strokeWidth: "1",
|
|
26
|
+
fill: "none"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ n("g", { transform: "translate(4.3, 2.85) scale(0.95)", children: /* @__PURE__ */ n(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
d: "M5.74945 0C6.57421 0 7.09678 0.678265 7.50336 1.43555C7.93323 2.23628 8.38332 3.42022 8.95843 4.92676L11.4623 11.4873C11.5716 11.7742 11.4279 12.0955 11.1411 12.2051C10.8541 12.3144 10.5329 12.1706 10.4233 11.8838L8.5766 7.04883H2.9223L1.07562 11.8838C0.965974 12.1707 0.644849 12.3146 0.357848 12.2051C0.0710441 12.0955 -0.0726477 11.7742 0.0365593 11.4873L2.54047 4.92676C3.11563 3.42012 3.56662 2.23629 3.99652 1.43555C4.40306 0.678393 4.92485 8.51363e-05 5.74945 0ZM5.74945 1.11328C5.62925 1.11335 5.38778 1.19685 4.97699 1.96191C4.5893 2.68404 4.16803 3.7852 3.5805 5.32422L3.34711 5.93555H8.15179L7.9184 5.32422C7.33089 3.78522 6.9096 2.68403 6.52191 1.96191C6.11099 1.19664 5.86959 1.11328 5.74945 1.11328Z",
|
|
33
|
+
fill: r === "inherit" || r === "currentColor" ? "var(--mantine-color-white)" : r
|
|
34
|
+
}
|
|
35
|
+
) })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function d({
|
|
41
|
+
size: t = 24,
|
|
42
|
+
bgColor: r,
|
|
43
|
+
borderColor: e
|
|
44
|
+
}) {
|
|
45
|
+
const o = r === "inherit" || r === "" || r === "default", i = t * 0.375, l = o ? "var(--mantine-color-body)" : r, h = o ? "var(--mantine-color-default-border)" : e;
|
|
46
|
+
return /* @__PURE__ */ n(
|
|
47
|
+
"svg",
|
|
48
|
+
{
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
+
width: t,
|
|
51
|
+
height: t,
|
|
52
|
+
viewBox: `0 0 ${t} ${t}`,
|
|
53
|
+
fill: "none",
|
|
54
|
+
children: /* @__PURE__ */ n(
|
|
55
|
+
"circle",
|
|
56
|
+
{
|
|
57
|
+
cx: t / 2,
|
|
58
|
+
cy: t / 2,
|
|
59
|
+
r: i,
|
|
60
|
+
fill: l,
|
|
61
|
+
stroke: h,
|
|
62
|
+
strokeWidth: "1.5"
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
d as HighlightSwatch,
|
|
70
|
+
s as TextColorIcon
|
|
71
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FlexProps } from '@mantine/core';
|
|
2
|
+
export type ColorItem = string | {
|
|
3
|
+
value: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
border?: string;
|
|
6
|
+
bg?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface ColorSection {
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
colors: ColorItem[];
|
|
12
|
+
value?: string;
|
|
13
|
+
type?: 'text' | 'highlight';
|
|
14
|
+
}
|
|
15
|
+
export interface RecentColorEntry {
|
|
16
|
+
value: string;
|
|
17
|
+
sectionKey?: string;
|
|
18
|
+
border?: string;
|
|
19
|
+
}
|
|
20
|
+
export type ColorPickerOnChange = (value: string, sectionKey?: string) => void;
|
|
21
|
+
export interface ColorPickerBaseProps {
|
|
22
|
+
colors?: ColorItem[];
|
|
23
|
+
sections?: ColorSection[];
|
|
24
|
+
value?: string;
|
|
25
|
+
onChange?: ColorPickerOnChange;
|
|
26
|
+
withRecentColors?: boolean;
|
|
27
|
+
maxRecentColors?: number;
|
|
28
|
+
swatchSize?: number;
|
|
29
|
+
withTick?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ColorPickerInlineProps extends ColorPickerBaseProps, Omit<FlexProps, 'onChange'> {
|
|
32
|
+
swatchShape?: 'circle' | 'square';
|
|
33
|
+
fullWidth?: boolean;
|
|
34
|
+
allowCustomColor?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ColorPickerListProps extends ColorPickerBaseProps {
|
|
37
|
+
columns?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ColorPickerCompactProps extends Omit<ColorPickerBaseProps, 'sections' | 'withRecentColors'>, Omit<FlexProps, 'onChange'> {
|
|
40
|
+
swatchShape?: 'circle' | 'square';
|
|
41
|
+
}
|
|
42
|
+
export declare function normalizeColorItem(item: ColorItem): {
|
|
43
|
+
value: string;
|
|
44
|
+
label: string;
|
|
45
|
+
border?: string;
|
|
46
|
+
bg?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function isDefaultColor(value: string): boolean;
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,KAChB,IAAI,CAAC;AAEV,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBACf,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,kBAAkB,CAAC,EACjE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAKA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RecentColorEntry } from './types';
|
|
2
|
+
interface UseRecentColorsOptions {
|
|
3
|
+
storageKey?: string;
|
|
4
|
+
maxItems?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function useRecentColors(options?: UseRecentColorsOptions): {
|
|
7
|
+
recentColors: RecentColorEntry[];
|
|
8
|
+
addRecent: (value: string, sectionKey?: string, border?: string) => void;
|
|
9
|
+
clearRecent: () => void;
|
|
10
|
+
reload: () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useRecentColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecentColors.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/useRecentColors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAmBD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB;;uBAYpD,MAAM,eAAe,MAAM,WAAW,MAAM;;;EAsBvD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState as I, useCallback as c } from "react";
|
|
2
|
+
const d = "color-picker-recent", p = 11;
|
|
3
|
+
function n(e) {
|
|
4
|
+
try {
|
|
5
|
+
const t = localStorage.getItem(e);
|
|
6
|
+
return t ? JSON.parse(t) : [];
|
|
7
|
+
} catch {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function E(e, t, o) {
|
|
12
|
+
try {
|
|
13
|
+
localStorage.setItem(e, JSON.stringify(t.slice(0, o)));
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function v(e) {
|
|
18
|
+
const t = e?.storageKey ?? d, o = e?.maxItems ?? p, [i, r] = I(() => n(t)), S = c(() => {
|
|
19
|
+
r(n(t));
|
|
20
|
+
}, [t]), g = c(
|
|
21
|
+
(s, a, f) => {
|
|
22
|
+
const y = n(t).filter(
|
|
23
|
+
(m) => !(m.value === s && m.sectionKey === a)
|
|
24
|
+
), l = [{ value: s, sectionKey: a, border: f }, ...y].slice(0, o);
|
|
25
|
+
E(t, l, o), r(l);
|
|
26
|
+
},
|
|
27
|
+
[t, o]
|
|
28
|
+
), u = c(() => {
|
|
29
|
+
try {
|
|
30
|
+
localStorage.removeItem(t);
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
r([]);
|
|
34
|
+
}, [t]);
|
|
35
|
+
return { recentColors: i, addRecent: g, clearRecent: u, reload: S };
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
v as useRecentColors
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentComposer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CommentComposer/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,oBAAoB,EAAwB,MAAM,SAAS,CAAC;AA0CrE,eAAO,MAAM,eAAe,GAAI,4EAQ7B,oBAAoB,4CAuctB,CAAC"}
|