@layers-app/shared 0.2.1 → 0.2.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.
- package/dist/assets/svg/group_default_icon.svg.js +4 -0
- package/dist/components/AppContainer/hooks/useAppContainerStore.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainerStore.js +26 -19
- package/dist/components/CommentComposer/CommentComposer.module.css.js +4 -4
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.js +25 -22
- package/dist/components/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +237 -153
- package/dist/components/CommentComposer/{useFloatingPosition.d.ts → useVirtualAnchor.d.ts} +3 -4
- package/dist/components/CommentComposer/useVirtualAnchor.d.ts.map +1 -0
- package/dist/components/CommentComposer/useVirtualAnchor.js +71 -0
- package/dist/components/FilePicker/FilePicker.js +1 -1
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +5 -5
- package/dist/components/GroupAvatar/index.d.ts +9 -0
- package/dist/components/GroupAvatar/index.d.ts.map +1 -0
- package/dist/components/GroupAvatar/index.js +24 -0
- package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
- package/dist/components/modals/RemoveConfirmModal.js +22 -21
- package/dist/components/table/FrontTable.d.ts +2 -1
- package/dist/components/table/FrontTable.d.ts.map +1 -1
- package/dist/components/table/components/TableCell.d.ts.map +1 -1
- package/dist/components/table/components/TableCell.js +63 -26
- package/dist/components/table/components/TableMenu.d.ts +2 -1
- package/dist/components/table/components/TableMenu.d.ts.map +1 -1
- package/dist/components/table/components/TableMenu.js +15 -14
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +390 -384
- package/dist/store/accessOptionsControl.d.ts +11 -1
- package/dist/store/accessOptionsControl.d.ts.map +1 -1
- package/dist/store/accessOptionsControl.js +15 -7
- package/package.json +1 -1
- package/dist/components/CommentComposer/useFloatingPosition.d.ts.map +0 -1
- package/dist/components/CommentComposer/useFloatingPosition.js +0 -115
|
@@ -1,197 +1,221 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Attachment02Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { showErrorNotification as
|
|
8
|
-
import { AttachmentsPreview as
|
|
9
|
-
import { CommentEditorHandler as
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
function
|
|
13
|
-
return "id" in
|
|
1
|
+
import { jsx as r, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useState as Q, useRef as v, useMemo as O, useCallback as ee, useEffect as L } from "react";
|
|
3
|
+
import { useTranslation as te } from "react-i18next";
|
|
4
|
+
import { Attachment02Icon as oe, Sent02Icon as ne } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as $ } from "@hugeicons/react";
|
|
6
|
+
import { Stack as re, Box as se, Group as B, FileButton as ie, ActionIcon as U, UnstyledButton as le, Text as ce, Button as ae, Popover as _ } from "@mantine/core";
|
|
7
|
+
import { showErrorNotification as P } from "../../helpers/showNotifications.js";
|
|
8
|
+
import { AttachmentsPreview as de } from "../AttachmentsPreview/AttachmentsPreview.js";
|
|
9
|
+
import { CommentEditorHandler as me } from "./CommentEditorHotkeys.js";
|
|
10
|
+
import { useVirtualAnchor as fe } from "./useVirtualAnchor.js";
|
|
11
|
+
import x from "./CommentComposer.module.css.js";
|
|
12
|
+
function W(n) {
|
|
13
|
+
return "id" in n;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return typeof
|
|
15
|
+
function ue(n) {
|
|
16
|
+
return typeof n == "object" && "isTemp" in n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
18
|
+
function pe(n) {
|
|
19
|
+
const a = URL.createObjectURL(n);
|
|
20
20
|
return {
|
|
21
21
|
id: `temp-${crypto.randomUUID()}`,
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
24
|
-
size:
|
|
25
|
-
url:
|
|
26
|
-
src:
|
|
27
|
-
isImage:
|
|
22
|
+
name: n.name,
|
|
23
|
+
type: n.type,
|
|
24
|
+
size: n.size,
|
|
25
|
+
url: a,
|
|
26
|
+
src: a,
|
|
27
|
+
isImage: n.type.startsWith("image/"),
|
|
28
28
|
isTemp: !0,
|
|
29
|
-
raw:
|
|
29
|
+
raw: n
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
function
|
|
34
|
-
return
|
|
32
|
+
const he = 5 * 1024 * 1024, ge = 10;
|
|
33
|
+
function j(n, a) {
|
|
34
|
+
return n(`composer.${a}`, { defaultValue: "" }) || n(`editor.composer.${a}`);
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
children:
|
|
38
|
-
onSubmit:
|
|
39
|
-
initialDraft:
|
|
40
|
-
updateLocation:
|
|
41
|
-
onBlur:
|
|
42
|
-
setEdit:
|
|
43
|
-
ns:
|
|
36
|
+
const _e = ({
|
|
37
|
+
children: n,
|
|
38
|
+
onSubmit: a,
|
|
39
|
+
initialDraft: d,
|
|
40
|
+
updateLocation: z,
|
|
41
|
+
onBlur: k,
|
|
42
|
+
setEdit: N,
|
|
43
|
+
ns: I = "comments"
|
|
44
44
|
}) => {
|
|
45
|
-
const [m, R] =
|
|
46
|
-
text:
|
|
47
|
-
files:
|
|
48
|
-
}), { t:
|
|
45
|
+
const [m, R] = Q({
|
|
46
|
+
text: d?.text ?? "",
|
|
47
|
+
files: d?.files ?? []
|
|
48
|
+
}), { t: y } = te(I), G = y(I === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), h = v(null), f = typeof d?.text < "u", c = {
|
|
49
49
|
text: m.text,
|
|
50
50
|
files: m.files
|
|
51
|
-
},
|
|
51
|
+
}, X = v(null), p = v(null), Y = O(
|
|
52
52
|
() => ({
|
|
53
53
|
container: document.createElement("div"),
|
|
54
54
|
elements: []
|
|
55
55
|
}),
|
|
56
56
|
[]
|
|
57
|
-
),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
), q = v(null), u = !!z, J = fe({
|
|
58
|
+
isFloat: u,
|
|
59
|
+
updateLocation: z,
|
|
60
|
+
selectionRef: q,
|
|
61
|
+
selectionState: Y
|
|
62
|
+
}), S = 10 * 30 * 0.7, b = ee(() => {
|
|
63
|
+
if (!p.current) return;
|
|
64
|
+
const e = p.current, t = e.querySelector(
|
|
65
|
+
'[class*="editorWrapper"]'
|
|
66
|
+
), s = t?.scrollHeight || 0, o = s > S, l = s > 35, i = e.closest(
|
|
67
|
+
'[class*="commentComposerFloat"]'
|
|
68
|
+
) || e;
|
|
69
|
+
u && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${S}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
|
|
70
|
+
}, [p, u, S]);
|
|
71
|
+
L(() => {
|
|
72
|
+
b();
|
|
73
|
+
}, [b]), L(() => {
|
|
74
|
+
if (!p.current) return;
|
|
75
|
+
const e = new ResizeObserver(() => {
|
|
76
|
+
b();
|
|
77
|
+
});
|
|
78
|
+
return e.observe(p.current), () => {
|
|
79
|
+
e.disconnect();
|
|
80
|
+
};
|
|
81
|
+
}, [b]), L(() => {
|
|
82
|
+
const e = document.querySelector("main");
|
|
83
|
+
if (e && u) {
|
|
84
|
+
const t = e.style.overflow;
|
|
85
|
+
return e.style.overflow = "hidden", () => {
|
|
86
|
+
e.style.overflow = t;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [u]);
|
|
90
|
+
const { textChanged: K, newFiles: V, deletedFiles: Z, hasChanges: F } = O(() => {
|
|
91
|
+
const e = d?.files || [], t = m.files, s = d?.text !== c.text, o = t.filter((i) => i.isTemp), g = new Set(
|
|
92
|
+
t.filter(
|
|
93
|
+
(i) => W(i)
|
|
94
|
+
).map((i) => i.id)
|
|
95
|
+
), l = e.filter(W).filter((i) => !g.has(i.id)), E = f ? JSON.stringify(d) === JSON.stringify(m) : c.text.trim().length > 0 || o.length > 0 || l.length > 0;
|
|
71
96
|
return {
|
|
72
|
-
textChanged:
|
|
73
|
-
newFiles:
|
|
74
|
-
deletedFiles:
|
|
75
|
-
hasChanges:
|
|
97
|
+
textChanged: s,
|
|
98
|
+
newFiles: o,
|
|
99
|
+
deletedFiles: l,
|
|
100
|
+
hasChanges: E
|
|
76
101
|
};
|
|
77
|
-
}, [
|
|
78
|
-
|
|
102
|
+
}, [f, d, m, c.text]), H = () => {
|
|
103
|
+
N ? N({
|
|
79
104
|
id: "",
|
|
80
105
|
text: "",
|
|
81
106
|
files: []
|
|
82
|
-
}) :
|
|
83
|
-
},
|
|
84
|
-
R((
|
|
85
|
-
if (
|
|
107
|
+
}) : k?.();
|
|
108
|
+
}, T = (e, t = !1) => {
|
|
109
|
+
R((s) => {
|
|
110
|
+
if (t)
|
|
86
111
|
return { text: "", files: [] };
|
|
87
|
-
const
|
|
112
|
+
const o = typeof e == "function" ? e(s) : e;
|
|
88
113
|
return {
|
|
89
|
-
text:
|
|
90
|
-
files:
|
|
114
|
+
text: o.text,
|
|
115
|
+
files: o.files
|
|
91
116
|
};
|
|
92
117
|
});
|
|
93
|
-
},
|
|
94
|
-
e &&
|
|
95
|
-
const
|
|
96
|
-
e.forEach((
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
message:
|
|
100
|
-
}),
|
|
101
|
-
message:
|
|
118
|
+
}, D = (e, t) => {
|
|
119
|
+
e && t((s) => {
|
|
120
|
+
const o = s.files, g = ge - o.length, l = [], E = [];
|
|
121
|
+
e.forEach((A) => {
|
|
122
|
+
A.size > he ? E.push(A) : l.push(A);
|
|
123
|
+
}), E.length > 0 && P({
|
|
124
|
+
message: j(y, "uploadErrors.fileTooLarge")
|
|
125
|
+
}), l.length > g && P({
|
|
126
|
+
message: j(y, "uploadErrors.tooManyFiles")
|
|
102
127
|
});
|
|
103
|
-
const
|
|
128
|
+
const i = l.slice(0, g);
|
|
104
129
|
return {
|
|
105
|
-
...
|
|
106
|
-
files: [...
|
|
130
|
+
...s,
|
|
131
|
+
files: [...o, ...i.map(pe)]
|
|
107
132
|
};
|
|
108
133
|
});
|
|
109
|
-
},
|
|
134
|
+
}, w = async () => {
|
|
110
135
|
try {
|
|
111
|
-
|
|
136
|
+
f ? await a({
|
|
112
137
|
mode: "edit",
|
|
113
138
|
data: {
|
|
114
|
-
textChanged:
|
|
115
|
-
newFiles:
|
|
116
|
-
deletedFiles:
|
|
117
|
-
newText:
|
|
139
|
+
textChanged: K,
|
|
140
|
+
newFiles: V,
|
|
141
|
+
deletedFiles: Z,
|
|
142
|
+
newText: c.text
|
|
118
143
|
}
|
|
119
|
-
}) : await
|
|
144
|
+
}) : await a({
|
|
120
145
|
mode: "create",
|
|
121
146
|
data: {
|
|
122
|
-
text:
|
|
123
|
-
files: m.files.filter(
|
|
147
|
+
text: c.text,
|
|
148
|
+
files: m.files.filter(ue)
|
|
124
149
|
}
|
|
125
150
|
});
|
|
126
151
|
} catch {
|
|
127
152
|
return;
|
|
128
153
|
}
|
|
129
|
-
|
|
130
|
-
const e =
|
|
154
|
+
H(), h.current && h.current.update(() => {
|
|
155
|
+
const e = h.current._editorState._nodeMap.get("root");
|
|
131
156
|
if (!e) return;
|
|
132
157
|
e.clear();
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
135
|
-
const
|
|
136
|
-
e.append(
|
|
137
|
-
}),
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
q,
|
|
158
|
+
const t = h.current._nodes.get("paragraph");
|
|
159
|
+
if (!t) return;
|
|
160
|
+
const s = new t.klass();
|
|
161
|
+
e.append(s), s.select();
|
|
162
|
+
}), T({ text: "", files: [] }, !0);
|
|
163
|
+
}, M = /* @__PURE__ */ r(
|
|
164
|
+
re,
|
|
141
165
|
{
|
|
142
|
-
ref:
|
|
166
|
+
ref: p,
|
|
143
167
|
className: `
|
|
144
|
-
${
|
|
145
|
-
${
|
|
146
|
-
${
|
|
168
|
+
${x.commentComposerWrapper}
|
|
169
|
+
${f ? x.editMode : ""}
|
|
170
|
+
${u ? x.commentComposerFloat : ""}
|
|
147
171
|
`,
|
|
148
|
-
children: /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ C(
|
|
149
173
|
"div",
|
|
150
174
|
{
|
|
151
|
-
className:
|
|
175
|
+
className: x.composerContainer,
|
|
152
176
|
style: {
|
|
153
|
-
"--placeholder-text": `"${
|
|
177
|
+
"--placeholder-text": `"${G}"`
|
|
154
178
|
},
|
|
155
179
|
children: [
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
|
|
180
|
+
/* @__PURE__ */ r("div", { className: x.editorWrapper, children: /* @__PURE__ */ r(
|
|
181
|
+
me,
|
|
158
182
|
{
|
|
159
|
-
onSubmit:
|
|
160
|
-
editorRef:
|
|
161
|
-
inputContainerRef:
|
|
162
|
-
commentDraft:
|
|
163
|
-
onBlur:
|
|
164
|
-
isEdit:
|
|
165
|
-
isFloat:
|
|
166
|
-
hasChanges:
|
|
167
|
-
ns:
|
|
168
|
-
children:
|
|
169
|
-
onSubmit:
|
|
183
|
+
onSubmit: w,
|
|
184
|
+
editorRef: h,
|
|
185
|
+
inputContainerRef: p,
|
|
186
|
+
commentDraft: c,
|
|
187
|
+
onBlur: H,
|
|
188
|
+
isEdit: f,
|
|
189
|
+
isFloat: u,
|
|
190
|
+
hasChanges: F,
|
|
191
|
+
ns: I,
|
|
192
|
+
children: n?.({
|
|
193
|
+
onSubmit: w,
|
|
170
194
|
handleBlur: () => {
|
|
171
195
|
},
|
|
172
|
-
setCommentDraft:
|
|
173
|
-
commentDraft:
|
|
174
|
-
editorRef:
|
|
175
|
-
initialContent:
|
|
196
|
+
setCommentDraft: T,
|
|
197
|
+
commentDraft: c,
|
|
198
|
+
editorRef: h,
|
|
199
|
+
initialContent: d?.text ?? ""
|
|
176
200
|
})
|
|
177
201
|
}
|
|
178
202
|
) }),
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
|
|
203
|
+
/* @__PURE__ */ r(se, { h: 10, "data-editor-spacer": !0, tabIndex: 0, style: { width: "100%" } }),
|
|
204
|
+
/* @__PURE__ */ r(
|
|
205
|
+
de,
|
|
182
206
|
{
|
|
183
207
|
files: m.files,
|
|
184
208
|
mode: "draft",
|
|
185
|
-
onRemove: (e) => R((
|
|
186
|
-
...
|
|
187
|
-
files:
|
|
209
|
+
onRemove: (e) => R((t) => ({
|
|
210
|
+
...t,
|
|
211
|
+
files: t.files.filter((s, o) => o !== e)
|
|
188
212
|
}))
|
|
189
213
|
}
|
|
190
214
|
),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
215
|
+
/* @__PURE__ */ C(
|
|
216
|
+
B,
|
|
193
217
|
{
|
|
194
|
-
justify:
|
|
218
|
+
justify: f ? "space-between" : "flex-end",
|
|
195
219
|
"data-comment-footer": !0,
|
|
196
220
|
align: "center",
|
|
197
221
|
w: "unset",
|
|
@@ -199,26 +223,26 @@ const be = ({
|
|
|
199
223
|
tabIndex: 0,
|
|
200
224
|
gap: "4px",
|
|
201
225
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
226
|
+
/* @__PURE__ */ r(
|
|
227
|
+
ie,
|
|
204
228
|
{
|
|
205
|
-
onChange: (e) =>
|
|
229
|
+
onChange: (e) => D(e, T),
|
|
206
230
|
multiple: !0,
|
|
207
|
-
children: (e) => /* @__PURE__ */
|
|
208
|
-
|
|
231
|
+
children: (e) => /* @__PURE__ */ r(U, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ r(
|
|
232
|
+
$,
|
|
209
233
|
{
|
|
210
234
|
style: { transform: "rotate(35deg)" },
|
|
211
|
-
icon:
|
|
235
|
+
icon: oe,
|
|
212
236
|
size: 20
|
|
213
237
|
}
|
|
214
238
|
) })
|
|
215
239
|
}
|
|
216
240
|
),
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
|
|
241
|
+
f ? /* @__PURE__ */ C(B, { gap: "8px", children: [
|
|
242
|
+
/* @__PURE__ */ r(
|
|
243
|
+
le,
|
|
220
244
|
{
|
|
221
|
-
onClick:
|
|
245
|
+
onClick: H,
|
|
222
246
|
"data-no-focus": !0,
|
|
223
247
|
style: {
|
|
224
248
|
cursor: "pointer",
|
|
@@ -227,29 +251,29 @@ const be = ({
|
|
|
227
251
|
background: "none",
|
|
228
252
|
border: "none"
|
|
229
253
|
},
|
|
230
|
-
children: /* @__PURE__ */
|
|
254
|
+
children: /* @__PURE__ */ r(ce, { size: "sm", c: "dimmed", children: y("composer.cancel") })
|
|
231
255
|
}
|
|
232
256
|
),
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
|
|
257
|
+
/* @__PURE__ */ r(
|
|
258
|
+
ae,
|
|
235
259
|
{
|
|
236
260
|
size: "xs",
|
|
237
261
|
radius: "md",
|
|
238
|
-
onClick:
|
|
239
|
-
disabled:
|
|
240
|
-
children:
|
|
262
|
+
onClick: w,
|
|
263
|
+
disabled: f ? F : !F,
|
|
264
|
+
children: y("composer.save")
|
|
241
265
|
}
|
|
242
266
|
)
|
|
243
|
-
] }) : /* @__PURE__ */
|
|
244
|
-
|
|
267
|
+
] }) : /* @__PURE__ */ r(
|
|
268
|
+
U,
|
|
245
269
|
{
|
|
246
270
|
color: "var(--mantine-primary-color-filled)",
|
|
247
271
|
size: "lg",
|
|
248
272
|
"data-comment-submit-button": !0,
|
|
249
273
|
variant: "filled",
|
|
250
|
-
onClick:
|
|
251
|
-
disabled: !
|
|
252
|
-
children: /* @__PURE__ */
|
|
274
|
+
onClick: w,
|
|
275
|
+
disabled: !c.text.trim() && c.files.length === 0,
|
|
276
|
+
children: /* @__PURE__ */ r($, { icon: ne, size: 20 })
|
|
253
277
|
}
|
|
254
278
|
)
|
|
255
279
|
]
|
|
@@ -260,7 +284,67 @@ const be = ({
|
|
|
260
284
|
)
|
|
261
285
|
}
|
|
262
286
|
);
|
|
287
|
+
return u ? /* @__PURE__ */ C(
|
|
288
|
+
_,
|
|
289
|
+
{
|
|
290
|
+
opened: !0,
|
|
291
|
+
position: "bottom-start",
|
|
292
|
+
offset: 10,
|
|
293
|
+
withinPortal: !1,
|
|
294
|
+
floatingStrategy: "fixed",
|
|
295
|
+
zIndex: 100,
|
|
296
|
+
middlewares: {
|
|
297
|
+
flip: { padding: 8 },
|
|
298
|
+
shift: { padding: 8 },
|
|
299
|
+
size: {
|
|
300
|
+
padding: 8,
|
|
301
|
+
apply: ({ availableHeight: e, rects: t, elements: s }) => {
|
|
302
|
+
const o = s.floating;
|
|
303
|
+
if (!o) return;
|
|
304
|
+
if (e < t.floating.height) {
|
|
305
|
+
const l = Math.max(e, 120);
|
|
306
|
+
Object.assign(o.style, {
|
|
307
|
+
maxHeight: `${l}px`,
|
|
308
|
+
overflowY: "auto"
|
|
309
|
+
}), o.setAttribute("data-constrained", "true");
|
|
310
|
+
} else
|
|
311
|
+
o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
styles: {
|
|
316
|
+
dropdown: {
|
|
317
|
+
padding: 0
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ r(_.Target, { children: /* @__PURE__ */ r(
|
|
322
|
+
"div",
|
|
323
|
+
{
|
|
324
|
+
ref: J,
|
|
325
|
+
style: {
|
|
326
|
+
position: "fixed",
|
|
327
|
+
width: "5px",
|
|
328
|
+
height: "5px",
|
|
329
|
+
pointerEvents: "none",
|
|
330
|
+
visibility: "hidden",
|
|
331
|
+
top: 0,
|
|
332
|
+
left: 0
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
) }),
|
|
336
|
+
/* @__PURE__ */ r(
|
|
337
|
+
_.Dropdown,
|
|
338
|
+
{
|
|
339
|
+
ref: X,
|
|
340
|
+
className: x.commentComposerFloat,
|
|
341
|
+
children: M
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
) : M;
|
|
263
347
|
};
|
|
264
348
|
export {
|
|
265
|
-
|
|
349
|
+
_e as CommentComposer
|
|
266
350
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
interface
|
|
2
|
-
boxRef: React.RefObject<HTMLDivElement>;
|
|
1
|
+
interface UseVirtualAnchorProps {
|
|
3
2
|
isFloat: boolean;
|
|
4
3
|
updateLocation?: (boxElem: HTMLDivElement, selectionRef: React.MutableRefObject<any>, selectionState: {
|
|
5
4
|
container: HTMLDivElement;
|
|
@@ -11,6 +10,6 @@ interface UseFloatingPositionProps {
|
|
|
11
10
|
elements: HTMLSpanElement[];
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
|
-
export declare function
|
|
13
|
+
export declare function useVirtualAnchor({ isFloat, updateLocation, selectionRef, selectionState, }: UseVirtualAnchorProps): import("react").MutableRefObject<HTMLDivElement | null>;
|
|
15
14
|
export {};
|
|
16
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=useVirtualAnchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVirtualAnchor.d.ts","sourceRoot":"","sources":["../../../src/components/CommentComposer/useVirtualAnchor.ts"],"names":[],"mappings":"AAEA,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EACzC,cAAc,EAAE;QACd,SAAS,EAAE,cAAc,CAAC;QAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;KAC7B,KACE,IAAI,CAAC;IACV,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC1C,cAAc,EAAE;QACd,SAAS,EAAE,cAAc,CAAC;QAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,cAAc,EACd,YAAY,EACZ,cAAc,GACf,EAAE,qBAAqB,2DAsHvB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useRef as h, useCallback as g, useLayoutEffect as p, useEffect as d } from "react";
|
|
2
|
+
function R({
|
|
3
|
+
isFloat: n,
|
|
4
|
+
updateLocation: f,
|
|
5
|
+
selectionRef: m,
|
|
6
|
+
selectionState: o
|
|
7
|
+
}) {
|
|
8
|
+
const u = h(null), a = h(null), b = h(!1), c = g(() => {
|
|
9
|
+
if (!u.current || !n) return;
|
|
10
|
+
const { elements: e } = o;
|
|
11
|
+
if (!e || e.length === 0) return;
|
|
12
|
+
const i = e[0], r = e[e.length - 1];
|
|
13
|
+
if (!i.isConnected || !r.isConnected) return;
|
|
14
|
+
const t = i.getBoundingClientRect(), s = r.getBoundingClientRect(), l = {
|
|
15
|
+
top: t.top,
|
|
16
|
+
bottom: s.bottom,
|
|
17
|
+
left: Math.min(t.left, s.left),
|
|
18
|
+
right: Math.max(t.right, s.right),
|
|
19
|
+
width: Math.max(t.right, s.right) - Math.min(t.left, s.left),
|
|
20
|
+
height: s.bottom - t.top,
|
|
21
|
+
x: Math.min(t.left, s.left),
|
|
22
|
+
y: t.top
|
|
23
|
+
};
|
|
24
|
+
a.current = l, u.current && (u.current.style.top = `${l.top}px`, u.current.style.left = `${l.left}px`), b.current = !0;
|
|
25
|
+
}, [n, o]);
|
|
26
|
+
return p(() => {
|
|
27
|
+
if (!n || !f) return;
|
|
28
|
+
const e = u.current;
|
|
29
|
+
if (!e) return;
|
|
30
|
+
f(e, m, o);
|
|
31
|
+
const i = setTimeout(() => {
|
|
32
|
+
c();
|
|
33
|
+
}, 50), r = o.container, t = document.body;
|
|
34
|
+
return t && r && !t.contains(r) && t.appendChild(r), () => {
|
|
35
|
+
clearTimeout(i), t && r && t.contains(r) && t.removeChild(r);
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
n,
|
|
39
|
+
f,
|
|
40
|
+
m,
|
|
41
|
+
o,
|
|
42
|
+
c
|
|
43
|
+
]), d(() => {
|
|
44
|
+
if (!n) return;
|
|
45
|
+
const e = new ResizeObserver(() => {
|
|
46
|
+
c();
|
|
47
|
+
}), i = new MutationObserver(() => {
|
|
48
|
+
c();
|
|
49
|
+
});
|
|
50
|
+
return o.elements.length > 0 && o.elements.forEach((r) => {
|
|
51
|
+
e.observe(r), i.observe(r, {
|
|
52
|
+
attributes: !0,
|
|
53
|
+
childList: !0,
|
|
54
|
+
subtree: !0
|
|
55
|
+
});
|
|
56
|
+
}), () => {
|
|
57
|
+
e.disconnect(), i.disconnect();
|
|
58
|
+
};
|
|
59
|
+
}, [n, o.elements, c]), d(() => {
|
|
60
|
+
if (!n) return;
|
|
61
|
+
const e = () => {
|
|
62
|
+
c();
|
|
63
|
+
};
|
|
64
|
+
return window.addEventListener("scroll", e, { passive: !0 }), () => {
|
|
65
|
+
window.removeEventListener("scroll", e);
|
|
66
|
+
};
|
|
67
|
+
}, [n, c]), u;
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
R as useVirtualAnchor
|
|
71
|
+
};
|
|
@@ -80,7 +80,7 @@ const _ = [
|
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
value: "unsplash",
|
|
83
|
-
label: /* @__PURE__ */ e(r, { children: !l && /* @__PURE__ */ e("span", { children: n
|
|
83
|
+
label: /* @__PURE__ */ e(r, { children: !l && /* @__PURE__ */ e("span", { children: n.searchImages }) }),
|
|
84
84
|
visible: a.includes("unsplash") && d
|
|
85
85
|
},
|
|
86
86
|
{
|
|
@@ -10,19 +10,19 @@ export declare const useFormGlobalTheme: ({ innerId }: {
|
|
|
10
10
|
black?: string | undefined;
|
|
11
11
|
colors?: {
|
|
12
12
|
[x: string & {}]: import("@mantine/core").MantineColorsTuple | undefined;
|
|
13
|
-
gray?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
14
13
|
blue?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
14
|
+
indigo?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
15
15
|
violet?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
16
|
-
|
|
16
|
+
grape?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
17
17
|
green?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
18
|
+
orange?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
19
|
+
gray?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
20
|
+
cyan?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
18
21
|
yellow?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
19
22
|
red?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
20
23
|
dark?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
21
24
|
pink?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
22
|
-
grape?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
23
|
-
indigo?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
24
25
|
lime?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
25
|
-
orange?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
26
26
|
teal?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
27
27
|
} | undefined;
|
|
28
28
|
primaryShade?: import("@mantine/core").MantineColorShade | {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AvatarProps } from '@mantine/core';
|
|
2
|
+
export interface GroupAvatarProps extends Omit<AvatarProps, 'src'>, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AvatarProps> {
|
|
3
|
+
groupIcon?: string | null;
|
|
4
|
+
groupId?: string;
|
|
5
|
+
groupName?: string;
|
|
6
|
+
size?: number | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const GroupAvatar: import("react").ForwardRefExoticComponent<GroupAvatarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GroupAvatar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAC9B,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,WAAW,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,6GAgBvB,CAAC"}
|