@devalok/shilp-sutra 0.31.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 (278) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_chunks/badge-group.js +123 -172
  3. package/dist/_chunks/date-time-picker.js +851 -0
  4. package/dist/_chunks/document-preview.js +92 -0
  5. package/dist/_chunks/file-preview.js +511 -0
  6. package/dist/_chunks/image-preview.js +90 -0
  7. package/dist/_chunks/mention-suggestion.js +362 -0
  8. package/dist/_chunks/primitives.js +109 -109
  9. package/dist/_chunks/stat-row.js +144 -124
  10. package/dist/_chunks/tiptap.js +11595 -7731
  11. package/dist/_chunks/use-calendar.js +117 -890
  12. package/dist/_chunks/vendor-client.js +1055 -894
  13. package/dist/ai/block-renderer.d.ts +2 -1
  14. package/dist/ai/block-renderer.d.ts.map +1 -1
  15. package/dist/ai/block-renderer.js +30 -29
  16. package/dist/ai/blocks/block-table.d.ts.map +1 -1
  17. package/dist/ai/blocks/confirm.d.ts.map +1 -1
  18. package/dist/ai/blocks/divider.d.ts.map +1 -1
  19. package/dist/ai/blocks/error.d.ts.map +1 -1
  20. package/dist/ai/blocks/info.d.ts.map +1 -1
  21. package/dist/ai/blocks/loading.d.ts.map +1 -1
  22. package/dist/ai/blocks/stat-row.d.ts.map +1 -1
  23. package/dist/ai/blocks/success.d.ts.map +1 -1
  24. package/dist/ai/blocks/text.d.ts.map +1 -1
  25. package/dist/ai/command-bar.d.ts +18 -0
  26. package/dist/ai/command-bar.d.ts.map +1 -1
  27. package/dist/ai/command-bar.js +126 -125
  28. package/dist/ai/conversation.d.ts +13 -1
  29. package/dist/ai/conversation.d.ts.map +1 -1
  30. package/dist/ai/conversation.js +78 -78
  31. package/dist/ai/types.d.ts +0 -1
  32. package/dist/ai/types.d.ts.map +1 -1
  33. package/dist/ai/types.js +0 -1
  34. package/dist/composed/bulk-action-bar.d.ts +6 -4
  35. package/dist/composed/bulk-action-bar.d.ts.map +1 -1
  36. package/dist/composed/bulk-action-bar.js +102 -58
  37. package/dist/composed/command-palette.d.ts +9 -0
  38. package/dist/composed/command-palette.d.ts.map +1 -1
  39. package/dist/composed/command-palette.js +68 -68
  40. package/dist/composed/confirm-dialog.d.ts +1 -1
  41. package/dist/composed/confirm-dialog.d.ts.map +1 -1
  42. package/dist/composed/confirm-dialog.js +10 -10
  43. package/dist/composed/date-picker/date-picker.d.ts +11 -1
  44. package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
  45. package/dist/composed/date-picker/index.js +9 -8
  46. package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
  47. package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
  48. package/dist/composed/deadline-indicator.d.ts +1 -1
  49. package/dist/composed/deadline-indicator.d.ts.map +1 -1
  50. package/dist/composed/deadline-indicator.js +39 -36
  51. package/dist/composed/emoji-picker.d.ts +14 -2
  52. package/dist/composed/emoji-picker.d.ts.map +1 -1
  53. package/dist/composed/emoji-picker.js +66 -55
  54. package/dist/composed/error-boundary.d.ts +21 -1
  55. package/dist/composed/error-boundary.d.ts.map +1 -1
  56. package/dist/composed/error-boundary.js +47 -32
  57. package/dist/composed/extensions/emoji-data.d.ts +35 -0
  58. package/dist/composed/extensions/emoji-data.d.ts.map +1 -0
  59. package/dist/composed/extensions/emoji-node.d.ts +11 -0
  60. package/dist/composed/extensions/emoji-node.d.ts.map +1 -0
  61. package/dist/composed/extensions/emoji-suggestion.d.ts +4 -6
  62. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -1
  63. package/dist/composed/extensions/slash-command.d.ts +35 -0
  64. package/dist/composed/extensions/slash-command.d.ts.map +1 -0
  65. package/dist/composed/file-preview/audio-preview.d.ts +7 -0
  66. package/dist/composed/file-preview/audio-preview.d.ts.map +1 -0
  67. package/dist/composed/file-preview/document-preview.d.ts +7 -0
  68. package/dist/composed/file-preview/document-preview.d.ts.map +1 -0
  69. package/dist/composed/file-preview/embed-preview.d.ts +7 -0
  70. package/dist/composed/file-preview/embed-preview.d.ts.map +1 -0
  71. package/dist/composed/file-preview/image-preview.d.ts +7 -0
  72. package/dist/composed/file-preview/image-preview.d.ts.map +1 -0
  73. package/dist/composed/file-preview/shared.d.ts +20 -0
  74. package/dist/composed/file-preview/shared.d.ts.map +1 -0
  75. package/dist/composed/file-preview/video-preview.d.ts +6 -0
  76. package/dist/composed/file-preview/video-preview.d.ts.map +1 -0
  77. package/dist/composed/file-preview.d.ts.map +1 -1
  78. package/dist/composed/file-preview.js +10 -662
  79. package/dist/composed/filter-bar.d.ts +10 -2
  80. package/dist/composed/filter-bar.d.ts.map +1 -1
  81. package/dist/composed/filter-bar.js +42 -43
  82. package/dist/composed/form-section.d.ts +1 -1
  83. package/dist/composed/form-section.d.ts.map +1 -1
  84. package/dist/composed/form-section.js +22 -21
  85. package/dist/composed/index.d.ts +9 -3
  86. package/dist/composed/index.d.ts.map +1 -1
  87. package/dist/composed/index.js +79 -69
  88. package/dist/composed/inline-edit.d.ts +1 -1
  89. package/dist/composed/inline-edit.d.ts.map +1 -1
  90. package/dist/composed/inline-edit.js +33 -32
  91. package/dist/composed/markdown-viewer.d.ts +1 -1
  92. package/dist/composed/markdown-viewer.d.ts.map +1 -1
  93. package/dist/composed/markdown-viewer.js +60 -59
  94. package/dist/composed/master-detail.d.ts +11 -7
  95. package/dist/composed/master-detail.d.ts.map +1 -1
  96. package/dist/composed/master-detail.js +123 -84
  97. package/dist/composed/responsive-overlay.d.ts +8 -0
  98. package/dist/composed/responsive-overlay.d.ts.map +1 -1
  99. package/dist/composed/rich-chat-input/attachment-strip.d.ts +15 -0
  100. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -0
  101. package/dist/composed/rich-chat-input/audio-player.d.ts +11 -0
  102. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -0
  103. package/dist/composed/rich-chat-input/audio-waveform.d.ts +24 -0
  104. package/dist/composed/rich-chat-input/audio-waveform.d.ts.map +1 -0
  105. package/dist/composed/rich-chat-input/chat-toolbar.d.ts +51 -0
  106. package/dist/composed/rich-chat-input/chat-toolbar.d.ts.map +1 -0
  107. package/dist/composed/rich-chat-input/recording-overlay.d.ts +15 -0
  108. package/dist/composed/rich-chat-input/recording-overlay.d.ts.map +1 -0
  109. package/dist/composed/rich-chat-input/reply-banner.d.ts +8 -0
  110. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -0
  111. package/dist/composed/rich-chat-input/schedule-send.d.ts +22 -0
  112. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -0
  113. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts +18 -0
  114. package/dist/composed/rich-chat-input/use-voice-recorder.d.ts.map +1 -0
  115. package/dist/composed/rich-chat-input.d.ts +91 -0
  116. package/dist/composed/rich-chat-input.d.ts.map +1 -0
  117. package/dist/composed/rich-chat-input.js +1861 -0
  118. package/dist/composed/rich-text-editor.d.ts +14 -3
  119. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  120. package/dist/composed/rich-text-editor.js +278 -447
  121. package/dist/composed/schedule-view.d.ts +9 -1
  122. package/dist/composed/schedule-view.d.ts.map +1 -1
  123. package/dist/hooks/index.d.ts +2 -0
  124. package/dist/hooks/index.d.ts.map +1 -1
  125. package/dist/hooks/index.js +8 -4
  126. package/dist/hooks/use-touch-device.d.ts +12 -0
  127. package/dist/hooks/use-touch-device.d.ts.map +1 -0
  128. package/dist/hooks/use-touch-device.js +13 -0
  129. package/dist/hooks/use-viewport-height.d.ts +11 -0
  130. package/dist/hooks/use-viewport-height.d.ts.map +1 -0
  131. package/dist/hooks/use-viewport-height.js +16 -0
  132. package/dist/shell/bottom-navbar.d.ts.map +1 -1
  133. package/dist/shell/bottom-navbar.js +72 -63
  134. package/dist/shell/command-registry.d.ts.map +1 -1
  135. package/dist/shell/notification-center.d.ts.map +1 -1
  136. package/dist/shell/notification-center.js +77 -77
  137. package/dist/shell/top-bar.d.ts +2 -2
  138. package/dist/shell/top-bar.d.ts.map +1 -1
  139. package/dist/shell/top-bar.js +61 -60
  140. package/dist/tailwind/index.cjs +51 -7
  141. package/dist/tailwind/preset.d.ts.map +1 -1
  142. package/dist/tailwind/preset.js +51 -7
  143. package/dist/tokens/primitives.css +3 -1
  144. package/dist/tokens/semantic.css +16 -13
  145. package/dist/ui/autocomplete.d.ts.map +1 -1
  146. package/dist/ui/autocomplete.js +38 -39
  147. package/dist/ui/badge.d.ts +104 -2
  148. package/dist/ui/badge.d.ts.map +1 -1
  149. package/dist/ui/banner.d.ts.map +1 -1
  150. package/dist/ui/banner.js +8 -7
  151. package/dist/ui/button-group.d.ts +27 -37
  152. package/dist/ui/button-group.d.ts.map +1 -1
  153. package/dist/ui/button-group.js +95 -29
  154. package/dist/ui/button.d.ts +2 -2
  155. package/dist/ui/button.d.ts.map +1 -1
  156. package/dist/ui/button.js +118 -134
  157. package/dist/ui/card.js +24 -24
  158. package/dist/ui/charts/area-chart.d.ts +2 -0
  159. package/dist/ui/charts/area-chart.d.ts.map +1 -1
  160. package/dist/ui/charts/bar-chart.d.ts +2 -0
  161. package/dist/ui/charts/bar-chart.d.ts.map +1 -1
  162. package/dist/ui/charts/chart-container.d.ts +2 -0
  163. package/dist/ui/charts/chart-container.d.ts.map +1 -1
  164. package/dist/ui/charts/index.js +583 -577
  165. package/dist/ui/charts/line-chart.d.ts +2 -0
  166. package/dist/ui/charts/line-chart.d.ts.map +1 -1
  167. package/dist/ui/charts/pie-chart.d.ts +2 -0
  168. package/dist/ui/charts/pie-chart.d.ts.map +1 -1
  169. package/dist/ui/charts/radar-chart.d.ts +2 -0
  170. package/dist/ui/charts/radar-chart.d.ts.map +1 -1
  171. package/dist/ui/checkbox.d.ts +2 -0
  172. package/dist/ui/checkbox.d.ts.map +1 -1
  173. package/dist/ui/checkbox.js +36 -27
  174. package/dist/ui/color-input.js +5 -5
  175. package/dist/ui/combobox.d.ts +6 -1
  176. package/dist/ui/combobox.d.ts.map +1 -1
  177. package/dist/ui/combobox.js +1 -1
  178. package/dist/ui/context-menu.js +1 -1
  179. package/dist/ui/data-table-body.d.ts +12 -0
  180. package/dist/ui/data-table-body.d.ts.map +1 -0
  181. package/dist/ui/data-table-body.js +219 -0
  182. package/dist/ui/data-table-bulk-actions.d.ts +19 -0
  183. package/dist/ui/data-table-bulk-actions.d.ts.map +1 -0
  184. package/dist/ui/data-table-bulk-actions.js +61 -0
  185. package/dist/ui/data-table-card.d.ts +9 -0
  186. package/dist/ui/data-table-card.d.ts.map +1 -0
  187. package/dist/ui/data-table-card.js +73 -0
  188. package/dist/ui/data-table-context.d.ts +62 -0
  189. package/dist/ui/data-table-context.d.ts.map +1 -0
  190. package/dist/ui/data-table-context.js +48 -0
  191. package/dist/ui/data-table-header.d.ts +10 -0
  192. package/dist/ui/data-table-header.d.ts.map +1 -0
  193. package/dist/ui/data-table-header.js +141 -0
  194. package/dist/ui/data-table-pagination.d.ts +13 -0
  195. package/dist/ui/data-table-pagination.d.ts.map +1 -0
  196. package/dist/ui/data-table-pagination.js +84 -0
  197. package/dist/ui/data-table.d.ts +11 -9
  198. package/dist/ui/data-table.d.ts.map +1 -1
  199. package/dist/ui/data-table.js +258 -573
  200. package/dist/ui/dialog.d.ts +6 -2
  201. package/dist/ui/dialog.d.ts.map +1 -1
  202. package/dist/ui/dialog.js +84 -82
  203. package/dist/ui/dropdown-menu.js +1 -1
  204. package/dist/ui/hover-card.d.ts +7 -0
  205. package/dist/ui/hover-card.d.ts.map +1 -1
  206. package/dist/ui/hover-card.js +3 -3
  207. package/dist/ui/icon-group.d.ts +2 -4
  208. package/dist/ui/icon-group.d.ts.map +1 -1
  209. package/dist/ui/icon-group.js +22 -23
  210. package/dist/ui/index.d.ts +2 -2
  211. package/dist/ui/index.d.ts.map +1 -1
  212. package/dist/ui/index.js +324 -327
  213. package/dist/ui/label.js +1 -1
  214. package/dist/ui/lib/bottom-sheet.d.ts +16 -0
  215. package/dist/ui/lib/bottom-sheet.d.ts.map +1 -0
  216. package/dist/ui/menubar.d.ts.map +1 -1
  217. package/dist/ui/menubar.js +64 -73
  218. package/dist/ui/navigation-menu.d.ts.map +1 -1
  219. package/dist/ui/navigation-menu.js +40 -44
  220. package/dist/ui/number-input.d.ts.map +1 -1
  221. package/dist/ui/number-input.js +19 -17
  222. package/dist/ui/popover.d.ts.map +1 -1
  223. package/dist/ui/popover.js +107 -32
  224. package/dist/ui/progress-ring.d.ts.map +1 -1
  225. package/dist/ui/progress-ring.js +80 -80
  226. package/dist/ui/progress.js +4 -4
  227. package/dist/ui/radio.d.ts +5 -2
  228. package/dist/ui/radio.d.ts.map +1 -1
  229. package/dist/ui/radio.js +29 -20
  230. package/dist/ui/search-input.d.ts.map +1 -1
  231. package/dist/ui/search-input.js +13 -12
  232. package/dist/ui/segmented-control.d.ts +6 -108
  233. package/dist/ui/segmented-control.d.ts.map +1 -1
  234. package/dist/ui/segmented-control.js +86 -272
  235. package/dist/ui/select.js +5 -5
  236. package/dist/ui/separator.js +5 -5
  237. package/dist/ui/sheet.d.ts +2 -0
  238. package/dist/ui/sheet.d.ts.map +1 -1
  239. package/dist/ui/sheet.js +102 -84
  240. package/dist/ui/sidebar.d.ts.map +1 -1
  241. package/dist/ui/sidebar.js +200 -175
  242. package/dist/ui/slider.js +14 -14
  243. package/dist/ui/split-button.d.ts +45 -0
  244. package/dist/ui/split-button.d.ts.map +1 -0
  245. package/dist/ui/split-button.js +282 -0
  246. package/dist/ui/status-dot.js +8 -8
  247. package/dist/ui/stepper.d.ts.map +1 -1
  248. package/dist/ui/stepper.js +33 -31
  249. package/dist/ui/switch.js +3 -3
  250. package/dist/ui/tabs.js +6 -6
  251. package/dist/ui/toast-types.d.ts +0 -1
  252. package/dist/ui/toast-types.d.ts.map +1 -1
  253. package/dist/ui/toast-types.js +0 -1
  254. package/dist/ui/toast.d.ts.map +1 -1
  255. package/dist/ui/toast.js +156 -150
  256. package/dist/ui/toggle-group.js +1 -1
  257. package/dist/ui/toggle.js +1 -1
  258. package/dist/ui/tooltip.js +3 -3
  259. package/docs/components/composed/emoji-picker.md +9 -0
  260. package/docs/components/composed/rich-chat-input.md +88 -0
  261. package/docs/components/composed/rich-text-editor.md +5 -0
  262. package/docs/components/ui/button-group.md +9 -0
  263. package/docs/components/ui/button.md +4 -0
  264. package/docs/components/ui/data-table-body.md +13 -0
  265. package/docs/components/ui/data-table-bulk-actions.md +13 -0
  266. package/docs/components/ui/data-table-card.md +13 -0
  267. package/docs/components/ui/data-table-context.md +13 -0
  268. package/docs/components/ui/data-table-header.md +13 -0
  269. package/docs/components/ui/data-table-pagination.md +13 -0
  270. package/docs/components/ui/split-button.md +41 -0
  271. package/llms-full.txt +235 -48
  272. package/llms.txt +54 -2
  273. package/package.json +30 -31
  274. package/dist/ui/chip.d.ts +0 -19
  275. package/dist/ui/chip.d.ts.map +0 -1
  276. package/dist/ui/chip.js +0 -14
  277. package/dist/ui/lib/use-ripple.d.ts +0 -14
  278. package/dist/ui/lib/use-ripple.d.ts.map +0 -1
