@agorapulse/ui-components 22.9.9-beta.1 → 22.9.11-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.
@@ -1,13 +1,19 @@
1
1
  import { FormFieldComponent } from '@agorapulse/ui-components/form-field';
2
+ import { injectResolveTexts } from '@agorapulse/ui-components/i18n';
2
3
  import { SymbolRegistry, apErrorFill, apRoundedCheckFill, SymbolComponent } from '@agorapulse/ui-symbol';
3
4
  import * as i0 from '@angular/core';
4
- import { signal, computed, inject, ElementRef, APP_ID, DestroyRef, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
5
+ import { input, computed, signal, inject, ElementRef, APP_ID, DestroyRef, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
5
6
 
7
+ const ROLES = { message: null };
6
8
  class FormMessageComponent {
7
9
  set messageType(messageType) {
8
10
  this.messageTypeSignal.set(messageType);
9
11
  }
10
- message;
12
+ /** The message shown next to the status symbol: a translation key, a key with params, or a raw text. Rendered as text. */
13
+ message = input.required(/* @ts-ignore */
14
+ ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
15
+ texts = computed(() => this.resolveTexts({ message: this.message() }, ROLES), /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
11
17
  messageTypeSignal = signal('error', /* @ts-ignore */
12
18
  ...(ngDevMode ? [{ debugName: "messageTypeSignal" }] : /* istanbul ignore next */ []));
13
19
  symbolIdSignal = computed(() => {
@@ -17,6 +23,7 @@ class FormMessageComponent {
17
23
  /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */
18
24
  messageId;
19
25
  symbolRegistry = inject(SymbolRegistry);
26
+ resolveTexts = injectResolveTexts();
20
27
  constructor() {
21
28
  this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);
22
29
  // The field cannot query for this: a message usually sits under `@if`, which a non-recursive
@@ -31,7 +38,7 @@ class FormMessageComponent {
31
38
  inject(DestroyRef).onDestroy(() => formField?.unregisterDescription(this.messageId));
32
39
  }
33
40
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
34
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.5", type: FormMessageComponent, isStandalone: true, selector: "ap-form-message", inputs: { messageType: "messageType", message: "message" }, host: { properties: { "class.error": "messageTypeSignal() === 'error'", "class.success": "messageTypeSignal() === 'success'" }, classAttribute: "ap-form-message" }, ngImport: i0, template: "<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n", styles: [".ap-form-message{font-size:var(--comp-forms-status-text-size);font-weight:var(--comp-forms-status-text-font-weight);line-height:var(--comp-forms-status-text-line-height);font-family:var(--comp-forms-status-text-font-family);margin:0;display:flex;align-items:center;gap:var(--ref-spacing-xxxs)}.ap-form-message.error{color:var(--comp-forms-status-text-error-color)}.ap-form-message.error ap-symbol{color:var(--comp-forms-status-icon-error-color)}.ap-form-message.success{color:var(--comp-forms-status-text-success-color)}.ap-form-message.success ap-symbol{color:var(--ref-color-green-150)}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
41
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: FormMessageComponent, isStandalone: true, selector: "ap-form-message", inputs: { messageType: { classPropertyName: "messageType", publicName: "messageType", isSignal: false, isRequired: true, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.error": "messageTypeSignal() === 'error'", "class.success": "messageTypeSignal() === 'success'" }, classAttribute: "ap-form-message" }, ngImport: i0, template: "<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ texts().message }}\n</span>\n", styles: [".ap-form-message{font-size:var(--comp-forms-status-text-size);font-weight:var(--comp-forms-status-text-font-weight);line-height:var(--comp-forms-status-text-line-height);font-family:var(--comp-forms-status-text-font-family);margin:0;display:flex;align-items:center;gap:var(--ref-spacing-xxxs)}.ap-form-message.error{color:var(--comp-forms-status-text-error-color)}.ap-form-message.error ap-symbol{color:var(--comp-forms-status-icon-error-color)}.ap-form-message.success{color:var(--comp-forms-status-text-success-color)}.ap-form-message.success ap-symbol{color:var(--ref-color-green-150)}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
35
42
  }
36
43
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: FormMessageComponent, decorators: [{
37
44
  type: Component,
@@ -39,14 +46,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
39
46
  class: 'ap-form-message',
40
47
  '[class.error]': "messageTypeSignal() === 'error'",
41
48
  '[class.success]': "messageTypeSignal() === 'success'",
42
- }, template: "<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n", styles: [".ap-form-message{font-size:var(--comp-forms-status-text-size);font-weight:var(--comp-forms-status-text-font-weight);line-height:var(--comp-forms-status-text-line-height);font-family:var(--comp-forms-status-text-font-family);margin:0;display:flex;align-items:center;gap:var(--ref-spacing-xxxs)}.ap-form-message.error{color:var(--comp-forms-status-text-error-color)}.ap-form-message.error ap-symbol{color:var(--comp-forms-status-icon-error-color)}.ap-form-message.success{color:var(--comp-forms-status-text-success-color)}.ap-form-message.success ap-symbol{color:var(--ref-color-green-150)}\n"] }]
49
+ }, template: "<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ texts().message }}\n</span>\n", styles: [".ap-form-message{font-size:var(--comp-forms-status-text-size);font-weight:var(--comp-forms-status-text-font-weight);line-height:var(--comp-forms-status-text-line-height);font-family:var(--comp-forms-status-text-font-family);margin:0;display:flex;align-items:center;gap:var(--ref-spacing-xxxs)}.ap-form-message.error{color:var(--comp-forms-status-text-error-color)}.ap-form-message.error ap-symbol{color:var(--comp-forms-status-icon-error-color)}.ap-form-message.success{color:var(--comp-forms-status-text-success-color)}.ap-form-message.success ap-symbol{color:var(--ref-color-green-150)}\n"] }]
43
50
  }], ctorParameters: () => [], propDecorators: { messageType: [{
44
51
  type: Input,
45
52
  args: [{ required: true }]
46
- }], message: [{
47
- type: Input,
48
- args: [{ required: true }]
49
- }] } });
53
+ }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }] } });
50
54
 
