// #region Imports
import { html } from '../../../../Dom/Html';
import { Icons } from '../../../../Resources/Icons';
import { classMap, when } from '../../../Directives/Directives';
import { ifNonEmpty } from '../../../Directives/IfNonEmpty';
import { Appearance } from '../../../Types/Appearance';
import { Size } from '../../../Types/Size';
import { Variant } from '../../../Types/Variant';
// #endregion
/**
 * The template of the `FileBoxElement`.
 *
 * @public
 */
export function fileBoxElementTemplate(e) {
    return html `
        ${when(!e.disabled, () => html `
        <mosaik-focus-ring part="focusRing"
                           .variant="${e.invalid ? Variant.Danger : e.variant}"
                           .visible="${e.isFocused}"
                           .controlled="${'manual'}"
                           @connected="${(evt) => evt.target.attach(e)}"></mosaik-focus-ring>
        `)}
        <div part="prefix"
             ?hidden="${!e.hasSlotContent('prefix')}">
            <slot name="prefix"></slot>
        </div>
        <div part="inner"
             class="${classMap({ prefix: e.hasPrefix, suffix: e.hasSuffix })}">
            ${when(e.label, () => html `
            <label part="label"
                   for="input"
                   class="${classMap({ floating: e.value || e.isFocused })}">${e.label}</label>
            `)}
            <input part="input"
                   .value="${e.value}"
                   readonly
                   ?disabled="${e.disabled}"
                   ?required="${e.required}"
                   id="input"
                   name="${ifNonEmpty(e.name)}"
                   type="text"
                   placeholder="${ifNonEmpty(e.isFocused || !e.label ? e.placeholder : '')}"
                   tabindex="${e.tabIndex}"
                   aria-invalid="${e.invalid ? 'true' : 'false'}"
                   @focus="${(x) => e.onFocus(x)}"
                   @blur="${(x) => e.onBlur(x)}"
                   @click="${() => e.browse()}"/>
        </div>
        <input part="fileInput"
               type="file"
               ?multiple="${e.multiple}"
               accept="${ifNonEmpty(e.accept.join(','))}"
               ?webkitdirectory="${e.directory}"
               style="display: none;"
               tabindex="-1"
               @change="${(x) => e.onFileChange(x)}"/>
        ${when(!e.disabled && !e.readonly && e.value && e.isClearable, () => html `
        <mosaik-button part="clear"
                       .appearance="${Appearance.Plain}"
                       .icon="${Icons.clear}"
                       .size="${Size.Small}"
                       .iconSize="${Size.Medium}"
                       @click="${() => e.clear()}"></mosaik-button>
        `)}
        ${when(!e.disabled && !e.readonly, () => html `
        <mosaik-button part="browse"
                       .appearance="${Appearance.Plain}"
                       .icon="${Icons.folderOpen}"
                       .size="${Size.Small}"
                       .iconSize="${Size.Medium}"
                       @click="${() => e.browse()}"></mosaik-button>
        `)}
        <div part="suffix"
             ?hidden="${!e.hasSlotContent('suffix')}">
            <slot name="suffix"></slot>
        </div>
    `;
}
//# sourceMappingURL=FileBoxElementTemplate.js.map