@acorex/components 22.2.10 → 22.2.12
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/emoji/README.md +3 -0
- package/emojipicker/README.md +3 -0
- package/fesm2022/acorex-components-bubble.mjs +71 -0
- package/fesm2022/acorex-components-bubble.mjs.map +1 -0
- package/fesm2022/acorex-components-combo-box.mjs +71 -18
- package/fesm2022/acorex-components-combo-box.mjs.map +1 -1
- package/fesm2022/{acorex-components-conversation-acorex-components-conversation-CXf00kvo.mjs → acorex-components-conversation-acorex-components-conversation-DDkiZfPb.mjs} +831 -254
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-DDkiZfPb.mjs.map +1 -0
- package/fesm2022/{acorex-components-conversation-picker-rename-file-dialog.component-DZINTie8.mjs → acorex-components-conversation-picker-rename-file-dialog.component-CH3Q6Hry.mjs} +2 -2
- package/fesm2022/{acorex-components-conversation-picker-rename-file-dialog.component-DZINTie8.mjs.map → acorex-components-conversation-picker-rename-file-dialog.component-CH3Q6Hry.mjs.map} +1 -1
- package/fesm2022/acorex-components-conversation.mjs +1 -1
- package/fesm2022/acorex-components-data-table.mjs +14 -10
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-emoji.mjs +74 -0
- package/fesm2022/acorex-components-emoji.mjs.map +1 -0
- package/fesm2022/acorex-components-emojipicker.mjs +425 -0
- package/fesm2022/acorex-components-emojipicker.mjs.map +1 -0
- package/fesm2022/acorex-components-file-viewer.mjs +46 -22
- package/fesm2022/acorex-components-file-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-inline-reaction.mjs +111 -0
- package/fesm2022/acorex-components-inline-reaction.mjs.map +1 -0
- package/fesm2022/acorex-components-map.mjs +7 -0
- package/fesm2022/acorex-components-map.mjs.map +1 -1
- package/fesm2022/acorex-components-message-status.mjs +71 -0
- package/fesm2022/acorex-components-message-status.mjs.map +1 -0
- package/fesm2022/acorex-components-message-time.mjs +36 -0
- package/fesm2022/acorex-components-message-time.mjs.map +1 -0
- package/fesm2022/acorex-components-message.mjs +120 -0
- package/fesm2022/acorex-components-message.mjs.map +1 -0
- package/fesm2022/acorex-components-reaction.mjs +144 -0
- package/fesm2022/acorex-components-reaction.mjs.map +1 -0
- package/fesm2022/acorex-components-tabs.mjs +2 -2
- package/fesm2022/acorex-components-tabs.mjs.map +1 -1
- package/inline-reaction/README.md +3 -0
- package/message/README.md +3 -0
- package/message-status/README.md +3 -0
- package/message-time/README.md +3 -0
- package/package.json +35 -3
- package/reaction/README.md +3 -0
- package/types/acorex-components-bubble.d.ts +31 -0
- package/types/acorex-components-combo-box.d.ts +2 -2
- package/types/acorex-components-conversation.d.ts +126 -13
- package/types/acorex-components-data-table.d.ts +1 -1
- package/types/acorex-components-emoji.d.ts +42 -0
- package/types/acorex-components-emojipicker.d.ts +146 -0
- package/types/acorex-components-file-viewer.d.ts +5 -0
- package/types/acorex-components-inline-reaction.d.ts +52 -0
- package/types/acorex-components-map.d.ts +5 -0
- package/types/acorex-components-message-status.d.ts +23 -0
- package/types/acorex-components-message-time.d.ts +19 -0
- package/types/acorex-components-message.d.ts +59 -0
- package/types/acorex-components-reaction.d.ts +85 -0
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-CXf00kvo.mjs.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, signal, effect, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
const check = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z" fill="#09090B"/>
|
|
8
|
+
</svg>`;
|
|
9
|
+
const checkCheck = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929C1.68342 10.9024 2.31658 10.9024 2.70711 11.2929L7 15.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289Z" fill="#09090B"/>
|
|
11
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7071 9.29289C23.0976 9.68342 23.0976 10.3166 22.7071 10.7071L15.2071 18.2071C14.8166 18.5976 14.1834 18.5976 13.7929 18.2071L12.2929 16.7071C11.9024 16.3166 11.9024 15.6834 12.2929 15.2929C12.6834 14.9024 13.3166 14.9024 13.7071 15.2929L14.5 16.0858L21.2929 9.29289C21.6834 8.90237 22.3166 8.90237 22.7071 9.29289Z" fill="#09090B"/>
|
|
12
|
+
</svg>
|
|
13
|
+
`;
|
|
14
|
+
const timer = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 2C9 1.44772 9.44772 1 10 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H10C9.44772 3 9 2.55228 9 2Z" fill="#09090B"/>
|
|
16
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.7071 10.2929C16.0976 10.6834 16.0976 11.3166 15.7071 11.7071L12.7071 14.7071C12.3166 15.0976 11.6834 15.0976 11.2929 14.7071C10.9024 14.3166 10.9024 13.6834 11.2929 13.2929L14.2929 10.2929C14.6834 9.90237 15.3166 9.90237 15.7071 10.2929Z" fill="#09090B"/>
|
|
17
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 7C8.13401 7 5 10.134 5 14C5 17.866 8.13401 21 12 21C15.866 21 19 17.866 19 14C19 10.134 15.866 7 12 7ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z" fill="#09090B"/>
|
|
18
|
+
</svg>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
class AXMessageStatusComponent {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.status = input('pending', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this.sanetizer = inject(DomSanitizer);
|
|
26
|
+
this.htmlContent = signal(null, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "htmlContent" }] : /* istanbul ignore next */ []));
|
|
28
|
+
this.#eff = effect(() => {
|
|
29
|
+
switch (this.status()) {
|
|
30
|
+
case 'pending':
|
|
31
|
+
this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(timer));
|
|
32
|
+
return;
|
|
33
|
+
case 'send':
|
|
34
|
+
this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(check));
|
|
35
|
+
return;
|
|
36
|
+
case 'delivered':
|
|
37
|
+
this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(checkCheck));
|
|
38
|
+
return;
|
|
39
|
+
default:
|
|
40
|
+
this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(checkCheck));
|
|
41
|
+
}
|
|
42
|
+
}, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "#eff" }] : /* istanbul ignore next */ []));
|
|
44
|
+
}
|
|
45
|
+
#eff;
|
|
46
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
47
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: AXMessageStatusComponent, isStandalone: true, selector: "ax-message-status", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<i [innerHTML]=\"htmlContent()\"></i>\n" }); }
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'ax-message-status', imports: [], template: "<i [innerHTML]=\"htmlContent()\"></i>\n" }]
|
|
52
|
+
}], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }] } });
|
|
53
|
+
|
|
54
|
+
class AXMessageStatusModule {
|
|
55
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
56
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusModule, imports: [CommonModule] }); }
|
|
57
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusModule, imports: [CommonModule] }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageStatusModule, decorators: [{
|
|
60
|
+
type: NgModule,
|
|
61
|
+
args: [{
|
|
62
|
+
imports: [CommonModule],
|
|
63
|
+
}]
|
|
64
|
+
}] });
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generated bundle index. Do not edit.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
export { AXMessageStatusComponent, AXMessageStatusModule };
|
|
71
|
+
//# sourceMappingURL=acorex-components-message-status.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-message-status.mjs","sources":["../../../../packages/components/message-status/src/lib/icons.ts","../../../../packages/components/message-status/src/lib/message-status.component.ts","../../../../packages/components/message-status/src/lib/message-status.component.html","../../../../packages/components/message-status/src/lib/message-status.module.ts","../../../../packages/components/message-status/src/acorex-components-message-status.ts"],"sourcesContent":["export const check = `<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z\" fill=\"#09090B\"/>\n</svg>`;\nexport const checkCheck = `<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929C1.68342 10.9024 2.31658 10.9024 2.70711 11.2929L7 15.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289Z\" fill=\"#09090B\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M22.7071 9.29289C23.0976 9.68342 23.0976 10.3166 22.7071 10.7071L15.2071 18.2071C14.8166 18.5976 14.1834 18.5976 13.7929 18.2071L12.2929 16.7071C11.9024 16.3166 11.9024 15.6834 12.2929 15.2929C12.6834 14.9024 13.3166 14.9024 13.7071 15.2929L14.5 16.0858L21.2929 9.29289C21.6834 8.90237 22.3166 8.90237 22.7071 9.29289Z\" fill=\"#09090B\"/>\n</svg>\n`;\nexport const timer = `<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 2C9 1.44772 9.44772 1 10 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H10C9.44772 3 9 2.55228 9 2Z\" fill=\"#09090B\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.7071 10.2929C16.0976 10.6834 16.0976 11.3166 15.7071 11.7071L12.7071 14.7071C12.3166 15.0976 11.6834 15.0976 11.2929 14.7071C10.9024 14.3166 10.9024 13.6834 11.2929 13.2929L14.2929 10.2929C14.6834 9.90237 15.3166 9.90237 15.7071 10.2929Z\" fill=\"#09090B\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 7C8.13401 7 5 10.134 5 14C5 17.866 8.13401 21 12 21C15.866 21 19 17.866 19 14C19 10.134 15.866 7 12 7ZM3 14C3 9.02944 7.02944 5 12 5C16.9706 5 21 9.02944 21 14C21 18.9706 16.9706 23 12 23C7.02944 23 3 18.9706 3 14Z\" fill=\"#09090B\"/>\n</svg>\n`;\n","import { Component, effect, inject, input, signal } from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { check, checkCheck, timer } from './icons';\nimport { MessageStatus } from './message-status.modal';\n\n@Component({\n selector: 'ax-message-status',\n templateUrl: './message-status.component.html',\n imports: [],\n})\nexport class AXMessageStatusComponent {\n status = input<MessageStatus>('pending');\n\n private sanetizer = inject(DomSanitizer);\n protected htmlContent = signal<SafeHtml>(null);\n\n #eff = effect(() => {\n switch (this.status()) {\n case 'pending':\n this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(timer));\n return;\n case 'send':\n this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(check));\n return;\n case 'delivered':\n this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(checkCheck));\n return;\n default:\n this.htmlContent.set(this.sanetizer.bypassSecurityTrustHtml(checkCheck));\n }\n });\n}\n","<i [innerHTML]=\"htmlContent()\"></i>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\n@NgModule({\n imports: [CommonModule],\n})\nexport class AXMessageStatusModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAO,MAAM,KAAK,GAAG,CAAA;;OAEd;AACA,MAAM,UAAU,GAAG,CAAA;;;;CAIzB;AACM,MAAM,KAAK,GAAG,CAAA;;;;;CAKpB;;MCHY,wBAAwB,CAAA;AALrC,IAAA,WAAA,GAAA;QAME,IAAA,CAAA,MAAM,GAAG,KAAK,CAAgB,SAAS;mFAAC;AAEhC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;QAC9B,IAAA,CAAA,WAAW,GAAG,MAAM,CAAW,IAAI;wFAAC;AAE9C,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAK;AACjB,YAAA,QAAQ,IAAI,CAAC,MAAM,EAAE;AACnB,gBAAA,KAAK,SAAS;AACZ,oBAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;oBACnE;AACF,gBAAA,KAAK,MAAM;AACT,oBAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CA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EAAA,qBAAqB,YAFtB,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAEX,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
class AXMessageTimeComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.time = input(/* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [undefined, { debugName: "time" }] : /* istanbul ignore next */ []));
|
|
9
|
+
}
|
|
10
|
+
ngOnInit() { }
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
12
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: AXMessageTimeComponent, isStandalone: true, selector: "ax-message-time", inputs: { time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<span class=\"ax-message-time\">\n {{ time() }}\n</span>\n" }); }
|
|
13
|
+
}
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeComponent, decorators: [{
|
|
15
|
+
type: Component,
|
|
16
|
+
args: [{ selector: 'ax-message-time', template: "<span class=\"ax-message-time\">\n {{ time() }}\n</span>\n" }]
|
|
17
|
+
}], ctorParameters: () => [], propDecorators: { time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }] } });
|
|
18
|
+
|
|
19
|
+
class AXMessageTimeModule {
|
|
20
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
21
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeModule, imports: [CommonModule] }); }
|
|
22
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeModule, imports: [CommonModule] }); }
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageTimeModule, decorators: [{
|
|
25
|
+
type: NgModule,
|
|
26
|
+
args: [{
|
|
27
|
+
imports: [CommonModule],
|
|
28
|
+
}]
|
|
29
|
+
}] });
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Generated bundle index. Do not edit.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export { AXMessageTimeComponent, AXMessageTimeModule };
|
|
36
|
+
//# sourceMappingURL=acorex-components-message-time.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-message-time.mjs","sources":["../../../../packages/components/message-time/src/lib/message-time.component.ts","../../../../packages/components/message-time/src/lib/message-time.component.html","../../../../packages/components/message-time/src/lib/message-time.module.ts","../../../../packages/components/message-time/src/acorex-components-message-time.ts"],"sourcesContent":["import { Component, input, OnInit } from '@angular/core';\n\n@Component({\n selector: 'ax-message-time',\n templateUrl: 'message-time.component.html',\n})\nexport class AXMessageTimeComponent implements OnInit {\n constructor() {}\n\n time = input<string>();\n\n ngOnInit() {}\n}\n","<span class=\"ax-message-time\">\n {{ time() }}\n</span>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\n@NgModule({\n imports: [CommonModule],\n})\nexport class AXMessageTimeModule {}\n","/**\n *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BAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, viewChild, computed, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { AXComponent } from '@acorex/cdk/common';
|
|
4
|
+
import { AXAvatarComponent } from '@acorex/components/avatar';
|
|
5
|
+
import { AXBubbleComponent } from '@acorex/components/bubble';
|
|
6
|
+
import { AXDecoratorGenericComponent } from '@acorex/components/decorators';
|
|
7
|
+
import { AXImageComponent } from '@acorex/components/image';
|
|
8
|
+
import { AXContextMenuComponent } from '@acorex/components/menu';
|
|
9
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
10
|
+
import { cloneDeep } from 'lodash-es';
|
|
11
|
+
import { AXInlineReactionComponent } from '@acorex/components/inline-reaction';
|
|
12
|
+
import { AXMessageStatusComponent } from '@acorex/components/message-status';
|
|
13
|
+
import { AXMessageTimeComponent } from '@acorex/components/message-time';
|
|
14
|
+
|
|
15
|
+
class AXMessageComponent {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.templateData = input(/* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [undefined, { debugName: "templateData" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this.itemTemplate = input(null, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
21
|
+
this.layout = input('ping-pong', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
23
|
+
/** Own message: aligned end in ping-pong and styled via inner ax-bubble. */
|
|
24
|
+
this.isown = input(false, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "isown" }] : /* istanbul ignore next */ []));
|
|
26
|
+
this.text = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
28
|
+
this.avatarSrc = input(null, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "avatarSrc" }] : /* istanbul ignore next */ []));
|
|
30
|
+
this.avatarSize = input(32, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "avatarSize" }] : /* istanbul ignore next */ []));
|
|
32
|
+
this.showAvatar = input(true, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "showAvatar" }] : /* istanbul ignore next */ []));
|
|
34
|
+
this.status = input(null, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
36
|
+
this.time = input(null, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Quick reactions shown in the context menu header. */
|
|
39
|
+
this.quickReactions = input([], /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "quickReactions" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Context menu action items. Parent can also append via `contextMenuOpening`. */
|
|
42
|
+
this.contextMenuItems = input([], /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "contextMenuItems" }] : /* istanbul ignore next */ []));
|
|
44
|
+
/** Whether right-click context menu is enabled on the bubble. */
|
|
45
|
+
this.contextMenuEnabled = input(true, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "contextMenuEnabled" }] : /* istanbul ignore next */ []));
|
|
47
|
+
/** Emoji size in pixels inside the context menu reaction bar. */
|
|
48
|
+
this.reactionSize = input(20, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "reactionSize" }] : /* istanbul ignore next */ []));
|
|
50
|
+
/** Emits when a quick reaction or picker emoji is selected from the context menu. */
|
|
51
|
+
this.reactionSelected = output();
|
|
52
|
+
/** Emits while the context menu opens so the parent can customize `event.items`. */
|
|
53
|
+
this.contextMenuOpening = output();
|
|
54
|
+
/** Emits when a context menu action item is clicked. */
|
|
55
|
+
this.menuItemClick = output();
|
|
56
|
+
this.contextMenu = viewChild(AXContextMenuComponent, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "contextMenu" }] : /* istanbul ignore next */ []));
|
|
58
|
+
this.hasTemplate = computed(() => !!this.itemTemplate(), /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "hasTemplate" }] : /* istanbul ignore next */ []));
|
|
60
|
+
this.showReactionBar = computed(() => this.quickReactions().length > 0, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "showReactionBar" }] : /* istanbul ignore next */ []));
|
|
62
|
+
this.hostClass = computed(() => {
|
|
63
|
+
const layout = this.layout();
|
|
64
|
+
if (layout === 'stack') {
|
|
65
|
+
return 'ax-message ax-message-stack';
|
|
66
|
+
}
|
|
67
|
+
return `ax-message ax-message-ping-pong ax-message-${this.isown() ? 'end' : 'start'}`;
|
|
68
|
+
}, /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
|
|
70
|
+
}
|
|
71
|
+
onContextMenuOpening(event) {
|
|
72
|
+
event.items.push(...cloneDeep(this.contextMenuItems()));
|
|
73
|
+
this.contextMenuOpening.emit(event);
|
|
74
|
+
}
|
|
75
|
+
onReactionSelected(emoji) {
|
|
76
|
+
this.reactionSelected.emit(emoji);
|
|
77
|
+
this.contextMenu()?.close();
|
|
78
|
+
}
|
|
79
|
+
onMenuItemClick(event) {
|
|
80
|
+
this.menuItemClick.emit(event);
|
|
81
|
+
}
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
83
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMessageComponent, isStandalone: true, selector: "ax-message", inputs: { templateData: { classPropertyName: "templateData", publicName: "templateData", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isown: { classPropertyName: "isown", publicName: "isown", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, avatarSrc: { classPropertyName: "avatarSrc", publicName: "avatarSrc", isSignal: true, isRequired: false, transformFunction: null }, avatarSize: { classPropertyName: "avatarSize", publicName: "avatarSize", isSignal: true, isRequired: false, transformFunction: null }, showAvatar: { classPropertyName: "showAvatar", publicName: "showAvatar", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, time: { classPropertyName: "time", publicName: "time", isSignal: true, isRequired: false, transformFunction: null }, quickReactions: { classPropertyName: "quickReactions", publicName: "quickReactions", isSignal: true, isRequired: false, transformFunction: null }, contextMenuItems: { classPropertyName: "contextMenuItems", publicName: "contextMenuItems", isSignal: true, isRequired: false, transformFunction: null }, contextMenuEnabled: { classPropertyName: "contextMenuEnabled", publicName: "contextMenuEnabled", isSignal: true, isRequired: false, transformFunction: null }, reactionSize: { classPropertyName: "reactionSize", publicName: "reactionSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reactionSelected: "reactionSelected", contextMenuOpening: "contextMenuOpening", menuItemClick: "menuItemClick" }, host: { properties: { "class": "hostClass()" } }, providers: [{ provide: AXComponent, useExisting: AXMessageComponent }], viewQueries: [{ propertyName: "contextMenu", first: true, predicate: AXContextMenuComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (hasTemplate()) {\n <ng-container [ngTemplateOutlet]=\"itemTemplate()!\" [ngTemplateOutletContext]=\"{ $implicit: templateData() }\" />\n} @else {\n <div class=\"ax-message-body\">\n @if (showAvatar()) {\n <ax-avatar class=\"ax-message-avatar\" [size]=\"avatarSize()\">\n @if (avatarSrc()) {\n <ax-image [src]=\"avatarSrc()!\" [alt]=\"''\" />\n }\n </ax-avatar>\n }\n\n <div class=\"ax-message-bubble-target\" #bubbleTarget>\n <ax-bubble [isown]=\"isown()\">\n @if (text()) {\n <ax-content>\n <span class=\"ax-message-text\">\n {{ text() }}\n </span>\n </ax-content>\n }\n\n <ng-content />\n\n @if (status() || time()) {\n <ax-footer class=\"ax-message-status-container\">\n <ax-message-status [status]=\"status()!\" />\n <ax-message-time [time]=\"time()\"></ax-message-time>\n </ax-footer>\n }\n </ax-bubble>\n </div>\n\n @if (contextMenuEnabled()) {\n <ax-context-menu\n [target]=\"bubbleTarget\"\n (onOpening)=\"onContextMenuOpening($event)\"\n (onItemClick)=\"onMenuItemClick($event)\"\n >\n @if (showReactionBar()) {\n <ax-header>\n <ax-inline-reaction\n [emojis]=\"quickReactions()\"\n [size]=\"reactionSize()\"\n [showExpanded]=\"true\"\n (selected)=\"onReactionSelected($event)\"\n />\n </ax-header>\n }\n </ax-context-menu>\n }\n </div>\n}\n", styles: ["@layer components{ax-message{--ax-comp-bubble-radius: var(--ax-sys-border-radius);--ax-comp-bubble-tail-self: 0;display:flex;width:100%;max-width:100%}ax-message.ax-message-ping-pong.ax-message-start{justify-content:flex-start}ax-message.ax-message-ping-pong.ax-message-end{justify-content:flex-end}ax-message.ax-message-ping-pong .ax-message-body{display:inline-flex;max-width:85%;min-width:calc(var(--spacing, .25rem) * 0);align-items:flex-end;gap:calc(var(--spacing, .25rem) * 2)}ax-message.ax-message-ping-pong.ax-message-start .ax-message-body{flex-direction:row}ax-message.ax-message-ping-pong.ax-message-end .ax-message-body{flex-direction:row-reverse}ax-message.ax-message-stack{justify-content:flex-end}ax-message.ax-message-stack ax-bubble{border-radius:var(--ax-comp-bubble-radius);border-end-end-radius:var(--ax-comp-bubble-tail-self)}ax-message.ax-message-stack .ax-message-body{display:inline-flex;max-width:85%;min-width:calc(var(--spacing, .25rem) * 0);flex-direction:row-reverse;align-items:flex-end;gap:calc(var(--spacing, .25rem) * 2)}ax-message .ax-message-avatar{flex-shrink:0;align-self:flex-end}ax-message .ax-message-text{overflow-wrap:break-word;white-space:pre-wrap}ax-message .ax-message-status-container{display:flex;justify-content:flex-end}ax-message .ax-message-bubble-target{min-width:calc(var(--spacing, .25rem) * 0)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AXAvatarComponent, selector: "ax-avatar", inputs: ["color", "size", "shape", "look"], outputs: ["sizeChange"] }, { kind: "component", type: AXBubbleComponent, selector: "ax-bubble", inputs: ["isown", "templateData", "itemTemplate"] }, { kind: "component", type: AXImageComponent, selector: "ax-image", inputs: ["width", "height", "overlayMode", "src", "alt", "priority", "lazy"], outputs: ["onLoad", "onError"] }, { kind: "component", type: AXMessageStatusComponent, selector: "ax-message-status", inputs: ["status"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXMessageTimeComponent, selector: "ax-message-time", inputs: ["time"] }, { kind: "component", type: AXContextMenuComponent, selector: "ax-context-menu", inputs: ["orientation", "openOn", "closeOn", "closeOnRouteChange", "items", "target"], outputs: ["onItemClick", "onOpening", "onClose"] }, { kind: "component", type: AXInlineReactionComponent, selector: "ax-inline-reaction", inputs: ["emojis", "size", "maxVisible", "showExpanded", "closeOnClickOutside"], outputs: ["selected", "expandedChange"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageComponent, decorators: [{
|
|
86
|
+
type: Component,
|
|
87
|
+
args: [{ selector: 'ax-message', imports: [
|
|
88
|
+
NgTemplateOutlet,
|
|
89
|
+
AXAvatarComponent,
|
|
90
|
+
AXBubbleComponent,
|
|
91
|
+
AXImageComponent,
|
|
92
|
+
AXMessageStatusComponent,
|
|
93
|
+
AXDecoratorGenericComponent,
|
|
94
|
+
AXMessageTimeComponent,
|
|
95
|
+
AXContextMenuComponent,
|
|
96
|
+
AXInlineReactionComponent,
|
|
97
|
+
], encapsulation: ViewEncapsulation.None, host: {
|
|
98
|
+
'[class]': 'hostClass()',
|
|
99
|
+
}, providers: [{ provide: AXComponent, useExisting: AXMessageComponent }], template: "@if (hasTemplate()) {\n <ng-container [ngTemplateOutlet]=\"itemTemplate()!\" [ngTemplateOutletContext]=\"{ $implicit: templateData() }\" />\n} @else {\n <div class=\"ax-message-body\">\n @if (showAvatar()) {\n <ax-avatar class=\"ax-message-avatar\" [size]=\"avatarSize()\">\n @if (avatarSrc()) {\n <ax-image [src]=\"avatarSrc()!\" [alt]=\"''\" />\n }\n </ax-avatar>\n }\n\n <div class=\"ax-message-bubble-target\" #bubbleTarget>\n <ax-bubble [isown]=\"isown()\">\n @if (text()) {\n <ax-content>\n <span class=\"ax-message-text\">\n {{ text() }}\n </span>\n </ax-content>\n }\n\n <ng-content />\n\n @if (status() || time()) {\n <ax-footer class=\"ax-message-status-container\">\n <ax-message-status [status]=\"status()!\" />\n <ax-message-time [time]=\"time()\"></ax-message-time>\n </ax-footer>\n }\n </ax-bubble>\n </div>\n\n @if (contextMenuEnabled()) {\n <ax-context-menu\n [target]=\"bubbleTarget\"\n (onOpening)=\"onContextMenuOpening($event)\"\n (onItemClick)=\"onMenuItemClick($event)\"\n >\n @if (showReactionBar()) {\n <ax-header>\n <ax-inline-reaction\n [emojis]=\"quickReactions()\"\n [size]=\"reactionSize()\"\n [showExpanded]=\"true\"\n (selected)=\"onReactionSelected($event)\"\n />\n </ax-header>\n }\n </ax-context-menu>\n }\n </div>\n}\n", styles: ["@layer components{ax-message{--ax-comp-bubble-radius: var(--ax-sys-border-radius);--ax-comp-bubble-tail-self: 0;display:flex;width:100%;max-width:100%}ax-message.ax-message-ping-pong.ax-message-start{justify-content:flex-start}ax-message.ax-message-ping-pong.ax-message-end{justify-content:flex-end}ax-message.ax-message-ping-pong .ax-message-body{display:inline-flex;max-width:85%;min-width:calc(var(--spacing, .25rem) * 0);align-items:flex-end;gap:calc(var(--spacing, .25rem) * 2)}ax-message.ax-message-ping-pong.ax-message-start .ax-message-body{flex-direction:row}ax-message.ax-message-ping-pong.ax-message-end .ax-message-body{flex-direction:row-reverse}ax-message.ax-message-stack{justify-content:flex-end}ax-message.ax-message-stack ax-bubble{border-radius:var(--ax-comp-bubble-radius);border-end-end-radius:var(--ax-comp-bubble-tail-self)}ax-message.ax-message-stack .ax-message-body{display:inline-flex;max-width:85%;min-width:calc(var(--spacing, .25rem) * 0);flex-direction:row-reverse;align-items:flex-end;gap:calc(var(--spacing, .25rem) * 2)}ax-message .ax-message-avatar{flex-shrink:0;align-self:flex-end}ax-message .ax-message-text{overflow-wrap:break-word;white-space:pre-wrap}ax-message .ax-message-status-container{display:flex;justify-content:flex-end}ax-message .ax-message-bubble-target{min-width:calc(var(--spacing, .25rem) * 0)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
100
|
+
}], propDecorators: { templateData: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateData", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], isown: [{ type: i0.Input, args: [{ isSignal: true, alias: "isown", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], avatarSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarSrc", required: false }] }], avatarSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarSize", required: false }] }], showAvatar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAvatar", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], time: [{ type: i0.Input, args: [{ isSignal: true, alias: "time", required: false }] }], quickReactions: [{ type: i0.Input, args: [{ isSignal: true, alias: "quickReactions", required: false }] }], contextMenuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextMenuItems", required: false }] }], contextMenuEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextMenuEnabled", required: false }] }], reactionSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "reactionSize", required: false }] }], reactionSelected: [{ type: i0.Output, args: ["reactionSelected"] }], contextMenuOpening: [{ type: i0.Output, args: ["contextMenuOpening"] }], menuItemClick: [{ type: i0.Output, args: ["menuItemClick"] }], contextMenu: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXContextMenuComponent), { isSignal: true }] }] } });
|
|
101
|
+
|
|
102
|
+
class AXMessageModule {
|
|
103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
104
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMessageModule, imports: [AXMessageComponent], exports: [AXMessageComponent] }); }
|
|
105
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageModule, imports: [AXMessageComponent] }); }
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMessageModule, decorators: [{
|
|
108
|
+
type: NgModule,
|
|
109
|
+
args: [{
|
|
110
|
+
imports: [AXMessageComponent],
|
|
111
|
+
exports: [AXMessageComponent],
|
|
112
|
+
}]
|
|
113
|
+
}] });
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generated bundle index. Do not edit.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export { AXMessageComponent, AXMessageModule };
|
|
120
|
+
//# sourceMappingURL=acorex-components-message.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-message.mjs","sources":["../../../../packages/components/message/src/lib/message.component.ts","../../../../packages/components/message/src/lib/message.component.html","../../../../packages/components/message/src/lib/message.module.ts","../../../../packages/components/message/src/acorex-components-message.ts"],"sourcesContent":["import { AXComponent } from '@acorex/cdk/common';\nimport { AXAvatarComponent } from '@acorex/components/avatar';\nimport { AXBubbleComponent } from '@acorex/components/bubble';\nimport { AXDecoratorGenericComponent } from '@acorex/components/decorators';\nimport { AXImageComponent } from '@acorex/components/image';\nimport {\n AXContextMenuComponent,\n AXContextMenuItemsClickEvent,\n AXContextMenuOpeningEvent,\n AXMenuItem,\n} from '@acorex/components/menu';\nimport { AXEmoji } from '@acorex/core/constants';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, input, output, TemplateRef, viewChild, ViewEncapsulation } from '@angular/core';\nimport { cloneDeep } from 'lodash-es';\nimport { AXInlineReactionComponent } from '@acorex/components/inline-reaction';\nimport { AXMessageStatusComponent, MessageStatus } from '@acorex/components/message-status';\nimport { AXMessageTimeComponent } from '@acorex/components/message-time';\nimport type { AXMessageLayout, AXMessageTemplateContext } from './message.type';\n\n@Component({\n selector: 'ax-message',\n templateUrl: './message.component.html',\n styleUrls: ['./message.component.css'],\n imports: [\n NgTemplateOutlet,\n AXAvatarComponent,\n AXBubbleComponent,\n AXImageComponent,\n AXMessageStatusComponent,\n AXDecoratorGenericComponent,\n AXMessageTimeComponent,\n AXContextMenuComponent,\n AXInlineReactionComponent,\n ],\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'hostClass()',\n },\n providers: [{ provide: AXComponent, useExisting: AXMessageComponent }],\n})\nexport class AXMessageComponent<T = unknown> {\n templateData = input<T>();\n\n itemTemplate = input<TemplateRef<AXMessageTemplateContext<T>> | null>(null);\n\n layout = input<AXMessageLayout>('ping-pong');\n\n /** Own message: aligned end in ping-pong and styled via inner ax-bubble. */\n isown = input(false);\n\n text = input<string>('');\n\n avatarSrc = input<string | null>(null);\n\n avatarSize = input(32);\n\n showAvatar = input(true);\n\n status = input<MessageStatus | null>(null);\n\n time = input<string | null>(null);\n\n /** Quick reactions shown in the context menu header. */\n quickReactions = input<readonly AXEmoji[]>([]);\n\n /** Context menu action items. Parent can also append via `contextMenuOpening`. */\n contextMenuItems = input<readonly AXMenuItem[]>([]);\n\n /** Whether right-click context menu is enabled on the bubble. */\n contextMenuEnabled = input(true);\n\n /** Emoji size in pixels inside the context menu reaction bar. */\n reactionSize = input(20);\n\n /** Emits when a quick reaction or picker emoji is selected from the context menu. */\n reactionSelected = output<AXEmoji>();\n\n /** Emits while the context menu opens so the parent can customize `event.items`. */\n contextMenuOpening = output<AXContextMenuOpeningEvent>();\n\n /** Emits when a context menu action item is clicked. */\n menuItemClick = output<AXContextMenuItemsClickEvent>();\n\n private readonly contextMenu = viewChild(AXContextMenuComponent);\n\n protected readonly hasTemplate = computed(() => !!this.itemTemplate());\n\n protected readonly showReactionBar = computed(() => this.quickReactions().length > 0);\n\n protected readonly hostClass = computed(() => {\n const layout = this.layout();\n\n if (layout === 'stack') {\n return 'ax-message ax-message-stack';\n }\n\n return `ax-message ax-message-ping-pong ax-message-${this.isown() ? 'end' : 'start'}`;\n });\n\n protected onContextMenuOpening(event: AXContextMenuOpeningEvent): void {\n event.items.push(...cloneDeep(this.contextMenuItems()));\n this.contextMenuOpening.emit(event);\n }\n\n protected onReactionSelected(emoji: AXEmoji): void {\n this.reactionSelected.emit(emoji);\n this.contextMenu()?.close();\n }\n\n protected onMenuItemClick(event: AXContextMenuItemsClickEvent): void {\n this.menuItemClick.emit(event);\n }\n}\n","@if (hasTemplate()) {\n <ng-container [ngTemplateOutlet]=\"itemTemplate()!\" [ngTemplateOutletContext]=\"{ $implicit: templateData() }\" />\n} @else {\n <div class=\"ax-message-body\">\n @if (showAvatar()) {\n <ax-avatar class=\"ax-message-avatar\" [size]=\"avatarSize()\">\n @if (avatarSrc()) {\n <ax-image [src]=\"avatarSrc()!\" [alt]=\"''\" />\n }\n </ax-avatar>\n }\n\n <div class=\"ax-message-bubble-target\" #bubbleTarget>\n <ax-bubble [isown]=\"isown()\">\n @if (text()) {\n <ax-content>\n <span class=\"ax-message-text\">\n {{ text() }}\n </span>\n </ax-content>\n }\n\n <ng-content />\n\n @if (status() || time()) {\n <ax-footer class=\"ax-message-status-container\">\n <ax-message-status [status]=\"status()!\" />\n <ax-message-time [time]=\"time()\"></ax-message-time>\n </ax-footer>\n }\n </ax-bubble>\n </div>\n\n @if (contextMenuEnabled()) {\n <ax-context-menu\n [target]=\"bubbleTarget\"\n (onOpening)=\"onContextMenuOpening($event)\"\n (onItemClick)=\"onMenuItemClick($event)\"\n >\n @if (showReactionBar()) {\n <ax-header>\n <ax-inline-reaction\n [emojis]=\"quickReactions()\"\n [size]=\"reactionSize()\"\n [showExpanded]=\"true\"\n (selected)=\"onReactionSelected($event)\"\n />\n </ax-header>\n }\n </ax-context-menu>\n }\n </div>\n}\n","import { NgModule } from '@angular/core';\nimport { AXMessageComponent } from './message.component';\n\n@NgModule({\n imports: [AXMessageComponent],\n exports: [AXMessageComponent],\n})\nexport class AXMessageModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAyCa,kBAAkB,CAAA;AArB/B,IAAA,WAAA,GAAA;AAsBE,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK;oGAAK;QAEzB,IAAA,CAAA,YAAY,GAAG,KAAK,CAAkD,IAAI;yFAAC;QAE3E,IAAA,CAAA,MAAM,GAAG,KAAK,CAAkB,WAAW;mFAAC;;QAG5C,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,KAAK;kFAAC;QAEpB,IAAA,CAAA,IAAI,GAAG,KAAK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BAAsB;wBACtB,yBAAyB;qBAC1B,EAAA,aAAA,EACc,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B;AACJ,wBAAA,SAAS,EAAE,aAAa;qBACzB,EAAA,SAAA,EACU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAA,kBAAoB,EAAE,CAAC,EAAA,QAAA,EAAA,sjDAAA,EAAA,MAAA,EAAA,CAAA,+4CAAA,CAAA,EAAA;8pDA6C7B,sBAAsB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ME7EpD,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CAHhB,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA,CAAA;AAEjB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAHhB,kBAAkB,CAAA,EAAA,CAAA,CAAA;;2FAGjB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC9B,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { AXComponent } from '@acorex/cdk/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, output, viewChild, signal, computed, effect, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
4
|
+
import { AXEmojiComponent } from '@acorex/components/emoji';
|
|
5
|
+
import { AXEmojiPickerComponent } from '@acorex/components/emojipicker';
|
|
6
|
+
import { AXPopoverComponent } from '@acorex/components/popover';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Telegram-style reaction chips for chat messages.
|
|
10
|
+
* Renders emojis with {@link AXEmojiComponent} and opens {@link AXEmojiPickerComponent}
|
|
11
|
+
* inside {@link AXPopoverComponent} when editable.
|
|
12
|
+
*
|
|
13
|
+
* @category Components
|
|
14
|
+
*/
|
|
15
|
+
class AXReactionComponent {
|
|
16
|
+
constructor() {
|
|
17
|
+
/**
|
|
18
|
+
* Aggregated reactions to display.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue []
|
|
21
|
+
*/
|
|
22
|
+
this.items = input([], /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
24
|
+
/**
|
|
25
|
+
* Rendered emoji size in pixels.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue 18
|
|
28
|
+
*/
|
|
29
|
+
this.size = input(18, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/**
|
|
32
|
+
* When true, reactions are interactive and an add button opens the emoji picker popover.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue false
|
|
35
|
+
*/
|
|
36
|
+
this.editable = input(false, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/**
|
|
39
|
+
* When true, the emoji picker popover is opened.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue false
|
|
42
|
+
*/
|
|
43
|
+
this.showPicker = input(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "showPicker" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/**
|
|
46
|
+
* Emits when the user selects a new reaction or an unselected existing one.
|
|
47
|
+
*/
|
|
48
|
+
this.add = output();
|
|
49
|
+
/**
|
|
50
|
+
* Emits when the user removes their own reaction.
|
|
51
|
+
*/
|
|
52
|
+
this.remove = output();
|
|
53
|
+
this.pickerPopover = viewChild('pickerPopover', /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "pickerPopover" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** Whether the emoji picker popover is currently open. */
|
|
56
|
+
this.pickerOpen = signal(false, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "pickerOpen" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** Whether the add button should appear pressed while the picker is open. */
|
|
59
|
+
this.isPickerVisible = computed(() => this.showPicker() || this.pickerOpen(), /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "isPickerVisible" }] : /* istanbul ignore next */ []));
|
|
61
|
+
effect(() => {
|
|
62
|
+
const show = this.showPicker();
|
|
63
|
+
const popover = this.pickerPopover();
|
|
64
|
+
if (!popover) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (show && !popover.isOpen) {
|
|
68
|
+
void popover.open();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Toggles a reaction without mutating counts; parent owns state. */
|
|
73
|
+
onItemClick(item) {
|
|
74
|
+
if (!this.editable()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (item.selected) {
|
|
78
|
+
this.remove.emit(item.emoji);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.add.emit(item.emoji);
|
|
82
|
+
}
|
|
83
|
+
/** Opens or closes the emoji picker popover. */
|
|
84
|
+
togglePicker(event) {
|
|
85
|
+
event?.preventDefault();
|
|
86
|
+
event?.stopPropagation();
|
|
87
|
+
const popover = this.pickerPopover();
|
|
88
|
+
if (!popover) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (popover.isOpen) {
|
|
92
|
+
popover.close();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
void popover.open();
|
|
96
|
+
}
|
|
97
|
+
/** Forwards a picker selection as `add` and closes the popover. */
|
|
98
|
+
onPickerSelected(emoji) {
|
|
99
|
+
this.add.emit(emoji);
|
|
100
|
+
this.pickerPopover()?.close();
|
|
101
|
+
}
|
|
102
|
+
/** Syncs the add-button pressed state when the popover opens. */
|
|
103
|
+
onPickerOpened() {
|
|
104
|
+
this.pickerOpen.set(true);
|
|
105
|
+
}
|
|
106
|
+
/** Syncs the add-button pressed state when the popover closes. */
|
|
107
|
+
onPickerClosed() {
|
|
108
|
+
this.pickerOpen.set(false);
|
|
109
|
+
}
|
|
110
|
+
/** Accessible name for an existing reaction chip. */
|
|
111
|
+
itemAriaLabel(item) {
|
|
112
|
+
const selected = item.selected ? ', selected' : '';
|
|
113
|
+
return `${item.emoji.name}, ${item.count}${selected}`;
|
|
114
|
+
}
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXReactionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
116
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXReactionComponent, isStandalone: true, selector: "ax-reaction", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, showPicker: { classPropertyName: "showPicker", publicName: "showPicker", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { add: "add", remove: "remove" }, host: { properties: { "class.ax-reaction-editable": "editable()" }, classAttribute: "ax-reaction-host" }, providers: [{ provide: AXComponent, useExisting: AXReactionComponent }], viewQueries: [{ propertyName: "pickerPopover", first: true, predicate: ["pickerPopover"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"ax-reaction\">\n @for (item of items(); track item.emoji.code) {\n <button\n type=\"button\"\n class=\"ax-reaction-item\"\n [class.ax-reaction-item-selected]=\"item.selected\"\n [class.ax-reaction-item-interactive]=\"editable()\"\n [attr.aria-label]=\"itemAriaLabel(item)\"\n [attr.aria-pressed]=\"item.selected ? true : null\"\n [title]=\"item.emoji.name\"\n (click)=\"onItemClick(item)\"\n >\n <ax-emoji [emoji]=\"item.emoji\" [size]=\"size()\" />\n\n <span class=\"ax-reaction-count\">\n {{ item.count }}\n </span>\n </button>\n }\n\n @if (editable()) {\n <button\n #addButton\n type=\"button\"\n class=\"ax-reaction-item ax-reaction-add\"\n [class.ax-reaction-item-selected]=\"isPickerVisible()\"\n [attr.aria-label]=\"'Add reaction'\"\n [attr.aria-expanded]=\"isPickerVisible()\"\n [attr.aria-haspopup]=\"true\"\n title=\"Add reaction\"\n (click)=\"togglePicker($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <span class=\"ax-reaction-add-icon\" aria-hidden=\"true\"></span>\n </button>\n\n <ax-popover\n #pickerPopover\n [target]=\"addButton\"\n [openOn]=\"'manual'\"\n [closeOn]=\"'clickOut'\"\n [placement]=\"'bottom-start'\"\n panelClass=\"ax-reaction-picker-panel\"\n (onOpened)=\"onPickerOpened()\"\n (onClosed)=\"onPickerClosed()\"\n >\n <ax-emoji-picker (selected)=\"onPickerSelected($event)\" />\n </ax-popover>\n }\n</div>\n", styles: ["@layer properties;@layer components{ax-reaction{--ax-comp-reaction-gap: .25rem;--ax-comp-reaction-item-gap: .25rem;--ax-comp-reaction-item-padding-x: .4rem;--ax-comp-reaction-item-padding-y: .125rem;--ax-comp-reaction-item-min-height: 1.5rem;--ax-comp-reaction-item-radius: 9999px;--ax-comp-reaction-item-font-size: .6875rem;--ax-comp-reaction-item-bg: var(--color-surface);--ax-comp-reaction-item-border: var(--color-border-lightest);--ax-comp-reaction-item-color: var(--color-on-surface);--ax-comp-reaction-item-hover-bg: var(--color-lightest);--ax-comp-reaction-item-selected-bg: color-mix(in srgb, rgba(var(--ax-sys-color-primary-surface)) 18%, rgba(var(--ax-sys-color-surface)));--ax-comp-reaction-item-selected-border: var(--color-border-primary);position:relative;display:inline-flex;align-items:center}@supports (color: color-mix(in lab,red,red)){ax-reaction{--ax-comp-reaction-item-selected-bg: color-mix(in oklab, var(--color-primary) 18%, var(--color-surface))}}ax-reaction .ax-reaction{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--ax-comp-reaction-gap)}ax-reaction .ax-reaction-item{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(infinity * 1px);border-style:var(--tw-border-style);border-width:1px;gap:var(--ax-comp-reaction-item-gap);min-height:var(--ax-comp-reaction-item-min-height);padding:var(--ax-comp-reaction-item-padding-y) var(--ax-comp-reaction-item-padding-x);border-radius:var(--ax-comp-reaction-item-radius);border-color:var(--ax-comp-reaction-item-border);background-color:var(--ax-comp-reaction-item-bg);color:var(--ax-comp-reaction-item-color);font-size:var(--ax-comp-reaction-item-font-size);line-height:1;cursor:default}ax-reaction .ax-reaction-item ax-emoji{pointer-events:none}ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add{cursor:pointer}:is(ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add):hover{background-color:var(--ax-comp-reaction-item-hover-bg);border-color:var(--color-border-light)}:is(ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add):focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}ax-reaction .ax-reaction-item-selected{background-color:var(--ax-comp-reaction-item-selected-bg);border-color:var(--ax-comp-reaction-item-selected-border)}ax-reaction .ax-reaction-count{--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);color:var(--ax-comp-reaction-item-color);opacity:.7}ax-reaction .ax-reaction-item-selected .ax-reaction-count{color:var(--color-primary);opacity:.95}ax-reaction .ax-reaction-add{aspect-ratio:1 / 1;min-width:1.5rem;padding-inline:calc(var(--spacing, .25rem) * 0)}ax-reaction .ax-reaction-add-icon{position:relative;display:block;width:calc(var(--spacing, .25rem) * 2.5);height:calc(var(--spacing, .25rem) * 2.5)}ax-reaction .ax-reaction-add-icon:before,ax-reaction .ax-reaction-add-icon:after{position:absolute;inset:calc(var(--spacing, .25rem) * 0);margin:auto;border-radius:calc(infinity * 1px);content:\"\";background-color:currentColor}ax-reaction .ax-reaction-add-icon:before{width:100%;height:1.5px}ax-reaction .ax-reaction-add-icon:after{width:1.5px;height:100%}ax-reaction ax-popover{display:contents}.ax-reaction-picker-panel ax-emoji-picker{width:min(22rem,92vw);border:none;box-shadow:none;border-radius:0}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@property --tw-ordinal{syntax: \"*\"; inherits: false;}@property --tw-slashed-zero{syntax: \"*\"; inherits: false;}@property --tw-numeric-figure{syntax: \"*\"; inherits: false;}@property --tw-numeric-spacing{syntax: \"*\"; inherits: false;}@property --tw-numeric-fraction{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial;--tw-ordinal: initial;--tw-slashed-zero: initial;--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXEmojiComponent, selector: "ax-emoji", inputs: ["emoji", "appearance", "size"] }, { kind: "component", type: AXEmojiPickerComponent, selector: "ax-emoji-picker", inputs: ["items", "size", "appearance", "showSearch", "showRecent", "columns", "searchPlaceholder", "excludeCategories", "excludeCodes", "excludeUnicode", "recentItems"], outputs: ["selected", "recentChanged"] }, { kind: "component", type: AXPopoverComponent, selector: "ax-popover", inputs: ["width", "disablePanelClass", "visualContextScope", "disabled", "offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "closeOnScroll", "backdropClass", "panelClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
117
|
+
}
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXReactionComponent, decorators: [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{ selector: 'ax-reaction', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
121
|
+
class: 'ax-reaction-host',
|
|
122
|
+
'[class.ax-reaction-editable]': 'editable()',
|
|
123
|
+
}, imports: [AXEmojiComponent, AXEmojiPickerComponent, AXPopoverComponent], providers: [{ provide: AXComponent, useExisting: AXReactionComponent }], template: "<div class=\"ax-reaction\">\n @for (item of items(); track item.emoji.code) {\n <button\n type=\"button\"\n class=\"ax-reaction-item\"\n [class.ax-reaction-item-selected]=\"item.selected\"\n [class.ax-reaction-item-interactive]=\"editable()\"\n [attr.aria-label]=\"itemAriaLabel(item)\"\n [attr.aria-pressed]=\"item.selected ? true : null\"\n [title]=\"item.emoji.name\"\n (click)=\"onItemClick(item)\"\n >\n <ax-emoji [emoji]=\"item.emoji\" [size]=\"size()\" />\n\n <span class=\"ax-reaction-count\">\n {{ item.count }}\n </span>\n </button>\n }\n\n @if (editable()) {\n <button\n #addButton\n type=\"button\"\n class=\"ax-reaction-item ax-reaction-add\"\n [class.ax-reaction-item-selected]=\"isPickerVisible()\"\n [attr.aria-label]=\"'Add reaction'\"\n [attr.aria-expanded]=\"isPickerVisible()\"\n [attr.aria-haspopup]=\"true\"\n title=\"Add reaction\"\n (click)=\"togglePicker($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <span class=\"ax-reaction-add-icon\" aria-hidden=\"true\"></span>\n </button>\n\n <ax-popover\n #pickerPopover\n [target]=\"addButton\"\n [openOn]=\"'manual'\"\n [closeOn]=\"'clickOut'\"\n [placement]=\"'bottom-start'\"\n panelClass=\"ax-reaction-picker-panel\"\n (onOpened)=\"onPickerOpened()\"\n (onClosed)=\"onPickerClosed()\"\n >\n <ax-emoji-picker (selected)=\"onPickerSelected($event)\" />\n </ax-popover>\n }\n</div>\n", styles: ["@layer properties;@layer components{ax-reaction{--ax-comp-reaction-gap: .25rem;--ax-comp-reaction-item-gap: .25rem;--ax-comp-reaction-item-padding-x: .4rem;--ax-comp-reaction-item-padding-y: .125rem;--ax-comp-reaction-item-min-height: 1.5rem;--ax-comp-reaction-item-radius: 9999px;--ax-comp-reaction-item-font-size: .6875rem;--ax-comp-reaction-item-bg: var(--color-surface);--ax-comp-reaction-item-border: var(--color-border-lightest);--ax-comp-reaction-item-color: var(--color-on-surface);--ax-comp-reaction-item-hover-bg: var(--color-lightest);--ax-comp-reaction-item-selected-bg: color-mix(in srgb, rgba(var(--ax-sys-color-primary-surface)) 18%, rgba(var(--ax-sys-color-surface)));--ax-comp-reaction-item-selected-border: var(--color-border-primary);position:relative;display:inline-flex;align-items:center}@supports (color: color-mix(in lab,red,red)){ax-reaction{--ax-comp-reaction-item-selected-bg: color-mix(in oklab, var(--color-primary) 18%, var(--color-surface))}}ax-reaction .ax-reaction{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var(--ax-comp-reaction-gap)}ax-reaction .ax-reaction-item{display:inline-flex;align-items:center;justify-content:center;border-radius:calc(infinity * 1px);border-style:var(--tw-border-style);border-width:1px;gap:var(--ax-comp-reaction-item-gap);min-height:var(--ax-comp-reaction-item-min-height);padding:var(--ax-comp-reaction-item-padding-y) var(--ax-comp-reaction-item-padding-x);border-radius:var(--ax-comp-reaction-item-radius);border-color:var(--ax-comp-reaction-item-border);background-color:var(--ax-comp-reaction-item-bg);color:var(--ax-comp-reaction-item-color);font-size:var(--ax-comp-reaction-item-font-size);line-height:1;cursor:default}ax-reaction .ax-reaction-item ax-emoji{pointer-events:none}ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add{cursor:pointer}:is(ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add):hover{background-color:var(--ax-comp-reaction-item-hover-bg);border-color:var(--color-border-light)}:is(ax-reaction .ax-reaction-item-interactive,ax-reaction .ax-reaction-add):focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}ax-reaction .ax-reaction-item-selected{background-color:var(--ax-comp-reaction-item-selected-bg);border-color:var(--ax-comp-reaction-item-selected-border)}ax-reaction .ax-reaction-count{--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);color:var(--ax-comp-reaction-item-color);opacity:.7}ax-reaction .ax-reaction-item-selected .ax-reaction-count{color:var(--color-primary);opacity:.95}ax-reaction .ax-reaction-add{aspect-ratio:1 / 1;min-width:1.5rem;padding-inline:calc(var(--spacing, .25rem) * 0)}ax-reaction .ax-reaction-add-icon{position:relative;display:block;width:calc(var(--spacing, .25rem) * 2.5);height:calc(var(--spacing, .25rem) * 2.5)}ax-reaction .ax-reaction-add-icon:before,ax-reaction .ax-reaction-add-icon:after{position:absolute;inset:calc(var(--spacing, .25rem) * 0);margin:auto;border-radius:calc(infinity * 1px);content:\"\";background-color:currentColor}ax-reaction .ax-reaction-add-icon:before{width:100%;height:1.5px}ax-reaction .ax-reaction-add-icon:after{width:1.5px;height:100%}ax-reaction ax-popover{display:contents}.ax-reaction-picker-panel ax-emoji-picker{width:min(22rem,92vw);border:none;box-shadow:none;border-radius:0}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@property --tw-ordinal{syntax: \"*\"; inherits: false;}@property --tw-slashed-zero{syntax: \"*\"; inherits: false;}@property --tw-numeric-figure{syntax: \"*\"; inherits: false;}@property --tw-numeric-spacing{syntax: \"*\"; inherits: false;}@property --tw-numeric-fraction{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial;--tw-ordinal: initial;--tw-slashed-zero: initial;--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial}}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
124
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], showPicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPicker", required: false }] }], add: [{ type: i0.Output, args: ["add"] }], remove: [{ type: i0.Output, args: ["remove"] }], pickerPopover: [{ type: i0.ViewChild, args: ['pickerPopover', { isSignal: true }] }] } });
|
|
125
|
+
|
|
126
|
+
class AXReactionModule {
|
|
127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXReactionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
128
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXReactionModule, imports: [AXReactionComponent], exports: [AXReactionComponent] }); }
|
|
129
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXReactionModule, imports: [AXReactionComponent] }); }
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXReactionModule, decorators: [{
|
|
132
|
+
type: NgModule,
|
|
133
|
+
args: [{
|
|
134
|
+
imports: [AXReactionComponent],
|
|
135
|
+
exports: [AXReactionComponent],
|
|
136
|
+
}]
|
|
137
|
+
}] });
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Generated bundle index. Do not edit.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
export { AXReactionComponent, AXReactionModule };
|
|
144
|
+
//# sourceMappingURL=acorex-components-reaction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-components-reaction.mjs","sources":["../../../../packages/components/reaction/src/lib/reaction.component.ts","../../../../packages/components/reaction/src/lib/reaction.component.html","../../../../packages/components/reaction/src/lib/reaction.module.ts","../../../../packages/components/reaction/src/acorex-components-reaction.ts"],"sourcesContent":["import { AXComponent } from '@acorex/cdk/common';\nimport { AXEmoji } from '@acorex/core/constants';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n input,\n output,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { AXEmojiComponent } from '@acorex/components/emoji';\nimport { AXEmojiPickerComponent } from '@acorex/components/emojipicker';\nimport { AXPopoverComponent } from '@acorex/components/popover';\nimport { AXReactionItem } from './reaction.type';\n\n/**\n * Telegram-style reaction chips for chat messages.\n * Renders emojis with {@link AXEmojiComponent} and opens {@link AXEmojiPickerComponent}\n * inside {@link AXPopoverComponent} when editable.\n *\n * @category Components\n */\n@Component({\n selector: 'ax-reaction',\n templateUrl: './reaction.component.html',\n styleUrls: ['./reaction.component.css'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'ax-reaction-host',\n '[class.ax-reaction-editable]': 'editable()',\n },\n imports: [AXEmojiComponent, AXEmojiPickerComponent, AXPopoverComponent],\n providers: [{ provide: AXComponent, useExisting: AXReactionComponent }],\n})\nexport class AXReactionComponent {\n /**\n * Aggregated reactions to display.\n *\n * @defaultValue []\n */\n readonly items = input<readonly AXReactionItem[]>([]);\n\n /**\n * Rendered emoji size in pixels.\n *\n * @defaultValue 18\n */\n readonly size = input(18);\n\n /**\n * When true, reactions are interactive and an add button opens the emoji picker popover.\n *\n * @defaultValue false\n */\n readonly editable = input(false);\n\n /**\n * When true, the emoji picker popover is opened.\n *\n * @defaultValue false\n */\n readonly showPicker = input(false);\n\n /**\n * Emits when the user selects a new reaction or an unselected existing one.\n */\n readonly add = output<AXEmoji>();\n\n /**\n * Emits when the user removes their own reaction.\n */\n readonly remove = output<AXEmoji>();\n\n private readonly pickerPopover = viewChild<AXPopoverComponent>('pickerPopover');\n\n /** Whether the emoji picker popover is currently open. */\n protected readonly pickerOpen = signal(false);\n\n /** Whether the add button should appear pressed while the picker is open. */\n protected readonly isPickerVisible = computed(() => this.showPicker() || this.pickerOpen());\n\n constructor() {\n effect(() => {\n const show = this.showPicker();\n const popover = this.pickerPopover();\n if (!popover) {\n return;\n }\n\n if (show && !popover.isOpen) {\n void popover.open();\n }\n });\n }\n\n /** Toggles a reaction without mutating counts; parent owns state. */\n protected onItemClick(item: AXReactionItem): void {\n if (!this.editable()) {\n return;\n }\n\n if (item.selected) {\n this.remove.emit(item.emoji);\n return;\n }\n\n this.add.emit(item.emoji);\n }\n\n /** Opens or closes the emoji picker popover. */\n protected togglePicker(event?: Event): void {\n event?.preventDefault();\n event?.stopPropagation();\n\n const popover = this.pickerPopover();\n if (!popover) {\n return;\n }\n\n if (popover.isOpen) {\n popover.close();\n return;\n }\n\n void popover.open();\n }\n\n /** Forwards a picker selection as `add` and closes the popover. */\n protected onPickerSelected(emoji: AXEmoji): void {\n this.add.emit(emoji);\n this.pickerPopover()?.close();\n }\n\n /** Syncs the add-button pressed state when the popover opens. */\n protected onPickerOpened(): void {\n this.pickerOpen.set(true);\n }\n\n /** Syncs the add-button pressed state when the popover closes. */\n protected onPickerClosed(): void {\n this.pickerOpen.set(false);\n }\n\n /** Accessible name for an existing reaction chip. */\n protected itemAriaLabel(item: AXReactionItem): string {\n const selected = item.selected ? ', selected' : '';\n return `${item.emoji.name}, ${item.count}${selected}`;\n }\n}\n","<div class=\"ax-reaction\">\n @for (item of items(); track item.emoji.code) {\n <button\n type=\"button\"\n class=\"ax-reaction-item\"\n [class.ax-reaction-item-selected]=\"item.selected\"\n [class.ax-reaction-item-interactive]=\"editable()\"\n [attr.aria-label]=\"itemAriaLabel(item)\"\n [attr.aria-pressed]=\"item.selected ? true : null\"\n [title]=\"item.emoji.name\"\n (click)=\"onItemClick(item)\"\n >\n <ax-emoji [emoji]=\"item.emoji\" [size]=\"size()\" />\n\n <span class=\"ax-reaction-count\">\n {{ item.count }}\n </span>\n </button>\n }\n\n @if (editable()) {\n <button\n #addButton\n type=\"button\"\n class=\"ax-reaction-item ax-reaction-add\"\n [class.ax-reaction-item-selected]=\"isPickerVisible()\"\n [attr.aria-label]=\"'Add reaction'\"\n [attr.aria-expanded]=\"isPickerVisible()\"\n [attr.aria-haspopup]=\"true\"\n title=\"Add reaction\"\n (click)=\"togglePicker($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n >\n <span class=\"ax-reaction-add-icon\" aria-hidden=\"true\"></span>\n </button>\n\n <ax-popover\n #pickerPopover\n [target]=\"addButton\"\n [openOn]=\"'manual'\"\n [closeOn]=\"'clickOut'\"\n [placement]=\"'bottom-start'\"\n panelClass=\"ax-reaction-picker-panel\"\n (onOpened)=\"onPickerOpened()\"\n (onClosed)=\"onPickerClosed()\"\n >\n <ax-emoji-picker (selected)=\"onPickerSelected($event)\" />\n </ax-popover>\n }\n</div>\n","import { NgModule } from '@angular/core';\nimport { AXReactionComponent } from './reaction.component';\n\n@NgModule({\n imports: [AXReactionComponent],\n exports: [AXReactionComponent],\n})\nexport class AXReactionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBA;;;;;;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