@d4gger/design-system 4.2.2 → 4.2.4

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 (145) hide show
  1. package/README.md +22 -2
  2. package/dist/blocks/kits/runsPage/RunsPage.cjs +4 -2
  3. package/dist/blocks/kits/runsPage/RunsPage.cjs.map +2 -2
  4. package/dist/blocks/kits/runsPage/RunsPage.d.cts.map +1 -1
  5. package/dist/blocks/kits/runsPage/RunsPage.d.mts.map +1 -1
  6. package/dist/blocks/kits/runsPage/RunsPage.d.ts.map +1 -1
  7. package/dist/blocks/kits/runsPage/RunsPage.js +4 -2
  8. package/dist/blocks/kits/runsPage/RunsPage.js.map +2 -2
  9. package/dist/components/articleNodes/articleExtensions.cjs +7 -1
  10. package/dist/components/articleNodes/articleExtensions.cjs.map +3 -3
  11. package/dist/components/articleNodes/articleExtensions.d.cts.map +1 -1
  12. package/dist/components/articleNodes/articleExtensions.d.mts.map +1 -1
  13. package/dist/components/articleNodes/articleExtensions.d.ts.map +1 -1
  14. package/dist/components/articleNodes/articleExtensions.js +7 -1
  15. package/dist/components/articleNodes/articleExtensions.js.map +2 -2
  16. package/dist/components/carousel/Carousel.cjs +15 -0
  17. package/dist/components/carousel/Carousel.cjs.map +2 -2
  18. package/dist/components/carousel/Carousel.d.cts.map +1 -1
  19. package/dist/components/carousel/Carousel.d.mts.map +1 -1
  20. package/dist/components/carousel/Carousel.d.ts.map +1 -1
  21. package/dist/components/carousel/Carousel.js +15 -0
  22. package/dist/components/carousel/Carousel.js.map +2 -2
  23. package/dist/components/data-table.css +3 -1
  24. package/dist/components/dataTable/DataTable.cjs +4 -1
  25. package/dist/components/dataTable/DataTable.cjs.map +2 -2
  26. package/dist/components/dataTable/DataTable.d.cts.map +1 -1
  27. package/dist/components/dataTable/DataTable.d.mts.map +1 -1
  28. package/dist/components/dataTable/DataTable.d.ts.map +1 -1
  29. package/dist/components/dataTable/DataTable.js +4 -1
  30. package/dist/components/dataTable/DataTable.js.map +2 -2
  31. package/dist/components/icon/Icon.cjs +24 -0
  32. package/dist/components/icon/Icon.cjs.map +2 -2
  33. package/dist/components/icon/Icon.d.cts +33 -1
  34. package/dist/components/icon/Icon.d.cts.map +1 -1
  35. package/dist/components/icon/Icon.d.mts +33 -1
  36. package/dist/components/icon/Icon.d.mts.map +1 -1
  37. package/dist/components/icon/Icon.d.ts +33 -1
  38. package/dist/components/icon/Icon.d.ts.map +1 -1
  39. package/dist/components/icon/Icon.js +32 -0
  40. package/dist/components/icon/Icon.js.map +2 -2
  41. package/dist/components/icon/icons.cjs +16 -0
  42. package/dist/components/icon/icons.cjs.map +2 -2
  43. package/dist/components/icon/icons.d.cts +40 -0
  44. package/dist/components/icon/icons.d.cts.map +1 -1
  45. package/dist/components/icon/icons.d.mts +40 -0
  46. package/dist/components/icon/icons.d.mts.map +1 -1
  47. package/dist/components/icon/icons.d.ts +40 -0
  48. package/dist/components/icon/icons.d.ts.map +1 -1
  49. package/dist/components/icon/icons.js +16 -0
  50. package/dist/components/icon/icons.js.map +2 -2
  51. package/dist/components/index.cjs +2 -0
  52. package/dist/components/index.cjs.map +2 -2
  53. package/dist/components/index.d.cts +2 -0
  54. package/dist/components/index.d.cts.map +1 -1
  55. package/dist/components/index.d.mts +2 -0
  56. package/dist/components/index.d.mts.map +1 -1
  57. package/dist/components/index.d.ts +2 -0
  58. package/dist/components/index.d.ts.map +1 -1
  59. package/dist/components/index.js +2 -0
  60. package/dist/components/index.js.map +2 -2
  61. package/dist/components/reactions/Reactions.cjs +176 -0
  62. package/dist/components/reactions/Reactions.cjs.map +7 -0
  63. package/dist/components/reactions/Reactions.d.cts +55 -0
  64. package/dist/components/reactions/Reactions.d.cts.map +1 -0
  65. package/dist/components/reactions/Reactions.d.mts +55 -0
  66. package/dist/components/reactions/Reactions.d.mts.map +1 -0
  67. package/dist/components/reactions/Reactions.d.ts +55 -0
  68. package/dist/components/reactions/Reactions.d.ts.map +1 -0
  69. package/dist/components/reactions/Reactions.js +146 -0
  70. package/dist/components/reactions/Reactions.js.map +7 -0
  71. package/dist/components/reactions/reactions.props.cjs +38 -0
  72. package/dist/components/reactions/reactions.props.cjs.map +7 -0
  73. package/dist/components/reactions/reactions.props.d.cts +17 -0
  74. package/dist/components/reactions/reactions.props.d.cts.map +1 -0
  75. package/dist/components/reactions/reactions.props.d.mts +17 -0
  76. package/dist/components/reactions/reactions.props.d.mts.map +1 -0
  77. package/dist/components/reactions/reactions.props.d.ts +17 -0
  78. package/dist/components/reactions/reactions.props.d.ts.map +1 -0
  79. package/dist/components/reactions/reactions.props.js +18 -0
  80. package/dist/components/reactions/reactions.props.js.map +7 -0
  81. package/dist/components/reactions.css +106 -0
  82. package/dist/components/rich-text-editor.css +15 -0
  83. package/dist/components/richTextEditor/EditorTools.cjs +278 -21
  84. package/dist/components/richTextEditor/EditorTools.cjs.map +2 -2
  85. package/dist/components/richTextEditor/EditorTools.d.cts +29 -2
  86. package/dist/components/richTextEditor/EditorTools.d.cts.map +1 -1
  87. package/dist/components/richTextEditor/EditorTools.d.mts +29 -2
  88. package/dist/components/richTextEditor/EditorTools.d.mts.map +1 -1
  89. package/dist/components/richTextEditor/EditorTools.d.ts +29 -2
  90. package/dist/components/richTextEditor/EditorTools.d.ts.map +1 -1
  91. package/dist/components/richTextEditor/EditorTools.js +278 -21
  92. package/dist/components/richTextEditor/EditorTools.js.map +2 -2
  93. package/dist/components/richTextEditor/RichTextEditor.cjs +3 -1
  94. package/dist/components/richTextEditor/RichTextEditor.cjs.map +2 -2
  95. package/dist/components/richTextEditor/RichTextEditor.d.cts.map +1 -1
  96. package/dist/components/richTextEditor/RichTextEditor.d.mts.map +1 -1
  97. package/dist/components/richTextEditor/RichTextEditor.d.ts.map +1 -1
  98. package/dist/components/richTextEditor/RichTextEditor.js +4 -2
  99. package/dist/components/richTextEditor/RichTextEditor.js.map +2 -2
  100. package/dist/components/share/Share.cjs +108 -0
  101. package/dist/components/share/Share.cjs.map +7 -0
  102. package/dist/components/share/Share.d.cts +28 -0
  103. package/dist/components/share/Share.d.cts.map +1 -0
  104. package/dist/components/share/Share.d.mts +28 -0
  105. package/dist/components/share/Share.d.mts.map +1 -0
  106. package/dist/components/share/Share.d.ts +28 -0
  107. package/dist/components/share/Share.d.ts.map +1 -0
  108. package/dist/components/share/Share.js +78 -0
  109. package/dist/components/share/Share.js.map +7 -0
  110. package/dist/components/share/share.props.cjs +34 -0
  111. package/dist/components/share/share.props.cjs.map +7 -0
  112. package/dist/components/share/share.props.d.cts +12 -0
  113. package/dist/components/share/share.props.d.cts.map +1 -0
  114. package/dist/components/share/share.props.d.mts +12 -0
  115. package/dist/components/share/share.props.d.mts.map +1 -0
  116. package/dist/components/share/share.props.d.ts +12 -0
  117. package/dist/components/share/share.props.d.ts.map +1 -0
  118. package/dist/components/share/share.props.js +14 -0
  119. package/dist/components/share/share.props.js.map +7 -0
  120. package/dist/components/share.css +25 -0
  121. package/dist/components/sortable-list.css +1 -0
  122. package/dist/components/sortableList/SortableList.cjs +2 -2
  123. package/dist/components/sortableList/SortableList.cjs.map +2 -2
  124. package/dist/components/sortableList/SortableList.js +3 -3
  125. package/dist/components/sortableList/SortableList.js.map +2 -2
  126. package/dist/components/sortableList/sortableList.props.cjs.map +1 -1
  127. package/dist/components/sortableList/sortableList.props.d.cts +2 -0
  128. package/dist/components/sortableList/sortableList.props.d.cts.map +1 -1
  129. package/dist/components/sortableList/sortableList.props.d.mts +2 -0
  130. package/dist/components/sortableList/sortableList.props.d.mts.map +1 -1
  131. package/dist/components/sortableList/sortableList.props.d.ts +2 -0
  132. package/dist/components/sortableList/sortableList.props.d.ts.map +1 -1
  133. package/dist/components.css +2 -0
  134. package/dist/docs/README.md +2 -0
  135. package/dist/docs/component-contract.md +5 -3
  136. package/dist/docs/component-index.json +17 -1
  137. package/dist/docs/components/carousel.md +3 -2
  138. package/dist/docs/components/data-table.md +3 -1
  139. package/dist/docs/components/reactions.md +106 -0
  140. package/dist/docs/components/rich-text-editor.md +13 -7
  141. package/dist/docs/components/share.md +103 -0
  142. package/dist/docs/components/sortable-list.md +2 -2
  143. package/dist/styles.css +156 -1
  144. package/dist/tokens.dtcg.json +1 -1
  145. package/package.json +80 -11
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var EditorTools_exports = {};
30
30
  __export(EditorTools_exports, {
31
31
  EditorTools: () => EditorTools,
32
+ defaultArticleInsertItems: () => defaultArticleInsertItems,
32
33
  defaultRichTextEditorLocaleText: () => defaultRichTextEditorLocaleText,
33
34
  resolveRichTextEditorLocaleText: () => resolveRichTextEditorLocaleText
34
35
  });
