@designsystem-se/af 38.1.0 → 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 (33) 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-filter.js +1 -1
  5. package/components/{p-13c09880.js → p-f84f590e.js} +2 -2
  6. package/custom-elements.json +9 -1
  7. package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
  8. package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +8 -6
  9. package/dist/cjs/digi-form-checkbox.cjs.entry.js +2 -2
  10. package/dist/cjs/digi-form-error-list.cjs.entry.js +33 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/collection/components/_calendar/calendar-datepicker/calendar-datepicker.js +53 -6
  13. package/dist/collection/components/_form/form-checkbox/form-checkbox.js +8 -5
  14. package/dist/collection/components/_form/form-error-list/form-error-list.js +20 -1
  15. package/dist/collection/design-tokens/components/_logo.variables.scss +17 -15
  16. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
  17. package/dist/digi-arbetsformedlingen/{p-37c0ea9e.entry.js → p-2295239c.entry.js} +1 -1
  18. package/dist/digi-arbetsformedlingen/p-42ae53aa.entry.js +1 -0
  19. package/dist/digi-arbetsformedlingen/p-7f155bd5.entry.js +1 -0
  20. package/dist/esm/digi-arbetsformedlingen.js +1 -1
  21. package/dist/esm/digi-calendar-datepicker.entry.js +8 -6
  22. package/dist/esm/digi-form-checkbox.entry.js +2 -2
  23. package/dist/esm/digi-form-error-list.entry.js +33 -1
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/types/components/_calendar/calendar-datepicker/calendar-datepicker.d.ts +10 -0
  26. package/dist/types/components/_form/form-checkbox/form-checkbox.d.ts +5 -2
  27. package/dist/types/components/_form/form-error-list/form-error-list.d.ts +3 -0
  28. package/dist/types/components.d.ts +24 -4
  29. package/hydrate/index.js +45 -9
  30. package/hydrate/index.mjs +45 -9
  31. package/package.json +1 -1
  32. package/dist/digi-arbetsformedlingen/p-ef689144.entry.js +0 -1
  33. package/dist/digi-arbetsformedlingen/p-f0a405ca.entry.js +0 -1
@@ -2213,6 +2213,8 @@ const CalendarDatepicker = class {
2213
2213
  this.afCloseOnSelect = false;
2214
2214
  this.afOpenCalendarTo = undefined;
2215
2215
  this.afErrorMessageIsAlert = true;
2216
+ this.afAnnounceIfOptional = false;
2217
+ this.afAnnounceIfOptionalText = undefined;
2216
2218
  }
