@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
1 lines • 3 kB
Source Map (JSON)
{"version":3,"file":"radio-group.cjs","sources":["../../../components/radio_group/radio_group.vue"],"sourcesContent":["<script>\nimport { DtInputGroup } from '../input_group';\n\n/**\n * Radio Groups are control elements that allow the user to make a single selection from a list of options.\n * @see https://dialtone.dialpad.com/components/radio_group.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtRadioGroup',\n\n extends: DtInputGroup,\n\n props: {\n /**\n * A provided value for the radio group\n * @model value\n */\n modelValue: {\n type: [String, Number],\n default: '',\n },\n\n /**\n * A data qa tag for the radio group\n */\n dataQaGroup: {\n type: String,\n default: 'radio-group',\n },\n\n /**\n * A data qa tag for the radio group legend\n */\n dataQaGroupLegend: {\n type: String,\n default: 'radio-group-legend',\n },\n\n /**\n * A data qa tag for the radio group messages\n */\n dataQaGroupMessages: {\n type: String,\n default: 'radio-group-messages',\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String | Number}\n */\n 'input',\n /**\n * Native input event\n *\n * @event input\n * @type {String | Number}\n */\n 'update:modelValue',\n ],\n\n data () {\n return {\n internalValue: this.modelValue,\n };\n },\n\n watch: {\n modelValue (newValue) {\n this.internalValue = newValue;\n },\n\n /*\n * watching value to support 2 way binding for slotted radios.\n * need this to pass value to slotted checkboxes if modified outside\n * radio group.\n */\n internalValue: {\n immediate: true,\n handler (newInternalValue) {\n this.provideObj.selectedValue = newInternalValue;\n },\n },\n },\n\n methods: {\n /*\n * provided value to support 2 way binding for slotted radios.\n * slotted radios will change this value and need to emit new value up.\n */\n setGroupValue (newValue) {\n this.$emit('input', newValue);\n this.$emit('update:modelValue', newValue);\n },\n\n getMessageKey (type, index) {\n return `radio-group-message-${type}-${index}-${this.id}`;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtInputGroup","newValue","newInternalValue","type","index"],"mappings":"8JAOKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,eAEN,QAASC,EAAAA,QAET,MAAO,CAKL,WAAY,CACV,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,IAMX,YAAa,CACX,KAAM,OACN,QAAS,eAMX,kBAAmB,CACjB,KAAM,OACN,QAAS,sBAMX,oBAAqB,CACnB,KAAM,OACN,QAAS,yBAIb,MAAO,CAOL,QAOA,qBAGF,MAAQ,CACN,MAAO,CACL,cAAe,KAAK,WAExB,EAEA,MAAO,CACL,WAAYC,EAAU,CACpB,KAAK,cAAgBA,CACvB,EAOA,cAAe,CACb,UAAW,GACX,QAASC,EAAkB,CACzB,KAAK,WAAW,cAAgBA,CAClC,IAIJ,QAAS,CAKP,cAAeD,EAAU,CACvB,KAAK,MAAM,QAASA,CAAQ,EAC5B,KAAK,MAAM,oBAAqBA,CAAQ,CAC1C,EAEA,cAAeE,EAAMC,EAAO,CAC1B,MAAO,uBAAuBD,CAAI,IAAIC,CAAK,IAAI,KAAK,EAAE,EACxD,EAEJ"}