@@ -44,6 +45,22 @@ var import_TextField = require("../textField/TextField");
44
45
  var import_VisuallyHidden = require("../visuallyHidden/VisuallyHidden");
45
46
  var import_MentionSuggestions = require("./MentionSuggestions");
46
47
  var import_jsx_runtime = require("react/jsx-runtime");
48
+ function defaultArticleInsertItems(locale) {
49
+ return [
50
+ { id: "quote", label: locale.quoteBlock, insert: (editor) => {
51
+ editor.chain().focus().toggleBlockquote().run();
52
+ }, node: "blockquote" },
53
+ { id: "code-block", label: locale.codeBlock, insert: (editor) => {
54
+ editor.chain().focus().toggleCodeBlock().run();
55
+ }, node: "codeBlock" },
56
+ { id: "table", label: locale.insertTable, insert: (editor) => {
57
+ editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run();
58
+ }, node: "table" },
59
+ { id: "divider", label: locale.insertDivider, insert: (editor) => {
60
+ editor.chain().focus().setHorizontalRule().run();
61
+ }, node: "horizontalRule" }
62
+ ];
63
+ }
47
64
  const defaultRichTextEditorLocaleText = {
48
65
  loading: "Editor loading",
49
66
  empty: "Ready to write",
@@ -65,6 +82,7 @@ const defaultRichTextEditorLocaleText = {
65
82
  inlineCode: "Inline code",
66
83
  bulletList: "Bulleted list",
67
84
  orderedList: "Numbered list",
85
+ taskList: "Task list",
68
86
  link: "Link",
69
87
  clearFormatting: "Clear formatting",
70
88
  undo: "Undo",
@@ -89,12 +107,36 @@ const defaultRichTextEditorLocaleText = {
89
107
  removeLink: "Remove link",
90
108
  mentionSuggestions: "Mention suggestions",
91
109
  peopleMatching: (query) => `People matching @${query}`,
92
- noMatchingPeople: "No matching people"
110
+ noMatchingPeople: "No matching people",
111
+ underline: "Underline",
112
+ highlight: "Highlight",
113
+ textColor: "Text color",
114
+ highlightColor: "Highlight color",
115
+ colorDialogTitle: "Text and highlight color",
116
+ colorDialogDescription: "Apply a hex color to selected text, or clear it.",
117
+ applyTextColor: "Apply text color",
118
+ applyHighlightColor: "Apply highlight color",
119
+ clearTextColor: "Clear text color",
120
+ clearHighlightColor: "Clear highlight color",
121
+ textAlign: "Text alignment",
122
+ alignLeft: "Align left",
123
+ alignCenter: "Align center",
124
+ alignRight: "Align right",
125
+ alignJustify: "Justify",
126
+ insertTable: "Table",
127
+ insertDivider: "Divider",
128
+ insertImage: "Image",
129
+ imageDialogTitle: "Insert image",
130
+ imageDialogDescription: "Add an image by URL.",
131
+ insertImageAction: "Insert image",
132
+ selectionBar: "Selection formatting",
133
+ slashMenu: "Insert block",
134
+ noMatchingBlocks: "No matching blocks"
93
135
  };
94
136
  function resolveRichTextEditorLocaleText(localeText) {
95
137
  return { ...defaultRichTextEditorLocaleText, ...localeText };
96
138
  }
97
- const defaults = ["style", "bold", "italic", "strike", "code", "bulletList", "orderedList", "blockquote", "codeBlock", "link", "clear", "history"];
139
+ const defaults = ["style", "bold", "italic", "strike", "code", "underline", "highlight", "textColor", "align", "bulletList", "orderedList", "taskList", "blockquote", "codeBlock", "link", "clear", "history"];
98
140
  const Control = React.forwardRef(
99
141
  function Control2({ children, ...props }, forwardedRef) {
100
142
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Toolbar.Toolbar.Button, { asChild: true, disabled: props.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "sm", variant: "ghost", className: "dsx-rich-text-editor__toolbar-button", ...props, ref: forwardedRef, children }) });
@@ -207,6 +249,209 @@ function LinkControl({ editor, disabled, localeText }) {
207
249
  ] })
208
250
  ] });
209
251
  }
