@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
91 lines (90 loc) • 1.85 kB
JavaScript
import a from "../input-group/input-group.js";
const u = {
compatConfig: { MODE: 3 },
name: "DtRadioGroup",
extends: a,
props: {
/**
* A provided value for the radio group
* @model value
*/
modelValue: {
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",
/**
* Native input event
*
* @event input
* @type {String | Number}
*/
"update:modelValue"
],
data() {
return {
internalValue: this.modelValue
};
},
watch: {
modelValue(e) {
this.internalValue = e;
},
/*
* watching value to support 2 way binding for slotted radios.
* need this to pass value to slotted checkboxes if modified outside
* radio group.
*/
internalValue: {
immediate: !0,
handler(e) {
this.provideObj.selectedValue = e;
}
}
},
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(e) {
this.$emit("input", e), this.$emit("update:modelValue", e);
},
getMessageKey(e, t) {
return `radio-group-message-${e}-${t}-${this.id}`;
}
}
};
export {
u as default
};
//# sourceMappingURL=radio-group.js.map