@@ -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 ke, IconCode as xe, 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 x } 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: x(
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: x(
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,353 +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-pressed": r,
266
- className: x(
40
+ onClick: i,
41
+ disabled: f,
42
+ title: h,
43
+ "aria-label": h,
44
+ "aria-pressed": u,
45
+ className: L(
267
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",
268
47
  "hover:bg-surface-raised-hover",
269
48
  "disabled:pointer-events-none disabled:opacity-action-disabled",
270
- 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"
271
50
  ),
272
- children: i
51
+ children: g
273
52
  }
274
53
  );
275
54
  }
276
- function De({ editor: e }) {
277
- const [r, s] = c.useState(!1), [o, i] = c.useState(""), t = c.useRef(null), l = () => {
278
- if (e.isActive("link")) {
279
- e.chain().focus().unsetLink().run();
280
- return;
281
- }
282
- const h = e.getAttributes("link").href || "";
283
- i(h), s(!0), setTimeout(() => t.current?.focus(), 0);
284
- }, k = (h) => {
285
- h.preventDefault(), o.trim() && e.chain().focus().setLink({ href: o.trim() }).run(), s(!1), i("");
286
- }, g = (h) => {
287
- h.key === "Escape" && (s(!1), i(""), e.commands.focus());
288
- };
289
- return /* @__PURE__ */ p("div", { className: "relative", children: [
290
- /* @__PURE__ */ n(d, { onClick: l, isActive: e.isActive("link"), title: "Link", children: /* @__PURE__ */ n(u, { icon: Ee, size: "sm" }) }),
291
- 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(
292
70
  "form",
293
71
  {
294
- onSubmit: k,
72
+ onSubmit: (m) => {
73
+ m.preventDefault(), h.trim() && i.chain().focus().setLink({ href: h.trim() }).run(), f(!1), g("");
74
+ },
295
75
  "aria-label": "Edit link URL",
296
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",
297
77
  children: [
298
- /* @__PURE__ */ n(
78
+ /* @__PURE__ */ e(
299
79
  "input",
300
80
  {
301
- ref: t,
81
+ ref: n,
302
82
  type: "url",
303
- value: o,
304
- onChange: (h) => i(h.target.value),
305
- 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
+ },
306
88
  placeholder: "https://...",
307
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"
308
90
  }
309
91
  ),
310
- /* @__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" })
311
93
  ]
312
94
  }
313
95
  )
314
96
  ] });
315
97
  }
316
- function y() {
317
- 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" });
318
100
  }
319
- function Me({ editor: e, toolbar: r, onImageClick: s, onFileClick: o, onEmojiClick: i }) {
320
- const t = (C) => !r || r.includes(C), l = t("bold") || t("italic") || t("underline") || t("strike") || t("highlight"), k = 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");
321
- return /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-ds-01 border-b border-surface-border-strong px-ds-04 py-ds-02b", children: [
322
- 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" }) }),
323
- 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" }) }),
324
- 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" }) }),
325
- 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" }) }),
326
- 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" }) }),
327
- l && k && /* @__PURE__ */ n(y, {}),
328
- 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" }) }),
329
- 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" }) }),
330
- 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" }) }),
331
- k && g && /* @__PURE__ */ n(y, {}),
332
- 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" }) }),
333
- 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" }) }),
334
- t("taskList") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleTaskList().run(), isActive: e.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ n(u, { icon: ke, size: "sm", stroke: "bold" }) }),
335
- t("codeBlock") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().toggleCodeBlock().run(), isActive: e.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ n(u, { icon: xe, size: "sm", stroke: "bold" }) }),
336
- g && h && /* @__PURE__ */ n(y, {}),
337
- t("link") && /* @__PURE__ */ n(De, { editor: e }),
338
- s && t("image") && /* @__PURE__ */ n(d, { onClick: s, title: "Insert image", children: /* @__PURE__ */ n(u, { icon: ve, size: "sm" }) }),
339
- o && t("file") && /* @__PURE__ */ n(d, { onClick: o, title: "Attach file", children: /* @__PURE__ */ n(u, { icon: ye, size: "sm" }) }),
340
- t("hr") && /* @__PURE__ */ n(d, { onClick: () => e.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ n(u, { icon: we, size: "sm" }) }),
341
- h && v && /* @__PURE__ */ n(y, {}),
342
- 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" }) }),
343
- 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" }) }),
344
- 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" }) }),
345
- v && (L || I) && /* @__PURE__ */ n(y, {}),
346
- i && t("emoji") && /* @__PURE__ */ n(d, { onClick: i, title: "Emoji", children: /* @__PURE__ */ n(u, { icon: Ie, size: "sm" }) }),
347
- 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" }) }),
348
- 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" }) })
349
153
  ] });