51
55
  /**
52
56
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-form-message.mjs","sources":["../../../libs/ui-components/form-message/src/form-message.component.ts","../../../libs/ui-components/form-message/src/form-message.component.html","../../../libs/ui-components/form-message/src/agorapulse-ui-components-form-message.ts"],"sourcesContent":["import { FormFieldComponent } from '@agorapulse/ui-components/form-field';\nimport { SymbolComponent, SymbolRegistry, apErrorFill, apRoundedCheckFill } from '@agorapulse/ui-symbol';\nimport {\n APP_ID,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Input,\n ViewEncapsulation,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nexport type MessageType = 'error' | 'success';\n\n@Component({\n selector: 'ap-form-message',\n templateUrl: './form-message.component.html',\n styleUrls: ['./form-message.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [SymbolComponent],\n host: {\n class: 'ap-form-message',\n '[class.error]': \"messageTypeSignal() === 'error'\",\n '[class.success]': \"messageTypeSignal() === 'success'\",\n },\n})\nexport class FormMessageComponent {\n @Input({ required: true })\n set messageType(messageType: MessageType) {\n this.messageTypeSignal.set(messageType);\n }\n\n @Input({ required: true })\n message!: string;\n\n messageTypeSignal = signal<MessageType>('error');\n\n symbolIdSignal = computed(() => {\n return this.messageTypeSignal() === 'error' ? 'error_fill' : 'rounded-check_fill';\n });\n\n /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */\n readonly messageId: string;\n\n private symbolRegistry = inject(SymbolRegistry);\n\n constructor() {\n this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);\n\n // The field cannot query for this: a message usually sits under `@if`, which a non-recursive\n // query misses, while a recursive one would let an outer field adopt a nested field's message.\n const element: HTMLElement = inject(ElementRef).nativeElement;\n if (!element.id) {\n element.id = `${inject(APP_ID)}-form-message-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;\n }\n this.messageId = element.id;\n\n const formField = inject(FormFieldComponent, { optional: true });\n formField?.registerDescription(this.messageId);\n inject(DestroyRef).onDestroy(() => formField?.unregisterDescription(this.messageId));\n }\n}\n","<ap-symbol\n size=\"sm\"\n [symbolId]=\"symbolIdSignal()\" />\n<span>\n {{ message }}\n</span>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MA8Ba,oBAAoB,CAAA;IAC7B,IACI,WAAW,CAAC,WAAwB,EAAA;AACpC,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;IAC3C;AAGA,IAAA,OAAO;IAEP,iBAAiB,GAAG,MAAM,CAAc,OAAO;0FAAC;AAEhD,IAAA,cAAc,GAAG,QAAQ,CAAC,MAAK;AAC3B,QAAA,OAAO,IAAI,CAAC,iBAAiB,EAAE,KAAK,OAAO,GAAG,YAAY,GAAG,oBAAoB;IACrF,CAAC;uFAAC;;AAGO,IAAA,SAAS;AAEV,IAAA,cAAc,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9BjC,2GAMA,EAAA,MAAA,EAAA,CAAA,glBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDiBc,eAAe,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAOhB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAbhC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,eAAA,EAGV,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,eAAe,CAAC,EAAA,IAAA,EACpB;AACF,wBAAA,KAAK,EAAE,iBAAiB;AACxB,wBAAA,eAAe,EAAE,iCAAiC;AAClD,wBAAA,iBAAiB,EAAE,mCAAmC;AACzD,qBAAA,EAAA,QAAA,EAAA,2GAAA,EAAA,MAAA,EAAA,CAAA,glBAAA,CAAA,EAAA;;sBAGA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAKxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AEpC7B;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-form-message.mjs","sources":["../../../libs/ui-components/form-message/src/form-message.component.ts","../../../libs/ui-components/form-message/src/form-message.component.html","../../../libs/ui-components/form-message/src/agorapulse-ui-components-form-message.ts"],"sourcesContent":["import { FormFieldComponent } from '@agorapulse/ui-components/form-field';\nimport { TextRoles, TranslationRequest, injectResolveTexts } from '@agorapulse/ui-components/i18n';\nimport { SymbolComponent, SymbolRegistry, apErrorFill, apRoundedCheckFill } from '@agorapulse/ui-symbol';\nimport {\n APP_ID,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Input,\n ViewEncapsulation,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nexport type MessageType = 'error' | 'success';\n\nconst ROLES = { message: null } as const satisfies TextRoles;\n\n@Component({\n selector: 'ap-form-message',\n templateUrl: './form-message.component.html',\n styleUrls: ['./form-message.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [SymbolComponent],\n host: {\n class: 'ap-form-message',\n '[class.error]': \"messageTypeSignal() === 'error'\",\n '[class.success]': \"messageTypeSignal() === 'success'\",\n },\n})\nexport class FormMessageComponent {\n @Input({ required: true })\n set messageType(messageType: MessageType) {\n this.messageTypeSignal.set(messageType);\n }\n\n /** The message shown next to the status symbol: a translation key, a key with params, or a raw text. Rendered as text. */\n readonly message = input.required<TranslationRequest>();\n\n protected readonly texts = computed(() => this.resolveTexts({ message: this.message() }, ROLES));\n\n messageTypeSignal = signal<MessageType>('error');\n\n symbolIdSignal = computed(() => {\n return this.messageTypeSignal() === 'error' ? 'error_fill' : 'rounded-check_fill';\n });\n\n /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */\n readonly messageId: string;\n\n private symbolRegistry = inject(SymbolRegistry);\n private readonly resolveTexts = injectResolveTexts();\n\n constructor() {\n this.symbolRegistry.registerSymbols([apErrorFill, apRoundedCheckFill]);\n\n // The field cannot query for this: a message usually sits under `@if`, which a non-recursive\n // query misses, while a recursive one would let an outer field adopt a nested field's message.\n const element: HTMLElement = inject(ElementRef).nativeElement;\n if (!element.id) {\n element.id = `${inject(APP_ID)}-form-message-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;\n }\n this.messageId = element.id;\n\n const formField = inject(FormFieldComponent, { optional: true });\n formField?.registerDescription(this.messageId);\n inject(DestroyRef).onDestroy(() => formField?.unregisterDescription(this.messageId));\n }\n}\n","<ap-symbol\n size=\"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AAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAOhB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAbhC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,eAAA,EAGV,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,eAAe,CAAC,EAAA,IAAA,EACpB;AACF,wBAAA,KAAK,EAAE,iBAAiB;AACxB,wBAAA,eAAe,EAAE,iCAAiC;AAClD,wBAAA,iBAAiB,EAAE,mCAAmC;AACzD,qBAAA,EAAA,QAAA,EAAA,mHAAA,EAAA,MAAA,EAAA,CAAA,glBAAA,CAAA,EAAA;;sBAGA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;;AEnC7B;;AAEG;;;;"}
@@ -1,22 +1,31 @@
1
1
  import { ButtonComponent } from '@agorapulse/ui-components/button';
