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