@devalok/shilp-sutra 0.32.0 → 0.33.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_chunks/date-time-picker.js +851 -0
  3. package/dist/_chunks/mention-suggestion.js +362 -0
  4. package/dist/_chunks/tiptap.js +11595 -7731
  5. package/dist/_chunks/use-calendar.js +115 -956
  6. package/dist/_chunks/vendor-client.js +1055 -894
  7. package/dist/composed/date-picker/index.js +9 -8
  8. package/dist/composed/emoji-picker.d.ts +8 -2
  9. package/dist/composed/emoji-picker.d.ts.map +1 -1
  10. package/dist/composed/emoji-picker.js +65 -56
  11. package/dist/composed/extensions/emoji-data.d.ts +35 -0
  12. package/dist/composed/extensions/emoji-data.d.ts.map +1 -0
  13. package/dist/composed/extensions/emoji-node.d.ts +11 -0
  14. package/dist/composed/extensions/emoji-node.d.ts.map +1 -0
  15. package/dist/composed/extensions/emoji-suggestion.d.ts +4 -6
  16. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -1
  17. package/dist/composed/extensions/slash-command.d.ts +35 -0
  18. package/dist/composed/extensions/slash-command.d.ts.map +1 -0
  19. package/dist/composed/index.d.ts +7 -1
  20. package/dist/composed/index.d.ts.map +1 -1
  21. package/dist/composed/index.js +79 -70
  22. package/dist/composed/rich-chat-input/attachment-strip.d.ts +15 -0
  23. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -0
  24. package/dist/composed/rich-chat-input/audio-player.d.ts +11 -0
  25. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -0
  26. package/dist/composed/rich-chat-input/audio-waveform.d.ts +24 -0
  27. package/dist/composed/rich-chat-input/audio-waveform.d.ts.map +1 -0
  28. package/dist/composed/rich-chat-input/chat-toolbar.d.ts +51 -0
  29. package/dist/composed/rich-chat-input/chat-toolbar.d.ts.map +1 -0
  30. package/dist/composed/rich-chat-input/recording-overlay.d.ts +15 -0
  31. package/dist/composed/rich-chat-input/recording-overlay.d.ts.map +1 -0
  32. package/dist/composed/rich-chat-input/reply-banner.d.ts +8 -0
  33. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -0
  34. package/dist/composed/rich-chat-input/schedule-send.d.ts +22 -0
  35. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -0
  36. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts +18 -0
  37. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts.map +1 -0
  38. package/dist/composed/rich-chat-input.d.ts +91 -0
  39. package/dist/composed/rich-chat-input.d.ts.map +1 -0
  40. package/dist/composed/rich-chat-input.js +1861 -0
  41. package/dist/composed/rich-text-editor.d.ts +3 -0
  42. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  43. package/dist/composed/rich-text-editor.js +278 -448
  44. package/dist/ui/button-group.d.ts +27 -37
  45. package/dist/ui/button-group.d.ts.map +1 -1
  46. package/dist/ui/button-group.js +95 -29
  47. package/dist/ui/button.d.ts.map +1 -1
  48. package/dist/ui/button.js +110 -106
  49. package/dist/ui/index.d.ts +1 -0
  50. package/dist/ui/index.d.ts.map +1 -1
  51. package/dist/ui/index.js +335 -333
  52. package/dist/ui/split-button.d.ts +45 -0
  53. package/dist/ui/split-button.d.ts.map +1 -0
  54. package/dist/ui/split-button.js +282 -0
  55. package/docs/components/composed/emoji-picker.md +9 -0
  56. package/docs/components/composed/rich-chat-input.md +88 -0
  57. package/docs/components/composed/rich-text-editor.md +5 -0
  58. package/docs/components/ui/button-group.md +9 -0
  59. package/docs/components/ui/button.md +4 -0
  60. package/docs/components/ui/split-button.md +41 -0
  61. package/llms-full.txt +157 -1
  62. package/llms.txt +22 -2
  63. package/package.json +30 -26
