@dialpad/dialtone 9.30.1 → 9.32.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 (102) hide show
  1. package/README.md +6 -0
  2. package/dist/css/dialtone.css +11 -2
  3. package/dist/css/dialtone.min.css +1 -1
  4. package/dist/tokens/css/variables-dark.css +1 -1
  5. package/dist/tokens/css/variables-expressive-dark.css +1 -1
  6. package/dist/tokens/css/variables-expressive-light.css +1 -1
  7. package/dist/tokens/css/variables-expressive-sm-dark.css +1 -1
  8. package/dist/tokens/css/variables-expressive-sm-light.css +1 -1
  9. package/dist/tokens/css/variables-light.css +1 -1
  10. package/dist/tokens/css/variables-tmo-dark.css +1 -1
  11. package/dist/tokens/css/variables-tmo-light.css +1 -1
  12. package/dist/tokens/less/variables-dark.less +1 -1
  13. package/dist/tokens/less/variables-expressive-dark.less +1 -1
  14. package/dist/tokens/less/variables-expressive-light.less +1 -1
  15. package/dist/tokens/less/variables-expressive-sm-dark.less +1 -1
  16. package/dist/tokens/less/variables-expressive-sm-light.less +1 -1
  17. package/dist/tokens/less/variables-light.less +1 -1
  18. package/dist/tokens/less/variables-tmo-dark.less +1 -1
  19. package/dist/tokens/less/variables-tmo-light.less +1 -1
  20. package/dist/vue2/component-documentation.json +1 -1
  21. package/dist/vue2/dialtone-vue.cjs +2 -0
  22. package/dist/vue2/dialtone-vue.cjs.map +1 -1
  23. package/dist/vue2/dialtone-vue.js +2 -0
  24. package/dist/vue2/dialtone-vue.js.map +1 -1
  25. package/dist/vue2/lib/editor.cjs +2 -0
  26. package/dist/vue2/lib/editor.cjs.map +1 -1
  27. package/dist/vue2/lib/editor.js +2 -0
  28. package/dist/vue2/lib/editor.js.map +1 -1
  29. package/dist/vue2/lib/message-input.cjs +21 -4
  30. package/dist/vue2/lib/message-input.cjs.map +1 -1
  31. package/dist/vue2/lib/message-input.js +21 -4
  32. package/dist/vue2/lib/message-input.js.map +1 -1
  33. package/dist/vue2/lib/notice.cjs +10 -1
  34. package/dist/vue2/lib/notice.cjs.map +1 -1
  35. package/dist/vue2/lib/notice.js +10 -1
  36. package/dist/vue2/lib/notice.js.map +1 -1
  37. package/dist/vue2/lib/popover.cjs +2 -1
  38. package/dist/vue2/lib/popover.cjs.map +1 -1
  39. package/dist/vue2/lib/popover.js +2 -1
  40. package/dist/vue2/lib/popover.js.map +1 -1
  41. package/dist/vue2/lib/rich-text-editor.cjs +220 -40
  42. package/dist/vue2/lib/rich-text-editor.cjs.map +1 -1
  43. package/dist/vue2/lib/rich-text-editor.js +220 -40
  44. package/dist/vue2/lib/rich-text-editor.js.map +1 -1
  45. package/dist/vue2/types/components/notice/notice.vue.d.ts +19 -0
  46. package/dist/vue2/types/components/notice/notice.vue.d.ts.map +1 -1
  47. package/dist/vue2/types/components/rich_text_editor/channel_suggestion.d.ts +15 -0
  48. package/dist/vue2/types/components/rich_text_editor/channel_suggestion.d.ts.map +1 -0
  49. package/dist/vue2/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +47 -0
  50. package/dist/vue2/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -0
  51. package/dist/vue2/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts +15 -0
  52. package/dist/vue2/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts.map +1 -0
  53. package/dist/vue2/types/components/rich_text_editor/extensions/channels/channel.d.ts +2 -0
  54. package/dist/vue2/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -0
  55. package/dist/vue2/types/components/rich_text_editor/extensions/channels/suggestion.d.ts +11 -0
  56. package/dist/vue2/types/components/rich_text_editor/extensions/channels/suggestion.d.ts.map +1 -0
  57. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +31 -0
  58. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  59. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +31 -0
  60. package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  61. package/dist/vue3/component-documentation.json +1 -1
  62. package/dist/vue3/dialtone-vue.cjs +2 -0
  63. package/dist/vue3/dialtone-vue.cjs.map +1 -1
  64. package/dist/vue3/dialtone-vue.js +2 -0
  65. package/dist/vue3/dialtone-vue.js.map +1 -1
  66. package/dist/vue3/lib/editor.cjs +2 -0
  67. package/dist/vue3/lib/editor.cjs.map +1 -1
  68. package/dist/vue3/lib/editor.js +2 -0
  69. package/dist/vue3/lib/editor.js.map +1 -1
  70. package/dist/vue3/lib/message-input.cjs +23 -3
  71. package/dist/vue3/lib/message-input.cjs.map +1 -1
  72. package/dist/vue3/lib/message-input.js +23 -3
  73. package/dist/vue3/lib/message-input.js.map +1 -1
  74. package/dist/vue3/lib/notice.cjs +10 -1
  75. package/dist/vue3/lib/notice.cjs.map +1 -1
  76. package/dist/vue3/lib/notice.js +10 -1
  77. package/dist/vue3/lib/notice.js.map +1 -1
  78. package/dist/vue3/lib/popover.cjs +2 -1
  79. package/dist/vue3/lib/popover.cjs.map +1 -1
  80. package/dist/vue3/lib/popover.js +2 -1
  81. package/dist/vue3/lib/popover.js.map +1 -1
  82. package/dist/vue3/lib/rich-text-editor.cjs +202 -17
  83. package/dist/vue3/lib/rich-text-editor.cjs.map +1 -1
  84. package/dist/vue3/lib/rich-text-editor.js +202 -17
  85. package/dist/vue3/lib/rich-text-editor.js.map +1 -1
  86. package/dist/vue3/types/components/notice/notice.vue.d.ts +19 -0
  87. package/dist/vue3/types/components/notice/notice.vue.d.ts.map +1 -1
  88. package/dist/vue3/types/components/rich_text_editor/channel_suggestion.d.ts +15 -0
  89. package/dist/vue3/types/components/rich_text_editor/channel_suggestion.d.ts.map +1 -0
  90. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +71 -0
  91. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -0
  92. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts +15 -0
  93. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts.map +1 -0
  94. package/dist/vue3/types/components/rich_text_editor/extensions/channels/channel.d.ts +2 -0
  95. package/dist/vue3/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -0
  96. package/dist/vue3/types/components/rich_text_editor/extensions/channels/suggestion.d.ts +11 -0
  97. package/dist/vue3/types/components/rich_text_editor/extensions/channels/suggestion.d.ts.map +1 -0
  98. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +31 -0
  99. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  100. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +31 -0
  101. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  102. package/package.json +55 -53