252
+ function ImageControl({ editor, disabled, localeText }) {
253
+ const locale = resolveRichTextEditorLocaleText(localeText);
254
+ const [open, setOpen] = React.useState(false);
255
+ const [url, setUrl] = React.useState("");
256
+ const [error, setError] = React.useState("");
257
+ const urlId = React.useId();
258
+ const insert = () => {
259
+ let href;
260
+ try {
261
+ const parsed = new URL(url);
262
+ if (!["https:", "http:"].includes(parsed.protocol)) throw new Error();
263
+ href = parsed.href;
264
+ } catch {
265
+ setError(locale.urlInvalid);
266
+ return;
267
+ }
268
+ editor.chain().focus().setImage({ src: href }).run();
269
+ setOpen(false);
270
+ };
271
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Popover.Popover, { open, onOpenChange: (next) => {
272
+ if (next) {
273
+ setUrl("");
274
+ setError("");
275
+ }
276
+ ;
277
+ setOpen(next);
278
+ }, children: [
279
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled, "aria-label": locale.insertImage, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "image", size: "sm" }) }) }),
280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Popover.Popover.Content, { className: "dsx-editor-tools__popover dsx-editor-tools__link", align: "start", onCloseAutoFocus: (event) => {
281
+ event.preventDefault();
282
+ if (!editor.isDestroyed) editor.commands.focus();
283
+ }, children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Title, { children: locale.imageDialogTitle }),
285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VisuallyHidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Description, { children: locale.imageDialogDescription }) }),
286
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField, { id: urlId, label: locale.urlLabel, errorText: error || void 0, invalid: Boolean(error), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField.Input, { value: url, onChange: (event) => {
287
+ setUrl(event.target.value);
288
+ setError("");
289
+ }, onKeyDown: (event) => {
290
+ if (event.key === "Enter") {
291
+ event.preventDefault();
292
+ insert();
293
+ }
294
+ } }) }),
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsx-editor-tools__actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "md", onClick: insert, children: locale.insertImageAction }) })
296
+ ] })
297
+ ] });
298
+ }
299
+ const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;
300
+ function normalizeHexInput(value) {
301
+ const withHash = value.startsWith("#") ? value : `#${value}`;
302
+ return HEX_COLOR_PATTERN.test(withHash) ? withHash.toUpperCase() : null;
303
+ }
304
+ function ColorControl({ editor, disabled, localeText }) {
305
+ const locale = resolveRichTextEditorLocaleText(localeText);
306
+ const [open, setOpen] = React.useState(false);
307
+ const [text, setText] = React.useState("");
308
+ const [highlight, setHighlight] = React.useState("");
309
+ const textId = React.useId();
310
+ const highlightId = React.useId();
311
+ const selection = React.useRef({ from: 0, to: 0 });
312
+ const openWithCurrent = () => {
313
+ selection.current = { from: editor.state.selection.from, to: editor.state.selection.to };
314
+ setText(editor.getAttributes("textStyle").color ?? "");
315
+ setHighlight(editor.getAttributes("highlight").color ?? "");
316
+ setOpen(true);
317
+ };
318
+ const applyText = () => {
319
+ const color = normalizeHexInput(text);
320
+ if (color) editor.chain().setTextSelection(selection.current).setColor(color).run();
321
+ };
322
+ const applyHighlight = () => {
323
+ const color = normalizeHexInput(highlight);
324
+ if (!color) return;
325
+ editor.chain().setTextSelection(selection.current).unsetHighlight().toggleHighlight({ color }).run();
326
+ };
327
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Popover.Popover, { open, onOpenChange: (next) => {
328
+ if (next) openWithCurrent();
329
+ else setOpen(false);
330
+ }, children: [
331
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled, "aria-label": locale.textColor, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "baseline", size: "sm" }) }) }),
332
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Popover.Popover.Content, { className: "dsx-editor-tools__popover dsx-editor-tools__link", align: "start", onCloseAutoFocus: (event) => {
333
+ event.preventDefault();
334
+ if (!editor.isDestroyed) editor.commands.focus();
335
+ }, children: [
336
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Title, { children: locale.colorDialogTitle }),
337
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VisuallyHidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Popover.Popover.Description, { children: locale.colorDialogDescription }) }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField, { id: textId, label: locale.textColor, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField.Input, { value: text, placeholder: "#RRGGBB", "aria-label": locale.textColor, onChange: (event) => setText(event.target.value), onKeyDown: (event) => {
339
+ if (event.key === "Enter") {
340
+ event.preventDefault();
341
+ applyText();
342
+ }
343
+ } }) }),
344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-editor-tools__actions", children: [
345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "md", disabled: !normalizeHexInput(text), onClick: applyText, "aria-label": locale.applyTextColor, children: locale.applyTextColor }),
346
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "md", variant: "outline", "aria-label": locale.clearTextColor, onClick: () => {
347
+ editor.chain().setTextSelection(selection.current).unsetColor().run();
348
+ setText("");
349
+ }, children: locale.clearTextColor })
350
+ ] }),
351
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField, { id: highlightId, label: locale.highlightColor, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField.Input, { value: highlight, placeholder: "#RRGGBB", "aria-label": locale.highlightColor, onChange: (event) => setHighlight(event.target.value), onKeyDown: (event) => {
352
+ if (event.key === "Enter") {
353
+ event.preventDefault();
354
+ applyHighlight();
355
+ }
356
+ } }) }),
357
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-editor-tools__actions", children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "md", disabled: !normalizeHexInput(highlight), onClick: applyHighlight, "aria-label": locale.applyHighlightColor, children: locale.applyHighlightColor }),
359
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "md", variant: "outline", "aria-label": locale.clearHighlightColor, onClick: () => {
360
+ editor.chain().setTextSelection(selection.current).unsetHighlight().run();
361
+ setHighlight("");
362
+ }, children: locale.clearHighlightColor })
363
+ ] })
364
+ ] })
365
+ ] });
366
+ }
367
+ function SelectionBar({ editor, disabled, tools, localeText }) {
368
+ const locale = resolveRichTextEditorLocaleText(localeText);
369
+ const [, refresh] = React.useReducer((value) => value + 1, 0);
370
+ React.useEffect(() => {
371
+ editor.on("selectionUpdate", refresh);
372
+ editor.on("transaction", refresh);
373
+ return () => {
374
+ editor.off("selectionUpdate", refresh);
375
+ editor.off("transaction", refresh);
376
+ };
377
+ }, [editor]);
378
+ const selection = editor.state.selection;
379
+ const visible = !disabled && editor.isEditable && !selection.empty && !(selection instanceof import_state.NodeSelection) && (tools.includes("bold") || tools.includes("italic") || tools.includes("underline") || tools.includes("link"));
380
+ if (!visible) return null;
381
+ const markAvailable = (tool, name) => tools.includes(tool) && Boolean(editor.schema.marks[name]);
382
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-editor-tools__bubble", role: "toolbar", "aria-label": locale.selectionBar, children: [
383
+ markAvailable("bold", "bold") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.bold, "aria-pressed": editor.isActive("bold"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleBold().run(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "bold", size: "sm" }) }) : null,
384
+ markAvailable("italic", "italic") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.italic, "aria-pressed": editor.isActive("italic"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleItalic().run(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "italic", size: "sm" }) }) : null,
385
+ markAvailable("underline", "underline") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.underline, "aria-pressed": editor.isActive("underline"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleUnderline().run(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "underline", size: "sm" }) }) : null
386
+ ] });
387
+ }
388
+ const SLASH_PATTERN = /(?:^|\s)\/([^/\s]*)$/;
389
+ function SlashMenu({ editor, insertItems, localeText }) {
390
+ const locale = resolveRichTextEditorLocaleText(localeText);
391
+ const [query, setQuery] = React.useState(null);
392
+ const [active, setActive] = React.useState(0);
393
+ const available = insertItems.filter((item) => !item.node || editor.schema.nodes[item.node]);
394
+ const matches = available.filter((item) => item.label.toLowerCase().includes(query?.text.toLowerCase() ?? ""));
395
+ const activeIndex = Math.min(active, Math.max(0, matches.length - 1));
396
+ const state = React.useRef({ query, active, matches });
397
+ state.current = { query, active: activeIndex, matches };
398
+ React.useEffect(() => {
399
+ const update = () => {
400
+ const selection = editor.state.selection;
401
+ if (!selection.empty || !editor.isEditable) {
402
+ setQuery(null);
403
+ return;
404
+ }
405
+ const before = selection.$from.parent.textBetween(0, selection.$from.parentOffset, "", "\uFFFC");
406
+ const match = before.match(SLASH_PATTERN);
407
+ setQuery(match ? { text: match[1], from: selection.from - match[1].length - 1, to: selection.from } : null);
408
+ setActive(0);
409
+ };
410
+ const apply = (index) => {
411
+ const current = state.current;
412
+ const item = current.matches[index];
413
+ if (!current.query || !item) return;
414
+ editor.chain().focus().deleteRange({ from: current.query.from, to: current.query.to }).run();
415
+ item.insert(editor);
416
+ setQuery(null);
417
+ };
418
+ const keydown = (event) => {
419
+ const current = state.current;
420
+ if (!current.query) return;
421
+ if (event.key === "Escape") {
422
+ event.preventDefault();
423
+ event.stopPropagation();
424
+ setQuery(null);
425
+ }
426
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
427
+ event.preventDefault();
428
+ event.stopPropagation();
429
+ setActive((index) => Math.max(0, Math.min(current.matches.length - 1, index + (event.key === "ArrowDown" ? 1 : -1))));
430
+ }
431
+ if (event.key === "Enter" && current.matches.length) {
432
+ event.preventDefault();
433
+ event.stopPropagation();
434
+ apply(current.active);
435
+ }
436
+ };
437
+ editor.on("transaction", update);
438
+ editor.view.dom.addEventListener("keydown", keydown, true);
439
+ return () => {
440
+ editor.off("transaction", update);
441
+ editor.view.dom.removeEventListener("keydown", keydown, true);
442
+ };
443
+ }, [editor]);
444
+ if (!query) return null;
445
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-editor-tools__slash", role: "listbox", "aria-label": locale.slashMenu, children: [
446
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: locale.slashMenu }),
447
+ matches.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", role: "option", "aria-selected": activeIndex === index, size: "lg", variant: activeIndex === index ? "secondary" : "ghost", onMouseDown: (event) => event.preventDefault(), onClick: () => {
448
+ editor.chain().focus().deleteRange({ from: query.from, to: query.to }).run();
449
+ item.insert(editor);
450
+ setQuery(null);
451
+ }, children: item.label }, item.id)),
452
+ !matches.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { role: "status", children: locale.noMatchingBlocks }) : null
453
+ ] });
454
+ }
210
455
  function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }) {
211
456
  const locale = resolveRichTextEditorLocaleText(localeText);
212
457
  const [, refresh] = React.useReducer((value) => value + 1, 0);
@@ -221,32 +466,42 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
221
466
  const levels = headingLevels ?? editor?.extensionManager.extensions.find((extension) => extension.name === "heading")?.options.levels ?? [1, 2, 3];
222
467
  const format = (label, icon, name, run) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled, "aria-label": label, "aria-pressed": editor?.isActive(name), onMouseDown: (event) => event.preventDefault(), onClick: run, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: icon, size: "sm" }) }, name);
223
468
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
224
- available("style") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.blockStyleGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu, { children: [
225
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Control, { disabled, children: [
226
- locale.textStyle,
227
- " ",
228
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "chevron-down", size: "sm" })
229
- ] }) }),
230
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu.Content, { onCloseAutoFocus: (event) => {
231
- event.preventDefault();
232
- editor?.commands.focus();
233
- }, children: [
234
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setParagraph().run(), children: locale.paragraph }),
235
- editor?.schema.nodes.heading ? levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor.chain().focus().toggleHeading({ level }).run(), children: locale.heading(level) }, level)) : null,
236
- available("blockquote", "blockquote") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor?.chain().focus().toggleBlockquote().run(), children: locale.quoteBlock }) : null,
237
- available("codeBlock", "codeBlock") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor?.chain().focus().toggleCodeBlock().run(), children: locale.codeBlock }) : null
238
- ] })
239
- ] }) }) : null,
240
469
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.textStyleGroup, children: [
470
+ available("style") ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu, { children: [
471
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Control, { disabled, children: [
472
+ locale.textStyle,
473
+ " ",
474
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "chevron-down", size: "sm" })
475
+ ] }) }),
476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu.Content, { onCloseAutoFocus: (event) => {
477
+ event.preventDefault();
478
+ if (editor && !editor.isDestroyed) editor.commands.focus();
479
+ }, children: [
480
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setParagraph().run(), children: locale.paragraph }),
481
+ editor?.schema.nodes.heading ? levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor.chain().focus().toggleHeading({ level }).run(), children: locale.heading(level) }, level)) : null
482
+ ] })
483
+ ] }) : null,
241
484
  available("bold", "bold") ? format(locale.bold, "bold", "bold", () => editor?.chain().focus().toggleBold().run()) : null,
242
485
  available("italic", "italic") ? format(locale.italic, "italic", "italic", () => editor?.chain().focus().toggleItalic().run()) : null,
243
486
  available("strike", "strike") ? format(locale.strikethrough, "strikethrough", "strike", () => editor?.chain().focus().toggleStrike().run()) : null,
