@dialpad/dialtone-vue 4.5.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 +18 -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 +36 -2
- package/dist/components/Banner/Banner.vue.d.ts.map +1 -1
- package/dist/components/Button/Button.vue.d.ts +18 -1
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Chip/Chip.vue.d.ts +18 -1
- package/dist/components/Chip/Chip.vue.d.ts.map +1 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts +18 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts.map +1 -1
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts +36 -2
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +36 -2
- package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/FilterPill/FilterPill.vue.d.ts +90 -5
- package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
- package/dist/components/Hovercard/Hovercard.vue.d.ts +72 -4
- package/dist/components/Hovercard/Hovercard.vue.d.ts.map +1 -1
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts +36 -2
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts.map +1 -1
- package/dist/components/Loader/Loader.vue.d.ts +18 -1
- package/dist/components/Loader/Loader.vue.d.ts.map +1 -1
- package/dist/components/Loader/LoaderConstants.d.ts +5 -0
- package/dist/components/Loader/LoaderConstants.d.ts.map +1 -0
- package/dist/components/Loader/index.d.ts +1 -0
- package/dist/components/Modal/Modal.vue.d.ts +37 -3
- package/dist/components/Modal/Modal.vue.d.ts.map +1 -1
- package/dist/components/Notice/Notice.vue.d.ts +36 -2
- package/dist/components/Notice/Notice.vue.d.ts.map +1 -1
- package/dist/components/Notice/NoticeAction.vue.d.ts +36 -2
- package/dist/components/Notice/NoticeAction.vue.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.vue.d.ts +18 -1
- package/dist/components/Pagination/Pagination.vue.d.ts.map +1 -1
- package/dist/components/Popover/Popover.vue.d.ts +36 -2
- package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
- package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts +18 -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 +55 -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 +72 -4
- package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts +18 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonStart.vue.d.ts +18 -1
- package/dist/components/Tab/Tab.vue.d.ts +18 -1
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts +36 -2
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts.map +1 -1
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts +36 -2
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts.map +1 -1
- package/dist/components/Toast/Toast.vue.d.ts +144 -8
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +116 -115
- 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/index.cjs +1 -1
- package/dist/lib/loader/index.js +3 -2
- package/dist/lib/loader/loader-constants.cjs +2 -0
- package/dist/lib/loader/loader-constants.cjs.map +1 -0
- package/dist/lib/loader/loader-constants.js +9 -0
- package/dist/lib/loader/loader-constants.js.map +1 -0
- package/dist/lib/loader/loader.cjs +21 -21
- package/dist/lib/loader/loader.cjs.map +1 -1
- package/dist/lib/loader/loader.js +77 -14
- 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 +5 -5
|
@@ -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>\n"],"mappings":"ukBAqEA,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,CAM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AA,EAAA,EAAA,YAAA,CAHA,IAAI,SAAQ,CAEJ,EAAK,CAAA,CAAA,CAAA,CAGN,SAAA,EAAA,EAAA,UAgBJ,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
|
+
{"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,w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EAAA,YAAA,CA5DX,IAAI,UACH,gBAAe,EAAA,aACf,eAAc,EAAA,YACd,KAAM,EAAA,KACN,UAAW,EAAA,UACX,wBAAuB,EAAA,mBAAkB,QAAA,SACzC,sBAAqB,EAAA,mBACtB,QAAQ,OACR,KAAK,OACJ,YAAW,EAAA,SACX,MAAO,EAAA,MACP,aAAY,EAAA,UACZ,YAAW,EAAA,SACX,uBAAsB,EAAA,wBACtB,kBAAiB,EAAA,eACV,EAAA,OAAM,CACb,OAAQ,EAAA,OACR,WAAY,EAAA,WACZ,eAAc,EAAA,8BACS,EAAlB,kBAAiB,CAAA,CAAA,CAEZ,QAAA,EAAA,EAAA,UAYP,CAZiB,WAAK,EAAA,EAAA,EAAA,YAYtB,EAAA,OAAA,UAAA,EAAA,EAAA,YAAA,CAHA,IAAI,SAAQ,CAEJ,EAAK,CAAA,CAAA,CAAA,CAGN,SAAA,EAAA,EAAA,UAgBJ,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,MAAM,MAAS,MAAS,EAAQ;GAEhF;EAMD,OAAO;GACL,MAAM;GACN,SAAS;GACV;EAOD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EAMD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EAMD,QAAQ;GACN,MAAM;GACN,UAAW;AAAE,WAAO,GAAiB;;GACtC;EASD,gBAAgB;GACd,MAAM;GACN,SAAS,EAA2B;GACpC,YAAY,MAAM,OAAO,OAAO,EAA2B,CAAC,SAAS,EAAE;GACxE;EAYD,oBAAoB;GAClB,MAAM;GACN,eACS,CAAC,OAAO;GAElB;EAMD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EAKD,mBAAmB;GACjB,MAAM;GACN,SAAS;GACV;EAKD,aAAa;GACX,MAAM;GACN,SAAS;GACV;EAKD,WAAW;GACT,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAKD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAO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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,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,MAAM,MAAS,MAAS,EAAQ;GAEhF;EAMD,OAAO;GACL,MAAM;GACN,SAAS;GACV;EAOD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EAMD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EAMD,QAAQ;GACN,MAAM;GACN,UAAW;AAAE,WAAO,GAAiB;;GACtC;EASD,gBAAgB;GACd,MAAM;GACN,SAAS,EAA2B;GACpC,YAAY,MAAM,OAAO,OAAO,EAA2B,CAAC,SAAS,EAAE;GACxE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,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 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./loader.cjs`);exports.DtLoader=e.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./loader-constants.cjs`),t=require(`./loader.cjs`);exports.DtLoader=t.default,exports.LOADER_KIND_MODIFIERS=e.LOADER_KIND_MODIFIERS;
|
package/dist/lib/loader/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import e from "./loader.js";
|
|
2
|
-
|
|
1
|
+
import { LOADER_KIND_MODIFIERS as e } from "./loader-constants.js";
|
|
2
|
+
import t from "./loader.js";
|
|
3
|
+
export { t as DtLoader, e as LOADER_KIND_MODIFIERS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-constants.cjs","names":[],"sources":["../../../components/Loader/LoaderConstants.js"],"sourcesContent":["export const LOADER_KIND_MODIFIERS = {\n dots: '',\n spinner: 'd-loader--spinner',\n};\n"],"mappings":"mEAAA,IAAa,EAAwB,CACnC,KAAM,GACN,QAAS,oBACV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-constants.js","names":[],"sources":["../../../components/Loader/LoaderConstants.js"],"sourcesContent":["export const LOADER_KIND_MODIFIERS = {\n dots: '',\n spinner: 'd-loader--spinner',\n};\n"],"mappings":";AAAA,IAAa,IAAwB;CACnC,MAAM;CACN,SAAS;CACV"}
|
|
@@ -1,22 +1,22 @@
|
|
|
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`);let
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
M12 0.0180664C18.6175 0.0180664 23.9819 5.38305 23.9819
|
|
3
|
+
12.0005C23.9819 18.6177 18.6175 23.9819 12 23.9819C5.38281
|
|
4
|
+
23.9819 0.0180664 18.6177 0.0180664 12.0005C0.0180664
|
|
5
|
+
5.38305 5.38281 0.0180664 12 0.0180664ZM12 3.26807C7.17773
|
|
6
|
+
3.26807 3.26807 7.17797 3.26807 12.0005C3.26807 16.8228
|
|
7
|
+
7.17773 20.7319 12 20.7319C16.8223 20.7319 20.7319 16.8228
|
|
8
|
+
20.7319 12.0005C20.7319 7.17797 16.8223 3.26807 12 3.26807Z
|
|
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
|
+
M0.0180664 12.0005
|
|
11
|
+
C0.0180664 5.38305 5.38305 0.0180664 12.0005 0.0180664
|
|
12
|
+
C12.8977 0.0183302 13.6255 0.745766 13.6255 1.64307
|
|
13
|
+
C13.6255 2.54037 12.8977 3.2678 12.0005 3.26807
|
|
14
|
+
C7.17797 3.26807 3.26807 7.17797 3.26807 12.0005
|
|
15
|
+
C3.26833 16.8228 7.17814 20.7319 12.0005 20.7319
|
|
16
|
+
C16.8226 20.7317 20.7317 16.8226 20.7319 12.0005
|
|
17
|
+
C20.7319 11.103 21.4595 10.3755 22.3569 10.3755
|
|
18
|
+
C23.2544 10.3755 23.9819 11.103 23.9819 12.0005
|
|
19
|
+
C23.9817 18.6175 18.6175 23.9817 12.0005 23.9819
|
|
20
|
+
C5.38321 23.9819 0.0183303 18.6177 0.0180664 12.0005Z
|
|
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\"\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,SAA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iBACR,QAAQ,YACR,MAAM,6BACN,cAAY,kDAaV,SAAA,CALA,MAAM,iCACN,UAAQ,gBACR,GAAG,SACH,GAAG,QACH,EAAE,2CAQF,SAAA,CALA,MAAM,iCACN,UAAQ,gBACR,GAAG,QACH,GAAG,SACH,EAAE,2CAQF,SAAA,CALA,MAAM,iCACN,UAAQ,gBACR,GAAG,SACH,GAAG,SACH,EAAE,2CAQF,SAAA,CALA,MAAM,iCACN,UAAQ,gBACR,GAAG,QACH,GAAG,QACH,EAAE"}
|
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
import { ordinalSizeValidator as e } from "../../common/validators/index.js";
|
|
2
2
|
import { t } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
|
|
3
3
|
import { ICON_SIZE_MODIFIERS as n } from "../icon/icon-constants.js";
|
|
4
|
-
import {
|
|
4
|
+
import { LOADER_KIND_MODIFIERS as r } from "./loader-constants.js";
|
|
5
|
+
import { DialtoneLocalization as i } from "../../localization/index.js";
|
|
6
|
+
import { Fragment as a, createElementBlock as o, createElementVNode as s, mergeProps as c, normalizeClass as l, openBlock as u } from "vue";
|
|
5
7
|
//#region components/Loader/Loader.vue
|
|
6
|
-
var
|
|
8
|
+
var d = {
|
|
7
9
|
name: "DtLoader",
|
|
10
|
+
inheritAttrs: !1,
|
|
8
11
|
props: {
|
|
9
12
|
ariaLabel: {
|
|
10
13
|
type: String,
|
|
11
14
|
default: ""
|
|
12
15
|
},
|
|
16
|
+
kind: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "dots",
|
|
19
|
+
validator: (e) => Object.keys(r).includes(e)
|
|
20
|
+
},
|
|
13
21
|
size: {
|
|
14
22
|
type: [String, Number],
|
|
15
23
|
default: 500,
|
|
16
24
|
validator: e(n)
|
|
17
25
|
}
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return { i18n: new i() };
|
|
29
|
+
},
|
|
30
|
+
computed: {
|
|
31
|
+
accessibleLabel() {
|
|
32
|
+
if (!["none", "presentation"].includes(this.$attrs.role)) return this.ariaLabel || this.i18n.$t("DIALTONE_LOADING");
|
|
33
|
+
},
|
|
34
|
+
isSpinner() {
|
|
35
|
+
return this.kind === "spinner";
|
|
36
|
+
},
|
|
37
|
+
loaderKindClass() {
|
|
38
|
+
return this.isSpinner ? r.spinner : r.dots;
|
|
39
|
+
}
|
|
18
40
|
}
|
|
19
|
-
},
|
|
20
|
-
function
|
|
21
|
-
return
|
|
22
|
-
class: "d-loader",
|
|
23
|
-
"aria-label":
|
|
41
|
+
}, f = ["aria-label", "role"];
|
|
42
|
+
function p(e, t, n, r, i, d) {
|
|
43
|
+
return u(), o("div", c({
|
|
44
|
+
class: ["d-loader", d.loaderKindClass],
|
|
45
|
+
"aria-label": d.accessibleLabel,
|
|
24
46
|
"data-qa": "dt-loader"
|
|
25
|
-
}, [(o(),
|
|
26
|
-
class:
|
|
47
|
+
}, e.$attrs, { role: e.$attrs.role ?? "img" }), [d.isSpinner ? (u(), o(a, { key: 0 }, [(u(), o("svg", {
|
|
48
|
+
class: l([
|
|
27
49
|
"d-icon",
|
|
28
50
|
`d-icon--size-${n.size}`,
|
|
29
51
|
"d-loader__icon-track"
|
|
30
52
|
]),
|
|
53
|
+
"data-qa": "dt-loader-icon-track",
|
|
31
54
|
viewBox: "0 0 24 24",
|
|
32
55
|
fill: "currentColor",
|
|
33
56
|
xmlns: "http://www.w3.org/2000/svg",
|
|
34
57
|
"aria-hidden": "true"
|
|
35
|
-
}, [...t[0] || (t[0] = [
|
|
36
|
-
class:
|
|
58
|
+
}, [...t[0] || (t[0] = [s("path", { 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 " }, null, -1)])], 2)), (u(), o("svg", {
|
|
59
|
+
class: l([
|
|
37
60
|
"d-icon",
|
|
38
61
|
`d-icon--size-${n.size}`,
|
|
39
62
|
"d-loader__icon"
|
|
@@ -43,10 +66,50 @@ function l(e, t, n, s, l, u) {
|
|
|
43
66
|
fill: "currentColor",
|
|
44
67
|
xmlns: "http://www.w3.org/2000/svg",
|
|
45
68
|
"aria-hidden": "true"
|
|
46
|
-
}, [...t[1] || (t[1] = [
|
|
69
|
+
}, [...t[1] || (t[1] = [s("path", { 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 " }, null, -1)])], 2))], 64)) : (u(), o("svg", {
|
|
70
|
+
key: 1,
|
|
71
|
+
class: l([
|
|
72
|
+
"d-icon",
|
|
73
|
+
`d-icon--size-${n.size}`,
|
|
74
|
+
"d-loader__icon"
|
|
75
|
+
]),
|
|
76
|
+
"data-qa": "dt-loader-icon",
|
|
77
|
+
viewBox: "0 0 24 24",
|
|
78
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
}, [...t[2] || (t[2] = [
|
|
81
|
+
s("circle", {
|
|
82
|
+
class: "d-loader__dot d-loader__dot--1",
|
|
83
|
+
"data-qa": "dt-loader-dot",
|
|
84
|
+
cx: "14.843",
|
|
85
|
+
cy: "9.471",
|
|
86
|
+
r: "2.410"
|
|
87
|
+
}, null, -1),
|
|
88
|
+
s("circle", {
|
|
89
|
+
class: "d-loader__dot d-loader__dot--2",
|
|
90
|
+
"data-qa": "dt-loader-dot",
|
|
91
|
+
cx: "9.156",
|
|
92
|
+
cy: "15.199",
|
|
93
|
+
r: "2.410"
|
|
94
|
+
}, null, -1),
|
|
95
|
+
s("circle", {
|
|
96
|
+
class: "d-loader__dot d-loader__dot--3",
|
|
97
|
+
"data-qa": "dt-loader-dot",
|
|
98
|
+
cx: "15.469",
|
|
99
|
+
cy: "15.743",
|
|
100
|
+
r: "3.647"
|
|
101
|
+
}, null, -1),
|
|
102
|
+
s("circle", {
|
|
103
|
+
class: "d-loader__dot d-loader__dot--4",
|
|
104
|
+
"data-qa": "dt-loader-dot",
|
|
105
|
+
cx: "8.539",
|
|
106
|
+
cy: "8.915",
|
|
107
|
+
r: "3.647"
|
|
108
|
+
}, null, -1)
|
|
109
|
+
])], 2))], 16, f);
|
|
47
110
|
}
|
|
48
|
-
var
|
|
111
|
+
var m = /* @__PURE__ */ t(d, [["render", p]]);
|
|
49
112
|
//#endregion
|
|
50
|
-
export {
|
|
113
|
+
export { m as default };
|
|
51
114
|
|
|
52
115
|
//# sourceMappingURL=loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","names":[],"sources":["../../../components/Loader/Loader.vue"],"sourcesContent":["<template>\n <div\n class=\"d-loader\"\n :aria-label=\"
|
|
1
|
+
{"version":3,"file":"loader.js","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 === 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