UNPKG

t-fighting-design

Version:

Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.

74 lines (73 loc) 2.25 kB
import { defineComponent as c, ref as b, computed as d, openBlock as n, createElementBlock as s, normalizeClass as v, unref as i, withDirectives as h, createElementVNode as u, isRef as V, vModelRadio as g, createCommentVNode as y, renderSlot as k, createTextVNode as R, toDisplayString as C, getCurrentInstance as E, inject as N } from "vue"; import { Props as P, Emits as j } from "./index3.js"; import { RadioGroupPropsKey as G } from "../../radio-group/src/index3.js"; const I = ["value", "disabled", "name"], B = { key: 0, class: "f-radio__circle" }, D = { class: "f-radio__text" }, F = c({ name: "FRadio" }), z = /* @__PURE__ */ c({ ...F, props: P, emits: j, setup(m, { emit: p }) { const l = m, a = b(null); (() => { const { parent: e } = E(), o = e.type.name; o && o === "FRadioGroup" && (a.value = N(G)); })(); const t = d({ get() { return a.value && a.value.modelValue || l.modelValue; }, set(e) { if (a.value && !a.value.disabled) { a.value.changeEvent(e); return; } l.disabled || (p("update:modelValue", e), l.change && l.change(e)); } }), f = d(() => { const { disabled: e } = l; return [ "f-radio", { "f-radio__checked": t.value === l.label, "f-radio__margin": !a.value, "f-radio__disabled": e || a.value && a.value.disabled } ]; }); return (e, o) => { var r; return n(), s("label", { role: "radio", "aria-checked": "false", tabindex: "0", "aria-labelledby": "q25_radio1-label", "data-value": "True", class: v(i(f)) }, [ h(u("input", { "onUpdate:modelValue": o[0] || (o[0] = (_) => V(t) ? t.value = _ : null), hidden: "", type: "radio", value: e.label, disabled: e.disabled, name: e.name }, null, 8, I), [ [g, i(t)] ]), (r = a.value) != null && r.border ? y("", !0) : (n(), s("span", B)), u("span", D, [ k(e.$slots, "default", {}, () => [ R(C(e.label), 1) ]) ]) ], 2); }; } }); export { z as default };