@dialpad/dialtone-vue 4.2.0 → 4.3.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.
@@ -109,6 +109,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
109
109
  hasSlotContent: typeof hasSlotContent;
110
110
  i18n: any;
111
111
  autoTeleportTarget: null;
112
+ mousedownOnBackdrop: boolean;
113
+ mouseupOnBackdrop: boolean;
112
114
  }, {
113
115
  hasFooterSlot(): boolean;
114
116
  bannerKindClass(): any;
@@ -117,6 +119,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
117
119
  getScrollRoot(): any;
118
120
  syncDialogState(isShowing: any): void;
119
121
  close(): void;
122
+ onBackdropMousedown(event: any): void;
123
+ onBackdropMouseup(event: any): void;
120
124
  onBackdropClick(event: any): void;
121
125
  onKeydown(event: any): void;
122
126
  onAfterEnter(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../components/Modal/Modal.vue"],"names":[],"mappings":"AAkIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA6iBuG,gBAAgB"}
@@ -16,6 +16,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
16
16
  type: ArrayConstructor;
17
17
  default: () => number[];
18
18
  };
19
+ showArrow: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
19
23
  placement: {
20
24
  type: StringConstructor;
21
25
  default: string;
@@ -90,7 +94,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
90
94
  internalShow: boolean;
91
95
  currentPlacement: string;
92
96
  }, {
97
+ tippyArrow(): false | "<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>";
93
98
  tippyProps(): {
99
+ arrow: string | boolean;
94
100
  offset: unknown[];
95
101
  delay: number | boolean;
96
102
  placement: string;
@@ -144,7 +150,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
144
150
  tooltipHasContent(tooltipInstance: any): boolean;
145
151
  initOptions(): {
146
152
  content: unknown;
147
- arrow: string;
153
+ arrow: string | boolean;
148
154
  duration: number;
149
155
  interactive: boolean;
150
156
  trigger: string;
@@ -223,6 +229,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
223
229
  type: ArrayConstructor;
224
230
  default: () => number[];
225
231
  };
232
+ showArrow: {
233
+ type: BooleanConstructor;
234
+ default: boolean;
235
+ };
226
236
  placement: {
227
237
  type: StringConstructor;
228
238
  default: string;
@@ -302,6 +312,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
302
312
  theme: string;
303
313
  fallbackPlacements: unknown[];
304
314
  enabled: boolean;
315
+ showArrow: boolean;
305
316
  transition: boolean;
306
317
  externalAnchor: string;
307
318
  externalAnchorElement: any;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.vue.d.ts","sourceRoot":"","sources":["../../../components/Tooltip/Tooltip.vue"],"names":[],"mappings":"AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAklB+F,gBAAgB"}
1
+ {"version":3,"file":"Tooltip.vue.d.ts","sourceRoot":"","sources":["../../../components/Tooltip/Tooltip.vue"],"names":[],"mappings":"AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAmmB+F,gBAAgB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/mode.cjs`),i=require(`../notice/notice-constants.cjs`),a=require(`../text/text.cjs`),o=require(`../../localization/index.cjs`),s=require(`../button/button.cjs`),c=require(`../../shared/sr_only_close_button.cjs`),l=require(`./modal-constants.cjs`);let u=require(`vue`),d=require(`@dialpad/dialtone-icons/vue`);var f=`button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),textarea:not(:disabled),details,[tabindex]:not([tabindex="-1"]):not(:disabled):not([aria-disabled="true"])`,p={name:`DtModal`,components:{DtButton:s.default,DtText:a.default,DtIconClose:d.DtIconClose,SrOnlyCloseButton:c.default},mixins:[r.default],props:{copy:{type:String,default:``},describedById:{type:String,default:``},labelledById:{type:String,default:function(){return t.getUniqueString()}},open:{type:Boolean,default:!1},headerText:{type:String,default:void 0},bannerHeaderText:{type:String,default:void 0},kind:{type:String,default:`default`,validator:e=>Object.keys(l.MODAL_KIND_MODIFIERS).includes(e)},fullscreen:{type:Boolean,default:!1},modalClass:{type:[String,Object,Array],default:``},dialogClass:{type:[String,Object,Array],default:``},contentClass:{type:[String,Object,Array],default:``},bannerKind:{type:String,default:`warning`,validator(e){return i.NOTICE_KINDS.includes(e)}},bannerClass:{type:[String,Object,Array],default:``},headerClass:{type:[String,Object,Array],default:``},footerClass:{type:[String,Object,Array],default:``},showClose:{type:Boolean,default:!0},closeOnClick:{type:Boolean,default:!0},fixedHeaderFooter:{type:Boolean,default:!0},initialFocusElement:{type:[String,e.HTML_ELEMENT_TYPE],default:`first`,validator:e=>e===`first`||e instanceof HTMLElement||e.startsWith(`#`)},appendTo:{type:String,default:void 0},transparentBackdrop:{type:Boolean,default:!1},modal:{type:Boolean,default:!1}},emits:[`click`,`keydown`,`update:open`],data(){return{MODAL_KIND_MODIFIERS:l.MODAL_KIND_MODIFIERS,MODAL_BANNER_KINDS:l.MODAL_BANNER_KINDS,hasSlotContent:t.hasSlotContent,i18n:new o.DialtoneLocalization,autoTeleportTarget:null}},computed:{hasFooterSlot(){return!!this.$slots.footer},bannerKindClass(){return l.MODAL_BANNER_KINDS[this.bannerKind]},closeButtonTitle(){return this.i18n.$t(`DIALTONE_CLOSE_BUTTON`)}},watch:{open(e){this.syncDialogState(e)}},mounted(){if(!this.appendTo){let e=this.$el?.getRootNode();if(e instanceof ShadowRoot){this.autoTeleportTarget=e,this.open&&this.$nextTick(()=>{this.open&&this.syncDialogState(!0)});return}}this.open&&this.syncDialogState(!0)},beforeUnmount(){let e=this.$refs.dialogEl;e?.open&&(e.close(),t.enableRootScrolling(this.getScrollRoot())),this.previousActiveElement=null},methods:{getScrollRoot(){return t.returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host},syncDialogState(e){let n=this.$refs.dialogEl;n&&(e?(this.previousActiveElement=document.activeElement,n.open||(this.modal?n.showModal():n.show()),t.disableRootScrolling(this.getScrollRoot())):n.open&&t.enableRootScrolling(this.getScrollRoot()))},close(){this.$emit(`update:open`,!1)},onBackdropClick(e){this.closeOnClick&&e.target===e.currentTarget&&this.close(),this.$emit(`click`,e)},onKeydown(e){!this.modal&&e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),this.close()),this.$emit(`keydown`,e)},async onAfterEnter(){this.$emit(`update:open`,!0),await this.setFocusAfterTransition()},onAfterLeave(){let e=this.$refs.dialogEl;e?.open&&e.close(),this.previousActiveElement?.focus(),this.previousActiveElement=null},focusFirstTabbable(e){let t=[...e.querySelectorAll(f)];if(!t.length)return;let n=t[0];n.matches(`[type="radio"]:not(:checked)`)&&(n=t.find(e=>e.checked&&e.name===n.name)||n),n.focus({preventScroll:!0})},async setFocusAfterTransition(){let e=this.$refs.dialogEl;if(e)if(await this.$nextTick(),this.initialFocusElement===`first`)this.focusFirstTabbable(e);else if(typeof this.initialFocusElement==`string`&&this.initialFocusElement.startsWith(`#`)){let t=e.querySelector(this.initialFocusElement);t?t.focus():(console.warn(`Could not find the element specified in dt-modal prop "initialFocusElement". Defaulting to focusing the first element.`),this.focusFirstTabbable(e))}else this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()}}},m=[`aria-modal`,`aria-describedby`,`aria-labelledby`],h=[`id`];function g(e,t,n,r,i,a){let o=(0,u.resolveComponent)(`dt-text`),s=(0,u.resolveComponent)(`sr-only-close-button`),c=(0,u.resolveComponent)(`dt-icon-close`),l=(0,u.resolveComponent)(`dt-button`),d=(0,u.resolveDirective)(`dt-focustrap`);return(0,u.openBlock)(),(0,u.createBlock)(u.Teleport,{disabled:!n.appendTo&&!i.autoTeleportTarget,to:n.appendTo||i.autoTeleportTarget},[(0,u.withDirectives)(((0,u.openBlock)(),(0,u.createElementBlock)(`dialog`,(0,u.mergeProps)({ref:`dialogEl`,class:[`d-modal`,i.MODAL_KIND_MODIFIERS[n.kind],{"d-modal--full":n.fullscreen},{"d-modal--transparent-backdrop":n.transparentBackdrop},n.modalClass],"data-qa":`dt-modal`,"aria-modal":n.modal?`true`:void 0,"aria-describedby":n.describedById||void 0,"aria-labelledby":n.labelledById},e.modeAttrs,{onCancel:t[0]||(t[0]=(0,u.withModifiers)((...e)=>a.close&&a.close(...e),[`prevent`])),onClick:t[1]||(t[1]=(...e)=>a.onBackdropClick&&a.onBackdropClick(...e)),onKeydown:t[2]||(t[2]=(...e)=>a.onKeydown&&a.onKeydown(...e))}),[n.open&&(i.hasSlotContent(e.$slots.banner)||n.bannerHeaderText)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,"data-qa":`dt-modal-banner`,class:(0,u.normalizeClass)([`d-modal__banner`,n.bannerClass,a.bannerKindClass])},[(0,u.renderSlot)(e.$slots,`banner`,{},()=>[(0,u.createTextVNode)((0,u.toDisplayString)(n.bannerHeaderText),1)])],2)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(u.Transition,{appear:n.open,name:`d-modal__dialog`,onAfterEnter:a.onAfterEnter,onAfterLeave:a.onAfterLeave},{default:(0,u.withCtx)(()=>[(0,u.withDirectives)((0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`d-modal__dialog`,{"d-modal__dialog--scrollable":n.fixedHeaderFooter},n.dialogClass])},[i.hasSlotContent(e.$slots.header)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,id:n.labelledById,class:(0,u.normalizeClass)([`d-modal__header`,n.headerClass]),"data-qa":`dt-modal-title`},[(0,u.renderSlot)(e.$slots,`header`)],10,h)):((0,u.openBlock)(),(0,u.createBlock)(o,{key:1,id:n.labelledById,kind:`headline`,size:600,strength:`medium`,density:`100`,"text-box-trim":`start`,as:`h2`,class:(0,u.normalizeClass)([`d-modal__header`,n.headerClass]),"data-qa":`dt-modal-title`},{default:(0,u.withCtx)(()=>[(0,u.createTextVNode)((0,u.toDisplayString)(n.headerText),1)]),_:1},8,[`id`,`class`])),i.hasSlotContent(e.$slots.default)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:2,class:(0,u.normalizeClass)([`d-modal__content`,n.contentClass]),"data-qa":`dt-modal-copy`},[(0,u.renderSlot)(e.$slots,`default`)],2)):((0,u.openBlock)(),(0,u.createElementBlock)(`p`,{key:3,class:(0,u.normalizeClass)([`d-modal__content`,n.contentClass]),"data-qa":`dt-modal-copy`},(0,u.toDisplayString)(n.copy),3)),a.hasFooterSlot?((0,u.openBlock)(),(0,u.createElementBlock)(`footer`,{key:4,class:(0,u.normalizeClass)([`d-modal__footer`,n.footerClass])},[(0,u.renderSlot)(e.$slots,`footer`)],2)):(0,u.createCommentVNode)(``,!0),n.showClose?((0,u.openBlock)(),(0,u.createBlock)(l,{key:6,class:`d-modal__close`,"data-qa":`dt-modal-close-button`,size:300,kind:`muted`,importance:`clear`,"aria-label":a.closeButtonTitle,title:a.closeButtonTitle,onClick:a.close},{icon:(0,u.withCtx)(({iconSize:e})=>[(0,u.createVNode)(c,{size:e},null,8,[`size`])]),_:1},8,[`aria-label`,`title`,`onClick`])):((0,u.openBlock)(),(0,u.createBlock)(s,{key:5,onClose:a.close},null,8,[`onClose`]))],2),[[u.vShow,n.open]])]),_:3},8,[`appear`,`onAfterEnter`,`onAfterLeave`])],16,m)),[[d,{active:n.open,initialFocus:!1,restoreFocus:!1}]])],8,[`disabled`,`to`])}var _=n.t(p,[[`render`,g]]);exports.default=_;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/mode.cjs`),i=require(`../notice/notice-constants.cjs`),a=require(`../text/text.cjs`),o=require(`../../localization/index.cjs`),s=require(`../button/button.cjs`),c=require(`../../shared/sr_only_close_button.cjs`),l=require(`./modal-constants.cjs`);let u=require(`vue`),d=require(`@dialpad/dialtone-icons/vue`);var f=`button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),textarea:not(:disabled),details,[tabindex]:not([tabindex="-1"]):not(:disabled):not([aria-disabled="true"])`,p={name:`DtModal`,components:{DtButton:s.default,DtText:a.default,DtIconClose:d.DtIconClose,SrOnlyCloseButton:c.default},mixins:[r.default],props:{copy:{type:String,default:``},describedById:{type:String,default:``},labelledById:{type:String,default:function(){return t.getUniqueString()}},open:{type:Boolean,default:!1},headerText:{type:String,default:void 0},bannerHeaderText:{type:String,default:void 0},kind:{type:String,default:`default`,validator:e=>Object.keys(l.MODAL_KIND_MODIFIERS).includes(e)},fullscreen:{type:Boolean,default:!1},modalClass:{type:[String,Object,Array],default:``},dialogClass:{type:[String,Object,Array],default:``},contentClass:{type:[String,Object,Array],default:``},bannerKind:{type:String,default:`warning`,validator(e){return i.NOTICE_KINDS.includes(e)}},bannerClass:{type:[String,Object,Array],default:``},headerClass:{type:[String,Object,Array],default:``},footerClass:{type:[String,Object,Array],default:``},showClose:{type:Boolean,default:!0},closeOnClick:{type:Boolean,default:!0},fixedHeaderFooter:{type:Boolean,default:!0},initialFocusElement:{type:[String,e.HTML_ELEMENT_TYPE],default:`first`,validator:e=>e===`first`||e instanceof HTMLElement||e.startsWith(`#`)},appendTo:{type:String,default:void 0},transparentBackdrop:{type:Boolean,default:!1},modal:{type:Boolean,default:!1}},emits:[`click`,`keydown`,`update:open`],data(){return{MODAL_KIND_MODIFIERS:l.MODAL_KIND_MODIFIERS,MODAL_BANNER_KINDS:l.MODAL_BANNER_KINDS,hasSlotContent:t.hasSlotContent,i18n:new o.DialtoneLocalization,autoTeleportTarget:null,mousedownOnBackdrop:!1,mouseupOnBackdrop:!1}},computed:{hasFooterSlot(){return!!this.$slots.footer},bannerKindClass(){return l.MODAL_BANNER_KINDS[this.bannerKind]},closeButtonTitle(){return this.i18n.$t(`DIALTONE_CLOSE_BUTTON`)}},watch:{open(e){this.syncDialogState(e)}},mounted(){if(!this.appendTo){let e=this.$el?.getRootNode();if(e instanceof ShadowRoot){this.autoTeleportTarget=e,this.open&&this.$nextTick(()=>{this.open&&this.syncDialogState(!0)});return}}this.open&&this.syncDialogState(!0)},beforeUnmount(){let e=this.$refs.dialogEl;e?.open&&(e.close(),t.enableRootScrolling(this.getScrollRoot())),this.previousActiveElement=null},methods:{getScrollRoot(){return t.returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host},syncDialogState(e){let n=this.$refs.dialogEl;n&&(e?(this.previousActiveElement=document.activeElement,n.open||(this.modal?n.showModal():n.show()),t.disableRootScrolling(this.getScrollRoot())):n.open&&t.enableRootScrolling(this.getScrollRoot()))},close(){this.$emit(`update:open`,!1)},onBackdropMousedown(e){this.mousedownOnBackdrop=e.target===e.currentTarget},onBackdropMouseup(e){this.mouseupOnBackdrop=e.target===e.currentTarget},onBackdropClick(e){let t=this.mousedownOnBackdrop&&this.mouseupOnBackdrop;this.closeOnClick&&e.target===e.currentTarget&&t&&this.close(),this.$emit(`click`,e)},onKeydown(e){!this.modal&&e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),this.close()),this.$emit(`keydown`,e)},async onAfterEnter(){this.$emit(`update:open`,!0),await this.setFocusAfterTransition()},onAfterLeave(){let e=this.$refs.dialogEl;e?.open&&e.close(),this.previousActiveElement?.focus(),this.previousActiveElement=null},focusFirstTabbable(e){let t=[...e.querySelectorAll(f)];if(!t.length)return;let n=t[0];n.matches(`[type="radio"]:not(:checked)`)&&(n=t.find(e=>e.checked&&e.name===n.name)||n),n.focus({preventScroll:!0})},async setFocusAfterTransition(){let e=this.$refs.dialogEl;if(e)if(await this.$nextTick(),this.initialFocusElement===`first`)this.focusFirstTabbable(e);else if(typeof this.initialFocusElement==`string`&&this.initialFocusElement.startsWith(`#`)){let t=e.querySelector(this.initialFocusElement);t?t.focus():(console.warn(`Could not find the element specified in dt-modal prop "initialFocusElement". Defaulting to focusing the first element.`),this.focusFirstTabbable(e))}else this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()}}},m=[`aria-modal`,`aria-describedby`,`aria-labelledby`],h=[`id`];function g(e,t,n,r,i,a){let o=(0,u.resolveComponent)(`dt-text`),s=(0,u.resolveComponent)(`sr-only-close-button`),c=(0,u.resolveComponent)(`dt-icon-close`),l=(0,u.resolveComponent)(`dt-button`),d=(0,u.resolveDirective)(`dt-focustrap`);return(0,u.openBlock)(),(0,u.createBlock)(u.Teleport,{disabled:!n.appendTo&&!i.autoTeleportTarget,to:n.appendTo||i.autoTeleportTarget},[(0,u.withDirectives)(((0,u.openBlock)(),(0,u.createElementBlock)(`dialog`,(0,u.mergeProps)({ref:`dialogEl`,class:[`d-modal`,i.MODAL_KIND_MODIFIERS[n.kind],{"d-modal--full":n.fullscreen},{"d-modal--transparent-backdrop":n.transparentBackdrop},n.modalClass],"data-qa":`dt-modal`,"aria-modal":n.modal?`true`:void 0,"aria-describedby":n.describedById||void 0,"aria-labelledby":n.labelledById},e.modeAttrs,{onCancel:t[0]||(t[0]=(0,u.withModifiers)((...e)=>a.close&&a.close(...e),[`prevent`])),onMousedown:t[1]||(t[1]=(...e)=>a.onBackdropMousedown&&a.onBackdropMousedown(...e)),onMouseup:t[2]||(t[2]=(...e)=>a.onBackdropMouseup&&a.onBackdropMouseup(...e)),onClick:t[3]||(t[3]=(...e)=>a.onBackdropClick&&a.onBackdropClick(...e)),onKeydown:t[4]||(t[4]=(...e)=>a.onKeydown&&a.onKeydown(...e))}),[n.open&&(i.hasSlotContent(e.$slots.banner)||n.bannerHeaderText)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,"data-qa":`dt-modal-banner`,class:(0,u.normalizeClass)([`d-modal__banner`,n.bannerClass,a.bannerKindClass])},[(0,u.renderSlot)(e.$slots,`banner`,{},()=>[(0,u.createTextVNode)((0,u.toDisplayString)(n.bannerHeaderText),1)])],2)):(0,u.createCommentVNode)(``,!0),(0,u.createVNode)(u.Transition,{appear:n.open,name:`d-modal__dialog`,onAfterEnter:a.onAfterEnter,onAfterLeave:a.onAfterLeave},{default:(0,u.withCtx)(()=>[(0,u.withDirectives)((0,u.createElementVNode)(`div`,{class:(0,u.normalizeClass)([`d-modal__dialog`,{"d-modal__dialog--scrollable":n.fixedHeaderFooter},n.dialogClass])},[i.hasSlotContent(e.$slots.header)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:0,id:n.labelledById,class:(0,u.normalizeClass)([`d-modal__header`,n.headerClass]),"data-qa":`dt-modal-title`},[(0,u.renderSlot)(e.$slots,`header`)],10,h)):((0,u.openBlock)(),(0,u.createBlock)(o,{key:1,id:n.labelledById,kind:`headline`,size:600,strength:`medium`,density:`100`,"text-box-trim":`start`,as:`h2`,class:(0,u.normalizeClass)([`d-modal__header`,n.headerClass]),"data-qa":`dt-modal-title`},{default:(0,u.withCtx)(()=>[(0,u.createTextVNode)((0,u.toDisplayString)(n.headerText),1)]),_:1},8,[`id`,`class`])),i.hasSlotContent(e.$slots.default)?((0,u.openBlock)(),(0,u.createElementBlock)(`div`,{key:2,class:(0,u.normalizeClass)([`d-modal__content`,n.contentClass]),"data-qa":`dt-modal-copy`},[(0,u.renderSlot)(e.$slots,`default`)],2)):((0,u.openBlock)(),(0,u.createElementBlock)(`p`,{key:3,class:(0,u.normalizeClass)([`d-modal__content`,n.contentClass]),"data-qa":`dt-modal-copy`},(0,u.toDisplayString)(n.copy),3)),a.hasFooterSlot?((0,u.openBlock)(),(0,u.createElementBlock)(`footer`,{key:4,class:(0,u.normalizeClass)([`d-modal__footer`,n.footerClass])},[(0,u.renderSlot)(e.$slots,`footer`)],2)):(0,u.createCommentVNode)(``,!0),n.showClose?((0,u.openBlock)(),(0,u.createBlock)(l,{key:6,class:`d-modal__close`,"data-qa":`dt-modal-close-button`,size:300,kind:`muted`,importance:`clear`,"aria-label":a.closeButtonTitle,title:a.closeButtonTitle,onClick:a.close},{icon:(0,u.withCtx)(({iconSize:e})=>[(0,u.createVNode)(c,{size:e},null,8,[`size`])]),_:1},8,[`aria-label`,`title`,`onClick`])):((0,u.openBlock)(),(0,u.createBlock)(s,{key:5,onClose:a.close},null,8,[`onClose`]))],2),[[u.vShow,n.open]])]),_:3},8,[`appear`,`onAfterEnter`,`onAfterLeave`])],16,m)),[[d,{active:n.open,initialFocus:!1,restoreFocus:!1}]])],8,[`disabled`,`to`])}var _=n.t(p,[[`render`,g]]);exports.default=_;
2
2
  //# sourceMappingURL=modal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal.cjs","names":[],"sources":["../../../components/Modal/Modal.vue"],"sourcesContent":["<template>\n <teleport\n :disabled=\"!appendTo && !autoTeleportTarget\"\n :to=\"appendTo || autoTeleportTarget\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <dialog\n ref=\"dialogEl\"\n v-dt-focustrap=\"{ active: open, initialFocus: false, restoreFocus: false }\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n { 'd-modal--full': fullscreen },\n { 'd-modal--transparent-backdrop': transparentBackdrop },\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-modal=\"modal ? 'true' : undefined\"\n :aria-describedby=\"describedById || undefined\"\n :aria-labelledby=\"labelledById\"\n v-bind=\"modeAttrs\"\n @cancel.prevent=\"close\"\n @click=\"onBackdropClick\"\n @keydown=\"onKeydown\"\n >\n <div\n v-if=\"open && (hasSlotContent($slots.banner) || bannerHeaderText)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerHeaderText prop -->\n <slot name=\"banner\">\n {{ bannerHeaderText }}\n </slot>\n </div>\n <transition\n :appear=\"open\"\n name=\"d-modal__dialog\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-show=\"open\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"headerText\" text prop -->\n <slot name=\"header\" />\n </div>\n <dt-text\n v-else\n :id=\"labelledById\"\n kind=\"headline\"\n :size=\"600\"\n strength=\"medium\"\n density=\"100\"\n text-box-trim=\"start\"\n as=\"h2\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n {{ headerText }}\n </dt-text>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n :class=\"['d-modal__footer', footerClass]\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"!showClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n :size=\"300\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close\n :size=\"iconSize\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dialog>\n </teleport>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/Button';\nimport { DtText } from '@/components/Text';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue';\nimport ModeMixin from '@/common/mixins/mode';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n} from './ModalConstants';\nimport { getUniqueString, hasSlotContent, returnFirstEl, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/Notice';\nimport { DialtoneLocalization } from '@/localization';\n\nconst focusableSelector = 'button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),' +\n 'textarea:not(:disabled),details,[tabindex]:not([tabindex=\"-1\"]):not(:disabled):not([aria-disabled=\"true\"])';\n\n/**\n * Modals focus the user's attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n name: 'DtModal',\n\n components: {\n DtButton,\n DtText,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [ModeMixin],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n open: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Header text to display in the modal header.\n */\n headerText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Header text to display in the modal banner.\n */\n bannerHeaderText: {\n type: String,\n default: undefined,\n },\n\n /**\n * The theme of the modal.\n * @values default, critical\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Whether the modal fills the viewport instead of rendering at its default size.\n * @values true, false\n */\n fullscreen: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept 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 * Sets the color of the banner.\n * @values base, critical, info, positive, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validator (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the header element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n headerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the footer element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n footerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Shows the close button on the modal\n * @values true, false\n */\n showClose: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTML_ELEMENT_TYPE],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n\n /**\n * A CSS selector string for the element to portal the modal to. If not provided, the modal will be rendered in its default location.\n */\n appendTo: {\n type: String,\n default: undefined,\n },\n\n /**\n * When true, the surrounding backdrop is rendered fully transparent\n * instead of the default dimming overlay. The dialog box itself\n * remains opaque. Useful when the underlying UI should remain visible.\n * @values true, false\n */\n transparentBackdrop: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When true, the dialog opens with showModal(), which promotes it to the browser\n * top layer. Nothing outside the top layer can paint above it regardless of\n * z-index, so application surfaces such as toasts and call notifications end up\n * behind it. When false, it opens with show() and stays in the normal stacking\n * order, where the Dialtone z-index scale applies and --zi-notification (700)\n * outranks --zi-modal (600) as documented.\n *\n * Focus trapping, scroll locking and Esc-to-close behave identically in both\n * modes. Background inertness does not: only the top layer provides it, so with\n * modal unset the page outside the dialog stays reachable. That is deliberate —\n * it is what lets an application's own overlays remain usable above a modal —\n * and keyboard containment still comes from the focus trap.\n * @values true, false\n */\n modal: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:open\n * @type {Boolean}\n */\n 'update:open',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_BANNER_KINDS,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n autoTeleportTarget: null,\n };\n },\n\n computed: {\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n open (isShowing) {\n this.syncDialogState(isShowing);\n },\n },\n\n mounted () {\n if (!this.appendTo) {\n const root = this.$el?.getRootNode();\n if (root instanceof ShadowRoot) {\n this.autoTeleportTarget = root;\n // Defer syncDialogState so the teleport renders inside the shadow root first.\n if (this.open) this.$nextTick(() => { if (this.open) this.syncDialogState(true); });\n return;\n }\n }\n if (this.open) {\n this.syncDialogState(true);\n }\n },\n\n beforeUnmount () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n enableRootScrolling(this.getScrollRoot());\n }\n this.previousActiveElement = null;\n },\n\n methods: {\n getScrollRoot () {\n return returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host;\n },\n\n syncDialogState (isShowing) {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n if (isShowing) {\n this.previousActiveElement = document.activeElement;\n if (!dialogEl.open) {\n // show() leaves the dialog in the normal stacking order instead of the\n // top layer, where the z-index scale still applies.\n if (this.modal) dialogEl.showModal(); else dialogEl.show();\n }\n disableRootScrolling(this.getScrollRoot());\n } else if (dialogEl.open) {\n // Leave transition plays via v-show on inner content.\n // close() is called in onAfterLeave when transition completes.\n enableRootScrolling(this.getScrollRoot());\n }\n },\n\n\n\n close () {\n this.$emit('update:open', false);\n },\n\n onBackdropClick (event) {\n if (this.closeOnClick && event.target === event.currentTarget) {\n this.close();\n }\n this.$emit('click', event);\n },\n\n onKeydown (event) {\n // The native cancel event only fires for dialogs opened with showModal(), so\n // Esc has to be handled explicitly to keep dismissal identical in both modes.\n // defaultPrevented means a nested widget (dropdown, combobox) already consumed\n // it to close itself, and the modal must not close out from under it.\n if (!this.modal && event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.close();\n }\n this.$emit('keydown', event);\n },\n\n async onAfterEnter () {\n this.$emit('update:open', true);\n await this.setFocusAfterTransition();\n },\n\n onAfterLeave () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n }\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n },\n\n focusFirstTabbable (container) {\n const focusable = [...container.querySelectorAll(focusableSelector)];\n if (!focusable.length) return;\n let target = focusable[0];\n // If first focusable is an unchecked radio, prefer the checked radio in the same group.\n if (target.matches('[type=\"radio\"]:not(:checked)')) {\n target = focusable.find(el => el.checked && el.name === target.name) || target;\n }\n target.focus({ preventScroll: true });\n },\n\n async setFocusAfterTransition () {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n await this.$nextTick();\n\n if (this.initialFocusElement === 'first') {\n this.focusFirstTabbable(dialogEl);\n } else if (typeof this.initialFocusElement === 'string' && this.initialFocusElement.startsWith('#')) {\n const el = dialogEl.querySelector(this.initialFocusElement);\n if (el) {\n el.focus();\n } else {\n // eslint-disable-next-line no-console\n console.warn('Could not find the element specified in dt-modal prop \"initialFocusElement\". ' +\n 'Defaulting to focusing the first element.');\n this.focusFirstTabbable(dialogEl);\n }\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n },\n};\n</script>\n"],"mappings":"+mBAmJA,IAAM,EAAoB,qLAQrB,EAAU,CACb,KAAM,UAEN,WAA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A,iBACZ,MAAO,EAAA,iBACP,QAAO,EAAA,QAEG,MAAA,EAAA,EAAA,UAGP,CAHe,cAAQ,EAAA,EAAA,EAAA,aAGvB,EAAA,CADC,KAAM,EAAQ,CAAA,KAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA,6CAhBZ,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,aAEP,EAAA,OADC,QAAO,EAAA,0CA5DF,EAAA,KAAI,CAAA,CAAA,CAAA,CAAA,sEAtCU,EAAA,KAAI,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,WAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"modal.cjs","names":[],"sources":["../../../components/Modal/Modal.vue"],"sourcesContent":["<template>\n <teleport\n :disabled=\"!appendTo && !autoTeleportTarget\"\n :to=\"appendTo || autoTeleportTarget\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <dialog\n ref=\"dialogEl\"\n v-dt-focustrap=\"{ active: open, initialFocus: false, restoreFocus: false }\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n { 'd-modal--full': fullscreen },\n { 'd-modal--transparent-backdrop': transparentBackdrop },\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-modal=\"modal ? 'true' : undefined\"\n :aria-describedby=\"describedById || undefined\"\n :aria-labelledby=\"labelledById\"\n v-bind=\"modeAttrs\"\n @cancel.prevent=\"close\"\n @mousedown=\"onBackdropMousedown\"\n @mouseup=\"onBackdropMouseup\"\n @click=\"onBackdropClick\"\n @keydown=\"onKeydown\"\n >\n <div\n v-if=\"open && (hasSlotContent($slots.banner) || bannerHeaderText)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerHeaderText prop -->\n <slot name=\"banner\">\n {{ bannerHeaderText }}\n </slot>\n </div>\n <transition\n :appear=\"open\"\n name=\"d-modal__dialog\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-show=\"open\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"headerText\" text prop -->\n <slot name=\"header\" />\n </div>\n <dt-text\n v-else\n :id=\"labelledById\"\n kind=\"headline\"\n :size=\"600\"\n strength=\"medium\"\n density=\"100\"\n text-box-trim=\"start\"\n as=\"h2\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n {{ headerText }}\n </dt-text>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n :class=\"['d-modal__footer', footerClass]\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"!showClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n :size=\"300\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close\n :size=\"iconSize\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dialog>\n </teleport>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/Button';\nimport { DtText } from '@/components/Text';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue';\nimport ModeMixin from '@/common/mixins/mode';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n} from './ModalConstants';\nimport { getUniqueString, hasSlotContent, returnFirstEl, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/Notice';\nimport { DialtoneLocalization } from '@/localization';\n\nconst focusableSelector = 'button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),' +\n 'textarea:not(:disabled),details,[tabindex]:not([tabindex=\"-1\"]):not(:disabled):not([aria-disabled=\"true\"])';\n\n/**\n * Modals focus the user's attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n name: 'DtModal',\n\n components: {\n DtButton,\n DtText,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [ModeMixin],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n open: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Header text to display in the modal header.\n */\n headerText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Header text to display in the modal banner.\n */\n bannerHeaderText: {\n type: String,\n default: undefined,\n },\n\n /**\n * The theme of the modal.\n * @values default, critical\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Whether the modal fills the viewport instead of rendering at its default size.\n * @values true, false\n */\n fullscreen: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept 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 * Sets the color of the banner.\n * @values base, critical, info, positive, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validator (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the header element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n headerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the footer element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n footerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Shows the close button on the modal\n * @values true, false\n */\n showClose: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTML_ELEMENT_TYPE],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n\n /**\n * A CSS selector string for the element to portal the modal to. If not provided, the modal will be rendered in its default location.\n */\n appendTo: {\n type: String,\n default: undefined,\n },\n\n /**\n * When true, the surrounding backdrop is rendered fully transparent\n * instead of the default dimming overlay. The dialog box itself\n * remains opaque. Useful when the underlying UI should remain visible.\n * @values true, false\n */\n transparentBackdrop: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When true, the dialog opens with showModal(), which promotes it to the browser\n * top layer. Nothing outside the top layer can paint above it regardless of\n * z-index, so application surfaces such as toasts and call notifications end up\n * behind it. When false, it opens with show() and stays in the normal stacking\n * order, where the Dialtone z-index scale applies and --zi-notification (700)\n * outranks --zi-modal (600) as documented.\n *\n * Focus trapping, scroll locking and Esc-to-close behave identically in both\n * modes. Background inertness does not: only the top layer provides it, so with\n * modal unset the page outside the dialog stays reachable. That is deliberate —\n * it is what lets an application's own overlays remain usable above a modal —\n * and keyboard containment still comes from the focus trap.\n * @values true, false\n */\n modal: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:open\n * @type {Boolean}\n */\n 'update:open',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_BANNER_KINDS,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n autoTeleportTarget: null,\n mousedownOnBackdrop: false,\n mouseupOnBackdrop: false,\n };\n },\n\n computed: {\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n open (isShowing) {\n this.syncDialogState(isShowing);\n },\n },\n\n mounted () {\n if (!this.appendTo) {\n const root = this.$el?.getRootNode();\n if (root instanceof ShadowRoot) {\n this.autoTeleportTarget = root;\n // Defer syncDialogState so the teleport renders inside the shadow root first.\n if (this.open) this.$nextTick(() => { if (this.open) this.syncDialogState(true); });\n return;\n }\n }\n if (this.open) {\n this.syncDialogState(true);\n }\n },\n\n beforeUnmount () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n enableRootScrolling(this.getScrollRoot());\n }\n this.previousActiveElement = null;\n },\n\n methods: {\n getScrollRoot () {\n return returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host;\n },\n\n syncDialogState (isShowing) {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n if (isShowing) {\n this.previousActiveElement = document.activeElement;\n if (!dialogEl.open) {\n // show() leaves the dialog in the normal stacking order instead of the\n // top layer, where the z-index scale still applies.\n if (this.modal) dialogEl.showModal(); else dialogEl.show();\n }\n disableRootScrolling(this.getScrollRoot());\n } else if (dialogEl.open) {\n // Leave transition plays via v-show on inner content.\n // close() is called in onAfterLeave when transition completes.\n enableRootScrolling(this.getScrollRoot());\n }\n },\n\n\n\n close () {\n this.$emit('update:open', false);\n },\n\n onBackdropMousedown (event) {\n this.mousedownOnBackdrop = event.target === event.currentTarget;\n },\n\n onBackdropMouseup (event) {\n this.mouseupOnBackdrop = event.target === event.currentTarget;\n },\n\n onBackdropClick (event) {\n const pressedAndReleasedOnBackdrop = this.mousedownOnBackdrop && this.mouseupOnBackdrop;\n if (this.closeOnClick && event.target === event.currentTarget && pressedAndReleasedOnBackdrop) {\n this.close();\n }\n this.$emit('click', event);\n },\n\n onKeydown (event) {\n // The native cancel event only fires for dialogs opened with showModal(), so\n // Esc has to be handled explicitly to keep dismissal identical in both modes.\n // defaultPrevented means a nested widget (dropdown, combobox) already consumed\n // it to close itself, and the modal must not close out from under it.\n if (!this.modal && event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.close();\n }\n this.$emit('keydown', event);\n },\n\n async onAfterEnter () {\n this.$emit('update:open', true);\n await this.setFocusAfterTransition();\n },\n\n onAfterLeave () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n }\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n },\n\n focusFirstTabbable (container) {\n const focusable = [...container.querySelectorAll(focusableSelector)];\n if (!focusable.length) return;\n let target = focusable[0];\n // If first focusable is an unchecked radio, prefer the checked radio in the same group.\n if (target.matches('[type=\"radio\"]:not(:checked)')) {\n target = focusable.find(el => el.checked && el.name === target.name) || target;\n }\n target.focus({ preventScroll: true });\n },\n\n async setFocusAfterTransition () {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n await this.$nextTick();\n\n if (this.initialFocusElement === 'first') {\n this.focusFirstTabbable(dialogEl);\n } else if (typeof this.initialFocusElement === 'string' && this.initialFocusElement.startsWith('#')) {\n const el = dialogEl.querySelector(this.initialFocusElement);\n if (el) {\n el.focus();\n } else {\n // eslint-disable-next-line no-console\n console.warn('Could not find the element specified in dt-modal prop \"initialFocusElement\". ' +\n 'Defaulting to focusing the first element.');\n this.focusFirstTabbable(dialogEl);\n }\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n },\n};\n</script>\n"],"mappings":"+mBAqJA,IAAM,EAAoB,qLAQrB,EAAU,CACb,KAAM,UAEN,WAAY,CACV,SAAA,EAAA,QACA,OAAA,EAAA,QACA,Y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A,KAAI,CAAA,EAAA,EAGD,EAAA,gBAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBAKC,SAAA,OAJN,OAAA,EAAA,EAAA,gBAAK,CAAA,kBAAsB,EAAA,YAAW,CAAA,oBAGjB,EAAA,OAAA,SAAA,CAAA,CAAA,EAAA,GAAA,EAAA,EAAA,oBAAA,GAAA,GAAA,CAGf,EAAA,+CAmBG,EAAA,OAdV,MAAM,iBACN,UAAQ,wBACP,KAAM,IACP,KAAK,QACL,WAAW,QACV,aAAY,EAAA,iBACZ,MAAO,EAAA,iBACP,QAAO,EAAA,QAEG,MAAA,EAAA,EAAA,UAGP,CAHe,cAAQ,EAAA,EAAA,EAAA,aAGvB,EAAA,CADC,KAAM,EAAQ,CAAA,KAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA,6CAhBZ,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,aAEP,EAAA,OADC,QAAO,EAAA,0CA5DF,EAAA,KAAI,CAAA,CAAA,CAAA,CAAA,sEAxCU,EAAA,KAAI,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,WAAA,KAAA,CAAA"}
@@ -152,7 +152,9 @@ var F = "button:not(:disabled),[href],input:not(:disabled),select:not(:disabled)
152
152
  MODAL_BANNER_KINDS: p,
153
153
  hasSlotContent: i,
154
154
  i18n: new u(),
155
- autoTeleportTarget: null
155
+ autoTeleportTarget: null,
156
+ mousedownOnBackdrop: !1,
157
+ mouseupOnBackdrop: !1
156
158
  };
157
159
  },
158
160
  computed: {
@@ -196,8 +198,15 @@ var F = "button:not(:disabled),[href],input:not(:disabled),select:not(:disabled)
196
198
  close() {
197
199
  this.$emit("update:open", !1);
198
200
  },
201
+ onBackdropMousedown(e) {
202
+ this.mousedownOnBackdrop = e.target === e.currentTarget;
203
+ },
204
+ onBackdropMouseup(e) {
205
+ this.mouseupOnBackdrop = e.target === e.currentTarget;
206
+ },
199
207
  onBackdropClick(e) {
200
- this.closeOnClick && e.target === e.currentTarget && this.close(), this.$emit("click", e);
208
+ let t = this.mousedownOnBackdrop && this.mouseupOnBackdrop;
209
+ this.closeOnClick && e.target === e.currentTarget && t && this.close(), this.$emit("click", e);
201
210
  },
202
211
  onKeydown(e) {
203
212
  !this.modal && e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), this.close()), this.$emit("keydown", e);
@@ -249,8 +258,10 @@ function z(e, t, n, r, i, a) {
249
258
  "aria-labelledby": n.labelledById
250
259
  }, e.modeAttrs, {
251
260
  onCancel: t[0] || (t[0] = N((...e) => a.close && a.close(...e), ["prevent"])),
252
- onClick: t[1] || (t[1] = (...e) => a.onBackdropClick && a.onBackdropClick(...e)),
253
- onKeydown: t[2] || (t[2] = (...e) => a.onKeydown && a.onKeydown(...e))
261
+ onMousedown: t[1] || (t[1] = (...e) => a.onBackdropMousedown && a.onBackdropMousedown(...e)),
262
+ onMouseup: t[2] || (t[2] = (...e) => a.onBackdropMouseup && a.onBackdropMouseup(...e)),
263
+ onClick: t[3] || (t[3] = (...e) => a.onBackdropClick && a.onBackdropClick(...e)),
264
+ onKeydown: t[4] || (t[4] = (...e) => a.onKeydown && a.onKeydown(...e))
254
265
  }), [n.open && (i.hasSlotContent(e.$slots.banner) || n.bannerHeaderText) ? (T(), y("div", {
255
266
  key: 0,
256
267
  "data-qa": "dt-modal-banner",
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","names":[],"sources":["../../../components/Modal/Modal.vue"],"sourcesContent":["<template>\n <teleport\n :disabled=\"!appendTo && !autoTeleportTarget\"\n :to=\"appendTo || autoTeleportTarget\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <dialog\n ref=\"dialogEl\"\n v-dt-focustrap=\"{ active: open, initialFocus: false, restoreFocus: false }\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n { 'd-modal--full': fullscreen },\n { 'd-modal--transparent-backdrop': transparentBackdrop },\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-modal=\"modal ? 'true' : undefined\"\n :aria-describedby=\"describedById || undefined\"\n :aria-labelledby=\"labelledById\"\n v-bind=\"modeAttrs\"\n @cancel.prevent=\"close\"\n @click=\"onBackdropClick\"\n @keydown=\"onKeydown\"\n >\n <div\n v-if=\"open && (hasSlotContent($slots.banner) || bannerHeaderText)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerHeaderText prop -->\n <slot name=\"banner\">\n {{ bannerHeaderText }}\n </slot>\n </div>\n <transition\n :appear=\"open\"\n name=\"d-modal__dialog\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-show=\"open\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"headerText\" text prop -->\n <slot name=\"header\" />\n </div>\n <dt-text\n v-else\n :id=\"labelledById\"\n kind=\"headline\"\n :size=\"600\"\n strength=\"medium\"\n density=\"100\"\n text-box-trim=\"start\"\n as=\"h2\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n {{ headerText }}\n </dt-text>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n :class=\"['d-modal__footer', footerClass]\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"!showClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n :size=\"300\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close\n :size=\"iconSize\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dialog>\n </teleport>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/Button';\nimport { DtText } from '@/components/Text';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue';\nimport ModeMixin from '@/common/mixins/mode';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n} from './ModalConstants';\nimport { getUniqueString, hasSlotContent, returnFirstEl, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/Notice';\nimport { DialtoneLocalization } from '@/localization';\n\nconst focusableSelector = 'button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),' +\n 'textarea:not(:disabled),details,[tabindex]:not([tabindex=\"-1\"]):not(:disabled):not([aria-disabled=\"true\"])';\n\n/**\n * Modals focus the user's attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n name: 'DtModal',\n\n components: {\n DtButton,\n DtText,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [ModeMixin],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n open: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Header text to display in the modal header.\n */\n headerText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Header text to display in the modal banner.\n */\n bannerHeaderText: {\n type: String,\n default: undefined,\n },\n\n /**\n * The theme of the modal.\n * @values default, critical\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Whether the modal fills the viewport instead of rendering at its default size.\n * @values true, false\n */\n fullscreen: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept 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 * Sets the color of the banner.\n * @values base, critical, info, positive, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validator (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the header element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n headerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the footer element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n footerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Shows the close button on the modal\n * @values true, false\n */\n showClose: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTML_ELEMENT_TYPE],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n\n /**\n * A CSS selector string for the element to portal the modal to. If not provided, the modal will be rendered in its default location.\n */\n appendTo: {\n type: String,\n default: undefined,\n },\n\n /**\n * When true, the surrounding backdrop is rendered fully transparent\n * instead of the default dimming overlay. The dialog box itself\n * remains opaque. Useful when the underlying UI should remain visible.\n * @values true, false\n */\n transparentBackdrop: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When true, the dialog opens with showModal(), which promotes it to the browser\n * top layer. Nothing outside the top layer can paint above it regardless of\n * z-index, so application surfaces such as toasts and call notifications end up\n * behind it. When false, it opens with show() and stays in the normal stacking\n * order, where the Dialtone z-index scale applies and --zi-notification (700)\n * outranks --zi-modal (600) as documented.\n *\n * Focus trapping, scroll locking and Esc-to-close behave identically in both\n * modes. Background inertness does not: only the top layer provides it, so with\n * modal unset the page outside the dialog stays reachable. That is deliberate —\n * it is what lets an application's own overlays remain usable above a modal —\n * and keyboard containment still comes from the focus trap.\n * @values true, false\n */\n modal: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:open\n * @type {Boolean}\n */\n 'update:open',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_BANNER_KINDS,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n autoTeleportTarget: null,\n };\n },\n\n computed: {\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n open (isShowing) {\n this.syncDialogState(isShowing);\n },\n },\n\n mounted () {\n if (!this.appendTo) {\n const root = this.$el?.getRootNode();\n if (root instanceof ShadowRoot) {\n this.autoTeleportTarget = root;\n // Defer syncDialogState so the teleport renders inside the shadow root first.\n if (this.open) this.$nextTick(() => { if (this.open) this.syncDialogState(true); });\n return;\n }\n }\n if (this.open) {\n this.syncDialogState(true);\n }\n },\n\n beforeUnmount () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n enableRootScrolling(this.getScrollRoot());\n }\n this.previousActiveElement = null;\n },\n\n methods: {\n getScrollRoot () {\n return returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host;\n },\n\n syncDialogState (isShowing) {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n if (isShowing) {\n this.previousActiveElement = document.activeElement;\n if (!dialogEl.open) {\n // show() leaves the dialog in the normal stacking order instead of the\n // top layer, where the z-index scale still applies.\n if (this.modal) dialogEl.showModal(); else dialogEl.show();\n }\n disableRootScrolling(this.getScrollRoot());\n } else if (dialogEl.open) {\n // Leave transition plays via v-show on inner content.\n // close() is called in onAfterLeave when transition completes.\n enableRootScrolling(this.getScrollRoot());\n }\n },\n\n\n\n close () {\n this.$emit('update:open', false);\n },\n\n onBackdropClick (event) {\n if (this.closeOnClick && event.target === event.currentTarget) {\n this.close();\n }\n this.$emit('click', event);\n },\n\n onKeydown (event) {\n // The native cancel event only fires for dialogs opened with showModal(), so\n // Esc has to be handled explicitly to keep dismissal identical in both modes.\n // defaultPrevented means a nested widget (dropdown, combobox) already consumed\n // it to close itself, and the modal must not close out from under it.\n if (!this.modal && event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.close();\n }\n this.$emit('keydown', event);\n },\n\n async onAfterEnter () {\n this.$emit('update:open', true);\n await this.setFocusAfterTransition();\n },\n\n onAfterLeave () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n }\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n },\n\n focusFirstTabbable (container) {\n const focusable = [...container.querySelectorAll(focusableSelector)];\n if (!focusable.length) return;\n let target = focusable[0];\n // If first focusable is an unchecked radio, prefer the checked radio in the same group.\n if (target.matches('[type=\"radio\"]:not(:checked)')) {\n target = focusable.find(el => el.checked && el.name === target.name) || target;\n }\n target.focus({ preventScroll: true });\n },\n\n async setFocusAfterTransition () {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n await this.$nextTick();\n\n if (this.initialFocusElement === 'first') {\n this.focusFirstTabbable(dialogEl);\n } else if (typeof this.initialFocusElement === 'string' && this.initialFocusElement.startsWith('#')) {\n const el = dialogEl.querySelector(this.initialFocusElement);\n if (el) {\n el.focus();\n } else {\n // eslint-disable-next-line no-console\n console.warn('Could not find the element specified in dt-modal prop \"initialFocusElement\". ' +\n 'Defaulting to focusing the first element.');\n this.focusFirstTabbable(dialogEl);\n }\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;;;AAmJA,IAAM,IAAoB,0LAQrB,IAAU;CACb,MAAM;CAEN,YAAY;EACV,UAAA;EACA,QAAA;EACA;EACA,mBAAA;EACD;CAED,QAAQ,CAAC,EAAU;CAEnB,OAAO;EAIL,MAAM;GACJ,MAAM;GACN,SAAS;GACV;EAOD,eAAe;GACb,MAAM;GACN,SAAS;GACV;EAKD,cAAc;GACZ,MAAM;GACN,SAAS,WAAY;AAAE,WAAO,GAAiB;;GAChD;EAOD,MAAM;GACJ,MAAM;GACN,SAAS;GACV;EAKD,YAAY;GACV,MAAM;GACN,SAAS,KAAA;GACV;EAKD,kBAAkB;GAChB,MAAM;GACN,SAAS,KAAA;GACV;EAMD,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,MAAM,OAAO,KAAK,EAAqB,CAAC,SAAS,EAAE;GAChE;EAMD,YAAY;GACV,MAAM;GACN,SAAS;GACV;EAOD,YAAY;GACV,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAOD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAOD,cAAc;GACZ,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAMD,YAAY;GACV,MAAM;GACN,SAAS;GACT,UAAW,GAAM;AACf,WAAO,EAAa,SAAS,EAAK;;GAErC;EAOD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAOD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAOD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAQ;IAAM;GAC7B,SAAS;GACV;EAMD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EAMD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,mBAAmB;GACjB,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AA,CAAA,CAAA,CAAA;;;;;;;UAtCU,EAAA;EAAI,cAAA;EAAA,cAAA;EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA,YAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"modal.js","names":[],"sources":["../../../components/Modal/Modal.vue"],"sourcesContent":["<template>\n <teleport\n :disabled=\"!appendTo && !autoTeleportTarget\"\n :to=\"appendTo || autoTeleportTarget\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <dialog\n ref=\"dialogEl\"\n v-dt-focustrap=\"{ active: open, initialFocus: false, restoreFocus: false }\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n { 'd-modal--full': fullscreen },\n { 'd-modal--transparent-backdrop': transparentBackdrop },\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-modal=\"modal ? 'true' : undefined\"\n :aria-describedby=\"describedById || undefined\"\n :aria-labelledby=\"labelledById\"\n v-bind=\"modeAttrs\"\n @cancel.prevent=\"close\"\n @mousedown=\"onBackdropMousedown\"\n @mouseup=\"onBackdropMouseup\"\n @click=\"onBackdropClick\"\n @keydown=\"onKeydown\"\n >\n <div\n v-if=\"open && (hasSlotContent($slots.banner) || bannerHeaderText)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerHeaderText prop -->\n <slot name=\"banner\">\n {{ bannerHeaderText }}\n </slot>\n </div>\n <transition\n :appear=\"open\"\n name=\"d-modal__dialog\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-show=\"open\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"headerText\" text prop -->\n <slot name=\"header\" />\n </div>\n <dt-text\n v-else\n :id=\"labelledById\"\n kind=\"headline\"\n :size=\"600\"\n strength=\"medium\"\n density=\"100\"\n text-box-trim=\"start\"\n as=\"h2\"\n :class=\"['d-modal__header', headerClass]\"\n data-qa=\"dt-modal-title\"\n >\n {{ headerText }}\n </dt-text>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n :class=\"['d-modal__footer', footerClass]\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"!showClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n :size=\"300\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close\n :size=\"iconSize\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dialog>\n </teleport>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/Button';\nimport { DtText } from '@/components/Text';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue';\nimport ModeMixin from '@/common/mixins/mode';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n} from './ModalConstants';\nimport { getUniqueString, hasSlotContent, returnFirstEl, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/Notice';\nimport { DialtoneLocalization } from '@/localization';\n\nconst focusableSelector = 'button:not(:disabled),[href],input:not(:disabled),select:not(:disabled),' +\n 'textarea:not(:disabled),details,[tabindex]:not([tabindex=\"-1\"]):not(:disabled):not([aria-disabled=\"true\"])';\n\n/**\n * Modals focus the user's attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n name: 'DtModal',\n\n components: {\n DtButton,\n DtText,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [ModeMixin],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n open: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Header text to display in the modal header.\n */\n headerText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Header text to display in the modal banner.\n */\n bannerHeaderText: {\n type: String,\n default: undefined,\n },\n\n /**\n * The theme of the modal.\n * @values default, critical\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Whether the modal fills the viewport instead of rendering at its default size.\n * @values true, false\n */\n fullscreen: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept 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 * Sets the color of the banner.\n * @values base, critical, info, positive, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validator (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the header element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n headerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the footer element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n footerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Shows the close button on the modal\n * @values true, false\n */\n showClose: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTML_ELEMENT_TYPE],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n\n /**\n * A CSS selector string for the element to portal the modal to. If not provided, the modal will be rendered in its default location.\n */\n appendTo: {\n type: String,\n default: undefined,\n },\n\n /**\n * When true, the surrounding backdrop is rendered fully transparent\n * instead of the default dimming overlay. The dialog box itself\n * remains opaque. Useful when the underlying UI should remain visible.\n * @values true, false\n */\n transparentBackdrop: {\n type: Boolean,\n default: false,\n },\n\n /**\n * When true, the dialog opens with showModal(), which promotes it to the browser\n * top layer. Nothing outside the top layer can paint above it regardless of\n * z-index, so application surfaces such as toasts and call notifications end up\n * behind it. When false, it opens with show() and stays in the normal stacking\n * order, where the Dialtone z-index scale applies and --zi-notification (700)\n * outranks --zi-modal (600) as documented.\n *\n * Focus trapping, scroll locking and Esc-to-close behave identically in both\n * modes. Background inertness does not: only the top layer provides it, so with\n * modal unset the page outside the dialog stays reachable. That is deliberate —\n * it is what lets an application's own overlays remain usable above a modal —\n * and keyboard containment still comes from the focus trap.\n * @values true, false\n */\n modal: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:open\n * @type {Boolean}\n */\n 'update:open',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_BANNER_KINDS,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n autoTeleportTarget: null,\n mousedownOnBackdrop: false,\n mouseupOnBackdrop: false,\n };\n },\n\n computed: {\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n open (isShowing) {\n this.syncDialogState(isShowing);\n },\n },\n\n mounted () {\n if (!this.appendTo) {\n const root = this.$el?.getRootNode();\n if (root instanceof ShadowRoot) {\n this.autoTeleportTarget = root;\n // Defer syncDialogState so the teleport renders inside the shadow root first.\n if (this.open) this.$nextTick(() => { if (this.open) this.syncDialogState(true); });\n return;\n }\n }\n if (this.open) {\n this.syncDialogState(true);\n }\n },\n\n beforeUnmount () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n enableRootScrolling(this.getScrollRoot());\n }\n this.previousActiveElement = null;\n },\n\n methods: {\n getScrollRoot () {\n return returnFirstEl(this.$refs.dialogEl)?.getRootNode()?.host;\n },\n\n syncDialogState (isShowing) {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n if (isShowing) {\n this.previousActiveElement = document.activeElement;\n if (!dialogEl.open) {\n // show() leaves the dialog in the normal stacking order instead of the\n // top layer, where the z-index scale still applies.\n if (this.modal) dialogEl.showModal(); else dialogEl.show();\n }\n disableRootScrolling(this.getScrollRoot());\n } else if (dialogEl.open) {\n // Leave transition plays via v-show on inner content.\n // close() is called in onAfterLeave when transition completes.\n enableRootScrolling(this.getScrollRoot());\n }\n },\n\n\n\n close () {\n this.$emit('update:open', false);\n },\n\n onBackdropMousedown (event) {\n this.mousedownOnBackdrop = event.target === event.currentTarget;\n },\n\n onBackdropMouseup (event) {\n this.mouseupOnBackdrop = event.target === event.currentTarget;\n },\n\n onBackdropClick (event) {\n const pressedAndReleasedOnBackdrop = this.mousedownOnBackdrop && this.mouseupOnBackdrop;\n if (this.closeOnClick && event.target === event.currentTarget && pressedAndReleasedOnBackdrop) {\n this.close();\n }\n this.$emit('click', event);\n },\n\n onKeydown (event) {\n // The native cancel event only fires for dialogs opened with showModal(), so\n // Esc has to be handled explicitly to keep dismissal identical in both modes.\n // defaultPrevented means a nested widget (dropdown, combobox) already consumed\n // it to close itself, and the modal must not close out from under it.\n if (!this.modal && event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.close();\n }\n this.$emit('keydown', event);\n },\n\n async onAfterEnter () {\n this.$emit('update:open', true);\n await this.setFocusAfterTransition();\n },\n\n onAfterLeave () {\n const dialogEl = this.$refs.dialogEl;\n if (dialogEl?.open) {\n dialogEl.close();\n }\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n },\n\n focusFirstTabbable (container) {\n const focusable = [...container.querySelectorAll(focusableSelector)];\n if (!focusable.length) return;\n let target = focusable[0];\n // If first focusable is an unchecked radio, prefer the checked radio in the same group.\n if (target.matches('[type=\"radio\"]:not(:checked)')) {\n target = focusable.find(el => el.checked && el.name === target.name) || target;\n }\n target.focus({ preventScroll: true });\n },\n\n async setFocusAfterTransition () {\n const dialogEl = this.$refs.dialogEl;\n if (!dialogEl) return;\n\n await this.$nextTick();\n\n if (this.initialFocusElement === 'first') {\n this.focusFirstTabbable(dialogEl);\n } else if (typeof this.initialFocusElement === 'string' && this.initialFocusElement.startsWith('#')) {\n const el = dialogEl.querySelector(this.initialFocusElement);\n if (el) {\n el.focus();\n } else {\n // eslint-disable-next-line no-console\n console.warn('Could not find the element specified in dt-modal prop \"initialFocusElement\". ' +\n 'Defaulting to focusing the first element.');\n this.focusFirstTabbable(dialogEl);\n }\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;;;AAqJA,IAAM,IAAoB,0LAQrB,IAAU;CACb,MAAM;CAEN,YAAY;EACV,UAAA;EACA,QAAA;EACA;EACA,mBAAA;EACD;CAED,QAAQ,CAAC,EAAU;CAEnB,OAAO;EAIL,MAAM;GACJ,MAAM;GACN,SAAS;GACV;EAOD,eAAe;GACb,MAAM;GACN,SAAS;GACV;EAKD,cAAc;GACZ,MAAM;GACN,SAAS,WAAY;AAAE,WAAO,GAAiB;;GAChD;EAOD,MAAM;GACJ,MAAM;GACN,SAAS;GACV;EAKD,YAAY;GACV,MAAM;GACN,SAAS,KA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AAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA,YAAA,KAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/mode.cjs`),i=require(`../popover/tippy-utils.cjs`),a=require(`./tooltip-constants.cjs`),o=require(`../popover/popover-constants.cjs`);let s=require(`vue`);var c={name:`DtTooltip`,mixins:[r.default],props:{id:{type:String,default(){return t.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:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>o.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},contentClass:{type:[String,Object,Array],default:``},anchorClass:{type:[String,Object,Array],default:``},message:{type:String,default:``},enabled:{type:Boolean,default:!0},open:{type:[Boolean,null],default:null},transition:{type:Boolean,default:!0},delay:{type:Boolean,default:!0},theme:{type:String,default:null},externalAnchor:{type:String,default:null},externalAnchorElement:{type:e.HTML_ELEMENT_TYPE,default:null}},emits:[`shown`,`update:open`],data(){return{TOOLTIP_KIND_MODIFIERS:a.TOOLTIP_KIND_MODIFIERS,hasSlotContent:t.hasSlotContent,tip:null,inTimer:null,internalShow:!1,currentPlacement:this.placement}},computed:{tippyProps(){return{offset:this.offset,delay:this.delay?300:!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:i.getPopperOptions({fallbackPlacements:this.fallbackPlacements,hasHideModifierEnabled:!0,onChangePlacement:this.onChangePlacement})}},anchor(){return this.externalAnchorElement?this.externalAnchorElement:this.externalAnchor?document.body.querySelector(this.externalAnchor):i.getAnchor(this.$refs.anchor)}},watch:{tippyProps:`setProps`,offset:{deep:!0,handler(e,t){e===t&&this.setProps()}},fallbackPlacements:{deep:!0,handler(e,t){e===t&&this.setProps()}},open:{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.open!=null&&(console.warn(`Tooltip: You cannot use both the enabled and open props at the same time.`),console.warn(`The open prop will be ignored.`)),this.tip=i.createTippy(this.anchor,this.initOptions()),(this.externalAnchor||this.externalAnchorElement)&&(await t.flushPromises(),this.addExternalAnchorEventListeners()),t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name)},beforeUnmount(){(this.externalAnchor||this.externalAnchorElement)&&this.removeExternalAnchorEventListeners(),this.anchor?._tippy&&this.tip?.destroy()},methods:{getModeReferenceEl(){return this.anchor},calculateAnchorZindex(){return t.returnFirstEl(this.$el).getRootNode().querySelector(`.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"], .d-modal[open], .d-modal--transparent[open]`)||t.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)},300):this.triggerShow(e))},triggerShow(e){e.type===`focusin`?this.open===null&&this.hasVisibleFocus()&&(this.internalShow=!0):this.open===null&&(this.internalShow=!0)},onLeaveAnchor(e){e.type===`keydown`&&e.code!==`Escape`||(clearTimeout(this.inTimer),this.inTimer=null,this.triggerHide())},triggerHide(){this.open===null&&(this.internalShow=!1)},onChangePlacement(e){this.currentPlacement=e},onHide(){this.tip?.unmount(),this.$emit(`shown`,!1),this.open!==null&&this.$emit(`update:open`,!1)},onShow(e,t){if(!this.tooltipHasContent(e))return!1;this.transition&&t===`onShow`||(this.$emit(`shown`,!0),this.open!==null&&this.$emit(`update:open`,!0))},resolveAppendTo(){return this.appendTo===`body`?this.anchor?.closest(`dialog`)??this.anchor?.getRootNode()?.querySelector(`body`):this.appendTo},setProps(){!this.tip||!this.tip.setProps||!this.anchor||this.tip&&this.tip.setProps&&this.tip.setProps({...this.tippyProps,appendTo:this.resolveAppendTo(),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,appendTo:this.resolveAppendTo(),popperOptions:i.getPopperOptions({hasHideModifierEnabled:!0})}},addExternalAnchorEventListeners(){[`focusin`,`mouseenter`].forEach(e=>{this.anchor?.addEventListener(e,e=>this.onEnterAnchor(e))}),[`focusout`,`mouseleave`,`keydown`].forEach(e=>{this.anchor?.addEventListener(e,e=>this.onLeaveAnchor(e))})},removeExternalAnchorEventListeners(){[`focusin`,`mouseenter`].forEach(e=>{this.anchor?.removeEventListener(e,e=>this.onEnterAnchor(e))}),[`focusout`,`mouseleave`,`keydown`].forEach(e=>{this.anchor?.removeEventListener(e,e=>this.onLeaveAnchor(e))})}}},l={"data-qa":`dt-tooltip-container`},u=[`id`];function d(e,t,n,r,i,a){return(0,s.openBlock)(),(0,s.createElementBlock)(`div`,l,[!n.externalAnchor&&!n.externalAnchorElement?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:0,ref:`anchor`,class:(0,s.normalizeClass)(n.anchorClass),"data-qa":`dt-tooltip-anchor`,onFocusin:t[0]||(t[0]=(...e)=>a.onEnterAnchor&&a.onEnterAnchor(...e)),onFocusout:t[1]||(t[1]=(...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e)),onMouseenter:t[2]||(t[2]=(...e)=>a.onEnterAnchor&&a.onEnterAnchor(...e)),onMouseleave:t[3]||(t[3]=(...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e)),onKeydown:t[4]||(t[4]=(0,s.withKeys)((...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e),[`esc`]))},[(0,s.renderSlot)(e.$slots,`anchor`)],34)):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,(0,s.mergeProps)({id:n.id,ref:`content`,"data-qa":`dt-tooltip`,class:[`d-tooltip`,{[i.TOOLTIP_KIND_MODIFIERS.inverted]:n.inverted},n.contentClass]},e.modeAttrs),[(0,s.renderSlot)(e.$slots,`default`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)(n.message),1)])],16,u)])}var f=n.t(c,[[`render`,d]]);exports.default=f;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/mode.cjs`),i=require(`../popover/tippy-utils.cjs`),a=require(`./tooltip-constants.cjs`),o=require(`../popover/popover-constants.cjs`);let s=require(`vue`);var c=`<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>`,l={name:`DtTooltip`,mixins:[r.default],props:{id:{type:String,default(){return t.getUniqueString()}},fallbackPlacements:{type:Array,default:()=>[`auto`]},inverted:{type:Boolean,default:!1},offset:{type:Array,default:()=>[0,12]},showArrow:{type:Boolean,default:!0},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:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>o.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},contentClass:{type:[String,Object,Array],default:``},anchorClass:{type:[String,Object,Array],default:``},message:{type:String,default:``},enabled:{type:Boolean,default:!0},open:{type:[Boolean,null],default:null},transition:{type:Boolean,default:!0},delay:{type:Boolean,default:!0},theme:{type:String,default:null},externalAnchor:{type:String,default:null},externalAnchorElement:{type:e.HTML_ELEMENT_TYPE,default:null}},emits:[`shown`,`update:open`],data(){return{TOOLTIP_KIND_MODIFIERS:a.TOOLTIP_KIND_MODIFIERS,hasSlotContent:t.hasSlotContent,tip:null,inTimer:null,internalShow:!1,currentPlacement:this.placement}},computed:{tippyArrow(){return this.showArrow?c:!1},tippyProps(){return{arrow:this.tippyArrow,offset:this.offset,delay:this.delay?300:!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:i.getPopperOptions({fallbackPlacements:this.fallbackPlacements,hasHideModifierEnabled:!0,onChangePlacement:this.onChangePlacement})}},anchor(){return this.externalAnchorElement?this.externalAnchorElement:this.externalAnchor?document.body.querySelector(this.externalAnchor):i.getAnchor(this.$refs.anchor)}},watch:{tippyProps:`setProps`,offset:{deep:!0,handler(e,t){e===t&&this.setProps()}},fallbackPlacements:{deep:!0,handler(e,t){e===t&&this.setProps()}},open:{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.open!=null&&(console.warn(`Tooltip: You cannot use both the enabled and open props at the same time.`),console.warn(`The open prop will be ignored.`)),this.tip=i.createTippy(this.anchor,this.initOptions()),(this.externalAnchor||this.externalAnchorElement)&&(await t.flushPromises(),this.addExternalAnchorEventListeners()),t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name)},beforeUnmount(){(this.externalAnchor||this.externalAnchorElement)&&this.removeExternalAnchorEventListeners(),this.anchor?._tippy&&this.tip?.destroy()},methods:{getModeReferenceEl(){return this.anchor},calculateAnchorZindex(){return t.returnFirstEl(this.$el).getRootNode().querySelector(`.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"], .d-modal[open], .d-modal--transparent[open]`)||t.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)},300):this.triggerShow(e))},triggerShow(e){e.type===`focusin`?this.open===null&&this.hasVisibleFocus()&&(this.internalShow=!0):this.open===null&&(this.internalShow=!0)},onLeaveAnchor(e){e.type===`keydown`&&e.code!==`Escape`||(clearTimeout(this.inTimer),this.inTimer=null,this.triggerHide())},triggerHide(){this.open===null&&(this.internalShow=!1)},onChangePlacement(e){this.currentPlacement=e},onHide(){this.tip?.unmount(),this.$emit(`shown`,!1),this.open!==null&&this.$emit(`update:open`,!1)},onShow(e,t){if(!this.tooltipHasContent(e))return!1;this.transition&&t===`onShow`||(this.$emit(`shown`,!0),this.open!==null&&this.$emit(`update:open`,!0))},resolveAppendTo(){return this.appendTo===`body`?this.anchor?.closest(`dialog`)??this.anchor?.getRootNode()?.querySelector(`body`):this.appendTo},setProps(){!this.tip||!this.tip.setProps||!this.anchor||this.tip&&this.tip.setProps&&this.tip.setProps({...this.tippyProps,appendTo:this.resolveAppendTo(),zIndex:this.calculateAnchorZindex()})},onMount(){this.setProps()},tooltipHasContent(e){return e.props.content.textContent.trim().length!==0},initOptions(){return{content:this.$refs.content,arrow:this.tippyArrow,duration:180,interactive:!1,trigger:`manual`,hideOnClick:!1,touch:!1,onMount:this.onMount,showOnCreate:this.internalShow,appendTo:this.resolveAppendTo(),popperOptions:i.getPopperOptions({hasHideModifierEnabled:!0})}},addExternalAnchorEventListeners(){[`focusin`,`mouseenter`].forEach(e=>{this.anchor?.addEventListener(e,e=>this.onEnterAnchor(e))}),[`focusout`,`mouseleave`,`keydown`].forEach(e=>{this.anchor?.addEventListener(e,e=>this.onLeaveAnchor(e))})},removeExternalAnchorEventListeners(){[`focusin`,`mouseenter`].forEach(e=>{this.anchor?.removeEventListener(e,e=>this.onEnterAnchor(e))}),[`focusout`,`mouseleave`,`keydown`].forEach(e=>{this.anchor?.removeEventListener(e,e=>this.onLeaveAnchor(e))})}}},u={"data-qa":`dt-tooltip-container`},d=[`id`];function f(e,t,n,r,i,a){return(0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[!n.externalAnchor&&!n.externalAnchorElement?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:0,ref:`anchor`,class:(0,s.normalizeClass)(n.anchorClass),"data-qa":`dt-tooltip-anchor`,onFocusin:t[0]||(t[0]=(...e)=>a.onEnterAnchor&&a.onEnterAnchor(...e)),onFocusout:t[1]||(t[1]=(...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e)),onMouseenter:t[2]||(t[2]=(...e)=>a.onEnterAnchor&&a.onEnterAnchor(...e)),onMouseleave:t[3]||(t[3]=(...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e)),onKeydown:t[4]||(t[4]=(0,s.withKeys)((...e)=>a.onLeaveAnchor&&a.onLeaveAnchor(...e),[`esc`]))},[(0,s.renderSlot)(e.$slots,`anchor`)],34)):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,(0,s.mergeProps)({id:n.id,ref:`content`,"data-qa":`dt-tooltip`,class:[`d-tooltip`,{[i.TOOLTIP_KIND_MODIFIERS.inverted]:n.inverted},n.contentClass]},e.modeAttrs),[(0,s.renderSlot)(e.$slots,`default`,{},()=>[(0,s.createTextVNode)((0,s.toDisplayString)(n.message),1)])],16,d)])}var p=n.t(l,[[`render`,f]]);exports.default=p;
2
2
  //# sourceMappingURL=tooltip.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.cjs","names":[],"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 && !externalAnchorElement\"\n ref=\"anchor\"\n :class=\"anchorClass\"\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-bind=\"modeAttrs\"\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 './TooltipConstants.js';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '../Popover/PopoverConstants';\nimport { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport {\n createTippy,\n getAnchor,\n getPopperOptions,\n} from '@/components/Popover/TippyUtils';\nimport ModeMixin from '@/common/mixins/mode';\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 mixins: [ModeMixin],\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 * @deprecated Use contentMode=\"invert\"\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 */\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' appends to the nearest ancestor <dialog> element when inside one\n * (keeping the tooltip in the browser's top layer), or to the nearest body otherwise.\n * To always append to body regardless of dialog context, pass document.body as an HTMLElement.\n * This prop is not reactive, must be set on initial render.\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, 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 * Additional class name for the anchor wrapper 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 anchorClass: {\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 open prop. open 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 * @values null, true, false\n */\n open: {\n type: [Boolean, null],\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 * @deprecated Use externalAnchorElement instead for Shadow DOM compatibility.\n */\n externalAnchor: {\n type: String,\n default: null,\n },\n\n /**\n * External anchor element reference. Use this instead of externalAnchor when\n * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.\n */\n externalAnchorElement: {\n type: HTML_ELEMENT_TYPE,\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 open value\n *\n * @event update:open\n */\n 'update:open',\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 if (this.externalAnchorElement) return this.externalAnchorElement;\n return this.externalAnchor ? document.body.querySelector(this.externalAnchor) : getAnchor(this.$refs.anchor);\n },\n },\n\n watch: {\n\n tippyProps: 'setProps',\n\n // tippyProps only tracks the offset/fallbackPlacements array references, so in-place\n // mutations (e.g. offset[1] = 8) need their own deep watchers to trigger setProps.\n // Reference replacements are already handled by the tippyProps watcher above; skip\n // those here (newValue === oldValue only when the array was mutated in place) to\n // avoid calling setProps twice for the same change.\n offset: {\n deep: true,\n handler (newValue, oldValue) {\n if (newValue === oldValue) this.setProps();\n },\n },\n\n fallbackPlacements: {\n deep: true,\n handler (newValue, oldValue) {\n if (newValue === oldValue) this.setProps();\n },\n },\n\n open: {\n handler: function (open) {\n if (open !== null && this.enabled) {\n this.internalShow = open;\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.open != null) {\n console.warn('Tooltip: You cannot use both the enabled and open props at the same time.');\n console.warn('The open prop will be ignored.');\n }\n\n this.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor || this.externalAnchorElement) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n (this.externalAnchor || this.externalAnchorElement) && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\n this.tip?.destroy();\n }\n },\n\n methods: {\n getModeReferenceEl () {\n return this.anchor;\n },\n\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('.d-modal[aria-hidden=\"false\"], .d-modal--transparent[aria-hidden=\"false\"], .d-modal[open], .d-modal--transparent[open]') ||\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.open === null && this.hasVisibleFocus()) {\n this.internalShow = true;\n }\n } else {\n if (this.open === 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.open === 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.open !== null) {\n this.$emit('update:open', 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.open !== null) {\n this.$emit('update:open', true);\n }\n },\n\n resolveAppendTo () {\n // When inside a native <dialog>, append there to stay in the browser's top layer.\n if (this.appendTo === 'body') {\n return this.anchor?.closest('dialog') ?? this.anchor?.getRootNode()?.querySelector('body');\n }\n return this.appendTo;\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.resolveAppendTo(),\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 appendTo: this.resolveAppendTo(),\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"],"mappings":"qdAqEA,IAAK,EAAU,CACb,KAAM,YAEN,OAAQ,CAAC,EAAA,QAAU,CAEnB,MAAO,CAIL,GAAI,CACF,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CAeD,mBAAoB,CAClB,KAAM,MACN,YAAe,CAAC,OAAO,CACxB,CAMD,SAAU,CACR,KAAM,QACN,QAAS,GACV,CAaD,OAAQ,CACN,KAAM,MACN,YAAe,CAAC,EAAG,GAAG,CACvB,CAgBD,UAAW,CACT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AAE,EAAA,eAAA,EAAA,cAAA,GAAA,EAAa,EACvB,aAAU,EAAA,KAAA,EAAA,IAAA,GAAA,IAAE,EAAA,eAAA,EAAA,cAAA,GAAA,EAAa,EACzB,aAAU,EAAA,KAAA,EAAA,IAAA,GAAA,IAAE,EAAA,eAAA,EAAA,cAAA,GAAA,EAAa,EACzB,UAAO,EAAA,KAAA,EAAA,IAAA,EAAA,EAAA,WAAA,GAAA,IAAM,EAAA,eAAA,EAAA,cAAA,GAAA,EAAa,CAAA,CAAA,MAAA,CAAA,qBAKzB,EAAA,OAAA,SAAA,CAAA,CAAA,GAAA,GAAA,EAAA,EAAA,oBAAA,GAAA,GAAA,EAAA,EAAA,EAAA,oBAqBE,OAAA,EAAA,EAAA,YAAA,CAlBH,GAAI,EAAA,GACL,IAAI,UACJ,UAAQ,aACP,MAAK,eAA+C,EAAA,uBAAuB,UAAY,EAAA,SAAA,CAA6B,EAAA,eAO7G,EAAA,UAAS,CAAA,EAAA,EAAA,EAAA,YAOV,EAAA,OAAA,UAAA,EAAA,KAAA,EAAA,EAAA,EAAA,kBAAA,EAAA,EAAA,iBADF,EAAA,QAAO,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"tooltip.cjs","names":[],"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 && !externalAnchorElement\"\n ref=\"anchor\"\n :class=\"anchorClass\"\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-bind=\"modeAttrs\"\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 './TooltipConstants.js';\nimport {\n POPOVER_APPEND_TO_VALUES,\n} from '../Popover/PopoverConstants';\nimport { flushPromises, getUniqueString, hasSlotContent, warnIfUnmounted, returnFirstEl } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport {\n createTippy,\n getAnchor,\n getPopperOptions,\n} from '@/components/Popover/TippyUtils';\nimport ModeMixin from '@/common/mixins/mode';\n\nconst TOOLTIP_ARROW_SVG = '<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\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 mixins: [ModeMixin],\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 * @deprecated Use contentMode=\"invert\"\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 * Whether to show the arrow between the tooltip and its anchor.\n * @values true, false\n */\n showArrow: {\n type: Boolean,\n default: true,\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 */\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' appends to the nearest ancestor <dialog> element when inside one\n * (keeping the tooltip in the browser's top layer), or to the nearest body otherwise.\n * To always append to body regardless of dialog context, pass document.body as an HTMLElement.\n * This prop is not reactive, must be set on initial render.\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, 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 * Additional class name for the anchor wrapper 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 anchorClass: {\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 open prop. open 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 * @values null, true, false\n */\n open: {\n type: [Boolean, null],\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 * @deprecated Use externalAnchorElement instead for Shadow DOM compatibility.\n */\n externalAnchor: {\n type: String,\n default: null,\n },\n\n /**\n * External anchor element reference. Use this instead of externalAnchor when\n * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.\n */\n externalAnchorElement: {\n type: HTML_ELEMENT_TYPE,\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 open value\n *\n * @event update:open\n */\n 'update:open',\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 tippyArrow () {\n return this.showArrow ? TOOLTIP_ARROW_SVG : false;\n },\n\n tippyProps () {\n return {\n arrow: this.tippyArrow,\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 if (this.externalAnchorElement) return this.externalAnchorElement;\n return this.externalAnchor ? document.body.querySelector(this.externalAnchor) : getAnchor(this.$refs.anchor);\n },\n },\n\n watch: {\n\n tippyProps: 'setProps',\n\n // tippyProps only tracks the offset/fallbackPlacements array references, so in-place\n // mutations (e.g. offset[1] = 8) need their own deep watchers to trigger setProps.\n // Reference replacements are already handled by the tippyProps watcher above; skip\n // those here (newValue === oldValue only when the array was mutated in place) to\n // avoid calling setProps twice for the same change.\n offset: {\n deep: true,\n handler (newValue, oldValue) {\n if (newValue === oldValue) this.setProps();\n },\n },\n\n fallbackPlacements: {\n deep: true,\n handler (newValue, oldValue) {\n if (newValue === oldValue) this.setProps();\n },\n },\n\n open: {\n handler: function (open) {\n if (open !== null && this.enabled) {\n this.internalShow = open;\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.open != null) {\n console.warn('Tooltip: You cannot use both the enabled and open props at the same time.');\n console.warn('The open prop will be ignored.');\n }\n\n this.tip = createTippy(this.anchor, this.initOptions());\n if (this.externalAnchor || this.externalAnchorElement) {\n await flushPromises();\n this.addExternalAnchorEventListeners();\n }\n warnIfUnmounted(returnFirstEl(this.$el), this.$options.name);\n },\n\n beforeUnmount () {\n (this.externalAnchor || this.externalAnchorElement) && this.removeExternalAnchorEventListeners();\n\n if (this.anchor?._tippy) {\n this.tip?.destroy();\n }\n },\n\n methods: {\n getModeReferenceEl () {\n return this.anchor;\n },\n\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('.d-modal[aria-hidden=\"false\"], .d-modal--transparent[aria-hidden=\"false\"], .d-modal[open], .d-modal--transparent[open]') ||\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.open === null && this.hasVisibleFocus()) {\n this.internalShow = true;\n }\n } else {\n if (this.open === 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.open === 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.open !== null) {\n this.$emit('update:open', 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.open !== null) {\n this.$emit('update:open', true);\n }\n },\n\n resolveAppendTo () {\n // When inside a native <dialog>, append there to stay in the browser's top layer.\n if (this.appendTo === 'body') {\n return this.anchor?.closest('dialog') ?? this.anchor?.getRootNode()?.querySelector('body');\n }\n return this.appendTo;\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.resolveAppendTo(),\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. Reactive options belong in tippyProps, but arrow is duplicated because Tippy\n // renders its default arrow during synchronous showOnCreate mounting. setProps only runs later from\n // onMount, so omitting the initial value would leave the default arrow in the DOM until then.\n initOptions () {\n const template = this.$refs.content;\n return {\n content: template,\n arrow: this.tippyArrow,\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 appendTo: this.resolveAppendTo(),\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"],"mappings":"qdA+DA,IAAM,EAAoB,uGAQrB,EAAU,CACb,KAAM,YAEN,OAAQ,CAAC,EAAA,QAAU,CAEnB,MAAO,CAIL,GAAI,CACF,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CAeD,mBAAoB,CAClB,KAAM,MACN,YAAe,CAAC,OAAO,CACxB,CAMD,SAAU,CACR,KAAM,QACN,QAAS,GACV,CAaD,OAAQ,CACN,KAAM,MACN,YAAe,CAAC,EAAG,GAAG,CACvB,CAMD,UAAW,CACT,KAAM,QACN,QAAS,GACV,CAgBD,UAAW,CACT,KAAM,OACN,QAAS,MACT,UAAW,EAAW,CACpB,OAAO,EAAA,mBAAmB,SAAS,EAAU,EAEhD,CAiBD,OAAQ,CACN,KAAM,CAAC,QAAS,OAAO,CACvB,QAAS,GACT,UAAY,GACH,EAAA,sBAAsB,SAAS,EAAO,CAEhD,CAUD,SAAU,CACR,KAAM,CAAC,EAAA,kBAAmB,OAAO,CACjC,QAAS,OACT,UAAW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