2
2
  import { CloseButtonComponent } from '@agorapulse/ui-components/close-button';
3
+ import { injectResolveTexts } from '@agorapulse/ui-components/i18n';
3
4
  import { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';
4
5
  import { SymbolRegistry, apInfoFill, apErrorFill, apWarningFill, apTrash, apRoundedCheckFill, apClose, apFeatureLock, SymbolComponent } from '@agorapulse/ui-symbol';
5
6
  import * as i0 from '@angular/core';
6
- import { inject, ElementRef, input, EventEmitter, booleanAttribute, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
7
+ import { inject, ElementRef, input, computed, EventEmitter, booleanAttribute, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
7
8
 
9
+ const ROLES = { title: null, action: null };
8
10
  // Increasing integer for generating unique ids for infobox components.
9
11
  let nextUniqueId = 0;
10
12
  class InfoboxComponent {
11
13
  symbolRegistry = inject(SymbolRegistry);
12
14
  elementRef = inject(ElementRef);
15
+ resolveTexts = injectResolveTexts();
16
+ /** `title` is shown above the projected text; `action` is the label of the button, which is shown only when set. Rendered as text. */
17
+ i18n = input({}, /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "i18n" }] : /* istanbul ignore next */ []));
19
+ /** Not a way to pass the title: use `i18n.title`. Typed `never` so that a `title` left on `<ap-infobox>` fails to compile instead of becoming the native tooltip. */
20
+ title = input(/* @ts-ignore */
21
+ ...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
22
+ texts = computed(() => this.resolveTexts(this.i18n(), ROLES), /* @ts-ignore */
23
+ ...(ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []));
13
24
  buttonId = null;
14
- buttonLabel = undefined;
15
25
  buttonDataTrack = null;
16
26
  buttonSymbolId = input(/* @ts-ignore */
17
27
  ...(ngDevMode ? [undefined, { debugName: "buttonSymbolId" }] : /* istanbul ignore next */ []));
18
28
  closable = false;
19
- title;
20
29
  type = 'info';
21
30
  buttonClicked = new EventEmitter();
22
31
  closed = new EventEmitter();
@@ -50,14 +59,12 @@ class InfoboxComponent {
50
59
  this.closed.emit();
51
60
  }
52
61
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InfoboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
53
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InfoboxComponent, isStandalone: true, selector: "ap-infobox", inputs: { buttonId: { classPropertyName: "buttonId", publicName: "buttonId", isSignal: false, isRequired: false, transformFunction: null }, buttonLabel: { classPropertyName: "buttonLabel", publicName: "buttonLabel", isSignal: false, isRequired: false, transformFunction: null }, buttonDataTrack: { classPropertyName: "buttonDataTrack", publicName: "buttonDataTrack", isSignal: false, isRequired: false, transformFunction: null }, buttonSymbolId: { classPropertyName: "buttonSymbolId", publicName: "buttonSymbolId", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, title: { classPropertyName: "title", publicName: "title", isSignal: false, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { buttonClicked: "buttonClicked", closed: "closed" }, ngImport: i0, template: "<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (buttonLabel) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ buttonLabel }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: CloseButtonComponent, selector: "ap-close-button", inputs: ["disabled", "ariaLabel", "dataTest"], outputs: ["closed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
62
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: InfoboxComponent, isStandalone: true, selector: "ap-infobox", inputs: { i18n: { classPropertyName: "i18n", publicName: "i18n", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, buttonId: { classPropertyName: "buttonId", publicName: "buttonId", isSignal: false, isRequired: false, transformFunction: null }, buttonDataTrack: { classPropertyName: "buttonDataTrack", publicName: "buttonDataTrack", isSignal: false, isRequired: false, transformFunction: null }, buttonSymbolId: { classPropertyName: "buttonSymbolId", publicName: "buttonSymbolId", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, type: { classPropertyName: "type", publicName: "type", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { buttonClicked: "buttonClicked", closed: "closed" }, ngImport: i0, template: "<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!texts().title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (texts().title; as title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (texts().action; as action) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ action }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"], dependencies: [{ kind: "component", type: SymbolComponent, selector: "ap-symbol", inputs: ["symbolId", "color", "size"], outputs: ["sizeChange"] }, { kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: CloseButtonComponent, selector: "ap-close-button", inputs: ["disabled", "ariaLabel", "dataTest"], outputs: ["closed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
54
63
  }
55
64
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: InfoboxComponent, decorators: [{
56
65
  type: Component,
57
- args: [{ selector: 'ap-infobox', imports: [SymbolComponent, ButtonComponent, CloseButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (buttonLabel) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ buttonLabel }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"] }]
58
- }], ctorParameters: () => [], propDecorators: { buttonId: [{
59
- type: Input
60
- }], buttonLabel: [{
66
+ args: [{ selector: 'ap-infobox', imports: [SymbolComponent, ButtonComponent, CloseButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!texts().title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (texts().title; as title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (texts().action; as action) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ action }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n", styles: ["ap-infobox{--comp-icon-size: 20px;container:infobox/inline-size;display:block;width:100%;max-width:100%}ap-infobox .main{display:flex;font-size:var(--ref-font-size-sm);line-height:var(--ref-font-line-height-sm);align-items:center;color:var(--ref-color-grey-100);padding:var(--comp-infobox-padding-top) var(--comp-infobox-padding-right) var(--comp-infobox-padding-bottom) var(--comp-infobox-padding-left);border-radius:var(--comp-infobox-border-radius);overflow:hidden;font-family:var(--comp-infobox-text-title-font-family);box-sizing:border-box;position:relative;gap:var(--comp-infobox-button-margin-left)}ap-infobox .main .status-banner{position:absolute;left:0;top:0;width:4px;height:100%}ap-infobox .main ap-symbol{align-self:center}ap-infobox .main .symbol-wrapper{margin-top:1px}ap-infobox .main.has-title .symbol-wrapper{margin-top:var(--ref-spacing-xxxs)}ap-infobox .main .wrapper{display:flex;justify-content:space-between;width:100%;align-items:flex-start;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content{display:flex;gap:var(--ref-spacing-xs);align-items:flex-start;flex:1}ap-infobox .main .wrapper .symbol-content .content{display:flex;flex-direction:column;align-items:flex-start;flex:1;justify-content:space-between;gap:var(--ref-spacing-xxs)}ap-infobox .main .wrapper .symbol-content .content ap-button button{width:unset}ap-infobox .main .wrapper .symbol-content .content .texts{display:flex;flex-direction:column;overflow-wrap:anywhere}ap-infobox .main .wrapper .symbol-content .content .texts .title{font-weight:var(--comp-infobox-text-title-weight);font-family:var(--comp-infobox-text-title-font-family);font-size:var(--comp-infobox-text-title-size);line-height:var(--comp-infobox-text-title-line-height)}ap-infobox .main.info{background-color:var(--comp-infobox-info-background-color)}ap-infobox .main.info ap-symbol.status{align-self:baseline;color:var(--comp-infobox-info-icon-color)}ap-infobox .main.info .status-banner{background-color:var(--comp-infobox-info-border-left-color)}ap-infobox .main.warning{background-color:var(--comp-infobox-warning-background-color)}ap-infobox .main.warning ap-symbol.status{color:var(--comp-infobox-warning-icon-color)}ap-infobox .main.warning .status-banner{background-color:var(--comp-infobox-warning-border-left-color)}ap-infobox .main.error{background-color:var(--comp-infobox-error-background-color)}ap-infobox .main.error ap-symbol.status{color:var(--comp-infobox-error-icon-color)}ap-infobox .main.error .status-banner{background-color:var(--comp-infobox-error-border-left-color)}ap-infobox .main.success{background-color:var(--comp-infobox-success-background-color)}ap-infobox .main.success ap-symbol.status{color:var(--comp-infobox-success-icon-color)}ap-infobox .main.success .status-banner{background-color:var(--comp-infobox-success-border-left-color)}ap-infobox .main.feature-lock{background-color:var(--comp-infobox-feature-lock-background-color)}ap-infobox .main.feature-lock ap-symbol.status{color:var(--comp-infobox-feature-lock-icon-color)}ap-infobox .main.feature-lock .status-banner{background-color:var(--comp-infobox-feature-lock-border-left-color)}@container infobox (min-width: 588px){.main .wrapper{align-items:center!important}.main .wrapper .symbol-wrapper{margin-top:0!important}.main .wrapper .symbol-content{align-items:center!important}.main .wrapper .symbol-content .content{flex-direction:row!important;align-items:center!important}}\n"] }]
67
+ }], ctorParameters: () => [], propDecorators: { i18n: [{ type: i0.Input, args: [{ isSignal: true, alias: "i18n", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], buttonId: [{
61
68
  type: Input
62
69
  }], buttonDataTrack: [{
63
70
  type: Input
@@ -66,8 +73,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
66
73
  args: [{
67
74
  transform: booleanAttribute,
68
75
  }]
69
- }], title: [{
70
- type: Input
71
76
  }], type: [{
72
77
  type: Input
73
78
  }], buttonClicked: [{
@@ -1 +1 @@
1
- {"version":3,"file":"agorapulse-ui-components-infobox.mjs","sources":["../../../libs/ui-components/infobox/src/infobox.component.ts","../../../libs/ui-components/infobox/src/infobox.component.html","../../../libs/ui-components/infobox/src/agorapulse-ui-components-infobox.ts"],"sourcesContent":["import { ButtonComponent } from '@agorapulse/ui-components/button';\nimport { CloseButtonComponent } from '@agorapulse/ui-components/close-button';\nimport { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';\nimport {\n SymbolComponent,\n SymbolRegistry,\n agorapulseSymbol,\n apClose,\n apErrorFill,\n apFeatureLock,\n apInfoFill,\n apRoundedCheckFill,\n apTrash,\n apWarningFill,\n} from '@agorapulse/ui-symbol';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n booleanAttribute,\n inject,\n input,\n} from '@angular/core';\n\nexport type InfoboxType = 'info' | 'warning' | 'error' | 'success' | 'feature-lock';\n\n// Increasing integer for generating unique ids for infobox components.\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'ap-infobox',\n templateUrl: './infobox.component.html',\n styleUrls: ['./infobox.component.scss'],\n imports: [SymbolComponent, ButtonComponent, CloseButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class InfoboxComponent {\n private readonly symbolRegistry = inject(SymbolRegistry);\n private readonly elementRef = inject(ElementRef);\n\n @Input() buttonId: string | null = null;\n @Input() buttonLabel: string | undefined = undefined;\n @Input() buttonDataTrack: string | null = null;\n buttonSymbolId = input<agorapulseSymbol>();\n @Input({\n transform: booleanAttribute,\n })\n closable = false;\n @Input() title?: string;\n @Input() type: InfoboxType = 'info';\n\n @Output() buttonClicked = new EventEmitter<void>();\n @Output() closed = new EventEmitter<void>();\n\n displayDirection: 'horizontal' | 'vertical' = 'horizontal';\n defaultButtonId: string = '';\n\n readonly symbolIds: { [k: string]: agorapulseSymbol } = {\n info: 'info_fill',\n warning: 'warning_fill',\n error: 'error_fill',\n success: 'rounded-check_fill',\n 'feature-lock': 'feature-lock',\n };\n\n constructor() {\n this.symbolRegistry.registerSymbols([\n apInfoFill,\n apErrorFill,\n apWarningFill,\n apTrash,\n apRoundedCheckFill,\n apClose,\n apFeatureLock,\n ]);\n this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));\n this.defaultButtonId = `infobox-button-${++nextUniqueId}`;\n }\n\n onClickButton(): void {\n this.buttonClicked.emit();\n }\n\n onCloseInfobox(): void {\n this.elementRef.nativeElement.remove();\n this.closed.emit();\n }\n}\n","<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (buttonLabel) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ buttonLabel }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_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GAAA,CAAA,EAAA;;sBAMpC;;sBACA;;sBACA;;sBAEA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,SAAS,EAAE,gBAAgB;AAC9B,qBAAA;;sBAEA;;sBACA;;sBAEA;;sBACA;;;AEzDL;;AAEG;;;;"}
1
+ {"version":3,"file":"agorapulse-ui-components-infobox.mjs","sources":["../../../libs/ui-components/infobox/src/infobox.component.ts","../../../libs/ui-components/infobox/src/infobox.component.html","../../../libs/ui-components/infobox/src/agorapulse-ui-components-infobox.ts"],"sourcesContent":["import { ButtonComponent } from '@agorapulse/ui-components/button';\nimport { CloseButtonComponent } from '@agorapulse/ui-components/close-button';\nimport { I18nOf, TextRolesOf, injectResolveTexts } from '@agorapulse/ui-components/i18n';\nimport { UI_COMPONENTS_SYMBOLS } from '@agorapulse/ui-components/providers';\nimport {\n SymbolComponent,\n SymbolRegistry,\n agorapulseSymbol,\n apClose,\n apErrorFill,\n apFeatureLock,\n apInfoFill,\n apRoundedCheckFill,\n apTrash,\n apWarningFill,\n} from '@agorapulse/ui-symbol';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\n\nexport type InfoboxType = 'info' | 'warning' | 'error' | 'success' | 'feature-lock';\n\nconst ROLES = { title: null, action: null } as const satisfies TextRolesOf<I18nOf<never, 'title' | 'action'>>;\n\n// Increasing integer for generating unique ids for infobox components.\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'ap-infobox',\n templateUrl: './infobox.component.html',\n styleUrls: ['./infobox.component.scss'],\n imports: [SymbolComponent, ButtonComponent, CloseButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class InfoboxComponent {\n private readonly symbolRegistry = inject(SymbolRegistry);\n private readonly elementRef = inject(ElementRef);\n private readonly resolveTexts = injectResolveTexts();\n\n /** `title` is shown above the projected text; `action` is the label of the button, which is shown only when set. Rendered as text. */\n readonly i18n = input<I18nOf<never, 'title' | 'action'>>({});\n\n /** Not a way to pass the title: use `i18n.title`. Typed `never` so that a `title` left on `<ap-infobox>` fails to compile instead of becoming the native tooltip. */\n readonly title = input<never>();\n\n protected readonly texts = computed(() => this.resolveTexts(this.i18n(), ROLES));\n\n @Input() buttonId: string | null = null;\n @Input() buttonDataTrack: string | null = null;\n buttonSymbolId = input<agorapulseSymbol>();\n @Input({\n transform: booleanAttribute,\n })\n closable = false;\n @Input() type: InfoboxType = 'info';\n\n @Output() buttonClicked = new EventEmitter<void>();\n @Output() closed = new EventEmitter<void>();\n\n displayDirection: 'horizontal' | 'vertical' = 'horizontal';\n defaultButtonId: string = '';\n\n readonly symbolIds: { [k: string]: agorapulseSymbol } = {\n info: 'info_fill',\n warning: 'warning_fill',\n error: 'error_fill',\n success: 'rounded-check_fill',\n 'feature-lock': 'feature-lock',\n };\n\n constructor() {\n this.symbolRegistry.registerSymbols([\n apInfoFill,\n apErrorFill,\n apWarningFill,\n apTrash,\n apRoundedCheckFill,\n apClose,\n apFeatureLock,\n ]);\n this.symbolRegistry.withSymbols(...(inject(UI_COMPONENTS_SYMBOLS, { optional: true })?.flat() ?? []));\n this.defaultButtonId = `infobox-button-${++nextUniqueId}`;\n }\n\n onClickButton(): void {\n this.buttonClicked.emit();\n }\n\n onCloseInfobox(): void {\n this.elementRef.nativeElement.remove();\n this.closed.emit();\n }\n}\n","<div\n class=\"main\"\n [class.info]=\"type === 'info'\"\n [class.warning]=\"type === 'warning'\"\n [class.error]=\"type === 'error'\"\n [class.success]=\"type === 'success'\"\n [class.feature-lock]=\"type === 'feature-lock'\"\n [class.has-title]=\"!!texts().title\">\n <div class=\"status-banner\"></div>\n <div class=\"wrapper\">\n <div class=\"symbol-content\">\n <div class=\"symbol-wrapper\">\n <ap-symbol\n class=\"status\"\n size=\"sm\"\n [symbolId]=\"symbolIds[type]\" />\n </div>\n <div class=\"content\">\n <div class=\"texts\">\n @if (texts().title; as title) {\n <span class=\"title\">\n {{ title }}\n </span>\n }\n <span class=\"text\">\n <ng-content />\n </span>\n </div>\n @if (texts().action; as action) {\n <ap-button\n name=\"infobox-button\"\n symbolPosition=\"left\"\n [symbolId]=\"buttonSymbolId()\"\n [id]=\"buttonId ?? defaultButtonId\"\n [attr.data-track]=\"buttonDataTrack\"\n [config]=\"{\n style: 'stroked',\n color: 'grey'\n }\"\n (click)=\"onClickButton()\">\n {{ action }}\n </ap-button>\n }\n </div>\n </div>\n @if (closable) {\n <ap-close-button (closed)=\"onCloseInfobox()\" />\n }\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AAgCA,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAoE;AAE7G;AACA,IAAI,YAAY,GAAG,CAAC;MAUP,gBAAgB,CAAA;AACR,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC/B,YAAY,GAAG,kBAAkB,EAAE;;IAG3C,IAAI,GAAG,KAAK,CAAoC,EAAE;6EAAC;;AAGnD,IAAA,KAAK,GAAG,KAAK;yFAAS;AAEZ,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC;8EAAC;IAEvE,QAAQ,GAAkB,IAAI;IAC9B,eAAe,GAAkB,IAAI;AAC9C,IAAA,cAAc,GAAG,KAAK;kGAAoB;IAI1C,QAAQ,GAAG,KAAK;IACP,IAAI,GAAgB,MAAM;AAEzB,IAAA,aAAa,GAAG,IAAI,YAAY,EAAQ;AACxC,IAAA,MAAM,GAAG,IAAI,YAAY,EAAQ;IAE3C,gBAAgB,GAA8B,YAAY;IAC1D,eAAe,GAAW,EAAE;AAEnB,IA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BAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,YAAA,EAAA,OAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,WAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAIvD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAR5B,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,EAAA,OAAA,EAGb,CAAC,eAAe,EAAE,eAAe,EAAE,oBAAoB,CAAC,EAAA,eAAA,EAChD,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,2zDAAA,EAAA,MAAA,EAAA,CAAA,u3GAAA,CAAA,EAAA;;sBAepC;;sBACA;;sBAEA,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA;AACH,wBAAA,SAAS,EAAE,gBAAgB;AAC9B,qBAAA;;sBAEA;;sBAEA;;sBACA;;;AEpEL;;AAEG;;;;"}
@@ -2,7 +2,7 @@ import { ConfirmModalComponent } from '@agorapulse/ui-components/confirm-modal';
2
2
  import * as i0 from '@angular/core';
3
3
  import { Injectable } from '@angular/core';
4
4
  import { MatDialog } from '@angular/material/dialog';
5
- import { of } from 'rxjs';
5
+ import { Subject, of } from 'rxjs';
6
6
  import { SnackbarsThreadService } from '@agorapulse/ui-components/snackbars-thread';
7
7
 
8
8
  function shownText(request) {
@@ -15,12 +15,18 @@ function shownText(request) {
15
15
  return request.params === undefined ? { key: request.key } : { key: request.key, params: request.params };
16
16
  }
17
17
 
18
- function askedConfirmation(i18n) {
18
+ function askedConfirmation(i18n, ids) {
19
19
  return {
20
20
  title: shownText(i18n.title),
21
21
  message: shownText(i18n.message),
22
22
  ...(i18n.confirm === undefined ? {} : { confirm: shownText(i18n.confirm) }),
23
23
  ...(i18n.cancel === undefined ? {} : { cancel: shownText(i18n.cancel) }),
24
+ ...(ids.footerConfirmButtonId === undefined || ids.footerConfirmButtonId === 'confirm'
25
+ ? {}
26
+ : { footerConfirmButtonId: ids.footerConfirmButtonId }),
27
+ ...(ids.footerCancelButtonId === undefined || ids.footerCancelButtonId === 'cancel'
28
+ ? {}
29
+ : { footerCancelButtonId: ids.footerCancelButtonId }),
24
30
  };
25
31
  }
26
32
  /**
@@ -37,25 +43,44 @@ function askedConfirmation(i18n) {
37
43
  class FakeConfirmModal extends MatDialog {
38
44
  /** Every confirm modal opened, oldest first. */
39
45
  asked = [];
40
- /** What the next modals answer: `true` confirms, `false` cancels, `undefined` closes without a choice. */
46
+ /** What the next modals answer. */
41
47
  answer = true;
48
+ pending = 0;
49
+ /** How many `'pending'` modals the code has not closed yet. */
50
+ get openModals() {
51
+ return this.pending;
52
+ }
42
53
  open(target, config) {
43
54
  if (target !== ConfirmModalComponent) {
44
55
  return super.open(target, config);
45
56
  }
46
57
  const answer = this.answer;
58
+ const componentInstance = {};
59
+ const closed = new Subject();
60
+ let open = answer === 'pending';
61
+ if (open) {
62
+ this.pending++;
63
+ }
47
64
  const ref = {
48
- componentInstance: {},
65
+ componentInstance,
49
66
  componentRef: {
50
67
  setInput: (name, value) => {
51
68
  if (name === 'i18n') {
52
- this.asked.push(askedConfirmation(value));
69
+ this.asked.push(askedConfirmation(value, componentInstance));
53
70
  }
54
71
  },
55
72
  },
56
73
  disableClose: true,
57
- afterClosed: () => of(answer),
58
- close: () => undefined,
74
+ afterClosed: () => (answer === 'pending' ? closed.asObservable() : of(answer)),
75
+ close: (result) => {
76
+ if (!open) {
77
+ return;
78
+ }
79
+ open = false;
80
+ this.pending--;
81
+ closed.next(result);
82
+ closed.complete();
83
+ },
59
84
  };
60
85
  return ref;
61
86
  }
@@ -1 +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,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;AAC7G;;ACEA,SAAS,iBAAiB,CAAC,IAA+B,EAAA;IACtD,OAAO;AACH,QAAA,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5B,QAAA,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;QAChC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3E,IAAI,IAAI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AC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAClF,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpG,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;YACxF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AACnE,YAAA,IAAI,OAAO,KAAK,eAAe,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACtD,SAAA,CAAC;QACF,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAChC;;IAGA,KAAK,GAAA;AACD,QAAA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;IACzB;uGA7BS,0BAA0B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAA1B,0BAA0B,EAAA,CAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC;;AAiCD;;;;;AAKG;SACa,oBAAoB,GAAA;AAChC,IAAA,OAAO,CAAC,0BAA0B,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;AACrH;;ACjFA;;AAEG;;;;"}
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, Subject } 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 /** Present only when it is not the default `'confirm'`. */\n footerConfirmButtonId?: string;\n /** Present only when it is not the default `'cancel'`. */\n footerCancelButtonId?: string;\n}\n\n/** What a modal answers: `true` confirms, `false` cancels, `undefined` closes without a choice, `'pending'` stays open until the code closes it. */\nexport type ConfirmModalAnswer = boolean | undefined | 'pending';\n\ninterface FooterIds {\n footerConfirmButtonId?: string;\n footerCancelButtonId?: string;\n}\n\nfunction askedConfirmation(i18n: ConfirmModalTexts['i18n'], ids: FooterIds): 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 ...(ids.footerConfirmButtonId === undefined || ids.footerConfirmButtonId === 'confirm'\n ? {}\n : { footerConfirmButtonId: ids.footerConfirmButtonId }),\n ...(ids.footerCancelButtonId === undefined || ids.footerCancelButtonId === 'cancel'\n ? {}\n : { footerCancelButtonId: ids.footerCancelButtonId }),\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. */\n answer: ConfirmModalAnswer = true;\n\n private pending = 0;\n\n /** How many `'pending'` modals the code has not closed yet. */\n get openModals(): number {\n return this.pending;\n }\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 componentInstance: FooterIds = {};\n const closed = new Subject<unknown>();\n let open = answer === 'pending';\n if (open) {\n this.pending++;\n }\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'], componentInstance));\n }\n },\n },\n disableClose: true,\n afterClosed: () => (answer === 'pending' ? closed.asObservable() : of(answer)),\n close: (result?: unknown): void => {\n if (!open) {\n return;\n }\n open = false;\n this.pending--;\n closed.next(result);\n closed.complete();\n },\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?: ConfirmModalAnswer } = {}): 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,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,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AClF,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACpG,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;YACxF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AACnE,YAAA,IAAI,OAAO,KAAK,eAAe,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AACtD,SAAA,CAAC;QACF,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAChC;;IAGA,KAAK,GAAA;AACD,QAAA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;IACzB;uGA7BS,0BAA0B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAA1B,0BAA0B,EAAA,CAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC;;AAiCD;;;;;AAKG;SACa,oBAAoB,GAAA;AAChC,IAAA,OAAO,CAAC,0BAA0B,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;AACrH;;ACjFA;;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.9-beta.1",
4
+ "version": "22.9.11-beta.1",
5
5
  "author": "Benoit Hediard",
6
6
  "repository": {
7
7
  "type": "git",
@@ -287,9 +287,9 @@ declare class FilterDropdownComponent implements DropdownOverlay {
287
287
  href: string | undefined;
288
288
  label: string | undefined;
289
289
  } | undefined;
290
- title: string | undefined;
291
290
  message: string | undefined;
292
291
  type: _agorapulse_ui_components_infobox.InfoboxType;
292
+ titleRequest: _agorapulse_ui_components_i18n.TranslationRequest | undefined;
293
293
  } | null>;
294
294
  /**
295
295
  * The filter groups to display: STRUCTURE only (keys, titles, options, locks, display type, and the
@@ -1,17 +1,23 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { TranslationRequest } from '@agorapulse/ui-components/i18n';
2
3
 
3
4
  type MessageType = 'error' | 'success';
4
5
  declare class FormMessageComponent {
5
6
  set messageType(messageType: MessageType);
6
- message: string;
7
+ /** The message shown next to the status symbol: a translation key, a key with params, or a raw text. Rendered as text. */
8
+ readonly message: _angular_core.InputSignal<TranslationRequest>;
9
+ protected readonly texts: _angular_core.Signal<{
10
+ readonly message: string | undefined;
11
+ }>;
7
12
  messageTypeSignal: _angular_core.WritableSignal<MessageType>;
8
13
  symbolIdSignal: _angular_core.Signal<"error_fill" | "rounded-check_fill">;
9
14
  /** The id this message is referenced by. A bound `[id]` would land after construction and leave the reference dangling. */
10
15
  readonly messageId: string;
11
16
  private symbolRegistry;
17
+ private readonly resolveTexts;
12
18
  constructor();
13
19
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormMessageComponent, never>;
14
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormMessageComponent, "ap-form-message", never, { "messageType": { "alias": "messageType"; "required": true; }; "message": { "alias": "message"; "required": true; }; }, {}, never, never, true, never>;
20
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormMessageComponent, "ap-form-message", never, { "messageType": { "alias": "messageType"; "required": true; }; "message": { "alias": "message"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
15
21
  }
16
22
 
17
23
  export { FormMessageComponent };
@@ -1,17 +1,25 @@
1
- import * as i0 from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
2
  import { EventEmitter } from '@angular/core';
3
+ import { I18nOf } from '@agorapulse/ui-components/i18n';
3
4
  import { agorapulseSymbol } from '@agorapulse/ui-symbol';
4
5
 
5
6
  type InfoboxType = 'info' | 'warning' | 'error' | 'success' | 'feature-lock';
6
7
  declare class InfoboxComponent {
7
8
  private readonly symbolRegistry;
8
9
  private readonly elementRef;
10
+ private readonly resolveTexts;
11
+ /** `title` is shown above the projected text; `action` is the label of the button, which is shown only when set. Rendered as text. */
12
+ readonly i18n: _angular_core.InputSignal<I18nOf<never, "title" | "action">>;
13
+ /** Not a way to pass the title: use `i18n.title`. Typed `never` so that a `title` left on `<ap-infobox>` fails to compile instead of becoming the native tooltip. */
14
+ readonly title: _angular_core.InputSignal<undefined>;
15
+ protected readonly texts: _angular_core.Signal<{
16
+ readonly title: string | undefined;
17
+ readonly action: string | undefined;
18
+ }>;
9
19
  buttonId: string | null;
10
- buttonLabel: string | undefined;
11
20
  buttonDataTrack: string | null;
12
- buttonSymbolId: i0.InputSignal<string | undefined>;
21
+ buttonSymbolId: _angular_core.InputSignal<string | undefined>;
13
22
  closable: boolean;
14
- title?: string;
15
23
  type: InfoboxType;
16
24
  buttonClicked: EventEmitter<void>;
17
25
  closed: EventEmitter<void>;
@@ -23,8 +31,8 @@ declare class InfoboxComponent {
23
31
  constructor();
24
32
  onClickButton(): void;
25
33
  onCloseInfobox(): void;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<InfoboxComponent, never>;
27
- static ɵcmp: i0.ɵɵComponentDeclaration<InfoboxComponent, "ap-infobox", never, { "buttonId": { "alias": "buttonId"; "required": false; }; "buttonLabel": { "alias": "buttonLabel"; "required": false; }; "buttonDataTrack": { "alias": "buttonDataTrack"; "required": false; }; "buttonSymbolId": { "alias": "buttonSymbolId"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; }; "title": { "alias": "title"; "required": false; }; "type": { "alias": "type"; "required": false; }; }, { "buttonClicked": "buttonClicked"; "closed": "closed"; }, never, ["*"], true, never>;
34
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<InfoboxComponent, never>;
35
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<InfoboxComponent, "ap-infobox", never, { "i18n": { "alias": "i18n"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "buttonId": { "alias": "buttonId"; "required": false; }; "buttonDataTrack": { "alias": "buttonDataTrack"; "required": false; }; "buttonSymbolId": { "alias": "buttonSymbolId"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; }; "type": { "alias": "type"; "required": false; }; }, { "buttonClicked": "buttonClicked"; "closed": "closed"; }, never, ["*"], true, never>;
28
36
  static ngAcceptInputType_closable: unknown;
29
37
  }
30
38
 
@@ -19,7 +19,13 @@ interface AskedConfirmation {
19
19
  message: ShownText;
20
20
  confirm?: ShownText;
21
21
  cancel?: ShownText;
22
+ /** Present only when it is not the default `'confirm'`. */
23
+ footerConfirmButtonId?: string;
24
+ /** Present only when it is not the default `'cancel'`. */
25
+ footerCancelButtonId?: string;
22
26
  }
27
+ /** What a modal answers: `true` confirms, `false` cancels, `undefined` closes without a choice, `'pending'` stays open until the code closes it. */
28
+ type ConfirmModalAnswer = boolean | undefined | 'pending';
23
29
  /**
24
30
  * A {@link MatDialog} for specs that answers every `ConfirmModalComponent.open` with {@link answer} instead of rendering
25
31
  * it, and records the texts of each modal in {@link asked}. Any other component goes to the real dialog. It needs no
@@ -34,8 +40,11 @@ interface AskedConfirmation {
34
40
  declare class FakeConfirmModal extends MatDialog {
35
41
  /** Every confirm modal opened, oldest first. */
36
42
  readonly asked: AskedConfirmation[];
37
- /** What the next modals answer: `true` confirms, `false` cancels, `undefined` closes without a choice. */
38
- answer: boolean | undefined;
43
+ /** What the next modals answer. */
44
+ answer: ConfirmModalAnswer;
45
+ private pending;
46
+ /** How many `'pending'` modals the code has not closed yet. */
47
+ get openModals(): number;
39
48
  open<T, D = unknown, R = unknown>(component: ComponentType<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;
40
49
  open<T, D = unknown, R = unknown>(template: TemplateRef<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;
41
50
  /** Forgets every modal opened so far. */
@@ -50,7 +59,7 @@ declare class FakeConfirmModal extends MatDialog {
50
59
  * providers: [provideFakeConfirmModal({ answer: true })]
51
60
  */
52
61
  declare function provideFakeConfirmModal(options?: {
53
- answer?: boolean | undefined;
62
+ answer?: ConfirmModalAnswer;
54
63
  }): Provider[];
55
64
 
56
65
  /** One snackbar the code under test showed. */
@@ -94,4 +103,4 @@ declare class FakeSnackbarsThreadService extends SnackbarsThreadService {
94
103
  declare function provideFakeSnackbars(): Provider[];
95
104
 
96
105
  export { FakeConfirmModal, FakeSnackbarsThreadService, provideFakeConfirmModal, provideFakeSnackbars };
97
- export type { AskedConfirmation, ShownSnackbar, ShownText };
106
+ export type { AskedConfirmation, ConfirmModalAnswer, ShownSnackbar, ShownText };