@@ -30,6 +30,8 @@ import { linkRegex, getPhoneNumberRegex } from "../common/utils.js";
30
30
  import Mention from "@tiptap/extension-mention";
31
31
  import { DtLink } from "./link.js";
32
32
  import { DtAvatar } from "./avatar.js";
33
+ import DtIconHash from "@dialpad/dialtone-icons/vue3/hash";
34
+ import DtIconLock from "@dialpad/dialtone-icons/vue3/lock";
33
35
  import "./skeleton.js";
34
36
  import "../chunks/icon_constants-Dy4MEUJL.js";
35
37
  import "@dialpad/dialtone-icons/icons.json";
@@ -42,7 +44,7 @@ import "../chunks/stack_constants-HraCekPm.js";
42
44
  import "../common/constants.js";
43
45
  import "../chunks/link_constants-nWVlXQBs.js";
44
46
  import "./presence.js";
45
- const _sfc_main$5 = {
47
+ const _sfc_main$7 = {
46
48
  name: "EmojiComponent",
47
49
  components: {
48
50
  NodeViewWrapper,
@@ -50,7 +52,7 @@ const _sfc_main$5 = {
50
52
  },
51
53
  props: nodeViewProps
52
54
  };
53
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
55
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
54
56
  const _component_dt_emoji = resolveComponent("dt-emoji");
55
57
  const _component_node_view_wrapper = resolveComponent("node-view-wrapper");
56
58
  return openBlock(), createBlock(_component_node_view_wrapper, { class: "d-d-inline-block d-va-bottom d-lh0" }, {
@@ -63,8 +65,8 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
63
65
  _: 1
64
66
  });
65
67
  }
66
- const EmojiComponent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
67
- const _sfc_main$4 = {
68
+ const EmojiComponent = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
69
+ const _sfc_main$6 = {
68
70
  name: "SuggestionList",
69
71
  components: {
70
72
  DtListItem
@@ -144,6 +146,9 @@ const _sfc_main$4 = {
144
146
  case "mention":
145
147
  this.command({ name: item.name, id: item.id, avatarSrc: item.avatarSrc });
146
148
  break;
149
+ case "channel":
150
+ this.command({ name: item.name, id: item.id });
151
+ break;
147
152
  }
148
153
  }
149
154
  }
@@ -153,7 +158,7 @@ const _hoisted_2 = {
153
158
  ref: "suggestionList",
154
159
  class: "dt-suggestion-list"
155
160
  };
156
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
161
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
157
162
  const _component_dt_list_item = resolveComponent("dt-list-item");
158
163
  return openBlock(), createElementBlock("div", _hoisted_1, [
159
164
  withDirectives(createElementVNode("ul", _hoisted_2, [
@@ -179,8 +184,8 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
179
184
  ])
180
185
  ]);
181
186
  }
182
- const SuggestionList = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
183
- const _sfc_main$3 = {
187
+ const SuggestionList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
188
+ const _sfc_main$5 = {
184
189
  name: "EmojiSuggestion",
185
190
  components: {
186
191
  DtEmoji,
@@ -193,7 +198,7 @@ const _sfc_main$3 = {
193
198
  }
194
199
  }
195
200
  };
196
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
201
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
197
202
  const _component_dt_emoji = resolveComponent("dt-emoji");
198
203
  const _component_dt_stack = resolveComponent("dt-stack");
199
204
  return openBlock(), createBlock(_component_dt_stack, {
@@ -210,7 +215,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
210
215
  _: 1
211
216
  });
212
217
  }
213
- const EmojiSuggestion = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
218
+ const EmojiSuggestion = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
214
219
  const suggestionOptions = {
215
220
  items: ({ query }) => {
216
221
  if (query.length < 2) {
@@ -585,7 +590,7 @@ const Link = Mark.create({
585
590
  ];
586
591
  }
587
592
  });
588
- const _sfc_main$2 = {
593
+ const _sfc_main$4 = {
589
594
  name: "MentionComponent",
590
595
  components: {
591
596
  NodeViewWrapper,
@@ -598,7 +603,7 @@ const _sfc_main$2 = {
598
603
  }
599
604
  }
600
605
  };
601
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
606
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
602
607
  const _component_dt_link = resolveComponent("dt-link");
603
608
  const _component_node_view_wrapper = resolveComponent("node-view-wrapper");
604
609
  return openBlock(), createBlock(_component_node_view_wrapper, { class: "d-d-inline-block" }, {
@@ -613,7 +618,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
613
618
  _: 1
614
619
  });
615
620
  }
616
- const MentionComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
621
+ const MentionComponent = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
617
622
  const MentionPlugin = Mention.extend({
618
623
  addNodeView() {
619
624
  return VueNodeViewRenderer(MentionComponent);
@@ -645,6 +650,72 @@ const MentionPlugin = Mention.extend({
645
650
  return ["mention-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
646
651
  }
647
652
  });
653
+ const _sfc_main$3 = {
654
+ name: "ChannelComponent",
655
+ components: {
656
+ NodeViewWrapper,
657
+ DtLink
658
+ },
659
+ props: nodeViewProps,
660
+ computed: {
661
+ text() {
662
+ return "#" + this.$props.node.attrs.name;
663
+ }
664
+ }
665
+ };
666
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
667
+ const _component_dt_link = resolveComponent("dt-link");
668
+ const _component_node_view_wrapper = resolveComponent("node-view-wrapper");
669
+ return openBlock(), createBlock(_component_node_view_wrapper, { class: "d-d-inline-block" }, {
670
+ default: withCtx(() => [
671
+ createVNode(_component_dt_link, { kind: "mention" }, {
672
+ default: withCtx(() => [
673
+ createTextVNode(toDisplayString($options.text), 1)
674
+ ]),
675
+ _: 1
676
+ })
677
+ ]),
678
+ _: 1
679
+ });
680
+ }
681
+ const ChannelComponent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
682
+ const ChannelPlugin = Mention.extend({
683
+ name: "channel",
684
+ addNodeView() {
685
+ return VueNodeViewRenderer(ChannelComponent);
686
+ },
687
+ parseHTML() {
688
+ return [
689
+ {
690
+ tag: "channel-component"
691
+ }
692
+ ];
693
+ },
694
+ addAttributes() {
695
+ return {
696
+ name: {
697
+ default: ""
698
+ },
699
+ id: {
700
+ default: ""
701
+ },
702
+ locked: {
703
+ default: false
704
+ }
705
+ };
706
+ },
707
+ renderText({ node }) {
708
+ return `#${node.attrs.id}`;
709
+ },
710
+ renderHTML({ HTMLAttributes }) {
711
+ return ["channel-component", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
712
+ }
713
+ }).configure({
714
+ suggestion: {
715
+ char: "#",
716
+ pluginKey: new PluginKey("channelSuggestion")
717
+ }
718
+ });
648
719
  const RICH_TEXT_EDITOR_OUTPUT_FORMATS = [
649
720
  "text",
650
721
  "json",
@@ -663,7 +734,7 @@ const RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS = [
663
734
  "sftp",
664
735
  "mailto"
665
736
  ];
666
- const _sfc_main$1 = {
737
+ const _sfc_main$2 = {
667
738
  name: "MentionSuggestion",
668
739
  components: {
669
740
  DtAvatar,
@@ -684,7 +755,7 @@ const _sfc_main$1 = {
684
755
  }
685
756
  }
686
757
  };
687
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
758
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
688
759
  const _component_dt_avatar = resolveComponent("dt-avatar");
689
760
  const _component_dt_stack = resolveComponent("dt-stack");
690
761
  return openBlock(), createBlock(_component_dt_stack, {
@@ -703,8 +774,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
703
774
  _: 1
704
775
  });
705
776
  }
706
- const MentionSuggestion = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
707
- const suggestion = {
777
+ const MentionSuggestion = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
778
+ const mentionSuggestion = {
708
779
  // This function comes from the user and passed to the editor directly.
709
780
  // This will also activate the mention plugin on the editor
710
781
  // items: ({ query }) => { return [] },
@@ -758,6 +829,101 @@ const suggestion = {
758
829
  };
759
830
  }
760
831
  };
832
+ const _sfc_main$1 = {
833
+ name: "ChannelSuggestion",
834
+ components: {
835
+ DtStack,
836
+ DtIconHash,
837
+ DtIconLock
838
+ },
839
+ props: {
840
+ item: {
841
+ type: Object,
842
+ required: true
843
+ }
844
+ },
845
+ computed: {
846
+ name() {
847
+ return this.item.name;
848
+ }
849
+ }
850
+ };
851
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
852
+ const _component_dt_icon_hash = resolveComponent("dt-icon-hash");
853
+ const _component_dt_icon_lock = resolveComponent("dt-icon-lock");
854
+ const _component_dt_stack = resolveComponent("dt-stack");
855
+ return openBlock(), createBlock(_component_dt_stack, {
856
+ direction: "row",
857
+ gap: "400"
858
+ }, {
859
+ default: withCtx(() => [
860
+ !$props.item.locked ? (openBlock(), createBlock(_component_dt_icon_hash, {
861
+ key: 0,
862
+ size: "300"
863
+ })) : (openBlock(), createBlock(_component_dt_icon_lock, {
864
+ key: 1,
865
+ size: "300"
866
+ })),
867
+ createElementVNode("span", null, toDisplayString($options.name), 1)
868
+ ]),
869
+ _: 1
870
+ });
871
+ }
872
+ const ChannelSuggestion = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
873
+ const channelSuggestion = {
874
+ // This function comes from the user and passed to the editor directly.
875
+ // This will also activate the mention plugin on the editor
876
+ // items: ({ query }) => { return [] },
877
+ allowSpaces: true,
878
+ render: () => {
879
+ let component;
880
+ let popup;
881
+ return {
882
+ onStart: (props) => {
883
+ component = new VueRenderer(SuggestionList, {
884
+ props: {
885
+ itemComponent: markRaw(ChannelSuggestion),
886
+ itemType: "channel",
887
+ ...props
888
+ },
889
+ editor: props.editor
890
+ });
891
+ if (!props.clientRect) {
892
+ return;
893
+ }
894
+ popup = tippy("body", {
895
+ getReferenceClientRect: props.clientRect,
896
+ appendTo: () => document.body,
897
+ content: component.element,
898
+ showOnCreate: true,
899
+ interactive: true,
900
+ trigger: "manual",
901
+ placement: "top-start"
902
+ });
903
+ },
904
+ onUpdate(props) {
905
+ component.updateProps(props);
906
+ if (!props.clientRect) {
907
+ return;
908
+ }
909
+ popup[0].setProps({
910
+ getReferenceClientRect: props.clientRect
911
+ });
912
+ },
913
+ onKeyDown(props) {
914
+ if (props.event.key === "Escape") {
915
+ popup[0].hide();
916
+ return true;
917
+ }
918
+ return component == null ? void 0 : component.ref.onKeyDown(props);
919
+ },
920
+ onExit() {
921
+ popup[0].destroy();
922
+ component.destroy();
923
+ }
924
+ };
925
+ }
926
+ };
761
927
  const _sfc_main = {
762
928
  name: "DtRichTextEditor",
763
929
  components: {
@@ -865,6 +1031,21 @@ const _sfc_main = {
865
1031
  type: Object,
866
1032
  default: null
867
1033
  },
1034
+ /**
1035
+ * suggestion object containing the items query function.
1036
+ * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
1037
+ *
1038
+ * The only required key is the items function which is used to query the channels for suggestion.
1039
+ * items({ query }) => { return [ChannelObject]; }
1040
+ * ChannelObject format:
1041
+ * { name: string, id: string, locked: boolean }
1042
+ *
1043
+ * When null, it does not add the plugin. Setting locked to true will display a lock rather than hash.
1044
+ */
1045
+ channelSuggestion: {
1046
+ type: Object,
1047
+ default: null
1048
+ },
868
1049
  /**
869
1050
  * Whether the input allows for block quote.
870
1051
  */
@@ -994,9 +1175,13 @@ const _sfc_main = {
994
1175
  protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
995
1176
  }));
996
1177
  if (this.mentionSuggestion) {
997
- const suggestionObject = { ...this.mentionSuggestion, ...suggestion };
1178
+ const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
998
1179
  extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
999
1180
  }
1181
+ if (this.channelSuggestion) {
1182
+ const suggestionObject = { ...this.channelSuggestion, ...channelSuggestion };
1183
+ extensions.push(ChannelPlugin.configure({ suggestion: suggestionObject }));
1184
+ }
1000
1185
  extensions.push(Emoji);
1001
1186
  extensions.push(TextAlign.configure({
1002
1187
  types: ["paragraph"],