@dialpad/dialtone-vue 3.135.2 → 3.136.1

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 (34) hide show
  1. package/dist/dialtone-vue.cjs +2 -0
  2. package/dist/dialtone-vue.cjs.map +1 -1
  3. package/dist/dialtone-vue.js +2 -0
  4. package/dist/dialtone-vue.js.map +1 -1
  5. package/dist/lib/message-input.cjs +14 -24
  6. package/dist/lib/message-input.cjs.map +1 -1
  7. package/dist/lib/message-input.js +15 -25
  8. package/dist/lib/message-input.js.map +1 -1
  9. package/dist/lib/rich-text-editor.cjs +154 -57
  10. package/dist/lib/rich-text-editor.cjs.map +1 -1
  11. package/dist/lib/rich-text-editor.js +154 -57
  12. package/dist/lib/rich-text-editor.js.map +1 -1
  13. package/dist/lib/scrollbar-directive.cjs +2407 -0
  14. package/dist/lib/scrollbar-directive.cjs.map +1 -0
  15. package/dist/lib/scrollbar-directive.js +2407 -0
  16. package/dist/lib/scrollbar-directive.js.map +1 -0
  17. package/dist/style.css +648 -4
  18. package/dist/types/components/rich_text_editor/extensions/channels/suggestion.d.ts.map +1 -1
  19. package/dist/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
  20. package/dist/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
  21. package/dist/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts.map +1 -1
  22. package/dist/types/components/rich_text_editor/extensions/suggestion/SuggestionList.vue.d.ts +1 -1
  23. package/dist/types/components/rich_text_editor/extensions/tippy_plugins/hide_on_esc.d.ts +12 -0
  24. package/dist/types/components/rich_text_editor/extensions/tippy_plugins/hide_on_esc.d.ts.map +1 -0
  25. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +2 -1
  26. package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  27. package/dist/types/directives/scrollbar/index.d.ts +2 -0
  28. package/dist/types/directives/scrollbar/index.d.ts.map +1 -0
  29. package/dist/types/directives/scrollbar/scrollbar.d.ts +6 -0
  30. package/dist/types/directives/scrollbar/scrollbar.d.ts.map +1 -0
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +0 -3
  33. package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  34. package/package.json +5 -4
@@ -112,9 +112,7 @@ const _sfc_main$8 = {
112
112
  return true;
113
113
  }
114
114
  if (event.key === "Enter" || event.key === "Tab") {
115
- event.preventDefault();
116
115
  this.selectHandler();
117
- event.stopPropagation();
118
116
  return true;
119
117
  }
120
118
  return false;
@@ -127,7 +125,8 @@ const _sfc_main$8 = {
127
125
  this.selectedIndex = (this.selectedIndex + 1) % this.items.length;
128
126
  this.scrollActiveElementIntoView();
129
127
  },
130
- scrollActiveElementIntoView() {
128
+ async scrollActiveElementIntoView() {
129
+ await this.$nextTick();
131
130
  const activeElement = this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");
132
131
  if (activeElement) {
133
132
  activeElement.scrollIntoView({
@@ -158,7 +157,7 @@ const _sfc_main$8 = {
158
157
  }
159
158
  }
160
159
  };
161
- const _hoisted_1$1 = { class: "d-popover__dialog" };
160
+ const _hoisted_1$1 = { class: "d-popover__dialog dt-suggestion-list__container" };
162
161
  const _hoisted_2$1 = {
163
162
  ref: "suggestionList",
164
163
  class: "dt-suggestion-list"
@@ -176,7 +175,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
176
175
  ]),
177
176
  "navigation-type": "arrow-keys",
178
177
  onClick: ($event) => $options.selectItem(index),
179
- onKeydown: vue.withModifiers($options.onKeyDown, ["prevent", "stop"])
178
+ onKeydown: vue.withModifiers($options.onKeyDown, ["prevent"])
180
179
  }, {
181
180
  default: vue.withCtx(() => [
182
181
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent($props.itemComponent), { item }, null, 8, ["item"]))
@@ -221,6 +220,25 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
221
220
  });
222
221
  }
223
222
  const EmojiSuggestion = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