@@ -1,235 +1,13 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as p } from "react/jsx-runtime";
3
- import * as c from "react";
4
- import { N as Z, R as ee, m as te, a as ne, E as re, S as se, u as M, U as P, T as U, b as K, P as ie, H as $, c as q, d as O, L as V, I as F, M as W, e as G } from "../_chunks/tiptap.js";
5
- import { IconFile as oe, IconDownload as le, IconBold as ae, IconItalic as ce, IconUnderline as ue, IconStrikethrough as de, IconHighlight as fe, IconH2 as me, IconH3 as he, IconBlockquote as ge, IconList as be, IconListNumbers as pe, IconListCheck as xe, IconCode as ke, IconPhoto as ve, IconPaperclip as ye, IconLineDashed as we, IconAlignLeft as Ae, IconAlignCenter as _e, IconAlignRight as Le, IconMoodSmile as Ie, IconArrowBackUp as Ce, IconArrowForwardUp as Re, IconLink as Ee } from "@tabler/icons-react";
6
- import { Icon as u } from "../ui/icon.js";
7
- import { createRoot as J } from "react-dom/client";
8
- import { cn as k } from "../ui/lib/utils.js";
9
- import { useColorMode as ze } from "../hooks/use-color-mode.js";
10
- function Ne(e) {
11
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
12
- }
13
- function Te({ node: e }) {
14
- const r = /^https?:\/\//.test(e.attrs.url) ? e.attrs.url : "#";
15
- return /* @__PURE__ */ n(ne, { className: "my-ds-02", children: /* @__PURE__ */ p(
16
- "a",
17
- {
18
- href: r,
19
- target: "_blank",
20
- rel: "noopener noreferrer",
21
- className: "inline-flex items-center gap-ds-03 rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-04 py-ds-03 text-ds-sm text-surface-fg transition-colors hover:border-surface-border-strong hover:bg-surface-raised-hover",
22
- contentEditable: !1,
23
- children: [
24
- /* @__PURE__ */ n(u, { icon: oe, size: "sm", className: "shrink-0 text-surface-fg-subtle" }),
25
- /* @__PURE__ */ n("span", { className: "truncate", children: e.attrs.name }),
26
- /* @__PURE__ */ p("span", { className: "shrink-0 text-surface-fg-subtle", children: [
27
- "(",
28
- Ne(e.attrs.size),
29
- ")"
30
- ] }),
31
- /* @__PURE__ */ n(u, { icon: le, size: "sm", className: "shrink-0 text-surface-fg-subtle" })
32
- ]
33
- }
34
- ) });
35
- }
36
- const Q = Z.create({
37
- name: "fileAttachment",
38
- group: "block",
39
- atom: !0,
40
- addAttributes() {
41
- return {
42
- url: { default: null },
43
- name: { default: "Untitled" },
44
- size: { default: 0 }
45
- };
46
- },
47
- parseHTML() {
48
- return [{ tag: "div[data-file-attachment]" }];
49
- },
50
- renderHTML({ HTMLAttributes: e }) {
51
- return ["div", te({ "data-file-attachment": "" }, e)];
52
- },
53
- addNodeView() {
54
- return ee(Te);
55
- }
56
- }), H = c.forwardRef(
57
- ({ items: e, command: r }, s) => {
58
- const [o, i] = c.useState(0);
59
- return c.useEffect(() => i(0), [e]), c.useImperativeHandle(s, () => ({
60
- onKeyDown: ({ event: t }) => t.key === "ArrowUp" ? (i((l) => (l + e.length - 1) % e.length), !0) : t.key === "ArrowDown" ? (i((l) => (l + 1) % e.length), !0) : t.key === "Enter" ? (e[o] && r(e[o]), !0) : !1
61
- })), e.length ? /* @__PURE__ */ n("div", { role: "listbox", "aria-label": "Mention suggestions", className: "z-popover overflow-hidden rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((t, l) => /* @__PURE__ */ p(
62
- "button",
63
- {
64
- type: "button",
65
- role: "option",
66
- "aria-selected": l === o,
67
- onClick: () => r(t),
68
- className: k(
69
- "flex w-full items-center gap-ds-03 px-ds-04 py-ds-02b text-left text-ds-sm",
70
- l === o ? "bg-surface-raised text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"
71
- ),
72
- children: [
73
- t.avatar ? /* @__PURE__ */ n("img", { src: t.avatar, alt: "", className: "h-ico-md w-ico-md rounded-ds-full object-cover" }) : /* @__PURE__ */ n("span", { className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-full bg-accent-2 text-[10px] font-semibold text-accent-11", children: t.label.charAt(0).toUpperCase() }),
74
- /* @__PURE__ */ n("span", { children: t.label })
75
- ]
76
- },
77
- t.id
78
- )) }) : null;
79
- }
80
- );
81
- H.displayName = "MentionList";
82
- function Se(e) {
83
- return () => {
84
- let r = null, s = null, o = null;
85
- return {
86
- onStart: (i) => {
87
- s = document.createElement("div"), s.style.position = "absolute", s.style.zIndex = "1400";
88
- const t = i.clientRect?.();
89
- t && (s.style.left = `${t.left}px`, s.style.top = `${t.bottom + 4}px`), document.body.appendChild(s), r = J(s), r.render(
90
- /* @__PURE__ */ n(
91
- H,
92
- {
93
- ref: (l) => {
94
- o = l;
95
- },
96
- items: i.items,
97
- command: (l) => {
98
- i.command({ id: l.id, label: l.label }), e?.(l);
99
- }
100
- }
101
- )
102
- );
103
- },
104
- onUpdate: (i) => {
105
- if (!r || !s) return;
106
- const t = i.clientRect?.();
107
- t && (s.style.left = `${t.left}px`, s.style.top = `${t.bottom + 4}px`), r.render(
108
- /* @__PURE__ */ n(
109
- H,
110
- {
111
- ref: (l) => {
112
- o = l;
113
- },
114
- items: i.items,
115
- command: (l) => {
116
- i.command({ id: l.id, label: l.label }), e?.(l);
117
- }
118
- }
119
- )
120
- );
121
- },
122
- onKeyDown: (i) => i.event.key === "Escape" ? (s && (r?.unmount(), s.remove(), s = null, r = null), !0) : o?.onKeyDown(i) ?? !1,
123
- onExit: () => {
124
- s && (r?.unmount(), s.remove(), s = null, r = null);
125
- }
126
- };
127
- };
128
- }
129
- let _ = null;
130
- async function He() {
131
- if (_) return _;
132
- const e = await import("@emoji-mart/data"), r = e.default ?? e;
133
- return _ = Object.values(r.emojis).map((s) => ({
134
- id: s.id,
135
- name: s.name,
136
- native: s.skins[0]?.native ?? ""
137
- })), _;
138
- }
139
- const j = c.forwardRef(
140
- ({ items: e, command: r }, s) => {
141
- const [o, i] = c.useState(0);
142
- return c.useEffect(() => i(0), [e]), c.useImperativeHandle(s, () => ({
143
- onKeyDown: ({ event: t }) => t.key === "ArrowUp" ? (i((l) => (l + e.length - 1) % e.length), !0) : t.key === "ArrowDown" ? (i((l) => (l + 1) % e.length), !0) : t.key === "Enter" ? (e[o] && r(e[o]), !0) : !1
144
- })), e.length ? /* @__PURE__ */ n("div", { role: "listbox", "aria-label": "Emoji suggestions", className: "z-popover max-h-[200px] overflow-x-hidden overflow-y-auto rounded-ds-md border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: e.map((t, l) => /* @__PURE__ */ p(
145
- "button",
146
- {
147
- type: "button",
148
- role: "option",
149
- "aria-selected": l === o,
150
- onClick: () => r(t),
151
- className: k(
152
- "flex w-full items-center gap-ds-03 px-ds-04 py-ds-02b text-left text-ds-sm",
153
- l === o ? "bg-surface-raised text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"
154
- ),
155
- children: [
156
- /* @__PURE__ */ n("span", { className: "text-ds-base", children: t.native }),
157
- /* @__PURE__ */ p("span", { className: "truncate", children: [
158
- ":",
159
- t.id,
160
- ":"
161
- ] })
162
- ]
163
- },
164
- t.id
165
- )) }) : null;
166
- }
167
- );
168
- j.displayName = "EmojiList";
169
- function je() {
170
- return () => {
171
- let e = null, r = null, s = null;
172
- return {
173
- onStart: (o) => {
174
- r = document.createElement("div"), r.style.position = "absolute", r.style.zIndex = "1400";
175
- const i = o.clientRect?.();
176
- i && (r.style.left = `${i.left}px`, r.style.top = `${i.bottom + 4}px`), document.body.appendChild(r), e = J(r), e.render(
177
- /* @__PURE__ */ n(
178
- j,
179
- {
180
- ref: (t) => {
181
- s = t;
182
- },
183
- items: o.items,
184
- command: (t) => o.command(t)
185
- }
186
- )
187
- );
188
- },
189
- onUpdate: (o) => {
190
- if (!e || !r) return;
191
- const i = o.clientRect?.();
192
- i && (r.style.left = `${i.left}px`, r.style.top = `${i.bottom + 4}px`), e.render(
193
- /* @__PURE__ */ n(
194
- j,
195
- {
196
- ref: (t) => {
197
- s = t;
198
- },
199
- items: o.items,
200
- command: (t) => o.command(t)
201
- }
202
- )
203
- );
204
- },
205
- onKeyDown: (o) => o.event.key === "Escape" ? (r && (e?.unmount(), r.remove(), r = null, e = null), !0) : s?.onKeyDown(o) ?? !1,
206
- onExit: () => {
207
- r && (e?.unmount(), r.remove(), r = null, e = null);
208
- }
209
- };
210
- };
211
- }
212
- const Be = re.create({
213
- name: "emojiSuggestion",
214
- addProseMirrorPlugins() {
215
- return [
216
- se({
217
- editor: this.editor,
218
- char: ":",
219
- items: async ({ query: e }) => {
220
- const r = await He();
221
- return e ? r.filter(
222
- (s) => s.id.includes(e.toLowerCase()) || s.name.toLowerCase().includes(e.toLowerCase())
223
- ).slice(0, 8) : r.slice(0, 8);
224
- },
225
- command: ({ editor: e, range: r, props: s }) => {
226
- e.chain().focus().deleteRange(r).insertContent(s.native).run();
227
- },
228
- render: je()
229
- })
230
- ];
231
- }
232
- }), X = [
2
+ import { jsxs as y, jsx as e } from "react/jsx-runtime";
3
+ import * as d from "react";
4
+ import { u as j, i as q, P as Q, a as D, L as U, b as M, c as O, d as K, E as $, e as V } from "../_chunks/tiptap.js";
5
+ import { F as W, E as X, a as Y, c as Z, l as G, b as F } from "../_chunks/mention-suggestion.js";
6
+ import { useColorMode as ee } from "../hooks/use-color-mode.js";
7
+ import { cn as L } from "../ui/lib/utils.js";
8
+ import { IconBold as te, IconItalic as ie, IconUnderline as se, IconStrikethrough as ne, IconHighlight as re, IconH2 as oe, IconH3 as le, IconBlockquote as ce, IconList as ae, IconListNumbers as de, IconListCheck as ue, IconCode as fe, IconPhoto as he, IconPaperclip as ge, IconLineDashed as me, IconAlignLeft as be, IconAlignCenter as pe, IconAlignRight as ke, IconMoodSmile as ve, IconArrowBackUp as xe, IconArrowForwardUp as Ae, IconLink as _e } from "@tabler/icons-react";
9
+ import { Icon as l } from "../ui/icon.js";
10
+ const J = [
233
11
  "prose prose-sm max-w-none",
234
12
  "font-body text-ds-md leading-relaxed text-surface-fg",
235
13
  "[&_h2]:text-ds-xl [&_h2]:mb-ds-03 [&_h2]:mt-ds-05 [&_h2]:text-surface-fg",
@@ -248,354 +26,406 @@ const Be = re.create({
248
26
  "[&_img]:max-w-full [&_img]:rounded-ds-md [&_img]:my-ds-03",
249
27
  "[&_.mention]:rounded-ds-sm [&_.mention]:bg-accent-2 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-accent-11"
250
28
  ];
251
- function d({
252
- onClick: e,
253
- isActive: r = !1,
254
- disabled: s = !1,
255
- title: o,
256
- children: i
29
+ function c({
30
+ onClick: i,
31
+ isActive: u = !1,
32
+ disabled: f = !1,
33
+ title: h,
34
+ children: g
257
35
  }) {
258
- return /* @__PURE__ */ n(
36
+ return /* @__PURE__ */ e(
259
37
  "button",
260
38
  {
261
39
  type: "button",
262
- onClick: e,
263
- disabled: s,
264
- title: o,
265
- "aria-label": o,
266
- "aria-pressed": r,
267
- className: k(
40
+ onClick: i,
41
+ disabled: f,
42
+ title: h,
43
+ "aria-label": h,
44
+ "aria-pressed": u,
45
+ className: L(
268
46
  "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md transition-colors duration-fast-01 ease-productive-standard",
269
47
  "hover:bg-surface-raised-hover",
270
48
  "disabled:pointer-events-none disabled:opacity-action-disabled",
271
- r ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"
49
+ u ? "bg-surface-raised-hover text-accent-11" : "text-surface-fg-subtle"
272
50
  ),
273
- children: i
51
+ children: g
274
52
  }
275
53
  );
276
54
  }
277
- function De({ editor: e }) {
278
- const [r, s] = c.useState(!1), [o, i] = c.useState(""), t = c.useRef(null), l = () => {
279
- if (e.isActive("link")) {
280
- e.chain().focus().unsetLink().run();
281
- return;
282
- }
283
- const h = e.getAttributes("link").href || "";
284
- i(h), s(!0), setTimeout(() => t.current?.focus(), 0);
285
- }, x = (h) => {
286
- h.preventDefault(), o.trim() && e.chain().focus().setLink({ href: o.trim() }).run(), s(!1), i("");
287
- }, g = (h) => {
288
- h.key === "Escape" && (s(!1), i(""), e.commands.focus());
289
- };
290
- return /* @__PURE__ */ p("div", { className: "relative", children: [
291
- /* @__PURE__ */ n(d, { onClick: l, isActive: e.isActive("link"), title: "Link", children: /* @__PURE__ */ n(u, { icon: Ee, size: "sm" }) }),
292
- r && /* @__PURE__ */ p(
55
+ function Le({ editor: i }) {
56
+ const [u, f] = d.useState(!1), [h, g] = d.useState(""), n = d.useRef(null), { isLink: t } = V({
57
+ editor: i,
58
+ selector: ({ editor: m }) => ({ isLink: m.isActive("link") })
59
+ });
60
+ return /* @__PURE__ */ y("div", { className: "relative", children: [
61
+ /* @__PURE__ */ e(c, { onClick: () => {
62
+ if (t) {
63
+ i.chain().focus().unsetLink().run();
64
+ return;
65
+ }
66
+ const m = i.getAttributes("link").href || "";
67
+ g(m), f(!0), setTimeout(() => n.current?.focus(), 0);
68
+ }, isActive: t, title: "Link", children: /* @__PURE__ */ e(l, { icon: _e, size: "sm" }) }),
69
+ u && /* @__PURE__ */ y(
293
70
  "form",
294
71
  {
295
- onSubmit: x,
72
+ onSubmit: (m) => {
73
+ m.preventDefault(), h.trim() && i.chain().focus().setLink({ href: h.trim() }).run(), f(!1), g("");
74
+ },
296
75
  "aria-label": "Edit link URL",
297
76
  className: "absolute left-0 top-full z-popover mt-ds-01 flex items-center gap-ds-02 rounded-ds-md border border-surface-border-strong bg-surface-overlay p-ds-02 shadow-raised-hover",
298
77
  children: [
299
- /* @__PURE__ */ n(
78
+ /* @__PURE__ */ e(
300
79
  "input",
301
80
  {
302
- ref: t,
81
+ ref: n,
303
82
  type: "url",
304
- value: o,
305
- onChange: (h) => i(h.target.value),
306
- onKeyDown: g,
83
+ value: h,
84
+ onChange: (m) => g(m.target.value),
85
+ onKeyDown: (m) => {
86
+ m.key === "Escape" && (f(!1), g(""), i.commands.focus());
87
+ },
307
88
  placeholder: "https://...",
308
89
  className: "h-ds-sm w-[240px] rounded-ds-sm border border-surface-border-strong bg-surface-overlay px-ds-03 text-ds-sm text-surface-fg focus:border-accent-7 focus:outline-none"
309
90
  }
310
91
  ),
311
- /* @__PURE__ */ n("button", { type: "submit", className: "h-ds-sm rounded-ds-sm bg-accent-9 px-ds-03 text-ds-sm text-accent-fg hover:bg-accent-10", children: "Apply" })
92
+ /* @__PURE__ */ e("button", { type: "submit", className: "h-ds-sm rounded-ds-sm bg-accent-9 px-ds-03 text-ds-sm text-accent-fg hover:bg-accent-10", children: "Apply" })
312
93
  ]
313
94
  }
314
95
  )
315
96
  ] });
316
97
  }
317
- function y() {
318
- return /* @__PURE__ */ n("div", { className: "mx-ds-02 h-[16px] w-px bg-surface-border" });
98
+ function _() {
99
+ return /* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-surface-border" });
319
100
  }
320
- function Me({ editor: e, toolbar: r, onImageClick: s, onFileClick: o, onEmojiClick: i }) {
321
- const t = (C) => !r || r.includes(C), l = t("bold") || t("italic") || t("underline") || t("strike") || t("highlight"), x = t("h2") || t("h3") || t("blockquote"), g = t("bulletList") || t("orderedList") || t("taskList") || t("codeBlock"), h = t("link") || !!s && t("image") || !!o && t("file") || t("hr"), v = t("alignLeft") || t("alignCenter") || t("alignRight"), L = !!i && t("emoji"), I = t("undo") || t("redo");
322
- return /* @__PURE__ */ p("div", { role: "toolbar", "aria-label": "Text formatting", className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b", children: [
323
- t("bold") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleBold().run(), isActive: e.isActive("bold"), title: "Bold", children: /* @__PURE__ */ n(u, { icon: ae, size: "sm", stroke: "bold" }) }),
324
- t("italic") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleItalic().run(), isActive: e.isActive("italic"), title: "Italic", children: /* @__PURE__ */ n(u, { icon: ce, size: "sm", stroke: "bold" }) }),
325
- t("underline") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleUnderline().run(), isActive: e.isActive("underline"), title: "Underline", children: /* @__PURE__ */ n(u, { icon: ue, size: "sm", stroke: "bold" }) }),
326
- t("strike") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleStrike().run(), isActive: e.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ n(u, { icon: de, size: "sm", stroke: "bold" }) }),
327
- t("highlight") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleHighlight().run(), isActive: e.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ n(u, { icon: fe, size: "sm", stroke: "bold" }) }),
328
- l && x && /* @__PURE__ */ n(y, {}),
329
- t("h2") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleHeading({ level: 2 }).run(), isActive: e.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ n(u, { icon: me, size: "sm", stroke: "bold" }) }),
330
- t("h3") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleHeading({ level: 3 }).run(), isActive: e.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ n(u, { icon: he, size: "sm", stroke: "bold" }) }),
331
- t("blockquote") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleBlockquote().run(), isActive: e.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ n(u, { icon: ge, size: "sm", stroke: "bold" }) }),
332
- x && g && /* @__PURE__ */ n(y, {}),
333
- t("bulletList") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleBulletList().run(), isActive: e.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ n(u, { icon: be, size: "sm", stroke: "bold" }) }),
334
- t("orderedList") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleOrderedList().run(), isActive: e.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ n(u, { icon: pe, size: "sm", stroke: "bold" }) }),
335
- t("taskList") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleTaskList().run(), isActive: e.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ n(u, { icon: xe, size: "sm", stroke: "bold" }) }),
336
- t("codeBlock") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleCodeBlock().run(), isActive: e.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ n(u, { icon: ke, size: "sm", stroke: "bold" }) }),
337
- g && h && /* @__PURE__ */ n(y, {}),
338
- t("link") && /* @__PURE__ */ n(De, { editor: e }),
339
- s && t("image") && /* @__PURE__ */ n(d, { onClick: s, title: "Insert image", children: /* @__PURE__ */ n(u, { icon: ve, size: "sm" }) }),
340
- o && t("file") && /* @__PURE__ */ n(d, { onClick: o, title: "Attach file", children: /* @__PURE__ */ n(u, { icon: ye, size: "sm" }) }),
341
- t("hr") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ n(u, { icon: we, size: "sm" }) }),
342
- h && v && /* @__PURE__ */ n(y, {}),
343
- t("alignLeft") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().setTextAlign("left").run(), isActive: e.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ n(u, { icon: Ae, size: "sm" }) }),
344
- t("alignCenter") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().setTextAlign("center").run(), isActive: e.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ n(u, { icon: _e, size: "sm" }) }),
345
- t("alignRight") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().setTextAlign("right").run(), isActive: e.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ n(u, { icon: Le, size: "sm" }) }),
346
- v && (L || I) && /* @__PURE__ */ n(y, {}),
347
- i && t("emoji") && /* @__PURE__ */ n(d, { onClick: i, title: "Emoji", children: /* @__PURE__ */ n(u, { icon: Ie, size: "sm" }) }),
348
- t("undo") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().undo().run(), disabled: !e.can().undo(), title: "Undo", children: /* @__PURE__ */ n(u, { icon: Ce, size: "sm" }) }),
349
- t("redo") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().redo().run(), disabled: !e.can().redo(), title: "Redo", children: /* @__PURE__ */ n(u, { icon: Re, size: "sm" }) })
101
+ function ye({ editor: i, toolbar: u, onImageClick: f, onFileClick: h, onEmojiClick: g }) {
102
+ const n = V({
103
+ editor: i,
104
+ selector: ({ editor: o }) => ({
105
+ isBold: o.isActive("bold"),
106
+ isItalic: o.isActive("italic"),
107
+ isUnderline: o.isActive("underline"),
108
+ isStrike: o.isActive("strike"),
109
+ isHighlight: o.isActive("highlight"),
110
+ isH2: o.isActive("heading", { level: 2 }),
111
+ isH3: o.isActive("heading", { level: 3 }),
112
+ isBlockquote: o.isActive("blockquote"),
113
+ isBulletList: o.isActive("bulletList"),
114
+ isOrderedList: o.isActive("orderedList"),
115
+ isTaskList: o.isActive("taskList"),
116
+ isCodeBlock: o.isActive("codeBlock"),
117
+ isLink: o.isActive("link"),
118
+ isAlignLeft: o.isActive({ textAlign: "left" }),
119
+ isAlignCenter: o.isActive({ textAlign: "center" }),
120
+ isAlignRight: o.isActive({ textAlign: "right" }),
121
+ canUndo: o.can().undo(),
122
+ canRedo: o.can().redo()
123
+ })
124
+ }), t = (o) => !u || u.includes(o), A = t("bold") || t("italic") || t("underline") || t("strike") || t("highlight"), p = t("h2") || t("h3") || t("blockquote"), k = t("bulletList") || t("orderedList") || t("taskList") || t("codeBlock"), m = t("link") || !!f && t("image") || !!h && t("file") || t("hr"), C = t("alignLeft") || t("alignCenter") || t("alignRight"), v = !!g && t("emoji"), R = t("undo") || t("redo");
125
+ return /* @__PURE__ */ y("div", { role: "toolbar", "aria-label": "Text formatting", className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b", children: [
126
+ t("bold") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleBold().run(), isActive: n.isBold, title: "Bold", children: /* @__PURE__ */ e(l, { icon: te, size: "sm", stroke: "bold" }) }),
127
+ t("italic") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleItalic().run(), isActive: n.isItalic, title: "Italic", children: /* @__PURE__ */ e(l, { icon: ie, size: "sm", stroke: "bold" }) }),
128
+ t("underline") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleUnderline().run(), isActive: n.isUnderline, title: "Underline", children: /* @__PURE__ */ e(l, { icon: se, size: "sm", stroke: "bold" }) }),
129
+ t("strike") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleStrike().run(), isActive: n.isStrike, title: "Strikethrough", children: /* @__PURE__ */ e(l, { icon: ne, size: "sm", stroke: "bold" }) }),
130
+ t("highlight") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleHighlight().run(), isActive: n.isHighlight, title: "Highlight", children: /* @__PURE__ */ e(l, { icon: re, size: "sm", stroke: "bold" }) }),
131
+ A && p && /* @__PURE__ */ e(_, {}),
132
+ t("h2") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleHeading({ level: 2 }).run(), isActive: n.isH2, title: "Heading 2", children: /* @__PURE__ */ e(l, { icon: oe, size: "sm", stroke: "bold" }) }),
133
+ t("h3") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleHeading({ level: 3 }).run(), isActive: n.isH3, title: "Heading 3", children: /* @__PURE__ */ e(l, { icon: le, size: "sm", stroke: "bold" }) }),
134
+ t("blockquote") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleBlockquote().run(), isActive: n.isBlockquote, title: "Blockquote", children: /* @__PURE__ */ e(l, { icon: ce, size: "sm", stroke: "bold" }) }),
135
+ p && k && /* @__PURE__ */ e(_, {}),
136
+ t("bulletList") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleBulletList().run(), isActive: n.isBulletList, title: "Bullet list", children: /* @__PURE__ */ e(l, { icon: ae, size: "sm", stroke: "bold" }) }),
137
+ t("orderedList") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleOrderedList().run(), isActive: n.isOrderedList, title: "Ordered list", children: /* @__PURE__ */ e(l, { icon: de, size: "sm", stroke: "bold" }) }),
138
+ t("taskList") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleTaskList().run(), isActive: n.isTaskList, title: "Task list", children: /* @__PURE__ */ e(l, { icon: ue, size: "sm", stroke: "bold" }) }),
139
+ t("codeBlock") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().toggleCodeBlock().run(), isActive: n.isCodeBlock, title: "Code block", children: /* @__PURE__ */ e(l, { icon: fe, size: "sm", stroke: "bold" }) }),
140
+ k && m && /* @__PURE__ */ e(_, {}),
141
+ t("link") && /* @__PURE__ */ e(Le, { editor: i }),
142
+ f && t("image") && /* @__PURE__ */ e(c, { onClick: f, title: "Insert image", children: /* @__PURE__ */ e(l, { icon: he, size: "sm" }) }),
143
+ h && t("file") && /* @__PURE__ */ e(c, { onClick: h, title: "Attach file", children: /* @__PURE__ */ e(l, { icon: ge, size: "sm" }) }),
144
+ t("hr") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ e(l, { icon: me, size: "sm" }) }),
145
+ m && C && /* @__PURE__ */ e(_, {}),
146
+ t("alignLeft") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().setTextAlign("left").run(), isActive: n.isAlignLeft, title: "Align left", children: /* @__PURE__ */ e(l, { icon: be, size: "sm" }) }),
147
+ t("alignCenter") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().setTextAlign("center").run(), isActive: n.isAlignCenter, title: "Align center", children: /* @__PURE__ */ e(l, { icon: pe, size: "sm" }) }),
148
+ t("alignRight") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().setTextAlign("right").run(), isActive: n.isAlignRight, title: "Align right", children: /* @__PURE__ */ e(l, { icon: ke, size: "sm" }) }),
149
+ C && (v || R) && /* @__PURE__ */ e(_, {}),
150
+ g && t("emoji") && /* @__PURE__ */ e(c, { onClick: g, title: "Emoji", children: /* @__PURE__ */ e(l, { icon: ve, size: "sm" }) }),
151
+ t("undo") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().undo().run(), disabled: !n.canUndo, title: "Undo", children: /* @__PURE__ */ e(l, { icon: xe, size: "sm" }) }),
152
+ t("redo") && /* @__PURE__ */ e(c, { onClick: () => i.chain().focus().redo().run(), disabled: !n.canRedo, title: "Redo", children: /* @__PURE__ */ e(l, { icon: Ae, size: "sm" }) })
350
153
  ] });