244
487
  available("code", "code") ? format(locale.inlineCode, "code", "code", () => editor?.chain().focus().toggleCode().run()) : null,
488
+ available("underline", "underline") ? format(locale.underline, "underline", "underline", () => editor?.chain().focus().toggleUnderline().run()) : null,
489
+ available("highlight", "highlight") ? format(locale.highlight, "highlight", "highlight", () => editor?.chain().focus().toggleHighlight().run()) : null,
490
+ available("align") && editor?.schema.nodes.paragraph ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu, { children: [
491
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled, "aria-label": locale.textAlign, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "align-left", size: "sm" }) }) }),
492
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Content, { onCloseAutoFocus: (event) => {
493
+ event.preventDefault();
494
+ if (editor && !editor.isDestroyed) editor.commands.focus();
495
+ }, children: [["left", locale.alignLeft], ["center", locale.alignCenter], ["right", locale.alignRight], ["justify", locale.alignJustify]].map(([align, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setTextAlign(align).run(), children: label }, align)) })
496
+ ] }) : null,
497
+ available("textColor") && editor?.schema.marks["textStyle"] ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ColorControl, { editor, disabled, localeText }) : null,
245
498
  available("bulletList", "bulletList") ? format(locale.bulletList, "list", "bulletList", () => editor?.chain().focus().toggleBulletList().run()) : null,
246
- available("orderedList", "orderedList") ? format(locale.orderedList, "list-ordered", "orderedList", () => editor?.chain().focus().toggleOrderedList().run()) : null
499
+ available("orderedList", "orderedList") ? format(locale.orderedList, "list-ordered", "orderedList", () => editor?.chain().focus().toggleOrderedList().run()) : null,
500
+ available("taskList", "taskList") ? format(locale.taskList, "list-todo", "taskList", () => editor?.chain().focus().toggleTaskList().run()) : null
247
501
  ] }),
248
502
  editor ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.insertGroup, children: [
249
503
  available("link", "link") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LinkControl, { editor, disabled, localeText }) : null,
504
+ editor.schema.nodes.image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageControl, { editor, disabled, localeText }) : null,
250
505
  insertItems.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DropdownMenu.DropdownMenu, { children: [
251
506
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Control, { disabled, children: [
252
507
  locale.insert,
@@ -256,7 +511,7 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
256
511
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Content, { onCloseAutoFocus: (event) => {
257
512
  event.preventDefault();
258
513
  if (!editor.isDestroyed) editor.commands.focus();
259
- }, children: insertItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => {
514
+ }, children: insertItems.filter((item) => !item.node || editor.schema.nodes[item.node]).map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DropdownMenu.DropdownMenu.Item, { onSelect: () => {
260
515
  if (editor.state.selection instanceof import_state.NodeSelection) editor.commands.command(({ tr }) => {
261
516
  const paragraph = editor.schema.nodes.paragraph;
262
517
  if (!paragraph) return false;
@@ -277,7 +532,9 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
277
532
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled: disabled || !editor?.can().undo(), "aria-label": locale.undo, onMouseDown: (event) => event.preventDefault(), onClick: () => editor?.chain().focus().undo().run(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "undo", size: "sm" }) }),
278
533
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Control, { disabled: disabled || !editor?.can().redo(), "aria-label": locale.redo, onMouseDown: (event) => event.preventDefault(), onClick: () => editor?.chain().focus().redo().run(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: "redo", size: "sm" }) })
279
534
  ] }) : null,
280
- editor && mentions.length && editor.schema.nodes.dsxMention ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MentionSuggestions.MentionSuggestions, { editor, mentions, localeText }) : null
535
+ editor && mentions.length && editor.schema.nodes.dsxMention ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MentionSuggestions.MentionSuggestions, { editor, mentions, localeText }) : null,
536
+ editor ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectionBar, { editor, disabled, tools, localeText }) : null,
537
+ editor && insertItems.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashMenu, { editor, insertItems, localeText }) : null
281
538
  ] });
282
539
  }
