@kirbydesign/designsystem 10.3.1 → 10.4.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 (128) hide show
  1. package/README.md +7 -0
  2. package/calendar/calendar.component.d.ts.map +1 -1
  3. package/checkbox/checkbox.component.d.ts +5 -3
  4. package/checkbox/checkbox.component.d.ts.map +1 -1
  5. package/config/index.d.ts +6 -0
  6. package/config/kirbydesign-designsystem-config.d.ts.map +1 -0
  7. package/config/provide-kirby.d.ts +27 -0
  8. package/config/provide-kirby.d.ts.map +1 -0
  9. package/config/public_api.d.ts +2 -0
  10. package/config/public_api.d.ts.map +1 -0
  11. package/dropdown/dropdown.module.d.ts +2 -1
  12. package/dropdown/dropdown.module.d.ts.map +1 -1
  13. package/fesm2022/kirbydesign-designsystem-accordion.mjs +12 -12
  14. package/fesm2022/kirbydesign-designsystem-action-group.mjs +4 -4
  15. package/fesm2022/kirbydesign-designsystem-avatar.mjs +4 -4
  16. package/fesm2022/kirbydesign-designsystem-badge.mjs +4 -4
  17. package/fesm2022/kirbydesign-designsystem-button.mjs +4 -4
  18. package/fesm2022/kirbydesign-designsystem-calendar.mjs +8 -7
  19. package/fesm2022/kirbydesign-designsystem-calendar.mjs.map +1 -1
  20. package/fesm2022/kirbydesign-designsystem-card.mjs +18 -18
  21. package/fesm2022/kirbydesign-designsystem-card.mjs.map +1 -1
  22. package/fesm2022/kirbydesign-designsystem-chart.mjs +23 -23
  23. package/fesm2022/kirbydesign-designsystem-checkbox.mjs +13 -8
  24. package/fesm2022/kirbydesign-designsystem-checkbox.mjs.map +1 -1
  25. package/fesm2022/kirbydesign-designsystem-config.mjs +37 -0
  26. package/fesm2022/kirbydesign-designsystem-config.mjs.map +1 -0
  27. package/fesm2022/kirbydesign-designsystem-data-table.mjs +8 -8
  28. package/fesm2022/kirbydesign-designsystem-divider.mjs +4 -4
  29. package/fesm2022/kirbydesign-designsystem-dropdown.mjs +18 -15
  30. package/fesm2022/kirbydesign-designsystem-dropdown.mjs.map +1 -1
  31. package/fesm2022/kirbydesign-designsystem-empty-state.mjs +9 -9
  32. package/fesm2022/kirbydesign-designsystem-empty-state.mjs.map +1 -1
  33. package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs +5 -5
  34. package/fesm2022/kirbydesign-designsystem-flag.mjs +4 -4
  35. package/fesm2022/kirbydesign-designsystem-form-field.mjs +143 -70
  36. package/fesm2022/kirbydesign-designsystem-form-field.mjs.map +1 -1
  37. package/fesm2022/kirbydesign-designsystem-header.mjs +21 -21
  38. package/fesm2022/kirbydesign-designsystem-header.mjs.map +1 -1
  39. package/fesm2022/kirbydesign-designsystem-helpers.mjs +9 -9
  40. package/fesm2022/kirbydesign-designsystem-icon.mjs +11 -12
  41. package/fesm2022/kirbydesign-designsystem-icon.mjs.map +1 -1
  42. package/fesm2022/kirbydesign-designsystem-item-group.mjs +4 -4
  43. package/fesm2022/kirbydesign-designsystem-item-sliding.mjs +4 -4
  44. package/fesm2022/kirbydesign-designsystem-item.mjs +11 -11
  45. package/fesm2022/kirbydesign-designsystem-kirby-app.mjs +8 -8
  46. package/fesm2022/kirbydesign-designsystem-list.mjs +41 -41
  47. package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs +7 -7
  48. package/fesm2022/kirbydesign-designsystem-menu.mjs +5 -5
  49. package/fesm2022/kirbydesign-designsystem-modal.mjs +45 -47
  50. package/fesm2022/kirbydesign-designsystem-modal.mjs.map +1 -1
  51. package/fesm2022/kirbydesign-designsystem-page.mjs +86 -47
  52. package/fesm2022/kirbydesign-designsystem-page.mjs.map +1 -1
  53. package/fesm2022/kirbydesign-designsystem-popover.mjs +4 -4
  54. package/fesm2022/kirbydesign-designsystem-progress-circle.mjs +7 -7
  55. package/fesm2022/kirbydesign-designsystem-radio.mjs +36 -18
  56. package/fesm2022/kirbydesign-designsystem-radio.mjs.map +1 -1
  57. package/fesm2022/kirbydesign-designsystem-range.mjs +4 -4
  58. package/fesm2022/kirbydesign-designsystem-reorder-list.mjs +4 -4
  59. package/fesm2022/kirbydesign-designsystem-router-outlet.mjs +8 -8
  60. package/fesm2022/kirbydesign-designsystem-section-header.mjs +4 -4
  61. package/fesm2022/kirbydesign-designsystem-shared-floating.mjs +4 -4
  62. package/fesm2022/kirbydesign-designsystem-shared-portal.mjs +4 -4
  63. package/fesm2022/kirbydesign-designsystem-shared.mjs +65 -23
  64. package/fesm2022/kirbydesign-designsystem-shared.mjs.map +1 -1
  65. package/fesm2022/kirbydesign-designsystem-slide-button.mjs +4 -4
  66. package/fesm2022/kirbydesign-designsystem-slide.mjs +14 -14
  67. package/fesm2022/kirbydesign-designsystem-spinner.mjs +8 -8
  68. package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs +11 -11
  69. package/fesm2022/kirbydesign-designsystem-tabs.mjs +14 -14
  70. package/fesm2022/kirbydesign-designsystem-testing-base.mjs +287 -287
  71. package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs +4 -4
  72. package/fesm2022/kirbydesign-designsystem-testing-jest.mjs +4 -4
  73. package/fesm2022/kirbydesign-designsystem-testing.mjs +4 -4
  74. package/fesm2022/kirbydesign-designsystem-toast.mjs +6 -6
  75. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs +77 -9
  76. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs.map +1 -1
  77. package/fesm2022/kirbydesign-designsystem-toggle.mjs +50 -19
  78. package/fesm2022/kirbydesign-designsystem-toggle.mjs.map +1 -1
  79. package/fesm2022/kirbydesign-designsystem-types.mjs +3 -3
  80. package/fesm2022/kirbydesign-designsystem.mjs +84 -26
  81. package/fesm2022/kirbydesign-designsystem.mjs.map +1 -1
  82. package/form-field/form-field.component.d.ts +21 -6
  83. package/form-field/form-field.component.d.ts.map +1 -1
  84. package/form-field/input/input.component.d.ts +11 -7
  85. package/form-field/input/input.component.d.ts.map +1 -1
  86. package/form-field/textarea/textarea.component.d.ts +8 -4
  87. package/form-field/textarea/textarea.component.d.ts.map +1 -1
  88. package/icon/kirby-icon-settings.d.ts.map +1 -1
  89. package/lib/components/segmented-control/segmented-control.component.d.ts +35 -1
  90. package/lib/components/segmented-control/segmented-control.component.d.ts.map +1 -1
  91. package/lib/index.d.ts +1 -1
  92. package/lib/index.d.ts.map +1 -1
  93. package/lib/kirby.module.d.ts +45 -48
  94. package/lib/kirby.module.d.ts.map +1 -1
  95. package/modal/modal/modal-component/modal.component.d.ts.map +1 -1
  96. package/package.json +40 -40
  97. package/page/page.component.d.ts +9 -2
  98. package/page/page.component.d.ts.map +1 -1
  99. package/radio/radio-group/radio-group.component.d.ts +13 -5
  100. package/radio/radio-group/radio-group.component.d.ts.map +1 -1
  101. package/readme.md +1 -1
  102. package/shared/controls/label-helpers.d.ts +13 -0
  103. package/shared/controls/label-helpers.d.ts.map +1 -1
  104. package/shared/fit-heading/fit-heading.directive.d.ts +1 -1
  105. package/shared/fit-heading/fit-heading.directive.d.ts.map +1 -1
  106. package/shared/translation/translation.interface.d.ts +1 -0
  107. package/shared/translation/translation.interface.d.ts.map +1 -1
  108. package/shared/translation/translation.service.d.ts.map +1 -1
  109. package/shared/translation/translations/da.d.ts.map +1 -1
  110. package/shared/translation/translations/de.d.ts +3 -0
  111. package/shared/translation/translations/de.d.ts.map +1 -0
  112. package/shared/translation/translations/en.d.ts.map +1 -1
  113. package/toggle/toggle.component.d.ts +13 -6
  114. package/toggle/toggle.component.d.ts.map +1 -1
  115. package/toggle-button/toggle-button.component.d.ts +35 -1
  116. package/toggle-button/toggle-button.component.d.ts.map +1 -1
  117. package/types/form-field-control.d.ts +6 -0
  118. package/types/form-field-control.d.ts.map +1 -0
  119. package/types/public_api.d.ts +1 -0
  120. package/types/public_api.d.ts.map +1 -1
  121. package/fesm2022/kirbydesign-designsystem-kirby-ionic-module.mjs +0 -30
  122. package/fesm2022/kirbydesign-designsystem-kirby-ionic-module.mjs.map +0 -1
  123. package/kirby-ionic-module/index.d.ts +0 -6
  124. package/kirby-ionic-module/kirby-ionic.module.d.ts +0 -7
  125. package/kirby-ionic-module/kirby-ionic.module.d.ts.map +0 -1
  126. package/kirby-ionic-module/kirbydesign-designsystem-kirby-ionic-module.d.ts.map +0 -1
  127. package/kirby-ionic-module/public_api.d.ts +0 -2
  128. package/kirby-ionic-module/public_api.d.ts.map +0 -1
