@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
89 lines (88 loc) • 2 kB
JavaScript
import normalizeComponent from "../../_virtual/_plugin-vue2_normalizer.js";
import DtInputGroup from "../input_group/input_group.vue.js";
const _sfc_main = {
name: "DtRadioGroup",
extends: DtInputGroup,
props: {
/**
* A provided value for the radio group
* @model value
*/
value: {
type: [String, Number],
default: ""
},
/**
* A data qa tag for the radio group
*/
dataQaGroup: {
type: String,
default: "radio-group"
},
/**
* A data qa tag for the radio group legend
*/
dataQaGroupLegend: {
type: String,
default: "radio-group-legend"
},
/**
* A data qa tag for the radio group messages
*/
dataQaGroupMessages: {
type: String,
default: "radio-group-messages"
}
},
emits: [
/**
* Native input event
*
* @event input
* @type {String | Number}
*/
"input"
],
data() {
return {
// wrap values in object to make reactive
provideObj: {
selectedValue: this.value
}
};
},
watch: {
/*
* watching value to support 2 way binding for slotted radios.
* need this to pass value to slotted radios if modified outside
* radio group.
*/
value(newValue) {
this.provideObj.selectedValue = newValue;
}
},
methods: {
/*
* provided value to support 2 way binding for slotted radios.
* slotted radios will change this value and need to emit new value up.
*/
setGroupValue(newValue) {
this.$emit("input", newValue);
},
getMessageKey(type, index) {
return `radio-group-message-${type}-${index}-${this.id}`;
}
}
};
const _sfc_render = null;
const _sfc_staticRenderFns = null;
var __component__ = /* @__PURE__ */ normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns
);
const radio_group = __component__.exports;
export {
radio_group as default
};
//# sourceMappingURL=radio_group.vue.js.map