350
154
  }
351
- const Pe = c.lazy(() => import("@emoji-mart/react"));
352
- function Ue({ onSelect: e }) {
353
- const [r, s] = c.useState(null), { colorMode: o } = ze();
354
- c.useEffect(() => {
355
- import("@emoji-mart/data").then((t) => s(t.default));
356
- }, []);
357
- 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..." }) });
358
- return r ? /* @__PURE__ */ n(c.Suspense, { fallback: i, children: /* @__PURE__ */ n(
359
- 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,
360
164
  {
361
- data: r,
362
- onEmojiSelect: (t) => e(t.native),
363
- 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",
364
169
  previewPosition: "none",
365
170
  skinTonePosition: "none"
366
171
  }
367
- ) }) : i;
172
+ ) }) : n;
368
173
  }
369
- const Ke = c.forwardRef(
174
+ const Ie = d.forwardRef(
370
175
  function({
371
- content: r = "",
372
- placeholder: s = "Start writing...",
373
- onChange: o,
374
- className: i,
375
- editable: t = !0,
376
- toolbar: l,
377
- onImageUpload: k,
378
- onFileUpload: g,
379
- mentions: h,
380
- onMentionSearch: v,
381
- onMentionSelect: L,
382
- ...I
383
- }, C) {
384
- 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) => {
385
- const f = R.current;
386
- if (f)
387
- if (k) {
388
- const m = await k(a);
389
- 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();
390
196
  } else {
391
- const m = new FileReader();
392
- m.onload = () => {
393
- f.chain().focus().setImage({ src: m.result }).run();
394
- }, m.readAsDataURL(a);
197
+ const a = new FileReader();
198
+ a.onload = () => {
199
+ r.chain().focus().setImage({ src: a.result }).run();
200
+ }, a.readAsDataURL(s);
395
201
  }
396
- }, S = async (a) => {
397
- const f = R.current;
398
- if (!f || !g) return;
399
- const m = await g(a);
400
- 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({
401
207
  type: "fileAttachment",
402
- attrs: { url: m.url, name: m.name, size: m.size }
208
+ attrs: { url: a.url, name: a.name, size: a.size }
403
209
  }).run();
404
- }, b = M({
210
+ }, b = j({
211
+ immediatelyRender: !1,
212
+ // SSR-safe — prevents hydration mismatch in Next.js
405
213
  extensions: [
406
- K.configure({
407
- 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
+ }
408
226
  }),
409
- ie.configure({
410
- placeholder: s,
227
+ Q.configure({
228
+ placeholder: f,
411
229
  emptyEditorClass: "before:content-[attr(data-placeholder)] before:text-surface-fg-subtle before:float-left before:h-0 before:pointer-events-none"
412
230
  }),
413
- P,
414
- $.configure({ multicolor: !1 }),
415
- U,
416
- q.configure({ nested: !0 }),
417
- O.configure({ types: ["heading", "paragraph"] }),
418
- V.configure({
419
- openOnClick: !1,
420
- protocols: ["http", "https", "mailto"],
421
- validate: (a) => /^(https?:\/\/|mailto:)/i.test(a),
422
- HTMLAttributes: {
423
- rel: "noopener noreferrer",
424
- target: "_blank"
425
- }
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 }
426
243
  }),
427
- F.configure({
244
+ M.configure({ types: ["heading", "paragraph"] }),
245
+ O.configure({
428
246
  allowBase64: !0,
429
247
  HTMLAttributes: {
430
248
  class: "max-w-full rounded-ds-md"
431
249
  }
432
250
  }),
433
- Q,
434
- ...h || v ? [
435
- W.configure({
251
+ W,
252
+ ...k || m ? [
253
+ K.configure({
436
254
  HTMLAttributes: { class: "mention" },
437
255
  suggestion: {
438
- items: async ({ query: a }) => v ? await v(a) : h ? h.filter((f) => f.label.toLowerCase().includes(a.toLowerCase())).slice(0, 8) : [],
439
- 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)
440
258
  }
441
259
  })
442
260
  ] : [],
443
- Be
261
+ X,
262
+ Z(v)
444
263
  ],
445
- content: r,
446
- editable: t,
264
+ content: u,
265
+ editable: n,
447
266
  editorProps: {
448
- handleDrop: (a, f, m, Y) => {
449
- if (Y || !f.dataTransfer?.files.length) return !1;
450
- const A = f.dataTransfer.files[0];
451
- 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;
452
271
  },
453
- handlePaste: (a, f) => {
454
- const m = f.clipboardData?.files[0];
455
- 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;
456
275
  },
457
276
  attributes: {
458
- class: x(
459
- ...X,
277
+ class: L(
278
+ ...J,
460
279
  "focus:outline-none",
461
280
  "min-h-[120px] px-ds-04 py-ds-04"
462
281
  )
463
282
  }
464
283
  },
465
- onUpdate: ({ editor: a }) => {
466
- E.current = !0, o?.(a.getHTML()), queueMicrotask(() => {
467
- E.current = !1;
284
+ onUpdate: ({ editor: s }) => {
285
+ T.current = !0, h?.(s.getHTML()), queueMicrotask(() => {
286
+ T.current = !1;
468
287
  });
469
288
  }
470
289
  });
471
- return c.useEffect(() => {
472
- R.current = b;
473
- }, [b]), c.useEffect(() => {
474
- if (!z) return;
475
- const a = (f) => {
476
- 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);
477
296
  };
478
- return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
479
- }, [z]), c.useEffect(() => {
480
- E.current || b && r !== b.getHTML() && b.commands.setContent(r, !1);
481
- }, [b, r]), b ? /* @__PURE__ */ p("div", { ref: C, ...I, className: x("relative", i), children: [
482
- 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(
483
302
  "div",
484
303
  {
485
- ref: N,
304
+ ref: B,
486
305
  className: "absolute bottom-full right-0 z-popover mb-ds-02",
487
- onKeyDown: (a) => {
488
- a.key === "Escape" && (a.stopPropagation(), w(!1));
306
+ onKeyDown: (s) => {
307
+ s.key === "Escape" && (s.stopPropagation(), w(!1));
489
308
  },
490
- children: /* @__PURE__ */ n(
491
- Ue,
309
+ children: /* @__PURE__ */ e(
310
+ we,
492
311
  {
493
- onSelect: (a) => {
494
- 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);
495
319
  }
496
320
  }
497
321
  )
498
322
  }
499
323
  ),
500
- /* @__PURE__ */ p(
324
+ /* @__PURE__ */ y(
501
325
  "div",
502
326
  {
503
- className: x(
327
+ className: L(
504
328
  "overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-raised",
505
329
  "transition-colors ease-productive-standard focus-within:border-surface-border-strong"
506
330
  ),
507
331
  children: [
508
- /* @__PURE__ */ n(
332
+ /* @__PURE__ */ e(
509
333
  "input",
510
334
  {
511
- ref: B,
335
+ ref: N,
512
336
  type: "file",
513
337
  accept: "image/*",
514
338
  "aria-label": "Upload image",
515
339
  className: "hidden",
516
- onChange: (a) => {
517
- const f = a.target.files?.[0];
518
- f && T(f), a.target.value = "";
340
+ onChange: (s) => {
341
+ const r = s.target.files?.[0];
342
+ r && H(r), s.target.value = "";
519
343
  }
520
344
  }
521
345
  ),
522
- g && /* @__PURE__ */ n(
346
+ p && /* @__PURE__ */ e(
523
347
  "input",
524
348
  {
525
- ref: D,
349
+ ref: P,
526
350
  type: "file",
527
351
  "aria-label": "Upload file",
528
352
  className: "hidden",
529
- onChange: (a) => {
530
- const f = a.target.files?.[0];
531
- f && S(f), a.target.value = "";
353
+ onChange: (s) => {
354
+ const r = s.target.files?.[0];
355
+ r && S(r), s.target.value = "";
532
356
  }
533
357
  }
534
358
  ),
535
- t && /* @__PURE__ */ n(
536
- Me,
359
+ n && /* @__PURE__ */ e(
360
+ ye,
537
361
  {
538
362
  editor: b,
539
- toolbar: l,
540
- onImageClick: () => B.current?.click(),
541
- onFileClick: g ? () => D.current?.click() : void 0,
542
- 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)
543
367
  }
544
368
  ),
545
- /* @__PURE__ */ n(G, { editor: b })
369
+ /* @__PURE__ */ e($, { editor: b })
546
370
  ]
547
371
  }
548
372
  )
549
373
  ] }) : null;
550
374
  }
551
375
  );
552
- Ke.displayName = "RichTextEditor";
553
- const $e = c.forwardRef(
554
- function({ content: r, className: s, ...o }, i) {
555
- 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
556
382
  extensions: [
557
- K.configure({
558
- heading: { levels: [2, 3] }
559
- }),
560
- P,
561
- $.configure({ multicolor: !1 }),
562
- U,
563
- q.configure({ nested: !0 }),
564
- O.configure({ types: ["heading", "paragraph"] }),
565
- V.configure({
566
- openOnClick: !0,
567
- protocols: ["http", "https", "mailto"],
568
- validate: (l) => /^(https?:\/\/|mailto:)/i.test(l),
569
- HTMLAttributes: {
570
- rel: "noopener noreferrer",
571
- 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
+ }
572
393
  }
573
394
  }),
574
- 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({
575
406
  allowBase64: !0,
576
407
  HTMLAttributes: {
577
408
  class: "max-w-full rounded-ds-md"
578
409
  }
579
410
  }),
580
- Q,
581
- W.configure({
411
+ W,
412
+ K.configure({
582
413
  HTMLAttributes: { class: "mention" }
583
414
  })
584
415
  ],
585
- content: r,
416
+ content: u,
586
417
  editable: !1,
587
418
  editorProps: {
588
419
  attributes: {
589
- class: x(...X)
420
+ class: L(...J)
590
421
  }
591
422
  }
592
423
  });
593
- 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;
594
425
  }
595
426
  );
596
- $e.displayName = "RichTextViewer";
427
+ Re.displayName = "RichTextViewer";
597
428
  export {
598
- Ke as RichTextEditor,
599
- $e as RichTextViewer
429
+ Ie as RichTextEditor,
430
+ Re as RichTextViewer
600
431
  };