@dialpad/dialtone-vue 2.193.4 → 2.194.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/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.cjs +1 -1
- package/dist/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.cjs.map +1 -1
- package/dist/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.js +7 -7
- package/dist/lib/callbar-button-with-dropdown/callbar-button-with-dropdown.js.map +1 -1
- package/dist/lib/callbar-button-with-popover/callbar-button-with-popover.cjs +1 -1
- package/dist/lib/callbar-button-with-popover/callbar-button-with-popover.cjs.map +1 -1
- package/dist/lib/callbar-button-with-popover/callbar-button-with-popover.js +5 -5
- package/dist/lib/callbar-button-with-popover/callbar-button-with-popover.js.map +1 -1
- package/dist/lib/datepicker/datepicker.cjs +1 -1
- package/dist/lib/datepicker/datepicker.cjs.map +1 -1
- package/dist/lib/datepicker/datepicker.js +10 -10
- package/dist/lib/datepicker/datepicker.js.map +1 -1
- package/dist/lib/dropdown/dropdown.cjs +1 -1
- package/dist/lib/dropdown/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown/dropdown.js +24 -26
- package/dist/lib/dropdown/dropdown.js.map +1 -1
- package/dist/lib/emoji-picker/emoji-picker.cjs.map +1 -1
- package/dist/lib/emoji-picker/emoji-picker.js +1 -0
- package/dist/lib/emoji-picker/emoji-picker.js.map +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.cjs +3 -3
- package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.js +65 -65
- package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/lib/toast/toast.cjs.map +1 -1
- package/dist/lib/toast/toast.js.map +1 -1
- package/dist/localization/de-DE.cjs +1 -13
- package/dist/localization/de-DE.cjs.map +1 -1
- package/dist/localization/de-DE.js +1 -13
- package/dist/localization/de-DE.js.map +1 -1
- package/dist/localization/es-LA.cjs +1 -13
- package/dist/localization/es-LA.cjs.map +1 -1
- package/dist/localization/es-LA.js +1 -13
- package/dist/localization/es-LA.js.map +1 -1
- package/dist/localization/fr-FR.cjs +1 -13
- package/dist/localization/fr-FR.cjs.map +1 -1
- package/dist/localization/fr-FR.js +1 -13
- package/dist/localization/fr-FR.js.map +1 -1
- package/dist/localization/it-IT.cjs +1 -13
- package/dist/localization/it-IT.cjs.map +1 -1
- package/dist/localization/it-IT.js +1 -13
- package/dist/localization/it-IT.js.map +1 -1
- package/dist/localization/ja-JP.cjs +1 -8
- package/dist/localization/ja-JP.cjs.map +1 -1
- package/dist/localization/ja-JP.js +1 -8
- package/dist/localization/ja-JP.js.map +1 -1
- package/dist/localization/nl-NL.cjs +1 -13
- package/dist/localization/nl-NL.cjs.map +1 -1
- package/dist/localization/nl-NL.js +1 -13
- package/dist/localization/nl-NL.js.map +1 -1
- package/dist/localization/pt-BR.cjs +1 -13
- package/dist/localization/pt-BR.cjs.map +1 -1
- package/dist/localization/pt-BR.js +1 -13
- package/dist/localization/pt-BR.js.map +1 -1
- package/dist/localization/ru-RU.cjs +1 -23
- package/dist/localization/ru-RU.cjs.map +1 -1
- package/dist/localization/ru-RU.js +1 -23
- package/dist/localization/ru-RU.js.map +1 -1
- package/dist/localization/zh-CN.cjs +1 -8
- package/dist/localization/zh-CN.cjs.map +1 -1
- package/dist/localization/zh-CN.js +1 -8
- package/dist/localization/zh-CN.js.map +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/package.json +4 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@dialpad/dialtone-icons/vue2"),n=require("../../common/utils/index.cjs"),a=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),i=require("../callbar-button/callbar-button.cjs"),s=require("../dropdown/dropdown.cjs"),d=require("../button/button.cjs"),u=require("../../common/mixins/localization.cjs"),c=require("../callbar-button/callbar-button-constants.cjs"),p={name:"DtRecipeCallbarButtonWithDropdown",components:{DtRecipeCallbarButton:i.default,DtDropdown:s.default,DtButton:d.default,DtIconChevronUp:l.DtIconChevronUp},mixins:[u.default],inheritAttrs:!1,props:{id:{type:String,default(){return n.default.getUniqueString()}},ariaLabel:{type:String,default:null,validator:e=>e||(void 0).$slots.default},placement:{type:String,default:"top"},fallbackPlacements:{type:Array,default:()=>["auto"]},disabled:{type:Boolean,default:!1},forceShowArrow:{type:Boolean,default:!1},active:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},buttonClass:{type:[String,Array,Object],default:""},textClass:{type:[String,Array,Object],default:""},buttonWidthSize:{type:String,default:"xl",validator:e=>c.CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(e)},invertedTooltip:{type:Boolean,default:!1},showTooltip:{type:Boolean,default:null},tooltipText:{type:String,default:void 0},tooltipDelay:{type:Boolean,default:void 0}},emits:["arrow-click","click","opened"],data(){return{open:!1}},computed:{showArrowButton(){return this.forceShowArrow||!this.disabled},isCompactMode(){return this.buttonWidthSize==="sm"||this.buttonWidthSize==="md"},arrowButtonLabel(){return this.i18n.$
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@dialpad/dialtone-icons/vue2"),n=require("../../common/utils/index.cjs"),a=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),i=require("../callbar-button/callbar-button.cjs"),s=require("../dropdown/dropdown.cjs"),d=require("../button/button.cjs"),u=require("../../common/mixins/localization.cjs"),c=require("../callbar-button/callbar-button-constants.cjs"),p={name:"DtRecipeCallbarButtonWithDropdown",components:{DtRecipeCallbarButton:i.default,DtDropdown:s.default,DtButton:d.default,DtIconChevronUp:l.DtIconChevronUp},mixins:[u.default],inheritAttrs:!1,props:{id:{type:String,default(){return n.default.getUniqueString()}},ariaLabel:{type:String,default:null,validator:e=>e||(void 0).$slots.default},placement:{type:String,default:"top"},fallbackPlacements:{type:Array,default:()=>["auto"]},disabled:{type:Boolean,default:!1},forceShowArrow:{type:Boolean,default:!1},active:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},buttonClass:{type:[String,Array,Object],default:""},textClass:{type:[String,Array,Object],default:""},buttonWidthSize:{type:String,default:"xl",validator:e=>c.CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(e)},invertedTooltip:{type:Boolean,default:!1},showTooltip:{type:Boolean,default:null},tooltipText:{type:String,default:void 0},tooltipDelay:{type:Boolean,default:void 0}},emits:["arrow-click","click","opened"],data(){return{open:!1}},computed:{showArrowButton(){return this.forceShowArrow||!this.disabled},isCompactMode(){return this.buttonWidthSize==="sm"||this.buttonWidthSize==="md"},arrowButtonLabel(){return this.i18n.$t("DIALTONE_CALLBAR_BUTTON_WITH_DROPDOWN_ARROW_BUTTON_ARIA_LABEL")}},mounted(){n.warnIfUnmounted(this.$el,this.$options.name)},methods:{arrowClick(e){return this.$emit("arrow-click",e),this.toggleOpen()},toggleOpen(){return this.open=!this.open},syncOpenState(){this.open=this.openDropdown},buttonClick(e){this.$listeners.click?this.$emit("click",e):this.arrowClick(e)},onModalIsOpened(e){this.open=e,this.$emit("opened",e)}}};var b=function(){var t=this,o=t._self._c;return o("div",{staticClass:"dt-recipe--callbar-button-with-dropdown"},[o("dt-recipe-callbar-button",{staticClass:"dt-recipe--callbar-button-with-dropdown--main-button",attrs:{active:t.active,"aria-label":t.ariaLabel,"button-class":t.buttonClass,"button-width-size":t.buttonWidthSize,danger:t.danger,disabled:t.disabled,"inverted-tooltip":t.invertedTooltip,"show-tooltip":t.showTooltip,"text-class":t.textClass,"tooltip-delay":t.tooltipDelay,"tooltip-text":t.tooltipText},on:{click:t.buttonClick},scopedSlots:t._u([{key:"icon",fn:function(){return[t._t("icon")]},proxy:!0},{key:"tooltip",fn:function(){return[t._t("tooltip")]},proxy:!0}],null,!0)},[t._t("default")],2),t.showArrowButton?o("dt-dropdown",t._b({staticClass:"dt-recipe--callbar-button-with-dropdown--dropdown-wrapper",attrs:{id:t.id,modal:!1,"fallback-placements":t.fallbackPlacements,open:t.open,placement:t.placement,padding:"none"},on:{opened:t.onModalIsOpened},scopedSlots:t._u([{key:"anchor",fn:function(){return[o("dt-button",{class:["dt-recipe--callbar-button-with-dropdown--arrow",{"dt-recipe--callbar-button-with-dropdown--arrow--large":!t.isCompactMode}],attrs:{active:t.open,circle:!0,importance:"clear",size:"lg","aria-label":t.arrowButtonLabel,title:t.arrowButtonLabel,width:"2rem"},on:{click:t.arrowClick},scopedSlots:t._u([{key:"icon",fn:function(){return[o("dt-icon-chevron-up",{staticClass:"dt-recipe--callbar-button-with-dropdown--arrow__icon",attrs:{size:"200"}})]},proxy:!0}],null,!1,887776886)})]},proxy:!0},{key:"list",fn:function({close:r}){return[t._t("list",null,{close:r})]}}],null,!0)},"dt-dropdown",t.$attrs,!1)):t._e()],1)},f=[],_=a.n(p,b,f);const w=_.exports;exports.default=w;
|
|
2
2
|
//# sourceMappingURL=callbar-button-with-dropdown.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbar-button-with-dropdown.cjs","sources":["../../../recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue"],"sourcesContent":["<template>\n <div\n class=\"dt-recipe--callbar-button-with-dropdown\"\n >\n <dt-recipe-callbar-button\n :active=\"active\"\n :aria-label=\"ariaLabel\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :danger=\"danger\"\n :disabled=\"disabled\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :text-class=\"textClass\"\n :tooltip-delay=\"tooltipDelay\"\n :tooltip-text=\"tooltipText\"\n class=\"dt-recipe--callbar-button-with-dropdown--main-button\"\n @click=\"buttonClick\"\n >\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n <slot />\n </dt-recipe-callbar-button>\n <dt-dropdown\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :fallback-placements=\"fallbackPlacements\"\n :open=\"open\"\n :placement=\"placement\"\n class=\"dt-recipe--callbar-button-with-dropdown--dropdown-wrapper\"\n padding=\"none\"\n v-bind=\"$attrs\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['dt-recipe--callbar-button-with-dropdown--arrow',\n { 'dt-recipe--callbar-button-with-dropdown--arrow--large': !isCompactMode }]\"\n circle\n importance=\"clear\"\n size=\"lg\"\n
|
|
1
|
+
{"version":3,"file":"callbar-button-with-dropdown.cjs","sources":["../../../recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue"],"sourcesContent":["<template>\n <div\n class=\"dt-recipe--callbar-button-with-dropdown\"\n >\n <dt-recipe-callbar-button\n :active=\"active\"\n :aria-label=\"ariaLabel\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :danger=\"danger\"\n :disabled=\"disabled\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :text-class=\"textClass\"\n :tooltip-delay=\"tooltipDelay\"\n :tooltip-text=\"tooltipText\"\n class=\"dt-recipe--callbar-button-with-dropdown--main-button\"\n @click=\"buttonClick\"\n >\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n <slot />\n </dt-recipe-callbar-button>\n <dt-dropdown\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :fallback-placements=\"fallbackPlacements\"\n :open=\"open\"\n :placement=\"placement\"\n class=\"dt-recipe--callbar-button-with-dropdown--dropdown-wrapper\"\n padding=\"none\"\n v-bind=\"$attrs\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['dt-recipe--callbar-button-with-dropdown--arrow',\n { 'dt-recipe--callbar-button-with-dropdown--arrow--large': !isCompactMode }]\"\n :circle=\"true\"\n importance=\"clear\"\n size=\"lg\"\n :aria-label=\"arrowButtonLabel\"\n :title=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"dt-recipe--callbar-button-with-dropdown--arrow__icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <template #list=\"{ close }\">\n <slot\n :close=\"close\"\n name=\"list\"\n />\n </template>\n </dt-dropdown>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtDropdown } from '@/components/dropdown';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithDropdown',\n\n components: { DtRecipeCallbarButton, DtDropdown, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal dropdown is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n arrowButtonLabel () {\n return this.i18n.$t('DIALTONE_CALLBAR_BUTTON_WITH_DROPDOWN_ARROW_BUTTON_ARIA_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openDropdown;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the dropdown\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtDropdown","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":"seA8EAA,EAAA,CACA,KAAA,oCAEA,WA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A,EAEA,QAAA,CACA,WAAAC,EAAA,CACA,YAAA,MAAA,cAAAA,CAAA,EACA,KAAA,YACA,EAEA,YAAA,CACA,OAAA,KAAA,KAAA,CAAA,KAAA,IACA,EAEA,eAAA,CACA,KAAA,KAAA,KAAA,YACA,EAEA,YAAAA,EAAA,CAGA,KAAA,WAAA,MAGA,KAAA,MAAA,QAAAA,CAAA,EAFA,KAAA,WAAAA,CAAA,CAIA,EAEA,gBAAAC,EAAA,CACA,KAAA,KAAAA,EACA,KAAA,MAAA,SAAAA,CAAA,CACA,CACA,CAEA"}
|
|
@@ -182,7 +182,7 @@ const f = {
|
|
|
182
182
|
return this.buttonWidthSize === "sm" || this.buttonWidthSize === "md";
|
|
183
183
|
},
|
|
184
184
|
arrowButtonLabel() {
|
|
185
|
-
return this.i18n.$
|
|
185
|
+
return this.i18n.$t("DIALTONE_CALLBAR_BUTTON_WITH_DROPDOWN_ARROW_BUTTON_ARIA_LABEL");
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
188
|
mounted() {
|
|
@@ -213,22 +213,22 @@ var b = function() {
|
|
|
213
213
|
}, proxy: !0 }, { key: "tooltip", fn: function() {
|
|
214
214
|
return [t._t("tooltip")];
|
|
215
215
|
}, proxy: !0 }], null, !0) }, [t._t("default")], 2), t.showArrowButton ? o("dt-dropdown", t._b({ staticClass: "dt-recipe--callbar-button-with-dropdown--dropdown-wrapper", attrs: { id: t.id, modal: !1, "fallback-placements": t.fallbackPlacements, open: t.open, placement: t.placement, padding: "none" }, on: { opened: t.onModalIsOpened }, scopedSlots: t._u([{ key: "anchor", fn: function() {
|
|
216
|
-
return [o("dt-button",
|
|
216
|
+
return [o("dt-button", { class: [
|
|
217
217
|
"dt-recipe--callbar-button-with-dropdown--arrow",
|
|
218
218
|
{ "dt-recipe--callbar-button-with-dropdown--arrow--large": !t.isCompactMode }
|
|
219
|
-
], attrs: { active: t.open, circle:
|
|
219
|
+
], attrs: { active: t.open, circle: !0, importance: "clear", size: "lg", "aria-label": t.arrowButtonLabel, title: t.arrowButtonLabel, width: "2rem" }, on: { click: t.arrowClick }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
220
220
|
return [o("dt-icon-chevron-up", { staticClass: "dt-recipe--callbar-button-with-dropdown--arrow__icon", attrs: { size: "200" } })];
|
|
221
|
-
}, proxy: !0 }], null, !1, 887776886) }
|
|
221
|
+
}, proxy: !0 }], null, !1, 887776886) })];
|
|
222
222
|
}, proxy: !0 }, { key: "list", fn: function({ close: n }) {
|
|
223
223
|
return [t._t("list", null, { close: n })];
|
|
224
224
|
} }], null, !0) }, "dt-dropdown", t.$attrs, !1)) : t._e()], 1);
|
|
225
|
-
}, m = [],
|
|
225
|
+
}, m = [], w = /* @__PURE__ */ l(
|
|
226
226
|
f,
|
|
227
227
|
b,
|
|
228
228
|
m
|
|
229
229
|
);
|
|
230
|
-
const
|
|
230
|
+
const A = w.exports;
|
|
231
231
|
export {
|
|
232
|
-
|
|
232
|
+
A as default
|
|
233
233
|
};
|
|
234
234
|
//# sourceMappingURL=callbar-button-with-dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbar-button-with-dropdown.js","sources":["../../../recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue"],"sourcesContent":["<template>\n <div\n class=\"dt-recipe--callbar-button-with-dropdown\"\n >\n <dt-recipe-callbar-button\n :active=\"active\"\n :aria-label=\"ariaLabel\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :danger=\"danger\"\n :disabled=\"disabled\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :text-class=\"textClass\"\n :tooltip-delay=\"tooltipDelay\"\n :tooltip-text=\"tooltipText\"\n class=\"dt-recipe--callbar-button-with-dropdown--main-button\"\n @click=\"buttonClick\"\n >\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n <slot />\n </dt-recipe-callbar-button>\n <dt-dropdown\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :fallback-placements=\"fallbackPlacements\"\n :open=\"open\"\n :placement=\"placement\"\n class=\"dt-recipe--callbar-button-with-dropdown--dropdown-wrapper\"\n padding=\"none\"\n v-bind=\"$attrs\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['dt-recipe--callbar-button-with-dropdown--arrow',\n { 'dt-recipe--callbar-button-with-dropdown--arrow--large': !isCompactMode }]\"\n circle\n importance=\"clear\"\n size=\"lg\"\n v-bind=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"dt-recipe--callbar-button-with-dropdown--arrow__icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <template #list=\"{ close }\">\n <slot\n :close=\"close\"\n name=\"list\"\n />\n </template>\n </dt-dropdown>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtDropdown } from '@/components/dropdown';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithDropdown',\n\n components: { DtRecipeCallbarButton, DtDropdown, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal dropdown is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n arrowButtonLabel () {\n return this.i18n.$ta('DIALTONE_CALLBAR_BUTTON_WITH_DROPDOWN_ARROW_BUTTON_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openDropdown;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the dropdown\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtDropdown","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":";;;;;;;;AA6EA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA,EAAA,uBAAAC,GAAA,YAAAC,GAAA,UAAAC,GAAA,iBAAAC,EAAA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,IAFA,KAAA,WAAAA,CAAA;AAAA,IAIA;AAAA,IAEA,gBAAAC,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,UAAAA,CAAA;AAAA,IACA;AAAA,EACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"callbar-button-with-dropdown.js","sources":["../../../recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue"],"sourcesContent":["<template>\n <div\n class=\"dt-recipe--callbar-button-with-dropdown\"\n >\n <dt-recipe-callbar-button\n :active=\"active\"\n :aria-label=\"ariaLabel\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :danger=\"danger\"\n :disabled=\"disabled\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :text-class=\"textClass\"\n :tooltip-delay=\"tooltipDelay\"\n :tooltip-text=\"tooltipText\"\n class=\"dt-recipe--callbar-button-with-dropdown--main-button\"\n @click=\"buttonClick\"\n >\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n <slot />\n </dt-recipe-callbar-button>\n <dt-dropdown\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :fallback-placements=\"fallbackPlacements\"\n :open=\"open\"\n :placement=\"placement\"\n class=\"dt-recipe--callbar-button-with-dropdown--dropdown-wrapper\"\n padding=\"none\"\n v-bind=\"$attrs\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['dt-recipe--callbar-button-with-dropdown--arrow',\n { 'dt-recipe--callbar-button-with-dropdown--arrow--large': !isCompactMode }]\"\n :circle=\"true\"\n importance=\"clear\"\n size=\"lg\"\n :aria-label=\"arrowButtonLabel\"\n :title=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"dt-recipe--callbar-button-with-dropdown--arrow__icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <template #list=\"{ close }\">\n <slot\n :close=\"close\"\n name=\"list\"\n />\n </template>\n </dt-dropdown>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtDropdown } from '@/components/dropdown';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithDropdown',\n\n components: { DtRecipeCallbarButton, DtDropdown, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal dropdown is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n arrowButtonLabel () {\n return this.i18n.$t('DIALTONE_CALLBAR_BUTTON_WITH_DROPDOWN_ARROW_BUTTON_ARIA_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openDropdown;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the dropdown\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtDropdown","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":";;;;;;;;AA8EA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA,EAAA,uBAAAC,GAAA,YAAAC,GAAA,UAAAC,GAAA,iBAAAC,EAAA;AAAA,EAEA,QAAA,CAAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AACA,eAAAC,EAAA;MACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAAC,MACAA,KAAAC,SAAA,OAAA;AAAA,IAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA;AAAA;AAAA;AAAA;AAAA,IAKA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,MAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AAAA,IACA,kBAAA;AACA,aAAA,KAAA,kBAAA,CAAA,KAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,aAAA,KAAA,oBAAA,QAAA,KAAA,oBAAA;AAAA,IACA;AAAA,IAEA,mBAAA;AACA,aAAA,KAAA,KAAA,GAAA,+DAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AACA,IAAAE,EAAA,KAAA,KAAA,KAAA,SAAA,IAAA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,WAAAC,GAAA;AACA,kBAAA,MAAA,eAAAA,CAAA,GACA,KAAA;IACA;AAAA,IAEA,aAAA;AACA,aAAA,KAAA,OAAA,CAAA,KAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,WAAA,OAAA,KAAA;AAAA,IACA;AAAA,IAEA,YAAAA,GAAA;AAGA,MAAA,KAAA,WAAA,QAGA,KAAA,MAAA,SAAAA,CAAA,IAFA,KAAA,WAAAA,CAAA;AAAA,IAIA;AAAA,IAEA,gBAAAC,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,UAAAA,CAAA;AAAA,IACA;AAAA,EACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@dialpad/dialtone-icons/vue2"),n=require("../../common/utils/index.cjs"),r=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),a=require("../callbar-button/callbar-button.cjs"),i=require("../popover/popover.cjs"),s=require("../button/button.cjs"),p=require("../../common/mixins/localization.cjs"),u=require("../callbar-button/callbar-button-constants.cjs"),c={name:"DtRecipeCallbarButtonWithPopover",components:{DtRecipeCallbarButton:a.default,DtPopover:i.default,DtButton:s.default,DtIconChevronUp:l.DtIconChevronUp},mixins:[p.default],inheritAttrs:!1,props:{id:{type:String,default(){return n.default.getUniqueString()}},ariaLabel:{type:String,default:null,validator:e=>e||(void 0).$slots.default},placement:{type:String,default:"top"},offset:{type:Array,default:()=>[0,16]},initialFocusElement:{type:String,default:"first"},showCloseButton:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},forceShowArrow:{type:Boolean,default:!1},active:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},buttonClass:{type:[String,Array,Object],default:""},textClass:{type:[String,Array,Object],default:""},buttonWidthSize:{type:String,default:"xl",validator:e=>u.CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(e)},contentClass:{type:[String,Array,Object],default:""},openPopover:{type:Boolean,default:!1},invertedTooltip:{type:Boolean,default:!1},showTooltip:{type:Boolean,default:null},tooltipText:{type:String,default:void 0},tooltipDelay:{type:Boolean,default:void 0}},emits:["arrow-click","click","opened"],data(){return{open:!1}},computed:{showArrowButton(){return this.forceShowArrow||!this.disabled},isCompactMode(){return this.buttonWidthSize==="sm"||this.buttonWidthSize==="md"},showPopover(){return!this.openPopover||this.open?(this.syncOpenState(),!1):this.toggleOpen()},arrowButtonLabel(){return this.i18n.$
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@dialpad/dialtone-icons/vue2"),n=require("../../common/utils/index.cjs"),r=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),a=require("../callbar-button/callbar-button.cjs"),i=require("../popover/popover.cjs"),s=require("../button/button.cjs"),p=require("../../common/mixins/localization.cjs"),u=require("../callbar-button/callbar-button-constants.cjs"),c={name:"DtRecipeCallbarButtonWithPopover",components:{DtRecipeCallbarButton:a.default,DtPopover:i.default,DtButton:s.default,DtIconChevronUp:l.DtIconChevronUp},mixins:[p.default],inheritAttrs:!1,props:{id:{type:String,default(){return n.default.getUniqueString()}},ariaLabel:{type:String,default:null,validator:e=>e||(void 0).$slots.default},placement:{type:String,default:"top"},offset:{type:Array,default:()=>[0,16]},initialFocusElement:{type:String,default:"first"},showCloseButton:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},forceShowArrow:{type:Boolean,default:!1},active:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},buttonClass:{type:[String,Array,Object],default:""},textClass:{type:[String,Array,Object],default:""},buttonWidthSize:{type:String,default:"xl",validator:e=>u.CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(e)},contentClass:{type:[String,Array,Object],default:""},openPopover:{type:Boolean,default:!1},invertedTooltip:{type:Boolean,default:!1},showTooltip:{type:Boolean,default:null},tooltipText:{type:String,default:void 0},tooltipDelay:{type:Boolean,default:void 0}},emits:["arrow-click","click","opened"],data(){return{open:!1}},computed:{showArrowButton(){return this.forceShowArrow||!this.disabled},isCompactMode(){return this.buttonWidthSize==="sm"||this.buttonWidthSize==="md"},showPopover(){return!this.openPopover||this.open?(this.syncOpenState(),!1):this.toggleOpen()},arrowButtonLabel(){return this.i18n.$t("DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_ARIA_LABEL")}},mounted(){n.warnIfUnmounted(this.$el,this.$options.name)},methods:{arrowClick(e){return this.$emit("arrow-click",e),this.toggleOpen()},toggleOpen(){return this.open=!this.open},syncOpenState(){this.open=this.openPopover},buttonClick(e){this.$listeners.click?this.$emit("click",e):this.arrowClick(e)},onModalIsOpened(e){this.open=e,this.$emit("opened",e)}}};var d=function(){var t=this,o=t._self._c;return o("div",{staticClass:"d-recipe-callbar-button-with-popover"},[o("dt-recipe-callbar-button",{staticClass:"d-recipe-callbar-button-with-popover--main-button",attrs:{"aria-label":t.ariaLabel,disabled:t.disabled,active:t.active,danger:t.danger,"button-class":t.buttonClass,"button-width-size":t.buttonWidthSize,"text-class":t.textClass,"inverted-tooltip":t.invertedTooltip,"show-tooltip":t.showTooltip,"tooltip-text":t.tooltipText,"tooltip-delay":t.tooltipDelay},on:{click:t.buttonClick}},[t._t("icon",null,{slot:"icon"}),t._t("tooltip",null,{slot:"tooltip"}),t._t("default")],2),t.showArrowButton?o("dt-popover",t._b({staticClass:"d-recipe-callbar-button-with-popover__popover-wrapper",attrs:{id:t.id,modal:!1,open:t.open,placement:t.placement,"initial-focus-element":t.initialFocusElement,"show-close-button":t.showCloseButton,offset:t.offset,padding:"none","dialog-class":["d-recipe-callbar-button-with-popover__popover",t.contentClass],"open-popover":t.showPopover},on:{opened:t.onModalIsOpened},scopedSlots:t._u([{key:"anchor",fn:function(){return[o("dt-button",{class:["d-recipe-callbar-button-with-popover__arrow",{"d-recipe-callbar-button-with-popover__arrow--large":!t.isCompactMode}],attrs:{active:t.open,circle:!0,importance:"clear",size:"lg","aria-label":t.arrowButtonLabel,title:t.arrowButtonLabel,width:"2rem"},on:{click:t.arrowClick},scopedSlots:t._u([{key:"icon",fn:function(){return[o("dt-icon-chevron-up",{staticClass:"d-recipe-callbar-button-with-popover__arrow-icon",attrs:{size:"200"}})]},proxy:!0}],null,!1,778999832)})]},proxy:!0}],null,!1,2571181550)},"dt-popover",t.$attrs,!1),[t._t("content",null,{slot:"content"}),t._t("headerContent",null,{slot:"headerContent"}),t._t("footerContent",null,{slot:"footerContent"})],2):t._e()],1)},f=[],_=r.n(c,d,f);const b=_.exports;exports.default=b;
|
|
2
2
|
//# sourceMappingURL=callbar-button-with-popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbar-button-with-popover.cjs","sources":["../../../recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-callbar-button-with-popover\"\n >\n <dt-recipe-callbar-button\n :aria-label=\"ariaLabel\"\n :disabled=\"disabled\"\n :active=\"active\"\n :danger=\"danger\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :text-class=\"textClass\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :tooltip-text=\"tooltipText\"\n :tooltip-delay=\"tooltipDelay\"\n class=\"d-recipe-callbar-button-with-popover--main-button\"\n @click=\"buttonClick\"\n >\n <slot\n slot=\"icon\"\n name=\"icon\"\n />\n <slot\n slot=\"tooltip\"\n name=\"tooltip\"\n />\n <slot />\n </dt-recipe-callbar-button>\n <dt-popover\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"initialFocusElement\"\n :show-close-button=\"showCloseButton\"\n :offset=\"offset\"\n padding=\"none\"\n class=\"d-recipe-callbar-button-with-popover__popover-wrapper\"\n :dialog-class=\"['d-recipe-callbar-button-with-popover__popover', contentClass]\"\n v-bind=\"$attrs\"\n :open-popover=\"showPopover\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['d-recipe-callbar-button-with-popover__arrow',\n { 'd-recipe-callbar-button-with-popover__arrow--large': !isCompactMode }]\"\n circle\n importance=\"clear\"\n size=\"lg\"\n v-bind=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"d-recipe-callbar-button-with-popover__arrow-icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <slot\n slot=\"content\"\n name=\"content\"\n />\n <slot\n slot=\"headerContent\"\n name=\"headerContent\"\n />\n <slot\n slot=\"footerContent\"\n name=\"footerContent\"\n />\n </dt-popover>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithPopover',\n\n components: { DtRecipeCallbarButton, DtPopover, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The element that is focused when the popover is opened. This can be an\n * HTMLElement within the popover, 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,\n default: 'first',\n },\n\n /**\n * Determines visibility for close button\n */\n showCloseButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Additional class name for the popover content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * To auto open the modal popover.\n */\n openPopover: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal popover is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n showPopover () {\n if (!this.openPopover || this.open) {\n this.syncOpenState();\n return false;\n }\n\n return this.toggleOpen();\n },\n\n arrowButtonLabel () {\n return this.i18n.$ta('DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openPopover;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the popover\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtPopover","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":"oeAyFAA,EAAA,CACA,KAAA,mCAEA,WAAA,CAAA,sBAAAC,EAAA,QAAA,UAAAC,UAAAC,SAAAA,EAAAA,QAAAC,gBAAAA,EAAAA,eAAA,EAEA,OAAA,CAAAC,EAAAA,OAAA,EAMA,aAAA,GAEA,MAAA,CAIA,GAAA,CACA,KAAA,OACA,SAAA,CACA,OAAAC,EAAAA,QAAA,iBACA,CACA,EAKA,UAAA,CACA,KAAA,OACA,QAAA,KACA,UAAAC,GACAA,GAAAC,SAAA,OAAA,OAEA,EAUA,UAAA,CACA,KAAA,OACA,QAAA,KACA,EAaA,OAAA,CACA,KAAA,MACA,QAAA,IAAA,CAAA,EAAA,EAAA,CACA,EASA,oBAAA,CACA,KAAA,OACA,QAAA,OACA,EAKA,gBAAA,CACA,KAAA,QACA,QAAA,EACA,EAOA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAOA,eAAA,CACA,KAAA,QACA,QAA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AEA,gBAAAC,EAAA,CACA,KAAA,KAAAA,EACA,KAAA,MAAA,SAAAA,CAAA,CACA,CACA,CAEA"}
|
|
1
|
+
{"version":3,"file":"callbar-button-with-popover.cjs","sources":["../../../recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-callbar-button-with-popover\"\n >\n <dt-recipe-callbar-button\n :aria-label=\"ariaLabel\"\n :disabled=\"disabled\"\n :active=\"active\"\n :danger=\"danger\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :text-class=\"textClass\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :tooltip-text=\"tooltipText\"\n :tooltip-delay=\"tooltipDelay\"\n class=\"d-recipe-callbar-button-with-popover--main-button\"\n @click=\"buttonClick\"\n >\n <slot\n slot=\"icon\"\n name=\"icon\"\n />\n <slot\n slot=\"tooltip\"\n name=\"tooltip\"\n />\n <slot />\n </dt-recipe-callbar-button>\n <dt-popover\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"initialFocusElement\"\n :show-close-button=\"showCloseButton\"\n :offset=\"offset\"\n padding=\"none\"\n class=\"d-recipe-callbar-button-with-popover__popover-wrapper\"\n :dialog-class=\"['d-recipe-callbar-button-with-popover__popover', contentClass]\"\n v-bind=\"$attrs\"\n :open-popover=\"showPopover\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['d-recipe-callbar-button-with-popover__arrow',\n { 'd-recipe-callbar-button-with-popover__arrow--large': !isCompactMode }]\"\n :circle=\"true\"\n importance=\"clear\"\n size=\"lg\"\n :aria-label=\"arrowButtonLabel\"\n :title=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"d-recipe-callbar-button-with-popover__arrow-icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <slot\n slot=\"content\"\n name=\"content\"\n />\n <slot\n slot=\"headerContent\"\n name=\"headerContent\"\n />\n <slot\n slot=\"footerContent\"\n name=\"footerContent\"\n />\n </dt-popover>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithPopover',\n\n components: { DtRecipeCallbarButton, DtPopover, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The element that is focused when the popover is opened. This can be an\n * HTMLElement within the popover, 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,\n default: 'first',\n },\n\n /**\n * Determines visibility for close button\n */\n showCloseButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Additional class name for the popover content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * To auto open the modal popover.\n */\n openPopover: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal popover is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n showPopover () {\n if (!this.openPopover || this.open) {\n this.syncOpenState();\n return false;\n }\n\n return this.toggleOpen();\n },\n\n arrowButtonLabel () {\n return this.i18n.$t('DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_ARIA_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openPopover;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the popover\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtPopover","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":"oeA0FAA,EAAA,CACA,KAAA,mCAEA,WAAA,CAAA,sBAAAC,EAAA,QAAA,UAAAC,UAAAC,SAAAA,EAAAA,QAAAC,gBAAAA,EAAAA,eAAA,EAEA,OAAA,CAAAC,EAAAA,OAAA,EAMA,aAAA,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GA,KAAA,YACA,EAEA,kBAAA,CACA,OAAA,KAAA,KAAA,GAAA,8DAAA,CACA,CACA,EAEA,SAAA,CACAE,EAAA,gBAAA,KAAA,IAAA,KAAA,SAAA,IAAA,CACA,EAEA,QAAA,CACA,WAAAC,EAAA,CACA,YAAA,MAAA,cAAAA,CAAA,EACA,KAAA,YACA,EAEA,YAAA,CACA,OAAA,KAAA,KAAA,CAAA,KAAA,IACA,EAEA,eAAA,CACA,KAAA,KAAA,KAAA,WACA,EAEA,YAAAA,EAAA,CAGA,KAAA,WAAA,MAGA,KAAA,MAAA,QAAAA,CAAA,EAFA,KAAA,WAAAA,CAAA,CAIA,EAEA,gBAAAC,EAAA,CACA,KAAA,KAAAA,EACA,KAAA,MAAA,SAAAA,CAAA,CACA,CACA,CAEA"}
|
|
@@ -218,7 +218,7 @@ const d = {
|
|
|
218
218
|
return !this.openPopover || this.open ? (this.syncOpenState(), !1) : this.toggleOpen();
|
|
219
219
|
},
|
|
220
220
|
arrowButtonLabel() {
|
|
221
|
-
return this.i18n.$
|
|
221
|
+
return this.i18n.$t("DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_ARIA_LABEL");
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
mounted() {
|
|
@@ -245,13 +245,13 @@ const d = {
|
|
|
245
245
|
var f = function() {
|
|
246
246
|
var t = this, o = t._self._c;
|
|
247
247
|
return o("div", { staticClass: "d-recipe-callbar-button-with-popover" }, [o("dt-recipe-callbar-button", { staticClass: "d-recipe-callbar-button-with-popover--main-button", attrs: { "aria-label": t.ariaLabel, disabled: t.disabled, active: t.active, danger: t.danger, "button-class": t.buttonClass, "button-width-size": t.buttonWidthSize, "text-class": t.textClass, "inverted-tooltip": t.invertedTooltip, "show-tooltip": t.showTooltip, "tooltip-text": t.tooltipText, "tooltip-delay": t.tooltipDelay }, on: { click: t.buttonClick } }, [t._t("icon", null, { slot: "icon" }), t._t("tooltip", null, { slot: "tooltip" }), t._t("default")], 2), t.showArrowButton ? o("dt-popover", t._b({ staticClass: "d-recipe-callbar-button-with-popover__popover-wrapper", attrs: { id: t.id, modal: !1, open: t.open, placement: t.placement, "initial-focus-element": t.initialFocusElement, "show-close-button": t.showCloseButton, offset: t.offset, padding: "none", "dialog-class": ["d-recipe-callbar-button-with-popover__popover", t.contentClass], "open-popover": t.showPopover }, on: { opened: t.onModalIsOpened }, scopedSlots: t._u([{ key: "anchor", fn: function() {
|
|
248
|
-
return [o("dt-button",
|
|
248
|
+
return [o("dt-button", { class: [
|
|
249
249
|
"d-recipe-callbar-button-with-popover__arrow",
|
|
250
250
|
{ "d-recipe-callbar-button-with-popover__arrow--large": !t.isCompactMode }
|
|
251
|
-
], attrs: { active: t.open, circle:
|
|
251
|
+
], attrs: { active: t.open, circle: !0, importance: "clear", size: "lg", "aria-label": t.arrowButtonLabel, title: t.arrowButtonLabel, width: "2rem" }, on: { click: t.arrowClick }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
252
252
|
return [o("dt-icon-chevron-up", { staticClass: "d-recipe-callbar-button-with-popover__arrow-icon", attrs: { size: "200" } })];
|
|
253
|
-
}, proxy: !0 }], null, !1, 778999832) }
|
|
254
|
-
}, proxy: !0 }], null, !1,
|
|
253
|
+
}, proxy: !0 }], null, !1, 778999832) })];
|
|
254
|
+
}, proxy: !0 }], null, !1, 2571181550) }, "dt-popover", t.$attrs, !1), [t._t("content", null, { slot: "content" }), t._t("headerContent", null, { slot: "headerContent" }), t._t("footerContent", null, { slot: "footerContent" })], 2) : t._e()], 1);
|
|
255
255
|
}, h = [], _ = /* @__PURE__ */ a(
|
|
256
256
|
d,
|
|
257
257
|
f,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbar-button-with-popover.js","sources":["../../../recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-callbar-button-with-popover\"\n >\n <dt-recipe-callbar-button\n :aria-label=\"ariaLabel\"\n :disabled=\"disabled\"\n :active=\"active\"\n :danger=\"danger\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :text-class=\"textClass\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :tooltip-text=\"tooltipText\"\n :tooltip-delay=\"tooltipDelay\"\n class=\"d-recipe-callbar-button-with-popover--main-button\"\n @click=\"buttonClick\"\n >\n <slot\n slot=\"icon\"\n name=\"icon\"\n />\n <slot\n slot=\"tooltip\"\n name=\"tooltip\"\n />\n <slot />\n </dt-recipe-callbar-button>\n <dt-popover\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"initialFocusElement\"\n :show-close-button=\"showCloseButton\"\n :offset=\"offset\"\n padding=\"none\"\n class=\"d-recipe-callbar-button-with-popover__popover-wrapper\"\n :dialog-class=\"['d-recipe-callbar-button-with-popover__popover', contentClass]\"\n v-bind=\"$attrs\"\n :open-popover=\"showPopover\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['d-recipe-callbar-button-with-popover__arrow',\n { 'd-recipe-callbar-button-with-popover__arrow--large': !isCompactMode }]\"\n circle\n importance=\"clear\"\n size=\"lg\"\n v-bind=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"d-recipe-callbar-button-with-popover__arrow-icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <slot\n slot=\"content\"\n name=\"content\"\n />\n <slot\n slot=\"headerContent\"\n name=\"headerContent\"\n />\n <slot\n slot=\"footerContent\"\n name=\"footerContent\"\n />\n </dt-popover>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithPopover',\n\n components: { DtRecipeCallbarButton, DtPopover, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The element that is focused when the popover is opened. This can be an\n * HTMLElement within the popover, 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,\n default: 'first',\n },\n\n /**\n * Determines visibility for close button\n */\n showCloseButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Additional class name for the popover content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * To auto open the modal popover.\n */\n openPopover: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal popover is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n showPopover () {\n if (!this.openPopover || this.open) {\n this.syncOpenState();\n return false;\n }\n\n return this.toggleOpen();\n },\n\n arrowButtonLabel () {\n return this.i18n.$ta('DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openPopover;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the popover\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtPopover","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_SIZE","warnIfUnmounted","ev","isOpened"],"mappings":";;;;;;;;AAyFA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA,EAAA,uBAAAC,GAAA,WAAAC,GAAA,UAAAC,GAAA,iBAAAC,EAAA;AAAA,EAEA,QAAA,CAAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AACA,eAAAC,EAAA;MACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA,CAAAC,MACAA,KAAAC,SAAA,OAAA;AAAA,IAEA;AAAA;AAAA;AAAA;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A,IAEA,gBAAA;AACA,WAAA,OAAA,KAAA;AAAA,IACA;AAAA,IAEA,YAAAA,GAAA;AAGA,MAAA,KAAA,WAAA,QAGA,KAAA,MAAA,SAAAA,CAAA,IAFA,KAAA,WAAAA,CAAA;AAAA,IAIA;AAAA,IAEA,gBAAAC,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,UAAAA,CAAA;AAAA,IACA;AAAA,EACA;AAEA;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"callbar-button-with-popover.js","sources":["../../../recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue"],"sourcesContent":["<template>\n <div\n class=\"d-recipe-callbar-button-with-popover\"\n >\n <dt-recipe-callbar-button\n :aria-label=\"ariaLabel\"\n :disabled=\"disabled\"\n :active=\"active\"\n :danger=\"danger\"\n :button-class=\"buttonClass\"\n :button-width-size=\"buttonWidthSize\"\n :text-class=\"textClass\"\n :inverted-tooltip=\"invertedTooltip\"\n :show-tooltip=\"showTooltip\"\n :tooltip-text=\"tooltipText\"\n :tooltip-delay=\"tooltipDelay\"\n class=\"d-recipe-callbar-button-with-popover--main-button\"\n @click=\"buttonClick\"\n >\n <slot\n slot=\"icon\"\n name=\"icon\"\n />\n <slot\n slot=\"tooltip\"\n name=\"tooltip\"\n />\n <slot />\n </dt-recipe-callbar-button>\n <dt-popover\n v-if=\"showArrowButton\"\n :id=\"id\"\n :modal=\"false\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"initialFocusElement\"\n :show-close-button=\"showCloseButton\"\n :offset=\"offset\"\n padding=\"none\"\n class=\"d-recipe-callbar-button-with-popover__popover-wrapper\"\n :dialog-class=\"['d-recipe-callbar-button-with-popover__popover', contentClass]\"\n v-bind=\"$attrs\"\n :open-popover=\"showPopover\"\n @opened=\"onModalIsOpened\"\n >\n <template #anchor>\n <dt-button\n :active=\"open\"\n :class=\"['d-recipe-callbar-button-with-popover__arrow',\n { 'd-recipe-callbar-button-with-popover__arrow--large': !isCompactMode }]\"\n :circle=\"true\"\n importance=\"clear\"\n size=\"lg\"\n :aria-label=\"arrowButtonLabel\"\n :title=\"arrowButtonLabel\"\n width=\"2rem\"\n @click=\"arrowClick\"\n >\n <template #icon>\n <dt-icon-chevron-up\n class=\"d-recipe-callbar-button-with-popover__arrow-icon\"\n size=\"200\"\n />\n </template>\n </dt-button>\n </template>\n <slot\n slot=\"content\"\n name=\"content\"\n />\n <slot\n slot=\"headerContent\"\n name=\"headerContent\"\n />\n <slot\n slot=\"footerContent\"\n name=\"footerContent\"\n />\n </dt-popover>\n </div>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtPopover } from '@/components/popover';\nimport { DtIconChevronUp } from '@dialpad/dialtone-icons/vue2';\nimport { DtRecipeCallbarButton, CALLBAR_BUTTON_VALID_WIDTH_SIZE } from '../callbar_button';\nimport utils, { warnIfUnmounted } from '@/common/utils';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtRecipeCallbarButtonWithPopover',\n\n components: { DtRecipeCallbarButton, DtPopover, DtButton, DtIconChevronUp },\n\n mixins: [DtLocalizationMixin],\n\n /* inheritAttrs: false is generally an option we want to set on library\n components. This allows any attributes passed in that are not recognized\n as props to be passed down to another element or component using v-bind:$attrs\n more info: https://vuejs.org/v2/api/#inheritAttrs */\n inheritAttrs: false,\n\n props: {\n /**\n * Id for the item.\n */\n id: {\n type: String,\n default () {\n return utils.getUniqueString();\n },\n },\n\n /**\n * Aria label for the button. If empty, it takes its value from the default slot.\n */\n ariaLabel: {\n type: String,\n default: null,\n validator: (label) => {\n return label || this.$slots.default;\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @values 'bottom', 'bottom-start', 'bottom-end',\n * 'right', 'right-start', 'right-end',\n * 'left', 'left-start', 'left-end',\n * 'top', 'top-start', 'top-end'\n * @default 'top'\n */\n placement: {\n type: String,\n default: 'top',\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * <a\n * class=\"d-link\"\n * href=\"https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n * target=\"_blank\"\n * >\n * Tippy.js docs\n * </a>\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The element that is focused when the popover is opened. This can be an\n * HTMLElement within the popover, 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,\n default: 'first',\n },\n\n /**\n * Determines visibility for close button\n */\n showCloseButton: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines whether the button should be disabled\n * default is false.\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Forces showing the arrow, even if the button is disabled.\n * default is false\n * @values true, false\n */\n forceShowArrow: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have danger styling\n * default is false.\n * @values true, false\n * @see https://dialtone.dialpad.com/components/button/\n */\n danger: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Additional class name for the button wrapper element.\n */\n buttonClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the button text.\n */\n textClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /*\n * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.\n */\n buttonWidthSize: {\n type: String,\n default: 'xl',\n validator: size => CALLBAR_BUTTON_VALID_WIDTH_SIZE.includes(size),\n },\n\n /**\n * Additional class name for the popover content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * To auto open the modal popover.\n */\n openPopover: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the tooltip has an inverted background color.\n * @values true, false\n */\n invertedTooltip: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Use this if you would like to manually override the logic for when the tooltip shows.\n * Otherwise it will just show on hover/focus.\n * @values null, true, false\n */\n showTooltip: {\n type: Boolean,\n default: null,\n },\n\n /**\n * The message that displays in the tooltip. This will be overridden by the tooltip slot.\n */\n tooltipText: {\n type: String,\n default: undefined,\n },\n\n /**\n * Whether there is a delay before the tooltip shows on hover/focus.\n * @values true, false\n */\n tooltipDelay: {\n type: Boolean,\n default: undefined,\n },\n },\n\n emits: [\n /**\n * Emitted when the arrow is clicked\n */\n 'arrow-click',\n\n /**\n * Native click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Emitted when modal popover is opened or closed.\n */\n 'opened',\n ],\n\n data () {\n return {\n open: false,\n };\n },\n\n computed: {\n showArrowButton () {\n return this.forceShowArrow || !this.disabled;\n },\n\n isCompactMode () {\n return this.buttonWidthSize === 'sm' || this.buttonWidthSize === 'md';\n },\n\n showPopover () {\n if (!this.openPopover || this.open) {\n this.syncOpenState();\n return false;\n }\n\n return this.toggleOpen();\n },\n\n arrowButtonLabel () {\n return this.i18n.$t('DIALTONE_CALLBAR_BUTTON_WITH_POPOVER_ARROW_BUTTON_ARIA_LABEL');\n },\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n arrowClick (ev) {\n this.$emit('arrow-click', ev);\n return this.toggleOpen();\n },\n\n toggleOpen () {\n return (this.open = !this.open);\n },\n\n syncOpenState () {\n this.open = this.openPopover;\n },\n\n buttonClick (ev) {\n // If no listener for the click event, the button click opens the popover\n // the same as if the arrow was clicked.\n if (!this.$listeners.click) {\n this.arrowClick(ev);\n } else {\n this.$emit('click', ev);\n }\n },\n\n onModalIsOpened (isOpened) {\n this.open = isOpened;\n this.$emit('opened', isOpened);\n },\n },\n\n};\n</script>\n"],"names":["_sfc_main","DtRecipeCallbarButton","DtPopover","DtButton","DtIconChevronUp","DtLocalizationMixin","utils","label","this","size","CALLBAR_BUTTON_VALID_WIDTH_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kBAAA,CAAA,KAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,aAAA,KAAA,oBAAA,QAAA,KAAA,oBAAA;AAAA,IACA;AAAA,IAEA,cAAA;AACA,aAAA,CAAA,KAAA,eAAA,KAAA,QACA,KAAA,cAAA,GACA,MAGA,KAAA;IACA;AAAA,IAEA,mBAAA;AACA,aAAA,KAAA,KAAA,GAAA,8DAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AACA,IAAAE,EAAA,KAAA,KAAA,KAAA,SAAA,IAAA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,WAAAC,GAAA;AACA,kBAAA,MAAA,eAAAA,CAAA,GACA,KAAA;IACA;AAAA,IAEA,aAAA;AACA,aAAA,KAAA,OAAA,CAAA,KAAA;AAAA,IACA;AAAA,IAEA,gBAAA;AACA,WAAA,OAAA,KAAA;AAAA,IACA;AAAA,IAEA,YAAAA,GAAA;AAGA,MAAA,KAAA,WAAA,QAGA,KAAA,MAAA,SAAAA,CAAA,IAFA,KAAA,WAAAA,CAAA;AAAA,IAIA;AAAA,IAEA,gBAAAC,GAAA;AACA,WAAA,OAAAA,GACA,KAAA,MAAA,UAAAA,CAAA;AAAA,IACA;AAAA,EACA;AAEA;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@dialpad/dialtone-icons/vue2"),n=require("date-fns"),i=require("./utils.cjs"),u=require("./datepicker-constants.cjs"),d=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),f=require("../button/button.cjs"),p=require("../tooltip/tooltip.cjs"),_=require("../stack/stack.cjs"),D=require("../../common/mixins/localization.cjs"),y=require("../../common/utils/index.cjs"),k={name:"DtDatepickerMonthYearPicker",components:{DtButton:f.default,DtTooltip:p.default,DtStack:_.default,DtIconChevronLeft:h.DtIconChevronLeft,DtIconChevronsLeft:h.DtIconChevronsLeft,DtIconChevronRight:h.DtIconChevronRight,DtIconChevronsRight:h.DtIconChevronsRight},mixins:[D.default],props:{selectedDate:{type:Date,required:!0}},emits:["calendar-days","focus-first-day","focus-last-day","close-datepicker"],data(){return{selectMonth:n.getMonth(this.selectedDate),selectYear:n.getYear(this.selectedDate),highlightedDay:null,focusPicker:0,focusRefs:[],refNames:["prevYearButtonRef","prevMonthButtonRef","nextMonthButtonRef","nextYearButtonRef"]}},computed:{calendarDays(){return i.getCalendarDays(this.selectMonth,this.selectYear,this.highlightedDay)},formattedMonth(){return s=>i.formatMonth(s,u.INTL_MONTH_FORMAT,this.i18n.currentLocale)},previousYearAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${this.selectYear-1}`},previousMonthAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${this.formattedMonth(this.selectMonth-1)}`},nextYearAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${this.selectYear+1}`},nextMonthAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${this.formattedMonth(this.selectMonth+1)}`}},watch:{selectMonth:{handler(){this.highlightDay(),this.$emit("calendar-days",this.calendarDays)},immediate:!0},selectYear:{handler(){this.highlightDay(),this.$emit("calendar-days",this.calendarDays)},immediate:!0}},mounted(){this.setButtonsRef(),this.focusMonthYearPicker()},methods:{setButtonsRef(){this.focusRefs=this.refNames.map(s=>this.$refs[s])},focusMonthYearPicker(){this.focusPicker=0,this.focusRefs[0].$el.focus()},handleKeyDown(s){switch(s.key){case"ArrowLeft":s.preventDefault(),this.focusPicker===0?(this.focusPicker=3,this.focusRefs[this.focusPicker].$el.focus()):(this.focusPicker--,this.focusRefs[this.focusPicker].$el.focus());break;case"ArrowRight":s.preventDefault(),this.focusPicker===3?(this.focusPicker=0,this.focusRefs[this.focusPicker].$el.focus()):(this.focusPicker++,this.focusRefs[this.focusPicker].$el.focus());break;case"ArrowDown":s.preventDefault(),this.$emit("focus-first-day");break;case"Tab":s.preventDefault(),this.$emit("focus-first-day");break;case"Escape":this.$emit("close-datepicker");break}},highlightDay(){const s=n.getYear(this.selectedDate),e=n.getMonth(this.selectedDate);s!==this.selectYear||e!==this.selectMonth?this.highlightedDay=null:this.highlightedDay=n.getDate(this.selectedDate)},changeMonth(s){(this.selectMonth===0&&s===-1||this.selectMonth===11&&s===1)&&(this.selectYear+=s);const e=n.set(this.selectedDate,{month:this.selectMonth,year:this.selectYear}),t=s===1?n.addMonths(e,1):n.subMonths(e,1);this.selectMonth=n.getMonth(t)},changeYear(s){this.selectYear=this.selectYear+s},goToNextMonth(){this.changeMonth(1)},goToPrevMonth(){this.changeMonth(-1)}}};var m=function(){var e=this,t=e._self._c;return t("dt-stack",{staticClass:"d-datepicker__month-year",attrs:{direction:"row",gap:"300"}},[t("dt-stack",{staticClass:"d-datepicker__nav",attrs:{as:"nav",direction:"row",gap:"200"}},[t("dt-tooltip",{attrs:{"fallback-placements":["top-start","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[0],staticClass:"d-datepicker__nav-btn",attrs:{id:"prevYearButton","aria-label":e.previousYearAriaLabel,circle:"",importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeYear(-1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevrons-left",{attrs:{size:"200"}})],1)]},proxy:!0}])}),t("dt-tooltip",{attrs:{"fallback-placements":["top-start","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[1],staticClass:"d-datepicker__nav-btn",attrs:{id:"prevMonthButton","aria-label":e.previousMonthAriaLabel,circle:"",importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeMonth(-1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevron-left",{attrs:{size:"200"}})],1)]},proxy:!0}])})],1),t("div",{staticClass:"d-datepicker__month-year-title",attrs:{id:"calendar-heading"}},[e._v(" "+e._s(e.formattedMonth(e.selectMonth))+" "+e._s(e.selectYear)+" ")]),t("dt-stack",{staticClass:"d-datepicker__nav",attrs:{as:"nav",direction:"row",gap:"200"}},[t("dt-tooltip",{attrs:{"fallback-placements":["top-end","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_NEXT_MONTH"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[2],staticClass:"d-datepicker__nav-btn",attrs:{id:"nextMonthButton","aria-label":e.nextMonthAriaLabel,circle:"",importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeMonth(1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevron-right",{attrs:{size:"200"}})],1)]},proxy:!0}])}),t("dt-tooltip",{attrs:{"fallback-placements":["top-end","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_NEXT_YEAR"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[3],staticClass:"d-datepicker__nav-btn",attrs:{id:"nextYearButton","aria-label":e.nextYearAriaLabel,circle:"",importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeYear(1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevrons-right",{attrs:{size:"200"}})],1)]},proxy:!0}])})],1)],1)},$=[],v=d.n(k,m,$);const R=v.exports,b={name:"DtDatepickerCalendar",components:{DtButton:f.default},mixins:[D.default],props:{calendarDays:{type:Array,required:!0}},emits:["select-date","focus-month-year-picker","close-datepicker"],data(){return{selectedDay:null,focusDay:0,daysRef:[]}},computed:{weekDays(){return i.getWeekDayNames(this.i18n.currentLocale,u.WEEK_START)}},watch:{calendarDays(){this.focusDay=0,this.selectedDay=null,this.daysRef=[],this.$nextTick(()=>{this.daysRef=[],this.setDayRef()})}},methods:{dayAriaLabel(s){return this.i18n.$t("DIALTONE_DATEPICKER_SELECT_DAY")+` ${i.formatDate(s.value,u.INTL_MONTH_FORMAT,this.i18n.currentLocale)}`},setDayRef(s,e){this.calendarDays.forEach((t,a)=>{t.days.forEach((c,r)=>{const l=`buttonRef_${a}_${r}`,o=this.$refs[l];o&&c.currentMonth&&this.daysRef.push({el:o[0],day:c})})})},handleKeyDown(s){switch(s.key){case"ArrowUp":s.preventDefault(),this.focusDay-=7;try{this.daysRef[this.focusDay].el.$el.focus()}catch{const t=i.calculatePrevFocusDate(this.daysRef[this.focusDay+7].day.value);this.$emit("go-to-prev-month"),this.$nextTick(()=>{this.setDayRef(),this.daysRef[t-1].el.$el.focus(),this.focusDay+=t-1})}break;case"ArrowDown":s.preventDefault(),this.focusDay+=7;try{this.daysRef[this.focusDay].el.$el.focus()}catch{const t=i.calculateNextFocusDate(this.daysRef[this.focusDay-7].day.value);this.$emit("go-to-next-month"),this.$nextTick(()=>{this.setDayRef(),this.daysRef[t-1].el.$el.focus(),this.focusDay+=t-1})}break;case"ArrowLeft":s.preventDefault(),this.focusDay>0?(this.focusDay-=1,this.daysRef[this.focusDay].el.$el.focus()):(this.$emit("go-to-prev-month"),this.$nextTick(()=>{this.focusLastDay()}));break;case"ArrowRight":s.preventDefault(),this.focusDay<this.daysRef.length-1?(this.focusDay+=1,this.daysRef[this.focusDay].el.$el.focus()):(this.$emit("go-to-next-month"),this.$nextTick(()=>{this.focusFirstDay()}));break;case"Tab":s.preventDefault(),this.$emit("focus-month-year-picker");break;case"Escape":this.$emit("close-datepicker");break}},focusFirstDay(){this.focusDay=0,this.$nextTick(()=>{this.daysRef[this.focusDay].el.$el.focus()})},focusLastDay(){this.$nextTick(()=>{this.focusDay=this.daysRef.length-1,this.daysRef[this.focusDay].el.$el.focus()})},selectDay(s){s.currentMonth&&(this.selectedDay=s.text,this.$emit("select-date",s.value))}}};var g=function(){var e=this,t=e._self._c;return t("table",{staticClass:"d-datepicker__calendar",attrs:{"aria-labelledby":"calendar-heading"}},[t("thead",[t("tr",e._l(e.weekDays,function(a){return t("th",{key:a,staticClass:"d-datepicker__cell d-datepicker__cell--header",attrs:{scope:"col"}},[t("span",{staticClass:"d-datepicker__weekday",attrs:{title:a,"aria-label":a}},[e._v(" "+e._s(a))])])}),0)]),t("tbody",e._l(e.calendarDays,function(a,c){return t("tr",{key:c},e._l(a.days,function(r,l){return t("td",{key:c+l,staticClass:"d-datepicker__cell",attrs:{role:"listbox"}},[t("dt-button",{ref:`buttonRef_${c}_${l}`,refInFor:!0,staticClass:"d-datepicker__day",class:{"d-datepicker__day--disabled":!r.currentMonth,"d-datepicker__day--selected":e.selectedDay?r.text===e.selectedDay&&r.currentMonth:r.selected},attrs:{circle:!0,size:"sm",importance:"clear",disabled:!r.currentMonth,type:"button","aria-selected":e.selectedDay?r.text===e.selectedDay&&r.currentMonth:r.selected,"aria-label":e.dayAriaLabel(r),role:"option"},on:{click:function(o){return e.selectDay(r)},keydown:function(o){return e.handleKeyDown(o)}}},[e._v(" "+e._s(r.text)+" ")])],1)}),0)}),0)])},E=[],T=d.n(b,g,E);const M=T.exports,A={name:"DtDatepicker",components:{DtStack:_.default,MonthYearPicker:R,Calendar:M},props:{selectedDate:{type:Date,default:()=>new Date}},emits:["selected-date","close-datepicker"],data(){return{calendarDays:[]}},mounted(){y.warnIfUnmounted(this.$el,this.$options.name)},methods:{updateCalendarDays(s){this.calendarDays=s}}};var C=function(){var e=this,t=e._self._c;return t("dt-stack",{staticClass:"d-datepicker",attrs:{gap:"400"}},[t("div",{staticClass:"d-datepicker__hd"},[t("month-year-picker",{ref:"monthYearPicker",attrs:{"selected-date":e.selectedDate},on:{"calendar-days":e.updateCalendarDays,"focus-first-day":function(a){return e.$refs.calendar.focusFirstDay()},"focus-last-day":function(a){return e.$refs.calendar.focusLastDay()},"close-datepicker":function(a){return e.$emit("close-datepicker")}}})],1),t("div",{staticClass:"d-datepicker__bd"},[t("calendar",{ref:"calendar",attrs:{"calendar-days":e.calendarDays},on:{"select-date":function(a){return e.$emit("selected-date",a)},"focus-month-year-picker":function(a){return e.$refs.monthYearPicker.focusMonthYearPicker()},"close-datepicker":function(a){return e.$emit("close-datepicker")},"go-to-next-month":function(a){return e.$refs.monthYearPicker.goToNextMonth()},"go-to-prev-month":function(a){return e.$refs.monthYearPicker.goToPrevMonth()}}})],1)])},I=[],P=d.n(A,C,I);const x=P.exports;exports.default=x;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@dialpad/dialtone-icons/vue2"),n=require("date-fns"),i=require("./utils.cjs"),u=require("./datepicker-constants.cjs"),d=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),f=require("../button/button.cjs"),p=require("../tooltip/tooltip.cjs"),_=require("../stack/stack.cjs"),D=require("../../common/mixins/localization.cjs"),y=require("../../common/utils/index.cjs"),k={name:"DtDatepickerMonthYearPicker",components:{DtButton:f.default,DtTooltip:p.default,DtStack:_.default,DtIconChevronLeft:h.DtIconChevronLeft,DtIconChevronsLeft:h.DtIconChevronsLeft,DtIconChevronRight:h.DtIconChevronRight,DtIconChevronsRight:h.DtIconChevronsRight},mixins:[D.default],props:{selectedDate:{type:Date,required:!0}},emits:["calendar-days","focus-first-day","focus-last-day","close-datepicker"],data(){return{selectMonth:n.getMonth(this.selectedDate),selectYear:n.getYear(this.selectedDate),highlightedDay:null,focusPicker:0,focusRefs:[],refNames:["prevYearButtonRef","prevMonthButtonRef","nextMonthButtonRef","nextYearButtonRef"]}},computed:{calendarDays(){return i.getCalendarDays(this.selectMonth,this.selectYear,this.highlightedDay)},formattedMonth(){return s=>i.formatMonth(s,u.INTL_MONTH_FORMAT,this.i18n.currentLocale)},previousYearAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${this.selectYear-1}`},previousMonthAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${this.formattedMonth(this.selectMonth-1)}`},nextYearAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${this.selectYear+1}`},nextMonthAriaLabel(){return`${this.i18n.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${this.i18n.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${this.formattedMonth(this.selectMonth+1)}`}},watch:{selectMonth:{handler(){this.highlightDay(),this.$emit("calendar-days",this.calendarDays)},immediate:!0},selectYear:{handler(){this.highlightDay(),this.$emit("calendar-days",this.calendarDays)},immediate:!0}},mounted(){this.setButtonsRef(),this.focusMonthYearPicker()},methods:{setButtonsRef(){this.focusRefs=this.refNames.map(s=>this.$refs[s])},focusMonthYearPicker(){this.focusPicker=0,this.focusRefs[0].$el.focus()},handleKeyDown(s){switch(s.key){case"ArrowLeft":s.preventDefault(),this.focusPicker===0?(this.focusPicker=3,this.focusRefs[this.focusPicker].$el.focus()):(this.focusPicker--,this.focusRefs[this.focusPicker].$el.focus());break;case"ArrowRight":s.preventDefault(),this.focusPicker===3?(this.focusPicker=0,this.focusRefs[this.focusPicker].$el.focus()):(this.focusPicker++,this.focusRefs[this.focusPicker].$el.focus());break;case"ArrowDown":s.preventDefault(),this.$emit("focus-first-day");break;case"Tab":s.preventDefault(),this.$emit("focus-first-day");break;case"Escape":this.$emit("close-datepicker");break}},highlightDay(){const s=n.getYear(this.selectedDate),e=n.getMonth(this.selectedDate);s!==this.selectYear||e!==this.selectMonth?this.highlightedDay=null:this.highlightedDay=n.getDate(this.selectedDate)},changeMonth(s){(this.selectMonth===0&&s===-1||this.selectMonth===11&&s===1)&&(this.selectYear+=s);const e=n.set(this.selectedDate,{month:this.selectMonth,year:this.selectYear}),t=s===1?n.addMonths(e,1):n.subMonths(e,1);this.selectMonth=n.getMonth(t)},changeYear(s){this.selectYear=this.selectYear+s},goToNextMonth(){this.changeMonth(1)},goToPrevMonth(){this.changeMonth(-1)}}};var m=function(){var e=this,t=e._self._c;return t("dt-stack",{staticClass:"d-datepicker__month-year",attrs:{direction:"row",gap:"300"}},[t("dt-stack",{staticClass:"d-datepicker__nav",attrs:{as:"nav",direction:"row",gap:"200"}},[t("dt-tooltip",{attrs:{"fallback-placements":["top-start","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[0],staticClass:"d-datepicker__nav-btn",attrs:{id:"prevYearButton","aria-label":e.previousYearAriaLabel,circle:!0,importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeYear(-1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevrons-left",{attrs:{size:"200"}})],1)]},proxy:!0}])}),t("dt-tooltip",{attrs:{"fallback-placements":["top-start","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[1],staticClass:"d-datepicker__nav-btn",attrs:{id:"prevMonthButton","aria-label":e.previousMonthAriaLabel,circle:!0,importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeMonth(-1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevron-left",{attrs:{size:"200"}})],1)]},proxy:!0}])})],1),t("div",{staticClass:"d-datepicker__month-year-title",attrs:{id:"calendar-heading"}},[e._v(" "+e._s(e.formattedMonth(e.selectMonth))+" "+e._s(e.selectYear)+" ")]),t("dt-stack",{staticClass:"d-datepicker__nav",attrs:{as:"nav",direction:"row",gap:"200"}},[t("dt-tooltip",{attrs:{"fallback-placements":["top-end","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_NEXT_MONTH"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[2],staticClass:"d-datepicker__nav-btn",attrs:{id:"nextMonthButton","aria-label":e.nextMonthAriaLabel,circle:!0,importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeMonth(1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevron-right",{attrs:{size:"200"}})],1)]},proxy:!0}])}),t("dt-tooltip",{attrs:{"fallback-placements":["top-end","auto"],message:e.i18n.$t("DIALTONE_DATEPICKER_NEXT_YEAR"),placement:"top"},scopedSlots:e._u([{key:"anchor",fn:function(){return[t("dt-button",{ref:e.refNames[3],staticClass:"d-datepicker__nav-btn",attrs:{id:"nextYearButton","aria-label":e.nextYearAriaLabel,circle:!0,importance:"clear",kind:"muted",size:"xs",type:"button"},on:{click:function(a){return e.changeYear(1)},keydown:function(a){return e.handleKeyDown(a)}}},[t("dt-icon-chevrons-right",{attrs:{size:"200"}})],1)]},proxy:!0}])})],1)],1)},$=[],v=d.n(k,m,$);const R=v.exports,b={name:"DtDatepickerCalendar",components:{DtButton:f.default},mixins:[D.default],props:{calendarDays:{type:Array,required:!0}},emits:["select-date","focus-month-year-picker","close-datepicker"],data(){return{selectedDay:null,focusDay:0,daysRef:[]}},computed:{weekDays(){return i.getWeekDayNames(this.i18n.currentLocale,u.WEEK_START)}},watch:{calendarDays(){this.focusDay=0,this.selectedDay=null,this.daysRef=[],this.$nextTick(()=>{this.daysRef=[],this.setDayRef()})}},methods:{dayAriaLabel(s){return this.i18n.$t("DIALTONE_DATEPICKER_SELECT_DAY")+` ${i.formatDate(s.value,u.INTL_MONTH_FORMAT,this.i18n.currentLocale)}`},setDayRef(s,e){this.calendarDays.forEach((t,a)=>{t.days.forEach((c,r)=>{const l=`buttonRef_${a}_${r}`,o=this.$refs[l];o&&c.currentMonth&&this.daysRef.push({el:o[0],day:c})})})},handleKeyDown(s){switch(s.key){case"ArrowUp":s.preventDefault(),this.focusDay-=7;try{this.daysRef[this.focusDay].el.$el.focus()}catch{const t=i.calculatePrevFocusDate(this.daysRef[this.focusDay+7].day.value);this.$emit("go-to-prev-month"),this.$nextTick(()=>{this.setDayRef(),this.daysRef[t-1].el.$el.focus(),this.focusDay+=t-1})}break;case"ArrowDown":s.preventDefault(),this.focusDay+=7;try{this.daysRef[this.focusDay].el.$el.focus()}catch{const t=i.calculateNextFocusDate(this.daysRef[this.focusDay-7].day.value);this.$emit("go-to-next-month"),this.$nextTick(()=>{this.setDayRef(),this.daysRef[t-1].el.$el.focus(),this.focusDay+=t-1})}break;case"ArrowLeft":s.preventDefault(),this.focusDay>0?(this.focusDay-=1,this.daysRef[this.focusDay].el.$el.focus()):(this.$emit("go-to-prev-month"),this.$nextTick(()=>{this.focusLastDay()}));break;case"ArrowRight":s.preventDefault(),this.focusDay<this.daysRef.length-1?(this.focusDay+=1,this.daysRef[this.focusDay].el.$el.focus()):(this.$emit("go-to-next-month"),this.$nextTick(()=>{this.focusFirstDay()}));break;case"Tab":s.preventDefault(),this.$emit("focus-month-year-picker");break;case"Escape":this.$emit("close-datepicker");break}},focusFirstDay(){this.focusDay=0,this.$nextTick(()=>{this.daysRef[this.focusDay].el.$el.focus()})},focusLastDay(){this.$nextTick(()=>{this.focusDay=this.daysRef.length-1,this.daysRef[this.focusDay].el.$el.focus()})},selectDay(s){s.currentMonth&&(this.selectedDay=s.text,this.$emit("select-date",s.value))}}};var g=function(){var e=this,t=e._self._c;return t("table",{staticClass:"d-datepicker__calendar",attrs:{"aria-labelledby":"calendar-heading"}},[t("thead",[t("tr",e._l(e.weekDays,function(a){return t("th",{key:a,staticClass:"d-datepicker__cell d-datepicker__cell--header",attrs:{scope:"col"}},[t("span",{staticClass:"d-datepicker__weekday",attrs:{title:a,"aria-label":a}},[e._v(" "+e._s(a))])])}),0)]),t("tbody",e._l(e.calendarDays,function(a,c){return t("tr",{key:c},e._l(a.days,function(r,l){return t("td",{key:c+l,staticClass:"d-datepicker__cell",attrs:{role:"listbox"}},[t("dt-button",{ref:`buttonRef_${c}_${l}`,refInFor:!0,staticClass:"d-datepicker__day",class:{"d-datepicker__day--disabled":!r.currentMonth,"d-datepicker__day--selected":e.selectedDay?r.text===e.selectedDay&&r.currentMonth:r.selected},attrs:{circle:!0,size:"sm",importance:"clear",disabled:!r.currentMonth,type:"button","aria-selected":e.selectedDay?r.text===e.selectedDay&&r.currentMonth:r.selected,"aria-label":e.dayAriaLabel(r),role:"option"},on:{click:function(o){return e.selectDay(r)},keydown:function(o){return e.handleKeyDown(o)}}},[e._v(" "+e._s(r.text)+" ")])],1)}),0)}),0)])},E=[],T=d.n(b,g,E);const M=T.exports,A={name:"DtDatepicker",components:{DtStack:_.default,MonthYearPicker:R,Calendar:M},props:{selectedDate:{type:Date,default:()=>new Date}},emits:["selected-date","close-datepicker"],data(){return{calendarDays:[]}},mounted(){y.warnIfUnmounted(this.$el,this.$options.name)},methods:{updateCalendarDays(s){this.calendarDays=s}}};var C=function(){var e=this,t=e._self._c;return t("dt-stack",{staticClass:"d-datepicker",attrs:{gap:"400"}},[t("div",{staticClass:"d-datepicker__hd"},[t("month-year-picker",{ref:"monthYearPicker",attrs:{"selected-date":e.selectedDate},on:{"calendar-days":e.updateCalendarDays,"focus-first-day":function(a){return e.$refs.calendar.focusFirstDay()},"focus-last-day":function(a){return e.$refs.calendar.focusLastDay()},"close-datepicker":function(a){return e.$emit("close-datepicker")}}})],1),t("div",{staticClass:"d-datepicker__bd"},[t("calendar",{ref:"calendar",attrs:{"calendar-days":e.calendarDays},on:{"select-date":function(a){return e.$emit("selected-date",a)},"focus-month-year-picker":function(a){return e.$refs.monthYearPicker.focusMonthYearPicker()},"close-datepicker":function(a){return e.$emit("close-datepicker")},"go-to-next-month":function(a){return e.$refs.monthYearPicker.goToNextMonth()},"go-to-prev-month":function(a){return e.$refs.monthYearPicker.goToPrevMonth()}}})],1)])},I=[],P=d.n(A,C,I);const x=P.exports;exports.default=x;
|
|
2
2
|
//# sourceMappingURL=datepicker.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker.cjs","sources":["../../../components/datepicker/modules/month-year-picker.vue","../../../components/datepicker/modules/calendar.vue","../../../components/datepicker/datepicker.vue"],"sourcesContent":["<template>\n <dt-stack\n class=\"d-datepicker__month-year\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-stack\n as=\"nav\"\n class=\"d-datepicker__nav\"\n direction=\"row\"\n gap=\"200\"\n >\n <dt-tooltip\n :fallback-placements=\"['top-start', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_YEAR')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevYearButton\"\n :ref=\"refNames[0]\"\n :aria-label=\"previousYearAriaLabel\"\n circle\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeYear(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevrons-left\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :fallback-placements=\"['top-start', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_MONTH')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevMonthButton\"\n :ref=\"refNames[1]\"\n :aria-label=\"previousMonthAriaLabel\"\n circle\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeMonth(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevron-left\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n <div\n id=\"calendar-heading\"\n class=\"d-datepicker__month-year-title\"\n >\n {{ formattedMonth(selectMonth) }}\n\n {{ selectYear }}\n </div>\n <dt-stack\n as=\"nav\"\n class=\"d-datepicker__nav\"\n direction=\"row\"\n gap=\"200\"\n >\n <dt-tooltip\n :fallback-placements=\"['top-end', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_NEXT_MONTH')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextMonthButton\"\n :ref=\"refNames[2]\"\n :aria-label=\"nextMonthAriaLabel\"\n circle\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeMonth(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevron-right\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :fallback-placements=\"['top-end', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_NEXT_YEAR')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextYearButton\"\n :ref=\"refNames[3]\"\n :aria-label=\"nextYearAriaLabel\"\n circle\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeYear(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevrons-right\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n </dt-stack>\n</template>\n\n<script>\nimport {\n DtIconChevronLeft,\n DtIconChevronsLeft,\n DtIconChevronRight,\n DtIconChevronsRight,\n} from '@dialpad/dialtone-icons/vue2';\nimport { getYear, addMonths, getMonth, set, subMonths, getDate } from 'date-fns';\nimport { getCalendarDays, formatMonth } from '../utils';\nimport { INTL_MONTH_FORMAT } from '../datepicker_constants';\nimport { DtStack } from '@/components/stack';\nimport { DtTooltip } from '@/components/tooltip';\nimport { DtButton } from '@/components/button';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtDatepickerMonthYearPicker',\n\n components: {\n DtButton,\n DtTooltip,\n DtStack,\n DtIconChevronLeft,\n DtIconChevronsLeft,\n DtIconChevronRight,\n DtIconChevronsRight,\n },\n\n mixins: [DtLocalizationMixin],\n\n props: {\n selectedDate: {\n type: Date,\n required: true,\n },\n },\n\n emits: [\n /**\n * Will retrieve the calendar days of the given date\n *\n * @event calendar-days\n * @type {Array}\n */\n 'calendar-days',\n\n /**\n * Will focus first day in calendar\n *\n * @event focus-first-day\n */\n 'focus-first-day',\n\n /**\n * Will focus last day in calendar\n *\n * @event focus-last-day\n */\n 'focus-last-day',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n selectMonth: getMonth(this.selectedDate),\n selectYear: getYear(this.selectedDate),\n highlightedDay: null,\n focusPicker: 0,\n focusRefs: [],\n refNames: ['prevYearButtonRef', 'prevMonthButtonRef', 'nextMonthButtonRef', 'nextYearButtonRef'],\n };\n },\n\n computed: {\n // Get days for the currently selected month and year and highlight the selected day\n calendarDays () {\n return getCalendarDays(this.selectMonth, this.selectYear, this.highlightedDay);\n },\n\n formattedMonth () {\n return (month) => formatMonth(month, INTL_MONTH_FORMAT, this.i18n.currentLocale);\n },\n\n previousYearAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_YEAR')} ${this.selectYear - 1}`;\n },\n\n previousMonthAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_MONTH')} ${this.formattedMonth(this.selectMonth - 1)}`;\n },\n\n nextYearAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_NEXT_YEAR')} ${this.selectYear + 1}`;\n },\n\n nextMonthAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_NEXT_MONTH')} ${this.formattedMonth(this.selectMonth + 1)}`;\n },\n },\n\n watch: {\n selectMonth: {\n handler () {\n this.highlightDay();\n this.$emit('calendar-days', this.calendarDays);\n },\n\n immediate: true,\n },\n\n selectYear: {\n handler () {\n this.highlightDay();\n this.$emit('calendar-days', this.calendarDays);\n },\n\n immediate: true,\n },\n\n },\n\n mounted () {\n this.setButtonsRef();\n this.focusMonthYearPicker();\n },\n\n methods: {\n setButtonsRef () {\n this.focusRefs = this.refNames.map(refName => this.$refs[refName]);\n },\n\n focusMonthYearPicker () {\n this.focusPicker = 0;\n this.focusRefs[0].$el.focus();\n },\n\n handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n if (this.focusPicker === 0) {\n this.focusPicker = 3;\n this.focusRefs[this.focusPicker].$el.focus();\n } else {\n this.focusPicker--;\n this.focusRefs[this.focusPicker].$el.focus();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (this.focusPicker === 3) {\n this.focusPicker = 0;\n this.focusRefs[this.focusPicker].$el.focus();\n } else {\n this.focusPicker++;\n this.focusRefs[this.focusPicker].$el.focus();\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n this.$emit('focus-first-day');\n break;\n\n case 'Tab':\n event.preventDefault();\n this.$emit('focus-first-day');\n break;\n\n case 'Escape':\n this.$emit('close-datepicker');\n break;\n }\n },\n\n highlightDay () {\n const year = getYear(this.selectedDate);\n const month = getMonth(this.selectedDate);\n\n if (year !== this.selectYear || month !== this.selectMonth) {\n this.highlightedDay = null;\n } else {\n this.highlightedDay = getDate(this.selectedDate);\n }\n },\n\n changeMonth (value) {\n // Adjust year when changing from January to December or vice versa\n if ((this.selectMonth === 0 && value === -1) || (this.selectMonth === 11 && value === 1)) {\n this.selectYear += value;\n }\n\n // Calculate the new date by adding or subtracting months\n const initialDate = set(this.selectedDate, { month: this.selectMonth, year: this.selectYear });\n const newDate = value === 1 ? addMonths(initialDate, 1) : subMonths(initialDate, 1);\n\n // Update the selected month\n this.selectMonth = getMonth(newDate);\n },\n\n changeYear (value) {\n this.selectYear = this.selectYear + value;\n },\n\n goToNextMonth () {\n this.changeMonth(1);\n },\n\n goToPrevMonth () {\n this.changeMonth(-1);\n },\n },\n};\n</script>\n","<template>\n <table\n class=\"d-datepicker__calendar\"\n aria-labelledby=\"calendar-heading\"\n >\n <thead>\n <tr>\n <th\n v-for=\"day in weekDays\"\n :key=\"day\"\n scope=\"col\"\n class=\"d-datepicker__cell d-datepicker__cell--header\"\n >\n <span\n class=\"d-datepicker__weekday\"\n :title=\"day\"\n :aria-label=\"day\"\n > {{ day }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(week, indexWeek) in calendarDays\"\n :key=\"indexWeek\"\n >\n <td\n v-for=\"(day, indexDays) in week.days\"\n :key=\"indexWeek + indexDays\"\n class=\"d-datepicker__cell\"\n role=\"listbox\"\n >\n <dt-button\n :ref=\"`buttonRef_${indexWeek}_${indexDays}`\"\n class=\"d-datepicker__day\"\n :circle=\"true\"\n size=\"sm\"\n importance=\"clear\"\n :disabled=\"!day.currentMonth\"\n :class=\"{\n 'd-datepicker__day--disabled': !day.currentMonth,\n 'd-datepicker__day--selected': selectedDay\n ? ((day.text === selectedDay) && day.currentMonth)\n : day.selected,\n }\"\n type=\"button\"\n :aria-selected=\"!!selectedDay ? ((day.text === selectedDay) && day.currentMonth) : day.selected\"\n :aria-label=\"dayAriaLabel(day)\"\n role=\"option\"\n @click=\"selectDay(day)\"\n @keydown=\"handleKeyDown($event)\"\n >\n {{ day.text }}\n </dt-button>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script>\nimport { getWeekDayNames, calculateNextFocusDate, calculatePrevFocusDate, formatDate } from '../utils';\nimport { WEEK_START, INTL_MONTH_FORMAT } from '../datepicker_constants.js';\nimport { DtButton } from '@/components/button';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtDatepickerCalendar',\n components: { DtButton },\n\n mixins: [DtLocalizationMixin],\n\n props: {\n calendarDays: {\n type: Array,\n required: true,\n },\n },\n\n emits: [\n /**\n * Event fired when a date is selected\n *\n * @event select-date\n * @type {Date}\n */\n 'select-date',\n\n /**\n * Will focus the month and year picker\n *\n * @event focus-month-year-picker\n */\n 'focus-month-year-picker',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n // local selectedDay to override the received by props calendarDays\n selectedDay: null,\n focusDay: 0,\n daysRef: [],\n };\n },\n\n computed: {\n weekDays () {\n return getWeekDayNames(this.i18n.currentLocale, WEEK_START);\n },\n },\n\n watch: {\n calendarDays () {\n // on calendarDays update, reset our local variables\n this.focusDay = 0;\n this.selectedDay = null;\n\n this.daysRef = [];\n\n this.$nextTick(() => {\n this.daysRef = [];\n this.setDayRef();\n });\n },\n },\n\n methods: {\n dayAriaLabel (day) {\n return this.i18n.$t('DIALTONE_DATEPICKER_SELECT_DAY') + ` ${formatDate(day.value, INTL_MONTH_FORMAT, this.i18n.currentLocale)}`;\n },\n\n setDayRef (el, day) {\n this.calendarDays.forEach((week, weekIndex) => {\n week.days.forEach((day, dayIndex) => {\n const refKey = `buttonRef_${weekIndex}_${dayIndex}`;\n const dayButton = this.$refs[refKey];\n if (dayButton && day.currentMonth) {\n this.daysRef.push({ el: dayButton[0], day });\n }\n });\n });\n },\n\n handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault();\n this.focusDay -= 7;\n try {\n this.daysRef[this.focusDay].el.$el.focus();\n } catch (error) {\n const prevFocusDate = calculatePrevFocusDate(this.daysRef[this.focusDay + 7].day.value);\n this.$emit('go-to-prev-month');\n this.$nextTick(() => {\n this.setDayRef();\n this.daysRef[prevFocusDate - 1].el.$el.focus();\n this.focusDay += prevFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n this.focusDay += 7;\n try {\n this.daysRef[this.focusDay].el.$el.focus();\n } catch (error) {\n const nextFocusDate = calculateNextFocusDate(this.daysRef[this.focusDay - 7].day.value);\n this.$emit('go-to-next-month');\n this.$nextTick(() => {\n this.setDayRef();\n this.daysRef[nextFocusDate - 1].el.$el.focus();\n this.focusDay += nextFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowLeft':\n event.preventDefault();\n if (this.focusDay > 0) {\n this.focusDay -= 1;\n this.daysRef[this.focusDay].el.$el.focus();\n } else {\n // if we are on month first day, jump to last day of prev month\n this.$emit('go-to-prev-month');\n this.$nextTick(() => {\n this.focusLastDay();\n });\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (this.focusDay < this.daysRef.length - 1) {\n this.focusDay += 1;\n this.daysRef[this.focusDay].el.$el.focus();\n } else {\n // if we are on month last day, jump to first day of next month\n this.$emit('go-to-next-month');\n this.$nextTick(() => {\n this.focusFirstDay();\n });\n }\n break;\n\n case 'Tab':\n event.preventDefault();\n this.$emit('focus-month-year-picker');\n break;\n\n case 'Escape':\n this.$emit('close-datepicker');\n break;\n }\n },\n\n focusFirstDay () {\n this.focusDay = 0;\n this.$nextTick(() => {\n this.daysRef[this.focusDay].el.$el.focus();\n });\n },\n\n focusLastDay () {\n this.$nextTick(() => {\n this.focusDay = this.daysRef.length - 1;\n this.daysRef[this.focusDay].el.$el.focus();\n });\n },\n\n selectDay (day) {\n if (!day.currentMonth) { return; }\n\n // local selectedDay is updated when a day is selected\n this.selectedDay = day.text;\n this.$emit('select-date', day.value);\n },\n },\n};\n</script>\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-stack\n class=\"d-datepicker\"\n gap=\"400\"\n >\n <div class=\"d-datepicker__hd\">\n <month-year-picker\n ref=\"monthYearPicker\"\n :selected-date=\"selectedDate\"\n @calendar-days=\"updateCalendarDays\"\n @focus-first-day=\"$refs.calendar.focusFirstDay()\"\n @focus-last-day=\"$refs.calendar.focusLastDay()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n />\n </div>\n <div class=\"d-datepicker__bd\">\n <calendar\n ref=\"calendar\"\n :calendar-days=\"calendarDays\"\n @select-date=\"$emit('selected-date', $event)\"\n @focus-month-year-picker=\"$refs.monthYearPicker.focusMonthYearPicker()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n @go-to-next-month=\"$refs.monthYearPicker.goToNextMonth()\"\n @go-to-prev-month=\"$refs.monthYearPicker.goToPrevMonth()\"\n />\n </div>\n </dt-stack>\n</template>\n\n<script>\nimport MonthYearPicker from './modules/month-year-picker.vue';\nimport Calendar from './modules/calendar.vue';\nimport { DtStack } from '@/components/stack';\nimport { warnIfUnmounted } from '@/common/utils';\n\nexport default {\n name: 'DtDatepicker',\n\n components: { DtStack, MonthYearPicker, Calendar },\n\n props: {\n /**\n * Selected date\n *\n * @type {Date}\n */\n selectedDate: {\n type: Date,\n default: () => (new Date()),\n },\n },\n\n emits: [\n /**\n * Event fired when a date is selected\n *\n * @event selected-date\n * @type {Date}\n */\n 'selected-date',\n\n /**\n * Event fired when user presses the esc key\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n calendarDays: [],\n };\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n updateCalendarDays (days) {\n this.calendarDays = days;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtTooltip","DtStack","DtIconChevronLeft","DtIconChevronsLeft","DtIconChevronRight","DtIconChevronsRight","DtLocalizationMixin","getMonth","getYear","getCalendarDays","month","formatMonth","INTL_MONTH_FORMAT","refName","event","year","getDate","value","initialDate","set","newDate","addMonths","subMonths","getWeekDayNames","WEEK_START","day","formatDate","el","week","weekIndex","dayIndex","refKey","dayButton","prevFocusDate","calculatePrevFocusDate","nextFocusDate","calculateNextFocusDate","MonthYearPicker","Calendar","warnIfUnmounted","days"],"mappings":"6eAkJAA,EAAA,CACA,KAAA,8BAEA,WAAA,CACA,SAAAC,EAAA,QACA,UAAAC,EAAA,QACA,QAAAC,EAAA,QACA,kBAAAC,EAAA,kBACA,mBAAAC,EAAA,mBACA,mBAAAC,EAAA,mBACA,oBAAAC,EAAA,mBACA,EAEA,OAAA,CAAAC,EAAAA,OAAA,EAEA,MAAA,CACA,aAAA,CACA,KAAA,KACA,SAAA,EACA,CACA,EAEA,MAAA,CAOA,gBAOA,kBAOA,iBAOA,kBACA,EAEA,MAAA,CACA,MAAA,CACA,YAAAC,EAAAA,SAAA,KAAA,YAAA,EACA,WAAAC,EAAAA,QAAA,KAAA,YAAA,EACA,eAAA,KACA,YAAA,EACA,UAAA,CAAA,EACA,SAAA,CAAA,oBAAA,qBAAA,qBAAA,mBAAA,CACA,CACA,EAEA,SAAA,CAEA,cAAA,CACA,OAAAC,EAAAA,gBAAA,KAAA,YAAA,KAAA,WAAA,KAAA,cAAA,CACA,EAEA,gBAAA,CACA,OAAAC,GAAAC,EAAAA,YAAAD,EAAAE,EAAA,kBAAA,KAAA,KAAA,aAAA,CACA,EAEA,uBAAA,CACA,MAAA,GAAA,KAAA,KAAA,GAAA,+BAAA,CAAA,IAAA,KAAA,KAAA,GAAA,mCAAA,CAAA,IAAA,KAAA,WAAA,CAAA,EACA,EAEA,wBAAA,CACA,MAAA,GAAA,KAAA,KAAA,GAAA,+BAAA,CAAA,IAAA,KAAA,KAAA,GAAA,oCAAA,CAAA,IAAA,KAAA,eAAA,KAAA,YAAA,CAAA,CAAA,EACA,EAEA,mBAAA,CACA,MAAA,GAAA,KAAA,KAAA,GAAA,+BAAA,CAAA,IAAA,KAAA,KAAA,GAAA,+BAAA,CAAA,IAAA,KAAA,WAAA,CAAA,EACA,EAEA,oBAAA,CACA,MAAA,GAAA,KAAA,KAAA,GAAA,+BAAA,CAAA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,GACA,KAAA,UAAA,EACA,KAAA,QAAA,KAAA,QAAA,EAAA,GAAA,IAAA,UAGA,KAAA,MAAA,kBAAA,EACA,KAAA,UAAA,IAAA,CACA,KAAA,cAAA,CACA,CAAA,GAEA,MAEA,IAAA,MACAA,EAAA,eAAA,EACA,KAAA,MAAA,yBAAA,EACA,MAEA,IAAA,SACA,KAAA,MAAA,kBAAA,EACA,KACA,CACA,EAEA,eAAA,CACA,KAAA,SAAA,EACA,KAAA,UAAA,IAAA,CACA,KAAA,QAAA,KAAA,QAAA,EAAA,GAAA,IAAA,OACA,CAAA,CACA,EAEA,cAAA,CACA,KAAA,UAAA,IAAA,CACA,KAAA,SAAA,KAAA,QAAA,OAAA,EACA,KAAA,QAAA,KAAA,QAAA,EAAA,GAAA,IAAA,OACA,CAAA,CACA,EAEA,UAAAW,EAAA,CACAA,EAAA,eAGA,KAAA,YAAAA,EAAA,KACA,KAAA,MAAA,cAAAA,EAAA,KAAA,EACA,CACA,CACA,4qCCjNA3B,EAAA,CACA,KAAA,eAEA,WAAA,CAAAG,QAAAA,EAAAA,QAAA,gBAAAoC,EAAA,SAAAC,CAAA,EAEA,MAAA,CAMA,aAAA,CACA,KAAA,KACA,QAAA,IAAA,IAAA,IACA,CACA,EAEA,MAAA,CAOA,gBAOA,kBACA,EAEA,MAAA,CACA,MAAA,CACA,aAAA,CAAA,CACA,CACA,EAEA,SAAA,CACAC,EAAA,gBAAA,KAAA,IAAA,KAAA,SAAA,IAAA,CACA,EAEA,QAAA,CACA,mBAAAC,EAAA,CACA,KAAA,aAAAA,CACA,CACA,CACA"}
|
|
1
|
+
{"version":3,"file":"datepicker.cjs","sources":["../../../components/datepicker/modules/month-year-picker.vue","../../../components/datepicker/modules/calendar.vue","../../../components/datepicker/datepicker.vue"],"sourcesContent":["<template>\n <dt-stack\n class=\"d-datepicker__month-year\"\n direction=\"row\"\n gap=\"300\"\n >\n <dt-stack\n as=\"nav\"\n class=\"d-datepicker__nav\"\n direction=\"row\"\n gap=\"200\"\n >\n <dt-tooltip\n :fallback-placements=\"['top-start', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_YEAR')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevYearButton\"\n :ref=\"refNames[0]\"\n :aria-label=\"previousYearAriaLabel\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeYear(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevrons-left\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :fallback-placements=\"['top-start', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_MONTH')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"prevMonthButton\"\n :ref=\"refNames[1]\"\n :aria-label=\"previousMonthAriaLabel\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeMonth(-1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevron-left\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n <div\n id=\"calendar-heading\"\n class=\"d-datepicker__month-year-title\"\n >\n {{ formattedMonth(selectMonth) }}\n\n {{ selectYear }}\n </div>\n <dt-stack\n as=\"nav\"\n class=\"d-datepicker__nav\"\n direction=\"row\"\n gap=\"200\"\n >\n <dt-tooltip\n :fallback-placements=\"['top-end', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_NEXT_MONTH')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextMonthButton\"\n :ref=\"refNames[2]\"\n :aria-label=\"nextMonthAriaLabel\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeMonth(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevron-right\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n <dt-tooltip\n :fallback-placements=\"['top-end', 'auto']\"\n :message=\"i18n.$t('DIALTONE_DATEPICKER_NEXT_YEAR')\"\n placement=\"top\"\n >\n <template #anchor>\n <dt-button\n id=\"nextYearButton\"\n :ref=\"refNames[3]\"\n :aria-label=\"nextYearAriaLabel\"\n :circle=\"true\"\n class=\"d-datepicker__nav-btn\"\n importance=\"clear\"\n kind=\"muted\"\n size=\"xs\"\n type=\"button\"\n @click=\"changeYear(1)\"\n @keydown=\"handleKeyDown($event)\"\n >\n <dt-icon-chevrons-right\n size=\"200\"\n />\n </dt-button>\n </template>\n </dt-tooltip>\n </dt-stack>\n </dt-stack>\n</template>\n\n<script>\nimport {\n DtIconChevronLeft,\n DtIconChevronsLeft,\n DtIconChevronRight,\n DtIconChevronsRight,\n} from '@dialpad/dialtone-icons/vue2';\nimport { getYear, addMonths, getMonth, set, subMonths, getDate } from 'date-fns';\nimport { getCalendarDays, formatMonth } from '../utils';\nimport { INTL_MONTH_FORMAT } from '../datepicker_constants';\nimport { DtStack } from '@/components/stack';\nimport { DtTooltip } from '@/components/tooltip';\nimport { DtButton } from '@/components/button';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtDatepickerMonthYearPicker',\n\n components: {\n DtButton,\n DtTooltip,\n DtStack,\n DtIconChevronLeft,\n DtIconChevronsLeft,\n DtIconChevronRight,\n DtIconChevronsRight,\n },\n\n mixins: [DtLocalizationMixin],\n\n props: {\n selectedDate: {\n type: Date,\n required: true,\n },\n },\n\n emits: [\n /**\n * Will retrieve the calendar days of the given date\n *\n * @event calendar-days\n * @type {Array}\n */\n 'calendar-days',\n\n /**\n * Will focus first day in calendar\n *\n * @event focus-first-day\n */\n 'focus-first-day',\n\n /**\n * Will focus last day in calendar\n *\n * @event focus-last-day\n */\n 'focus-last-day',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n selectMonth: getMonth(this.selectedDate),\n selectYear: getYear(this.selectedDate),\n highlightedDay: null,\n focusPicker: 0,\n focusRefs: [],\n refNames: ['prevYearButtonRef', 'prevMonthButtonRef', 'nextMonthButtonRef', 'nextYearButtonRef'],\n };\n },\n\n computed: {\n // Get days for the currently selected month and year and highlight the selected day\n calendarDays () {\n return getCalendarDays(this.selectMonth, this.selectYear, this.highlightedDay);\n },\n\n formattedMonth () {\n return (month) => formatMonth(month, INTL_MONTH_FORMAT, this.i18n.currentLocale);\n },\n\n previousYearAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_YEAR')} ${this.selectYear - 1}`;\n },\n\n previousMonthAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_PREVIOUS_MONTH')} ${this.formattedMonth(this.selectMonth - 1)}`;\n },\n\n nextYearAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_NEXT_YEAR')} ${this.selectYear + 1}`;\n },\n\n nextMonthAriaLabel () {\n return `${this.i18n.$t('DIALTONE_DATEPICKER_CHANGE_TO')} ${this.i18n.$t('DIALTONE_DATEPICKER_NEXT_MONTH')} ${this.formattedMonth(this.selectMonth + 1)}`;\n },\n },\n\n watch: {\n selectMonth: {\n handler () {\n this.highlightDay();\n this.$emit('calendar-days', this.calendarDays);\n },\n\n immediate: true,\n },\n\n selectYear: {\n handler () {\n this.highlightDay();\n this.$emit('calendar-days', this.calendarDays);\n },\n\n immediate: true,\n },\n\n },\n\n mounted () {\n this.setButtonsRef();\n this.focusMonthYearPicker();\n },\n\n methods: {\n setButtonsRef () {\n this.focusRefs = this.refNames.map(refName => this.$refs[refName]);\n },\n\n focusMonthYearPicker () {\n this.focusPicker = 0;\n this.focusRefs[0].$el.focus();\n },\n\n handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault();\n if (this.focusPicker === 0) {\n this.focusPicker = 3;\n this.focusRefs[this.focusPicker].$el.focus();\n } else {\n this.focusPicker--;\n this.focusRefs[this.focusPicker].$el.focus();\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (this.focusPicker === 3) {\n this.focusPicker = 0;\n this.focusRefs[this.focusPicker].$el.focus();\n } else {\n this.focusPicker++;\n this.focusRefs[this.focusPicker].$el.focus();\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n this.$emit('focus-first-day');\n break;\n\n case 'Tab':\n event.preventDefault();\n this.$emit('focus-first-day');\n break;\n\n case 'Escape':\n this.$emit('close-datepicker');\n break;\n }\n },\n\n highlightDay () {\n const year = getYear(this.selectedDate);\n const month = getMonth(this.selectedDate);\n\n if (year !== this.selectYear || month !== this.selectMonth) {\n this.highlightedDay = null;\n } else {\n this.highlightedDay = getDate(this.selectedDate);\n }\n },\n\n changeMonth (value) {\n // Adjust year when changing from January to December or vice versa\n if ((this.selectMonth === 0 && value === -1) || (this.selectMonth === 11 && value === 1)) {\n this.selectYear += value;\n }\n\n // Calculate the new date by adding or subtracting months\n const initialDate = set(this.selectedDate, { month: this.selectMonth, year: this.selectYear });\n const newDate = value === 1 ? addMonths(initialDate, 1) : subMonths(initialDate, 1);\n\n // Update the selected month\n this.selectMonth = getMonth(newDate);\n },\n\n changeYear (value) {\n this.selectYear = this.selectYear + value;\n },\n\n goToNextMonth () {\n this.changeMonth(1);\n },\n\n goToPrevMonth () {\n this.changeMonth(-1);\n },\n },\n};\n</script>\n","<template>\n <table\n class=\"d-datepicker__calendar\"\n aria-labelledby=\"calendar-heading\"\n >\n <thead>\n <tr>\n <th\n v-for=\"day in weekDays\"\n :key=\"day\"\n scope=\"col\"\n class=\"d-datepicker__cell d-datepicker__cell--header\"\n >\n <span\n class=\"d-datepicker__weekday\"\n :title=\"day\"\n :aria-label=\"day\"\n > {{ day }}</span>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(week, indexWeek) in calendarDays\"\n :key=\"indexWeek\"\n >\n <td\n v-for=\"(day, indexDays) in week.days\"\n :key=\"indexWeek + indexDays\"\n class=\"d-datepicker__cell\"\n role=\"listbox\"\n >\n <dt-button\n :ref=\"`buttonRef_${indexWeek}_${indexDays}`\"\n class=\"d-datepicker__day\"\n :circle=\"true\"\n size=\"sm\"\n importance=\"clear\"\n :disabled=\"!day.currentMonth\"\n :class=\"{\n 'd-datepicker__day--disabled': !day.currentMonth,\n 'd-datepicker__day--selected': selectedDay\n ? ((day.text === selectedDay) && day.currentMonth)\n : day.selected,\n }\"\n type=\"button\"\n :aria-selected=\"!!selectedDay ? ((day.text === selectedDay) && day.currentMonth) : day.selected\"\n :aria-label=\"dayAriaLabel(day)\"\n role=\"option\"\n @click=\"selectDay(day)\"\n @keydown=\"handleKeyDown($event)\"\n >\n {{ day.text }}\n </dt-button>\n </td>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script>\nimport { getWeekDayNames, calculateNextFocusDate, calculatePrevFocusDate, formatDate } from '../utils';\nimport { WEEK_START, INTL_MONTH_FORMAT } from '../datepicker_constants.js';\nimport { DtButton } from '@/components/button';\nimport { DtLocalizationMixin } from '@/common/mixins';\n\nexport default {\n name: 'DtDatepickerCalendar',\n components: { DtButton },\n\n mixins: [DtLocalizationMixin],\n\n props: {\n calendarDays: {\n type: Array,\n required: true,\n },\n },\n\n emits: [\n /**\n * Event fired when a date is selected\n *\n * @event select-date\n * @type {Date}\n */\n 'select-date',\n\n /**\n * Will focus the month and year picker\n *\n * @event focus-month-year-picker\n */\n 'focus-month-year-picker',\n\n /**\n * Will close the datepicker\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n // local selectedDay to override the received by props calendarDays\n selectedDay: null,\n focusDay: 0,\n daysRef: [],\n };\n },\n\n computed: {\n weekDays () {\n return getWeekDayNames(this.i18n.currentLocale, WEEK_START);\n },\n },\n\n watch: {\n calendarDays () {\n // on calendarDays update, reset our local variables\n this.focusDay = 0;\n this.selectedDay = null;\n\n this.daysRef = [];\n\n this.$nextTick(() => {\n this.daysRef = [];\n this.setDayRef();\n });\n },\n },\n\n methods: {\n dayAriaLabel (day) {\n return this.i18n.$t('DIALTONE_DATEPICKER_SELECT_DAY') + ` ${formatDate(day.value, INTL_MONTH_FORMAT, this.i18n.currentLocale)}`;\n },\n\n setDayRef (el, day) {\n this.calendarDays.forEach((week, weekIndex) => {\n week.days.forEach((day, dayIndex) => {\n const refKey = `buttonRef_${weekIndex}_${dayIndex}`;\n const dayButton = this.$refs[refKey];\n if (dayButton && day.currentMonth) {\n this.daysRef.push({ el: dayButton[0], day });\n }\n });\n });\n },\n\n handleKeyDown (event) {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault();\n this.focusDay -= 7;\n try {\n this.daysRef[this.focusDay].el.$el.focus();\n } catch (error) {\n const prevFocusDate = calculatePrevFocusDate(this.daysRef[this.focusDay + 7].day.value);\n this.$emit('go-to-prev-month');\n this.$nextTick(() => {\n this.setDayRef();\n this.daysRef[prevFocusDate - 1].el.$el.focus();\n this.focusDay += prevFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowDown':\n event.preventDefault();\n this.focusDay += 7;\n try {\n this.daysRef[this.focusDay].el.$el.focus();\n } catch (error) {\n const nextFocusDate = calculateNextFocusDate(this.daysRef[this.focusDay - 7].day.value);\n this.$emit('go-to-next-month');\n this.$nextTick(() => {\n this.setDayRef();\n this.daysRef[nextFocusDate - 1].el.$el.focus();\n this.focusDay += nextFocusDate - 1;\n });\n }\n break;\n\n case 'ArrowLeft':\n event.preventDefault();\n if (this.focusDay > 0) {\n this.focusDay -= 1;\n this.daysRef[this.focusDay].el.$el.focus();\n } else {\n // if we are on month first day, jump to last day of prev month\n this.$emit('go-to-prev-month');\n this.$nextTick(() => {\n this.focusLastDay();\n });\n }\n break;\n\n case 'ArrowRight':\n event.preventDefault();\n if (this.focusDay < this.daysRef.length - 1) {\n this.focusDay += 1;\n this.daysRef[this.focusDay].el.$el.focus();\n } else {\n // if we are on month last day, jump to first day of next month\n this.$emit('go-to-next-month');\n this.$nextTick(() => {\n this.focusFirstDay();\n });\n }\n break;\n\n case 'Tab':\n event.preventDefault();\n this.$emit('focus-month-year-picker');\n break;\n\n case 'Escape':\n this.$emit('close-datepicker');\n break;\n }\n },\n\n focusFirstDay () {\n this.focusDay = 0;\n this.$nextTick(() => {\n this.daysRef[this.focusDay].el.$el.focus();\n });\n },\n\n focusLastDay () {\n this.$nextTick(() => {\n this.focusDay = this.daysRef.length - 1;\n this.daysRef[this.focusDay].el.$el.focus();\n });\n },\n\n selectDay (day) {\n if (!day.currentMonth) { return; }\n\n // local selectedDay is updated when a day is selected\n this.selectedDay = day.text;\n this.$emit('select-date', day.value);\n },\n },\n};\n</script>\n","<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-stack\n class=\"d-datepicker\"\n gap=\"400\"\n >\n <div class=\"d-datepicker__hd\">\n <month-year-picker\n ref=\"monthYearPicker\"\n :selected-date=\"selectedDate\"\n @calendar-days=\"updateCalendarDays\"\n @focus-first-day=\"$refs.calendar.focusFirstDay()\"\n @focus-last-day=\"$refs.calendar.focusLastDay()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n />\n </div>\n <div class=\"d-datepicker__bd\">\n <calendar\n ref=\"calendar\"\n :calendar-days=\"calendarDays\"\n @select-date=\"$emit('selected-date', $event)\"\n @focus-month-year-picker=\"$refs.monthYearPicker.focusMonthYearPicker()\"\n @close-datepicker=\"$emit('close-datepicker')\"\n @go-to-next-month=\"$refs.monthYearPicker.goToNextMonth()\"\n @go-to-prev-month=\"$refs.monthYearPicker.goToPrevMonth()\"\n />\n </div>\n </dt-stack>\n</template>\n\n<script>\nimport MonthYearPicker from './modules/month-year-picker.vue';\nimport Calendar from './modules/calendar.vue';\nimport { DtStack } from '@/components/stack';\nimport { warnIfUnmounted } from '@/common/utils';\n\nexport default {\n name: 'DtDatepicker',\n\n components: { DtStack, MonthYearPicker, Calendar },\n\n props: {\n /**\n * Selected date\n *\n * @type {Date}\n */\n selectedDate: {\n type: Date,\n default: () => (new Date()),\n },\n },\n\n emits: [\n /**\n * Event fired when a date is selected\n *\n * @event selected-date\n * @type {Date}\n */\n 'selected-date',\n\n /**\n * Event fired when user presses the esc key\n *\n * @event close-datepicker\n */\n 'close-datepicker',\n ],\n\n data () {\n return {\n calendarDays: [],\n };\n },\n\n mounted () {\n warnIfUnmounted(this.$el, this.$options.name);\n },\n\n methods: {\n updateCalendarDays (days) {\n this.calendarDays = days;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtTooltip","DtStack","DtIconChevronLeft","DtIconChevronsLeft","DtIconChevronRight","DtIconChevronsRight","DtLocalizationMixin","getMonth","getYear","getCalendarDays","month","formatMonth","INTL_MONTH_FORMAT","refName","event","year","getDate","value","initialDate","set","newDate","addMonths","subMonths","getWeekDayNames","WEEK_START","day","formatDate","el","week","weekIndex","dayIndex","refKey","dayButton","prevFocusDate","calculatePrevFocusDate","nextFocusDate","calculateNextFocusDate","MonthYearPicker","Calendar","warnIfUnmounted","days"],"mappings":"6eAkJAA,EAAA,CACA,KAAA,8BAEA,WAAA,CACA,SAAAC,EAAA,QACA,UAAAC,EAAA,QACA,QAAAC,EAAA,QACA,kBAAAC,EAAA,kBACA,mBAAAC,EAAA,mBACA,mBAAAC,EAAA,mBACA,oBAAAC,EAAA,mBACA,EAEA,OAAA,CAAAC,EAAAA,OAAA,EAEA,MAAA,CACA,aAAA,CACA,KAAA,KACA,SAAA,EACA,CACA,EAEA,MAAA,CAOA,gBAOA,kBAOA,iBAOA,kBACA,EAEA,MAAA,CACA,MAAA,CACA,YAAAC,EAAAA,SAAA,KAAA,YAAA,EACA,WAAAC,EAAAA,QAAA,KAAA,Y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