@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.
Files changed (39) hide show
  1. package/components/digi-calendar-datepicker.js +10 -6
  2. package/components/digi-form-checkbox.js +1 -1
  3. package/components/digi-form-error-list.js +33 -1
  4. package/components/digi-form-file-upload.js +23 -9
  5. package/components/digi-form-filter.js +1 -1
  6. package/components/{p-13c09880.js → p-f84f590e.js} +2 -2
  7. package/custom-elements.json +9 -1
  8. package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
  9. package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +8 -6
  10. package/dist/cjs/digi-form-checkbox.cjs.entry.js +2 -2
  11. package/dist/cjs/digi-form-error-list.cjs.entry.js +33 -1
  12. package/dist/cjs/digi-form-file-upload.cjs.entry.js +21 -8
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/_calendar/calendar-datepicker/calendar-datepicker.js +53 -6
  15. package/dist/collection/components/_form/form-checkbox/form-checkbox.js +8 -5
  16. package/dist/collection/components/_form/form-error-list/form-error-list.js +20 -1
  17. package/dist/collection/components/_form/form-file-upload/form-file-upload.js +41 -8
  18. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
  19. package/dist/digi-arbetsformedlingen/{p-37c0ea9e.entry.js → p-2295239c.entry.js} +1 -1
  20. package/dist/digi-arbetsformedlingen/p-2788683e.entry.js +1 -0
  21. package/dist/digi-arbetsformedlingen/p-42ae53aa.entry.js +1 -0
  22. package/dist/digi-arbetsformedlingen/p-7f155bd5.entry.js +1 -0
  23. package/dist/esm/digi-arbetsformedlingen.js +1 -1
  24. package/dist/esm/digi-calendar-datepicker.entry.js +8 -6
  25. package/dist/esm/digi-form-checkbox.entry.js +2 -2
  26. package/dist/esm/digi-form-error-list.entry.js +33 -1
  27. package/dist/esm/digi-form-file-upload.entry.js +21 -8
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/types/components/_calendar/calendar-datepicker/calendar-datepicker.d.ts +10 -0
  30. package/dist/types/components/_form/form-checkbox/form-checkbox.d.ts +5 -2
  31. package/dist/types/components/_form/form-error-list/form-error-list.d.ts +3 -0
  32. package/dist/types/components/_form/form-file-upload/form-file-upload.d.ts +5 -0
  33. package/dist/types/components.d.ts +29 -4
  34. package/hydrate/index.js +68 -18
  35. package/hydrate/index.mjs +68 -18
  36. package/package.json +1 -1
  37. package/dist/digi-arbetsformedlingen/p-ba3c4861.entry.js +0 -1
  38. package/dist/digi-arbetsformedlingen/p-ef689144.entry.js +0 -1
  39. package/dist/digi-arbetsformedlingen/p-f0a405ca.entry.js +0 -1
