@nysds/nys-fileinput 1.12.0 → 1.13.0

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.
@@ -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);
@@ -207,7 +210,10 @@ const f = class f extends y {
207
210
  ) === this && (t.focus(), t.classList.add("active-focus")) : (t.focus(), t.classList.add("active-focus"));
208
211
  }
209
212
  }
210
- // Functions
213
+ /**
214
+ * Functions
215
+ * --------------------------------------------------------------------------
216
+ */
211
217
  // Store the files to be displayed
212
218
  async _saveSelectedFiles(e) {
213
219
  if (this._selectedFiles.some(
@@ -275,7 +281,10 @@ const f = class f extends y {
275
281
  t && (t.setAttribute("tabindex", "-1"), t.focus());
276
282
  }
277
283
  }
278
- // Event Handlers
284
+ /**
285
+ * Event Handlers
286
+ * --------------------------------------------------------------------------
287
+ */
279
288
  // Access the selected files & add new files to the internal list via the hidden <input type="file">
280
289
  _handleFileChange(e) {
281
290
  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,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;;;;;;;ACpCO,MAAMC,IAAN,MAAMA,UAAoBC,EAAW;AAAA,EAArC,cAAA;AAAA,UAAA,GAAA,SAAA,GAGuB,KAAA,WAAW,IACX,KAAA,SAId,WACc,KAAA,WAAW,GACX,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,C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B,EASiB,WAAA,SAAA;AACA5B,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAVf2B,EAUiB,WAAA,QAAA;AACgB5B,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAX/B2B,EAWiC,WAAA,UAAA;AACA5B,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAZ/B2B,EAYiC,WAAA,UAAA;AACA5B,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAb/B2B,EAaiC,WAAA,UAAA;AACA5B,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAd/B2B,EAciC,WAAA,WAAA;AAChB5B,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAff2B,EAeiB,WAAA,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 * `<nys-fileitem>` displays an individual file in a file input component.\n * It shows the file name, upload status, progress bar, and error messages.\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;\n\ninterface FileWithProgress {\n file: File;\n progress: number;\n status: \"pending\" | \"processing\" | \"done\" | \"error\";\n errorMsg?: string;\n}\n\n/**\n * `<nys-fileinput>` provides accessible file selection with optional\n * drag-and-drop support, progress tracking, validation, and form submission.\n *\n * Features:\n * - Supports single or multiple file uploads\n * - Optional drag-and-drop dropzone\n * - File type validation and upload progress\n * - Form-associated with native validation behavior\n * - Keyboard and screen reader accessible\n *\n * @slot description - Custom description content under the label\n *\n * @fires nys-change - Fired when files are added or removed\n *\n * @returns {boolean} checkValidity - Returns validity state for form validation\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 /**\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 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,MAA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A,GAff2B,EAeiB,WAAA,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;AAygBzC,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.0",
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.0",
27
+ "@nysds/nys-button": "^1.13.0",
28
+ "@nysds/nys-label": "^1.13.0",
29
+ "@nysds/nys-errormessage": "^1.13.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "lit": "^3.3.1",