351
154
  }
352
- const Pe = c.lazy(() => import("@emoji-mart/react"));
353
- function Ue({ onSelect: e }) {
354
- const [r, s] = c.useState(null), { colorMode: o } = ze();
355
- c.useEffect(() => {
356
- import("@emoji-mart/data").then((t) => s(t.default));
357
- }, []);
358
- const i = /* @__PURE__ */ n("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: /* @__PURE__ */ n("span", { className: "text-ds-sm text-surface-fg-subtle", children: "Loading..." }) });
359
- return r ? /* @__PURE__ */ n(c.Suspense, { fallback: i, children: /* @__PURE__ */ n(
360
- Pe,
155
+ const Ce = d.lazy(() => import("@emoji-mart/react"));
156
+ function we({ set: i = "native", onSelect: u }) {
157
+ const [f, h] = d.useState(null), { colorMode: g } = ee();
158
+ d.useEffect(() => {
159
+ G(i).then((t) => h(t));
160
+ }, [i]);
161
+ const n = /* @__PURE__ */ e("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-surface-border-strong bg-surface-overlay shadow-raised-hover", children: /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: "Loading..." }) });
162
+ return f ? /* @__PURE__ */ e(d.Suspense, { fallback: n, children: /* @__PURE__ */ e(
163
+ Ce,
361
164
  {
362
- data: r,
363
- onEmojiSelect: (t) => e(t.native),
364
- theme: o === "dark" ? "dark" : "light",
165
+ data: f,
166
+ set: i,
167
+ onEmojiSelect: (t) => u({ id: t.id, native: t.native }),
168
+ theme: g === "dark" ? "dark" : "light",
365
169
  previewPosition: "none",
366
170
  skinTonePosition: "none"
367
171
  }
368
- ) }) : i;
172
+ ) }) : n;
369
173
  }
