/*!
 * KoliBri - The accessible HTML-Standard
 */
import { __rest } from "tslib";
import { Fragment, h } from "@stencil/core";
import { getMsgType, isMsgDefinedAndInputTouched } from "../../../schema";
import clsx from "../../../utils/clsx";
import { createRelatedUniqueId } from "../../../utils/dev.utils";
import { getDefaultProps } from "../_helpers/getDefaultProps";
const InputFc = (props) => {
    const { class: classNames, msg, required, disabled, touched, readonly, ariaDescribedBy, hideLabel, label, suggestions, value } = props, other = __rest(props, ["class", "msg", "required", "disabled", "touched", "readonly", "ariaDescribedBy", "hideLabel", "label", "suggestions", "value"]);
    const stateCssClasses = {
        ['kol-input--disabled']: Boolean(disabled),
        ['kol-input--required']: Boolean(required),
        ['kol-input--touched']: Boolean(touched),
        ['kol-input--readonly']: Boolean(readonly),
        [`kol-input--${getMsgType(msg)}`]: isMsgDefinedAndInputTouched(msg, touched),
    };
    const inputProps = Object.assign(Object.assign({ class: clsx('kol-input', stateCssClasses, classNames), required: required, disabled: disabled, readonly: readonly, type: 'text', list: suggestions && typeof other.id === 'string' ? createRelatedUniqueId(other.id, 'list') : undefined }, getDefaultProps({ ariaDescribedBy, hideLabel, label })), other);
    return (h(Fragment, null, h("input", Object.assign({}, inputProps, { value: value })), suggestions));
};
export default InputFc;
//# sourceMappingURL=Input.js.map