283
540
  //# sourceMappingURL=EditorTools.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/richTextEditor/EditorTools.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\nimport { NodeSelection, TextSelection } from '@tiptap/pm/state'\nimport type { Editor } from '@tiptap/react'\ntype Level = 1 | 2 | 3 | 4 | 5 | 6\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { DropdownMenu } from '../dropdownMenu/DropdownMenu'\nimport { Popover } from '../popover/Popover'\nimport { TextField } from '../textField/TextField'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { MentionSuggestions } from './MentionSuggestions'\nimport type { EditorVariable, EditorMention } from './editorTokens'\n\nexport type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history'\nexport interface EditorInsertItem { id: string; label: string; insert: (editor: Editor) => void }\nexport interface EditorToolsOptions {\n tools?: readonly EditorTool[]\n headingLevels?: readonly Level[]\n insertItems?: readonly EditorInsertItem[]\n variables?: readonly EditorVariable[]\n mentions?: readonly EditorMention[]\n localeText?: Partial<RichTextEditorLocaleText>\n}\nexport interface RichTextEditorLocaleText {\n loading: string\n empty: string\n characterCount: (count: number) => string\n toolbarLabel: string\n blockStyleGroup: string\n textStyleGroup: string\n insertGroup: string\n historyGroup: string\n textStyle: string\n paragraph: string\n heading: (level: number) => string\n quoteBlock: string\n codeBlock: string\n insert: string\n bold: string\n italic: string\n strikethrough: string\n inlineCode: string\n bulletList: string\n orderedList: string\n link: string\n clearFormatting: string\n undo: string\n redo: string\n variable: string\n mention: string\n insertVariable: string\n mentionSomeone: string\n variableDescription: string\n mentionDescription: string\n searchVariables: string\n searchPeople: string\n variables: string\n people: string\n noMatches: string\n sensitiveSuffix: string\n editLink: string\n linkDescription: string\n urlLabel: string\n urlInvalid: string\n saveLink: string\n removeLink: string\n mentionSuggestions: string\n peopleMatching: (query: string) => string\n noMatchingPeople: string\n}\nexport const defaultRichTextEditorLocaleText: RichTextEditorLocaleText = {\n loading: 'Editor loading',\n empty: 'Ready to write',\n characterCount: (count) => `${count} characters`,\n toolbarLabel: 'Formatting toolbar',\n blockStyleGroup: 'Block style',\n textStyleGroup: 'Text style',\n insertGroup: 'Insert',\n historyGroup: 'History',\n textStyle: 'Text style',\n paragraph: 'Paragraph',\n heading: (level) => `Heading ${level}`,\n quoteBlock: 'Quote block',\n codeBlock: 'Code block',\n insert: 'Insert',\n bold: 'Bold',\n italic: 'Italic',\n strikethrough: 'Strikethrough',\n inlineCode: 'Inline code',\n bulletList: 'Bulleted list',\n orderedList: 'Numbered list',\n link: 'Link',\n clearFormatting: 'Clear formatting',\n undo: 'Undo',\n redo: 'Redo',\n variable: 'Variable',\n mention: 'Mention',\n insertVariable: 'Insert variable',\n mentionSomeone: 'Mention someone',\n variableDescription: 'Insert a key. Its value is resolved by your application.',\n mentionDescription: 'Select a person to insert their stable identity.',\n searchVariables: 'Search variables',\n searchPeople: 'Search people',\n variables: 'Variables',\n people: 'People',\n noMatches: 'No matches',\n sensitiveSuffix: ' \u00B7 Sensitive',\n editLink: 'Edit link',\n linkDescription: 'Link the selected text or insert a URL at the caret.',\n urlLabel: 'URL',\n urlInvalid: 'Enter a valid https, http, mailto or tel URL.',\n saveLink: 'Save link',\n removeLink: 'Remove link',\n mentionSuggestions: 'Mention suggestions',\n peopleMatching: (query) => `People matching @${query}`,\n noMatchingPeople: 'No matching people',\n}\nexport function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText {\n return { ...defaultRichTextEditorLocaleText, ...localeText }\n}\nconst defaults: EditorTool[] = ['style', 'bold', 'italic', 'strike', 'code', 'bulletList', 'orderedList', 'blockquote', 'codeBlock', 'link', 'clear', 'history']\nconst Control = React.forwardRef<React.ComponentRef<typeof Button>, React.ComponentProps<typeof Button>>(\n function Control({ children, ...props }, forwardedRef) {\n return <Toolbar.Button asChild disabled={props.disabled}><Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"dsx-rich-text-editor__toolbar-button\" {...props} ref={forwardedRef}>{children}</Button></Toolbar.Button>\n },\n)\nControl.displayName = 'Control'\nfunction TokenPicker({ editor, disabled, records, kind, localeText }: { editor: Editor; disabled: boolean; records: readonly (EditorVariable | EditorMention)[]; kind: 'variable' | 'mention'; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [query, setQuery] = React.useState('')\n const [active, setActive] = React.useState(0)\n const listId = React.useId()\n const matches = records.filter(record => `${record.label} ${'key' in record ? record.key : record.id}`.toLowerCase().includes(query.toLowerCase()))\n const insert = (index: number) => {\n const record = matches[index]\n if (!record) return\n editor.chain().focus().insertContent({ type: kind === 'variable' ? 'dsxVariable' : 'dsxMention', attrs: 'key' in record ? { key: record.key } : { userId: record.id } }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { setOpen(next); setQuery(''); setActive(0) }}>\n <Popover.Trigger asChild><Control disabled={disabled}>{kind === 'variable' ? locale.variable : locale.mention}</Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{kind === 'variable' ? locale.insertVariable : locale.mentionSomeone}</Popover.Title>\n <Popover.Description>{kind === 'variable' ? locale.variableDescription : locale.mentionDescription}</Popover.Description>\n <TextField><TextField.Input aria-label={kind === 'variable' ? locale.searchVariables : locale.searchPeople} role=\"combobox\" aria-expanded=\"true\" aria-controls={listId} aria-activedescendant={matches.length ? `${listId}-${active}` : undefined} value={query} onChange={event => { setQuery(event.target.value); setActive(0) }} onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(index => Math.max(0, Math.min(matches.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))) }\n if (event.key === 'Enter') { event.preventDefault(); insert(active) }\n }} /></TextField>\n <div id={listId} role=\"listbox\" aria-label={kind === 'variable' ? locale.variables : locale.people} className=\"dsx-editor-tools__choices\">\n {matches.map((record, index) => <Button id={`${listId}-${index}`} key={'key' in record ? record.key : record.id} role=\"option\" aria-selected={active === index} type=\"button\" variant={active === index ? 'secondary' : 'ghost'} size=\"lg\" onClick={() => insert(index)} onPointerMove={() => setActive(index)}>\n <span>{record.label}{'sensitive' in record && record.sensitive ? locale.sensitiveSuffix : ''}<small>{'key' in record ? record.key : record.id}</small></span>\n </Button>)}\n {!matches.length ? <span role=\"status\">{locale.noMatches}</span> : null}\n </div>\n </Popover.Content>\n </Popover>\n}\nfunction LinkControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [url, setUrl] = React.useState('')\n const [error, setError] = React.useState('')\n const urlId = React.useId()\n const selection = React.useRef({ from: 1, to: 1 })\n const save = () => {\n let href: string\n try { const parsed = new URL(url); if (!['https:', 'http:', 'mailto:', 'tel:'].includes(parsed.protocol)) throw new Error(); href = parsed.href } catch { setError(locale.urlInvalid); return }\n const chain = editor.chain().focus().setTextSelection(selection.current)\n if (selection.current.from === selection.current.to && !editor.isActive('link')) chain.insertContent({ type: 'text', text: href, marks: [{ type: 'link', attrs: { href } }] }).run()\n else chain.extendMarkRange('link').setLink({ href }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { if (next) { selection.current = { from: editor.state.selection.from, to: editor.state.selection.to }; setUrl(editor.getAttributes('link').href ?? ''); setError('') }; setOpen(next) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.link} aria-pressed={editor.isActive('link')}><Icon name=\"link\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{locale.editLink}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.linkDescription}</Popover.Description></VisuallyHidden>\n <TextField id={urlId} label={locale.urlLabel} errorText={error || undefined} invalid={Boolean(error)}><TextField.Input value={url} onChange={event => { setUrl(event.target.value); setError('') }} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); save() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" onClick={save}>{locale.saveLink}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" disabled={!editor.isActive('link')} onClick={() => { editor.chain().focus().setTextSelection(selection.current).extendMarkRange('link').unsetLink().run(); setOpen(false) }}>{locale.removeLink}</Button></div>\n </Popover.Content>\n </Popover>\n}\nexport function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }: EditorToolsOptions & { editor: Editor | null; disabled: boolean }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [, refresh] = React.useReducer(value => value + 1, 0)\n React.useEffect(() => { if (!editor) return; editor.on('transaction', refresh); return () => { editor.off('transaction', refresh) } }, [editor])\n const available = (tool: EditorTool, name?: string) => tools.includes(tool) && (!name || Boolean(editor?.schema.nodes[name] || editor?.schema.marks[name]))\n const levels = headingLevels ?? editor?.extensionManager.extensions.find(extension => extension.name === 'heading')?.options.levels ?? [1, 2, 3]\n const format = (label: string, icon: React.ComponentProps<typeof Icon>['name'], name: string, run: () => void) => <Control key={name} disabled={disabled} aria-label={label} aria-pressed={editor?.isActive(name)} onMouseDown={event => event.preventDefault()} onClick={run}><Icon name={icon} size=\"sm\" /></Control>\n return <>\n {available('style') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.blockStyleGroup}><DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.textStyle} <Icon name=\"chevron-down\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); editor?.commands.focus() }}>\n <DropdownMenu.Item onSelect={() => editor?.chain().focus().setParagraph().run()}>{locale.paragraph}</DropdownMenu.Item>\n {editor?.schema.nodes.heading ? (levels as Level[]).map(level => <DropdownMenu.Item key={level} onSelect={() => editor.chain().focus().toggleHeading({ level }).run()}>{locale.heading(level)}</DropdownMenu.Item>) : null}\n {available('blockquote', 'blockquote') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleBlockquote().run()}>{locale.quoteBlock}</DropdownMenu.Item> : null}\n {available('codeBlock', 'codeBlock') ? <DropdownMenu.Item onSelect={() => editor?.chain().focus().toggleCodeBlock().run()}>{locale.codeBlock}</DropdownMenu.Item> : null}\n </DropdownMenu.Content></DropdownMenu></div> : null}\n <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.textStyleGroup}>\n {available('bold', 'bold') ? format(locale.bold, 'bold', 'bold', () => editor?.chain().focus().toggleBold().run()) : null}\n {available('italic', 'italic') ? format(locale.italic, 'italic', 'italic', () => editor?.chain().focus().toggleItalic().run()) : null}\n {available('strike', 'strike') ? format(locale.strikethrough, 'strikethrough', 'strike', () => editor?.chain().focus().toggleStrike().run()) : null}\n {available('code', 'code') ? format(locale.inlineCode, 'code', 'code', () => editor?.chain().focus().toggleCode().run()) : null}\n {available('bulletList', 'bulletList') ? format(locale.bulletList, 'list', 'bulletList', () => editor?.chain().focus().toggleBulletList().run()) : null}\n {available('orderedList', 'orderedList') ? format(locale.orderedList, 'list-ordered', 'orderedList', () => editor?.chain().focus().toggleOrderedList().run()) : null}\n </div>\n {editor ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.insertGroup}>\n {available('link', 'link') ? <LinkControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {insertItems.length ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.insert} <Icon name=\"plus\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>{insertItems.map(item => <DropdownMenu.Item key={item.id} onSelect={() => {\n if (editor.state.selection instanceof NodeSelection) editor.commands.command(({ tr }) => {\n const paragraph = editor.schema.nodes.paragraph\n if (!paragraph) return false\n let point = tr.doc.resolve(tr.selection.to)\n while (point.depth > 0 && !point.parent.canReplaceWith(point.index(), point.index(), paragraph)) point = tr.doc.resolve(point.after())\n tr.insert(point.pos, paragraph.create())\n tr.setSelection(TextSelection.create(tr.doc, point.pos + 1))\n return true\n })\n item.insert(editor)\n }}>{item.label}</DropdownMenu.Item>)}</DropdownMenu.Content></DropdownMenu> : null}\n {variables.length && editor.schema.nodes.dsxVariable ? <TokenPicker editor={editor} disabled={disabled} kind=\"variable\" records={variables} localeText={localeText} /> : null}\n {mentions.length && editor.schema.nodes.dsxMention ? <TokenPicker editor={editor} disabled={disabled} kind=\"mention\" records={mentions} localeText={localeText} /> : null}\n {available('clear') ? format(locale.clearFormatting, 'eraser', '', () => editor.chain().focus().clearNodes().unsetAllMarks().run()) : null}\n </div> : null}\n {available('history') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.historyGroup}><Control disabled={disabled || !editor?.can().undo()} aria-label={locale.undo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().undo().run()}><Icon name=\"undo\" size=\"sm\" /></Control><Control disabled={disabled || !editor?.can().redo()} aria-label={locale.redo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().redo().run()}><Icon name=\"redo\" size=\"sm\" /></Control></div> : null}\n {editor && mentions.length && editor.schema.nodes.dsxMention ? <MentionSuggestions editor={editor} mentions={mentions} localeText={localeText} /> : null}\n </>\n}\n"],
