import { html } from 'lit'; import { classMap } from 'lit-html/directives/class-map'; import { ifDefined } from 'lit-html/directives/if-defined'; export const renderFormControl = (props, input) => { const hasLabel = props.label ? true : !!props.hasLabelSlot; const hasHelpText = props.helpText ? true : !!props.hasHelpTextSlot; return html `
${html `${input}`}
${props.helpText}
`; }; export function getLabelledBy(props) { const labelledBy = [ props.label || props.hasLabelSlot ? props.labelId : '', props.helpText || props.hasHelpTextSlot ? props.helpTextId : '' ].filter(val => val); return labelledBy.join(' ') || undefined; }