@dialpad/dialtone-vue 3.222.0 → 3.222.2
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/common/constants/index.cjs +1 -1
- package/dist/common/constants/index.cjs.map +1 -1
- package/dist/common/constants/index.d.ts +4 -0
- package/dist/common/constants/index.d.ts.map +1 -1
- package/dist/common/constants/index.js +10 -10
- package/dist/common/constants/index.js.map +1 -1
- package/dist/component-documentation.json +1 -1
- package/dist/components/combobox_with_popover/combobox_with_popover.vue.d.ts +18 -18
- package/dist/components/combobox_with_popover/combobox_with_popover.vue.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.vue.d.ts +18 -18
- package/dist/components/dropdown/dropdown.vue.d.ts.map +1 -1
- package/dist/components/emoji_picker/emoji_picker.vue.d.ts +22 -0
- package/dist/components/emoji_picker/modules/emoji_search.vue.d.ts +22 -0
- package/dist/components/emoji_picker/modules/emoji_search.vue.d.ts.map +1 -1
- package/dist/components/hovercard/hovercard.vue.d.ts +32 -32
- package/dist/components/hovercard/hovercard.vue.d.ts.map +1 -1
- package/dist/components/input/input.vue.d.ts +11 -0
- package/dist/components/input/input.vue.d.ts.map +1 -1
- package/dist/components/modal/modal.vue.d.ts +6 -5
- package/dist/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/components/popover/popover.vue.d.ts +13 -13
- package/dist/components/popover/popover.vue.d.ts.map +1 -1
- package/dist/components/resizable/composables/useResizableGroup.d.ts.map +1 -1
- package/dist/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts +24 -13
- package/dist/components/split_button/split_button.vue.d.ts +18 -18
- package/dist/components/tooltip/tooltip.vue.d.ts +8 -8
- package/dist/components/tooltip/tooltip.vue.d.ts.map +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +149 -149
- package/dist/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/lib/combobox-multi-select/combobox-multi-select.js +49 -48
- package/dist/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/dist/lib/combobox-with-popover/combobox-with-popover.cjs +1 -1
- package/dist/lib/combobox-with-popover/combobox-with-popover.cjs.map +1 -1
- package/dist/lib/combobox-with-popover/combobox-with-popover.js +43 -42
- package/dist/lib/combobox-with-popover/combobox-with-popover.js.map +1 -1
- package/dist/lib/dropdown/dropdown.cjs +1 -1
- package/dist/lib/dropdown/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown/dropdown.js +33 -33
- package/dist/lib/dropdown/dropdown.js.map +1 -1
- package/dist/lib/editor/editor.cjs +1 -1
- package/dist/lib/editor/editor.js +1 -1
- package/dist/lib/hovercard/hovercard.cjs +1 -1
- package/dist/lib/hovercard/hovercard.cjs.map +1 -1
- package/dist/lib/hovercard/hovercard.js +28 -27
- package/dist/lib/hovercard/hovercard.js.map +1 -1
- package/dist/lib/input/input.cjs +1 -1
- package/dist/lib/input/input.cjs.map +1 -1
- package/dist/lib/input/input.js +6 -6
- package/dist/lib/input/input.js.map +1 -1
- package/dist/lib/message-input/index.cjs +1 -1
- package/dist/lib/message-input/index.js +1 -1
- package/dist/lib/message-input/message-input.cjs +1 -1
- package/dist/lib/message-input/message-input.js +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 +61 -58
- package/dist/lib/modal/modal.js.map +1 -1
- package/dist/lib/popover/popover.cjs +1 -1
- package/dist/lib/popover/popover.cjs.map +1 -1
- package/dist/lib/popover/popover.js +76 -75
- package/dist/lib/popover/popover.js.map +1 -1
- package/dist/lib/resizable/index.cjs +1 -1
- package/dist/lib/resizable/index.js +1 -1
- package/dist/lib/resizable/resizable.cjs +1 -1
- package/dist/lib/resizable/resizable.js +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/tooltip/tooltip.cjs +2 -2
- package/dist/lib/tooltip/tooltip.cjs.map +1 -1
- package/dist/lib/tooltip/tooltip.js +30 -29
- package/dist/lib/tooltip/tooltip.js.map +1 -1
- package/dist/{message_input-B47LB7C8.js → message_input-B2fppje7.js} +2 -2
- package/dist/{message_input-B47LB7C8.js.map → message_input-B2fppje7.js.map} +1 -1
- package/dist/{message_input-BCIq_1AD.cjs → message_input-DmLi63dh.cjs} +2 -2
- package/dist/{message_input-BCIq_1AD.cjs.map → message_input-DmLi63dh.cjs.map} +1 -1
- package/dist/recipes/buttons/callbar_button/callbar_button.vue.d.ts +8 -8
- package/dist/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +26 -26
- package/dist/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +21 -21
- package/dist/recipes/cards/ivr_node/ivr_node.vue.d.ts +18 -18
- package/dist/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts +18 -18
- package/dist/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts +13 -13
- package/dist/recipes/conversation_view/editor/editor.vue.d.ts +63 -52
- package/dist/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +8 -8
- package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts +94 -50
- package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/recipes/conversation_view/message_input/message_input_button.vue.d.ts +8 -8
- package/dist/recipes/conversation_view/message_input/message_input_link.vue.d.ts +32 -21
- package/dist/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
- package/dist/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +8 -8
- package/dist/recipes/leftbar/contact_row/contact_row.vue.d.ts +8 -8
- package/dist/recipes/leftbar/general_row/general_row.vue.d.ts +8 -8
- package/dist/recipes/leftbar/group_row/group_row.vue.d.ts +8 -8
- package/dist/{resizable-aOVGO_Os.cjs → resizable-BOCf9EIc.cjs} +2 -2
- package/dist/{resizable-aOVGO_Os.cjs.map → resizable-BOCf9EIc.cjs.map} +1 -1
- package/dist/{resizable-D4-peBOl.js → resizable-CPaF9dgG.js} +7 -3
- package/dist/{resizable-D4-peBOl.js.map → resizable-CPaF9dgG.js.map} +1 -1
- package/dist/{rich_text_editor-CNFb6tIx.js → rich_text_editor-BhUKyR0E.js} +2 -2
- package/dist/{rich_text_editor-CNFb6tIx.js.map → rich_text_editor-BhUKyR0E.js.map} +1 -1
- package/dist/{rich_text_editor-DRytK1_9.cjs → rich_text_editor-wvONcbYd.cjs} +2 -2
- package/dist/{rich_text_editor-DRytK1_9.cjs.map → rich_text_editor-wvONcbYd.cjs.map} +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-with-popover.cjs","names":[],"sources":["../../../components/combobox_with_popover/combobox_with_popover.vue"],"sourcesContent":["<template>\n <dt-combobox\n ref=\"combobox\"\n :loading=\"loading\"\n :label=\"label\"\n :label-visible=\"labelVisible\"\n :size=\"size\"\n :description=\"description\"\n :empty-list=\"emptyList\"\n :empty-state-message=\"emptyStateMessage\"\n :show-list=\"isListShown\"\n :on-beginning-of-list=\"onBeginningOfList\"\n :on-end-of-list=\"onEndOfList\"\n :list-rendered-outside=\"true\"\n :list-id=\"listId\"\n data-qa=\"dt-combobox\"\n v-bind=\"comboboxListeners\"\n >\n <template\n #input=\"{ inputProps }\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n :id=\"externalAnchor\"\n ref=\"input\"\n @focusin=\"onFocusIn\"\n @keydown.up=\"openOnArrowKeyPress($event)\"\n @keydown.down=\"openOnArrowKeyPress($event)\"\n >\n <slot\n name=\"input\"\n :input-props=\"inputProps\"\n :on-input=\"handleDisplayList\"\n />\n </div>\n </template>\n <template #list=\"{ opened, listProps, clearHighlightIndex }\">\n <dt-popover\n ref=\"popover\"\n v-model:open=\"isListShown\"\n :hide-on-click=\"false\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :offset=\"popoverOffset\"\n :sticky=\"popoverSticky\"\n placement=\"bottom-start\"\n initial-focus-element=\"none\"\n padding=\"none\"\n role=\"listbox\"\n :external-anchor=\"externalAnchor\"\n :content-width=\"contentWidth\"\n :content-appear=\"true\"\n :content-tabindex=\"null\"\n :modal=\"false\"\n :auto-focus=\"false\"\n :append-to=\"appendTo\"\n :dialog-class=\"dialogClass\"\n :transition=\"transition\"\n @opened=\"opened\"\n >\n <template\n v-if=\"hasSlotContent($slots.header)\"\n #headerContent\n >\n <div\n ref=\"header\"\n >\n <slot name=\"header\" />\n </div>\n </template>\n\n <template #content>\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n ref=\"listWrapper\"\n :class=\"[\n 'd-recipe-combobox-with-popover__list',\n DROPDOWN_PADDING_CLASSES[padding],\n listClass,\n ]\"\n @mouseleave=\"clearHighlightIndex\"\n @focusout=\"clearHighlightIndex\"\n >\n <combobox-loading-list\n v-if=\"loading\"\n v-bind=\"listProps\"\n />\n <combobox-empty-list\n v-else-if=\"emptyList && emptyStateMessage\"\n v-bind=\"listProps\"\n :message=\"emptyStateMessage\"\n />\n <slot\n v-else\n name=\"list\"\n :list-props=\"listProps\"\n />\n </div>\n </template>\n\n <template\n v-if=\"hasSlotContent($slots.footer)\"\n #footerContent\n >\n <div\n ref=\"footer\"\n >\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-popover>\n </template>\n </dt-combobox>\n</template>\n\n<script>\nimport ComboboxLoadingList from '@/components/combobox/combobox_loading-list.vue';\nimport ComboboxEmptyList from '@/components/combobox/combobox_empty-list.vue';\nimport { DtCombobox, COMBOBOX_LABEL_SIZES } from '@/components/combobox';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_CONTENT_WIDTHS } from '@/components/popover';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DROPDOWN_PADDING_CLASSES } from '@/components/dropdown';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtComboboxWithPopover',\n\n components: {\n DtCombobox,\n DtPopover,\n ComboboxLoadingList,\n ComboboxEmptyList,\n },\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values null, xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: null,\n validator: (t) => Object.values(COMBOBOX_LABEL_SIZES).includes(t),\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\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 * 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 popover dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\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 * 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 * Vertical padding size around the list element.\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 * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n */\n contentWidth: {\n type: String,\n default: null,\n validator: contentWidth => POPOVER_CONTENT_WIDTHS.includes(contentWidth),\n },\n\n /**\n * If the list should be shown by pressing up or down arrow key on the input element.\n * This can be set when not passing showList prop.\n */\n openWithArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the popover content box from its anchor element\n * by the specified number of pixels.\n */\n popoverOffset: {\n type: Array,\n default: () => [0, 4],\n },\n\n /**\n * If the popover sticks to the input.\n */\n popoverSticky: {\n type: [Boolean, String],\n default: false,\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines when to show the skeletons and also controls aria-busy attribute.\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets the list to an empty state, and displays the message from prop `emptyStateMessage`.\n */\n emptyList: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Message to show when the list is empty\n */\n emptyStateMessage: {\n type: String,\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', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\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 * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when 'escape' key is pressed\n *\n * @event escape\n */\n 'escape',\n\n /**\n * Event fired when an item is highlighted\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Emitted when items are shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n DROPDOWN_PADDING_CLASSES,\n isListShown: false,\n isInputFocused: false,\n isListFocused: false,\n externalAnchor: getUniqueString(),\n hasSlotContent,\n };\n },\n\n computed: {\n comboboxListeners () {\n return {\n ...this.$attrs,\n\n onSelect: this.onSelect,\n\n onEscape: this.onEscape,\n\n onHighlight: this.onHighlight,\n };\n },\n },\n\n watch: {\n showList: {\n handler: function (show) {\n if (show !== null) {\n this.isListShown = show;\n }\n },\n\n immediate: true,\n },\n\n isListShown (val) {\n if (val) {\n window.addEventListener('mousedown', this.onFocusOut);\n } else {\n window.removeEventListener('mousedown', this.onFocusOut);\n }\n this.onOpened(val);\n },\n },\n\n methods: {\n handleDisplayList (value) {\n if (!this.hasSuggestionList && value) { this.showComboboxList(); }\n if (!this.hasSuggestionList && !value) { this.closeComboboxList(); }\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = true;\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = false;\n },\n\n onSelect (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('select', highlightIndex);\n if (!this.hasSuggestionList) {\n // we don't display the list before the user has typed anything\n this.closeComboboxList();\n }\n },\n\n onEscape () {\n this.$emit('escape');\n this.closeComboboxList();\n },\n\n onHighlight (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('highlight', highlightIndex);\n },\n\n onOpened (opened) {\n this.$emit('opened', opened);\n },\n\n onFocusIn (e) {\n if (this.hasSuggestionList && e && this.$refs.input?.querySelector('input') === e.target) {\n // only trigger if we show suggestion list when focused, and\n // it's the input specifically that was focused\n this.showComboboxList();\n }\n },\n\n onFocusOut (e) {\n // Check if the focus change was to another target within the combobox component\n const popoverEl = this.$refs.popover?.tip?.popper;\n const comboboxEl = this.$refs.input;\n\n if (e.composedPath()?.some(el => [popoverEl, comboboxEl].includes(el))) return;\n\n // If outside the combobox then close\n this.closeComboboxList();\n },\n\n openOnArrowKeyPress () {\n if (this.showList !== null || this.isListShown || !this.openWithArrowKeys) { return; }\n\n this.showComboboxList();\n },\n },\n};\n</script>\n"],"mappings":"ikBA2HA,IAAK,EAAU,CACb,aAAc,CAAE,KAAM,EAAG,CACzB,KAAM,wBAEN,WAAY,CACV,WAAA,EAAA,EACA,UAAA,EAAA,QACA,oBAAA,EAAA,QACA,kBAAA,EAAA,QACD,CAED,MAAO,CAIL,MAAO,CACL,KAAM,OACN,SAAU,GACX,CAMD,aAAc,CACZ,KAAM,QACN,QAAS,GACV,CAMD,KAAM,CACJ,KAAM,OACN,QAAS,KACT,UAAY,GAAM,OAAO,OAAO,EAAA,qBAAqB,CAAC,SAAS,EAAE,CAClE,CAKD,YAAa,CACX,KAAM,OACN,QAAS,GACV,CAQD,SAAU,CACR,KAAM,QACN,QAAS,KACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CAKD,UAAW,CACT,KAAM,CAAC,OAAQ,MAAO,OAAO,CAC7B,QAAS,GACV,CAKD,YAAa,CACX,KAAM,CAAC,OAAQ,MAAO,OAAO,CAC7B,QAAS,GACV,CAKD,kBAAmB,CACjB,KAAM,SACN,QAAS,KACV,CAKD,YAAa,CACX,KAAM,SACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAKD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,aAAc,CACZ,KAAM,OACN,QAAS,KACT,UAAW,GAAgB,EAAA,uBAAuB,SAAS,EAAa,CACzE,CAMD,kBAAmB,CACjB,KAAM,QACN,QAAS,GACV,CAMD,cAAe,CACb,KAAM,MACN,YAAe,CAAC,EAAG,EAAE,CACtB,CAKD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AAA,CAAA,CAAA,IAAA,CAAA,CAAA,iBAkClB,EAAA,eAAe,EAAA,OAAO,OAAM,CAAA,MACjC,qCAMK,EAAA,EAAA,EAAA,oBAAA,MAJN,EAIM,EAAA,EAAA,EAAA,YADkB,EAAA,OAAA,SAAA,CAAA,CAAA,IAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"combobox-with-popover.cjs","names":[],"sources":["../../../components/combobox_with_popover/combobox_with_popover.vue"],"sourcesContent":["<template>\n <dt-combobox\n ref=\"combobox\"\n :loading=\"loading\"\n :label=\"label\"\n :label-visible=\"labelVisible\"\n :size=\"size\"\n :description=\"description\"\n :empty-list=\"emptyList\"\n :empty-state-message=\"emptyStateMessage\"\n :show-list=\"isListShown\"\n :on-beginning-of-list=\"onBeginningOfList\"\n :on-end-of-list=\"onEndOfList\"\n :list-rendered-outside=\"true\"\n :list-id=\"listId\"\n data-qa=\"dt-combobox\"\n v-bind=\"comboboxListeners\"\n >\n <template\n #input=\"{ inputProps }\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n :id=\"externalAnchor\"\n ref=\"input\"\n @focusin=\"onFocusIn\"\n @keydown.up=\"openOnArrowKeyPress($event)\"\n @keydown.down=\"openOnArrowKeyPress($event)\"\n >\n <slot\n name=\"input\"\n :input-props=\"inputProps\"\n :on-input=\"handleDisplayList\"\n />\n </div>\n </template>\n <template #list=\"{ opened, listProps, clearHighlightIndex }\">\n <dt-popover\n ref=\"popover\"\n v-model:open=\"isListShown\"\n :hide-on-click=\"false\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :offset=\"popoverOffset\"\n :sticky=\"popoverSticky\"\n placement=\"bottom-start\"\n initial-focus-element=\"none\"\n padding=\"none\"\n role=\"listbox\"\n :external-anchor=\"externalAnchor\"\n :content-width=\"contentWidth\"\n :content-appear=\"true\"\n :content-tabindex=\"null\"\n :modal=\"false\"\n :auto-focus=\"false\"\n :append-to=\"appendTo\"\n :dialog-class=\"dialogClass\"\n :transition=\"transition\"\n @opened=\"opened\"\n >\n <template\n v-if=\"hasSlotContent($slots.header)\"\n #headerContent\n >\n <div\n ref=\"header\"\n >\n <slot name=\"header\" />\n </div>\n </template>\n\n <template #content>\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n ref=\"listWrapper\"\n :class=\"[\n 'd-recipe-combobox-with-popover__list',\n DROPDOWN_PADDING_CLASSES[padding],\n listClass,\n ]\"\n @mouseleave=\"clearHighlightIndex\"\n @focusout=\"clearHighlightIndex\"\n >\n <combobox-loading-list\n v-if=\"loading\"\n v-bind=\"listProps\"\n />\n <combobox-empty-list\n v-else-if=\"emptyList && emptyStateMessage\"\n v-bind=\"listProps\"\n :message=\"emptyStateMessage\"\n />\n <slot\n v-else\n name=\"list\"\n :list-props=\"listProps\"\n />\n </div>\n </template>\n\n <template\n v-if=\"hasSlotContent($slots.footer)\"\n #footerContent\n >\n <div\n ref=\"footer\"\n >\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-popover>\n </template>\n </dt-combobox>\n</template>\n\n<script>\nimport ComboboxLoadingList from '@/components/combobox/combobox_loading-list.vue';\nimport ComboboxEmptyList from '@/components/combobox/combobox_empty-list.vue';\nimport { DtCombobox, COMBOBOX_LABEL_SIZES } from '@/components/combobox';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_CONTENT_WIDTHS } from '@/components/popover';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { DROPDOWN_PADDING_CLASSES } from '@/components/dropdown';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtComboboxWithPopover',\n\n components: {\n DtCombobox,\n DtPopover,\n ComboboxLoadingList,\n ComboboxEmptyList,\n },\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values null, xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: null,\n validator: (t) => Object.values(COMBOBOX_LABEL_SIZES).includes(t),\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\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 * 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 popover dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\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 * 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 * Vertical padding size around the list element.\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 * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n */\n contentWidth: {\n type: String,\n default: null,\n validator: contentWidth => POPOVER_CONTENT_WIDTHS.includes(contentWidth),\n },\n\n /**\n * If the list should be shown by pressing up or down arrow key on the input element.\n * This can be set when not passing showList prop.\n */\n openWithArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the popover content box from its anchor element\n * by the specified number of pixels.\n */\n popoverOffset: {\n type: Array,\n default: () => [0, 4],\n },\n\n /**\n * If the popover sticks to the input.\n */\n popoverSticky: {\n type: [Boolean, String],\n default: false,\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines when to show the skeletons and also controls aria-busy attribute.\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets the list to an empty state, and displays the message from prop `emptyStateMessage`.\n */\n emptyList: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Message to show when the list is empty\n */\n emptyStateMessage: {\n type: String,\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', 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 * 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 * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when 'escape' key is pressed\n *\n * @event escape\n */\n 'escape',\n\n /**\n * Event fired when an item is highlighted\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Emitted when items are shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n DROPDOWN_PADDING_CLASSES,\n isListShown: false,\n isInputFocused: false,\n isListFocused: false,\n externalAnchor: getUniqueString(),\n hasSlotContent,\n };\n },\n\n computed: {\n comboboxListeners () {\n return {\n ...this.$attrs,\n\n onSelect: this.onSelect,\n\n onEscape: this.onEscape,\n\n onHighlight: this.onHighlight,\n };\n },\n },\n\n watch: {\n showList: {\n handler: function (show) {\n if (show !== null) {\n this.isListShown = show;\n }\n },\n\n immediate: true,\n },\n\n isListShown (val) {\n if (val) {\n window.addEventListener('mousedown', this.onFocusOut);\n } else {\n window.removeEventListener('mousedown', this.onFocusOut);\n }\n this.onOpened(val);\n },\n },\n\n methods: {\n handleDisplayList (value) {\n if (!this.hasSuggestionList && value) { this.showComboboxList(); }\n if (!this.hasSuggestionList && !value) { this.closeComboboxList(); }\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = true;\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = false;\n },\n\n onSelect (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('select', highlightIndex);\n if (!this.hasSuggestionList) {\n // we don't display the list before the user has typed anything\n this.closeComboboxList();\n }\n },\n\n onEscape () {\n this.$emit('escape');\n this.closeComboboxList();\n },\n\n onHighlight (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('highlight', highlightIndex);\n },\n\n onOpened (opened) {\n this.$emit('opened', opened);\n },\n\n onFocusIn (e) {\n if (this.hasSuggestionList && e && this.$refs.input?.querySelector('input') === e.target) {\n // only trigger if we show suggestion list when focused, and\n // it's the input specifically that was focused\n this.showComboboxList();\n }\n },\n\n onFocusOut (e) {\n // Check if the focus change was to another target within the combobox component\n const popoverEl = this.$refs.popover?.tip?.popper;\n const comboboxEl = this.$refs.input;\n\n if (e.composedPath()?.some(el => [popoverEl, comboboxEl].includes(el))) return;\n\n // If outside the combobox then close\n this.closeComboboxList();\n },\n\n openOnArrowKeyPress () {\n if (this.showList !== null || this.isListShown || !this.openWithArrowKeys) { return; }\n\n this.showComboboxList();\n },\n },\n};\n</script>\n"],"mappings":"+mBA4HA,IAAK,EAAU,CACb,aAAc,CAAE,KAAM,EAAG,CACzB,KAAM,wBAEN,WAAY,CACV,WAAA,EAAA,EACA,UAAA,EAAA,QACA,oBAAA,EAAA,QACA,kBAAA,EAAA,QACD,CAED,MAAO,CAIL,MAAO,C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|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import l from "../popover/popover.js";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
1
|
+
import { HTML_ELEMENT_TYPE as e } from "../../common/constants/index.js";
|
|
2
|
+
import { getUniqueString as t, hasSlotContent as n } from "../../common/utils/index.js";
|
|
3
|
+
import { t as r } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
|
|
4
|
+
import i from "../combobox/combobox-loading-list.js";
|
|
5
|
+
import a from "../combobox/combobox-empty-list.js";
|
|
6
|
+
import { t as o } from "../../combobox-DgClbLOg.js";
|
|
7
|
+
import { COMBOBOX_LABEL_SIZES as s } from "../combobox/combobox-constants.js";
|
|
8
|
+
import { POPOVER_APPEND_TO_VALUES as c, POPOVER_CONTENT_WIDTHS as l } from "../popover/popover-constants.js";
|
|
9
|
+
import u from "../popover/popover.js";
|
|
10
|
+
import { DROPDOWN_PADDING_CLASSES as d } from "../dropdown/dropdown-constants.js";
|
|
11
|
+
import { createBlock as f, createElementVNode as p, createSlots as m, createVNode as h, mergeProps as g, normalizeClass as _, normalizeProps as v, openBlock as y, renderSlot as b, resolveComponent as x, withCtx as S, withKeys as C } from "vue";
|
|
11
12
|
//#region components/combobox_with_popover/combobox_with_popover.vue
|
|
12
|
-
var
|
|
13
|
+
var w = {
|
|
13
14
|
compatConfig: { MODE: 3 },
|
|
14
15
|
name: "DtComboboxWithPopover",
|
|
15
16
|
components: {
|
|
16
|
-
DtCombobox:
|
|
17
|
-
DtPopover:
|
|
18
|
-
ComboboxLoadingList:
|
|
19
|
-
ComboboxEmptyList:
|
|
17
|
+
DtCombobox: o,
|
|
18
|
+
DtPopover: u,
|
|
19
|
+
ComboboxLoadingList: i,
|
|
20
|
+
ComboboxEmptyList: a
|
|
20
21
|
},
|
|
21
22
|
props: {
|
|
22
23
|
label: {
|
|
@@ -30,7 +31,7 @@ var C = {
|
|
|
30
31
|
size: {
|
|
31
32
|
type: String,
|
|
32
33
|
default: null,
|
|
33
|
-
validator: (e) => Object.values(
|
|
34
|
+
validator: (e) => Object.values(s).includes(e)
|
|
34
35
|
},
|
|
35
36
|
description: {
|
|
36
37
|
type: String,
|
|
@@ -43,7 +44,7 @@ var C = {
|
|
|
43
44
|
listId: {
|
|
44
45
|
type: String,
|
|
45
46
|
default() {
|
|
46
|
-
return
|
|
47
|
+
return t();
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
50
|
listClass: {
|
|
@@ -81,12 +82,12 @@ var C = {
|
|
|
81
82
|
padding: {
|
|
82
83
|
type: String,
|
|
83
84
|
default: "small",
|
|
84
|
-
validator: (e) => Object.keys(
|
|
85
|
+
validator: (e) => Object.keys(d).some((t) => t === e)
|
|
85
86
|
},
|
|
86
87
|
contentWidth: {
|
|
87
88
|
type: String,
|
|
88
89
|
default: null,
|
|
89
|
-
validator: (e) =>
|
|
90
|
+
validator: (e) => l.includes(e)
|
|
90
91
|
},
|
|
91
92
|
openWithArrowKeys: {
|
|
92
93
|
type: Boolean,
|
|
@@ -117,9 +118,9 @@ var C = {
|
|
|
117
118
|
default: ""
|
|
118
119
|
},
|
|
119
120
|
appendTo: {
|
|
120
|
-
type: [
|
|
121
|
+
type: [e, String],
|
|
121
122
|
default: "body",
|
|
122
|
-
validator: (e) =>
|
|
123
|
+
validator: (e) => c.includes(e) || e instanceof HTMLElement
|
|
123
124
|
},
|
|
124
125
|
transition: {
|
|
125
126
|
type: String,
|
|
@@ -134,12 +135,12 @@ var C = {
|
|
|
134
135
|
],
|
|
135
136
|
data() {
|
|
136
137
|
return {
|
|
137
|
-
DROPDOWN_PADDING_CLASSES:
|
|
138
|
+
DROPDOWN_PADDING_CLASSES: d,
|
|
138
139
|
isListShown: !1,
|
|
139
140
|
isInputFocused: !1,
|
|
140
141
|
isListFocused: !1,
|
|
141
|
-
externalAnchor:
|
|
142
|
-
hasSlotContent:
|
|
142
|
+
externalAnchor: t(),
|
|
143
|
+
hasSlotContent: n
|
|
143
144
|
};
|
|
144
145
|
},
|
|
145
146
|
computed: { comboboxListeners() {
|
|
@@ -194,10 +195,10 @@ var C = {
|
|
|
194
195
|
this.showList !== null || this.isListShown || !this.openWithArrowKeys || this.showComboboxList();
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
|
-
},
|
|
198
|
-
function
|
|
199
|
-
let o =
|
|
200
|
-
return
|
|
198
|
+
}, T = ["id"], E = { ref: "header" }, D = ["onMouseleave", "onFocusout"], O = { ref: "footer" };
|
|
199
|
+
function k(e, t, n, r, i, a) {
|
|
200
|
+
let o = x("combobox-loading-list"), s = x("combobox-empty-list"), c = x("dt-popover"), l = x("dt-combobox");
|
|
201
|
+
return y(), f(l, g({
|
|
201
202
|
ref: "combobox",
|
|
202
203
|
loading: n.loading,
|
|
203
204
|
label: n.label,
|
|
@@ -213,16 +214,16 @@ function O(e, t, n, r, i, a) {
|
|
|
213
214
|
"list-id": n.listId,
|
|
214
215
|
"data-qa": "dt-combobox"
|
|
215
216
|
}, a.comboboxListeners), {
|
|
216
|
-
input:
|
|
217
|
+
input: S(({ inputProps: n }) => [p("div", {
|
|
217
218
|
id: i.externalAnchor,
|
|
218
219
|
ref: "input",
|
|
219
220
|
onFocusin: t[0] || (t[0] = (...e) => a.onFocusIn && a.onFocusIn(...e)),
|
|
220
|
-
onKeydown: [t[1] || (t[1] =
|
|
221
|
-
}, [
|
|
221
|
+
onKeydown: [t[1] || (t[1] = C((e) => a.openOnArrowKeyPress(e), ["up"])), t[2] || (t[2] = C((e) => a.openOnArrowKeyPress(e), ["down"]))]
|
|
222
|
+
}, [b(e.$slots, "input", {
|
|
222
223
|
inputProps: n,
|
|
223
224
|
onInput: a.handleDisplayList
|
|
224
|
-
})], 40,
|
|
225
|
-
list:
|
|
225
|
+
})], 40, T)]),
|
|
226
|
+
list: S(({ opened: r, listProps: a, clearHighlightIndex: l }) => [h(c, {
|
|
226
227
|
ref: "popover",
|
|
227
228
|
open: i.isListShown,
|
|
228
229
|
"onUpdate:open": t[3] || (t[3] = (e) => i.isListShown = e),
|
|
@@ -245,28 +246,28 @@ function O(e, t, n, r, i, a) {
|
|
|
245
246
|
"dialog-class": n.dialogClass,
|
|
246
247
|
transition: n.transition,
|
|
247
248
|
onOpened: r
|
|
248
|
-
},
|
|
249
|
-
content:
|
|
249
|
+
}, m({
|
|
250
|
+
content: S(() => [p("div", {
|
|
250
251
|
ref: "listWrapper",
|
|
251
|
-
class:
|
|
252
|
+
class: _([
|
|
252
253
|
"d-recipe-combobox-with-popover__list",
|
|
253
254
|
i.DROPDOWN_PADDING_CLASSES[n.padding],
|
|
254
255
|
n.listClass
|
|
255
256
|
]),
|
|
256
257
|
onMouseleave: l,
|
|
257
258
|
onFocusout: l
|
|
258
|
-
}, [n.loading ? (
|
|
259
|
+
}, [n.loading ? (y(), f(o, v(g({ key: 0 }, a)), null, 16)) : n.emptyList && n.emptyStateMessage ? (y(), f(s, g({ key: 1 }, a, { message: n.emptyStateMessage }), null, 16, ["message"])) : b(e.$slots, "list", {
|
|
259
260
|
key: 2,
|
|
260
261
|
listProps: a
|
|
261
|
-
})], 42,
|
|
262
|
+
})], 42, D)]),
|
|
262
263
|
_: 2
|
|
263
264
|
}, [i.hasSlotContent(e.$slots.header) ? {
|
|
264
265
|
name: "headerContent",
|
|
265
|
-
fn:
|
|
266
|
+
fn: S(() => [p("div", E, [b(e.$slots, "header")], 512)]),
|
|
266
267
|
key: "0"
|
|
267
268
|
} : void 0, i.hasSlotContent(e.$slots.footer) ? {
|
|
268
269
|
name: "footerContent",
|
|
269
|
-
fn:
|
|
270
|
+
fn: S(() => [p("div", O, [b(e.$slots, "footer")], 512)]),
|
|
270
271
|
key: "1"
|
|
271
272
|
} : void 0]), 1032, [
|
|
272
273
|
"open",
|
|
@@ -296,8 +297,8 @@ function O(e, t, n, r, i, a) {
|
|
|
296
297
|
"list-id"
|
|
297
298
|
]);
|
|
298
299
|
}
|
|
299
|
-
var
|
|
300
|
+
var A = /* @__PURE__ */ r(w, [["render", k]]);
|
|
300
301
|
//#endregion
|
|
301
|
-
export {
|
|
302
|
+
export { A as default };
|
|
302
303
|
|
|
303
304
|
//# sourceMappingURL=combobox-with-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-with-popover.js","names":[],"sources":["../../../components/combobox_with_popover/combobox_with_popover.vue"],"sourcesContent":["<template>\n <dt-combobox\n ref=\"combobox\"\n :loading=\"loading\"\n :label=\"label\"\n :label-visible=\"labelVisible\"\n :size=\"size\"\n :description=\"description\"\n :empty-list=\"emptyList\"\n :empty-state-message=\"emptyStateMessage\"\n :show-list=\"isListShown\"\n :on-beginning-of-list=\"onBeginningOfList\"\n :on-end-of-list=\"onEndOfList\"\n :list-rendered-outside=\"true\"\n :list-id=\"listId\"\n data-qa=\"dt-combobox\"\n v-bind=\"comboboxListeners\"\n >\n <template\n #input=\"{ inputProps }\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n :id=\"externalAnchor\"\n ref=\"input\"\n @focusin=\"onFocusIn\"\n @keydown.up=\"openOnArrowKeyPress($event)\"\n @keydown.down=\"openOnArrowKeyPress($event)\"\n >\n <slot\n name=\"input\"\n :input-props=\"inputProps\"\n :on-input=\"handleDisplayList\"\n />\n </div>\n </template>\n <template #list=\"{ opened, listProps, clearHighlightIndex }\">\n <dt-popover\n ref=\"popover\"\n v-model:open=\"isListShown\"\n :hide-on-click=\"false\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :offset=\"popoverOffset\"\n :sticky=\"popoverSticky\"\n placement=\"bottom-start\"\n initial-focus-element=\"none\"\n padding=\"none\"\n role=\"listbox\"\n :external-anchor=\"externalAnchor\"\n :content-width=\"contentWidth\"\n :content-appear=\"true\"\n :content-tabindex=\"null\"\n :modal=\"false\"\n :auto-focus=\"false\"\n :append-to=\"appendTo\"\n :dialog-class=\"dialogClass\"\n :transition=\"transition\"\n @opened=\"opened\"\n >\n <template\n v-if=\"hasSlotContent($slots.header)\"\n #headerContent\n >\n <div\n ref=\"header\"\n >\n <slot name=\"header\" />\n </div>\n </template>\n\n <template #content>\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n ref=\"listWrapper\"\n :class=\"[\n 'd-recipe-combobox-with-popover__list',\n DROPDOWN_PADDING_CLASSES[padding],\n listClass,\n ]\"\n @mouseleave=\"clearHighlightIndex\"\n @focusout=\"clearHighlightIndex\"\n >\n <combobox-loading-list\n v-if=\"loading\"\n v-bind=\"listProps\"\n />\n <combobox-empty-list\n v-else-if=\"emptyList && emptyStateMessage\"\n v-bind=\"listProps\"\n :message=\"emptyStateMessage\"\n />\n <slot\n v-else\n name=\"list\"\n :list-props=\"listProps\"\n />\n </div>\n </template>\n\n <template\n v-if=\"hasSlotContent($slots.footer)\"\n #footerContent\n >\n <div\n ref=\"footer\"\n >\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-popover>\n </template>\n </dt-combobox>\n</template>\n\n<script>\nimport ComboboxLoadingList from '@/components/combobox/combobox_loading-list.vue';\nimport ComboboxEmptyList from '@/components/combobox/combobox_empty-list.vue';\nimport { DtCombobox, COMBOBOX_LABEL_SIZES } from '@/components/combobox';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_CONTENT_WIDTHS } from '@/components/popover';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { DROPDOWN_PADDING_CLASSES } from '@/components/dropdown';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtComboboxWithPopover',\n\n components: {\n DtCombobox,\n DtPopover,\n ComboboxLoadingList,\n ComboboxEmptyList,\n },\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values null, xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: null,\n validator: (t) => Object.values(COMBOBOX_LABEL_SIZES).includes(t),\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\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 * 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 popover dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\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 * 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 * Vertical padding size around the list element.\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 * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n */\n contentWidth: {\n type: String,\n default: null,\n validator: contentWidth => POPOVER_CONTENT_WIDTHS.includes(contentWidth),\n },\n\n /**\n * If the list should be shown by pressing up or down arrow key on the input element.\n * This can be set when not passing showList prop.\n */\n openWithArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the popover content box from its anchor element\n * by the specified number of pixels.\n */\n popoverOffset: {\n type: Array,\n default: () => [0, 4],\n },\n\n /**\n * If the popover sticks to the input.\n */\n popoverSticky: {\n type: [Boolean, String],\n default: false,\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines when to show the skeletons and also controls aria-busy attribute.\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets the list to an empty state, and displays the message from prop `emptyStateMessage`.\n */\n emptyList: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Message to show when the list is empty\n */\n emptyStateMessage: {\n type: String,\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', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\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 * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when 'escape' key is pressed\n *\n * @event escape\n */\n 'escape',\n\n /**\n * Event fired when an item is highlighted\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Emitted when items are shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n DROPDOWN_PADDING_CLASSES,\n isListShown: false,\n isInputFocused: false,\n isListFocused: false,\n externalAnchor: getUniqueString(),\n hasSlotContent,\n };\n },\n\n computed: {\n comboboxListeners () {\n return {\n ...this.$attrs,\n\n onSelect: this.onSelect,\n\n onEscape: this.onEscape,\n\n onHighlight: this.onHighlight,\n };\n },\n },\n\n watch: {\n showList: {\n handler: function (show) {\n if (show !== null) {\n this.isListShown = show;\n }\n },\n\n immediate: true,\n },\n\n isListShown (val) {\n if (val) {\n window.addEventListener('mousedown', this.onFocusOut);\n } else {\n window.removeEventListener('mousedown', this.onFocusOut);\n }\n this.onOpened(val);\n },\n },\n\n methods: {\n handleDisplayList (value) {\n if (!this.hasSuggestionList && value) { this.showComboboxList(); }\n if (!this.hasSuggestionList && !value) { this.closeComboboxList(); }\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = true;\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = false;\n },\n\n onSelect (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('select', highlightIndex);\n if (!this.hasSuggestionList) {\n // we don't display the list before the user has typed anything\n this.closeComboboxList();\n }\n },\n\n onEscape () {\n this.$emit('escape');\n this.closeComboboxList();\n },\n\n onHighlight (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('highlight', highlightIndex);\n },\n\n onOpened (opened) {\n this.$emit('opened', opened);\n },\n\n onFocusIn (e) {\n if (this.hasSuggestionList && e && this.$refs.input?.querySelector('input') === e.target) {\n // only trigger if we show suggestion list when focused, and\n // it's the input specifically that was focused\n this.showComboboxList();\n }\n },\n\n onFocusOut (e) {\n // Check if the focus change was to another target within the combobox component\n const popoverEl = this.$refs.popover?.tip?.popper;\n const comboboxEl = this.$refs.input;\n\n if (e.composedPath()?.some(el => [popoverEl, comboboxEl].includes(el))) return;\n\n // If outside the combobox then close\n this.closeComboboxList();\n },\n\n openOnArrowKeyPress () {\n if (this.showList !== null || this.isListShown || !this.openWithArrowKeys) { return; }\n\n this.showComboboxList();\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;AA2HA,IAAK,IAAU;CACb,cAAc,EAAE,MAAM,GAAG;CACzB,MAAM;CAEN,YAAY;EACV,YAAA;EACA,WAAA;EACA,qBAAA;EACA,mBAAA;EACD;CAED,OAAO;EAIL,OAAO;GACL,MAAM;GACN,UAAU;GACX;EAMD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,MAAM,OAAO,OAAO,EAAqB,CAAC,SAAS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AAA;IAvBJ,KAAI;IACH,OAAK,EAAA;;KAAwE,EAAA,yBAAyB,EAAA;KAAwB,EAAA;;IAK9H,cAAY;IACZ,YAAU;OAGH,EAAA,WAAA,GAAA,EADR,EAGE,GAAA,EAAA,EAAA,EAAA,KAAA,GAAA,EADQ,EAAS,CAAA,EAAA,MAAA,GAAA,IAGN,EAAA,aAAa,EAAA,qBAAA,GAAA,EAD1B,EAIE,GAJF,EAIE,EAAA,KAAA,GAAA,EAFQ,GAAS,EAChB,SAAS,EAAA,mBAAiB,CAAA,EAAA,MAAA,IAAA,CAAA,UAAA,CAAA,IAE7B,EAIE,EAAA,QAAA,QAAA;;IADa;;;MAlCX,EAAA,eAAe,EAAA,OAAO,OAAM,GAAA;SACjC;eAMK,CAJN,EAIM,OAJN,GAIM,CADJ,EAAsB,EAAA,QAAA,SAAA,CAAA,EAAA,IAAA,CAAA,CAAA;;cAkClB,EAAA,eAAe,EAAA,OAAO,OAAM,GAAA;SACjC;eAMK,CAJN,EAIM,OAJN,GAIM,CADJ,EAAsB,EAAA,QAAA,SAAA,CAAA,EAAA,IAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"combobox-with-popover.js","names":[],"sources":["../../../components/combobox_with_popover/combobox_with_popover.vue"],"sourcesContent":["<template>\n <dt-combobox\n ref=\"combobox\"\n :loading=\"loading\"\n :label=\"label\"\n :label-visible=\"labelVisible\"\n :size=\"size\"\n :description=\"description\"\n :empty-list=\"emptyList\"\n :empty-state-message=\"emptyStateMessage\"\n :show-list=\"isListShown\"\n :on-beginning-of-list=\"onBeginningOfList\"\n :on-end-of-list=\"onEndOfList\"\n :list-rendered-outside=\"true\"\n :list-id=\"listId\"\n data-qa=\"dt-combobox\"\n v-bind=\"comboboxListeners\"\n >\n <template\n #input=\"{ inputProps }\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n :id=\"externalAnchor\"\n ref=\"input\"\n @focusin=\"onFocusIn\"\n @keydown.up=\"openOnArrowKeyPress($event)\"\n @keydown.down=\"openOnArrowKeyPress($event)\"\n >\n <slot\n name=\"input\"\n :input-props=\"inputProps\"\n :on-input=\"handleDisplayList\"\n />\n </div>\n </template>\n <template #list=\"{ opened, listProps, clearHighlightIndex }\">\n <dt-popover\n ref=\"popover\"\n v-model:open=\"isListShown\"\n :hide-on-click=\"false\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :offset=\"popoverOffset\"\n :sticky=\"popoverSticky\"\n placement=\"bottom-start\"\n initial-focus-element=\"none\"\n padding=\"none\"\n role=\"listbox\"\n :external-anchor=\"externalAnchor\"\n :content-width=\"contentWidth\"\n :content-appear=\"true\"\n :content-tabindex=\"null\"\n :modal=\"false\"\n :auto-focus=\"false\"\n :append-to=\"appendTo\"\n :dialog-class=\"dialogClass\"\n :transition=\"transition\"\n @opened=\"opened\"\n >\n <template\n v-if=\"hasSlotContent($slots.header)\"\n #headerContent\n >\n <div\n ref=\"header\"\n >\n <slot name=\"header\" />\n </div>\n </template>\n\n <template #content>\n <!-- eslint-disable-next-line vuejs-accessibility/no-static-element-interactions -->\n <div\n ref=\"listWrapper\"\n :class=\"[\n 'd-recipe-combobox-with-popover__list',\n DROPDOWN_PADDING_CLASSES[padding],\n listClass,\n ]\"\n @mouseleave=\"clearHighlightIndex\"\n @focusout=\"clearHighlightIndex\"\n >\n <combobox-loading-list\n v-if=\"loading\"\n v-bind=\"listProps\"\n />\n <combobox-empty-list\n v-else-if=\"emptyList && emptyStateMessage\"\n v-bind=\"listProps\"\n :message=\"emptyStateMessage\"\n />\n <slot\n v-else\n name=\"list\"\n :list-props=\"listProps\"\n />\n </div>\n </template>\n\n <template\n v-if=\"hasSlotContent($slots.footer)\"\n #footerContent\n >\n <div\n ref=\"footer\"\n >\n <slot name=\"footer\" />\n </div>\n </template>\n </dt-popover>\n </template>\n </dt-combobox>\n</template>\n\n<script>\nimport ComboboxLoadingList from '@/components/combobox/combobox_loading-list.vue';\nimport ComboboxEmptyList from '@/components/combobox/combobox_empty-list.vue';\nimport { DtCombobox, COMBOBOX_LABEL_SIZES } from '@/components/combobox';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_CONTENT_WIDTHS } from '@/components/popover';\nimport { getUniqueString, hasSlotContent } from '@/common/utils';\nimport { HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { DROPDOWN_PADDING_CLASSES } from '@/components/dropdown';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtComboboxWithPopover',\n\n components: {\n DtCombobox,\n DtPopover,\n ComboboxLoadingList,\n ComboboxEmptyList,\n },\n\n props: {\n /**\n * String to use for the input label.\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values null, xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: null,\n validator: (t) => Object.values(COMBOBOX_LABEL_SIZES).includes(t),\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Determines when to show the list element and also controls the aria-expanded attribute.\n * Leaving this null will have the combobox trigger on input focus by default.\n * If you set this value, the default trigger behavior will be disabled and you can\n * control it as you need.\n */\n showList: {\n type: Boolean,\n default: null,\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 * 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 popover dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\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 * 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 * Vertical padding size around the list element.\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 * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n */\n contentWidth: {\n type: String,\n default: null,\n validator: contentWidth => POPOVER_CONTENT_WIDTHS.includes(contentWidth),\n },\n\n /**\n * If the list should be shown by pressing up or down arrow key on the input element.\n * This can be set when not passing showList prop.\n */\n openWithArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Displaces the popover content box from its anchor element\n * by the specified number of pixels.\n */\n popoverOffset: {\n type: Array,\n default: () => [0, 4],\n },\n\n /**\n * If the popover sticks to the input.\n */\n popoverSticky: {\n type: [Boolean, String],\n default: false,\n },\n\n /**\n * Displays the list when the combobox is focused, before the user has typed anything.\n * When this is enabled the list will not close after selection.\n */\n hasSuggestionList: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Determines when to show the skeletons and also controls aria-busy attribute.\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets the list to an empty state, and displays the message from prop `emptyStateMessage`.\n */\n emptyList: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Message to show when the list is empty\n */\n emptyStateMessage: {\n type: String,\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', 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 * 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 * Event fired when item selected\n *\n * @event select\n * @type {Number}\n */\n 'select',\n\n /**\n * Event fired when 'escape' key is pressed\n *\n * @event escape\n */\n 'escape',\n\n /**\n * Event fired when an item is highlighted\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Emitted when items are shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n DROPDOWN_PADDING_CLASSES,\n isListShown: false,\n isInputFocused: false,\n isListFocused: false,\n externalAnchor: getUniqueString(),\n hasSlotContent,\n };\n },\n\n computed: {\n comboboxListeners () {\n return {\n ...this.$attrs,\n\n onSelect: this.onSelect,\n\n onEscape: this.onEscape,\n\n onHighlight: this.onHighlight,\n };\n },\n },\n\n watch: {\n showList: {\n handler: function (show) {\n if (show !== null) {\n this.isListShown = show;\n }\n },\n\n immediate: true,\n },\n\n isListShown (val) {\n if (val) {\n window.addEventListener('mousedown', this.onFocusOut);\n } else {\n window.removeEventListener('mousedown', this.onFocusOut);\n }\n this.onOpened(val);\n },\n },\n\n methods: {\n handleDisplayList (value) {\n if (!this.hasSuggestionList && value) { this.showComboboxList(); }\n if (!this.hasSuggestionList && !value) { this.closeComboboxList(); }\n },\n\n showComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = true;\n },\n\n closeComboboxList () {\n if (this.showList != null) { return; }\n this.isListShown = false;\n },\n\n onSelect (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('select', highlightIndex);\n if (!this.hasSuggestionList) {\n // we don't display the list before the user has typed anything\n this.closeComboboxList();\n }\n },\n\n onEscape () {\n this.$emit('escape');\n this.closeComboboxList();\n },\n\n onHighlight (highlightIndex) {\n if (this.loading) return;\n\n this.$emit('highlight', highlightIndex);\n },\n\n onOpened (opened) {\n this.$emit('opened', opened);\n },\n\n onFocusIn (e) {\n if (this.hasSuggestionList && e && this.$refs.input?.querySelector('input') === e.target) {\n // only trigger if we show suggestion list when focused, and\n // it's the input specifically that was focused\n this.showComboboxList();\n }\n },\n\n onFocusOut (e) {\n // Check if the focus change was to another target within the combobox component\n const popoverEl = this.$refs.popover?.tip?.popper;\n const comboboxEl = this.$refs.input;\n\n if (e.composedPath()?.some(el => [popoverEl, comboboxEl].includes(el))) return;\n\n // If outside the combobox then close\n this.closeComboboxList();\n },\n\n openOnArrowKeyPress () {\n if (this.showList !== null || this.isListShown || !this.openWithArrowKeys) { return; }\n\n this.showComboboxList();\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;;AA4HA,IAAK,IAAU;CACb,cAAc,EAAE,MAAM,GAAG;CACzB,MAAM;CAEN,YAAY;EACV,YAAA;EACA,WAAA;EACA,qBAAA;EACA,mBAAA;EACD;CAED,OAAO;EAIL,OAAO;GACL,MAAM;GACN,UAAU;GACX;EAMD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,MAAM,OAAO,OAAO,EAAqB,CAAC,SAAS,EAAE;GAClE;EAKD,aAAa;GACX,MAAM;GACN,SAAS;GACV;EAQD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EAMD,QAAQ;GACN,MAAM;GACN,UAAW;AAAE,WAAO,GAAiB;;GACtC;EAKD,WAAW;GACT,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAKD,aAAa;GACX,MAAM;IAAC;IAAQ;IAAO;IAAO;GAC7B,SAAS;GACV;EAKD,mBAAmB;GACjB,MAAM;GACN,SAAS;GACV;EAKD,aAAa;GACX,MAAM;GACN,SAAS;GACV;EAMD,WAAW;GACT,MAAM;GACN,SAAS;GACV;EAMD,UAAU;GACR,MAAM;GACN,SAAS;GACV;EAKD,SAAS;GACP,MAAM;GACN,SAAS;GACT,YAAY,MACH,OAAO,KAAK,EAAyB,CAAC,MAAM,MAAS,MAAS,EAAQ;GAEhF;EAMD,cAAc;GACZ,MAAM;GACN,SAAS;GACT,YAAW,MAAgB,EAAuB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MK,CAJN,EAIM,OAJN,GAIM,CADJ,EAAsB,EAAA,QAAA,SAAA,CAAA,EAAA,IAAA,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/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/keyboard-list-navigation.cjs`),i=require(`../list-item/list-item-constants.cjs`),a=require(`../popover/popover-constants.cjs`),o=require(`../popover/popover.cjs`),s=require(`./dropdown-constants.cjs`);let c=require(`vue`);var l={compatConfig:{MODE:3},name:`DtDropdown`,components:{DtPopover:o.default},mixins:[r.default({indexKey:`highlightIndex`,idKey:`highlightId`,listElementKey:`getListElement`,listItemRole:`menuitem`,afterHighlightMethod:`afterHighlight`,beginningOfListMethod:`beginningOfListMethod`,endOfListMethod:`endOfListMethod`,activeItemKey:`activeItemEl`,focusOnKeyboardNavigation:!0})],inheritAttrs:!1,props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},padding:{type:String,default:`small`,validator:e=>Object.keys(s.DROPDOWN_PADDING_CLASSES).some(t=>t===e)},modal:{type:Boolean,default:!0},contentWidth:{type:String,default:null},maxHeight:{type:String,default:``},maxWidth:{type:String,default:``},listId:{type:String,default(){return t.getUniqueString()}},navigationType:{type:String,default:i.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,validator:e=>Object.values(i.LIST_ITEM_NAVIGATION_TYPES).includes(e)},fallbackPlacements:{type:Array,default:()=>[`auto`]},placement:{type:String,default:`bottom`},onBeginningOfList:{type:Function,default:null},onEndOfList:{type:Function,default:null},listClass:{type:[String,Array,Object],default:``},appendTo:{type:[
|
|
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/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/keyboard-list-navigation.cjs`),i=require(`../list-item/list-item-constants.cjs`),a=require(`../popover/popover-constants.cjs`),o=require(`../popover/popover.cjs`),s=require(`./dropdown-constants.cjs`);let c=require(`vue`);var l={compatConfig:{MODE:3},name:`DtDropdown`,components:{DtPopover:o.default},mixins:[r.default({indexKey:`highlightIndex`,idKey:`highlightId`,listElementKey:`getListElement`,listItemRole:`menuitem`,afterHighlightMethod:`afterHighlight`,beginningOfListMethod:`beginningOfListMethod`,endOfListMethod:`endOfListMethod`,activeItemKey:`activeItemEl`,focusOnKeyboardNavigation:!0})],inheritAttrs:!1,props:{open:{type:Boolean,default:null},openOnContext:{type:Boolean,default:!1},padding:{type:String,default:`small`,validator:e=>Object.keys(s.DROPDOWN_PADDING_CLASSES).some(t=>t===e)},modal:{type:Boolean,default:!0},contentWidth:{type:String,default:null},maxHeight:{type:String,default:``},maxWidth:{type:String,default:``},listId:{type:String,default(){return t.getUniqueString()}},navigationType:{type:String,default:i.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,validator:e=>Object.values(i.LIST_ITEM_NAVIGATION_TYPES).includes(e)},fallbackPlacements:{type:Array,default:()=>[`auto`]},placement:{type:String,default:`bottom`},onBeginningOfList:{type:Function,default:null},onEndOfList:{type:Function,default:null},listClass:{type:[String,Array,Object],default:``},appendTo:{type:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>a.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},tether:{type:Boolean,default:!0},transition:{type:String,default:`fade`}},emits:[`keydown`,`highlight`,`update:open`,`opened`],data(){return{LIST_ITEM_NAVIGATION_TYPES:i.LIST_ITEM_NAVIGATION_TYPES,DROPDOWN_PADDING_CLASSES:s.DROPDOWN_PADDING_CLASSES,EVENT_KEYNAMES:e.EVENT_KEYNAMES,openedWithKeyboard:!1,isOpen:null}},computed:{dropdownListeners(){return{"update:open":e=>{this.$emit(`update:open`,e)},opened:e=>{this.updateInitialHighlightIndex(e)},keydown:t=>{switch(t.code){case e.EVENT_KEYNAMES.up:case e.EVENT_KEYNAMES.arrowup:this.onUpKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.down:case e.EVENT_KEYNAMES.arrowdown:this.onDownKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.space:case e.EVENT_KEYNAMES.spacebar:this.onSpaceKey();break;case e.EVENT_KEYNAMES.enter:this.onEnterKey();break;case e.EVENT_KEYNAMES.home:this.onHomeKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.end:this.onEndKeyPress(t),t.stopPropagation(),t.preventDefault();break;default:this.onKeyPress(t);break}this.$emit(`keydown`,t)}}},beginningOfListMethod(){return this.onBeginningOfList||this.jumpToEnd},endOfListMethod(){return this.onEndOfList||this.jumpToBeginning},activeItemEl(){return this.getListElement().querySelector(`#`+this.highlightId)},isArrowKeyNav(){return this.navigationType===this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS},listClasses(){return[`d-dropdown-list`,s.DROPDOWN_PADDING_CLASSES[this.padding],this.listClass,{"d-context-menu-list":this.openOnContext}]},shouldOpenWithArrowKeys(){return!this.openOnContext}},methods:{onMouseHighlight(e){let t=e.target.closest(`li`);t&&t.role&&this.highlightId!==t.id&&(this.setHighlightId(t.id),t.focus())},getListElement(){return this.$refs.listWrapper},clearHighlightIndex(){this.setHighlightIndex(-1)},afterHighlight(){this.highlightIndex!==this._itemsLength()-1&&this.$emit(`highlight`,this.highlightIndex)},updateInitialHighlightIndex(e){this.isOpen=e,e?(this.openedWithKeyboard&&this.isArrowKeyNav&&this.setHighlightIndex(0),this.$emit(`opened`,!0)):(this.clearHighlightIndex(),this.openedWithKeyboard=!1,this.$emit(`opened`,!1))},onSpaceKey(){this.open||(this.openedWithKeyboard=!0)},onEnterKey(){this.open||(this.openedWithKeyboard=!0)},onUpKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.onUpKey()},onDownKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.onDownKey()},onHomeKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav))return this.onHomeKey()},onEndKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav))return this.onEndKey()},onKeyPress(e){if(!(!this.isOpen||!this.isArrowKeyNav||!this.isValidLetter(e.key)))return e.stopPropagation(),e.preventDefault(),this.onNavigationKey(e.key)}}},u=[`id`];function d(e,t,n,r,i,a){let o=(0,c.resolveComponent)(`dt-popover`);return(0,c.openBlock)(),(0,c.createBlock)(o,(0,c.mergeProps)({ref:`popover`,"content-width":n.contentWidth,open:n.open,placement:n.placement,"initial-focus-element":i.openedWithKeyboard?`first`:`dialog`,"fallback-placements":n.fallbackPlacements,padding:`none`,role:`menu`,"append-to":n.appendTo,modal:n.modal,"max-height":n.maxHeight,"max-width":n.maxWidth,"open-with-arrow-keys":a.shouldOpenWithArrowKeys,"open-on-context":n.openOnContext},e.$attrs,{tether:n.tether,transition:n.transition},(0,c.toHandlers)(a.dropdownListeners)),{anchor:(0,c.withCtx)(({attrs:t})=>[(0,c.renderSlot)(e.$slots,`anchor`,(0,c.mergeProps)({ref:`anchor`},t))]),content:(0,c.withCtx)(({close:r})=>[(0,c.createElementVNode)(`ul`,{id:n.listId,ref:`listWrapper`,class:(0,c.normalizeClass)(a.listClasses),"data-qa":`dt-dropdown-list-wrapper`,onMouseleave:t[0]||(t[0]=(...e)=>a.clearHighlightIndex&&a.clearHighlightIndex(...e)),onMousemoveCapture:t[1]||(t[1]=(...e)=>a.onMouseHighlight&&a.onMouseHighlight(...e))},[(0,c.renderSlot)(e.$slots,`list`,{close:r})],42,u)]),footerContent:(0,c.withCtx)(({close:t})=>[(0,c.renderSlot)(e.$slots,`footer`,{close:t})]),_:3},16,[`content-width`,`open`,`placement`,`initial-focus-element`,`fallback-placements`,`append-to`,`modal`,`max-height`,`max-width`,`open-with-arrow-keys`,`open-on-context`,`tether`,`transition`])}var f=n.t(l,[[`render`,d]]);exports.default=f;
|
|
2
2
|
//# sourceMappingURL=dropdown.cjs.map
|
|
@@ -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 :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 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/list_item';\nimport { DROPDOWN_PADDING_CLASSES } from './dropdown_constants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES } from '@/common/constants';\n\nexport default {\n compatConfig: { MODE: 3 },\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 * Controls whether the dropdown is shown. Leaving this null will have the dropdown trigger on click by default.\n * If you set this value, the default trigger behavior will be disabled and you can control it as you need.\n * Supports v-model\n */\n open: {\n type: Boolean,\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 */\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 * 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', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, 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":"whBAkEA,IAAK,EAAU,CACb,aAAc,CAAE,KAAM,EAAG,CACzB,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,CAML,KAAM,CACJ,KAAM,QACN,QAAS,KACV,CAMD,cAAe,CACb,KAAM,QACN,QAAS,GACV,CAMD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,MAAO,CACL,KAAM,QACN,QAAS,GACV,CAOD,aAAc,CACZ,KAAM,OACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CASD,eAAgB,CACd,KAAM,OACN,QAAS,EAAA,2BAA2B,WACpC,UAAY,GAAM,OAAO,OAAO,EAAA,2BAA2B,CAAC,SAAS,EAAE,CACxE,CAYD,mBAAoB,CAClB,KAAM,MACN,YACS,CAAC,OAAO,CAElB,CAKD,UAAW,CACT,KAAM,OACN,QAAS,SACV,CAKD,kBAAmB,CACjB,KAAM,SACN,QAAS,KACV,CAKD,YAAa,CACX,KAAM,SACN,QAAS,KACV,CAKD,UAAW,CACT,KAAM,CAAC,OAAQ,MAAO,O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AAA,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 :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 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/list_item';\nimport { DROPDOWN_PADDING_CLASSES } from './dropdown_constants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\n\nexport default {\n compatConfig: { MODE: 3 },\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 * Controls whether the dropdown is shown. Leaving this null will have the dropdown trigger on click by default.\n * If you set this value, the default trigger behavior will be disabled and you can control it as you need.\n * Supports v-model\n */\n open: {\n type: Boolean,\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 */\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 * 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', 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":"whBAkEA,IAAK,EAAU,CACb,aAAc,CAAE,KAAM,EAAG,CACzB,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,CAML,KAAM,CACJ,KAAM,QACN,QAAS,KACV,CAMD,cAAe,CACb,KAAM,QACN,QAAS,GACV,CAMD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,MAAO,CACL,KAAM,QACN,QAAS,GACV,CAOD,aAAc,CACZ,KAAM,OACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CASD,eAAgB,CACd,KAAM,OACN,QAAS,EAAA,2BAA2B,WACpC,UAAY,GAAM,OAAO,OAAO,EAAA,2BAA2B,CAAC,SAAS,EAAE,CACxE,CAYD,mBAAoB,CAClB,KAAM,MACN,YACS,CAAC,OAAO,CAElB,CAKD,UAAW,CACT,KAAM,OACN,QAAS,SACV,CAKD,kBAAmB,CACjB,KAAM,SACN,QAAS,KACV,CAKD,YAAa,CACX,KAAM,SACN,QAAS,KACV,CAKD,UAAW,CACT,KAAM,CAAC,OAAQ,MAAO,OAAO,CAC7B,QAAS,GACV,CAOD,SAAU,CACR,KAAM,CAAC,EAAA,kBAAmB,OAAO,CACjC,QAAS,OACT,UAAW,GACF,EAAA,yBAAyB,S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_KEYNAMES as e } from "../../common/constants/index.js";
|
|
2
|
-
import { getUniqueString as
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
5
|
-
import { LIST_ITEM_NAVIGATION_TYPES as
|
|
6
|
-
import { POPOVER_APPEND_TO_VALUES as
|
|
7
|
-
import
|
|
8
|
-
import { DROPDOWN_PADDING_CLASSES as
|
|
9
|
-
import { createBlock as
|
|
1
|
+
import { EVENT_KEYNAMES as e, HTML_ELEMENT_TYPE as t } from "../../common/constants/index.js";
|
|
2
|
+
import { getUniqueString as n } from "../../common/utils/index.js";
|
|
3
|
+
import { t as r } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
|
|
4
|
+
import i from "../../common/mixins/keyboard-list-navigation.js";
|
|
5
|
+
import { LIST_ITEM_NAVIGATION_TYPES as a } from "../list-item/list-item-constants.js";
|
|
6
|
+
import { POPOVER_APPEND_TO_VALUES as o } from "../popover/popover-constants.js";
|
|
7
|
+
import s from "../popover/popover.js";
|
|
8
|
+
import { DROPDOWN_PADDING_CLASSES as c } from "./dropdown-constants.js";
|
|
9
|
+
import { createBlock as l, createElementVNode as u, mergeProps as d, normalizeClass as f, openBlock as p, renderSlot as m, resolveComponent as h, toHandlers as g, withCtx as _ } from "vue";
|
|
10
10
|
//#region components/dropdown/dropdown.vue
|
|
11
|
-
var
|
|
11
|
+
var v = {
|
|
12
12
|
compatConfig: { MODE: 3 },
|
|
13
13
|
name: "DtDropdown",
|
|
14
|
-
components: { DtPopover:
|
|
15
|
-
mixins: [
|
|
14
|
+
components: { DtPopover: s },
|
|
15
|
+
mixins: [i({
|
|
16
16
|
indexKey: "highlightIndex",
|
|
17
17
|
idKey: "highlightId",
|
|
18
18
|
listElementKey: "getListElement",
|
|
@@ -36,7 +36,7 @@ var _ = {
|
|
|
36
36
|
padding: {
|
|
37
37
|
type: String,
|
|
38
38
|
default: "small",
|
|
39
|
-
validator: (e) => Object.keys(
|
|
39
|
+
validator: (e) => Object.keys(c).some((t) => t === e)
|
|
40
40
|
},
|
|
41
41
|
modal: {
|
|
42
42
|
type: Boolean,
|
|
@@ -57,13 +57,13 @@ var _ = {
|
|
|
57
57
|
listId: {
|
|
58
58
|
type: String,
|
|
59
59
|
default() {
|
|
60
|
-
return
|
|
60
|
+
return n();
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
navigationType: {
|
|
64
64
|
type: String,
|
|
65
|
-
default:
|
|
66
|
-
validator: (e) => Object.values(
|
|
65
|
+
default: a.ARROW_KEYS,
|
|
66
|
+
validator: (e) => Object.values(a).includes(e)
|
|
67
67
|
},
|
|
68
68
|
fallbackPlacements: {
|
|
69
69
|
type: Array,
|
|
@@ -90,9 +90,9 @@ var _ = {
|
|
|
90
90
|
default: ""
|
|
91
91
|
},
|
|
92
92
|
appendTo: {
|
|
93
|
-
type: [
|
|
93
|
+
type: [t, String],
|
|
94
94
|
default: "body",
|
|
95
|
-
validator: (e) =>
|
|
95
|
+
validator: (e) => o.includes(e) || e instanceof HTMLElement
|
|
96
96
|
},
|
|
97
97
|
tether: {
|
|
98
98
|
type: Boolean,
|
|
@@ -111,8 +111,8 @@ var _ = {
|
|
|
111
111
|
],
|
|
112
112
|
data() {
|
|
113
113
|
return {
|
|
114
|
-
LIST_ITEM_NAVIGATION_TYPES:
|
|
115
|
-
DROPDOWN_PADDING_CLASSES:
|
|
114
|
+
LIST_ITEM_NAVIGATION_TYPES: a,
|
|
115
|
+
DROPDOWN_PADDING_CLASSES: c,
|
|
116
116
|
EVENT_KEYNAMES: e,
|
|
117
117
|
openedWithKeyboard: !1,
|
|
118
118
|
isOpen: null
|
|
@@ -173,7 +173,7 @@ var _ = {
|
|
|
173
173
|
listClasses() {
|
|
174
174
|
return [
|
|
175
175
|
"d-dropdown-list",
|
|
176
|
-
|
|
176
|
+
c[this.padding],
|
|
177
177
|
this.listClass,
|
|
178
178
|
{ "d-context-menu-list": this.openOnContext }
|
|
179
179
|
];
|
|
@@ -229,10 +229,10 @@ var _ = {
|
|
|
229
229
|
if (!(!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key))) return e.stopPropagation(), e.preventDefault(), this.onNavigationKey(e.key);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
},
|
|
233
|
-
function
|
|
234
|
-
let o =
|
|
235
|
-
return
|
|
232
|
+
}, y = ["id"];
|
|
233
|
+
function b(e, t, n, r, i, a) {
|
|
234
|
+
let o = h("dt-popover");
|
|
235
|
+
return p(), l(o, d({
|
|
236
236
|
ref: "popover",
|
|
237
237
|
"content-width": n.contentWidth,
|
|
238
238
|
open: n.open,
|
|
@@ -250,17 +250,17 @@ function y(e, t, n, r, i, a) {
|
|
|
250
250
|
}, e.$attrs, {
|
|
251
251
|
tether: n.tether,
|
|
252
252
|
transition: n.transition
|
|
253
|
-
},
|
|
254
|
-
anchor:
|
|
255
|
-
content:
|
|
253
|
+
}, g(a.dropdownListeners)), {
|
|
254
|
+
anchor: _(({ attrs: t }) => [m(e.$slots, "anchor", d({ ref: "anchor" }, t))]),
|
|
255
|
+
content: _(({ close: r }) => [u("ul", {
|
|
256
256
|
id: n.listId,
|
|
257
257
|
ref: "listWrapper",
|
|
258
|
-
class:
|
|
258
|
+
class: f(a.listClasses),
|
|
259
259
|
"data-qa": "dt-dropdown-list-wrapper",
|
|
260
260
|
onMouseleave: t[0] || (t[0] = (...e) => a.clearHighlightIndex && a.clearHighlightIndex(...e)),
|
|
261
261
|
onMousemoveCapture: t[1] || (t[1] = (...e) => a.onMouseHighlight && a.onMouseHighlight(...e))
|
|
262
|
-
}, [
|
|
263
|
-
footerContent:
|
|
262
|
+
}, [m(e.$slots, "list", { close: r })], 42, y)]),
|
|
263
|
+
footerContent: _(({ close: t }) => [m(e.$slots, "footer", { close: t })]),
|
|
264
264
|
_: 3
|
|
265
265
|
}, 16, [
|
|
266
266
|
"content-width",
|
|
@@ -278,8 +278,8 @@ function y(e, t, n, r, i, a) {
|
|
|
278
278
|
"transition"
|
|
279
279
|
]);
|
|
280
280
|
}
|
|
281
|
-
var
|
|
281
|
+
var x = /* @__PURE__ */ r(v, [["render", b]]);
|
|
282
282
|
//#endregion
|
|
283
|
-
export {
|
|
283
|
+
export { x as default };
|
|
284
284
|
|
|
285
285
|
//# sourceMappingURL=dropdown.js.map
|