@dialpad/dialtone-vue 2.127.1 → 2.128.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 (45) hide show
  1. package/dist/chunks/{index-DUr1xHR0.js → index-eJ-WWRdf.js} +2 -2
  2. package/dist/chunks/{index-DUr1xHR0.js.map → index-eJ-WWRdf.js.map} +1 -1
  3. package/dist/chunks/{index-IA-Z8fgm.js → index-gj1jEXP4.js} +2 -2
  4. package/dist/chunks/{index-IA-Z8fgm.js.map → index-gj1jEXP4.js.map} +1 -1
  5. package/dist/dialtone-vue.cjs +3 -1
  6. package/dist/dialtone-vue.cjs.map +1 -1
  7. package/dist/dialtone-vue.js +3 -1
  8. package/dist/dialtone-vue.js.map +1 -1
  9. package/dist/lib/combobox-multi-select.cjs +1 -1
  10. package/dist/lib/combobox-multi-select.js +1 -1
  11. package/dist/lib/combobox-with-popover.cjs +1 -1
  12. package/dist/lib/combobox-with-popover.js +1 -1
  13. package/dist/lib/combobox.cjs +1 -1
  14. package/dist/lib/combobox.js +1 -1
  15. package/dist/lib/editor.cjs +2 -0
  16. package/dist/lib/editor.cjs.map +1 -1
  17. package/dist/lib/editor.js +2 -0
  18. package/dist/lib/editor.js.map +1 -1
  19. package/dist/lib/message-input.cjs +21 -4
  20. package/dist/lib/message-input.cjs.map +1 -1
  21. package/dist/lib/message-input.js +21 -4
  22. package/dist/lib/message-input.js.map +1 -1
  23. package/dist/lib/popover.cjs +2 -1
  24. package/dist/lib/popover.cjs.map +1 -1
  25. package/dist/lib/popover.js +2 -1
  26. package/dist/lib/popover.js.map +1 -1
  27. package/dist/lib/rich-text-editor.cjs +220 -40
  28. package/dist/lib/rich-text-editor.cjs.map +1 -1
  29. package/dist/lib/rich-text-editor.js +220 -40
  30. package/dist/lib/rich-text-editor.js.map +1 -1
  31. package/dist/types/components/rich_text_editor/channel_suggestion.d.ts +15 -0
  32. package/dist/types/components/rich_text_editor/channel_suggestion.d.ts.map +1 -0
  33. package/dist/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +47 -0
  34. package/dist/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -0
  35. package/dist/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts +15 -0
  36. package/dist/types/components/rich_text_editor/extensions/channels/ChannelSuggestion.vue.d.ts.map +1 -0
  37. package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts +2 -0
  38. package/dist/types/components/rich_text_editor/extensions/channels/channel.d.ts.map +1 -0
  39. package/dist/types/components/rich_text_editor/extensions/channels/suggestion.d.ts +11 -0
  40. package/dist/types/components/rich_text_editor/extensions/channels/suggestion.d.ts.map +1 -0
  41. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +31 -0
  42. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  43. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +31 -0
  44. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  45. package/package.json +2 -2
@@ -31,6 +31,8 @@ const common_utils = require("../common/utils.cjs");
31
31
  const Mention = require("@tiptap/extension-mention");
32
32
  const lib_link = require("./link.cjs");
33
33
  const lib_avatar = require("./avatar.cjs");
34
+ const DtIconHash = require("@dialpad/dialtone-icons/vue2/hash");
35
+ const DtIconLock = require("@dialpad/dialtone-icons/vue2/lock");
34
36
  require("./skeleton.cjs");
35
37
  require("../chunks/icon_constants-QYpmdE0R.js");
36
38
  require("@dialpad/dialtone-icons/icons.json");
@@ -45,7 +47,7 @@ require("../common/constants.cjs");
45
47
  require("vue");
46
48
  require("../chunks/link_constants-Huj7D_hm.js");
47
49
  require("./presence.cjs");
