@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
89 lines (88 loc) • 2.15 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const _pluginVue2_normalizer = require("../../_virtual/_plugin-vue2_normalizer.cjs");
const input_group = require("../input_group/input_group.vue.cjs");
const _sfc_main = {
name: "DtRadioGroup",
extends: input_group.default,
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__ */ _pluginVue2_normalizer.default(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns
);
const radio_group = __component__.exports;
exports.default = radio_group;
//# sourceMappingURL=radio_group.vue.cjs.map