@designsystem-se/af 38.0.1-beta.2 → 38.2.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-calendar-datepicker.js +10 -6
- package/components/digi-form-checkbox.js +1 -1
- package/components/digi-form-error-list.js +33 -1
- package/components/digi-form-file-upload.js +23 -9
- package/components/digi-form-filter.js +1 -1
- package/components/{p-13c09880.js → p-f84f590e.js} +2 -2
- package/custom-elements.json +9 -1
- package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
- package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +8 -6
- package/dist/cjs/digi-form-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/digi-form-error-list.cjs.entry.js +33 -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/_calendar/calendar-datepicker/calendar-datepicker.js +53 -6
- package/dist/collection/components/_form/form-checkbox/form-checkbox.js +8 -5
- package/dist/collection/components/_form/form-error-list/form-error-list.js +20 -1
- package/dist/collection/components/_form/form-file-upload/form-file-upload.js +41 -8
- package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/{p-37c0ea9e.entry.js → p-2295239c.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-2788683e.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-42ae53aa.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-7f155bd5.entry.js +1 -0
- package/dist/esm/digi-arbetsformedlingen.js +1 -1
- package/dist/esm/digi-calendar-datepicker.entry.js +8 -6
- package/dist/esm/digi-form-checkbox.entry.js +2 -2
- package/dist/esm/digi-form-error-list.entry.js +33 -1
- package/dist/esm/digi-form-file-upload.entry.js +21 -8
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/_calendar/calendar-datepicker/calendar-datepicker.d.ts +10 -0
- package/dist/types/components/_form/form-checkbox/form-checkbox.d.ts +5 -2
- package/dist/types/components/_form/form-error-list/form-error-list.d.ts +3 -0
- package/dist/types/components/_form/form-file-upload/form-file-upload.d.ts +5 -0
- package/dist/types/components.d.ts +29 -4
- package/hydrate/index.js +68 -18
- package/hydrate/index.mjs +68 -18
- package/package.json +1 -1
- package/dist/digi-arbetsformedlingen/p-ba3c4861.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-ef689144.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-f0a405ca.entry.js +0 -1
|
@@ -2217,6 +2217,8 @@ const CalendarDatepicker = class {
|
|
|
2217
2217
|
this.afCloseOnSelect = false;
|
|
2218
2218
|
this.afOpenCalendarTo = undefined;
|
|
2219
2219
|
this.afErrorMessageIsAlert = true;
|
|
2220
|
+
this.afAnnounceIfOptional = false;
|
|
2221
|
+
this.afAnnounceIfOptionalText = undefined;
|
|
2220
2222
|
}
|
|
2221
2223
|
afDisableValidationChangeHandler(newVal) {
|
|
2222
2224
|
if (!newVal) {
|
|
@@ -2548,9 +2550,9 @@ const CalendarDatepicker = class {
|
|
|
2548
2550
|
return this.afSelectedDates;
|
|
2549
2551
|
}
|
|
2550
2552
|
render() {
|
|
2551
|
-
return (index$2.h(index$2.Host, { key: '
|
|
2553
|
+
return (index$2.h(index$2.Host, { key: 'a22b366eece8bdf2a6d66ba7b4561093391ad16d', tabindex: -1 }, index$2.h("div", { key: '5ec3557df78bb012f2e10f1852252e78e2470ee3', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, index$2.h("div", { key: '1215a13021718ac98ad2a4a7a5bae3c456385124', class: "digi-calendar-datepicker__input-field" }, index$2.h("digi-form-input", { key: '8794d312452fe11f0f9052bbdd238e5570ec55f0', ref: (el) => (this._input = el), class: 'digi-calendar-datepicker__input-component', afLabel: this.afLabel, afLabelDescription: this.afLabelDescription, afName: this.afName, afValue: this.inputValue, afValidation: this.hasBuiltInValidationError()
|
|
2552
2554
|
? formInputVariation_enum.FormInputValidation.ERROR
|
|
2553
|
-
: this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, onAfOnChange: (evt) => {
|
|
2555
|
+
: this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, afAnnounceIfOptional: this.afAnnounceIfOptional, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText, onAfOnChange: (evt) => {
|
|
2554
2556
|
evt.stopImmediatePropagation();
|
|
2555
2557
|
this.parseInput(evt);
|
|
2556
2558
|
}, onAfOnBlur: (evt) => {
|
|
@@ -2565,11 +2567,11 @@ const CalendarDatepicker = class {
|
|
|
2565
2567
|
e.preventDefault();
|
|
2566
2568
|
const focusableDateButton = this.hostElement.querySelector('.digi-calendar__date[tabindex="0"]');
|
|
2567
2569
|
focusableDateButton === null || focusableDateButton === void 0 ? void 0 : focusableDateButton.focus();
|
|
2568
|
-
} }, index$2.h("button", { key: '
|
|
2570
|
+
} }, index$2.h("button", { key: 'c953ddf0c99cfd3b892941da7da4a887b342fd78', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
|
|
2569
2571
|
? this.afCloseCalendarAriaLabel
|
|
2570
|
-
: this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, index$2.h("digi-icon-calendar-alt", { key: '
|
|
2572
|
+
: this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, index$2.h("digi-icon-calendar-alt", { key: '46c7387d404b77911b97f31c10e7147bd436c7e3', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), index$2.h("div", { key: '91894a4219afa79d913f558f5d1cc6b410b535ce', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, index$2.h("p", { key: '989fc17ea7a95aa014a26e09f7db7f59fe53a36b', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
|
|
2571
2573
|
? `${text._t.calendar.screenReaderInstructions}${this.screenReaderUpdateTrigger ? '\u200B' : ''}`
|
|
2572
|
-
: ''), index$2.h("digi-calendar", { key: '
|
|
2574
|
+
: ''), index$2.h("digi-calendar", { key: '6e62fb845769eca0a9b8cb21e4a09a5620804d42', afActive: this.showCalendar, afShowWeekNumber: this.afShowWeekNumber, afMultipleDates: this.afMultipleDates, afYearSelect: this.afYearSelect, afSelectedDates: this.getSelectedDates, afMinDate: this.afMinDate, afMaxDate: this.afMaxDate, "aria-hidden": !this.showCalendar, afOpenCalendarTo: this.afOpenCalendarTo, onAfOnDateSelectedChange: (evt) => {
|
|
2573
2575
|
evt.stopImmediatePropagation();
|
|
2574
2576
|
this.parseCalendar(evt);
|
|
2575
2577
|
}, onKeyDown: (e) => {
|
|
@@ -2580,7 +2582,7 @@ const CalendarDatepicker = class {
|
|
|
2580
2582
|
return;
|
|
2581
2583
|
e.preventDefault();
|
|
2582
2584
|
this.focusOnCalendarInput();
|
|
2583
|
-
} })), this.afCloseOnSelect && !this.afMultipleDates && (index$2.h("div", { key: '
|
|
2585
|
+
} })), this.afCloseOnSelect && !this.afMultipleDates && (index$2.h("div", { key: 'd9f3eb470b29a0ab96134f1e4666743efacd7448', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
|
|
2584
2586
|
? `${text._t.calendar.datepicker.selectedDate}: ${this.datesToInputString(this.afSelectedDates)}`
|
|
2585
2587
|
: '')))));
|
|
2586
2588
|
}
|
|
@@ -118,7 +118,7 @@ const FormCheckbox = class {
|
|
|
118
118
|
this.afOnInput.emit(e);
|
|
119
119
|
}
|
|
120
120
|
render() {
|
|
121
|
-
return (index.h(index.Host, { key: '
|
|
121
|
+
return (index.h(index.Host, { key: 'e8ca1dfe96537dd438a4b6c206adfc7c9fd64d9c', tabindex: -1 }, index.h("div", { key: '850911b7ffdcea222b12c2c883cf93b63f703b4f', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, index.h("input", { key: '923a49d0402e6b3034d3e8e6d43033692695c830', class: "digi-form-checkbox__input", ref: (el) => {
|
|
122
122
|
var _a;
|
|
123
123
|
this._input = el;
|
|
124
124
|
(_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
|
|
@@ -126,7 +126,7 @@ const FormCheckbox = class {
|
|
|
126
126
|
? null
|
|
127
127
|
: `${this.afAriaDescribedby ? `${this.afAriaDescribedby} ` : ''}${this.afDescription ? `${this.afId}-description` : ''}`, "aria-labelledby": this.afAriaLabelledby, "aria-label": this.afAriaLabel, "aria-invalid": this.afValidation === formCheckboxVariation_enum.FormCheckboxValidation.ERROR
|
|
128
128
|
? 'true'
|
|
129
|
-
: 'false', required: this.afRequired, id: this.afId, name: this.afName, type: "checkbox", checked: this.afChecked, value: this.afValue, indeterminate: this.afIndeterminate, autofocus: this.afAutofocus ? this.afAutofocus : null }), index.h("label", { key: '
|
|
129
|
+
: 'false', required: this.afRequired, id: this.afId, name: this.afName, type: "checkbox", checked: this.afChecked, value: this.afValue, indeterminate: this.afIndeterminate, autofocus: this.afAutofocus ? this.afAutofocus : null }), index.h("label", { key: 'dccbd4e83dbc757483a18ac22d1539ef83dfb534', htmlFor: this.afId, class: "digi-form-checkbox__label" }, index.h("span", { key: '1cbc88be9d74dab3e04472bc9462712377447d4a', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (index.h("p", { key: 'bdab264d9d13520858c581d2664c0d53171a1415', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
|
|
130
130
|
}
|
|
131
131
|
get hostElement() { return index.getElement(this); }
|
|
132
132
|
static get watchers() { return {
|
|
@@ -52,6 +52,20 @@ require('./typography-meta-variation.enum-13ac3538.js');
|
|
|
52
52
|
require('./typography-time-variation.enum-bce1d87e.js');
|
|
53
53
|
require('./util-breakpoint-observer-breakpoints.enum-e96d3a84.js');
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Small utility for adding Stencil component scope to dynamically inserted elements
|
|
57
|
+
* (e.g. svg for title logotypes)
|
|
58
|
+
*/
|
|
59
|
+
function applyStencilScope(host, root) {
|
|
60
|
+
const scopeClasses = [...host.classList].filter(c => c.startsWith('sc-'));
|
|
61
|
+
if (!scopeClasses.length)
|
|
62
|
+
return;
|
|
63
|
+
root.classList.add(...scopeClasses);
|
|
64
|
+
root.querySelectorAll('*').forEach(el => {
|
|
65
|
+
el.classList.add(...scopeClasses);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
55
69
|
const formErrorListCss = ".sc-digi-form-error-list-h{--digi--form-error-list--list--padding:var(--digi--gutter--smaller) 0 0 0;--digi--form-error-list--list--margin:0;--digi--form-error-list--item--padding:var(--digi--padding--smaller) 0 0 0;--digi--form-error-list--item--margin:0}.sc-digi-form-error-list-h .digi-form-error-list.sc-digi-form-error-list ul.sc-digi-form-error-list{list-style:none;padding:var(--digi--form-error-list--list--padding);margin:var(--digi--form-error-list--list--margin)}.sc-digi-form-error-list-h .digi-form-error-list.sc-digi-form-error-list ul.sc-digi-form-error-list>li.sc-digi-form-error-list{list-style:none;padding:var(--digi--form-error-list--item--padding);margin:var(--digi--form-error-list--item--margin)}";
|
|
56
70
|
const DigiFormErrorListStyle0 = formErrorListCss;
|
|
57
71
|
|
|
@@ -74,6 +88,24 @@ const FormErrorList = class {
|
|
|
74
88
|
async afMSetHeadingFocus() {
|
|
75
89
|
this.setHeadingFocus();
|
|
76
90
|
}
|
|
91
|
+
connectedCallback() {
|
|
92
|
+
this.observer = new MutationObserver((mutations) => {
|
|
93
|
+
const hasChildChanges = mutations.some(mutation => mutation.type === 'childList');
|
|
94
|
+
if (hasChildChanges) {
|
|
95
|
+
const hostElement = this.hostElement.querySelector('.digi-form-error-list');
|
|
96
|
+
applyStencilScope(hostElement, hostElement);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
this.observer.observe(this.hostElement, {
|
|
100
|
+
childList: true,
|
|
101
|
+
subtree: true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
if (this.observer) {
|
|
106
|
+
this.observer.disconnect();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
77
109
|
componentDidLoad() {
|
|
78
110
|
this.setHeadingFocus();
|
|
79
111
|
this.afOnReady.emit();
|
|
@@ -100,7 +132,7 @@ const FormErrorList = class {
|
|
|
100
132
|
this.afOnClickLink.emit({ id });
|
|
101
133
|
}
|
|
102
134
|
render() {
|
|
103
|
-
return (index.h("div", { key: '
|
|
135
|
+
return (index.h("div", { key: '9471a904e95c6304644d884e15aac90d3b0fbad1', class: "digi-form-error-list", id: this.afId }, index.h("digi-notification-alert", { key: '13a8bf3037570f929f470cc2a531156d552ca53a', ref: (el) => (this._notificationAlert = el), "af-heading": this.afHeading, "af-heading-level": this.afHeadingLevel, "af-variation": typographyVariation_enum.NotificationAlertVariation.DANGER }, this.afDescription && (index.h("digi-typography", { key: '8e8ef106286f426b0cbcfd904407582e79e8ce24', "af-variation": typographyVariation_enum.TypographyVariation.SMALL }, index.h("p", { key: '51175a8da94efe46a262ce365994aa3c23983f2e', class: "digi-form-error-list__description" }, this.afDescription))), index.h("slot", { key: 'b9f5287d0e2c0326100a094a48fa5e7ab314b92f' }))));
|
|
104
136
|
}
|
|
105
137
|
get hostElement() { return index.getElement(this); }
|
|
106
138
|
};
|
|
@@ -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 {
|