@dialpad/dialtone 9.159.0 → 9.160.1
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/tokens/doc.json +82707 -82707
- package/dist/vue3/common/test-utils/node-traversal.cjs +2 -0
- package/dist/vue3/common/test-utils/node-traversal.cjs.map +1 -0
- package/dist/vue3/common/test-utils/node-traversal.js +54 -0
- package/dist/vue3/common/test-utils/node-traversal.js.map +1 -0
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/lib/button/button.cjs +1 -1
- package/dist/vue3/lib/button/button.cjs.map +1 -1
- package/dist/vue3/lib/button/button.js +146 -81
- package/dist/vue3/lib/button/button.js.map +1 -1
- package/dist/vue3/lib/dropdown/dropdown-separator.cjs +1 -1
- package/dist/vue3/lib/editor/editor.cjs +1 -1
- package/dist/vue3/lib/editor/editor.cjs.map +1 -1
- package/dist/vue3/lib/editor/editor.js +284 -148
- package/dist/vue3/lib/editor/editor.js.map +1 -1
- package/dist/vue3/lib/link/link.cjs +1 -1
- package/dist/vue3/lib/link/link.cjs.map +1 -1
- package/dist/vue3/lib/link/link.js +58 -18
- package/dist/vue3/lib/link/link.js.map +1 -1
- package/dist/vue3/lib/list-item-group/list-item-group.cjs +1 -1
- package/dist/vue3/lib/list-item-group/list-item-group.js +5 -5
- package/dist/vue3/lib/message-input/message-input.cjs +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue3/lib/message-input/message-input.js +22 -21
- package/dist/vue3/lib/message-input/message-input.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +4 -4
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +466 -283
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.js +66 -64
- package/dist/vue3/lib/tooltip-directive/tooltip.js.map +1 -1
- package/dist/vue3/localization/en-US.cjs +6 -0
- package/dist/vue3/localization/en-US.cjs.map +1 -1
- package/dist/vue3/localization/en-US.js +6 -0
- package/dist/vue3/localization/en-US.js.map +1 -1
- package/dist/vue3/types/common/sr_only_close_button.vue.d.ts +68 -1
- package/dist/vue3/types/common/test_utils/node_traversal.d.ts +10 -0
- package/dist/vue3/types/common/test_utils/node_traversal.d.ts.map +1 -0
- package/dist/vue3/types/components/banner/banner.vue.d.ts +136 -2
- package/dist/vue3/types/components/banner/banner.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/breadcrumbs/breadcrumb_item.vue.d.ts +39 -1
- package/dist/vue3/types/components/breadcrumbs/breadcrumb_item.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/breadcrumbs/breadcrumbs.vue.d.ts +39 -1
- package/dist/vue3/types/components/button/button.vue.d.ts +68 -1
- package/dist/vue3/types/components/button/button.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/chip/chip.vue.d.ts +68 -1
- package/dist/vue3/types/components/chip/chip.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/collapsible/collapsible.vue.d.ts +68 -1
- package/dist/vue3/types/components/collapsible/collapsible.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/dropdown/dropdown.vue.d.ts +136 -2
- package/dist/vue3/types/components/dropdown/dropdown.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts +272 -4
- package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts +136 -2
- package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/link/link.vue.d.ts +39 -1
- package/dist/vue3/types/components/link/link.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/modal/modal.vue.d.ts +136 -2
- package/dist/vue3/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/notice/notice.vue.d.ts +136 -2
- package/dist/vue3/types/components/notice/notice.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/notice/notice_action.vue.d.ts +136 -2
- package/dist/vue3/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/pagination/pagination.vue.d.ts +68 -1
- package/dist/vue3/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/popover/popover.vue.d.ts +136 -2
- package/dist/vue3/types/components/popover/popover.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts +68 -1
- package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +39 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +39 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts +1804 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts.map +1 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/index.d.ts +3 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/index.d.ts.map +1 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/variable.d.ts +3 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/variable/variable.d.ts.map +1 -0
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +87 -1
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/split_button/split_button-alpha.vue.d.ts +68 -1
- package/dist/vue3/types/components/split_button/split_button-omega.vue.d.ts +68 -1
- package/dist/vue3/types/components/split_button/split_button-omega.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/split_button/split_button.vue.d.ts +272 -4
- package/dist/vue3/types/components/split_button/split_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/tab/tab.vue.d.ts +68 -1
- package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +136 -2
- package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts +136 -2
- package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toast/toast.vue.d.ts +544 -8
- package/dist/vue3/types/components/toast/toast.vue.d.ts.map +1 -1
- package/dist/vue3/types/directives/tooltip_directive/tooltip.d.ts.map +1 -1
- package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +272 -4
- package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +272 -4
- package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +204 -3
- package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +136 -2
- package/dist/vue3/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +272 -4
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +204 -3
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +664 -4
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +631 -9
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +272 -4
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/contact_row/contact_row.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/leftbar/contact_row/contact_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts +68 -1
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("../../common/utils/index.cjs"),n=require("./button-constants.cjs"),d=require("../../localization/index.cjs"),c=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),u=require("../link/link-constants.cjs"),h={compatConfig:{MODE:3},name:"DtButton",props:{circle:{type:Boolean,default:!1},iconPosition:{type:String,default:"left",validator:t=>Object.keys(n.ICON_POSITION_MODIFIERS).includes(t)},importance:{type:String,default:"primary",validator:t=>Object.keys(n.BUTTON_IMPORTANCE_MODIFIERS).includes(t)},link:{type:Boolean,default:!1},linkKind:{type:String,default:"default",validator:t=>Object.keys(u.LINK_KIND_MODIFIERS).includes(t)},linkInverted:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},type:{type:String,default:"button",validator:t=>n.BUTTON_TYPES.includes(t)},width:{type:String,default:null},size:{type:String,default:"md",validator:t=>Object.keys(n.BUTTON_SIZE_MODIFIERS).includes(t)},labelClass:{type:[String,Array,Object],default:""},loading:{type:Boolean,default:!1},kind:{type:String,default:"default",validator:t=>Object.keys(n.BUTTON_KIND_MODIFIERS).includes(t)},assertiveOnFocus:{type:Boolean,default:!1},active:{type:Boolean,default:!1},to:{type:[String,Object],default:null},href:{type:String,default:null},target:{type:String,default:null},rel:{type:String,default:null},replace:{type:Boolean,default:!1}},emits:["focusin","focusout"],data(){return{ICON_POSITION_MODIFIERS:n.ICON_POSITION_MODIFIERS,isInFocus:!1,hasSlotContent:r.hasSlotContent,i18n:new d.DialtoneLocalization}},computed:{computedTag(){return this.to?this.resolveRouterLink():this.href?"a":"button"},isNativeButton(){return!this.to&&!this.href},computedAttrs(){return this.to?{to:this.to,replace:this.replace,...this.disabled&&{"aria-disabled":"true",tabindex:"-1"}}:this.href?{href:this.disabled?null:this.href,target:this.target,rel:this.rel,...this.disabled&&{"aria-disabled":"true",tabindex:"-1"}}:{type:this.type,disabled:this.disabled}},computedListeners(){const t={focusin:i=>{this.isInFocus=this.assertiveOnFocus,this.$emit("focusin",i)},focusout:i=>{this.isInFocus=!1,this.$emit("focusout",i)}};return this.isNativeButton||(this.disabled&&(t.click=i=>{i.preventDefault(),i.stopImmediatePropagation()}),t.keydown=i=>{(i.key===" "||i.code==="Space")&&(i.preventDefault(),this.disabled||i.target.click())}),t},computedAriaLive(){return this.assertiveOnFocus&&this.isInFocus?"assertive":this.$attrs.ariaLive},iconSize(){return n.BUTTON_ICON_SIZES[this.size]}},watch:{$props:{deep:!0,immediate:!0,handler(){process.env.NODE_ENV!=="production"&&(this.circle&&this.link&&e.warn("You cannot enable circle and link at the same time",this),this.isInvalidPropCombination(this.circle,this.kind,this.importance))}}},methods:{resolveRouterLink(){try{return e.resolveComponent("RouterLink")}catch{return e.warn('DtButton: "to" prop requires vue-router. Falling back to <a>.'),"a"}},buttonClasses(){return this.link?["d-link",u.getLinkKindModifier(this.linkKind,this.linkInverted),n.BUTTON_SIZE_MODIFIERS[this.size]]:this.kind==="unstyled"?["d-btn--unstyled"]:["d-btn",n.BUTTON_IMPORTANCE_MODIFIERS[this.importance],n.BUTTON_KIND_MODIFIERS[this.kind],n.BUTTON_SIZE_MODIFIERS[this.size],{"d-btn--circle":this.circle,"d-btn--loading":this.loading,"d-btn--icon-only":this.isIconOnly(),"d-btn--vertical":this.isVerticalIconLayout(),"d-btn--active":this.active}]},isInvalidPropCombination(t,i,s){if(this.kind==="unstyled")return!0;for(const l of n.INVALID_COMBINATION)if(t===l.circle&&i===l.kind&&s===l.importance)return e.warn(l.message),!1;return!0},shouldRenderIcon(){return r.hasSlotContent(this.$slots.icon)&&!this.link},isIconOnly(){return this.shouldRenderIcon()&&!r.hasSlotContent(this.$slots.default)},isVerticalIconLayout(){return!this.isIconOnly()&&["top","bottom"].includes(this.iconPosition)}}};function f(t,i,s,l,o,a){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.computedTag),e.mergeProps({class:["base-button__button",a.buttonClasses()],"data-qa":"dt-button",style:{width:s.width},"aria-live":a.computedAriaLive,"aria-label":s.loading?o.i18n.$t("DIALTONE_LOADING"):t.$attrs["aria-label"]},a.computedAttrs,e.toHandlers(a.computedListeners)),{default:e.withCtx(()=>[a.shouldRenderIcon()?(e.openBlock(),e.createElementBlock("span",{key:0,"data-qa":"dt-button-icon",class:e.normalizeClass(["base-button__icon",{"d-btn__icon":s.kind!=="unstyled",[o.ICON_POSITION_MODIFIERS[s.iconPosition]]:s.kind!=="unstyled"}])},[e.renderSlot(t.$slots,"icon",{iconSize:a.iconSize})],2)):e.createCommentVNode("",!0),o.hasSlotContent(t.$slots.default)?(e.openBlock(),e.createElementBlock("span",{key:1,"data-qa":"dt-button-label",class:e.normalizeClass(["base-button__label",{"d-btn__label":s.kind!=="unstyled"},s.labelClass])},[e.renderSlot(t.$slots,"default")],2)):e.createCommentVNode("",!0)]),_:3},16,["class","style","aria-live","aria-label"])}const I=c._(h,[["render",f]]);exports.default=I;
|
|
2
2
|
//# sourceMappingURL=button.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <button\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :type=\"type\"\n :disabled=\"disabled\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-on=\"buttonListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </button>\n</template>\n\n<script>\nimport { warn } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a\n * class=\"d-link\"\n * href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\"\n * target=\"_blank\"\n * >\n * (Reference)\n * </a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">\n * CSS width attribute\n * </a>\n * values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\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 */\n active: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n\n buttonListeners () {\n return {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n console.warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","e","BUTTON_ICON_SIZES","warn","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_openBlock","_createElementBlock","_mergeProps","$options","$props","$data","_ctx","_toHandlers","_normalizeClass","_renderSlot"],"mappings":"6VAsEKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,WAEN,MAAO,CAKL,OAAQ,CACN,KAAM,QACN,QAAS,IAOX,aAAc,CACZ,KAAM,OACN,QAAS,OACT,UAAYC,GAAa,OAAO,KAAKC,yBAAuB,EAAE,SAASD,CAAQ,GAOjF,WAAY,CACV,KAAM,OACN,QAAS,UACT,UAAYE,GAAM,OAAO,KAAKC,6BAA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QAAUC,OAAK,uBAAyBC,EAAA,OAAM,YAAA,CAC3D,EAAAC,EAAAA,WAAsBJ,EAAhB,gBAAe,EAAA,CAAA,EAAA,CAIbA,EAAA,iBAAgB,iBADxBF,EAAAA,mBAgBO,OAAA,OAdL,UAAQ,iBACP,MAAKO,EAAAA,eAAA,oCAAoEJ,EAAA,OAAI,YAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,EAAIA,EAAA,OAAI,gBAStJK,EAAAA,WAGEH,EAAA,OAAA,OAAA,CADC,SAAWH,EAAA,QAAQ,CAAA,mCAIhBE,EAAA,eAAeC,EAAA,OAAO,OAAO,iBADrCL,EAAAA,mBAWO,OAAA,OATL,UAAQ,kBACP,MAAKO,EAAAA,eAAA,sCAA4DJ,EAAA,OAAI,UAAA,EAA2BA,EAAA,eAOjGK,aAAQH,EAAA,OAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"button.cjs","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <component\n :is=\"computedTag\"\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-bind=\"computedAttrs\"\n v-on=\"computedListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </component>\n</template>\n\n<script>\nimport { warn, resolveComponent } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\" target=\"_blank\">(Reference)</a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">CSS width attribute</a> values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\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 */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * vue-router `to` prop. When provided, renders a `<router-link>`\n * for client-side SPA navigation.\n * @see https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to\n */\n to: {\n type: [String, Object],\n default: null,\n },\n\n /**\n * When provided, renders an `<a>` element for standard browser navigation.\n */\n href: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor target attribute. Only applied when using the `href` prop.\n * @values _self, _blank, _parent, _top\n */\n target: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor rel attribute. Only applied when using the `href` prop.\n */\n rel: {\n type: String,\n default: null,\n },\n\n /**\n * vue-router `replace` prop. When true, navigation will not leave a\n * history entry. Only applied when using the `to` prop.\n * @values true, false\n */\n replace: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n computedTag () {\n if (this.to) return this.resolveRouterLink();\n if (this.href) return 'a';\n return 'button';\n },\n\n isNativeButton () {\n return !this.to && !this.href;\n },\n\n computedAttrs () {\n if (this.to) {\n return {\n to: this.to,\n replace: this.replace,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n if (this.href) {\n return {\n href: this.disabled ? null : this.href,\n target: this.target,\n rel: this.rel,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n return {\n type: this.type,\n disabled: this.disabled,\n };\n },\n\n computedListeners () {\n const listeners = {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n\n if (!this.isNativeButton) {\n // Prevent click when disabled for link elements.\n // stopImmediatePropagation prevents parent onClick attrs from firing.\n if (this.disabled) {\n listeners.click = (e) => {\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n }\n\n // Space key handler: <a> only responds to Enter natively,\n // but buttons respond to both Enter and Space.\n listeners.keydown = (e) => {\n if (e.key === ' ' || e.code === 'Space') {\n e.preventDefault();\n if (!this.disabled) {\n e.target.click();\n }\n }\n };\n }\n\n return listeners;\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n resolveRouterLink () {\n try {\n return resolveComponent('RouterLink');\n } catch {\n warn('DtButton: \"to\" prop requires vue-router. Falling back to <a>.');\n return 'a';\n }\n },\n\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","listeners","e","BUTTON_ICON_SIZES","warn","resolveComponent","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_createBlock","_resolveDynamicComponent","$options","_mergeProps","$props","$data","_ctx","_toHandlers","_createElementBlock","_normalizeClass","_renderSlot"],"mappings":"6VAsEKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,WAEN,MAAO,CAKL,OAAQ,CACN,KAAM,QACN,QAAS,IAOX,aAAc,CACZ,KAAM,OACN,QAAS,OACT,UAAYC,GAAa,OAAO,KAAKC,yBAAuB,EAAE,SAASD,CAAQ,GAOjF,WAAY,CACV,KAAM,OACN,QAAS,UACT,UAAYE,GAAM,OAAO,KAAKC,6BAA2B,EAAE,SAASD,CAAC,GAQvE,KAAM,CACJ,KAAM,QACN,QAAS,IAQX,SAAU,CACR,KAAM,OACN,QAAS,UACT,UAAYE,GAAO,OAAO,KAAKC,qBAAmB,EAAE,SAASD,CAAE,GAQjE,aAAc,CACZ,KAAM,QACN,QAAS,IAQX,SAAU,CACR,KAAM,QACN,QAAS,IAQX,KAAM,CACJ,KAAM,OACN,QAAS,SACT,UAAY,GAAME,eAAa,SAAS,CAAC,GAO3C,MAAO,CACL,KAAM,OACN,QAAS,MAOX,KAAM,CACJ,KAAM,OACN,QAAS,KACT,UAAYC,GAAM,OAAO,KAAKC,uBAAqB,EAAE,SAASD,CAAC,GAMjE,WAAY,CACV,KAAM,CAAC,OAAQ,MAAO,MAAM,EAC5B,QAAS,IAOX,QAAS,CACP,KAAM,QACN,QAAS,IAOX,KAAM,CACJ,KAAM,OACN,QAAS,UACT,UAAYE,GAAM,OAAO,KAAKC,uBAAqB,EAAE,SAASD,CAAC,GASjE,iBAAkB,CAChB,KAAM,QACN,QAAS,IAQX,OAAQ,CACN,KAAM,QACN,QAAS,IAQX,GAAI,CACF,KAAM,CAAC,OAAQ,MAAM,EACrB,Q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AAC,KAAK,WAAU,GAAM,CAAC,MAAO,QAAQ,EAAE,SAAS,KAAK,YAAY,CAC3E,EAEJ,+CAvcEa,cA2CYC,EAAAA,wBA1CLC,EAAA,WAAW,EADlBC,aA2CY,CAzCT,MAAK,uBAAuCD,EAAA,cAAa,GAI1D,UAAQ,YACP,aAAgBE,EAAA,KAAK,EACrB,YAAWF,EAAA,iBACX,aAAYE,EAAA,QAAUC,OAAK,uBAAyBC,EAAA,OAAM,YAAA,GACnDJ,EAAA,cACRK,EAAAA,WAAML,EAAA,iBAAiB,CAAA,EAAA,mBAGvB,IAgBO,CAfCA,EAAA,iBAAgB,iBADxBM,EAAAA,mBAgBO,OAAA,OAdL,UAAQ,iBACP,MAAKC,EAAAA,eAAA,oCAAoEL,EAAA,OAAI,YAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,EAAIA,EAAA,OAAI,gBAStJM,EAAAA,WAGEJ,EAAA,OAAA,OAAA,CADC,SAAWJ,EAAA,QAAQ,CAAA,mCAIhBG,EAAA,eAAeC,EAAA,OAAO,OAAO,iBADrCE,EAAAA,mBAWO,OAAA,OATL,UAAQ,kBACP,MAAKC,EAAAA,eAAA,sCAA4DL,EAAA,OAAI,UAAA,EAA2BA,EAAA,eAOjGM,aAAQJ,EAAA,OAAA,SAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { warn as
|
|
2
|
-
import { hasSlotContent as
|
|
3
|
-
import { INVALID_COMBINATION as
|
|
4
|
-
import { DialtoneLocalization as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { getLinkKindModifier as
|
|
7
|
-
const
|
|
1
|
+
import { warn as l, resolveComponent as y, openBlock as r, createBlock as I, resolveDynamicComponent as k, mergeProps as O, toHandlers as _, withCtx as v, createElementBlock as u, normalizeClass as c, renderSlot as f, createCommentVNode as h } from "vue";
|
|
2
|
+
import { hasSlotContent as o } from "../../common/utils/index.js";
|
|
3
|
+
import { INVALID_COMBINATION as S, BUTTON_SIZE_MODIFIERS as d, BUTTON_IMPORTANCE_MODIFIERS as b, BUTTON_KIND_MODIFIERS as p, BUTTON_ICON_SIZES as g, ICON_POSITION_MODIFIERS as m, BUTTON_TYPES as N } from "./button-constants.js";
|
|
4
|
+
import { DialtoneLocalization as B } from "../../localization/index.js";
|
|
5
|
+
import { _ as D } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
import { getLinkKindModifier as C, LINK_KIND_MODIFIERS as T } from "../link/link-constants.js";
|
|
7
|
+
const L = {
|
|
8
8
|
compatConfig: { MODE: 3 },
|
|
9
9
|
name: "DtButton",
|
|
10
10
|
props: {
|
|
@@ -23,7 +23,7 @@ const g = {
|
|
|
23
23
|
iconPosition: {
|
|
24
24
|
type: String,
|
|
25
25
|
default: "left",
|
|
26
|
-
validator: (t) => Object.keys(
|
|
26
|
+
validator: (t) => Object.keys(m).includes(t)
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
29
29
|
* The fill and outline of the button associated with its visual importance.
|
|
@@ -32,7 +32,7 @@ const g = {
|
|
|
32
32
|
importance: {
|
|
33
33
|
type: String,
|
|
34
34
|
default: "primary",
|
|
35
|
-
validator: (t) => Object.keys(
|
|
35
|
+
validator: (t) => Object.keys(b).includes(t)
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
38
38
|
* Whether the button should be styled as a link or not.
|
|
@@ -51,7 +51,7 @@ const g = {
|
|
|
51
51
|
linkKind: {
|
|
52
52
|
type: String,
|
|
53
53
|
default: "default",
|
|
54
|
-
validator: (t) => Object.keys(
|
|
54
|
+
validator: (t) => Object.keys(T).includes(t)
|
|
55
55
|
},
|
|
56
56
|
/**
|
|
57
57
|
* Determines whether the link should have inverted styling if the button is styled as a link.
|
|
@@ -73,26 +73,17 @@ const g = {
|
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* HTML button type attribute
|
|
76
|
-
* <a
|
|
77
|
-
* class="d-link"
|
|
78
|
-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type"
|
|
79
|
-
* target="_blank"
|
|
80
|
-
* >
|
|
81
|
-
* (Reference)
|
|
82
|
-
* </a>
|
|
76
|
+
* <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type" target="_blank">(Reference)</a>
|
|
83
77
|
* @values button, submit, reset
|
|
84
78
|
*/
|
|
85
79
|
type: {
|
|
86
80
|
type: String,
|
|
87
81
|
default: "button",
|
|
88
|
-
validator: (t) =>
|
|
82
|
+
validator: (t) => N.includes(t)
|
|
89
83
|
},
|
|
90
84
|
/**
|
|
91
85
|
* Button width, accepts
|
|
92
|
-
* <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/CSS/width" target="_blank">
|
|
93
|
-
* CSS width attribute
|
|
94
|
-
* </a>
|
|
95
|
-
* values
|
|
86
|
+
* <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/CSS/width" target="_blank">CSS width attribute</a> values
|
|
96
87
|
*/
|
|
97
88
|
width: {
|
|
98
89
|
type: String,
|
|
@@ -105,7 +96,7 @@ const g = {
|
|
|
105
96
|
size: {
|
|
106
97
|
type: String,
|
|
107
98
|
default: "md",
|
|
108
|
-
validator: (t) => Object.keys(
|
|
99
|
+
validator: (t) => Object.keys(d).includes(t)
|
|
109
100
|
},
|
|
110
101
|
/**
|
|
111
102
|
* Used to customize the label container
|
|
@@ -129,7 +120,7 @@ const g = {
|
|
|
129
120
|
kind: {
|
|
130
121
|
type: String,
|
|
131
122
|
default: "default",
|
|
132
|
-
validator: (t) => Object.keys(
|
|
123
|
+
validator: (t) => Object.keys(p).includes(t)
|
|
133
124
|
},
|
|
134
125
|
/**
|
|
135
126
|
* Determines whether a screenreader reads live updates of
|
|
@@ -149,6 +140,46 @@ const g = {
|
|
|
149
140
|
active: {
|
|
150
141
|
type: Boolean,
|
|
151
142
|
default: !1
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* vue-router `to` prop. When provided, renders a `<router-link>`
|
|
146
|
+
* for client-side SPA navigation.
|
|
147
|
+
* @see https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to
|
|
148
|
+
*/
|
|
149
|
+
to: {
|
|
150
|
+
type: [String, Object],
|
|
151
|
+
default: null
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* When provided, renders an `<a>` element for standard browser navigation.
|
|
155
|
+
*/
|
|
156
|
+
href: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: null
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* HTML anchor target attribute. Only applied when using the `href` prop.
|
|
162
|
+
* @values _self, _blank, _parent, _top
|
|
163
|
+
*/
|
|
164
|
+
target: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: null
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* HTML anchor rel attribute. Only applied when using the `href` prop.
|
|
170
|
+
*/
|
|
171
|
+
rel: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: null
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* vue-router `replace` prop. When true, navigation will not leave a
|
|
177
|
+
* history entry. Only applied when using the `to` prop.
|
|
178
|
+
* @values true, false
|
|
179
|
+
*/
|
|
180
|
+
replace: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: !1
|
|
152
183
|
}
|
|
153
184
|
},
|
|
154
185
|
emits: [
|
|
@@ -169,29 +200,55 @@ const g = {
|
|
|
169
200
|
],
|
|
170
201
|
data() {
|
|
171
202
|
return {
|
|
172
|
-
ICON_POSITION_MODIFIERS:
|
|
203
|
+
ICON_POSITION_MODIFIERS: m,
|
|
173
204
|
// whether the button is currently in focus
|
|
174
205
|
isInFocus: !1,
|
|
175
|
-
hasSlotContent:
|
|
176
|
-
i18n: new
|
|
206
|
+
hasSlotContent: o,
|
|
207
|
+
i18n: new B()
|
|
177
208
|
};
|
|
178
209
|
},
|
|
179
210
|
computed: {
|
|
180
|
-
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
|
|
211
|
+
computedTag() {
|
|
212
|
+
return this.to ? this.resolveRouterLink() : this.href ? "a" : "button";
|
|
213
|
+
},
|
|
214
|
+
isNativeButton() {
|
|
215
|
+
return !this.to && !this.href;
|
|
216
|
+
},
|
|
217
|
+
computedAttrs() {
|
|
218
|
+
return this.to ? {
|
|
219
|
+
to: this.to,
|
|
220
|
+
replace: this.replace,
|
|
221
|
+
...this.disabled && { "aria-disabled": "true", tabindex: "-1" }
|
|
222
|
+
} : this.href ? {
|
|
223
|
+
href: this.disabled ? null : this.href,
|
|
224
|
+
target: this.target,
|
|
225
|
+
rel: this.rel,
|
|
226
|
+
...this.disabled && { "aria-disabled": "true", tabindex: "-1" }
|
|
227
|
+
} : {
|
|
228
|
+
type: this.type,
|
|
229
|
+
disabled: this.disabled
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
computedListeners() {
|
|
233
|
+
const t = {
|
|
234
|
+
focusin: (e) => {
|
|
235
|
+
this.isInFocus = this.assertiveOnFocus, this.$emit("focusin", e);
|
|
184
236
|
},
|
|
185
|
-
focusout: (
|
|
186
|
-
this.isInFocus = !1, this.$emit("focusout",
|
|
237
|
+
focusout: (e) => {
|
|
238
|
+
this.isInFocus = !1, this.$emit("focusout", e);
|
|
187
239
|
}
|
|
188
240
|
};
|
|
241
|
+
return this.isNativeButton || (this.disabled && (t.click = (e) => {
|
|
242
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
243
|
+
}), t.keydown = (e) => {
|
|
244
|
+
(e.key === " " || e.code === "Space") && (e.preventDefault(), this.disabled || e.target.click());
|
|
245
|
+
}), t;
|
|
189
246
|
},
|
|
190
247
|
computedAriaLive() {
|
|
191
248
|
return this.assertiveOnFocus && this.isInFocus ? "assertive" : this.$attrs.ariaLive;
|
|
192
249
|
},
|
|
193
250
|
iconSize() {
|
|
194
|
-
return
|
|
251
|
+
return g[this.size];
|
|
195
252
|
}
|
|
196
253
|
},
|
|
197
254
|
watch: {
|
|
@@ -199,21 +256,28 @@ const g = {
|
|
|
199
256
|
deep: !0,
|
|
200
257
|
immediate: !0,
|
|
201
258
|
handler() {
|
|
202
|
-
process.env.NODE_ENV !== "production" && (this.circle && this.link &&
|
|
259
|
+
process.env.NODE_ENV !== "production" && (this.circle && this.link && l("You cannot enable circle and link at the same time", this), this.isInvalidPropCombination(this.circle, this.kind, this.importance));
|
|
203
260
|
}
|
|
204
261
|
}
|
|
205
262
|
},
|
|
206
263
|
methods: {
|
|
264
|
+
resolveRouterLink() {
|
|
265
|
+
try {
|
|
266
|
+
return y("RouterLink");
|
|
267
|
+
} catch {
|
|
268
|
+
return l('DtButton: "to" prop requires vue-router. Falling back to <a>.'), "a";
|
|
269
|
+
}
|
|
270
|
+
},
|
|
207
271
|
buttonClasses() {
|
|
208
272
|
return this.link ? [
|
|
209
273
|
"d-link",
|
|
210
|
-
|
|
211
|
-
|
|
274
|
+
C(this.linkKind, this.linkInverted),
|
|
275
|
+
d[this.size]
|
|
212
276
|
] : this.kind === "unstyled" ? ["d-btn--unstyled"] : [
|
|
213
277
|
"d-btn",
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
278
|
+
b[this.importance],
|
|
279
|
+
p[this.kind],
|
|
280
|
+
d[this.size],
|
|
217
281
|
{
|
|
218
282
|
"d-btn--circle": this.circle,
|
|
219
283
|
"d-btn--loading": this.loading,
|
|
@@ -223,66 +287,67 @@ const g = {
|
|
|
223
287
|
}
|
|
224
288
|
];
|
|
225
289
|
},
|
|
226
|
-
isInvalidPropCombination(t,
|
|
290
|
+
isInvalidPropCombination(t, e, i) {
|
|
227
291
|
if (this.kind === "unstyled")
|
|
228
292
|
return !0;
|
|
229
|
-
for (const
|
|
230
|
-
if (t ===
|
|
231
|
-
return
|
|
293
|
+
for (const s of S)
|
|
294
|
+
if (t === s.circle && e === s.kind && i === s.importance)
|
|
295
|
+
return l(s.message), !1;
|
|
232
296
|
return !0;
|
|
233
297
|
},
|
|
234
298
|
shouldRenderIcon() {
|
|
235
|
-
return
|
|
299
|
+
return o(this.$slots.icon) && !this.link;
|
|
236
300
|
},
|
|
237
301
|
isIconOnly() {
|
|
238
|
-
return this.shouldRenderIcon() && !
|
|
302
|
+
return this.shouldRenderIcon() && !o(this.$slots.default);
|
|
239
303
|
},
|
|
240
304
|
isVerticalIconLayout() {
|
|
241
305
|
return !this.isIconOnly() && ["top", "bottom"].includes(this.iconPosition);
|
|
242
306
|
}
|
|
243
307
|
}
|
|
244
|
-
}
|
|
245
|
-
function
|
|
246
|
-
return
|
|
308
|
+
};
|
|
309
|
+
function E(t, e, i, s, a, n) {
|
|
310
|
+
return r(), I(k(n.computedTag), O({
|
|
247
311
|
class: [
|
|
248
312
|
"base-button__button",
|
|
249
313
|
n.buttonClasses()
|
|
250
314
|
],
|
|
251
315
|
"data-qa": "dt-button",
|
|
252
|
-
|
|
253
|
-
disabled: e.disabled,
|
|
254
|
-
style: { width: e.width },
|
|
316
|
+
style: { width: i.width },
|
|
255
317
|
"aria-live": n.computedAriaLive,
|
|
256
|
-
"aria-label":
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
318
|
+
"aria-label": i.loading ? a.i18n.$t("DIALTONE_LOADING") : t.$attrs["aria-label"]
|
|
319
|
+
}, n.computedAttrs, _(n.computedListeners)), {
|
|
320
|
+
default: v(() => [
|
|
321
|
+
n.shouldRenderIcon() ? (r(), u("span", {
|
|
322
|
+
key: 0,
|
|
323
|
+
"data-qa": "dt-button-icon",
|
|
324
|
+
class: c([
|
|
325
|
+
"base-button__icon",
|
|
326
|
+
{
|
|
327
|
+
"d-btn__icon": i.kind !== "unstyled",
|
|
328
|
+
[a.ICON_POSITION_MODIFIERS[i.iconPosition]]: i.kind !== "unstyled"
|
|
329
|
+
}
|
|
330
|
+
])
|
|
331
|
+
}, [
|
|
332
|
+
f(t.$slots, "icon", { iconSize: n.iconSize })
|
|
333
|
+
], 2)) : h("", !0),
|
|
334
|
+
a.hasSlotContent(t.$slots.default) ? (r(), u("span", {
|
|
335
|
+
key: 1,
|
|
336
|
+
"data-qa": "dt-button-label",
|
|
337
|
+
class: c([
|
|
338
|
+
"base-button__label",
|
|
339
|
+
{ "d-btn__label": i.kind !== "unstyled" },
|
|
340
|
+
i.labelClass
|
|
341
|
+
])
|
|
342
|
+
}, [
|
|
343
|
+
f(t.$slots, "default")
|
|
344
|
+
], 2)) : h("", !0)
|
|
345
|
+
]),
|
|
346
|
+
_: 3
|
|
347
|
+
}, 16, ["class", "style", "aria-live", "aria-label"]);
|
|
283
348
|
}
|
|
284
|
-
const
|
|
349
|
+
const z = /* @__PURE__ */ D(L, [["render", E]]);
|
|
285
350
|
export {
|
|
286
|
-
|
|
351
|
+
z as default
|
|
287
352
|
};
|
|
288
353
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <button\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :type=\"type\"\n :disabled=\"disabled\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-on=\"buttonListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </button>\n</template>\n\n<script>\nimport { warn } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a\n * class=\"d-link\"\n * href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\"\n * target=\"_blank\"\n * >\n * (Reference)\n * </a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">\n * CSS width attribute\n * </a>\n * values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\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 */\n active: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n\n buttonListeners () {\n return {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n console.warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","e","BUTTON_ICON_SIZES","warn","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_openBlock","_createElementBlock","_mergeProps","$options","$props","$data","_ctx","_toHandlers","_normalizeClass","_renderSlot"],"mappings":";;;;;;AAsEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAa,OAAO,KAAKC,CAAuB,EAAE,SAASD,CAAQ;AAAA;;;;;IAOjF,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAM,OAAO,KAAKC,CAA2B,EAAE,SAASD,CAAC;AAAA;;;;;;IAQvE,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAO,OAAO,KAAKC,CAAmB,EAAE,SAASD,CAAE;AAAA;;;;;;IAQjE,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;;;;IAcX,MAAM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B,aAAO,CAAC,KAAK,WAAU,KAAM,CAAC,OAAO,QAAQ,EAAE,SAAS,KAAK,YAAY;AAAA,IAC3E;AAAA;AAEJ;;AAnWE,SAAAW,EAAA,GAAAC,EA2CS,UA3CTC,EA2CS;AAAA,IA1CN,OAAK;AAAA;MAAuCC,EAAA,cAAa;AAAA;IAI1D,WAAQ;AAAA,IACP,MAAMC,EAAA;AAAA,IACN,UAAUA,EAAA;AAAA,IACV,gBAAgBA,EAAA,MAAK;AAAA,IACrB,aAAWD,EAAA;AAAA,IACX,cAAYC,EAAA,UAAUC,OAAK,yBAAyBC,EAAA,OAAM,YAAA;AAAA,EAC3D,GAAAC,EAAsBJ,EAAhB,iBAAe,EAAA,CAAA,GAAA;AAAA,IAIbA,EAAA,iBAAgB,UADxBF,EAgBO,QAAA;AAAA;MAdL,WAAQ;AAAA,MACP,OAAKO,EAAA;AAAA;;yBAAoEJ,EAAA,SAAI;AAAA,WAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,GAAIA,EAAA,SAAI;AAAA;;;MAStJK,EAGEH,EAAA,QAAA,QAAA,EADC,UAAWH,EAAA,SAAQ,CAAA;AAAA;IAIhBE,EAAA,eAAeC,EAAA,OAAO,OAAO,UADrCL,EAWO,QAAA;AAAA;MATL,WAAQ;AAAA,MACP,OAAKO,EAAA;AAAA;0BAA4DJ,EAAA,SAAI,WAAA;AAAA,QAA2BA,EAAA;AAAA;;MAOjGK,EAAQH,EAAA,QAAA,SAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <component\n :is=\"computedTag\"\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-bind=\"computedAttrs\"\n v-on=\"computedListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </component>\n</template>\n\n<script>\nimport { warn, resolveComponent } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\" target=\"_blank\">(Reference)</a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">CSS width attribute</a> values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\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 */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * vue-router `to` prop. When provided, renders a `<router-link>`\n * for client-side SPA navigation.\n * @see https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to\n */\n to: {\n type: [String, Object],\n default: null,\n },\n\n /**\n * When provided, renders an `<a>` element for standard browser navigation.\n */\n href: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor target attribute. Only applied when using the `href` prop.\n * @values _self, _blank, _parent, _top\n */\n target: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor rel attribute. Only applied when using the `href` prop.\n */\n rel: {\n type: String,\n default: null,\n },\n\n /**\n * vue-router `replace` prop. When true, navigation will not leave a\n * history entry. Only applied when using the `to` prop.\n * @values true, false\n */\n replace: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n computedTag () {\n if (this.to) return this.resolveRouterLink();\n if (this.href) return 'a';\n return 'button';\n },\n\n isNativeButton () {\n return !this.to && !this.href;\n },\n\n computedAttrs () {\n if (this.to) {\n return {\n to: this.to,\n replace: this.replace,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n if (this.href) {\n return {\n href: this.disabled ? null : this.href,\n target: this.target,\n rel: this.rel,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n return {\n type: this.type,\n disabled: this.disabled,\n };\n },\n\n computedListeners () {\n const listeners = {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n\n if (!this.isNativeButton) {\n // Prevent click when disabled for link elements.\n // stopImmediatePropagation prevents parent onClick attrs from firing.\n if (this.disabled) {\n listeners.click = (e) => {\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n }\n\n // Space key handler: <a> only responds to Enter natively,\n // but buttons respond to both Enter and Space.\n listeners.keydown = (e) => {\n if (e.key === ' ' || e.code === 'Space') {\n e.preventDefault();\n if (!this.disabled) {\n e.target.click();\n }\n }\n };\n }\n\n return listeners;\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n resolveRouterLink () {\n try {\n return resolveComponent('RouterLink');\n } catch {\n warn('DtButton: \"to\" prop requires vue-router. Falling back to <a>.');\n return 'a';\n }\n },\n\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","listeners","BUTTON_ICON_SIZES","warn","resolveComponent","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_createBlock","_resolveDynamicComponent","$options","_mergeProps","$props","$data","_ctx","_toHandlers","_createElementBlock","_normalizeClass","_renderSlot"],"mappings":";;;;;;AAsEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAa,OAAO,KAAKC,CAAuB,EAAE,SAASD,CAAQ;AAAA;;;;;IAOjF,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAM,OAAO,KAAKC,CAA2B,EAAE,SAASD,CAAC;AAAA;;;;;;IAQvE,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAO,OAAO,KAAKC,CAAmB,EAAE,SAASD,CAAE;AAA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AO,IAAI,KAAK,CAAC,KAAK;AAAA,IACnD;AAAA,IAEA,aAAc;AACZ,aAAO,KAAK,sBAAsB,CAACA,EAAe,KAAK,OAAO,OAAO;AAAA,IACvE;AAAA,IAEA,uBAAwB;AACtB,aAAO,CAAC,KAAK,WAAU,KAAM,CAAC,OAAO,QAAQ,EAAE,SAAS,KAAK,YAAY;AAAA,IAC3E;AAAA;AAEJ;;cAvcEY,EA2CYC,EA1CLC,EAAA,WAAW,GADlBC,EA2CY;AAAA,IAzCT,OAAK;AAAA;MAAuCD,EAAA,cAAa;AAAA;IAI1D,WAAQ;AAAA,IACP,gBAAgBE,EAAA,MAAK;AAAA,IACrB,aAAWF,EAAA;AAAA,IACX,cAAYE,EAAA,UAAUC,OAAK,yBAAyBC,EAAA,OAAM,YAAA;AAAA,KACnDJ,EAAA,eACRK,EAAML,EAAA,iBAAiB,CAAA,GAAA;AAAA,eAGvB,MAgBO;AAAA,MAfCA,EAAA,iBAAgB,UADxBM,EAgBO,QAAA;AAAA;QAdL,WAAQ;AAAA,QACP,OAAKC,EAAA;AAAA;;2BAAoEL,EAAA,SAAI;AAAA,aAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,GAAIA,EAAA,SAAI;AAAA;;;QAStJM,EAGEJ,EAAA,QAAA,QAAA,EADC,UAAWJ,EAAA,SAAQ,CAAA;AAAA;MAIhBG,EAAA,eAAeC,EAAA,OAAO,OAAO,UADrCE,EAWO,QAAA;AAAA;QATL,WAAQ;AAAA,QACP,OAAKC,EAAA;AAAA;4BAA4DL,EAAA,SAAI,WAAA;AAAA,UAA2BA,EAAA;AAAA;;QAOjGM,EAAQJ,EAAA,QAAA,SAAA;AAAA;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),r={compatConfig:{MODE:3},name:"DtDropdownSeparator"},o={"aria-hidden":"true",class:"d-list-item-separator"};function n(s,c,i,u,p,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),r={compatConfig:{MODE:3},name:"DtDropdownSeparator"},o={"aria-hidden":"true",class:"d-list-item-separator"};function n(s,c,i,u,p,l){return e.openBlock(),e.createElementBlock("li",o)}const a=t._(r,[["render",n]]);exports.default=a;
|
|
2
2
|
//# sourceMappingURL=dropdown-separator.cjs.map
|