@dialpad/dialtone-vue 4.6.0 → 4.6.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/{RichTextEditor-DaOHmXD_.js → RichTextEditor-D8DfONFm.js} +7 -7
- package/dist/{RichTextEditor-DaOHmXD_.js.map → RichTextEditor-D8DfONFm.js.map} +1 -1
- package/dist/{RichTextEditor-7eY8gy9u.cjs → RichTextEditor-DMUDJKVn.cjs} +2 -2
- package/dist/{RichTextEditor-7eY8gy9u.cjs.map → RichTextEditor-DMUDJKVn.cjs.map} +1 -1
- package/dist/common/sr_only_close_button.vue.d.ts +4 -1
- package/dist/component-documentation.json +1 -1
- package/dist/components/Avatar/Avatar.vue.d.ts +12 -8
- package/dist/components/Avatar/Avatar.vue.d.ts.map +1 -1
- package/dist/components/Badge/Badge.vue.d.ts +1 -2
- package/dist/components/Banner/Banner.vue.d.ts +8 -2
- package/dist/components/Banner/Banner.vue.d.ts.map +1 -1
- package/dist/components/Button/Button.vue.d.ts +4 -1
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Chip/Chip.vue.d.ts +4 -1
- package/dist/components/Chip/Chip.vue.d.ts.map +1 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts +4 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts.map +1 -1
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts +8 -2
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +8 -2
- package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/FilterPill/FilterPill.vue.d.ts +20 -5
- package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
- package/dist/components/Hovercard/Hovercard.vue.d.ts +16 -4
- package/dist/components/Hovercard/Hovercard.vue.d.ts.map +1 -1
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts +8 -2
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts.map +1 -1
- package/dist/components/Loader/Loader.vue.d.ts +4 -1
- package/dist/components/Loader/Loader.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +9 -3
- package/dist/components/Modal/Modal.vue.d.ts.map +1 -1
- package/dist/components/Notice/Notice.vue.d.ts +8 -2
- package/dist/components/Notice/Notice.vue.d.ts.map +1 -1
- package/dist/components/Notice/NoticeAction.vue.d.ts +8 -2
- package/dist/components/Notice/NoticeAction.vue.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.vue.d.ts +4 -1
- package/dist/components/Pagination/Pagination.vue.d.ts.map +1 -1
- package/dist/components/Popover/Popover.vue.d.ts +8 -2
- package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
- package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts +4 -1
- package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts.map +1 -1
- package/dist/components/RichTextEditor/Extensions/Mentions/MentionSuggestion.vue.d.ts +12 -8
- package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts +13 -5
- package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControlItem.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButton.vue.d.ts +16 -4
- package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts +4 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonStart.vue.d.ts +4 -1
- package/dist/components/Tab/Tab.vue.d.ts +4 -1
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts +8 -2
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts.map +1 -1
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts +8 -2
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts.map +1 -1
- package/dist/components/Toast/Toast.vue.d.ts +32 -8
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +7 -7
- package/dist/lib/avatar/avatar.cjs +1 -1
- package/dist/lib/avatar/avatar.cjs.map +1 -1
- package/dist/lib/avatar/avatar.js +50 -47
- package/dist/lib/avatar/avatar.js.map +1 -1
- package/dist/lib/badge/badge.cjs +1 -1
- package/dist/lib/badge/badge.cjs.map +1 -1
- package/dist/lib/badge/badge.js +12 -14
- package/dist/lib/badge/badge.js.map +1 -1
- package/dist/lib/button/button.cjs +1 -1
- package/dist/lib/button/button.js +21 -21
- package/dist/lib/dropdown/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown/dropdown.js.map +1 -1
- package/dist/lib/filter-pill/filter-pill.cjs +1 -1
- package/dist/lib/filter-pill/filter-pill.js +5 -5
- package/dist/lib/loader/loader.cjs +3 -3
- package/dist/lib/loader/loader.cjs.map +1 -1
- package/dist/lib/loader/loader.js +28 -20
- package/dist/lib/loader/loader.js.map +1 -1
- package/dist/lib/modal/modal.cjs +1 -1
- package/dist/lib/modal/modal.cjs.map +1 -1
- package/dist/lib/modal/modal.js +6 -5
- package/dist/lib/modal/modal.js.map +1 -1
- package/dist/lib/rich-text-editor/index.cjs +1 -1
- package/dist/lib/rich-text-editor/index.js +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/lib/segmented-control/segmented-control-item.cjs.map +1 -1
- package/dist/lib/segmented-control/segmented-control-item.js.map +1 -1
- package/dist/lib/text/text.cjs.map +1 -1
- package/dist/lib/text/text.js.map +1 -1
- package/dist/localization/index.cjs +1 -1
- package/dist/localization/index.cjs.map +1 -1
- package/dist/localization/index.js +50 -33
- package/dist/localization/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","names":[],"sources":["../../../components/Badge/Badge.vue"],"sourcesContent":["<template>\n <span\n :class=\"[\n 'd-badge',\n BADGE_TYPE_MODIFIERS[type],\n BADGE_KIND_MODIFIERS[kind],\n BADGE_DECORATION_MODIFIERS[decoration],\n { 'd-badge--subtle': subtle },\n { 'd-badge--outlined': outlined },\n ]\"\n data-qa=\"dt-badge\"\n >\n <span\n v-if=\"decoration\"\n class=\"d-badge__decorative\"\n />\n <span\n v-if=\"hasLeftIcon\"\n :class=\"['d-badge__icon-left', startIconClass]\"\n >\n <!-- @slot Slot for start icon, icon-size slot prop defaults to '200' -->\n <slot\n v-if=\"$slots.startIcon\"\n name=\"startIcon\"\n :icon-size=\"iconSize\"\n />\n <!-- @slot @deprecated Use startIcon -->\n <slot\n v-else\n name=\"leftIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span :class=\"['d-badge__label', labelClass]\">\n <!-- @slot Slot for badge content, defaults to text prop -->\n <slot>\n {{ text }}\n </slot>\n </span>\n <span\n v-if=\"hasRightIcon\"\n :class=\"['d-badge__icon-right', endIconClass]\"\n >\n <!-- @slot Slot for end icon, icon-size slot prop defaults to '200' -->\n <slot\n v-if=\"$slots.endIcon\"\n name=\"endIcon\"\n :icon-size=\"iconSize\"\n />\n <!-- @slot @deprecated Use endIcon -->\n <slot\n v-else\n name=\"rightIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n </span>\n</template>\n\n<script>\nimport { BADGE_TYPE_MODIFIERS, BADGE_KIND_MODIFIERS, BADGE_DECORATION_MODIFIERS } from './BadgeConstants';\nimport { ICON_SIZE_MODIFIERS } from '@/components/Icon';\nimport { hasSlotContent } from '@/common/utils/index.js';\nimport { ordinalSizeValidator } from '@/common/validators';\n\n/**\n * A badge is a compact UI element that provides brief, descriptive information about an element.\n * It is terse, ideally one word.\n * @see https://dialtone.dialpad.com/components/badge.html\n */\nexport default {\n name: 'DtBadge',\n\n props: {\n /**\n * The size of the left and right icons.\n * @values 100, 200, 300, 400, 500, 600, 700, 800\n */\n iconSize: {\n type: [String, Number],\n default: 200,\n validator: ordinalSizeValidator(ICON_SIZE_MODIFIERS),\n },\n\n /**\n * Text for the badge content\n */\n text: {\n type: String,\n default: '',\n },\n\n /**\n * The kind of badge which determines the styling\n * @values label, count\n */\n kind: {\n type: String,\n default: 'label',\n validator: (kind) => Object.keys(BADGE_KIND_MODIFIERS).includes(kind),\n },\n\n /**\n * Color for the badge background\n * @values default, info, positive, warning, critical, bulletin, ai\n */\n type: {\n type: String,\n default: 'default',\n validator: (type) => Object.keys(BADGE_TYPE_MODIFIERS).includes(type),\n },\n\n /**\n * Decoration for the badge. This can be only used with kind: label and type: default\n * with no left and right icons\n * @values black-400, black-500, black-900, red-200, red-300, red-400, purple-200,\n * purple-300, purple-400, purple-500, blue-200, blue-300, blue-400, green-300, green-400,\n * green-500, gold-300, gold-400, gold-500, magenta-200, magenta-300, magenta-400\n */\n decoration: {\n type: String,\n default: undefined,\n validator: (type) => Object.keys(BADGE_DECORATION_MODIFIERS).includes(type),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Used to customize the start icon container\n */\n startIconClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Used to customize the end icon container\n */\n endIconClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Shows a subtle appearance for the badge\n * Currently only affects the badge when type is bulletin.\n */\n subtle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Outlines the badge with a border\n */\n outlined: {\n type: Boolean,\n default: false,\n },\n },\n\n data () {\n return {\n BADGE_TYPE_MODIFIERS,\n BADGE_KIND_MODIFIERS,\n BADGE_DECORATION_MODIFIERS,\n };\n },\n\n
|
|
1
|
+
{"version":3,"file":"badge.js","names":[],"sources":["../../../components/Badge/Badge.vue"],"sourcesContent":["<template>\n <span\n :class=\"[\n 'd-badge',\n BADGE_TYPE_MODIFIERS[type],\n BADGE_KIND_MODIFIERS[kind],\n BADGE_DECORATION_MODIFIERS[decoration],\n { 'd-badge--subtle': subtle },\n { 'd-badge--outlined': outlined },\n ]\"\n data-qa=\"dt-badge\"\n >\n <span\n v-if=\"decoration\"\n class=\"d-badge__decorative\"\n />\n <span\n v-if=\"hasLeftIcon()\"\n :class=\"['d-badge__icon-left', startIconClass]\"\n >\n <!-- @slot Slot for start icon, icon-size slot prop defaults to '200' -->\n <slot\n v-if=\"$slots.startIcon\"\n name=\"startIcon\"\n :icon-size=\"iconSize\"\n />\n <!-- @slot @deprecated Use startIcon -->\n <slot\n v-else\n name=\"leftIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span :class=\"['d-badge__label', labelClass]\">\n <!-- @slot Slot for badge content, defaults to text prop -->\n <slot>\n {{ text }}\n </slot>\n </span>\n <span\n v-if=\"hasRightIcon()\"\n :class=\"['d-badge__icon-right', endIconClass]\"\n >\n <!-- @slot Slot for end icon, icon-size slot prop defaults to '200' -->\n <slot\n v-if=\"$slots.endIcon\"\n name=\"endIcon\"\n :icon-size=\"iconSize\"\n />\n <!-- @slot @deprecated Use endIcon -->\n <slot\n v-else\n name=\"rightIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n </span>\n</template>\n\n<script>\nimport { BADGE_TYPE_MODIFIERS, BADGE_KIND_MODIFIERS, BADGE_DECORATION_MODIFIERS } from './BadgeConstants';\nimport { ICON_SIZE_MODIFIERS } from '@/components/Icon';\nimport { hasSlotContent } from '@/common/utils/index.js';\nimport { ordinalSizeValidator } from '@/common/validators';\n\n/**\n * A badge is a compact UI element that provides brief, descriptive information about an element.\n * It is terse, ideally one word.\n * @see https://dialtone.dialpad.com/components/badge.html\n */\nexport default {\n name: 'DtBadge',\n\n props: {\n /**\n * The size of the left and right icons.\n * @values 100, 200, 300, 400, 500, 600, 700, 800\n */\n iconSize: {\n type: [String, Number],\n default: 200,\n validator: ordinalSizeValidator(ICON_SIZE_MODIFIERS),\n },\n\n /**\n * Text for the badge content\n */\n text: {\n type: String,\n default: '',\n },\n\n /**\n * The kind of badge which determines the styling\n * @values label, count\n */\n kind: {\n type: String,\n default: 'label',\n validator: (kind) => Object.keys(BADGE_KIND_MODIFIERS).includes(kind),\n },\n\n /**\n * Color for the badge background\n * @values default, info, positive, warning, critical, bulletin, ai\n */\n type: {\n type: String,\n default: 'default',\n validator: (type) => Object.keys(BADGE_TYPE_MODIFIERS).includes(type),\n },\n\n /**\n * Decoration for the badge. This can be only used with kind: label and type: default\n * with no left and right icons\n * @values black-400, black-500, black-900, red-200, red-300, red-400, purple-200,\n * purple-300, purple-400, purple-500, blue-200, blue-300, blue-400, green-300, green-400,\n * green-500, gold-300, gold-400, gold-500, magenta-200, magenta-300, magenta-400\n */\n decoration: {\n type: String,\n default: undefined,\n validator: (type) => Object.keys(BADGE_DECORATION_MODIFIERS).includes(type),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Used to customize the start icon container\n */\n startIconClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Used to customize the end icon container\n */\n endIconClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Shows a subtle appearance for the badge\n * Currently only affects the badge when type is bulletin.\n */\n subtle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Outlines the badge with a border\n */\n outlined: {\n type: Boolean,\n default: false,\n },\n },\n\n data () {\n return {\n BADGE_TYPE_MODIFIERS,\n BADGE_KIND_MODIFIERS,\n BADGE_DECORATION_MODIFIERS,\n };\n },\n\n mounted () {\n this.validateProps();\n },\n\n updated () {\n this.validateProps();\n },\n\n methods: {\n // These read $slots, which is not reactive, so they must not be cached as computeds.\n hasLeftIcon () {\n return hasSlotContent(this.$slots.startIcon) || hasSlotContent(this.$slots.leftIcon);\n },\n\n hasRightIcon () {\n return hasSlotContent(this.$slots.endIcon) || hasSlotContent(this.$slots.rightIcon);\n },\n\n hasIcons () {\n return this.hasLeftIcon() || this.hasRightIcon();\n },\n\n validateProps () {\n this.validateTypePropCombination();\n this.validateDecorationPropCombination();\n },\n\n validateTypePropCombination () {\n if (this.type === 'ai' && this.kind === 'count') {\n console.error('DtBadge error: type: \\'ai\\' with kind: \\'count\\' is an invalid combination.');\n }\n if (this.type !== 'bulletin' && this.subtle) {\n console.error('DtBadge error: subtle can only be used with type \\'bulletin\\'');\n }\n },\n\n validateDecorationPropCombination () {\n if (!this.decoration) return;\n\n if (this.kind !== 'label' || this.type !== 'default') {\n console.error('DtBadge error: decoration prop can only be used with kind: \\'label\\' and type: \\'default\\'.');\n }\n\n if (this.hasIcons()) {\n console.error('DtBadge error: decoration prop cannot be used with startIcon or endIcon.');\n }\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;AAsEA,IAAK,IAAU;CACb,MAAM;CAEN,OAAO;EAKL,UAAU;GACR,MAAM,CAAC,QAAQ,OAAO;GACtB,SAAS;GACT,WAAW,EAAqB,EAAoB;GACrD;EAKD,MAAM;GACJ,MAAM;GACN,SAAS;GACV;EAMD,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,MAAS,OAAO,KAAK,EAAqB,CAAC,SAAS,EAAK;GACtE;EAMD,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,MAAS,OAAO,KAAK,EAAqB,CAAC,SAAS,EAAK;GACtE;EASD,YAAY;GACV,MAAM;GACN,SAAS,KAAA;GACT,YAAY,MAAS,OAAO,KAAK,EAA2B,CAAC,SAAS,EAAK;GAC5E;EAKD,YAAY;GACV,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAKD,gBAAgB;GACd,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAKD,cAAc;GACZ,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAMD,QAAQ;GACN,MAAM;GACN,SAAS;GACV;EAKD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EACF;CAED,OAAQ;AACN,SAAO;GACL;GACA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CAEzC,EAEO,EAAA,QAAA,WAAA,EAAA,QAAA,CAAA,EAAA,EADF,EAAA,KAAI,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,EAAA;EAIH,EAAA,cAAY,IAAA,GAAA,EADpB,EAgBO,QAAA;;GAdJ,OAAK,EAAA,CAAA,uBAA0B,EAAA,aAAY,CAAA;MAIpC,EAAA,OAAO,UADf,EAIE,EAAA,QAAA,WAAA;;GADC,UAAW,EAAA;OAGd,EAIE,EAAA,QAAA,aAAA;;GADC,UAAW,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/validators/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/validators/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../localization/index.cjs`),i=require(`../loader/loader.cjs`),a=require(`./button-constants.cjs`),o=require(`../link/link-constants.cjs`);let s=require(`vue`);var c={name:`DtButton`,components:{DtLoader:i.default},props:{circle:{type:Boolean,default:!1},iconPosition:{type:String,default:`start`,validator:e=>Object.keys(a.ICON_POSITION_MODIFIERS).includes(e)},importance:{type:String,default:`primary`,validator:e=>Object.keys(a.BUTTON_IMPORTANCE_MODIFIERS).includes(e)},link:{type:Boolean,default:!1},linkKind:{type:String,default:`default`,validator:e=>Object.keys(o.LINK_KIND_MODIFIERS).includes(e)},linkInverted:{type:Boolean,default:!1},linkUnderline:{type:Boolean,default:!0},underline:{type:Boolean,default:null},disabled:{type:Boolean,default:!1},type:{type:String,default:`button`,validator:e=>a.BUTTON_TYPES.includes(e)},width:{type:String,default:null},size:{type:[String,Number],default:300,validator:e.ordinalSizeValidator(a.BUTTON_SIZE_MODIFIERS)},labelClass:{type:[String,Array,Object],default:``},leadingClass:{type:[String,Array,Object],default:``},trailingClass:{type:[String,Array,Object],default:``},startIconClass:{type:[String,Array,Object],default:``},endIconClass:{type:[String,Array,Object],default:``},blockStartIconClass:{type:[String,Array,Object],default:``},blockEndIconClass:{type:[String,Array,Object],default:``},iconClass:{type:[String,Array,Object],default:``},loading:{type:Boolean,default:!1},kind:{type:String,default:`default`,validator:e=>Object.keys(a.BUTTON_KIND_MODIFIERS).includes(e)},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:a.ICON_POSITION_MODIFIERS,isInFocus:!1,hasSlotContent:t.hasSlotContent,i18n:new r.DialtoneLocalization}},computed:{resolvedUnderline(){return this.underline??this.linkUnderline},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(){let e={focusin:e=>{this.isInFocus=this.assertiveOnFocus,this.$emit(`focusin`,e)},focusout:e=>{this.isInFocus=!1,this.$emit(`focusout`,e)}};return this.isNativeButton||(this.disabled&&(e.click=e=>{e.preventDefault(),e.stopImmediatePropagation()}),e.keydown=e=>{(e.key===` `||e.code===`Space`)&&(e.preventDefault(),this.disabled||e.target.click())}),e},computedAriaLive(){return this.assertiveOnFocus&&this.isInFocus?`assertive`:this.$attrs.ariaLive},iconSize(){return a.BUTTON_ICON_SIZES[String(this.size)]},loaderSize(){return a.BUTTON_ICON_SIZES[String(this.size)]},propCombination(){return[this.circle,this.kind,this.importance,this.link]}},watch:{propCombination:{handler:`validatePropCombination`,immediate:!0}},methods:{validatePropCombination(){process.env.NODE_ENV!==`production`&&(this.circle&&this.link&&(0,s.warn)(`You cannot enable circle and link at the same time`,this),this.isInvalidPropCombination(this.circle,this.kind,this.importance))},resolveRouterLink(){try{return(0,s.resolveComponent)(`RouterLink`)}catch{return(0,s.warn)(`DtButton: "to" prop requires vue-router. Falling back to <a>.`),`a`}},buttonClasses(){return this.link?[`d-link`,o.getLinkKindModifier(this.linkKind,this.linkInverted),a.BUTTON_SIZE_MODIFIERS[String(this.size)],{"d-link--no-underline":!this.resolvedUnderline}]:this.kind===`unstyled`?[`d-btn--unstyled`]:[`d-btn`,a.BUTTON_IMPORTANCE_MODIFIERS[this.importance],a.BUTTON_KIND_MODIFIERS[this.kind],a.BUTTON_SIZE_MODIFIERS[String(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(e,t,n){if(this.kind===`unstyled`)return!0;for(let r of a.INVALID_COMBINATION)if(e===r.circle&&t===r.kind&&n===r.importance)return(0,s.warn)(r.message),!1;return!0},hasStartIcon(){return t.hasSlotContent(this.$slots.startIcon)},hasEndIcon(){return t.hasSlotContent(this.$slots.endIcon)},hasBlockStartIcon(){return t.hasSlotContent(this.$slots.blockStartIcon)},hasBlockEndIcon(){return t.hasSlotContent(this.$slots.blockEndIcon)},hasNewIconSlots(){return this.hasStartIcon()||this.hasEndIcon()||this.hasBlockStartIcon()||this.hasBlockEndIcon()},shouldRenderLegacyIcon(){return t.hasSlotContent(this.$slots.icon)&&!this.hasNewIconSlots()&&!this.link},isIconOnly(){return(this.hasNewIconSlots()||this.shouldRenderLegacyIcon())&&!t.hasSlotContent(this.$slots.default)},isVerticalIconLayout(){return this.isIconOnly()?!1:this.hasBlockStartIcon()||this.hasBlockEndIcon()?!0:!this.hasNewIconSlots()&&[`top`,`bottom`].includes(this.iconPosition)}}};function l(e,t,n,r,i,a){let o=(0,s.resolveComponent)(`dt-loader`);return(0,s.openBlock)(),(0,s.createBlock)((0,s.resolveDynamicComponent)(a.computedTag),(0,s.mergeProps)({class:[`base-button__button`,a.buttonClasses()],"data-qa":`dt-button`,style:{width:n.width},"aria-live":a.computedAriaLive,"aria-label":n.loading?i.i18n.$t(`DIALTONE_LOADING`):e.$attrs[`aria-label`]},a.computedAttrs,(0,s.toHandlers)(a.computedListeners)),{default:(0,s.withCtx)(()=>[n.loading&&n.kind!==`unstyled`?((0,s.openBlock)(),(0,s.createBlock)(o,{key:0,class:`d-btn__loader`,size:a.loaderSize,"aria-hidden":`true`},null,8,[`size`])):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.leading)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:1,class:(0,s.normalizeClass)([`d-btn__leading`,n.leadingClass])},[(0,s.renderSlot)(e.$slots,`leading`)],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.blockStartIcon)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:2,"data-qa":`dt-button-block-start-icon`,class:(0,s.normalizeClass)([`base-button__icon`,{"d-btn__icon":n.kind!==`unstyled`,"d-btn__icon--top":n.kind!==`unstyled`},n.blockStartIconClass])},[(0,s.renderSlot)(e.$slots,`blockStartIcon`,{iconSize:a.iconSize})],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.startIcon)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:3,"data-qa":`dt-button-start-icon`,class:(0,s.normalizeClass)([`base-button__icon`,{"d-btn__icon":n.kind!==`unstyled`,"d-btn__icon--left":n.kind!==`unstyled`},n.startIconClass])},[(0,s.renderSlot)(e.$slots,`startIcon`,{iconSize:a.iconSize})],2)):(0,s.createCommentVNode)(``,!0),a.shouldRenderLegacyIcon()?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:4,"data-qa":`dt-button-icon`,class:(0,s.normalizeClass)([`base-button__icon`,{"d-btn__icon":n.kind!==`unstyled`,[i.ICON_POSITION_MODIFIERS[n.iconPosition]]:n.kind!==`unstyled`},n.iconClass])},[(0,s.renderSlot)(e.$slots,`icon`,{iconSize:a.iconSize})],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.default)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:5,"data-qa":`dt-button-label`,class:(0,s.normalizeClass)([`base-button__label`,{"d-btn__label":n.kind!==`unstyled`},n.labelClass])},[(0,s.renderSlot)(e.$slots,`default`)],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.endIcon)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:6,"data-qa":`dt-button-end-icon`,class:(0,s.normalizeClass)([`base-button__icon`,{"d-btn__icon":n.kind!==`unstyled`,"d-btn__icon--right":n.kind!==`unstyled`},n.endIconClass])},[(0,s.renderSlot)(e.$slots,`endIcon`,{iconSize:a.iconSize})],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.blockEndIcon)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:7,"data-qa":`dt-button-block-end-icon`,class:(0,s.normalizeClass)([`base-button__icon`,{"d-btn__icon":n.kind!==`unstyled`,"d-btn__icon--bottom":n.kind!==`unstyled`},n.blockEndIconClass])},[(0,s.renderSlot)(e.$slots,`blockEndIcon`,{iconSize:a.iconSize})],2)):(0,s.createCommentVNode)(``,!0),i.hasSlotContent(e.$slots.trailing)?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,{key:8,class:(0,s.normalizeClass)([`d-btn__trailing`,n.trailingClass])},[(0,s.renderSlot)(e.$slots,`trailing`)],2)):(0,s.createCommentVNode)(``,!0)]),_:3},16,[`class`,`style`,`aria-live`,`aria-label`])}var u=n.t(c,[[`render`,l]]);exports.default=u;
|
|
2
2
|
//# sourceMappingURL=button.cjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ordinalSizeValidator as e } from "../../common/validators/index.js";
|
|
2
2
|
import { hasSlotContent as t } from "../../common/utils/index.js";
|
|
3
3
|
import { t as n } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { DialtoneLocalization as r } from "../../localization/index.js";
|
|
5
|
+
import i from "../loader/loader.js";
|
|
6
|
+
import { BUTTON_ICON_SIZES as a, BUTTON_IMPORTANCE_MODIFIERS as o, BUTTON_KIND_MODIFIERS as s, BUTTON_SIZE_MODIFIERS as c, BUTTON_TYPES as l, ICON_POSITION_MODIFIERS as u, INVALID_COMBINATION as d } from "./button-constants.js";
|
|
7
|
+
import { LINK_KIND_MODIFIERS as f, getLinkKindModifier as p } from "../link/link-constants.js";
|
|
8
8
|
import { createBlock as m, createCommentVNode as h, createElementBlock as g, mergeProps as _, normalizeClass as v, openBlock as y, renderSlot as b, resolveComponent as x, resolveDynamicComponent as S, toHandlers as C, warn as w, withCtx as T } from "vue";
|
|
9
9
|
//#region components/Button/Button.vue
|
|
10
10
|
var E = {
|
|
11
11
|
name: "DtButton",
|
|
12
|
-
components: { DtLoader:
|
|
12
|
+
components: { DtLoader: i },
|
|
13
13
|
props: {
|
|
14
14
|
circle: {
|
|
15
15
|
type: Boolean,
|
|
@@ -18,12 +18,12 @@ var E = {
|
|
|
18
18
|
iconPosition: {
|
|
19
19
|
type: String,
|
|
20
20
|
default: "start",
|
|
21
|
-
validator: (e) => Object.keys(
|
|
21
|
+
validator: (e) => Object.keys(u).includes(e)
|
|
22
22
|
},
|
|
23
23
|
importance: {
|
|
24
24
|
type: String,
|
|
25
25
|
default: "primary",
|
|
26
|
-
validator: (e) => Object.keys(
|
|
26
|
+
validator: (e) => Object.keys(o).includes(e)
|
|
27
27
|
},
|
|
28
28
|
link: {
|
|
29
29
|
type: Boolean,
|
|
@@ -32,7 +32,7 @@ var E = {
|
|
|
32
32
|
linkKind: {
|
|
33
33
|
type: String,
|
|
34
34
|
default: "default",
|
|
35
|
-
validator: (e) => Object.keys(
|
|
35
|
+
validator: (e) => Object.keys(f).includes(e)
|
|
36
36
|
},
|
|
37
37
|
linkInverted: {
|
|
38
38
|
type: Boolean,
|
|
@@ -53,7 +53,7 @@ var E = {
|
|
|
53
53
|
type: {
|
|
54
54
|
type: String,
|
|
55
55
|
default: "button",
|
|
56
|
-
validator: (e) =>
|
|
56
|
+
validator: (e) => l.includes(e)
|
|
57
57
|
},
|
|
58
58
|
width: {
|
|
59
59
|
type: String,
|
|
@@ -62,7 +62,7 @@ var E = {
|
|
|
62
62
|
size: {
|
|
63
63
|
type: [String, Number],
|
|
64
64
|
default: 300,
|
|
65
|
-
validator: e(
|
|
65
|
+
validator: e(c)
|
|
66
66
|
},
|
|
67
67
|
labelClass: {
|
|
68
68
|
type: [
|
|
@@ -135,7 +135,7 @@ var E = {
|
|
|
135
135
|
kind: {
|
|
136
136
|
type: String,
|
|
137
137
|
default: "default",
|
|
138
|
-
validator: (e) => Object.keys(
|
|
138
|
+
validator: (e) => Object.keys(s).includes(e)
|
|
139
139
|
},
|
|
140
140
|
assertiveOnFocus: {
|
|
141
141
|
type: Boolean,
|
|
@@ -169,10 +169,10 @@ var E = {
|
|
|
169
169
|
emits: ["focusin", "focusout"],
|
|
170
170
|
data() {
|
|
171
171
|
return {
|
|
172
|
-
ICON_POSITION_MODIFIERS:
|
|
172
|
+
ICON_POSITION_MODIFIERS: u,
|
|
173
173
|
isInFocus: !1,
|
|
174
174
|
hasSlotContent: t,
|
|
175
|
-
i18n: new
|
|
175
|
+
i18n: new r()
|
|
176
176
|
};
|
|
177
177
|
},
|
|
178
178
|
computed: {
|
|
@@ -225,10 +225,10 @@ var E = {
|
|
|
225
225
|
return this.assertiveOnFocus && this.isInFocus ? "assertive" : this.$attrs.ariaLive;
|
|
226
226
|
},
|
|
227
227
|
iconSize() {
|
|
228
|
-
return
|
|
228
|
+
return a[String(this.size)];
|
|
229
229
|
},
|
|
230
230
|
loaderSize() {
|
|
231
|
-
return
|
|
231
|
+
return a[String(this.size)];
|
|
232
232
|
},
|
|
233
233
|
propCombination() {
|
|
234
234
|
return [
|
|
@@ -257,14 +257,14 @@ var E = {
|
|
|
257
257
|
buttonClasses() {
|
|
258
258
|
return this.link ? [
|
|
259
259
|
"d-link",
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
p(this.linkKind, this.linkInverted),
|
|
261
|
+
c[String(this.size)],
|
|
262
262
|
{ "d-link--no-underline": !this.resolvedUnderline }
|
|
263
263
|
] : this.kind === "unstyled" ? ["d-btn--unstyled"] : [
|
|
264
264
|
"d-btn",
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
o[this.importance],
|
|
266
|
+
s[this.kind],
|
|
267
|
+
c[String(this.size)],
|
|
268
268
|
{
|
|
269
269
|
"d-btn--circle": this.circle,
|
|
270
270
|
"d-btn--loading": this.loading,
|
|
@@ -276,7 +276,7 @@ var E = {
|
|
|
276
276
|
},
|
|
277
277
|
isInvalidPropCombination(e, t, n) {
|
|
278
278
|
if (this.kind === "unstyled") return !0;
|
|
279
|
-
for (let r of
|
|
279
|
+
for (let r of d) if (e === r.circle && t === r.kind && n === r.importance) return w(r.message), !1;
|
|
280
280
|
return !0;
|
|
281
281
|
},
|
|
282
282
|
hasStartIcon() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.cjs","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the dropdown -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\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 * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script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
1
|
+
{"version":3,"file":"dropdown.cjs","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!--\n @slot Dropdown trigger. Bind the three ARIA slot props individually to the trigger to preserve consumer refs.\n @binding {string} ref Internal ref key. Do not forward it to the trigger.\n @binding {string} aria-expanded Whether the dropdown is open, as \"true\" or \"false\".\n @binding {string} aria-controls ID of the popup element with role=\"menu\".\n @binding {string} aria-haspopup Popup role, \"menu\".\n -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\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 * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":"ukBA2EA,IAAK,EAAU,CACb,KAAM,aAEN,WAAY,CACV,UAAA,EAAA,QACD,CAED,OAAQ,CACN,EAAA,QAAmB,CACjB,SAAU,iBACV,MAAO,cACP,eAAgB,iBAChB,aAAc,WACd,qBAAsB,iBACtB,sBAAuB,wBACvB,gBAAiB,kBACjB,cAAe,eACf,0BAA2B,GAC5B,CAAC,CACH,CAED,aAAc,GAEd,MAAO,CAKL,YAAa,EAAA,EAQb,KAAM,CACJ,KAAM,CAAC,QAAS,KAAK,CACrB,QAAS,KACV,CAMD,cAAe,CACb,KAAM,QACN,QAAS,GACV,CAMD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,MAAO,CACL,KAAM,QACN,QAAS,GACV,CAOD,aAAc,CACZ,KAAM,OACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CASD,eAAgB,CACd,KAAM,OACN,QAAS,EAAA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J,CAhBe,WAAK,EAAA,EAAA,EAAA,oBAgBpB,KAAA,CAZF,GAAI,EAAA,OACL,IAAI,cACH,OAAA,EAAA,EAAA,gBAAO,EAAA,YAAW,CACnB,UAAQ,2BACP,aAAU,EAAA,KAAA,EAAA,IAAA,GAAA,IAAE,EAAA,qBAAA,EAAA,oBAAA,GAAA,EAAmB,yCACZ,EAAA,kBAAA,EAAA,iBAAA,GAAA,EAAgB,qBAMlC,EAAA,OAAA,OAAA,CADQ,QAAK,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,CAIR,eAAA,EAAA,EAAA,UAKP,CALwB,WAAK,EAAA,EAAA,EAAA,YAK7B,EAAA,OAAA,SAAA,CADQ,QAAK,CAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the dropdown -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\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 * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;AAqEA,IAAK,IAAU;CACb,MAAM;CAEN,YAAY,EACV,WAAA,GACD;CAED,QAAQ,CACN,EAAmB;EACjB,UAAU;EACV,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,eAAe;EACf,2BAA2B;EAC5B,CAAC,CACH;CAED,cAAc;CAEd,OAAO;EAKL,aAAa;EAQb,MAAM;GACJ,MAAM,CAAC,SAAS,KAAK;GACrB,SAAS;GACV;EAMD,eAAe;GACb,MAAM;GACN,SAAS;GACV;EAMD,SAAS;GACP,MAAM;GACN,SAAS;GACT,YAAY,MACH,OAAO,KAAK,EAAyB,CAAC,MA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,EAAA;EACZ,gBAAc,EAAA;IACf,EAAwB,EAAlB,kBAAiB,CAAA,EAAA;EAEZ,QAAM,GAMb,EANiB,eAAK,CAExB,EAIE,EAAA,QAAA,UAJF,EAIE,EAHA,KAAI,UAAQ,EAEJ,EAAK,CAAA,CAAA,CAAA;EAGN,SAAO,GAgBX,EAhBe,eAAK,CAGzB,EAaK,MAAA;GAZF,IAAI,EAAA;GACL,KAAI;GACH,OAAK,EAAE,EAAA,YAAW;GACnB,WAAQ;GACP,cAAU,EAAA,OAAA,EAAA,MAAA,GAAA,MAAE,EAAA,uBAAA,EAAA,oBAAA,GAAA,EAAmB;iDACZ,EAAA,oBAAA,EAAA,iBAAA,GAAA,EAAgB;MAGpC,EAGE,EAAA,QAAA,QAAA,EADQ,UAAK,CAAA,CAAA,EAAA,IAAA,EAAA,CAAA,CAAA;EAIR,eAAa,GAKpB,EALwB,eAAK,CAE/B,EAGE,EAAA,QAAA,UAAA,EADQ,UAAK,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"dropdown.js","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!--\n @slot Dropdown trigger. Bind the three ARIA slot props individually to the trigger to preserve consumer refs.\n @binding {string} ref Internal ref key. Do not forward it to the trigger.\n @binding {string} aria-expanded Whether the dropdown is open, as \"true\" or \"false\".\n @binding {string} aria-controls ID of the popup element with role=\"menu\".\n @binding {string} aria-haspopup Popup role, \"menu\".\n -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\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 * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;AA2EA,IAAK,IAAU;CACb,MAAM;CAEN,YAAY,EACV,WAAA,GACD;CAED,QAAQ,CACN,EAAmB;EACjB,UAAU;EACV,OAAO;EACP,gBAA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X,KAAI;EACH,iBAAe,EAAA;EACf,gBAAc,EAAA;EACd,MAAM,EAAA;EACN,WAAW,EAAA;EACX,yBAAuB,EAAA,qBAAkB,UAAA;EACzC,uBAAqB,EAAA;EACtB,SAAQ;EACR,MAAK;EACJ,aAAW,EAAA;EACX,OAAO,EAAA;EACP,cAAY,EAAA;EACZ,aAAW,EAAA;EACX,wBAAsB,EAAA;EACtB,mBAAiB,EAAA;IACV,EAAA,QAAM;EACb,QAAQ,EAAA;EACR,YAAY,EAAA;EACZ,gBAAc,EAAA;IACf,EAAwB,EAAlB,kBAAiB,CAAA,EAAA;EAEZ,QAAM,GAYb,EAZiB,eAAK,CAQxB,EAIE,EAAA,QAAA,UAJF,EAIE,EAHA,KAAI,UAAQ,EAEJ,EAAK,CAAA,CAAA,CAAA;EAGN,SAAO,GAgBX,EAhBe,eAAK,CAGzB,EAaK,MAAA;GAZF,IAAI,EAAA;GACL,KAAI;GACH,OAAK,EAAE,EAAA,YAAW;GACnB,WAAQ;GACP,cAAU,EAAA,OAAA,EAAA,MAAA,GAAA,MAAE,EAAA,uBAAA,EAAA,oBAAA,GAAA,EAAmB;iDACZ,EAAA,oBAAA,EAAA,iBAAA,GAAA,EAAgB;MAGpC,EAGE,EAAA,QAAA,QAAA,EADQ,UAAK,CAAA,CAAA,EAAA,IAAA,EAAA,CAAA,CAAA;EAIR,eAAa,GAKpB,EALwB,eAAK,CAE/B,EAGE,EAAA,QAAA,UAAA,EADQ,UAAK,CAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/validators/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../mode_constants-CzYJW9ua.cjs`),i=require(`../button/button-constants.cjs`),a=require(`../../localization/index.cjs`),o=require(`../button/button.cjs`),s=require(`../checkbox/checkbox.cjs`),c=require(`../checkbox-group/checkbox-group.cjs`),l=require(`../list-item/list-item.cjs`),u=require(`../stack/stack.cjs`),d=require(`../popover/popover-constants.cjs`),f=require(`../popover/popover.cjs`),p=require(`../dropdown/dropdown.cjs`);let m=require(`vue`),h=require(`@dialpad/dialtone-icons/vue`);var g={name:`DtFilterPill`,components:{DtCheckboxGroup:c.default,DtCheckbox:s.default,DtPopover:f.default,DtButton:o.default,DtIconClose:h.DtIconClose,DtIconChevronDown:h.DtIconChevronDown,DtDropdown:p.default,DtListItem:l.default,DtStack:u.default},props:{useDropdown:{type:Boolean,default:!1},deferSelection:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]},startTooltipText:{type:String,default:``},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},showClear:{type:Boolean,default:!0},label:{type:String,default:void 0},endTooltipText:{type:String,default:``},popoverAppendTo:{type:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},popoverFallbackPlacements:{type:Array,default:()=>[`auto`]},popoverMaxHeight:{type:String,default:``},popoverMaxWidth:{type:String,default:``},popoverPadding:{type:String,default:`large`,validator:e=>Object.keys(d.POPOVER_PADDING_CLASSES).some(t=>t===e)},popoverPlacement:{type:String,default:`bottom-start`},labelClass:{type:[String,Array,Object],default:``},popoverContentClass:{type:[String,Array,Object],default:``},popoverHeaderClass:{type:[String,Array,Object],default:``},popoverFooterClass:{type:[String,Array,Object],default:``},popoverDialogClass:{type:[String,Array,Object],default:``},dropdownListClass:{type:[String,Array,Object],default:``},contentMode:r.t,size:{type:[String,Number],default:200,validator:t.ordinalSizeValidator(i.BUTTON_SIZE_MODIFIERS)}},emits:[`clear`,`open`,`update:modelValue`,`apply`],data(){return{isOpen:!1,i18n:new a.DialtoneLocalization,filters:this.modelValue,pendingFilters:null}},computed:{overlayComponent(){return this.useDropdown?`dt-dropdown`:`dt-popover`},overlayProps(){let e={"append-to":this.popoverAppendTo,"fallback-placements":this.popoverFallbackPlacements,"max-height":this.popoverMaxHeight,"max-width":this.popoverMaxWidth,modal:!0,placement:this.popoverPlacement};return this.useDropdown?e[`list-class`]=this.dropdownListClass:(e.padding=this.popoverPadding,e[`content-class`]=this.popoverContentClass,e[`header-wrapper-class`]=this.popoverHeaderClass,e[`footer-wrapper-class`]=this.popoverFooterClass,e[`dialog-class`]=this.popoverDialogClass),e},buttonKind(){return this.isActive&&!this.disabled?`default`:`muted`},resolvedStartTooltipText(){return this.readOnly?this.startTooltipText||this.i18n.$t(`DIALTONE_FILTER_PILL_READ_ONLY_TOOLTIP`):this.startTooltipText},clearButtonAriaLabel(){return this.endTooltipText||this.i18n.$t(`DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL`)},clearButtonTitle(){if(!this.endTooltipText)return this.clearButtonAriaLabel},activeFilters(){return this.filters.filter(e=>e.active).map(e=>e.name)},activeFilterList(){return this.activeFilters.length===this.filters.length&&this.filters.length>1?`All`:this.activeFilters[0]??``},activeFilterOverflow(){return this.activeFilters.length<=1||this.activeFilters.length===this.filters.length&&this.filters.length>1?``:`+`+(this.activeFilters.length-1)},isActive(){return this.activeFilterList.length>0},hasClear(){return!this.readOnly&&this.showClear&&this.activeFilterList.length>0},displayFilters(){return this.deferSelection&&this.pendingFilters?this.pendingFilters:this.filters},pendingActiveFilters(){return this.pendingFilters?this.pendingFilters.filter(e=>e.active).map(e=>e.name):[]},cancelButtonLabel(){return this.i18n.$t(`DIALTONE_FILTER_PILL_CANCEL_BUTTON_LABEL`)},applyButtonLabel(){return this.i18n.$t(`DIALTONE_FILTER_PILL_APPLY_BUTTON_LABEL`)},clearIconSize(){return String(this.size)===`100`?`100`:i.BUTTON_ICON_SIZES[String(this.size)]}},watch:{isOpen(e){this.$emit(`open`,e),this.deferSelection&&(e?this.pendingFilters=JSON.parse(JSON.stringify(this.filters)):this.pendingFilters=null)},filters:{deep:!0,handler(e){this.$emit(`update:modelValue`,e)}}},mounted(){this.modelValue?.length||this.$slots.content&&this.$slots.content()||console.warn(`Please provide content through the v-model or the "content" slot.`),this.deferSelection&&this.useDropdown&&console.warn(`deferSelection has no effect when useDropdown is true.`)},methods:{clearFilter(e){this.filters.forEach(e=>delete e.active),this.$emit(`clear`,e)},openPopover(){this.readOnly||(this.isOpen=!0)},selectFilter(e,t){this.filters.forEach(t=>{t.active=t===e}),t()},applySelection(){this.pendingFilters&&(this.filters.forEach((e,t)=>{this.pendingFilters[t]?e.active=this.pendingFilters[t].active:delete e.active}),this.$emit(`apply`),this.isOpen=!1)},cancelSelection(){this.isOpen=!1}}},_=[`title`,`textContent`],v=[`title`,`textContent`],y=[`title`,`textContent`];function b(e,t,n,r,i,a){let o=(0,m.resolveComponent)(`dt-icon-chevron-down`),s=(0,m.resolveComponent)(`dt-button`),c=(0,m.resolveComponent)(`dt-checkbox`),l=(0,m.resolveComponent)(`dt-checkbox-group`),u=(0,m.resolveComponent)(`dt-stack`),d=(0,m.resolveComponent)(`dt-list-item`),f=(0,m.resolveComponent)(`dt-icon-close`),p=(0,m.resolveDirective)(`dt-tooltip`);return(0,m.openBlock)(),(0,m.createElementBlock)(`div`,{class:(0,m.normalizeClass)([`d-filter-pill`,{"d-filter-pill--read-only":n.readOnly}]),"data-qa":`dt-filter-pill`},[((0,m.openBlock)(),(0,m.createBlock)((0,m.resolveDynamicComponent)(a.overlayComponent),(0,m.mergeProps)({open:i.isOpen,"onUpdate:open":t[0]||(t[0]=e=>i.isOpen=e)},a.overlayProps,{"content-mode":n.contentMode}),(0,m.createSlots)({anchor:(0,m.withCtx)(t=>[(0,m.withDirectives)(((0,m.openBlock)(),(0,m.createBlock)(s,(0,m.mergeProps)(n.useDropdown?t:t.attrs,{active:a.isActive,"aria-disabled":n.readOnly||void 0,class:[`d-filter-pill__primary`,{"d-filter-pill--selected":a.isActive}],disabled:n.disabled,kind:a.buttonKind,size:n.size,"data-qa":`dt-filter-pill__button`,importance:`outlined`,onClick:a.openPopover,onKeydown:(0,m.withKeys)((0,m.withModifiers)(a.openPopover,[`prevent`]),[`up`,`down`])}),(0,m.createSlots)({default:(0,m.withCtx)(()=>[(0,m.createElementVNode)(`span`,{class:(0,m.normalizeClass)([`d-filter-pill__label`,n.labelClass])},[(0,m.renderSlot)(e.$slots,`default`,{label:n.label,filters:i.filters,activeFilters:a.activeFilters,activeFilterList:a.activeFilterList,activeFilterOverflow:a.activeFilterOverflow},()=>[(0,m.createElementVNode)(`span`,{class:`d-filter-pill__label-start`,title:n.label,textContent:(0,m.toDisplayString)(n.label)},null,8,_),a.activeFilterList?((0,m.openBlock)(),(0,m.createElementBlock)(`span`,{key:0,class:`d-filter-pill__label-end`,title:a.activeFilterList,textContent:(0,m.toDisplayString)(a.activeFilterList)},null,8,v)):(0,m.createCommentVNode)(``,!0),a.activeFilterOverflow?((0,m.openBlock)(),(0,m.createElementBlock)(`span`,{key:1,class:`d-filter-pill__label-end-overflow`,title:`plus ${a.activeFilters.length-1} others`,textContent:(0,m.toDisplayString)(a.activeFilterOverflow)},null,8,y)):(0,m.createCommentVNode)(``,!0)])],2)]),_:2},[e.$slots.startIcon?{name:`startIcon`,fn:(0,m.withCtx)(({iconSize:t})=>[(0,m.renderSlot)(e.$slots,`startIcon`,{iconSize:t})]),key:`0`}:void 0,n.readOnly?void 0:{name:`endIcon`,fn:(0,m.withCtx)(({iconSize:e})=>[(0,m.createVNode)(o,{size:e,class:`d-filter-pill__icon`,"data-qa":`dt-filter-pill__icon`},null,8,[`size`])]),key:`1`}]),1040,[`active`,`aria-disabled`,`class`,`disabled`,`kind`,`size`,`onClick`,`onKeydown`])),[[p,a.resolvedStartTooltipText]])]),_:2},[n.useDropdown?void 0:{name:`content`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`content`,{close:t,apply:a.applySelection,cancel:a.cancelSelection,pendingFilters:i.pendingFilters},()=>[n.modelValue?.length?((0,m.openBlock)(),(0,m.createBlock)(l,{key:0,"model-value":n.deferSelection?a.pendingActiveFilters:a.activeFilters,"aria-label":n.label,name:n.label||`filter-pill`},{default:(0,m.withCtx)(()=>[((0,m.openBlock)(!0),(0,m.createElementBlock)(m.Fragment,null,(0,m.renderList)(a.displayFilters,e=>((0,m.openBlock)(),(0,m.createBlock)(c,{key:e.name,label:e.name,value:e.name,"onUpdate:modelValue":t=>e.active=t},null,8,[`label`,`value`,`onUpdate:modelValue`]))),128))]),_:1},8,[`model-value`,`aria-label`,`name`])):(0,m.createCommentVNode)(``,!0)])]),key:`0`},!n.useDropdown&&e.$slots.headerContent?{name:`headerContent`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`headerContent`,{close:t})]),key:`1`}:void 0,!n.useDropdown&&(n.deferSelection||e.$slots.footerContent)?{name:`footerContent`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`footerContent`,{close:t,apply:a.applySelection,cancel:a.cancelSelection},()=>[n.deferSelection?((0,m.openBlock)(),(0,m.createBlock)(u,{key:0,direction:`row`,gap:`400`,justify:`end`,"data-qa":`dt-filter-pill__deferred-footer`},{default:(0,m.withCtx)(()=>[(0,m.createVNode)(s,{importance:`clear`,kind:`muted`,size:200,"data-qa":`dt-filter-pill__cancel-button`,onClick:a.cancelSelection},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(a.cancelButtonLabel),1)]),_:1},8,[`onClick`]),(0,m.createVNode)(s,{importance:`primary`,size:200,"data-qa":`dt-filter-pill__apply-button`,onClick:a.applySelection},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(a.applyButtonLabel),1)]),_:1},8,[`onClick`])]),_:1})):(0,m.createCommentVNode)(``,!0)])]),key:`2`}:void 0,n.useDropdown?{name:`list`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`content`,{close:t},()=>[((0,m.openBlock)(!0),(0,m.createElementBlock)(m.Fragment,null,(0,m.renderList)(i.filters,e=>((0,m.openBlock)(),(0,m.createBlock)(d,{key:e.name,role:`menuitem`,"navigation-type":`arrow-keys`,selected:e.active,onClick:n=>a.selectFilter(e,t)},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(e.name),1)]),_:2},1032,[`selected`,`onClick`]))),128))])]),key:`3`}:void 0]),1040,[`open`,`content-mode`])),a.hasClear?(0,m.withDirectives)(((0,m.openBlock)(),(0,m.createBlock)(s,{key:0,active:a.isActive,"aria-label":a.clearButtonAriaLabel,class:(0,m.normalizeClass)([`d-filter-pill__clear`,{"d-filter-pill__clear--selected":a.isActive}]),disabled:n.disabled,kind:a.buttonKind,size:n.size,title:a.clearButtonTitle,"data-qa":`dt-filter-pill__clear-button`,importance:`outlined`,onClick:a.clearFilter},{icon:(0,m.withCtx)(()=>[(0,m.createVNode)(f,{size:a.clearIconSize},null,8,[`size`])]),_:1},8,[`active`,`aria-label`,`class`,`disabled`,`kind`,`size`,`title`,`onClick`])),[[p,n.endTooltipText]]):(0,m.createCommentVNode)(``,!0)],2)}var x=n.t(g,[[`render`,b]]);exports.default=x;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/validators/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../mode_constants-CzYJW9ua.cjs`),i=require(`../../localization/index.cjs`),a=require(`../button/button-constants.cjs`),o=require(`../button/button.cjs`),s=require(`../checkbox/checkbox.cjs`),c=require(`../checkbox-group/checkbox-group.cjs`),l=require(`../list-item/list-item.cjs`),u=require(`../stack/stack.cjs`),d=require(`../popover/popover-constants.cjs`),f=require(`../popover/popover.cjs`),p=require(`../dropdown/dropdown.cjs`);let m=require(`vue`),h=require(`@dialpad/dialtone-icons/vue`);var g={name:`DtFilterPill`,components:{DtCheckboxGroup:c.default,DtCheckbox:s.default,DtPopover:f.default,DtButton:o.default,DtIconClose:h.DtIconClose,DtIconChevronDown:h.DtIconChevronDown,DtDropdown:p.default,DtListItem:l.default,DtStack:u.default},props:{useDropdown:{type:Boolean,default:!1},deferSelection:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]},startTooltipText:{type:String,default:``},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},showClear:{type:Boolean,default:!0},label:{type:String,default:void 0},endTooltipText:{type:String,default:``},popoverAppendTo:{type:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>d.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},popoverFallbackPlacements:{type:Array,default:()=>[`auto`]},popoverMaxHeight:{type:String,default:``},popoverMaxWidth:{type:String,default:``},popoverPadding:{type:String,default:`large`,validator:e=>Object.keys(d.POPOVER_PADDING_CLASSES).some(t=>t===e)},popoverPlacement:{type:String,default:`bottom-start`},labelClass:{type:[String,Array,Object],default:``},popoverContentClass:{type:[String,Array,Object],default:``},popoverHeaderClass:{type:[String,Array,Object],default:``},popoverFooterClass:{type:[String,Array,Object],default:``},popoverDialogClass:{type:[String,Array,Object],default:``},dropdownListClass:{type:[String,Array,Object],default:``},contentMode:r.t,size:{type:[String,Number],default:200,validator:t.ordinalSizeValidator(a.BUTTON_SIZE_MODIFIERS)}},emits:[`clear`,`open`,`update:modelValue`,`apply`],data(){return{isOpen:!1,i18n:new i.DialtoneLocalization,filters:this.modelValue,pendingFilters:null}},computed:{overlayComponent(){return this.useDropdown?`dt-dropdown`:`dt-popover`},overlayProps(){let e={"append-to":this.popoverAppendTo,"fallback-placements":this.popoverFallbackPlacements,"max-height":this.popoverMaxHeight,"max-width":this.popoverMaxWidth,modal:!0,placement:this.popoverPlacement};return this.useDropdown?e[`list-class`]=this.dropdownListClass:(e.padding=this.popoverPadding,e[`content-class`]=this.popoverContentClass,e[`header-wrapper-class`]=this.popoverHeaderClass,e[`footer-wrapper-class`]=this.popoverFooterClass,e[`dialog-class`]=this.popoverDialogClass),e},buttonKind(){return this.isActive&&!this.disabled?`default`:`muted`},resolvedStartTooltipText(){return this.readOnly?this.startTooltipText||this.i18n.$t(`DIALTONE_FILTER_PILL_READ_ONLY_TOOLTIP`):this.startTooltipText},clearButtonAriaLabel(){return this.endTooltipText||this.i18n.$t(`DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL`)},clearButtonTitle(){if(!this.endTooltipText)return this.clearButtonAriaLabel},activeFilters(){return this.filters.filter(e=>e.active).map(e=>e.name)},activeFilterList(){return this.activeFilters.length===this.filters.length&&this.filters.length>1?`All`:this.activeFilters[0]??``},activeFilterOverflow(){return this.activeFilters.length<=1||this.activeFilters.length===this.filters.length&&this.filters.length>1?``:`+`+(this.activeFilters.length-1)},isActive(){return this.activeFilterList.length>0},hasClear(){return!this.readOnly&&this.showClear&&this.activeFilterList.length>0},displayFilters(){return this.deferSelection&&this.pendingFilters?this.pendingFilters:this.filters},pendingActiveFilters(){return this.pendingFilters?this.pendingFilters.filter(e=>e.active).map(e=>e.name):[]},cancelButtonLabel(){return this.i18n.$t(`DIALTONE_FILTER_PILL_CANCEL_BUTTON_LABEL`)},applyButtonLabel(){return this.i18n.$t(`DIALTONE_FILTER_PILL_APPLY_BUTTON_LABEL`)},clearIconSize(){return String(this.size)===`100`?`100`:a.BUTTON_ICON_SIZES[String(this.size)]}},watch:{isOpen(e){this.$emit(`open`,e),this.deferSelection&&(e?this.pendingFilters=JSON.parse(JSON.stringify(this.filters)):this.pendingFilters=null)},filters:{deep:!0,handler(e){this.$emit(`update:modelValue`,e)}}},mounted(){this.modelValue?.length||this.$slots.content&&this.$slots.content()||console.warn(`Please provide content through the v-model or the "content" slot.`),this.deferSelection&&this.useDropdown&&console.warn(`deferSelection has no effect when useDropdown is true.`)},methods:{clearFilter(e){this.filters.forEach(e=>delete e.active),this.$emit(`clear`,e)},openPopover(){this.readOnly||(this.isOpen=!0)},selectFilter(e,t){this.filters.forEach(t=>{t.active=t===e}),t()},applySelection(){this.pendingFilters&&(this.filters.forEach((e,t)=>{this.pendingFilters[t]?e.active=this.pendingFilters[t].active:delete e.active}),this.$emit(`apply`),this.isOpen=!1)},cancelSelection(){this.isOpen=!1}}},_=[`title`,`textContent`],v=[`title`,`textContent`],y=[`title`,`textContent`];function b(e,t,n,r,i,a){let o=(0,m.resolveComponent)(`dt-icon-chevron-down`),s=(0,m.resolveComponent)(`dt-button`),c=(0,m.resolveComponent)(`dt-checkbox`),l=(0,m.resolveComponent)(`dt-checkbox-group`),u=(0,m.resolveComponent)(`dt-stack`),d=(0,m.resolveComponent)(`dt-list-item`),f=(0,m.resolveComponent)(`dt-icon-close`),p=(0,m.resolveDirective)(`dt-tooltip`);return(0,m.openBlock)(),(0,m.createElementBlock)(`div`,{class:(0,m.normalizeClass)([`d-filter-pill`,{"d-filter-pill--read-only":n.readOnly}]),"data-qa":`dt-filter-pill`},[((0,m.openBlock)(),(0,m.createBlock)((0,m.resolveDynamicComponent)(a.overlayComponent),(0,m.mergeProps)({open:i.isOpen,"onUpdate:open":t[0]||(t[0]=e=>i.isOpen=e)},a.overlayProps,{"content-mode":n.contentMode}),(0,m.createSlots)({anchor:(0,m.withCtx)(t=>[(0,m.withDirectives)(((0,m.openBlock)(),(0,m.createBlock)(s,(0,m.mergeProps)(n.useDropdown?t:t.attrs,{active:a.isActive,"aria-disabled":n.readOnly||void 0,class:[`d-filter-pill__primary`,{"d-filter-pill--selected":a.isActive}],disabled:n.disabled,kind:a.buttonKind,size:n.size,"data-qa":`dt-filter-pill__button`,importance:`outlined`,onClick:a.openPopover,onKeydown:(0,m.withKeys)((0,m.withModifiers)(a.openPopover,[`prevent`]),[`up`,`down`])}),(0,m.createSlots)({default:(0,m.withCtx)(()=>[(0,m.createElementVNode)(`span`,{class:(0,m.normalizeClass)([`d-filter-pill__label`,n.labelClass])},[(0,m.renderSlot)(e.$slots,`default`,{label:n.label,filters:i.filters,activeFilters:a.activeFilters,activeFilterList:a.activeFilterList,activeFilterOverflow:a.activeFilterOverflow},()=>[(0,m.createElementVNode)(`span`,{class:`d-filter-pill__label-start`,title:n.label,textContent:(0,m.toDisplayString)(n.label)},null,8,_),a.activeFilterList?((0,m.openBlock)(),(0,m.createElementBlock)(`span`,{key:0,class:`d-filter-pill__label-end`,title:a.activeFilterList,textContent:(0,m.toDisplayString)(a.activeFilterList)},null,8,v)):(0,m.createCommentVNode)(``,!0),a.activeFilterOverflow?((0,m.openBlock)(),(0,m.createElementBlock)(`span`,{key:1,class:`d-filter-pill__label-end-overflow`,title:`plus ${a.activeFilters.length-1} others`,textContent:(0,m.toDisplayString)(a.activeFilterOverflow)},null,8,y)):(0,m.createCommentVNode)(``,!0)])],2)]),_:2},[e.$slots.startIcon?{name:`startIcon`,fn:(0,m.withCtx)(({iconSize:t})=>[(0,m.renderSlot)(e.$slots,`startIcon`,{iconSize:t})]),key:`0`}:void 0,n.readOnly?void 0:{name:`endIcon`,fn:(0,m.withCtx)(({iconSize:e})=>[(0,m.createVNode)(o,{size:e,class:`d-filter-pill__icon`,"data-qa":`dt-filter-pill__icon`},null,8,[`size`])]),key:`1`}]),1040,[`active`,`aria-disabled`,`class`,`disabled`,`kind`,`size`,`onClick`,`onKeydown`])),[[p,a.resolvedStartTooltipText]])]),_:2},[n.useDropdown?void 0:{name:`content`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`content`,{close:t,apply:a.applySelection,cancel:a.cancelSelection,pendingFilters:i.pendingFilters},()=>[n.modelValue?.length?((0,m.openBlock)(),(0,m.createBlock)(l,{key:0,"model-value":n.deferSelection?a.pendingActiveFilters:a.activeFilters,"aria-label":n.label,name:n.label||`filter-pill`},{default:(0,m.withCtx)(()=>[((0,m.openBlock)(!0),(0,m.createElementBlock)(m.Fragment,null,(0,m.renderList)(a.displayFilters,e=>((0,m.openBlock)(),(0,m.createBlock)(c,{key:e.name,label:e.name,value:e.name,"onUpdate:modelValue":t=>e.active=t},null,8,[`label`,`value`,`onUpdate:modelValue`]))),128))]),_:1},8,[`model-value`,`aria-label`,`name`])):(0,m.createCommentVNode)(``,!0)])]),key:`0`},!n.useDropdown&&e.$slots.headerContent?{name:`headerContent`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`headerContent`,{close:t})]),key:`1`}:void 0,!n.useDropdown&&(n.deferSelection||e.$slots.footerContent)?{name:`footerContent`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`footerContent`,{close:t,apply:a.applySelection,cancel:a.cancelSelection},()=>[n.deferSelection?((0,m.openBlock)(),(0,m.createBlock)(u,{key:0,direction:`row`,gap:`400`,justify:`end`,"data-qa":`dt-filter-pill__deferred-footer`},{default:(0,m.withCtx)(()=>[(0,m.createVNode)(s,{importance:`clear`,kind:`muted`,size:200,"data-qa":`dt-filter-pill__cancel-button`,onClick:a.cancelSelection},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(a.cancelButtonLabel),1)]),_:1},8,[`onClick`]),(0,m.createVNode)(s,{importance:`primary`,size:200,"data-qa":`dt-filter-pill__apply-button`,onClick:a.applySelection},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(a.applyButtonLabel),1)]),_:1},8,[`onClick`])]),_:1})):(0,m.createCommentVNode)(``,!0)])]),key:`2`}:void 0,n.useDropdown?{name:`list`,fn:(0,m.withCtx)(({close:t})=>[(0,m.renderSlot)(e.$slots,`content`,{close:t},()=>[((0,m.openBlock)(!0),(0,m.createElementBlock)(m.Fragment,null,(0,m.renderList)(i.filters,e=>((0,m.openBlock)(),(0,m.createBlock)(d,{key:e.name,role:`menuitem`,"navigation-type":`arrow-keys`,selected:e.active,onClick:n=>a.selectFilter(e,t)},{default:(0,m.withCtx)(()=>[(0,m.createTextVNode)((0,m.toDisplayString)(e.name),1)]),_:2},1032,[`selected`,`onClick`]))),128))])]),key:`3`}:void 0]),1040,[`open`,`content-mode`])),a.hasClear?(0,m.withDirectives)(((0,m.openBlock)(),(0,m.createBlock)(s,{key:0,active:a.isActive,"aria-label":a.clearButtonAriaLabel,class:(0,m.normalizeClass)([`d-filter-pill__clear`,{"d-filter-pill__clear--selected":a.isActive}]),disabled:n.disabled,kind:a.buttonKind,size:n.size,title:a.clearButtonTitle,"data-qa":`dt-filter-pill__clear-button`,importance:`outlined`,onClick:a.clearFilter},{icon:(0,m.withCtx)(()=>[(0,m.createVNode)(f,{size:a.clearIconSize},null,8,[`size`])]),_:1},8,[`active`,`aria-label`,`class`,`disabled`,`kind`,`size`,`title`,`onClick`])),[[p,n.endTooltipText]]):(0,m.createCommentVNode)(``,!0)],2)}var x=n.t(g,[[`render`,b]]);exports.default=x;
|
|
2
2
|
//# sourceMappingURL=filter-pill.cjs.map
|
|
@@ -2,8 +2,8 @@ import { HTML_ELEMENT_TYPE as e } from "../../common/constants/index.js";
|
|
|
2
2
|
import { ordinalSizeValidator as t } from "../../common/validators/index.js";
|
|
3
3
|
import { t as n } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
|
|
4
4
|
import { t as r } from "../../mode_constants-tb7TL85q.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { DialtoneLocalization as i } from "../../localization/index.js";
|
|
6
|
+
import { BUTTON_ICON_SIZES as a, BUTTON_SIZE_MODIFIERS as o } from "../button/button-constants.js";
|
|
7
7
|
import s from "../button/button.js";
|
|
8
8
|
import c from "../checkbox/checkbox.js";
|
|
9
9
|
import l from "../checkbox-group/checkbox-group.js";
|
|
@@ -143,7 +143,7 @@ var z = {
|
|
|
143
143
|
size: {
|
|
144
144
|
type: [String, Number],
|
|
145
145
|
default: 200,
|
|
146
|
-
validator: t(
|
|
146
|
+
validator: t(o)
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
emits: [
|
|
@@ -155,7 +155,7 @@ var z = {
|
|
|
155
155
|
data() {
|
|
156
156
|
return {
|
|
157
157
|
isOpen: !1,
|
|
158
|
-
i18n: new
|
|
158
|
+
i18n: new i(),
|
|
159
159
|
filters: this.modelValue,
|
|
160
160
|
pendingFilters: null
|
|
161
161
|
};
|
|
@@ -215,7 +215,7 @@ var z = {
|
|
|
215
215
|
return this.i18n.$t("DIALTONE_FILTER_PILL_APPLY_BUTTON_LABEL");
|
|
216
216
|
},
|
|
217
217
|
clearIconSize() {
|
|
218
|
-
return String(this.size) === "100" ? "100" :
|
|
218
|
+
return String(this.size) === "100" ? "100" : a[String(this.size)];
|
|
219
219
|
}
|
|
220
220
|
},
|
|
221
221
|
watch: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/validators/index.cjs`),t=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),n=require(`../icon/icon-constants.cjs`),r=require(`./loader-constants.cjs`);let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/validators/index.cjs`),t=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),n=require(`../icon/icon-constants.cjs`),r=require(`./loader-constants.cjs`),i=require(`../../localization/index.cjs`);let a=require(`vue`);var o={name:`DtLoader`,inheritAttrs:!1,props:{ariaLabel:{type:String,default:``},kind:{type:String,default:`dots`,validator:e=>Object.keys(r.LOADER_KIND_MODIFIERS).includes(e)},size:{type:[String,Number],default:500,validator:e.ordinalSizeValidator(n.ICON_SIZE_MODIFIERS)}},data(){return{i18n:new i.DialtoneLocalization}},computed:{accessibleLabel(){if(![`none`,`presentation`].includes(this.$attrs.role))return this.ariaLabel||this.i18n.$t(`DIALTONE_LOADING`)},isSpinner(){return this.kind===`spinner`},loaderKindClass(){return this.isSpinner?r.LOADER_KIND_MODIFIERS.spinner:r.LOADER_KIND_MODIFIERS.dots}}},s=[`aria-label`,`role`];function c(e,t,n,r,i,o){return(0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({class:[`d-loader`,o.loaderKindClass],"aria-label":o.accessibleLabel,"data-qa":`dt-loader`},e.$attrs,{role:e.$attrs.role??`img`}),[o.isSpinner?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{class:(0,a.normalizeClass)([`d-icon`,`d-icon--size-${n.size}`,`d-loader__icon-track`]),"data-qa":`dt-loader-icon-track`,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[...t[0]||(t[0]=[(0,a.createElementVNode)(`path`,{d:`
|
|
2
2
|
M12 0.0180664C18.6175 0.0180664 23.9819 5.38305 23.9819
|
|
3
3
|
12.0005C23.9819 18.6177 18.6175 23.9819 12 23.9819C5.38281
|
|
4
4
|
23.9819 0.0180664 18.6177 0.0180664 12.0005C0.0180664
|
|
@@ -6,7 +6,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
6
6
|
3.26807 3.26807 7.17797 3.26807 12.0005C3.26807 16.8228
|
|
7
7
|
7.17773 20.7319 12 20.7319C16.8223 20.7319 20.7319 16.8228
|
|
8
8
|
20.7319 12.0005C20.7319 7.17797 16.8223 3.26807 12 3.26807Z
|
|
9
|
-
`},null,-1)])],2)),((0,
|
|
9
|
+
`},null,-1)])],2)),((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{class:(0,a.normalizeClass)([`d-icon`,`d-icon--size-${n.size}`,`d-loader__icon`]),"data-qa":`dt-loader-icon`,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[...t[1]||(t[1]=[(0,a.createElementVNode)(`path`,{d:`
|
|
10
10
|
M0.0180664 12.0005
|
|
11
11
|
C0.0180664 5.38305 5.38305 0.0180664 12.0005 0.0180664
|
|
12
12
|
C12.8977 0.0183302 13.6255 0.745766 13.6255 1.64307
|
|
@@ -18,5 +18,5 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
18
18
|
C23.2544 10.3755 23.9819 11.103 23.9819 12.0005
|
|
19
19
|
C23.9817 18.6175 18.6175 23.9817 12.0005 23.9819
|
|
20
20
|
C5.38321 23.9819 0.0183303 18.6177 0.0180664 12.0005Z
|
|
21
|
-
`},null,-1)])],2))],64)):((0,
|
|
21
|
+
`},null,-1)])],2))],64)):((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{key:1,class:(0,a.normalizeClass)([`d-icon`,`d-icon--size-${n.size}`,`d-loader__icon`]),"data-qa":`dt-loader-icon`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[...t[2]||(t[2]=[(0,a.createElementVNode)(`circle`,{class:`d-loader__dot d-loader__dot--1`,"data-qa":`dt-loader-dot`,cx:`14.843`,cy:`9.471`,r:`2.410`},null,-1),(0,a.createElementVNode)(`circle`,{class:`d-loader__dot d-loader__dot--2`,"data-qa":`dt-loader-dot`,cx:`9.156`,cy:`15.199`,r:`2.410`},null,-1),(0,a.createElementVNode)(`circle`,{class:`d-loader__dot d-loader__dot--3`,"data-qa":`dt-loader-dot`,cx:`15.469`,cy:`15.743`,r:`3.647`},null,-1),(0,a.createElementVNode)(`circle`,{class:`d-loader__dot d-loader__dot--4`,"data-qa":`dt-loader-dot`,cx:`8.539`,cy:`8.915`,r:`3.647`},null,-1)])],2))],16,s)}var l=t.t(o,[[`render`,c]]);exports.default=l;
|
|
22
22
|
//# sourceMappingURL=loader.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.cjs","names":[],"sources":["../../../components/Loader/Loader.vue"],"sourcesContent":["<template>\n <div\n :class=\"['d-loader', loaderKindClass]\"\n :aria-label=\"
|
|
1
|
+
{"version":3,"file":"loader.cjs","names":[],"sources":["../../../components/Loader/Loader.vue"],"sourcesContent":["<template>\n <div\n :class=\"['d-loader', loaderKindClass]\"\n :aria-label=\"accessibleLabel\"\n data-qa=\"dt-loader\"\n v-bind=\"$attrs\"\n :role=\"$attrs.role ?? 'img'\"\n >\n <template v-if=\"isSpinner\">\n <svg\n :class=\"['d-icon', `d-icon--size-${size}`, 'd-loader__icon-track']\"\n data-qa=\"dt-loader-icon-track\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path\n d=\"\n M12 0.0180664C18.6175 0.0180664 23.9819 5.38305 23.9819\n 12.0005C23.9819 18.6177 18.6175 23.9819 12 23.9819C5.38281\n 23.9819 0.0180664 18.6177 0.0180664 12.0005C0.0180664\n 5.38305 5.38281 0.0180664 12 0.0180664ZM12 3.26807C7.17773\n 3.26807 3.26807 7.17797 3.26807 12.0005C3.26807 16.8228\n 7.17773 20.7319 12 20.7319C16.8223 20.7319 20.7319 16.8228\n 20.7319 12.0005C20.7319 7.17797 16.8223 3.26807 12 3.26807Z\n \"\n />\n </svg>\n <svg\n :class=\"['d-icon', `d-icon--size-${size}`, 'd-loader__icon']\"\n data-qa=\"dt-loader-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path\n d=\"\n M0.0180664 12.0005\n C0.0180664 5.38305 5.38305 0.0180664 12.0005 0.0180664\n C12.8977 0.0183302 13.6255 0.745766 13.6255 1.64307\n C13.6255 2.54037 12.8977 3.2678 12.0005 3.26807\n C7.17797 3.26807 3.26807 7.17797 3.26807 12.0005\n C3.26833 16.8228 7.17814 20.7319 12.0005 20.7319\n C16.8226 20.7317 20.7317 16.8226 20.7319 12.0005\n C20.7319 11.103 21.4595 10.3755 22.3569 10.3755\n C23.2544 10.3755 23.9819 11.103 23.9819 12.0005\n C23.9817 18.6175 18.6175 23.9817 12.0005 23.9819\n C5.38321 23.9819 0.0183303 18.6177 0.0180664 12.0005Z\n \"\n />\n </svg>\n </template>\n <svg\n v-else\n :class=\"['d-icon', `d-icon--size-${size}`, 'd-loader__icon']\"\n data-qa=\"dt-loader-icon\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <!--\n Rest positions and radii in the 24-unit viewBox. They must stay in sync\n with the keyframes in loader.less, which include a 5% outward spread and\n a 0.9655 scale on top of the Figma spec.\n -->\n <circle\n class=\"d-loader__dot d-loader__dot--1\"\n data-qa=\"dt-loader-dot\"\n cx=\"14.843\"\n cy=\"9.471\"\n r=\"2.410\"\n />\n <circle\n class=\"d-loader__dot d-loader__dot--2\"\n data-qa=\"dt-loader-dot\"\n cx=\"9.156\"\n cy=\"15.199\"\n r=\"2.410\"\n />\n <circle\n class=\"d-loader__dot d-loader__dot--3\"\n data-qa=\"dt-loader-dot\"\n cx=\"15.469\"\n cy=\"15.743\"\n r=\"3.647\"\n />\n <circle\n class=\"d-loader__dot d-loader__dot--4\"\n data-qa=\"dt-loader-dot\"\n cx=\"8.539\"\n cy=\"8.915\"\n r=\"3.647\"\n />\n </svg>\n </div>\n</template>\n\n<script>\nimport { ICON_SIZE_MODIFIERS } from '@/components/Icon';\nimport { ordinalSizeValidator } from '@/common/validators';\nimport { LOADER_KIND_MODIFIERS } from './LoaderConstants';\nimport { DialtoneLocalization } from '@/localization';\n\nexport default {\n name: 'DtLoader',\n\n inheritAttrs: false,\n\n props: {\n /**\n * The label of the loader as read out by a screen reader.\n * Defaults to the localized loading message.\n */\n ariaLabel: {\n type: String,\n default: '',\n },\n\n /**\n * The visual style of the loader: the four-dot loader, or the circular spinner.\n * @values dots, spinner\n */\n kind: {\n type: String,\n default: 'dots',\n validator: (kind) => Object.keys(LOADER_KIND_MODIFIERS).includes(kind),\n },\n\n /**\n * The size of the icon.\n * @values 100, 200, 300, 400, 500, 600, 700, 800\n */\n size: {\n type: [String, Number],\n default: 500,\n validator: ordinalSizeValidator(ICON_SIZE_MODIFIERS),\n },\n },\n\n data () {\n return {\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n accessibleLabel () {\n if (['none', 'presentation'].includes(this.$attrs.role)) return undefined;\n return this.ariaLabel || this.i18n.$t('DIALTONE_LOADING');\n },\n\n isSpinner () {\n return this.kind === 'spinner';\n },\n\n loaderKindClass () {\n return this.isSpinner ? LOADER_KIND_MODIFIERS.spinner : LOADER_KIND_MODIFIERS.dots;\n },\n },\n};\n</script>\n"],"mappings":"6XAyGA,IAAK,EAAU,CACb,KAAM,WAEN,aAAc,GAEd,MAAO,CAKL,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,KAAM,CACJ,KAAM,OACN,QAAS,OACT,UAAY,GAAS,OAAO,KAAK,EAAA,sBAAsB,CAAC,SAAS,EAAK,CACvE,CAMD,KAAM,CACJ,KAAM,CAAC,OAAQ,OAAO,CACtB,QAAS,IACT,UAAW,EAAA,qBAAqB,EAAA,oBAAoB,CACrD,CACF,CAED,MAAQ,CACN,MAAO,CACL,KAAM,IAAI,EAAA,qBACX,EAGH,SAAU,CACR,iBAAmB,CACb,KAAC,OAAQ,eAAe,CAAC,SAAS,KAAK,OAAO,KAAK,CACvD,OAAO,KAAK,WAAa,KAAK,KAAK,GAAG,mBAAmB,EAG3D,WAAa,CACX,OAAO,KAAK,OAAS,WAGvB,iBAAmB,CACjB,OAAO,KAAK,UAAY,EAAA,sBAAsB,QAAU,EAAA,sBAAsB,MAEjF,CACF,kGAjEO,OAAA,EAAA,EAAA,YAAA,CA9FH,MAAK,CAAA,WAAe,EAAA,gBAAe,CACnC,aAAY,EAAA,gBACb,UAAQ,aACA,EAAA,OAAM,CACb,KAAM,EAAA,OAAO,MAAI,MAAA,CAAA,CAAA,CAEF,EAAA,YAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oBA6CL,EAAA,SAAA,CAAA,IAAA,EAAA,CAAA,GAAA,EAAA,EAAA,YAAA,EAAA,EAAA,EAAA,oB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