@devalok/shilp-sutra 0.7.0 → 0.8.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 (46) hide show
  1. package/dist/composed/command-palette.d.ts.map +1 -1
  2. package/dist/composed/command-palette.js +84 -73
  3. package/dist/composed/extensions/emoji-suggestion.d.ts +2 -1
  4. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -1
  5. package/dist/composed/extensions/emoji-suggestion.js +1 -1
  6. package/dist/composed/extensions/file-attachment.d.ts +2 -1
  7. package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
  8. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  9. package/dist/composed/rich-text-editor.js +173 -161
  10. package/dist/composed/status-badge.d.ts +11 -1
  11. package/dist/composed/status-badge.d.ts.map +1 -1
  12. package/dist/composed/status-badge.js +48 -20
  13. package/dist/hooks/use-color-mode.d.ts.map +1 -1
  14. package/dist/hooks/use-color-mode.js +8 -4
  15. package/dist/hooks/use-mobile.d.ts +5 -0
  16. package/dist/hooks/use-mobile.d.ts.map +1 -1
  17. package/dist/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js +40141 -0
  18. package/dist/node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js +17 -0
  19. package/dist/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.js +2958 -0
  20. package/dist/tailwind/index.cjs +2 -0
  21. package/dist/tailwind/preset.d.ts.map +1 -1
  22. package/dist/tailwind/preset.js +2 -0
  23. package/dist/tokens/semantic.css +3 -1
  24. package/dist/ui/alert.js +1 -1
  25. package/dist/ui/badge.js +2 -1
  26. package/dist/ui/banner.js +12 -12
  27. package/dist/ui/chip.d.ts.map +1 -1
  28. package/dist/ui/chip.js +1 -1
  29. package/dist/ui/color-input.d.ts.map +1 -1
  30. package/dist/ui/color-input.js +17 -16
  31. package/dist/ui/combobox.d.ts +20 -11
  32. package/dist/ui/combobox.d.ts.map +1 -1
  33. package/dist/ui/dialog.js +9 -9
  34. package/dist/ui/form.js +14 -35
  35. package/dist/ui/input.d.ts.map +1 -1
  36. package/dist/ui/input.js +12 -11
  37. package/dist/ui/number-input.d.ts.map +1 -1
  38. package/dist/ui/number-input.js +39 -35
  39. package/dist/ui/sheet.js +21 -21
  40. package/dist/ui/textarea.d.ts.map +1 -1
  41. package/dist/ui/textarea.js +30 -24
  42. package/dist/ui/toast.js +18 -18
  43. package/llms-full.txt +6 -4
  44. package/package.json +597 -592
  45. package/dist/_virtual/shilp-sutra.js +0 -5
  46. package/dist/_virtual/shilp-sutra2.js +0 -5
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { jsxs as k, jsx as e } from "react/jsx-runtime";
2
+ import { jsxs as b, jsx as e } from "react/jsx-runtime";
3
3
  import * as c from "react";
4
- import { useEditor as E, EditorContent as H } from "@tiptap/react";
4
+ import { useEditor as S, EditorContent as H } from "@tiptap/react";
5
5
  import B from "@tiptap/starter-kit";
6
6
  import G from "@tiptap/extension-placeholder";
7
7
  import P from "@tiptap/extension-underline";
8
8
  import M from "@tiptap/extension-highlight";
9
9
  import j from "@tiptap/extension-task-list";
10
- import z from "@tiptap/extension-task-item";
11
- import D from "@tiptap/extension-text-align";
10
+ import D from "@tiptap/extension-task-item";
11
+ import z from "@tiptap/extension-text-align";
12
12
  import q from "@tiptap/extension-link";
13
13
  import U from "@tiptap/extension-image";
14
14
  import O from "@tiptap/extension-mention";
@@ -16,8 +16,8 @@ import { FileAttachment as K } from "./extensions/file-attachment.js";
16
16
  import { createSuggestionRenderer as J } from "./extensions/mention-suggestion.js";
17
17
  import { EmojiSuggestion as Q } from "./extensions/emoji-suggestion.js";
18
18
  import { useColorMode as X } from "../hooks/use-color-mode.js";
