@dialpad/dialtone 9.143.0 → 9.145.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.
- package/README.md +21 -0
- package/dist/css/dialtone-default-theme.css +100 -13
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone-docs.json +1 -1
- package/dist/css/dialtone.css +100 -13
- package/dist/css/dialtone.min.css +1 -1
- package/dist/css/tokens-docs.json +1 -1
- package/dist/tokens/doc.json +60627 -60627
- package/dist/vue2/lib/avatar/avatar.cjs +1 -1
- package/dist/vue2/lib/avatar/avatar.cjs.map +1 -1
- package/dist/vue2/lib/avatar/avatar.js +13 -10
- package/dist/vue2/lib/avatar/avatar.js.map +1 -1
- package/dist/vue2/lib/popover/popover.cjs +1 -1
- package/dist/vue2/lib/popover/popover.cjs.map +1 -1
- package/dist/vue2/lib/popover/popover.js +12 -10
- package/dist/vue2/lib/popover/popover.js.map +1 -1
- package/dist/vue2/lib/popover/tippy-utils.cjs +1 -1
- package/dist/vue2/lib/popover/tippy-utils.cjs.map +1 -1
- package/dist/vue2/lib/popover/tippy-utils.js +39 -35
- package/dist/vue2/lib/popover/tippy-utils.js.map +1 -1
- package/dist/vue2/lib/tooltip/tooltip.cjs +2 -2
- package/dist/vue2/lib/tooltip/tooltip.cjs.map +1 -1
- package/dist/vue2/lib/tooltip/tooltip.js +7 -7
- package/dist/vue2/lib/tooltip/tooltip.js.map +1 -1
- package/dist/vue2/types/components/popover/tippy_utils.d.ts.map +1 -1
- package/dist/vue3/lib/avatar/avatar.cjs +1 -1
- package/dist/vue3/lib/avatar/avatar.cjs.map +1 -1
- package/dist/vue3/lib/avatar/avatar.js +29 -26
- package/dist/vue3/lib/avatar/avatar.js.map +1 -1
- package/dist/vue3/lib/popover/popover.cjs +1 -1
- package/dist/vue3/lib/popover/popover.cjs.map +1 -1
- package/dist/vue3/lib/popover/popover.js +12 -10
- package/dist/vue3/lib/popover/popover.js.map +1 -1
- package/dist/vue3/lib/popover/tippy-utils.cjs +1 -1
- package/dist/vue3/lib/popover/tippy-utils.cjs.map +1 -1
- package/dist/vue3/lib/popover/tippy-utils.js +39 -35
- package/dist/vue3/lib/popover/tippy-utils.js.map +1 -1
- package/dist/vue3/lib/tooltip/tooltip.cjs +2 -2
- package/dist/vue3/lib/tooltip/tooltip.cjs.map +1 -1
- package/dist/vue3/lib/tooltip/tooltip.js +5 -5
- package/dist/vue3/lib/tooltip/tooltip.js.map +1 -1
- package/dist/vue3/types/components/avatar/avatar.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/popover/tippy_utils.d.ts.map +1 -1
- package/dist/vue3/types/components/tooltip/tooltip.vue.d.ts.map +1 -1
- package/package.json +9 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import o, { sticky as s } from "tippy.js";
|
|
2
|
+
const a = [
|
|
3
3
|
"bottom",
|
|
4
4
|
"bottom-start",
|
|
5
5
|
"bottom-end",
|
|
@@ -12,30 +12,30 @@ const l = [
|
|
|
12
12
|
"top",
|
|
13
13
|
"top-start",
|
|
14
14
|
"top-end"
|
|
15
|
-
],
|
|
16
|
-
const { contentElement: n } = { ...
|
|
17
|
-
return delete
|
|
18
|
-
...
|
|
19
|
-
plugins: [
|
|
20
|
-
render: () =>
|
|
15
|
+
], l = [!0, !1, "reference", "popper"], d = (t, e) => {
|
|
16
|
+
const { contentElement: n } = { ...e };
|
|
17
|
+
return delete e.contentElement, o(t, {
|
|
18
|
+
...e,
|
|
19
|
+
plugins: [s],
|
|
20
|
+
render: () => i(n)
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
...
|
|
24
|
-
plugins: [
|
|
25
|
-
}),
|
|
26
|
-
boundary:
|
|
27
|
-
fallbackPlacements:
|
|
22
|
+
}, m = (t, e) => o(t, {
|
|
23
|
+
...e,
|
|
24
|
+
plugins: [s]
|
|
25
|
+
}), u = ({
|
|
26
|
+
boundary: t = "clippingParents",
|
|
27
|
+
fallbackPlacements: e = [],
|
|
28
28
|
hasHideModifierEnabled: n = !1,
|
|
29
29
|
// If set to false the dialog will display over top of the anchor when there is insufficient space.
|
|
30
30
|
// if set to true it will never move from its position relative to the anchor and will clip instead.
|
|
31
|
-
tether:
|
|
31
|
+
tether: r = !0
|
|
32
32
|
} = {}) => ({
|
|
33
33
|
modifiers: [
|
|
34
34
|
{
|
|
35
35
|
name: "flip",
|
|
36
36
|
options: {
|
|
37
|
-
fallbackPlacements:
|
|
38
|
-
boundary:
|
|
37
|
+
fallbackPlacements: e,
|
|
38
|
+
boundary: t
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -45,30 +45,34 @@ const l = [
|
|
|
45
45
|
{
|
|
46
46
|
name: "preventOverflow",
|
|
47
47
|
options: {
|
|
48
|
-
altAxis: !
|
|
49
|
-
tether:
|
|
48
|
+
altAxis: !r,
|
|
49
|
+
tether: r
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
}, f = (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
}), p = (t) => {
|
|
54
|
+
const e = document.createElement("span");
|
|
55
|
+
return e.innerText = t.innerText || "", t.innerText = "", t.appendChild(e), e;
|
|
56
|
+
}, f = (t) => {
|
|
57
|
+
if (!t) {
|
|
58
|
+
console.warn("No anchor wrapper provided. This may cause issues with the popover.");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const e = t.children[0];
|
|
62
|
+
return e || p(t);
|
|
63
|
+
}, i = (t) => {
|
|
64
|
+
const e = document.createElement("div");
|
|
65
|
+
return e.className = "tippy-box d-ps-absolute", e.appendChild(t), {
|
|
66
|
+
popper: e
|
|
63
67
|
};
|
|
64
68
|
};
|
|
65
69
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
a as BASE_TIPPY_DIRECTIONS,
|
|
71
|
+
l as TIPPY_STICKY_VALUES,
|
|
72
|
+
m as createTippy,
|
|
73
|
+
d as createTippyPopover,
|
|
70
74
|
f as getAnchor,
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
i as getContentWrapper,
|
|
76
|
+
u as getPopperOptions
|
|
73
77
|
};
|
|
74
78
|
//# sourceMappingURL=tippy-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tippy-utils.js","sources":["../../../components/popover/tippy_utils.js"],"sourcesContent":["import tippy, { sticky } from 'tippy.js';\n\nexport const BASE_TIPPY_DIRECTIONS = [\n 'bottom', 'bottom-start', 'bottom-end',\n 'right', 'right-start', 'right-end',\n 'left', 'left-start', 'left-end',\n 'top', 'top-start', 'top-end',\n];\n\nexport const TIPPY_STICKY_VALUES = [true, false, 'reference', 'popper'];\nexport const createTippyPopover = (anchorElement, options) => {\n const { contentElement } = { ...options };\n delete options.contentElement;\n return tippy(anchorElement, {\n ...options,\n plugins: [sticky],\n render: () => getContentWrapper(contentElement),\n });\n};\n\nexport const createTippy = (anchorElement, options) => {\n return tippy(anchorElement, {\n ...options,\n plugins: [sticky],\n });\n};\n\nexport const getPopperOptions = ({\n boundary = 'clippingParents',\n fallbackPlacements = [],\n hasHideModifierEnabled = false,\n // If set to false the dialog will display over top of the anchor when there is insufficient space.\n // if set to true it will never move from its position relative to the anchor and will clip instead.\n tether = true,\n} = {}) => {\n return {\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements,\n boundary,\n },\n },\n {\n name: 'hide',\n enabled: hasHideModifierEnabled,\n },\n {\n name: 'preventOverflow',\n options: {\n altAxis: !tether,\n tether,\n },\n },\n ],\n };\n};\n\nconst createAnchor = (anchorWrapper) => {\n const span = document.createElement('span');\n span.innerText = anchorWrapper.innerText || '';\n anchorWrapper.innerText = '';\n anchorWrapper.appendChild(span);\n return span;\n};\n\nexport const getAnchor = (anchorWrapper) => {\n const anchor = anchorWrapper
|
|
1
|
+
{"version":3,"file":"tippy-utils.js","sources":["../../../components/popover/tippy_utils.js"],"sourcesContent":["import tippy, { sticky } from 'tippy.js';\n\nexport const BASE_TIPPY_DIRECTIONS = [\n 'bottom', 'bottom-start', 'bottom-end',\n 'right', 'right-start', 'right-end',\n 'left', 'left-start', 'left-end',\n 'top', 'top-start', 'top-end',\n];\n\nexport const TIPPY_STICKY_VALUES = [true, false, 'reference', 'popper'];\nexport const createTippyPopover = (anchorElement, options) => {\n const { contentElement } = { ...options };\n delete options.contentElement;\n return tippy(anchorElement, {\n ...options,\n plugins: [sticky],\n render: () => getContentWrapper(contentElement),\n });\n};\n\nexport const createTippy = (anchorElement, options) => {\n return tippy(anchorElement, {\n ...options,\n plugins: [sticky],\n });\n};\n\nexport const getPopperOptions = ({\n boundary = 'clippingParents',\n fallbackPlacements = [],\n hasHideModifierEnabled = false,\n // If set to false the dialog will display over top of the anchor when there is insufficient space.\n // if set to true it will never move from its position relative to the anchor and will clip instead.\n tether = true,\n} = {}) => {\n return {\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements,\n boundary,\n },\n },\n {\n name: 'hide',\n enabled: hasHideModifierEnabled,\n },\n {\n name: 'preventOverflow',\n options: {\n altAxis: !tether,\n tether,\n },\n },\n ],\n };\n};\n\nconst createAnchor = (anchorWrapper) => {\n const span = document.createElement('span');\n span.innerText = anchorWrapper.innerText || '';\n anchorWrapper.innerText = '';\n anchorWrapper.appendChild(span);\n return span;\n};\n\nexport const getAnchor = (anchorWrapper) => {\n if (!anchorWrapper) {\n console.warn('No anchor wrapper provided. This may cause issues with the popover.');\n return;\n }\n const anchor = anchorWrapper.children[0];\n if (!anchor) return createAnchor(anchorWrapper);\n return anchor;\n};\n\nexport const getContentWrapper = content => {\n // The recommended structure is to use the popper as an outer wrapper\n const popper = document.createElement('div');\n popper.className = 'tippy-box d-ps-absolute';\n popper.appendChild(content);\n return {\n popper,\n };\n};\n"],"names":["BASE_TIPPY_DIRECTIONS","TIPPY_STICKY_VALUES","createTippyPopover","anchorElement","options","contentElement","tippy","sticky","getContentWrapper","createTippy","getPopperOptions","boundary","fallbackPlacements","hasHideModifierEnabled","tether","createAnchor","anchorWrapper","span","getAnchor","anchor","content","popper"],"mappings":";AAEY,MAACA,IAAwB;AAAA,EACnC;AAAA,EAAU;AAAA,EAAgB;AAAA,EAC1B;AAAA,EAAS;AAAA,EAAe;AAAA,EACxB;AAAA,EAAQ;AAAA,EAAc;AAAA,EACtB;AAAA,EAAO;AAAA,EAAa;AACtB,GAEaC,IAAsB,CAAC,IAAM,IAAO,aAAa,QAAQ,GACzDC,IAAqB,CAACC,GAAeC,MAAY;AAC5D,QAAM,EAAE,gBAAAC,EAAc,IAAK,EAAE,GAAGD,EAAO;AACvC,gBAAOA,EAAQ,gBACRE,EAAMH,GAAe;AAAA,IAC1B,GAAGC;AAAA,IACH,SAAS,CAACG,CAAM;AAAA,IAChB,QAAQ,MAAMC,EAAkBH,CAAc;AAAA,EAClD,CAAG;AACH,GAEaI,IAAc,CAACN,GAAeC,MAClCE,EAAMH,GAAe;AAAA,EAC1B,GAAGC;AAAA,EACH,SAAS,CAACG,CAAM;AACpB,CAAG,GAGUG,IAAmB,CAAC;AAAA,EAC/B,UAAAC,IAAW;AAAA,EACX,oBAAAC,IAAqB,CAAA;AAAA,EACrB,wBAAAC,IAAyB;AAAA;AAAA;AAAA,EAGzB,QAAAC,IAAS;AACX,IAAI,QACK;AAAA,EACL,WAAW;AAAA,IACT;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,QACP,oBAAAF;AAAA,QACA,UAAAD;AAAA,MACV;AAAA,IACA;AAAA,IACM;AAAA,MACE,MAAM;AAAA,MACN,SAASE;AAAA,IACjB;AAAA,IACM;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,QACP,SAAS,CAACC;AAAA,QACV,QAAAA;AAAA,MACV;AAAA,IACA;AAAA,EACA;AACA,IAGMC,IAAe,CAACC,MAAkB;AACtC,QAAMC,IAAO,SAAS,cAAc,MAAM;AAC1C,SAAAA,EAAK,YAAYD,EAAc,aAAa,IAC5CA,EAAc,YAAY,IAC1BA,EAAc,YAAYC,CAAI,GACvBA;AACT,GAEaC,IAAY,CAACF,MAAkB;AAC1C,MAAI,CAACA,GAAe;AAClB,YAAQ,KAAK,qEAAqE;AAClF;AAAA,EACF;AACA,QAAMG,IAASH,EAAc,SAAS,CAAC;AACvC,SAAKG,KAAeJ,EAAaC,CAAa;AAEhD,GAEaR,IAAoB,CAAAY,MAAW;AAE1C,QAAMC,IAAS,SAAS,cAAc,KAAK;AAC3C,SAAAA,EAAO,YAAY,2BACnBA,EAAO,YAAYD,CAAO,GACnB;AAAA,IACL,QAAAC;AAAA,EACJ;AACA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./tooltip-constants.cjs"),d=require("../popover/popover-constants.cjs"),s=require("../../common/utils/index.cjs"),l=require("../popover/tippy-utils.cjs"),o=require("vue"),u=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),c={compatConfig:{MODE:3},name:"DtTooltip",props:{id:{type:String,default(){return s.getUniqueString()}},fallbackPlacements:{type:Array,default:()=>["auto"]},inverted:{type:Boolean,default:!1},offset:{type:Array,default:()=>[0,12]},placement:{type:String,default:"top",validator(e){return a.TOOLTIP_DIRECTIONS.includes(e)}},sticky:{type:[Boolean,String],default:!0,validator:e=>a.TOOLTIP_STICKY_VALUES.includes(e)},appendTo:{type:[HTMLElement,String],default:"body",validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},contentClass:{type:[String,Object,Array],default:""},message:{type:String,default:""},enabled:{type:Boolean,default:!0},show:{type:Boolean,default:null},transition:{type:Boolean,default:!0},delay:{type:Boolean,default:!0},theme:{type:String,default:null},externalAnchor:{type:String,default:null}},emits:["shown","update:show"],data(){return{TOOLTIP_KIND_MODIFIERS:a.TOOLTIP_KIND_MODIFIERS,hasSlotContent:s.hasSlotContent,tip:null,inTimer:null,internalShow:!1,currentPlacement:this.placement}},computed:{tippyProps(){return{offset:this.offset,delay:this.delay?a.TOOLTIP_DELAY_MS:!1,placement:this.placement,sticky:this.sticky,theme:this.inverted?"inverted":this.theme,animation:this.transition?"fade":!1,onShown:e=>this.onShow(e,"onShown"),onShow:e=>this.onShow(e,"onShow"),onHidden:this.onHide,popperOptions:l.getPopperOptions({fallbackPlacements:this.fallbackPlacements,hasHideModifierEnabled:!0})}},anchor(){return this.externalAnchor?document.body.querySelector(this.externalAnchor):l.getAnchor(this.$refs.anchor)}},watch:{tippyProps:{handler:"setProps",deep:!0},show:{handler:function(e){e!==null&&this.enabled&&(this.internalShow=e)},immediate:!0},internalShow(e){this.tip
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./tooltip-constants.cjs"),d=require("../popover/popover-constants.cjs"),s=require("../../common/utils/index.cjs"),l=require("../popover/tippy-utils.cjs"),o=require("vue"),u=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),c={compatConfig:{MODE:3},name:"DtTooltip",props:{id:{type:String,default(){return s.getUniqueString()}},fallbackPlacements:{type:Array,default:()=>["auto"]},inverted:{type:Boolean,default:!1},offset:{type:Array,default:()=>[0,12]},placement:{type:String,default:"top",validator(e){return a.TOOLTIP_DIRECTIONS.includes(e)}},sticky:{type:[Boolean,String],default:!0,validator:e=>a.TOOLTIP_STICKY_VALUES.includes(e)},appendTo:{type:[HTMLElement,String],default:"body",validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},contentClass:{type:[String,Object,Array],default:""},message:{type:String,default:""},enabled:{type:Boolean,default:!0},show:{type:Boolean,default:null},transition:{type:Boolean,default:!0},delay:{type:Boolean,default:!0},theme:{type:String,default:null},externalAnchor:{type:String,default:null}},emits:["shown","update:show"],data(){return{TOOLTIP_KIND_MODIFIERS:a.TOOLTIP_KIND_MODIFIERS,hasSlotContent:s.hasSlotContent,tip:null,inTimer:null,internalShow:!1,currentPlacement:this.placement}},computed:{tippyProps(){return{offset:this.offset,delay:this.delay?a.TOOLTIP_DELAY_MS:!1,placement:this.placement,sticky:this.sticky,theme:this.inverted?"inverted":this.theme,animation:this.transition?"fade":!1,onShown:e=>this.onShow(e,"onShown"),onShow:e=>this.onShow(e,"onShow"),onHidden:this.onHide,popperOptions:l.getPopperOptions({fallbackPlacements:this.fallbackPlacements,hasHideModifierEnabled:!0})}},anchor(){return this.externalAnchor?document.body.querySelector(this.externalAnchor):l.getAnchor(this.$refs.anchor)}},watch:{tippyProps:{handler:"setProps",deep:!0},show:{handler:function(e){e!==null&&this.enabled&&(this.internalShow=e)},immediate:!0},internalShow(e){!this.tip||!this.anchor||(e?(this.setProps(),this.tip.show()):this.tip.hide())},sticky(e){this.tip.setProps({sticky:e})}},async mounted(){!this.enabled&&this.show!=null&&(console.warn("Tooltip: You cannot use both the enabled and show props at the same time."),console.warn("The show prop will be ignored.")),this.tip=l.createTippy(this.anchor,this.initOptions()),this.externalAnchor&&(await s.flushPromises(),this.addExternalAnchorEventListeners()),s.warnIfUnmounted(s.returnFirstEl(this.$el),this.$options.name)},beforeUnmount(){var e,t;this.externalAnchor&&this.removeExternalAnchorEventListeners(),(e=this.anchor)!=null&&e._tippy&&((t=this.tip)==null||t.destroy())},methods:{calculateAnchorZindex(){return s.returnFirstEl(this.$el).getRootNode().querySelector(`.d-modal[aria-hidden="false"],
|
|
2
2
|
.d-modal--transparent[aria-hidden="false"],
|
|
3
3
|
.d-modal:not([aria-hidden]),
|
|
4
|
-
.d-modal--transparent:not([aria-hidden])`)||s.returnFirstEl(this.$el).closest(".d-zi-drawer")?651:400},hasVisibleFocus(){return this.anchor.matches(":focus-visible")},onEnterAnchor(e){this.enabled&&(this.delay&&this.inTimer===null?this.inTimer=setTimeout(()=>{this.triggerShow(e)},a.TOOLTIP_DELAY_MS):this.triggerShow(e))},triggerShow(e){e.type==="focusin"?this.show===null&&this.hasVisibleFocus()&&(this.internalShow=!0):this.show===null&&(this.internalShow=!0)},onLeaveAnchor(e){e.type==="keydown"&&e.code!=="Escape"||(clearTimeout(this.inTimer),this.inTimer=null,this.triggerHide())},triggerHide(){this.show===null&&(this.internalShow=!1)},onChangePlacement(e){this.currentPlacement=e},onHide(){var e;(e=this.tip)==null||e.unmount(),this.$emit("shown",!1),this.show!==null&&this.$emit("update:show",!1)},onShow(e,t){if(!this.tooltipHasContent(e))return!1;this.transition&&t==="onShow"||(this.$emit("shown",!0),this.show!==null&&this.$emit("update:show",!0))},setProps(){var e,t
|
|
4
|
+
.d-modal--transparent:not([aria-hidden])`)||s.returnFirstEl(this.$el).closest(".d-zi-drawer")?651:400},hasVisibleFocus(){return this.anchor.matches(":focus-visible")},onEnterAnchor(e){this.enabled&&(this.delay&&this.inTimer===null?this.inTimer=setTimeout(()=>{this.triggerShow(e)},a.TOOLTIP_DELAY_MS):this.triggerShow(e))},triggerShow(e){e.type==="focusin"?this.show===null&&this.hasVisibleFocus()&&(this.internalShow=!0):this.show===null&&(this.internalShow=!0)},onLeaveAnchor(e){e.type==="keydown"&&e.code!=="Escape"||(clearTimeout(this.inTimer),this.inTimer=null,this.triggerHide())},triggerHide(){this.show===null&&(this.internalShow=!1)},onChangePlacement(e){this.currentPlacement=e},onHide(){var e;(e=this.tip)==null||e.unmount(),this.$emit("shown",!1),this.show!==null&&this.$emit("update:show",!1)},onShow(e,t){if(!this.tooltipHasContent(e))return!1;this.transition&&t==="onShow"||(this.$emit("shown",!0),this.show!==null&&this.$emit("update:show",!0))},setProps(){var e,t;!this.tip||!this.tip.setProps||!this.anchor||this.tip&&this.tip.setProps&&this.tip.setProps({...this.tippyProps,appendTo:this.appendTo==="body"?(t=(e=this.anchor)==null?void 0:e.getRootNode())==null?void 0:t.querySelector("body"):this.appendTo,zIndex:this.calculateAnchorZindex()})},onMount(){this.setProps()},tooltipHasContent(e){return e.props.content.textContent.trim().length!==0},initOptions(){return{content:this.$refs.content,arrow:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="7"><path d="M 14.5,7 8,0 1.5,7 Z"/></svg>',duration:180,interactive:!1,trigger:"manual",hideOnClick:!1,touch:!1,onMount:this.onMount,showOnCreate:this.internalShow,popperOptions:l.getPopperOptions({hasHideModifierEnabled:!0})}},addExternalAnchorEventListeners(){["focusin","mouseenter"].forEach(e=>{var t;(t=this.anchor)==null||t.addEventListener(e,n=>this.onEnterAnchor(n))}),["focusout","mouseleave","keydown"].forEach(e=>{var t;(t=this.anchor)==null||t.addEventListener(e,n=>this.onLeaveAnchor(n))})},removeExternalAnchorEventListeners(){["focusin","mouseenter"].forEach(e=>{var t;(t=this.anchor)==null||t.removeEventListener(e,n=>this.onEnterAnchor(n))}),["focusout","mouseleave","keydown"].forEach(e=>{var t;(t=this.anchor)==null||t.removeEventListener(e,n=>this.onLeaveAnchor(n))})}}},p={"data-qa":"dt-tooltip-container"},f=["id"];function m(e,t,n,y,h,i){return o.openBlock(),o.createElementBlock("div",p,[n.externalAnchor?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",{key:0,ref:"anchor","data-qa":"dt-tooltip-anchor",onFocusin:t[0]||(t[0]=(...r)=>i.onEnterAnchor&&i.onEnterAnchor(...r)),onFocusout:t[1]||(t[1]=(...r)=>i.onLeaveAnchor&&i.onLeaveAnchor(...r)),onMouseenter:t[2]||(t[2]=(...r)=>i.onEnterAnchor&&i.onEnterAnchor(...r)),onMouseleave:t[3]||(t[3]=(...r)=>i.onLeaveAnchor&&i.onLeaveAnchor(...r)),onKeydown:t[4]||(t[4]=o.withKeys((...r)=>i.onLeaveAnchor&&i.onLeaveAnchor(...r),["esc"]))},[o.renderSlot(e.$slots,"anchor")],544)),o.createElementVNode("div",{id:n.id,ref:"content","data-qa":"dt-tooltip",class:o.normalizeClass(["d-tooltip",{[h.TOOLTIP_KIND_MODIFIERS.inverted]:n.inverted},n.contentClass])},[o.renderSlot(e.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(n.message),1)])],10,f)])}const w=u._(c,[["render",m]]);exports.default=w;
|
|
5
5
|
//# sourceMappingURL=tooltip.cjs.map
|
|
@@ -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 >\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 >\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 { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } 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 compatConfig: { MODE: 3 },\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: true,\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 (fade).\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 * Set a custom theme on the tooltip. See https://atomiks.github.io/tippyjs/v6/themes/\n */\n theme: {\n type: String,\n default: null,\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 internalShow: 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\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' : this.theme,\n animation: this.transition ? 'fade' : false,\n // onShown only triggers when transition is truthy\n onShown: (tooltipInstance) => this.onShow(tooltipInstance, 'onShown'),\n // onShown will always be called, but it will be called before the animation is complete\n onShow: (tooltipInstance) => this.onShow(tooltipInstance, 'onShow'),\n onHidden: this.onHide,\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 && this.enabled) {\n this.internalShow = show;\n }\n },\n\n immediate: true,\n },\n\n internalShow (value) {\n if (!this.tip) return;\n\n if (value) {\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 async 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.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\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 (returnFirstEl(this.$el).getRootNode()\n .querySelector(\n `.d-modal[aria-hidden=\"false\"],\n .d-modal--transparent[aria-hidden=\"false\"],\n .d-modal:not([aria-hidden]),\n .d-modal--transparent:not([aria-hidden])`) ||\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 returnFirstEl(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.enabled) return;\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.internalShow = true;\n }\n } else {\n if (this.show === null) this.internalShow = 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.internalShow = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onHide () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onShow (tooltipInstance, callingMethod) {\n if (!this.tooltipHasContent(tooltipInstance)) {\n return false;\n }\n if (this.transition && callingMethod === 'onShow') {\n return;\n }\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 tooltipHasContent (tooltipInstance) {\n // don't show tooltip when no content\n if (tooltipInstance.props.content.textContent.trim().length === 0) {\n return false;\n }\n return true;\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=\"7\"><path d=\"M 14.5,7 8,0 1.5,7 Z\"/></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 showOnCreate: this.internalShow,\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"],"names":["_sfc_main","getUniqueString","placement","TOOLTIP_DIRECTIONS","sticky","TOOLTIP_STICKY_VALUES","appendTo","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","TOOLTIP_DELAY_MS","tooltipInstance","getPopperOptions","getAnchor","show","value","createTippy","flushPromises","warnIfUnmounted","returnFirstEl","_a","_b","callingMethod","listener","event","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","$props","_createCommentVNode","$options","args","_cache","_withKeys","_renderSlot","_ctx","_createElementVNode","_normalizeClass","$data","_createTextVNode","_toDisplayString"],"mappings":"kWAiEKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,YAEN,MAAO,CAIL,GAAI,CACF,KAAM,OACN,SAAW,CAAE,OAAOC,EAAAA,gBAAe,CAAI,GAgBzC,mBAAoB,CAClB,KAAM,MACN,QAAS,IAAM,CAAC,MAAM,GAOxB,SAAU,CACR,KAAM,QACN,QAAS,IAcX,OAAQ,CACN,KAAM,MACN,QAAS,IAAM,CAAC,EAAG,EAAE,GAkBvB,UAAW,CACT,KAAM,OACN,QAAS,MACT,UAAWC,EAAW,CACpB,OAAOC,EAAAA,mBAAmB,SAASD,CAAS,CAC9C,GAkBF,OAAQ,CACN,KAAM,CAAC,QAAS,MAAM,EACtB,QAAS,GACT,UAAYE,GACHC,EAAAA,sBAAsB,SAASD,CAAM,GAUhD,SAAU,CACR,KAAM,CAAC,YAAa,MAAM,EAC1B,QAAS,OACT,UAAWE,GACFC,EAAAA,yBAAyB,SAASD,CAAQ,GAC5CA,aAAoB,aAS7B,aAAc,CACZ,KAAM,CAAC,OAAQ,OAAQ,KAAK,EAC5B,QAAS,IAMX,QAAS,CACP,KAAM,OACN,QAAS,IAQX,QAAS,CACP,KAAM,QACN,QAAS,IASX,KAAM,CACJ,KAAM,QACN,QAAS,MAMX,WAAY,CACV,KAAM,QACN,QAAS,IAOX,MAAO,CACL,KAAM,QACN,QAAS,IAMX,MAAO,CACL,KAAM,OACN,QAAS,MAOX,eAAgB,C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,CACH,EAEJ,EA/gBOC,EAAA,CAAA,UAAQ,sBAAsB,EADrCC,EAAA,CAAA,IAAA,0BACE,OAAAC,YAAA,EAAAC,qBAsCM,MAtCNH,EAsCM,CAjCKI,EAAA,eANbC,EAAAA,mBAAA,GAAA,EAAA,iBAKIF,EAAAA,mBAcO,OAAA,CAnBX,IAAA,EAOM,IAAI,SACJ,UAAQ,oBACP,8BAASG,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,GACT,+BAAUD,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,GACV,iCAAYD,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,GACZ,iCAAYD,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,GACZ,UAAOC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAbdC,EAAAA,iBAaoBH,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,EAAa,CAAA,KAAA,CAAA,KAG3BG,aAEEC,EAAA,OAAA,QAAA,SAEJC,EAAAA,mBAkBM,MAAA,CAjBH,GAAIR,EAAA,GACL,IAAI,UACJ,UAAQ,aACP,MAxBPS,EAAAA,eAAA,eAwB2DC,EAAA,uBAAuB,QAAQ,EAAIV,EAAA,UAA6BA,EAAA,iBAWrHM,EAAAA,WAEOC,sBAFP,IAEO,CArCbI,EAAAA,gBAAAC,EAAAA,gBAoCWZ,EAAA,OAAO,EAAA,CAAA,GApClB,EAAA,GAAAH,CAAA"}
|
|
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 >\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 { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } 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 compatConfig: { MODE: 3 },\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: true,\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 (fade).\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 * Set a custom theme on the tooltip. See https://atomiks.github.io/tippyjs/v6/themes/\n */\n theme: {\n type: String,\n default: null,\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 internalShow: 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\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' : this.theme,\n animation: this.transition ? 'fade' : false,\n // onShown only triggers when transition is truthy\n onShown: (tooltipInstance) => this.onShow(tooltipInstance, 'onShown'),\n // onShown will always be called, but it will be called before the animation is complete\n onShow: (tooltipInstance) => this.onShow(tooltipInstance, 'onShow'),\n onHidden: this.onHide,\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 && this.enabled) {\n this.internalShow = show;\n }\n },\n\n immediate: true,\n },\n\n internalShow (value) {\n if (!this.tip || !this.anchor) return;\n\n if (value) {\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 async 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.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\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 (returnFirstEl(this.$el).getRootNode()\n .querySelector(\n `.d-modal[aria-hidden=\"false\"],\n .d-modal--transparent[aria-hidden=\"false\"],\n .d-modal:not([aria-hidden]),\n .d-modal--transparent:not([aria-hidden])`) ||\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 returnFirstEl(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.enabled) return;\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.internalShow = true;\n }\n } else {\n if (this.show === null) this.internalShow = 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.internalShow = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onHide () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onShow (tooltipInstance, callingMethod) {\n if (!this.tooltipHasContent(tooltipInstance)) {\n return false;\n }\n if (this.transition && callingMethod === 'onShow') {\n return;\n }\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 || !this.anchor) return;\n\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 tooltipHasContent (tooltipInstance) {\n // don't show tooltip when no content\n if (tooltipInstance.props.content.textContent.trim().length === 0) {\n return false;\n }\n return true;\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=\"7\"><path d=\"M 14.5,7 8,0 1.5,7 Z\"/></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 showOnCreate: this.internalShow,\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"],"names":["_sfc_main","getUniqueString","placement","TOOLTIP_DIRECTIONS","sticky","TOOLTIP_STICKY_VALUES","appendTo","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","TOOLTIP_DELAY_MS","tooltipInstance","getPopperOptions","getAnchor","show","value","createTippy","flushPromises","warnIfUnmounted","returnFirstEl","_a","_b","callingMethod","listener","event","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","$props","_createCommentVNode","$options","args","_cache","_withKeys","_renderSlot","_ctx","_createElementVNode","_normalizeClass","$data","_createTextVNode","_toDisplayString"],"mappings":"kWAiEKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,YAEN,MAAO,CAIL,GAAI,CACF,KAAM,OACN,SAAW,CAAE,OAAOC,EAAAA,gBAAe,CA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AC,CAAA,GACZ,iCAAYD,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,GACZ,UAAOC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAbdC,EAAAA,iBAaoBH,EAAA,eAAAA,EAAA,cAAA,GAAAC,CAAA,EAAa,CAAA,KAAA,CAAA,KAG3BG,aAEEC,EAAA,OAAA,QAAA,SAEJC,EAAAA,mBAkBM,MAAA,CAjBH,GAAIR,EAAA,GACL,IAAI,UACJ,UAAQ,aACP,MAxBPS,EAAAA,eAAA,eAwB2DC,EAAA,uBAAuB,QAAQ,EAAIV,EAAA,UAA6BA,EAAA,iBAWrHM,EAAAA,WAEOC,sBAFP,IAEO,CArCbI,EAAAA,gBAAAC,EAAAA,gBAoCWZ,EAAA,OAAO,EAAA,CAAA,GApClB,EAAA,GAAAH,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { TOOLTIP_DELAY_MS as s, TOOLTIP_KIND_MODIFIERS as c, TOOLTIP_STICKY_VALU
|
|
|
2
2
|
import { POPOVER_APPEND_TO_VALUES as m } from "../popover/popover-constants.js";
|
|
3
3
|
import { returnFirstEl as r, flushPromises as w, warnIfUnmounted as y, hasSlotContent as E, getUniqueString as S } from "../../common/utils/index.js";
|
|
4
4
|
import { getPopperOptions as a, createTippy as v, getAnchor as g } from "../popover/tippy-utils.js";
|
|
5
|
-
import { createElementBlock as h, openBlock as l, createCommentVNode as A, createElementVNode as T, withKeys as
|
|
5
|
+
import { createElementBlock as h, openBlock as l, createCommentVNode as A, createElementVNode as T, withKeys as P, renderSlot as d, normalizeClass as L, createTextVNode as O, toDisplayString as b } from "vue";
|
|
6
6
|
import { _ as x } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
7
|
const I = {
|
|
8
8
|
compatConfig: { MODE: 3 },
|
|
@@ -242,7 +242,7 @@ const I = {
|
|
|
242
242
|
immediate: !0
|
|
243
243
|
},
|
|
244
244
|
internalShow(e) {
|
|
245
|
-
this.tip
|
|
245
|
+
!this.tip || !this.anchor || (e ? (this.setProps(), this.tip.show()) : this.tip.hide());
|
|
246
246
|
},
|
|
247
247
|
sticky(e) {
|
|
248
248
|
this.tip.setProps({
|
|
@@ -299,7 +299,7 @@ const I = {
|
|
|
299
299
|
},
|
|
300
300
|
setProps() {
|
|
301
301
|
var e, t;
|
|
302
|
-
this.tip && this.tip.setProps && this.tip.setProps({
|
|
302
|
+
!this.tip || !this.tip.setProps || !this.anchor || this.tip && this.tip.setProps && this.tip.setProps({
|
|
303
303
|
...this.tippyProps,
|
|
304
304
|
// these need to be set here rather than in tippyProps because they are non-reactive
|
|
305
305
|
appendTo: this.appendTo === "body" ? (t = (e = this.anchor) == null ? void 0 : e.getRootNode()) == null ? void 0 : t.querySelector("body") : this.appendTo,
|
|
@@ -362,7 +362,7 @@ function M(e, t, n, _, u, o) {
|
|
|
362
362
|
onFocusout: t[1] || (t[1] = (...i) => o.onLeaveAnchor && o.onLeaveAnchor(...i)),
|
|
363
363
|
onMouseenter: t[2] || (t[2] = (...i) => o.onEnterAnchor && o.onEnterAnchor(...i)),
|
|
364
364
|
onMouseleave: t[3] || (t[3] = (...i) => o.onLeaveAnchor && o.onLeaveAnchor(...i)),
|
|
365
|
-
onKeydown: t[4] || (t[4] =
|
|
365
|
+
onKeydown: t[4] || (t[4] = P((...i) => o.onLeaveAnchor && o.onLeaveAnchor(...i), ["esc"]))
|
|
366
366
|
}, [
|
|
367
367
|
d(e.$slots, "anchor")
|
|
368
368
|
], 544)),
|
|
@@ -370,7 +370,7 @@ function M(e, t, n, _, u, o) {
|
|
|
370
370
|
id: n.id,
|
|
371
371
|
ref: "content",
|
|
372
372
|
"data-qa": "dt-tooltip",
|
|
373
|
-
class:
|
|
373
|
+
class: L([
|
|
374
374
|
"d-tooltip",
|
|
375
375
|
{
|
|
376
376
|
[u.TOOLTIP_KIND_MODIFIERS.inverted]: n.inverted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","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 >\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 { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } 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 compatConfig: { MODE: 3 },\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: true,\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 (fade).\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 * Set a custom theme on the tooltip. See https://atomiks.github.io/tippyjs/v6/themes/\n */\n theme: {\n type: String,\n default: null,\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 internalShow: 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\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' : this.theme,\n animation: this.transition ? 'fade' : false,\n // onShown only triggers when transition is truthy\n onShown: (tooltipInstance) => this.onShow(tooltipInstance, 'onShown'),\n // onShown will always be called, but it will be called before the animation is complete\n onShow: (tooltipInstance) => this.onShow(tooltipInstance, 'onShow'),\n onHidden: this.onHide,\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 && this.enabled) {\n this.internalShow = show;\n }\n },\n\n immediate: true,\n },\n\n internalShow (value) {\n if (!this.tip) return;\n\n if (value) {\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 async 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.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\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 (returnFirstEl(this.$el).getRootNode()\n .querySelector(\n `.d-modal[aria-hidden=\"false\"],\n .d-modal--transparent[aria-hidden=\"false\"],\n .d-modal:not([aria-hidden]),\n .d-modal--transparent:not([aria-hidden])`) ||\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 returnFirstEl(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.enabled) return;\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.internalShow = true;\n }\n } else {\n if (this.show === null) this.internalShow = 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.internalShow = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onHide () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onShow (tooltipInstance, callingMethod) {\n if (!this.tooltipHasContent(tooltipInstance)) {\n return false;\n }\n if (this.transition && callingMethod === 'onShow') {\n return;\n }\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 tooltipHasContent (tooltipInstance) {\n // don't show tooltip when no content\n if (tooltipInstance.props.content.textContent.trim().length === 0) {\n return false;\n }\n return true;\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=\"7\"><path d=\"M 14.5,7 8,0 1.5,7 Z\"/></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 showOnCreate: this.internalShow,\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"],"names":["_sfc_main","getUniqueString","placement","TOOLTIP_DIRECTIONS","sticky","TOOLTIP_STICKY_VALUES","appendTo","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","TOOLTIP_DELAY_MS","tooltipInstance","getPopperOptions","getAnchor","show","value","createTippy","flushPromises","warnIfUnmounted","returnFirstEl","_a","_b","callingMethod","listener","event","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","$props","_createCommentVNode","$options","args","_cache","_withKeys","_renderSlot","_ctx","_createElementVNode","_normalizeClass","$data","_createTextVNode","_toDisplayString"],"mappings":";;;;;;AAiEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI;AAAA,MACF,MAAM;AAAA,MACN,UAAW;AAAE,eAAOC,EAAe;AAAA,MAAI;AAAA;;;;;;;;;;;;;;IAgBzC,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,MAAM;AAAA;;;;;IAOxB,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;;;;IAcX,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM,CAAC,GAAG,EAAE;AAAA;;;;;;;;;;;;;;;;IAkBvB,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAWC,GAAW;AACpB,eAAOC,EAAmB,SAASD,CAAS;AAAA,MAC9C;AAAA;;;;;;;;;;;;;;;;IAkBF,QAAQ;AAAA,MACN,MAAM,CAAC,SAAS,MAAM;AAAA,MACtB,SAAS;AAAA,MACT,WAAW,CAACE,MACHC,EAAsB,SAASD,CAAM;AAAA;;;;;;;IAUhD,UAAU;AAAA,MACR,MAAM,CAAC,aAAa,MAAM;AAAA,MAC1B,SAAS;AAAA,MACT,WAAW,CAAAE,MACFC,EAAyB,SAASD,CAAQ,KAC5CA,aAAoB;AAAA;;;;;;IAS7B,cAAc;AAAA,MACZ,MAAM,CAAC,QAAQ,QAAQ,KAAK;AAAA,MAC5B,SAAS;AAAA;;;;IAMX,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;IASX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;I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AAA,MAnBX,KAAA;AAAA,MAOM,KAAI;AAAA,MACJ,WAAQ;AAAA,MACP,qCAASG,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA;AAAA,MACT,sCAAUD,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA;AAAA,MACV,wCAAYD,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA;AAAA,MACZ,wCAAYD,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA;AAAA,MACZ,WAAOC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAbdC,YAaoBH,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA,GAAa,CAAA,KAAA,CAAA;AAAA;MAG3BG,EAEEC,EAAA,QAAA,QAAA;AAAA;IAEJC,EAkBM,OAAA;AAAA,MAjBH,IAAIR,EAAA;AAAA,MACL,KAAI;AAAA,MACJ,WAAQ;AAAA,MACP,OAxBPS,EAAA;AAAA;;WAwB2DC,EAAA,uBAAuB,QAAQ,GAAIV,EAAA;AAAA;QAA6BA,EAAA;AAAA;;MAWrHM,EAEOC,yBAFP,MAEO;AAAA,QArCbI,EAAAC,EAoCWZ,EAAA,OAAO,GAAA,CAAA;AAAA;IApClB,GAAA,IAAAH,CAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"tooltip.js","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 >\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 { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } 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 compatConfig: { MODE: 3 },\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: true,\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 (fade).\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 * Set a custom theme on the tooltip. See https://atomiks.github.io/tippyjs/v6/themes/\n */\n theme: {\n type: String,\n default: null,\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 internalShow: 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\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' : this.theme,\n animation: this.transition ? 'fade' : false,\n // onShown only triggers when transition is truthy\n onShown: (tooltipInstance) => this.onShow(tooltipInstance, 'onShown'),\n // onShown will always be called, but it will be called before the animation is complete\n onShow: (tooltipInstance) => this.onShow(tooltipInstance, 'onShow'),\n onHidden: this.onHide,\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 && this.enabled) {\n this.internalShow = show;\n }\n },\n\n immediate: true,\n },\n\n internalShow (value) {\n if (!this.tip || !this.anchor) return;\n\n if (value) {\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 async 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.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n this.externalAnchor && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\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 (returnFirstEl(this.$el).getRootNode()\n .querySelector(\n `.d-modal[aria-hidden=\"false\"],\n .d-modal--transparent[aria-hidden=\"false\"],\n .d-modal:not([aria-hidden]),\n .d-modal--transparent:not([aria-hidden])`) ||\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 returnFirstEl(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.enabled) return;\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.internalShow = true;\n }\n } else {\n if (this.show === null) this.internalShow = 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.internalShow = false;\n },\n\n onChangePlacement (placement) {\n this.currentPlacement = placement;\n },\n\n onHide () {\n this.tip?.unmount();\n this.$emit('shown', false);\n if (this.show !== null) {\n this.$emit('update:show', false);\n }\n },\n\n onShow (tooltipInstance, callingMethod) {\n if (!this.tooltipHasContent(tooltipInstance)) {\n return false;\n }\n if (this.transition && callingMethod === 'onShow') {\n return;\n }\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 || !this.anchor) return;\n\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 tooltipHasContent (tooltipInstance) {\n // don't show tooltip when no content\n if (tooltipInstance.props.content.textContent.trim().length === 0) {\n return false;\n }\n return true;\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=\"7\"><path d=\"M 14.5,7 8,0 1.5,7 Z\"/></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 showOnCreate: this.internalShow,\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"],"names":["_sfc_main","getUniqueString","placement","TOOLTIP_DIRECTIONS","sticky","TOOLTIP_STICKY_VALUES","appendTo","POPOVER_APPEND_TO_VALUES","TOOLTIP_KIND_MODIFIERS","hasSlotContent","TOOLTIP_DELAY_MS","tooltipInstance","getPopperOptions","getAnchor","show","value","createTippy","flushPromises","warnIfUnmounted","returnFirstEl","_a","_b","callingMethod","listener","event","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","$props","_createCommentVNode","$options","args","_cache","_withKeys","_renderSlot","_ctx","_createElementVNode","_normalizeClass","$data","_createTextVNode","_toDisplayString"],"mappings":";;;;;;AAiEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI;AAAA,MACF,MAAM;AAAA,MACN,UAAW;AAAE,eAAOC,EAAe;AAAA,MAAI;AAAA;;;;;;;;;;;;;;IAgBzC,oBAAoB;AAAA,MAClB,MAAM;AAAA,M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AA,cAAA,GAAAC,CAAA;AAAA,MACZ,WAAOC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAbdC,YAaoBH,EAAA,iBAAAA,EAAA,cAAA,GAAAC,CAAA,GAAa,CAAA,KAAA,CAAA;AAAA;MAG3BG,EAEEC,EAAA,QAAA,QAAA;AAAA;IAEJC,EAkBM,OAAA;AAAA,MAjBH,IAAIR,EAAA;AAAA,MACL,KAAI;AAAA,MACJ,WAAQ;AAAA,MACP,OAxBPS,EAAA;AAAA;;WAwB2DC,EAAA,uBAAuB,QAAQ,GAAIV,EAAA;AAAA;QAA6BA,EAAA;AAAA;;MAWrHM,EAEOC,yBAFP,MAEO;AAAA,QArCbI,EAAAC,EAoCWZ,EAAA,OAAO,GAAA,CAAA;AAAA;IApClB,GAAA,IAAAH,CAAA;AAAA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.vue.d.ts","sourceRoot":"","sources":["../../../../components/avatar/avatar.vue"],"names":[],"mappings":"AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+
|
|
1
|
+
{"version":3,"file":"avatar.vue.d.ts","sourceRoot":"","sources":["../../../../components/avatar/avatar.vue"],"names":[],"mappings":"AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAobkE,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tippy_utils.d.ts","sourceRoot":"","sources":["../../../../components/popover/tippy_utils.js"],"names":[],"mappings":"AAEA,6CAKE;AAEF,uDAAwE;AACjE,8HAQN;AAEM,uHAKN;AAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BN;AAUM,
|
|
1
|
+
{"version":3,"file":"tippy_utils.d.ts","sourceRoot":"","sources":["../../../../components/popover/tippy_utils.js"],"names":[],"mappings":"AAEA,6CAKE;AAEF,uDAAwE;AACjE,8HAQN;AAEM,uHAKN;AAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BN;AAUM,mDAQN;AAEM;;EAQN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.vue.d.ts","sourceRoot":"","sources":["../../../../components/tooltip/tooltip.vue"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+
|
|
1
|
+
{"version":3,"file":"tooltip.vue.d.ts","sourceRoot":"","sources":["../../../../components/tooltip/tooltip.vue"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA+hB+F,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialpad/dialtone",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.145.0",
|
|
4
4
|
"description": "Dialpad's Dialtone design system monorepo",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"overlayscrollbars": "2.10.0",
|
|
81
81
|
"regex-combined-emojis": "1.6.0",
|
|
82
82
|
"tippy.js": "6.3.7",
|
|
83
|
-
"@dialpad/dialtone-
|
|
84
|
-
"@dialpad/dialtone-mcp-server": "1.0.2",
|
|
83
|
+
"@dialpad/dialtone-emojis": "1.2.3",
|
|
85
84
|
"@dialpad/dialtone-tokens": "1.47.1",
|
|
86
|
-
"@dialpad/dialtone-
|
|
85
|
+
"@dialpad/dialtone-mcp-server": "1.1.0",
|
|
86
|
+
"@dialpad/dialtone-icons": "4.44.1"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@commitlint/cli": "^18.4.3",
|
|
@@ -189,5 +189,9 @@
|
|
|
189
189
|
"nx": {
|
|
190
190
|
"includedScripts": []
|
|
191
191
|
},
|
|
192
|
-
"scripts": {
|
|
192
|
+
"scripts": {
|
|
193
|
+
"clean": "pnpm clean:dist && pnpm clean:cache",
|
|
194
|
+
"clean:dist": "rm -rf packages/dialtone-tokens/dist apps/dialtone-documentation/docs/.vuepress/.cache apps/dialtone-documentation/docs/.vuepress/.temp",
|
|
195
|
+
"clean:cache": "pnpm nx reset --onlyCache"
|
|
196
|
+
}
|
|
193
197
|
}
|