48
- const _sfc_main$5 = {
50
+ const _sfc_main$7 = {
49
51
  name: "EmojiComponent",
50
52
  components: {
51
53
  NodeViewWrapper: vue2.NodeViewWrapper,
@@ -53,23 +55,23 @@ const _sfc_main$5 = {
53
55
  },
54
56
  props: vue2.nodeViewProps
55
57
  };
56
- var _sfc_render$5 = function render() {
58
+ var _sfc_render$7 = function render() {
57
59
  var _vm = this, _c = _vm._self._c;
58
60
  return _c("node-view-wrapper", { staticClass: "d-d-inline-block d-va-bottom d-lh0" }, [_c("dt-emoji", { attrs: { "size": "500", "code": _vm.node.attrs.code } })], 1);
59
61
  };
60
- var _sfc_staticRenderFns$5 = [];
61
- var __component__$5 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
62
- _sfc_main$5,
63
- _sfc_render$5,
64
- _sfc_staticRenderFns$5,
62
+ var _sfc_staticRenderFns$7 = [];
63
+ var __component__$7 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
64
+ _sfc_main$7,
65
+ _sfc_render$7,
66
+ _sfc_staticRenderFns$7,
65
67
  false,
66
68
  null,
67
69
  null,
68
70
  null,
69
71
  null
70
72
  );
71
- const EmojiComponent = __component__$5.exports;
72
- const _sfc_main$4 = {
73
+ const EmojiComponent = __component__$7.exports;
74
+ const _sfc_main$6 = {
73
75
  name: "SuggestionList",
74
76
  components: {
75
77
  DtListItem: lib_listItem.DtListItem
@@ -149,11 +151,14 @@ const _sfc_main$4 = {
149
151
  case "mention":
150
152
  this.command({ name: item.name, id: item.id, avatarSrc: item.avatarSrc });
151
153
  break;
154
+ case "channel":
155
+ this.command({ name: item.name, id: item.id });
156
+ break;
152
157
  }
153
158
  }
154
159
  }
155
160
  };
156
- var _sfc_render$4 = function render2() {
161
+ var _sfc_render$6 = function render2() {
157
162
  var _vm = this, _c = _vm._self._c;
158
163
  return _c("div", { staticClass: "d-popover__dialog" }, [_c("ul", { directives: [{ name: "show", rawName: "v-show", value: _vm.items.length, expression: "items.length" }], ref: "suggestionList", staticClass: "dt-suggestion-list" }, _vm._l(_vm.items, function(item, index) {
159
164
  return _c("dt-list-item", { key: item.id, class: [
@@ -168,19 +173,19 @@ var _sfc_render$4 = function render2() {
168
173
  } } }, [_c(_vm.itemComponent, { tag: "component", attrs: { "item": item } })], 1);
169
174
  }), 1)]);
170
175
  };
171
- var _sfc_staticRenderFns$4 = [];
172
- var __component__$4 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
173
- _sfc_main$4,
174
- _sfc_render$4,
175
- _sfc_staticRenderFns$4,
176
+ var _sfc_staticRenderFns$6 = [];
177
+ var __component__$6 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
178
+ _sfc_main$6,
179
+ _sfc_render$6,
180
+ _sfc_staticRenderFns$6,
176
181
  false,
177
182
  null,
178
183
  null,
179
184
  null,
180
185
  null
181
186
  );
182
- const SuggestionList = __component__$4.exports;
183
- const _sfc_main$3 = {
187
+ const SuggestionList = __component__$6.exports;
188
+ const _sfc_main$5 = {
184
189
  name: "EmojiSuggestion",
185
190
  components: {
186
191
  DtEmoji: lib_emoji.DtEmoji,
@@ -193,22 +198,22 @@ const _sfc_main$3 = {
193
198
  }
194
199
  }
195
200
  };
196
- var _sfc_render$3 = function render3() {
201
+ var _sfc_render$5 = function render3() {
197
202
  var _vm = this, _c = _vm._self._c;
198
203
  return _c("dt-stack", { attrs: { "direction": "row", "gap": "400" } }, [_c("dt-emoji", { attrs: { "size": "200", "code": _vm.item.code } }), _vm._v(" " + _vm._s(_vm.item.code) + " ")], 1);
199
204
  };
200
- var _sfc_staticRenderFns$3 = [];
201
- var __component__$3 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
202
- _sfc_main$3,
203
- _sfc_render$3,
204
- _sfc_staticRenderFns$3,
205
+ var _sfc_staticRenderFns$5 = [];
206
+ var __component__$5 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
207
+ _sfc_main$5,
208
+ _sfc_render$5,
209
+ _sfc_staticRenderFns$5,
205
210
  false,
206
211
  null,
207
212
  null,
208
213
  null,
209
214
  null
210
215
  );
211
- const EmojiSuggestion = __component__$3.exports;
216
+ const EmojiSuggestion = __component__$5.exports;
212
217
  const suggestionOptions = {
213
218
  items: ({ query }) => {
214
219
  if (query.length < 2) {
@@ -584,7 +589,7 @@ const Link = core.Mark.create({
584
589
  ];
585
590
  }
586
591
  });
587
- const _sfc_main$2 = {
592
+ const _sfc_main$4 = {
588
593
  name: "MentionComponent",
589
594
  components: {
590
595
  NodeViewWrapper: vue2.NodeViewWrapper,
@@ -597,22 +602,22 @@ const _sfc_main$2 = {
597
602
  }
598
603
  }
599
604
  };
600
- var _sfc_render$2 = function render4() {
605
+ var _sfc_render$4 = function render4() {
601
606
  var _vm = this, _c = _vm._self._c;
602
607
  return _c("node-view-wrapper", { staticClass: "d-d-inline-block" }, [_c("dt-link", { attrs: { "kind": "mention" } }, [_vm._v(" " + _vm._s(_vm.text) + " ")])], 1);
603
608
  };
604
- var _sfc_staticRenderFns$2 = [];
605
- var __component__$2 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
606
- _sfc_main$2,
607
- _sfc_render$2,
608
- _sfc_staticRenderFns$2,
609
+ var _sfc_staticRenderFns$4 = [];
610
+ var __component__$4 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
611
+ _sfc_main$4,
612
+ _sfc_render$4,
613
+ _sfc_staticRenderFns$4,
609
614
  false,
610
615
  null,
611
616
  null,
612
617
  null,
613
618
  null
614
619
  );
615
- const MentionComponent = __component__$2.exports;
620
+ const MentionComponent = __component__$4.exports;
616
621
  const MentionPlugin = Mention.extend({
617
622
  addNodeView() {
618
623
  return vue2.VueNodeViewRenderer(MentionComponent);
@@ -644,6 +649,72 @@ const MentionPlugin = Mention.extend({
644
649
  return ["mention-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
645
650
  }
646
651
  });
652
+ const _sfc_main$3 = {
653
+ name: "ChannelComponent",
654
+ components: {
655
+ NodeViewWrapper: vue2.NodeViewWrapper,
656
+ DtLink: lib_link.DtLink
657
+ },
658
+ props: vue2.nodeViewProps,
659
+ computed: {
660
+ text() {
661
+ return "#" + this.$props.node.attrs.name;
662
+ }
663
+ }
664
+ };
665
+ var _sfc_render$3 = function render5() {
666
+ var _vm = this, _c = _vm._self._c;
667
+ return _c("node-view-wrapper", { staticClass: "d-d-inline-block" }, [_c("dt-link", { attrs: { "kind": "mention" } }, [_vm._v(" " + _vm._s(_vm.text) + " ")])], 1);
668
+ };
669
+ var _sfc_staticRenderFns$3 = [];
670
+ var __component__$3 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
671
+ _sfc_main$3,
672
+ _sfc_render$3,
673
+ _sfc_staticRenderFns$3,
674
+ false,
675
+ null,
676
+ null,
677
+ null,
678
+ null
679
+ );
680
+ const ChannelComponent = __component__$3.exports;
681
+ const ChannelPlugin = Mention.extend({
682
+ name: "channel",
683
+ addNodeView() {
684
+ return vue2.VueNodeViewRenderer(ChannelComponent);
685
+ },
686
+ parseHTML() {
687
+ return [
688
+ {
689
+ tag: "channel-component"
690
+ }
691
+ ];
692
+ },
693
+ addAttributes() {
694
+ return {
695
+ name: {
696
+ default: ""
697
+ },
698
+ id: {
699
+ default: ""
700
+ },
701
+ locked: {
702
+ default: false
703
+ }
704
+ };
705
+ },
706
+ renderText({ node }) {
707
+ return `#${node.attrs.id}`;
708
+ },
709
+ renderHTML({ HTMLAttributes }) {
710
+ return ["channel-component", core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
711
+ }
712
+ }).configure({
713
+ suggestion: {
714
+ char: "#",
715
+ pluginKey: new state.PluginKey("channelSuggestion")
716
+ }
717
+ });
647
718
  const RICH_TEXT_EDITOR_OUTPUT_FORMATS = [
648
719
  "text",
649
720
  "json",
@@ -662,7 +733,7 @@ const RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS = [
662
733
  "sftp",
663
734
  "mailto"
664
735
  ];
665
- const _sfc_main$1 = {
736
+ const _sfc_main$2 = {
666
737
  name: "MentionSuggestion",
667
738
  components: {
668
739
  DtAvatar: lib_avatar.DtAvatar,
@@ -683,10 +754,100 @@ const _sfc_main$1 = {
683
754
  }
684
755
  }
685
756
  };
686
- var _sfc_render$1 = function render5() {
757
+ var _sfc_render$2 = function render6() {
687
758
  var _vm = this, _c = _vm._self._c;
688
759
  return _c("dt-stack", { attrs: { "direction": "row", "gap": "400" } }, [_c("dt-avatar", { attrs: { "full-name": _vm.name, "image-src": _vm.avatarSrc, "image-alt": _vm.name, "size": "xs" } }), _vm._v(" " + _vm._s(_vm.name) + " ")], 1);
689
760
  };
761
+ var _sfc_staticRenderFns$2 = [];
762
+ var __component__$2 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
763
+ _sfc_main$2,
764
+ _sfc_render$2,
765
+ _sfc_staticRenderFns$2,
766
+ false,
767
+ null,
768
+ null,
769
+ null,
770
+ null
771
+ );
772
+ const MentionSuggestion = __component__$2.exports;
773
+ const mentionSuggestion = {
774
+ // This function comes from the user and passed to the editor directly.
775
+ // This will also activate the mention plugin on the editor
776
+ // items: ({ query }) => { return [] },
777
+ allowSpaces: true,
778
+ render: () => {
779
+ let component;
780
+ let popup;
781
+ return {
782
+ onStart: (props) => {
783
+ component = new vue2.VueRenderer(SuggestionList, {
784
+ parent: void 0,
785
+ propsData: {
786
+ itemComponent: MentionSuggestion,
787
+ itemType: "mention",
788
+ ...props
789
+ },
790
+ editor: props.editor
791
+ });
792
+ if (!props.clientRect) {
793
+ return;
794
+ }
795
+ popup = tippy("body", {
796
+ getReferenceClientRect: props.clientRect,
797
+ appendTo: () => document.body,
798
+ content: component.element,
799
+ showOnCreate: true,
800
+ interactive: true,
801
+ trigger: "manual",
802
+ placement: "top-start"
803
+ });
804
+ },
805
+ onUpdate(props) {
806
+ component.updateProps(props);
807
+ if (!props.clientRect) {
808
+ return;
809
+ }
810
+ popup[0].setProps({
811
+ getReferenceClientRect: props.clientRect
812
+ });
813
+ },
814
+ onKeyDown(props) {
815
+ if (props.event.key === "Escape") {
816
+ popup[0].hide();
817
+ return true;
818
+ }
819
+ return component == null ? void 0 : component.ref.onKeyDown(props);
820
+ },
821
+ onExit() {
822
+ popup[0].destroy();
823
+ component.destroy();
824
+ }
825
+ };
826
+ }
827
+ };
828
+ const _sfc_main$1 = {
829
+ name: "ChannelSuggestion",
830
+ components: {
831
+ DtStack: lib_stack.DtStack,
832
+ DtIconHash,
833
+ DtIconLock
834
+ },
835
+ props: {
836
+ item: {
837
+ type: Object,
838
+ required: true
839
+ }
840
+ },
841
+ computed: {
842
+ name() {
843
+ return this.item.name;
844
+ }
845
+ }
846
+ };
847
+ var _sfc_render$1 = function render7() {
848
+ var _vm = this, _c = _vm._self._c;
849
+ return _c("dt-stack", { attrs: { "direction": "row", "gap": "400" } }, [!_vm.item.locked ? _c("dt-icon-hash", { attrs: { "size": "300" } }) : _c("dt-icon-lock", { attrs: { "size": "300" } }), _c("span", [_vm._v(_vm._s(_vm.name))])], 1);
850
+ };
690
851
  var _sfc_staticRenderFns$1 = [];
691
852
  var __component__$1 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
692
853
  _sfc_main$1,
@@ -698,8 +859,8 @@ var __component__$1 = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
698
859
  null,
699
860
  null
700
861
  );
701
- const MentionSuggestion = __component__$1.exports;
702
- const suggestion = {
862
+ const ChannelSuggestion = __component__$1.exports;
863
+ const channelSuggestion = {
703
864
  // This function comes from the user and passed to the editor directly.
704
865
  // This will also activate the mention plugin on the editor
705
866
  // items: ({ query }) => { return [] },
@@ -712,8 +873,8 @@ const suggestion = {
712
873
  component = new vue2.VueRenderer(SuggestionList, {
713
874
  parent: void 0,
714
875
  propsData: {
715
- itemComponent: MentionSuggestion,
716
- itemType: "mention",
876
+ itemComponent: ChannelSuggestion,
877
+ itemType: "channel",
717
878
  ...props
718
879
  },
719
880
  editor: props.editor
@@ -861,6 +1022,21 @@ const _sfc_main = {
861
1022
  type: Object,
862
1023
  default: null
863
1024
  },
1025
+ /**
1026
+ * suggestion object containing the items query function.
1027
+ * The valid keys passed into this object can be found here: https://tiptap.dev/api/utilities/suggestion
1028
+ *
1029
+ * The only required key is the items function which is used to query the channels for suggestion.
1030
+ * items({ query }) => { return [ChannelObject]; }
1031
+ * ChannelObject format:
1032
+ * { name: string, id: string, locked: boolean }
1033
+ *
1034
+ * When null, it does not add the plugin. Setting locked to true will display a lock rather than hash.
1035
+ */
1036
+ channelSuggestion: {
1037
+ type: Object,
1038
+ default: null
1039
+ },
864
1040
  /**
865
1041
  * Whether the input allows for block quote.
866
1042
  */
@@ -990,9 +1166,13 @@ const _sfc_main = {
990
1166
  protocols: RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS
991
1167
  }));
992
1168
  if (this.mentionSuggestion) {
993
- const suggestionObject = { ...this.mentionSuggestion, ...suggestion };
1169
+ const suggestionObject = { ...this.mentionSuggestion, ...mentionSuggestion };
994
1170
  extensions.push(MentionPlugin.configure({ suggestion: suggestionObject }));
995
1171
  }
1172
+ if (this.channelSuggestion) {
1173
+ const suggestionObject = { ...this.channelSuggestion, ...channelSuggestion };
1174
+ extensions.push(ChannelPlugin.configure({ suggestion: suggestionObject }));
1175
+ }
996
1176
  extensions.push(Emoji);
997
1177
  extensions.push(TextAlign.configure({
998
1178
  types: ["paragraph"],
@@ -1117,7 +1297,7 @@ const _sfc_main = {
1117
1297
  }
1118
1298
  }
1119
1299
  };
1120
- var _sfc_render = function render6() {
1300
+ var _sfc_render = function render8() {
1121
1301
  var _vm = this, _c = _vm._self._c;
1122
1302
  return _c("editor-content", { staticClass: "dt-rich-text-editor", attrs: { "editor": _vm.editor, "data-qa": "dt-rich-text-editor" } });
1123
1303
  };