@agorapulse/ui-components 15.1.17 → 15.1.18

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.
@@ -1,7 +1,10 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, forwardRef, inject, Input, Output, ViewChild, ViewEncapsulation, } from "@angular/core";
2
- import { CommonModule, NgIf } from "@angular/common";
3
- import { apCheck2, SymbolComponent, SymbolRegistry } from "@agorapulse/ui-symbol";
4
- import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from "@angular/forms";
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, forwardRef, inject, Input, Output, ViewChild, ViewEncapsulation, } from '@angular/core';
2
+ import { CommonModule, NgIf } from '@angular/common';
3
+ import { apCheck2, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';
4
+ import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
6
+ import { MatLegacyDialog } from '@angular/material/legacy-dialog';
7
+ import { first } from 'rxjs/operators';
5
8
  import * as i0 from "@angular/core";
6
9
  export const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
7
10
  provide: NG_VALUE_ACCESSOR,
@@ -11,9 +14,16 @@ export const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
11
14
  export class ToggleComponent {
12
15
  constructor() {
13
16
  this.symbolRegistry = inject(SymbolRegistry);
17
+ this.dialog = inject(MatLegacyDialog);
18
+ this.cdr = inject(ChangeDetectorRef);
14
19
  this.ariaLabel = '';
15
20
  this.ariaLabelledby = null;
16
21
  this.labelPosition = 'right';
22
+ this.confirm = false;
23
+ this.confirmMessage = 'If you toggle this, it will affect other things. Are you sure';
24
+ this.confirmOk = 'Confirm';
25
+ this.confirmCancel = 'Cancel';
26
+ this.confirmTitle = 'Are you sure?';
17
27
  // eslint-disable-next-line
18
28
  this.change = new EventEmitter();
19
29
  this.hasLabel = false;
@@ -32,9 +42,7 @@ export class ToggleComponent {
32
42
  }
33
43
  }
34
44
  ngOnInit() {
35
- this.symbolRegistry.registerSymbols([
36
- apCheck2
37
- ]);
45
+ this.symbolRegistry.registerSymbols([apCheck2]);
38
46
  }
39
47
  ngAfterContentInit() {
40
48
  if (this.labelElement) {
@@ -42,23 +50,57 @@ export class ToggleComponent {
42
50
  }
43
51
  }
44
52
  onValueChange() {
45
- if (this.onTouched) {
46
- this.onTouched();
47
- }
48
53
  if (!this.disabled) {
49
- this.checked = !this.checked;
50
- this.focus();
51
- this.change.emit(this.checked);
52
- if (this._controlValueAccessorChangeFn) {
53
- this._controlValueAccessorChangeFn(this.checked);
54
+ if (!this.confirm) {
55
+ if (this.onTouched) {
56
+ this.onTouched();
57
+ }
58
+ this.changeValue();
54
59
  }
55
- // Assigning the value again here is redundant, but we have to do it in case it was
56
- // changed inside the `change` listener which will cause the input to be out of sync.
57
- if (this.inputElement) {
58
- this.inputElement.nativeElement.checked = this.checked;
60
+ else {
61
+ const toggleConfirmModal = {
62
+ contentText: this.confirmMessage,
63
+ headerTitle: this.confirmTitle,
64
+ footerCancelButtonLabel: this.confirmCancel,
65
+ footerConfirmButtonLabel: this.confirmOk,
66
+ footerConfirmButtonId: 'confirm',
67
+ footerCancelButtonId: 'cancel',
68
+ };
69
+ const modalConfig = {
70
+ matDialogConfig: {
71
+ panelClass: 'design-system',
72
+ width: '550px',
73
+ },
74
+ };
75
+ const dialogRef = ConfirmModalComponent.open(this.dialog, toggleConfirmModal, modalConfig);
76
+ dialogRef
77
+ .afterClosed()
78
+ .pipe(first())
79
+ .subscribe(result => {
80
+ if (result) {
81
+ if (this.onTouched) {
82
+ this.onTouched();
83
+ }
84
+ this.changeValue();
85
+ }
86
+ });
59
87
  }
60
88
  }
61
89
  }
90
+ changeValue() {
91
+ this.checked = !this.checked;
92
+ this.focus();
93
+ this.change.emit(this.checked);
94
+ if (this._controlValueAccessorChangeFn) {
95
+ this._controlValueAccessorChangeFn(this.checked);
96
+ }
97
+ // Assigning the value again here is redundant, but we have to do it in case it was
98
+ // changed inside the `change` listener which will cause the input to be out of sync.
99
+ if (this.inputElement) {
100
+ this.inputElement.nativeElement.checked = this.checked;
101
+ }
102
+ this.cdr.markForCheck();
103
+ }
62
104
  focus() {
63
105
  this.inputElement.nativeElement.focus();
64
106
  }
@@ -75,9 +117,10 @@ export class ToggleComponent {
75
117
  this.disabled = isDisabled;
76
118
  }
77
119
  validate({ value }) {
78
- return this.required && !value && {
79
- invalid: true
80
- };
120
+ return (this.required &&
121
+ !value && {
122
+ invalid: true,
123
+ });
81
124
  }
82
125
  _preventBubblingFromLabel(event) {
83
126
  if (!!event.target && this.labelElement.nativeElement.contains(event.target)) {
@@ -86,28 +129,26 @@ export class ToggleComponent {
86
129
  }
87
130
  }
88
131
  ToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
89
- ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", name: "name" }, outputs: { change: "change" }, providers: [
132
+ ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", confirm: "confirm", confirmMessage: "confirmMessage", confirmOk: "confirmOk", confirmCancel: "confirmCancel", confirmTitle: "confirmTitle", name: "name" }, outputs: { change: "change" }, providers: [
90
133
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
91
134
  {
92
135
  provide: NG_VALIDATORS,
93
136
  useExisting: ToggleComponent,
94
- multi: true
95
- }
96
- ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
137
+ multi: true,
138
+ },
139
+ MatLegacyDialog,
140
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
97
141
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, decorators: [{
98
142
  type: Component,
99
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [
100
- NgIf,
101
- SymbolComponent,
102
- CommonModule
103
- ], providers: [
143
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [NgIf, SymbolComponent, CommonModule], providers: [
104
144
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
105
145
  {
106
146
  provide: NG_VALIDATORS,
107
147
  useExisting: ToggleComponent,
108
- multi: true
109
- }
110
- ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
148
+ multi: true,
149
+ },
150
+ MatLegacyDialog,
151
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
111
152
  }], propDecorators: { inputElement: [{
112
153
  type: ViewChild,
113
154
  args: ['input', { static: true }]
@@ -131,9 +172,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
131
172
  type: Input
132
173
  }], required: [{
133
174
  type: Input
175
+ }], confirm: [{
176
+ type: Input
177
+ }], confirmMessage: [{
178
+ type: Input
179
+ }], confirmOk: [{
180
+ type: Input
181
+ }], confirmCancel: [{
182
+ type: Input
183
+ }], confirmTitle: [{
184
+ type: Input
134
185
  }], name: [{
135
186
  type: Input
136
187
  }], change: [{
137
188
  type: Output
138
189
  }] } });
139
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9nZ2xlLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYn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hYmVsbGVkYnlcIlxuICAgICAgICAgICAgW2F0dHIuYXJpYS1kZXNjcmliZWRieV09XCJhcmlhRGVzY3JpYmVkYnlcIlxuICAgICAgICAgICAgW2F0dHIuYXJpYS1jaGVja2VkXT1cImNoZWNrZWRcIlxuICAgICAgICAgICAgKGNsaWNrKT1cIm9uVmFsdWVDaGFuZ2UoKVwiXG4gICAgPlxuICAgIDxkaXYgY2xhc3M9XCJzd2l0Y2gtY29udGFpbmVyXCJcbiAgICAgICAgIFtjbGFzcy5sYWJlbC1sZWZ0XT1cImxhYmVsUG9zaXRpb24gPT09ICdsZWZ0J1wiXG4gICAgPlxuICAgICAgICA8ZGl2IGNsYXNzPVwic3dpdGNoXCJcbiAgICAgICAgICAgICBbY2xhc3MuY2hlY2tlZF09XCJjaGVja2VkXCJcbiAgICAgICAgICAgICAoY2xpY2spPVwib25WYWx1ZUNoYW5nZSgpXCJcbiAgICAgICAgPlxuICAgICAgICAgICAgPGRpdiBjbGFzcz1cImtub2JcIj48L2Rpdj5cbiAgICAgICAgPC9kaXY+XG4gICAgICAgIDxsYWJlbFxuICAgICAgICAgICAgI2xhYmVsXG4gICAgICAgICAgICBbY2xhc3MuZGlzYWJsZWRdPVwiZGlzYWJsZWRcIlxuICAgICAgICAgICAgW2Zvcl09XCJuYW1lXCJcbiAgICAgICAgPlxuICAgICAgICAgICAgPG5nLWNvbnRlbnQ+PC9uZy1jb250ZW50PlxuICAgICAgICA8L2xhYmVsPlxuICAgIDwvZGl2PlxuPC9kaXY+XG4iXX0=
190
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9nZ2xlLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvdWktY29tcG9uZW50cy90b2dnbGUvc3JjL3RvZ2dsZS5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi9saWJzL3VpLWNvbXBvbmVudHMv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gICAgICBpZiAoIXRoaXMuY29uZmlybSkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm9uVG91Y2hlZCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9uVG91Y2hlZCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLmNoYW5nZVZhbHVlKCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnN0IHRvZ2dsZUNvbmZpcm1Nb2RhbCA9IHtcbiAgICAgICAgICAgICAgICAgICAgY29udGVudFRleHQ6IHRoaXMuY29uZmlybU1lc3NhZ2UsXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlclRpdGxlOiB0aGlzLmNvbmZpcm1UaXRsZSxcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyQ2FuY2VsQnV0dG9uTGFiZWw6IHRoaXMuY29uZmlybUNhbmNlbCxcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyQ29uZmlybUJ1dHRvbkxhYmVsOiB0aGlzLmNvbmZpcm1PayxcbiAgICAgICAgICAgICAgICAgICAgZm9vdGVyQ29uZmlybUJ1dHRvbklkOiAnY29uZmlybScsXG4gICAgICAgICAgICAgICAgICAgIGZvb3RlckNhbmNlbEJ1dHRvbklkOiAnY2FuY2VsJyxcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGNvbnN0IG1vZGFsQ29uZmlnID0ge1xuICAgICAgICAgICAgICAgICAgICBtYXREaWFsb2dDb25maWc6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhbmVsQ2xhc3M6ICdkZXNpZ24tc3lzdGVtJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnNTUwcHgnLFxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICBjb25zdCBkaWFsb2dSZWYgPSBDb25maXJtTW9kYWxDb21wb25lbnQub3Blbih0aGlzLmRpYWxvZywgdG9nZ2xlQ29uZmlybU1vZGFsLCBtb2RhbENvbmZpZyk7XG4gICAgICAgICAgICAgICAgZGlhbG9nUmVmXG4gICAgICAgICAgICAgICAgICAgIC5hZnRlckNsb3NlZCgpXG4gICAgICAgICAgICAgICAgICAgIC5waXBlKGZpcnN0KCkpXG4gICAgICAgICAgICAgICAgICAgIC5zdWJzY3JpYmUocmVzdWx0ID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5vblRvdWNoZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vblRvdWNoZWQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGFuZ2VWYWx1ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNoYW5nZVZhbHVlKCk6IHZvaWQge1xuICAgICAgICB0aGlzLmNoZWNrZWQgPSAhdGhpcy5jaGVja2VkO1xuICAgICAgICB0aGlzLmZvY3VzKCk7XG4gICAgICAgIHRoaXMuY2hhbmdlLmVtaXQodGhpcy5jaGVja2VkKTtcbiAgICAgICAgaWYgKHRoaXMuX2NvbnRyb2xWYWx1ZUFjY2Vzc29yQ2hhbmdlRm4pIHtcbiAgICAgICAgICAgIHRoaXMuX2NvbnRyb2xWYWx1ZUFjY2Vzc29yQ2hhbmdlRm4odGhpcy5jaGVja2VkKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEFzc2lnbmluZyB0aGUgdmFsdWUgYWdhaW4gaGVyZSBpcyByZWR1bmRhbnQsIGJ1dCB3ZSBoYXZlIHRvIGRvIGl0IGluIGNhc2UgaXQgd2FzXG4gICAgICAgI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ic3dpdGNoLWNvbnRhaW5lclwiIFtjbGFzcy5sYWJlbC1sZWZ0XT1cImxhYmVsUG9zaXRpb24gPT09ICdsZWZ0J1wiPlxuICAgICAgICA8ZGl2IGNsYXNzPVwic3dpdGNoXCIgW2NsYXNzLmNoZWNrZWRdPVwiY2hlY2tlZFwiIChjbGljayk9XCJvblZhbHVlQ2hhbmdlKClcIj5cbiAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJrbm9iXCI+PC9kaXY+XG4gICAgICAgIDwvZGl2PlxuICAgICAgICA8bGFiZWwgI2xhYmVsIFtjbGFzcy5kaXNhYmxlZF09XCJkaXNhYmxlZFwiIFtmb3JdPVwibmFtZVwiPlxuICAgICAgICAgICAgPG5nLWNvbnRlbnQ+PC9uZy1jb250ZW50PlxuICAgICAgICA8L2xhYmVsPlxuICAgIDwvZGl2PlxuPC9kaXY+XG4iXX0=
@@ -1,8 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { forwardRef, inject, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Output } from '@angular/core';
2
+ import { forwardRef, inject, ChangeDetectorRef, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Output } from '@angular/core';
3
3
  import { CommonModule, NgIf } from '@angular/common';
4
4
  import { SymbolRegistry, apCheck2, SymbolComponent } from '@agorapulse/ui-symbol';
5
5
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
6
+ import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
7
+ import { MatLegacyDialog } from '@angular/material/legacy-dialog';
8
+ import { first } from 'rxjs/operators';
6
9
 
7
10
  const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
8
11
  provide: NG_VALUE_ACCESSOR,
@@ -12,9 +15,16 @@ const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
12
15
  class ToggleComponent {
13
16
  constructor() {
14
17
  this.symbolRegistry = inject(SymbolRegistry);
18
+ this.dialog = inject(MatLegacyDialog);
19
+ this.cdr = inject(ChangeDetectorRef);
15
20
  this.ariaLabel = '';
16
21
  this.ariaLabelledby = null;
17
22
  this.labelPosition = 'right';
23
+ this.confirm = false;
24
+ this.confirmMessage = 'If you toggle this, it will affect other things. Are you sure';
25
+ this.confirmOk = 'Confirm';
26
+ this.confirmCancel = 'Cancel';
27
+ this.confirmTitle = 'Are you sure?';
18
28
  // eslint-disable-next-line
19
29
  this.change = new EventEmitter();
20
30
  this.hasLabel = false;
@@ -33,9 +43,7 @@ class ToggleComponent {
33
43
  }
34
44
  }
35
45
  ngOnInit() {
36
- this.symbolRegistry.registerSymbols([
37
- apCheck2
38
- ]);
46
+ this.symbolRegistry.registerSymbols([apCheck2]);
39
47
  }
40
48
  ngAfterContentInit() {
41
49
  if (this.labelElement) {
@@ -43,23 +51,57 @@ class ToggleComponent {
43
51
  }
44
52
  }
45
53
  onValueChange() {
46
- if (this.onTouched) {
47
- this.onTouched();
48
- }
49
54
  if (!this.disabled) {
50
- this.checked = !this.checked;
51
- this.focus();
52
- this.change.emit(this.checked);
53
- if (this._controlValueAccessorChangeFn) {
54
- this._controlValueAccessorChangeFn(this.checked);
55
+ if (!this.confirm) {
56
+ if (this.onTouched) {
57
+ this.onTouched();
58
+ }
59
+ this.changeValue();
55
60
  }
56
- // Assigning the value again here is redundant, but we have to do it in case it was
57
- // changed inside the `change` listener which will cause the input to be out of sync.
58
- if (this.inputElement) {
59
- this.inputElement.nativeElement.checked = this.checked;
61
+ else {
62
+ const toggleConfirmModal = {
63
+ contentText: this.confirmMessage,
64
+ headerTitle: this.confirmTitle,
65
+ footerCancelButtonLabel: this.confirmCancel,
66
+ footerConfirmButtonLabel: this.confirmOk,
67
+ footerConfirmButtonId: 'confirm',
68
+ footerCancelButtonId: 'cancel',
69
+ };
70
+ const modalConfig = {
71
+ matDialogConfig: {
72
+ panelClass: 'design-system',
73
+ width: '550px',
74
+ },
75
+ };
76
+ const dialogRef = ConfirmModalComponent.open(this.dialog, toggleConfirmModal, modalConfig);
77
+ dialogRef
78
+ .afterClosed()
79
+ .pipe(first())
80
+ .subscribe(result => {
81
+ if (result) {
82
+ if (this.onTouched) {
83
+ this.onTouched();
84
+ }
85
+ this.changeValue();
86
+ }
87
+ });
60
88
  }
61
89
  }
62
90
  }
91
+ changeValue() {
92
+ this.checked = !this.checked;
93
+ this.focus();
94
+ this.change.emit(this.checked);
95
+ if (this._controlValueAccessorChangeFn) {
96
+ this._controlValueAccessorChangeFn(this.checked);
97
+ }
98
+ // Assigning the value again here is redundant, but we have to do it in case it was
99
+ // changed inside the `change` listener which will cause the input to be out of sync.
100
+ if (this.inputElement) {
101
+ this.inputElement.nativeElement.checked = this.checked;
102
+ }
103
+ this.cdr.markForCheck();
104
+ }
63
105
  focus() {
64
106
  this.inputElement.nativeElement.focus();
65
107
  }
@@ -76,9 +118,10 @@ class ToggleComponent {
76
118
  this.disabled = isDisabled;
77
119
  }
78
120
  validate({ value }) {
79
- return this.required && !value && {
80
- invalid: true
81
- };
121
+ return (this.required &&
122
+ !value && {
123
+ invalid: true,
124
+ });
82
125
  }
83
126
  _preventBubblingFromLabel(event) {
84
127
  if (!!event.target && this.labelElement.nativeElement.contains(event.target)) {
@@ -87,28 +130,26 @@ class ToggleComponent {
87
130
  }
88
131
  }
89
132
  ToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
90
- ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", name: "name" }, outputs: { change: "change" }, providers: [
133
+ ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", confirm: "confirm", confirmMessage: "confirmMessage", confirmOk: "confirmOk", confirmCancel: "confirmCancel", confirmTitle: "confirmTitle", name: "name" }, outputs: { change: "change" }, providers: [
91
134
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
92
135
  {
93
136
  provide: NG_VALIDATORS,
94
137
  useExisting: ToggleComponent,
95
- multi: true
96
- }
97
- ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
138
+ multi: true,
139
+ },
140
+ MatLegacyDialog,
141
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
98
142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, decorators: [{
99
143
  type: Component,
100
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [
101
- NgIf,
102
- SymbolComponent,
103
- CommonModule
104
- ], providers: [
144
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [NgIf, SymbolComponent, CommonModule], providers: [
105
145
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
106
146
  {
107
147
  provide: NG_VALIDATORS,
108
148
  useExisting: ToggleComponent,
109
- multi: true
110
- }
111
- ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
149
+ multi: true,
150
+ },
151
+ MatLegacyDialog,
152
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
112
153
  }], propDecorators: { inputElement: [{
113
154
  type: ViewChild,
114
155
  args: ['input', { static: true }]
@@ -132,6 +173,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
132
173
  type: Input
133
174
  }], required: [{
134
175
  type: Input
176
+ }], confirm: [{
177
+ type: Input
178
+ }], confirmMessage: [{
179
+ type: Input
180
+ }], confirmOk: [{
181
+ type: Input
182
+ }], confirmCancel: [{
183
+ type: Input
184
+ }], confirmTitle: [{
185
+ type: Input
135
186
  }], name: [{
136
187
  type: Input
137
188
  }], change: [{
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-toggle.mjs","sources":["../../../libs/ui-components/toggle/src/toggle.component.ts","../../../libs/ui-components/toggle/src/toggle.component.html","../../../libs/ui-components/toggle/src/agorapulse-ui-components-toggle.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef, inject,\n Input,\n OnChanges, OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {CommonModule, NgIf} from \"@angular/common\";\nimport {apCheck2, SymbolComponent, SymbolRegistry} from \"@agorapulse/ui-symbol\";\nimport {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR} from \"@angular/forms\";\n\nexport const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-toggle[name]',\n styleUrls: ['./toggle.component.scss'],\n standalone: true,\n imports: [\n NgIf,\n SymbolComponent,\n CommonModule\n ],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true\n }\n ],\n templateUrl: './toggle.component.html',\n encapsulation: ViewEncapsulation.None\n})\nexport class ToggleComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnInit {\n\n private readonly symbolRegistry = inject(SymbolRegistry);\n @ViewChild('input', { static: true }) inputElement: ElementRef<HTMLInputElement>;\n @ViewChild('label', { static: true }) labelElement: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input() disabled: boolean;\n @Input() checked: boolean;\n @Input() required: boolean;\n @Input() set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n }\n }\n get name(): string {\n return this._name;\n }\n // eslint-disable-next-line\n @Output() readonly change: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n hasLabel: boolean = false;\n private _name: string;\n private _controlValueAccessorChangeFn: (value: boolean) => void;\n onTouched: () => void;\n\n ngOnChanges(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n ngOnInit() {\n this.symbolRegistry.registerSymbols([\n apCheck2\n ]);\n }\n\n ngAfterContentInit(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n onValueChange() {\n if (this.onTouched) {\n this.onTouched();\n }\n if (!this.disabled) {\n this.checked = !this.checked;\n this.focus();\n this.change.emit(this.checked);\n if (this._controlValueAccessorChangeFn) {\n this._controlValueAccessorChangeFn(this.checked);\n }\n\n // Assigning the value again here is redundant, but we have to do it in case it was\n // changed inside the `change` listener which will cause the input to be out of sync.\n if (this.inputElement) {\n this.inputElement.nativeElement.checked = this.checked;\n }\n }\n }\n\n focus() {\n this.inputElement.nativeElement.focus();\n }\n\n writeValue(value: boolean): void {\n this.checked = value;\n }\n registerOnChange(fn: (value: boolean) => void): void {\n this._controlValueAccessorChangeFn = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n validate({ value }: FormControl) {\n return this.required && !value && {\n invalid: true\n }\n }\n\n _preventBubblingFromLabel(event: MouseEvent) {\n if (!!event.target && this.labelElement.nativeElement.contains(event.target as HTMLElement)) {\n event.stopPropagation();\n }\n }\n\n}\n","<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAiBa,MAAA,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAAA,KAAK,EAAE,IAAI;EACb;MAuBW,eAAe,CAAA;AArB5B,IAAA,WAAA,GAAA;AAuBqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAGpC,QAAA,IAAS,CAAA,SAAA,GAAW,EAAE,CAAC;AAClB,QAAA,IAAc,CAAA,cAAA,GAAkB,IAAI,CAAC;AAEtD,QAAA,IAAa,CAAA,aAAA,GAAqB,OAAO,CAAC;;AAahC,QAAA,IAAA,CAAA,MAAM,GAA0B,IAAI,YAAY,EAAW,CAAC;AAE/E,QAAA,IAAQ,CAAA,QAAA,GAAY,KAAK,CAAC;KAwE7B;IAnFG,IAAa,IAAI,CAAC,IAAY,EAAA;AAC1B,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AAC5B,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;AAClC,SAA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J,qBAAA,EAEc,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,qjCAAA,EAAA,MAAA,EAAA,CAAA,wyEAAA,CAAA,EAAA,CAAA;8BAKC,YAAY,EAAA,CAAA;sBAAjD,SAAS;gBAAC,IAAA,EAAA,CAAA,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;gBACE,YAAY,EAAA,CAAA;sBAAjD,SAAS;gBAAC,IAAA,EAAA,CAAA,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;gBACf,SAAS,EAAA,CAAA;sBAA7B,KAAK;uBAAC,YAAY,CAAA;gBACO,cAAc,EAAA,CAAA;sBAAvC,KAAK;uBAAC,iBAAiB,CAAA;gBACG,eAAe,EAAA,CAAA;sBAAzC,KAAK;uBAAC,kBAAkB,CAAA;gBAChB,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACO,IAAI,EAAA,CAAA;sBAAhB,KAAK;gBASa,MAAM,EAAA,CAAA;sBAAxB,MAAM;;;AEjEX;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-toggle.mjs","sources":["../../../libs/ui-components/toggle/src/toggle.component.ts","../../../libs/ui-components/toggle/src/toggle.component.html","../../../libs/ui-components/toggle/src/agorapulse-ui-components-toggle.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n inject,\n Input,\n OnChanges,\n OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {CommonModule, NgIf} from '@angular/common';\nimport {apCheck2, SymbolComponent, SymbolRegistry} from '@agorapulse/ui-symbol';\nimport {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {ConfirmModalComponent} from '@agorapulse/ui-components/confirm-modal';\nimport {MatLegacyDialog} from '@angular/material/legacy-dialog';\nimport {first} from 'rxjs/operators';\n\nexport const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-toggle[name]',\n styleUrls: ['./toggle.component.scss'],\n standalone: true,\n imports: [NgIf, SymbolComponent, CommonModule],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true,\n },\n MatLegacyDialog,\n ],\n templateUrl: './toggle.component.html',\n encapsulation: ViewEncapsulation.None,\n})\nexport class ToggleComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnInit {\n private readonly symbolRegistry = inject(SymbolRegistry);\n private readonly dialog = inject(MatLegacyDialog);\n private readonly cdr = inject(ChangeDetectorRef);\n\n @ViewChild('input', {static: true}) inputElement: ElementRef<HTMLInputElement>;\n @ViewChild('label', {static: true}) labelElement: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input() disabled: boolean;\n @Input() checked: boolean;\n @Input() required: boolean;\n @Input() confirm: boolean = false;\n @Input() confirmMessage: string = 'If you toggle this, it will affect other things. Are you sure';\n @Input() confirmOk: string = 'Confirm';\n @Input() confirmCancel: string = 'Cancel';\n @Input() confirmTitle: string = 'Are you sure?';\n @Input() set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n }\n }\n get name(): string {\n return this._name;\n }\n // eslint-disable-next-line\n @Output() readonly change: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n hasLabel: boolean = false;\n private _name: string;\n private _controlValueAccessorChangeFn: (value: boolean) => void;\n onTouched: () => void;\n\n ngOnChanges(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n ngOnInit() {\n this.symbolRegistry.registerSymbols([apCheck2]);\n }\n\n ngAfterContentInit(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n onValueChange() {\n if (!this.disabled) {\n if (!this.confirm) {\n if (this.onTouched) {\n this.onTouched();\n }\n this.changeValue();\n } else {\n const toggleConfirmModal = {\n contentText: this.confirmMessage,\n headerTitle: this.confirmTitle,\n footerCancelButtonLabel: this.confirmCancel,\n footerConfirmButtonLabel: this.confirmOk,\n footerConfirmButtonId: 'confirm',\n footerCancelButtonId: 'cancel',\n };\n const modalConfig = {\n matDialogConfig: {\n panelClass: 'design-system',\n width: '550px',\n },\n };\n\n const dialogRef = ConfirmModalComponent.open(this.dialog, toggleConfirmModal, modalConfig);\n dialogRef\n .afterClosed()\n .pipe(first())\n .subscribe(result => {\n if (result) {\n if (this.onTouched) {\n this.onTouched();\n }\n this.changeValue();\n }\n });\n }\n }\n }\n\n changeValue(): void {\n this.checked = !this.checked;\n this.focus();\n this.change.emit(this.checked);\n if (this._controlValueAccessorChangeFn) {\n this._controlValueAccessorChangeFn(this.checked);\n }\n\n // Assigning the value again here is redundant, but we have to do it in case it was\n // changed inside the `change` listener which will cause the input to be out of sync.\n if (this.inputElement) {\n this.inputElement.nativeElement.checked = this.checked;\n }\n this.cdr.markForCheck();\n }\n\n focus() {\n this.inputElement.nativeElement.focus();\n }\n\n writeValue(value: boolean): void {\n this.checked = value;\n }\n registerOnChange(fn: (value: boolean) => void): void {\n this._controlValueAccessorChangeFn = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n validate({value}: FormControl) {\n return (\n this.required &&\n !value && {\n invalid: true,\n }\n );\n }\n\n _preventBubblingFromLabel(event: MouseEvent) {\n if (!!event.target && this.labelElement.nativeElement.contains(event.target as HTMLElement)) {\n event.stopPropagation();\n }\n }\n}\n","<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAuBa,MAAA,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAAA,KAAK,EAAE,IAAI;EACb;MAoBW,eAAe,CAAA;AAlB5B,IAAA,WAAA,GAAA;AAmBqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACxC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACjC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAI5B,QAAA,IAAS,CAAA,SAAA,GAAW,EAAE,CAAC;AAClB,QAAA,IAAc,CAAA,cAAA,GAAkB,IAAI,CAAC;AAEtD,QAAA,IAAa,CAAA,aAAA,GAAqB,OAAO,CAAC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,CAAA;sBAAjB,KAAK;gBACG,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,YAAY,EAAA,CAAA;sBAApB,KAAK;gBACO,IAAI,EAAA,CAAA;sBAAhB,KAAK;gBASa,MAAM,EAAA,CAAA;sBAAxB,MAAM;;;AE3EX;;AAEG;;;;"}
@@ -1,8 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { forwardRef, inject, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Output } from '@angular/core';
2
+ import { forwardRef, inject, ChangeDetectorRef, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, Output } from '@angular/core';
3
3
  import { CommonModule, NgIf } from '@angular/common';
4
4
  import { SymbolRegistry, apCheck2, SymbolComponent } from '@agorapulse/ui-symbol';
5
5
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
6
+ import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
7
+ import { MatLegacyDialog } from '@angular/material/legacy-dialog';
8
+ import { first } from 'rxjs/operators';
6
9
 
7
10
  const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
8
11
  provide: NG_VALUE_ACCESSOR,
@@ -12,9 +15,16 @@ const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
12
15
  class ToggleComponent {
13
16
  constructor() {
14
17
  this.symbolRegistry = inject(SymbolRegistry);
18
+ this.dialog = inject(MatLegacyDialog);
19
+ this.cdr = inject(ChangeDetectorRef);
15
20
  this.ariaLabel = '';
16
21
  this.ariaLabelledby = null;
17
22
  this.labelPosition = 'right';
23
+ this.confirm = false;
24
+ this.confirmMessage = 'If you toggle this, it will affect other things. Are you sure';
25
+ this.confirmOk = 'Confirm';
26
+ this.confirmCancel = 'Cancel';
27
+ this.confirmTitle = 'Are you sure?';
18
28
  // eslint-disable-next-line
19
29
  this.change = new EventEmitter();
20
30
  this.hasLabel = false;
@@ -33,9 +43,7 @@ class ToggleComponent {
33
43
  }
34
44
  }
35
45
  ngOnInit() {
36
- this.symbolRegistry.registerSymbols([
37
- apCheck2
38
- ]);
46
+ this.symbolRegistry.registerSymbols([apCheck2]);
39
47
  }
40
48
  ngAfterContentInit() {
41
49
  if (this.labelElement) {
@@ -43,23 +51,57 @@ class ToggleComponent {
43
51
  }
44
52
  }
45
53
  onValueChange() {
46
- if (this.onTouched) {
47
- this.onTouched();
48
- }
49
54
  if (!this.disabled) {
50
- this.checked = !this.checked;
51
- this.focus();
52
- this.change.emit(this.checked);
53
- if (this._controlValueAccessorChangeFn) {
54
- this._controlValueAccessorChangeFn(this.checked);
55
+ if (!this.confirm) {
56
+ if (this.onTouched) {
57
+ this.onTouched();
58
+ }
59
+ this.changeValue();
55
60
  }
56
- // Assigning the value again here is redundant, but we have to do it in case it was
57
- // changed inside the `change` listener which will cause the input to be out of sync.
58
- if (this.inputElement) {
59
- this.inputElement.nativeElement.checked = this.checked;
61
+ else {
62
+ const toggleConfirmModal = {
63
+ contentText: this.confirmMessage,
64
+ headerTitle: this.confirmTitle,
65
+ footerCancelButtonLabel: this.confirmCancel,
66
+ footerConfirmButtonLabel: this.confirmOk,
67
+ footerConfirmButtonId: 'confirm',
68
+ footerCancelButtonId: 'cancel',
69
+ };
70
+ const modalConfig = {
71
+ matDialogConfig: {
72
+ panelClass: 'design-system',
73
+ width: '550px',
74
+ },
75
+ };
76
+ const dialogRef = ConfirmModalComponent.open(this.dialog, toggleConfirmModal, modalConfig);
77
+ dialogRef
78
+ .afterClosed()
79
+ .pipe(first())
80
+ .subscribe(result => {
81
+ if (result) {
82
+ if (this.onTouched) {
83
+ this.onTouched();
84
+ }
85
+ this.changeValue();
86
+ }
87
+ });
60
88
  }
61
89
  }
62
90
  }
91
+ changeValue() {
92
+ this.checked = !this.checked;
93
+ this.focus();
94
+ this.change.emit(this.checked);
95
+ if (this._controlValueAccessorChangeFn) {
96
+ this._controlValueAccessorChangeFn(this.checked);
97
+ }
98
+ // Assigning the value again here is redundant, but we have to do it in case it was
99
+ // changed inside the `change` listener which will cause the input to be out of sync.
100
+ if (this.inputElement) {
101
+ this.inputElement.nativeElement.checked = this.checked;
102
+ }
103
+ this.cdr.markForCheck();
104
+ }
63
105
  focus() {
64
106
  this.inputElement.nativeElement.focus();
65
107
  }
@@ -76,9 +118,10 @@ class ToggleComponent {
76
118
  this.disabled = isDisabled;
77
119
  }
78
120
  validate({ value }) {
79
- return this.required && !value && {
80
- invalid: true
81
- };
121
+ return (this.required &&
122
+ !value && {
123
+ invalid: true,
124
+ });
82
125
  }
83
126
  _preventBubblingFromLabel(event) {
84
127
  if (!!event.target && this.labelElement.nativeElement.contains(event.target)) {
@@ -87,28 +130,26 @@ class ToggleComponent {
87
130
  }
88
131
  }
89
132
  ToggleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
90
- ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", name: "name" }, outputs: { change: "change" }, providers: [
133
+ ToggleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: ToggleComponent, isStandalone: true, selector: "ap-toggle[name]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], labelPosition: "labelPosition", disabled: "disabled", checked: "checked", required: "required", confirm: "confirm", confirmMessage: "confirmMessage", confirmOk: "confirmOk", confirmCancel: "confirmCancel", confirmTitle: "confirmTitle", name: "name" }, outputs: { change: "change" }, providers: [
91
134
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
92
135
  {
93
136
  provide: NG_VALIDATORS,
94
137
  useExisting: ToggleComponent,
95
- multi: true
96
- }
97
- ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
138
+ multi: true,
139
+ },
140
+ MatLegacyDialog,
141
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
98
142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ToggleComponent, decorators: [{
99
143
  type: Component,
100
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [
101
- NgIf,
102
- SymbolComponent,
103
- CommonModule
104
- ], providers: [
144
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-toggle[name]', standalone: true, imports: [NgIf, SymbolComponent, CommonModule], providers: [
105
145
  AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
106
146
  {
107
147
  provide: NG_VALIDATORS,
108
148
  useExisting: ToggleComponent,
109
- multi: true
110
- }
111
- ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
149
+ multi: true,
150
+ },
151
+ MatLegacyDialog,
152
+ ], encapsulation: ViewEncapsulation.None, template: "<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n", styles: ["ap-toggle{position:relative}ap-toggle .toggle{display:flex;gap:8px;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);line-height:var(--sys-text-style-body-line-height);color:var(--ref-color-grey-100)}ap-toggle .toggle input.hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}ap-toggle .toggle input[type=checkbox]{margin:0;padding:0;width:0;height:0;transform:scale(0)}@media (hover: hover){ap-toggle .toggle input[type=checkbox]:focus:not(.disabled)~.switch-container .switch{outline:2px solid var(--ref-color-electric-blue-100);outline-offset:1px}}ap-toggle .toggle input[type=checkbox]:disabled~.switch-container .switch{background:var(--ref-color-grey-20);pointer-events:none;cursor:default}ap-toggle .toggle .switch-container{display:flex;gap:var(--ref-spacing-xs);align-items:center}ap-toggle .toggle .switch-container.label-left{flex-direction:row-reverse}ap-toggle .toggle .switch-container .switch{box-sizing:content-box;position:relative;display:flex;align-items:center;padding:2px;width:28px;height:12px;border-radius:16px;background:var(--ref-color-grey-40);transition:background-color .25s}ap-toggle .toggle .switch-container .switch:hover{cursor:pointer;background:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container .switch:active:not(.checked){background:var(--ref-color-grey-80)}ap-toggle .toggle .switch-container .switch.checked{background:var(--ref-color-electric-blue-100)}ap-toggle .toggle .switch-container .switch.checked:active{background:var(--ref-color-electric-blue-60)}ap-toggle .toggle .switch-container .switch.checked .knob{left:18px}ap-toggle .toggle .switch-container .switch .knob{width:12px;height:12px;background:white;border-radius:100%;position:absolute;transition:left .25s;left:2px}ap-toggle .toggle .switch-container label{display:flex;align-items:center;font-family:var(--sys-text-style-body-font-family);font-size:var(--sys-text-style-body-size);font-weight:var(--sys-text-style-body-weight);line-height:var(--sys-text-style-body-line-height)}ap-toggle .toggle .switch-container label:empty{display:none}ap-toggle .toggle .switch-container label.disabled{color:var(--ref-color-grey-60)}ap-toggle .toggle .switch-container label:hover:not(.disabled){cursor:pointer}\n"] }]
112
153
  }], propDecorators: { inputElement: [{
113
154
  type: ViewChild,
114
155
  args: ['input', { static: true }]
@@ -132,6 +173,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
132
173
  type: Input
133
174
  }], required: [{
134
175
  type: Input
176
+ }], confirm: [{
177
+ type: Input
178
+ }], confirmMessage: [{
179
+ type: Input
180
+ }], confirmOk: [{
181
+ type: Input
182
+ }], confirmCancel: [{
183
+ type: Input
184
+ }], confirmTitle: [{
185
+ type: Input
135
186
  }], name: [{
136
187
  type: Input
137
188
  }], change: [{
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-toggle.mjs","sources":["../../../libs/ui-components/toggle/src/toggle.component.ts","../../../libs/ui-components/toggle/src/toggle.component.html","../../../libs/ui-components/toggle/src/agorapulse-ui-components-toggle.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef, inject,\n Input,\n OnChanges, OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {CommonModule, NgIf} from \"@angular/common\";\nimport {apCheck2, SymbolComponent, SymbolRegistry} from \"@agorapulse/ui-symbol\";\nimport {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR} from \"@angular/forms\";\n\nexport const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-toggle[name]',\n styleUrls: ['./toggle.component.scss'],\n standalone: true,\n imports: [\n NgIf,\n SymbolComponent,\n CommonModule\n ],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true\n }\n ],\n templateUrl: './toggle.component.html',\n encapsulation: ViewEncapsulation.None\n})\nexport class ToggleComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnInit {\n\n private readonly symbolRegistry = inject(SymbolRegistry);\n @ViewChild('input', { static: true }) inputElement: ElementRef<HTMLInputElement>;\n @ViewChild('label', { static: true }) labelElement: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input() disabled: boolean;\n @Input() checked: boolean;\n @Input() required: boolean;\n @Input() set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n }\n }\n get name(): string {\n return this._name;\n }\n // eslint-disable-next-line\n @Output() readonly change: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n hasLabel: boolean = false;\n private _name: string;\n private _controlValueAccessorChangeFn: (value: boolean) => void;\n onTouched: () => void;\n\n ngOnChanges(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n ngOnInit() {\n this.symbolRegistry.registerSymbols([\n apCheck2\n ]);\n }\n\n ngAfterContentInit(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n onValueChange() {\n if (this.onTouched) {\n this.onTouched();\n }\n if (!this.disabled) {\n this.checked = !this.checked;\n this.focus();\n this.change.emit(this.checked);\n if (this._controlValueAccessorChangeFn) {\n this._controlValueAccessorChangeFn(this.checked);\n }\n\n // Assigning the value again here is redundant, but we have to do it in case it was\n // changed inside the `change` listener which will cause the input to be out of sync.\n if (this.inputElement) {\n this.inputElement.nativeElement.checked = this.checked;\n }\n }\n }\n\n focus() {\n this.inputElement.nativeElement.focus();\n }\n\n writeValue(value: boolean): void {\n this.checked = value;\n }\n registerOnChange(fn: (value: boolean) => void): void {\n this._controlValueAccessorChangeFn = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n validate({ value }: FormControl) {\n return this.required && !value && {\n invalid: true\n }\n }\n\n _preventBubblingFromLabel(event: MouseEvent) {\n if (!!event.target && this.labelElement.nativeElement.contains(event.target as HTMLElement)) {\n event.stopPropagation();\n }\n }\n\n}\n","<div class=\"toggle\"\n (click)=\"_preventBubblingFromLabel($event)\"\n>\n <input #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\"\n >\n <div class=\"switch\"\n [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n >\n <div class=\"knob\"></div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\"\n >\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAiBa,MAAA,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAAA,KAAK,EAAE,IAAI;EACb;MAuBW,eAAe,CAAA;AArB5B,IAAA,WAAA,GAAA;AAuBqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QAGpC,IAAS,CAAA,SAAA,GAAW,EAAE,CAAC;QAClB,IAAc,CAAA,cAAA,GAAkB,IAAI,CAAC;QAEtD,IAAa,CAAA,aAAA,GAAqB,OAAO,CAAC;;AAahC,QAAA,IAAA,CAAA,MAAM,GAA0B,IAAI,YAAY,EAAW,CAAC;QAE/E,IAAQ,CAAA,QAAA,GAAY,KAAK,CAAC;AAwE7B,KAAA;IAnFG,IAAa,IAAI,CAAC,IAAY,EAAA;AAC1B,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AAC5B,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,UAAU,CAAC;AAClC,SAAA;KACJ;AACD,IAAA,IAAI,IAAI,GAAA;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;IASD,WAAW,GAAA;QACP,IAAI,IAAI,CAAC,YAAY,EAAE;AACnB,YAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AACxE,SAAA;KACJ;IAED,QAAQ,GAAA;AACJ,QAAA,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC;YAChC,QAAQ;AACX,SAAA,CAAC,CAAC;KACN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AAA;sBAA7B,KAAK;uBAAC,YAAY,CAAA;gBACO,cAAc,EAAA,CAAA;sBAAvC,KAAK;uBAAC,iBAAiB,CAAA;gBACG,eAAe,EAAA,CAAA;sBAAzC,KAAK;uBAAC,kBAAkB,CAAA;gBAChB,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACO,IAAI,EAAA,CAAA;sBAAhB,KAAK;gBASa,MAAM,EAAA,CAAA;sBAAxB,MAAM;;;AEjEX;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-toggle.mjs","sources":["../../../libs/ui-components/toggle/src/toggle.component.ts","../../../libs/ui-components/toggle/src/toggle.component.html","../../../libs/ui-components/toggle/src/agorapulse-ui-components-toggle.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n inject,\n Input,\n OnChanges,\n OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {CommonModule, NgIf} from '@angular/common';\nimport {apCheck2, SymbolComponent, SymbolRegistry} from '@agorapulse/ui-symbol';\nimport {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {ConfirmModalComponent} from '@agorapulse/ui-components/confirm-modal';\nimport {MatLegacyDialog} from '@angular/material/legacy-dialog';\nimport {first} from 'rxjs/operators';\n\nexport const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'ap-toggle[name]',\n styleUrls: ['./toggle.component.scss'],\n standalone: true,\n imports: [NgIf, SymbolComponent, CommonModule],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true,\n },\n MatLegacyDialog,\n ],\n templateUrl: './toggle.component.html',\n encapsulation: ViewEncapsulation.None,\n})\nexport class ToggleComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnInit {\n private readonly symbolRegistry = inject(SymbolRegistry);\n private readonly dialog = inject(MatLegacyDialog);\n private readonly cdr = inject(ChangeDetectorRef);\n\n @ViewChild('input', {static: true}) inputElement: ElementRef<HTMLInputElement>;\n @ViewChild('label', {static: true}) labelElement: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input() disabled: boolean;\n @Input() checked: boolean;\n @Input() required: boolean;\n @Input() confirm: boolean = false;\n @Input() confirmMessage: string = 'If you toggle this, it will affect other things. Are you sure';\n @Input() confirmOk: string = 'Confirm';\n @Input() confirmCancel: string = 'Cancel';\n @Input() confirmTitle: string = 'Are you sure?';\n @Input() set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n }\n }\n get name(): string {\n return this._name;\n }\n // eslint-disable-next-line\n @Output() readonly change: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n hasLabel: boolean = false;\n private _name: string;\n private _controlValueAccessorChangeFn: (value: boolean) => void;\n onTouched: () => void;\n\n ngOnChanges(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n ngOnInit() {\n this.symbolRegistry.registerSymbols([apCheck2]);\n }\n\n ngAfterContentInit(): void {\n if (this.labelElement) {\n this.hasLabel = !!this.labelElement.nativeElement.textContent.trim();\n }\n }\n\n onValueChange() {\n if (!this.disabled) {\n if (!this.confirm) {\n if (this.onTouched) {\n this.onTouched();\n }\n this.changeValue();\n } else {\n const toggleConfirmModal = {\n contentText: this.confirmMessage,\n headerTitle: this.confirmTitle,\n footerCancelButtonLabel: this.confirmCancel,\n footerConfirmButtonLabel: this.confirmOk,\n footerConfirmButtonId: 'confirm',\n footerCancelButtonId: 'cancel',\n };\n const modalConfig = {\n matDialogConfig: {\n panelClass: 'design-system',\n width: '550px',\n },\n };\n\n const dialogRef = ConfirmModalComponent.open(this.dialog, toggleConfirmModal, modalConfig);\n dialogRef\n .afterClosed()\n .pipe(first())\n .subscribe(result => {\n if (result) {\n if (this.onTouched) {\n this.onTouched();\n }\n this.changeValue();\n }\n });\n }\n }\n }\n\n changeValue(): void {\n this.checked = !this.checked;\n this.focus();\n this.change.emit(this.checked);\n if (this._controlValueAccessorChangeFn) {\n this._controlValueAccessorChangeFn(this.checked);\n }\n\n // Assigning the value again here is redundant, but we have to do it in case it was\n // changed inside the `change` listener which will cause the input to be out of sync.\n if (this.inputElement) {\n this.inputElement.nativeElement.checked = this.checked;\n }\n this.cdr.markForCheck();\n }\n\n focus() {\n this.inputElement.nativeElement.focus();\n }\n\n writeValue(value: boolean): void {\n this.checked = value;\n }\n registerOnChange(fn: (value: boolean) => void): void {\n this._controlValueAccessorChangeFn = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n validate({value}: FormControl) {\n return (\n this.required &&\n !value && {\n invalid: true,\n }\n );\n }\n\n _preventBubblingFromLabel(event: MouseEvent) {\n if (!!event.target && this.labelElement.nativeElement.contains(event.target as HTMLElement)) {\n event.stopPropagation();\n }\n }\n}\n","<div class=\"toggle\" (click)=\"_preventBubblingFromLabel($event)\">\n <input\n #input\n class=\"hidden\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"name\"\n [name]=\"name\"\n [checked]=\"checked\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [attr.data-test]=\"name\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n [attr.aria-checked]=\"checked\"\n (click)=\"onValueChange()\" />\n <div class=\"switch-container\" [class.label-left]=\"labelPosition === 'left'\">\n <div class=\"switch\" [class.checked]=\"checked\" (click)=\"onValueChange()\">\n <div class=\"knob\"></div>\n </div>\n <label #label [class.disabled]=\"disabled\" [for]=\"name\">\n <ng-content></ng-content>\n </label>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAuBa,MAAA,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAAA,KAAK,EAAE,IAAI;EACb;MAoBW,eAAe,CAAA;AAlB5B,IAAA,WAAA,GAAA;AAmBqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACxC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACjC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAI5B,IAAS,CAAA,SAAA,GAAW,EAAE,CAAC;QAClB,IAAc,CAAA,cAAA,GAAkB,IAAI,CAAC;QAEtD,IAAa,CAAA,aAAA,GAAqB,OAAO,CAAC;QAI1C,IAAO,CAAA,OAAA,GAAY,KAAK,CAAC;QACzB,IAAc,CAAA,cAAA,GAAW,+DAA+D,CAAC;QACzF,IAAS,CAAA,SAAA,GAAW,SAAS,CAAC;QAC9B,IAAa,CAAA,aAAA,GAAW,QAAQ,CAAC;QACjC,IAAY,CAAA,YAAA,GAAW,eAAe,CAAC;;AAU7B,QAAA,IAAA,CAAA,MAAM,GAA0B,IAAI,YAAY,EAAW,CAAC;QAE/E,IAAQ,CAAA,QAAA,GAAY,KAAK,CAAC;AA2G7B,KAAA;IAtHG,IAAa,IAAI,CAAC,IAAY,EAAA;AAC1B,QAA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AE,IAAI;AACd,yBAAA;wBACD,eAAe;qBAClB,EAEc,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,u5BAAA,EAAA,MAAA,EAAA,CAAA,wyEAAA,CAAA,EAAA,CAAA;8BAOD,YAAY,EAAA,CAAA;sBAA/C,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAA;gBACE,YAAY,EAAA,CAAA;sBAA/C,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,OAAO,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAA;gBACb,SAAS,EAAA,CAAA;sBAA7B,KAAK;uBAAC,YAAY,CAAA;gBACO,cAAc,EAAA,CAAA;sBAAvC,KAAK;uBAAC,iBAAiB,CAAA;gBACG,eAAe,EAAA,CAAA;sBAAzC,KAAK;uBAAC,kBAAkB,CAAA;gBAChB,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,cAAc,EAAA,CAAA;sBAAtB,KAAK;gBACG,SAAS,EAAA,CAAA;sBAAjB,KAAK;gBACG,aAAa,EAAA,CAAA;sBAArB,KAAK;gBACG,YAAY,EAAA,CAAA;sBAApB,KAAK;gBACO,IAAI,EAAA,CAAA;sBAAhB,KAAK;gBASa,MAAM,EAAA,CAAA;sBAAxB,MAAM;;;AE3EX;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agorapulse/ui-components",
3
3
  "description": "Agorapulse UI Components Library",
4
- "version": "15.1.17",
4
+ "version": "15.1.18",
5
5
  "author": "Benoit Hediard",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,5 +1,5 @@
1
- import { AfterContentInit, ElementRef, EventEmitter, OnChanges, OnInit } from "@angular/core";
2
- import { ControlValueAccessor, FormControl } from "@angular/forms";
1
+ import { AfterContentInit, ElementRef, EventEmitter, OnChanges, OnInit } from '@angular/core';
2
+ import { ControlValueAccessor, FormControl } from '@angular/forms';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR: {
5
5
  provide: import("@angular/core").InjectionToken<readonly ControlValueAccessor[]>;
@@ -8,6 +8,8 @@ export declare const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR: {
8
8
  };
9
9
  export declare class ToggleComponent implements ControlValueAccessor, AfterContentInit, OnChanges, OnInit {
10
10
  private readonly symbolRegistry;
11
+ private readonly dialog;
12
+ private readonly cdr;
11
13
  inputElement: ElementRef<HTMLInputElement>;
12
14
  labelElement: ElementRef<HTMLInputElement>;
13
15
  ariaLabel: string;
@@ -17,6 +19,11 @@ export declare class ToggleComponent implements ControlValueAccessor, AfterConte
17
19
  disabled: boolean;
18
20
  checked: boolean;
19
21
  required: boolean;
22
+ confirm: boolean;
23
+ confirmMessage: string;
24
+ confirmOk: string;
25
+ confirmCancel: string;
26
+ confirmTitle: string;
20
27
  set name(name: string);
21
28
  get name(): string;
22
29
  readonly change: EventEmitter<boolean>;
@@ -28,6 +35,7 @@ export declare class ToggleComponent implements ControlValueAccessor, AfterConte
28
35
  ngOnInit(): void;
29
36
  ngAfterContentInit(): void;
30
37
  onValueChange(): void;
38
+ changeValue(): void;
31
39
  focus(): void;
32
40
  writeValue(value: boolean): void;
33
41
  registerOnChange(fn: (value: boolean) => void): void;
@@ -38,5 +46,5 @@ export declare class ToggleComponent implements ControlValueAccessor, AfterConte
38
46
  };
39
47
  _preventBubblingFromLabel(event: MouseEvent): void;
40
48
  static ɵfac: i0.ɵɵFactoryDeclaration<ToggleComponent, never>;
41
- static ɵcmp: i0.ɵɵComponentDeclaration<ToggleComponent, "ap-toggle[name]", never, { "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "labelPosition": "labelPosition"; "disabled": "disabled"; "checked": "checked"; "required": "required"; "name": "name"; }, { "change": "change"; }, never, ["*"], true, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToggleComponent, "ap-toggle[name]", never, { "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "ariaDescribedby": "aria-describedby"; "labelPosition": "labelPosition"; "disabled": "disabled"; "checked": "checked"; "required": "required"; "confirm": "confirm"; "confirmMessage": "confirmMessage"; "confirmOk": "confirmOk"; "confirmCancel": "confirmCancel"; "confirmTitle": "confirmTitle"; "name": "name"; }, { "change": "change"; }, never, ["*"], true, never>;
42
50
  }