@@ -91,11 +91,11 @@ const MOCK_PROVIDERS = [
91
91
  // eslint-disable-next-line @typescript-eslint/triple-slash-reference
92
92
  /// <reference path='../../../../../node_modules/@types/jasmine/index.d.ts' />
93
93
  class KirbyTestingModule {
94
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
95
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, imports: [KirbyTestingBaseModule], exports: [KirbyTestingBaseModule] }); }
96
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, providers: [...MOCK_PROVIDERS], imports: [KirbyTestingBaseModule, KirbyTestingBaseModule] }); }
94
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
95
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, imports: [KirbyTestingBaseModule], exports: [KirbyTestingBaseModule] }); }
96
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, providers: [...MOCK_PROVIDERS], imports: [KirbyTestingBaseModule, KirbyTestingBaseModule] }); }
97
97
  }
98
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, decorators: [{
98
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, decorators: [{
99
99
  type: NgModule,
100
100
  args: [{
101
101
  imports: [KirbyTestingBaseModule],
@@ -97,11 +97,11 @@ const MOCK_PROVIDERS = [
97
97
  // eslint-disable-next-line @typescript-eslint/triple-slash-reference
98
98
  /// <reference path='../../../../../node_modules/@types/jest/index.d.ts' />
99
99
  class KirbyTestingModule {
100
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
101
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, imports: [KirbyTestingBaseModule], exports: [KirbyTestingBaseModule] }); }
102
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, providers: [...MOCK_PROVIDERS], imports: [KirbyTestingBaseModule, KirbyTestingBaseModule] }); }
100
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
101
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, imports: [KirbyTestingBaseModule], exports: [KirbyTestingBaseModule] }); }
102
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, providers: [...MOCK_PROVIDERS], imports: [KirbyTestingBaseModule, KirbyTestingBaseModule] }); }
103
103
  }
104
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: KirbyTestingModule, decorators: [{
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: KirbyTestingModule, decorators: [{
105
105
  type: NgModule,
106
106
  args: [{
107
107
  imports: [KirbyTestingBaseModule],
@@ -5,11 +5,11 @@ import { provideIonicAngular } from '@ionic/angular/standalone';
5
5
  import { componentOnReady } from '@ionic/core';
6
6
 
7
7
  class IonicTestingModule {
8
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: IonicTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: IonicTestingModule }); }
10
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: IonicTestingModule, providers: [provideIonicAngular({ mode: 'ios', _testing: true })] }); }
8
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: IonicTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: IonicTestingModule }); }
10
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: IonicTestingModule, providers: [provideIonicAngular({ mode: 'ios', _testing: true })] }); }
11
11
  }
12
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: IonicTestingModule, decorators: [{
12
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: IonicTestingModule, decorators: [{
13
13
  type: NgModule,
14
14
  args: [{
15
15
  providers: [provideIonicAngular({ mode: 'ios', _testing: true })],
@@ -30,10 +30,10 @@ class ToastHelper {
30
30
  }
31
31
  return cssClass;
32
32
  }
33
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastHelper, deps: [{ token: i1.ToastController }], target: i0.ɵɵFactoryTarget.Injectable }); }
34
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastHelper }); }
33
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastHelper, deps: [{ token: i1.ToastController }], target: i0.ɵɵFactoryTarget.Injectable }); }
34
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastHelper }); }
35
35
  }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastHelper, decorators: [{
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastHelper, decorators: [{
37
37
  type: Injectable
38
38
  }], ctorParameters: () => [{ type: i1.ToastController }] });
