@goliapkg/gds 2.1.1 → 2.2.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/a11y-CoNNB_xa.js +6 -0
- package/dist/a11y-CoNNB_xa.js.map +1 -0
- package/dist/{avatar-Ct8OOGx6.js → avatar-oCar1zX6.js} +2 -2
- package/dist/{avatar-Ct8OOGx6.js.map → avatar-oCar1zX6.js.map} +1 -1
- package/dist/{badge-BCvi5RVF.js → badge-B3ijD3ch.js} +2 -2
- package/dist/{badge-BCvi5RVF.js.map → badge-B3ijD3ch.js.map} +1 -1
- package/dist/{button-BD3VHhwq.js → button-fRpdsI_4.js} +15 -41
- package/dist/button-fRpdsI_4.js.map +1 -0
- package/dist/dist-qdXk1a7h.js +35 -0
- package/dist/dist-qdXk1a7h.js.map +1 -0
- package/dist/{dom-17XgfxMq.js → dom-DkPgnDHP.js} +1 -1
- package/dist/{dom-17XgfxMq.js.map → dom-DkPgnDHP.js.map} +1 -1
- package/dist/editor/index.d.ts +11 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +1250 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/email-composer-field-UoKh5XMX.js +178 -0
- package/dist/email-composer-field-UoKh5XMX.js.map +1 -0
- package/dist/{gesture-I79dlTuS.js → gesture-CVcSA-iZ.js} +1 -1
- package/dist/{gesture-I79dlTuS.js.map → gesture-CVcSA-iZ.js.map} +1 -1
- package/dist/{highlight-BAGZc-4h.js → highlight-pgwGrmcq.js} +1 -1
- package/dist/{highlight-BAGZc-4h.js.map → highlight-pgwGrmcq.js.map} +1 -1
- package/dist/{hooks-BE-_EmDI.js → hooks-CejfTXVD.js} +1 -1
- package/dist/{hooks-BE-_EmDI.js.map → hooks-CejfTXVD.js.map} +1 -1
- package/dist/{icon-button-Bns79124.js → icon-button-CR2GECEZ.js} +3 -3
- package/dist/{icon-button-Bns79124.js.map → icon-button-CR2GECEZ.js.map} +1 -1
- package/dist/index.js +30 -27
- package/dist/l2-primitives/index.js +11 -11
- package/dist/{l2-primitives-Cn0KNxbB.js → l2-primitives-D503ozjH.js} +4 -4
- package/dist/{l2-primitives-Cn0KNxbB.js.map → l2-primitives-D503ozjH.js.map} +1 -1
- package/dist/l3-atoms/index.js +6 -5
- package/dist/{l3-atoms-BCJNqPHk.js → l3-atoms-CumlHlnP.js} +54 -53
- package/dist/{l3-atoms-BCJNqPHk.js.map → l3-atoms-CumlHlnP.js.map} +1 -1
- package/dist/l4-molecules/index.js +5 -4
- package/dist/{l4-molecules-DtNnQaFU.js → l4-molecules-CWwgFWmO.js} +125 -124
- package/dist/{l4-molecules-DtNnQaFU.js.map → l4-molecules-CWwgFWmO.js.map} +1 -1
- package/dist/l5-organisms/index.d.ts +0 -10
- package/dist/l5-organisms/index.d.ts.map +1 -1
- package/dist/l5-organisms/index.js +2 -2
- package/dist/{l5-organisms-Bu2Z8LSj.js → l5-organisms-QcvIAoHr.js} +1310 -2548
- package/dist/l5-organisms-QcvIAoHr.js.map +1 -0
- package/dist/l6-charts/index.js +1 -1
- package/dist/{l6-charts-DEA5DgMy.js → l6-charts-DKNVGuo0.js} +145 -17
- package/dist/l6-charts-DKNVGuo0.js.map +1 -0
- package/dist/l7-patterns/index.js +1 -1
- package/dist/{l7-patterns-CwonNW9o.js → l7-patterns-CM3FUxjA.js} +34 -34
- package/dist/{l7-patterns-CwonNW9o.js.map → l7-patterns-CM3FUxjA.js.map} +1 -1
- package/dist/loading-dots-CjzCz938.js +24 -0
- package/dist/loading-dots-CjzCz938.js.map +1 -0
- package/dist/motion-CKB1OKVd.js +22 -0
- package/dist/motion-CKB1OKVd.js.map +1 -0
- package/dist/{portal-Bbl6F_Wj.js → portal-B7bfstxv.js} +1 -1
- package/dist/{portal-Bbl6F_Wj.js.map → portal-B7bfstxv.js.map} +1 -1
- package/dist/{progress-dZIQEiTw.js → progress-B81FKPw5.js} +2 -2
- package/dist/{progress-dZIQEiTw.js.map → progress-B81FKPw5.js.map} +1 -1
- package/dist/{resize-handle-BjSNhgJK.js → resize-handle-BFffbhyG.js} +2 -2
- package/dist/{resize-handle-BjSNhgJK.js.map → resize-handle-BFffbhyG.js.map} +1 -1
- package/dist/{sanitize-BF45M9xp.js → sanitize-CO5dRqZX.js} +1 -1
- package/dist/{sanitize-BF45M9xp.js.map → sanitize-CO5dRqZX.js.map} +1 -1
- package/dist/{separator-CRll1Ycp.js → separator-wAUWmxji.js} +2 -2
- package/dist/{separator-CRll1Ycp.js.map → separator-wAUWmxji.js.map} +1 -1
- package/dist/{skeleton-C9FFZSYN.js → skeleton-DhqLfA7r.js} +1 -1
- package/dist/{skeleton-C9FFZSYN.js.map → skeleton-DhqLfA7r.js.map} +1 -1
- package/dist/{spinner-C15eER04.js → spinner-BimzKtfC.js} +3 -3
- package/dist/{spinner-C15eER04.js.map → spinner-BimzKtfC.js.map} +1 -1
- package/dist/{stepper-DJ8pn-9D.js → stepper-BINbai2f.js} +4 -4
- package/dist/{stepper-DJ8pn-9D.js.map → stepper-BINbai2f.js.map} +1 -1
- package/dist/{switch-BAS-GXJV.js → switch-COzaggYE.js} +3 -3
- package/dist/{switch-BAS-GXJV.js.map → switch-COzaggYE.js.map} +1 -1
- package/dist/{textarea-Btdu41rY.js → textarea-DD1huKel.js} +3 -3
- package/dist/{textarea-Btdu41rY.js.map → textarea-DD1huKel.js.map} +1 -1
- package/dist/toast-BujeTn1T.js +442 -0
- package/dist/toast-BujeTn1T.js.map +1 -0
- package/dist/{loading-dots-C1LPHGa0.js → tooltip-BlvhLCp0.js} +2 -17
- package/dist/tooltip-BlvhLCp0.js.map +1 -0
- package/dist/utils/index.js +8 -7
- package/package.json +5 -1
- package/dist/button-BD3VHhwq.js.map +0 -1
- package/dist/l5-organisms-Bu2Z8LSj.js.map +0 -1
- package/dist/l6-charts-DEA5DgMy.js.map +0 -1
- package/dist/loading-dots-C1LPHGa0.js.map +0 -1
- package/dist/motion-DUPegem-.js +0 -22
- package/dist/motion-DUPegem-.js.map +0 -1
- package/dist/toast-QxCZG0Oy.js +0 -614
- package/dist/toast-QxCZG0Oy.js.map +0 -1
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
import { r as e, t } from "../glass-CQTlX7IO.js";
|
|
2
|
+
import { t as n } from "../icon-button-CR2GECEZ.js";
|
|
3
|
+
import { t as r } from "../avatar-oCar1zX6.js";
|
|
4
|
+
import { t as i } from "../tooltip-BlvhLCp0.js";
|
|
5
|
+
import { t as a } from "../email-composer-field-UoKh5XMX.js";
|
|
6
|
+
import { n as o, t as s } from "../sanitize-CO5dRqZX.js";
|
|
7
|
+
import { createContext as c, createElement as l, forwardRef as u, useCallback as d, useContext as f, useEffect as p, useImperativeHandle as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
8
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
|
+
import { CodeBlockLowlight as x } from "@tiptap/extension-code-block-lowlight";
|
|
10
|
+
import { Image as S } from "@tiptap/extension-image";
|
|
11
|
+
import { Link as C } from "@tiptap/extension-link";
|
|
12
|
+
import { Placeholder as w } from "@tiptap/extension-placeholder";
|
|
13
|
+
import { Table as T, TableCell as E, TableHeader as D, TableRow as O } from "@tiptap/extension-table";
|
|
14
|
+
import { TaskItem as k } from "@tiptap/extension-task-item";
|
|
15
|
+
import { TaskList as ee } from "@tiptap/extension-task-list";
|
|
16
|
+
import { Underline as A } from "@tiptap/extension-underline";
|
|
17
|
+
import { EditorContent as j, useEditor as M } from "@tiptap/react";
|
|
18
|
+
import { StarterKit as N } from "@tiptap/starter-kit";
|
|
19
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
20
|
+
var P = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), F = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), I = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), L = (e) => {
|
|
21
|
+
let t = I(e);
|
|
22
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
23
|
+
}, R = {
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
width: 24,
|
|
26
|
+
height: 24,
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
fill: "none",
|
|
29
|
+
stroke: "currentColor",
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
strokeLinecap: "round",
|
|
32
|
+
strokeLinejoin: "round"
|
|
33
|
+
}, z = (e) => {
|
|
34
|
+
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
35
|
+
return !1;
|
|
36
|
+
}, B = c({}), V = () => f(B), H = u(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => {
|
|
37
|
+
let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = V() ?? {}, h = r ?? f ? Number(n ?? d) * 24 / Number(t ?? u) : n ?? d;
|
|
38
|
+
return l("svg", {
|
|
39
|
+
ref: c,
|
|
40
|
+
...R,
|
|
41
|
+
width: t ?? u ?? R.width,
|
|
42
|
+
height: t ?? u ?? R.height,
|
|
43
|
+
stroke: e ?? p,
|
|
44
|
+
strokeWidth: h,
|
|
45
|
+
className: P("lucide", m, i),
|
|
46
|
+
...!a && !z(s) && { "aria-hidden": "true" },
|
|
47
|
+
...s
|
|
48
|
+
}, [...o.map(([e, t]) => l(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
49
|
+
}), U = (e, t) => {
|
|
50
|
+
let n = u(({ className: n, ...r }, i) => l(H, {
|
|
51
|
+
ref: i,
|
|
52
|
+
iconNode: t,
|
|
53
|
+
className: P(`lucide-${F(L(e))}`, `lucide-${e}`, n),
|
|
54
|
+
...r
|
|
55
|
+
}));
|
|
56
|
+
return n.displayName = L(e), n;
|
|
57
|
+
}, W = U("chevron-down", [["path", {
|
|
58
|
+
d: "m6 9 6 6 6-6",
|
|
59
|
+
key: "qrunsl"
|
|
60
|
+
}]]), G = U("chevron-right", [["path", {
|
|
61
|
+
d: "m9 18 6-6-6-6",
|
|
62
|
+
key: "mthhwq"
|
|
63
|
+
}]]), K = U("download", [
|
|
64
|
+
["path", {
|
|
65
|
+
d: "M12 15V3",
|
|
66
|
+
key: "m9g1x1"
|
|
67
|
+
}],
|
|
68
|
+
["path", {
|
|
69
|
+
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
70
|
+
key: "ih7n3h"
|
|
71
|
+
}],
|
|
72
|
+
["path", {
|
|
73
|
+
d: "m7 10 5 5 5-5",
|
|
74
|
+
key: "brsn70"
|
|
75
|
+
}]
|
|
76
|
+
]), q = U("file-text", [
|
|
77
|
+
["path", {
|
|
78
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
79
|
+
key: "1oefj6"
|
|
80
|
+
}],
|
|
81
|
+
["path", {
|
|
82
|
+
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
83
|
+
key: "wfsgrz"
|
|
84
|
+
}],
|
|
85
|
+
["path", {
|
|
86
|
+
d: "M10 9H8",
|
|
87
|
+
key: "b1mrlr"
|
|
88
|
+
}],
|
|
89
|
+
["path", {
|
|
90
|
+
d: "M16 13H8",
|
|
91
|
+
key: "t4e002"
|
|
92
|
+
}],
|
|
93
|
+
["path", {
|
|
94
|
+
d: "M16 17H8",
|
|
95
|
+
key: "z1uh3a"
|
|
96
|
+
}]
|
|
97
|
+
]), J = U("forward", [["path", {
|
|
98
|
+
d: "m15 17 5-5-5-5",
|
|
99
|
+
key: "nf172w"
|
|
100
|
+
}], ["path", {
|
|
101
|
+
d: "M4 18v-2a4 4 0 0 1 4-4h12",
|
|
102
|
+
key: "jmiej9"
|
|
103
|
+
}]]), Y = U("image", [
|
|
104
|
+
["rect", {
|
|
105
|
+
width: "18",
|
|
106
|
+
height: "18",
|
|
107
|
+
x: "3",
|
|
108
|
+
y: "3",
|
|
109
|
+
rx: "2",
|
|
110
|
+
ry: "2",
|
|
111
|
+
key: "1m3agn"
|
|
112
|
+
}],
|
|
113
|
+
["circle", {
|
|
114
|
+
cx: "9",
|
|
115
|
+
cy: "9",
|
|
116
|
+
r: "2",
|
|
117
|
+
key: "af1f0g"
|
|
118
|
+
}],
|
|
119
|
+
["path", {
|
|
120
|
+
d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",
|
|
121
|
+
key: "1xmnt7"
|
|
122
|
+
}]
|
|
123
|
+
]), X = U("paperclip", [["path", {
|
|
124
|
+
d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
|
|
125
|
+
key: "1miecu"
|
|
126
|
+
}]]), te = U("reply-all", [
|
|
127
|
+
["path", {
|
|
128
|
+
d: "m12 17-5-5 5-5",
|
|
129
|
+
key: "1s3y5u"
|
|
130
|
+
}],
|
|
131
|
+
["path", {
|
|
132
|
+
d: "M22 18v-2a4 4 0 0 0-4-4H7",
|
|
133
|
+
key: "1fcyog"
|
|
134
|
+
}],
|
|
135
|
+
["path", {
|
|
136
|
+
d: "m7 17-5-5 5-5",
|
|
137
|
+
key: "1ed8i2"
|
|
138
|
+
}]
|
|
139
|
+
]), ne = U("reply", [["path", {
|
|
140
|
+
d: "M20 18v-2a4 4 0 0 0-4-4H4",
|
|
141
|
+
key: "5vmcpk"
|
|
142
|
+
}], ["path", {
|
|
143
|
+
d: "m9 17-5-5 5-5",
|
|
144
|
+
key: "nvlc11"
|
|
145
|
+
}]]), re = U("send", [["path", {
|
|
146
|
+
d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
|
|
147
|
+
key: "1ffxy3"
|
|
148
|
+
}], ["path", {
|
|
149
|
+
d: "m21.854 2.147-10.94 10.939",
|
|
150
|
+
key: "12cjpa"
|
|
151
|
+
}]]), Z = U("sparkles", [
|
|
152
|
+
["path", {
|
|
153
|
+
d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",
|
|
154
|
+
key: "1s2grr"
|
|
155
|
+
}],
|
|
156
|
+
["path", {
|
|
157
|
+
d: "M20 2v4",
|
|
158
|
+
key: "1rf3ol"
|
|
159
|
+
}],
|
|
160
|
+
["path", {
|
|
161
|
+
d: "M22 4h-4",
|
|
162
|
+
key: "gwowj6"
|
|
163
|
+
}],
|
|
164
|
+
["circle", {
|
|
165
|
+
cx: "4",
|
|
166
|
+
cy: "20",
|
|
167
|
+
r: "2",
|
|
168
|
+
key: "6kqj1y"
|
|
169
|
+
}]
|
|
170
|
+
]), ie = U("trash-2", [
|
|
171
|
+
["path", {
|
|
172
|
+
d: "M10 11v6",
|
|
173
|
+
key: "nco0om"
|
|
174
|
+
}],
|
|
175
|
+
["path", {
|
|
176
|
+
d: "M14 11v6",
|
|
177
|
+
key: "outv1u"
|
|
178
|
+
}],
|
|
179
|
+
["path", {
|
|
180
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
|
|
181
|
+
key: "miytrc"
|
|
182
|
+
}],
|
|
183
|
+
["path", {
|
|
184
|
+
d: "M3 6h18",
|
|
185
|
+
key: "d0wm0j"
|
|
186
|
+
}],
|
|
187
|
+
["path", {
|
|
188
|
+
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
189
|
+
key: "e791ji"
|
|
190
|
+
}]
|
|
191
|
+
]), ae = U("x", [["path", {
|
|
192
|
+
d: "M18 6 6 18",
|
|
193
|
+
key: "1bl5f8"
|
|
194
|
+
}], ["path", {
|
|
195
|
+
d: "m6 6 12 12",
|
|
196
|
+
key: "d8bk6v"
|
|
197
|
+
}]]);
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/l5-organisms/rich-text-editor.tsx
|
|
200
|
+
function oe() {
|
|
201
|
+
return [
|
|
202
|
+
{
|
|
203
|
+
key: "bold",
|
|
204
|
+
label: "Bold",
|
|
205
|
+
shortcut: "Ctrl+B",
|
|
206
|
+
icon: /* @__PURE__ */ y("span", {
|
|
207
|
+
className: "font-bold",
|
|
208
|
+
children: "B"
|
|
209
|
+
}),
|
|
210
|
+
action: (e) => e.chain().focus().toggleBold().run(),
|
|
211
|
+
isActive: (e) => e.isActive("bold")
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
key: "italic",
|
|
215
|
+
label: "Italic",
|
|
216
|
+
shortcut: "Ctrl+I",
|
|
217
|
+
icon: /* @__PURE__ */ y("span", {
|
|
218
|
+
className: "italic",
|
|
219
|
+
children: "I"
|
|
220
|
+
}),
|
|
221
|
+
action: (e) => e.chain().focus().toggleItalic().run(),
|
|
222
|
+
isActive: (e) => e.isActive("italic")
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
key: "underline",
|
|
226
|
+
label: "Underline",
|
|
227
|
+
shortcut: "Ctrl+U",
|
|
228
|
+
icon: /* @__PURE__ */ y("span", {
|
|
229
|
+
className: "underline",
|
|
230
|
+
children: "U"
|
|
231
|
+
}),
|
|
232
|
+
action: (e) => e.chain().focus().toggleUnderline().run(),
|
|
233
|
+
isActive: (e) => e.isActive("underline")
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
key: "strikethrough",
|
|
237
|
+
label: "Strikethrough",
|
|
238
|
+
icon: /* @__PURE__ */ y("span", {
|
|
239
|
+
className: "line-through",
|
|
240
|
+
children: "S"
|
|
241
|
+
}),
|
|
242
|
+
action: (e) => e.chain().focus().toggleStrike().run(),
|
|
243
|
+
isActive: (e) => e.isActive("strike")
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
key: "code",
|
|
247
|
+
label: "Inline Code",
|
|
248
|
+
icon: /* @__PURE__ */ y("span", {
|
|
249
|
+
className: "font-mono text-[11px]",
|
|
250
|
+
children: "</>"
|
|
251
|
+
}),
|
|
252
|
+
action: (e) => e.chain().focus().toggleCode().run(),
|
|
253
|
+
isActive: (e) => e.isActive("code")
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: "codeBlock",
|
|
257
|
+
label: "Code Block",
|
|
258
|
+
icon: /* @__PURE__ */ y("span", {
|
|
259
|
+
className: "font-mono text-[10px]",
|
|
260
|
+
children: "{ }"
|
|
261
|
+
}),
|
|
262
|
+
action: (e) => e.chain().focus().toggleCodeBlock().run(),
|
|
263
|
+
isActive: (e) => e.isActive("codeBlock")
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: "heading",
|
|
267
|
+
label: "Heading",
|
|
268
|
+
icon: /* @__PURE__ */ y("span", {
|
|
269
|
+
className: "text-[11px] font-bold",
|
|
270
|
+
children: "H"
|
|
271
|
+
}),
|
|
272
|
+
action: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
273
|
+
isActive: (e) => e.isActive("heading")
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "blockquote",
|
|
277
|
+
label: "Blockquote",
|
|
278
|
+
icon: /* @__PURE__ */ y("span", {
|
|
279
|
+
className: "text-[13px]",
|
|
280
|
+
children: "\""
|
|
281
|
+
}),
|
|
282
|
+
action: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
283
|
+
isActive: (e) => e.isActive("blockquote")
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
key: "bulletList",
|
|
287
|
+
label: "Bullet List",
|
|
288
|
+
icon: /* @__PURE__ */ y("span", {
|
|
289
|
+
className: "text-[11px]",
|
|
290
|
+
children: "•"
|
|
291
|
+
}),
|
|
292
|
+
action: (e) => e.chain().focus().toggleBulletList().run(),
|
|
293
|
+
isActive: (e) => e.isActive("bulletList")
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
key: "orderedList",
|
|
297
|
+
label: "Ordered List",
|
|
298
|
+
icon: /* @__PURE__ */ y("span", {
|
|
299
|
+
className: "text-[11px]",
|
|
300
|
+
children: "1."
|
|
301
|
+
}),
|
|
302
|
+
action: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
303
|
+
isActive: (e) => e.isActive("orderedList")
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
key: "taskList",
|
|
307
|
+
label: "Task List",
|
|
308
|
+
icon: /* @__PURE__ */ y("span", {
|
|
309
|
+
className: "text-[11px]",
|
|
310
|
+
children: "☑"
|
|
311
|
+
}),
|
|
312
|
+
action: (e) => e.chain().focus().toggleTaskList().run(),
|
|
313
|
+
isActive: (e) => e.isActive("taskList")
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
key: "link",
|
|
317
|
+
label: "Link",
|
|
318
|
+
icon: /* @__PURE__ */ y("span", {
|
|
319
|
+
className: "text-[11px]",
|
|
320
|
+
children: "🔗"
|
|
321
|
+
}),
|
|
322
|
+
action: (e) => {
|
|
323
|
+
if (typeof window > "u") return;
|
|
324
|
+
let t = window.prompt("Enter URL");
|
|
325
|
+
t !== null && t !== "" && e.chain().focus().setLink({ href: t }).run();
|
|
326
|
+
},
|
|
327
|
+
isActive: (e) => e.isActive("link")
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
key: "image",
|
|
331
|
+
label: "Image",
|
|
332
|
+
icon: /* @__PURE__ */ y("span", {
|
|
333
|
+
className: "text-[11px]",
|
|
334
|
+
children: "🖼"
|
|
335
|
+
}),
|
|
336
|
+
action: (e) => {
|
|
337
|
+
if (typeof window > "u") return;
|
|
338
|
+
let t = window.prompt("Enter image URL");
|
|
339
|
+
t !== null && t !== "" && e.chain().focus().setImage({ src: t }).run();
|
|
340
|
+
},
|
|
341
|
+
isActive: () => !1
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "table",
|
|
345
|
+
label: "Table",
|
|
346
|
+
icon: /* @__PURE__ */ y("span", {
|
|
347
|
+
className: "text-[10px]",
|
|
348
|
+
children: "⊞"
|
|
349
|
+
}),
|
|
350
|
+
action: (e) => e.chain().focus().insertTable({
|
|
351
|
+
rows: 3,
|
|
352
|
+
cols: 3
|
|
353
|
+
}).run(),
|
|
354
|
+
isActive: () => !1
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
key: "divider",
|
|
358
|
+
label: "Divider",
|
|
359
|
+
icon: /* @__PURE__ */ y("span", {
|
|
360
|
+
className: "text-[11px]",
|
|
361
|
+
children: "—"
|
|
362
|
+
}),
|
|
363
|
+
action: (e) => e.chain().focus().setHorizontalRule().run(),
|
|
364
|
+
isActive: () => !1
|
|
365
|
+
}
|
|
366
|
+
];
|
|
367
|
+
}
|
|
368
|
+
var se = [
|
|
369
|
+
"bold",
|
|
370
|
+
"italic",
|
|
371
|
+
"underline",
|
|
372
|
+
"strikethrough",
|
|
373
|
+
"|",
|
|
374
|
+
"code",
|
|
375
|
+
"codeBlock",
|
|
376
|
+
"|",
|
|
377
|
+
"heading",
|
|
378
|
+
"blockquote",
|
|
379
|
+
"|",
|
|
380
|
+
"bulletList",
|
|
381
|
+
"orderedList",
|
|
382
|
+
"taskList",
|
|
383
|
+
"|",
|
|
384
|
+
"link",
|
|
385
|
+
"image",
|
|
386
|
+
"table",
|
|
387
|
+
"divider"
|
|
388
|
+
], ce = [
|
|
389
|
+
"bold",
|
|
390
|
+
"italic",
|
|
391
|
+
"underline",
|
|
392
|
+
"|",
|
|
393
|
+
"link"
|
|
394
|
+
], le = u(function({ value: n, defaultValue: r, onChange: i, placeholder: a, mode: o = "full", toolbar: s = !0, toolbarItems: c, onImageUpload: l, onSubmit: u, glass: d, className: f, ...g }, _) {
|
|
395
|
+
let v = n !== void 0, P = n ?? r ?? "", F = M({
|
|
396
|
+
extensions: h(() => o === "minimal" ? [
|
|
397
|
+
N.configure({
|
|
398
|
+
code: !1,
|
|
399
|
+
codeBlock: !1,
|
|
400
|
+
heading: !1,
|
|
401
|
+
blockquote: !1
|
|
402
|
+
}),
|
|
403
|
+
C.configure({
|
|
404
|
+
autolink: !0,
|
|
405
|
+
openOnClick: !1
|
|
406
|
+
}),
|
|
407
|
+
A,
|
|
408
|
+
w.configure({ placeholder: a ?? "" })
|
|
409
|
+
] : [
|
|
410
|
+
N.configure({ codeBlock: !1 }),
|
|
411
|
+
x.configure({}),
|
|
412
|
+
S.configure({ inline: !0 }),
|
|
413
|
+
C.configure({
|
|
414
|
+
autolink: !0,
|
|
415
|
+
openOnClick: !1,
|
|
416
|
+
HTMLAttributes: {
|
|
417
|
+
target: "_blank",
|
|
418
|
+
rel: "noopener noreferrer"
|
|
419
|
+
}
|
|
420
|
+
}),
|
|
421
|
+
T.configure({ resizable: !0 }),
|
|
422
|
+
O,
|
|
423
|
+
E,
|
|
424
|
+
D,
|
|
425
|
+
ee,
|
|
426
|
+
k.configure({ nested: !0 }),
|
|
427
|
+
A,
|
|
428
|
+
w.configure({ placeholder: a ?? "" })
|
|
429
|
+
], [o, a]),
|
|
430
|
+
content: P,
|
|
431
|
+
onUpdate: ({ editor: e }) => {
|
|
432
|
+
i !== void 0 && i(e.getHTML(), e.getText());
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
p(() => {
|
|
436
|
+
v && F !== null && n !== F.getHTML() && F.commands.setContent(n, { emitUpdate: !1 });
|
|
437
|
+
}, [
|
|
438
|
+
v,
|
|
439
|
+
n,
|
|
440
|
+
F
|
|
441
|
+
]), p(() => {
|
|
442
|
+
if (F === null || u === void 0) return;
|
|
443
|
+
let e = (e) => {
|
|
444
|
+
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), u());
|
|
445
|
+
}, t = F.view.dom;
|
|
446
|
+
return t.addEventListener("keydown", e), () => t.removeEventListener("keydown", e);
|
|
447
|
+
}, [F, u]), p(() => {
|
|
448
|
+
if (F === null || l === void 0) return;
|
|
449
|
+
let e = async (e) => {
|
|
450
|
+
let t = e.dataTransfer?.files;
|
|
451
|
+
if (!(t === void 0 || t.length === 0)) {
|
|
452
|
+
for (let n of Array.from(t)) if (n.type.startsWith("image/")) {
|
|
453
|
+
e.preventDefault();
|
|
454
|
+
let t = await l(n);
|
|
455
|
+
t !== null && F.chain().focus().setImage({ src: t }).run();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}, t = async (e) => {
|
|
459
|
+
let t = e.clipboardData?.files;
|
|
460
|
+
if (!(t === void 0 || t.length === 0)) {
|
|
461
|
+
for (let n of Array.from(t)) if (n.type.startsWith("image/")) {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
let t = await l(n);
|
|
464
|
+
t !== null && F.chain().focus().setImage({ src: t }).run();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}, n = F.view.dom, r = (t) => {
|
|
468
|
+
e(t);
|
|
469
|
+
}, i = (e) => {
|
|
470
|
+
t(e);
|
|
471
|
+
};
|
|
472
|
+
return n.addEventListener("drop", r), n.addEventListener("paste", i), () => {
|
|
473
|
+
n.removeEventListener("drop", r), n.removeEventListener("paste", i);
|
|
474
|
+
};
|
|
475
|
+
}, [F, l]), m(_, () => ({
|
|
476
|
+
focus: () => F?.commands.focus(),
|
|
477
|
+
getHTML: () => F?.getHTML() ?? "",
|
|
478
|
+
getText: () => F?.getText() ?? "",
|
|
479
|
+
getEditor: () => F,
|
|
480
|
+
setContent: (e) => F?.commands.setContent(e),
|
|
481
|
+
clearContent: () => F?.commands.clearContent(),
|
|
482
|
+
isEmpty: () => F?.isEmpty ?? !0
|
|
483
|
+
}), [F]);
|
|
484
|
+
let I = h(() => oe(), []), L = c ?? (o === "full" ? se : ce);
|
|
485
|
+
return /* @__PURE__ */ b("div", {
|
|
486
|
+
...g,
|
|
487
|
+
className: e("border-border gds-radius-input bg-surface flex flex-col overflow-hidden border", d === !0 && t(d), d === !0 && "bg-bg/60 border-white/10", f),
|
|
488
|
+
"data-component": "rich-text-editor",
|
|
489
|
+
"data-variant": o,
|
|
490
|
+
children: [s && F !== null && /* @__PURE__ */ y("div", {
|
|
491
|
+
className: "border-border bg-bg-secondary flex flex-wrap items-center gap-0.5 border-b px-2 py-1.5",
|
|
492
|
+
role: "toolbar",
|
|
493
|
+
"aria-label": "Formatting options",
|
|
494
|
+
children: L.map((t, n) => {
|
|
495
|
+
if (t === "|") return /* @__PURE__ */ y("div", {
|
|
496
|
+
className: "bg-border mx-1 h-4 w-px",
|
|
497
|
+
role: "separator"
|
|
498
|
+
}, `sep-${n}`);
|
|
499
|
+
let r = I.find((e) => e.key === t);
|
|
500
|
+
if (r === void 0) return null;
|
|
501
|
+
let i = r.isActive(F);
|
|
502
|
+
return /* @__PURE__ */ y("button", {
|
|
503
|
+
type: "button",
|
|
504
|
+
className: e("flex items-center justify-center rounded px-1.5 py-1 text-xs transition-colors select-none", i ? "bg-accent/15 text-accent" : "text-fg-muted hover:text-fg hover:bg-white/[0.04]"),
|
|
505
|
+
onClick: () => r.action(F),
|
|
506
|
+
title: r.shortcut === void 0 ? r.label : `${r.label} (${r.shortcut})`,
|
|
507
|
+
"aria-pressed": i,
|
|
508
|
+
"aria-label": r.label,
|
|
509
|
+
children: r.icon
|
|
510
|
+
}, r.key);
|
|
511
|
+
})
|
|
512
|
+
}), /* @__PURE__ */ y("div", {
|
|
513
|
+
className: "min-h-[120px] flex-1 overflow-y-auto",
|
|
514
|
+
"data-selectable": !0,
|
|
515
|
+
children: /* @__PURE__ */ y(j, {
|
|
516
|
+
editor: F,
|
|
517
|
+
className: e("prose prose-sm text-fg max-w-none px-3 py-2", "prose-headings:text-fg prose-p:text-fg prose-a:text-accent", "prose-strong:text-fg prose-em:text-fg", "prose-code:bg-bg-tertiary prose-code:rounded prose-code:px-1 prose-code:text-[0.85em]", "prose-pre:bg-bg-tertiary prose-pre:rounded-lg", "prose-blockquote:border-accent/30", "[&_.tiptap]:min-h-[100px] [&_.tiptap]:outline-none", "[&_.tiptap_p.is-editor-empty:first-child::before]:text-fg-muted/30 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0 [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]")
|
|
518
|
+
})
|
|
519
|
+
})]
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/l5-organisms/email-composer.tsx
|
|
524
|
+
function ue(e) {
|
|
525
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
526
|
+
}
|
|
527
|
+
function de(e, t, n, r, i, a) {
|
|
528
|
+
let o = [], s = [];
|
|
529
|
+
if (o.push(e), s.push(t), a !== void 0 && a !== "" && (o.push("<div style=\"margin-top:16px;border-top:1px solid #e5e5e5;padding-top:12px\">"), o.push(a), o.push("</div>"), s.push("\n-- \n")), r !== void 0 && r !== "") {
|
|
530
|
+
let e = i ?? "";
|
|
531
|
+
o.push("<div style=\"margin-top:16px;padding-left:12px;border-left:3px solid #d1d5db;color:#6b7280\">"), e !== "" && o.push(`<p style="margin-bottom:8px">${e}</p>`), o.push(r), o.push("</div>"), e !== "" && s.push(`\n${e}\n`), s.push("> (quoted content)");
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
html: o.join("\n"),
|
|
535
|
+
text: s.join("\n"),
|
|
536
|
+
attachments: n
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
var fe = u(function({ mode: n, to: r, onToChange: i, cc: o, onCcChange: c, bcc: l, onBccChange: u, showCc: f, showBcc: v, subject: x, onSubjectChange: S, onContactSearch: C, onImageUpload: w, quotedHtml: T, quotedHeader: E, signature: D, onSend: O, onDiscard: k, onSaveDraft: ee, submitLabel: A, submitShortcut: j, footerActions: M, glass: N, className: P, ...F }, I) {
|
|
540
|
+
let [L, R] = _(f === !0), [z, B] = _(v === !0), [V, H] = _([]), [U, W] = _(!0), G = g(null), K = g(null), q = h(() => T === void 0 || T === "" ? T : s(T), [T]), J = d(() => {
|
|
541
|
+
O(de(G.current?.getHTML() ?? "", G.current?.getText() ?? "", V, T, E, D));
|
|
542
|
+
}, [
|
|
543
|
+
V,
|
|
544
|
+
T,
|
|
545
|
+
E,
|
|
546
|
+
D,
|
|
547
|
+
O
|
|
548
|
+
]);
|
|
549
|
+
p(() => {
|
|
550
|
+
let e = (e) => {
|
|
551
|
+
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), J());
|
|
552
|
+
};
|
|
553
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
554
|
+
}, [J]);
|
|
555
|
+
let Y = d((e) => {
|
|
556
|
+
H((t) => [...t, ...Array.from(e)]);
|
|
557
|
+
}, []), te = d((e) => {
|
|
558
|
+
H((t) => {
|
|
559
|
+
let n = [...t];
|
|
560
|
+
return n.splice(e, 1), n;
|
|
561
|
+
});
|
|
562
|
+
}, []), ne = d((e) => {
|
|
563
|
+
e.preventDefault();
|
|
564
|
+
let t = e.dataTransfer.files;
|
|
565
|
+
t.length > 0 && Y(t);
|
|
566
|
+
}, [Y]);
|
|
567
|
+
m(I, () => ({
|
|
568
|
+
focus: () => G.current?.focus(),
|
|
569
|
+
getAssembled: () => de(G.current?.getHTML() ?? "", G.current?.getText() ?? "", V, T, E, D),
|
|
570
|
+
getEditorRef: () => G.current,
|
|
571
|
+
addAttachment: (e) => H((t) => [...t, e]),
|
|
572
|
+
clearContent: () => {
|
|
573
|
+
G.current?.clearContent(), H([]);
|
|
574
|
+
}
|
|
575
|
+
}), [
|
|
576
|
+
V,
|
|
577
|
+
T,
|
|
578
|
+
E,
|
|
579
|
+
D
|
|
580
|
+
]);
|
|
581
|
+
let Z = A ?? "Send", ie = j ?? "Ctrl+Enter";
|
|
582
|
+
return /* @__PURE__ */ b("div", {
|
|
583
|
+
...F,
|
|
584
|
+
className: e("border-border gds-radius-card bg-surface flex flex-col overflow-hidden border", N === !0 && t(N), N === !0 && "bg-bg/60 border-white/10", P),
|
|
585
|
+
"data-component": "email-composer",
|
|
586
|
+
"data-variant": n,
|
|
587
|
+
onDragOver: (e) => e.preventDefault(),
|
|
588
|
+
onDrop: ne,
|
|
589
|
+
children: [
|
|
590
|
+
/* @__PURE__ */ b("div", {
|
|
591
|
+
className: "border-border flex flex-col border-b",
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ b("div", {
|
|
594
|
+
className: "flex items-center",
|
|
595
|
+
children: [/* @__PURE__ */ y("div", {
|
|
596
|
+
className: "flex-1",
|
|
597
|
+
children: /* @__PURE__ */ y(a, {
|
|
598
|
+
label: "To",
|
|
599
|
+
value: r,
|
|
600
|
+
onChange: i,
|
|
601
|
+
onSearch: C
|
|
602
|
+
})
|
|
603
|
+
}), !L && !z && /* @__PURE__ */ b("div", {
|
|
604
|
+
className: "flex shrink-0 gap-1.5 px-2",
|
|
605
|
+
children: [/* @__PURE__ */ y("button", {
|
|
606
|
+
type: "button",
|
|
607
|
+
className: "gds-text-label text-fg-muted hover:text-accent transition-colors",
|
|
608
|
+
onClick: () => R(!0),
|
|
609
|
+
children: "Cc"
|
|
610
|
+
}), /* @__PURE__ */ y("button", {
|
|
611
|
+
type: "button",
|
|
612
|
+
className: "gds-text-label text-fg-muted hover:text-accent transition-colors",
|
|
613
|
+
onClick: () => B(!0),
|
|
614
|
+
children: "Bcc"
|
|
615
|
+
})]
|
|
616
|
+
})]
|
|
617
|
+
}),
|
|
618
|
+
L && c !== void 0 && /* @__PURE__ */ y(a, {
|
|
619
|
+
label: "Cc",
|
|
620
|
+
value: o ?? [],
|
|
621
|
+
onChange: c,
|
|
622
|
+
onSearch: C
|
|
623
|
+
}),
|
|
624
|
+
z && u !== void 0 && /* @__PURE__ */ y(a, {
|
|
625
|
+
label: "Bcc",
|
|
626
|
+
value: l ?? [],
|
|
627
|
+
onChange: u,
|
|
628
|
+
onSearch: C
|
|
629
|
+
})
|
|
630
|
+
]
|
|
631
|
+
}),
|
|
632
|
+
/* @__PURE__ */ y("div", {
|
|
633
|
+
className: "border-border border-b",
|
|
634
|
+
children: /* @__PURE__ */ y("input", {
|
|
635
|
+
type: "text",
|
|
636
|
+
value: x,
|
|
637
|
+
onChange: (e) => S(e.target.value),
|
|
638
|
+
placeholder: "Subject",
|
|
639
|
+
className: "gds-text-body text-fg placeholder:text-fg-muted/30 w-full bg-transparent px-3 py-2.5 outline-none"
|
|
640
|
+
})
|
|
641
|
+
}),
|
|
642
|
+
/* @__PURE__ */ y("div", {
|
|
643
|
+
className: "min-h-0 flex-1",
|
|
644
|
+
children: /* @__PURE__ */ y(le, {
|
|
645
|
+
ref: G,
|
|
646
|
+
mode: "full",
|
|
647
|
+
placeholder: "Write your message...",
|
|
648
|
+
onImageUpload: w,
|
|
649
|
+
onSubmit: J,
|
|
650
|
+
className: "rounded-none border-0"
|
|
651
|
+
})
|
|
652
|
+
}),
|
|
653
|
+
V.length > 0 && /* @__PURE__ */ y("div", {
|
|
654
|
+
className: "border-border flex flex-wrap gap-2 border-t px-3 py-2",
|
|
655
|
+
children: V.map((e, t) => /* @__PURE__ */ b("div", {
|
|
656
|
+
className: "bg-bg-secondary gds-text-label flex items-center gap-1.5 rounded-md px-2 py-1",
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ y(X, { className: "text-fg-muted h-3 w-3" }),
|
|
659
|
+
/* @__PURE__ */ y("span", {
|
|
660
|
+
className: "text-fg max-w-[140px] truncate",
|
|
661
|
+
children: e.name
|
|
662
|
+
}),
|
|
663
|
+
/* @__PURE__ */ y("span", {
|
|
664
|
+
className: "text-fg-muted",
|
|
665
|
+
children: ue(e.size)
|
|
666
|
+
}),
|
|
667
|
+
/* @__PURE__ */ y("button", {
|
|
668
|
+
type: "button",
|
|
669
|
+
className: "text-fg-muted hover:text-danger transition-colors",
|
|
670
|
+
onClick: () => te(t),
|
|
671
|
+
"aria-label": `Remove ${e.name}`,
|
|
672
|
+
children: /* @__PURE__ */ y(ae, { className: "h-3 w-3" })
|
|
673
|
+
})
|
|
674
|
+
]
|
|
675
|
+
}, `${e.name}-${t}`))
|
|
676
|
+
}),
|
|
677
|
+
q !== void 0 && q !== "" && /* @__PURE__ */ b("div", {
|
|
678
|
+
className: "border-border border-t",
|
|
679
|
+
children: [/* @__PURE__ */ b("button", {
|
|
680
|
+
type: "button",
|
|
681
|
+
className: "gds-text-label text-fg-muted hover:text-fg flex w-full items-center gap-1.5 px-3 py-1.5 transition-colors",
|
|
682
|
+
onClick: () => W((e) => !e),
|
|
683
|
+
"aria-expanded": !U,
|
|
684
|
+
"aria-label": U ? "Show original message" : "Hide original message",
|
|
685
|
+
children: [/* @__PURE__ */ y("svg", {
|
|
686
|
+
className: e("h-3 w-3 transition-transform", !U && "rotate-90"),
|
|
687
|
+
fill: "none",
|
|
688
|
+
stroke: "currentColor",
|
|
689
|
+
strokeWidth: "2",
|
|
690
|
+
viewBox: "0 0 24 24",
|
|
691
|
+
children: /* @__PURE__ */ y("polyline", { points: "9 18 15 12 9 6" })
|
|
692
|
+
}), U ? "Show original" : "Hide original"]
|
|
693
|
+
}), !U && /* @__PURE__ */ y("div", {
|
|
694
|
+
className: "border-accent/20 text-fg-muted gds-text-body ml-3 border-l-2 px-3 pb-3",
|
|
695
|
+
dangerouslySetInnerHTML: { __html: q }
|
|
696
|
+
})]
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ b("div", {
|
|
699
|
+
className: "border-border flex items-center justify-between border-t px-3 py-2",
|
|
700
|
+
children: [/* @__PURE__ */ b("div", {
|
|
701
|
+
className: "flex items-center gap-2",
|
|
702
|
+
children: [
|
|
703
|
+
/* @__PURE__ */ y("button", {
|
|
704
|
+
type: "button",
|
|
705
|
+
className: "text-fg-muted hover:text-fg flex items-center justify-center rounded p-1.5 transition-colors hover:bg-white/[0.04]",
|
|
706
|
+
onClick: () => K.current?.click(),
|
|
707
|
+
title: "Attach file",
|
|
708
|
+
"aria-label": "Attach file",
|
|
709
|
+
children: /* @__PURE__ */ y(X, { className: "h-4 w-4" })
|
|
710
|
+
}),
|
|
711
|
+
/* @__PURE__ */ y("input", {
|
|
712
|
+
ref: K,
|
|
713
|
+
type: "file",
|
|
714
|
+
multiple: !0,
|
|
715
|
+
className: "hidden",
|
|
716
|
+
"aria-label": "Choose files to attach",
|
|
717
|
+
onChange: (e) => {
|
|
718
|
+
e.target.files !== null && e.target.files.length > 0 && (Y(e.target.files), e.target.value = "");
|
|
719
|
+
}
|
|
720
|
+
}),
|
|
721
|
+
M
|
|
722
|
+
]
|
|
723
|
+
}), /* @__PURE__ */ b("div", {
|
|
724
|
+
className: "flex items-center gap-2",
|
|
725
|
+
children: [k !== void 0 && /* @__PURE__ */ y("button", {
|
|
726
|
+
type: "button",
|
|
727
|
+
className: "gds-text-body text-fg-muted hover:text-fg px-2 py-1 transition-colors",
|
|
728
|
+
onClick: k,
|
|
729
|
+
children: "Cancel"
|
|
730
|
+
}), /* @__PURE__ */ b("button", {
|
|
731
|
+
type: "button",
|
|
732
|
+
className: "bg-accent gds-text-body text-accent-fg hover:bg-accent-hover inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 font-medium transition-colors",
|
|
733
|
+
onClick: J,
|
|
734
|
+
title: `${Z} (${ie})`,
|
|
735
|
+
children: [/* @__PURE__ */ y(re, { className: "h-3.5 w-3.5" }), Z]
|
|
736
|
+
})]
|
|
737
|
+
})]
|
|
738
|
+
})
|
|
739
|
+
]
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region src/l5-organisms/email-thread.tsx
|
|
744
|
+
function pe(e) {
|
|
745
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
746
|
+
}
|
|
747
|
+
function me(e) {
|
|
748
|
+
let t = new Date(e);
|
|
749
|
+
if (Number.isNaN(t.getTime())) return e;
|
|
750
|
+
let n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
751
|
+
if (r < 1) return "just now";
|
|
752
|
+
if (r < 60) return `${r}m ago`;
|
|
753
|
+
let i = Math.floor(r / 60);
|
|
754
|
+
if (i < 24) return `${i}h ago`;
|
|
755
|
+
let a = Math.floor(i / 24);
|
|
756
|
+
return a < 7 ? `${a}d ago` : t.toLocaleDateString(void 0, {
|
|
757
|
+
year: "numeric",
|
|
758
|
+
month: "short",
|
|
759
|
+
day: "numeric"
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
function he(e) {
|
|
763
|
+
return e.startsWith("image/");
|
|
764
|
+
}
|
|
765
|
+
function ge(e) {
|
|
766
|
+
return e === "application/pdf";
|
|
767
|
+
}
|
|
768
|
+
function _e({ attachment: t, message: r, onAttachmentClick: a, onAttachmentDownload: o, onAttachmentExtractText: s, renderAttachment: c }) {
|
|
769
|
+
if (c !== void 0) return /* @__PURE__ */ y(v, { children: c(t, r) });
|
|
770
|
+
let l = he(t.mimeType), u = ge(t.mimeType);
|
|
771
|
+
return /* @__PURE__ */ b("div", {
|
|
772
|
+
className: e("border-border bg-bg-secondary flex items-center gap-2 rounded-md border p-2", a !== void 0 && "hover:bg-bg-tertiary cursor-pointer"),
|
|
773
|
+
role: a === void 0 ? void 0 : "button",
|
|
774
|
+
tabIndex: a === void 0 ? void 0 : 0,
|
|
775
|
+
onClick: a === void 0 ? void 0 : () => a(r, t),
|
|
776
|
+
onKeyDown: a === void 0 ? void 0 : (e) => {
|
|
777
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(r, t));
|
|
778
|
+
},
|
|
779
|
+
"data-component": "email-attachment-preview",
|
|
780
|
+
children: [
|
|
781
|
+
l && t.thumbnailUrl !== void 0 ? /* @__PURE__ */ y("img", {
|
|
782
|
+
src: t.thumbnailUrl,
|
|
783
|
+
alt: t.filename,
|
|
784
|
+
className: "h-10 w-10 rounded object-cover"
|
|
785
|
+
}) : /* @__PURE__ */ b("span", {
|
|
786
|
+
className: "bg-bg-tertiary text-fg-muted flex h-10 w-10 shrink-0 items-center justify-center rounded",
|
|
787
|
+
children: [
|
|
788
|
+
l && /* @__PURE__ */ y(Y, { size: 18 }),
|
|
789
|
+
!l && u && /* @__PURE__ */ y(q, { size: 18 }),
|
|
790
|
+
!l && !u && /* @__PURE__ */ y(X, { size: 18 })
|
|
791
|
+
]
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ b("div", {
|
|
794
|
+
className: "min-w-0 flex-1",
|
|
795
|
+
children: [/* @__PURE__ */ y("div", {
|
|
796
|
+
className: "text-fg truncate text-sm font-medium",
|
|
797
|
+
children: t.filename
|
|
798
|
+
}), /* @__PURE__ */ y("div", {
|
|
799
|
+
className: "text-fg-muted text-xs",
|
|
800
|
+
children: pe(t.size)
|
|
801
|
+
})]
|
|
802
|
+
}),
|
|
803
|
+
/* @__PURE__ */ b("div", {
|
|
804
|
+
className: "flex shrink-0 items-center gap-1",
|
|
805
|
+
children: [u && s !== void 0 && /* @__PURE__ */ y(i, {
|
|
806
|
+
content: "Extract text",
|
|
807
|
+
children: /* @__PURE__ */ y(n, {
|
|
808
|
+
size: "sm",
|
|
809
|
+
icon: /* @__PURE__ */ y(q, { size: 14 }),
|
|
810
|
+
tooltip: "Extract text",
|
|
811
|
+
onClick: (e) => {
|
|
812
|
+
e.stopPropagation(), s(r, t);
|
|
813
|
+
}
|
|
814
|
+
})
|
|
815
|
+
}), o !== void 0 && /* @__PURE__ */ y(i, {
|
|
816
|
+
content: "Download",
|
|
817
|
+
children: /* @__PURE__ */ y(n, {
|
|
818
|
+
size: "sm",
|
|
819
|
+
icon: /* @__PURE__ */ y(K, { size: 14 }),
|
|
820
|
+
tooltip: "Download attachment",
|
|
821
|
+
onClick: (e) => {
|
|
822
|
+
e.stopPropagation(), o(r, t);
|
|
823
|
+
}
|
|
824
|
+
})
|
|
825
|
+
})]
|
|
826
|
+
})
|
|
827
|
+
]
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
function ve({ analysis: e }) {
|
|
831
|
+
let [t, n] = _(!1), r = e.summary !== void 0 && e.summary.length > 0, i = e.people !== void 0 && e.people.length > 0 || e.dates !== void 0 && e.dates.length > 0 || e.amounts !== void 0 && e.amounts.length > 0 || e.actionItems !== void 0 && e.actionItems.length > 0 || e.deadline !== void 0 || e.riskScore !== void 0;
|
|
832
|
+
return !r && !i ? null : /* @__PURE__ */ b("div", {
|
|
833
|
+
className: "border-accent/20 bg-accent/5 mt-2 rounded-md border p-3",
|
|
834
|
+
"data-component": "email-ai-panel",
|
|
835
|
+
children: [
|
|
836
|
+
/* @__PURE__ */ b("button", {
|
|
837
|
+
type: "button",
|
|
838
|
+
className: "text-accent flex w-full items-center gap-2 text-left text-xs font-medium",
|
|
839
|
+
onClick: () => n((e) => !e),
|
|
840
|
+
"aria-expanded": t,
|
|
841
|
+
"aria-label": "AI Analysis",
|
|
842
|
+
children: [
|
|
843
|
+
/* @__PURE__ */ y(Z, { size: 14 }),
|
|
844
|
+
/* @__PURE__ */ y("span", {
|
|
845
|
+
className: "flex-1",
|
|
846
|
+
children: "AI Analysis"
|
|
847
|
+
}),
|
|
848
|
+
i && y(t ? W : G, { size: 14 })
|
|
849
|
+
]
|
|
850
|
+
}),
|
|
851
|
+
r && /* @__PURE__ */ y("p", {
|
|
852
|
+
className: "text-fg-muted mt-1 text-xs",
|
|
853
|
+
children: e.summary
|
|
854
|
+
}),
|
|
855
|
+
t && i && /* @__PURE__ */ b("div", {
|
|
856
|
+
className: "mt-2 flex flex-col gap-2 text-xs",
|
|
857
|
+
children: [
|
|
858
|
+
e.people !== void 0 && e.people.length > 0 && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
859
|
+
className: "text-fg font-medium",
|
|
860
|
+
children: "People:"
|
|
861
|
+
}), /* @__PURE__ */ y("ul", {
|
|
862
|
+
className: "text-fg-muted mt-0.5 list-inside list-disc",
|
|
863
|
+
children: e.people.map((e, t) => /* @__PURE__ */ b("li", { children: [
|
|
864
|
+
e.name,
|
|
865
|
+
e.role !== void 0 && /* @__PURE__ */ b("span", {
|
|
866
|
+
className: "text-fg-muted/60",
|
|
867
|
+
children: [" — ", e.role]
|
|
868
|
+
}),
|
|
869
|
+
e.email !== void 0 && /* @__PURE__ */ b("span", {
|
|
870
|
+
className: "text-fg-muted/60",
|
|
871
|
+
children: [
|
|
872
|
+
" (",
|
|
873
|
+
e.email,
|
|
874
|
+
")"
|
|
875
|
+
]
|
|
876
|
+
})
|
|
877
|
+
] }, t))
|
|
878
|
+
})] }),
|
|
879
|
+
e.dates !== void 0 && e.dates.length > 0 && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
880
|
+
className: "text-fg font-medium",
|
|
881
|
+
children: "Dates:"
|
|
882
|
+
}), /* @__PURE__ */ y("ul", {
|
|
883
|
+
className: "text-fg-muted mt-0.5 list-inside list-disc",
|
|
884
|
+
children: e.dates.map((e, t) => /* @__PURE__ */ b("li", { children: [e.text, e.context !== void 0 && /* @__PURE__ */ b("span", {
|
|
885
|
+
className: "text-fg-muted/60",
|
|
886
|
+
children: [" — ", e.context]
|
|
887
|
+
})] }, t))
|
|
888
|
+
})] }),
|
|
889
|
+
e.amounts !== void 0 && e.amounts.length > 0 && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
890
|
+
className: "text-fg font-medium",
|
|
891
|
+
children: "Amounts:"
|
|
892
|
+
}), /* @__PURE__ */ y("ul", {
|
|
893
|
+
className: "text-fg-muted mt-0.5 list-inside list-disc",
|
|
894
|
+
children: e.amounts.map((e, t) => /* @__PURE__ */ b("li", { children: [
|
|
895
|
+
e.value,
|
|
896
|
+
e.currency !== void 0 && /* @__PURE__ */ b("span", { children: [" ", e.currency] }),
|
|
897
|
+
e.context !== void 0 && /* @__PURE__ */ b("span", {
|
|
898
|
+
className: "text-fg-muted/60",
|
|
899
|
+
children: [" — ", e.context]
|
|
900
|
+
})
|
|
901
|
+
] }, t))
|
|
902
|
+
})] }),
|
|
903
|
+
e.actionItems !== void 0 && e.actionItems.length > 0 && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
|
|
904
|
+
className: "text-fg font-medium",
|
|
905
|
+
children: "Action Items:"
|
|
906
|
+
}), /* @__PURE__ */ y("ul", {
|
|
907
|
+
className: "text-fg-muted mt-0.5 list-inside list-disc",
|
|
908
|
+
children: e.actionItems.map((e, t) => /* @__PURE__ */ y("li", { children: e }, t))
|
|
909
|
+
})] }),
|
|
910
|
+
e.deadline !== void 0 && /* @__PURE__ */ b("div", { children: [
|
|
911
|
+
/* @__PURE__ */ y("span", {
|
|
912
|
+
className: "text-danger font-medium",
|
|
913
|
+
children: "Deadline:"
|
|
914
|
+
}),
|
|
915
|
+
" ",
|
|
916
|
+
/* @__PURE__ */ y("span", {
|
|
917
|
+
className: "text-danger",
|
|
918
|
+
children: e.deadline
|
|
919
|
+
})
|
|
920
|
+
] }),
|
|
921
|
+
e.riskScore !== void 0 && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("span", {
|
|
922
|
+
className: "text-warning font-medium",
|
|
923
|
+
children: [
|
|
924
|
+
"Risk: ",
|
|
925
|
+
e.riskScore,
|
|
926
|
+
"/10"
|
|
927
|
+
]
|
|
928
|
+
}), e.riskReason !== void 0 && /* @__PURE__ */ b("span", {
|
|
929
|
+
className: "text-fg-muted",
|
|
930
|
+
children: [" — ", e.riskReason]
|
|
931
|
+
})] })
|
|
932
|
+
]
|
|
933
|
+
})
|
|
934
|
+
]
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
function ye({ message: t, isExpanded: a, onToggleExpand: o, onReply: c, onReplyAll: l, onForward: u, onDelete: d, onAttachmentClick: f, onAttachmentDownload: p, onAttachmentExtractText: m, showAiAnalysis: g, renderMessageActions: _, renderAttachment: v }) {
|
|
938
|
+
let x = t.fromName ?? t.from, S = t.attachments !== void 0 && t.attachments.length > 0, C = g === !0 && t.aiAnalysis !== void 0 && t.aiAnalysis !== null, w = h(() => t.htmlBody === null ? null : s(t.htmlBody), [t.htmlBody]), T = h(() => w === null ? t.textBody === null ? /* @__PURE__ */ y("p", {
|
|
939
|
+
className: "text-fg-muted text-sm italic",
|
|
940
|
+
children: "No content"
|
|
941
|
+
}) : /* @__PURE__ */ y("pre", {
|
|
942
|
+
className: "text-fg font-sans text-sm leading-relaxed break-words whitespace-pre-wrap",
|
|
943
|
+
children: t.textBody
|
|
944
|
+
}) : /* @__PURE__ */ y("div", {
|
|
945
|
+
className: "prose prose-sm dark:prose-invert max-w-none break-words [&_img]:h-auto [&_img]:max-w-full [&_table]:text-xs",
|
|
946
|
+
dangerouslySetInnerHTML: { __html: w }
|
|
947
|
+
}), [w, t.textBody]), E = h(() => {
|
|
948
|
+
if (t.textBody !== null) {
|
|
949
|
+
let e = t.textBody.split("\n").filter((e) => e.trim().length > 0).slice(0, 3).join(" ");
|
|
950
|
+
return e.length > 200 ? `${e.slice(0, 200)}…` : e;
|
|
951
|
+
}
|
|
952
|
+
if (t.htmlBody !== null) {
|
|
953
|
+
let e = t.htmlBody.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
954
|
+
return e.length > 200 ? `${e.slice(0, 200)}…` : e;
|
|
955
|
+
}
|
|
956
|
+
return "";
|
|
957
|
+
}, [t.textBody, t.htmlBody]), D = /* @__PURE__ */ y(r, {
|
|
958
|
+
name: x,
|
|
959
|
+
size: "default"
|
|
960
|
+
}), O = /* @__PURE__ */ b("div", {
|
|
961
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
962
|
+
children: [/* @__PURE__ */ b("button", {
|
|
963
|
+
type: "button",
|
|
964
|
+
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
965
|
+
onClick: o,
|
|
966
|
+
"aria-expanded": a,
|
|
967
|
+
"aria-label": a ? `Collapse message from ${x}` : `Expand message from ${x}`,
|
|
968
|
+
children: [
|
|
969
|
+
y(a ? W : G, {
|
|
970
|
+
size: 14,
|
|
971
|
+
className: "text-fg-muted shrink-0"
|
|
972
|
+
}),
|
|
973
|
+
/* @__PURE__ */ y("span", {
|
|
974
|
+
className: "text-fg truncate text-sm font-medium",
|
|
975
|
+
children: x
|
|
976
|
+
}),
|
|
977
|
+
/* @__PURE__ */ b("span", {
|
|
978
|
+
className: "text-fg-muted truncate text-xs",
|
|
979
|
+
children: [
|
|
980
|
+
"<",
|
|
981
|
+
t.from,
|
|
982
|
+
">"
|
|
983
|
+
]
|
|
984
|
+
})
|
|
985
|
+
]
|
|
986
|
+
}), /* @__PURE__ */ y("span", {
|
|
987
|
+
className: "text-fg-muted shrink-0 text-xs",
|
|
988
|
+
children: me(t.date)
|
|
989
|
+
})]
|
|
990
|
+
}), k = _ === void 0 ? /* @__PURE__ */ b("div", {
|
|
991
|
+
className: "flex items-center gap-0.5",
|
|
992
|
+
children: [
|
|
993
|
+
c !== void 0 && /* @__PURE__ */ y(i, {
|
|
994
|
+
content: "Reply",
|
|
995
|
+
children: /* @__PURE__ */ y(n, {
|
|
996
|
+
size: "sm",
|
|
997
|
+
icon: /* @__PURE__ */ y(ne, { size: 14 }),
|
|
998
|
+
tooltip: "Reply",
|
|
999
|
+
onClick: () => c(t)
|
|
1000
|
+
})
|
|
1001
|
+
}),
|
|
1002
|
+
l !== void 0 && /* @__PURE__ */ y(i, {
|
|
1003
|
+
content: "Reply All",
|
|
1004
|
+
children: /* @__PURE__ */ y(n, {
|
|
1005
|
+
size: "sm",
|
|
1006
|
+
icon: /* @__PURE__ */ y(te, { size: 14 }),
|
|
1007
|
+
tooltip: "Reply all",
|
|
1008
|
+
onClick: () => l(t)
|
|
1009
|
+
})
|
|
1010
|
+
}),
|
|
1011
|
+
u !== void 0 && /* @__PURE__ */ y(i, {
|
|
1012
|
+
content: "Forward",
|
|
1013
|
+
children: /* @__PURE__ */ y(n, {
|
|
1014
|
+
size: "sm",
|
|
1015
|
+
icon: /* @__PURE__ */ y(J, { size: 14 }),
|
|
1016
|
+
tooltip: "Forward",
|
|
1017
|
+
onClick: () => u(t)
|
|
1018
|
+
})
|
|
1019
|
+
}),
|
|
1020
|
+
d !== void 0 && /* @__PURE__ */ y(i, {
|
|
1021
|
+
content: "Delete",
|
|
1022
|
+
children: /* @__PURE__ */ y(n, {
|
|
1023
|
+
size: "sm",
|
|
1024
|
+
variant: "danger",
|
|
1025
|
+
icon: /* @__PURE__ */ y(ie, { size: 14 }),
|
|
1026
|
+
tooltip: "Delete",
|
|
1027
|
+
onClick: () => d(t)
|
|
1028
|
+
})
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
}) : _(t), ee = c !== void 0 || l !== void 0 || u !== void 0 || d !== void 0 || _ !== void 0;
|
|
1032
|
+
return /* @__PURE__ */ b("div", {
|
|
1033
|
+
className: e("flex gap-3", t.isOwn && "flex-row-reverse"),
|
|
1034
|
+
"data-component": "email-message-bubble",
|
|
1035
|
+
"data-state": a ? "expanded" : "collapsed",
|
|
1036
|
+
"data-own": t.isOwn ? "true" : "false",
|
|
1037
|
+
children: [/* @__PURE__ */ y("div", {
|
|
1038
|
+
className: "shrink-0 pt-1",
|
|
1039
|
+
children: D
|
|
1040
|
+
}), /* @__PURE__ */ b("div", {
|
|
1041
|
+
className: e("gds-pad min-w-0 flex-1 rounded-lg border", t.isOwn ? "border-accent/20 bg-accent/5" : "border-border bg-bg-secondary"),
|
|
1042
|
+
children: [
|
|
1043
|
+
/* @__PURE__ */ b("div", {
|
|
1044
|
+
className: "flex items-start gap-2",
|
|
1045
|
+
children: [O, a && ee && /* @__PURE__ */ y("div", {
|
|
1046
|
+
className: "shrink-0",
|
|
1047
|
+
children: k
|
|
1048
|
+
})]
|
|
1049
|
+
}),
|
|
1050
|
+
a && /* @__PURE__ */ b("div", {
|
|
1051
|
+
className: "text-fg-muted mt-1 text-xs",
|
|
1052
|
+
children: [/* @__PURE__ */ b("span", { children: ["To: ", t.to.join(", ")] }), t.cc !== void 0 && t.cc.length > 0 && /* @__PURE__ */ b("span", {
|
|
1053
|
+
className: "ml-2",
|
|
1054
|
+
children: ["Cc: ", t.cc.join(", ")]
|
|
1055
|
+
})]
|
|
1056
|
+
}),
|
|
1057
|
+
/* @__PURE__ */ y("div", {
|
|
1058
|
+
className: "mt-2",
|
|
1059
|
+
children: a ? T : /* @__PURE__ */ b("button", {
|
|
1060
|
+
type: "button",
|
|
1061
|
+
className: "text-fg-muted w-full text-left text-sm",
|
|
1062
|
+
onClick: o,
|
|
1063
|
+
"aria-expanded": !1,
|
|
1064
|
+
"aria-label": `Expand message from ${x}`,
|
|
1065
|
+
children: [/* @__PURE__ */ y("span", {
|
|
1066
|
+
className: "line-clamp-2",
|
|
1067
|
+
children: E
|
|
1068
|
+
}), /* @__PURE__ */ y("span", {
|
|
1069
|
+
className: "text-accent text-xs",
|
|
1070
|
+
children: " Show more"
|
|
1071
|
+
})]
|
|
1072
|
+
})
|
|
1073
|
+
}),
|
|
1074
|
+
a && S && /* @__PURE__ */ b("div", {
|
|
1075
|
+
className: "mt-3",
|
|
1076
|
+
children: [/* @__PURE__ */ b("div", {
|
|
1077
|
+
className: "text-fg-muted mb-1.5 flex items-center gap-1 text-xs font-medium",
|
|
1078
|
+
children: [/* @__PURE__ */ y(X, { size: 12 }), /* @__PURE__ */ b("span", { children: [
|
|
1079
|
+
t.attachments?.length ?? 0,
|
|
1080
|
+
" attachment",
|
|
1081
|
+
(t.attachments?.length ?? 0) > 1 ? "s" : ""
|
|
1082
|
+
] })]
|
|
1083
|
+
}), /* @__PURE__ */ y("div", {
|
|
1084
|
+
className: "grid gap-2 sm:grid-cols-2",
|
|
1085
|
+
children: (t.attachments ?? []).map((e) => /* @__PURE__ */ y(_e, {
|
|
1086
|
+
attachment: e,
|
|
1087
|
+
message: t,
|
|
1088
|
+
onAttachmentClick: f,
|
|
1089
|
+
onAttachmentDownload: p,
|
|
1090
|
+
onAttachmentExtractText: m,
|
|
1091
|
+
renderAttachment: v
|
|
1092
|
+
}, e.index))
|
|
1093
|
+
})]
|
|
1094
|
+
}),
|
|
1095
|
+
a && C && t.aiAnalysis !== void 0 && t.aiAnalysis !== null && /* @__PURE__ */ y(ve, { analysis: t.aiAnalysis })
|
|
1096
|
+
]
|
|
1097
|
+
})]
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
var be = u(function({ messages: n, defaultExpandedIds: r, expandAll: i, onReply: a, onReplyAll: o, onForward: s, onDelete: c, onPrint: l, onDownloadRaw: u, onAttachmentClick: f, onAttachmentDownload: p, onAttachmentExtractText: m, showAiAnalysis: g, renderMessageActions: v, renderAttachment: b, glass: x, className: S, ...C }, w) {
|
|
1101
|
+
let [T, E] = _(h(() => i === !0 ? new Set(n.map((e) => e.id)) : r === void 0 ? n.length > 0 ? new Set([n[n.length - 1].id]) : /* @__PURE__ */ new Set() : new Set(r), [])), D = i === !0 ? new Set(n.map((e) => e.id)) : T, O = d((e) => {
|
|
1102
|
+
E((t) => {
|
|
1103
|
+
let n = new Set(t);
|
|
1104
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1105
|
+
});
|
|
1106
|
+
}, []);
|
|
1107
|
+
return n.length === 0 ? /* @__PURE__ */ y("div", {
|
|
1108
|
+
ref: w,
|
|
1109
|
+
className: e("text-fg-muted gds-text-body flex flex-col items-center justify-center py-12", x === !0 && t(x), S),
|
|
1110
|
+
"data-component": "email-thread",
|
|
1111
|
+
"data-state": "empty",
|
|
1112
|
+
...C,
|
|
1113
|
+
children: /* @__PURE__ */ y("p", { children: "No messages" })
|
|
1114
|
+
}) : /* @__PURE__ */ y("div", {
|
|
1115
|
+
ref: w,
|
|
1116
|
+
className: e("gds-gap flex flex-col", x === !0 && t(x), S),
|
|
1117
|
+
"data-component": "email-thread",
|
|
1118
|
+
role: "list",
|
|
1119
|
+
"aria-label": "Email thread",
|
|
1120
|
+
...C,
|
|
1121
|
+
children: n.map((e) => /* @__PURE__ */ y("div", {
|
|
1122
|
+
role: "listitem",
|
|
1123
|
+
children: /* @__PURE__ */ y(ye, {
|
|
1124
|
+
message: e,
|
|
1125
|
+
isExpanded: D.has(e.id),
|
|
1126
|
+
onToggleExpand: () => O(e.id),
|
|
1127
|
+
onReply: a,
|
|
1128
|
+
onReplyAll: o,
|
|
1129
|
+
onForward: s,
|
|
1130
|
+
onDelete: c,
|
|
1131
|
+
onAttachmentClick: f,
|
|
1132
|
+
onAttachmentDownload: p,
|
|
1133
|
+
onAttachmentExtractText: m,
|
|
1134
|
+
showAiAnalysis: g,
|
|
1135
|
+
renderMessageActions: v,
|
|
1136
|
+
renderAttachment: b
|
|
1137
|
+
})
|
|
1138
|
+
}, e.id))
|
|
1139
|
+
});
|
|
1140
|
+
});
|
|
1141
|
+
//#endregion
|
|
1142
|
+
//#region src/l5-organisms/markdown-parser.ts
|
|
1143
|
+
function xe(e) {
|
|
1144
|
+
return e.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<script[^>]*>/gi, "").replace(/\son\w+\s*=\s*"[^"]*"/gi, "").replace(/\son\w+\s*=\s*'[^']*'/gi, "").replace(/\son\w+\s*=\s*[^\s>]*/gi, "");
|
|
1145
|
+
}
|
|
1146
|
+
function Q(e) {
|
|
1147
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1148
|
+
}
|
|
1149
|
+
function $(e) {
|
|
1150
|
+
let t = Q(e);
|
|
1151
|
+
return t = t.replace(/`([^`]+)`/g, "<code class=\"rounded bg-bg-tertiary px-1 py-0.5 font-mono text-[0.85em]\">$1</code>"), t = t.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), t = t.replace(/\*([^*]+)\*/g, "<em>$1</em>"), t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "<a href=\"$2\" class=\"text-accent hover:underline\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>"), t;
|
|
1152
|
+
}
|
|
1153
|
+
function Se(e) {
|
|
1154
|
+
let t = e.split("\n"), n = [], r = !1, i = [], a = !1;
|
|
1155
|
+
for (let e = 0; e < t.length; e++) {
|
|
1156
|
+
let o = t[e];
|
|
1157
|
+
if (o.trimStart().startsWith("```")) {
|
|
1158
|
+
r ? (n.push(`<pre class="overflow-auto rounded-lg bg-bg-tertiary p-3 font-mono text-xs"><code>${Q(i.join("\n"))}</code></pre>`), i = [], r = !1) : (a &&= (n.push("</ul>"), !1), r = !0);
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
if (r) {
|
|
1162
|
+
i.push(o);
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
if (/^---+$/.test(o.trim())) {
|
|
1166
|
+
a &&= (n.push("</ul>"), !1), n.push("<hr class=\"my-3 border-border\" />");
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
let s = o.match(/^(#{1,6})\s+(.+)$/);
|
|
1170
|
+
if (s !== null) {
|
|
1171
|
+
a &&= (n.push("</ul>"), !1);
|
|
1172
|
+
let e = s[1].length;
|
|
1173
|
+
n.push(`<h${e} class="font-semibold ${[
|
|
1174
|
+
"text-xl",
|
|
1175
|
+
"text-lg",
|
|
1176
|
+
"text-base",
|
|
1177
|
+
"text-sm",
|
|
1178
|
+
"text-xs",
|
|
1179
|
+
"text-xs"
|
|
1180
|
+
][e - 1]} ${[
|
|
1181
|
+
"mt-4 mb-2",
|
|
1182
|
+
"mt-3 mb-2",
|
|
1183
|
+
"mt-3 mb-1",
|
|
1184
|
+
"mt-2 mb-1",
|
|
1185
|
+
"mt-2 mb-1",
|
|
1186
|
+
"mt-2 mb-1"
|
|
1187
|
+
][e - 1]}">${$(s[2])}</h${e}>`);
|
|
1188
|
+
continue;
|
|
1189
|
+
}
|
|
1190
|
+
if (o.trimStart().startsWith("> ")) {
|
|
1191
|
+
a &&= (n.push("</ul>"), !1);
|
|
1192
|
+
let e = o.replace(/^>\s*/, "");
|
|
1193
|
+
n.push(`<blockquote class="border-l-2 border-accent/30 pl-3 text-fg-muted italic">${$(e)}</blockquote>`);
|
|
1194
|
+
continue;
|
|
1195
|
+
}
|
|
1196
|
+
let c = o.match(/^(\s*)[-*]\s+(.+)$/);
|
|
1197
|
+
if (c !== null) {
|
|
1198
|
+
a ||= (n.push("<ul class=\"list-disc pl-5 space-y-0.5\">"), !0), n.push(`<li>${$(c[2])}</li>`);
|
|
1199
|
+
continue;
|
|
1200
|
+
}
|
|
1201
|
+
a &&= (n.push("</ul>"), !1), o.trim() !== "" && n.push(`<p class="mb-2">${$(o)}</p>`);
|
|
1202
|
+
}
|
|
1203
|
+
return r && n.push(`<pre class="overflow-auto rounded-lg bg-bg-tertiary p-3 font-mono text-xs"><code>${Q(i.join("\n"))}</code></pre>`), a && n.push("</ul>"), xe(n.join("\n"));
|
|
1204
|
+
}
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/l5-organisms/markdown-preview.tsx
|
|
1207
|
+
var Ce = u(function({ content: t, glass: n, className: r, sanitize: i = !0 }, a) {
|
|
1208
|
+
let s = h(() => {
|
|
1209
|
+
let e = Se(t);
|
|
1210
|
+
if (!i) return e;
|
|
1211
|
+
try {
|
|
1212
|
+
return o(e, { ADD_ATTR: ["target", "rel"] });
|
|
1213
|
+
} catch {
|
|
1214
|
+
return e.replace(/<[^>]*>/g, "");
|
|
1215
|
+
}
|
|
1216
|
+
}, [t, i]);
|
|
1217
|
+
return /* @__PURE__ */ y("div", {
|
|
1218
|
+
ref: a,
|
|
1219
|
+
className: e("gds-radius-popover gds-pad-x gds-pad-y text-fg text-sm leading-relaxed", n === !0 && "bg-white/5 backdrop-blur-md", r),
|
|
1220
|
+
"data-component": "markdown-preview",
|
|
1221
|
+
dangerouslySetInnerHTML: { __html: s }
|
|
1222
|
+
});
|
|
1223
|
+
}), we = u(function({ value: t, onChange: n, placeholder: r, className: i }, a) {
|
|
1224
|
+
let o = d((e) => n(e.target.value), [n]);
|
|
1225
|
+
return /* @__PURE__ */ b("div", {
|
|
1226
|
+
ref: a,
|
|
1227
|
+
className: e("border-border bg-surface flex gap-px overflow-hidden rounded-lg border", i),
|
|
1228
|
+
"data-component": "markdown-editor",
|
|
1229
|
+
children: [
|
|
1230
|
+
/* @__PURE__ */ y("textarea", {
|
|
1231
|
+
className: "text-fg min-h-[200px] flex-1 resize-none bg-transparent p-3 font-mono text-sm outline-none",
|
|
1232
|
+
value: t,
|
|
1233
|
+
onChange: o,
|
|
1234
|
+
placeholder: r
|
|
1235
|
+
}),
|
|
1236
|
+
/* @__PURE__ */ y("div", { className: "bg-border w-px" }),
|
|
1237
|
+
/* @__PURE__ */ y("div", {
|
|
1238
|
+
className: "min-h-[200px] flex-1 overflow-auto",
|
|
1239
|
+
children: /* @__PURE__ */ y(Ce, {
|
|
1240
|
+
content: t,
|
|
1241
|
+
className: "h-full"
|
|
1242
|
+
})
|
|
1243
|
+
})
|
|
1244
|
+
]
|
|
1245
|
+
});
|
|
1246
|
+
});
|
|
1247
|
+
//#endregion
|
|
1248
|
+
export { fe as EmailComposer, be as EmailThread, we as MarkdownEditor, Ce as MarkdownPreview, le as RichTextEditor };
|
|
1249
|
+
|
|
1250
|
+
//# sourceMappingURL=index.js.map
|