5
- "mappings": ";;;;;;;;;;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S;AAAA,IACR,UAAU,SAAS,IAAI,6CAAC,SAAI,WAAU,uCAAsC,MAAK,SAAQ,cAAY,OAAO,cAAc;AAAA,kDAAC,WAAQ,UAAU,YAAY,CAAC,QAAQ,IAAI,EAAE,KAAK,GAAG,cAAY,OAAO,MAAM,aAAa,WAAS,MAAM,eAAe,GAAG,SAAS,MAAM,QAAQ,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,sDAAC,oBAAK,MAAK,QAAO,MAAK,MAAK,GAAE;AAAA,MAAU,4CAAC,WAAQ,UAAU,YAAY,CAAC,QAAQ,IAAI,EAAE,KAAK,GAAG,cAAY,OAAO,MAAM,aAAa,WAAS,MAAM,eAAe,GAAG,SAAS,MAAM,QAAQ,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,sDAAC,oBAAK,MAAK,QAAO,MAAK,MAAK,GAAE;AAAA,OAAU,IAAS;AAAA,IACvjB,UAAU,SAAS,UAAU,OAAO,OAAO,MAAM,aAAa,4CAAC,gDAAmB,QAAgB,UAAoB,YAAwB,IAAK;AAAA,KACtJ;AACF;",
4
+ "sourcesContent": ["import * as React from 'react'\nimport { NodeSelection, TextSelection } from '@tiptap/pm/state'\nimport type { Editor } from '@tiptap/react'\ntype Level = 1 | 2 | 3 | 4 | 5 | 6\nimport { Button } from '../button/Button'\nimport { Icon } from '../icon/Icon'\nimport { Toolbar } from '../toolbar/Toolbar'\nimport { DropdownMenu } from '../dropdownMenu/DropdownMenu'\nimport { Popover } from '../popover/Popover'\nimport { TextField } from '../textField/TextField'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { MentionSuggestions } from './MentionSuggestions'\nimport type { EditorVariable, EditorMention } from './editorTokens'\n\nexport type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'underline' | 'highlight' | 'textColor' | 'align' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history'\nexport interface EditorInsertItem { id: string; label: string; insert: (editor: Editor) => void; /** Schema node that must exist for the item to render (e.g. 'table', 'image'). Omitted = always shown. */ node?: string }\nexport function defaultArticleInsertItems(locale: RichTextEditorLocaleText): EditorInsertItem[] {\n return [\n { id: 'quote', label: locale.quoteBlock, insert: (editor) => { editor.chain().focus().toggleBlockquote().run() }, node: 'blockquote' },\n { id: 'code-block', label: locale.codeBlock, insert: (editor) => { editor.chain().focus().toggleCodeBlock().run() }, node: 'codeBlock' },\n { id: 'table', label: locale.insertTable, insert: (editor) => { editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run() }, node: 'table' },\n { id: 'divider', label: locale.insertDivider, insert: (editor) => { editor.chain().focus().setHorizontalRule().run() }, node: 'horizontalRule' },\n ]\n}\nexport interface EditorToolsOptions {\n tools?: readonly EditorTool[]\n headingLevels?: readonly Level[]\n insertItems?: readonly EditorInsertItem[]\n variables?: readonly EditorVariable[]\n mentions?: readonly EditorMention[]\n localeText?: Partial<RichTextEditorLocaleText>\n}\nexport interface RichTextEditorLocaleText {\n loading: string\n empty: string\n characterCount: (count: number) => string\n toolbarLabel: string\n blockStyleGroup: string\n textStyleGroup: string\n insertGroup: string\n historyGroup: string\n textStyle: string\n paragraph: string\n heading: (level: number) => string\n quoteBlock: string\n codeBlock: string\n insert: string\n bold: string\n italic: string\n strikethrough: string\n inlineCode: string\n bulletList: string\n orderedList: string\n taskList: string\n link: string\n clearFormatting: string\n undo: string\n redo: string\n variable: string\n mention: string\n insertVariable: string\n mentionSomeone: string\n variableDescription: string\n mentionDescription: string\n searchVariables: string\n searchPeople: string\n variables: string\n people: string\n noMatches: string\n sensitiveSuffix: string\n editLink: string\n linkDescription: string\n urlLabel: string\n urlInvalid: string\n saveLink: string\n removeLink: string\n mentionSuggestions: string\n peopleMatching: (query: string) => string\n noMatchingPeople: string\n underline: string\n highlight: string\n textColor: string\n highlightColor: string\n colorDialogTitle: string\n colorDialogDescription: string\n applyTextColor: string\n applyHighlightColor: string\n clearTextColor: string\n clearHighlightColor: string\n textAlign: string\n alignLeft: string\n alignCenter: string\n alignRight: string\n alignJustify: string\n insertTable: string\n insertDivider: string\n insertImage: string\n imageDialogTitle: string\n imageDialogDescription: string\n insertImageAction: string\n selectionBar: string\n slashMenu: string\n noMatchingBlocks: string\n}\nexport const defaultRichTextEditorLocaleText: RichTextEditorLocaleText = {\n loading: 'Editor loading',\n empty: 'Ready to write',\n characterCount: (count) => `${count} characters`,\n toolbarLabel: 'Formatting toolbar',\n blockStyleGroup: 'Block style',\n textStyleGroup: 'Text style',\n insertGroup: 'Insert',\n historyGroup: 'History',\n textStyle: 'Text style',\n paragraph: 'Paragraph',\n heading: (level) => `Heading ${level}`,\n quoteBlock: 'Quote block',\n codeBlock: 'Code block',\n insert: 'Insert',\n bold: 'Bold',\n italic: 'Italic',\n strikethrough: 'Strikethrough',\n inlineCode: 'Inline code',\n bulletList: 'Bulleted list',\n orderedList: 'Numbered list',\n taskList: 'Task list',\n link: 'Link',\n clearFormatting: 'Clear formatting',\n undo: 'Undo',\n redo: 'Redo',\n variable: 'Variable',\n mention: 'Mention',\n insertVariable: 'Insert variable',\n mentionSomeone: 'Mention someone',\n variableDescription: 'Insert a key. Its value is resolved by your application.',\n mentionDescription: 'Select a person to insert their stable identity.',\n searchVariables: 'Search variables',\n searchPeople: 'Search people',\n variables: 'Variables',\n people: 'People',\n noMatches: 'No matches',\n sensitiveSuffix: ' \u00B7 Sensitive',\n editLink: 'Edit link',\n linkDescription: 'Link the selected text or insert a URL at the caret.',\n urlLabel: 'URL',\n urlInvalid: 'Enter a valid https, http, mailto or tel URL.',\n saveLink: 'Save link',\n removeLink: 'Remove link',\n mentionSuggestions: 'Mention suggestions',\n peopleMatching: (query) => `People matching @${query}`,\n noMatchingPeople: 'No matching people',\n underline: 'Underline',\n highlight: 'Highlight',\n textColor: 'Text color',\n highlightColor: 'Highlight color',\n colorDialogTitle: 'Text and highlight color',\n colorDialogDescription: 'Apply a hex color to selected text, or clear it.',\n applyTextColor: 'Apply text color',\n applyHighlightColor: 'Apply highlight color',\n clearTextColor: 'Clear text color',\n clearHighlightColor: 'Clear highlight color',\n textAlign: 'Text alignment',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n alignJustify: 'Justify',\n insertTable: 'Table',\n insertDivider: 'Divider',\n insertImage: 'Image',\n imageDialogTitle: 'Insert image',\n imageDialogDescription: 'Add an image by URL.',\n insertImageAction: 'Insert image',\n selectionBar: 'Selection formatting',\n slashMenu: 'Insert block',\n noMatchingBlocks: 'No matching blocks',\n}\nexport function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText {\n return { ...defaultRichTextEditorLocaleText, ...localeText }\n}\nconst defaults: EditorTool[] = ['style', 'bold', 'italic', 'strike', 'code', 'underline', 'highlight', 'textColor', 'align', 'bulletList', 'orderedList', 'taskList', 'blockquote', 'codeBlock', 'link', 'clear', 'history']\nconst Control = React.forwardRef<React.ComponentRef<typeof Button>, React.ComponentProps<typeof Button>>(\n function Control({ children, ...props }, forwardedRef) {\n return <Toolbar.Button asChild disabled={props.disabled}><Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"dsx-rich-text-editor__toolbar-button\" {...props} ref={forwardedRef}>{children}</Button></Toolbar.Button>\n },\n)\nControl.displayName = 'Control'\nfunction TokenPicker({ editor, disabled, records, kind, localeText }: { editor: Editor; disabled: boolean; records: readonly (EditorVariable | EditorMention)[]; kind: 'variable' | 'mention'; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [query, setQuery] = React.useState('')\n const [active, setActive] = React.useState(0)\n const listId = React.useId()\n const matches = records.filter(record => `${record.label} ${'key' in record ? record.key : record.id}`.toLowerCase().includes(query.toLowerCase()))\n const insert = (index: number) => {\n const record = matches[index]\n if (!record) return\n editor.chain().focus().insertContent({ type: kind === 'variable' ? 'dsxVariable' : 'dsxMention', attrs: 'key' in record ? { key: record.key } : { userId: record.id } }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { setOpen(next); setQuery(''); setActive(0) }}>\n <Popover.Trigger asChild><Control disabled={disabled}>{kind === 'variable' ? locale.variable : locale.mention}</Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{kind === 'variable' ? locale.insertVariable : locale.mentionSomeone}</Popover.Title>\n <Popover.Description>{kind === 'variable' ? locale.variableDescription : locale.mentionDescription}</Popover.Description>\n <TextField><TextField.Input aria-label={kind === 'variable' ? locale.searchVariables : locale.searchPeople} role=\"combobox\" aria-expanded=\"true\" aria-controls={listId} aria-activedescendant={matches.length ? `${listId}-${active}` : undefined} value={query} onChange={event => { setQuery(event.target.value); setActive(0) }} onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(index => Math.max(0, Math.min(matches.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))) }\n if (event.key === 'Enter') { event.preventDefault(); insert(active) }\n }} /></TextField>\n <div id={listId} role=\"listbox\" aria-label={kind === 'variable' ? locale.variables : locale.people} className=\"dsx-editor-tools__choices\">\n {matches.map((record, index) => <Button id={`${listId}-${index}`} key={'key' in record ? record.key : record.id} role=\"option\" aria-selected={active === index} type=\"button\" variant={active === index ? 'secondary' : 'ghost'} size=\"lg\" onClick={() => insert(index)} onPointerMove={() => setActive(index)}>\n <span>{record.label}{'sensitive' in record && record.sensitive ? locale.sensitiveSuffix : ''}<small>{'key' in record ? record.key : record.id}</small></span>\n </Button>)}\n {!matches.length ? <span role=\"status\">{locale.noMatches}</span> : null}\n </div>\n </Popover.Content>\n </Popover>\n}\nfunction LinkControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [url, setUrl] = React.useState('')\n const [error, setError] = React.useState('')\n const urlId = React.useId()\n const selection = React.useRef({ from: 1, to: 1 })\n const save = () => {\n let href: string\n try { const parsed = new URL(url); if (!['https:', 'http:', 'mailto:', 'tel:'].includes(parsed.protocol)) throw new Error(); href = parsed.href } catch { setError(locale.urlInvalid); return }\n const chain = editor.chain().focus().setTextSelection(selection.current)\n if (selection.current.from === selection.current.to && !editor.isActive('link')) chain.insertContent({ type: 'text', text: href, marks: [{ type: 'link', attrs: { href } }] }).run()\n else chain.extendMarkRange('link').setLink({ href }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={next => { if (next) { selection.current = { from: editor.state.selection.from, to: editor.state.selection.to }; setUrl(editor.getAttributes('link').href ?? ''); setError('') }; setOpen(next) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.link} aria-pressed={editor.isActive('link')}><Icon name=\"link\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{locale.editLink}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.linkDescription}</Popover.Description></VisuallyHidden>\n <TextField id={urlId} label={locale.urlLabel} errorText={error || undefined} invalid={Boolean(error)}><TextField.Input value={url} onChange={event => { setUrl(event.target.value); setError('') }} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); save() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" onClick={save}>{locale.saveLink}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" disabled={!editor.isActive('link')} onClick={() => { editor.chain().focus().setTextSelection(selection.current).extendMarkRange('link').unsetLink().run(); setOpen(false) }}>{locale.removeLink}</Button></div>\n </Popover.Content>\n </Popover>\n}\nfunction ImageControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [url, setUrl] = React.useState('')\n const [error, setError] = React.useState('')\n const urlId = React.useId()\n const insert = () => {\n let href: string\n try { const parsed = new URL(url); if (!['https:', 'http:'].includes(parsed.protocol)) throw new Error(); href = parsed.href } catch { setError(locale.urlInvalid); return }\n editor.chain().focus().setImage({ src: href }).run()\n setOpen(false)\n }\n return <Popover open={open} onOpenChange={(next) => { if (next) { setUrl(''); setError('') }; setOpen(next) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.insertImage}><Icon name=\"image\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{locale.imageDialogTitle}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.imageDialogDescription}</Popover.Description></VisuallyHidden>\n <TextField id={urlId} label={locale.urlLabel} errorText={error || undefined} invalid={Boolean(error)}><TextField.Input value={url} onChange={event => { setUrl(event.target.value); setError('') }} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); insert() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" onClick={insert}>{locale.insertImageAction}</Button></div>\n </Popover.Content>\n </Popover>\n}\nconst HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/\nfunction normalizeHexInput(value: string): string | null {\n const withHash = value.startsWith('#') ? value : `#${value}`\n return HEX_COLOR_PATTERN.test(withHash) ? withHash.toUpperCase() : null\n}\nfunction ColorControl({ editor, disabled, localeText }: { editor: Editor; disabled: boolean; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [open, setOpen] = React.useState(false)\n const [text, setText] = React.useState('')\n const [highlight, setHighlight] = React.useState('')\n const textId = React.useId()\n const highlightId = React.useId()\n const selection = React.useRef({ from: 0, to: 0 })\n const openWithCurrent = () => {\n selection.current = { from: editor.state.selection.from, to: editor.state.selection.to }\n setText(editor.getAttributes('textStyle').color ?? '')\n setHighlight(editor.getAttributes('highlight').color ?? '')\n setOpen(true)\n }\n const applyText = () => { const color = normalizeHexInput(text); if (color) editor.chain().setTextSelection(selection.current).setColor(color).run() }\n const applyHighlight = () => { const color = normalizeHexInput(highlight); if (!color) return; editor.chain().setTextSelection(selection.current).unsetHighlight().toggleHighlight({ color }).run() }\n return <Popover open={open} onOpenChange={(next) => { if (next) openWithCurrent(); else setOpen(false) }}>\n <Popover.Trigger asChild><Control disabled={disabled} aria-label={locale.textColor}><Icon name=\"baseline\" size=\"sm\" /></Control></Popover.Trigger>\n <Popover.Content className=\"dsx-editor-tools__popover dsx-editor-tools__link\" align=\"start\" onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>\n <Popover.Title>{locale.colorDialogTitle}</Popover.Title><VisuallyHidden asChild><Popover.Description>{locale.colorDialogDescription}</Popover.Description></VisuallyHidden>\n <TextField id={textId} label={locale.textColor}><TextField.Input value={text} placeholder=\"#RRGGBB\" aria-label={locale.textColor} onChange={event => setText(event.target.value)} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); applyText() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" disabled={!normalizeHexInput(text)} onClick={applyText} aria-label={locale.applyTextColor}>{locale.applyTextColor}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" aria-label={locale.clearTextColor} onClick={() => { editor.chain().setTextSelection(selection.current).unsetColor().run(); setText('') }}>{locale.clearTextColor}</Button></div>\n <TextField id={highlightId} label={locale.highlightColor}><TextField.Input value={highlight} placeholder=\"#RRGGBB\" aria-label={locale.highlightColor} onChange={event => setHighlight(event.target.value)} onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); applyHighlight() } }} /></TextField>\n <div className=\"dsx-editor-tools__actions\"><Button type=\"button\" size=\"md\" disabled={!normalizeHexInput(highlight)} onClick={applyHighlight} aria-label={locale.applyHighlightColor}>{locale.applyHighlightColor}</Button><Button type=\"button\" size=\"md\" variant=\"outline\" aria-label={locale.clearHighlightColor} onClick={() => { editor.chain().setTextSelection(selection.current).unsetHighlight().run(); setHighlight('') }}>{locale.clearHighlightColor}</Button></div>\n </Popover.Content>\n </Popover>\n}\n/**\n * Selection shortcut bar (bubble role). Transaction-driven: it appears when a\n * non-collapsed text selection exists and hides otherwise. It is rendered\n * inline below the toolbar groups rather than floating near the selection, so\n * it needs no layout measurement and behaves identically in jsdom and browsers.\n */\nfunction SelectionBar({ editor, disabled, tools, localeText }: { editor: Editor; disabled: boolean; tools: readonly EditorTool[]; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [, refresh] = React.useReducer(value => value + 1, 0)\n React.useEffect(() => { editor.on('selectionUpdate', refresh); editor.on('transaction', refresh); return () => { editor.off('selectionUpdate', refresh); editor.off('transaction', refresh) } }, [editor])\n const selection = editor.state.selection\n const visible = !disabled && editor.isEditable && !selection.empty && !(selection instanceof NodeSelection)\n && (tools.includes('bold') || tools.includes('italic') || tools.includes('underline') || tools.includes('link'))\n if (!visible) return null\n const markAvailable = (tool: EditorTool, name: string) => tools.includes(tool) && Boolean(editor.schema.marks[name])\n return <div className=\"dsx-editor-tools__bubble\" role=\"toolbar\" aria-label={locale.selectionBar}>\n {markAvailable('bold', 'bold') ? <Button type=\"button\" size=\"sm\" variant=\"ghost\" aria-label={locale.bold} aria-pressed={editor.isActive('bold')} onMouseDown={event => event.preventDefault()} onClick={() => editor.chain().focus().toggleBold().run()}><Icon name=\"bold\" size=\"sm\" /></Button> : null}\n {markAvailable('italic', 'italic') ? <Button type=\"button\" size=\"sm\" variant=\"ghost\" aria-label={locale.italic} aria-pressed={editor.isActive('italic')} onMouseDown={event => event.preventDefault()} onClick={() => editor.chain().focus().toggleItalic().run()}><Icon name=\"italic\" size=\"sm\" /></Button> : null}\n {markAvailable('underline', 'underline') ? <Button type=\"button\" size=\"sm\" variant=\"ghost\" aria-label={locale.underline} aria-pressed={editor.isActive('underline')} onMouseDown={event => event.preventDefault()} onClick={() => editor.chain().focus().toggleUnderline().run()}><Icon name=\"underline\" size=\"sm\" /></Button> : null}\n </div>\n}\n\nconst SLASH_PATTERN = /(?:^|\\s)\\/([^/\\s]*)$/\n\n/**\n * Slash menu. Transaction-driven like `MentionSuggestions`: typing `/` at the\n * start of a block (or after whitespace) opens the block-insert list filtered\n * by the text after the slash. `Enter` applies the active item after deleting\n * the `/query`, `Escape` dismisses. Schema-gated by `EditorInsertItem.node`\n * exactly like the toolbar Insert menu.\n */\nfunction SlashMenu({ editor, insertItems, localeText }: { editor: Editor; insertItems: readonly EditorInsertItem[]; localeText?: Partial<RichTextEditorLocaleText> }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [query, setQuery] = React.useState<{ text: string; from: number; to: number } | null>(null)\n const [active, setActive] = React.useState(0)\n const available = insertItems.filter(item => !item.node || editor.schema.nodes[item.node])\n const matches = available.filter(item => item.label.toLowerCase().includes(query?.text.toLowerCase() ?? ''))\n const activeIndex = Math.min(active, Math.max(0, matches.length - 1))\n const state = React.useRef({ query, active, matches })\n state.current = { query, active: activeIndex, matches }\n React.useEffect(() => {\n const update = () => {\n const selection = editor.state.selection\n if (!selection.empty || !editor.isEditable) { setQuery(null); return }\n const before = selection.$from.parent.textBetween(0, selection.$from.parentOffset, '', '\\ufffc')\n const match = before.match(SLASH_PATTERN)\n setQuery(match ? { text: match[1], from: selection.from - match[1].length - 1, to: selection.from } : null)\n setActive(0)\n }\n const apply = (index: number) => {\n const current = state.current\n const item = current.matches[index]\n if (!current.query || !item) return\n editor.chain().focus().deleteRange({ from: current.query.from, to: current.query.to }).run()\n item.insert(editor)\n setQuery(null)\n }\n const keydown = (event: KeyboardEvent) => {\n const current = state.current\n if (!current.query) return\n if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); setQuery(null) }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); event.stopPropagation(); setActive(index => Math.max(0, Math.min(current.matches.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))) }\n if (event.key === 'Enter' && current.matches.length) { event.preventDefault(); event.stopPropagation(); apply(current.active) }\n }\n editor.on('transaction', update)\n editor.view.dom.addEventListener('keydown', keydown, true)\n return () => { editor.off('transaction', update); editor.view.dom.removeEventListener('keydown', keydown, true) }\n }, [editor])\n if (!query) return null\n return <div className=\"dsx-editor-tools__slash\" role=\"listbox\" aria-label={locale.slashMenu}>\n <span>{locale.slashMenu}</span>\n {matches.map((item, index) => <Button type=\"button\" role=\"option\" aria-selected={activeIndex === index} key={item.id} size=\"lg\" variant={activeIndex === index ? 'secondary' : 'ghost'} onMouseDown={event => event.preventDefault()} onClick={() => {\n editor.chain().focus().deleteRange({ from: query.from, to: query.to }).run()\n item.insert(editor)\n setQuery(null)\n }}>{item.label}</Button>)}\n {!matches.length ? <span role=\"status\">{locale.noMatchingBlocks}</span> : null}\n </div>\n}\n\nexport function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }: EditorToolsOptions & { editor: Editor | null; disabled: boolean }) {\n const locale = resolveRichTextEditorLocaleText(localeText)\n const [, refresh] = React.useReducer(value => value + 1, 0)\n React.useEffect(() => { if (!editor) return; editor.on('transaction', refresh); return () => { editor.off('transaction', refresh) } }, [editor])\n const available = (tool: EditorTool, name?: string) => tools.includes(tool) && (!name || Boolean(editor?.schema.nodes[name] || editor?.schema.marks[name]))\n const levels = headingLevels ?? editor?.extensionManager.extensions.find(extension => extension.name === 'heading')?.options.levels ?? [1, 2, 3]\n const format = (label: string, icon: React.ComponentProps<typeof Icon>['name'], name: string, run: () => void) => <Control key={name} disabled={disabled} aria-label={label} aria-pressed={editor?.isActive(name)} onMouseDown={event => event.preventDefault()} onClick={run}><Icon name={icon} size=\"sm\" /></Control>\n return <>\n <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.textStyleGroup}>\n {available('style') ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.textStyle} <Icon name=\"chevron-down\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); if (editor && !editor.isDestroyed) editor.commands.focus() }}>\n <DropdownMenu.Item onSelect={() => editor?.chain().focus().setParagraph().run()}>{locale.paragraph}</DropdownMenu.Item>\n {editor?.schema.nodes.heading ? (levels as Level[]).map(level => <DropdownMenu.Item key={level} onSelect={() => editor.chain().focus().toggleHeading({ level }).run()}>{locale.heading(level)}</DropdownMenu.Item>) : null}\n </DropdownMenu.Content></DropdownMenu> : null}\n {available('bold', 'bold') ? format(locale.bold, 'bold', 'bold', () => editor?.chain().focus().toggleBold().run()) : null}\n {available('italic', 'italic') ? format(locale.italic, 'italic', 'italic', () => editor?.chain().focus().toggleItalic().run()) : null}\n {available('strike', 'strike') ? format(locale.strikethrough, 'strikethrough', 'strike', () => editor?.chain().focus().toggleStrike().run()) : null}\n {available('code', 'code') ? format(locale.inlineCode, 'code', 'code', () => editor?.chain().focus().toggleCode().run()) : null}\n {available('underline', 'underline') ? format(locale.underline, 'underline', 'underline', () => editor?.chain().focus().toggleUnderline().run()) : null}\n {available('highlight', 'highlight') ? format(locale.highlight, 'highlight', 'highlight', () => editor?.chain().focus().toggleHighlight().run()) : null}\n {available('align') && editor?.schema.nodes.paragraph ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled} aria-label={locale.textAlign}><Icon name=\"align-left\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); if (editor && !editor.isDestroyed) editor.commands.focus() }}>\n {([['left', locale.alignLeft], ['center', locale.alignCenter], ['right', locale.alignRight], ['justify', locale.alignJustify]] as const).map(([align, label]) => <DropdownMenu.Item key={align} onSelect={() => editor?.chain().focus().setTextAlign(align).run()}>{label}</DropdownMenu.Item>)}\n </DropdownMenu.Content></DropdownMenu> : null}\n {available('textColor') && editor?.schema.marks['textStyle'] ? <ColorControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {available('bulletList', 'bulletList') ? format(locale.bulletList, 'list', 'bulletList', () => editor?.chain().focus().toggleBulletList().run()) : null}\n {available('orderedList', 'orderedList') ? format(locale.orderedList, 'list-ordered', 'orderedList', () => editor?.chain().focus().toggleOrderedList().run()) : null}\n {available('taskList', 'taskList') ? format(locale.taskList, 'list-todo', 'taskList', () => editor?.chain().focus().toggleTaskList().run()) : null}\n </div>\n {editor ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.insertGroup}>\n {available('link', 'link') ? <LinkControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {editor.schema.nodes.image ? <ImageControl editor={editor} disabled={disabled} localeText={localeText} /> : null}\n {insertItems.length ? <DropdownMenu><DropdownMenu.Trigger asChild><Control disabled={disabled}>{locale.insert} <Icon name=\"plus\" size=\"sm\" /></Control></DropdownMenu.Trigger><DropdownMenu.Content onCloseAutoFocus={event => { event.preventDefault(); if (!editor.isDestroyed) editor.commands.focus() }}>{insertItems.filter((item) => !item.node || editor.schema.nodes[item.node]).map(item => <DropdownMenu.Item key={item.id} onSelect={() => {\n if (editor.state.selection instanceof NodeSelection) editor.commands.command(({ tr }) => {\n const paragraph = editor.schema.nodes.paragraph\n if (!paragraph) return false\n let point = tr.doc.resolve(tr.selection.to)\n while (point.depth > 0 && !point.parent.canReplaceWith(point.index(), point.index(), paragraph)) point = tr.doc.resolve(point.after())\n tr.insert(point.pos, paragraph.create())\n tr.setSelection(TextSelection.create(tr.doc, point.pos + 1))\n return true\n })\n item.insert(editor)\n }}>{item.label}</DropdownMenu.Item>)}</DropdownMenu.Content></DropdownMenu> : null}\n {variables.length && editor.schema.nodes.dsxVariable ? <TokenPicker editor={editor} disabled={disabled} kind=\"variable\" records={variables} localeText={localeText} /> : null}\n {mentions.length && editor.schema.nodes.dsxMention ? <TokenPicker editor={editor} disabled={disabled} kind=\"mention\" records={mentions} localeText={localeText} /> : null}\n {available('clear') ? format(locale.clearFormatting, 'eraser', '', () => editor.chain().focus().clearNodes().unsetAllMarks().run()) : null}\n </div> : null}\n {available('history') ? <div className=\"dsx-rich-text-editor__toolbar-group\" role=\"group\" aria-label={locale.historyGroup}><Control disabled={disabled || !editor?.can().undo()} aria-label={locale.undo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().undo().run()}><Icon name=\"undo\" size=\"sm\" /></Control><Control disabled={disabled || !editor?.can().redo()} aria-label={locale.redo} onMouseDown={event => event.preventDefault()} onClick={() => editor?.chain().focus().redo().run()}><Icon name=\"redo\" size=\"sm\" /></Control></div> : null}\n {editor && mentions.length && editor.schema.nodes.dsxMention ? <MentionSuggestions editor={editor} mentions={mentions} localeText={localeText} /> : null}\n {editor ? <SelectionBar editor={editor} disabled={disabled} tools={tools} localeText={localeText} /> : null}\n {editor && insertItems.length ? <SlashMenu editor={editor} insertItems={insertItems} localeText={localeText} /> : null}\n </>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAA6C;AAG7C,oBAAuB;AACvB,kBAAqB;AACrB,qBAAwB;AACxB,0BAA6B;AAC7B,qBAAwB;AACxB,uBAA0B;AAC1B,4BAA+B;AAC/B,gCAAmC;AA2K0B;AAtKtD,SAAS,0BAA0B,QAAsD;AAC9F,SAAO;AAAA,IACL,EAAE,IAAI,SAAS,OAAO,OAAO,YAAY,QAAQ,CAAC,WAAW;AAAE,aAAO,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI;AAAA,IAAE,GAAG,MAAM,aAAa;AAAA,IACrI,EAAE,IAAI,cA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