@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
87 lines (86 loc) • 1.77 kB
JavaScript
import { n as a } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
import r from "../input-group/input-group.js";
const o = {
name: "DtRadioGroup",
extends: r,
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(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);
},
getMessageKey(e, t) {
return `radio-group-message-${e}-${t}-${this.id}`;
}
}
}, s = null, u = null;
var n = /* @__PURE__ */ a(
o,
s,
u
);
const i = n.exports;
export {
i as default
};
//# sourceMappingURL=radio-group.js.map