UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

1 lines 4.19 kB
{"version":3,"file":"input-group.cjs","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=\"hasSlotContent($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';\nimport { hasSlotContent } from '@/common/utils';\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 compatConfig: { MODE: 3 },\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 data () {\n return {\n internalValue: this.value,\n hasSlotContent,\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: {\n immediate: true,\n handler (newInternalValue) {\n this.provideObj.value = newInternalValue;\n },\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","hasSlotContent","newValue","newInternalValue","type","index","_hoisted_1","_hoisted_2","_createElementBlock","$props","$data","_ctx","_openBlock","_mergeProps","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_createVNode","_component_dt_validation_messages"],"mappings":"oVAuCKA,EAAU,CACb,aAAc,CAAE,KAAM,CAAG,EACzB,KAAM,eAEN,WAAY,CAAEC,qBAAAA,EAAAA,OAAsB,EAEpC,OAAQ,CAACC,EAAAA,eAAe,EAExB,MAAO,CAIL,YAAa,CACX,KAAM,OACN,QAAS,aACV,EAKD,kBAAmB,CACjB,KAAM,OACN,QAAS,oBACV,EAKD,oBAAqB,CACnB,KAAM,OACN,QAAS,sBACV,CACF,EAED,MAAQ,CACN,MAAO,CACL,cAAe,KAAK,MACpB,eAAAC,EAAc,eAEjB,EAED,MAAO,CACL,MAAOC,EAAU,CACf,KAAK,cAAgBA,CACtB,EAOD,cAAe,CACb,UAAW,GACX,QAASC,EAAkB,CACzB,KAAK,WAAW,MAAQA,CACzB,CACF,CACF,EAED,QAAS,CACP,cAAeC,EAAMC,EAAO,CAC1B,MAAO,uBAAuBD,CAAI,IAAIC,CAAK,IAAI,KAAK,EAAE,EACvD,CACF,CACH,EAvGAC,EAAA,CAAA,SAAA,EAAAC,EAAA,CAAA,SAAA,oGACEC,EAwBW,mBAAA,WAAA,CAvBT,MAAM,0BACL,UAASC,EAAW,cAGbC,EAAA,eAAeC,EAAA,OAAO,MAAM,GAAKA,EAAM,QAD/CC,EAAAA,YAAAJ,EAAAA,mBAUS,SAVTK,aAUS,CAfb,IAAA,EAOO,iBAAmBF,EAAW,WAAA,GACvBA,EAAgB,iBAAA,CACvB,UAASF,EAAiB,iBAAA,CAAA,EAAA,CAG3BK,EAAAA,WAEOH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