39
39
 
@@ -48,10 +48,10 @@ class ToastController {
48
48
  }
49
49
  });
50
50
  }
51
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastController, deps: [{ token: ToastHelper }], target: i0.ɵɵFactoryTarget.Injectable }); }
52
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastController }); }
51
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastController, deps: [{ token: ToastHelper }], target: i0.ɵɵFactoryTarget.Injectable }); }
52
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastController }); }
53
53
  }
54
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToastController, decorators: [{
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToastController, decorators: [{
55
55
  type: Injectable
56
56
  }], ctorParameters: () => [{ type: ToastHelper }] });
57
57
 
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostListener, NgModule } from '@angular/core';
2
+ import { EventEmitter, forwardRef, HostListener, Output, Input, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
4
  import * as i1 from '@angular/common';
4
5
  import { CommonModule } from '@angular/common';
5
6
 
@@ -8,6 +9,10 @@ class ToggleButtonComponent {
8
9
  this.elementRef = elementRef;
9
10
  this.cdr = cdr;
10
11
  this.checkChanged = new EventEmitter();
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function
13
+ this.onChange = (_checked) => { };
14
+ // eslint-disable-next-line no-empty-function, @typescript-eslint/no-empty-function
15
+ this.onTouched = () => { };
11
16
  }
12
17
  onClick(event) {
13
18
  const targetElement = event.target;
@@ -15,21 +20,81 @@ class ToggleButtonComponent {
15
20
  if (!buttonEnabled)
16
21
  return;
17
22
  this.checked = !this.checked;
23
+ this.onChange(this.checked);
24
+ this.onTouched();
18
25
  this.checkChanged.emit(this.checked);
19
26
  this.focusToggledButton();
20
27
  }
28
+ onFocusOut() {
29
+ this.onTouched();
30
+ }
21
31
  focusToggledButton() {
22
32
  // force re-render to ensure that the new button is in the dom
23
33
  this.cdr.detectChanges();
24
34
  const buttonToFocus = this.elementRef.nativeElement.querySelector('button[kirby-button]');
25
35
  buttonToFocus?.focus();
26
36
  }
27
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
28
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: ToggleButtonComponent, isStandalone: false, selector: "kirby-toggle-button", inputs: { checked: "checked" }, outputs: { checkChanged: "checkChanged" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0, template: "<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
37
+ /**
38
+ * Sets the toggle button's value. Part of the ControlValueAccessor interface
39
+ * required to integrate with Angular's core forms API.
40
+ *
41
+ * @param checked New value to be written to the model.
42
+ */
43
+ writeValue(checked) {
44
+ if (this.checked !== checked) {
45
+ this.checked = checked;
46
+ this.cdr.markForCheck();
47
+ }
48
+ }
49
+ /**
50
+ * Saves a callback function to be invoked when the toggle button's value
51
+ * changes from user input. Part of the ControlValueAccessor interface
52
+ * required to integrate with Angular's core forms API.
53
+ *
54
+ * @param fn Callback to be triggered when the value changes.
55
+ */
56
+ registerOnChange(fn) {
57
+ this.onChange = fn;
58
+ }
59
+ /**
60
+ * Saves a callback function to be invoked when the toggle button is blurred
61
+ * by the user. Part of the ControlValueAccessor interface required
62
+ * to integrate with Angular's core forms API.
63
+ *
64
+ * @param fn Callback to be triggered when the component has been touched.
65
+ */
66
+ registerOnTouched(fn) {
67
+ this.onTouched = fn;
68
+ }
69
+ /**
70
+ * Disables the toggle button. Part of the ControlValueAccessor interface required
71
+ * to integrate with Angular's core forms API.
72
+ *
73
+ * @param isDisabled Sets whether the component is disabled.
74
+ */
75
+ setDisabledState(isDisabled) {
76
+ this.elementRef.nativeElement
77
+ .querySelector('button[kirby-button]')
78
+ ?.toggleAttribute('disabled', isDisabled);
79
+ }
80
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
81
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: ToggleButtonComponent, isStandalone: false, selector: "kirby-toggle-button", inputs: { checked: "checked" }, outputs: { checkChanged: "checkChanged" }, host: { listeners: { "click": "onClick($event)", "focusout": "onFocusOut()" } }, providers: [
82
+ {
83
+ provide: NG_VALUE_ACCESSOR,
84
+ useExisting: forwardRef((() => ToggleButtonComponent)),
85
+ multi: true,
86
+ },
87
+ ], ngImport: i0, template: "<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
29
88
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonComponent, decorators: [{
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonComponent, decorators: [{
31
90
  type: Component,
32
- args: [{ selector: 'kirby-toggle-button', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n" }]
91
+ args: [{ selector: 'kirby-toggle-button', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, providers: [
92
+ {
93
+ provide: NG_VALUE_ACCESSOR,
94
+ useExisting: forwardRef((() => ToggleButtonComponent)),
95
+ multi: true,
96
+ },
97
+ ], template: "<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n" }]
33
98
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { checked: [{
34
99
  type: Input
35
100
  }], checkChanged: [{
@@ -37,15 +102,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
37
102
  }], onClick: [{
38
103
  type: HostListener,
39
104
  args: ['click', ['$event']]
105
+ }], onFocusOut: [{
106
+ type: HostListener,
107
+ args: ['focusout']
40
108
  }] } });
41
109
 
42
110
  const DECLARATIONS = [ToggleButtonComponent];
43
111
  class ToggleButtonModule {
44
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
45
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonModule, declarations: [ToggleButtonComponent], imports: [CommonModule], exports: [ToggleButtonComponent] }); }
46
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonModule, imports: [CommonModule] }); }
112
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonModule, declarations: [ToggleButtonComponent], imports: [CommonModule], exports: [ToggleButtonComponent] }); }
114
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonModule, imports: [CommonModule] }); }
47
115
  }
