@dialpad/dialtone-vue 3.119.0 → 3.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js +2 -0
- package/dist/chunks/_plugin-vue_export-helper-6_y-gaV6.js.map +1 -0
- package/dist/chunks/dropdown-UO3UJalk.js +2 -0
- package/dist/chunks/dropdown-UO3UJalk.js.map +1 -0
- package/dist/chunks/dropdown_constants-KHFvVI2L.js +2 -0
- package/dist/chunks/dropdown_constants-KHFvVI2L.js.map +1 -0
- package/dist/chunks/icon_constants-2S_OSQ1t.js +2 -0
- package/dist/chunks/icon_constants-2S_OSQ1t.js.map +1 -0
- package/dist/chunks/index-6tYeqbgP.js +3 -0
- package/dist/chunks/index-6tYeqbgP.js.map +1 -0
- package/dist/chunks/index-IBtQ5jRJ.js +2 -0
- package/dist/chunks/index-IBtQ5jRJ.js.map +1 -0
- package/dist/chunks/input-0Uksk4DP.js +2 -0
- package/dist/chunks/input-0Uksk4DP.js.map +1 -0
- package/dist/chunks/input_group-AS760Cp7.js +2 -0
- package/dist/chunks/input_group-AS760Cp7.js.map +1 -0
- package/dist/chunks/keyboard_list_navigation-N74Bpdq7.js +2 -0
- package/dist/chunks/keyboard_list_navigation-N74Bpdq7.js.map +1 -0
- package/dist/chunks/link_constants-Kn6kP4i1.js +2 -0
- package/dist/chunks/link_constants-Kn6kP4i1.js.map +1 -0
- package/dist/chunks/list_item_constants-Tsz5CO1m.js +2 -0
- package/dist/chunks/list_item_constants-Tsz5CO1m.js.map +1 -0
- package/dist/chunks/modal-qEzlo0Sj.js +2 -0
- package/dist/chunks/modal-qEzlo0Sj.js.map +1 -0
- package/dist/chunks/notice_action-jO199emq.js +2 -0
- package/dist/chunks/notice_action-jO199emq.js.map +1 -0
- package/dist/chunks/notice_constants-mC6al2Dm.js +2 -0
- package/dist/chunks/notice_constants-mC6al2Dm.js.map +1 -0
- package/dist/chunks/popover_constants-hOEhklvr.js +2 -0
- package/dist/chunks/popover_constants-hOEhklvr.js.map +1 -0
- package/dist/chunks/sr_only_close_button-iD7s1Pbj.js +3 -0
- package/dist/chunks/sr_only_close_button-iD7s1Pbj.js.map +1 -0
- package/dist/chunks/stack_constants-m9Ickqw0.js +2 -0
- package/dist/chunks/stack_constants-m9Ickqw0.js.map +1 -0
- package/dist/chunks/tab-at7WWglk.js +2 -0
- package/dist/chunks/tab-at7WWglk.js.map +1 -0
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +2 -0
- package/dist/dialtone-vue.cjs.map +1 -0
- package/dist/lib/attachment-carousel.cjs +2 -0
- package/dist/lib/attachment-carousel.cjs.map +1 -0
- package/dist/lib/attachment-carousel.js +2 -3
- package/dist/lib/attachment-carousel.js.map +1 -1
- package/dist/lib/avatar.cjs +2 -0
- package/dist/lib/avatar.cjs.map +1 -0
- package/dist/lib/avatar.js +2 -3
- package/dist/lib/avatar.js.map +1 -1
- package/dist/lib/badge.cjs +2 -0
- package/dist/lib/badge.cjs.map +1 -0
- package/dist/lib/badge.js +2 -3
- package/dist/lib/badge.js.map +1 -1
- package/dist/lib/banner.cjs +3 -0
- package/dist/lib/banner.cjs.map +1 -0
- package/dist/lib/banner.js +6 -7
- package/dist/lib/banner.js.map +1 -1
- package/dist/lib/breadcrumbs.cjs +2 -0
- package/dist/lib/breadcrumbs.cjs.map +1 -0
- package/dist/lib/button-group.cjs +2 -0
- package/dist/lib/button-group.cjs.map +1 -0
- package/dist/lib/button.cjs +2 -0
- package/dist/lib/button.cjs.map +1 -0
- package/dist/lib/callbar-button-with-popover.cjs +2 -0
- package/dist/lib/callbar-button-with-popover.cjs.map +1 -0
- package/dist/lib/callbar-button-with-popover.js +9 -10
- package/dist/lib/callbar-button-with-popover.js.map +1 -1
- package/dist/lib/callbar-button.cjs +2 -0
- package/dist/lib/callbar-button.cjs.map +1 -0
- package/dist/lib/callbox.cjs +2 -0
- package/dist/lib/callbox.cjs.map +1 -0
- package/dist/lib/callbox.js +2 -3
- package/dist/lib/callbox.js.map +1 -1
- package/dist/lib/card.cjs +2 -0
- package/dist/lib/card.cjs.map +1 -0
- package/dist/lib/checkbox-group.cjs +2 -0
- package/dist/lib/checkbox-group.cjs.map +1 -0
- package/dist/lib/checkbox.cjs +2 -0
- package/dist/lib/checkbox.cjs.map +1 -0
- package/dist/lib/chip.cjs +2 -0
- package/dist/lib/chip.cjs.map +1 -0
- package/dist/lib/chip.js +10 -11
- package/dist/lib/chip.js.map +1 -1
- package/dist/lib/codeblock.cjs +3 -0
- package/dist/lib/codeblock.cjs.map +1 -0
- package/dist/lib/collapsible.cjs +2 -0
- package/dist/lib/collapsible.cjs.map +1 -0
- package/dist/lib/collapsible.js +7 -8
- package/dist/lib/collapsible.js.map +1 -1
- package/dist/lib/combobox-multi-select.cjs +2 -0
- package/dist/lib/combobox-multi-select.cjs.map +1 -0
- package/dist/lib/combobox-with-popover.cjs +2 -0
- package/dist/lib/combobox-with-popover.cjs.map +1 -0
- package/dist/lib/combobox.cjs +2 -0
- package/dist/lib/combobox.cjs.map +1 -0
- package/dist/lib/constants.cjs +2 -0
- package/dist/lib/constants.cjs.map +1 -0
- package/dist/lib/contact-info.cjs +2 -0
- package/dist/lib/contact-info.cjs.map +1 -0
- package/dist/lib/contact-info.js +2 -3
- package/dist/lib/contact-info.js.map +1 -1
- package/dist/lib/contact-row.cjs +2 -0
- package/dist/lib/contact-row.cjs.map +1 -0
- package/dist/lib/datepicker.cjs +2 -0
- package/dist/lib/datepicker.cjs.map +1 -0
- package/dist/lib/datepicker.js +12 -13
- package/dist/lib/datepicker.js.map +1 -1
- package/dist/lib/dates.cjs +2 -0
- package/dist/lib/dates.cjs.map +1 -0
- package/dist/lib/description-list.cjs +2 -0
- package/dist/lib/description-list.cjs.map +1 -0
- package/dist/lib/dropdown.cjs +2 -0
- package/dist/lib/dropdown.cjs.map +1 -0
- package/dist/lib/dropdown.js +6 -7
- package/dist/lib/dropdown.js.map +1 -1
- package/dist/lib/editor.cjs +2 -0
- package/dist/lib/editor.cjs.map +1 -0
- package/dist/lib/emoji-picker.cjs +2 -0
- package/dist/lib/emoji-picker.cjs.map +1 -0
- package/dist/lib/emoji-picker.js +2 -3
- package/dist/lib/emoji-picker.js.map +1 -1
- package/dist/lib/emoji-row.cjs +2 -0
- package/dist/lib/emoji-row.cjs.map +1 -0
- package/dist/lib/emoji-text-wrapper.cjs +2 -0
- package/dist/lib/emoji-text-wrapper.cjs.map +1 -0
- package/dist/lib/emoji.cjs +2 -0
- package/dist/lib/emoji.cjs.map +1 -0
- package/dist/lib/feed-item-row.cjs +2 -0
- package/dist/lib/feed-item-row.cjs.map +1 -0
- package/dist/lib/feed-item-row.js +11 -12
- package/dist/lib/feed-item-row.js.map +1 -1
- package/dist/lib/feed-pill.cjs +2 -0
- package/dist/lib/feed-pill.cjs.map +1 -0
- package/dist/lib/feed-pill.js +2 -3
- package/dist/lib/feed-pill.js.map +1 -1
- package/dist/lib/general-row.cjs +2 -0
- package/dist/lib/general-row.cjs.map +1 -0
- package/dist/lib/group-row.cjs +2 -0
- package/dist/lib/group-row.cjs.map +1 -0
- package/dist/lib/group-row.js +1 -1
- package/dist/lib/grouped-chip.cjs +2 -0
- package/dist/lib/grouped-chip.cjs.map +1 -0
- package/dist/lib/grouped-chip.js +5 -6
- package/dist/lib/grouped-chip.js.map +1 -1
- package/dist/lib/hovercard.cjs +2 -0
- package/dist/lib/hovercard.cjs.map +1 -0
- package/dist/lib/hovercard.js +7 -8
- package/dist/lib/hovercard.js.map +1 -1
- package/dist/lib/icon.cjs +2 -0
- package/dist/lib/icon.cjs.map +1 -0
- package/dist/lib/icon.js +20 -51
- package/dist/lib/icon.js.map +1 -1
- package/dist/lib/image-viewer.cjs +2 -0
- package/dist/lib/image-viewer.cjs.map +1 -0
- package/dist/lib/image-viewer.js +9 -10
- package/dist/lib/image-viewer.js.map +1 -1
- package/dist/lib/input-group.cjs +2 -0
- package/dist/lib/input-group.cjs.map +1 -0
- package/dist/lib/input.cjs +2 -0
- package/dist/lib/input.cjs.map +1 -0
- package/dist/lib/item-layout.cjs +2 -0
- package/dist/lib/item-layout.cjs.map +1 -0
- package/dist/lib/ivr-node.cjs +2 -0
- package/dist/lib/ivr-node.cjs.map +1 -0
- package/dist/lib/ivr-node.js +4 -5
- package/dist/lib/ivr-node.js.map +1 -1
- package/dist/lib/keyboard-shortcut.cjs +2 -0
- package/dist/lib/keyboard-shortcut.cjs.map +1 -0
- package/dist/lib/keyboard-shortcut.js +4 -5
- package/dist/lib/keyboard-shortcut.js.map +1 -1
- package/dist/lib/lazy-show.cjs +2 -0
- package/dist/lib/lazy-show.cjs.map +1 -0
- package/dist/lib/link.cjs +2 -0
- package/dist/lib/link.cjs.map +1 -0
- package/dist/lib/list-item-group.cjs +2 -0
- package/dist/lib/list-item-group.cjs.map +1 -0
- package/dist/lib/list-item.cjs +2 -0
- package/dist/lib/list-item.cjs.map +1 -0
- package/dist/lib/list-item.js +2 -3
- package/dist/lib/list-item.js.map +1 -1
- package/dist/lib/message-input.cjs +2 -0
- package/dist/lib/message-input.cjs.map +1 -0
- package/dist/lib/message-input.js +148 -100
- package/dist/lib/message-input.js.map +1 -1
- package/dist/lib/mixins.cjs +2 -0
- package/dist/lib/mixins.cjs.map +1 -0
- package/dist/lib/modal.cjs +3 -0
- package/dist/lib/modal.cjs.map +1 -0
- package/dist/lib/modal.js +11 -12
- package/dist/lib/modal.js.map +1 -1
- package/dist/lib/notice.cjs +2 -0
- package/dist/lib/notice.cjs.map +1 -0
- package/dist/lib/notice.js +2 -3
- package/dist/lib/notice.js.map +1 -1
- package/dist/lib/pagination.cjs +2 -0
- package/dist/lib/pagination.cjs.map +1 -0
- package/dist/lib/pagination.js +2 -3
- package/dist/lib/pagination.js.map +1 -1
- package/dist/lib/popover.cjs +2 -0
- package/dist/lib/popover.cjs.map +1 -0
- package/dist/lib/popover.js +4 -5
- package/dist/lib/popover.js.map +1 -1
- package/dist/lib/presence.cjs +2 -0
- package/dist/lib/presence.cjs.map +1 -0
- package/dist/lib/radio-group.cjs +2 -0
- package/dist/lib/radio-group.cjs.map +1 -0
- package/dist/lib/radio.cjs +2 -0
- package/dist/lib/radio.cjs.map +1 -0
- package/dist/lib/rich-text-editor.cjs +2 -0
- package/dist/lib/rich-text-editor.cjs.map +1 -0
- package/dist/lib/rich-text-editor.js +174 -142
- package/dist/lib/rich-text-editor.js.map +1 -1
- package/dist/lib/root-layout.cjs +2 -0
- package/dist/lib/root-layout.cjs.map +1 -0
- package/dist/lib/scroller.cjs +2 -0
- package/dist/lib/scroller.cjs.map +1 -0
- package/dist/lib/select-menu.cjs +2 -0
- package/dist/lib/select-menu.cjs.map +1 -0
- package/dist/lib/settings-menu-button.cjs +2 -0
- package/dist/lib/settings-menu-button.cjs.map +1 -0
- package/dist/lib/settings-menu-button.js +2 -3
- package/dist/lib/settings-menu-button.js.map +1 -1
- package/dist/lib/skeleton.cjs +2 -0
- package/dist/lib/skeleton.cjs.map +1 -0
- package/dist/lib/stack.cjs +2 -0
- package/dist/lib/stack.cjs.map +1 -0
- package/dist/lib/tabs.cjs +2 -0
- package/dist/lib/tabs.cjs.map +1 -0
- package/dist/lib/time-pill.cjs +2 -0
- package/dist/lib/time-pill.cjs.map +1 -0
- package/dist/lib/toast.cjs +2 -0
- package/dist/lib/toast.cjs.map +1 -0
- package/dist/lib/toast.js +2 -3
- package/dist/lib/toast.js.map +1 -1
- package/dist/lib/toggle.cjs +2 -0
- package/dist/lib/toggle.cjs.map +1 -0
- package/dist/lib/tooltip-directive.cjs +2 -0
- package/dist/lib/tooltip-directive.cjs.map +1 -0
- package/dist/lib/tooltip.cjs +2 -0
- package/dist/lib/tooltip.cjs.map +1 -0
- package/dist/lib/top-banner-info.cjs +2 -0
- package/dist/lib/top-banner-info.cjs.map +1 -0
- package/dist/lib/unread-pill.cjs +2 -0
- package/dist/lib/unread-pill.cjs.map +1 -0
- package/dist/lib/unread-pill.js +2 -3
- package/dist/lib/unread-pill.js.map +1 -1
- package/dist/lib/utils.cjs +2 -0
- package/dist/lib/utils.cjs.map +1 -0
- package/dist/lib/validation-messages.cjs +2 -0
- package/dist/lib/validation-messages.cjs.map +1 -0
- package/dist/lib/validators.cjs +2 -0
- package/dist/lib/validators.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/components/avatar/avatar.vue.d.ts +1 -1
- package/dist/types/components/button/button.vue.d.ts +2 -2
- package/dist/types/components/card/card.vue.d.ts +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +1 -1
- package/dist/types/components/collapsible/collapsible.vue.d.ts +2 -2
- package/dist/types/components/combobox/combobox.vue.d.ts +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
- package/dist/types/components/emoji/emoji.vue.d.ts +1 -1
- package/dist/types/components/icon/icon.vue.d.ts +1 -19
- package/dist/types/components/icon/icon.vue.d.ts.map +1 -1
- package/dist/types/components/list_item_group/list_item_group.vue.d.ts +1 -1
- package/dist/types/components/modal/modal.vue.d.ts +2 -2
- package/dist/types/components/popover/popover_header_footer.vue.d.ts +1 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +91 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/types/components/root_layout/root_layout.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-list-item.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-paragraph.vue.d.ts +3 -3
- package/dist/types/components/skeleton/skeleton-shape.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.vue.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +2 -2
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +2 -2
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +90 -0
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/types/recipes/leftbar/general_row/general_row.vue.d.ts +1 -1
- package/dist/types/recipes/leftbar/general_row/leftbar_general_row_icon.vue.d.ts +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../chunks/modal-qEzlo0Sj.js"),c=require("./utils.cjs"),n=require("./constants.cjs"),u=require("../chunks/sr_only_close_button-iD7s1Pbj.js"),e=require("vue"),f=require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js"),S=require("./lazy-show.cjs"),E=require("./button.cjs"),C=require("./icon.cjs"),k=require("../chunks/notice_constants-mC6al2Dm.js");require("../chunks/link_constants-Kn6kP4i1.js");require("@dialpad/dialtone-icons/vue3");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");const i={default:"",danger:"d-modal--danger"},r={default:"",full:"d-modal--full"},d={error:"d-modal__banner--critical",info:"d-modal__banner--info",success:"d-modal__banner--success",warning:"d-modal__banner--warning",base:"d-modal__banner--general"},g={name:"DtModal",components:{DtLazyShow:S.DtLazyShow,DtButton:E.DtButton,DtIcon:C.DtIcon,SrOnlyCloseButton:u.S},mixins:[b.M,u.a],props:{closeButtonProps:{type:Object,required:!0,validator:t=>!!t.ariaLabel},copy:{type:String,default:""},describedById:{type:String,default:""},labelledById:{type:String,default:function(){return c.getUniqueString()}},show:{type:Boolean,default:!1},title:{type:String,default:""},bannerTitle:{type:String,default:""},kind:{type:String,default:"default",validator:t=>Object.keys(i).includes(t)},size:{type:String,default:"default",validator:t=>Object.keys(r).includes(t)},modalClass:{type:[String,Object,Array],default:""},dialogClass:{type:[String,Object,Array],default:""},contentClass:{type:[String,Object,Array],default:""},bannerKind:{type:String,default:"warning",validate(t){return k.N.includes(t)}},bannerClass:{type:[String,Object,Array],default:""},hideClose:{type:Boolean,default:!1},closeOnClick:{type:Boolean,default:!0},fixedHeaderFooter:{type:Boolean,default:!0},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:t=>t==="first"||t instanceof HTMLElement||t.startsWith("#")}},emits:["click","keydown","update:show"],data(){return{MODAL_KIND_MODIFIERS:i,MODAL_SIZE_MODIFIERS:r,MODAL_BANNER_KINDS:d,EVENT_KEYNAMES:n.EVENT_KEYNAMES,hasSlotContent:c.hasSlotContent}},computed:{modalListeners(){return{click:t=>{this.closeOnClick&&(t.target===t.currentTarget&&this.close(),this.$emit("click",t))},keydown:t=>{switch(t.code){case n.EVENT_KEYNAMES.esc:case n.EVENT_KEYNAMES.escape:this.close();break;case n.EVENT_KEYNAMES.tab:this.trapFocus(t);break}this.$emit("keydown",t)},"after-enter":t=>{this.$emit("update:show",!0),t.target===t.currentTarget&&this.setFocusAfterTransition()}}},open(){return`${!this.show}`},hasFooterSlot(){return!!this.$slots.footer},bannerKindClass(){return d[this.bannerKind]}},watch:{show:{immediate:!0,handler(t){var s;t?this.previousActiveElement=document.activeElement:((s=this.previousActiveElement)==null||s.focus(),this.previousActiveElement=null)}},$props:{immediate:!0,deep:!0,handler(){this.validateProps()}}},methods:{close(){this.$emit("update:show",!1)},setFocusAfterTransition(){this.initialFocusElement==="first"?this.focusFirstElement():this.initialFocusElement.startsWith("#")?this.focusElementById(this.initialFocusElement):this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},trapFocus(t){this.show&&this.focusTrappedTabPress(t)},validateProps(){this.hideClose&&!this.visuallyHiddenClose&&console.error(`If hideClose prop is true, visuallyHiddenClose and visuallyHiddenCloseLabel props
|
|
2
|
+
need to be set so the component always includes a close button`)}}},B=["aria-describedby","aria-labelledby"],p=["id"],w=["id"],D={key:4,class:"d-modal__footer"};function I(t,s,l,v,a,o){const m=e.resolveComponent("dt-icon"),_=e.resolveComponent("dt-button"),h=e.resolveComponent("sr-only-close-button"),y=e.resolveComponent("dt-lazy-show");return e.openBlock(),e.createBlock(y,e.mergeProps({transition:"d-zoom",show:l.show,class:["d-modal",a.MODAL_KIND_MODIFIERS[l.kind],a.MODAL_SIZE_MODIFIERS[l.size],l.modalClass],"data-qa":"dt-modal","aria-hidden":o.open},e.toHandlers(o.modalListeners)),{default:e.withCtx(()=>[l.show&&(a.hasSlotContent(t.$slots.banner)||l.bannerTitle)?(e.openBlock(),e.createElementBlock("div",{key:0,"data-qa":"dt-modal-banner",class:e.normalizeClass(["d-modal__banner",l.bannerClass,o.bannerKindClass])},[e.renderSlot(t.$slots,"banner",{},()=>[e.createTextVNode(e.toDisplayString(l.bannerTitle),1)])],2)):e.createCommentVNode("",!0),e.createVNode(e.Transition,{appear:"",name:"d-modal__dialog"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["d-modal__dialog",{"d-modal__dialog--scrollable":l.fixedHeaderFooter},l.dialogClass]),role:"dialog","aria-modal":"true","aria-describedby":l.describedById,"aria-labelledby":l.labelledById},[a.hasSlotContent(t.$slots.header)?(e.openBlock(),e.createElementBlock("div",{key:0,id:l.labelledById,class:"d-modal__header","data-qa":"dt-modal-title"},[e.renderSlot(t.$slots,"header")],8,p)):(e.openBlock(),e.createElementBlock("h2",{key:1,id:l.labelledById,class:"d-modal__header","data-qa":"dt-modal-title"},e.toDisplayString(l.title),9,w)),a.hasSlotContent(t.$slots.default)?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["d-modal__content",l.contentClass]),"data-qa":"dt-modal-copy"},[e.renderSlot(t.$slots,"default")],2)):(e.openBlock(),e.createElementBlock("p",{key:3,class:e.normalizeClass(["d-modal__content",l.contentClass]),"data-qa":"dt-modal-copy"},e.toDisplayString(l.copy),3)),o.hasFooterSlot?(e.openBlock(),e.createElementBlock("footer",D,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0),l.hideClose?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,e.mergeProps({key:5,class:"d-modal__close",circle:"",size:"lg",importance:"clear","aria-label":l.closeButtonProps.ariaLabel},l.closeButtonProps,{onClick:o.close}),{icon:e.withCtx(()=>[e.createVNode(m,{name:"close",size:"400"})]),_:1},16,["aria-label","onClick"])),t.showVisuallyHiddenClose?(e.openBlock(),e.createBlock(h,{key:6,"visually-hidden-close-label":t.visuallyHiddenCloseLabel,onClose:o.close},null,8,["visually-hidden-close-label","onClose"])):e.createCommentVNode("",!0)],10,B),[[e.vShow,l.show]])]),_:3})]),_:3},16,["show","class","aria-hidden"])}const N=f._(g,[["render",I]]);exports.DtModal=N;exports.MODAL_BANNER_KINDS=d;exports.MODAL_KIND_MODIFIERS=i;exports.MODAL_SIZE_MODIFIERS=r;
|
|
3
|
+
//# sourceMappingURL=modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.cjs","sources":["../../components/modal/modal_constants.js","../../components/modal/modal.vue"],"sourcesContent":["// Modal style modifiers\nexport const MODAL_KIND_MODIFIERS = {\n default: '',\n danger: 'd-modal--danger',\n};\n\n// Modal size modifiers\nexport const MODAL_SIZE_MODIFIERS = {\n default: '',\n full: 'd-modal--full',\n};\n\nexport const MODAL_BANNER_KINDS = {\n error: 'd-modal__banner--critical',\n info: 'd-modal__banner--info',\n success: 'd-modal__banner--success',\n warning: 'd-modal__banner--warning',\n base: 'd-modal__banner--general',\n};\n","<template>\n <dt-lazy-show\n transition=\"d-zoom\"\n :show=\"show\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n MODAL_SIZE_MODIFIERS[size],\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-hidden=\"open\"\n v-on=\"modalListeners\"\n >\n <div\n v-if=\"show && (hasSlotContent($slots.banner) || bannerTitle)\"\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 bannerTitle prop -->\n <slot name=\"banner\">\n {{ bannerTitle }}\n </slot>\n </div>\n <transition\n appear\n name=\"d-modal__dialog\"\n >\n <div\n v-show=\"show\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-describedby=\"describedById\"\n :aria-labelledby=\"labelledById\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"title\" text prop -->\n <slot name=\"header\" />\n </div>\n <h2\n v-else\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n {{ title }}\n </h2>\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\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <dt-button\n v-if=\"!hideClose\"\n class=\"d-modal__close\"\n circle\n size=\"lg\"\n importance=\"clear\"\n :aria-label=\"closeButtonProps.ariaLabel\"\n v-bind=\"closeButtonProps\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon\n name=\"close\"\n size=\"400\"\n />\n </template>\n </dt-button>\n <sr-only-close-button\n v-if=\"showVisuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"close\"\n />\n </div>\n </transition>\n </dt-lazy-show>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport Modal from '@/common/mixins/modal';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n} from './modal_constants';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/notice';\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 DtLazyShow,\n DtButton,\n DtIcon,\n SrOnlyCloseButton,\n },\n\n mixins: [Modal, SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * A set of props to be passed into the modal's close button.\n * Requires an 'ariaLabel' property.\n */\n closeButtonProps: {\n type: Object,\n required: true,\n validator: (props) => {\n return !!props.ariaLabel;\n },\n },\n\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 show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Title text to display in the modal header.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Title text to display in the modal banner.\n */\n bannerTitle: {\n type: String,\n default: '',\n },\n\n /**\n * The theme of the modal. kind - default or danger,\n * @values default, danger\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * The size of the modal. size - default or full,\n * @values default, full\n */\n size: {\n type: String,\n default: 'default',\n validator: (s) => Object.keys(MODAL_SIZE_MODIFIERS).includes(s),\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, error, info, success, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validate (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 * Hides the close button on the modal\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\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, HTMLElement],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\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:show\n * @type {Boolean}\n */\n 'update:show',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n MODAL_BANNER_KINDS,\n EVENT_KEYNAMES,\n hasSlotContent,\n };\n },\n\n computed: {\n modalListeners () {\n return {\n click: event => {\n if (!this.closeOnClick) return;\n (event.target === event.currentTarget) && this.close();\n this.$emit('click', event);\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n this.$emit('keydown', event);\n },\n\n 'after-enter': event => {\n this.$emit('update:show', true);\n (event.target === event.currentTarget) && this.setFocusAfterTransition();\n },\n };\n },\n\n open () {\n return `${!this.show}`;\n },\n\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n },\n\n watch: {\n show: {\n immediate: true,\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n } else {\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n\n $props: {\n immediate: true,\n deep: true,\n handler () {\n this.validateProps();\n },\n },\n },\n\n methods: {\n close () {\n this.$emit('update:show', false);\n },\n\n setFocusAfterTransition () {\n if (this.initialFocusElement === 'first') {\n this.focusFirstElement();\n } else if (this.initialFocusElement.startsWith('#')) {\n this.focusElementById(this.initialFocusElement);\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n\n trapFocus (e) {\n if (this.show) {\n this.focusTrappedTabPress(e);\n }\n },\n\n validateProps () {\n if (this.hideClose && !this.visuallyHiddenClose) {\n console.error(`If hideClose prop is true, visuallyHiddenClose and visuallyHiddenCloseLabel props\n need to be set so the component always includes a close button`);\n }\n },\n },\n};\n</script>\n"],"names":["MODAL_KIND_MODIFIERS","MODAL_SIZE_MODIFIERS","MODAL_BANNER_KINDS","_sfc_main","DtLazyShow","DtButton","DtIcon","SrOnlyCloseButton","Modal","SrOnlyCloseButtonMixin","props","getUniqueString","k","s","kind","NOTICE_KINDS","initialFocusElement","EVENT_KEYNAMES","hasSlotContent","event","isShowing","_a","e","_openBlock","_createBlock","_component_dt_lazy_show","_mergeProps","$props","$data","$options","_toHandlers","_ctx","_createElementBlock","_normalizeClass","_renderSlot","_createVNode","_Transition","_createElementVNode","_hoisted_3","_hoisted_4","_component_dt_button","_component_dt_icon","_component_sr_only_close_button"],"mappings":"onBACY,MAACA,EAAuB,CAClC,QAAS,GACT,OAAQ,iBACV,EAGaC,EAAuB,CAClC,QAAS,GACT,KAAM,eACR,EAEaC,EAAqB,CAChC,MAAO,4BACP,KAAM,wBACN,QAAS,2BACT,QAAS,2BACT,KAAM,0BACR,ECwHKC,EAAU,CACb,KAAM,UAEN,WAAY,YACVC,EAAU,WACV,SAAAC,EAAQ,SACR,OAAAC,EAAM,OACN,kBAAAC,EAAiB,CAClB,EAED,OAAQ,CAACC,EAAK,EAAEC,GAAsB,EAEtC,MAAO,CAKL,iBAAkB,CAChB,KAAM,OACN,SAAU,GACV,UAAYC,GACH,CAAC,CAACA,EAAM,SAElB,EAKD,KAAM,CACJ,KAAM,OACN,QAAS,EACV,EAOD,cAAe,CACb,KAAM,OACN,QAAS,EACV,EAKD,aAAc,CACZ,KAAM,OACN,QAAS,UAAY,CAA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TO,EAMS,CADPL,aAAsBH,EAAA,OAAA,QAAA,iCAGfJ,EAAS,uCADlBJ,EAAAA,YAAAC,EAAAA,YAgBYgB,EAhBZd,aAgBY,OAdV,MAAM,iBACN,OAAA,GACA,KAAK,KACL,WAAW,QACV,aAAYC,EAAgB,iBAAC,WACtBA,EAAgB,iBAAA,CACvB,QAAOE,EAAK,KAAA,CAAA,EAAA,CAEF,eACT,IAGE,CAHFM,EAAAA,YAGEM,EAAA,CAFA,KAAK,QACL,KAAK,6CAKHV,EAAuB,uCAD/BP,EAIE,YAAAkB,EAAA,OAFC,8BAA6BX,EAAwB,yBACrD,QAAOF,EAAK,uGA5EPF,EAAI,IAAA"}
|
package/dist/lib/modal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { M as E } from "../chunks/modal-VuMFkZFH.js";
|
|
2
2
|
import { getUniqueString as I, hasSlotContent as v } from "./utils.js";
|
|
3
|
-
import { EVENT_KEYNAMES as
|
|
3
|
+
import { EVENT_KEYNAMES as n } from "./constants.js";
|
|
4
4
|
import { S as B, a as O } from "../chunks/sr_only_close_button-7O-Ev8uM.js";
|
|
5
|
-
import { resolveComponent as
|
|
5
|
+
import { resolveComponent as i, openBlock as a, createBlock as m, mergeProps as _, toHandlers as D, withCtx as h, createElementBlock as o, normalizeClass as d, renderSlot as r, createTextVNode as M, toDisplayString as f, createCommentVNode as c, createVNode as y, Transition as F, withDirectives as A, createElementVNode as T, vShow as L } from "vue";
|
|
6
6
|
import { _ as N } from "../chunks/_plugin-vue_export-helper-hUChTQA_.js";
|
|
7
7
|
import { DtLazyShow as H } from "./lazy-show.js";
|
|
8
8
|
import { DtButton as z } from "./button.js";
|
|
@@ -12,7 +12,6 @@ import "../chunks/link_constants-vIUB92L4.js";
|
|
|
12
12
|
import "@dialpad/dialtone-icons/vue3";
|
|
13
13
|
import "../chunks/icon_constants-OpYAAKwF.js";
|
|
14
14
|
import "@dialpad/dialtone-icons/icons.json";
|
|
15
|
-
import "./skeleton.js";
|
|
16
15
|
const b = {
|
|
17
16
|
default: "",
|
|
18
17
|
danger: "d-modal--danger"
|
|
@@ -223,7 +222,7 @@ const b = {
|
|
|
223
222
|
MODAL_KIND_MODIFIERS: b,
|
|
224
223
|
MODAL_SIZE_MODIFIERS: C,
|
|
225
224
|
MODAL_BANNER_KINDS: S,
|
|
226
|
-
EVENT_KEYNAMES:
|
|
225
|
+
EVENT_KEYNAMES: n,
|
|
227
226
|
hasSlotContent: v
|
|
228
227
|
};
|
|
229
228
|
},
|
|
@@ -235,11 +234,11 @@ const b = {
|
|
|
235
234
|
},
|
|
236
235
|
keydown: (e) => {
|
|
237
236
|
switch (e.code) {
|
|
238
|
-
case
|
|
239
|
-
case
|
|
237
|
+
case n.esc:
|
|
238
|
+
case n.escape:
|
|
240
239
|
this.close();
|
|
241
240
|
break;
|
|
242
|
-
case
|
|
241
|
+
case n.tab:
|
|
243
242
|
this.trapFocus(e);
|
|
244
243
|
break;
|
|
245
244
|
}
|
|
@@ -296,7 +295,7 @@ const b = {
|
|
|
296
295
|
class: "d-modal__footer"
|
|
297
296
|
};
|
|
298
297
|
function Z(e, u, t, U, s, l) {
|
|
299
|
-
const
|
|
298
|
+
const g = i("dt-icon"), p = i("dt-button"), w = i("sr-only-close-button"), k = i("dt-lazy-show");
|
|
300
299
|
return a(), m(k, _({
|
|
301
300
|
transition: "d-zoom",
|
|
302
301
|
show: t.show,
|
|
@@ -372,7 +371,7 @@ function Z(e, u, t, U, s, l) {
|
|
|
372
371
|
l.hasFooterSlot ? (a(), o("footer", W, [
|
|
373
372
|
r(e.$slots, "footer")
|
|
374
373
|
])) : c("", !0),
|
|
375
|
-
t.hideClose ? c("", !0) : (a(), m(
|
|
374
|
+
t.hideClose ? c("", !0) : (a(), m(p, _({
|
|
376
375
|
key: 5,
|
|
377
376
|
class: "d-modal__close",
|
|
378
377
|
circle: "",
|
|
@@ -381,7 +380,7 @@ function Z(e, u, t, U, s, l) {
|
|
|
381
380
|
"aria-label": t.closeButtonProps.ariaLabel
|
|
382
381
|
}, t.closeButtonProps, { onClick: l.close }), {
|
|
383
382
|
icon: h(() => [
|
|
384
|
-
y(
|
|
383
|
+
y(g, {
|
|
385
384
|
name: "close",
|
|
386
385
|
size: "400"
|
|
387
386
|
})
|
|
@@ -403,9 +402,9 @@ function Z(e, u, t, U, s, l) {
|
|
|
403
402
|
_: 3
|
|
404
403
|
}, 16, ["show", "class", "aria-hidden"]);
|
|
405
404
|
}
|
|
406
|
-
const
|
|
405
|
+
const ie = /* @__PURE__ */ N(j, [["render", Z]]);
|
|
407
406
|
export {
|
|
408
|
-
|
|
407
|
+
ie as DtModal,
|
|
409
408
|
S as MODAL_BANNER_KINDS,
|
|
410
409
|
b as MODAL_KIND_MODIFIERS,
|
|
411
410
|
C as MODAL_SIZE_MODIFIERS
|
package/dist/lib/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../components/modal/modal_constants.js","../../components/modal/modal.vue"],"sourcesContent":["// Modal style modifiers\nexport const MODAL_KIND_MODIFIERS = {\n default: '',\n danger: 'd-modal--danger',\n};\n\n// Modal size modifiers\nexport const MODAL_SIZE_MODIFIERS = {\n default: '',\n full: 'd-modal--full',\n};\n\nexport const MODAL_BANNER_KINDS = {\n error: 'd-modal__banner--critical',\n info: 'd-modal__banner--info',\n success: 'd-modal__banner--success',\n warning: 'd-modal__banner--warning',\n base: 'd-modal__banner--general',\n};\n","<template>\n <dt-lazy-show\n transition=\"d-zoom\"\n :show=\"show\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n MODAL_SIZE_MODIFIERS[size],\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-hidden=\"open\"\n v-on=\"modalListeners\"\n >\n <div\n v-if=\"show && (hasSlotContent($slots.banner) || bannerTitle)\"\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 bannerTitle prop -->\n <slot name=\"banner\">\n {{ bannerTitle }}\n </slot>\n </div>\n <transition\n appear\n name=\"d-modal__dialog\"\n >\n <div\n v-show=\"show\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-describedby=\"describedById\"\n :aria-labelledby=\"labelledById\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"title\" text prop -->\n <slot name=\"header\" />\n </div>\n <h2\n v-else\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n {{ title }}\n </h2>\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\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <dt-button\n v-if=\"!hideClose\"\n class=\"d-modal__close\"\n circle\n size=\"lg\"\n importance=\"clear\"\n :aria-label=\"closeButtonProps.ariaLabel\"\n v-bind=\"closeButtonProps\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon\n name=\"close\"\n size=\"400\"\n />\n </template>\n </dt-button>\n <sr-only-close-button\n v-if=\"showVisuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"close\"\n />\n </div>\n </transition>\n </dt-lazy-show>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport Modal from '@/common/mixins/modal';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n} from './modal_constants';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/notice';\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 DtLazyShow,\n DtButton,\n DtIcon,\n SrOnlyCloseButton,\n },\n\n mixins: [Modal, SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * A set of props to be passed into the modal's close button.\n * Requires an 'ariaLabel' property.\n */\n closeButtonProps: {\n type: Object,\n required: true,\n validator: (props) => {\n return !!props.ariaLabel;\n },\n },\n\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 show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Title text to display in the modal header.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Title text to display in the modal banner.\n */\n bannerTitle: {\n type: String,\n default: '',\n },\n\n /**\n * The theme of the modal. kind - default or danger,\n * @values default, danger\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * The size of the modal. size - default or full,\n * @values default, full\n */\n size: {\n type: String,\n default: 'default',\n validator: (s) => Object.keys(MODAL_SIZE_MODIFIERS).includes(s),\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, error, info, success, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validate (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 * Hides the close button on the modal\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\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, HTMLElement],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\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:show\n * @type {Boolean}\n */\n 'update:show',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n MODAL_BANNER_KINDS,\n EVENT_KEYNAMES,\n hasSlotContent,\n };\n },\n\n computed: {\n modalListeners () {\n return {\n click: event => {\n if (!this.closeOnClick) return;\n (event.target === event.currentTarget) && this.close();\n this.$emit('click', event);\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n this.$emit('keydown', event);\n },\n\n 'after-enter': event => {\n this.$emit('update:show', true);\n (event.target === event.currentTarget) && this.setFocusAfterTransition();\n },\n };\n },\n\n open () {\n return `${!this.show}`;\n },\n\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n },\n\n watch: {\n show: {\n immediate: true,\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n } else {\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n\n $props: {\n immediate: true,\n deep: true,\n handler () {\n this.validateProps();\n },\n },\n },\n\n methods: {\n close () {\n this.$emit('update:show', false);\n },\n\n setFocusAfterTransition () {\n if (this.initialFocusElement === 'first') {\n this.focusFirstElement();\n } else if (this.initialFocusElement.startsWith('#')) {\n this.focusElementById(this.initialFocusElement);\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n\n trapFocus (e) {\n if (this.show) {\n this.focusTrappedTabPress(e);\n }\n },\n\n validateProps () {\n if (this.hideClose && !this.visuallyHiddenClose) {\n console.error(`If hideClose prop is true, visuallyHiddenClose and visuallyHiddenCloseLabel props\n need to be set so the component always includes a close button`);\n }\n },\n },\n};\n</script>\n"],"names":["MODAL_KIND_MODIFIERS","MODAL_SIZE_MODIFIERS","MODAL_BANNER_KINDS","_sfc_main","DtLazyShow","DtButton","DtIcon","SrOnlyCloseButton","Modal","SrOnlyCloseButtonMixin","props","getUniqueString","k","s","kind","NOTICE_KINDS","initialFocusElement","EVENT_KEYNAMES","hasSlotContent","event","isShowing","_a","_openBlock","_createBlock","_component_dt_lazy_show","_mergeProps","$props","$data","$options","_toHandlers","_ctx","_createElementBlock","_normalizeClass","_renderSlot","_createVNode","_Transition","_createElementVNode","_hoisted_3","_hoisted_4","_component_dt_button","_component_dt_icon","_component_sr_only_close_button"],"mappings":";;;;;;;;;;;;;;;AACY,MAACA,IAAuB;AAAA,EAClC,SAAS;AAAA,EACT,QAAQ;AACV,GAGaC,IAAuB;AAAA,EAClC,SAAS;AAAA,EACT,MAAM;AACR,GAEaC,IAAqB;AAAA,EAChC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,MAAM;AACR,GCwHKC,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,mBAAAC;AAAA,EACD;AAAA,EAED,QAAQ,CAACC,GAAOC,CAAsB;AAAA,EAEtC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,kBAAkB;AAAA,MAChB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,WAA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AExBC,EAOK,MAAA;AAAA;cALF,IAAIL,EAAY;AAAA,cACjB,OAAM;AAAA,cACN,WAAQ;AAAA,iBAELA,EAAK,KAAA,GAAA,GAAAW,CAAA;AAAA,YAGFV,EAAc,eAACG,EAAM,OAAC,OAAO,UADrCC,EAUM,OAAA;AAAA;cARH,OAAKC,EAAA;AAAA;gBAAgDN,EAAY;AAAA;cAIlE,WAAQ;AAAA;cAGRO,EAAQH,EAAA,QAAA,SAAA;AAAA,2BAEVC,EASI,KAAA;AAAA;cAPD,OAAKC,EAAA;AAAA;gBAAgDN,EAAY;AAAA;cAIlE,WAAQ;AAAA,iBAELA,EAAI,IAAA,GAAA,CAAA;AAAA,YAGDE,EAAa,iBADrBN,KAAAS,EAMS,UANTO,GAMS;AAAA,cADPL,EAAsBH,EAAA,QAAA,QAAA;AAAA;YAGfJ,EAAS,yBADlBJ,KAAAC,EAgBYgB,GAhBZd,EAgBY;AAAA;cAdV,OAAM;AAAA,cACN,QAAA;AAAA,cACA,MAAK;AAAA,cACL,YAAW;AAAA,cACV,cAAYC,EAAgB,iBAAC;AAAA,eACtBA,EAAgB,kBAAA,EACvB,SAAOE,EAAK,MAAA,CAAA,GAAA;AAAA,cAEF,QACT,MAGE;AAAA,gBAHFM,EAGEM,GAAA;AAAA,kBAFA,MAAK;AAAA,kBACL,MAAK;AAAA;;;;YAKHV,EAAuB,gCAD/BP,EAIEkB,GAAA;AAAA;cAFC,+BAA6BX,EAAwB;AAAA,cACrD,SAAOF,EAAK;AAAA;;gBA5EPF,EAAI,IAAA;AAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../components/modal/modal_constants.js","../../components/modal/modal.vue"],"sourcesContent":["// Modal style modifiers\nexport const MODAL_KIND_MODIFIERS = {\n default: '',\n danger: 'd-modal--danger',\n};\n\n// Modal size modifiers\nexport const MODAL_SIZE_MODIFIERS = {\n default: '',\n full: 'd-modal--full',\n};\n\nexport const MODAL_BANNER_KINDS = {\n error: 'd-modal__banner--critical',\n info: 'd-modal__banner--info',\n success: 'd-modal__banner--success',\n warning: 'd-modal__banner--warning',\n base: 'd-modal__banner--general',\n};\n","<template>\n <dt-lazy-show\n transition=\"d-zoom\"\n :show=\"show\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n MODAL_SIZE_MODIFIERS[size],\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-hidden=\"open\"\n v-on=\"modalListeners\"\n >\n <div\n v-if=\"show && (hasSlotContent($slots.banner) || bannerTitle)\"\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 bannerTitle prop -->\n <slot name=\"banner\">\n {{ bannerTitle }}\n </slot>\n </div>\n <transition\n appear\n name=\"d-modal__dialog\"\n >\n <div\n v-show=\"show\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-describedby=\"describedById\"\n :aria-labelledby=\"labelledById\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"title\" text prop -->\n <slot name=\"header\" />\n </div>\n <h2\n v-else\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n {{ title }}\n </h2>\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\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <dt-button\n v-if=\"!hideClose\"\n class=\"d-modal__close\"\n circle\n size=\"lg\"\n importance=\"clear\"\n :aria-label=\"closeButtonProps.ariaLabel\"\n v-bind=\"closeButtonProps\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon\n name=\"close\"\n size=\"400\"\n />\n </template>\n </dt-button>\n <sr-only-close-button\n v-if=\"showVisuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"close\"\n />\n </div>\n </transition>\n </dt-lazy-show>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\nimport Modal from '@/common/mixins/modal';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n} from './modal_constants';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/notice';\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 DtLazyShow,\n DtButton,\n DtIcon,\n SrOnlyCloseButton,\n },\n\n mixins: [Modal, SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * A set of props to be passed into the modal's close button.\n * Requires an 'ariaLabel' property.\n */\n closeButtonProps: {\n type: Object,\n required: true,\n validator: (props) => {\n return !!props.ariaLabel;\n },\n },\n\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 show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Title text to display in the modal header.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Title text to display in the modal banner.\n */\n bannerTitle: {\n type: String,\n default: '',\n },\n\n /**\n * The theme of the modal. kind - default or danger,\n * @values default, danger\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * The size of the modal. size - default or full,\n * @values default, full\n */\n size: {\n type: String,\n default: 'default',\n validator: (s) => Object.keys(MODAL_SIZE_MODIFIERS).includes(s),\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, error, info, success, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validate (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 * Hides the close button on the modal\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\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, HTMLElement],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\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:show\n * @type {Boolean}\n */\n 'update:show',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n MODAL_BANNER_KINDS,\n EVENT_KEYNAMES,\n hasSlotContent,\n };\n },\n\n computed: {\n modalListeners () {\n return {\n click: event => {\n if (!this.closeOnClick) return;\n (event.target === event.currentTarget) && this.close();\n this.$emit('click', event);\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n this.$emit('keydown', event);\n },\n\n 'after-enter': event => {\n this.$emit('update:show', true);\n (event.target === event.currentTarget) && this.setFocusAfterTransition();\n },\n };\n },\n\n open () {\n return `${!this.show}`;\n },\n\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n },\n\n watch: {\n show: {\n immediate: true,\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n } else {\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n\n $props: {\n immediate: true,\n deep: true,\n handler () {\n this.validateProps();\n },\n },\n },\n\n methods: {\n close () {\n this.$emit('update:show', false);\n },\n\n setFocusAfterTransition () {\n if (this.initialFocusElement === 'first') {\n this.focusFirstElement();\n } else if (this.initialFocusElement.startsWith('#')) {\n this.focusElementById(this.initialFocusElement);\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n\n trapFocus (e) {\n if (this.show) {\n this.focusTrappedTabPress(e);\n }\n },\n\n validateProps () {\n if (this.hideClose && !this.visuallyHiddenClose) {\n console.error(`If hideClose prop is true, visuallyHiddenClose and visuallyHiddenCloseLabel props\n need to be set so the component always includes a close button`);\n }\n },\n },\n};\n</script>\n"],"names":["MODAL_KIND_MODIFIERS","MODAL_SIZE_MODIFIERS","MODAL_BANNER_KINDS","_sfc_main","DtLazyShow","DtButton","DtIcon","SrOnlyCloseButton","Modal","SrOnlyCloseButtonMixin","props","getUniqueString","k","s","kind","NOTICE_KINDS","initialFocusElement","EVENT_KEYNAMES","hasSlotContent","event","isShowing","_a","_openBlock","_createBlock","_component_dt_lazy_show","_mergeProps","$props","$data","$options","_toHandlers","_ctx","_createElementBlock","_normalizeClass","_renderSlot","_createVNode","_Transition","_createElementVNode","_hoisted_3","_hoisted_4","_component_dt_button","_component_dt_icon","_component_sr_only_close_button"],"mappings":";;;;;;;;;;;;;;AACY,MAACA,IAAuB;AAAA,EAClC,SAAS;AAAA,EACT,QAAQ;AACV,GAGaC,IAAuB;AAAA,EACl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AA,kBACL,MAAK;AAAA;;;;YAKHV,EAAuB,gCAD/BP,EAIEkB,GAAA;AAAA;cAFC,+BAA6BX,EAAwB;AAAA,cACrD,SAAOF,EAAK;AAAA;;gBA5EPF,EAAI,IAAA;AAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/notice_action-jO199emq.js"),i=require("../chunks/notice_constants-mC6al2Dm.js"),a=require("../chunks/sr_only_close_button-iD7s1Pbj.js"),e=require("vue"),u=require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js");require("./utils.cjs");require("./constants.cjs");require("./icon.cjs");require("@dialpad/dialtone-icons/vue3");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");require("./button.cjs");require("../chunks/link_constants-Kn6kP4i1.js");const f={name:"DtNotice",components:{DtNoticeIcon:n.a,DtNoticeContent:n.b,DtNoticeAction:n.D},mixins:[a.a],props:{titleId:{type:String,default:void 0},contentId:{type:String,default:void 0},title:{type:String,default:""},role:{type:String,default:"status",validate(t){return i.a.includes(t)}},important:{type:Boolean,default:!1},kind:{type:String,default:"base",validate(t){return i.N.includes(t)}},closeButtonProps:{type:Object,default:()=>({})},hideClose:{type:Boolean,default:!1},hideIcon:{type:Boolean,default:!1},hideAction:{type:Boolean,default:!1}},emits:["close","click"],computed:{noticeClass(){return["d-notice",{error:"d-notice--error",info:"d-notice--info",success:"d-notice--success",warning:"d-notice--warning",base:"d-notice--base"}[this.kind],{"d-notice--important":this.important}]}}};function _(t,l,o,p,y,c){const d=e.resolveComponent("dt-notice-icon"),r=e.resolveComponent("dt-notice-content"),s=e.resolveComponent("dt-notice-action");return e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(c.noticeClass),"data-qa":"notice"},[o.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,kind:o.kind},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"icon")]),_:3},8,["kind"])),e.createVNode(r,{"title-id":o.titleId,"content-id":o.contentId,title:o.title,role:o.role},{titleOverride:e.withCtx(()=>[e.renderSlot(t.$slots,"titleOverride")]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["title-id","content-id","title","role"]),e.createVNode(s,{"hide-action":o.hideAction,"hide-close":o.hideClose,"close-button-props":o.closeButtonProps,"visually-hidden-close":t.visuallyHiddenClose,"visually-hidden-close-label":t.visuallyHiddenCloseLabel,onClose:l[0]||(l[0]=C=>t.$emit("close"))},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"action")]),_:3},8,["hide-action","hide-close","close-button-props","visually-hidden-close","visually-hidden-close-label"])],2)}const m=u._(f,[["render",_]]);exports.DtNoticeAction=n.D;exports.DtNoticeContent=n.b;exports.DtNoticeIcon=n.a;exports.NOTICE_KINDS=i.N;exports.NOTICE_ROLES=i.a;exports.DtNotice=m;
|
|
2
|
+
//# sourceMappingURL=notice.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notice.cjs","sources":["../../components/notice/notice.vue"],"sourcesContent":["<template>\n <aside\n :class=\"noticeClass\"\n data-qa=\"notice\"\n >\n <dt-notice-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n >\n <!-- @slot Slot for custom icon -->\n <slot name=\"icon\" />\n </dt-notice-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n >\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need\n to override with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the notice -->\n <slot />\n </dt-notice-content>\n <dt-notice-action\n :hide-action=\"hideAction\"\n :hide-close=\"hideClose\"\n :close-button-props=\"closeButtonProps\"\n :visually-hidden-close=\"visuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"$emit('close')\"\n >\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <slot name=\"action\" />\n </dt-notice-action>\n </aside>\n</template>\n\n<script>\nimport DtNoticeIcon from './notice_icon.vue';\nimport DtNoticeContent from './notice_content.vue';\nimport DtNoticeAction from './notice_action.vue';\nimport { NOTICE_KINDS, NOTICE_ROLES } from './notice_constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\n\n/**\n * A notice is an informational and assistive message that appears inline with content.\n * @see https://dialtone.dialpad.com/components/notice.html\n */\nexport default {\n name: 'DtNotice',\n\n components: {\n DtNoticeIcon,\n DtNoticeContent,\n DtNoticeAction,\n },\n\n mixins: [SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title header of the notice. This can be left blank to remove the title from the notice entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the notice. 'status' is used to communicate a message. 'alert' is used to communicate an\n * important message that does not contain any interactive elements. 'alertdialog' is used to communicate an\n * important message that does contain interactive elements.\n * @values alert, alertdialog, status\n */\n role: {\n type: String,\n default: 'status',\n validate (role) {\n return NOTICE_ROLES.includes(role);\n },\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * This will also change the aria role from status to alert.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Severity level of the notice, sets the icon and background\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validate (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Props for the notice close button.\n */\n closeButtonProps: {\n type: Object,\n default: () => ({}),\n },\n\n /**\n * Hides the close button from the notice\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Close button click event\n *\n * @event close\n */\n 'close',\n\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n ],\n\n computed: {\n noticeClass () {\n const noticeKinds = {\n error: 'd-notice--error',\n info: 'd-notice--info',\n success: 'd-notice--success',\n warning: 'd-notice--warning',\n base: 'd-notice--base',\n };\n return [\n 'd-notice',\n noticeKinds[this.kind],\n { 'd-notice--important': this.important },\n ];\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtNoticeIcon","DtNoticeContent","DtNoticeAction","SrOnlyCloseButtonMixin","role","NOTICE_ROLES","kind","NOTICE_KINDS","_createElementBlock","$options","$props","_createBlock","_component_dt_notice_icon","_renderSlot","_ctx","_createVNode","_component_dt_notice_content","_component_dt_notice_action"],"mappings":"ulBAmDA,MAAKA,EAAU,CACb,KAAM,WAEN,WAAY,cACVC,EAAY,EACZ,gBAAAC,EAAe,EACf,eAAAC,EAAc,CACf,EAED,OAAQ,CAACC,EAAAA,CAAsB,EAE/B,MAAO,CAKL,QAAS,CACP,KAAM,OACN,QAAS,MACV,EAMD,UAAW,CACT,KAAM,OACN,QAAS,MACV,EAKD,MAAO,CACL,KAAM,OACN,QAAS,EACV,EAQD,KAAM,CACJ,KAAM,OACN,QAAS,SACT,SAAUC,EAAM,CACd,OAAOC,EAAY,EAAC,SAASD,CAAI,CAClC,CACF,EAOD,UAAW,CACT,KAAM,QACN,QAAS,EACV,EAMD,KAAM,CACJ,KAAM,OACN,QAAS,OACT,SAAUE,EAAM,CACd,OAAOC,EAAY,EAAC,SAASD,CAAI,CAClC,CACF,EAKD,iBAAkB,CAChB,KAAM,OACN,QAAS,KAAO,CAAA,EACjB,EAMD,UAAW,CACT,KAAM,QACN,QAAS,EACV,EAMD,SAAU,CACR,KAAM,QACN,QAAS,EACV,EAMD,WAAY,CACV,KAAM,QACN,QAAS,EACV,CACF,EAED,MAAO,CAML,QAQA,OACD,EAED,SAAU,CACR,aAAe,CAQb,MAAO,CACL,WARkB,CAClB,MAAO,kBACP,KAAM,iBACN,QAAS,oBACT,QAAS,oBACT,KAAM,kBAIM,KAAK,IAAI,EACrB,CAAE,sBAAuB,KAAK,SAAW,EAE5C,CACF,CACH,+KAjMEE,EAoCQ,mBAAA,QAAA,CAnCL,uBAAOC,EAAW,WAAA,EACnB,UAAQ,WAGCC,EAAQ,oDADjBC,EAMiB,YAAAC,EAAA,OAJd,KAAMF,EAAI,yBAGX,IAAoB,CAApBG,aAAoBC,EAAA,OAAA,MAAA,sBAEtBC,EAAAA,YAaoBC,EAAA,CAZjB,WAAUN,EAAO,QACjB,aAAYA,EAAS,UACrB,MAAOA,EAAK,MACZ,KAAMA,EAAI,OAEA,wBAGT,IAA6B,CAA7BG,aAA6BC,EAAA,OAAA,eAAA,sBAG/B,IAAQ,CAARD,aAAQC,EAAA,OAAA,SAAA,qDAEVC,EAAAA,YAUmBE,EAAA,CAThB,cAAaP,EAAU,WACvB,aAAYA,EAAS,UACrB,qBAAoBA,EAAgB,iBACpC,wBAAuBI,EAAmB,oBAC1C,8BAA6BA,EAAwB,yBACrD,uBAAOA,EAAK,MAAA,OAAA,uBAGb,IAAsB,CAAtBD,aAAsBC,EAAA,OAAA,QAAA"}
|
package/dist/lib/notice.js
CHANGED
|
@@ -9,7 +9,6 @@ import "./icon.js";
|
|
|
9
9
|
import "@dialpad/dialtone-icons/vue3";
|
|
10
10
|
import "../chunks/icon_constants-OpYAAKwF.js";
|
|
11
11
|
import "@dialpad/dialtone-icons/icons.json";
|
|
12
|
-
import "./skeleton.js";
|
|
13
12
|
import "./button.js";
|
|
14
13
|
import "../chunks/link_constants-vIUB92L4.js";
|
|
15
14
|
const B = {
|
|
@@ -184,9 +183,9 @@ function I(e, l, t, S, g, c) {
|
|
|
184
183
|
}, 8, ["hide-action", "hide-close", "close-button-props", "visually-hidden-close", "visually-hidden-close-label"])
|
|
185
184
|
], 2);
|
|
186
185
|
}
|
|
187
|
-
const
|
|
186
|
+
const M = /* @__PURE__ */ k(B, [["render", I]]);
|
|
188
187
|
export {
|
|
189
|
-
|
|
188
|
+
M as DtNotice,
|
|
190
189
|
p as DtNoticeAction,
|
|
191
190
|
f as DtNoticeContent,
|
|
192
191
|
m as DtNoticeIcon,
|
package/dist/lib/notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.js","sources":["../../components/notice/notice.vue"],"sourcesContent":["<template>\n <aside\n :class=\"noticeClass\"\n data-qa=\"notice\"\n >\n <dt-notice-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n >\n <!-- @slot Slot for custom icon -->\n <slot name=\"icon\" />\n </dt-notice-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n >\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need\n to override with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the notice -->\n <slot />\n </dt-notice-content>\n <dt-notice-action\n :hide-action=\"hideAction\"\n :hide-close=\"hideClose\"\n :close-button-props=\"closeButtonProps\"\n :visually-hidden-close=\"visuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"$emit('close')\"\n >\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <slot name=\"action\" />\n </dt-notice-action>\n </aside>\n</template>\n\n<script>\nimport DtNoticeIcon from './notice_icon.vue';\nimport DtNoticeContent from './notice_content.vue';\nimport DtNoticeAction from './notice_action.vue';\nimport { NOTICE_KINDS, NOTICE_ROLES } from './notice_constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\n\n/**\n * A notice is an informational and assistive message that appears inline with content.\n * @see https://dialtone.dialpad.com/components/notice.html\n */\nexport default {\n name: 'DtNotice',\n\n components: {\n DtNoticeIcon,\n DtNoticeContent,\n DtNoticeAction,\n },\n\n mixins: [SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title header of the notice. This can be left blank to remove the title from the notice entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the notice. 'status' is used to communicate a message. 'alert' is used to communicate an\n * important message that does not contain any interactive elements. 'alertdialog' is used to communicate an\n * important message that does contain interactive elements.\n * @values alert, alertdialog, status\n */\n role: {\n type: String,\n default: 'status',\n validate (role) {\n return NOTICE_ROLES.includes(role);\n },\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * This will also change the aria role from status to alert.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Severity level of the notice, sets the icon and background\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validate (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Props for the notice close button.\n */\n closeButtonProps: {\n type: Object,\n default: () => ({}),\n },\n\n /**\n * Hides the close button from the notice\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Close button click event\n *\n * @event close\n */\n 'close',\n\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n ],\n\n computed: {\n noticeClass () {\n const noticeKinds = {\n error: 'd-notice--error',\n info: 'd-notice--info',\n success: 'd-notice--success',\n warning: 'd-notice--warning',\n base: 'd-notice--base',\n };\n return [\n 'd-notice',\n noticeKinds[this.kind],\n { 'd-notice--important': this.important },\n ];\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtNoticeIcon","DtNoticeContent","DtNoticeAction","SrOnlyCloseButtonMixin","role","NOTICE_ROLES","kind","NOTICE_KINDS","_createElementBlock","$options","$props","_createBlock","_component_dt_notice_icon","_renderSlot","_ctx","_createVNode","_component_dt_notice_content","_component_dt_notice_action"],"mappings":"
|
|
1
|
+
{"version":3,"file":"notice.js","sources":["../../components/notice/notice.vue"],"sourcesContent":["<template>\n <aside\n :class=\"noticeClass\"\n data-qa=\"notice\"\n >\n <dt-notice-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n >\n <!-- @slot Slot for custom icon -->\n <slot name=\"icon\" />\n </dt-notice-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n >\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need\n to override with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the notice -->\n <slot />\n </dt-notice-content>\n <dt-notice-action\n :hide-action=\"hideAction\"\n :hide-close=\"hideClose\"\n :close-button-props=\"closeButtonProps\"\n :visually-hidden-close=\"visuallyHiddenClose\"\n :visually-hidden-close-label=\"visuallyHiddenCloseLabel\"\n @close=\"$emit('close')\"\n >\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <slot name=\"action\" />\n </dt-notice-action>\n </aside>\n</template>\n\n<script>\nimport DtNoticeIcon from './notice_icon.vue';\nimport DtNoticeContent from './notice_content.vue';\nimport DtNoticeAction from './notice_action.vue';\nimport { NOTICE_KINDS, NOTICE_ROLES } from './notice_constants';\nimport SrOnlyCloseButtonMixin from '@/common/mixins/sr_only_close_button';\n\n/**\n * A notice is an informational and assistive message that appears inline with content.\n * @see https://dialtone.dialpad.com/components/notice.html\n */\nexport default {\n name: 'DtNotice',\n\n components: {\n DtNoticeIcon,\n DtNoticeContent,\n DtNoticeAction,\n },\n\n mixins: [SrOnlyCloseButtonMixin],\n\n props: {\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title header of the notice. This can be left blank to remove the title from the notice entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the notice. 'status' is used to communicate a message. 'alert' is used to communicate an\n * important message that does not contain any interactive elements. 'alertdialog' is used to communicate an\n * important message that does contain interactive elements.\n * @values alert, alertdialog, status\n */\n role: {\n type: String,\n default: 'status',\n validate (role) {\n return NOTICE_ROLES.includes(role);\n },\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * This will also change the aria role from status to alert.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Severity level of the notice, sets the icon and background\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validate (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Props for the notice close button.\n */\n closeButtonProps: {\n type: Object,\n default: () => ({}),\n },\n\n /**\n * Hides the close button from the notice\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Close button click event\n *\n * @event close\n */\n 'close',\n\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n ],\n\n computed: {\n noticeClass () {\n const noticeKinds = {\n error: 'd-notice--error',\n info: 'd-notice--info',\n success: 'd-notice--success',\n warning: 'd-notice--warning',\n base: 'd-notice--base',\n };\n return [\n 'd-notice',\n noticeKinds[this.kind],\n { 'd-notice--important': this.important },\n ];\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtNoticeIcon","DtNoticeContent","DtNoticeAction","SrOnlyCloseButtonMixin","role","NOTICE_ROLES","kind","NOTICE_KINDS","_createElementBlock","$options","$props","_createBlock","_component_dt_notice_icon","_renderSlot","_ctx","_createVNode","_component_dt_notice_content","_component_dt_notice_action"],"mappings":";;;;;;;;;;;;;AAmDA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,EACD;AAAA,EAED,QAAQ,CAACC,CAAsB;AAAA,EAE/B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQD,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAUC,GAAM;AACd,eAAOC,EAAa,SAASD,CAAI;AAAA,MAClC;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOD,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,MAAM;AAAA,MACJ,MAAM;AA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A;iBAG/B,MAAQ;AAAA,QAARD,EAAQC,EAAA,QAAA,SAAA;AAAA;;;IAEVC,EAUmBE,GAAA;AAAA,MAThB,eAAaP,EAAU;AAAA,MACvB,cAAYA,EAAS;AAAA,MACrB,sBAAoBA,EAAgB;AAAA,MACpC,yBAAuBI,EAAmB;AAAA,MAC1C,+BAA6BA,EAAwB;AAAA,MACrD,gCAAOA,EAAK,MAAA,OAAA;AAAA;iBAGb,MAAsB;AAAA,QAAtBD,EAAsBC,EAAA,QAAA,QAAA;AAAA;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),g=require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js"),d=require("./button.cjs"),b=require("./icon.cjs");require("./utils.cjs");require("./constants.cjs");require("../chunks/link_constants-Kn6kP4i1.js");require("@dialpad/dialtone-icons/vue3");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");const m={name:"DtPagination",components:{DtButton:d.DtButton,DtIcon:b.DtIcon},props:{ariaLabel:{type:String,required:!0},totalPages:{type:Number,required:!0},prevAriaLabel:{type:String,required:!0},nextAriaLabel:{type:String,required:!0},pageNumberAriaLabel:{type:Function,required:!0},activePage:{type:Number,default:1},maxVisible:{type:Number,default:5}},emits:["change"],data(){return{currentPage:this.activePage}},computed:{isFirstPage(){return this.currentPage===1},isLastPage(){return this.currentPage===this.totalPages},pages(){if(this.maxVisible===0)return[];if(this.totalPages<=this.maxVisible)return this.range(1,this.totalPages);const a=this.maxVisible-1,i=this.totalPages-a+1;if(this.currentPage<a)return[...this.range(1,a),"...",this.totalPages];if(this.currentPage>i)return[1,"...",...this.range(i,this.totalPages)];const n=this.maxVisible-(3-this.maxVisible%2),s=Math.floor(n/2),c=this.currentPage-s,t=this.currentPage+s;return[1,"...",...this.range(c,t),"...",this.totalPages]}},methods:{range(a,i){const n=[];a=a>0?a:1;for(let s=a;s<=i;s++)n.push(s);return n},changePage(a){this.currentPage=a,this.$emit("change",this.currentPage)}}},h=["aria-label"],P={key:0,class:"d-pagination__separator-icon","data-qa":"dt-pagination-separator"};function p(a,i,n,s,c,t){const l=e.resolveComponent("dt-icon"),o=e.resolveComponent("dt-button");return e.openBlock(),e.createElementBlock("nav",{"aria-label":n.ariaLabel,class:"d-pagination"},[e.createVNode(o,{class:e.normalizeClass(["d-pagination__button",t.isFirstPage?"d-fc-black-300 d-bgc-transparent":"d-fc-tertiary"]),"data-qa":"dt-pagination-prev","aria-label":n.prevAriaLabel,kind:t.isFirstPage?"default":"muted",importance:t.isFirstPage?"primary":"clear",disabled:t.isFirstPage,onClick:i[0]||(i[0]=r=>t.changePage(c.currentPage-1))},{icon:e.withCtx(()=>[e.createVNode(l,{name:"chevron-left",size:"300"})]),_:1},8,["aria-label","kind","importance","disabled","class"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(r,u)=>(e.openBlock(),e.createElementBlock("div",{key:`page-${r}-${u}`,class:e.normalizeClass({"d-pagination__separator":isNaN(Number(r))})},[isNaN(Number(r))?(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(l,{name:"more-horizontal",size:"300"})])):(e.openBlock(),e.createBlock(o,{key:1,"aria-label":n.pageNumberAriaLabel(r),kind:c.currentPage===r?"default":"muted",importance:c.currentPage===r?"primary":"clear","label-class":"",onClick:k=>t.changePage(r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r),1)]),_:2},1032,["aria-label","kind","importance","onClick"]))],2))),128)),e.createVNode(o,{class:e.normalizeClass(["d-pagination__button",t.isLastPage?"d-fc-black-300 d-bgc-transparent":"d-fc-tertiary"]),"data-qa":"dt-pagination-next","aria-label":n.nextAriaLabel,disabled:t.isLastPage,kind:"muted",importance:t.isLastPage?"primary":"clear",onClick:i[1]||(i[1]=r=>t.changePage(c.currentPage+1))},{icon:e.withCtx(()=>[e.createVNode(l,{name:"chevron-right",size:"300"})]),_:1},8,["aria-label","disabled","importance","class"])],8,h)}const _=g._(m,[["render",p]]);exports.DtPagination=_;
|
|
2
|
+
//# sourceMappingURL=pagination.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.cjs","sources":["../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n :kind=\"isFirstPage ? 'default' : 'muted'\"\n :importance=\"isFirstPage ? 'primary' : 'clear'\"\n :disabled=\"isFirstPage\"\n :class=\"isFirstPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-left\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon\n name=\"more-horizontal\"\n size=\"300\"\n />\n <!-- … -->\n </div>\n <!-- eslint-enable vue/no-bare-strings-in-template -->\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n :importance=\"isLastPage ? 'primary' : 'clear'\"\n :class=\"isLastPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-right\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIcon,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * Descriptive label for the previous button.\n */\n prevAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Descriptive label for the next button.\n */\n nextAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * A method that will be called to get the aria label of each page.\n */\n pageNumberAriaLabel: {\n type: Function,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n const start = this.maxVisible - 1;\n const end = this.totalPages - start + 1;\n\n if (this.currentPage < start) {\n return [...this.range(1, start), '...', this.totalPages];\n }\n\n if (this.currentPage > end) {\n return [1, '...', ...this.range(end, this.totalPages)];\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n const left = this.currentPage - centerIndex;\n const right = this.currentPage + centerIndex;\n return [1, '...', ...this.range(left, right), '...', this.totalPages];\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIcon","start","end","total","centerIndex","left","right","from","to","range","i","page","_createElementBlock","$props","_createVNode","_component_dt_button","_normalizeClass","$options","_cache","$event","$data","_component_dt_icon","_openBlock","_Fragment","_renderList","index","_hoisted_2","_createBlock"],"mappings":"8bA+EA,MAAKA,EAAU,CACb,KAAM,eAEN,WAAY,CACV,SAAAC,EAAQ,SACR,OAAAC,EAAM,MACP,EAED,MAAO,CAIL,UAAW,CACT,KAAM,OACN,SAAU,EACX,EAKD,WAAY,CACV,KAAM,OACN,SAAU,EACX,EAKD,cAAe,CACb,KAAM,OACN,SAAU,EACX,EAKD,cAAe,CACb,KAAM,OACN,SAAU,EACX,EAKD,oBAAqB,CACnB,KAAM,SACN,SAAU,EACX,EAKD,WAAY,CACV,KAAM,OACN,QAAS,CACV,EAOD,WAAY,CACV,KAAM,OACN,QAAS,CACV,CACF,EAED,MAAO,CAOL,QACD,EAED,MAAQ,CACN,MAAO,CACL,YAAa,KAAK,WAErB,EAED,SAAU,CACR,aAAe,CACb,OAAO,KAAK,cAAgB,CAC7B,EAED,YAAc,CACZ,OAAO,KAAK,cAAgB,KAAK,UAClC,EAED,OAAS,CACP,GAAI,KAAK,aAAe,EACtB,MAAO,GAET,GAAI,KAAK,YAAc,KAAK,WAC1B,OAAO,KAAK,MAAM,EAAG,KAAK,UAAU,EAGtC,MAAMC,EAAQ,KAAK,WAAa,EAC1BC,EAAM,KAAK,WAAaD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BMW,WA3BoB,KAAAC,EAAA,WAAAP,EAAA,MAAhB,CAAAN,EAAMc,mBADhBb,EA4BM,mBAAA,MAAA,CA1BH,IAAG,QAAUD,CAAI,IAAIc,CAAK,GAC1B,MAAoCT,EAAA,eAAA,CAAA,0BAAA,MAAM,OAAOL,CAAI,CAAA,EAAA,IAI9C,MAAM,OAAOA,CAAI,CAAA,GADzBW,EAAAA,YAAAV,EAAAA,mBAUM,MAVNc,EAUM,CALJZ,EAAAA,YAGEO,EAAA,CAFA,KAAK,kBACL,KAAK,0BAKTM,EASY,YAAAZ,EAAA,OAPT,aAAYF,EAAmB,oBAACF,CAAI,EACpC,KAAMS,EAAW,cAAKT,EAAI,UAAA,QAC1B,WAAYS,EAAW,cAAKT,EAAI,UAAA,QACjC,cAAY,GACX,QAAKQ,GAAEF,EAAU,WAACN,CAAI,sBAEvB,IAAU,qCAAPA,CAAI,EAAA,CAAA,yEAGXG,EAAAA,YAgBYC,EAAA,CAfV,MAAKC,EAAA,eAAA,CAAC,uBAMEC,EAAU,WAAA,mCAAA,eAAA,CAAA,EALlB,UAAQ,qBACP,aAAYJ,EAAa,cACzB,SAAUI,EAAU,WACrB,KAAK,QACJ,WAAYA,EAAU,WAAA,UAAA,QAEtB,QAAKC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,GAAEF,EAAU,WAACG,EAAW,YAAA,CAAA,KAEnB,eACT,IAGE,CAHFN,EAAAA,YAGEO,EAAA,CAFA,KAAK,gBACL,KAAK"}
|
package/dist/lib/pagination.js
CHANGED
|
@@ -8,7 +8,6 @@ import "../chunks/link_constants-vIUB92L4.js";
|
|
|
8
8
|
import "@dialpad/dialtone-icons/vue3";
|
|
9
9
|
import "../chunks/icon_constants-OpYAAKwF.js";
|
|
10
10
|
import "@dialpad/dialtone-icons/icons.json";
|
|
11
|
-
import "./skeleton.js";
|
|
12
11
|
const L = {
|
|
13
12
|
name: "DtPagination",
|
|
14
13
|
components: {
|
|
@@ -185,8 +184,8 @@ function V(t, r, i, n, s, e) {
|
|
|
185
184
|
}, 8, ["aria-label", "disabled", "importance", "class"])
|
|
186
185
|
], 8, N);
|
|
187
186
|
}
|
|
188
|
-
const
|
|
187
|
+
const T = /* @__PURE__ */ y(L, [["render", V]]);
|
|
189
188
|
export {
|
|
190
|
-
|
|
189
|
+
T as DtPagination
|
|
191
190
|
};
|
|
192
191
|
//# sourceMappingURL=pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n :kind=\"isFirstPage ? 'default' : 'muted'\"\n :importance=\"isFirstPage ? 'primary' : 'clear'\"\n :disabled=\"isFirstPage\"\n :class=\"isFirstPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-left\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon\n name=\"more-horizontal\"\n size=\"300\"\n />\n <!-- … -->\n </div>\n <!-- eslint-enable vue/no-bare-strings-in-template -->\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n :importance=\"isLastPage ? 'primary' : 'clear'\"\n :class=\"isLastPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-right\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIcon,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * Descriptive label for the previous button.\n */\n prevAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Descriptive label for the next button.\n */\n nextAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * A method that will be called to get the aria label of each page.\n */\n pageNumberAriaLabel: {\n type: Function,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n const start = this.maxVisible - 1;\n const end = this.totalPages - start + 1;\n\n if (this.currentPage < start) {\n return [...this.range(1, start), '...', this.totalPages];\n }\n\n if (this.currentPage > end) {\n return [1, '...', ...this.range(end, this.totalPages)];\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n const left = this.currentPage - centerIndex;\n const right = this.currentPage + centerIndex;\n return [1, '...', ...this.range(left, right), '...', this.totalPages];\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIcon","start","end","total","centerIndex","left","right","from","to","range","i","page","_createElementBlock","$props","_createVNode","_component_dt_button","_normalizeClass","$options","_cache","$event","$data","_component_dt_icon","_openBlock","_Fragment","_renderList","index","_hoisted_2","_createBlock"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n :kind=\"isFirstPage ? 'default' : 'muted'\"\n :importance=\"isFirstPage ? 'primary' : 'clear'\"\n :disabled=\"isFirstPage\"\n :class=\"isFirstPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-left\"\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon\n name=\"more-horizontal\"\n size=\"300\"\n />\n <!-- … -->\n </div>\n <!-- eslint-enable vue/no-bare-strings-in-template -->\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n :importance=\"isLastPage ? 'primary' : 'clear'\"\n :class=\"isLastPage ? 'd-fc-black-300 d-bgc-transparent' : 'd-fc-tertiary'\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon\n name=\"chevron-right\"\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIcon } from '@/components/icon';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIcon,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * Descriptive label for the previous button.\n */\n prevAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Descriptive label for the next button.\n */\n nextAriaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * A method that will be called to get the aria label of each page.\n */\n pageNumberAriaLabel: {\n type: Function,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n const start = this.maxVisible - 1;\n const end = this.totalPages - start + 1;\n\n if (this.currentPage < start) {\n return [...this.range(1, start), '...', this.totalPages];\n }\n\n if (this.currentPage > end) {\n return [1, '...', ...this.range(end, this.totalPages)];\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n const left = this.currentPage - centerIndex;\n const right = this.currentPage + centerIndex;\n return [1, '...', ...this.range(left, right), '...', this.totalPages];\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIcon","start","end","total","centerIndex","left","right","from","to","range","i","page","_createElementBlock","$props","_createVNode","_component_dt_button","_normalizeClass","$options","_cache","$event","$data","_component_dt_icon","_openBlock","_Fragment","_renderList","index","_hoisted_2","_createBlock"],"mappings":";;;;;;;;;;AA+EA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,UAAAC;AAAA,IACA,QAAAC;AAAA,EACD;AAAA,EAED,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,UA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AC1B,OAAoCT,EAAA,EAAA,2BAAA,MAAM,OAAOL,CAAI,CAAA,GAAA;AAAA;MAI9C,MAAM,OAAOA,CAAI,CAAA,KADzBW,KAAAV,EAUM,OAVNc,GAUM;AAAA,QALJZ,EAGEO,GAAA;AAAA,UAFA,MAAK;AAAA,UACL,MAAK;AAAA;kBAKTM,EASYZ,GAAA;AAAA;QAPT,cAAYF,EAAmB,oBAACF,CAAI;AAAA,QACpC,MAAMS,EAAW,gBAAKT,IAAI,YAAA;AAAA,QAC1B,YAAYS,EAAW,gBAAKT,IAAI,YAAA;AAAA,QACjC,eAAY;AAAA,QACX,SAAK,CAAAQ,MAAEF,EAAU,WAACN,CAAI;AAAA;mBAEvB,MAAU;AAAA,cAAPA,CAAI,GAAA,CAAA;AAAA;;;;IAGXG,EAgBYC,GAAA;AAAA,MAfV,OAAKC,EAAA,CAAC,wBAMEC,EAAU,aAAA,qCAAA,eAAA,CAAA;AAAA,MALlB,WAAQ;AAAA,MACP,cAAYJ,EAAa;AAAA,MACzB,UAAUI,EAAU;AAAA,MACrB,MAAK;AAAA,MACJ,YAAYA,EAAU,aAAA,YAAA;AAAA,MAEtB,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEF,EAAU,WAACG,EAAW,cAAA,CAAA;AAAA;MAEnB,QACT,MAGE;AAAA,QAHFN,EAGEO,GAAA;AAAA,UAFA,MAAK;AAAA,UACL,MAAK;AAAA;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../chunks/popover_constants-hOEhklvr.js"),d=require("./utils.cjs"),m=require("../chunks/modal-qEzlo0Sj.js"),o=require("vue"),f=require("../chunks/_plugin-vue_export-helper-6_y-gaV6.js"),v=require("./button.cjs"),y=require("./icon.cjs"),u=require("../chunks/sr_only_close_button-iD7s1Pbj.js"),C=require("./lazy-show.cjs");require("tippy.js");require("./constants.cjs");require("../chunks/link_constants-Kn6kP4i1.js");require("@dialpad/dialtone-icons/vue3");require("../chunks/icon_constants-2S_OSQ1t.js");require("@dialpad/dialtone-icons/icons.json");const E={name:"PopoverHeaderFooter",components:{DtButton:v.DtButton,DtIcon:y.DtIcon},props:{type:{type:String,validator:function(e){return["header","footer"].includes(e)}},contentClass:{type:[String,Array,Object],default:""},showCloseButton:{type:Boolean,default:!1},closeButtonProps:{type:Object,default:()=>{}}},emits:["close"],data(){return{hasSlotContent:d.hasSlotContent}},methods:{focusCloseButton(){var t;const e=(t=this.$refs["popover__close-button"])==null?void 0:t.$el;e==null||e.focus()}}};function O(e,t,n,a,l,i){const c=o.resolveComponent("dt-icon"),h=o.resolveComponent("dt-button");return o.openBlock(),o.createElementBlock("div",{"data-qa":"dt-popover-header-footer",class:o.normalizeClass({"d-popover__header":n.type==="header","d-popover__footer":n.type==="footer"})},[l.hasSlotContent(e.$slots.content)?(o.openBlock(),o.createElementBlock("div",{key:0,"data-qa":"dt-popover-header-footer-content",class:o.normalizeClass([{"d-popover__header__content":n.type==="header","d-popover__footer__content":n.type==="footer"},n.contentClass])},[o.renderSlot(e.$slots,"content")],2)):o.createCommentVNode("",!0),n.showCloseButton?(o.openBlock(),o.createBlock(h,o.mergeProps({key:1,ref:"popover__close-button","data-qa":"dt-popover-close",class:{"d-popover__header__close-button":n.type==="header","d-popover__footer__close-button":n.type==="footer"},importance:"outlined",kind:"muted",circle:""},n.closeButtonProps,{onClick:t[0]||(t[0]=p=>e.$emit("close"))}),{icon:o.withCtx(()=>[o.createVNode(c,{name:"close",size:"300"})]),_:1},16,["class"])):o.createCommentVNode("",!0)],2)}const _=f._(E,[["render",O]]),b={name:"DtPopover",components:{SrOnlyCloseButton:u.S,DtLazyShow:C.DtLazyShow,PopoverHeaderFooter:_},mixins:[m.M,u.a],props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},elementType:{type:String,default:"div"},transition:{type:String,default:"fade"},role:{type:String,default:"dialog",validator:e=>s.b.includes(e)},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},closeButtonProps:{type:Object,default:()=>({})},padding:{type:String,default:"large",validator:e=>Object.keys(s.P).some(t=>t===e)},contentClass:{type:[String,Array,Object],default:""},contentWidth:{type:String,default:"",validator:e=>s.c.includes(e)},contentAppear:{type:Boolean,default:null},contentTabindex:{type:Number||null,default:-1},externalAnchor:{type:String,default:""},id:{type:String,default(){return d.getUniqueString()}},offset:{type:Array,default:()=>[0,4]},hideOnClick:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},fallbackPlacements:{type:Array,default:()=>["auto"]},placement:{type:String,default:"bottom-end"},tether:{type:Boolean,default:!0},sticky:{type:[Boolean,String],default:!1,validator:e=>s.f.includes(e)},maxHeight:{type:String,default:""},maxWidth:{type:String,default:""},showCloseButton:{type:Boolean,default:!1},headerClass:{type:[String,Array,Object],default:""},footerClass:{type:[String,Array,Object],default:""},dialogClass:{type:[String,Array,Object],default:""},initialFocusElement:{type:[String,HTMLElement],default:"first",validator:e=>s.d.includes(e)||e instanceof HTMLElement||e.startsWith("#")},openWithArrowKeys:{type:Boolean,default:!1},appendTo:{type:[HTMLElement,String],default:"body",validator:e=>s.e.includes(e)||e instanceof HTMLElement},hovercard:{type:Boolean,default:!1},timer:{type:[Object,null],default:null,validator:e=>e===null||e.enter&&e.leave&&Object.keys(e).includes("current")}},emits:["keydown","update:open","opened"],data(){return{POPOVER_PADDING_CLASSES:s.P,POPOVER_HEADER_FOOTER_PADDING_CLASSES:s.a,intersectionObserver:null,isOutsideViewport:!1,isOpen:!1,toAppear:!1,anchorEl:null,popoverContentEl:null,hasSlotContent:d.hasSlotContent,inTimer:null,outTimer:null}},computed:{popoverListeners(){return{keydown:e=>{this.onKeydown(e)},"after-leave":e=>{this.onLeaveTransitionComplete()},"after-enter":e=>{this.onEnterTransitionComplete()}}},calculatedMaxHeight(){return this.isOutsideViewport&&this.modal?"calc(100vh - var(--dt-space-300))":this.maxHeight},labelledBy(){return this.ariaLabelledby||!this.ariaLabel&&d.getUniqueString("DtPopover__anchor")},currentHovercard(){var e;return(e=this.timer)==null?void 0:e.current}},watch:{$props:{immediate:!0,deep:!0,handler(){this.validateProps()}},modal(e){var t;(t=this.tip)==null||t.setProps({zIndex:e?650:this.calculateAnchorZindex()})},offset(e){var t;(t=this.tip)==null||t.setProps({offset:e})},sticky(e){var t;(t=this.tip)==null||t.setProps({sticky:e})},fallbackPlacements(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},tether(){var e;(e=this.tip)==null||e.setProps({popperOptions:this.popperOptions()})},placement(e){var t;(t=this.tip)==null||t.setProps({placement:e})},open:{handler:function(e){e!==null&&(this.isOpen=e),e===!0&&(this.toAppear=!0)},immediate:!0},contentAppear:{handler:function(e){e!==null&&(this.toAppear=e)}},isOpen(e,t){e?(this.initTippyInstance(),this.tip.show()):!e&&t!==e&&(this.removeEventListeners(),this.tip.hide())},currentHovercard(){this.hovercard&&this.timer&&(this.currentHovercard===this.id?this.isOpen=!0:this.isOpen=!1)}},mounted(){var t;const e=this.externalAnchor?this.$refs.anchor.getRootNode().querySelector(`#${this.externalAnchor}`):null;this.anchorEl=e??this.$refs.anchor.children[0],this.popoverContentEl=(t=this.$refs.content)==null?void 0:t.$el,this.isOpen&&(this.initTippyInstance(),this.tip.show()),this.intersectionObserver=new IntersectionObserver(this.hasIntersectedViewport),this.intersectionObserver.observe(this.popoverContentEl)},beforeUnmount(){var e;(e=this.tip)==null||e.destroy(),this.intersectionObserver.disconnect(),this.removeReferences(),this.removeEventListeners()},methods:{hasIntersectedViewport(e){var a;const t=(a=e==null?void 0:e[0])==null?void 0:a.target;if(!t)return;const n=d.isOutOfViewPort(t);this.isOutsideViewport=n.bottom||n.top},popperOptions(){return s.l({fallbackPlacements:this.fallbackPlacements,tether:this.tether,hasHideModifierEnabled:!0})},validateProps(){this.modal&&this.initialFocusElement==="none"&&console.error('If the popover is modal you must set the initialFocusElement prop. Possible values: "dialog", "first", HTMLElement')},calculateAnchorZindex(){var e;return this.$el.getRootNode().querySelector('.d-modal[aria-hidden="false"], .d-modal--transparent[aria-hidden="false"]')||(e=this.anchorEl)!=null&&e.closest(".d-zi-drawer")?650:300},defaultToggleOpen(e){var t,n,a;if(!this.hovercard&&!this.openOnContext&&(this.open===null||this.open===void 0)){if(!((t=this.anchorEl)!=null&&t.contains(e.target))&&!((n=this.anchorEl)!=null&&n.isEqualNode(e.target))||(a=this.anchorEl)!=null&&a.disabled)return;this.toggleOpen()}},async onContext(e){this.openOnContext&&(e.preventDefault(),this.isOpen=!0,await this.$nextTick(),this.tip.setProps({placement:"right-start",getReferenceClientRect:()=>({width:0,height:0,top:e.clientY,bottom:e.clientY,left:e.clientX,right:e.clientX})}))},toggleOpen(){this.isOpen=!this.isOpen},onArrowKeyPress(e){var t;this.open===null&&(this.openWithArrowKeys&&((t=this.anchorEl)!=null&&t.contains(e.target))&&(this.isOpen||(this.isOpen=!0)),this.$emit("keydown",e))},addEventListeners(){window.addEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.addEventListener("resize",this.onResize)},removeEventListeners(){window.removeEventListener("dt-popover-close",this.closePopover),this.contentWidth==="anchor"&&window.removeEventListener("resize",this.onResize)},closePopover(){this.isOpen=!1},preventScrolling(){var e,t;if(this.modal){const n=(e=this.anchorEl)==null?void 0:e.closest("body, .tippy-box");if(!n)return;((t=n.tagName)==null?void 0:t.toLowerCase())==="body"?(n.classList.add("d-of-hidden"),this.tip.setProps({offset:this.offset})):n.classList.add("d-zi-popover")}},enableScrolling(){var t,n;const e=(t=this.anchorEl)==null?void 0:t.closest("body, .tippy-box");e&&(((n=e.tagName)==null?void 0:n.toLowerCase())==="body"?(e.classList.remove("d-of-hidden"),this.tip.setProps({offset:this.offset})):e.classList.remove("d-zi-popover"))},removeReferences(){this.anchorEl=null,this.popoverContentEl=null,this.tip=null},async onShow(){this.contentWidth==="anchor"&&await this.setPopoverContentAnchorWidth(),this.contentWidth===null&&(this.popoverContentEl.style.width="auto"),this.addEventListeners()},async onLeaveTransitionComplete(){var e;this.modal&&(await this.focusFirstElement(this.$refs.anchor),await this.$nextTick(),this.enableScrolling()),(e=this.tip)==null||e.unmount(),this.$emit("opened",!1),this.open!==null&&this.$emit("update:open",!1)},async onEnterTransitionComplete(){this.focusInitialElement(),await this.$nextTick(),this.preventScrolling(),this.$emit("opened",!0,this.$refs.popover__content),this.open!==null&&this.$emit("update:open",!0)},focusInitialElement(){var e,t;this.initialFocusElement==="dialog"&&((t=(e=this.$refs.content)==null?void 0:e.$el)==null||t.focus()),this.initialFocusElement.startsWith("#")&&this.focusInitialElementById(),this.initialFocusElement==="first"&&this.focusFirstElementIfNeeded(this.$refs.popover__content),this.initialFocusElement instanceof HTMLElement&&this.initialFocusElement.focus()},focusInitialElementById(){var t,n,a;const e=(n=(t=this.$refs.content)==null?void 0:t.$el)==null?void 0:n.querySelector(this.initialFocusElement);e?e.focus():console.warn('Could not find the element specified in dt-popover prop "initialFocusElement". Defaulting to focusing the dialog.'),e?e.focus():(a=this.$refs.content)==null||a.$el.focus()},onResize(){this.closePopover()},onClickOutside(){if(!this.hideOnClick)return;this.popoverContentEl.querySelector(".d-popover__anchor--opened")||this.closePopover()},onKeydown(e){e.key==="Tab"&&this.modal&&this.focusTrappedTabPress(e,this.popoverContentEl),e.key==="Escape"&&this.closePopover(),this.$emit("keydown",e)},async setPopoverContentAnchorWidth(){var e;await this.$nextTick(),this.popoverContentEl.style.width=`${(e=this.anchorEl)==null?void 0:e.clientWidth}px`},focusFirstElementIfNeeded(e){var n,a;this._getFocusableElements(e,!0).length!==0?this.focusFirstElement(e):this.showCloseButton?(n=this.$refs.popover__header)==null||n.focusCloseButton():(a=this.$refs.content)==null||a.$el.focus()},initTippyInstance(){var e,t;this.tip=s.n(this.anchorEl,{popperOptions:this.popperOptions(),contentElement:this.popoverContentEl,placement:this.placement,offset:this.offset,sticky:this.sticky,appendTo:this.appendTo==="body"?(t=(e=this.anchorEl)==null?void 0:e.getRootNode())==null?void 0:t.querySelector("body"):this.appendTo,interactive:!0,trigger:"manual",hideOnClick:!1,zIndex:this.modal?650:this.calculateAnchorZindex(),onClickOutside:this.onClickOutside,onShow:this.onShow})},setInTimer(){this.inTimer=setTimeout(()=>{this.isOpen=!0},s.h)},setOutTimer(){this.outTimer=setTimeout(()=>{this.isOpen=!1},s.h)},onEnterAnchor(){this.hovercard&&(this.timer?this.timer.enter(this.id):(clearTimeout(this.outTimer),this.setInTimer()))},onLeaveAnchor(){this.hovercard&&(this.timer?this.timer.leave():(clearTimeout(this.inTimer),this.setOutTimer()))},onEnterContent(){this.hovercard&&(this.timer?this.timer.enter(this.id):clearTimeout(this.outTimer))},onLeaveContent(){this.hovercard&&(this.timer?this.timer.leave():this.setOutTimer())}}},P=["aria-hidden"],g=["id","data-qa","tabindex"],S=["data-qa"];function w(e,t,n,a,l,i){const c=o.resolveComponent("popover-header-footer"),h=o.resolveComponent("sr-only-close-button"),p=o.resolveComponent("dt-lazy-show");return o.openBlock(),o.createElementBlock("div",null,[n.modal&&l.isOpen?(o.openBlock(),o.createBlock(o.Teleport,{key:0,to:"body"},[o.createElementVNode("div",{class:"d-modal--transparent","aria-hidden":n.modal&&l.isOpen?"false":"true",onClick:t[0]||(t[0]=o.withModifiers(()=>{},["prevent","stop"]))},null,8,P)])):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(n.elementType),{ref:"popover",class:o.normalizeClass(["d-popover",{"d-popover__anchor--opened":l.isOpen}]),"data-qa":"dt-popover-container"},{default:o.withCtx(()=>[o.createElementVNode("div",{id:!n.ariaLabelledby&&i.labelledBy,ref:"anchor","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-anchor`:"dt-popover-anchor",tabindex:n.openOnContext?0:void 0,onClickCapture:t[1]||(t[1]=(...r)=>i.defaultToggleOpen&&i.defaultToggleOpen(...r)),onContextmenu:t[2]||(t[2]=(...r)=>i.onContext&&i.onContext(...r)),onKeydown:[t[3]||(t[3]=o.withKeys(o.withModifiers((...r)=>i.onArrowKeyPress&&i.onArrowKeyPress(...r),["prevent"]),["up"])),t[4]||(t[4]=o.withKeys(o.withModifiers((...r)=>i.onArrowKeyPress&&i.onArrowKeyPress(...r),["prevent"]),["down"])),t[6]||(t[6]=o.withKeys(r=>e.$emit("keydown",r),["enter"])),t[7]||(t[7]=o.withKeys(r=>e.$emit("keydown",r),["space"]))],onKeydownCapture:t[5]||(t[5]=o.withKeys((...r)=>i.closePopover&&i.closePopover(...r),["escape"])),onMouseenter:t[8]||(t[8]=(...r)=>i.onEnterAnchor&&i.onEnterAnchor(...r)),onMouseleave:t[9]||(t[9]=(...r)=>i.onLeaveAnchor&&i.onLeaveAnchor(...r))},[o.renderSlot(e.$slots,"anchor",{attrs:{"aria-expanded":l.isOpen.toString(),"aria-controls":n.id,"aria-haspopup":n.role}})],40,g),o.createVNode(p,o.mergeProps({id:n.id,ref:"content",role:n.role,"data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}__dialog`:"dt-popover","aria-hidden":`${!l.isOpen}`,"aria-labelledby":i.labelledBy,"aria-label":n.ariaLabel,"aria-modal":`${!n.modal}`,transition:n.transition,show:l.isOpen,appear:l.toAppear,class:["d-popover__dialog",{"d-popover__dialog--modal":n.modal},n.dialogClass],style:{"max-height":i.calculatedMaxHeight,"max-width":n.maxWidth},css:e.$attrs.css,tabindex:n.contentTabindex},o.toHandlers(i.popoverListeners),{onMouseenter:i.onEnterContent,onMouseleave:i.onLeaveContent}),{default:o.withCtx(()=>[l.hasSlotContent(e.$slots.headerContent)||n.showCloseButton?(o.openBlock(),o.createBlock(c,{key:0,ref:"popover__header",class:o.normalizeClass(l.POPOVER_HEADER_FOOTER_PADDING_CLASSES[n.padding]),"content-class":n.headerClass,type:"header","show-close-button":n.showCloseButton,"close-button-props":n.closeButtonProps,onClose:i.closePopover},{content:o.withCtx(()=>[o.renderSlot(e.$slots,"headerContent",{close:i.closePopover})]),_:3},8,["class","content-class","show-close-button","close-button-props","onClose"])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref:"popover__content","data-qa":e.$attrs["data-qa"]?`${e.$attrs["data-qa"]}-content`:"dt-popover-content",class:o.normalizeClass(["d-popover__content",l.POPOVER_PADDING_CLASSES[n.padding],n.contentClass])},[o.renderSlot(e.$slots,"content",{close:i.closePopover})],10,S),l.hasSlotContent(e.$slots.footerContent)?(o.openBlock(),o.createBlock(c,{key:1,ref:"popover__footer",type:"footer",class:o.normalizeClass(l.POPOVER_HEADER_FOOTER_PADDING_CLASSES[n.padding]),"content-class":n.footerClass},{content:o.withCtx(()=>[o.renderSlot(e.$slots,"footerContent",{close:i.closePopover})]),_:3},8,["class","content-class"])):o.createCommentVNode("",!0),e.showVisuallyHiddenClose?(o.openBlock(),o.createBlock(h,{key:2,"visually-hidden-close-label":e.visuallyHiddenCloseLabel,onClose:i.closePopover},null,8,["visually-hidden-close-label","onClose"])):o.createCommentVNode("",!0)]),_:3},16,["id","role","data-qa","aria-hidden","aria-labelledby","aria-label","aria-modal","transition","show","appear","class","style","css","tabindex","onMouseenter","onMouseleave"])]),_:3},8,["class"]))])}const T=f._(b,[["render",w]]);exports.POPOVER_APPEND_TO_VALUES=s.e;exports.POPOVER_CONTENT_WIDTHS=s.c;exports.POPOVER_DIRECTIONS=s.g;exports.POPOVER_HEADER_FOOTER_PADDING_CLASSES=s.a;exports.POPOVER_INITIAL_FOCUS_STRINGS=s.d;exports.POPOVER_PADDING_CLASSES=s.P;exports.POPOVER_ROLES=s.b;exports.POPOVER_STICKY_VALUES=s.f;exports.DtPopover=T;
|
|
2
|
+
//# sourceMappingURL=popover.cjs.map
|