@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
|
@@ -112,6 +112,7 @@ export class FormFileUpload {
|
|
|
112
112
|
* @en Import array with files without triggering upload event. A file object needs to contain an id, status and the file itself.
|
|
113
113
|
*/
|
|
114
114
|
async afMImportFiles(files) {
|
|
115
|
+
this.resetErrors();
|
|
115
116
|
if (files && files.length > 0) {
|
|
116
117
|
for (const importedFile of files) {
|
|
117
118
|
this.validateFile(importedFile);
|
|
@@ -126,6 +127,14 @@ export class FormFileUpload {
|
|
|
126
127
|
async afMGetFormControlElement() {
|
|
127
128
|
return this._input;
|
|
128
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Rensar komponentens fillista och eventuella felmeddelanden.
|
|
132
|
+
* @en Clears the component's file list and any error messages.
|
|
133
|
+
*/
|
|
134
|
+
async afMClearFiles() {
|
|
135
|
+
this.files = [];
|
|
136
|
+
this.resetErrors();
|
|
137
|
+
}
|
|
129
138
|
/**
|
|
130
139
|
* Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
|
|
131
140
|
* @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
|
|
@@ -173,7 +182,11 @@ export class FormFileUpload {
|
|
|
173
182
|
let exist = false;
|
|
174
183
|
if (this.files.length > 0) {
|
|
175
184
|
this.files.forEach((file) => {
|
|
176
|
-
if (file
|
|
185
|
+
if (file['id'] === fileToCheck['id']) {
|
|
186
|
+
exist = true;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
else if (file.name === fileToCheck.name) {
|
|
177
190
|
exist = true;
|
|
178
191
|
}
|
|
179
192
|
});
|
|
@@ -557,22 +570,22 @@ export class FormFileUpload {
|
|
|
557
570
|
} }, this.renderFiles())));
|
|
558
571
|
}
|
|
559
572
|
render() {
|
|
560
|
-
return (h(Fragment, { key: '
|
|
573
|
+
return (h(Fragment, { key: 'bec280d44d534a720927ab737b34335600c3fe80' }, h("digi-util-breakpoint-observer", { key: '93983b718eda1869ff95f7a0abe8c6704395a1e0', onAfOnChange: (e) => this.breakpointHandler(e) }), h("div", { key: '23f30473aa0dd681c6c4ea20138d3f13391bb070', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, 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 }), h("div", { key: 'db1082e11bafb320c13a790d639d37ca821617ac', class: {
|
|
561
574
|
'digi-form-file-upload__upload-area': true,
|
|
562
575
|
'digi-form-file-upload__upload-area--hover': this.fileHover
|
|
563
576
|
}, 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 &&
|
|
564
|
-
this.afVariation != FormFileUploadVariation.SMALL && (h("div", { key: '
|
|
577
|
+
this.afVariation != FormFileUploadVariation.SMALL && (h("div", { key: 'f58d5f61b5568263e9b60b255f47e6ef418c78e5', class: "digi-form-file-upload__upload-area-overlay" })), h("div", { key: 'c58c52f7e2c8aa8d17fe510ef90435d488844237', class: "digi-form-file-upload__text-area" }, h("button", { key: '1bb7fa84e0778702d0e77008f7d468d560ac8e17', type: "button", id: this.afId + '-button', ref: (el) => {
|
|
565
578
|
this._uploadButton = el;
|
|
566
579
|
}, onClick: (e) => this.handleInputClick(e), class: "digi-form-file-upload__button hidden_mobile", style: {
|
|
567
580
|
margin: '0'
|
|
568
|
-
} }, h("digi-icon-paperclip", { key: '
|
|
581
|
+
} }, h("digi-icon-paperclip", { key: 'a84b67ad055682b1c1b013ec948af0935c35ed0c', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
|
|
569
582
|
? this.afUploadBtnText
|
|
570
|
-
: _t.form.file_choose), h("input", { key: '
|
|
583
|
+
: _t.form.file_choose), h("input", { key: 'd0babe3bcbc5d03f2436c0f4a7ee23a93ecb0474', ref: (el) => {
|
|
571
584
|
this._input = el;
|
|
572
|
-
}, 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" }), h("span", { key: '
|
|
573
|
-
_t.form.file_dropzone))), h("p", { key: '
|
|
585
|
+
}, 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" }), h("span", { key: '20a4158d0462ee2f871bddb57b9e168d356573ed' }, this.afVariation !== FormFileUploadVariation.SMALL &&
|
|
586
|
+
_t.form.file_dropzone))), h("p", { key: 'ade6d22fde218536ce42daff285a1605ac16bdb1', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
|
|
574
587
|
this._srTextContainer = el;
|
|
575
|
-
} }), (this.files.length > 0 || this.error) && (h("div", { key: '
|
|
588
|
+
} }), (this.files.length > 0 || this.error) && (h("div", { key: '06044ba8e2a5d7e76374af1dfa479c891554ab45', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
|
|
576
589
|
}
|
|
577
590
|
static get is() { return "digi-form-file-upload"; }
|
|
578
591
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1317,6 +1330,26 @@ export class FormFileUpload {
|
|
|
1317
1330
|
"text": "",
|
|
1318
1331
|
"tags": []
|
|
1319
1332
|
}
|
|
1333
|
+
},
|
|
1334
|
+
"afMClearFiles": {
|
|
1335
|
+
"complexType": {
|
|
1336
|
+
"signature": "() => Promise<void>",
|
|
1337
|
+
"parameters": [],
|
|
1338
|
+
"references": {
|
|
1339
|
+
"Promise": {
|
|
1340
|
+
"location": "global",
|
|
1341
|
+
"id": "global::Promise"
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1344
|
+
"return": "Promise<void>"
|
|
1345
|
+
},
|
|
1346
|
+
"docs": {
|
|
1347
|
+
"text": "Rensar komponentens fillista och eventuella felmeddelanden.",
|
|
1348
|
+
"tags": [{
|
|
1349
|
+
"name": "en",
|
|
1350
|
+
"text": "Clears the component's file list and any error messages."
|
|
1351
|
+
}]
|
|
1352
|
+
}
|
|
1320
1353
|
}
|
|
1321
1354
|
};
|
|
1322
1355
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
--digi--logo
|
|
5
|
-
--digi--logo--
|
|
6
|
-
--digi--logo
|
|
7
|
-
--digi--logo
|
|
8
|
-
|
|
9
|
-
--digi--logo
|
|
10
|
-
--digi--logo
|
|
11
|
-
--digi--logo
|
|
12
|
-
--digi--logo
|
|
13
|
-
|
|
14
|
-
--digi--logo
|
|
15
|
-
--digi--logo
|
|
16
|
-
--digi--logo--primary--text: var(--digi--color--logotype--primary--text);
|
|
17
|
-
--digi--logo--secondary--text: var(--digi--color--logotype--secondary--text);
|
|
1
|
+
@mixin digi-title-logo--variables() {
|
|
2
|
+
--digi--title-logo-text-color: var(--digi--color--text--primary);
|
|
3
|
+
--digi--title-logo-font-weight: var(--digi--global--typography--font-weight--bold);
|
|
4
|
+
--digi--title-logo-font-size: var(--digi--typography--title-logo--font-size--mobile);
|
|
5
|
+
--digi--title-logo-font-size-small: var(--digi--global--typography--font-size--large);
|
|
6
|
+
--digi--title-logo-line-height-small: 1.25rem;
|
|
7
|
+
--digi--title-logo-symbol-color: var(--digi--color--logotype--primary--symbol);
|
|
8
|
+
--digi--title-logo-symbol-width: 36px;
|
|
9
|
+
--digi--title-logo-symbol-height: 36px;
|
|
10
|
+
--digi--title-logo-symbol-width-mobile: 44px;
|
|
11
|
+
--digi--title-logo-symbol-height-mobile: 44px;
|
|
12
|
+
--digi--title-logo-text-height: 40px;
|
|
13
|
+
--digi--title-logo-border-width: var(--digi--global--border-width--base);
|
|
14
|
+
--digi--title-logo-vertical-padding: 1.375rem;
|
|
15
|
+
--digi--title-logo-gap: 9px;
|
|
18
16
|
}
|