@nysds/nys-fileinput 1.12.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,12 +10,12 @@ async function _(p, e) {
10
10
  return !1;
11
11
  }
12
12
  const v = ':host{--_nys-fileitem-border-radius: var(--nys-radius-md, 4px);--_nys-fileitem-padding: var(--nys-space-100, 8px) var(--nys-space-200, 16px);--_nys-fileitem-background-color: var(--nys-color-ink-reverse, #fff);--_nys-fileitem-border-color: var(--nys-color-neutral-100, #d0d0ce);--_nys-fileitem-font-family: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-fileitem-font-size: var(--nys-font-size-ui-md, 16px);--_nys-fileitem-font-weight: var(--nys-font-weight-regular, 400);--_nys-fileitem-line-height: var(--nys-font-lineheight-ui-md, 24px);--_nys-fileitem-letter-spacing: var( --nys-font-letterspacing-ui-md, .044px );--_nys-fileitem-background-color--progress: var( --nys-color-neutral-50, #ededed );--_nys-fileitem-background-color--progress--fill: var( --nys-color-info, #004dd1 )}.file-item{position:relative;border-radius:var(--_nys-fileitem-border-radius);border-width:var(--nys-border-width-sm, 1px);border-style:solid;border-color:var(--_nys-fileitem-border-color);background-color:var(--_nys-fileitem-background-color)}.file-item.error{--_nys-fileitem-border-color: var(--nys-color-danger, #b52c2c)}.file-item__main{display:flex;justify-items:center;align-items:center;gap:var(--_nys-fileinput-gap);padding:var(--_nys-fileitem-padding);height:56px;box-sizing:border-box}.file-item__info{display:flex;flex-direction:column;flex:1;min-width:0;font-family:var(--_nys-fileitem-font-family);font-size:var(--_nys-fileitem-font-size);font-style:normal;font-weight:var(--_nys-fileitem-font-weight);line-height:var(--_nys-fileitem-line-height);letter-spacing:var(--_nys-fileitem-letter-spacing)}.file-item__info-name{display:flex;max-width:100%;overflow:hidden;white-space:nowrap;align-items:center}.file-item__info-name-start{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:1;min-width:0}.file-item p{margin:0}.file-item__error{color:var(--nys-color-danger, #b52c2c);text-overflow:ellipsis;font-weight:700}progress{position:absolute;bottom:0;display:flex;width:100%;height:6px;border-radius:var(--nys-radius-round, 1776px);background:var(--_nys-fileitem-background-color--progress--fill);overflow:hidden;appearance:none}progress::-moz-progress-bar{background-color:var(--_nys-fileitem-background-color--progress)}progress::-webkit-progress-value{background-color:var(--_nys-fileitem-background-color--progress--fill)}progress::-webkit-progress-bar{background-color:var(--_nys-fileitem-background-color--progress)}.file-icon[name=progress_activity]{animation:spin 1s linear infinite}.file-icon[name=error]{color:var(--nys-color-danger, #b52c2c)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}';