370
- const Ke = c.forwardRef(
174
+ const Ie = d.forwardRef(
371
175
  function({
372
- content: r = "",
373
- placeholder: s = "Start writing...",
374
- onChange: o,
375
- className: i,
376
- editable: t = !0,
377
- toolbar: l,
378
- onImageUpload: x,
379
- onFileUpload: g,
380
- mentions: h,
381
- onMentionSearch: v,
382
- onMentionSelect: L,
383
- ...I
384
- }, C) {
385
- const R = c.useRef(null), E = c.useRef(!1), [z, w] = c.useState(!1), N = c.useRef(null), B = c.useRef(null), D = c.useRef(null), T = async (a) => {
386
- const f = R.current;
387
- if (f)
388
- if (x) {
389
- const m = await x(a);
390
- m && /^https?:\/\//i.test(m) && f.chain().focus().setImage({ src: m }).run();
176
+ content: u = "",
177
+ placeholder: f = "Start writing...",
178
+ onChange: h,
179
+ className: g,
180
+ editable: n = !0,
181
+ toolbar: t,
182
+ onImageUpload: A,
183
+ onFileUpload: p,
184
+ mentions: k,
185
+ onMentionSearch: m,
186
+ onMentionSelect: C,
187
+ emojiSet: v = "native",
188
+ ...R
189
+ }, o) {
190
+ const z = d.useRef(null), T = d.useRef(!1), [E, w] = d.useState(!1), B = d.useRef(null), N = d.useRef(null), P = d.useRef(null), H = async (s) => {
191
+ const r = z.current;
192
+ if (r)
193
+ if (A) {
194
+ const a = await A(s);
195
+ a && /^https?:\/\//i.test(a) && r.chain().focus().setImage({ src: a }).run();
391
196
  } else {
392
- const m = new FileReader();
393
- m.onload = () => {
394
- f.chain().focus().setImage({ src: m.result }).run();
395
- }, m.readAsDataURL(a);
197
+ const a = new FileReader();
198
+ a.onload = () => {
199
+ r.chain().focus().setImage({ src: a.result }).run();
200
+ }, a.readAsDataURL(s);
396
201
  }
397
- }, S = async (a) => {
398
- const f = R.current;
399
- if (!f || !g) return;
400
- const m = await g(a);
401
- f.chain().focus().insertContent({
202
+ }, S = async (s) => {
203
+ const r = z.current;
204
+ if (!r || !p) return;
205
+ const a = await p(s);
206
+ r.chain().focus().insertContent({
402
207
  type: "fileAttachment",
403
- attrs: { url: m.url, name: m.name, size: m.size }
208
+ attrs: { url: a.url, name: a.name, size: a.size }
404
209
  }).run();
405
- }, b = M({
210
+ }, b = j({
211
+ immediatelyRender: !1,
212
+ // SSR-safe — prevents hydration mismatch in Next.js
406
213
  extensions: [
407
- K.configure({
408
- heading: { levels: [2, 3] }
214
+ q.configure({
215
+ heading: { levels: [2, 3] },
216
+ // v3: Underline + Link are now included in StarterKit
217
+ link: {
218
+ openOnClick: !1,
219
+ protocols: ["http", "https", "mailto"],
220
+ validate: (s) => /^(https?:\/\/|mailto:)/i.test(s),
221
+ HTMLAttributes: {
222
+ rel: "noopener noreferrer",
223
+ target: "_blank"
224
+ }
225
+ }
409
226
  }),
410
- ie.configure({
411
- placeholder: s,
227
+ Q.configure({
228
+ placeholder: f,
412
229
  emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-surface-fg-subtle before:float-left before:h-0 before:pointer-events-none"
413
230
  }),
414
- P,
415
- $.configure({ multicolor: !1 }),
416
- U,
417
- q.configure({ nested: !0 }),
418
- O.configure({ types: ["heading", "paragraph"] }),
419
- V.configure({
420
- openOnClick: !1,
421
- protocols: ["http", "https", "mailto"],
422
- validate: (a) => /^(https?:\/\/|mailto:)/i.test(a),
423
- HTMLAttributes: {
424
- rel: "noopener noreferrer",
425
- target: "_blank"
426
- }
231
+ D.configure({ multicolor: !1 }),
232
+ U.configure({
233
+ bulletList: !1,
234
+ // Already in StarterKit
235
+ orderedList: !1,
236
+ // Already in StarterKit
237
+ listItem: !1,
238
+ // Already in StarterKit
239
+ listKeymap: !1,
240
+ // Already in StarterKit
241
+ taskList: {},
242
+ taskItem: { nested: !0 }
427
243
  }),
428
- F.configure({
244
+ M.configure({ types: ["heading", "paragraph"] }),
245
+ O.configure({
429
246
  allowBase64: !0,
430
247
  HTMLAttributes: {
431
248
  class: "max-w-full rounded-ds-md"
432
249
  }
433
250
  }),
434
- Q,
435
- ...h || v ? [
436
- W.configure({
251
+ W,
252
+ ...k || m ? [
253
+ K.configure({
437
254
  HTMLAttributes: { class: "mention" },
438
255
  suggestion: {
439
- items: async ({ query: a }) => v ? await v(a) : h ? h.filter((f) => f.label.toLowerCase().includes(a.toLowerCase())).slice(0, 8) : [],
440
- render: Se(L)
256
+ items: async ({ query: s }) => m ? await m(s) : k ? k.filter((r) => r.label.toLowerCase().includes(s.toLowerCase())).slice(0, 8) : [],
257
+ render: Y(C)
441
258
  }
442
259
  })
443
260
  ] : [],
444
- Be
261
+ X,
262
+ Z(v)
445
263
  ],
446
- content: r,
447
- editable: t,
264
+ content: u,
265
+ editable: n,
448
266
  editorProps: {
449
- handleDrop: (a, f, m, Y) => {
450
- if (Y || !f.dataTransfer?.files.length) return !1;
451
- const A = f.dataTransfer.files[0];
452
- return A ? A.type.startsWith("image/") ? (T(A), !0) : g ? (S(A), !0) : !1 : !1;
267
+ handleDrop: (s, r, a, x) => {
268
+ if (x || !r.dataTransfer?.files.length) return !1;
269
+ const I = r.dataTransfer.files[0];
270
+ return I ? I.type.startsWith("image/") ? (H(I), !0) : p ? (S(I), !0) : !1 : !1;
453
271
  },
454
- handlePaste: (a, f) => {
455
- const m = f.clipboardData?.files[0];
456
- return m ? m.type.startsWith("image/") ? (T(m), !0) : g ? (S(m), !0) : !1 : !1;
272
+ handlePaste: (s, r) => {
273
+ const a = r.clipboardData?.files[0];
274
+ return a ? a.type.startsWith("image/") ? (H(a), !0) : p ? (S(a), !0) : !1 : !1;
457
275
  },
458
276
  attributes: {
459
- class: k(
460
- ...X,
277
+ class: L(
278
+ ...J,
461
279
  "focus:outline-none",
462
280
  "min-h-[120px] px-ds-04 py-ds-04"
463
281
  )
464
282
  }
465
283
  },
466
- onUpdate: ({ editor: a }) => {
467
- E.current = !0, o?.(a.getHTML()), queueMicrotask(() => {
468
- E.current = !1;
284
+ onUpdate: ({ editor: s }) => {
285
+ T.current = !0, h?.(s.getHTML()), queueMicrotask(() => {
286
+ T.current = !1;
469
287
  });
470
288
  }
471
289
  });
472
- return c.useEffect(() => {
473
- R.current = b;
474
- }, [b]), c.useEffect(() => {
475
- if (!z) return;
476
- const a = (f) => {
477
- N.current && !N.current.contains(f.target) && w(!1);
290
+ return d.useEffect(() => {
291
+ z.current = b;
292
+ }, [b]), d.useEffect(() => {
293
+ if (!E) return;
294
+ const s = (r) => {
295
+ B.current && !B.current.contains(r.target) && w(!1);
478
296
  };
479
- return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
480
- }, [z]), c.useEffect(() => {
481
- E.current || b && r !== b.getHTML() && b.commands.setContent(r, !1);
482
- }, [b, r]), b ? /* @__PURE__ */ p("div", { ref: C, ...I, className: k("relative", i), children: [
483
- z && /* @__PURE__ */ n(
297
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
298
+ }, [E]), d.useEffect(() => {
299
+ T.current || b && u !== b.getHTML() && b.commands.setContent(u, { emitUpdate: !1 });
300
+ }, [b, u]), b ? /* @__PURE__ */ y("div", { ref: o, ...R, className: L("relative", g), children: [
301
+ E && /* @__PURE__ */ e(
484
302
  "div",
485
303
  {
486
- ref: N,
304
+ ref: B,
487
305
  className: "absolute bottom-full right-0 z-popover mb-ds-02",
488
- onKeyDown: (a) => {
489
- a.key === "Escape" && (a.stopPropagation(), w(!1));
306
+ onKeyDown: (s) => {
307
+ s.key === "Escape" && (s.stopPropagation(), w(!1));
490
308
  },
491
- children: /* @__PURE__ */ n(
492
- Ue,
309
+ children: /* @__PURE__ */ e(
310
+ we,
493
311
  {
494
- onSelect: (a) => {
495
- b.chain().focus().insertContent(a).run(), w(!1);
312
+ set: v,
313
+ onSelect: async ({ id: s, native: r }) => {
314
+ const a = await G(v), x = F(a, s);
315
+ x ? b.chain().focus().insertContent({
316
+ type: "emojiNode",
317
+ attrs: { id: s, native: x.native, set: v, x: x.x, y: x.y }
318
+ }).run() : b.chain().focus().insertContent(r).run(), w(!1);
496
319
  }
497
320
  }
498
321
  )
499
322
  }
500
323
  ),
501
- /* @__PURE__ */ p(
324
+ /* @__PURE__ */ y(
502
325
  "div",
503
326
  {
504
- className: k(
327
+ className: L(
505
328
  "overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-raised",
506
329
  "transition-colors ease-productive-standard focus-within:border-surface-border-strong"
507
330
  ),
508
331
  children: [
509
- /* @__PURE__ */ n(
332
+ /* @__PURE__ */ e(
510
333
  "input",
511
334
  {
512
- ref: B,
335
+ ref: N,
513
336
  type: "file",
514
337
  accept: "image/*",
515
338
  "aria-label": "Upload image",
516
339
  className: "hidden",
517
- onChange: (a) => {
518
- const f = a.target.files?.[0];
519
- f && T(f), a.target.value = "";
340
+ onChange: (s) => {
341
+ const r = s.target.files?.[0];
342
+ r && H(r), s.target.value = "";
520
343
  }
521
344
  }
522
345
  ),
523
- g && /* @__PURE__ */ n(
346
+ p && /* @__PURE__ */ e(
524
347
  "input",
525
348
  {
526
- ref: D,
349
+ ref: P,
527
350
  type: "file",
528
351
  "aria-label": "Upload file",
529
352
  className: "hidden",
530
- onChange: (a) => {
531
- const f = a.target.files?.[0];
532
- f && S(f), a.target.value = "";
353
+ onChange: (s) => {
354
+ const r = s.target.files?.[0];
355
+ r && S(r), s.target.value = "";
533
356
  }
534
357
  }
535
358
  ),
536
- t && /* @__PURE__ */ n(
537
- Me,
359
+ n && /* @__PURE__ */ e(
360
+ ye,
538
361
  {
539
362
  editor: b,
540
- toolbar: l,
541
- onImageClick: () => B.current?.click(),
542
- onFileClick: g ? () => D.current?.click() : void 0,
543
- onEmojiClick: () => w((a) => !a)
363
+ toolbar: t,
364
+ onImageClick: () => N.current?.click(),
365
+ onFileClick: p ? () => P.current?.click() : void 0,
366
+ onEmojiClick: () => w((s) => !s)
544
367
  }
545
368
  ),
546
- /* @__PURE__ */ n(G, { editor: b })
369
+ /* @__PURE__ */ e($, { editor: b })
547
370
  ]
548
371
  }
549
372
  )
550
373
  ] }) : null;
551
374
  }
552
375
  );
553
- Ke.displayName = "RichTextEditor";
554
- const $e = c.forwardRef(
555
- function({ content: r, className: s, ...o }, i) {
556
- const t = M({
376
+ Ie.displayName = "RichTextEditor";
377
+ const Re = d.forwardRef(
378
+ function({ content: u, className: f, ...h }, g) {
379
+ const n = j({
380
+ immediatelyRender: !1,
381
+ // SSR-safe — prevents hydration mismatch in Next.js
557
382
  extensions: [
558
- K.configure({
559
- heading: { levels: [2, 3] }
560
- }),
561
- P,
562
- $.configure({ multicolor: !1 }),
563
- U,
564
- q.configure({ nested: !0 }),
565
- O.configure({ types: ["heading", "paragraph"] }),
566
- V.configure({
567
- openOnClick: !0,
568
- protocols: ["http", "https", "mailto"],
569
- validate: (l) => /^(https?:\/\/|mailto:)/i.test(l),
570
- HTMLAttributes: {
571
- rel: "noopener noreferrer",
572
- target: "_blank"
383
+ q.configure({
384
+ heading: { levels: [2, 3] },
385
+ link: {
386
+ openOnClick: !0,
387
+ protocols: ["http", "https", "mailto"],
388
+ validate: (t) => /^(https?:\/\/|mailto:)/i.test(t),
389
+ HTMLAttributes: {
390
+ rel: "noopener noreferrer",
391
+ target: "_blank"
392
+ }
573
393
  }
574
394
  }),
575
- F.configure({
395
+ D.configure({ multicolor: !1 }),
396
+ U.configure({
397
+ bulletList: !1,
398
+ orderedList: !1,
399
+ listItem: !1,
400
+ listKeymap: !1,
401
+ taskList: {},
402
+ taskItem: { nested: !0 }
403
+ }),
404
+ M.configure({ types: ["heading", "paragraph"] }),
405
+ O.configure({
576
406
  allowBase64: !0,
577
407
  HTMLAttributes: {
578
408
  class: "max-w-full rounded-ds-md"
579
409
  }
580
410
  }),
581
- Q,
582
- W.configure({
411
+ W,
412
+ K.configure({
583
413
  HTMLAttributes: { class: "mention" }
584
414
  })
585
415
  ],
586
- content: r,
416
+ content: u,
587
417
  editable: !1,
588
418
  editorProps: {
589
419
  attributes: {
590
- class: k(...X)
420
+ class: L(...J)
591
421
  }
592
422
  }
593
423
  });
594
- return t ? /* @__PURE__ */ n("div", { ref: i, ...o, className: s, children: /* @__PURE__ */ n(G, { editor: t }) }) : null;
424
+ return n ? /* @__PURE__ */ e("div", { ref: g, ...h, className: f, children: /* @__PURE__ */ e($, { editor: n }) }) : null;
595
425
  }
596
426
  );
597
- $e.displayName = "RichTextViewer";
427
+ Re.displayName = "RichTextViewer";
598
428
  export {
599
- Ke as RichTextEditor,
600
- $e as RichTextViewer
429
+ Ie as RichTextEditor,
430
+ Re as RichTextViewer
601
431
  };