UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

28 lines (25 loc) 1.63 kB
/*! * KoliBri - The accessible HTML-Standard */ import { a as __rest } from './tslib.es6.js'; import { h, Fragment } from '@stencil/core/internal/client'; import './common.js'; import './prop.validators.js'; import { i as isMsgDefinedAndInputTouched, c as getDefaultProps, a as getMsgType } from './controller4.js'; import { c as clsx } from './clsx.js'; import { a as createRelatedUniqueId } from './dev.utils.js'; 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 { InputFc as I }; //# sourceMappingURL=Input.js.map //# sourceMappingURL=Input.js.map