@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
26 lines (25 loc) • 1.65 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { __rest } from "tslib";
import { h } from "@stencil/core";
import { getMsgType, isMsgDefinedAndInputTouched } from "../../../schema";
import clsx from "../../../utils/clsx";
import KolInputFc from "../Input";
const InputWrapperFc = (_a) => {
var { class: classNames } = _a, other = __rest(_a, ["class"]);
return h(KolInputFc, Object.assign({ class: clsx('kol-input-radio__input', classNames) }, other, { type: "radio" }));
};
const RadioFc = (_a) => {
var { class: classNames, inputProps } = _a, other = __rest(_a, ["class", "inputProps"]);
const cssVariants = {
['kol-input-radio--checked']: inputProps === null || inputProps === void 0 ? void 0 : inputProps.checked,
['kol-input-radio--disabled']: Boolean(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
['kol-input-radio--required']: Boolean(inputProps === null || inputProps === void 0 ? void 0 : inputProps.required),
['kol-input-radio--touched']: Boolean(inputProps === null || inputProps === void 0 ? void 0 : inputProps.touched),
[`kol-input-radio--${getMsgType(inputProps === null || inputProps === void 0 ? void 0 : inputProps.msg)}`]: Boolean(isMsgDefinedAndInputTouched(inputProps === null || inputProps === void 0 ? void 0 : inputProps.msg, inputProps === null || inputProps === void 0 ? void 0 : inputProps.touched)),
};
return (h("label", Object.assign({ class: clsx('kol-input-radio', cssVariants, classNames) }, other), h(InputWrapperFc, Object.assign({}, inputProps))));
};
export default RadioFc;
//# sourceMappingURL=Radio.js.map