@dialpad/dialtone-vue 3.124.0 → 3.125.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 (79) hide show
  1. package/dist/chunks/{dropdown-w8Do29L5.js → dropdown-XFYig-ys.js} +2 -2
  2. package/dist/chunks/{dropdown-w8Do29L5.js.map → dropdown-XFYig-ys.js.map} +1 -1
  3. package/dist/chunks/{dropdown-Hn-TeTvZ.js → dropdown-tVfEPEl1.js} +2 -2
  4. package/dist/chunks/{dropdown-Hn-TeTvZ.js.map → dropdown-tVfEPEl1.js.map} +1 -1
  5. package/dist/chunks/{popover_constants-Qkpb0yh2.js → popover_constants-kQaX7G4a.js} +10 -13
  6. package/dist/chunks/popover_constants-kQaX7G4a.js.map +1 -0
  7. package/dist/chunks/{popover_constants-JwBF9h1Z.js → popover_constants-qUYTzsS3.js} +10 -13
  8. package/dist/chunks/popover_constants-qUYTzsS3.js.map +1 -0
  9. package/dist/component-documentation.json +1 -1
  10. package/dist/dialtone-vue.cjs +2 -2
  11. package/dist/dialtone-vue.js +2 -2
  12. package/dist/lib/callbar-button-with-popover.cjs +2 -2
  13. package/dist/lib/callbar-button-with-popover.js +2 -2
  14. package/dist/lib/callbar-button.cjs +1 -2
  15. package/dist/lib/callbar-button.cjs.map +1 -1
  16. package/dist/lib/callbar-button.js +1 -2
  17. package/dist/lib/callbar-button.js.map +1 -1
  18. package/dist/lib/combobox-multi-select.cjs +1 -1
  19. package/dist/lib/combobox-multi-select.js +1 -1
  20. package/dist/lib/combobox-with-popover.cjs +1 -1
  21. package/dist/lib/combobox-with-popover.js +1 -1
  22. package/dist/lib/contact-row.cjs +1 -2
  23. package/dist/lib/contact-row.cjs.map +1 -1
  24. package/dist/lib/contact-row.js +1 -2
  25. package/dist/lib/contact-row.js.map +1 -1
  26. package/dist/lib/datepicker.cjs +1 -2
  27. package/dist/lib/datepicker.cjs.map +1 -1
  28. package/dist/lib/datepicker.js +1 -2
  29. package/dist/lib/datepicker.js.map +1 -1
  30. package/dist/lib/dropdown.cjs +2 -2
  31. package/dist/lib/dropdown.js +2 -2
  32. package/dist/lib/editor.cjs +1 -1
  33. package/dist/lib/editor.js +1 -1
  34. package/dist/lib/emoji-picker.cjs +1 -2
  35. package/dist/lib/emoji-picker.cjs.map +1 -1
  36. package/dist/lib/emoji-picker.js +1 -2
  37. package/dist/lib/emoji-picker.js.map +1 -1
  38. package/dist/lib/emoji-row.cjs +1 -2
  39. package/dist/lib/emoji-row.cjs.map +1 -1
  40. package/dist/lib/emoji-row.js +1 -2
  41. package/dist/lib/emoji-row.js.map +1 -1
  42. package/dist/lib/general-row.cjs +47 -10
  43. package/dist/lib/general-row.cjs.map +1 -1
  44. package/dist/lib/general-row.js +47 -10
  45. package/dist/lib/general-row.js.map +1 -1
  46. package/dist/lib/group-row.cjs +1 -2
  47. package/dist/lib/group-row.cjs.map +1 -1
  48. package/dist/lib/group-row.js +1 -2
  49. package/dist/lib/group-row.js.map +1 -1
  50. package/dist/lib/hovercard.cjs +1 -1
  51. package/dist/lib/hovercard.js +1 -1
  52. package/dist/lib/ivr-node.cjs +2 -2
  53. package/dist/lib/ivr-node.js +2 -2
  54. package/dist/lib/message-input.cjs +2 -2
  55. package/dist/lib/message-input.js +2 -2
  56. package/dist/lib/popover.cjs +2 -2
  57. package/dist/lib/popover.cjs.map +1 -1
  58. package/dist/lib/popover.js +3 -3
  59. package/dist/lib/popover.js.map +1 -1
  60. package/dist/lib/tooltip-directive.cjs +1 -2
  61. package/dist/lib/tooltip-directive.cjs.map +1 -1
  62. package/dist/lib/tooltip-directive.js +1 -2
  63. package/dist/lib/tooltip-directive.js.map +1 -1
  64. package/dist/lib/tooltip.cjs +40 -52
  65. package/dist/lib/tooltip.cjs.map +1 -1
  66. package/dist/lib/tooltip.js +42 -54
  67. package/dist/lib/tooltip.js.map +1 -1
  68. package/dist/style.css +87 -55
  69. package/dist/types/components/popover/tippy_utils.d.ts +1 -6
  70. package/dist/types/components/popover/tippy_utils.d.ts.map +1 -1
  71. package/dist/types/components/tooltip/tooltip.vue.d.ts +22 -47
  72. package/dist/types/components/tooltip/tooltip.vue.d.ts.map +1 -1
  73. package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts +19 -0
  74. package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
  75. package/package.json +5 -5
  76. package/dist/chunks/popover_constants-JwBF9h1Z.js.map +0 -1
  77. package/dist/chunks/popover_constants-Qkpb0yh2.js.map +0 -1
  78. package/dist/types/components/tooltip/modifiers.d.ts +0 -8
  79. package/dist/types/components/tooltip/modifiers.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-directive.js","sources":["../../directives/tooltip/tooltip.js"],"sourcesContent":["import { DtTooltip } from '@/components/tooltip';\nimport { getUniqueString } from '@/common/utils';\nimport { createApp, getCurrentInstance, h } from 'vue';\n\nexport const DtTooltipDirective = {\n name: 'dt-tooltip-directive',\n install (app) {\n let tooltipInstance;\n const mountPoint = document.createElement('div');\n document.body.appendChild(mountPoint);\n\n const DEFAULT_PLACEMENT = 'top';\n const DtTooltipDirectiveApp = createApp({\n name: 'DtTooltipDirectiveApp',\n components: { DtTooltip },\n data () {\n return {\n tooltips: [],\n };\n },\n\n mounted () {\n tooltipInstance = getCurrentInstance();\n },\n\n methods: {\n addOrUpdateTooltip (id, message, placement) {\n const index = this.tooltips.findIndex(tooltip => tooltip.id === id);\n if (index !== -1) {\n // Update existing tooltip\n this.tooltips[index].message = message;\n this.tooltips[index].placement = placement;\n } else {\n // Add new tooltip\n this.tooltips.push({ id, message, placement });\n }\n },\n\n removeTooltip (id) {\n this.tooltips = this.tooltips.filter(tooltip => tooltip.id !== id);\n },\n },\n\n render () {\n return h('div',\n this.tooltips.map(({ id, message, placement }) => {\n return h(DtTooltip, {\n key: id,\n message,\n placement,\n /**\n * Set the delay to false when running tests only.\n */\n delay: process.env.NODE_ENV !== 'test',\n externalAnchor: `[data-dt-tooltip-id=\"${id}\"]`,\n });\n }),\n );\n },\n });\n\n DtTooltipDirectiveApp.mount(mountPoint);\n\n app.directive('dt-tooltip', {\n beforeMount (anchor, binding) {\n // Initial tooltip setup\n setupTooltip(anchor, binding);\n },\n updated (anchor, binding) {\n // Update tooltip on binding value change\n if (binding.value !== binding.oldValue) {\n setupTooltip(anchor, binding);\n }\n },\n unmounted (anchor) {\n tooltipInstance.ctx.removeTooltip(anchor.getAttribute('data-dt-tooltip-id'));\n },\n });\n\n function setupTooltip (anchor, binding) {\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id') || getUniqueString();\n const message = binding.value;\n const placement = binding.arg || DEFAULT_PLACEMENT;\n\n anchor.setAttribute('data-dt-tooltip-id', tooltipId);\n\n tooltipInstance.ctx.addOrUpdateTooltip(tooltipId, message, placement);\n }\n },\n};\n\nexport default DtTooltipDirective;\n"],"names":[],"mappings":";;;;;;;;AAIY,MAAC,qBAAqB;AAAA,EAChC,MAAM;AAAA,EACN,QAAS,KAAK;AACZ,QAAI;AACJ,UAAM,aAAa,SAAS,cAAc,KAAK;AAC/C,aAAS,KAAK,YAAY,UAAU;AAEpC,UAAM,oBAAoB;AAC1B,UAAM,wBAAwB,UAAU;AAAA,MACtC,MAAM;AAAA,MACN,YAAY,EAAE,UAAW;AAAA,MACzB,OAAQ;AACN,eAAO;AAAA,UACL,UAAU,CAAE;AAAA,QACtB;AAAA,MACO;AAAA,MAED,UAAW;AACT,0BAAkB,mBAAkB;AAAA,MACrC;AAAA,MAED,SAAS;AAAA,QACP,mBAAoB,IAAI,SAAS,WAAW;AAC1C,gBAAM,QAAQ,KAAK,SAAS,UAAU,aAAW,QAAQ,OAAO,EAAE;AAClE,cAAI,UAAU,IAAI;AAEhB,iBAAK,SAAS,KAAK,EAAE,UAAU;AAC/B,iBAAK,SAAS,KAAK,EAAE,YAAY;AAAA,UAC7C,OAAiB;AAEL,iBAAK,SAAS,KAAK,EAAE,IAAI,SAAS,UAAS,CAAE;AAAA,UAC9C;AAAA,QACF;AAAA,QAED,cAAe,IAAI;AACjB,eAAK,WAAW,KAAK,SAAS,OAAO,aAAW,QAAQ,OAAO,EAAE;AAAA,QAClE;AAAA,MACF;AAAA,MAED,SAAU;AACR,eAAO;AAAA,UAAE;AAAA,UACP,KAAK,SAAS,IAAI,CAAC,EAAE,IAAI,SAAS,gBAAgB;AAChD,mBAAO,EAAE,WAAW;AAAA,cAClB,KAAK;AAAA,cACL;AAAA,cACA;AAAA;AAAA;AAAA;AAAA,cAIA,OAAO,QAAQ,IAAI,aAAa;AAAA,cAChC,gBAAgB,wBAAwB,EAAE;AAAA,YACxD,CAAa;AAAA,UACb,CAAW;AAAA,QACX;AAAA,MACO;AAAA,IACP,CAAK;AAED,0BAAsB,MAAM,UAAU;AAEtC,QAAI,UAAU,cAAc;AAAA,MAC1B,YAAa,QAAQ,SAAS;AAE5B,qBAAa,QAAQ,OAAO;AAAA,MAC7B;AAAA,MACD,QAAS,QAAQ,SAAS;AAExB,YAAI,QAAQ,UAAU,QAAQ,UAAU;AACtC,uBAAa,QAAQ,OAAO;AAAA,QAC7B;AAAA,MACF;AAAA,MACD,UAAW,QAAQ;AACjB,wBAAgB,IAAI,cAAc,OAAO,aAAa,oBAAoB,CAAC;AAAA,MAC5E;AAAA,IACP,CAAK;AAED,aAAS,aAAc,QAAQ,SAAS;AACtC,YAAM,YAAY,OAAO,aAAa,oBAAoB,KAAK,gBAAe;AAC9E,YAAM,UAAU,QAAQ;AACxB,YAAM,YAAY,QAAQ,OAAO;AAEjC,aAAO,aAAa,sBAAsB,SAAS;AAEnD,sBAAgB,IAAI,mBAAmB,WAAW,SAAS,SAAS;AAAA,IACrE;AAAA,EACF;AACH;"}
1
+ {"version":3,"file":"tooltip-directive.js","sources":["../../directives/tooltip/tooltip.js"],"sourcesContent":["import { DtTooltip } from '@/components/tooltip';\nimport { getUniqueString } from '@/common/utils';\nimport { createApp, getCurrentInstance, h } from 'vue';\n\nexport const DtTooltipDirective = {\n name: 'dt-tooltip-directive',\n install (app) {\n let tooltipInstance;\n const mountPoint = document.createElement('div');\n document.body.appendChild(mountPoint);\n\n const DEFAULT_PLACEMENT = 'top';\n const DtTooltipDirectiveApp = createApp({\n name: 'DtTooltipDirectiveApp',\n components: { DtTooltip },\n data () {\n return {\n tooltips: [],\n };\n },\n\n mounted () {\n tooltipInstance = getCurrentInstance();\n },\n\n methods: {\n addOrUpdateTooltip (id, message, placement) {\n const index = this.tooltips.findIndex(tooltip => tooltip.id === id);\n if (index !== -1) {\n // Update existing tooltip\n this.tooltips[index].message = message;\n this.tooltips[index].placement = placement;\n } else {\n // Add new tooltip\n this.tooltips.push({ id, message, placement });\n }\n },\n\n removeTooltip (id) {\n this.tooltips = this.tooltips.filter(tooltip => tooltip.id !== id);\n },\n },\n\n render () {\n return h('div',\n this.tooltips.map(({ id, message, placement }) => {\n return h(DtTooltip, {\n key: id,\n message,\n placement,\n /**\n * Set the delay to false when running tests only.\n */\n delay: process.env.NODE_ENV !== 'test',\n externalAnchor: `[data-dt-tooltip-id=\"${id}\"]`,\n });\n }),\n );\n },\n });\n\n DtTooltipDirectiveApp.mount(mountPoint);\n\n app.directive('dt-tooltip', {\n beforeMount (anchor, binding) {\n // Initial tooltip setup\n setupTooltip(anchor, binding);\n },\n updated (anchor, binding) {\n // Update tooltip on binding value change\n if (binding.value !== binding.oldValue) {\n setupTooltip(anchor, binding);\n }\n },\n unmounted (anchor) {\n tooltipInstance.ctx.removeTooltip(anchor.getAttribute('data-dt-tooltip-id'));\n },\n });\n\n function setupTooltip (anchor, binding) {\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id') || getUniqueString();\n const message = binding.value;\n const placement = binding.arg || DEFAULT_PLACEMENT;\n\n anchor.setAttribute('data-dt-tooltip-id', tooltipId);\n\n tooltipInstance.ctx.addOrUpdateTooltip(tooltipId, message, placement);\n }\n },\n};\n\nexport default DtTooltipDirective;\n"],"names":[],"mappings":";;;;;;;AAIY,MAAC,qBAAqB;AAAA,EAChC,MAA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SAAS;AAExB,YAAI,QAAQ,UAAU,QAAQ,UAAU;AACtC,uBAAa,QAAQ,OAAO;AAAA,QAC7B;AAAA,MACF;AAAA,MACD,UAAW,QAAQ;AACjB,wBAAgB,IAAI,cAAc,OAAO,aAAa,oBAAoB,CAAC;AAAA,MAC5E;AAAA,IACP,CAAK;AAED,aAAS,aAAc,QAAQ,SAAS;AACtC,YAAM,YAAY,OAAO,aAAa,oBAAoB,KAAK,gBAAe;AAC9E,YAAM,UAAU,QAAQ;AACxB,YAAM,YAAY,QAAQ,OAAO;AAEjC,aAAO,aAAa,sBAAsB,SAAS;AAEnD,sBAAgB,IAAI,mBAAmB,WAAW,SAAS,SAAS;AAAA,IACrE;AAAA,EACF;AACH;"}
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const popover_constants = require("../chunks/popover_constants-JwBF9h1Z.js");
3
+ const popover_constants = require("../chunks/popover_constants-qUYTzsS3.js");
4
4
  const common_utils = require("../common/utils.cjs");
5
5
  const vue = require("vue");
6
6
  const _pluginVue_exportHelper = require("../chunks/_plugin-vue_export-helper-fhnQq0tA.js");
7
- const lib_lazyShow = require("./lazy-show.cjs");
8
7
  require("tippy.js");
9
8
  require("../common/constants.cjs");
10
9
  const _sfc_main = {
11
10
  name: "DtTooltip",
12
- components: {
13
- DtLazyShow: lib_lazyShow.DtLazyShow
14
- },
15
11
  props: {
16
12
  /**
17
13
  * The id of the tooltip
@@ -60,7 +56,7 @@ const _sfc_main = {
60
56
  */
61
57
  offset: {
62
58
  type: Array,
63
- default: () => [0, -4]
59
+ default: () => [0, 12]
64
60
  },
65
61
  /**
66
62
  * The direction the popover displays relative to the anchor. See
@@ -155,20 +151,11 @@ const _sfc_main = {
155
151
  default: null
156
152
  },
157
153
  /**
158
- * Named transition when the content display is toggled.
159
- * @see DtLazyShow
154
+ * Whether the tooltip should have a transition effect.
160
155
  */
161
156
  transition: {
162
- type: String,
163
- default: "fade"
164
- },
165
- /**
166
- * Whether to apply transition on initial render in the content lazy show component.
167
- * @values true, false
168
- */
169
- contentAppear: {
170
157
  type: Boolean,
171
- default: false
158
+ default: true
172
159
  },
173
160
  /**
174
161
  * Whether the tooltip will have a delay when being focused or moused over.
@@ -214,9 +201,7 @@ const _sfc_main = {
214
201
  // this is where the placement currently is, this can be different than
215
202
  // the placement prop when there is not enough available room for the tip
216
203
  // to display and it uses a fallback placement.
217
- currentPlacement: this.placement,
218
- // flag check touch based device
219
- isTouchDevice: false
204
+ currentPlacement: this.placement
220
205
  };
221
206
  },
222
207
  computed: {
@@ -242,10 +227,11 @@ const _sfc_main = {
242
227
  tippyProps() {
243
228
  return {
244
229
  offset: this.offset,
245
- interactive: false,
246
- trigger: "manual",
230
+ delay: this.delay ? popover_constants.TOOLTIP_DELAY_MS : false,
247
231
  placement: this.placement,
248
232
  sticky: this.sticky,
233
+ theme: this.inverted ? "inverted" : void 0,
234
+ animation: this.transition ? "fade" : false,
249
235
  popperOptions: popover_constants.getPopperOptions({
250
236
  fallbackPlacements: this.fallbackPlacements,
251
237
  hasHideModifierEnabled: true,
@@ -316,8 +302,6 @@ const _sfc_main = {
316
302
  return this.anchor.matches(":focus-visible");
317
303
  },
318
304
  onEnterAnchor(e) {
319
- if (this.isTouchDevice && !e.relatedTarget)
320
- return;
321
305
  if (this.delay && this.inTimer === null) {
322
306
  this.inTimer = setTimeout(() => {
323
307
  this.triggerShow(e);
@@ -325,7 +309,6 @@ const _sfc_main = {
325
309
  } else {
326
310
  this.triggerShow(e);
327
311
  }
328
- this.isTouchDevice = false;
329
312
  },
330
313
  triggerShow(e) {
331
314
  if (e.type === "focusin") {
@@ -370,21 +353,39 @@ const _sfc_main = {
370
353
  if (this.tip && this.tip.setProps) {
371
354
  this.tip.setProps({
372
355
  ...this.tippyProps,
373
- zIndex: this.calculateAnchorZindex(),
374
- appendTo: this.appendTo === "body" ? (_b = (_a = this.anchor) == null ? void 0 : _a.getRootNode()) == null ? void 0 : _b.querySelector("body") : this.appendTo
356
+ // these need to be set here rather than in tippyProps because they are non-reactive
357
+ appendTo: this.appendTo === "body" ? (_b = (_a = this.anchor) == null ? void 0 : _a.getRootNode()) == null ? void 0 : _b.querySelector("body") : this.appendTo,
358
+ zIndex: this.calculateAnchorZindex()
375
359
  });
376
360
  }
377
361
  },
378
362
  onMount() {
379
363
  this.setProps();
380
364
  },
365
+ onShow(tooltipInstance) {
366
+ if (tooltipInstance.props.content.textContent.length === 0) {
367
+ return false;
368
+ }
369
+ },
370
+ // set initial options here. If any of the options need to dynamically change, they should be put in
371
+ // tippyProps instead.
381
372
  initOptions() {
373
+ const template = this.$refs.content;
382
374
  return {
383
- contentElement: this.$refs.content.$el,
384
- allowHTML: true,
385
- zIndex: this.calculateAnchorZindex(),
375
+ content: template,
376
+ arrow: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="6"><path transform="rotate(180 6.21875 3.575)" d="m12.844.45-6 6-6-6h12Z"/></svg>',
377
+ // transition duration - same as our custom fade delay in dialtone-globals.less
378
+ duration: 180,
379
+ interactive: false,
380
+ trigger: "manual",
381
+ hideOnClick: false,
382
+ // disable tooltip from displaying on touch devices
383
+ touch: false,
386
384
  onMount: this.onMount,
387
- ...this.tippyProps
385
+ onShow: this.onShow,
386
+ popperOptions: popover_constants.getPopperOptions({
387
+ hasHideModifierEnabled: true
388
+ })
388
389
  };
389
390
  },
390
391
  addExternalAnchorEventListeners() {
@@ -402,15 +403,12 @@ const _sfc_main = {
402
403
  ["focusout", "mouseleave", "keydown"].forEach((listener) => {
403
404
  this.anchor.removeEventListener(listener, (event) => this.onLeaveAnchor(event));
404
405
  });
405
- },
406
- onTouchStart() {
407
- this.isTouchDevice = true;
408
406
  }
409
407
  }
410
408
  };
411
409
  const _hoisted_1 = { "data-qa": "dt-tooltip-container" };
410
+ const _hoisted_2 = ["id"];
412
411
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
413
- const _component_dt_lazy_show = vue.resolveComponent("dt-lazy-show");
414
412
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
415
413
  !$props.externalAnchor ? (vue.openBlock(), vue.createElementBlock("span", {
416
414
  key: 0,
@@ -420,36 +418,26 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
420
418
  onFocusout: _cache[1] || (_cache[1] = (...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args)),
421
419
  onMouseenter: _cache[2] || (_cache[2] = (...args) => $options.onEnterAnchor && $options.onEnterAnchor(...args)),
422
420
  onMouseleave: _cache[3] || (_cache[3] = (...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args)),
423
- onKeydown: _cache[4] || (_cache[4] = vue.withKeys((...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args), ["esc"])),
424
- onTouchstart: _cache[5] || (_cache[5] = (...args) => $options.onTouchStart && $options.onTouchStart(...args))
421
+ onKeydown: _cache[4] || (_cache[4] = vue.withKeys((...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args), ["esc"]))
425
422
  }, [
426
423
  vue.renderSlot(_ctx.$slots, "anchor")
427
424
  ], 544)) : vue.createCommentVNode("", true),
428
- vue.createVNode(_component_dt_lazy_show, vue.mergeProps({
425
+ vue.createElementVNode("div", vue.mergeProps({
429
426
  id: $props.id,
430
427
  ref: "content",
431
- show: $options.isVisible,
432
- role: "tooltip",
433
- "aria-hidden": "false",
434
428
  "data-qa": "dt-tooltip",
435
- appear: $props.contentAppear,
436
- transition: $props.transition,
437
429
  class: [
438
430
  "d-tooltip",
439
- `d-tooltip__arrow-tippy--${$data.currentPlacement}`,
440
431
  {
441
432
  [$data.TOOLTIP_KIND_MODIFIERS.inverted]: $props.inverted
442
433
  },
443
434
  $props.contentClass
444
435
  ]
445
- }, vue.toHandlers($options.tooltipListeners)), {
446
- default: vue.withCtx(() => [
447
- vue.renderSlot(_ctx.$slots, "default", {}, () => [
448
- vue.createTextVNode(vue.toDisplayString($props.message), 1)
449
- ])
450
- ]),
451
- _: 3
452
- }, 16, ["id", "show", "appear", "transition", "class"])
436
+ }, vue.toHandlers($options.tooltipListeners, true)), [
437
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
438
+ vue.createTextVNode(vue.toDisplayString($props.message), 1)
439
+ ])
440
+ ], 16, _hoisted_2)
453
441
  ]);
454
442
  }
455
443
  const DtTooltip = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.cjs","sources":["../../components/tooltip/tooltip.vue"],"sourcesContent":["<template>\n <div data-qa=\"dt-tooltip-container\">\n <!-- disabling as the below events are for capturing events from interactive\n elements within the span rather than on the span itself -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <span\n v-if=\"!externalAnchor\"\n ref=\"anchor\"\n data-qa=\"dt-tooltip-anchor\"\n @focusin=\"onEnterAnchor\"\n @focusout=\"onLeaveAnchor\"\n @mouseenter=\"onEnterAnchor\"\n @mouseleave=\"onLeaveAnchor\"\n @keydown.esc=\"onLeaveAnchor\"\n @touchstart=\"onTouchStart\"\n >\n <!-- @slot Slot for the anchor element -->\n <slot\n name=\"anchor\"\n />\n </span>\n <dt-lazy-show\n :id=\"id\"\n ref=\"content\"\n :show=\"isVisible\"\n role=\"tooltip\"\n aria-hidden=\"false\"\n data-qa=\"dt-tooltip\"\n :appear=\"contentAppear\"\n :transition=\"transition\"\n :class=\"[\n 'd-tooltip',\n `d-tooltip__arrow-tippy--${currentPlacement}`,\n {\n [ TOOLTIP_KIND_MODIFIERS.inverted ]: inverted,\n },\n contentClass,\n ]\"\n v-on=\"tooltipListeners\"\n >\n <!-- In case when transitionend event doesn't work correct (for ex. tooltip component with custom trigger) -->\n <!-- after-leave event can be used instead of transitionend -->\n <!-- @slot Slot for the content, defaults to message prop -->\n <slot>\n {{ message }}\n </slot>\n </dt-lazy-show>\n </div>\n</template>\n\n<script>\nimport {\n TOOLTIP_KIND_MODIFIERS,\n TOOLTIP_DIRECTIONS,\n TOOLTIP_STICKY_VALUES,\n TOOLTIP_DELAY_MS,\n} from './tooltip_constants.js';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '../popover/popover_constants';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport {\n createTippy,\n getAnchor,\n getPopperOptions,\n} from '@/components/popover/tippy_utils';\n\n/**\n * A tooltip is a floating label that briefly explains an action, function, or an element.\n * Its content is exclusively text and shouldn't be vital information for users.\n * If richer media is desired, consider using a popover instead.\n * @see https://dialtone.dialpad.com/components/tooltip.html\n */\nexport default {\n name: 'DtTooltip',\n components: {\n DtLazyShow,\n },\n\n props: {\n /**\n * The id of the tooltip\n */\n id: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * If the popover does not fit in the direction described by \"placement\",\n * it will attempt to change its direction to the \"fallbackPlacements\"\n * if defined, otherwise it will automatically position to a new location\n * as it sees best fit. See\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * */\n fallbackPlacements: {\n type: Array,\n default: () => ['auto'],\n },\n\n /**\n * If true, applies inverted styles to the tooltip\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the tooltip from its reference element\n * by the specified number of pixels. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, -4],\n },\n\n /**\n * The direction the popover displays relative to the anchor. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#placement\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'top',\n validator (placement) {\n return TOOLTIP_DIRECTIONS.includes(placement);\n },\n },\n\n /**\n * If the tooltip sticks to the anchor. This is usually not needed, but can be needed\n * if the reference element's position is animating, or to automatically update the popover\n * position in those cases the DOM layout changes the reference element's position.\n * `true` enables it, `reference` only checks the \"reference\" rect for changes and `popper` only\n * checks the \"popper\" rect for changes. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#sticky\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n * @values true, false, reference, popper\n */\n sticky: {\n type: [Boolean, String],\n default: false,\n validator: (sticky) => {\n return TOOLTIP_STICKY_VALUES.includes(sticky);\n },\n },\n\n /**\n * Sets the element to which the tooltip is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * This prop is not reactive, must be set on initial render.\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * Additional css classes for the tooltip content element.\n * Can accept all of String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n contentClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * A provided message for the tooltip content\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Controls whether hover/focus causes the tooltip to appear.\n * Cannot be combined with the show prop. show value will be ignored.\n * by default this is true, if you override with false, the tooltip will never show up.\n */\n enabled: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Controls whether the tooltip is shown. Leaving this null will have the tooltip trigger on mouseover by default.\n * If you set this value, the default mouseover behavior will be disabled and you can control it as you need.\n * Supports .sync modifier\n * @values null, true, false\n */\n show: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n\n /**\n * Whether to apply transition on initial render in the content lazy show component.\n * @values true, false\n */\n contentAppear: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the tooltip will have a delay when being focused or moused over.\n * @values true, false\n */\n delay: {\n type: Boolean,\n default: true,\n },\n\n /**\n * External anchor id to use in those cases the anchor can't be provided via the slot.\n * For instance, using the combobox's input as the anchor for the popover.\n */\n externalAnchor: {\n type: String,\n default: null,\n },\n },\n\n emits: [\n /**\n * Emitted when tooltip is shown or hidden\n *\n * @event shown\n * @type {Boolean}\n */\n 'shown',\n\n /**\n * Sync show value\n *\n * @event update:show\n */\n 'update:show',\n ],\n\n data () {\n return {\n TOOLTIP_KIND_MODIFIERS,\n hasSlotContent,\n tip: null,\n\n inTimer: null,\n\n // Internal state for whether the tooltip is shown. Changing the prop\n // will update this.\n isShown: false,\n\n // this is where the placement currently is, this can be different than\n // the placement prop when there is not enough available room for the tip\n // to display and it uses a fallback placement.\n currentPlacement: this.placement,\n\n // flag check touch based device\n isTouchDevice: false,\n };\n },\n\n computed: {\n // whether the tooltip is visible or not.\n isVisible () {\n const hasMessage = !!this.message?.trim();\n const hasDefaultSlot = !!this.$slots?.default;\n const isDeviceCompatible = !this.isTouchDevice;\n\n const shouldBeVisible = this.isShown && this.enabled && (hasMessage || hasDefaultSlot);\n\n return shouldBeVisible && isDeviceCompatible;\n },\n\n tooltipListeners () {\n return {\n 'after-leave': () => {\n this.onLeaveTransitionComplete();\n },\n\n 'after-enter': () => {\n this.onEnterTransitionComplete();\n },\n };\n },\n\n tippyProps () {\n return {\n offset: this.offset,\n interactive: false,\n trigger: 'manual',\n placement: this.placement,\n sticky: this.sticky,\n popperOptions: getPopperOptions({\n fallbackPlacements: this.fallbackPlacements,\n hasHideModifierEnabled: true,\n onChangePlacement: this.onChangePlacement,\n }),\n };\n },\n\n anchor () {\n return this.externalAnchor ? document.body.querySelector(this.externalAnchor) : getAnchor(this.$refs.anchor);\n },\n },\n\n watch: {\n\n tippyProps: {\n handler: 'setProps',\n deep: true,\n },\n\n show: {\n handler: function (show) {\n if (show !== null) {\n this.isShown = show;\n }\n },\n\n immediate: true,\n },\n\n isShown (isShown) {\n if (isShown) {\n this.setProps();\n this.tip.show();\n } else {\n this.tip.hide();\n }\n },\n\n sticky (sticky) {\n this.tip.setProps({\n sticky,\n });\n },\n },\n\n mounted () {\n if (!this.enabled && this.show != null) {\n console.warn('Tooltip: You cannot use both the enabled and show props at the same time.');\n console.warn('The show prop will be ignored.');\n }\n\n this.externalAnchor && this.addExternalAnchorEventListeners();\n this.tip = createTippy(this.anchor, this.initOptions());\n\n // immediate watcher fires before mounted, so have this here in case\n // show prop was initially set to true.\n if (this.isShown) {\n this.tip.show();\n }\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.tip) {\n this.tip?.destroy();\n }\n },\n\n methods: {\n calculateAnchorZindex () {\n // if a modal is currently active render at modal-element z-index, otherwise at tooltip z-index\n if (this.$el.getRootNode()\n .querySelector('.d-modal[aria-hidden=\"false\"], .d-modal--transparent[aria-hidden=\"false\"]') ||\n // Special case because we don't have any dialtone drawer component yet. Render at 651 when\n // anchor of popover is within a drawer.\n this.$el.closest('.d-zi-drawer')) {\n return 651;\n } else {\n return 400;\n }\n },\n\n hasVisibleFocus () {\n return this.anchor.matches(':focus-visible');\n },\n\n onEnterAnchor (e) {\n // Note: This is to stop the call of mouseenter event when touchstart event is triggered,\n // as when triggered by click or touch, the relatedTarget property of MouseEvent is null\n if (this.isTouchDevice && !e.relatedTarget) return;\n\n if (this.delay && this.inTimer === null) {\n this.inTimer = setTimeout(() => {\n this.triggerShow(e);\n }, TOOLTIP_DELAY_MS);\n } else {\n this.triggerShow(e);\n }\n\n // since this method will be trigger by mouse event, updating the flag is non-touch device\n this.isTouchDevice = false;\n },\n\n triggerShow (e) {\n if (e.type === 'focusin') {\n // only show tooltips on visible focus when triggered via focus.\n // when the user is using the mouse they only want tooltips to display\n // on mouseover.\n //\n // Example: anchor of a popover is a button with tooltip.\n // closing it with the mouse would trigger the tooltip to display as\n // the anchor is focused on close. Not what we want.\n if (this.show === null && this.hasVisibleFocus()) {\n this.isShown = true;\n }\n } else {\n if (this.show === null) this.isShown = true;\n }\n },\n\n onLeaveAnchor (e) {\n if (e.type === 'keydown' && e.code !== 'Escape') return;\n\n clearTimeout(this.inTimer);\n this.inTimer = null;\n this.triggerHide();\n },\n\n triggerHide () {\n if (this.show === null) this.isShown = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onLeaveTransitionComplete () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onEnterTransitionComplete () {\n this.$emit('shown', true);\n if (this.show !== null) {\n this.$emit('update:show', true);\n }\n },\n\n setProps () {\n if (this.tip && this.tip.setProps) {\n this.tip.setProps({\n ...this.tippyProps,\n zIndex: this.calculateAnchorZindex(),\n appendTo: this.appendTo === 'body' ? this.anchor?.getRootNode()?.querySelector('body') : this.appendTo,\n });\n }\n },\n\n onMount () {\n this.setProps();\n },\n\n initOptions () {\n return {\n contentElement: this.$refs.content.$el,\n allowHTML: true,\n zIndex: this.calculateAnchorZindex(),\n onMount: this.onMount,\n ...this.tippyProps,\n };\n },\n\n addExternalAnchorEventListeners () {\n ['focusin', 'mouseenter'].forEach(listener => {\n this.anchor.addEventListener(listener, (event) => this.onEnterAnchor(event));\n });\n ['focusout', 'mouseleave', 'keydown'].forEach(listener => {\n this.anchor.addEventListener(listener, (event) => this.onLeaveAnchor(event));\n });\n },\n\n removeExternalAnchorEventListeners () {\n ['focusin', 'mouseenter'].forEach(listener => {\n this.anchor.removeEventListener(listener, (event) => this.onEnterAnchor(event));\n });\n ['focusout', 'mouseleave', 'keydown'].forEach(listener => {\n this.anchor.removeEventListener(listener, (event) => this.onLeaveAnchor(event));\n });\n },\n\n onTouchStart () {\n this.isTouchDevice = true;\n },\n },\n};\n</script>\n\n<style lang=\"less\">\n.tippy-box[data-popper-reference-hidden] {\n .d-tooltip {\n visibility: hidden;\n pointer-events: none;\n }\n}\n</style>\n"],"names":["DtLazyShow","getUniqueString","TOOLTIP_DIRECTIONS","TOOLTIP_STICKY_VALUES","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","getPopperOptions","getAnchor","createTippy","TOOLTIP_DELAY_MS","_openBlock","_createElementBlock","_renderSlot","_createVNode","_mergeProps","_toHandlers"],"mappings":";;;;;;;;;AA0EA,MAAK,YAAU;AAAA,EACb,MAAM;AAAA,EACN,YAAY;AAAA,gBACVA,aAAU;AAAA,EACX;AAAA,EAED,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI;AAAA,MACF,MAAM;AAAA,MACN,UAAW;AAAE,eAAOC,aAAe,gBAAA;AAAA,MAAK;AAAA,IACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAeD,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,MAAM;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAaD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,GAAG,EAAE;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAiBD,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAW,WAAW;AACpB,eAAOC,kBAAkB,mBAAC,SAAS,SAAS;AAAA,MAC7C;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AA;AAAA;MAGzBC,eAEE,KAAA,QAAA,QAAA;AAAA;IAEJC,IAAA,YAyBe,yBAzBfC,eAyBe;AAAA,MAxBZ,IAAI,OAAE;AAAA,MACP,KAAI;AAAA,MACH,MAAM,SAAS;AAAA,MAChB,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAQ;AAAA,MACP,QAAQ,OAAa;AAAA,MACrB,YAAY,OAAU;AAAA,MACtB,OAAK;AAAA;mCAA4D,MAAgB,gBAAA;AAAA;WAA0B,MAAsB,uBAAC,QAAQ,GAAI,OAAQ;AAAA;QAAqB,OAAY;AAAA;IAQxL,GAAAC,eAAM,SAAgB,gBAAA,CAAA,GAAA;AAAA,2BAKtB,MAEO;AAAA,QAFPH,IAAAA,WAEO,4BAFP,MAEO;AAAA,kDADF,OAAO,OAAA,GAAA,CAAA;AAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tooltip.cjs","sources":["../../components/tooltip/tooltip.vue"],"sourcesContent":["<template>\n <div data-qa=\"dt-tooltip-container\">\n <!-- disabling as the below events are for capturing events from interactive\n elements within the span rather than on the span itself -->\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <span\n v-if=\"!externalAnchor\"\n ref=\"anchor\"\n data-qa=\"dt-tooltip-anchor\"\n @focusin=\"onEnterAnchor\"\n @focusout=\"onLeaveAnchor\"\n @mouseenter=\"onEnterAnchor\"\n @mouseleave=\"onLeaveAnchor\"\n @keydown.esc=\"onLeaveAnchor\"\n >\n <!-- @slot Slot for the anchor element -->\n <slot\n name=\"anchor\"\n />\n </span>\n <div\n :id=\"id\"\n ref=\"content\"\n data-qa=\"dt-tooltip\"\n :class=\"[\n 'd-tooltip',\n {\n [ TOOLTIP_KIND_MODIFIERS.inverted ]: inverted,\n },\n contentClass,\n ]\"\n v-on=\"tooltipListeners\"\n >\n <!-- In case when transitionend event doesn't work correct (for ex. tooltip component with custom trigger) -->\n <!-- after-leave event can be used instead of transitionend -->\n <!-- @slot Slot for the content, defaults to message prop -->\n <slot>\n {{ message }}\n </slot>\n </div>\n </div>\n</template>\n\n<script>\nimport {\n TOOLTIP_KIND_MODIFIERS,\n TOOLTIP_DIRECTIONS,\n TOOLTIP_STICKY_VALUES,\n TOOLTIP_DELAY_MS,\n} from './tooltip_constants.js';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '../popover/popover_constants';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport {\n createTippy,\n getAnchor,\n getPopperOptions,\n} from '@/components/popover/tippy_utils';\n\n/**\n * A tooltip is a floating label that briefly explains an action, function, or an element.\n * Its content is exclusively text and shouldn't be vital information for users.\n * If richer media is desired, consider using a popover instead.\n * @see https://dialtone.dialpad.com/components/tooltip.html\n */\nexport default {\n name: 'DtTooltip',\n\n props: {\n /**\n * The id of the tooltip\n */\n id: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * If the popover does not fit in the direction described by \"placement\",\n * it will attempt to change its direction to the \"fallbackPlacements\"\n * if defined, otherwise it will automatically position to a new location\n * as it sees best fit. See\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * */\n fallbackPlacements: {\n type: Array,\n default: () => ['auto'],\n },\n\n /**\n * If true, applies inverted styles to the tooltip\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the tooltip from its reference element\n * by the specified number of pixels. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, 12],\n },\n\n /**\n * The direction the popover displays relative to the anchor. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#placement\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'top',\n validator (placement) {\n return TOOLTIP_DIRECTIONS.includes(placement);\n },\n },\n\n /**\n * If the tooltip sticks to the anchor. This is usually not needed, but can be needed\n * if the reference element's position is animating, or to automatically update the popover\n * position in those cases the DOM layout changes the reference element's position.\n * `true` enables it, `reference` only checks the \"reference\" rect for changes and `popper` only\n * checks the \"popper\" rect for changes. See\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#sticky\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n * @values true, false, reference, popper\n */\n sticky: {\n type: [Boolean, String],\n default: false,\n validator: (sticky) => {\n return TOOLTIP_STICKY_VALUES.includes(sticky);\n },\n },\n\n /**\n * Sets the element to which the tooltip is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * This prop is not reactive, must be set on initial render.\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * Additional css classes for the tooltip content element.\n * Can accept all of String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n contentClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * A provided message for the tooltip content\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Controls whether hover/focus causes the tooltip to appear.\n * Cannot be combined with the show prop. show value will be ignored.\n * by default this is true, if you override with false, the tooltip will never show up.\n */\n enabled: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Controls whether the tooltip is shown. Leaving this null will have the tooltip trigger on mouseover by default.\n * If you set this value, the default mouseover behavior will be disabled and you can control it as you need.\n * Supports .sync modifier\n * @values null, true, false\n */\n show: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Whether the tooltip should have a transition effect.\n */\n transition: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the tooltip will have a delay when being focused or moused over.\n * @values true, false\n */\n delay: {\n type: Boolean,\n default: true,\n },\n\n /**\n * External anchor id to use in those cases the anchor can't be provided via the slot.\n * For instance, using the combobox's input as the anchor for the popover.\n */\n externalAnchor: {\n type: String,\n default: null,\n },\n },\n\n emits: [\n /**\n * Emitted when tooltip is shown or hidden\n *\n * @event shown\n * @type {Boolean}\n */\n 'shown',\n\n /**\n * Sync show value\n *\n * @event update:show\n */\n 'update:show',\n ],\n\n data () {\n return {\n TOOLTIP_KIND_MODIFIERS,\n hasSlotContent,\n tip: null,\n\n inTimer: null,\n\n // Internal state for whether the tooltip is shown. Changing the prop\n // will update this.\n isShown: false,\n\n // this is where the placement currently is, this can be different than\n // the placement prop when there is not enough available room for the tip\n // to display and it uses a fallback placement.\n currentPlacement: this.placement,\n };\n },\n\n computed: {\n // whether the tooltip is visible or not.\n isVisible () {\n const hasMessage = !!this.message?.trim();\n const hasDefaultSlot = !!this.$slots?.default;\n const isDeviceCompatible = !this.isTouchDevice;\n\n const shouldBeVisible = this.isShown && this.enabled && (hasMessage || hasDefaultSlot);\n\n return shouldBeVisible && isDeviceCompatible;\n },\n\n tooltipListeners () {\n return {\n 'after-leave': () => {\n this.onLeaveTransitionComplete();\n },\n\n 'after-enter': () => {\n this.onEnterTransitionComplete();\n },\n };\n },\n\n tippyProps () {\n return {\n offset: this.offset,\n delay: this.delay ? TOOLTIP_DELAY_MS : false,\n placement: this.placement,\n sticky: this.sticky,\n theme: this.inverted ? 'inverted' : undefined,\n animation: this.transition ? 'fade' : false,\n\n popperOptions: getPopperOptions({\n fallbackPlacements: this.fallbackPlacements,\n hasHideModifierEnabled: true,\n onChangePlacement: this.onChangePlacement,\n }),\n };\n },\n\n anchor () {\n return this.externalAnchor ? document.body.querySelector(this.externalAnchor) : getAnchor(this.$refs.anchor);\n },\n },\n\n watch: {\n\n tippyProps: {\n handler: 'setProps',\n deep: true,\n },\n\n show: {\n handler: function (show) {\n if (show !== null) {\n this.isShown = show;\n }\n },\n\n immediate: true,\n },\n\n isShown (isShown) {\n if (isShown) {\n this.setProps();\n this.tip.show();\n } else {\n this.tip.hide();\n }\n },\n\n sticky (sticky) {\n this.tip.setProps({\n sticky,\n });\n },\n },\n\n mounted () {\n if (!this.enabled && this.show != null) {\n console.warn('Tooltip: You cannot use both the enabled and show props at the same time.');\n console.warn('The show prop will be ignored.');\n }\n\n this.externalAnchor && this.addExternalAnchorEventListeners();\n this.tip = createTippy(this.anchor, this.initOptions());\n\n // immediate watcher fires before mounted, so have this here in case\n // show prop was initially set to true.\n if (this.isShown) {\n this.tip.show();\n }\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.tip) {\n this.tip?.destroy();\n }\n },\n\n methods: {\n calculateAnchorZindex () {\n // if a modal is currently active render at modal-element z-index, otherwise at tooltip z-index\n if (this.$el.getRootNode()\n .querySelector('.d-modal[aria-hidden=\"false\"], .d-modal--transparent[aria-hidden=\"false\"]') ||\n // Special case because we don't have any dialtone drawer component yet. Render at 651 when\n // anchor of popover is within a drawer.\n this.$el.closest('.d-zi-drawer')) {\n return 651;\n } else {\n return 400;\n }\n },\n\n hasVisibleFocus () {\n return this.anchor.matches(':focus-visible');\n },\n\n onEnterAnchor (e) {\n if (this.delay && this.inTimer === null) {\n this.inTimer = setTimeout(() => {\n this.triggerShow(e);\n }, TOOLTIP_DELAY_MS);\n } else {\n this.triggerShow(e);\n }\n },\n\n triggerShow (e) {\n if (e.type === 'focusin') {\n // only show tooltips on visible focus when triggered via focus.\n // when the user is using the mouse they only want tooltips to display\n // on mouseover.\n //\n // Example: anchor of a popover is a button with tooltip.\n // closing it with the mouse would trigger the tooltip to display as\n // the anchor is focused on close. Not what we want.\n if (this.show === null && this.hasVisibleFocus()) {\n this.isShown = true;\n }\n } else {\n if (this.show === null) this.isShown = true;\n }\n },\n\n onLeaveAnchor (e) {\n if (e.type === 'keydown' && e.code !== 'Escape') return;\n\n clearTimeout(this.inTimer);\n this.inTimer = null;\n this.triggerHide();\n },\n\n triggerHide () {\n if (this.show === null) this.isShown = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onLeaveTransitionComplete () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onEnterTransitionComplete () {\n this.$emit('shown', true);\n if (this.show !== null) {\n this.$emit('update:show', true);\n }\n },\n\n setProps () {\n if (this.tip && this.tip.setProps) {\n this.tip.setProps({\n ...this.tippyProps,\n // these need to be set here rather than in tippyProps because they are non-reactive\n appendTo: this.appendTo === 'body' ? this.anchor?.getRootNode()?.querySelector('body') : this.appendTo,\n zIndex: this.calculateAnchorZindex(),\n });\n }\n },\n\n onMount () {\n this.setProps();\n },\n\n onShow (tooltipInstance) {\n // don't show tooltip when no content\n if (tooltipInstance.props.content.textContent.length === 0) {\n return false;\n }\n },\n\n // set initial options here. If any of the options need to dynamically change, they should be put in\n // tippyProps instead.\n initOptions () {\n const template = this.$refs.content;\n return {\n content: template,\n arrow: '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"6\"><path transform=\"rotate(180 6.21875 3.575)\" d=\"m12.844.45-6 6-6-6h12Z\"/></svg>',\n // transition duration - same as our custom fade delay in dialtone-globals.less\n duration: 180,\n interactive: false,\n trigger: 'manual',\n hideOnClick: false,\n // disable tooltip from displaying on touch devices\n touch: false,\n onMount: this.onMount,\n onShow: this.onShow,\n popperOptions: getPopperOptions({\n hasHideModifierEnabled: true,\n }),\n };\n },\n\n addExternalAnchorEventListeners () {\n ['focusin', 'mouseenter'].forEach(listener => {\n this.anchor.addEventListener(listener, (event) => this.onEnterAnchor(event));\n });\n ['focusout', 'mouseleave', 'keydown'].forEach(listener => {\n this.anchor.addEventListener(listener, (event) => this.onLeaveAnchor(event));\n });\n },\n\n removeExternalAnchorEventListeners () {\n ['focusin', 'mouseenter'].forEach(listener => {\n this.anchor.removeEventListener(listener, (event) => this.onEnterAnchor(event));\n });\n ['focusout', 'mouseleave', 'keydown'].forEach(listener => {\n this.anchor.removeEventListener(listener, (event) => this.onLeaveAnchor(event));\n });\n },\n },\n};\n</script>\n\n<style lang=\"less\">\n@import 'tippy.js/dist/svg-arrow.css';\n\n.tippy-box[data-reference-hidden] {\n visibility: hidden;\n pointer-events: none;\n}\n\n.tippy-box > .tippy-svg-arrow {\n fill: var(--dt-color-surface-contrast);\n}\n\n.tippy-box[data-theme~='inverted'] > .tippy-svg-arrow {\n fill: var(--dt-color-surface-moderate);\n}\n\n.tippy-box[data-animation='fade'][data-state='hidden'] {\n opacity: 0;\n}\n</style>\n"],"names":["getUniqueString","TOOLTIP_DIRECTIONS","TOOLTIP_STICKY_VALUES","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","TOOLTIP_DELAY_MS","getPopperOptions","getAnchor","createTippy","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_mergeProps","_toHandlers"],"mappings":";;;;;;;;AAkEA,MAAK,YAAU;AAAA,EACb,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI;AAAA,MACF,MAAM;AAAA,MACN,UAAW;AAAE,eAAOA,aAAe,gBAAA;AAAA,MAAK;AAAA,IACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAeD,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,MAAM;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAaD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,GAAG,EAAE;AA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AvCN,YAuCM;AAAA,KAlCK,OAAc,mCADvBA,IAcO,mBAAA,QAAA;AAAA;MAZL,KAAI;AAAA,MACJ,WAAQ;AAAA,MACP,kDAAS,SAAa,iBAAA,SAAA,cAAA,GAAA,IAAA;AAAA,MACtB,mDAAU,SAAa,iBAAA,SAAA,cAAA,GAAA,IAAA;AAAA,MACvB,qDAAY,SAAa,iBAAA,SAAA,cAAA,GAAA,IAAA;AAAA,MACzB,qDAAY,SAAa,iBAAA,SAAA,cAAA,GAAA,IAAA;AAAA,MACzB,+DAAa,SAAa,iBAAA,SAAA,cAAA,GAAA,IAAA,GAAA,CAAA,KAAA,CAAA;AAAA;MAG3BC,eAEE,KAAA,QAAA,QAAA;AAAA;IAEJC,IAAA,mBAmBM,OAnBNC,eAmBM;AAAA,MAlBH,IAAI,OAAE;AAAA,MACP,KAAI;AAAA,MACJ,WAAQ;AAAA,MACP,OAAK;AAAA;;WAA+C,MAAsB,uBAAC,QAAQ,GAAI,OAAQ;AAAA;QAAqB,OAAY;AAAA;IAOjI,GAAAC,IAAA,WAAM,SAAgB,kBAAA,IAAA,CAAA,GAAA;AAAA,MAKtBH,IAAAA,WAEO,4BAFP,MAEO;AAAA,gDADF,OAAO,OAAA,GAAA,CAAA;AAAA;;;;;;;;;;;"}
@@ -1,16 +1,12 @@
1
- import { TOOLTIP_DIRECTIONS, TOOLTIP_STICKY_VALUES, POPOVER_APPEND_TO_VALUES, TOOLTIP_KIND_MODIFIERS, getPopperOptions, getAnchor, createTippy, TOOLTIP_DELAY_MS } from "../chunks/popover_constants-Qkpb0yh2.js";
2
- import { TOOLTIP_HIDE_ON_CLICK_VARIANTS } from "../chunks/popover_constants-Qkpb0yh2.js";
1
+ import { TOOLTIP_DIRECTIONS, TOOLTIP_STICKY_VALUES, POPOVER_APPEND_TO_VALUES, TOOLTIP_KIND_MODIFIERS, TOOLTIP_DELAY_MS, getPopperOptions, getAnchor, createTippy } from "../chunks/popover_constants-kQaX7G4a.js";
2
+ import { TOOLTIP_HIDE_ON_CLICK_VARIANTS } from "../chunks/popover_constants-kQaX7G4a.js";
3
3
  import { getUniqueString, hasSlotContent } from "../common/utils.js";
4
- import { resolveComponent, openBlock, createElementBlock, withKeys, renderSlot, createCommentVNode, createVNode, mergeProps, toHandlers, withCtx, createTextVNode, toDisplayString } from "vue";
4
+ import { openBlock, createElementBlock, withKeys, renderSlot, createCommentVNode, createElementVNode, mergeProps, toHandlers, createTextVNode, toDisplayString } from "vue";
5
5
  import { _export_sfc } from "../chunks/_plugin-vue_export-helper-caHeSgYY.js";
6
- import { DtLazyShow } from "./lazy-show.js";
7
6
  import "tippy.js";
8
7
  import "../common/constants.js";
9
8
  const _sfc_main = {
10
9
  name: "DtTooltip",
11
- components: {
12
- DtLazyShow
13
- },
14
10
  props: {
15
11
  /**
16
12
  * The id of the tooltip
@@ -59,7 +55,7 @@ const _sfc_main = {
59
55
  */
60
56
  offset: {
61
57
  type: Array,
62
- default: () => [0, -4]
58
+ default: () => [0, 12]
63
59
  },
64
60
  /**
65
61
  * The direction the popover displays relative to the anchor. See
@@ -154,20 +150,11 @@ const _sfc_main = {
154
150
  default: null
155
151
  },
156
152
  /**
157
- * Named transition when the content display is toggled.
158
- * @see DtLazyShow
153
+ * Whether the tooltip should have a transition effect.
159
154
  */
160
155
  transition: {
161
- type: String,
162
- default: "fade"
163
- },
164
- /**
165
- * Whether to apply transition on initial render in the content lazy show component.
166
- * @values true, false
167
- */
168
- contentAppear: {
169
156
  type: Boolean,
170
- default: false
157
+ default: true
171
158
  },
172
159
  /**
173
160
  * Whether the tooltip will have a delay when being focused or moused over.
@@ -213,9 +200,7 @@ const _sfc_main = {
213
200
  // this is where the placement currently is, this can be different than
214
201
  // the placement prop when there is not enough available room for the tip
215
202
  // to display and it uses a fallback placement.
216
- currentPlacement: this.placement,
217
- // flag check touch based device
218
- isTouchDevice: false
203
+ currentPlacement: this.placement
219
204
  };
220
205
  },
221
206
  computed: {
@@ -241,10 +226,11 @@ const _sfc_main = {
241
226
  tippyProps() {
242
227
  return {
243
228
  offset: this.offset,
244
- interactive: false,
245
- trigger: "manual",
229
+ delay: this.delay ? TOOLTIP_DELAY_MS : false,
246
230
  placement: this.placement,
247
231
  sticky: this.sticky,
232
+ theme: this.inverted ? "inverted" : void 0,
233
+ animation: this.transition ? "fade" : false,
248
234
  popperOptions: getPopperOptions({
249
235
  fallbackPlacements: this.fallbackPlacements,
250
236
  hasHideModifierEnabled: true,
@@ -315,8 +301,6 @@ const _sfc_main = {
315
301
  return this.anchor.matches(":focus-visible");
316
302
  },
317
303
  onEnterAnchor(e) {
318
- if (this.isTouchDevice && !e.relatedTarget)
319
- return;
320
304
  if (this.delay && this.inTimer === null) {
321
305
  this.inTimer = setTimeout(() => {
322
306
  this.triggerShow(e);
@@ -324,7 +308,6 @@ const _sfc_main = {
324
308
  } else {
325
309
  this.triggerShow(e);
326
310
  }
327
- this.isTouchDevice = false;
328
311
  },
329
312
  triggerShow(e) {
330
313
  if (e.type === "focusin") {
@@ -369,21 +352,39 @@ const _sfc_main = {
369
352
  if (this.tip && this.tip.setProps) {
370
353
  this.tip.setProps({
371
354
  ...this.tippyProps,
372
- zIndex: this.calculateAnchorZindex(),
373
- appendTo: this.appendTo === "body" ? (_b = (_a = this.anchor) == null ? void 0 : _a.getRootNode()) == null ? void 0 : _b.querySelector("body") : this.appendTo
355
+ // these need to be set here rather than in tippyProps because they are non-reactive
356
+ appendTo: this.appendTo === "body" ? (_b = (_a = this.anchor) == null ? void 0 : _a.getRootNode()) == null ? void 0 : _b.querySelector("body") : this.appendTo,
357
+ zIndex: this.calculateAnchorZindex()
374
358
  });
375
359
  }
376
360
  },
377
361
  onMount() {
378
362
  this.setProps();
379
363
  },
364
+ onShow(tooltipInstance) {
365
+ if (tooltipInstance.props.content.textContent.length === 0) {
366
+ return false;
367
+ }
368
+ },
369
+ // set initial options here. If any of the options need to dynamically change, they should be put in
370
+ // tippyProps instead.
380
371
  initOptions() {
372
+ const template = this.$refs.content;
381
373
  return {
382
- contentElement: this.$refs.content.$el,
383
- allowHTML: true,
384
- zIndex: this.calculateAnchorZindex(),
374
+ content: template,
375
+ arrow: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="6"><path transform="rotate(180 6.21875 3.575)" d="m12.844.45-6 6-6-6h12Z"/></svg>',
376
+ // transition duration - same as our custom fade delay in dialtone-globals.less
377
+ duration: 180,
378
+ interactive: false,
379
+ trigger: "manual",
380
+ hideOnClick: false,
381
+ // disable tooltip from displaying on touch devices
382
+ touch: false,
385
383
  onMount: this.onMount,
386
- ...this.tippyProps
384
+ onShow: this.onShow,
385
+ popperOptions: getPopperOptions({
386
+ hasHideModifierEnabled: true
387
+ })
387
388
  };
388
389
  },
389
390
  addExternalAnchorEventListeners() {
@@ -401,15 +402,12 @@ const _sfc_main = {
401
402
  ["focusout", "mouseleave", "keydown"].forEach((listener) => {
402
403
  this.anchor.removeEventListener(listener, (event) => this.onLeaveAnchor(event));
403
404
  });
404
- },
405
- onTouchStart() {
406
- this.isTouchDevice = true;
407
405
  }
408
406
  }
409
407
  };
410
408
  const _hoisted_1 = { "data-qa": "dt-tooltip-container" };
409
+ const _hoisted_2 = ["id"];
411
410
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
412
- const _component_dt_lazy_show = resolveComponent("dt-lazy-show");
413
411
  return openBlock(), createElementBlock("div", _hoisted_1, [
414
412
  !$props.externalAnchor ? (openBlock(), createElementBlock("span", {
415
413
  key: 0,
@@ -419,36 +417,26 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
419
417
  onFocusout: _cache[1] || (_cache[1] = (...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args)),
420
418
  onMouseenter: _cache[2] || (_cache[2] = (...args) => $options.onEnterAnchor && $options.onEnterAnchor(...args)),
421
419
  onMouseleave: _cache[3] || (_cache[3] = (...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args)),
422
- onKeydown: _cache[4] || (_cache[4] = withKeys((...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args), ["esc"])),
423
- onTouchstart: _cache[5] || (_cache[5] = (...args) => $options.onTouchStart && $options.onTouchStart(...args))
420
+ onKeydown: _cache[4] || (_cache[4] = withKeys((...args) => $options.onLeaveAnchor && $options.onLeaveAnchor(...args), ["esc"]))
424
421
  }, [
425
422
  renderSlot(_ctx.$slots, "anchor")
426
423
  ], 544)) : createCommentVNode("", true),
427
- createVNode(_component_dt_lazy_show, mergeProps({
424
+ createElementVNode("div", mergeProps({
428
425
  id: $props.id,
429
426
  ref: "content",
430
- show: $options.isVisible,
431
- role: "tooltip",
432
- "aria-hidden": "false",
433
427
  "data-qa": "dt-tooltip",
434
- appear: $props.contentAppear,
435
- transition: $props.transition,
436
428
  class: [
437
429
  "d-tooltip",
438
- `d-tooltip__arrow-tippy--${$data.currentPlacement}`,
439
430
  {
440
431
  [$data.TOOLTIP_KIND_MODIFIERS.inverted]: $props.inverted
441
432
  },
442
433
  $props.contentClass
443
434
  ]
444
- }, toHandlers($options.tooltipListeners)), {
445
- default: withCtx(() => [
446
- renderSlot(_ctx.$slots, "default", {}, () => [
447
- createTextVNode(toDisplayString($props.message), 1)
448
- ])
449
- ]),
450
- _: 3
451
- }, 16, ["id", "show", "appear", "transition", "class"])
435
+ }, toHandlers($options.tooltipListeners, true)), [
436
+ renderSlot(_ctx.$slots, "default", {}, () => [
437
+ createTextVNode(toDisplayString($props.message), 1)
438
+ ])
439
+ ], 16, _hoisted_2)
452
440
  ]);
453
441
  }
454
442
  const DtTooltip = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);