UNPKG

@shopware-ag/meteor-component-library

Version:

The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).

62 lines (61 loc) 2.37 kB
import '../mt-radio-group-item.css'; "use strict"; const vue = require("vue"); const MtRadioGroupIndicator = require("./MtRadioGroupIndicator.js"); const _pluginVue_exportHelper = require("../_plugin-vue_export-helper-9c783a34.js"); const _hoisted_1 = ["for"]; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "mt-radio-group-item", props: { id: {}, value: { type: [String, Number, Boolean] }, label: {}, required: { type: Boolean, default: false }, ariaDescribedBy: { default: void 0 }, error: { type: Boolean, default: false } }, setup(__props) { const props = __props; const radioGroup = vue.inject("radioGroupContext"); if (!radioGroup) { throw new Error("MtRadioGroupItem must be used within MtRadioGroupRoot"); } const radioGroupContext = radioGroup; const name = vue.computed(() => radioGroupContext.name.value); const checked = vue.computed(() => radioGroupContext.selectedValue.value === props.value); const isDisabled = vue.computed(() => radioGroupContext.disabled.value); function onClick() { if (isDisabled.value) { return; } radioGroupContext.selectOption(props.value); } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(["mt-radio-group-item", { "mt-radio-group-item--disabled": isDisabled.value }]), onClick }, [ vue.createVNode(MtRadioGroupIndicator, { id: _ctx.id, name: name.value, value: _ctx.value, checked: checked.value, disabled: isDisabled.value, required: _ctx.required, "aria-described-by": _ctx.ariaDescribedBy, error: _ctx.error }, null, 8, ["id", "name", "value", "checked", "disabled", "required", "aria-described-by", "error"]), vue.createElementVNode("label", { for: _ctx.id, class: "mt-radio-group-item__label" }, vue.toDisplayString(_ctx.label), 9, _hoisted_1) ], 2); }; } }); const mtRadioGroupItem_vue_vue_type_style_index_0_scoped_95a7195b_lang = ""; const mtRadioGroupItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-95a7195b"]]); module.exports = mtRadioGroupItem; //# sourceMappingURL=MtRadioGroupItem.js.map