13
- var b = Object.defineProperty, u = (p, e, t, i) => {
13
+ var b = Object.defineProperty, h = (p, e, t, i) => {
14
14
  for (var s = void 0, r = p.length - 1, d; r >= 0; r--)
15
15
  (d = p[r]) && (s = d(e, t, s) || s);
16
16
  return s && b(e, t, s), s;
17
17
  };
18
- const h = class h extends y {
18
+ const u = class u extends y {
19
19
  constructor() {
20
20
  super(...arguments), this.filename = "", this.status = "pending", this.progress = 0, this.errorMessage = "";
21
21
  }
@@ -88,18 +88,18 @@ const h = class h extends y {
88
88
  `;
89
89
  }
90
90
  };
91
- h.styles = g(v);
92
- let c = h;
93
- u([
91
+ u.styles = g(v);
92
+ let c = u;
93
+ h([
94
94
  n({ type: String })
95
95
  ], c.prototype, "filename");
96
- u([
96
+ h([
97
97
  n({ type: String })
98
98
  ], c.prototype, "status");
99
- u([
99
+ h([
100
100
  n({ type: Number })
101
101
  ], c.prototype, "progress");
102
- u([
102
+ h([
103
103
  n({ type: String })
104
104
  ], c.prototype, "errorMessage");
105
105
  customElements.define("nys-fileitem", c);
@@ -109,7 +109,7 @@ var $ = Object.defineProperty, l = (p, e, t, i) => {
109
109
  (d = p[r]) && (s = d(e, t, s) || s);
110
110
  return s && $(e, t, s), s;
111
111
  };
112
- let x = 0;
112
+ let F = 0;
113
113
  const f = class f extends y {
114
114
  // allows use of elementInternals' API
115
115
  constructor() {
@@ -145,7 +145,7 @@ const f = class f extends y {
145
145
  }
146
146
  // Generate a unique ID if one is not provided
147
147
  connectedCallback() {
148
- super.connectedCallback(), this.id || (this.id = `nys-fileinput-${Date.now()}-${x++}`), this.addEventListener("invalid", this._handleInvalid);
148
+ super.connectedCallback(), this.id || (this.id = `nys-fileinput-${Date.now()}-${F++}`), this.addEventListener("invalid", this._handleInvalid);
149
149
  }
150
150
  disconnectedCallback() {
151
151
  super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid);
@@ -153,7 +153,10 @@ const f = class f extends y {
153
153
  firstUpdated() {
154
154
  this._setValue();
155
155
  }
156
- // Form Integration
156
+ /**
157
+ * Form Integration
158
+ * --------------------------------------------------------------------------
159
+ */
157
160
  _setValue() {
158
161
  if (this.multiple) {
159
162
  const e = this._selectedFiles.map((t) => t.file);
@@ -197,6 +200,14 @@ const f = class f extends y {
197
200
  const e = this.shadowRoot?.querySelector("input");
198
201
  return e ? e.checkValidity() : !0;
199
202
  }
203
+ // Called automatically when the parent form is reset
204
+ formResetCallback() {
205
+ this._selectedFiles = [];
206
+ const e = this.shadowRoot?.querySelector(
207
+ ".hidden-file-input"
208
+ );
209
+ e && (e.value = ""), this._internals.setFormValue(null), this.showError = !1, this.errorMessage = "", this._internals.setValidity({}), this.requestUpdate();
210
+ }
200
211
  _handleInvalid(e) {
201
212
  e.preventDefault(), this._validate();
202
213
  const t = this._innerNysButton;
@@ -207,7 +218,10 @@ const f = class f extends y {
207
218
  ) === this && (t.focus(), t.classList.add("active-focus")) : (t.focus(), t.classList.add("active-focus"));
208
219
  }
209
220
  }
210
- // Functions
221
+ /**
222
+ * Functions
223
+ * --------------------------------------------------------------------------
224
+ */
211
225
  // Store the files to be displayed
212
226
  async _saveSelectedFiles(e) {
213
227
  if (this._selectedFiles.some(
@@ -275,7 +289,10 @@ const f = class f extends y {
275
289
  t && (t.setAttribute("tabindex", "-1"), t.focus());
276
290
  }
277
291
  }
278
- // Event Handlers
292
+ /**
293
+ * Event Handlers
294
+ * --------------------------------------------------------------------------
295
+ */
279
296
  // Access the selected files & add new files to the internal list via the hidden <input type="file">
280
297
  _handleFileChange(e) {
281
298
  const i = e.target.files;
@@ -1 +1 @@
1
- {"version":3,"file":"nys-fileinput.js","sources":["../src/validateFileHeader.ts","../src/nys-fileitem.ts","../src/nys-fileinput.ts"],"sourcesContent":["// The main function for file validation based only on extension and `accept` attribute.\nexport async function validateFileHeader(\n file: File,\n accept: string,\n): Promise<boolean> {\n // 1) If no accept attribute is defined, assume anything is allowed\n if (!accept || accept.trim() === \"\") return true;\n\n // 2) Normalize and parse the accept attribute\n const acceptItems = accept\n .toLowerCase()\n .split(\",\")\n .map((a) => a.trim());\n\n // 3) Get the file extension\n const filename = file.name.toLowerCase();\n const fileExt = filename.includes(\".\") ? filename.split(\".\").pop()! : \"\";\n\n // 4) Check if extension matches any of the accept items\n for (const acceptItem of acceptItems) {\n // Direct extension match (e.g. \".pdf\")\n if (acceptItem.startsWith(\".\") && acceptItem.slice(1) === fileExt) {\n return true;\n }\n\n // Wildcard /* (e.g. \"image/*\") -> match common prefixes\n if (\n acceptItem.endsWith(\"/*\") &&\n file.type.startsWith(acceptItem.slice(0, -1))\n ) {\n return true;\n }\n\n // Exact MIME match\n if (file.type === acceptItem) {\n return true;\n }\n }\n\n // 5) Not matched\n return false;\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-fileitem.scss?inline\";\n\nexport class NysFileItem extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: String }) filename = \"\";\n @property({ type: String }) status:\n | \"pending\"\n | \"processing\"\n | \"done\"\n | \"error\" = \"pending\";\n @property({ type: Number }) progress = 0;\n @property({ type: String }) errorMessage = \"\";\n\n private _handleRemove() {\n this.dispatchEvent(\n new CustomEvent(\"nys-fileRemove\", {\n detail: { filename: this.filename },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private splitFilename(filename: string) {\n const lastDotIndex = filename.lastIndexOf(\".\");\n const extension = lastDotIndex !== -1 ? filename.slice(lastDotIndex) : \"\"; // e.g. \".pdf\"\n const name =\n lastDotIndex !== -1 ? filename.slice(0, lastDotIndex) : filename;\n\n const startPart = name.slice(0, name.length - 3);\n const endPart = name.slice(-3);\n\n return { startPart, endPart, extension };\n }\n\n render() {\n const { startPart, endPart, extension } = this.splitFilename(this.filename);\n\n return html`\n <div\n class=\"file-item ${this.status}\"\n aria-busy=${this.status === \"processing\" ? \"true\" : \"false\"}\n aria-label=\"You have selected ${this.filename}\"\n >\n <div class=\"file-item__main\" role=\"group\">\n <nys-icon\n class=\"file-icon\"\n name=${this.status === \"processing\"\n ? \"progress_activity\"\n : this.status === \"error\"\n ? \"error\"\n : \"attach_file\"}\n size=\"2xl\"\n ></nys-icon>\n <div class=\"file-item__info\">\n <div class=\"file-item__info-name\">\n <span class=\"file-item__info-name-start\">${startPart}</span>\n <span class=\"file-item__info-name-end\"\n >${endPart}${extension}</span\n >\n </div>\n ${this.errorMessage\n ? html`<p\n class=\"file-item__error\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-invalid=\"true\"\n aria-errormessage=${this.errorMessage}\n id=\"${this.filename}-error\"\n >\n ${this.errorMessage}\n </p>`\n : null}\n </div>\n <nys-button\n circle\n icon=\"close\"\n ariaLabel=\"close button\"\n size=\"sm\"\n variant=\"ghost\"\n @nys-click=${this._handleRemove}\n ariaLabel=\"Remove file: ${this.filename}\"\n ></nys-button>\n </div>\n ${this.status === \"processing\"\n ? html`<div\n class=\"file-item__progress-container\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-valuenow=\"${this.progress}\"\n aria-label=\"Upload progress for ${this.filename}\"\n >\n <progress value=${this.progress} max=\"100\"></progress>\n </div>`\n : null}\n </div>\n `;\n }\n}\n\ncustomElements.define(\"nys-fileitem\", NysFileItem);\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { validateFileHeader } from \"./validateFileHeader\";\nimport \"./nys-fileitem\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-fileinput.scss?inline\";\n\nlet fileinputIdCounter = 0; // Counter for generating unique IDs\n\ninterface FileWithProgress {\n file: File;\n progress: number;\n status: \"pending\" | \"processing\" | \"done\" | \"error\";\n errorMsg?: string;\n}\n\nexport class NysFileinput extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: String, reflect: true }) id = \"\";\n @property({ type: String, reflect: true }) name = \"\";\n @property({ type: String }) label = \"\";\n @property({ type: String }) description = \"\";\n @property({ type: Boolean }) multiple = false;\n @property({ type: String, reflect: true }) form: string | null = null;\n @property({ type: String }) tooltip = \"\";\n @property({ type: String }) accept = \"\"; // e.g. \"image/*,.pdf\"\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: Boolean, reflect: true }) required = false;\n @property({ type: Boolean, reflect: true }) optional = false;\n @property({ type: Boolean, reflect: true }) showError = false;\n @property({ type: String }) errorMessage = \"\";\n @property({ type: Boolean }) dropzone = false;\n @property({ type: String, reflect: true }) width: \"lg\" | \"full\" = \"full\";\n @property({ type: Boolean, reflect: true }) inverted = false;\n\n private _selectedFiles: FileWithProgress[] = [];\n private _dragActive = false;\n private get _isDropDisabled(): boolean {\n return this.disabled || (!this.multiple && this._selectedFiles.length > 0);\n }\n\n private get _buttonAriaLabel(): string {\n if (this._selectedFiles.length === 0) {\n return this.multiple ? \"Choose files: \" : \"Choose file: \";\n }\n\n return this.multiple ? \"Change files: \" : \"Change file: \";\n }\n\n private get _buttonAriaDescription(): string {\n if (this._selectedFiles.length === 0)\n return `${this.label + \" \" + this.description}`;\n\n const hasInvalidFiles = this._selectedFiles.some(\n (file) => file.status === \"error\",\n );\n\n let base = \"\";\n\n if (this._selectedFiles.length === 1) {\n base = `You have selected ${this._selectedFiles[0].file.name}.`;\n } else {\n const fileNames = this._selectedFiles.map((f) => f.file.name).join(\", \");\n base = `You have selected ${this._selectedFiles.length} files: ${fileNames}`;\n }\n\n const error = hasInvalidFiles\n ? \" Error: One or more files are not valid file types.\"\n : \"\";\n\n return `${base}${error}`;\n }\n\n private get _innerNysButton(): HTMLElement | null {\n const nysButton = this.renderRoot.querySelector(\n '[name=\"file-btn\"]',\n ) as HTMLButtonElement | null;\n const innerButton = nysButton?.shadowRoot?.querySelector(\n \"button\",\n ) as HTMLElement | null;\n return innerButton;\n }\n\n private _internals: ElementInternals;\n\n // Lifecycle Updates\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-fileinput-${Date.now()}-${fileinputIdCounter++}`;\n }\n\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n }\n\n // Form Integration\n private _setValue() {\n // for multiple file uploads, we upload File object as an array\n if (this.multiple) {\n const files = this._selectedFiles.map((entry) => entry.file);\n\n if (files.length > 0) {\n const formData = new FormData();\n files.forEach((file) => {\n formData.append(this.name, file);\n });\n this._internals.setFormValue(formData);\n } else {\n this._internals.setFormValue(null);\n }\n } else {\n const singleFile = this._selectedFiles[0]?.file || null;\n this._internals.setFormValue(singleFile);\n }\n\n this._manageRequire(); // Check validation when value is set\n }\n\n // Called to internally set the initial internalElement required flag.\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n const message = this.errorMessage || \"Please upload a file.\";\n const isInvalid = this.required && this._selectedFiles.length == 0;\n\n if (isInvalid) {\n this._internals.ariaRequired = \"true\"; // Screen readers should announce error\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.ariaRequired = \"false\"; // Reset when valid\n this._internals.setValidity({}, \"\", input);\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = message === (this.errorMessage || \"Please upload a file.\");\n\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const hasErrorFiles = this._selectedFiles.some(\n (entry) => entry.status === \"error\",\n );\n const isEmpty = this.required && this._selectedFiles.length === 0;\n\n let message = \"\";\n if (isEmpty) {\n message = this.errorMessage || \"Please upload a file.\";\n } else if (hasErrorFiles) {\n message = \"One or more files are invalid.\";\n }\n\n this._setValidityMessage(message);\n }\n\n // This helper function is called to perform the element's native validation.\n checkValidity(): boolean {\n const input = this.shadowRoot?.querySelector(\"input\");\n return input ? input.checkValidity() : true;\n }\n\n private _handleInvalid(event: Event) {\n event.preventDefault();\n this._validate();\n\n const innerButton = this._innerNysButton;\n if (innerButton) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find(\n (element) =>\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity(),\n );\n if (firstInvalidElement === this) {\n innerButton.focus();\n innerButton.classList.add(\"active-focus\"); // This class styling is found within <nys-button>\n }\n } else {\n // If not part of a form, simply focus.\n innerButton.focus();\n innerButton.classList.add(\"active-focus\"); // This class styling is found within <nys-button>\n }\n }\n }\n\n // Functions\n\n // Store the files to be displayed\n private async _saveSelectedFiles(file: File) {\n const isDuplicate = this._selectedFiles.some(\n (existingFile) => existingFile.file.name == file.name,\n );\n if (isDuplicate) return;\n\n if (!this.multiple && this._selectedFiles.length >= 1) return;\n\n const entry: FileWithProgress = {\n file,\n progress: 0,\n status: \"pending\",\n };\n\n this._selectedFiles.push(entry);\n await this._processFile(entry);\n\n // Now that the file is added, update form value and validation\n this._setValue();\n this._validate();\n }\n\n // Read the contents of stored files, this will indicate loading progress of the uploaded files\n private async _processFile(entry: FileWithProgress) {\n entry.status = \"processing\";\n\n try {\n const isValid = await validateFileHeader(entry.file, this.accept);\n if (!isValid) {\n entry.status = \"error\";\n entry.errorMsg = \"File type is invalid.\";\n this.requestUpdate();\n return;\n }\n\n const reader = new FileReader();\n\n reader.onprogress = (e) => {\n if (e.lengthComputable) {\n const percentage = Math.round((e.loaded * 100) / e.total);\n entry.progress = percentage;\n this.requestUpdate();\n }\n };\n\n reader.onload = () => {\n entry.progress = 100;\n entry.status = \"done\";\n this.requestUpdate();\n };\n\n reader.onerror = () => {\n entry.status = \"error\";\n entry.errorMsg = \"Failed to load file.\";\n this.requestUpdate();\n };\n\n reader.readAsArrayBuffer(entry.file);\n } catch {\n entry.status = \"error\";\n entry.errorMsg = \"Error validating file.\";\n this.requestUpdate();\n }\n }\n\n private _dispatchChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: { id: this.id, files: this._selectedFiles },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _openFileDialog() {\n const input = this.renderRoot.querySelector(\n \".hidden-file-input\",\n ) as HTMLInputElement;\n\n input?.click();\n }\n\n private _handlePostFileSelectionFocus() {\n if (this.multiple) {\n const innerButton = this._innerNysButton;\n\n if (innerButton) {\n innerButton.focus();\n }\n } else {\n this._focusFirstFileItemIfSingleMode();\n }\n }\n\n private async _focusFirstFileItemIfSingleMode() {\n if (!this.multiple) {\n await this.updateComplete;\n const fileItem = this.renderRoot.querySelector(\n \"nys-fileitem\",\n ) as HTMLElement;\n\n const innerFileItemMainContainer = fileItem?.shadowRoot?.querySelector(\n \".file-item\",\n ) as HTMLElement | null;\n\n if (innerFileItemMainContainer) {\n innerFileItemMainContainer.setAttribute(\"tabindex\", \"-1\");\n innerFileItemMainContainer.focus();\n }\n }\n }\n\n // Event Handlers\n // Access the selected files & add new files to the internal list via the hidden <input type=\"file\">\n private _handleFileChange(e: Event) {\n const input = e.target as HTMLInputElement;\n const files = input.files;\n const newFiles = files ? Array.from(files) : []; // changes FileList to array\n\n // Store the uploaded files\n newFiles.map((file) => {\n this._saveSelectedFiles(file);\n });\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n this._handlePostFileSelectionFocus();\n }\n\n private _handleFileRemove(e: CustomEvent) {\n const filenameToRemove = e.detail.filename;\n\n // Remove selected files\n this._selectedFiles = this._selectedFiles.filter(\n (existingFile) => existingFile.file.name !== filenameToRemove,\n );\n\n if (this._selectedFiles.length === 0) {\n const input = this.shadowRoot?.querySelector(\n \"input\",\n ) as HTMLInputElement | null;\n if (input) input.value = \"\";\n }\n\n this._setValue();\n this._validate();\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n }\n\n private _onDragOver(e: DragEvent) {\n if (this.disabled) return;\n\n e.stopPropagation();\n e.preventDefault();\n if (!this._dragActive) {\n this._dragActive = true; // For styling purpose\n this.requestUpdate();\n }\n }\n\n // Mostly used for styling purpose\n private _onDragLeave(e: DragEvent) {\n if (this.disabled) return;\n\n e.stopPropagation();\n e.preventDefault();\n // Only reset if leaving the dropzone itself (not children)\n if (e.currentTarget === e.target) {\n this._dragActive = false; // For styling purpose\n this.requestUpdate();\n }\n }\n\n private _onDrop(e: DragEvent) {\n if (this.disabled) return;\n\n e.preventDefault();\n this._dragActive = false; // For styling purpose\n this.requestUpdate();\n\n const files = e.dataTransfer?.files;\n if (!files) return;\n\n const newFiles = Array.from(files);\n\n if (this.multiple) {\n newFiles.forEach((file) => {\n this._saveSelectedFiles(file);\n });\n } else {\n this._saveSelectedFiles(newFiles[0]);\n }\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n }\n\n render() {\n return html`<div\n class=\"nys-fileinput\"\n @nys-fileRemove=${this._handleFileRemove}\n >\n <nys-label\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n\n <input\n class=\"hidden-file-input\"\n tabindex=\"-1\"\n type=\"file\"\n name=${this.name}\n accept=${this.accept}\n form=${ifDefined(this.form || undefined)}\n ?multiple=${this.multiple}\n ?required=${this.required}\n ?disabled=${this.disabled ||\n (!this.multiple && this._selectedFiles.length > 0)}\n aria-disabled=\"${this.disabled}\"\n aria-hidden=\"true\"\n @change=${this._handleFileChange}\n hidden\n />\n\n ${!this.dropzone\n ? html`<nys-button\n id=\"choose-files-btn\"\n name=\"file-btn\"\n label=${this.multiple ? \"Choose files\" : \"Choose file\"}\n variant=\"outline\"\n ariaLabel=${this._buttonAriaLabel}\n ariaDescription=${this._buttonAriaDescription}\n ?disabled=${this.disabled ||\n (!this.multiple && this._selectedFiles.length > 0)}\n @nys-click=${this._openFileDialog}\n ></nys-button>`\n : html`<div\n class=\"nys-fileinput__dropzone\n ${this._dragActive ? \"drag-active\" : \"\"}\n ${this._isDropDisabled ? \"disabled\" : \"\"}\n ${this.showError && !this._isDropDisabled ? \"error\" : \"\"}\"\n @click=${this._isDropDisabled\n ? null\n : (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n\n // Ignore clicks that originated within a nys-button\n if (target.closest(\"nys-button\")) return;\n\n // Only handle direct wrapper clicks (outside of buttons)\n this._openFileDialog();\n }}\n @dragover=${this._isDropDisabled ? null : this._onDragOver}\n @dragleave=${this._isDropDisabled ? null : this._onDragLeave}\n @drop=${this._isDropDisabled ? null : this._onDrop}\n aria-label=\"Drag files here or choose from folder\"\n >\n ${this._dragActive\n ? html`<p>Drop file to upload</p>`\n : html` <nys-button\n id=\"choose-files-btn-drag\"\n name=\"file-btn\"\n label=${this.multiple ? \"Choose files\" : \"Choose file\"}\n variant=\"outline\"\n ariaLabel=${this._buttonAriaLabel}\n ariaDescription=${this._buttonAriaDescription}\n ?disabled=${this._isDropDisabled}\n @nys-click=\"${(e: CustomEvent) => {\n e.preventDefault();\n e.stopPropagation();\n this._openFileDialog();\n }}\"\n ></nys-button>\n <p>or drag here</p>`}\n </div>`}\n ${this.showError\n ? html`\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n ></nys-errormessage>\n `\n : null}\n ${this._selectedFiles.length > 0\n ? html`\n <ul>\n ${this._selectedFiles.map(\n (entry) =>\n html`<li>\n <nys-fileitem\n filename=${entry.file.name}\n status=${entry.status}\n progress=${entry.progress}\n errorMessage=${entry.errorMsg || \"\"}\n ></nys-fileitem>\n </li>`,\n )}\n </ul>\n `\n : null}\n </div>`;\n }\n}\n\nif (!customElements.get(\"nys-fileinput\")) {\n customElements.define(\"nys-fileinput\", NysFileinput);\n}\n"],"names":["validateFileHeader","file","accept","acceptItems","a","filename","fileExt","acceptItem","_NysFileItem","LitElement","lastDotIndex","extension","name","startPart","endPart","html","unsafeCSS","styles","NysFileItem","__decorateClass","property","fileinputIdCounter","_NysFileinput","hasInvalidFiles","base","fileNames","f","files","entry","formData","singleFile","input","message","hasErrorFiles","isEmpty","event","innerButton","form","element","existingFile","reader","e","percentage","innerFileItemMainContainer","filenameToRemove","newFiles","ifDefined","NysFileinput"],"mappings":";;;AACA,eAAsBA,EACpBC,GACAC,GACkB;AAElB,MAAI,CAACA,KAAUA,EAAO,KAAA,MAAW,GAAI,QAAO;AAG5C,QAAMC,IAAcD,EACjB,YAAA,EACA,MAAM,GAAG,EACT,IAAI,CAACE,MAAMA,EAAE,KAAA,CAAM,GAGhBC,IAAWJ,EAAK,KAAK,YAAA,GACrBK,IAAUD,EAAS,SAAS,GAAG,IAAIA,EAAS,MAAM,GAAG,EAAE,IAAA,IAAS;AAGtE,aAAWE,KAAcJ;AAevB,QAbII,EAAW,WAAW,G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cAAA;AACC5B,EAAA;AAAA,EAA5BC,EAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAhBhB2B,EAgBkB,WAAA,UAAA;AACc5B,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAjB9B2B,EAiBgC,WAAA,OAAA;AACC5B,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAlB/B2B,EAkBiC,WAAA,UAAA;AA2fzC,eAAe,IAAI,eAAe,KACrC,eAAe,OAAO,iBAAiBA,CAAY;"}
1
+ {"version":3,"file":"nys-fileinput.js","sources":["../src/validateFileHeader.ts","../src/nys-fileitem.ts","../src/nys-fileinput.ts"],"sourcesContent":["// The main function for file validation based only on extension and `accept` attribute.\nexport async function validateFileHeader(\n file: File,\n accept: string,\n): Promise<boolean> {\n // 1) If no accept attribute is defined, assume anything is allowed\n if (!accept || accept.trim() === \"\") return true;\n\n // 2) Normalize and parse the accept attribute\n const acceptItems = accept\n .toLowerCase()\n .split(\",\")\n .map((a) => a.trim());\n\n // 3) Get the file extension\n const filename = file.name.toLowerCase();\n const fileExt = filename.includes(\".\") ? filename.split(\".\").pop()! : \"\";\n\n // 4) Check if extension matches any of the accept items\n for (const acceptItem of acceptItems) {\n // Direct extension match (e.g. \".pdf\")\n if (acceptItem.startsWith(\".\") && acceptItem.slice(1) === fileExt) {\n return true;\n }\n\n // Wildcard /* (e.g. \"image/*\") -> match common prefixes\n if (\n acceptItem.endsWith(\"/*\") &&\n file.type.startsWith(acceptItem.slice(0, -1))\n ) {\n return true;\n }\n\n // Exact MIME match\n if (file.type === acceptItem) {\n return true;\n }\n }\n\n // 5) Not matched\n return false;\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-fileitem.scss?inline\";\n\n/**\n * **Internal component.** Displays an individual file within `nys-fileinput` with status and progress.\n *\n * Rendered automatically by `nys-fileinput` for each selected file. Shows filename, upload status\n * (pending/processing/done/error), progress bar during upload, and error messages. Remove button emits event.\n *\n * @summary Internal file item display with status, progress bar, and remove action.\n * @element nys-fileitem\n *\n * @fires nys-fileRemove - Fired when remove button is clicked. Detail: `{filename}`.\n */\nexport class NysFileItem extends LitElement {\n static styles = unsafeCSS(styles);\n\n /** Name of the file being displayed. */\n @property({ type: String }) filename = \"\";\n\n /**\n * Upload status: `pending` (queued), `processing` (uploading), `done` (complete), `error` (failed).\n * @default \"pending\"\n */\n @property({ type: String }) status:\n | \"pending\"\n | \"processing\"\n | \"done\"\n | \"error\" = \"pending\";\n\n /** Upload progress percentage (0-100). Only shown when status is `processing`. */\n @property({ type: Number }) progress = 0;\n\n /** Error message displayed when status is `error`. */\n @property({ type: String }) errorMessage = \"\";\n\n private _handleRemove() {\n this.dispatchEvent(\n new CustomEvent(\"nys-fileRemove\", {\n detail: { filename: this.filename },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private splitFilename(filename: string) {\n const lastDotIndex = filename.lastIndexOf(\".\");\n const extension = lastDotIndex !== -1 ? filename.slice(lastDotIndex) : \"\"; // e.g. \".pdf\"\n const name =\n lastDotIndex !== -1 ? filename.slice(0, lastDotIndex) : filename;\n\n const startPart = name.slice(0, name.length - 3);\n const endPart = name.slice(-3);\n\n return { startPart, endPart, extension };\n }\n\n render() {\n const { startPart, endPart, extension } = this.splitFilename(this.filename);\n\n return html`\n <div\n class=\"file-item ${this.status}\"\n aria-busy=${this.status === \"processing\" ? \"true\" : \"false\"}\n aria-label=\"You have selected ${this.filename}\"\n >\n <div class=\"file-item__main\" role=\"group\">\n <nys-icon\n class=\"file-icon\"\n name=${this.status === \"processing\"\n ? \"progress_activity\"\n : this.status === \"error\"\n ? \"error\"\n : \"attach_file\"}\n size=\"2xl\"\n ></nys-icon>\n <div class=\"file-item__info\">\n <div class=\"file-item__info-name\">\n <span class=\"file-item__info-name-start\">${startPart}</span>\n <span class=\"file-item__info-name-end\"\n >${endPart}${extension}</span\n >\n </div>\n ${this.errorMessage\n ? html`<p\n class=\"file-item__error\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-invalid=\"true\"\n aria-errormessage=${this.errorMessage}\n id=\"${this.filename}-error\"\n >\n ${this.errorMessage}\n </p>`\n : null}\n </div>\n <nys-button\n circle\n icon=\"close\"\n ariaLabel=\"close button\"\n size=\"sm\"\n variant=\"ghost\"\n @nys-click=${this._handleRemove}\n ariaLabel=\"Remove file: ${this.filename}\"\n ></nys-button>\n </div>\n ${this.status === \"processing\"\n ? html`<div\n class=\"file-item__progress-container\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-valuenow=\"${this.progress}\"\n aria-label=\"Upload progress for ${this.filename}\"\n >\n <progress value=${this.progress} max=\"100\"></progress>\n </div>`\n : null}\n </div>\n `;\n }\n}\n\ncustomElements.define(\"nys-fileitem\", NysFileItem);\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { validateFileHeader } from \"./validateFileHeader\";\nimport \"./nys-fileitem\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-fileinput.scss?inline\";\n\nlet fileinputIdCounter = 0;\n\ninterface FileWithProgress {\n file: File;\n progress: number;\n status: \"pending\" | \"processing\" | \"done\" | \"error\";\n errorMsg?: string;\n}\n\n/**\n * A file input for uploading files with support for multiple files, drag-and-drop, and progress tracking.\n * Validates file types via magic bytes (not just extension). Form-associated via ElementInternals.\n *\n * Use for document uploads, image uploads, or any file submission. Enable `dropzone` for drag-and-drop UI.\n *\n * @summary File input with drag-and-drop, validation, and progress tracking.\n * @element nys-fileinput\n *\n * @slot description - Custom HTML description content.\n *\n * @fires nys-change - Fired when files are added or removed. Detail: `{id, files}`.\n *\n * @example Single file upload\n * ```html\n * <nys-fileinput label=\"Upload document\" accept=\".pdf,.doc\" required></nys-fileinput>\n * ```\n *\n * @example Multiple files with dropzone\n * ```html\n * <nys-fileinput label=\"Upload images\" accept=\"image/*\" multiple dropzone></nys-fileinput>\n * ```\n */\n\nexport class NysFileinput extends LitElement {\n static styles = unsafeCSS(styles);\n\n /** Unique identifier. Auto-generated if not provided. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Name for form submission. */\n @property({ type: String, reflect: true }) name = \"\";\n\n /** Visible label text. */\n @property({ type: String }) label = \"\";\n\n /** Helper text below label. Use slot for custom HTML. */\n @property({ type: String }) description = \"\";\n\n /** Allows selecting multiple files. */\n @property({ type: Boolean }) multiple = false;\n\n /** Form `id` to associate with. */\n @property({ type: String, reflect: true }) form: string | null = null;\n\n /** Tooltip text shown on hover/focus of info icon. */\n @property({ type: String }) tooltip = \"\";\n\n /** Accepted file types. Use MIME types (`image/*`) or extensions (`.pdf`). Validated via magic bytes. */\n @property({ type: String }) accept = \"\";\n\n /** Prevents interaction. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Requires at least one file to be uploaded. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Shows \"Optional\" flag. */\n @property({ type: Boolean, reflect: true }) optional = false;\n\n /** Shows error message when true. */\n @property({ type: Boolean, reflect: true }) showError = false;\n\n /** Error message text. Shown only when `showError` is true. */\n @property({ type: String }) errorMessage = \"\";\n\n /** Enables drag-and-drop zone UI. */\n @property({ type: Boolean }) dropzone = false;\n\n /**\n * Component width: `lg` (384px) or `full` (100%, default).\n * @default \"full\"\n */\n @property({ type: String, reflect: true }) width: \"lg\" | \"full\" = \"full\";\n\n /** Adjusts colors for dark backgrounds. */\n @property({ type: Boolean, reflect: true }) inverted = false;\n\n private _selectedFiles: FileWithProgress[] = [];\n private _dragActive = false;\n private get _isDropDisabled(): boolean {\n return this.disabled || (!this.multiple && this._selectedFiles.length > 0);\n }\n\n private get _buttonAriaLabel(): string {\n if (this._selectedFiles.length === 0) {\n return this.multiple ? \"Choose files: \" : \"Choose file: \";\n }\n\n return this.multiple ? \"Change files: \" : \"Change file: \";\n }\n\n private get _buttonAriaDescription(): string {\n if (this._selectedFiles.length === 0)\n return `${this.label + \" \" + this.description}`;\n\n const hasInvalidFiles = this._selectedFiles.some(\n (file) => file.status === \"error\",\n );\n\n let base = \"\";\n\n if (this._selectedFiles.length === 1) {\n base = `You have selected ${this._selectedFiles[0].file.name}.`;\n } else {\n const fileNames = this._selectedFiles.map((f) => f.file.name).join(\", \");\n base = `You have selected ${this._selectedFiles.length} files: ${fileNames}`;\n }\n\n const error = hasInvalidFiles\n ? \" Error: One or more files are not valid file types.\"\n : \"\";\n\n return `${base}${error}`;\n }\n\n private get _innerNysButton(): HTMLElement | null {\n const nysButton = this.renderRoot.querySelector(\n '[name=\"file-btn\"]',\n ) as HTMLButtonElement | null;\n const innerButton = nysButton?.shadowRoot?.querySelector(\n \"button\",\n ) as HTMLElement | null;\n return innerButton;\n }\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-fileinput-${Date.now()}-${fileinputIdCounter++}`;\n }\n\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n private _setValue() {\n // for multiple file uploads, we upload File object as an array\n if (this.multiple) {\n const files = this._selectedFiles.map((entry) => entry.file);\n\n if (files.length > 0) {\n const formData = new FormData();\n files.forEach((file) => {\n formData.append(this.name, file);\n });\n this._internals.setFormValue(formData);\n } else {\n this._internals.setFormValue(null);\n }\n } else {\n const singleFile = this._selectedFiles[0]?.file || null;\n this._internals.setFormValue(singleFile);\n }\n\n this._manageRequire(); // Check validation when value is set\n }\n\n // Called to internally set the initial internalElement required flag.\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n const message = this.errorMessage || \"Please upload a file.\";\n const isInvalid = this.required && this._selectedFiles.length == 0;\n\n if (isInvalid) {\n this._internals.ariaRequired = \"true\"; // Screen readers should announce error\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.ariaRequired = \"false\"; // Reset when valid\n this._internals.setValidity({}, \"\", input);\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = message === (this.errorMessage || \"Please upload a file.\");\n\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const hasErrorFiles = this._selectedFiles.some(\n (entry) => entry.status === \"error\",\n );\n const isEmpty = this.required && this._selectedFiles.length === 0;\n\n let message = \"\";\n if (isEmpty) {\n message = this.errorMessage || \"Please upload a file.\";\n } else if (hasErrorFiles) {\n message = \"One or more files are invalid.\";\n }\n\n this._setValidityMessage(message);\n }\n\n // This helper function is called to perform the element's native validation.\n checkValidity(): boolean {\n const input = this.shadowRoot?.querySelector(\"input\");\n return input ? input.checkValidity() : true;\n }\n\n // Called automatically when the parent form is reset\n public formResetCallback() {\n this._selectedFiles = [];\n const input = this.shadowRoot?.querySelector(\n \".hidden-file-input\",\n ) as HTMLInputElement | null;\n\n if (input) {\n input.value = \"\";\n }\n\n this._internals.setFormValue(null);\n\n // Reset validation UI\n this.showError = false;\n this.errorMessage = \"\";\n this._internals.setValidity({});\n\n // Re-render UI\n this.requestUpdate();\n }\n\n private _handleInvalid(event: Event) {\n event.preventDefault();\n this._validate();\n\n const innerButton = this._innerNysButton;\n if (innerButton) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find(\n (element) =>\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity(),\n );\n if (firstInvalidElement === this) {\n innerButton.focus();\n innerButton.classList.add(\"active-focus\"); // This class styling is found within <nys-button>\n }\n } else {\n // If not part of a form, simply focus.\n innerButton.focus();\n innerButton.classList.add(\"active-focus\"); // This class styling is found within <nys-button>\n }\n }\n }\n\n /**\n * Functions\n * --------------------------------------------------------------------------\n */\n\n // Store the files to be displayed\n private async _saveSelectedFiles(file: File) {\n const isDuplicate = this._selectedFiles.some(\n (existingFile) => existingFile.file.name == file.name,\n );\n if (isDuplicate) return;\n\n if (!this.multiple && this._selectedFiles.length >= 1) return;\n\n const entry: FileWithProgress = {\n file,\n progress: 0,\n status: \"pending\",\n };\n\n this._selectedFiles.push(entry);\n await this._processFile(entry);\n\n // Now that the file is added, update form value and validation\n this._setValue();\n this._validate();\n }\n\n // Read the contents of stored files, this will indicate loading progress of the uploaded files\n private async _processFile(entry: FileWithProgress) {\n entry.status = \"processing\";\n\n try {\n const isValid = await validateFileHeader(entry.file, this.accept);\n if (!isValid) {\n entry.status = \"error\";\n entry.errorMsg = \"File type is invalid.\";\n this.requestUpdate();\n return;\n }\n\n const reader = new FileReader();\n\n reader.onprogress = (e) => {\n if (e.lengthComputable) {\n const percentage = Math.round((e.loaded * 100) / e.total);\n entry.progress = percentage;\n this.requestUpdate();\n }\n };\n\n reader.onload = () => {\n entry.progress = 100;\n entry.status = \"done\";\n this.requestUpdate();\n };\n\n reader.onerror = () => {\n entry.status = \"error\";\n entry.errorMsg = \"Failed to load file.\";\n this.requestUpdate();\n };\n\n reader.readAsArrayBuffer(entry.file);\n } catch {\n entry.status = \"error\";\n entry.errorMsg = \"Error validating file.\";\n this.requestUpdate();\n }\n }\n\n private _dispatchChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: { id: this.id, files: this._selectedFiles },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _openFileDialog() {\n const input = this.renderRoot.querySelector(\n \".hidden-file-input\",\n ) as HTMLInputElement;\n\n input?.click();\n }\n\n private _handlePostFileSelectionFocus() {\n if (this.multiple) {\n const innerButton = this._innerNysButton;\n\n if (innerButton) {\n innerButton.focus();\n }\n } else {\n this._focusFirstFileItemIfSingleMode();\n }\n }\n\n private async _focusFirstFileItemIfSingleMode() {\n if (!this.multiple) {\n await this.updateComplete;\n const fileItem = this.renderRoot.querySelector(\n \"nys-fileitem\",\n ) as HTMLElement;\n\n const innerFileItemMainContainer = fileItem?.shadowRoot?.querySelector(\n \".file-item\",\n ) as HTMLElement | null;\n\n if (innerFileItemMainContainer) {\n innerFileItemMainContainer.setAttribute(\"tabindex\", \"-1\");\n innerFileItemMainContainer.focus();\n }\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n // Access the selected files & add new files to the internal list via the hidden <input type=\"file\">\n private _handleFileChange(e: Event) {\n const input = e.target as HTMLInputElement;\n const files = input.files;\n const newFiles = files ? Array.from(files) : []; // changes FileList to array\n\n // Store the uploaded files\n newFiles.map((file) => {\n this._saveSelectedFiles(file);\n });\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n this._handlePostFileSelectionFocus();\n }\n\n private _handleFileRemove(e: CustomEvent) {\n const filenameToRemove = e.detail.filename;\n\n // Remove selected files\n this._selectedFiles = this._selectedFiles.filter(\n (existingFile) => existingFile.file.name !== filenameToRemove,\n );\n\n if (this._selectedFiles.length === 0) {\n const input = this.shadowRoot?.querySelector(\n \"input\",\n ) as HTMLInputElement | null;\n if (input) input.value = \"\";\n }\n\n this._setValue();\n this._validate();\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n }\n\n private _onDragOver(e: DragEvent) {\n if (this.disabled) return;\n\n e.stopPropagation();\n e.preventDefault();\n if (!this._dragActive) {\n this._dragActive = true; // For styling purpose\n this.requestUpdate();\n }\n }\n\n // Mostly used for styling purpose\n private _onDragLeave(e: DragEvent) {\n if (this.disabled) return;\n\n e.stopPropagation();\n e.preventDefault();\n // Only reset if leaving the dropzone itself (not children)\n if (e.currentTarget === e.target) {\n this._dragActive = false; // For styling purpose\n this.requestUpdate();\n }\n }\n\n private _onDrop(e: DragEvent) {\n if (this.disabled) return;\n\n e.preventDefault();\n this._dragActive = false; // For styling purpose\n this.requestUpdate();\n\n const files = e.dataTransfer?.files;\n if (!files) return;\n\n const newFiles = Array.from(files);\n\n if (this.multiple) {\n newFiles.forEach((file) => {\n this._saveSelectedFiles(file);\n });\n } else {\n this._saveSelectedFiles(newFiles[0]);\n }\n\n this.requestUpdate();\n this._dispatchChangeEvent();\n }\n\n render() {\n return html`<div\n class=\"nys-fileinput\"\n @nys-fileRemove=${this._handleFileRemove}\n >\n <nys-label\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n\n <input\n class=\"hidden-file-input\"\n tabindex=\"-1\"\n type=\"file\"\n name=${this.name}\n accept=${this.accept}\n form=${ifDefined(this.form || undefined)}\n ?multiple=${this.multiple}\n ?required=${this.required}\n ?disabled=${this.disabled ||\n (!this.multiple && this._selectedFiles.length > 0)}\n aria-disabled=\"${this.disabled}\"\n aria-hidden=\"true\"\n @change=${this._handleFileChange}\n hidden\n />\n\n ${!this.dropzone\n ? html`<nys-button\n id=\"choose-files-btn\"\n name=\"file-btn\"\n label=${this.multiple ? \"Choose files\" : \"Choose file\"}\n variant=\"outline\"\n ariaLabel=${this._buttonAriaLabel}\n ariaDescription=${this._buttonAriaDescription}\n ?disabled=${this.disabled ||\n (!this.multiple && this._selectedFiles.length > 0)}\n @nys-click=${this._openFileDialog}\n ></nys-button>`\n : html`<div\n class=\"nys-fileinput__dropzone\n ${this._dragActive ? \"drag-active\" : \"\"}\n ${this._isDropDisabled ? \"disabled\" : \"\"}\n ${this.showError && !this._isDropDisabled ? \"error\" : \"\"}\"\n @click=${this._isDropDisabled\n ? null\n : (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n\n // Ignore clicks that originated within a nys-button\n if (target.closest(\"nys-button\")) return;\n\n // Only handle direct wrapper clicks (outside of buttons)\n this._openFileDialog();\n }}\n @dragover=${this._isDropDisabled ? null : this._onDragOver}\n @dragleave=${this._isDropDisabled ? null : this._onDragLeave}\n @drop=${this._isDropDisabled ? null : this._onDrop}\n aria-label=\"Drag files here or choose from folder\"\n >\n ${this._dragActive\n ? html`<p>Drop file to upload</p>`\n : html` <nys-button\n id=\"choose-files-btn-drag\"\n name=\"file-btn\"\n label=${this.multiple ? \"Choose files\" : \"Choose file\"}\n variant=\"outline\"\n ariaLabel=${this._buttonAriaLabel}\n ariaDescription=${this._buttonAriaDescription}\n ?disabled=${this._isDropDisabled}\n @nys-click=\"${(e: CustomEvent) => {\n e.preventDefault();\n e.stopPropagation();\n this._openFileDialog();\n }}\"\n ></nys-button>\n <p>or drag here</p>`}\n </div>`}\n ${this.showError\n ? html`\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n ></nys-errormessage>\n `\n : null}\n ${this._selectedFiles.length > 0\n ? html`\n <ul>\n ${this._selectedFiles.map(\n (entry) =>\n html`<li>\n <nys-fileitem\n filename=${entry.file.name}\n status=${entry.status}\n progress=${entry.progress}\n errorMessage=${entry.errorMsg || \"\"}\n ></nys-fileitem>\n </li>`,\n )}\n </ul>\n `\n : null}\n </div>`;\n }\n}\n\nif (!customElements.get(\"nys-fileinput\")) {\n customElements.define(\"nys-fileinput\", NysFileinput);\n}\n"],"names":["validateFileHeader","file","accept","acceptItems","a","filename","fileExt","acceptItem","_NysFileItem","LitElement","lastDotIndex","extension","name","startPart","endPart","html","unsafeCSS","styles","NysFileItem","__decorateClass","property","fileinputIdCounter","_NysFileinput","hasInvalidFiles","base","fileNames","f","files","entry","formData","singleFile","input","message","hasErrorFiles","isEmpty","event","innerButton","form","element","existingFile","reader","e","percentage","innerFileItemMainContainer","filenameToRemove","newFiles","ifDefined","NysFileinput"],"mappings":";;;AACA,eAAsBA,EACpBC,GACAC,GACkB;AAElB,MAAI,CAACA,KAAUA,EAAO,KAAA,MAAW,GAAI,QAAO;AAG5C,QAAMC,IAAcD,EACjB,YAAA,EACA,MAAM,GAAG,EACT,IAAI,CAACE,MAAMA,EAAE,KAAA,CAAM,GAGhBC,IAAWJ,EAAK,KAAK,YAAA,GACrBK,IAAUD,EAAS,SAAS,GAAG,IAAIA,EAAS,MAAM,GAAG,EAAE,IAAA,IAAS;AAGtE,aAAWE,KAAcJ;AAevB,QAbII,EAAW,WAAW,GAAG,KAAKA,EAAW,MAAM,CAAC,MAAMD,KAMxDC,EAAW,SAAS,IAAI,KACxBN,EAAK,KAAK,WAAWM,EAAW,MAAM,GAAG,EAAE,CAAC,KAM1CN,EAAK,SAASM;AAChB,aAAO;AAKX,SAAO;AACT;;;;;;;ACzBO,MAAMC,IAAN,MAAMA,UAAoBC,EAAW;AAAA,EAArC,cAAA;AAAA,UAAA,GAAA,SAAA,GAIuB,KAAA,WAAW,IAMX,KAAA,SAId,WAGc,KAAA,WAAW,GAGX,KAAA,eAAe;AAAA,EAAA;AAAA,EAEnC,gBAAgB;AACtB,SAAK;AAAA,MACH,IAAI,YAAY,kBAAkB;AAAA,QAChC,QAAQ,EAAE,UAAU,KAAK,SAAA;AAAA,QACzB,SAAS;AAAA,QACT,UAAU;AAAA,MAAA,CACX;AAAA,IAAA;AAAA,EAEL;AAAA,EAEQ,cAAcJ,GAAkB;AACtC,UAAMK,IAAeL,EAAS,YAAY,GAAG,GACvCM,IAAYD,MAAiB,KAAKL,EAAS,MAAMK,CAAY,IAAI,IACjEE,IACJF,MAAiB,KAAKL,EAAS,MAAM,GAAGK,CAAY,IA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A+hBzC,eAAe,IAAI,eAAe,KACrC,eAAe,OAAO,iBAAiBA,CAAY;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/nys-fileinput",
3
- "version": "1.12.0",
3
+ "version": "1.13.1",
4
4
  "description": "The Fileinput component from the NYS Design System.",
5
5
  "module": "dist/nys-fileinput.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,10 +23,10 @@
23
23
  "lit-analyze": "lit-analyzer '**/*.ts'"
24
24
  },
25
25
  "dependencies": {
26
- "@nysds/nys-icon": "^1.12.0",
27
- "@nysds/nys-button": "^1.12.0",
28
- "@nysds/nys-label": "^1.12.0",
29
- "@nysds/nys-errormessage": "^1.12.0"
26
+ "@nysds/nys-icon": "^1.13.1",
27
+ "@nysds/nys-button": "^1.13.1",
28
+ "@nysds/nys-label": "^1.13.1",
29
+ "@nysds/nys-errormessage": "^1.13.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "lit": "^3.3.1",