48
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleButtonModule, decorators: [{
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleButtonModule, decorators: [{
49
117
  type: NgModule,
50
118
  args: [{
51
119
  declarations: [...DECLARATIONS],
@@ -1 +1 @@
1
- {"version":3,"file":"kirbydesign-designsystem-toggle-button.mjs","sources":["../../toggle-button/src/toggle-button.component.ts","../../toggle-button/src/toggle-button.component.html","../../toggle-button/src/toggle-button.module.ts","../../toggle-button/src/kirbydesign-designsystem-toggle-button.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n Output,\n} from '@angular/core';\n\n@Component({\n selector: 'kirby-toggle-button',\n templateUrl: './toggle-button.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class ToggleButtonComponent {\n @Input() checked: boolean;\n @Output() checkChanged = new EventEmitter<boolean>();\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private cdr: ChangeDetectorRef\n ) {}\n\n @HostListener('click', ['$event'])\n onClick(event: PointerEvent) {\n const targetElement = event.target as HTMLElement;\n const buttonEnabled = targetElement.closest('button[kirby-button]:not(:disabled)');\n\n if (!buttonEnabled) return;\n\n this.checked = !this.checked;\n this.checkChanged.emit(this.checked);\n this.focusToggledButton();\n }\n\n focusToggledButton() {\n // force re-render to ensure that the new button is in the dom\n this.cdr.detectChanges();\n\n const buttonToFocus = this.elementRef.nativeElement.querySelector(\n 'button[kirby-button]'\n ) as HTMLButtonElement;\n\n buttonToFocus?.focus();\n }\n}\n","<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ToggleButtonComponent } from './toggle-button.component';\n\nconst DECLARATIONS = [ToggleButtonComponent];\n\n@NgModule({\n declarations: [...DECLARATIONS],\n imports: [CommonModule],\n exports: [...DECLARATIONS],\n})\nexport class ToggleButtonModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAiBa,qBAAqB,CAAA;IAIhC,WACU,CAAA,UAAmC,EACnC,GAAsB,EAAA;QADtB,IAAU,CAAA,UAAA,GAAV,UAAU;QACV,IAAG,CAAA,GAAA,GAAH,GAAG;AAJH,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAW;;AAQpD,IAAA,OAAO,CAAC,KAAmB,EAAA;AACzB,QAAA,MAAM,aAAa,GAAG,KAAK,CAAC,MAAqB;QACjD,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,qCAAqC,CAAC;AAElF,QAAA,IAAI,CAAC,aAAa;YAAE;AAEpB,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO;QAC5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,kBAAkB,EAAE;;IAG3B,kBAAkB,GAAA;;AAEhB,QAAA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE;AA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AAA,CAAA;AAAlB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAPT,YAAA,EAAA,CAAA,qBAAqB,CAI/B,EAAA,OAAA,EAAA,CAAA,YAAY,aAJF,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAO9B,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHnB,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGX,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;oBAC/B,OAAO,EAAE,CAAC,YAAY,CAAC;AACvB,oBAAA,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC;AAC3B,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"kirbydesign-designsystem-toggle-button.mjs","sources":["../../toggle-button/src/toggle-button.component.ts","../../toggle-button/src/toggle-button.component.html","../../toggle-button/src/toggle-button.module.ts","../../toggle-button/src/kirbydesign-designsystem-toggle-button.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostListener,\n Input,\n Output,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n@Component({\n selector: 'kirby-toggle-button',\n templateUrl: './toggle-button.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleButtonComponent),\n multi: true,\n },\n ],\n})\nexport class ToggleButtonComponent implements ControlValueAccessor {\n @Input() checked: boolean;\n @Output() checkChanged = new EventEmitter<boolean>();\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private cdr: ChangeDetectorRef\n ) {}\n\n @HostListener('click', ['$event'])\n onClick(event: PointerEvent) {\n const targetElement = event.target as HTMLElement;\n const buttonEnabled = targetElement.closest('button[kirby-button]:not(:disabled)');\n\n if (!buttonEnabled) return;\n\n this.checked = !this.checked;\n this.onChange(this.checked);\n this.onTouched();\n this.checkChanged.emit(this.checked);\n this.focusToggledButton();\n }\n\n @HostListener('focusout')\n onFocusOut() {\n this.onTouched();\n }\n\n focusToggledButton() {\n // force re-render to ensure that the new button is in the dom\n this.cdr.detectChanges();\n\n const buttonToFocus = this.elementRef.nativeElement.querySelector(\n 'button[kirby-button]'\n ) as HTMLButtonElement;\n\n buttonToFocus?.focus();\n }\n\n /**\n * Sets the toggle button's value. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param checked New value to be written to the model.\n */\n writeValue(checked: boolean): void {\n if (this.checked !== checked) {\n this.checked = checked;\n this.cdr.markForCheck();\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function\n private onChange = (_checked: boolean) => {};\n // eslint-disable-next-line no-empty-function, @typescript-eslint/no-empty-function\n private onTouched = () => {};\n\n /**\n * Saves a callback function to be invoked when the toggle button's value\n * changes from user input. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the value changes.\n */\n registerOnChange(fn: (checked: boolean) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Saves a callback function to be invoked when the toggle button is blurred\n * by the user. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the component has been touched.\n */\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Disables the toggle button. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param isDisabled Sets whether the component is disabled.\n */\n setDisabledState(isDisabled: boolean): void {\n this.elementRef.nativeElement\n .querySelector('button[kirby-button]')\n ?.toggleAttribute('disabled', isDisabled);\n }\n}\n","<ng-content *ngIf=\"!checked\" select=\"button[kirby-button][unchecked]\"></ng-content>\n<ng-content *ngIf=\"checked\" select=\"button[kirby-button][checked]\"></ng-content>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ToggleButtonComponent } from './toggle-button.component';\n\nconst DECLARATIONS = [ToggleButtonComponent];\n\n@NgModule({\n declarations: [...DECLARATIONS],\n imports: [CommonModule],\n exports: [...DECLARATIONS],\n})\nexport class ToggleButtonModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MA0Ba,qBAAqB,CAAA;IAIhC,WACU,CAAA,UAAmC,EACnC,GAAsB,EAAA;QADtB,IAAU,CAAA,UAAA,GAAV,UAAU;QACV,IAAG,CAAA,GAAA,GAAH,GAAG;AAJH,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAW;;AAmD5C,QAAA,IAAA,CAAA,QAAQ,GAAG,CAAC,QAAiB,KAAI,GAAG;;AAEpC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAK,GAAG;;AA7C5B,IAAA,OAAO,CAAC,KAAmB,EAAA;AACzB,QAAA,MAAM,aAAa,GAAG,KAAK,CAAC,MAAqB;QACjD,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,qCAAqC,CAAC;AAElF,QAAA,IAAI,CAAC,aAAa;YAAE;AAEpB,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO;AAC5B,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3B,IAAI,CAAC,SAAS,EAAE;QAChB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC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YAAY;uBAAC,UAAU;;;AE5C1B,MAAM,YAAY,GAAG,CAAC,qBAAqB,CAAC;MAO/B,kBAAkB,CAAA;iIAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAlB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAPT,YAAA,EAAA,CAAA,qBAAqB,CAI/B,EAAA,OAAA,EAAA,CAAA,YAAY,aAJF,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAO9B,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHnB,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGX,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;oBAC/B,OAAO,EAAE,CAAC,YAAY,CAAC;AACvB,oBAAA,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC;AAC3B,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,16 +1,26 @@
1
+ import * as i2 from '@angular/common';
1
2
  import { CommonModule } from '@angular/common';
2
3
  import * as i0 from '@angular/core';
3
- import { EventEmitter, forwardRef, Component, ChangeDetectionStrategy, Input, HostBinding, Output } from '@angular/core';
4
+ import { EventEmitter, ElementRef, forwardRef, Output, HostBinding, Input, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
4
5
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
6
  import { IonToggle } from '@ionic/angular/standalone';
7
+ import { inheritAriaLabelText, setAccessibleLabel } from '@kirbydesign/designsystem/shared';
8
+ import * as i1 from '@kirbydesign/designsystem/helpers';
9
+ import { IonicElementPartHelper } from '@kirbydesign/designsystem/helpers';
6
10
 
7
11
  class ToggleComponent {
8
- constructor(cdr, elementRef) {
12
+ get _isDisabled() {
13
+ return this.disabled ? 'disabled' : null;
14
+ }
15
+ constructor(cdr, elementRef, ionicElementPartHelper) {
9
16
  this.cdr = cdr;
10
17
  this.elementRef = elementRef;
18
+ this.ionicElementPartHelper = ionicElementPartHelper;
11
19
  this.checked = false;
12
20
  this.disabled = false;
13
21
  this.checkedChange = new EventEmitter();
22
+ this._justify = 'start';
23
+ this._labelPlacement = 'start';
14
24
  this._pressed = false;
15
25
  // Initialize default ControlValueAccessor callback functions (noop)
16
26
  // eslint-disable-next-line no-empty-function
@@ -19,19 +29,32 @@ class ToggleComponent {
19
29
  this._onTouched = () => { };
20
30
  }
21
31
  ngOnInit() {
22
- this.inheritAriaAttributes();
23
- }
24
- inheritAriaAttributes() {
25
- const el = this.elementRef.nativeElement;
26
- const attribute = 'aria-label';
27
- if (el.hasAttribute(attribute)) {
28
- const value = el.getAttribute(attribute);
29
- el.removeAttribute(attribute);
30
- this._ariaLabel = value;
32
+ /**
33
+ * We cannot query ion-toggle for slotted content at this point as the slot has not been rendered.
34
+ * But we need to know if content is slotted to set justify and labelPlacement BEFORE ion-toggle is rendered.
35
+ * So it has to be done by querying an additional wrapper around the default content slot like this.
36
+ */
37
+ this._hasSlottedContent = this.elementRef.nativeElement
38
+ .querySelector('.default-content')
39
+ .hasChildNodes();
40
+ const slot = this.elementRef.nativeElement.getAttribute('slot');
41
+ if (slot === 'end' && this._hasSlottedContent) {
42
+ this._justify = 'space-between';
43
+ }
44
+ if (slot === 'start' && this._hasSlottedContent) {
45
+ this._labelPlacement = 'end';
31
46
  }
32
47
  }
33
- get _isDisabled() {
34
- return this.disabled ? 'disabled' : null;
48
+ ngAfterViewInit() {
49
+ this.ionicElementPartHelper.setPart('label', this.ionToggleElement, '.toggle-wrapper');
50
+ this.ionicElementPartHelper.setPart('label-text-wrapper', this.ionToggleElement, '.label-text-wrapper');
51
+ }
52
+ ngAfterContentInit() {
53
+ this._labelText = inheritAriaLabelText(this.elementRef.nativeElement);
54
+ if (!this._labelText && !this._hasSlottedContent) {
55
+ // if no label has been set try to find a label in an item and use its text content
56
+ this._labelText = setAccessibleLabel(this.elementRef.nativeElement);
57
+ }
35
58
  }
36
59
  onCheckedChange(checked) {
37
60
  this.checked = checked;
@@ -84,31 +107,39 @@ class ToggleComponent {
84
107
  this.disabled = isDisabled;
85
108
  this.cdr.detectChanges();
86
109
  }
87
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
88
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: ToggleComponent, isStandalone: true, selector: "kirby-toggle", inputs: { checked: "checked", disabled: "disabled" }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "attr.disabled": "this._isDisabled" } }, providers: [
110
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.IonicElementPartHelper }], target: i0.ɵɵFactoryTarget.Component }); }
111
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: ToggleComponent, isStandalone: true, selector: "kirby-toggle", inputs: { checked: "checked", disabled: "disabled" }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "attr.disabled": "this._isDisabled", "class.has-hidden-label": "this._labelText" } }, providers: [
112
+ IonicElementPartHelper,
89
113
  {
90
114
  provide: NG_VALUE_ACCESSOR,
91
115
  useExisting: forwardRef((() => ToggleComponent)),
92
116
  multi: true,
93
117
  },
94
- ], ngImport: i0, template: "<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [attr.aria-label]=\"_ariaLabel\"\n>\n <ng-content></ng-content>\n</ion-toggle>\n", styles: [":host{display:inline-flex}@media (hover: hover) and (pointer: fine){ion-toggle{overflow:visible;contain:none}ion-toggle:focus-within::part(track){transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}@media (hover: hover){ion-toggle:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;--track-background: rgb(119.28, 119.28, 119.28);--handle-background: rgb(244.8, 244.8, 244.8);--track-background-checked: rgb(45.030660793, 192.689339207, 114.1474889868);--handle-background-checked: rgb(244.8, 244.8, 244.8)}}ion-toggle:active,ion-toggle.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--track-background: rgb(107.92, 107.92, 107.92);--handle-background: rgb(234.6, 234.6, 234.6);--track-background-checked: rgb(40.7420264317, 174.3379735683, 103.2762995595);--handle-background-checked: rgb(234.6, 234.6, 234.6)}ion-toggle{--track-background: var(--kirby-semi-dark);--handle-background: var(--kirby-white);--track-background-checked: var(--kirby-success);--handle-background-checked: var(--kirby-white);--handle-transition: .2s;--handle-box-shadow: 0 1px 24px 0 rgba(28, 28, 28, .04);--handle-height: 28px;--handle-width: 28px;--border-radius: 16px}ion-toggle::part(track){height:32px}ion-toggle.in-item.legacy-toggle{padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IonToggle, selector: "ion-toggle", inputs: ["checked", "color", "disabled", "enableOnOffLabels", "justify", "labelPlacement", "mode", "name", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
118
+ ], viewQueries: [{ propertyName: "ionToggleElement", first: true, predicate: IonToggle, descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [justify]=\"_justify\"\n [labelPlacement]=\"_labelPlacement\"\n>\n <span class=\"hidden-label\" *ngIf=\"_labelText\">{{ _labelText }}</span>\n <span class=\"default-content\">\n <ng-content></ng-content>\n </span>\n</ion-toggle>\n", styles: [":host{display:inline-flex}:host:has(ion-toggle.in-item.toggle-justify-space-between){width:100%}:host.has-hidden-label{position:initial}:host.has-hidden-label[slot=end] ion-toggle{margin-inline-start:12px}:host.has-hidden-label ion-toggle{position:initial}:host.has-hidden-label ion-toggle::part(label){position:initial}:host.has-hidden-label ion-toggle.in-item::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}@media (hover: hover) and (pointer: fine){ion-toggle{overflow:visible;contain:none}ion-toggle:focus-within::part(track){transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}@media (hover: hover){ion-toggle:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;--track-background: rgb(119.28, 119.28, 119.28);--handle-background: rgb(244.8, 244.8, 244.8);--track-background-checked: rgb(45.030660793, 192.689339207, 114.1474889868);--handle-background-checked: rgb(244.8, 244.8, 244.8)}}ion-toggle:active,ion-toggle.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--track-background: rgb(107.92, 107.92, 107.92);--handle-background: rgb(234.6, 234.6, 234.6);--track-background-checked: rgb(40.7420264317, 174.3379735683, 103.2762995595);--handle-background-checked: rgb(234.6, 234.6, 234.6)}ion-toggle{--track-background: var(--kirby-semi-dark);--handle-background: var(--kirby-white);--track-background-checked: var(--kirby-success);--handle-background-checked: var(--kirby-white);--handle-transition: .2s;--handle-box-shadow: 0 1px 24px 0 rgba(28, 28, 28, .04);--handle-height: 28px;--handle-width: 28px;--border-radius: 16px}ion-toggle::part(track){height:32px}ion-toggle ::part(label-text-wrapper){line-height:24px;white-space:pre-line}ion-toggle.in-item::part(label){align-items:center;padding-inline:0}ion-toggle.in-item::part(label),ion-toggle.in-item::part(label-text-wrapper){margin-block:0}ion-toggle.in-item.toggle-label-placement-start::part(label-text-wrapper){margin-inline:0 12px}ion-toggle.in-item.toggle-label-placement-end::part(label-text-wrapper){margin-inline:12px 0}ion-toggle.in-item.legacy-toggle{padding:0}:host-context(kirby-item){z-index:1}:host-context(kirby-item) ion-toggle{margin:0}:host-context(kirby-item)[slot=start]{margin-inline-end:12px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IonToggle, selector: "ion-toggle", inputs: ["checked", "color", "disabled", "enableOnOffLabels", "justify", "labelPlacement", "mode", "name", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
95
119
  }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ToggleComponent, decorators: [{
120
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ToggleComponent, decorators: [{
97
121
  type: Component,
98
122
  args: [{ imports: [CommonModule, IonToggle], selector: 'kirby-toggle', providers: [
123
+ IonicElementPartHelper,
99
124
  {
100
125
  provide: NG_VALUE_ACCESSOR,
101
126
  useExisting: forwardRef((() => ToggleComponent)),
102
127
  multi: true,
103
128
  },
104
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [attr.aria-label]=\"_ariaLabel\"\n>\n <ng-content></ng-content>\n</ion-toggle>\n", styles: [":host{display:inline-flex}@media (hover: hover) and (pointer: fine){ion-toggle{overflow:visible;contain:none}ion-toggle:focus-within::part(track){transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}@media (hover: hover){ion-toggle:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;--track-background: rgb(119.28, 119.28, 119.28);--handle-background: rgb(244.8, 244.8, 244.8);--track-background-checked: rgb(45.030660793, 192.689339207, 114.1474889868);--handle-background-checked: rgb(244.8, 244.8, 244.8)}}ion-toggle:active,ion-toggle.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--track-background: rgb(107.92, 107.92, 107.92);--handle-background: rgb(234.6, 234.6, 234.6);--track-background-checked: rgb(40.7420264317, 174.3379735683, 103.2762995595);--handle-background-checked: rgb(234.6, 234.6, 234.6)}ion-toggle{--track-background: var(--kirby-semi-dark);--handle-background: var(--kirby-white);--track-background-checked: var(--kirby-success);--handle-background-checked: var(--kirby-white);--handle-transition: .2s;--handle-box-shadow: 0 1px 24px 0 rgba(28, 28, 28, .04);--handle-height: 28px;--handle-width: 28px;--border-radius: 16px}ion-toggle::part(track){height:32px}ion-toggle.in-item.legacy-toggle{padding:0}\n"] }]
105
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { checked: [{
129
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [justify]=\"_justify\"\n [labelPlacement]=\"_labelPlacement\"\n>\n <span class=\"hidden-label\" *ngIf=\"_labelText\">{{ _labelText }}</span>\n <span class=\"default-content\">\n <ng-content></ng-content>\n </span>\n</ion-toggle>\n", styles: [":host{display:inline-flex}:host:has(ion-toggle.in-item.toggle-justify-space-between){width:100%}:host.has-hidden-label{position:initial}:host.has-hidden-label[slot=end] ion-toggle{margin-inline-start:12px}:host.has-hidden-label ion-toggle{position:initial}:host.has-hidden-label ion-toggle::part(label){position:initial}:host.has-hidden-label ion-toggle.in-item::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}@media (hover: hover) and (pointer: fine){ion-toggle{overflow:visible;contain:none}ion-toggle:focus-within::part(track){transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}@media (hover: hover){ion-toggle:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;--track-background: rgb(119.28, 119.28, 119.28);--handle-background: rgb(244.8, 244.8, 244.8);--track-background-checked: rgb(45.030660793, 192.689339207, 114.1474889868);--handle-background-checked: rgb(244.8, 244.8, 244.8)}}ion-toggle:active,ion-toggle.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--track-background: rgb(107.92, 107.92, 107.92);--handle-background: rgb(234.6, 234.6, 234.6);--track-background-checked: rgb(40.7420264317, 174.3379735683, 103.2762995595);--handle-background-checked: rgb(234.6, 234.6, 234.6)}ion-toggle{--track-background: var(--kirby-semi-dark);--handle-background: var(--kirby-white);--track-background-checked: var(--kirby-success);--handle-background-checked: var(--kirby-white);--handle-transition: .2s;--handle-box-shadow: 0 1px 24px 0 rgba(28, 28, 28, .04);--handle-height: 28px;--handle-width: 28px;--border-radius: 16px}ion-toggle::part(track){height:32px}ion-toggle ::part(label-text-wrapper){line-height:24px;white-space:pre-line}ion-toggle.in-item::part(label){align-items:center;padding-inline:0}ion-toggle.in-item::part(label),ion-toggle.in-item::part(label-text-wrapper){margin-block:0}ion-toggle.in-item.toggle-label-placement-start::part(label-text-wrapper){margin-inline:0 12px}ion-toggle.in-item.toggle-label-placement-end::part(label-text-wrapper){margin-inline:12px 0}ion-toggle.in-item.legacy-toggle{padding:0}:host-context(kirby-item){z-index:1}:host-context(kirby-item) ion-toggle{margin:0}:host-context(kirby-item)[slot=start]{margin-inline-end:12px}\n"] }]
130
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.IonicElementPartHelper }], propDecorators: { ionToggleElement: [{
131
+ type: ViewChild,
132
+ args: [IonToggle, { read: ElementRef, static: true }]
133
+ }], checked: [{
106
134
  type: Input
107
135
  }], disabled: [{
108
136
  type: Input
109
137
  }], _isDisabled: [{
110
138
  type: HostBinding,
111
139
  args: ['attr.disabled']
140
+ }], _labelText: [{
141
+ type: HostBinding,
142
+ args: ['class.has-hidden-label']
112
143
  }], checkedChange: [{
113
144
  type: Output
114
145
  }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"kirbydesign-designsystem-toggle.mjs","sources":["../../toggle/src/toggle.component.ts","../../toggle/src/toggle.component.html","../../toggle/src/kirbydesign-designsystem-toggle.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n Input,\n OnInit,\n Output,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { IonToggle } from '@ionic/angular/standalone';\n\n@Component({\n imports: [CommonModule, IonToggle],\n selector: 'kirby-toggle',\n templateUrl: './toggle.component.html',\n styleUrls: ['./toggle.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToggleComponent implements ControlValueAccessor, OnInit {\n constructor(\n private cdr: ChangeDetectorRef,\n private elementRef: ElementRef<HTMLElement>\n ) {}\n\n ngOnInit(): void {\n this.inheritAriaAttributes();\n }\n\n _ariaLabel: string;\n\n private inheritAriaAttributes() {\n const el = this.elementRef.nativeElement;\n const attribute = 'aria-label';\n if (el.hasAttribute(attribute)) {\n const value = el.getAttribute(attribute);\n el.removeAttribute(attribute);\n this._ariaLabel = value;\n }\n }\n\n @Input() checked: boolean = false;\n @Input() disabled: boolean = false;\n @HostBinding('attr.disabled')\n get _isDisabled() {\n return this.disabled ? 'disabled' : null;\n }\n\n @Output() checkedChange = new EventEmitter<boolean>();\n\n _pressed = false;\n\n onCheckedChange(checked: boolean): void {\n this.checked = checked;\n this._onChange(this.checked);\n this.checkedChange.emit(this.checked);\n }\n\n _onActive() {\n this._pressed = true;\n }\n\n _onInactive() {\n this._pressed = false;\n this._onTouched();\n }\n\n // Initialize default ControlValueAccessor callback functions (noop)\n // eslint-disable-next-line no-empty-function\n private _onChange: (value: boolean) => void = () => {};\n // eslint-disable-next-line no-empty-function\n private _onTouched = () => {};\n\n /**\n * Sets the toggle's value. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param value New value to be written to the model.\n */\n writeValue(value: boolean): void {\n this.checked = value;\n }\n /**\n * Saves a callback function to be invoked when the toggle's value\n * changes from user input. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the value changes.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n /**\n * Saves a callback function to be invoked when the toggle is blurred\n * by the user. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the component has been touched.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n /**\n * Disables the toggle. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param isDisabled Sets whether the component is disabled.\n */\n setDisabledState?(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cdr.detectChanges();\n }\n}\n","<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [attr.aria-label]=\"_ariaLabel\"\n>\n <ng-content></ng-content>\n</ion-toggle>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MA8Ba,eAAe,CAAA;IAC1B,WACU,CAAA,GAAsB,EACtB,UAAmC,EAAA;QADnC,IAAG,CAAA,GAAA,GAAH,GAAG;QACH,IAAU,CAAA,UAAA,GAAV,UAAU;QAmBX,IAAO,CAAA,OAAA,GAAY,KAAK;QACxB,IAAQ,CAAA,QAAA,GAAY,KAAK;AAMxB,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,YAAY,EAAW;QAErD,IAAQ,CAAA,QAAA,GAAG,KAAK;;;AAmBR,QAAA,IAAA,CAAA,SAAS,GAA6B,MAAK,GAAG;;AAE9C,QAAA,IAAA,CAAA,UAAU,GAAG,MAAK,GAAG;;IA9C7B,QAAQ,GAAA;QACN,IAAI,CAAC,qBAAqB,EAAE;;IAKtB,qBAAqB,GAAA;AAC3B,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa;QACxC,MAAM,SAAS,GAAG,YAAY;AAC9B,QAAA,IAAI,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;YAC9B,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;AACxC,YAAA,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC;AAC7B,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK;;;AAM3B,IAAA,IACI,WAAW,GAAA;Q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A,EAAA,MAAA,EAAA,CAAA,w2CAAA,CAAA,EAAA;+GAwBtC,OAAO,EAAA,CAAA;sBAAf;gBACQ,QAAQ,EAAA,CAAA;sBAAhB;gBAEG,WAAW,EAAA,CAAA;sBADd,WAAW;uBAAC,eAAe;gBAKlB,aAAa,EAAA,CAAA;sBAAtB;;;AE3DH;;AAEG;;;;"}
1
+ {"version":3,"file":"kirbydesign-designsystem-toggle.mjs","sources":["../../toggle/src/toggle.component.ts","../../toggle/src/toggle.component.html","../../toggle/src/kirbydesign-designsystem-toggle.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n Input,\n OnInit,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { IonToggle } from '@ionic/angular/standalone';\nimport { inheritAriaLabelText, setAccessibleLabel } from '@kirbydesign/designsystem/shared';\nimport { IonicElementPartHelper } from '@kirbydesign/designsystem/helpers';\n\n@Component({\n imports: [CommonModule, IonToggle],\n selector: 'kirby-toggle',\n templateUrl: './toggle.component.html',\n styleUrls: ['./toggle.component.scss'],\n providers: [\n IonicElementPartHelper,\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToggleComponent\n implements ControlValueAccessor, OnInit, AfterViewInit, AfterContentInit\n{\n @ViewChild(IonToggle, { read: ElementRef, static: true })\n private ionToggleElement?: ElementRef<HTMLIonToggleElement>;\n\n @Input() checked: boolean = false;\n\n @Input() disabled: boolean = false;\n @HostBinding('attr.disabled')\n get _isDisabled() {\n return this.disabled ? 'disabled' : null;\n }\n\n @HostBinding('class.has-hidden-label') _labelText: string;\n\n @Output() checkedChange = new EventEmitter<boolean>();\n\n _justify: 'start' | 'end' | 'space-between' = 'start';\n _labelPlacement: 'end' | 'fixed' | 'stacked' | 'start' = 'start';\n _hasSlottedContent: boolean;\n _pressed = false;\n\n constructor(\n private cdr: ChangeDetectorRef,\n private elementRef: ElementRef<HTMLElement>,\n private ionicElementPartHelper: IonicElementPartHelper\n ) {}\n\n ngOnInit(): void {\n /**\n * We cannot query ion-toggle for slotted content at this point as the slot has not been rendered.\n * But we need to know if content is slotted to set justify and labelPlacement BEFORE ion-toggle is rendered.\n * So it has to be done by querying an additional wrapper around the default content slot like this.\n */\n this._hasSlottedContent = this.elementRef.nativeElement\n .querySelector('.default-content')\n .hasChildNodes();\n\n const slot = this.elementRef.nativeElement.getAttribute('slot');\n if (slot === 'end' && this._hasSlottedContent) {\n this._justify = 'space-between';\n }\n\n if (slot === 'start' && this._hasSlottedContent) {\n this._labelPlacement = 'end';\n }\n }\n\n ngAfterViewInit(): void {\n this.ionicElementPartHelper.setPart('label', this.ionToggleElement, '.toggle-wrapper');\n this.ionicElementPartHelper.setPart(\n 'label-text-wrapper',\n this.ionToggleElement,\n '.label-text-wrapper'\n );\n }\n\n ngAfterContentInit(): void {\n this._labelText = inheritAriaLabelText(this.elementRef.nativeElement);\n\n if (!this._labelText && !this._hasSlottedContent) {\n // if no label has been set try to find a label in an item and use its text content\n this._labelText = setAccessibleLabel(this.elementRef.nativeElement);\n }\n }\n\n onCheckedChange(checked: boolean): void {\n this.checked = checked;\n this._onChange(this.checked);\n this.checkedChange.emit(this.checked);\n }\n\n _onActive() {\n this._pressed = true;\n }\n\n _onInactive() {\n this._pressed = false;\n this._onTouched();\n }\n\n // Initialize default ControlValueAccessor callback functions (noop)\n // eslint-disable-next-line no-empty-function\n private _onChange: (value: boolean) => void = () => {};\n // eslint-disable-next-line no-empty-function\n private _onTouched = () => {};\n\n /**\n * Sets the toggle's value. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param value New value to be written to the model.\n */\n writeValue(value: boolean): void {\n this.checked = value;\n }\n /**\n * Saves a callback function to be invoked when the toggle's value\n * changes from user input. Part of the ControlValueAccessor interface\n * required to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the value changes.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n /**\n * Saves a callback function to be invoked when the toggle is blurred\n * by the user. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param fn Callback to be triggered when the component has been touched.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n /**\n * Disables the toggle. Part of the ControlValueAccessor interface required\n * to integrate with Angular's core forms API.\n *\n * @param isDisabled Sets whether the component is disabled.\n */\n setDisabledState?(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cdr.detectChanges();\n }\n}\n","<ion-toggle\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [class.interaction-state-active]=\"_pressed\"\n (keydown.space)=\"_onActive()\"\n (keyup.space)=\"_onInactive()\"\n (blur)=\"_onInactive()\"\n (ionChange)=\"onCheckedChange($event.detail.checked)\"\n [justify]=\"_justify\"\n [labelPlacement]=\"_labelPlacement\"\n>\n <span class=\"hidden-label\" *ngIf=\"_labelText\">{{ _labelText }}</span>\n <span class=\"default-content\">\n <ng-content></ng-content>\n </span>\n</ion-toggle>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;MAoCa,eAAe,CAAA;AAS1B,IAAA,IACI,WAAW,GAAA;QACb,OAAO,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI;;AAY1C,IAAA,WAAA,CACU,GAAsB,EACtB,UAAmC,EACnC,sBAA8C,EAAA;QAF9C,IAAG,CAAA,GAAA,GAAH,GAAG;QACH,IAAU,CAAA,UAAA,GAAV,UAAU;QACV,IAAsB,CAAA,sBAAA,GAAtB,sBAAsB;QApBvB,IAAO,CAAA,OAAA,GAAY,KAAK;QAExB,IAAQ,CAAA,QAAA,GAAY,KAAK;AAQxB,Q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,qBAAqB,EAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,+fAAA,EAAA,MAAA,EAAA,CAAA,k2EAAA,CAAA,EAAA;oJAMvC,gBAAgB,EAAA,CAAA;sBADvB,SAAS;uBAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;gBAG/C,OAAO,EAAA,CAAA;sBAAf;gBAEQ,QAAQ,EAAA,CAAA;sBAAhB;gBAEG,WAAW,EAAA,CAAA;sBADd,WAAW;uBAAC,eAAe;gBAKW,UAAU,EAAA,CAAA;sBAAhD,WAAW;uBAAC,wBAAwB;gBAE3B,aAAa,EAAA,CAAA;sBAAtB;;;AEpDH;;AAEG;;;;"}
@@ -5,10 +5,10 @@ class WindowRef {
5
5
  get nativeWindow() {
6
6
  return window;
7
7
  }
8
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WindowRef, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WindowRef, providedIn: 'root' }); }
8
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: WindowRef, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: WindowRef, providedIn: 'root' }); }
10
10
  }
11
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WindowRef, decorators: [{
11
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: WindowRef, decorators: [{
12
12
  type: Injectable,
13
13
  args: [{
14
14
  providedIn: 'root',