2217
2219
  afDisableValidationChangeHandler(newVal) {
2218
2220
  if (!newVal) {
@@ -2544,9 +2546,9 @@ const CalendarDatepicker = class {
2544
2546
  return this.afSelectedDates;
2545
2547
  }
2546
2548
  render() {
2547
- return (h(Host, { key: '6b080d933e012fe050aee0181f927c3252b0bb7e', tabindex: -1 }, h("div", { key: 'ec59a7f209f7a5e06c62d4443fbca980b1030d12', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, h("div", { key: '2bf3bd4f0a82c14c4fb04610dab19767fbba595d', class: "digi-calendar-datepicker__input-field" }, h("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()
2549
+ return (h(Host, { key: 'a22b366eece8bdf2a6d66ba7b4561093391ad16d', tabindex: -1 }, h("div", { key: '5ec3557df78bb012f2e10f1852252e78e2470ee3', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, h("div", { key: '1215a13021718ac98ad2a4a7a5bae3c456385124', class: "digi-calendar-datepicker__input-field" }, 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()
2548
2550
  ? FormInputValidation.ERROR
2549
- : this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, onAfOnChange: (evt) => {
2551
+ : 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) => {
2550
2552
  evt.stopImmediatePropagation();
2551
2553
  this.parseInput(evt);
2552
2554
  }, onAfOnBlur: (evt) => {
@@ -2561,11 +2563,11 @@ const CalendarDatepicker = class {
2561
2563
  e.preventDefault();
2562
2564
  const focusableDateButton = this.hostElement.querySelector('.digi-calendar__date[tabindex="0"]');
2563
2565
  focusableDateButton === null || focusableDateButton === void 0 ? void 0 : focusableDateButton.focus();
2564
- } }, h("button", { key: '04df5ccb789271d7ba2f693b740f316301f9fae0', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
2566
+ } }, h("button", { key: 'c953ddf0c99cfd3b892941da7da4a887b342fd78', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
2565
2567
  ? this.afCloseCalendarAriaLabel
2566
- : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, h("digi-icon-calendar-alt", { key: '65b9a472f629bbaa46a64c8a304f358da76b0830', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), h("div", { key: 'd0df89ce680bb2a0ca7f311b2c0ead0f72dc30b6', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, h("p", { key: '9796876e15e88b1599d772863c29fc472da24c69', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
2568
+ : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, h("digi-icon-calendar-alt", { key: '46c7387d404b77911b97f31c10e7147bd436c7e3', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), h("div", { key: '91894a4219afa79d913f558f5d1cc6b410b535ce', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, h("p", { key: '989fc17ea7a95aa014a26e09f7db7f59fe53a36b', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
2567
2569
  ? `${_t.calendar.screenReaderInstructions}${this.screenReaderUpdateTrigger ? '\u200B' : ''}`
2568
- : ''), h("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) => {
2570
+ : ''), 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) => {
2569
2571
  evt.stopImmediatePropagation();
2570
2572
  this.parseCalendar(evt);
2571
2573
  }, onKeyDown: (e) => {
@@ -2576,7 +2578,7 @@ const CalendarDatepicker = class {
2576
2578
  return;
2577
2579
  e.preventDefault();
2578
2580
  this.focusOnCalendarInput();
2579
- } })), this.afCloseOnSelect && !this.afMultipleDates && (h("div", { key: 'fc150d20f14731e8f67f38c6042e8af4e24eae38', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
2581
+ } })), this.afCloseOnSelect && !this.afMultipleDates && (h("div", { key: 'd9f3eb470b29a0ab96134f1e4666743efacd7448', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
2580
2582
  ? `${_t.calendar.datepicker.selectedDate}: ${this.datesToInputString(this.afSelectedDates)}`
2581
2583
  : '')))));
2582
2584
  }
@@ -114,7 +114,7 @@ const FormCheckbox = class {
114
114
  this.afOnInput.emit(e);
115
115
  }
116
116
  render() {
117
- return (h(Host, { key: '93a52532d5ee8e2b89982b3d06509c16b3656bce', tabindex: -1 }, h("div", { key: '3f2fe30e35c36080d80fdec5c57abf8e310ae14b', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, h("input", { key: 'a45c26da379bff48830f0b03ceebcf24b06c3b17', class: "digi-form-checkbox__input", ref: (el) => {
117
+ return (h(Host, { key: 'e8ca1dfe96537dd438a4b6c206adfc7c9fd64d9c', tabindex: -1 }, h("div", { key: '850911b7ffdcea222b12c2c883cf93b63f703b4f', class: Object.assign({ 'digi-form-checkbox': true }, this.cssModifiers) }, h("input", { key: '923a49d0402e6b3034d3e8e6d43033692695c830', class: "digi-form-checkbox__input", ref: (el) => {
118
118
  var _a;
119
119
  this._input = el;
120
120
  (_a = this === null || this === void 0 ? void 0 : this.afInputRef) === null || _a === void 0 ? void 0 : _a.call(this, el);
@@ -122,7 +122,7 @@ const FormCheckbox = class {
122
122
  ? null
123
123
  : `${this.afAriaDescribedby ? `${this.afAriaDescribedby} ` : ''}${this.afDescription ? `${this.afId}-description` : ''}`, "aria-labelledby": this.afAriaLabelledby, "aria-label": this.afAriaLabel, "aria-invalid": this.afValidation === FormCheckboxValidation.ERROR
124
124
  ? 'true'
125
- : '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 }), h("label", { key: '54cd68f1c10fd023e9dd81bd0fabb2920b911c12', htmlFor: this.afId, class: "digi-form-checkbox__label" }, h("span", { key: 'c7184f48868d38d04485a48f214cc3c37d862ba4', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (h("p", { key: 'afc00a7de3cef740bdbf23607cd9247887752759', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
125
+ : '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 }), h("label", { key: 'dccbd4e83dbc757483a18ac22d1539ef83dfb534', htmlFor: this.afId, class: "digi-form-checkbox__label" }, h("span", { key: '1cbc88be9d74dab3e04472bc9462712377447d4a', class: "digi-form-checkbox__box" }), this.afLabel), !!this.afDescription && (h("p", { key: 'bdab264d9d13520858c581d2664c0d53171a1415', id: `${this.afId}-description`, class: "digi-form-checkbox__description" }, this.afDescription)))));
126
126
  }
127
127
  get hostElement() { return getElement(this); }
128
128
  static get watchers() { return {
@@ -48,6 +48,20 @@ import './typography-meta-variation.enum-1f7c2878.js';
48
48
  import './typography-time-variation.enum-34c830ef.js';
49
49
  import './util-breakpoint-observer-breakpoints.enum-6d004731.js';
50
50
 
51
+ /**
52
+ * Small utility for adding Stencil component scope to dynamically inserted elements
53
+ * (e.g. svg for title logotypes)
54
+ */
55
+ function applyStencilScope(host, root) {
56
+ const scopeClasses = [...host.classList].filter(c => c.startsWith('sc-'));
57
+ if (!scopeClasses.length)
58
+ return;
59
+ root.classList.add(...scopeClasses);
60
+ root.querySelectorAll('*').forEach(el => {
61
+ el.classList.add(...scopeClasses);
62
+ });
63
+ }
64
+
51
65
  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)}";
52
66
  const DigiFormErrorListStyle0 = formErrorListCss;
53
67
 
@@ -70,6 +84,24 @@ const FormErrorList = class {
70
84
  async afMSetHeadingFocus() {
71
85
  this.setHeadingFocus();
72
86
  }
87
+ connectedCallback() {
88
+ this.observer = new MutationObserver((mutations) => {
89
+ const hasChildChanges = mutations.some(mutation => mutation.type === 'childList');
90
+ if (hasChildChanges) {
91
+ const hostElement = this.hostElement.querySelector('.digi-form-error-list');
92
+ applyStencilScope(hostElement, hostElement);
93
+ }
94
+ });
95
+ this.observer.observe(this.hostElement, {
96
+ childList: true,
97
+ subtree: true
98
+ });
99
+ }
100
+ disconnectedCallback() {
101
+ if (this.observer) {
102
+ this.observer.disconnect();
103
+ }
104
+ }
73
105
  componentDidLoad() {
74
106
  this.setHeadingFocus();
75
107
  this.afOnReady.emit();
@@ -96,7 +128,7 @@ const FormErrorList = class {
96
128
  this.afOnClickLink.emit({ id });
97
129
  }
98
130
  render() {
99
- return (h("div", { key: '59bc43d4b3dd0149647b50203cc1ae585d829006', class: "digi-form-error-list", id: this.afId }, h("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 && (h("digi-typography", { key: '3a61c65373b92a73694770f851c6727e27f853e7', "af-variation": TypographyVariation.SMALL }, h("p", { key: 'a088b4d084f5a6db85cedcb4f469f4dff803f8f6', class: "digi-form-error-list__description" }, this.afDescription))), h("slot", { key: '794c42cdece0d06945255b70a96a6992eb4dcd4c' }))));
131
+ return (h("div", { key: '9471a904e95c6304644d884e15aac90d3b0fbad1', class: "digi-form-error-list", id: this.afId }, h("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 && (h("digi-typography", { key: '8e8ef106286f426b0cbcfd904407582e79e8ce24', "af-variation": TypographyVariation.SMALL }, h("p", { key: '51175a8da94efe46a262ce365994aa3c23983f2e', class: "digi-form-error-list__description" }, this.afDescription))), h("slot", { key: 'b9f5287d0e2c0326100a094a48fa5e7ab314b92f' }))));
100
132
  }
101
133
  get hostElement() { return getElement(this); }
102
134
  };