@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
41 lines (40 loc) • 1.58 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { __rest } from "tslib";
import { h } from "@stencil/core";
import KolCheckboxFc from "../../functional-components/inputs/Checkbox";
import { getRenderStates } from "../_helpers/getRenderStates";
function getCheckboxProps(state, inputProps = {}) {
const { ariaDescribedBy } = getRenderStates(state);
const props = {
id: state._id,
hideLabel: state._hideLabel,
label: state._label,
value: state._value,
accessKey: state._accessKey,
disabled: state._disabled,
name: state._name,
ariaDescribedBy: ariaDescribedBy,
};
if ('_required' in state)
props.required = state._required;
if ('_checked' in state)
props.checked = state._checked;
if ('_indeterminate' in state)
props.indeterminate = state._indeterminate;
if ('_touched' in state)
props.touched = state._touched;
if ('_msg' in state)
props.msg = state._msg;
if ('_shortKey' in state)
props['aria-keyshortcuts'] = state._shortKey;
return Object.assign(Object.assign({}, props), inputProps);
}
const CheckboxStateWrapper = (_a) => {
var { state, inputProps } = _a, other = __rest(_a, ["state", "inputProps"]);
const variant = (state === null || state === void 0 ? void 0 : state._variant) || 'default';
return h(KolCheckboxFc, Object.assign({ variant: variant, inputProps: getCheckboxProps(state, inputProps) }, other));
};
export default CheckboxStateWrapper;
//# sourceMappingURL=CheckboxStateWrapper.js.map