@dialpad/dialtone-vue 2.125.0 → 2.125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js +33 -0
- package/dist/chunks/_plugin-vue2_normalizer-u6G_3nkj.js.map +1 -0
- package/dist/chunks/dropdown-SMWaTWyF.js +357 -0
- package/dist/chunks/dropdown-SMWaTWyF.js.map +1 -0
- package/dist/chunks/dropdown_constants-EUcDxBrX.js +9 -0
- package/dist/chunks/dropdown_constants-EUcDxBrX.js.map +1 -0
- package/dist/chunks/icon_constants-OpYAAKwF.js +16 -0
- package/dist/chunks/icon_constants-OpYAAKwF.js.map +1 -0
- package/dist/chunks/index-nIyl_PL6.js +372 -0
- package/dist/chunks/index-nIyl_PL6.js.map +1 -0
- package/dist/chunks/index-o4OMWMuv.js +244 -0
- package/dist/chunks/index-o4OMWMuv.js.map +1 -0
- package/dist/chunks/input-1tm09l_-.js +273 -0
- package/dist/chunks/input-1tm09l_-.js.map +1 -0
- package/dist/chunks/input_group-zcAq3DQl.js +141 -0
- package/dist/chunks/input_group-zcAq3DQl.js.map +1 -0
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js +197 -0
- package/dist/chunks/keyboard_list_navigation-F0O8nht0.js.map +1 -0
- package/dist/chunks/link_constants-vIUB92L4.js +16 -0
- package/dist/chunks/link_constants-vIUB92L4.js.map +1 -0
- package/dist/chunks/list_item_constants-LTUc74pD.js +13 -0
- package/dist/chunks/list_item_constants-LTUc74pD.js.map +1 -0
- package/dist/chunks/modal-VuMFkZFH.js +82 -0
- package/dist/chunks/modal-VuMFkZFH.js.map +1 -0
- package/dist/chunks/notice_action-9NmtQRai.js +182 -0
- package/dist/chunks/notice_action-9NmtQRai.js.map +1 -0
- package/dist/chunks/notice_constants-c--hBFQw.js +6 -0
- package/dist/chunks/notice_constants-c--hBFQw.js.map +1 -0
- package/dist/chunks/popover_constants-qjlEkroB.js +114 -0
- package/dist/chunks/popover_constants-qjlEkroB.js.map +1 -0
- package/dist/chunks/sr_only_close_button-JGole5Xi.js +86 -0
- package/dist/chunks/sr_only_close_button-JGole5Xi.js.map +1 -0
- package/dist/chunks/stack_constants-u7tNqGtc.js +13 -0
- package/dist/chunks/stack_constants-u7tNqGtc.js.map +1 -0
- package/dist/chunks/tab-Qm9LVkYj.js +346 -0
- package/dist/chunks/tab-Qm9LVkYj.js.map +1 -0
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.js +354 -10368
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/attachment-carousel.js +250 -0
- package/dist/lib/attachment-carousel.js.map +1 -0
- package/dist/lib/avatar.js +369 -0
- package/dist/lib/avatar.js.map +1 -0
- package/dist/lib/badge.js +169 -0
- package/dist/lib/badge.js.map +1 -0
- package/dist/lib/banner.js +200 -0
- package/dist/lib/banner.js.map +1 -0
- package/dist/lib/breadcrumbs.js +138 -0
- package/dist/lib/breadcrumbs.js.map +1 -0
- package/dist/lib/button-group.js +45 -0
- package/dist/lib/button-group.js.map +1 -0
- package/dist/lib/button.js +328 -0
- package/dist/lib/button.js.map +1 -0
- package/dist/lib/callbar-button-with-popover.js +235 -0
- package/dist/lib/callbar-button-with-popover.js.map +1 -0
- package/dist/lib/callbar-button.js +175 -0
- package/dist/lib/callbar-button.js.map +1 -0
- package/dist/lib/callbox.js +142 -0
- package/dist/lib/callbox.js.map +1 -0
- package/dist/lib/card.js +72 -0
- package/dist/lib/card.js.map +1 -0
- package/dist/lib/checkbox-group.js +117 -0
- package/dist/lib/checkbox-group.js.map +1 -0
- package/dist/lib/checkbox.js +117 -0
- package/dist/lib/checkbox.js.map +1 -0
- package/dist/lib/chip.js +186 -0
- package/dist/lib/chip.js.map +1 -0
- package/dist/lib/codeblock.js +29 -0
- package/dist/lib/codeblock.js.map +1 -0
- package/dist/lib/collapsible.js +313 -0
- package/dist/lib/collapsible.js.map +1 -0
- package/dist/lib/combobox-multi-select.js +433 -0
- package/dist/lib/combobox-multi-select.js.map +1 -0
- package/dist/lib/combobox-with-popover.js +341 -0
- package/dist/lib/combobox-with-popover.js.map +1 -0
- package/dist/lib/combobox.js +19 -0
- package/dist/lib/combobox.js.map +1 -0
- package/dist/lib/constants.js +53 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/contact-info.js +145 -0
- package/dist/lib/contact-info.js.map +1 -0
- package/dist/lib/contact-row.js +203 -0
- package/dist/lib/contact-row.js.map +1 -0
- package/dist/lib/datepicker.js +552 -0
- package/dist/lib/datepicker.js.map +1 -0
- package/dist/lib/dates.js +57 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/description-list.js +83 -0
- package/dist/lib/description-list.js.map +1 -0
- package/dist/lib/dropdown.js +45 -0
- package/dist/lib/dropdown.js.map +1 -0
- package/dist/lib/editor.js +527 -0
- package/dist/lib/editor.js.map +1 -0
- package/dist/{emoji_picker-kiTOKaq8.js → lib/emoji-picker.js} +30 -12
- package/dist/lib/emoji-picker.js.map +1 -0
- package/dist/lib/emoji-row.js +83 -0
- package/dist/lib/emoji-row.js.map +1 -0
- package/dist/{emoji_text_wrapper-48ClwKvf.js → lib/emoji-text-wrapper.js} +19 -14
- package/dist/lib/emoji-text-wrapper.js.map +1 -0
- package/dist/lib/emoji.js +11 -0
- package/dist/{emoji.js.map → lib/emoji.js.map} +1 -1
- package/dist/lib/feed-item-row.js +207 -0
- package/dist/lib/feed-item-row.js.map +1 -0
- package/dist/lib/feed-pill.js +142 -0
- package/dist/lib/feed-pill.js.map +1 -0
- package/dist/lib/general-row.js +379 -0
- package/dist/lib/general-row.js.map +1 -0
- package/dist/lib/group-row.js +115 -0
- package/dist/lib/group-row.js.map +1 -0
- package/dist/lib/grouped-chip.js +45 -0
- package/dist/lib/grouped-chip.js.map +1 -0
- package/dist/lib/hovercard.js +194 -0
- package/dist/lib/hovercard.js.map +1 -0
- package/dist/lib/icon.js +82 -0
- package/dist/lib/icon.js.map +1 -0
- package/dist/lib/image-viewer.js +171 -0
- package/dist/lib/image-viewer.js.map +1 -0
- package/dist/lib/input-group.js +90 -0
- package/dist/lib/input-group.js.map +1 -0
- package/dist/lib/input.js +455 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/item-layout.js +39 -0
- package/dist/lib/item-layout.js.map +1 -0
- package/dist/lib/ivr-node.js +195 -0
- package/dist/lib/ivr-node.js.map +1 -0
- package/dist/lib/keyboard-shortcut.js +100 -0
- package/dist/lib/keyboard-shortcut.js.map +1 -0
- package/dist/lib/lazy-show.js +77 -0
- package/dist/lib/lazy-show.js.map +1 -0
- package/dist/lib/link.js +69 -0
- package/dist/lib/link.js.map +1 -0
- package/dist/lib/list-item-group.js +59 -0
- package/dist/lib/list-item-group.js.map +1 -0
- package/dist/lib/list-item.js +195 -0
- package/dist/lib/list-item.js.map +1 -0
- package/dist/{message_input.js → lib/message-input.js} +107 -56
- package/dist/lib/message-input.js.map +1 -0
- package/dist/lib/mixins.js +17 -0
- package/dist/lib/mixins.js.map +1 -0
- package/dist/lib/modal.js +324 -0
- package/dist/lib/modal.js.map +1 -0
- package/dist/lib/notice.js +158 -0
- package/dist/lib/notice.js.map +1 -0
- package/dist/lib/pagination.js +142 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/popover.js +779 -0
- package/dist/lib/popover.js.map +1 -0
- package/dist/lib/presence.js +60 -0
- package/dist/lib/presence.js.map +1 -0
- package/dist/lib/radio-group.js +97 -0
- package/dist/lib/radio-group.js.map +1 -0
- package/dist/lib/radio.js +111 -0
- package/dist/lib/radio.js.map +1 -0
- package/dist/lib/rich-text-editor.js +920 -0
- package/dist/lib/rich-text-editor.js.map +1 -0
- package/dist/lib/root-layout.js +127 -0
- package/dist/lib/root-layout.js.map +1 -0
- package/dist/lib/select-menu.js +243 -0
- package/dist/lib/select-menu.js.map +1 -0
- package/dist/lib/settings-menu-button.js +65 -0
- package/dist/lib/settings-menu-button.js.map +1 -0
- package/dist/lib/skeleton.js +574 -0
- package/dist/lib/skeleton.js.map +1 -0
- package/dist/lib/stack.js +118 -0
- package/dist/lib/stack.js.map +1 -0
- package/dist/lib/tabs.js +93 -0
- package/dist/lib/tabs.js.map +1 -0
- package/dist/lib/time-pill.js +43 -0
- package/dist/lib/time-pill.js.map +1 -0
- package/dist/lib/toast.js +226 -0
- package/dist/lib/toast.js.map +1 -0
- package/dist/lib/toggle.js +169 -0
- package/dist/lib/toggle.js.map +1 -0
- package/dist/{directives.js → lib/tooltip-directive.js} +24 -18
- package/dist/lib/tooltip-directive.js.map +1 -0
- package/dist/lib/tooltip.js +376 -0
- package/dist/lib/tooltip.js.map +1 -0
- package/dist/lib/top-banner-info.js +60 -0
- package/dist/lib/top-banner-info.js.map +1 -0
- package/dist/lib/unread-pill.js +61 -0
- package/dist/lib/unread-pill.js.map +1 -0
- package/dist/lib/utils.js +175 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validation-messages.js +83 -0
- package/dist/lib/validation-messages.js.map +1 -0
- package/dist/lib/validators.js +12 -0
- package/dist/lib/validators.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/common/{constants.d.ts → constants/index.d.ts} +1 -1
- package/dist/types/common/constants/index.d.ts.map +1 -0
- package/dist/types/common/{dates.d.ts → dates/index.d.ts} +1 -1
- package/dist/types/common/dates/index.d.ts.map +1 -0
- package/dist/types/common/{emoji.d.ts → emoji/index.d.ts} +1 -1
- package/dist/types/common/{emoji.d.ts.map → emoji/index.d.ts.map} +1 -1
- package/dist/types/common/{utils.d.ts → utils/index.d.ts} +1 -1
- package/dist/types/common/utils/index.d.ts.map +1 -0
- package/dist/types/common/{validators.d.ts → validators/index.d.ts} +1 -1
- package/dist/types/common/validators/index.d.ts.map +1 -0
- package/dist/types/components/avatar/avatar.vue.d.ts +1 -1
- package/dist/types/components/button/button.vue.d.ts +2 -2
- package/dist/types/components/card/card.vue.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.vue.d.ts +7 -7
- package/dist/types/components/checkbox/checkbox.vue.d.ts.map +1 -1
- package/dist/types/components/chip/chip.vue.d.ts +2 -2
- package/dist/types/components/collapsible/collapsible.vue.d.ts +3 -3
- package/dist/types/components/combobox/combobox.vue.d.ts +7 -8
- package/dist/types/components/combobox/combobox.vue.d.ts.map +1 -1
- package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
- package/dist/types/components/emoji/emoji.vue.d.ts +1 -1
- package/dist/types/components/emoji_picker/modules/emoji_selector.vue.d.ts +1 -219
- package/dist/types/components/icon/icon.vue.d.ts +20 -16
- package/dist/types/components/icon/icon.vue.d.ts.map +1 -1
- package/dist/types/components/icon/icon_constants.d.ts +2 -0
- package/dist/types/components/icon/icon_constants.d.ts.map +1 -1
- package/dist/types/components/icon/index.d.ts +1 -1
- package/dist/types/components/input_group/input_group.vue.d.ts +15 -6
- package/dist/types/components/input_group/input_group.vue.d.ts.map +1 -1
- package/dist/types/components/list_item_group/list_item_group.vue.d.ts +1 -1
- package/dist/types/components/modal/modal.vue.d.ts +7 -2
- package/dist/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/types/components/notice/notice_action.vue.d.ts +3 -1
- package/dist/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/types/components/popover/popover_header_footer.vue.d.ts +1 -1
- package/dist/types/components/radio/radio.vue.d.ts +2 -12
- package/dist/types/components/radio/radio.vue.d.ts.map +1 -1
- package/dist/types/components/skeleton/skeleton-list-item.vue.d.ts +1 -1
- package/dist/types/components/skeleton/skeleton-paragraph.vue.d.ts +3 -3
- package/dist/types/components/skeleton/skeleton-shape.vue.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts +8 -3
- package/dist/types/components/skeleton/skeleton-text.vue.d.ts.map +1 -1
- package/dist/types/components/skeleton/skeleton.vue.d.ts +1 -1
- package/dist/types/components/toggle/toggle.vue.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.vue.d.ts +2 -2
- package/dist/types/index.d.ts +36 -29
- package/dist/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +1 -1
- package/dist/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +2 -2
- package/dist/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts +1 -1
- package/dist/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +2 -2
- package/package.json +18 -58
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -2904
- package/dist/dialtone-vue.cjs +0 -6
- package/dist/dialtone-vue.cjs.map +0 -1
- package/dist/directives.cjs +0 -2
- package/dist/directives.cjs.map +0 -1
- package/dist/directives.js.map +0 -1
- package/dist/emoji.cjs +0 -2
- package/dist/emoji.cjs.map +0 -1
- package/dist/emoji.js +0 -36
- package/dist/emoji_picker-kiTOKaq8.js.map +0 -1
- package/dist/emoji_picker-njWWAm6V.cjs +0 -2
- package/dist/emoji_picker-njWWAm6V.cjs.map +0 -1
- package/dist/emoji_text_wrapper-48ClwKvf.js.map +0 -1
- package/dist/emoji_text_wrapper-ZlynvHnd.cjs +0 -2
- package/dist/emoji_text_wrapper-ZlynvHnd.cjs.map +0 -1
- package/dist/index-OF94C6nQ.js +0 -142834
- package/dist/index-OF94C6nQ.js.map +0 -1
- package/dist/index-Wx7Jagcr.cjs +0 -2
- package/dist/index-Wx7Jagcr.cjs.map +0 -1
- package/dist/message_input.cjs +0 -2
- package/dist/message_input.cjs.map +0 -1
- package/dist/message_input.js.map +0 -1
- package/dist/rich_text_editor-RVMsCB8N.cjs +0 -98
- package/dist/rich_text_editor-RVMsCB8N.cjs.map +0 -1
- package/dist/rich_text_editor-eMvTs_Gp.js +0 -16479
- package/dist/rich_text_editor-eMvTs_Gp.js.map +0 -1
- package/dist/tooltip-88U5vFMA.js +0 -2517
- package/dist/tooltip-88U5vFMA.js.map +0 -1
- package/dist/tooltip-i2wxFIIi.cjs +0 -22
- package/dist/tooltip-i2wxFIIi.cjs.map +0 -1
- package/dist/types/common/constants.d.ts.map +0 -1
- package/dist/types/common/dates.d.ts.map +0 -1
- package/dist/types/common/utils.d.ts.map +0 -1
- package/dist/types/common/validators.d.ts.map +0 -1
- package/dist/types/components/emoji_picker/emojis/index.d.ts +0 -50
- package/dist/types/components/emoji_picker/emojis/index.d.ts.map +0 -1
- package/dist/types/directives.d.ts +0 -2
- package/dist/types/directives.d.ts.map +0 -1
- package/dist/types/emoji.d.ts +0 -5
- package/dist/types/emoji.d.ts.map +0 -1
- package/dist/types/message_input.d.ts +0 -3
- package/dist/types/message_input.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-viewer.js","sources":["../../components/image_viewer/image_viewer.vue"],"sourcesContent":["<template>\n <div>\n <dt-button\n data-qa=\"dt-image-viewer-preview\"\n class=\"d-image-viewer__preview-button\"\n :aria-label=\"ariaLabel\"\n importance=\"clear\"\n @click=\"openModal\"\n >\n <img\n :class=\"imageButtonClass\"\n :src=\"imageSrc\"\n :alt=\"imageAlt\"\n >\n </dt-button>\n <portal v-if=\"isOpen\">\n <div\n :aria-hidden=\"!isOpen ? 'true' : 'false'\"\n class=\"d-modal\"\n data-qa=\"dt-modal\"\n v-on=\"modalListeners\"\n @mouseover=\"showCloseButton = true\"\n @mouseleave=\"showCloseButton = false\"\n @focusin=\" showCloseButton = true\"\n @focusout=\" showCloseButton = false\"\n >\n <div\n data-qa=\"dt-image-viewer-full\"\n class=\"d-image-viewer__full\"\n role=\"dialog\"\n aria-modal=\"true\"\n >\n <img\n class=\"d-image-viewer__full__image\"\n :src=\"imageSrc\"\n :alt=\"imageAlt\"\n >\n </div>\n <transition name=\"fade\">\n <dt-button\n v-if=\"showCloseButton\"\n ref=\"closeImage\"\n data-qa=\"dt-image-viewer-close-btn\"\n class=\"d-modal__close\"\n circle\n size=\"lg\"\n importance=\"clear\"\n kind=\"inverted\"\n :aria-label=\"closeAriaLabel\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon\n class=\"d-image-viewer__close-button\"\n name=\"close\"\n size=\"400\"\n />\n </template>\n </dt-button>\n </transition>\n </div>\n </portal>\n </div>\n</template>\n\n<script>\nimport Modal from '@/common/mixins/modal';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport { DtIcon } from '@/components/icon';\nimport { DtButton } from '@/components/button';\nimport { Portal } from '@linusborg/vue-simple-portal';\n\nexport default {\n name: 'DtImageViewer',\n\n components: {\n Portal,\n DtButton,\n DtIcon,\n },\n\n mixins: [Modal],\n\n props: {\n /**\n * Controls whether the image modal is shown. Leaving this null will have the image modal\n * 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 .sync modifier\n * @values null, true, false\n */\n open: {\n type: Boolean,\n default: null,\n },\n\n /**\n * URL of the image to be shown\n */\n imageSrc: {\n type: String,\n required: true,\n },\n\n /**\n * Alt text of image\n */\n imageAlt: {\n type: String,\n required: true,\n },\n\n /**\n * Image Class\n */\n imageButtonClass: {\n type: String,\n required: false,\n default: '',\n },\n\n /**\n * Aria label\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * Aria label for close button\n */\n closeAriaLabel: {\n type: String,\n required: true,\n },\n },\n\n emits: [\n /**\n * Emitted when popover is shown or hidden\n *\n * @event opened\n * @type {Boolean}\n */\n 'opened',\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 data () {\n return {\n showCloseButton: true,\n isOpen: false,\n };\n },\n\n computed: {\n modalListeners () {\n return {\n ...this.$listeners,\n\n click: event => {\n (event.target === event.currentTarget) && this.close();\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n },\n };\n },\n },\n\n watch: {\n isOpen: {\n immediate: true,\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n } else {\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n\n open: {\n handler: function (open) {\n if (open !== null) {\n this.isOpen = open;\n }\n },\n\n immediate: true,\n },\n },\n\n methods: {\n openModal () {\n // Has custom control passed in\n if (this.open !== null) {\n return;\n }\n this.isOpen = true;\n this.showCloseButton = true;\n this.$emit('opened', true);\n\n setTimeout(() => {\n this.focusAfterOpen();\n });\n },\n\n close () {\n this.isOpen = false;\n this.$emit('opened', false);\n\n if (this.open !== null) {\n this.$emit('update:open', false);\n }\n },\n\n focusAfterOpen () {\n this.$refs.closeImage?.$el.focus();\n },\n\n trapFocus (e) {\n if (this.isOpen) {\n this.focusTrappedTabPress(e);\n }\n },\n\n },\n};\n</script>\n"],"names":["_sfc_main","Portal","DtButton","DtIcon","Modal","event","EVENT_KEYNAMES","isShowing","_a","open","e"],"mappings":";;;;;;;;;;;;AAwEA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,EACA;AAAA,EAEA,QAAA,CAAAC,CAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,kBAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,gBAAA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AA,SAAA,QACA,KAAA,MAAA,eAAA,EAAA;AAAA,IAEA;AAAA,IAEA,iBAAA;;AACA,OAAAD,IAAA,KAAA,MAAA,eAAA,QAAAA,EAAA,IAAA;AAAA,IACA;AAAA,IAEA,UAAAE,GAAA;AACA,MAAA,KAAA,UACA,KAAA,qBAAAA,CAAA;AAAA,IAEA;AAAA,EAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { I as t } from "../chunks/input_group-zcAq3DQl.js";
|
|
2
|
+
import { n } from "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
3
|
+
import { DtValidationMessages as r } from "./validation-messages.js";
|
|
4
|
+
import "vue";
|
|
5
|
+
import "./validators.js";
|
|
6
|
+
import "./constants.js";
|
|
7
|
+
import "./utils.js";
|
|
8
|
+
const l = {
|
|
9
|
+
name: "DtInputGroup",
|
|
10
|
+
components: { DtValidationMessages: r },
|
|
11
|
+
mixins: [t],
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* A data qa tag for the input group
|
|
15
|
+
*/
|
|
16
|
+
dataQaGroup: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "input-group"
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* A data qa tag for the input group legend
|
|
22
|
+
*/
|
|
23
|
+
dataQaGroupLegend: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "input-group-legend"
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* A data qa tag for the input group messages
|
|
29
|
+
*/
|
|
30
|
+
dataQaGroupMessages: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "input-group-messages"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
emits: [
|
|
36
|
+
/**
|
|
37
|
+
* Native input event
|
|
38
|
+
*
|
|
39
|
+
* @event input
|
|
40
|
+
*/
|
|
41
|
+
"input"
|
|
42
|
+
],
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
internalValue: this.value,
|
|
46
|
+
// wrap values in object to make reactive
|
|
47
|
+
provideObj: {
|
|
48
|
+
value: this.value
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
watch: {
|
|
53
|
+
value(a) {
|
|
54
|
+
this.internalValue = a;
|
|
55
|
+
},
|
|
56
|
+
/*
|
|
57
|
+
* watching value to support 2 way binding for slotted inputs.
|
|
58
|
+
* need this to pass value to slotted inputs if modified outside
|
|
59
|
+
* input group.
|
|
60
|
+
*/
|
|
61
|
+
internalValue(a) {
|
|
62
|
+
this.provideObj.value = a;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
getMessageKey(a, e) {
|
|
67
|
+
return `input-group-message-${a}-${e}-${this.id}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var i = function() {
|
|
72
|
+
var e = this, s = e._self._c;
|
|
73
|
+
return s("fieldset", { staticClass: "d-input-group__fieldset", attrs: { "data-qa": e.dataQaGroup } }, [e.$slots.legend || e.legend ? s("legend", e._b({ class: ["d-label", e.legendClass], attrs: { "data-qa": e.dataQaGroupLegend } }, "legend", e.legendChildProps, !1), [e._t("legend", function() {
|
|
74
|
+
return [e._v(" " + e._s(e.legend) + " ")];
|
|
75
|
+
})], 2) : e._e(), e._t("default"), s("dt-validation-messages", e._b({ class: e.messagesClass, attrs: { "validation-messages": e.formattedMessages, "show-messages": e.showMessages, "data-qa": e.dataQaGroupMessages } }, "dt-validation-messages", e.messagesChildProps, !1))], 2);
|
|
76
|
+
}, o = [], d = /* @__PURE__ */ n(
|
|
77
|
+
l,
|
|
78
|
+
i,
|
|
79
|
+
o,
|
|
80
|
+
!1,
|
|
81
|
+
null,
|
|
82
|
+
null,
|
|
83
|
+
null,
|
|
84
|
+
null
|
|
85
|
+
);
|
|
86
|
+
const v = d.exports;
|
|
87
|
+
export {
|
|
88
|
+
v as DtInputGroup
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=input-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.js","sources":["../../components/input_group/input_group.vue"],"sourcesContent":["<template>\n <fieldset\n class=\"d-input-group__fieldset\"\n :data-qa=\"dataQaGroup\"\n >\n <legend\n v-if=\"$slots.legend || legend\"\n :class=\"['d-label', legendClass]\"\n v-bind=\"legendChildProps\"\n :data-qa=\"dataQaGroupLegend\"\n >\n <!-- @slot slot for Input Group Legend -->\n <slot name=\"legend\">\n {{ legend }}\n </slot>\n </legend>\n <!-- @slot slot for Input Group Components -->\n <slot />\n <dt-validation-messages\n :validation-messages=\"formattedMessages\"\n :show-messages=\"showMessages\"\n :class=\"messagesClass\"\n :data-qa=\"dataQaGroupMessages\"\n v-bind=\"messagesChildProps\"\n />\n </fieldset>\n</template>\n\n<script>\nimport { InputGroupMixin } from '@/common/mixins/input_group';\nimport { DtValidationMessages } from '../validation_messages';\n\n/**\n * Input Groups are convenience components for a grouping of related inputs.\n * While each input within the group could be independent, the `v-model` on the group\n * provides a convenient interface for determining the current state of the group.\n * @see https://dialtone.dialpad.com/components/input_group.html\n */\nexport default {\n name: 'DtInputGroup',\n\n components: { DtValidationMessages },\n\n mixins: [InputGroupMixin],\n\n props: {\n /**\n * A data qa tag for the input group\n */\n dataQaGroup: {\n type: String,\n default: 'input-group',\n },\n\n /**\n * A data qa tag for the input group legend\n */\n dataQaGroupLegend: {\n type: String,\n default: 'input-group-legend',\n },\n\n /**\n * A data qa tag for the input group messages\n */\n dataQaGroupMessages: {\n type: String,\n default: 'input-group-messages',\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n */\n 'input',\n ],\n\n data () {\n return {\n internalValue: this.value,\n // wrap values in object to make reactive\n provideObj: {\n value: this.value,\n },\n };\n },\n\n watch: {\n value (newValue) {\n this.internalValue = newValue;\n },\n\n /*\n * watching value to support 2 way binding for slotted inputs.\n * need this to pass value to slotted inputs if modified outside\n * input group.\n */\n internalValue (newInternalValue) {\n this.provideObj.value = newInternalValue;\n },\n },\n\n methods: {\n getMessageKey (type, index) {\n return `input-group-message-${type}-${index}-${this.id}`;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtValidationMessages","InputGroupMixin","newValue","newInternalValue","type","index"],"mappings":";;;;;;;AAsCA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA,EAAA,sBAAAC,EAAA;AAAA,EAEA,QAAA,CAAAC,CAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,mBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,qBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,eAAA,KAAA;AAAA;AAAA,MAEA,YAAA;AAAA,QACA,OAAA,KAAA;AAAA,MACA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA,MAAAC,GAAA;AACA,WAAA,gBAAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,cAAAC,GAAA;AACA,WAAA,WAAA,QAAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,cAAAC,GAAAC,GAAA;AACA,aAAA,uBAAAD,CAAA,IAAAC,CAAA,IAAA,KAAA,EAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { DESCRIPTION_SIZE_TYPES as c, VALIDATION_MESSAGE_TYPES as h } from "./constants.js";
|
|
2
|
+
import { getUniqueString as g, getValidationState as m } from "./utils.js";
|
|
3
|
+
import { M as f } from "../chunks/input-1tm09l_-.js";
|
|
4
|
+
import { n as _ } from "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
5
|
+
import { DtValidationMessages as v } from "./validation-messages.js";
|
|
6
|
+
import "vue";
|
|
7
|
+
import "./validators.js";
|
|
8
|
+
const a = {
|
|
9
|
+
TEXT: "text",
|
|
10
|
+
TEXTAREA: "textarea",
|
|
11
|
+
PASSWORD: "password",
|
|
12
|
+
EMAIL: "email",
|
|
13
|
+
NUMBER: "number",
|
|
14
|
+
DATE: "date",
|
|
15
|
+
TIME: "time",
|
|
16
|
+
FILE: "file"
|
|
17
|
+
}, s = {
|
|
18
|
+
EXTRA_SMALL: "xs",
|
|
19
|
+
SMALL: "sm",
|
|
20
|
+
DEFAULT: "md",
|
|
21
|
+
LARGE: "lg",
|
|
22
|
+
EXTRA_LARGE: "xl"
|
|
23
|
+
}, b = {
|
|
24
|
+
name: "DtInput",
|
|
25
|
+
components: { DtValidationMessages: v },
|
|
26
|
+
mixins: [f],
|
|
27
|
+
inheritAttrs: !1,
|
|
28
|
+
props: {
|
|
29
|
+
/**
|
|
30
|
+
* Name property of the input element
|
|
31
|
+
*/
|
|
32
|
+
name: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Type of the input, one of: `text`, `password`, `email`, `number`, `textarea`, 'date', 'time'.
|
|
38
|
+
* When `textarea` a `<textarea>` element will be rendered instead of an `<input>` element.
|
|
39
|
+
* @values text, password, email, number, textarea, date, time
|
|
40
|
+
*/
|
|
41
|
+
type: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: a.TEXT,
|
|
44
|
+
validator: (e) => Object.values(a).includes(e)
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Value of the input
|
|
48
|
+
*/
|
|
49
|
+
value: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: ""
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Disables the input
|
|
55
|
+
* @values true, false
|
|
56
|
+
*/
|
|
57
|
+
disabled: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: !1
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Label for the input
|
|
63
|
+
*/
|
|
64
|
+
label: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Determines visibility of input label.
|
|
70
|
+
* @values true, false
|
|
71
|
+
*/
|
|
72
|
+
labelVisible: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: !0
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Description for the input
|
|
78
|
+
*/
|
|
79
|
+
description: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ""
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`
|
|
85
|
+
* @values null, xs, sm, md, lg, xl
|
|
86
|
+
*/
|
|
87
|
+
size: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: null,
|
|
90
|
+
validator: (e) => Object.values(s).includes(e)
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Size of the icon. One of `xs`, `sm`, `md`, `lg`, `xl`. If you do not set this the icon will size relative
|
|
94
|
+
* to the input size
|
|
95
|
+
* @values null, xs, sm, md, lg, xl
|
|
96
|
+
*/
|
|
97
|
+
iconSize: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: null,
|
|
100
|
+
validator: (e) => Object.values(s).includes(e)
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Additional class name for the input element.
|
|
104
|
+
* Can accept String, Object, and Array, i.e. has the
|
|
105
|
+
* same API as Vue's built-in handling of the class attribute.
|
|
106
|
+
*/
|
|
107
|
+
inputClass: {
|
|
108
|
+
type: [String, Object, Array],
|
|
109
|
+
default: ""
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* Additional class name for the input wrapper element.
|
|
113
|
+
* Can accept all of String, Object, and Array, i.e. has the
|
|
114
|
+
* same api as Vue's built-in handling of the class attribute.
|
|
115
|
+
*/
|
|
116
|
+
inputWrapperClass: {
|
|
117
|
+
type: [String, Object, Array],
|
|
118
|
+
default: ""
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* The current character length that the user has entered into the input.
|
|
122
|
+
* This will only need to be used if you are using `validate.length` and
|
|
123
|
+
* the string contains abnormal characters.
|
|
124
|
+
* For example, an emoji could take up many characters in the input, but should only count as 1 character.
|
|
125
|
+
* If no number is provided, a built-in length calculation will be used for the length validation.
|
|
126
|
+
*/
|
|
127
|
+
currentLength: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Whether the input will continue to display a warning validation message even if the input has lost focus.
|
|
133
|
+
*/
|
|
134
|
+
retainWarning: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: !1
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Validation for the input. Supports maximum length validation with the structure:
|
|
140
|
+
* `{ "length": {"description": string, "max": number, "warn": number, "message": string,
|
|
141
|
+
* "limitMaxLength": boolean }}`
|
|
142
|
+
*/
|
|
143
|
+
validate: {
|
|
144
|
+
type: Object,
|
|
145
|
+
default: null
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* hidden allows to use input without the element visually present in DOM
|
|
149
|
+
*/
|
|
150
|
+
hidden: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: !1
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
emits: [
|
|
156
|
+
/**
|
|
157
|
+
* Native input event
|
|
158
|
+
*
|
|
159
|
+
* @event input
|
|
160
|
+
* @type {String}
|
|
161
|
+
*/
|
|
162
|
+
"input",
|
|
163
|
+
/**
|
|
164
|
+
* Native input blur event
|
|
165
|
+
*
|
|
166
|
+
* @event blur
|
|
167
|
+
* @type {FocusEvent}
|
|
168
|
+
*/
|
|
169
|
+
"blur",
|
|
170
|
+
/**
|
|
171
|
+
* Input clear event
|
|
172
|
+
*
|
|
173
|
+
* @event clear
|
|
174
|
+
*/
|
|
175
|
+
"clear",
|
|
176
|
+
/**
|
|
177
|
+
* Native input focus event
|
|
178
|
+
*
|
|
179
|
+
* @event focus
|
|
180
|
+
* @type {FocusEvent}
|
|
181
|
+
*/
|
|
182
|
+
"focus",
|
|
183
|
+
/**
|
|
184
|
+
* Native input focusin event
|
|
185
|
+
*
|
|
186
|
+
* @event focusin
|
|
187
|
+
* @type {FocusEvent}
|
|
188
|
+
*/
|
|
189
|
+
"focusin",
|
|
190
|
+
/**
|
|
191
|
+
* Native input focusout event
|
|
192
|
+
*
|
|
193
|
+
* @event focusout
|
|
194
|
+
* @type {FocusEvent}
|
|
195
|
+
*/
|
|
196
|
+
"focusout",
|
|
197
|
+
/**
|
|
198
|
+
* Length of the input when currentLength prop is not passed
|
|
199
|
+
*
|
|
200
|
+
* @event update:length
|
|
201
|
+
* @type {Number}
|
|
202
|
+
*/
|
|
203
|
+
"update:length",
|
|
204
|
+
/**
|
|
205
|
+
* Result of the input validation
|
|
206
|
+
*
|
|
207
|
+
* @event update:invalid
|
|
208
|
+
* @type {Boolean}
|
|
209
|
+
*/
|
|
210
|
+
"update:invalid"
|
|
211
|
+
],
|
|
212
|
+
data() {
|
|
213
|
+
return {
|
|
214
|
+
descriptionSizeClasses: {
|
|
215
|
+
lg: "d-description--lg",
|
|
216
|
+
xl: "d-description--xl"
|
|
217
|
+
},
|
|
218
|
+
labelSizeClasses: {
|
|
219
|
+
xs: "d-label--xs",
|
|
220
|
+
sm: "d-label--sm",
|
|
221
|
+
md: "d-label--md",
|
|
222
|
+
lg: "d-label--lg",
|
|
223
|
+
xl: "d-label--xl"
|
|
224
|
+
},
|
|
225
|
+
isInputFocused: !1,
|
|
226
|
+
isInvalid: !1,
|
|
227
|
+
defaultLength: 0
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
computed: {
|
|
231
|
+
isTextarea() {
|
|
232
|
+
return this.type === a.TEXTAREA;
|
|
233
|
+
},
|
|
234
|
+
isDefaultSize() {
|
|
235
|
+
return this.size === s.DEFAULT;
|
|
236
|
+
},
|
|
237
|
+
isDefaultIconSize() {
|
|
238
|
+
return this.iconSizeComputed === s.DEFAULT;
|
|
239
|
+
},
|
|
240
|
+
iconSizeComputed() {
|
|
241
|
+
return this.iconSize ? this.iconSize : this.size;
|
|
242
|
+
},
|
|
243
|
+
isValidSize() {
|
|
244
|
+
return Object.values(s).includes(this.size);
|
|
245
|
+
},
|
|
246
|
+
isValidDescriptionSize() {
|
|
247
|
+
return Object.values(c).includes(this.size);
|
|
248
|
+
},
|
|
249
|
+
inputComponent() {
|
|
250
|
+
return this.isTextarea ? "textarea" : "input";
|
|
251
|
+
},
|
|
252
|
+
inputListeners() {
|
|
253
|
+
return {
|
|
254
|
+
/* TODO
|
|
255
|
+
Check if any usages of this component leverage $listeners and either remove if unused or scope the removal
|
|
256
|
+
and migration prior to upgrading to Vue 3.x
|
|
257
|
+
*/
|
|
258
|
+
...this.$listeners,
|
|
259
|
+
input: (e) => this.$emit("input", e.target.value),
|
|
260
|
+
focus: (e) => {
|
|
261
|
+
this.isInputFocused = !0, this.$emit("focus", e);
|
|
262
|
+
},
|
|
263
|
+
blur: (e) => {
|
|
264
|
+
this.isInputFocused = !1, this.onBlur(e);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
descriptionKey() {
|
|
269
|
+
return `input-description-${g()}`;
|
|
270
|
+
},
|
|
271
|
+
inputState() {
|
|
272
|
+
return m(this.validationMessages);
|
|
273
|
+
},
|
|
274
|
+
defaultLengthCalculation() {
|
|
275
|
+
return this.calculateLength(this.value);
|
|
276
|
+
},
|
|
277
|
+
validationProps() {
|
|
278
|
+
var e, t, i, n, l, r, u, d, o, p;
|
|
279
|
+
return {
|
|
280
|
+
length: {
|
|
281
|
+
description: (t = (e = this == null ? void 0 : this.validate) == null ? void 0 : e.length) == null ? void 0 : t.description,
|
|
282
|
+
max: (n = (i = this == null ? void 0 : this.validate) == null ? void 0 : i.length) == null ? void 0 : n.max,
|
|
283
|
+
warn: (r = (l = this == null ? void 0 : this.validate) == null ? void 0 : l.length) == null ? void 0 : r.warn,
|
|
284
|
+
message: (d = (u = this == null ? void 0 : this.validate) == null ? void 0 : u.length) == null ? void 0 : d.message,
|
|
285
|
+
limitMaxLength: (p = (o = this == null ? void 0 : this.validate) == null ? void 0 : o.length) != null && p.limitMaxLength ? this.validate.length.limitMaxLength : !1
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
},
|
|
289
|
+
validationMessages() {
|
|
290
|
+
return this.showLengthLimitValidation ? this.formattedMessages.concat([this.inputLengthErrorMessage()]) : this.formattedMessages;
|
|
291
|
+
},
|
|
292
|
+
showInputState() {
|
|
293
|
+
return this.showMessages && this.inputState;
|
|
294
|
+
},
|
|
295
|
+
inputLength() {
|
|
296
|
+
return this.currentLength ? this.currentLength : this.defaultLengthCalculation;
|
|
297
|
+
},
|
|
298
|
+
inputLengthState() {
|
|
299
|
+
return this.inputLength < this.validationProps.length.warn ? null : this.inputLength <= this.validationProps.length.max ? this.validationProps.length.warn ? h.WARNING : null : h.ERROR;
|
|
300
|
+
},
|
|
301
|
+
shouldValidateLength() {
|
|
302
|
+
return !!(this.validationProps.length.description && this.validationProps.length.max);
|
|
303
|
+
},
|
|
304
|
+
shouldLimitMaxLength() {
|
|
305
|
+
return this.shouldValidateLength && this.validationProps.length.limitMaxLength;
|
|
306
|
+
},
|
|
307
|
+
// eslint-disable-next-line complexity
|
|
308
|
+
showLengthLimitValidation() {
|
|
309
|
+
return this.shouldValidateLength && this.inputLengthState !== null && this.validationProps.length.message && (this.retainWarning || this.isInputFocused || this.isInvalid);
|
|
310
|
+
},
|
|
311
|
+
sizeModifierClass() {
|
|
312
|
+
return this.isDefaultSize || !this.isValidSize ? "" : {
|
|
313
|
+
input: {
|
|
314
|
+
xs: "d-input--xs",
|
|
315
|
+
sm: "d-input--sm",
|
|
316
|
+
lg: "d-input--lg",
|
|
317
|
+
xl: "d-input--xl"
|
|
318
|
+
},
|
|
319
|
+
textarea: {
|
|
320
|
+
xs: "d-textarea--xs",
|
|
321
|
+
sm: "d-textarea--sm",
|
|
322
|
+
lg: "d-textarea--lg",
|
|
323
|
+
xl: "d-textarea--xl"
|
|
324
|
+
}
|
|
325
|
+
}[this.inputComponent][this.size];
|
|
326
|
+
},
|
|
327
|
+
stateClass() {
|
|
328
|
+
return [{
|
|
329
|
+
input: {
|
|
330
|
+
error: "d-input--error base-input__input--error",
|
|
331
|
+
warning: "d-input--warning base-input__input--warning",
|
|
332
|
+
success: "d-input--success base-input__input--success"
|
|
333
|
+
},
|
|
334
|
+
textarea: {
|
|
335
|
+
error: "d-textarea--error base-input__input--error",
|
|
336
|
+
warning: "d-textarea--warning base-input__input--warning",
|
|
337
|
+
success: "d-textarea--success base-input__input--success"
|
|
338
|
+
}
|
|
339
|
+
}[this.inputComponent][this.inputState]];
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
watch: {
|
|
343
|
+
isInvalid(e) {
|
|
344
|
+
this.$emit("update:invalid", e);
|
|
345
|
+
},
|
|
346
|
+
value: {
|
|
347
|
+
immediate: !0,
|
|
348
|
+
handler(e) {
|
|
349
|
+
this.shouldValidateLength && this.validateLength(this.inputLength), this.currentLength == null && this.$emit("update:length", this.calculateLength(e));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
methods: {
|
|
354
|
+
inputClasses() {
|
|
355
|
+
return [
|
|
356
|
+
"base-input__input",
|
|
357
|
+
this.inputComponent === "input" ? "d-input" : "d-textarea",
|
|
358
|
+
{
|
|
359
|
+
[this.stateClass]: this.showInputState,
|
|
360
|
+
"d-input-icon--left": this.$slots.leftIcon,
|
|
361
|
+
"d-input-icon--right": this.$slots.rightIcon
|
|
362
|
+
},
|
|
363
|
+
this.sizeModifierClass,
|
|
364
|
+
this.inputClass
|
|
365
|
+
];
|
|
366
|
+
},
|
|
367
|
+
inputWrapperClasses() {
|
|
368
|
+
return this.hidden ? [] : [
|
|
369
|
+
"d-input__wrapper",
|
|
370
|
+
{ [this.stateClass]: this.showInputState },
|
|
371
|
+
this.inputWrapperClass
|
|
372
|
+
];
|
|
373
|
+
},
|
|
374
|
+
calculateLength(e) {
|
|
375
|
+
return typeof e != "string" ? 0 : [...e].length;
|
|
376
|
+
},
|
|
377
|
+
inputLengthErrorMessage() {
|
|
378
|
+
return {
|
|
379
|
+
message: this.validationProps.length.message,
|
|
380
|
+
type: this.inputLengthState
|
|
381
|
+
};
|
|
382
|
+
},
|
|
383
|
+
inputIconClasses(e) {
|
|
384
|
+
const t = {
|
|
385
|
+
xs: "d-input-icon--xs",
|
|
386
|
+
sm: "d-input-icon--sm",
|
|
387
|
+
lg: "d-input-icon--lg",
|
|
388
|
+
xl: "d-input-icon--xl"
|
|
389
|
+
};
|
|
390
|
+
return [
|
|
391
|
+
{
|
|
392
|
+
left: "base-input__icon--left d-input-icon--left",
|
|
393
|
+
right: "base-input__icon--right d-input-icon--right"
|
|
394
|
+
}[e],
|
|
395
|
+
"d-input-icon",
|
|
396
|
+
{ [t[this.iconSizeComputed]]: !this.isDefaultIconSize },
|
|
397
|
+
this.sizeModifierClass
|
|
398
|
+
];
|
|
399
|
+
},
|
|
400
|
+
onBlur(e) {
|
|
401
|
+
var t;
|
|
402
|
+
(t = this.$refs.container) != null && t.contains(e.relatedTarget) || this.$emit("blur", e);
|
|
403
|
+
},
|
|
404
|
+
clear() {
|
|
405
|
+
this.$emit("input", ""), this.$emit("clear");
|
|
406
|
+
},
|
|
407
|
+
blur() {
|
|
408
|
+
this.$refs.input.blur();
|
|
409
|
+
},
|
|
410
|
+
focus() {
|
|
411
|
+
this.$refs.input.focus();
|
|
412
|
+
},
|
|
413
|
+
select() {
|
|
414
|
+
this.$refs.input.select();
|
|
415
|
+
},
|
|
416
|
+
getMessageKey(e, t) {
|
|
417
|
+
return `message-${e}-${t}`;
|
|
418
|
+
},
|
|
419
|
+
validateLength(e) {
|
|
420
|
+
this.isInvalid = e > this.validationProps.length.max;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
var x = function() {
|
|
425
|
+
var t = this, i = t._self._c;
|
|
426
|
+
return i("div", { ref: "container", class: ["base-input", { "d-vi-hidden": t.hidden }], attrs: { "data-qa": "dt-input" } }, [i("label", { staticClass: "base-input__label", attrs: { "aria-details": t.$slots.description || t.description ? t.descriptionKey : void 0, "data-qa": "dt-input-label-wrapper" } }, [t._t("labelSlot", function() {
|
|
427
|
+
return [t.labelVisible && t.label ? i("div", { ref: "label", class: [
|
|
428
|
+
"base-input__label-text",
|
|
429
|
+
"d-label",
|
|
430
|
+
t.labelSizeClasses[t.size]
|
|
431
|
+
], attrs: { "data-qa": "dt-input-label" } }, [t._v(" " + t._s(t.label) + " ")]) : t._e()];
|
|
432
|
+
}), t.$slots.description || t.description || t.shouldValidateLength ? i("div", { ref: "description", class: [
|
|
433
|
+
"base-input__description",
|
|
434
|
+
"d-description",
|
|
435
|
+
t.descriptionSizeClasses[t.size]
|
|
436
|
+
], attrs: { id: t.descriptionKey, "data-qa": "dt-input-description" } }, [t.$slots.description || t.description ? i("div", [t._t("description", function() {
|
|
437
|
+
return [t._v(t._s(t.description))];
|
|
438
|
+
})], 2) : t._e(), t.shouldValidateLength ? i("div", { staticClass: "d-input__length-description", attrs: { "data-qa": "dt-input-length-description" } }, [t._v(" " + t._s(t.validationProps.length.description) + " ")]) : t._e()]) : t._e(), i("div", { class: t.inputWrapperClasses(), attrs: { "read-only": t.disabled } }, [t.$slots.leftIcon ? i("span", { class: t.inputIconClasses("left"), attrs: { "data-qa": "dt-input-left-icon-wrapper" }, on: { focusout: t.onBlur } }, [t._t("leftIcon")], 2) : t._e(), t.isTextarea ? i("textarea", t._g(t._b({ ref: "input", class: t.inputClasses(), attrs: { name: t.name, disabled: t.disabled, maxlength: t.shouldLimitMaxLength ? t.validationProps.length.max : null, "data-qa": t.$attrs["data-qa"] ?? "dt-input-input" }, domProps: { value: t.value } }, "textarea", t.$attrs, !1), t.inputListeners)) : i("input", t._g(t._b({ ref: "input", class: t.inputClasses(), attrs: { name: t.name, type: t.type, disabled: t.disabled, maxlength: t.shouldLimitMaxLength ? t.validationProps.length.max : null, "data-qa": t.$attrs["data-qa"] ?? "dt-input-input" }, domProps: { value: t.value } }, "input", t.$attrs, !1), t.inputListeners)), t.$slots.rightIcon ? i("span", { class: t.inputIconClasses("right"), attrs: { "data-qa": "dt-input-right-icon-wrapper" }, on: { focusout: t.onBlur } }, [t._t("rightIcon")], 2) : t._e()])], 2), i("dt-validation-messages", t._b({ class: t.messagesClass, attrs: { "validation-messages": t.validationMessages, "show-messages": t.showMessages, "data-qa": "dt-input-messages" } }, "dt-validation-messages", t.messagesChildProps, !1))], 1);
|
|
439
|
+
}, L = [], S = /* @__PURE__ */ _(
|
|
440
|
+
b,
|
|
441
|
+
x,
|
|
442
|
+
L,
|
|
443
|
+
!1,
|
|
444
|
+
null,
|
|
445
|
+
null,
|
|
446
|
+
null,
|
|
447
|
+
null
|
|
448
|
+
);
|
|
449
|
+
const $ = S.exports;
|
|
450
|
+
export {
|
|
451
|
+
$ as DtInput,
|
|
452
|
+
s as INPUT_SIZES,
|
|
453
|
+
a as INPUT_TYPES
|
|
454
|
+
};
|
|
455
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../components/input/input_constants.js","../../components/input/input.vue"],"sourcesContent":["// Valid input types, any other input types (for example: 'radio' or 'checkbox') should\n// use the respective base vue components (radio.vue and checkout.vue).\nexport const INPUT_TYPES = {\n TEXT: 'text',\n TEXTAREA: 'textarea',\n PASSWORD: 'password',\n EMAIL: 'email',\n NUMBER: 'number',\n DATE: 'date',\n TIME: 'time',\n FILE: 'file',\n};\n\nexport const INPUT_SIZES = {\n EXTRA_SMALL: 'xs',\n SMALL: 'sm',\n DEFAULT: 'md',\n LARGE: 'lg',\n EXTRA_LARGE: 'xl',\n};\n\nexport default {\n INPUT_TYPES,\n INPUT_SIZES,\n};\n","<!-- eslint-disable vue/no-restricted-class -->\n<template>\n <div\n ref=\"container\"\n :class=\"['base-input', { 'd-vi-hidden': hidden }]\"\n data-qa=\"dt-input\"\n >\n <label\n class=\"base-input__label\"\n :aria-details=\"$slots.description || description ? descriptionKey : undefined\"\n data-qa=\"dt-input-label-wrapper\"\n >\n <!-- @slot slot for label, defaults to label prop -->\n <slot name=\"labelSlot\">\n <div\n v-if=\"labelVisible && label\"\n ref=\"label\"\n data-qa=\"dt-input-label\"\n :class=\"[\n 'base-input__label-text',\n 'd-label',\n labelSizeClasses[size],\n ]\"\n >\n {{ label }}\n </div>\n </slot>\n <div\n v-if=\"$slots.description || description || shouldValidateLength\"\n :id=\"descriptionKey\"\n ref=\"description\"\n :class=\"[\n 'base-input__description',\n 'd-description',\n descriptionSizeClasses[size],\n ]\"\n data-qa=\"dt-input-description\"\n >\n <div\n v-if=\"$slots.description || description\"\n >\n <!-- @slot slot for description, defaults to description prop -->\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <div\n v-if=\"shouldValidateLength\"\n data-qa=\"dt-input-length-description\"\n class=\"d-input__length-description\"\n >\n {{ validationProps.length.description }}\n </div>\n </div>\n <div\n :class=\"inputWrapperClasses()\"\n :read-only=\"disabled\"\n >\n <span\n v-if=\"$slots.leftIcon\"\n :class=\"inputIconClasses('left')\"\n data-qa=\"dt-input-left-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for left icon -->\n <slot name=\"leftIcon\" />\n </span>\n <textarea\n v-if=\"isTextarea\"\n ref=\"input\"\n :value=\"value\"\n :name=\"name\"\n :disabled=\"disabled\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n :data-qa=\"$attrs['data-qa'] ?? 'dt-input-input'\"\n v-bind=\"$attrs\"\n v-on=\"inputListeners\"\n />\n <input\n v-else\n ref=\"input\"\n :value=\"value\"\n :name=\"name\"\n :type=\"type\"\n :disabled=\"disabled\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n :data-qa=\"$attrs['data-qa'] ?? 'dt-input-input'\"\n v-bind=\"$attrs\"\n v-on=\"inputListeners\"\n >\n <span\n v-if=\"$slots.rightIcon\"\n :class=\"inputIconClasses('right')\"\n data-qa=\"dt-input-right-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for right icon -->\n <slot name=\"rightIcon\" />\n </span>\n </div>\n </label>\n <dt-validation-messages\n :validation-messages=\"validationMessages\"\n :show-messages=\"showMessages\"\n :class=\"messagesClass\"\n v-bind=\"messagesChildProps\"\n data-qa=\"dt-input-messages\"\n />\n </div>\n</template>\n\n<script>\nimport { DESCRIPTION_SIZE_TYPES, VALIDATION_MESSAGE_TYPES } from '@/common/constants';\nimport { INPUT_TYPES, INPUT_SIZES } from './input_constants';\nimport {\n getUniqueString,\n getValidationState,\n} from '@/common/utils';\nimport { DtValidationMessages } from '@/components/validation_messages';\nimport { MessagesMixin } from '@/common/mixins/input';\n\n/**\n * An input field is an input control that allows users to enter alphanumeric information.\n * It can have a range of options and supports single line and multi-line lengths,\n * as well as varying formats, including numbers, masked passwords, etc.\n * @property {Boolean} placeholder attribute\n * @see https://dialtone.dialpad.com/components/input.html\n */\nexport default {\n name: 'DtInput',\n\n components: { DtValidationMessages },\n\n mixins: [MessagesMixin],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Name property of the input element\n */\n name: {\n type: String,\n default: '',\n },\n\n /**\n * Type of the input, one of: `text`, `password`, `email`, `number`, `textarea`, 'date', 'time'.\n * When `textarea` a `<textarea>` element will be rendered instead of an `<input>` element.\n * @values text, password, email, number, textarea, date, time\n */\n type: {\n type: String,\n default: INPUT_TYPES.TEXT,\n validator: (t) => Object.values(INPUT_TYPES).includes(t),\n },\n\n /**\n * Value of the input\n */\n value: {\n type: [String, Number],\n default: '',\n },\n\n /**\n * Disables the input\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Label for the input\n */\n label: {\n type: String,\n default: '',\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 * Description for the input\n */\n description: {\n type: String,\n default: '',\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(INPUT_SIZES).includes(t),\n },\n\n /**\n * Size of the icon. One of `xs`, `sm`, `md`, `lg`, `xl`. If you do not set this the icon will size relative\n * to the input size\n * @values null, xs, sm, md, lg, xl\n */\n iconSize: {\n type: String,\n default: null,\n validator: (t) => Object.values(INPUT_SIZES).includes(t),\n },\n\n /**\n * Additional class name for the input element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n inputClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the input wrapper element.\n * Can accept all of String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n inputWrapperClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * The current character length that the user has entered into the input.\n * This will only need to be used if you are using `validate.length` and\n * the string contains abnormal characters.\n * For example, an emoji could take up many characters in the input, but should only count as 1 character.\n * If no number is provided, a built-in length calculation will be used for the length validation.\n */\n currentLength: {\n type: Number,\n default: null,\n },\n\n /**\n * Whether the input will continue to display a warning validation message even if the input has lost focus.\n */\n retainWarning: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Validation for the input. Supports maximum length validation with the structure:\n * `{ \"length\": {\"description\": string, \"max\": number, \"warn\": number, \"message\": string,\n * \"limitMaxLength\": boolean }}`\n */\n validate: {\n type: Object,\n default: null,\n },\n\n /**\n * hidden allows to use input without the element visually present in DOM\n */\n hidden: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String}\n */\n 'input',\n\n /**\n * Native input blur event\n *\n * @event blur\n * @type {FocusEvent}\n */\n 'blur',\n\n /**\n * Input clear event\n *\n * @event clear\n */\n 'clear',\n\n /**\n * Native input focus event\n *\n * @event focus\n * @type {FocusEvent}\n */\n 'focus',\n\n /**\n * Native input focusin event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native input focusout event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n\n /**\n * Length of the input when currentLength prop is not passed\n *\n * @event update:length\n * @type {Number}\n */\n 'update:length',\n\n /**\n * Result of the input validation\n *\n * @event update:invalid\n * @type {Boolean}\n */\n 'update:invalid',\n ],\n\n data () {\n return {\n descriptionSizeClasses: {\n lg: 'd-description--lg',\n xl: 'd-description--xl',\n },\n\n labelSizeClasses: {\n xs: 'd-label--xs',\n sm: 'd-label--sm',\n md: 'd-label--md',\n lg: 'd-label--lg',\n xl: 'd-label--xl',\n },\n\n isInputFocused: false,\n isInvalid: false,\n defaultLength: 0,\n };\n },\n\n computed: {\n\n isTextarea () {\n return this.type === INPUT_TYPES.TEXTAREA;\n },\n\n isDefaultSize () {\n return this.size === INPUT_SIZES.DEFAULT;\n },\n\n isDefaultIconSize () {\n return this.iconSizeComputed === INPUT_SIZES.DEFAULT;\n },\n\n iconSizeComputed () {\n return this.iconSize ? this.iconSize : this.size;\n },\n\n isValidSize () {\n return Object.values(INPUT_SIZES).includes(this.size);\n },\n\n isValidDescriptionSize () {\n return Object.values(DESCRIPTION_SIZE_TYPES).includes(this.size);\n },\n\n inputComponent () {\n if (this.isTextarea) {\n return 'textarea';\n }\n\n return 'input';\n },\n\n inputListeners () {\n return {\n /* TODO\n Check if any usages of this component leverage $listeners and either remove if unused or scope the removal\n and migration prior to upgrading to Vue 3.x\n */\n ...this.$listeners,\n input: event => this.$emit('input', event.target.value),\n focus: event => {\n this.isInputFocused = true;\n this.$emit('focus', event);\n },\n\n blur: event => {\n this.isInputFocused = false;\n this.onBlur(event);\n },\n };\n },\n\n descriptionKey () {\n return `input-description-${getUniqueString()}`;\n },\n\n inputState () {\n return getValidationState(this.validationMessages);\n },\n\n defaultLengthCalculation () {\n return this.calculateLength(this.value);\n },\n\n validationProps () {\n return {\n length: {\n description: this?.validate?.length?.description,\n max: this?.validate?.length?.max,\n warn: this?.validate?.length?.warn,\n message: this?.validate?.length?.message,\n limitMaxLength: this?.validate?.length?.limitMaxLength ? this.validate.length.limitMaxLength : false,\n },\n };\n },\n\n validationMessages () {\n // Add length validation message if exists\n if (this.showLengthLimitValidation) {\n return this.formattedMessages.concat([this.inputLengthErrorMessage()]);\n }\n\n return this.formattedMessages;\n },\n\n showInputState () {\n return this.showMessages && this.inputState;\n },\n\n inputLength () {\n return this.currentLength ? this.currentLength : this.defaultLengthCalculation;\n },\n\n inputLengthState () {\n if (this.inputLength < this.validationProps.length.warn) {\n return null;\n } else if (this.inputLength <= this.validationProps.length.max) {\n return this.validationProps.length.warn ? VALIDATION_MESSAGE_TYPES.WARNING : null;\n } else {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n },\n\n shouldValidateLength () {\n return !!(\n this.validationProps.length.description &&\n this.validationProps.length.max\n );\n },\n\n shouldLimitMaxLength () {\n return this.shouldValidateLength && this.validationProps.length.limitMaxLength;\n },\n\n // eslint-disable-next-line complexity\n showLengthLimitValidation () {\n return (\n this.shouldValidateLength &&\n this.inputLengthState !== null &&\n this.validationProps.length.message &&\n (this.retainWarning || this.isInputFocused || this.isInvalid)\n );\n },\n\n sizeModifierClass () {\n if (this.isDefaultSize || !this.isValidSize) {\n return '';\n }\n\n const sizeClasses = {\n input: {\n xs: 'd-input--xs',\n sm: 'd-input--sm',\n lg: 'd-input--lg',\n xl: 'd-input--xl',\n },\n\n textarea: {\n xs: 'd-textarea--xs',\n sm: 'd-textarea--sm',\n lg: 'd-textarea--lg',\n xl: 'd-textarea--xl',\n },\n };\n\n return sizeClasses[this.inputComponent][this.size];\n },\n\n stateClass () {\n const inputStateClasses = {\n input: {\n error: 'd-input--error base-input__input--error',\n warning: 'd-input--warning base-input__input--warning',\n success: 'd-input--success base-input__input--success',\n },\n\n textarea: {\n error: 'd-textarea--error base-input__input--error',\n warning: 'd-textarea--warning base-input__input--warning',\n success: 'd-textarea--success base-input__input--success',\n },\n };\n return [inputStateClasses[this.inputComponent][this.inputState]];\n },\n },\n\n watch: {\n isInvalid (val) {\n this.$emit('update:invalid', val);\n },\n\n value: {\n immediate: true,\n handler (newValue) {\n if (this.shouldValidateLength) {\n this.validateLength(this.inputLength);\n }\n\n if (this.currentLength == null) {\n this.$emit('update:length', this.calculateLength(newValue));\n }\n },\n },\n },\n\n methods: {\n inputClasses () {\n return [\n 'base-input__input',\n this.inputComponent === 'input' ? 'd-input' : 'd-textarea',\n {\n [this.stateClass]: this.showInputState,\n 'd-input-icon--left': this.$slots.leftIcon,\n 'd-input-icon--right': this.$slots.rightIcon,\n },\n this.sizeModifierClass,\n this.inputClass,\n ];\n },\n\n inputWrapperClasses () {\n if (this.hidden) {\n return [];\n }\n return [\n 'd-input__wrapper',\n { [this.stateClass]: this.showInputState },\n this.inputWrapperClass,\n ];\n },\n\n calculateLength (value) {\n if (typeof value !== 'string') {\n return 0;\n }\n\n return [...value].length;\n },\n\n inputLengthErrorMessage () {\n return {\n message: this.validationProps.length.message,\n type: this.inputLengthState,\n };\n },\n\n inputIconClasses (side) {\n const iconSizeClasses = {\n xs: 'd-input-icon--xs',\n sm: 'd-input-icon--sm',\n lg: 'd-input-icon--lg',\n xl: 'd-input-icon--xl',\n };\n const iconOrientationClasses = {\n left: 'base-input__icon--left d-input-icon--left',\n right: 'base-input__icon--right d-input-icon--right',\n };\n\n return [\n iconOrientationClasses[side],\n 'd-input-icon',\n { [iconSizeClasses[this.iconSizeComputed]]: !this.isDefaultIconSize },\n this.sizeModifierClass,\n ];\n },\n\n onBlur (e) {\n // Do not emit a blur event if the target element is a child of this component\n if (!this.$refs.container?.contains(e.relatedTarget)) {\n this.$emit('blur', e);\n }\n },\n\n clear () {\n this.$emit('input', '');\n this.$emit('clear');\n },\n\n blur () {\n this.$refs.input.blur();\n },\n\n focus () {\n this.$refs.input.focus();\n },\n\n select () {\n this.$refs.input.select();\n },\n\n getMessageKey (type, index) {\n return `message-${type}-${index}`;\n },\n\n validateLength (length) {\n this.isInvalid = (length > this.validationProps.length.max);\n },\n },\n};\n</script>\n"],"names":["INPUT_TYPES","INPUT_SIZES","_sfc_main","DtValidationMessages","MessagesMixin","t","DESCRIPTION_SIZE_TYPES","event","getUniqueString","getValidationState","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","VALIDATION_MESSAGE_TYPES","val","newValue","value","side","iconSizeClasses","type","index","length"],"mappings":";;;;;;;AAEY,MAACA,IAAc;AAAA,EACzB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR,GAEaC,IAAc;AAAA,EACzB,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AACf,GC6GAC,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA,EAAA,sBAAAC,EAAA;AAAA,EAEA,QAAA,CAAAC,CAAA;AAAA,EAEA,cAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAAJ,EAAA;AAAA,MACA,WAAA,CAAAK,MAAA,OAAA,OAAAL,C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IACA;AAAA,IAEA,OAAA,GAAA;;AAEA,OAAAd,IAAA,KAAA,MAAA,cAAA,QAAAA,EAAA,SAAA,EAAA,kBACA,KAAA,MAAA,QAAA,CAAA;AAAA,IAEA;AAAA,IAEA,QAAA;AACA,WAAA,MAAA,SAAA,EAAA,GACA,KAAA,MAAA,OAAA;AAAA,IACA;AAAA,IAEA,OAAA;AACA,WAAA,MAAA,MAAA;IACA;AAAA,IAEA,QAAA;AACA,WAAA,MAAA,MAAA;IACA;AAAA,IAEA,SAAA;AACA,WAAA,MAAA,MAAA;IACA;AAAA,IAEA,cAAAe,GAAAC,GAAA;AACA,aAAA,WAAAD,CAAA,IAAAC,CAAA;AAAA,IACA;AAAA,IAEA,eAAAC,GAAA;AACA,WAAA,YAAAA,IAAA,KAAA,gBAAA,OAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { n as a } from "../chunks/_plugin-vue2_normalizer-u6G_3nkj.js";
|
|
2
|
+
const s = {
|
|
3
|
+
name: "DtItemLayout",
|
|
4
|
+
props: {
|
|
5
|
+
/**
|
|
6
|
+
* Set this prop to render layout as a specific HTML element.
|
|
7
|
+
*/
|
|
8
|
+
as: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "div"
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* Set this prop to remove the default styling.
|
|
14
|
+
* @values true, false
|
|
15
|
+
*/
|
|
16
|
+
unstyled: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !1
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var l = function() {
|
|
23
|
+
var t = this, e = t._self._c;
|
|
24
|
+
return e(t.as, { tag: "component", class: t.unstyled ? "dt-item-layout--custom" : "dt-item-layout" }, [t.$slots.left ? e("section", { staticClass: "dt-item-layout--left", attrs: { "data-qa": "dt-item-layout-left-wrapper" } }, [t._t("left")], 2) : t._e(), e("section", { staticClass: "dt-item-layout--content", attrs: { "data-qa": "dt-item-layout-content-wrapper" } }, [t.$slots.default ? e("div", { staticClass: "dt-item-layout--title", attrs: { "data-qa": "dt-item-layout-title-wrapper" } }, [t._t("default")], 2) : t._e(), t.$slots.subtitle ? e("div", { class: ["dt-item-layout--subtitle", { "dt-item-layout--subtitle--with-title": t.$slots.default }], attrs: { "data-qa": "dt-item-layout-subtitle-wrapper" } }, [t._t("subtitle")], 2) : t._e(), t.$slots.bottom ? e("div", { staticClass: "dt-item-layout--bottom", attrs: { "data-qa": "dt-item-layout-bottom-wrapper" } }, [t._t("bottom")], 2) : t._e()]), t.$slots.right ? e("section", { staticClass: "dt-item-layout--right", attrs: { "data-qa": "dt-item-layout-right-wrapper" } }, [t._t("right")], 2) : t._e(), t.$slots.selected ? e("section", { staticClass: "dt-item-layout--selected", attrs: { "data-qa": "dt-item-layout-selected-wrapper" } }, [t._t("selected")], 2) : t._e()]);
|
|
25
|
+
}, o = [], i = /* @__PURE__ */ a(
|
|
26
|
+
s,
|
|
27
|
+
l,
|
|
28
|
+
o,
|
|
29
|
+
!1,
|
|
30
|
+
null,
|
|
31
|
+
null,
|
|
32
|
+
null,
|
|
33
|
+
null
|
|
34
|
+
);
|
|
35
|
+
const u = i.exports;
|
|
36
|
+
export {
|
|
37
|
+
u as DtItemLayout
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=item-layout.js.map
|