@@ -116,8 +116,11 @@ export declare class FormCheckbox {
116
116
  */
117
117
  afAutofocus: boolean;
118
118
  /**
119
- * Tabindex
120
- * @deprecated Denna prop kommer att tas bort i slutet av augusti
119
+ * @ignore
120
+ * Sätter specifikt tabindex för input. Används till vår komponent Multifiter
121
+ * där vi vill manipulera tabbordningen för att underlätta navigeringen för tangentbordsanvändare
122
+ * @en Set specific tabindex for input. Used in our component Multifilter
123
+ * where we want to manipulate the tab order to facilitate navigation for keyboard users.
121
124
  */
122
125
  afTabIndex: number;
123
126
  /**
@@ -50,11 +50,14 @@ export declare class FormErrorList {
50
50
  * @en When the component and slots are loaded and initialized this event will trigger.
51
51
  */
52
52
  afOnReady: EventEmitter;
53
+ private observer;
53
54
  /**
54
55
  * Sätter fokus på rubriken.
55
56
  * @en Sets focus on the heading.
56
57
  */
57
58
  afMSetHeadingFocus(): Promise<void>;
59
+ connectedCallback(): void;
60
+ disconnectedCallback(): void;
58
61
  componentDidLoad(): void;
59
62
  setHeadingFocus(): void;
60
63
  clickResponse(e: CustomEvent): void;
@@ -179,6 +179,11 @@ export declare class FormFileUpload {
179
179
  */
180
180
  afMImportFiles(files: File[]): Promise<void>;
181
181
  afMGetFormControlElement(): Promise<HTMLInputElement>;
182
+ /**
183
+ * Rensar komponentens fillista och eventuella felmeddelanden.
184
+ * @en Clears the component's file list and any error messages.
185
+ */
186
+ afMClearFiles(): Promise<void>;
182
187
  /**
183
188
  * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
184
189
  * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
@@ -510,6 +510,16 @@ export namespace Components {
510
510
  * @valueAccessor TextValueAccessor
511
511
  */
512
512
  interface DigiCalendarDatepicker {
513
+ /**
514
+ * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
515
+ * @en Set this to true if the form contains more required fields than optional fields.
516
+ */
517
+ "afAnnounceIfOptional": boolean;
518
+ /**
519
+ * Sätter text för afAnnounceIfOptional.
520
+ * @en Set text for afAnnounceIfOptional.
521
+ */
522
+ "afAnnounceIfOptionalText": string;
513
523
  /**
514
524
  * Aria-label till knappen som stänger kalendern
515
525
  * @en Aria-label for the button that closes the calendar
@@ -1122,8 +1132,8 @@ export namespace Components {
1122
1132
  */
1123
1133
  "afRequired": boolean;
1124
1134
  /**
1125
- * Tabindex
1126
- * @deprecated Denna prop kommer att tas bort i slutet av augusti
1135
+ * @ignore Sätter specifikt tabindex för input. Används till vår komponent Multifiter där vi vill manipulera tabbordningen för att underlätta navigeringen för tangentbordsanvändare
1136
+ * @en Set specific tabindex for input. Used in our component Multifilter where we want to manipulate the tab order to facilitate navigation for keyboard users.
1127
1137
  */
1128
1138
  "afTabIndex": number;
1129
1139
  /**
@@ -1302,6 +1312,11 @@ export namespace Components {
1302
1312
  * @en A description text
1303
1313
  */
1304
1314
  "afLabelDescription": string;
1315
+ /**
1316
+ * Rensar komponentens fillista och eventuella felmeddelanden.
1317
+ * @en Clears the component's file list and any error messages.
1318
+ */
1319
+ "afMClearFiles": () => Promise<void>;
1305
1320
  /**
1306
1321
  * Få ut alla uppladdade filer
1307
1322
  * @en Get all uploaded files
@@ -11936,6 +11951,16 @@ declare namespace LocalJSX {
11936
11951
  * @valueAccessor TextValueAccessor
11937
11952
  */
11938
11953
  interface DigiCalendarDatepicker {
11954
+ /**
11955
+ * Sätt denna till true om formuläret innehåller fler obligatoriska fält än valfria.
11956
+ * @en Set this to true if the form contains more required fields than optional fields.
11957
+ */
11958
+ "afAnnounceIfOptional"?: boolean;
11959
+ /**
11960
+ * Sätter text för afAnnounceIfOptional.
11961
+ * @en Set text for afAnnounceIfOptional.
11962
+ */
11963
+ "afAnnounceIfOptionalText"?: string;
11939
11964
  /**
11940
11965
  * Aria-label till knappen som stänger kalendern
11941
11966
  * @en Aria-label for the button that closes the calendar
@@ -12618,8 +12643,8 @@ declare namespace LocalJSX {
12618
12643
  */
12619
12644
  "afRequired"?: boolean;
12620
12645
  /**
12621
- * Tabindex
12622
- * @deprecated Denna prop kommer att tas bort i slutet av augusti
12646
+ * @ignore Sätter specifikt tabindex för input. Används till vår komponent Multifiter där vi vill manipulera tabbordningen för att underlätta navigeringen för tangentbordsanvändare
12647
+ * @en Set specific tabindex for input. Used in our component Multifilter where we want to manipulate the tab order to facilitate navigation for keyboard users.
12623
12648
  */
12624
12649
  "afTabIndex"?: number;
12625
12650
  /**
package/hydrate/index.js CHANGED
@@ -9446,6 +9446,8 @@ class CalendarDatepicker {
9446
9446
  this.afCloseOnSelect = false;
9447
9447
  this.afOpenCalendarTo = undefined;
9448
9448
  this.afErrorMessageIsAlert = true;
9449
+ this.afAnnounceIfOptional = false;
9450
+ this.afAnnounceIfOptionalText = undefined;
9449
9451
  }
9450
9452
  afDisableValidationChangeHandler(newVal) {
9451
9453
  if (!newVal) {
@@ -9777,9 +9779,9 @@ class CalendarDatepicker {
9777
9779
  return this.afSelectedDates;
9778
9780
  }
9779
9781
  render() {
9780
- return (hAsync(Host, { key: '6b080d933e012fe050aee0181f927c3252b0bb7e', tabindex: -1 }, hAsync("div", { key: 'ec59a7f209f7a5e06c62d4443fbca980b1030d12', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, hAsync("div", { key: '2bf3bd4f0a82c14c4fb04610dab19767fbba595d', class: "digi-calendar-datepicker__input-field" }, hAsync("digi-form-input", { key: 'ebde8123611c021b60104f75c2e4085e35fb4697', 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()
9782
+ return (hAsync(Host, { key: 'a22b366eece8bdf2a6d66ba7b4561093391ad16d', tabindex: -1 }, hAsync("div", { key: '5ec3557df78bb012f2e10f1852252e78e2470ee3', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, hAsync("div", { key: '1215a13021718ac98ad2a4a7a5bae3c456385124', class: "digi-calendar-datepicker__input-field" }, hAsync("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()
9781
9783
  ? FormInputValidation.ERROR
9782
- : this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, onAfOnChange: (evt) => {
9784
+ : 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) => {
9783
9785
  evt.stopImmediatePropagation();
9784
9786
  this.parseInput(evt);
9785
9787
  }, onAfOnBlur: (evt) => {
@@ -9794,11 +9796,11 @@ class CalendarDatepicker {
9794
9796
  e.preventDefault();
9795
9797
  const focusableDateButton = this.hostElement.querySelector('.digi-calendar__date[tabindex="0"]');
9796
9798
  focusableDateButton === null || focusableDateButton === void 0 ? void 0 : focusableDateButton.focus();
9797
- } }, hAsync("button", { key: '04df5ccb789271d7ba2f693b740f316301f9fae0', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
9799
+ } }, hAsync("button", { key: 'c953ddf0c99cfd3b892941da7da4a887b342fd78', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
9798
9800
  ? this.afCloseCalendarAriaLabel
9799
- : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, hAsync("digi-icon-calendar-alt", { key: '65b9a472f629bbaa46a64c8a304f358da76b0830', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), hAsync("div", { key: 'd0df89ce680bb2a0ca7f311b2c0ead0f72dc30b6', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, hAsync("p", { key: '9796876e15e88b1599d772863c29fc472da24c69', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
9801
+ : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, hAsync("digi-icon-calendar-alt", { key: '46c7387d404b77911b97f31c10e7147bd436c7e3', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), hAsync("div", { key: '91894a4219afa79d913f558f5d1cc6b410b535ce', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, hAsync("p", { key: '989fc17ea7a95aa014a26e09f7db7f59fe53a36b', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
9800
9802
  ? `${_t.calendar.screenReaderInstructions}${this.screenReaderUpdateTrigger ? '\u200B' : ''}`
9801
- : ''), hAsync("digi-calendar", { key: 'bd5f34bcdbcb2276b5080c43479337c514861ba9', 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) => {
9803
+ : ''), hAsync("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) => {
9802
9804
  evt.stopImmediatePropagation();
9803
9805
  this.parseCalendar(evt);
9804
9806
  }, onKeyDown: (e) => {
@@ -9809,7 +9811,7 @@ class CalendarDatepicker {
9809
9811
  return;
9810
9812
  e.preventDefault();
9811
9813
  this.focusOnCalendarInput();
9812
- } })), this.afCloseOnSelect && !this.afMultipleDates && (hAsync("div", { key: 'fc150d20f14731e8f67f38c6042e8af4e24eae38', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
9814
+ } })), this.afCloseOnSelect && !this.afMultipleDates && (hAsync("div", { key: 'd9f3eb470b29a0ab96134f1e4666743efacd7448', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
9813
9815
  ? `${_t.calendar.datepicker.selectedDate}: ${this.datesToInputString(this.afSelectedDates)}`
9814
9816
  : '')))));
9815
9817
  }
@@ -9850,6 +9852,8 @@ class CalendarDatepicker {
9850
9852
  "afCloseOnSelect": [4, "af-close-on-select"],
9851
9853
  "afOpenCalendarTo": [16],
9852
9854
  "afErrorMessageIsAlert": [8, "af-error-message-is-alert"],
9855
+ "afAnnounceIfOptional": [4, "af-announce-if-optional"],
9856
+ "afAnnounceIfOptionalText": [1, "af-announce-if-optional-text"],
9853
9857
  "showWrongFormatError": [32],
9854
9858
  "showDisabledDateError": [32],
9855
9859
  "showCalendar": [32],
@@ -20839,7 +20843,7 @@ class FormCheckbox {
20839
20843
  this.afOnInput.emit(e);
20840
20844
  }
20841
20845
  render() {
20842
- return (hAsync(Host, { key: '93a52532d5ee8e2b89982b3d06509c16b3656bce', tabindex: -1 }, hAsync("div", { key: '3f2fe30e35c36080d80fdec5c57abf8e310ae14b', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, hAsync("input", { key: 'a45c26da379bff48830f0b03ceebcf24b06c3b17', class: "digi-form-checkbox__input", ref: (el) => {
20846
+ return (hAsync(Host, { key: 'e8ca1dfe96537dd438a4b6c206adfc7c9fd64d9c', tabindex: -1 }, hAsync("div", { key: '850911b7ffdcea222b12c2c883cf93b63f703b4f', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, hAsync("input", { key: '923a49d0402e6b3034d3e8e6d43033692695c830', class: "digi-form-checkbox__input", ref: (el) => {
20843
20847
  var _a;
20844
20848
  this._input = el;
20845
20849
  (_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
@@ -20847,7 +20851,7 @@ class FormCheckbox {
20847
20851
  ? null
20848
20852
  : `${this.afAriaDescribedby ? `${this.afAriaDescribedby} ` : ''}${this.afDescription ? `${this.afId}-description` : ''}`, "aria-labelledby": this.afAriaLabelledby, "aria-label": this.afAriaLabel, "aria-invalid": this.afValidation === FormCheckboxValidation.ERROR
20849
20853
  ? 'true'
20850
- : '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 }), hAsync("label", { key: '54cd68f1c10fd023e9dd81bd0fabb2920b911c12', htmlFor: this.afId, class: "digi-form-checkbox__label" }, hAsync("span", { key: 'c7184f48868d38d04485a48f214cc3c37d862ba4', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (hAsync("p", { key: 'afc00a7de3cef740bdbf23607cd9247887752759', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
20854
+ : '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 }), hAsync("label", { key: 'dccbd4e83dbc757483a18ac22d1539ef83dfb534', htmlFor: this.afId, class: "digi-form-checkbox__label" }, hAsync("span", { key: '1cbc88be9d74dab3e04472bc9462712377447d4a', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (hAsync("p", { key: 'bdab264d9d13520858c581d2664c0d53171a1415', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
20851
20855
  }
20852
20856
  get hostElement() { return getElement(this); }
20853
20857
  static get watchers() { return {
@@ -20890,6 +20894,20 @@ class FormCheckbox {
20890
20894
  }; }
20891
20895
  }
20892
20896
 
20897
+ /**
20898
+ * Small utility for adding Stencil component scope to dynamically inserted elements
20899
+ * (e.g. svg for title logotypes)
20900
+ */
20901
+ function applyStencilScope(host, root) {
20902
+ const scopeClasses = [...host.classList].filter(c => c.startsWith('sc-'));
20903
+ if (!scopeClasses.length)
20904
+ return;
20905
+ root.classList.add(...scopeClasses);
20906
+ root.querySelectorAll('*').forEach(el => {
20907
+ el.classList.add(...scopeClasses);
20908
+ });
20909
+ }
20910
+
20893
20911
  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)}";
20894
20912
  var DigiFormErrorListStyle0 = formErrorListCss;
20895
20913
 
@@ -20916,6 +20934,24 @@ class FormErrorList {
20916
20934
  async afMSetHeadingFocus() {
20917
20935
  this.setHeadingFocus();
20918
20936
  }
20937
+ connectedCallback() {
20938
+ this.observer = new MutationObserver((mutations) => {
20939
+ const hasChildChanges = mutations.some(mutation => mutation.type === 'childList');
20940
+ if (hasChildChanges) {
20941
+ const hostElement = this.hostElement.querySelector('.digi-form-error-list');
20942
+ applyStencilScope(hostElement, hostElement);
20943
+ }
20944
+ });
20945
+ this.observer.observe(this.hostElement, {
20946
+ childList: true,
20947
+ subtree: true
20948
+ });
20949
+ }
20950
+ disconnectedCallback() {
20951
+ if (this.observer) {
20952
+ this.observer.disconnect();
20953
+ }
20954
+ }
20919
20955
  componentDidLoad() {
20920
20956
  this.setHeadingFocus();
20921
20957
  this.afOnReady.emit();
@@ -20942,7 +20978,7 @@ class FormErrorList {
20942
20978
  this.afOnClickLink.emit({ id });
20943
20979
  }
20944
20980
  render() {
20945
- return (hAsync("div", { key: '59bc43d4b3dd0149647b50203cc1ae585d829006', class: "digi-form-error-list", id: this.afId }, hAsync("digi-notification-alert", { key: 'a2b034276ff7549c9c0711202020e3753da7808d', ref: (el) => (this._notificationAlert = el), "af-heading": this.afHeading, "af-heading-level": this.afHeadingLevel, "af-variation": NotificationAlertVariation.DANGER }, this.afDescription && (hAsync("digi-typography", { key: '3a61c65373b92a73694770f851c6727e27f853e7', "af-variation": TypographyVariation.SMALL }, hAsync("p", { key: 'a088b4d084f5a6db85cedcb4f469f4dff803f8f6', class: "digi-form-error-list__description" }, this.afDescription))), hAsync("slot", { key: '794c42cdece0d06945255b70a96a6992eb4dcd4c' }))));
20981
+ return (hAsync("div", { key: '9471a904e95c6304644d884e15aac90d3b0fbad1', class: "digi-form-error-list", id: this.afId }, hAsync("digi-notification-alert", { key: '13a8bf3037570f929f470cc2a531156d552ca53a', ref: (el) => (this._notificationAlert = el), "af-heading": this.afHeading, "af-heading-level": this.afHeadingLevel, "af-variation": NotificationAlertVariation.DANGER }, this.afDescription && (hAsync("digi-typography", { key: '8e8ef106286f426b0cbcfd904407582e79e8ce24', "af-variation": TypographyVariation.SMALL }, hAsync("p", { key: '51175a8da94efe46a262ce365994aa3c23983f2e', class: "digi-form-error-list__description" }, this.afDescription))), hAsync("slot", { key: 'b9f5287d0e2c0326100a094a48fa5e7ab314b92f' }))));
20946
20982
  }
20947
20983
  get hostElement() { return getElement(this); }
20948
20984
  static get style() { return DigiFormErrorListStyle0; }
@@ -21122,6 +21158,7 @@ class FormFileUpload {
21122
21158
  * @en Import array with files without triggering upload event. A file object needs to contain an id, status and the file itself.
21123
21159
  */
21124
21160
  async afMImportFiles(files) {
21161
+ this.resetErrors();
21125
21162
  if (files && files.length > 0) {
21126
21163
  for (const importedFile of files) {
21127
21164
  this.validateFile(importedFile);
@@ -21136,6 +21173,14 @@ class FormFileUpload {
21136
21173
  async afMGetFormControlElement() {
21137
21174
  return this._input;
21138
21175
  }
21176
+ /**
21177
+ * Rensar komponentens fillista och eventuella felmeddelanden.
21178
+ * @en Clears the component's file list and any error messages.
21179
+ */
21180
+ async afMClearFiles() {
21181
+ this.files = [];
21182
+ this.resetErrors();
21183
+ }
21139
21184
  /**
21140
21185
  * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
21141
21186
  * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
@@ -21183,7 +21228,11 @@ class FormFileUpload {
21183
21228
  let exist = false;
21184
21229
  if (this.files.length > 0) {
21185
21230
  this.files.forEach((file) => {
21186
- if (file.name === fileToCheck.name) {
21231
+ if (file['id'] === fileToCheck['id']) {
21232
+ exist = true;
21233
+ return;
21234
+ }
21235
+ else if (file.name === fileToCheck.name) {
21187
21236
  exist = true;
21188
21237
  }
21189
21238
  });
@@ -21567,22 +21616,22 @@ class FormFileUpload {
21567
21616
  } }, this.renderFiles())));
21568
21617
  }
21569
21618
  render() {
21570
- return (hAsync(Fragment, { key: '1104991979216e10bd2e137de392134a9dd970f3' }, hAsync("digi-util-breakpoint-observer", { key: '645a8f2849a39c068b77fa7c6ddfd726e834b3b2', onAfOnChange: (e) => this.breakpointHandler(e) }), hAsync("div", { key: 'c6b2785961f0e0b0cb2b2ccb7da42d663b9e9e3b', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, hAsync("digi-form-label", { key: 'd51e788ee53461e075b0f73b600608646c70032f', afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), hAsync("div", { key: '9df4b7deaca899f1c06bf615065a2fce7eea4bc0', class: {
21619
+ return (hAsync(Fragment, { key: 'bec280d44d534a720927ab737b34335600c3fe80' }, hAsync("digi-util-breakpoint-observer", { key: '93983b718eda1869ff95f7a0abe8c6704395a1e0', onAfOnChange: (e) => this.breakpointHandler(e) }), hAsync("div", { key: '23f30473aa0dd681c6c4ea20138d3f13391bb070', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, hAsync("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 }), hAsync("div", { key: 'db1082e11bafb320c13a790d639d37ca821617ac', class: {
21571
21620
  'digi-form-file-upload__upload-area': true,
21572
21621
  'digi-form-file-upload__upload-area--hover': this.fileHover
21573
21622
  }, 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 &&
21574
- this.afVariation != FormFileUploadVariation.SMALL && (hAsync("div", { key: '8c35b4e2523db4f4f892d2f615caedb8bb3a9ebe', class: "digi-form-file-upload__upload-area-overlay" })), hAsync("div", { key: '096b05c159ce7722687cdc0b1a0ff4889a5485e2', class: "digi-form-file-upload__text-area" }, hAsync("button", { key: '97504d954e2f3a0e76d99fb4d5049ddea108a32f', type: "button", id: this.afId + '-button', ref: (el) => {
21623
+ this.afVariation != FormFileUploadVariation.SMALL && (hAsync("div", { key: 'f58d5f61b5568263e9b60b255f47e6ef418c78e5', class: "digi-form-file-upload__upload-area-overlay" })), hAsync("div", { key: 'c58c52f7e2c8aa8d17fe510ef90435d488844237', class: "digi-form-file-upload__text-area" }, hAsync("button", { key: '1bb7fa84e0778702d0e77008f7d468d560ac8e17', type: "button", id: this.afId + '-button', ref: (el) => {
21575
21624
  this._uploadButton = el;
21576
21625
  }, onClick: (e) => this.handleInputClick(e), class: "digi-form-file-upload__button hidden_mobile", style: {
21577
21626
  margin: '0'
21578
- } }, hAsync("digi-icon-paperclip", { key: 'e47597d6988db6a71c22fb9ab4cfa877be4a48fa', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
21627
+ } }, hAsync("digi-icon-paperclip", { key: 'a84b67ad055682b1c1b013ec948af0935c35ed0c', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
21579
21628
  ? this.afUploadBtnText
21580
- : _t.form.file_choose), hAsync("input", { key: 'b21162f7873e21a8b3ed2d286ef154b66b95c8ec', ref: (el) => {
21629
+ : _t.form.file_choose), hAsync("input", { key: 'd0babe3bcbc5d03f2436c0f4a7ee23a93ecb0474', ref: (el) => {
21581
21630
  this._input = el;
21582
- }, 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" }), hAsync("span", { key: 'c8e448ef96e9d4f292ec88606526e06935192308' }, this.afVariation !== FormFileUploadVariation.SMALL &&
21583
- _t.form.file_dropzone))), hAsync("p", { key: '8c6f1b6190eb4f87bbcd9d50f4c4929cdcf4c026', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
21631
+ }, 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" }), hAsync("span", { key: '20a4158d0462ee2f871bddb57b9e168d356573ed' }, this.afVariation !== FormFileUploadVariation.SMALL &&
21632
+ _t.form.file_dropzone))), hAsync("p", { key: 'ade6d22fde218536ce42daff285a1605ac16bdb1', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
21584
21633
  this._srTextContainer = el;
21585
- } }), (this.files.length > 0 || this.error) && (hAsync("div", { key: '7faefe886463ce493824665375b3b4ab0aec5753', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
21634
+ } }), (this.files.length > 0 || this.error) && (hAsync("div", { key: '06044ba8e2a5d7e76374af1dfa479c891554ab45', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
21586
21635
  }
21587
21636
  get hostElement() { return getElement(this); }
21588
21637
  static get watchers() { return {
@@ -21626,7 +21675,8 @@ class FormFileUpload {
21626
21675
  "afMGetAllFiles": [64],
21627
21676
  "afMGetValidationState": [64],
21628
21677
  "afMImportFiles": [64],
21629
- "afMGetFormControlElement": [64]
21678
+ "afMGetFormControlElement": [64],
21679
+ "afMClearFiles": [64]
21630
21680
  },
21631
21681
  "$listeners$": [[0, "focus", "focusOnInput"]],
21632
21682
  "$lazyBundleId$": "-",
package/hydrate/index.mjs CHANGED
@@ -9442,6 +9442,8 @@ class CalendarDatepicker {
9442
9442
  this.afCloseOnSelect = false;
9443
9443
  this.afOpenCalendarTo = undefined;
9444
9444
  this.afErrorMessageIsAlert = true;
9445
+ this.afAnnounceIfOptional = false;
9446
+ this.afAnnounceIfOptionalText = undefined;
9445
9447
  }
9446
9448
  afDisableValidationChangeHandler(newVal) {
9447
9449
  if (!newVal) {
@@ -9773,9 +9775,9 @@ class CalendarDatepicker {
9773
9775
  return this.afSelectedDates;
9774
9776
  }
9775
9777
  render() {
9776
- return (hAsync(Host, { key: '6b080d933e012fe050aee0181f927c3252b0bb7e', tabindex: -1 }, hAsync("div", { key: 'ec59a7f209f7a5e06c62d4443fbca980b1030d12', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, hAsync("div", { key: '2bf3bd4f0a82c14c4fb04610dab19767fbba595d', class: "digi-calendar-datepicker__input-field" }, hAsync("digi-form-input", { key: 'ebde8123611c021b60104f75c2e4085e35fb4697', 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()
9778
+ return (hAsync(Host, { key: 'a22b366eece8bdf2a6d66ba7b4561093391ad16d', tabindex: -1 }, hAsync("div", { key: '5ec3557df78bb012f2e10f1852252e78e2470ee3', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, hAsync("div", { key: '1215a13021718ac98ad2a4a7a5bae3c456385124', class: "digi-calendar-datepicker__input-field" }, hAsync("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()
9777
9779
  ? FormInputValidation.ERROR
9778
- : this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, onAfOnChange: (evt) => {
9780
+ : 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) => {
9779
9781
  evt.stopImmediatePropagation();
9780
9782
  this.parseInput(evt);
9781
9783
  }, onAfOnBlur: (evt) => {
@@ -9790,11 +9792,11 @@ class CalendarDatepicker {
9790
9792
  e.preventDefault();
9791
9793
  const focusableDateButton = this.hostElement.querySelector('.digi-calendar__date[tabindex="0"]');
9792
9794
  focusableDateButton === null || focusableDateButton === void 0 ? void 0 : focusableDateButton.focus();
9793
- } }, hAsync("button", { key: '04df5ccb789271d7ba2f693b740f316301f9fae0', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
9795
+ } }, hAsync("button", { key: 'c953ddf0c99cfd3b892941da7da4a887b342fd78', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
9794
9796
  ? this.afCloseCalendarAriaLabel
9795
- : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, hAsync("digi-icon-calendar-alt", { key: '65b9a472f629bbaa46a64c8a304f358da76b0830', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), hAsync("div", { key: 'd0df89ce680bb2a0ca7f311b2c0ead0f72dc30b6', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, hAsync("p", { key: '9796876e15e88b1599d772863c29fc472da24c69', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
9797
+ : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, hAsync("digi-icon-calendar-alt", { key: '46c7387d404b77911b97f31c10e7147bd436c7e3', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), hAsync("div", { key: '91894a4219afa79d913f558f5d1cc6b410b535ce', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, hAsync("p", { key: '989fc17ea7a95aa014a26e09f7db7f59fe53a36b', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
9796
9798
  ? `${_t.calendar.screenReaderInstructions}${this.screenReaderUpdateTrigger ? '\u200B' : ''}`
9797
- : ''), hAsync("digi-calendar", { key: 'bd5f34bcdbcb2276b5080c43479337c514861ba9', 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) => {
9799
+ : ''), hAsync("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) => {
9798
9800
  evt.stopImmediatePropagation();
9799
9801
  this.parseCalendar(evt);
9800
9802
  }, onKeyDown: (e) => {
@@ -9805,7 +9807,7 @@ class CalendarDatepicker {
9805
9807
  return;
9806
9808
  e.preventDefault();
9807
9809
  this.focusOnCalendarInput();
9808
- } })), this.afCloseOnSelect && !this.afMultipleDates && (hAsync("div", { key: 'fc150d20f14731e8f67f38c6042e8af4e24eae38', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
9810
+ } })), this.afCloseOnSelect && !this.afMultipleDates && (hAsync("div", { key: 'd9f3eb470b29a0ab96134f1e4666743efacd7448', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
9809
9811
  ? `${_t.calendar.datepicker.selectedDate}: ${this.datesToInputString(this.afSelectedDates)}`
9810
9812
  : '')))));
9811
9813
  }
@@ -9846,6 +9848,8 @@ class CalendarDatepicker {
9846
9848
  "afCloseOnSelect": [4, "af-close-on-select"],
9847
9849
  "afOpenCalendarTo": [16],
9848
9850
  "afErrorMessageIsAlert": [8, "af-error-message-is-alert"],
9851
+ "afAnnounceIfOptional": [4, "af-announce-if-optional"],
9852
+ "afAnnounceIfOptionalText": [1, "af-announce-if-optional-text"],
9849
9853
  "showWrongFormatError": [32],
9850
9854
  "showDisabledDateError": [32],
9851
9855
  "showCalendar": [32],
@@ -20835,7 +20839,7 @@ class FormCheckbox {
20835
20839
  this.afOnInput.emit(e);
20836
20840
  }
20837
20841
  render() {
20838
- return (hAsync(Host, { key: '93a52532d5ee8e2b89982b3d06509c16b3656bce', tabindex: -1 }, hAsync("div", { key: '3f2fe30e35c36080d80fdec5c57abf8e310ae14b', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, hAsync("input", { key: 'a45c26da379bff48830f0b03ceebcf24b06c3b17', class: "digi-form-checkbox__input", ref: (el) => {
20842
+ return (hAsync(Host, { key: 'e8ca1dfe96537dd438a4b6c206adfc7c9fd64d9c', tabindex: -1 }, hAsync("div", { key: '850911b7ffdcea222b12c2c883cf93b63f703b4f', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, hAsync("input", { key: '923a49d0402e6b3034d3e8e6d43033692695c830', class: "digi-form-checkbox__input", ref: (el) => {
20839
20843
  var _a;
20840
20844
  this._input = el;
20841
20845
  (_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
@@ -20843,7 +20847,7 @@ class FormCheckbox {
20843
20847
  ? null
20844
20848
  : `${this.afAriaDescribedby ? `${this.afAriaDescribedby} ` : ''}${this.afDescription ? `${this.afId}-description` : ''}`, "aria-labelledby": this.afAriaLabelledby, "aria-label": this.afAriaLabel, "aria-invalid": this.afValidation === FormCheckboxValidation.ERROR
20845
20849
  ? 'true'
20846
- : '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 }), hAsync("label", { key: '54cd68f1c10fd023e9dd81bd0fabb2920b911c12', htmlFor: this.afId, class: "digi-form-checkbox__label" }, hAsync("span", { key: 'c7184f48868d38d04485a48f214cc3c37d862ba4', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (hAsync("p", { key: 'afc00a7de3cef740bdbf23607cd9247887752759', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
20850
+ : '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 }), hAsync("label", { key: 'dccbd4e83dbc757483a18ac22d1539ef83dfb534', htmlFor: this.afId, class: "digi-form-checkbox__label" }, hAsync("span", { key: '1cbc88be9d74dab3e04472bc9462712377447d4a', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (hAsync("p", { key: 'bdab264d9d13520858c581d2664c0d53171a1415', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
20847
20851
  }
20848
20852
  get hostElement() { return getElement(this); }
20849
20853
  static get watchers() { return {
@@ -20886,6 +20890,20 @@ class FormCheckbox {
20886
20890
  }; }
20887
20891
  }
20888
20892
 
20893
+ /**
20894
+ * Small utility for adding Stencil component scope to dynamically inserted elements
20895
+ * (e.g. svg for title logotypes)
20896
+ */
20897
+ function applyStencilScope(host, root) {
20898
+ const scopeClasses = [...host.classList].filter(c => c.startsWith('sc-'));
20899
+ if (!scopeClasses.length)
20900
+ return;
20901
+ root.classList.add(...scopeClasses);
20902
+ root.querySelectorAll('*').forEach(el => {
20903
+ el.classList.add(...scopeClasses);
20904
+ });
20905
+ }
20906
+
20889
20907
  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)}";
20890
20908
  var DigiFormErrorListStyle0 = formErrorListCss;
20891
20909
 
@@ -20912,6 +20930,24 @@ class FormErrorList {
20912
20930
  async afMSetHeadingFocus() {
20913
20931
  this.setHeadingFocus();
20914
20932
  }
20933
+ connectedCallback() {
20934
+ this.observer = new MutationObserver((mutations) => {
20935
+ const hasChildChanges = mutations.some(mutation => mutation.type === 'childList');
20936
+ if (hasChildChanges) {
20937
+ const hostElement = this.hostElement.querySelector('.digi-form-error-list');
20938
+ applyStencilScope(hostElement, hostElement);
20939
+ }
20940
+ });
20941
+ this.observer.observe(this.hostElement, {
20942
+ childList: true,
20943
+ subtree: true
20944
+ });
20945
+ }
20946
+ disconnectedCallback() {
20947
+ if (this.observer) {
20948
+ this.observer.disconnect();
20949
+ }
20950
+ }
20915
20951
  componentDidLoad() {
20916
20952
  this.setHeadingFocus();
20917
20953
  this.afOnReady.emit();
@@ -20938,7 +20974,7 @@ class FormErrorList {
20938
20974
  this.afOnClickLink.emit({ id });
20939
20975
  }
20940
20976
  render() {
20941
- return (hAsync("div", { key: '59bc43d4b3dd0149647b50203cc1ae585d829006', class: "digi-form-error-list", id: this.afId }, hAsync("digi-notification-alert", { key: 'a2b034276ff7549c9c0711202020e3753da7808d', ref: (el) => (this._notificationAlert = el), "af-heading": this.afHeading, "af-heading-level": this.afHeadingLevel, "af-variation": NotificationAlertVariation.DANGER }, this.afDescription && (hAsync("digi-typography", { key: '3a61c65373b92a73694770f851c6727e27f853e7', "af-variation": TypographyVariation.SMALL }, hAsync("p", { key: 'a088b4d084f5a6db85cedcb4f469f4dff803f8f6', class: "digi-form-error-list__description" }, this.afDescription))), hAsync("slot", { key: '794c42cdece0d06945255b70a96a6992eb4dcd4c' }))));
20977
+ return (hAsync("div", { key: '9471a904e95c6304644d884e15aac90d3b0fbad1', class: "digi-form-error-list", id: this.afId }, hAsync("digi-notification-alert", { key: '13a8bf3037570f929f470cc2a531156d552ca53a', ref: (el) => (this._notificationAlert = el), "af-heading": this.afHeading, "af-heading-level": this.afHeadingLevel, "af-variation": NotificationAlertVariation.DANGER }, this.afDescription && (hAsync("digi-typography", { key: '8e8ef106286f426b0cbcfd904407582e79e8ce24', "af-variation": TypographyVariation.SMALL }, hAsync("p", { key: '51175a8da94efe46a262ce365994aa3c23983f2e', class: "digi-form-error-list__description" }, this.afDescription))), hAsync("slot", { key: 'b9f5287d0e2c0326100a094a48fa5e7ab314b92f' }))));
20942
20978
  }
20943
20979
  get hostElement() { return getElement(this); }
20944
20980
  static get style() { return DigiFormErrorListStyle0; }
@@ -21118,6 +21154,7 @@ class FormFileUpload {
21118
21154
  * @en Import array with files without triggering upload event. A file object needs to contain an id, status and the file itself.
21119
21155
  */
21120
21156
  async afMImportFiles(files) {
21157
+ this.resetErrors();
21121
21158
  if (files && files.length > 0) {
21122
21159
  for (const importedFile of files) {
21123
21160
  this.validateFile(importedFile);
@@ -21132,6 +21169,14 @@ class FormFileUpload {
21132
21169
  async afMGetFormControlElement() {
21133
21170
  return this._input;
21134
21171
  }
21172
+ /**
21173
+ * Rensar komponentens fillista och eventuella felmeddelanden.
21174
+ * @en Clears the component's file list and any error messages.
21175
+ */
21176
+ async afMClearFiles() {
21177
+ this.files = [];
21178
+ this.resetErrors();
21179
+ }
21135
21180
  /**
21136
21181
  * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
21137
21182
  * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
@@ -21179,7 +21224,11 @@ class FormFileUpload {
21179
21224
  let exist = false;
21180
21225
  if (this.files.length > 0) {
21181
21226
  this.files.forEach((file) => {
21182
- if (file.name === fileToCheck.name) {
21227
+ if (file['id'] === fileToCheck['id']) {
21228
+ exist = true;
21229
+ return;
21230
+ }
21231
+ else if (file.name === fileToCheck.name) {
21183
21232
  exist = true;
21184
21233
  }
21185
21234
  });
@@ -21563,22 +21612,22 @@ class FormFileUpload {
21563
21612
  } }, this.renderFiles())));
21564
21613
  }
21565
21614
  render() {
21566
- return (hAsync(Fragment, { key: '1104991979216e10bd2e137de392134a9dd970f3' }, hAsync("digi-util-breakpoint-observer", { key: '645a8f2849a39c068b77fa7c6ddfd726e834b3b2', onAfOnChange: (e) => this.breakpointHandler(e) }), hAsync("div", { key: 'c6b2785961f0e0b0cb2b2ccb7da42d663b9e9e3b', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, hAsync("digi-form-label", { key: 'd51e788ee53461e075b0f73b600608646c70032f', afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), hAsync("div", { key: '9df4b7deaca899f1c06bf615065a2fce7eea4bc0', class: {
21615
+ return (hAsync(Fragment, { key: 'bec280d44d534a720927ab737b34335600c3fe80' }, hAsync("digi-util-breakpoint-observer", { key: '93983b718eda1869ff95f7a0abe8c6704395a1e0', onAfOnChange: (e) => this.breakpointHandler(e) }), hAsync("div", { key: '23f30473aa0dd681c6c4ea20138d3f13391bb070', class: Object.assign({ 'digi-form-file-upload': true }, this.cssModifiers) }, hAsync("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 }), hAsync("div", { key: 'db1082e11bafb320c13a790d639d37ca821617ac', class: {
21567
21616
  'digi-form-file-upload__upload-area': true,
21568
21617
  'digi-form-file-upload__upload-area--hover': this.fileHover
21569
21618
  }, 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 &&
21570
- this.afVariation != FormFileUploadVariation.SMALL && (hAsync("div", { key: '8c35b4e2523db4f4f892d2f615caedb8bb3a9ebe', class: "digi-form-file-upload__upload-area-overlay" })), hAsync("div", { key: '096b05c159ce7722687cdc0b1a0ff4889a5485e2', class: "digi-form-file-upload__text-area" }, hAsync("button", { key: '97504d954e2f3a0e76d99fb4d5049ddea108a32f', type: "button", id: this.afId + '-button', ref: (el) => {
21619
+ this.afVariation != FormFileUploadVariation.SMALL && (hAsync("div", { key: 'f58d5f61b5568263e9b60b255f47e6ef418c78e5', class: "digi-form-file-upload__upload-area-overlay" })), hAsync("div", { key: 'c58c52f7e2c8aa8d17fe510ef90435d488844237', class: "digi-form-file-upload__text-area" }, hAsync("button", { key: '1bb7fa84e0778702d0e77008f7d468d560ac8e17', type: "button", id: this.afId + '-button', ref: (el) => {
21571
21620
  this._uploadButton = el;
21572
21621
  }, onClick: (e) => this.handleInputClick(e), class: "digi-form-file-upload__button hidden_mobile", style: {
21573
21622
  margin: '0'
21574
- } }, hAsync("digi-icon-paperclip", { key: 'e47597d6988db6a71c22fb9ab4cfa877be4a48fa', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
21623
+ } }, hAsync("digi-icon-paperclip", { key: 'a84b67ad055682b1c1b013ec948af0935c35ed0c', "aria-hidden": "true", class: "digi-form-file-upload__button-icon paper-clip", slot: "icon" }), this.afUploadBtnText
21575
21624
  ? this.afUploadBtnText
21576
- : _t.form.file_choose), hAsync("input", { key: 'b21162f7873e21a8b3ed2d286ef154b66b95c8ec', ref: (el) => {
21625
+ : _t.form.file_choose), hAsync("input", { key: 'd0babe3bcbc5d03f2436c0f4a7ee23a93ecb0474', ref: (el) => {
21577
21626
  this._input = el;
21578
- }, 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" }), hAsync("span", { key: 'c8e448ef96e9d4f292ec88606526e06935192308' }, this.afVariation !== FormFileUploadVariation.SMALL &&
21579
- _t.form.file_dropzone))), hAsync("p", { key: '8c6f1b6190eb4f87bbcd9d50f4c4929cdcf4c026', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
21627
+ }, 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" }), hAsync("span", { key: '20a4158d0462ee2f871bddb57b9e168d356573ed' }, this.afVariation !== FormFileUploadVariation.SMALL &&
21628
+ _t.form.file_dropzone))), hAsync("p", { key: 'ade6d22fde218536ce42daff285a1605ac16bdb1', class: "visually-hidden", role: this.errorMessageIsAlert ? 'alert' : null, "aria-atomic": "true", ref: (el) => {
21580
21629
  this._srTextContainer = el;
21581
- } }), (this.files.length > 0 || this.error) && (hAsync("div", { key: '7faefe886463ce493824665375b3b4ab0aec5753', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
21630
+ } }), (this.files.length > 0 || this.error) && (hAsync("div", { key: '06044ba8e2a5d7e76374af1dfa479c891554ab45', class: "digi-form-file-upload__files" }, this.renderErrorMessage(), this.renderFileContainer())))));
21582
21631
  }
21583
21632
  get hostElement() { return getElement(this); }
21584
21633
  static get watchers() { return {
@@ -21622,7 +21671,8 @@ class FormFileUpload {
21622
21671
  "afMGetAllFiles": [64],
21623
21672
  "afMGetValidationState": [64],
21624
21673
  "afMImportFiles": [64],
21625
- "afMGetFormControlElement": [64]
21674
+ "afMGetFormControlElement": [64],
21675
+ "afMClearFiles": [64]
21626
21676
  },
21627
21677
  "$listeners$": [[0, "focus", "focusOnInput"]],
21628
21678
  "$lazyBundleId$": "-",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@designsystem-se/af",
3
3
  "author": "Arbetsförmedlingen",
4
- "version": "38.0.1-beta.2",
4
+ "version": "38.2.0",
5
5
  "description": "Web Components for Digi Designsystem",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./dist/index.cjs.js",