@agorapulse/ui-components 22.9.7 → 22.9.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agorapulse-ui-components-22.9.9-beta.1.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-button.mjs +2 -0
- package/fesm2022/agorapulse-ui-components-button.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-confirm-modal.mjs +19 -21
- package/fesm2022/agorapulse-ui-components-confirm-modal.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-datepicker.mjs +14 -33
- package/fesm2022/agorapulse-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-directives.mjs +3 -17
- package/fesm2022/agorapulse-ui-components-directives.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-i18n.mjs +7 -0
- package/fesm2022/agorapulse-ui-components-i18n.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-icon-button.mjs +4 -2
- package/fesm2022/agorapulse-ui-components-icon-button.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-snackbars-thread.mjs +99 -93
- package/fesm2022/agorapulse-ui-components-snackbars-thread.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-social-button.mjs +4 -2
- package/fesm2022/agorapulse-ui-components-social-button.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-split-button.mjs +8 -2
- package/fesm2022/agorapulse-ui-components-split-button.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-testing.mjs +157 -0
- package/fesm2022/agorapulse-ui-components-testing.mjs.map +1 -0
- package/fesm2022/agorapulse-ui-components-toggle.mjs +15 -19
- package/fesm2022/agorapulse-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components.mjs +1 -1
- package/fesm2022/agorapulse-ui-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/agorapulse-ui-components-confirm-modal.d.ts +16 -11
- package/types/agorapulse-ui-components-datepicker.d.ts +2 -7
- package/types/agorapulse-ui-components-directives.d.ts +1 -7
- package/types/agorapulse-ui-components-i18n.d.ts +7 -0
- package/types/agorapulse-ui-components-snackbars-thread.d.ts +92 -27
- package/types/agorapulse-ui-components-testing.d.ts +97 -0
- package/types/agorapulse-ui-components-toggle.d.ts +4 -5
- package/types/agorapulse-ui-components.d.ts +1 -1
- package/agorapulse-ui-components-22.9.7.tgz +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable } from '@angular/core';
|
|
4
|
+
import { MatDialog } from '@angular/material/dialog';
|
|
5
|
+
import { of } from 'rxjs';
|
|
6
|
+
import { SnackbarsThreadService } from '@agorapulse/ui-components/snackbars-thread';
|
|
7
|
+
|
|
8
|
+
function shownText(request) {
|
|
9
|
+
if (typeof request === 'string') {
|
|
10
|
+
return { key: request };
|
|
11
|
+
}
|
|
12
|
+
if ('raw' in request) {
|
|
13
|
+
return { raw: request.raw };
|
|
14
|
+
}
|
|
15
|
+
return request.params === undefined ? { key: request.key } : { key: request.key, params: request.params };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function askedConfirmation(i18n) {
|
|
19
|
+
return {
|
|
20
|
+
title: shownText(i18n.title),
|
|
21
|
+
message: shownText(i18n.message),
|
|
22
|
+
...(i18n.confirm === undefined ? {} : { confirm: shownText(i18n.confirm) }),
|
|
23
|
+
...(i18n.cancel === undefined ? {} : { cancel: shownText(i18n.cancel) }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A {@link MatDialog} for specs that answers every `ConfirmModalComponent.open` with {@link answer} instead of rendering
|
|
28
|
+
* it, and records the texts of each modal in {@link asked}. Any other component goes to the real dialog. It needs no
|
|
29
|
+
* test runner, so it works under Jest and Vitest alike.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* TestBed.configureTestingModule({ providers: [provideFakeConfirmModal({ answer: false })] });
|
|
33
|
+
* const confirmModal = TestBed.inject(FakeConfirmModal);
|
|
34
|
+
* // ...act...
|
|
35
|
+
* expect(confirmModal.asked).toEqual([{ title: { key: 'post.delete.title' }, message: { key: 'post.delete.message' } }]);
|
|
36
|
+
*/
|
|
37
|
+
class FakeConfirmModal extends MatDialog {
|
|
38
|
+
/** Every confirm modal opened, oldest first. */
|
|
39
|
+
asked = [];
|
|
40
|
+
/** What the next modals answer: `true` confirms, `false` cancels, `undefined` closes without a choice. */
|
|
41
|
+
answer = true;
|
|
42
|
+
open(target, config) {
|
|
43
|
+
if (target !== ConfirmModalComponent) {
|
|
44
|
+
return super.open(target, config);
|
|
45
|
+
}
|
|
46
|
+
const answer = this.answer;
|
|
47
|
+
const ref = {
|
|
48
|
+
componentInstance: {},
|
|
49
|
+
componentRef: {
|
|
50
|
+
setInput: (name, value) => {
|
|
51
|
+
if (name === 'i18n') {
|
|
52
|
+
this.asked.push(askedConfirmation(value));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
disableClose: true,
|
|
57
|
+
afterClosed: () => of(answer),
|
|
58
|
+
close: () => undefined,
|
|
59
|
+
};
|
|
60
|
+
return ref;
|
|
61
|
+
}
|
|
62
|
+
/** Forgets every modal opened so far. */
|
|
63
|
+
clear() {
|
|
64
|
+
this.asked.length = 0;
|
|
65
|
+
}
|
|
66
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeConfirmModal, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
67
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeConfirmModal });
|
|
68
|
+
}
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeConfirmModal, decorators: [{
|
|
70
|
+
type: Injectable
|
|
71
|
+
}] });
|
|
72
|
+
/**
|
|
73
|
+
* Provides {@link FakeConfirmModal} in place of {@link MatDialog}; inject the fake to set the answer and read what was asked.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* providers: [provideFakeConfirmModal({ answer: true })]
|
|
77
|
+
*/
|
|
78
|
+
function provideFakeConfirmModal(options = {}) {
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
provide: FakeConfirmModal,
|
|
82
|
+
useFactory: () => {
|
|
83
|
+
const fake = new FakeConfirmModal();
|
|
84
|
+
if ('answer' in options) {
|
|
85
|
+
fake.answer = options.answer;
|
|
86
|
+
}
|
|
87
|
+
return fake;
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{ provide: MatDialog, useExisting: FakeConfirmModal },
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const DEFAULT_TIMEOUT = 5000;
|
|
95
|
+
const TYPE_OF_INDEX = {
|
|
96
|
+
0: 'info',
|
|
97
|
+
1: 'success',
|
|
98
|
+
3: 'error',
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A {@link SnackbarsThreadService} for specs: it records every snackbar in {@link shown}, with its tone and its texts,
|
|
102
|
+
* and never starts a timer. It needs no test runner, so it works under Jest and Vitest alike.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* TestBed.configureTestingModule({ providers: [provideFakeSnackbars()] });
|
|
106
|
+
* const snackbars = TestBed.inject(FakeSnackbarsThreadService);
|
|
107
|
+
* // ...act...
|
|
108
|
+
* expect(snackbars.shown).toEqual([{ type: 'error', message: { key: 'post.failed' } }]);
|
|
109
|
+
*/
|
|
110
|
+
class FakeSnackbarsThreadService extends SnackbarsThreadService {
|
|
111
|
+
/** Every snackbar shown, oldest first; removing one does not drop it from here. */
|
|
112
|
+
shown = [];
|
|
113
|
+
pendingType;
|
|
114
|
+
show(message, type, options) {
|
|
115
|
+
this.pendingType = type;
|
|
116
|
+
return super.show(message, type, options);
|
|
117
|
+
}
|
|
118
|
+
addWithId(elem, id, timeout = DEFAULT_TIMEOUT) {
|
|
119
|
+
const type = this.pendingType ?? TYPE_OF_INDEX[elem.snackbarType];
|
|
120
|
+
this.pendingType = undefined;
|
|
121
|
+
this.shown.push({
|
|
122
|
+
type,
|
|
123
|
+
message: shownText(elem.i18n.message),
|
|
124
|
+
...(elem.i18n.action === undefined ? {} : { action: shownText(elem.i18n.action) }),
|
|
125
|
+
...(elem.navigateInternalUrl === undefined ? {} : { navigateInternalUrl: elem.navigateInternalUrl }),
|
|
126
|
+
...(elem.openUrlInNewTab === undefined ? {} : { openUrlInNewTab: elem.openUrlInNewTab }),
|
|
127
|
+
...(elem.callback === undefined ? {} : { callback: elem.callback }),
|
|
128
|
+
...(timeout === DEFAULT_TIMEOUT ? {} : { timeout }),
|
|
129
|
+
});
|
|
130
|
+
super.addWithId(elem, id, 0);
|
|
131
|
+
}
|
|
132
|
+
/** Forgets every snackbar shown so far, e.g. the ones a spec's setup raised. */
|
|
133
|
+
clear() {
|
|
134
|
+
this.shown.length = 0;
|
|
135
|
+
}
|
|
136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeSnackbarsThreadService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
137
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeSnackbarsThreadService });
|
|
138
|
+
}
|
|
139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FakeSnackbarsThreadService, decorators: [{
|
|
140
|
+
type: Injectable
|
|
141
|
+
}] });
|
|
142
|
+
/**
|
|
143
|
+
* Provides {@link FakeSnackbarsThreadService} in place of {@link SnackbarsThreadService}; inject the fake to read what was shown.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* providers: [provideFakeSnackbars()]
|
|
147
|
+
*/
|
|
148
|
+
function provideFakeSnackbars() {
|
|
149
|
+
return [FakeSnackbarsThreadService, { provide: SnackbarsThreadService, useExisting: FakeSnackbarsThreadService }];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Generated bundle index. Do not edit.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
export { FakeConfirmModal, FakeSnackbarsThreadService, provideFakeConfirmModal, provideFakeSnackbars };
|
|
157
|
+
//# sourceMappingURL=agorapulse-ui-components-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agorapulse-ui-components-testing.mjs","sources":["../../../libs/ui-components/testing/src/shown-text.ts","../../../libs/ui-components/testing/src/fake-confirm-modal.ts","../../../libs/ui-components/testing/src/fake-snackbars-thread.service.ts","../../../libs/ui-components/testing/src/agorapulse-ui-components-testing.ts"],"sourcesContent":["import { TranslationRequest } from '@agorapulse/ui-components/i18n';\n\n/** A text as a spec compares it: a key with its optional params, or raw text. A bare key string becomes `{ key }`. */\nexport type ShownText = { key: string; params?: Record<string, unknown> } | { raw: string };\n\nexport function shownText(request: TranslationRequest): ShownText {\n if (typeof request === 'string') {\n return { key: request };\n }\n if ('raw' in request) {\n return { raw: request.raw };\n }\n return request.params === undefined ? { key: request.key } : { key: request.key, params: request.params };\n}\n","import { ConfirmModalComponent, ConfirmModalTexts } from '@agorapulse/ui-components/confirm-modal';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { Injectable, Provider, TemplateRef } from '@angular/core';\nimport { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';\nimport { of } from 'rxjs';\nimport { ShownText, shownText } from './shown-text';\n\n/** One confirm modal the code under test opened. */\nexport interface AskedConfirmation {\n title: ShownText;\n message: ShownText;\n confirm?: ShownText;\n cancel?: ShownText;\n}\n\nfunction askedConfirmation(i18n: ConfirmModalTexts['i18n']): AskedConfirmation {\n return {\n title: shownText(i18n.title),\n message: shownText(i18n.message),\n ...(i18n.confirm === undefined ? {} : { confirm: shownText(i18n.confirm) }),\n ...(i18n.cancel === undefined ? {} : { cancel: shownText(i18n.cancel) }),\n };\n}\n\n/**\n * A {@link MatDialog} for specs that answers every `ConfirmModalComponent.open` with {@link answer} instead of rendering\n * it, and records the texts of each modal in {@link asked}. Any other component goes to the real dialog. It needs no\n * test runner, so it works under Jest and Vitest alike.\n *\n * @example\n * TestBed.configureTestingModule({ providers: [provideFakeConfirmModal({ answer: false })] });\n * const confirmModal = TestBed.inject(FakeConfirmModal);\n * // ...act...\n * expect(confirmModal.asked).toEqual([{ title: { key: 'post.delete.title' }, message: { key: 'post.delete.message' } }]);\n */\n@Injectable()\nexport class FakeConfirmModal extends MatDialog {\n /** Every confirm modal opened, oldest first. */\n readonly asked: AskedConfirmation[] = [];\n\n /** What the next modals answer: `true` confirms, `false` cancels, `undefined` closes without a choice. */\n answer: boolean | undefined = true;\n\n override open<T, D = unknown, R = unknown>(component: ComponentType<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;\n override open<T, D = unknown, R = unknown>(template: TemplateRef<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;\n override open<T, D = unknown, R = unknown>(target: ComponentType<T> | TemplateRef<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R> {\n if (target !== (ConfirmModalComponent as ComponentType<unknown>)) {\n return super.open(target, config);\n }\n const answer = this.answer;\n const ref = {\n componentInstance: {},\n componentRef: {\n setInput: (name: string, value: unknown): void => {\n if (name === 'i18n') {\n this.asked.push(askedConfirmation(value as ConfirmModalTexts['i18n']));\n }\n },\n },\n disableClose: true,\n afterClosed: () => of(answer),\n close: (): void => undefined,\n };\n return ref as unknown as MatDialogRef<T, R>;\n }\n\n /** Forgets every modal opened so far. */\n clear(): void {\n this.asked.length = 0;\n }\n}\n\n/**\n * Provides {@link FakeConfirmModal} in place of {@link MatDialog}; inject the fake to set the answer and read what was asked.\n *\n * @example\n * providers: [provideFakeConfirmModal({ answer: true })]\n */\nexport function provideFakeConfirmModal(options: { answer?: boolean | undefined } = {}): Provider[] {\n return [\n {\n provide: FakeConfirmModal,\n useFactory: () => {\n const fake = new FakeConfirmModal();\n if ('answer' in options) {\n fake.answer = options.answer;\n }\n return fake;\n },\n },\n { provide: MatDialog, useExisting: FakeConfirmModal },\n ];\n}\n","import { TranslationRequest } from '@agorapulse/ui-components/i18n';\nimport {\n externalSnackbarTypeAllowed,\n SnackbarOptions,\n SnackbarsThreadBase,\n SnackbarsThreadService,\n} from '@agorapulse/ui-components/snackbars-thread';\nimport { Injectable, Provider } from '@angular/core';\nimport { ShownText, shownText } from './shown-text';\n\n/** One snackbar the code under test showed. */\nexport interface ShownSnackbar {\n type: externalSnackbarTypeAllowed;\n message: ShownText;\n action?: ShownText;\n navigateInternalUrl?: string;\n openUrlInNewTab?: boolean;\n callback?: () => void;\n /** Present only when it differs from the service's default of 5000 ms; 0 keeps the snackbar open. */\n timeout?: number;\n}\n\nconst DEFAULT_TIMEOUT = 5000;\n\nconst TYPE_OF_INDEX: Record<SnackbarsThreadBase['snackbarType'], externalSnackbarTypeAllowed> = {\n 0: 'info',\n 1: 'success',\n 3: 'error',\n};\n\n/**\n * A {@link SnackbarsThreadService} for specs: it records every snackbar in {@link shown}, with its tone and its texts,\n * and never starts a timer. It needs no test runner, so it works under Jest and Vitest alike.\n *\n * @example\n * TestBed.configureTestingModule({ providers: [provideFakeSnackbars()] });\n * const snackbars = TestBed.inject(FakeSnackbarsThreadService);\n * // ...act...\n * expect(snackbars.shown).toEqual([{ type: 'error', message: { key: 'post.failed' } }]);\n */\n@Injectable()\nexport class FakeSnackbarsThreadService extends SnackbarsThreadService {\n /** Every snackbar shown, oldest first; removing one does not drop it from here. */\n readonly shown: ShownSnackbar[] = [];\n\n private pendingType: externalSnackbarTypeAllowed | undefined;\n\n override show(message: TranslationRequest, type: externalSnackbarTypeAllowed, options?: SnackbarOptions): string {\n this.pendingType = type;\n return super.show(message, type, options);\n }\n\n override addWithId(elem: SnackbarsThreadBase, id: string, timeout: number = DEFAULT_TIMEOUT): void {\n const type = this.pendingType ?? TYPE_OF_INDEX[elem.snackbarType];\n this.pendingType = undefined;\n this.shown.push({\n type,\n message: shownText(elem.i18n.message),\n ...(elem.i18n.action === undefined ? {} : { action: shownText(elem.i18n.action) }),\n ...(elem.navigateInternalUrl === undefined ? {} : { navigateInternalUrl: elem.navigateInternalUrl }),\n ...(elem.openUrlInNewTab === undefined ? {} : { openUrlInNewTab: elem.openUrlInNewTab }),\n ...(elem.callback === undefined ? {} : { callback: elem.callback }),\n ...(timeout === DEFAULT_TIMEOUT ? {} : { timeout }),\n });\n super.addWithId(elem, id, 0);\n }\n\n /** Forgets every snackbar shown so far, e.g. the ones a spec's setup raised. */\n clear(): void {\n this.shown.length = 0;\n }\n}\n\n/**\n * Provides {@link FakeSnackbarsThreadService} in place of {@link SnackbarsThreadService}; inject the fake to read what was shown.\n *\n * @example\n * providers: [provideFakeSnackbars()]\n */\nexport function provideFakeSnackbars(): Provider[] {\n return [FakeSnackbarsThreadService, { provide: SnackbarsThreadService, useExisting: FakeSnackbarsThreadService }];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAKM,SAAU,SAAS,CAAC,OAA2B,EAAA;AACjD,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;IAC3B;AACA,IAAA,IAAI,KAAK,IAAI,OAAO,EAAE;AAClB,QAAA,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAC/B;AACA,IAAA,OAAO,OAAO,CAAC,MAAM,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,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AA;AAChC,IAAA,OAAO,CAAC,0BAA0B,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;AACrH;;ACjFA;;AAEG;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
|
|
2
2
|
import { SymbolRegistry, apCheck, apClose, SymbolComponent } from '@agorapulse/ui-symbol';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { forwardRef, inject, ChangeDetectorRef, EventEmitter, booleanAttribute, Output, Input, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { forwardRef, inject, ChangeDetectorRef, input, EventEmitter, booleanAttribute, Output, Input, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
5
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
6
6
|
import { MatDialog } from '@angular/material/dialog';
|
|
7
7
|
import { first } from 'rxjs/operators';
|
|
8
8
|
|
|
9
|
+
const CONFIRM_TITLE_KEY = 'ui-components.toggle.confirm-title';
|
|
10
|
+
const CONFIRM_MESSAGE_KEY = 'ui-components.toggle.confirm-message';
|
|
9
11
|
const AP_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
|
|
10
12
|
provide: NG_VALUE_ACCESSOR,
|
|
11
13
|
useExisting: forwardRef(() => ToggleComponent),
|
|
@@ -25,10 +27,9 @@ class ToggleComponent {
|
|
|
25
27
|
checked = false;
|
|
26
28
|
required = false;
|
|
27
29
|
confirm = false;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
confirmTitle = 'Are you sure?';
|
|
30
|
+
/** Texts of the confirmation shown when `confirm` is set; the title and message default to the DS texts, the buttons to the confirm modal's. */
|
|
31
|
+
i18n = input({}, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "i18n" }] : /* istanbul ignore next */ []));
|
|
32
33
|
set name(name) {
|
|
33
34
|
if (!name.endsWith('Checkbox')) {
|
|
34
35
|
this._name = name + 'Checkbox';
|
|
@@ -68,13 +69,16 @@ class ToggleComponent {
|
|
|
68
69
|
this.changeValue();
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
72
|
+
const i18n = this.i18n();
|
|
71
73
|
const toggleConfirmModal = {
|
|
72
|
-
contentText: this.confirmMessage,
|
|
73
|
-
headerTitle: this.confirmTitle,
|
|
74
|
-
footerCancelButtonLabel: this.confirmCancel,
|
|
75
|
-
footerConfirmButtonLabel: this.confirmOk,
|
|
76
74
|
footerConfirmButtonId: 'confirm',
|
|
77
75
|
footerCancelButtonId: 'cancel',
|
|
76
|
+
i18n: {
|
|
77
|
+
title: i18n.confirmTitle ?? CONFIRM_TITLE_KEY,
|
|
78
|
+
message: i18n.confirmMessage ?? CONFIRM_MESSAGE_KEY,
|
|
79
|
+
confirm: i18n.confirm,
|
|
80
|
+
cancel: i18n.cancel,
|
|
81
|
+
},
|
|
78
82
|
};
|
|
79
83
|
const modalConfig = {
|
|
80
84
|
matDialogConfig: {
|
|
@@ -139,7 +143,7 @@ class ToggleComponent {
|
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
142
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
146
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: ToggleComponent, isStandalone: true, selector: "ap-toggle", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: false, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: false, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: false, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: false, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: false, isRequired: false, transformFunction: null }, i18n: { classPropertyName: "i18n", publicName: "i18n", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: true, transformFunction: null } }, outputs: { change: "change" }, providers: [
|
|
143
147
|
AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,
|
|
144
148
|
{
|
|
145
149
|
provide: NG_VALIDATORS,
|
|
@@ -191,15 +195,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
191
195
|
}]
|
|
192
196
|
}], confirm: [{
|
|
193
197
|
type: Input
|
|
194
|
-
}],
|
|
195
|
-
type: Input
|
|
196
|
-
}], confirmOk: [{
|
|
197
|
-
type: Input
|
|
198
|
-
}], confirmCancel: [{
|
|
199
|
-
type: Input
|
|
200
|
-
}], confirmTitle: [{
|
|
201
|
-
type: Input
|
|
202
|
-
}], name: [{
|
|
198
|
+
}], i18n: [{ type: i0.Input, args: [{ isSignal: true, alias: "i18n", required: false }] }], name: [{
|
|
203
199
|
type: Input,
|
|
204
200
|
args: [{
|
|
205
201
|
required: true,
|
|
@@ -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 { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nimport { apCheck, apClose, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport {\n AfterContentInit,\n booleanAttribute,\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 { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatDialog } from '@angular/material/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',\n styleUrls: ['./toggle.component.scss'],\n imports: [SymbolComponent],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true,\n },\n MatDialog,\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(MatDialog);\n private readonly cdr = inject(ChangeDetectorRef);\n\n @ViewChild('input') inputElement!: ElementRef<HTMLInputElement>;\n @ViewChild('label') labelElement!: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string | null = null;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input({\n transform: booleanAttribute,\n })\n disabled = false;\n @Input() checked = false;\n @Input({\n transform: booleanAttribute,\n })\n required = false;\n @Input() confirm = false;\n @Input() confirmMessage = 'If you toggle this, it will affect other things. Are you sure';\n @Input() confirmOk = 'Confirm';\n @Input() confirmCancel = 'Cancel';\n @Input() confirmTitle = 'Are you sure?';\n @Input({\n required: true,\n })\n set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n } else {\n this._name = name;\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 = '';\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([apCheck, apClose]);\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 this.cdr.markForCheck();\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\n class=\"toggle\"\n (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 [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n (change)=\"$event.stopPropagation()\" />\n <div\n class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\">\n <div\n class=\"switch\"\n [class.checked]=\"checked\"\n [class.disabled]=\"disabled\"\n (click)=\"onValueChange()\">\n <div class=\"knob\">\n <ap-symbol\n [class.checked]=\"checked\"\n [symbolId]=\"checked ? 'check' : 'close'\" />\n </div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\">\n <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":";;;;;;;;AAuBO,MAAM,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAA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ACH,wBAAA,QAAQ,EAAE,IAAI;AACjB,qBAAA;;sBAYA;;;AErFL;;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 { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nimport { DefaultTextKey, I18nOf } from '@agorapulse/ui-components/i18n';\nimport { apCheck, apClose, SymbolComponent, SymbolRegistry } from '@agorapulse/ui-symbol';\nimport {\n AfterContentInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n inject,\n input,\n Input,\n OnChanges,\n OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatDialog } from '@angular/material/dialog';\nimport { first } from 'rxjs/operators';\n\nconst CONFIRM_TITLE_KEY: DefaultTextKey = 'ui-components.toggle.confirm-title';\nconst CONFIRM_MESSAGE_KEY: DefaultTextKey = 'ui-components.toggle.confirm-message';\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',\n styleUrls: ['./toggle.component.scss'],\n imports: [SymbolComponent],\n providers: [\n AP_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: ToggleComponent,\n multi: true,\n },\n MatDialog,\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(MatDialog);\n private readonly cdr = inject(ChangeDetectorRef);\n\n @ViewChild('input') inputElement!: ElementRef<HTMLInputElement>;\n @ViewChild('label') labelElement!: ElementRef<HTMLInputElement>;\n @Input('aria-label') ariaLabel: string = '';\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n @Input('aria-describedby') ariaDescribedby: string | null = null;\n @Input() labelPosition: 'left' | 'right' = 'right';\n @Input({\n transform: booleanAttribute,\n })\n disabled = false;\n @Input() checked = false;\n @Input({\n transform: booleanAttribute,\n })\n required = false;\n @Input() confirm = false;\n\n /** Texts of the confirmation shown when `confirm` is set; the title and message default to the DS texts, the buttons to the confirm modal's. */\n readonly i18n = input<I18nOf<never, 'confirmTitle' | 'confirmMessage' | 'confirm' | 'cancel'>>({});\n\n @Input({\n required: true,\n })\n set name(name: string) {\n if (!name.endsWith('Checkbox')) {\n this._name = name + 'Checkbox';\n } else {\n this._name = name;\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 = '';\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([apCheck, apClose]);\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 i18n = this.i18n();\n const toggleConfirmModal = {\n footerConfirmButtonId: 'confirm',\n footerCancelButtonId: 'cancel',\n i18n: {\n title: i18n.confirmTitle ?? CONFIRM_TITLE_KEY,\n message: i18n.confirmMessage ?? CONFIRM_MESSAGE_KEY,\n confirm: i18n.confirm,\n cancel: i18n.cancel,\n },\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 this.cdr.markForCheck();\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\n class=\"toggle\"\n (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 [class.checked]=\"checked\"\n (click)=\"onValueChange()\"\n (change)=\"$event.stopPropagation()\" />\n <div\n class=\"switch-container\"\n [class.label-left]=\"labelPosition === 'left'\">\n <div\n class=\"switch\"\n [class.checked]=\"checked\"\n [class.disabled]=\"disabled\"\n (click)=\"onValueChange()\">\n <div class=\"knob\">\n <ap-symbol\n [class.checked]=\"checked\"\n [symbolId]=\"checked ? 'check' : 'close'\" />\n </div>\n </div>\n <label\n #label\n [class.disabled]=\"disabled\"\n [for]=\"name\">\n <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":";;;;;;;;AAyBA,MAAM,iBAAiB,GAAmB,oCAAoC;AAC9E,MAAM,mBAAmB,GAAmB,sCAAsC;AAE3E,MAAM,kCAAkC,GAAG;AAC9C,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,eAAe,CAAC;AAC9C,IAAA,KAAK,EAAE,IAAI;;MAoBF,eAAe,CAAA;AACP,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1B,IAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAE5B,IAAA,YAAY;AACZ,IAAA,YAAY;IACX,SAAS,GAAW,EAAE;IACjB,cAAc,GAAkB,IAAI;IACnC,eAAe,GAAkB,IAAI;IACvD,aAAa,GAAqB,OAAO;IAIlD,QAAQ,GAAG,KAAK;IACP,OAAO,GAAG,KAAK;IAIxB,QAAQ,GAAG,KAAK;IACP,OAAO,GAAG,KAAK;;IAGf,IAAI,GAAG,KAAK,CAA0E,EAAE;6EAAC;IAElG,IAGI,IAAI,CAAC,IAAY,EAAA;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AAC5B,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,UAAU;QAClC;aAAO;AACH,YAAA,IAAI,CAAC,KAAK,GAA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pC,SAAS;uBAAC,OAAO;;sBACjB,SAAS;uBAAC,OAAO;;sBACjB,KAAK;uBAAC,YAAY;;sBAClB,KAAK;uBAAC,iBAAiB;;sBACvB,KAAK;uBAAC,kBAAkB;;sBACxB;;sBACA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,SAAS,EAAE,gBAAgB;AAC9B,qBAAA;;sBAEA;;sBACA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,SAAS,EAAE,gBAAgB;AAC9B,qBAAA;;sBAEA;;sBAKA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,QAAQ,EAAE,IAAI;AACjB,qBAAA;;sBAYA;;;AE1FL;;AAEG;;;;"}
|
|
@@ -35,7 +35,7 @@ export { PasswordInputComponent } from '@agorapulse/ui-components/password-input
|
|
|
35
35
|
import { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';
|
|
36
36
|
export { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';
|
|
37
37
|
import { SnackbarsThreadComponent } from '@agorapulse/ui-components/snackbars-thread';
|
|
38
|
-
export {
|
|
38
|
+
export { SnackbarTypeValues, SnackbarsThreadComponent, SnackbarsThreadService } from '@agorapulse/ui-components/snackbars-thread';
|
|
39
39
|
import { StepperComponent } from '@agorapulse/ui-components/stepper';
|
|
40
40
|
export { StepperComponent } from '@agorapulse/ui-components/stepper';
|
|
41
41
|
import { TooltipDirective } from '@agorapulse/ui-components/tooltip';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agorapulse-ui-components.mjs","sources":["../../../libs/ui-components/src/lib/agorapulse-ui-components.module.ts","../../../libs/ui-components/index.ts","../../../libs/ui-components/agorapulse-ui-components.ts"],"sourcesContent":["// Modules\nimport { AddCommentComponent } from '@agorapulse/ui-components/add-comment';\nimport { AvatarComponent } from '@agorapulse/ui-components/avatar';\nimport { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nimport { DatepickerComponent } from '@agorapulse/ui-components/datepicker';\nimport {\n AutosizeTextareaDirective,\n DefaultImageDirective,\n EllipsisDirective,\n EqualValidatorDirective,\n FrozenGifDirective,\n MultiStyleTextDirective,\n} from '@agorapulse/ui-components/directives';\nimport { DotStepperComponent } from '@agorapulse/ui-components/dot-stepper';\nimport { InfoboxComponent } from '@agorapulse/ui-components/infobox';\nimport { LabelComponent } from '@agorapulse/ui-components/labels';\nimport { LabelsSelectorComponent } from '@agorapulse/ui-components/labels-selector';\nimport { MediaDisplayOverlayDialogComponent } from '@agorapulse/ui-components/media-display-overlay';\nimport { ModalComponent } from '@agorapulse/ui-components/modal';\nimport { DayDisabledPipe, NeoDatepickerComponent } from '@agorapulse/ui-components/neo-datepicker';\nimport { NotificationComponent } from '@agorapulse/ui-components/notification';\nimport { OverflowListComponent } from '@agorapulse/ui-components/overflow-list';\nimport { PaginatorButtonComponent, PaginatorComponent } from '@agorapulse/ui-components/paginator';\nimport { PasswordInputComponent } from '@agorapulse/ui-components/password-input';\nimport { PopmenuModule } from '@agorapulse/ui-components/popmenu';\nimport { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';\nimport { SnackbarsThreadComponent } from '@agorapulse/ui-components/snackbars-thread';\nimport { StepperComponent } from '@agorapulse/ui-components/stepper';\nimport { TooltipDirective } from '@agorapulse/ui-components/tooltip';\nimport { NgModule } from '@angular/core';\nimport { MAT_TABS_CONFIG } from '@angular/material/tabs';\n\n/**\n * @deprecated for better tree-shaking, use standalone component import instead\n */\n@NgModule({\n declarations: [],\n imports: [\n // Components\n AvatarComponent,\n StepperComponent,\n ConfirmModalComponent,\n DatepickerComponent,\n DotStepperComponent,\n EllipsisDirective,\n InfoboxComponent,\n OverflowListComponent,\n LabelsSelectorComponent,\n NeoDatepickerComponent,\n MediaDisplayOverlayDialogComponent,\n ModalComponent,\n PasswordInputComponent,\n LabelComponent,\n NotificationComponent,\n PaginatorComponent,\n PaginatorButtonComponent,\n SlideToggleComponent,\n SnackbarsThreadComponent,\n // Directives\n DefaultImageDirective,\n FrozenGifDirective,\n EqualValidatorDirective,\n MultiStyleTextDirective,\n TooltipDirective,\n AddCommentComponent,\n AutosizeTextareaDirective,\n // Pipes\n DayDisabledPipe,\n ],\n exports: [\n // Components\n AddCommentComponent,\n AvatarComponent,\n StepperComponent,\n ConfirmModalComponent,\n DatepickerComponent,\n NeoDatepickerComponent,\n DotStepperComponent,\n EllipsisDirective,\n InfoboxComponent,\n LabelComponent,\n OverflowListComponent,\n MediaDisplayOverlayDialogComponent,\n ModalComponent,\n PasswordInputComponent,\n LabelsSelectorComponent,\n NotificationComponent,\n PaginatorComponent,\n PaginatorButtonComponent,\n SlideToggleComponent,\n SnackbarsThreadComponent,\n // Pipes\n DayDisabledPipe,\n // Directives\n AutosizeTextareaDirective,\n DefaultImageDirective,\n FrozenGifDirective,\n EqualValidatorDirective,\n MultiStyleTextDirective,\n TooltipDirective,\n // Modules\n PopmenuModule,\n ],\n providers: [\n // Disable ripple effect\n // {provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: {disabled: true}},\n // Disable tabs animation\n { provide: MAT_TABS_CONFIG, useValue: { animationDuration: '0ms' } },\n ],\n})\nexport class AgorapulseUiComponentsModule {}\n","/*\n * Public API Surface of ui\n */\n\n// Module\nexport { PopmenuModule } from '@agorapulse/ui-components/popmenu';\nexport { AgorapulseUiComponentsModule } from './src/lib/agorapulse-ui-components.module';\n\n// Directive\nexport {\n AutosizeTextareaDirective,\n CheckboxDirective,\n DefaultImageDirective,\n EllipsisDirective,\n EqualValidatorDirective,\n FrozenGifDirective,\n MultiStyleTextDirective,\n} from '@agorapulse/ui-components/directives';\nexport { PopmenuDirective } from '@agorapulse/ui-components/popmenu';\nexport { TooltipDirective, TooltipExternalTriggerDirective } from '@agorapulse/ui-components/tooltip';\n\n// Dropdown base\nexport { DropdownOptionDirective, DropdownOverlay, DropdownTriggerDirective, createDropdownOverlay } from '@agorapulse/ui-components/dropdown-base';\nexport { DropdownContentDirective, DropdownPanelComponent } from '@agorapulse/ui-components/dropdown-panel';\n\n// Component\nexport { ActionDropdownComponent, ActionDropdownItem, ActionDropdownTriggerDirective } from '@agorapulse/ui-components/action-dropdown';\nexport { AddCommentComponent } from '@agorapulse/ui-components/add-comment';\nexport { AutocompleteComponent } from '@agorapulse/ui-components/autocomplete';\nexport { AvatarComponent, AvatarItem } from '@agorapulse/ui-components/avatar';\nexport { BadgeComponent } from '@agorapulse/ui-components/badge';\nexport { ButtonComponent } from '@agorapulse/ui-components/button';\nexport { CheckboxComponent } from '@agorapulse/ui-components/checkbox';\nexport { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nexport { CounterComponent } from '@agorapulse/ui-components/counter';\nexport {\n DatepickerComponent,\n DatepickerMode,\n DatepickerPreset,\n DatepickerSelectComponent,\n DatepickerValue,\n defaultDatepickerPresets,\n isPeriod,\n Period,\n} from '@agorapulse/ui-components/datepicker';\nexport { DotStepperComponent } from '@agorapulse/ui-components/dot-stepper';\nexport { IconButtonComponent } from '@agorapulse/ui-components/icon-button';\nexport { InfoboxComponent } from '@agorapulse/ui-components/infobox';\nexport { LabelComponent } from '@agorapulse/ui-components/labels';\nexport { LabelsSelectorComponent } from '@agorapulse/ui-components/labels-selector';\nexport { InputComponent } from '@agorapulse/ui-components/legacy/input';\nexport { SelectComponent } from '@agorapulse/ui-components/legacy/select';\nexport { TextareaComponent } from '@agorapulse/ui-components/legacy/textarea';\nexport { MediaDisplayOverlayDialogComponent } from '@agorapulse/ui-components/media-display-overlay';\nexport { ModalComponent, ModalConfig } from '@agorapulse/ui-components/modal';\nexport { NavSelectorComponent } from '@agorapulse/ui-components/nav-selector';\nexport {\n DayDisabledPipe,\n NeoDatePickerLocale,\n NeoDatePickerMode,\n NeoDatePickerStartsOn,\n NeoDatepickerComponent,\n} from '@agorapulse/ui-components/neo-datepicker';\nexport { NotificationComponent } from '@agorapulse/ui-components/notification';\nexport { OverflowListComponent, OverflowListDisplayType, OverflowListMode } from '@agorapulse/ui-components/overflow-list';\nexport { PaginatorButtonComponent, PaginatorComponent } from '@agorapulse/ui-components/paginator';\nexport { PasswordInputComponent } from '@agorapulse/ui-components/password-input';\nexport { PopmenuComponent } from '@agorapulse/ui-components/popmenu';\nexport { RadioComponent } from '@agorapulse/ui-components/radio';\nexport { RadioButtonCardComponent } from '@agorapulse/ui-components/radio-button-card';\nexport { SegmentedControlComponent, SegmentedControlOption } from '@agorapulse/ui-components/segmented-control';\nexport {\n SelectionDropdownComponent,\n SelectionDropdownItem,\n SelectionDropdownTriggerDirective,\n} from '@agorapulse/ui-components/selection-dropdown';\nexport { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';\nexport { SnackbarsThreadComponent } from '@agorapulse/ui-components/snackbars-thread';\nexport { SocialButtonComponent } from '@agorapulse/ui-components/social-button';\nexport { StatusComponent } from '@agorapulse/ui-components/status';\nexport { StatusCardActor, StatusCardComponent } from '@agorapulse/ui-components/status-card';\nexport { StepperComponent } from '@agorapulse/ui-components/stepper';\nexport { TagComponent } from '@agorapulse/ui-components/tag';\nexport { ToggleComponent } from '@agorapulse/ui-components/toggle';\n\n// Service\nexport { SnackbarsThreadService } from '@agorapulse/ui-components/snackbars-thread';\n\n// Model\nexport { ConfirmModalTexts } from '@agorapulse/ui-components/confirm-modal';\nexport * from '@agorapulse/ui-components/filter-dropdown';\nexport {\n CodeStatus,\n SnackbarTypeValues,\n SnackbarsThreadBase,\n externalSnackbarTypeAllowed,\n generateCodeStatus,\n} from '@agorapulse/ui-components/snackbars-thread';\nexport { Step } from '@agorapulse/ui-components/stepper';\nexport { CustomTooltipAvatarItem, CustomTooltipPresentationItem, CustomTooltipType } from '@agorapulse/ui-components/tooltip';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAgCA;;AAEG;MA4EU,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BAExB,eAAe;;wBAEf,yBAAyB;wBACzB,qBAAqB;wBACrB,kBAAkB;wBAClB,uBAAuB;wBACvB,uBAAuB;wBACvB,gBAAgB;;wBAEhB,aAAa;AAChB,qBAAA;AACD,oBAAA,SAAS,EAAE;;;;wBAIP,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE;AACvE,qBAAA;AACJ,iBAAA;;;AC7GD;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"agorapulse-ui-components.mjs","sources":["../../../libs/ui-components/src/lib/agorapulse-ui-components.module.ts","../../../libs/ui-components/index.ts","../../../libs/ui-components/agorapulse-ui-components.ts"],"sourcesContent":["// Modules\nimport { AddCommentComponent } from '@agorapulse/ui-components/add-comment';\nimport { AvatarComponent } from '@agorapulse/ui-components/avatar';\nimport { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nimport { DatepickerComponent } from '@agorapulse/ui-components/datepicker';\nimport {\n AutosizeTextareaDirective,\n DefaultImageDirective,\n EllipsisDirective,\n EqualValidatorDirective,\n FrozenGifDirective,\n MultiStyleTextDirective,\n} from '@agorapulse/ui-components/directives';\nimport { DotStepperComponent } from '@agorapulse/ui-components/dot-stepper';\nimport { InfoboxComponent } from '@agorapulse/ui-components/infobox';\nimport { LabelComponent } from '@agorapulse/ui-components/labels';\nimport { LabelsSelectorComponent } from '@agorapulse/ui-components/labels-selector';\nimport { MediaDisplayOverlayDialogComponent } from '@agorapulse/ui-components/media-display-overlay';\nimport { ModalComponent } from '@agorapulse/ui-components/modal';\nimport { DayDisabledPipe, NeoDatepickerComponent } from '@agorapulse/ui-components/neo-datepicker';\nimport { NotificationComponent } from '@agorapulse/ui-components/notification';\nimport { OverflowListComponent } from '@agorapulse/ui-components/overflow-list';\nimport { PaginatorButtonComponent, PaginatorComponent } from '@agorapulse/ui-components/paginator';\nimport { PasswordInputComponent } from '@agorapulse/ui-components/password-input';\nimport { PopmenuModule } from '@agorapulse/ui-components/popmenu';\nimport { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';\nimport { SnackbarsThreadComponent } from '@agorapulse/ui-components/snackbars-thread';\nimport { StepperComponent } from '@agorapulse/ui-components/stepper';\nimport { TooltipDirective } from '@agorapulse/ui-components/tooltip';\nimport { NgModule } from '@angular/core';\nimport { MAT_TABS_CONFIG } from '@angular/material/tabs';\n\n/**\n * @deprecated for better tree-shaking, use standalone component import instead\n */\n@NgModule({\n declarations: [],\n imports: [\n // Components\n AvatarComponent,\n StepperComponent,\n ConfirmModalComponent,\n DatepickerComponent,\n DotStepperComponent,\n EllipsisDirective,\n InfoboxComponent,\n OverflowListComponent,\n LabelsSelectorComponent,\n NeoDatepickerComponent,\n MediaDisplayOverlayDialogComponent,\n ModalComponent,\n PasswordInputComponent,\n LabelComponent,\n NotificationComponent,\n PaginatorComponent,\n PaginatorButtonComponent,\n SlideToggleComponent,\n SnackbarsThreadComponent,\n // Directives\n DefaultImageDirective,\n FrozenGifDirective,\n EqualValidatorDirective,\n MultiStyleTextDirective,\n TooltipDirective,\n AddCommentComponent,\n AutosizeTextareaDirective,\n // Pipes\n DayDisabledPipe,\n ],\n exports: [\n // Components\n AddCommentComponent,\n AvatarComponent,\n StepperComponent,\n ConfirmModalComponent,\n DatepickerComponent,\n NeoDatepickerComponent,\n DotStepperComponent,\n EllipsisDirective,\n InfoboxComponent,\n LabelComponent,\n OverflowListComponent,\n MediaDisplayOverlayDialogComponent,\n ModalComponent,\n PasswordInputComponent,\n LabelsSelectorComponent,\n NotificationComponent,\n PaginatorComponent,\n PaginatorButtonComponent,\n SlideToggleComponent,\n SnackbarsThreadComponent,\n // Pipes\n DayDisabledPipe,\n // Directives\n AutosizeTextareaDirective,\n DefaultImageDirective,\n FrozenGifDirective,\n EqualValidatorDirective,\n MultiStyleTextDirective,\n TooltipDirective,\n // Modules\n PopmenuModule,\n ],\n providers: [\n // Disable ripple effect\n // {provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: {disabled: true}},\n // Disable tabs animation\n { provide: MAT_TABS_CONFIG, useValue: { animationDuration: '0ms' } },\n ],\n})\nexport class AgorapulseUiComponentsModule {}\n","/*\n * Public API Surface of ui\n */\n\n// Module\nexport { PopmenuModule } from '@agorapulse/ui-components/popmenu';\nexport { AgorapulseUiComponentsModule } from './src/lib/agorapulse-ui-components.module';\n\n// Directive\nexport {\n AutosizeTextareaDirective,\n CheckboxDirective,\n DefaultImageDirective,\n EllipsisDirective,\n EqualValidatorDirective,\n FrozenGifDirective,\n MultiStyleTextDirective,\n} from '@agorapulse/ui-components/directives';\nexport { PopmenuDirective } from '@agorapulse/ui-components/popmenu';\nexport { TooltipDirective, TooltipExternalTriggerDirective } from '@agorapulse/ui-components/tooltip';\n\n// Dropdown base\nexport {\n DropdownOptionDirective,\n DropdownOverlay,\n DropdownTriggerDirective,\n createDropdownOverlay,\n} from '@agorapulse/ui-components/dropdown-base';\nexport { DropdownContentDirective, DropdownPanelComponent } from '@agorapulse/ui-components/dropdown-panel';\n\n// Component\nexport { ActionDropdownComponent, ActionDropdownItem, ActionDropdownTriggerDirective } from '@agorapulse/ui-components/action-dropdown';\nexport { AddCommentComponent } from '@agorapulse/ui-components/add-comment';\nexport { AutocompleteComponent } from '@agorapulse/ui-components/autocomplete';\nexport { AvatarComponent, AvatarItem } from '@agorapulse/ui-components/avatar';\nexport { BadgeComponent } from '@agorapulse/ui-components/badge';\nexport { ButtonComponent } from '@agorapulse/ui-components/button';\nexport { CheckboxComponent } from '@agorapulse/ui-components/checkbox';\nexport { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';\nexport { CounterComponent } from '@agorapulse/ui-components/counter';\nexport {\n DatepickerComponent,\n DatepickerMode,\n DatepickerPreset,\n DatepickerSelectComponent,\n DatepickerValue,\n Period,\n defaultDatepickerPresets,\n isPeriod,\n} from '@agorapulse/ui-components/datepicker';\nexport { DotStepperComponent } from '@agorapulse/ui-components/dot-stepper';\nexport { IconButtonComponent } from '@agorapulse/ui-components/icon-button';\nexport { InfoboxComponent } from '@agorapulse/ui-components/infobox';\nexport { LabelComponent } from '@agorapulse/ui-components/labels';\nexport { LabelsSelectorComponent } from '@agorapulse/ui-components/labels-selector';\nexport { InputComponent } from '@agorapulse/ui-components/legacy/input';\nexport { SelectComponent } from '@agorapulse/ui-components/legacy/select';\nexport { TextareaComponent } from '@agorapulse/ui-components/legacy/textarea';\nexport { MediaDisplayOverlayDialogComponent } from '@agorapulse/ui-components/media-display-overlay';\nexport { ModalComponent, ModalConfig } from '@agorapulse/ui-components/modal';\nexport { NavSelectorComponent } from '@agorapulse/ui-components/nav-selector';\nexport {\n DayDisabledPipe,\n NeoDatePickerLocale,\n NeoDatePickerMode,\n NeoDatePickerStartsOn,\n NeoDatepickerComponent,\n} from '@agorapulse/ui-components/neo-datepicker';\nexport { NotificationComponent } from '@agorapulse/ui-components/notification';\nexport { OverflowListComponent, OverflowListDisplayType, OverflowListMode } from '@agorapulse/ui-components/overflow-list';\nexport { PaginatorButtonComponent, PaginatorComponent } from '@agorapulse/ui-components/paginator';\nexport { PasswordInputComponent } from '@agorapulse/ui-components/password-input';\nexport { PopmenuComponent } from '@agorapulse/ui-components/popmenu';\nexport { RadioComponent } from '@agorapulse/ui-components/radio';\nexport { RadioButtonCardComponent } from '@agorapulse/ui-components/radio-button-card';\nexport { SegmentedControlComponent, SegmentedControlOption } from '@agorapulse/ui-components/segmented-control';\nexport {\n SelectionDropdownComponent,\n SelectionDropdownItem,\n SelectionDropdownTriggerDirective,\n} from '@agorapulse/ui-components/selection-dropdown';\nexport { SlideToggleComponent } from '@agorapulse/ui-components/slide-toggle';\nexport { SnackbarsThreadComponent } from '@agorapulse/ui-components/snackbars-thread';\nexport { SocialButtonComponent } from '@agorapulse/ui-components/social-button';\nexport { StatusComponent } from '@agorapulse/ui-components/status';\nexport { StatusCardActor, StatusCardComponent } from '@agorapulse/ui-components/status-card';\nexport { StepperComponent } from '@agorapulse/ui-components/stepper';\nexport { TagComponent } from '@agorapulse/ui-components/tag';\nexport { ToggleComponent } from '@agorapulse/ui-components/toggle';\n\n// Service\nexport { SnackbarsThreadService } from '@agorapulse/ui-components/snackbars-thread';\n\n// Model\nexport { ConfirmModalTexts } from '@agorapulse/ui-components/confirm-modal';\nexport * from '@agorapulse/ui-components/filter-dropdown';\nexport {\n SnackbarOptions,\n SnackbarTypeValues,\n SnackbarsThreadBase,\n externalSnackbarTypeAllowed,\n} from '@agorapulse/ui-components/snackbars-thread';\nexport { Step } from '@agorapulse/ui-components/stepper';\nexport { CustomTooltipAvatarItem, CustomTooltipPresentationItem, CustomTooltipType } from '@agorapulse/ui-components/tooltip';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAgCA;;AAEG;MA4EU,4BAA4B,CAAA;uGAA5B,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAA5B,4BAA4B,EAAA,OAAA,EAAA;;YAvEjC,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,mBAAmB;YACnB,mBAAmB;YACnB,iBAAiB;YACjB,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,sBAAsB;YACtB,kCAAkC;YAClC,cAAc;YACd,sBAAsB;YACtB,cAAc;YACd,qBAAqB;YACrB,kBAAkB;YAClB,wBAAwB;YACxB,oBAAoB;YACpB,wBAAwB;;YAExB,qBAAqB;YACrB,kBAAkB;YAClB,uBAAuB;YACvB,uBAAuB;YACvB,gBAAgB;YAChB,mBAAmB;YACnB,yBAAyB;;YAEzB,eAAe,CAAA,EAAA,OAAA,EAAA;;YAIf,mBAAmB;YACnB,eAAe;YACf,gBAAgB;YAChB,qBAAqB;YACrB,mBAAmB;YAC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BACtB,kCAAkC;wBAClC,cAAc;wBACd,sBAAsB;wBACtB,cAAc;wBACd,qBAAqB;wBACrB,kBAAkB;wBAClB,wBAAwB;wBACxB,oBAAoB;wBACpB,wBAAwB;;wBAExB,qBAAqB;wBACrB,kBAAkB;wBAClB,uBAAuB;wBACvB,uBAAuB;wBACvB,gBAAgB;wBAChB,mBAAmB;wBACnB,yBAAyB;;wBAEzB,eAAe;AAClB,qBAAA;AACD,oBAAA,OAAO,EAAE;;wBAEL,mBAAmB;wBACnB,eAAe;wBACf,gBAAgB;wBAChB,qBAAqB;wBACrB,mBAAmB;wBACnB,sBAAsB;wBACtB,mBAAmB;wBACnB,iBAAiB;wBACjB,gBAAgB;wBAChB,cAAc;wBACd,qBAAqB;wBACrB,kCAAkC;wBAClC,cAAc;wBACd,sBAAsB;wBACtB,uBAAuB;wBACvB,qBAAqB;wBACrB,kBAAkB;wBAClB,wBAAwB;wBACxB,oBAAoB;wBACpB,wBAAwB;;wBAExB,eAAe;;wBAEf,yBAAyB;wBACzB,qBAAqB;wBACrB,kBAAkB;wBAClB,uBAAuB;wBACvB,uBAAuB;wBACvB,gBAAgB;;wBAEhB,aAAa;AAChB,qBAAA;AACD,oBAAA,SAAS,EAAE;;;;wBAIP,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE;AACvE,qBAAA;AACJ,iBAAA;;;AC7GD;;AAEG;AAEH;;ACJA;;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": "22.9.
|
|
4
|
+
"version": "22.9.9-beta.1",
|
|
5
5
|
"author": "Benoit Hediard",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -281,6 +281,10 @@
|
|
|
281
281
|
"types": "./types/agorapulse-ui-components-tag.d.ts",
|
|
282
282
|
"default": "./fesm2022/agorapulse-ui-components-tag.mjs"
|
|
283
283
|
},
|
|
284
|
+
"./testing": {
|
|
285
|
+
"types": "./types/agorapulse-ui-components-testing.d.ts",
|
|
286
|
+
"default": "./fesm2022/agorapulse-ui-components-testing.mjs"
|
|
287
|
+
},
|
|
284
288
|
"./text-measurement": {
|
|
285
289
|
"types": "./types/agorapulse-ui-components-text-measurement.d.ts",
|
|
286
290
|
"default": "./fesm2022/agorapulse-ui-components-text-measurement.mjs"
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
+
import * as _agorapulse_ui_components_i18n from '@agorapulse/ui-components/i18n';
|
|
2
|
+
import { I18nOf } from '@agorapulse/ui-components/i18n';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
1
4
|
import { ModalConfig } from '@agorapulse/ui-components/modal';
|
|
2
5
|
import { MatDialogRef, MatDialog } from '@angular/material/dialog';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
6
|
|
|
5
7
|
interface ConfirmModalTexts {
|
|
6
8
|
footerConfirmButtonId: string | 'confirm';
|
|
7
|
-
footerConfirmButtonLabel: string;
|
|
8
|
-
contentText: string;
|
|
9
9
|
footerCancelButtonId: string | 'cancel';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/** `title` and `message` are required; `confirm` defaults to “OK”, `cancel` to “Cancel”. Rendered as text. */
|
|
11
|
+
i18n: I18nOf<'title' | 'message', 'confirm' | 'cancel'>;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
declare class ConfirmModalComponent {
|
|
15
15
|
dialogRef: MatDialogRef<ConfirmModalComponent, boolean>;
|
|
16
|
-
contentText: string;
|
|
17
16
|
footerCancelButtonId: string;
|
|
18
|
-
footerCancelButtonLabel: string;
|
|
19
17
|
footerConfirmButtonId: string;
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/** Texts of the modal, rendered as text; see {@link ConfirmModalTexts} for the required roles and defaults. */
|
|
19
|
+
readonly i18n: _angular_core.InputSignal<_agorapulse_ui_components_i18n.I18nOf<"title" | "message", "cancel" | "confirm">>;
|
|
20
|
+
private readonly resolveTexts;
|
|
21
|
+
protected readonly texts: _angular_core.Signal<{
|
|
22
|
+
readonly title: string | undefined;
|
|
23
|
+
readonly message: string | undefined;
|
|
24
|
+
readonly confirm: string;
|
|
25
|
+
readonly cancel: string;
|
|
26
|
+
}>;
|
|
22
27
|
constructor(dialogRef: MatDialogRef<ConfirmModalComponent, boolean>);
|
|
23
28
|
onCancel(): void;
|
|
24
29
|
onConfirm(): void;
|
|
25
30
|
static open(dialog: MatDialog, confirmModalTexts: ConfirmModalTexts, modalConfig?: ModalConfig | null): MatDialogRef<ConfirmModalComponent, boolean>;
|
|
26
|
-
static ɵfac:
|
|
27
|
-
static ɵcmp:
|
|
31
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ConfirmModalComponent, never>;
|
|
32
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ConfirmModalComponent, "ap-confirm-modal", never, { "footerCancelButtonId": { "alias": "footerCancelButtonId"; "required": false; }; "footerConfirmButtonId": { "alias": "footerConfirmButtonId"; "required": false; }; "i18n": { "alias": "i18n"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
export { ConfirmModalComponent };
|
|
@@ -58,7 +58,8 @@ declare class DatepickerMonthPickerComponent implements DropdownOverlay {
|
|
|
58
58
|
* the arrows alone costs one click per year; through the grid it costs one per page.
|
|
59
59
|
*/
|
|
60
60
|
readonly showingYears: _angular_core.WritableSignal<boolean>;
|
|
61
|
-
private readonly
|
|
61
|
+
private readonly panelTemplate;
|
|
62
|
+
private readonly overlay;
|
|
62
63
|
readonly isOpen: _angular_core.Signal<boolean>;
|
|
63
64
|
/** Browsable on its own, and re-anchored on the calendar's year whenever that moves. */
|
|
64
65
|
readonly displayedYear: _angular_core.WritableSignal<number>;
|
|
@@ -75,10 +76,7 @@ declare class DatepickerMonthPickerComponent implements DropdownOverlay {
|
|
|
75
76
|
readonly months: _angular_core.Signal<MonthOption[]>;
|
|
76
77
|
readonly years: _angular_core.Signal<YearOption[]>;
|
|
77
78
|
open(triggerElement?: HTMLElement): void;
|
|
78
|
-
/** The panel gives focus back to the trigger; a gesture (Escape, outside click) closes through it too. */
|
|
79
79
|
close(): void;
|
|
80
|
-
/** Back to months, so reopening never starts on the year grid the last visit happened to leave on. */
|
|
81
|
-
onPanelClosed(): void;
|
|
82
80
|
toggle(triggerElement?: HTMLElement): void;
|
|
83
81
|
onPrevious(): void;
|
|
84
82
|
onNext(): void;
|
|
@@ -86,9 +84,6 @@ declare class DatepickerMonthPickerComponent implements DropdownOverlay {
|
|
|
86
84
|
onToggleYears(): void;
|
|
87
85
|
onSelectYear(year: number): void;
|
|
88
86
|
onSelectMonth(month: number): void;
|
|
89
|
-
/** An out-of-bounds month is disabled, hence unfocusable: focus then stays on the panel. */
|
|
90
|
-
private focusSelectedMonth;
|
|
91
|
-
private focusInPanel;
|
|
92
87
|
/** One year at a time through the months, a whole page at a time through the years. */
|
|
93
88
|
private step;
|
|
94
89
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DatepickerMonthPickerComponent, never>;
|
|
@@ -72,20 +72,14 @@ declare class CheckboxDirective implements OnInit, OnDestroy {
|
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
declare class ClickDirective {
|
|
75
|
-
/**
|
|
76
|
-
* Turns the host back into a plain element: no role, no tab stop, no activation at all.
|
|
77
|
-
* A host disabled while it holds focus keeps `tabindex="-1"` until focus leaves it, so the
|
|
78
|
-
* browser does not drop focus to `<body>` (a disclosure that disables itself once open).
|
|
79
|
-
*/
|
|
75
|
+
/** Turns the host back into a plain element: no role, no tab stop, no activation at all. */
|
|
80
76
|
apClickDisabled: i0.InputSignalWithTransform<boolean, unknown>;
|
|
81
77
|
/** ARIA role applied while the host is interactive. */
|
|
82
78
|
apClickRole: i0.InputSignal<string>;
|
|
83
79
|
apClick: i0.OutputEmitterRef<MouseEvent | KeyboardEvent>;
|
|
84
80
|
private host;
|
|
85
|
-
protected readonly focused: i0.WritableSignal<boolean>;
|
|
86
81
|
constructor();
|
|
87
82
|
protected isInteractive(): boolean;
|
|
88
|
-
protected tabIndex(): 0 | -1 | null;
|
|
89
83
|
/** The two checks are independent, so an anchor without `href` still gets its contenteditable read. */
|
|
90
84
|
private isNativelyActivated;
|
|
91
85
|
/**
|
|
@@ -3,6 +3,8 @@ import { InjectionToken, PipeTransform, Signal, Provider } from '@angular/core';
|
|
|
3
3
|
|
|
4
4
|
declare const DEFAULT_TEXTS: Readonly<{
|
|
5
5
|
readonly 'ui-components.action-dropdown.aria-label': "Action dropdown";
|
|
6
|
+
readonly 'ui-components.confirm-modal.confirm': "OK";
|
|
7
|
+
readonly 'ui-components.confirm-modal.cancel': "Cancel";
|
|
6
8
|
readonly 'ui-components.filters.trigger': "Filters";
|
|
7
9
|
readonly 'ui-components.filters.aria-label': "Filters";
|
|
8
10
|
readonly 'ui-components.filters.apply': "Apply filters";
|
|
@@ -23,7 +25,12 @@ declare const DEFAULT_TEXTS: Readonly<{
|
|
|
23
25
|
readonly 'ui-components.selection.options-section': "Options";
|
|
24
26
|
readonly 'ui-components.selection.select-all': "Select all";
|
|
25
27
|
readonly 'ui-components.selection.select-all-count': "({{selected}} of {{total}})";
|
|
28
|
+
readonly 'ui-components.snackbar.info': "Info";
|
|
29
|
+
readonly 'ui-components.snackbar.success': "Success";
|
|
30
|
+
readonly 'ui-components.snackbar.error': "Error";
|
|
26
31
|
readonly 'ui-components.split-button.toggle': "Toggle";
|
|
32
|
+
readonly 'ui-components.toggle.confirm-title': "Are you sure?";
|
|
33
|
+
readonly 'ui-components.toggle.confirm-message': "If you toggle this, it will affect other things. Are you sure?";
|
|
27
34
|
}>;
|
|
28
35
|
/**
|
|
29
36
|
* A key of the DS default texts, the only keys a component may fall back to.
|