import { r as o, c as r, h as e, H as d } from "./index.61732cef.js";
import { c as t } from "./index-orsBiyT_.fc4357c3.js";
import "react";
import "react-dom";
const p = () => ".sc-swirl-file-uploader-h{display:block;width:100%}.sc-swirl-file-uploader-h *.sc-swirl-file-uploader{box-sizing:border-box}.file-uploader.sc-swirl-file-uploader{width:100%}.file-uploader--show-dropzone.sc-swirl-file-uploader .file-uploader__dropzone.sc-swirl-file-uploader{position:relative;display:flex;width:100%;height:10rem;margin-top:var(--s-space-4);justify-content:center;align-items:center;border:var(--s-border-width-default) dashed var(--s-border-strong);border-radius:var(--s-border-radius-s);flex-direction:column}.file-uploader--show-dropzone.sc-swirl-file-uploader .file-uploader__dropzone.sc-swirl-file-uploader:focus-within{border-width:0.125rem;border-color:var(--s-focus-default)}.file-uploader--show-dropzone.sc-swirl-file-uploader .file-uploader__input.sc-swirl-file-uploader{position:absolute;z-index:1;display:block;width:100%;cursor:pointer;opacity:0;inset:0}.file-uploader--disabled.sc-swirl-file-uploader .file-uploader__input.sc-swirl-file-uploader{cursor:default}.file-uploader--disabled.sc-swirl-file-uploader .file-uploader__dropzone-cta.sc-swirl-file-uploader,.file-uploader--disabled.sc-swirl-file-uploader .file-uploader__drag-drop-label.sc-swirl-file-uploader{color:var(--s-text-disabled)}.file-uploader--disabled.sc-swirl-file-uploader .file-uploader__dropzone-icon.sc-swirl-file-uploader{color:var(--s-text-disabled)}.file-uploader__label.sc-swirl-file-uploader{display:block;font-weight:var(--s-font-weight-semibold);line-height:var(--s-line-height-base)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-uploader__label.sc-swirl-file-uploader{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.file-uploader__description.sc-swirl-file-uploader{display:block;margin-top:var(--s-space-4);margin-bottom:var(--s-space-8);color:var(--s-text-subdued);font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-uploader__description.sc-swirl-file-uploader{margin-top:var(--s-space-2)}}.file-uploader__dropzone-icon.sc-swirl-file-uploader{color:var(--s-icon-highlight)}.file-uploader__dropzone-label.sc-swirl-file-uploader{margin-top:var(--s-space-16);line-height:var(--s-line-height-base)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-uploader__dropzone-label.sc-swirl-file-uploader{margin-top:var(--s-space-8);font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.file-uploader__dropzone-cta.sc-swirl-file-uploader{color:var(--s-interactive-primary-default);font-weight:var(--s-font-weight-medium)}.file-uploader__upload-button.sc-swirl-file-uploader{margin-top:var(--s-space-16)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-uploader__upload-button.sc-swirl-file-uploader{margin-top:var(--s-space-12)}}.file-uploader__input.sc-swirl-file-uploader{display:none}.file-uploader__input.sc-swirl-file-uploader::-webkit-file-upload-button{cursor:pointer}.file-uploader__input.sc-swirl-file-uploader::file-selector-button{cursor:pointer}", n = class {
  constructor(i) {
    o(this, i), this.valueChange = r(this, "valueChange", 7), this.ctaLabel = "Click to upload", this.descriptionAllowHtml = !1, this.dragDropLabel = "or drag and drop.", this.hideLabel = !1, this.showDropzone = !0, this.uploadButtonLabel = "Select file", this.uploadButtonVariant = "flat", this.onChange = (l) => {
      const a = l.target.files;
      this.valueChange.emit(a);
    }, this.onUploadButtonClick = () => {
      this.inputEl.click();
    };
  }
  async reset() {
    this.inputEl.value = "";
  }
  render() {
    const i = Boolean(this.description) ? `${this.inputId}-description ${this.inputId}-additional-label` : `${this.inputId}-additional-label`, l = this.showDropzone ? 0 : -1, a = t("file-uploader", {
      "file-uploader--disabled": this.disabled,
      "file-uploader--show-dropzone": this.showDropzone
    });
    return e(d, { key: "ec7a92077de8f98c88ed7e134394cef3ed720fcf" }, e("div", { key: "ed4e1c2b6c2cc5e56069b5211178a733511f033d", class: a }, this.hideLabel ? e("swirl-visually-hidden", null, e("label", { htmlFor: this.inputId }, this.label)) : e("label", { class: "file-uploader__label", htmlFor: this.inputId, id: `${this.inputId}-label` }, this.label), this.description && e("span", { key: "79bf414ec75847b6782a1c340a61abec6ad7d4fa", class: "file-uploader__description", id: `${this.inputId}-description`, innerHTML: this.descriptionAllowHtml ? this.description : void 0 }, !this.descriptionAllowHtml && this.description), e("div", { key: "b22af5697557dc1151bd347526f98ce4707d6fd4", class: "file-uploader__dropzone" }, this.showDropzone ? [
      e("swirl-icon-cloud-upload", { class: "file-uploader__dropzone-icon" }),
      e("div", { class: "file-uploader__dropzone-label", id: `${this.inputId}-additional-label` }, e("span", { class: "file-uploader__dropzone-cta" }, this.ctaLabel), " ", e("span", { class: "file-uploader__drag-drop-label" }, this.dragDropLabel))
    ] : e("swirl-button", { class: "file-uploader__upload-button", disabled: this.disabled, icon: this.uploadButtonIcon, intent: "primary", label: this.uploadButtonLabel, onClick: this.onUploadButtonClick, swirlAriaDescribedby: i, variant: this.uploadButtonVariant }), e("input", { key: "00293a2a4d276afb8c3f00efeb28ebd76277b786", accept: this.accept, "aria-describedby": i, "aria-disabled": this.disabled, autoComplete: "off", class: "file-uploader__input", disabled: this.disabled, id: this.inputId, multiple: this.multiple, name: this.inputName, onChange: this.onChange, ref: (s) => this.inputEl = s, tabIndex: l, type: "file" }))));
  }
};
n.style = p();
export {
  n as swirl_file_uploader
};
