@designsystem-se/af 38.0.1-beta.2 → 38.1.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.
- package/components/digi-form-file-upload.js +23 -9
- package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
- package/dist/cjs/digi-form-file-upload.cjs.entry.js +21 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/_form/form-file-upload/form-file-upload.js +41 -8
- package/dist/collection/design-tokens/components/_logo.variables.scss +15 -17
- package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/p-2788683e.entry.js +1 -0
- package/dist/esm/digi-arbetsformedlingen.js +1 -1
- package/dist/esm/digi-form-file-upload.entry.js +21 -8
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/_form/form-file-upload/form-file-upload.d.ts +5 -0
- package/dist/types/components.d.ts +5 -0
- package/hydrate/index.js +23 -9
- package/hydrate/index.mjs +23 -9
- package/package.json +1 -1
- package/dist/digi-arbetsformedlingen/p-ba3c4861.entry.js +0 -1
|
@@ -117,6 +117,7 @@ const FormFileUpload = class {
|
|
|
117
117
|
* @en Import array with files without triggering upload event. A file object needs to contain an id, status and the file itself.
|
|
118
118
|
*/
|
|
119
119
|
async afMImportFiles(files) {
|
|
120
|
+
this.resetErrors();
|
|
120
121
|
if (files && files.length > 0) {
|
|
121
122
|
for (const importedFile of files) {
|
|
122
123
|
this.validateFile(importedFile);
|
|
@@ -131,6 +132,14 @@ const FormFileUpload = class {
|
|
|
131
132
|
async afMGetFormControlElement() {
|
|
132
133
|
return this._input;
|
|
133
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Rensar komponentens fillista och eventuella felmeddelanden.
|
|
137
|
+
* @en Clears the component's file list and any error messages.
|
|
138
|
+
*/
|
|
139
|
+
async afMClearFiles() {
|
|
140
|
+
this.files = [];
|
|
141
|
+
this.resetErrors();
|
|
142
|
+
}
|
|
134
143
|
/**
|
|
135
144
|
* Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
|
|
136
145
|
* @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
|
|
@@ -178,7 +187,11 @@ const FormFileUpload = class {
|
|
|
178
187
|
let exist = false;
|
|
179
188
|
if (this.files.length > 0) {
|
|
180
189
|
this.files.forEach((file) => {
|
|
181
|
-
if (file
|
|
190
|
+
if (file['id'] === fileToCheck['id']) {
|
|
191
|
+
exist = true;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
else if (file.name === fileToCheck.name) {
|
|
182
195
|
exist = true;
|
|
183
196
|
}
|
|
184
197
|
});
|
|
@@ -562,22 +575,22 @@ const FormFileUpload = class {
|
|
|
562
575
|
} }, this.renderFiles())));
|
|
563
576
|
}
|
|
564
577
|
render() {
|
|
565
|
-
return (index.h(index.Fragment, { key: '
|
|
578
|
+
return (index.h(index.Fragment, { key: 'bec280d44d534a720927ab737b34335600c3fe80' }, index.h("digi-util-breakpoint-observer", { key: '93983b718eda1869ff95f7a0abe8c6704395a1e0', onAfOnChange: (e) => this.breakpointHandler(e) }), index.h("div", { key: '23f30473aa0dd681c6c4ea20138d3f13391bb070', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, index.h("digi-form-label", { key: 'c42a873187b3bf30ddfdb71561d6902a8b2f98fe', afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), index.h("div", { key: 'db1082e11bafb320c13a790d639d37ca821617ac', class: {
|
|
566
579
|
'digi-form-file-upload__upload-area': true,
|
|
567
580
|
'digi-form-file-upload__upload-area--hover': this.fileHover
|
|
568
581
|
}, onDrop: (e) => this.handleDrop(e), onDragOver: (e) => this.handleAllowDrop(e), onDragEnter: (e) => this.handleOnDragEnterLeave(e), onDragLeave: (e) => this.handleOnDragEnterLeave(e), onClick: (e) => this.handleInputClick(e) }, this.fileHover &&
|
|
569
|
-
this.afVariation != formFileUploadVariation_enum.FormFileUploadVariation.SMALL && (index.h("div", { key: '
|
|
582
|
+
this.afVariation != formFileUploadVariation_enum.FormFileUploadVariation.SMALL && (index.h("div", { key: 'f58d5f61b5568263e9b60b255f47e6ef418c78e5', class: "digi-form-file-upload__upload-area-overlay" })), index.h("div", { key: 'c58c52f7e2c8aa8d17fe510ef90435d488844237', class: "digi-form-file-upload__text-area" }, index.h("button", { key: '1bb7fa84e0778702d0e77008f7d468d560ac8e17', type: "button", id: this.afId + '-button', ref: (el) => {
|
|
570
583
|
this._uploadButton = el;
|
|
571
584
|
}, onClick: (e) => this.handleInputClick(e), class: "digi-form-file-upload__button hidden_mobile", style: {
|
|
572
585
|
margin: '0'
|
|
573
|
-
} }, index.h("digi-icon-paperclip", { key: '
|
|
586
|
+
} }, index.h("digi-icon-paperclip", { key: 'a84b67ad055682b1c1b013ec948af0935c35ed0c', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
|
|
574
587
|
? this.afUploadBtnText
|
|
575
|
-
: text._t.form.file_choose), index.h("input", { key: '
|
|
588
|
+
: text._t.form.file_choose), index.h("input", { key: 'd0babe3bcbc5d03f2436c0f4a7ee23a93ecb0474', ref: (el) => {
|
|
576
589
|
this._input = el;
|
|
577
|
-
}, onChange: (e) => this.onButtonUploadFileHandler(e), class: "digi-form-file-upload__input", multiple: true, type: "file", id: this.afId, accept: this.afFileTypes, name: this.afName ? this.afName : null, required: this.afRequired ? this.afRequired : null, onDrop: (e) => this.handleDrop(e), onDragOver: (e) => this.handleAllowDrop(e), "aria-errormessage": "digi-form-file-upload__error", "aria-describedBy": "digi-form-file-upload__error" }), index.h("span", { key: '
|
|
578
|
-
text._t.form.file_dropzone))), index.h("p", { key: '
|
|
590
|
+
}, onChange: (e) => this.onButtonUploadFileHandler(e), class: "digi-form-file-upload__input", multiple: true, type: "file", id: this.afId, accept: this.afFileTypes, name: this.afName ? this.afName : null, required: this.afRequired ? this.afRequired : null, onDrop: (e) => this.handleDrop(e), onDragOver: (e) => this.handleAllowDrop(e), "aria-errormessage": "digi-form-file-upload__error", "aria-describedBy": "digi-form-file-upload__error" }), index.h("span", { key: '20a4158d0462ee2f871bddb57b9e168d356573ed' }, this.afVariation !== formFileUploadVariation_enum.FormFileUploadVariation.SMALL &&
|
|
591
|
+
text._t.form.file_dropzone))), index.h("p", { key: 'ade6d22fde218536ce42daff285a1605ac16bdb1', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
|
|
579
592
|
this._srTextContainer = el;
|
|
580
|
-
} }), (this.files.length > 0 || this.error) && (index.h("div", { key: '
|
|
593
|
+
} }), (this.files.length > 0 || this.error) && (index.h("div", { key: '06044ba8e2a5d7e76374af1dfa479c891554ab45', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
|
|
581
594
|
}
|
|
582
595
|
get hostElement() { return index.getElement(this); }
|
|
583
596
|
static get watchers() { return {
|