19
- import { cn as w } from "../ui/lib/utils.js";
20
- import { IconBold as Y, IconItalic as Z, IconUnderline as $, IconStrikethrough as F, IconHighlight as ee, IconH2 as te, IconH3 as ie, IconBlockquote as se, IconList as re, IconListNumbers as ne, IconListCheck as oe, IconCode as ce, IconPhoto as le, IconPaperclip as ae, IconLineDashed as ue, IconAlignLeft as de, IconAlignCenter as me, IconAlignRight as fe, IconMoodSmile as he, IconArrowBackUp as ge, IconArrowForwardUp as pe, IconLink as ke } from "@tabler/icons-react";
19
+ import { cn as k } from "../ui/lib/utils.js";
20
+ import { IconBold as Y, IconItalic as Z, IconUnderline as $, IconStrikethrough as F, IconHighlight as ee, IconH2 as te, IconH3 as ie, IconBlockquote as se, IconList as re, IconListNumbers as oe, IconListCheck as ne, IconCode as ce, IconPhoto as le, IconPaperclip as ae, IconLineDashed as de, IconAlignLeft as ue, IconAlignCenter as me, IconAlignRight as fe, IconMoodSmile as he, IconArrowBackUp as ge, IconArrowForwardUp as pe, IconLink as ke } from "@tabler/icons-react";
21
21
  const V = [
22
22
  "prose prose-sm max-w-none",
23
23
  "font-body text-ds-md leading-relaxed text-text-primary",
@@ -37,12 +37,12 @@ const V = [
37
37
  "[&_img]:max-w-full [&_img]:rounded-ds-md [&_img]:my-ds-03",
38
38
  "[&_.mention]:rounded-ds-sm [&_.mention]:bg-interactive/10 [&_.mention]:px-ds-02 [&_.mention]:py-[1px] [&_.mention]:font-medium [&_.mention]:text-interactive"
39
39
  ];
40
- function s({
40
+ function r({
41
41
  onClick: t,
42
- isActive: o = !1,
42
+ isActive: n = !1,
43
43
  disabled: a = !1,
44
44
  title: l,
45
- children: u
45
+ children: d
46
46
  }) {
47
47
  return /* @__PURE__ */ e(
48
48
  "button",
@@ -51,36 +51,36 @@ function s({
51
51
  onClick: t,
52
52
  disabled: a,
53
53
  title: l,
54
- "aria-pressed": o,
55
- className: w(
54
+ "aria-pressed": n,
55
+ className: k(
56
56
  "inline-flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md transition-colors",
57
57
  "hover:bg-field",
58
58
  "disabled:pointer-events-none disabled:opacity-[0.38]",
59
- o ? "bg-field text-interactive" : "text-text-placeholder"
59
+ n ? "bg-field text-interactive" : "text-text-placeholder"
60
60
  ),
61
- children: u
61
+ children: d
62
62
  }
63
63
  );
64
64
  }
65
65
  function be({ editor: t }) {
66
- const [o, a] = c.useState(!1), [l, u] = c.useState(""), f = c.useRef(null), b = () => {
66
+ const [n, a] = c.useState(!1), [l, d] = c.useState(""), u = c.useRef(null), x = () => {
67
67
  if (t.isActive("link")) {
68
68
  t.chain().focus().unsetLink().run();
69
69
  return;
70
70
  }
71
- const d = t.getAttributes("link").href || "";
72
- u(d), a(!0), setTimeout(() => {
73
- var _;
74
- return (_ = f.current) == null ? void 0 : _.focus();
71
+ const m = t.getAttributes("link").href || "";
72
+ d(m), a(!0), setTimeout(() => {
73
+ var A;
74
+ return (A = u.current) == null ? void 0 : A.focus();
75
75
  }, 0);
76
- }, h = (d) => {
77
- d.preventDefault(), l.trim() && t.chain().focus().setLink({ href: l.trim() }).run(), a(!1), u("");
78
- }, g = (d) => {
79
- d.key === "Escape" && (a(!1), u(""), t.commands.focus());
76
+ }, h = (m) => {
77
+ m.preventDefault(), l.trim() && t.chain().focus().setLink({ href: l.trim() }).run(), a(!1), d("");
78
+ }, g = (m) => {
79
+ m.key === "Escape" && (a(!1), d(""), t.commands.focus());
80
80
  };
81
- return /* @__PURE__ */ k("div", { className: "relative", children: [
82
- /* @__PURE__ */ e(s, { onClick: b, isActive: t.isActive("link"), title: "Link", children: /* @__PURE__ */ e(ke, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
83
- o && /* @__PURE__ */ k(
81
+ return /* @__PURE__ */ b("div", { className: "relative", children: [
82
+ /* @__PURE__ */ e(r, { onClick: x, isActive: t.isActive("link"), title: "Link", children: /* @__PURE__ */ e(ke, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
83
+ n && /* @__PURE__ */ b(
84
84
  "form",
85
85
  {
86
86
  onSubmit: h,
@@ -90,10 +90,10 @@ function be({ editor: t }) {
90
90
  /* @__PURE__ */ e(
91
91
  "input",
92
92
  {
93
- ref: f,
93
+ ref: u,
94
94
  type: "url",
95
95
  value: l,
96
- onChange: (d) => u(d.target.value),
96
+ onChange: (m) => d(m.target.value),
97
97
  onKeyDown: g,
98
98
  placeholder: "https://...",
99
99
  className: "h-ds-sm w-[240px] rounded-ds-sm border border-border bg-layer-01 px-ds-03 text-ds-sm text-text-primary focus:border-interactive focus:outline-none"
@@ -108,89 +108,89 @@ function be({ editor: t }) {
108
108
  function p() {
109
109
  return /* @__PURE__ */ e("div", { className: "mx-ds-02 h-[16px] w-px bg-border" });
110
110
  }
111
- function xe({ editor: t, onImageClick: o, onFileClick: a, onEmojiClick: l }) {
112
- return /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-ds-01 border-b border-border px-ds-04 py-ds-02b", children: [
113
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBold().run(), isActive: t.isActive("bold"), title: "Bold", children: /* @__PURE__ */ e(Y, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
114
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleItalic().run(), isActive: t.isActive("italic"), title: "Italic", children: /* @__PURE__ */ e(Z, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
115
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleUnderline().run(), isActive: t.isActive("underline"), title: "Underline", children: /* @__PURE__ */ e($, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
116
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleStrike().run(), isActive: t.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ e(F, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
117
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHighlight().run(), isActive: t.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ e(ee, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
111
+ function xe({ editor: t, onImageClick: n, onFileClick: a, onEmojiClick: l }) {
112
+ return /* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-ds-01 border-b border-border px-ds-04 py-ds-02b", children: [
113
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleBold().run(), isActive: t.isActive("bold"), title: "Bold", children: /* @__PURE__ */ e(Y, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
114
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleItalic().run(), isActive: t.isActive("italic"), title: "Italic", children: /* @__PURE__ */ e(Z, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
115
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleUnderline().run(), isActive: t.isActive("underline"), title: "Underline", children: /* @__PURE__ */ e($, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
116
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleStrike().run(), isActive: t.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ e(F, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
117
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleHighlight().run(), isActive: t.isActive("highlight"), title: "Highlight", children: /* @__PURE__ */ e(ee, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
118
118
  /* @__PURE__ */ e(p, {}),
119
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(), isActive: t.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ e(te, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
120
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(), isActive: t.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ e(ie, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
121
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBlockquote().run(), isActive: t.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ e(se, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
119
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(), isActive: t.isActive("heading", { level: 2 }), title: "Heading 2", children: /* @__PURE__ */ e(te, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
120
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(), isActive: t.isActive("heading", { level: 3 }), title: "Heading 3", children: /* @__PURE__ */ e(ie, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
121
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleBlockquote().run(), isActive: t.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ e(se, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
122
122
  /* @__PURE__ */ e(p, {}),
123
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleBulletList().run(), isActive: t.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ e(re, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
124
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleOrderedList().run(), isActive: t.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ e(ne, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
125
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleTaskList().run(), isActive: t.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ e(oe, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
126
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().toggleCodeBlock().run(), isActive: t.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ e(ce, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
123
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleBulletList().run(), isActive: t.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ e(re, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
124
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleOrderedList().run(), isActive: t.isActive("orderedList"), title: "Ordered list", children: /* @__PURE__ */ e(oe, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
125
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleTaskList().run(), isActive: t.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ e(ne, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
126
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().toggleCodeBlock().run(), isActive: t.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ e(ce, { className: "h-ico-sm w-ico-sm", stroke: 2.5 }) }),
127
127
  /* @__PURE__ */ e(p, {}),
128
128
  /* @__PURE__ */ e(be, { editor: t }),
129
- o && /* @__PURE__ */ e(s, { onClick: o, title: "Insert image", children: /* @__PURE__ */ e(le, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
130
- a && /* @__PURE__ */ e(s, { onClick: a, title: "Attach file", children: /* @__PURE__ */ e(ae, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
131
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ e(ue, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
129
+ n && /* @__PURE__ */ e(r, { onClick: n, title: "Insert image", children: /* @__PURE__ */ e(le, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
130
+ a && /* @__PURE__ */ e(r, { onClick: a, title: "Attach file", children: /* @__PURE__ */ e(ae, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
131
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ e(de, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
132
132
  /* @__PURE__ */ e(p, {}),
133
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("left").run(), isActive: t.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ e(de, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
134
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("center").run(), isActive: t.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ e(me, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
135
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().setTextAlign("right").run(), isActive: t.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ e(fe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
133
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().setTextAlign("left").run(), isActive: t.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ e(ue, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
134
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().setTextAlign("center").run(), isActive: t.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ e(me, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
135
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().setTextAlign("right").run(), isActive: t.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ e(fe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
136
136
  /* @__PURE__ */ e(p, {}),
137
- l && /* @__PURE__ */ e(s, { onClick: l, title: "Emoji", children: /* @__PURE__ */ e(he, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
138
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().undo().run(), disabled: !t.can().undo(), title: "Undo", children: /* @__PURE__ */ e(ge, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
139
- /* @__PURE__ */ e(s, { onClick: () => t.chain().focus().redo().run(), disabled: !t.can().redo(), title: "Redo", children: /* @__PURE__ */ e(pe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) })
137
+ l && /* @__PURE__ */ e(r, { onClick: l, title: "Emoji", children: /* @__PURE__ */ e(he, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
138
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().undo().run(), disabled: !t.can().undo(), title: "Undo", children: /* @__PURE__ */ e(ge, { className: "h-ico-sm w-ico-sm", stroke: 2 }) }),
139
+ /* @__PURE__ */ e(r, { onClick: () => t.chain().focus().redo().run(), disabled: !t.can().redo(), title: "Redo", children: /* @__PURE__ */ e(pe, { className: "h-ico-sm w-ico-sm", stroke: 2 }) })
140
140
  ] });
141
141
  }
142
- const ve = c.lazy(() => import("../_virtual/shilp-sutra.js"));
142
+ const ve = c.lazy(() => import("../node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js"));
143
143
  function we({ onSelect: t }) {
144
- const [o, a] = c.useState(null), { colorMode: l } = X();
144
+ const [n, a] = c.useState(null), { colorMode: l } = X();
145
145
  c.useEffect(() => {
146
- import("../_virtual/shilp-sutra2.js").then((f) => a(f.default));
146
+ import("../node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js").then((u) => a(u.default));
147
147
  }, []);
148
- const u = /* @__PURE__ */ e("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-border bg-layer-01 shadow-02", children: /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: "Loading..." }) });
149
- return o ? /* @__PURE__ */ e(c.Suspense, { fallback: u, children: /* @__PURE__ */ e(
148
+ const d = /* @__PURE__ */ e("div", { className: "flex h-[350px] w-[352px] items-center justify-center rounded-ds-lg border border-border bg-layer-01 shadow-02", children: /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: "Loading..." }) });
149
+ return n ? /* @__PURE__ */ e(c.Suspense, { fallback: d, children: /* @__PURE__ */ e(
150
150
  ve,
151
151
  {
152
- data: o,
153
- onEmojiSelect: (f) => t(f.native),
152
+ data: n,
153
+ onEmojiSelect: (u) => t(u.native),
154
154
  theme: l === "dark" ? "dark" : "light",
155
155
  previewPosition: "none",
156
156
  skinTonePosition: "none"
157
157
  }
158
- ) }) : u;
158
+ ) }) : d;
159
159
  }
160
160
  const _e = c.forwardRef(
161
161
  function({
162
- content: o = "",
162
+ content: n = "",
163
163
  placeholder: a = "Start writing...",
164
164
  onChange: l,
165
- className: u,
166
- editable: f = !0,
167
- onImageUpload: b,
165
+ className: d,
166
+ editable: u = !0,
167
+ onImageUpload: x,
168
168
  onFileUpload: h,
169
169
  mentions: g,
170
- onMentionSearch: d,
171
- onMentionSelect: _
170
+ onMentionSearch: m,
171
+ onMentionSelect: A
172
172
  }, W) {
173
- const A = c.useRef(null), [y, I] = c.useState(!1), N = c.useRef(null), T = c.useRef(null), R = c.useRef(null), C = async (i) => {
174
- const r = A.current;
175
- if (r)
176
- if (b) {
177
- const n = await b(i);
178
- r.chain().focus().setImage({ src: n }).run();
173
+ const y = c.useRef(null), [I, v] = c.useState(!1), N = c.useRef(null), T = c.useRef(null), R = c.useRef(null), C = async (i) => {
174
+ const o = y.current;
175
+ if (o)
176
+ if (x) {
177
+ const s = await x(i);
178
+ s && /^https?:\/\//i.test(s) && o.chain().focus().setImage({ src: s }).run();
179
179
  } else {
180
- const n = new FileReader();
181
- n.onload = () => {
182
- r.chain().focus().setImage({ src: n.result }).run();
183
- }, n.readAsDataURL(i);
180
+ const s = new FileReader();
181
+ s.onload = () => {
182
+ o.chain().focus().setImage({ src: s.result }).run();
183
+ }, s.readAsDataURL(i);
184
184
  }
185
185
  }, L = async (i) => {
186
- const r = A.current;
187
- if (!r || !h) return;
188
- const n = await h(i);
189
- r.chain().focus().insertContent({
186
+ const o = y.current;
187
+ if (!o || !h) return;
188
+ const s = await h(i);
189
+ o.chain().focus().insertContent({
190
190
  type: "fileAttachment",
191
- attrs: { url: n.url, name: n.name, size: n.size }
191
+ attrs: { url: s.url, name: s.name, size: s.size }
192
192
  }).run();
193
- }, m = E({
193
+ }, f = S({
194
194
  extensions: [
195
195
  B.configure({
196
196
  heading: { levels: [2, 3] }
@@ -202,10 +202,12 @@ const _e = c.forwardRef(
202
202
  P,
203
203
  M.configure({ multicolor: !1 }),
204
204
  j,
205
- z.configure({ nested: !0 }),
206
- D.configure({ types: ["heading", "paragraph"] }),
205
+ D.configure({ nested: !0 }),
206
+ z.configure({ types: ["heading", "paragraph"] }),
207
207
  q.configure({
208
208
  openOnClick: !1,
209
+ protocols: ["http", "https", "mailto"],
210
+ validate: (i) => /^(https?:\/\/|mailto:)/i.test(i),
209
211
  HTMLAttributes: {
210
212
  rel: "noopener noreferrer",
211
213
  target: "_blank"
@@ -218,33 +220,33 @@ const _e = c.forwardRef(
218
220
  }
219
221
  }),
220
222
  K,
221
- ...g || d ? [
223
+ ...g || m ? [
222
224
  O.configure({
223
225
  HTMLAttributes: { class: "mention" },
224
226
  suggestion: {
225
- items: async ({ query: i }) => d ? await d(i) : g ? g.filter((r) => r.label.toLowerCase().includes(i.toLowerCase())).slice(0, 8) : [],
227
+ items: async ({ query: i }) => m ? await m(i) : g ? g.filter((o) => o.label.toLowerCase().includes(i.toLowerCase())).slice(0, 8) : [],
226
228
  render: J()
227
229
  }
228
230
  })
229
231
  ] : [],
230
232
  Q
231
233
  ],
232
- content: o,
233
- editable: f,
234
+ content: n,
235
+ editable: u,
234
236
  editorProps: {
235
- handleDrop: (i, r, n, x) => {
236
- var S;
237
- if (x || !((S = r.dataTransfer) != null && S.files.length)) return !1;
238
- const v = r.dataTransfer.files[0];
239
- return v ? v.type.startsWith("image/") ? (C(v), !0) : h ? (L(v), !0) : !1 : !1;
237
+ handleDrop: (i, o, s, w) => {
238
+ var E;
239
+ if (w || !((E = o.dataTransfer) != null && E.files.length)) return !1;
240
+ const _ = o.dataTransfer.files[0];
241
+ return _ ? _.type.startsWith("image/") ? (C(_), !0) : h ? (L(_), !0) : !1 : !1;
240
242
  },
241
- handlePaste: (i, r) => {
242
- var x;
243
- const n = (x = r.clipboardData) == null ? void 0 : x.files[0];
244
- return n ? n.type.startsWith("image/") ? (C(n), !0) : h ? (L(n), !0) : !1 : !1;
243
+ handlePaste: (i, o) => {
244
+ var w;
245
+ const s = (w = o.clipboardData) == null ? void 0 : w.files[0];
246
+ return s ? s.type.startsWith("image/") ? (C(s), !0) : h ? (L(s), !0) : !1 : !1;
245
247
  },
246
248
  attributes: {
247
- class: w(
249
+ class: k(
248
250
  ...V,
249
251
  "focus:outline-none",
250
252
  "min-h-[120px] px-ds-04 py-ds-04"
@@ -256,59 +258,75 @@ const _e = c.forwardRef(
256
258
  }
257
259
  });
258
260
  return c.useEffect(() => {
259
- A.current = m;
260
- }, [m]), c.useEffect(() => {
261
- if (!y) return;
262
- const i = (r) => {
263
- N.current && !N.current.contains(r.target) && I(!1);
261
+ y.current = f;
262
+ }, [f]), c.useEffect(() => {
263
+ if (!I) return;
264
+ const i = (o) => {
265
+ N.current && !N.current.contains(o.target) && v(!1);
264
266
  };
265
267
  return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
266
- }, [y]), c.useEffect(() => {
267
- m && o !== m.getHTML() && m.commands.setContent(o, !1);
268
- }, [m, o]), m ? /* @__PURE__ */ k(
269
- "div",
270
- {
271
- ref: W,
272
- className: w(
273
- "overflow-hidden rounded-ds-lg border border-border bg-layer-01",
274
- "transition-colors focus-within:border-border-strong",
275
- u
276
- ),
277
- children: [
278
- /* @__PURE__ */ e(
279
- "input",
268
+ }, [I]), c.useEffect(() => {
269
+ f && n !== f.getHTML() && f.commands.setContent(n, !1);
270
+ }, [f, n]), f ? /* @__PURE__ */ b("div", { ref: W, className: k("relative", d), children: [
271
+ I && /* @__PURE__ */ e(
272
+ "div",
273
+ {
274
+ ref: N,
275
+ className: "absolute bottom-full right-0 z-popover mb-ds-02",
276
+ onKeyDown: (i) => {
277
+ i.key === "Escape" && (i.stopPropagation(), v(!1));
278
+ },
279
+ children: /* @__PURE__ */ e(
280
+ we,
280
281
  {
281
- ref: T,
282
- type: "file",
283
- accept: "image/*",
284
- "aria-label": "Upload image",
285
- className: "hidden",
286
- onChange: (i) => {
287
- var n;
288
- const r = (n = i.target.files) == null ? void 0 : n[0];
289
- r && C(r), i.target.value = "";
290
- }
291
- }
292
- ),
293
- h && /* @__PURE__ */ e(
294
- "input",
295
- {
296
- ref: R,
297
- type: "file",
298
- "aria-label": "Upload file",
299
- className: "hidden",
300
- onChange: (i) => {
301
- var n;
302
- const r = (n = i.target.files) == null ? void 0 : n[0];
303
- r && L(r), i.target.value = "";
282
+ onSelect: (i) => {
283
+ f.chain().focus().insertContent(i).run(), v(!1);
304
284
  }
305
285
  }
286
+ )
287
+ }
288
+ ),
289
+ /* @__PURE__ */ b(
290
+ "div",
291
+ {
292
+ className: k(
293
+ "overflow-hidden rounded-ds-lg border border-border bg-layer-01",
294
+ "transition-colors focus-within:border-border-strong"
306
295
  ),
307
- f && /* @__PURE__ */ k("div", { className: "relative", children: [
296
+ children: [
308
297
  /* @__PURE__ */ e(
298
+ "input",
299
+ {
300
+ ref: T,
301
+ type: "file",
302
+ accept: "image/*",
303
+ "aria-label": "Upload image",
304
+ className: "hidden",
305
+ onChange: (i) => {
306
+ var s;
307
+ const o = (s = i.target.files) == null ? void 0 : s[0];
308
+ o && C(o), i.target.value = "";
309
+ }
310
+ }
311
+ ),
312
+ h && /* @__PURE__ */ e(
313
+ "input",
314
+ {
315
+ ref: R,
316
+ type: "file",
317
+ "aria-label": "Upload file",
318
+ className: "hidden",
319
+ onChange: (i) => {
320
+ var s;
321
+ const o = (s = i.target.files) == null ? void 0 : s[0];
322
+ o && L(o), i.target.value = "";
323
+ }
324
+ }
325
+ ),
326
+ u && /* @__PURE__ */ e(
309
327
  xe,
310
328
  {
311
- editor: m,
329
+ editor: f,
312
330
  onImageClick: () => {
313
331
  var i;
314
332
  return (i = T.current) == null ? void 0 : i.click();
@@ -317,28 +335,20 @@ const _e = c.forwardRef(
317
335
  var i;
318
336
  return (i = R.current) == null ? void 0 : i.click();
319
337
  } : void 0,
320
- onEmojiClick: () => I((i) => !i)
338
+ onEmojiClick: () => v((i) => !i)
321
339
  }
322
340
  ),
323
- y && /* @__PURE__ */ e("div", { ref: N, className: "absolute right-0 top-full z-popover", children: /* @__PURE__ */ e(
324
- we,
325
- {
326
- onSelect: (i) => {
327
- m.chain().focus().insertContent(i).run(), I(!1);
328
- }
329
- }
330
- ) })
331
- ] }),
332
- /* @__PURE__ */ e(H, { editor: m })
333
- ]
334
- }
335
- ) : null;
341
+ /* @__PURE__ */ e(H, { editor: f })
342
+ ]
343
+ }
344
+ )
345
+ ] }) : null;
336
346
  }
337
347
  );
338
348
  _e.displayName = "RichTextEditor";
339
349
  const Ae = c.forwardRef(
340
- function({ content: o, className: a }, l) {
341
- const u = E({
350
+ function({ content: n, className: a }, l) {
351
+ const d = S({
342
352
  extensions: [
343
353
  B.configure({
344
354
  heading: { levels: [2, 3] }
@@ -346,10 +356,12 @@ const Ae = c.forwardRef(
346
356
  P,
347
357
  M.configure({ multicolor: !1 }),
348
358
  j,
349
- z.configure({ nested: !0 }),
350
- D.configure({ types: ["heading", "paragraph"] }),
359
+ D.configure({ nested: !0 }),
360
+ z.configure({ types: ["heading", "paragraph"] }),
351
361
  q.configure({
352
362
  openOnClick: !0,
363
+ protocols: ["http", "https", "mailto"],
364
+ validate: (u) => /^(https?:\/\/|mailto:)/i.test(u),
353
365
  HTMLAttributes: {
354
366
  rel: "noopener noreferrer",
355
367
  target: "_blank"
@@ -366,15 +378,15 @@ const Ae = c.forwardRef(
366
378
  HTMLAttributes: { class: "mention" }
367
379
  })
368
380
  ],
369
- content: o,
381
+ content: n,
370
382
  editable: !1,
371
383
  editorProps: {
372
384
  attributes: {
373
- class: w(...V)
385
+ class: k(...V)
374
386
  }
375
387
  }
376
388
  });
377
- return u ? /* @__PURE__ */ e("div", { ref: l, className: a, children: /* @__PURE__ */ e(H, { editor: u }) }) : null;
389
+ return d ? /* @__PURE__ */ e("div", { ref: l, className: a, children: /* @__PURE__ */ e(H, { editor: d }) }) : null;
378
390
  }
379
391
  );
380
392
  Ae.displayName = "RichTextViewer";
@@ -5,10 +5,20 @@ declare const statusBadgeVariants: (props?: ({
5
5
  color?: "error" | "warning" | "success" | "neutral" | "info" | null | undefined;
6
6
  size?: "sm" | "md" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
- export interface StatusBadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'color'>, VariantProps<typeof statusBadgeVariants> {
8
+ interface StatusBadgeBaseProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'color'> {
9
9
  label?: string;
10
10
  hideDot?: boolean;
11
+ size?: VariantProps<typeof statusBadgeVariants>['size'];
11
12
  }
13
+ interface StatusBadgeWithStatus extends StatusBadgeBaseProps {
14
+ status?: VariantProps<typeof statusBadgeVariants>['status'];
15
+ color?: never;
16
+ }
17
+ interface StatusBadgeWithColor extends StatusBadgeBaseProps {
18
+ status?: never;
19
+ color: 'success' | 'warning' | 'error' | 'info' | 'neutral';
20
+ }
21
+ export type StatusBadgeProps = StatusBadgeWithStatus | StatusBadgeWithColor;
12
22
  declare const StatusBadge: React.ForwardRefExoticComponent<StatusBadgeProps & React.RefAttributes<HTMLSpanElement>>;
13
23
  export { StatusBadge, statusBadgeVariants };
14
24
  //# sourceMappingURL=status-badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/composed/status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,mBAAmB;;;;8EA8BxB,CAAA;AAqBD,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EACvE,YAAY,CAAC,OAAO,mBAAmB,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,QAAA,MAAM,WAAW,0FAwChB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/composed/status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,mBAAmB;;;;8EA8BxB,CAAA;AAqBD,UAAU,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IACtG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;CACxD;AAED,UAAU,qBAAsB,SAAQ,oBAAoB;IAC1D,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3D,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,UAAU,oBAAqB,SAAQ,oBAAoB;IACzD,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;CAC5D;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,oBAAoB,CAAA;AAE3E,QAAA,MAAM,WAAW,0FA2DhB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,8 +1,8 @@
1
- import { jsxs as b, jsx as p } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import { cva as m } from "class-variance-authority";
4
- import { cn as a } from "../ui/lib/utils.js";
5
- const y = m(
1
+ import { jsxs as i, jsx as u } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cva as y } from "class-variance-authority";
4
+ import { cn as r } from "../ui/lib/utils.js";
5
+ const g = y(
6
6
  "inline-flex items-center gap-ds-02b rounded-ds-full font-body",
7
7
  {
8
8
  variants: {
@@ -47,31 +47,59 @@ const y = m(
47
47
  error: "bg-error",
48
48
  info: "bg-info",
49
49
  neutral: "bg-icon-secondary"
50
- }, v = f.forwardRef(
51
- ({ status: c, color: e, size: r, label: o, hideDot: n = !1, className: d, ...i }, u) => {
52
- const t = e != null, s = t ? void 0 : c ?? "pending", g = t ? e : void 0, l = o ?? (t ? e.charAt(0).toUpperCase() + e.slice(1) : s.charAt(0).toUpperCase() + s.slice(1)), x = t ? h[e] : w[s];
53
- return /* @__PURE__ */ b(
50
+ }, v = m.forwardRef(
51
+ ({ status: l, color: e, size: s, label: a, hideDot: c = !1, className: n, ...d }, o) => {
52
+ if (e != null) {
53
+ const p = a ?? e.charAt(0).toUpperCase() + e.slice(1), f = h[e];
54
+ return /* @__PURE__ */ i(
55
+ "span",
56
+ {
57
+ ref: o,
58
+ className: r(
59
+ g({ color: e, size: s }),
60
+ n
61
+ ),
62
+ ...d,
63
+ children: [
64
+ !c && /* @__PURE__ */ u(
65
+ "span",
66
+ {
67
+ className: r(
68
+ "shrink-0 rounded-ds-full",
69
+ s === "sm" ? "h-ds-02b w-ds-02b" : "h-[8px] w-[8px]",
70
+ f
71
+ ),
72
+ "aria-hidden": "true"
73
+ }
74
+ ),
75
+ p
76
+ ]
77
+ }
78
+ );
79
+ }
80
+ const t = l ?? "pending", x = a ?? t.charAt(0).toUpperCase() + t.slice(1), b = w[t];
81
+ return /* @__PURE__ */ i(
54
82
  "span",
55
83
  {
56
- ref: u,
57
- className: a(
58
- y({ status: s, color: g, size: r }),
59
- d
84
+ ref: o,
85
+ className: r(
86
+ g({ status: t, size: s }),
87
+ n
60
88
  ),
61
- ...i,
89
+ ...d,
62
90
  children: [
63
- !n && /* @__PURE__ */ p(
91
+ !c && /* @__PURE__ */ u(
64
92
  "span",
65
93
  {
66
- className: a(
94
+ className: r(
67
95
  "shrink-0 rounded-ds-full",
68
- r === "sm" ? "h-ds-02b w-ds-02b" : "h-[8px] w-[8px]",
69
- x
96
+ s === "sm" ? "h-ds-02b w-ds-02b" : "h-[8px] w-[8px]",
97
+ b
70
98
  ),
71
99
  "aria-hidden": "true"
72
100
  }
73
101
  ),
74
- l
102
+ x
75
103
  ]
76
104
  }
77
105
  );
@@ -80,5 +108,5 @@ const y = m(
80
108
  v.displayName = "StatusBadge";
81
109
  export {
82
110
  v as StatusBadge,
83
- y as statusBadgeVariants
111
+ g as statusBadgeVariants
84
112
  };