223
+ const hideOnEsc = {
224
+ name: "hideOnEsc",
225
+ defaultValue: true,
226
+ fn({ hide }) {
227
+ function onKeyDown(event) {
228
+ if (event.keyCode === 27) {
229
+ hide();
230
+ }
231
+ }
232
+ return {
233
+ onShow() {
234
+ document.addEventListener("keydown", onKeyDown);
235
+ },
236
+ onHide() {
237
+ document.removeEventListener("keydown", onKeyDown);
238
+ }
239
+ };
240
+ }
241
+ };
224
242
  const suggestionOptions = {
225
243
  items: ({ query }) => {
226
244
  if (query.length < 2) {
@@ -259,6 +277,7 @@ const suggestionOptions = {
259
277
  render: () => {
260
278
  let component;
261
279
  let popup;
280
+ let popupIsOpen = false;
262
281
  return {
263
282
  onStart: (props) => {
264
283
  component = new vue3.VueRenderer(SuggestionList, {
@@ -276,33 +295,45 @@ const suggestionOptions = {
276
295
  getReferenceClientRect: props.clientRect,
277
296
  appendTo: () => document.body,
278
297
  content: component.element,
279
- showOnCreate: true,
298
+ showOnCreate: false,
299
+ onShow: () => {
300
+ popupIsOpen = true;
301
+ },
302
+ onHidden: () => {
303
+ popupIsOpen = false;
304
+ },
280
305
  interactive: true,
281
306
  trigger: "manual",
282
307
  placement: "top-start",
283
- zIndex: 650
308
+ zIndex: 650,
309
+ plugins: [hideOnEsc]
284
310
  });
311
+ if (props.items.length > 0) {
312
+ popup == null ? void 0 : popup[0].show();
313
+ }
285
314
  },
286
315
  onUpdate(props) {
287
- component.updateProps(props);
288
- if (!props.clientRect) {
289
- return;
316
+ component == null ? void 0 : component.updateProps(props);
317
+ if (props.items.length > 0) {
318
+ popup == null ? void 0 : popup[0].show();
319
+ } else {
320
+ popup == null ? void 0 : popup[0].hide();
290
321
  }
291
- popup[0].setProps({
322
+ popup == null ? void 0 : popup[0].setProps({
292
323
  getReferenceClientRect: props.clientRect
293
324
  });
294
325
  },
295
326
  onKeyDown(props) {
296
327
  var _a;
297
- if (props.event.key === "Escape") {
298
- popup[0].hide();
299
- return true;
328
+ if (popupIsOpen) {
329
+ return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
300
330
  }
301
- return (_a = component.ref) == null ? void 0 : _a.onKeyDown(props);
302
331
  },
303
332
  onExit() {
304
- popup[0].destroy();
305
- component.destroy();
333
+ popup == null ? void 0 : popup[0].destroy();
334
+ popup = null;
335
+ component == null ? void 0 : component.destroy();
336
+ component = null;
306
337
  }
307
338
  };
308
339
  }
@@ -897,6 +928,7 @@ const mentionSuggestion = {
897
928
  render: () => {
898
929
  let component;
899
930
  let popup;
931
+ let popupIsOpen = false;
900
932
  return {
901
933
  onStart: (props) => {
902
934
  component = new vue3.VueRenderer(SuggestionList, {
@@ -914,31 +946,48 @@ const mentionSuggestion = {
914
946
  getReferenceClientRect: props.clientRect,
915
947
  appendTo: () => document.body,
916
948
  content: component.element,
917
- showOnCreate: true,
949
+ showOnCreate: false,
950
+ onShow: () => {
951
+ popupIsOpen = true;
952
+ },
953
+ onHidden: () => {
954
+ popupIsOpen = false;
955
+ },
918
956
  interactive: true,
919
957
  trigger: "manual",
920
- placement: "top-start"
958
+ placement: "top-start",
959
+ zIndex: 650,
960
+ plugins: [hideOnEsc]
921
961
  });
962
+ if (props.items.length > 0) {
963
+ popup == null ? void 0 : popup[0].show();
964
+ }
922
965
  },
923
966
  onUpdate(props) {
924
- component.updateProps(props);
967
+ component == null ? void 0 : component.updateProps(props);
968
+ if (props.items.length > 0) {
969
+ popup == null ? void 0 : popup[0].show();
970
+ } else {
971
+ popup == null ? void 0 : popup[0].hide();
972
+ }
925
973
  if (!props.clientRect) {
926
974
  return;
927
975
  }
928
- popup[0].setProps({
976
+ popup == null ? void 0 : popup[0].setProps({
929
977
  getReferenceClientRect: props.clientRect
930
978
  });
931
979
  },
932
980
  onKeyDown(props) {
933
- if (props.event.key === "Escape") {
934
- popup[0].hide();
935
- return true;
981
+ var _a;
982
+ if (popupIsOpen) {
983
+ return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
936
984
  }
937
- return component == null ? void 0 : component.ref.onKeyDown(props);
938
985
  },
939
986
  onExit() {
940
- popup[0].destroy();
941
- component.destroy();
987
+ popup == null ? void 0 : popup[0].destroy();
988
+ popup = null;
989
+ component == null ? void 0 : component.destroy();
990
+ component = null;
942
991
  }
943
992
  };
944
993
  }
@@ -992,6 +1041,7 @@ const channelSuggestion = {
992
1041
  render: () => {
993
1042
  let component;
994
1043
  let popup;
1044
+ let popupIsOpen = false;
995
1045
  return {
996
1046
  onStart: (props) => {
997
1047
  component = new vue3.VueRenderer(SuggestionList, {
@@ -1009,31 +1059,48 @@ const channelSuggestion = {
1009
1059
  getReferenceClientRect: props.clientRect,
1010
1060
  appendTo: () => document.body,
1011
1061
  content: component.element,
1012
- showOnCreate: true,
1062
+ showOnCreate: false,
1063
+ onShow: () => {
1064
+ popupIsOpen = true;
1065
+ },
1066
+ onHidden: () => {
1067
+ popupIsOpen = false;
1068
+ },
1013
1069
  interactive: true,
1014
1070
  trigger: "manual",
1015
- placement: "top-start"
1071
+ placement: "top-start",
1072
+ zIndex: 650,
1073
+ plugins: [hideOnEsc]
1016
1074
  });
1075
+ if (props.items.length > 0) {
1076
+ popup == null ? void 0 : popup[0].show();
1077
+ }
1017
1078
  },
1018
1079
  onUpdate(props) {
1019
- component.updateProps(props);
1080
+ component == null ? void 0 : component.updateProps(props);
1081
+ if (props.items.length > 0) {
1082
+ popup == null ? void 0 : popup[0].show();
1083
+ } else {
1084
+ popup == null ? void 0 : popup[0].hide();
1085
+ }
1020
1086
  if (!props.clientRect) {
1021
1087
  return;
1022
1088
  }
1023
- popup[0].setProps({
1089
+ popup == null ? void 0 : popup[0].setProps({
1024
1090
  getReferenceClientRect: props.clientRect
1025
1091
  });
1026
1092
  },
1027
1093
  onKeyDown(props) {
1028
- if (props.event.key === "Escape") {
1029
- popup[0].hide();
1030
- return true;
1094
+ var _a;
1095
+ if (popupIsOpen) {
1096
+ return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
1031
1097
  }
1032
- return component == null ? void 0 : component.ref.onKeyDown(props);
1033
1098
  },
1034
1099
  onExit() {
1035
- popup[0].destroy();
1036
- component.destroy();
1100
+ popup == null ? void 0 : popup[0].destroy();
1101
+ popup = null;
1102
+ component == null ? void 0 : component.destroy();
1103
+ component = null;
1037
1104
  }
1038
1105
  };
1039
1106
  }
@@ -1060,7 +1127,7 @@ const _sfc_main$1 = {
1060
1127
  };
1061
1128
  const _hoisted_1 = { class: "d-body--md-compact" };
1062
1129
  const _hoisted_2 = { key: 0 };
1063
- const _hoisted_3 = { class: "d-body--sm" };
1130
+ const _hoisted_3 = { class: "d-body--sm d-fc-tertiary" };
1064
1131
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1065
1132
  return vue.openBlock(), vue.createElementBlock("div", null, [
1066
1133
  vue.createElementVNode("div", _hoisted_1, [
@@ -1080,6 +1147,7 @@ const slashCommandSuggestion = {
1080
1147
  render: () => {
1081
1148
  let component;
1082
1149
  let popup;
1150
+ let popupIsOpen = false;
1083
1151
  return {
1084
1152
  onStart: (props) => {
1085
1153
  component = new vue3.VueRenderer(SuggestionList, {
@@ -1098,31 +1166,48 @@ const slashCommandSuggestion = {
1098
1166
  getReferenceClientRect: props.clientRect,
1099
1167
  appendTo: () => document.body,
1100
1168
  content: component.element,
1101
- showOnCreate: true,
1169
+ showOnCreate: false,
1170
+ onShow: () => {
1171
+ popupIsOpen = true;
1172
+ },
1173
+ onHidden: () => {
1174
+ popupIsOpen = false;
1175
+ },
1102
1176
  interactive: true,
1103
1177
  trigger: "manual",
1104
- placement: "top-start"
1178
+ placement: "top-start",
1179
+ zIndex: 650,
1180
+ plugins: [hideOnEsc]
1105
1181
  });
1182
+ if (props.items.length > 0) {
1183
+ popup == null ? void 0 : popup[0].show();
1184
+ }
1106
1185
  },
1107
1186
  onUpdate(props) {
1108
- component.updateProps(props);
1187
+ component == null ? void 0 : component.updateProps(props);
1188
+ if (props.items.length > 0) {
1189
+ popup == null ? void 0 : popup[0].show();
1190
+ } else {
1191
+ popup == null ? void 0 : popup[0].hide();
1192
+ }
1109
1193
  if (!props.clientRect) {
1110
1194
  return;
1111
1195
  }
1112
- popup[0].setProps({
1196
+ popup == null ? void 0 : popup[0].setProps({
1113
1197
  getReferenceClientRect: props.clientRect
1114
1198
  });
1115
1199
  },
1116
1200
  onKeyDown(props) {
1117
- if (props.event.key === "Escape") {
1118
- popup[0].hide();
1119
- return true;
1201
+ var _a;
1202
+ if (popupIsOpen) {
1203
+ return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
1120
1204
  }
1121
- return component == null ? void 0 : component.ref.onKeyDown(props);
1122
1205
  },
1123
1206
  onExit() {
1124
- popup[0].destroy();
1125
- component.destroy();
1207
+ popup == null ? void 0 : popup[0].destroy();
1208
+ popup = null;
1209
+ component == null ? void 0 : component.destroy();
1210
+ component = null;
1126
1211
  }
1127
1212
  };
1128
1213
  }
@@ -1372,7 +1457,13 @@ const _sfc_main = {
1372
1457
  * @event focus
1373
1458
  * @type {FocusEvent}
1374
1459
  */
1375
- "focus"
1460
+ "focus",
1461
+ /**
1462
+ * Enter was pressed. Note that shift enter must be pressed to line break the input.
1463
+ * @event enter
1464
+ * @type {String}
1465
+ */
1466
+ "enter"
1376
1467
  ],
1377
1468
  data() {
1378
1469
  return {
@@ -1437,14 +1528,20 @@ const _sfc_main = {
1437
1528
  HardBreak.extend({
1438
1529
  addKeyboardShortcuts() {
1439
1530
  return {
1440
- Enter: () => true,
1441
- "Shift-Enter": () => this.editor.commands.first(({ commands }) => [
1442
- () => commands.newlineInCode(),
1443
- () => self.allowBulletList && commands.splitListItem("listItem"),
1444
- () => commands.createParagraphNear(),
1445
- () => commands.liftEmptyBlock(),
1446
- () => commands.splitBlock()
1447
- ])
1531
+ Enter: () => {
1532
+ self.$emit("enter");
1533
+ return true;
1534
+ },
1535
+ "Shift-Enter": () => {
1536
+ this.editor.commands.first(({ commands }) => [
1537
+ () => commands.newlineInCode(),
1538
+ () => self.allowBulletList && commands.splitListItem("listItem"),
1539
+ () => commands.createParagraphNear(),
1540
+ () => commands.liftEmptyBlock(),
1541
+ () => commands.splitBlock()
1542
+ ]);
1543
+ return true;
1544
+ }
1448
1545
  };
1449
1546
  }
1450
1547
  })