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