@molecule/app-ui-angular 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +989 -1103
- package/dist/components/alert.component.d.ts +11 -16
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.component.js +22 -51
- package/dist/components/alert.component.js.map +1 -1
- package/dist/components/auth-guard.component.d.ts +36 -28
- package/dist/components/auth-guard.component.d.ts.map +1 -1
- package/dist/components/auth-guard.component.js +59 -67
- package/dist/components/auth-guard.component.js.map +1 -1
- package/dist/components/avatar.component.d.ts +13 -10
- package/dist/components/avatar.component.d.ts.map +1 -1
- package/dist/components/avatar.component.js +27 -25
- package/dist/components/avatar.component.js.map +1 -1
- package/dist/components/button.component.d.ts +26 -30
- package/dist/components/button.component.d.ts.map +1 -1
- package/dist/components/button.component.js +41 -75
- package/dist/components/button.component.js.map +1 -1
- package/dist/components/checkbox.component.d.ts +5 -4
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.component.js +14 -9
- package/dist/components/checkbox.component.js.map +1 -1
- package/dist/components/confirm-button.component.d.ts +11 -28
- package/dist/components/confirm-button.component.d.ts.map +1 -1
- package/dist/components/confirm-button.component.js +31 -63
- package/dist/components/confirm-button.component.js.map +1 -1
- package/dist/components/confirm-dialog.component.d.ts +28 -17
- package/dist/components/confirm-dialog.component.d.ts.map +1 -1
- package/dist/components/confirm-dialog.component.js +98 -69
- package/dist/components/confirm-dialog.component.js.map +1 -1
- package/dist/components/dropdown.component.d.ts +29 -16
- package/dist/components/dropdown.component.d.ts.map +1 -1
- package/dist/components/dropdown.component.js +134 -105
- package/dist/components/dropdown.component.js.map +1 -1
- package/dist/components/empty-state.component.d.ts +10 -15
- package/dist/components/empty-state.component.d.ts.map +1 -1
- package/dist/components/empty-state.component.js +23 -27
- package/dist/components/empty-state.component.js.map +1 -1
- package/dist/components/form-field.component.d.ts +26 -11
- package/dist/components/form-field.component.d.ts.map +1 -1
- package/dist/components/form-field.component.js +86 -25
- package/dist/components/form-field.component.js.map +1 -1
- package/dist/components/input.component.d.ts +20 -23
- package/dist/components/input.component.d.ts.map +1 -1
- package/dist/components/input.component.js +45 -54
- package/dist/components/input.component.js.map +1 -1
- package/dist/components/language-picker.component.d.ts +15 -18
- package/dist/components/language-picker.component.d.ts.map +1 -1
- package/dist/components/language-picker.component.js +25 -35
- package/dist/components/language-picker.component.js.map +1 -1
- package/dist/components/load-error-banner.component.d.ts +14 -26
- package/dist/components/load-error-banner.component.d.ts.map +1 -1
- package/dist/components/load-error-banner.component.js +28 -62
- package/dist/components/load-error-banner.component.js.map +1 -1
- package/dist/components/modal.component.d.ts +25 -21
- package/dist/components/modal.component.d.ts.map +1 -1
- package/dist/components/modal.component.js +42 -78
- package/dist/components/modal.component.js.map +1 -1
- package/dist/components/molecule/button.component.d.ts +13 -2
- package/dist/components/molecule/button.component.d.ts.map +1 -1
- package/dist/components/molecule/button.component.js +45 -15
- package/dist/components/molecule/button.component.js.map +1 -1
- package/dist/components/molecule/toast.component.d.ts +2 -1
- package/dist/components/molecule/toast.component.d.ts.map +1 -1
- package/dist/components/molecule/toast.component.js +9 -7
- package/dist/components/molecule/toast.component.js.map +1 -1
- package/dist/components/molecule/tooltip.component.d.ts +4 -2
- package/dist/components/molecule/tooltip.component.d.ts.map +1 -1
- package/dist/components/molecule/tooltip.component.js +19 -14
- package/dist/components/molecule/tooltip.component.js.map +1 -1
- package/dist/components/optimistic-toggle-button.component.d.ts +13 -25
- package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -1
- package/dist/components/optimistic-toggle-button.component.js +33 -63
- package/dist/components/optimistic-toggle-button.component.js.map +1 -1
- package/dist/components/page-header.component.d.ts +8 -13
- package/dist/components/page-header.component.d.ts.map +1 -1
- package/dist/components/page-header.component.js +16 -24
- package/dist/components/page-header.component.js.map +1 -1
- package/dist/components/page-shell.component.d.ts +8 -14
- package/dist/components/page-shell.component.d.ts.map +1 -1
- package/dist/components/page-shell.component.js +18 -28
- package/dist/components/page-shell.component.js.map +1 -1
- package/dist/components/panel-close.component.d.ts +14 -8
- package/dist/components/panel-close.component.d.ts.map +1 -1
- package/dist/components/panel-close.component.js +28 -17
- package/dist/components/panel-close.component.js.map +1 -1
- package/dist/components/prompt-dialog.component.d.ts +32 -10
- package/dist/components/prompt-dialog.component.d.ts.map +1 -1
- package/dist/components/prompt-dialog.component.js +110 -73
- package/dist/components/prompt-dialog.component.js.map +1 -1
- package/dist/components/responsive-app-shell.component.d.ts +38 -57
- package/dist/components/responsive-app-shell.component.d.ts.map +1 -1
- package/dist/components/responsive-app-shell.component.js +138 -213
- package/dist/components/responsive-app-shell.component.js.map +1 -1
- package/dist/components/sidebar-user-card.component.d.ts +8 -12
- package/dist/components/sidebar-user-card.component.d.ts.map +1 -1
- package/dist/components/sidebar-user-card.component.js +19 -35
- package/dist/components/sidebar-user-card.component.js.map +1 -1
- package/dist/components/switch.component.d.ts +13 -8
- package/dist/components/switch.component.d.ts.map +1 -1
- package/dist/components/switch.component.js +29 -20
- package/dist/components/switch.component.js.map +1 -1
- package/dist/components/table.component.d.ts +22 -14
- package/dist/components/table.component.d.ts.map +1 -1
- package/dist/components/table.component.js +34 -32
- package/dist/components/table.component.js.map +1 -1
- package/dist/components/toast.component.d.ts +34 -37
- package/dist/components/toast.component.d.ts.map +1 -1
- package/dist/components/toast.component.js +76 -112
- package/dist/components/toast.component.js.map +1 -1
- package/dist/components/tooltip.component.d.ts +14 -11
- package/dist/components/tooltip.component.d.ts.map +1 -1
- package/dist/components/tooltip.component.js +47 -47
- package/dist/components/tooltip.component.js.map +1 -1
- package/dist/components/user-menu-popover.component.d.ts +6 -12
- package/dist/components/user-menu-popover.component.d.ts.map +1 -1
- package/dist/components/user-menu-popover.component.js +40 -77
- package/dist/components/user-menu-popover.component.js.map +1 -1
- package/dist/components/user-menu.component.d.ts +8 -11
- package/dist/components/user-menu.component.d.ts.map +1 -1
- package/dist/components/user-menu.component.js +19 -27
- package/dist/components/user-menu.component.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/utilities/dom-context.d.ts +62 -15
- package/dist/utilities/dom-context.d.ts.map +1 -1
- package/dist/utilities/dom-context.js +79 -34
- package/dist/utilities/dom-context.js.map +1 -1
- package/dist/utilities/form-field-context.d.ts +2 -0
- package/dist/utilities/form-field-context.d.ts.map +1 -1
- package/dist/utilities/form-field-context.js +4 -2
- package/dist/utilities/form-field-context.js.map +1 -1
- package/dist/utilities/node-value.d.ts +8 -0
- package/dist/utilities/node-value.d.ts.map +1 -1
- package/dist/utilities/node-value.js +10 -0
- package/dist/utilities/node-value.js.map +1 -1
- package/dist/utilities/rest-attrs.d.ts +2 -2
- package/dist/utilities/rest-attrs.js +1 -1
- package/package.json +3 -3
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { EventEmitter } from '@angular/core';
|
|
6
|
+
import { ElementRef, EventEmitter } from '@angular/core';
|
|
7
7
|
import type { ButtonVariant, ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "@molecule/app-angular";
|
|
9
10
|
/**
|
|
10
11
|
* Angular Button UI component with UIClassMap-driven styling.
|
|
12
|
+
*
|
|
13
|
+
* React's root is the native `<button>`, so the button element of the
|
|
14
|
+
* template renders in front of the host (`placeElementBefore`) and the host
|
|
15
|
+
* itself leaves the page: the rendered tree is React's, with no wrapper
|
|
16
|
+
* element around the button.
|
|
11
17
|
*/
|
|
12
18
|
export declare class MoleculeButton {
|
|
13
19
|
variant: ButtonVariant;
|
|
@@ -22,6 +28,11 @@ export declare class MoleculeButton {
|
|
|
22
28
|
disabled: boolean;
|
|
23
29
|
type: 'button' | 'submit' | 'reset';
|
|
24
30
|
handleClick: EventEmitter<MouseEvent>;
|
|
31
|
+
/** The native button React renders as the component's root. */
|
|
32
|
+
root?: ElementRef<HTMLButtonElement>;
|
|
33
|
+
private readonly host;
|
|
34
|
+
/** Renders the button in front of the host, which leaves the page. */
|
|
35
|
+
constructor();
|
|
25
36
|
/**
|
|
26
37
|
* Retrieves the current UI class map.
|
|
27
38
|
* @returns The UIClassMap instance for styling.
|
|
@@ -33,6 +44,6 @@ export declare class MoleculeButton {
|
|
|
33
44
|
*/
|
|
34
45
|
get classes(): string;
|
|
35
46
|
static ɵfac: i0.ɵɵFactoryDeclaration<MoleculeButton, never>;
|
|
36
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MoleculeButton, "mol-button", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "type": { "alias": "type"; "required": false; }; }, { "handleClick": "handleClick"; }, never, ["*"], true,
|
|
47
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MoleculeButton, "mol-button", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "type": { "alias": "type"; "required": false; }; }, { "handleClick": "handleClick"; }, never, ["*"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
37
48
|
}
|
|
38
49
|
//# sourceMappingURL=button.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"button.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,UAAU,EACV,YAAY,EAKb,MAAM,eAAe,CAAA;AAQtB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;;AAGrF;;;;;;;GAOG;AACH,qBA+Ba,cAAc;IAChB,OAAO,EAAE,aAAa,CAAU;IAChC,KAAK,EAAE,YAAY,CAAY;IAC/B,IAAI,EAAE,IAAI,CAAO;IACjB,OAAO,UAAQ;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,UAAQ;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,UAAQ;IAChB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAW;IAE7C,WAAW,2BAAiC;IAEtD,+DAA+D;IAC5C,IAAI,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAEvD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IAEnE,sEAAsE;;IAUtE;;;OAGG;IACH,IAAI,EAAE,IAAI,UAAU,CAEnB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAUpB;yCApDU,cAAc;2CAAd,cAAc;CAqD1B"}
|
|
@@ -3,27 +3,35 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
+
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, inject, Input, Output, ViewChild, } from '@angular/core';
|
|
7
|
+
import { MolPlacement, placeElementBefore, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
7
8
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
|
+
const _c0 = ["root"];
|
|
12
|
+
const _c1 = ["*"];
|
|
13
|
+
function MoleculeButton_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
11
14
|
i0.ɵɵdomElement(0, "span");
|
|
12
15
|
} if (rf & 2) {
|
|
13
16
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
14
17
|
i0.ɵɵclassMap(ctx_r0.cm.buttonSpinner);
|
|
15
18
|
} }
|
|
16
|
-
function
|
|
19
|
+
function MoleculeButton_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
17
20
|
i0.ɵɵtext(0);
|
|
18
21
|
} if (rf & 2) {
|
|
19
22
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
20
23
|
i0.ɵɵtextInterpolate1(" ", ctx_r0.loadingText, " ");
|
|
21
24
|
} }
|
|
22
|
-
function
|
|
25
|
+
function MoleculeButton_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
23
26
|
i0.ɵɵprojection(0);
|
|
24
27
|
} }
|
|
25
28
|
/**
|
|
26
29
|
* Angular Button UI component with UIClassMap-driven styling.
|
|
30
|
+
*
|
|
31
|
+
* React's root is the native `<button>`, so the button element of the
|
|
32
|
+
* template renders in front of the host (`placeElementBefore`) and the host
|
|
33
|
+
* itself leaves the page: the rendered tree is React's, with no wrapper
|
|
34
|
+
* element around the button.
|
|
27
35
|
*/
|
|
28
36
|
/**
|
|
29
37
|
* Molecule Button class.
|
|
@@ -42,6 +50,19 @@ export class MoleculeButton {
|
|
|
42
50
|
disabled = false;
|
|
43
51
|
type = 'button';
|
|
44
52
|
handleClick = new EventEmitter();
|
|
53
|
+
/** The native button React renders as the component's root. */
|
|
54
|
+
root;
|
|
55
|
+
host = inject(ElementRef);
|
|
56
|
+
/** Renders the button in front of the host, which leaves the page. */
|
|
57
|
+
constructor() {
|
|
58
|
+
usePlacement(() => {
|
|
59
|
+
const root = this.root?.nativeElement;
|
|
60
|
+
if (!root)
|
|
61
|
+
return;
|
|
62
|
+
placeElementBefore(root, this.host.nativeElement);
|
|
63
|
+
setElementPresent(this.host.nativeElement, false);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
45
66
|
/**
|
|
46
67
|
* Retrieves the current UI class map.
|
|
47
68
|
* @returns The UIClassMap instance for styling.
|
|
@@ -62,22 +83,27 @@ export class MoleculeButton {
|
|
|
62
83
|
}), this.className);
|
|
63
84
|
}
|
|
64
85
|
static ɵfac = function MoleculeButton_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MoleculeButton)(); };
|
|
65
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MoleculeButton, selectors: [["mol-button"]],
|
|
86
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MoleculeButton, selectors: [["mol-button"]], viewQuery: function MoleculeButton_Query(rf, ctx) { if (rf & 1) {
|
|
87
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
88
|
+
} if (rf & 2) {
|
|
89
|
+
let _t;
|
|
90
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.root = _t.first);
|
|
91
|
+
} }, inputs: { variant: "variant", color: "color", size: "size", loading: "loading", loadingText: "loadingText", fullWidth: "fullWidth", className: "className", style: "style", testId: "testId", disabled: "disabled", type: "type" }, outputs: { handleClick: "handleClick" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c1, decls: 5, vars: 10, consts: [["root", ""], [3, "click", "type", "disabled"], [3, "class"]], template: function MoleculeButton_Template(rf, ctx) { if (rf & 1) {
|
|
66
92
|
i0.ɵɵprojectionDef();
|
|
67
|
-
i0.ɵɵdomElementStart(0, "button", 0);
|
|
93
|
+
i0.ɵɵdomElementStart(0, "button", 1, 0);
|
|
68
94
|
i0.ɵɵdomListener("click", function MoleculeButton_Template_button_click_0_listener($event) { return ctx.handleClick.emit($event); });
|
|
69
|
-
i0.ɵɵconditionalCreate(
|
|
70
|
-
i0.ɵɵconditionalCreate(
|
|
95
|
+
i0.ɵɵconditionalCreate(2, MoleculeButton_Conditional_2_Template, 1, 2, "span", 2);
|
|
96
|
+
i0.ɵɵconditionalCreate(3, MoleculeButton_Conditional_3_Template, 1, 1)(4, MoleculeButton_Conditional_4_Template, 1, 0);
|
|
71
97
|
i0.ɵɵdomElementEnd();
|
|
72
98
|
} if (rf & 2) {
|
|
73
99
|
i0.ɵɵstyleMap(ctx.style);
|
|
74
100
|
i0.ɵɵclassMap(ctx.classes);
|
|
75
101
|
i0.ɵɵdomProperty("type", ctx.type)("disabled", ctx.disabled || ctx.loading);
|
|
76
102
|
i0.ɵɵattribute("data-testid", ctx.testId)("aria-busy", ctx.loading);
|
|
103
|
+
i0.ɵɵadvance(2);
|
|
104
|
+
i0.ɵɵconditional(ctx.loading ? 2 : -1);
|
|
77
105
|
i0.ɵɵadvance();
|
|
78
|
-
i0.ɵɵconditional(ctx.loading ?
|
|
79
|
-
i0.ɵɵadvance();
|
|
80
|
-
i0.ɵɵconditional(ctx.loading && ctx.loadingText ? 2 : 3);
|
|
106
|
+
i0.ɵɵconditional(ctx.loading && ctx.loadingText ? 3 : 4);
|
|
81
107
|
} }, encapsulation: 2 });
|
|
82
108
|
}
|
|
83
109
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeButton, [{
|
|
@@ -86,9 +112,10 @@ export class MoleculeButton {
|
|
|
86
112
|
selector: 'mol-button',
|
|
87
113
|
standalone: true,
|
|
88
114
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
89
|
-
|
|
115
|
+
hostDirectives: [MolPlacement],
|
|
90
116
|
template: `
|
|
91
117
|
<button
|
|
118
|
+
#root
|
|
92
119
|
[type]="type"
|
|
93
120
|
[class]="classes"
|
|
94
121
|
[style]="style"
|
|
@@ -108,7 +135,7 @@ export class MoleculeButton {
|
|
|
108
135
|
</button>
|
|
109
136
|
`,
|
|
110
137
|
}]
|
|
111
|
-
}],
|
|
138
|
+
}], () => [], { variant: [{
|
|
112
139
|
type: Input
|
|
113
140
|
}], color: [{
|
|
114
141
|
type: Input
|
|
@@ -132,6 +159,9 @@ export class MoleculeButton {
|
|
|
132
159
|
type: Input
|
|
133
160
|
}], handleClick: [{
|
|
134
161
|
type: Output
|
|
162
|
+
}], root: [{
|
|
163
|
+
type: ViewChild,
|
|
164
|
+
args: ['root']
|
|
135
165
|
}] }); })();
|
|
136
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeButton, { className: "MoleculeButton", filePath: "components/molecule/button.component.ts", lineNumber:
|
|
166
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeButton, { className: "MoleculeButton", filePath: "components/molecule/button.component.ts", lineNumber: 66 }); })();
|
|
137
167
|
//# sourceMappingURL=button.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.component.js","sourceRoot":"","sources":["../../../src/components/molecule/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"button.component.js","sourceRoot":"","sources":["../../../src/components/molecule/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAA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AS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,EACF,IAAI,CAAC,SAAS,CACf,CAAA;IACH,CAAC;wGApDU,cAAc;6DAAd,cAAc;;;;;;;YAzBvB,uCASC;YADC,oGAAS,4BAAwB,IAAC;YAElC,iFAAe;YAKb,AAFF,sEAA8B,gDAErB;YAGX,oBAAS;;YAdP,wBAAe;YADf,0BAAiB;YAGjB,AAJA,kCAAa,yCAImB;;YAIhC,eAEC;YAFD,sCAEC;YACD,cAIC;YAJD,wDAIC;;;iFAQM,cAAc;cA/B1B,SAAS;eAAC;gBACT,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;GAoBT;aACF;;kBAME,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBAGN,SAAS;mBAAC,MAAM;;kFAhBN,cAAc"}
|
|
@@ -21,7 +21,8 @@ export declare class MoleculeToast implements OnInit, OnDestroy {
|
|
|
21
21
|
style?: Record<string, string>;
|
|
22
22
|
testId?: string;
|
|
23
23
|
dismiss: EventEmitter<void>;
|
|
24
|
-
|
|
24
|
+
/** Whether the toast shows; a signal, so the auto-dismiss timer's change renders (OnPush). */
|
|
25
|
+
readonly isVisible: import("@angular/core").WritableSignal<boolean>;
|
|
25
26
|
private timer?;
|
|
26
27
|
/**
|
|
27
28
|
* Reactive translation, read in the injection context. Its `t` reads the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/toast.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,YAAY,EAEZ,KAAK,SAAS,EACd,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"toast.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/toast.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,YAAY,EAEZ,KAAK,SAAS,EACd,KAAK,MAAM,EAGZ,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAehE;;GAEG;AACH,qBAgDa,aAAc,YAAW,MAAM,EAAE,SAAS;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,YAAY,CAAS;IAC7B,QAAQ,SAAO;IACf,WAAW,UAAO;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,CAC/E;IACP,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEd,OAAO,qBAA2B;IAE5C,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,kDAAe;IACjC,OAAO,CAAC,KAAK,CAAC,CAA+B;IAE7C;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC;;;OAGG;IACH,IAAI,EAAE,IAAI,UAAU,CAEnB;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,OAAO,CAAC,aAAa,CAKpB;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,MAAM,CAG1B;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,MAAM,CAGzB;IAED;;OAEG;IACH,QAAQ,IAAI,IAAI;IAShB;;OAEG;IACH,WAAW,IAAI,IAAI;IAMnB;;OAEG;IACH,SAAS,IAAI,IAAI;yCA3IN,aAAa;2CAAb,aAAa;CA+IzB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
|
|
6
|
+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, signal, } from '@angular/core';
|
|
7
7
|
import { useTranslation } from '@molecule/app-angular';
|
|
8
8
|
import { getClassMap } from '@molecule/app-ui';
|
|
9
9
|
import { getIconSvg } from '../../utilities/icon-markup.js';
|
|
@@ -112,7 +112,9 @@ export class MoleculeToast {
|
|
|
112
112
|
style;
|
|
113
113
|
testId;
|
|
114
114
|
dismiss = new EventEmitter();
|
|
115
|
-
|
|
115
|
+
/** Whether the toast shows; a signal, so the auto-dismiss timer's change renders (OnPush). */
|
|
116
|
+
isVisible = signal(true, /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
116
118
|
timer;
|
|
117
119
|
/**
|
|
118
120
|
* Reactive translation, read in the injection context. Its `t` reads the
|
|
@@ -204,7 +206,7 @@ export class MoleculeToast {
|
|
|
204
206
|
ngOnInit() {
|
|
205
207
|
if (this.duration > 0) {
|
|
206
208
|
this.timer = setTimeout(() => {
|
|
207
|
-
this.isVisible
|
|
209
|
+
this.isVisible.set(false);
|
|
208
210
|
this.dismiss.emit();
|
|
209
211
|
}, this.duration);
|
|
210
212
|
}
|
|
@@ -221,7 +223,7 @@ export class MoleculeToast {
|
|
|
221
223
|
* Handles the dismiss action by hiding the toast.
|
|
222
224
|
*/
|
|
223
225
|
onDismiss() {
|
|
224
|
-
this.isVisible
|
|
226
|
+
this.isVisible.set(false);
|
|
225
227
|
this.dismiss.emit();
|
|
226
228
|
}
|
|
227
229
|
static ɵfac = function MoleculeToast_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MoleculeToast)(); };
|
|
@@ -229,7 +231,7 @@ export class MoleculeToast {
|
|
|
229
231
|
i0.ɵɵprojectionDef();
|
|
230
232
|
i0.ɵɵconditionalCreate(0, MoleculeToast_Conditional_0_Template, 7, 11, "div", 0);
|
|
231
233
|
} if (rf & 2) {
|
|
232
|
-
i0.ɵɵconditional(ctx.isVisible ? 0 : -1);
|
|
234
|
+
i0.ɵɵconditional(ctx.isVisible() ? 0 : -1);
|
|
233
235
|
} }, encapsulation: 2 });
|
|
234
236
|
}
|
|
235
237
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeToast, [{
|
|
@@ -239,7 +241,7 @@ export class MoleculeToast {
|
|
|
239
241
|
standalone: true,
|
|
240
242
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
241
243
|
template: `
|
|
242
|
-
@if (isVisible) {
|
|
244
|
+
@if (isVisible()) {
|
|
243
245
|
<div
|
|
244
246
|
role="alert"
|
|
245
247
|
data-state="open"
|
|
@@ -301,5 +303,5 @@ export class MoleculeToast {
|
|
|
301
303
|
}], dismiss: [{
|
|
302
304
|
type: Output
|
|
303
305
|
}] }); })();
|
|
304
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeToast, { className: "MoleculeToast", filePath: "components/molecule/toast.component.ts", lineNumber:
|
|
306
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeToast, { className: "MoleculeToast", filePath: "components/molecule/toast.component.ts", lineNumber: 86 }); })();
|
|
305
307
|
//# sourceMappingURL=toast.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.component.js","sourceRoot":"","sources":["../../../src/components/molecule/toast.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,MAAM,GACP,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;;;;IA6BjD,+BAAoC;IAClC,6BAAyC;IAC3C,oBAAO;;;IAFD,yCAA6B;IAC3B,cAA2B;IAA3B,sEAA2B;;;IAKjC,8BAA0B;IAAA,YAAW;IAAA,oBAAM;;;IAAtC,gCAAoB;IAAC,cAAW;IAAX,kCAAW;;;IAGrC,8BAAgC;IAAA,YAAiB;IAAA,oBAAM;;;IAAlD,sCAA0B;IAAC,cAAiB;IAAjB,wCAAiB;;;IAEjD,8BAAgC;IAC9B,kBAAyB;IAC3B,oBAAM;;;IAFD,sCAA0B;;;;IAMjC,oCAKC;IAHC,mMAAS,kBAAW,KAAC;IAIrB,6BAA0C;IAC5C,oBAAS;;;IAJP,sCAA0B;;IAGpB,cAA4B;IAA5B,uEAA4B;;;IA/BxC,iCAMC;IACC,8FAAgB;IAKhB,8BAAsC;IACpC,6FAAa;IAKX,AAFF,6FAAmB,uEAEV;IAKX,oBAAM;IACN,gGAAmB;IAUrB,oBAAM;;;IA9BJ,2BAAe;IADf,kCAAsB;;IAItB,cAIC;IAJD,0CAIC;IACI,cAAgC;IAAhC,4CAAgC;IACnC,cAEC;IAFD,uCAEC;IACD,cAMC;IAND,4CAMC;IAEH,eASC;IATD,6CASC;;AApDT,MAAM,gBAAgB,GACpB;IACE,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAA;AAEH;;GAEG;AA6CH;;;GAGG;AACH,MAAM,OAAO,aAAa;IACf,KAAK,CAAS;IACd,WAAW,CAAS;IACpB,MAAM,GAAiB,MAAM,CAAA;IAC7B,QAAQ,GAAG,IAAI,CAAA;IACf,WAAW,GAAG,IAAI,CAAA;IAClB,UAAU,CAAS;IACnB,QAAQ,GACf,cAAc,CAAA;IACP,SAAS,CAAS;IAClB,KAAK,CAAyB;IAC9B,MAAM,CAAS;IAEd,OAAO,GAAG,IAAI,YAAY,EAAQ,CAAA;IAE5C,SAAS,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"toast.component.js","sourceRoot":"","sources":["../../../src/components/molecule/toast.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;;;;IA6BjD,+BAAoC;IAClC,6BAAyC;IAC3C,oBAAO;;;IAFD,yCAA6B;IAC3B,cAA2B;IAA3B,sEAA2B;;;IAKjC,8BAA0B;IAAA,YAAW;IAAA,oBAAM;;;IAAtC,gCAAoB;IAAC,cAAW;IAAX,kCAAW;;;IAGrC,8BAAgC;IAAA,YAAiB;IAAA,oBAAM;;;IAAlD,sCAA0B;IAAC,cAAiB;IAAjB,wCAAiB;;;IAEjD,8BAAgC;IAC9B,kBAAyB;IAC3B,oBAAM;;;IAFD,sCAA0B;;;;IAMjC,oCAKC;IAHC,mMAAS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O,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC/D,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC3B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;gBACzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YACrB,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;IACrB,CAAC;uGA9IU,aAAa;6DAAb,aAAa;;YA3CtB,gFAAmB;;YAAnB,0CAoCC;;;iFAOQ,aAAa;cAhDzB,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCT;aACF;;kBAME,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kFAbI,aAAa"}
|
|
@@ -37,8 +37,10 @@ export declare class MoleculeTooltip implements OnDestroy {
|
|
|
37
37
|
testId?: string;
|
|
38
38
|
triggerRef?: ElementRef<HTMLDivElement>;
|
|
39
39
|
tooltipRef?: ElementRef<HTMLDivElement>;
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
/** Whether the tooltip shows; a signal, so the delay timer's change renders (OnPush). */
|
|
41
|
+
readonly isVisible: import("@angular/core").WritableSignal<boolean>;
|
|
42
|
+
/** The measured placement; a signal, so the animation frame's measurement renders (OnPush). */
|
|
43
|
+
readonly positionStyle: import("@angular/core").WritableSignal<Record<string, string>>;
|
|
42
44
|
private timeoutId?;
|
|
43
45
|
/**
|
|
44
46
|
* Retrieves the current UI class map.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/tooltip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"tooltip.component.d.ts","sourceRoot":"","sources":["../../../src/components/molecule/tooltip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,SAAS,EAGf,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiDxF;AAED;;;;;GAKG;AACH,qBA4Ca,eAAgB,YAAW,SAAS;IACtC,OAAO,SAAK;IACZ,SAAS,EAAE,gBAAgB,CAAQ;IACnC,KAAK,SAAI;IACT,QAAQ,UAAQ;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IAEF,UAAU,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACrC,UAAU,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAE/D,yFAAyF;IACzF,QAAQ,CAAC,SAAS,kDAAgB;IAClC,+FAA+F;IAC/F,QAAQ,CAAC,aAAa,iEAAqC;IAC3D,OAAO,CAAC,SAAS,CAAC,CAA+B;IAEjD;;;OAGG;IACH,IAAI,EAAE,IAAI,UAAU,CAEnB;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvC;IAED;;OAEG;IACH,IAAI,IAAI,IAAI;IAaZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAOZ;;OAEG;IACH,WAAW,IAAI,IAAI;IAMnB;;OAEG;IACH,OAAO,CAAC,cAAc;yCAhFX,eAAe;2CAAf,eAAe;CAsI3B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { ChangeDetectionStrategy, Component, Input, ViewChild, } from '@angular/core';
|
|
6
|
+
import { ChangeDetectionStrategy, Component, Input, signal, ViewChild, } from '@angular/core';
|
|
7
7
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
const _c0 = ["trigger"];
|
|
@@ -23,7 +23,7 @@ function MoleculeTooltip_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
|
23
23
|
i0.ɵɵdomElementEnd();
|
|
24
24
|
} if (rf & 2) {
|
|
25
25
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
26
|
-
i0.ɵɵstyleMap(ctx_r0.positionStyle);
|
|
26
|
+
i0.ɵɵstyleMap(ctx_r0.positionStyle());
|
|
27
27
|
i0.ɵɵadvance();
|
|
28
28
|
i0.ɵɵstyleMap(ctx_r0.style);
|
|
29
29
|
i0.ɵɵclassMap(ctx_r0.tooltipClasses);
|
|
@@ -119,8 +119,12 @@ export class MoleculeTooltip {
|
|
|
119
119
|
testId;
|
|
120
120
|
triggerRef;
|
|
121
121
|
tooltipRef;
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
/** Whether the tooltip shows; a signal, so the delay timer's change renders (OnPush). */
|
|
123
|
+
isVisible = signal(false, /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
125
|
+
/** The measured placement; a signal, so the animation frame's measurement renders (OnPush). */
|
|
126
|
+
positionStyle = signal({}, /* @ts-ignore */
|
|
127
|
+
...(ngDevMode ? [{ debugName: "positionStyle" }] : /* istanbul ignore next */ []));
|
|
124
128
|
timeoutId;
|
|
125
129
|
/**
|
|
126
130
|
* Retrieves the current UI class map.
|
|
@@ -149,12 +153,13 @@ export class MoleculeTooltip {
|
|
|
149
153
|
show() {
|
|
150
154
|
if (this.delay > 0) {
|
|
151
155
|
this.timeoutId = setTimeout(() => {
|
|
152
|
-
this.isVisible
|
|
153
|
-
|
|
156
|
+
this.isVisible.set(true);
|
|
157
|
+
// Measured once the tooltip has rendered.
|
|
158
|
+
requestAnimationFrame(() => this.updatePosition());
|
|
154
159
|
}, this.delay);
|
|
155
160
|
}
|
|
156
161
|
else {
|
|
157
|
-
this.isVisible
|
|
162
|
+
this.isVisible.set(true);
|
|
158
163
|
requestAnimationFrame(() => this.updatePosition());
|
|
159
164
|
}
|
|
160
165
|
}
|
|
@@ -165,7 +170,7 @@ export class MoleculeTooltip {
|
|
|
165
170
|
if (this.timeoutId) {
|
|
166
171
|
clearTimeout(this.timeoutId);
|
|
167
172
|
}
|
|
168
|
-
this.isVisible
|
|
173
|
+
this.isVisible.set(false);
|
|
169
174
|
}
|
|
170
175
|
/**
|
|
171
176
|
* Clears pending timeouts on component destruction.
|
|
@@ -222,12 +227,12 @@ export class MoleculeTooltip {
|
|
|
222
227
|
},
|
|
223
228
|
};
|
|
224
229
|
const pos = positions[this.placement];
|
|
225
|
-
this.positionStyle
|
|
230
|
+
this.positionStyle.set({
|
|
226
231
|
position: 'absolute',
|
|
227
232
|
top: `${pos.top}px`,
|
|
228
233
|
left: `${pos.left}px`,
|
|
229
234
|
zIndex: '9999',
|
|
230
|
-
};
|
|
235
|
+
});
|
|
231
236
|
}
|
|
232
237
|
static ɵfac = function MoleculeTooltip_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MoleculeTooltip)(); };
|
|
233
238
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MoleculeTooltip, selectors: [["mol-tooltip"]], viewQuery: function MoleculeTooltip_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -246,7 +251,7 @@ export class MoleculeTooltip {
|
|
|
246
251
|
} if (rf & 2) {
|
|
247
252
|
i0.ɵɵclassMap(ctx.cm.tooltipTrigger);
|
|
248
253
|
i0.ɵɵadvance(3);
|
|
249
|
-
i0.ɵɵconditional(ctx.isVisible ? 3 : -1);
|
|
254
|
+
i0.ɵɵconditional(ctx.isVisible() ? 3 : -1);
|
|
250
255
|
} }, encapsulation: 2 });
|
|
251
256
|
}
|
|
252
257
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeTooltip, [{
|
|
@@ -266,7 +271,7 @@ export class MoleculeTooltip {
|
|
|
266
271
|
>
|
|
267
272
|
<ng-content></ng-content>
|
|
268
273
|
</div>
|
|
269
|
-
@if (isVisible) {
|
|
274
|
+
@if (isVisible()) {
|
|
270
275
|
<!--
|
|
271
276
|
Outer positioned wrapper carries the top/left/z-index placement; the
|
|
272
277
|
arrow renders as its SIBLING (not nested inside the visible box),
|
|
@@ -274,7 +279,7 @@ export class MoleculeTooltip {
|
|
|
274
279
|
past the box's own edge would be clipped invisible if it were a
|
|
275
280
|
descendant of that element instead.
|
|
276
281
|
-->
|
|
277
|
-
<div [style]="positionStyle">
|
|
282
|
+
<div [style]="positionStyle()">
|
|
278
283
|
<div
|
|
279
284
|
#tooltipEl
|
|
280
285
|
role="tooltip"
|
|
@@ -312,5 +317,5 @@ export class MoleculeTooltip {
|
|
|
312
317
|
type: ViewChild,
|
|
313
318
|
args: ['tooltipEl']
|
|
314
319
|
}] }); })();
|
|
315
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeTooltip, { className: "MoleculeTooltip", filePath: "components/molecule/tooltip.component.ts", lineNumber:
|
|
320
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeTooltip, { className: "MoleculeTooltip", filePath: "components/molecule/tooltip.component.ts", lineNumber: 138 }); })();
|
|
316
321
|
//# sourceMappingURL=tooltip.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.component.js","sourceRoot":"","sources":["../../../src/components/molecule/tooltip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EAET,KAAK,EAEL,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;;;IA8GpC,6BAAqD;;;IAA5B,gCAAoB;;;IAV/C,AADF,
|
|
1
|
+
{"version":3,"file":"tooltip.component.js","sourceRoot":"","sources":["../../../src/components/molecule/tooltip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EAET,KAAK,EAEL,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;;;IA8GpC,6BAAqD;;;IAA5B,gCAAoB;;;IAV/C,AADF,8BAA+B,gBAO5B;IACC,YACF;IAAA,oBAAM;IACN,gGAAgB;IAGlB,oBAAM;;;IAbD,qCAAyB;IAK1B,cAAe;IAAf,2BAAe;IADf,oCAAwB;;IAIxB,eACF;IADE,+CACF;IACA,cAEC;IAFD,0CAEC;;AA7GT,mFAAmF;AACnF,MAAM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DoCheck, ElementRef, type OnDestroy, type TemplateRef } from '@angular/core';
|
|
8
8
|
import type { ButtonVariant, ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
|
|
9
9
|
import { type HasElement } from '../utilities/element.js';
|
|
10
10
|
import { asTemplate, nodeText } from '../utilities/node-value.js';
|
|
11
11
|
import type { OptimisticValueState } from '../utilities/optimistic-value.js';
|
|
12
12
|
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@molecule/app-angular";
|
|
13
14
|
/**
|
|
14
15
|
* Props for {@link OptimisticToggleButton} (React's
|
|
15
16
|
* `OptimisticToggleButtonProps`, in Angular's form).
|
|
@@ -62,7 +63,7 @@ export interface OptimisticToggleButtonProps {
|
|
|
62
63
|
* one is shown, moved onto the button with no wrapper, matching React's
|
|
63
64
|
* `{toggle.value ? activeLabel : inactiveLabel}`.
|
|
64
65
|
*/
|
|
65
|
-
export declare class OptimisticToggleButton implements
|
|
66
|
+
export declare class OptimisticToggleButton implements DoCheck, OnDestroy, HasElement<HTMLButtonElement> {
|
|
66
67
|
/** The loaded server value. */
|
|
67
68
|
value: OptimisticToggleButtonProps['value'];
|
|
68
69
|
/** Saves the desired boolean and returns the server-confirmed boolean. */
|
|
@@ -116,15 +117,12 @@ export declare class OptimisticToggleButton implements AfterViewInit, DoCheck, O
|
|
|
116
117
|
private readonly host;
|
|
117
118
|
/** The element a caller's ref receives: the host `<button>`. */
|
|
118
119
|
readonly element: import("@angular/core").Signal<HTMLButtonElement | null>;
|
|
119
|
-
private readonly renderer;
|
|
120
|
-
private readonly sync;
|
|
121
120
|
private unsubscribe?;
|
|
122
121
|
private lastReceived;
|
|
123
122
|
private hasLeft;
|
|
124
123
|
private hasRight;
|
|
125
|
-
|
|
124
|
+
/** The slot whose content is currently shown on the button. */
|
|
126
125
|
private visibleFrom;
|
|
127
|
-
private anchor;
|
|
128
126
|
/** Creates the optimistic controller and mirrors its state into the signal. */
|
|
129
127
|
constructor();
|
|
130
128
|
/**
|
|
@@ -151,36 +149,26 @@ export declare class OptimisticToggleButton implements AfterViewInit, DoCheck, O
|
|
|
151
149
|
/** Flips the displayed value and saves the newest desired value. */
|
|
152
150
|
handleClick(): void;
|
|
153
151
|
/**
|
|
154
|
-
* Reads slot presence
|
|
155
|
-
*
|
|
152
|
+
* Reads slot presence and takes the label capture spans out of the DOM,
|
|
153
|
+
* then shows the visible label.
|
|
154
|
+
*
|
|
155
|
+
* @param hasContent - Reads whether a slot has content.
|
|
156
156
|
*/
|
|
157
|
-
|
|
157
|
+
private reconcile;
|
|
158
158
|
/**
|
|
159
159
|
* Takes a newer server value the way React's effect does (only when it
|
|
160
|
-
* differs from the last one received)
|
|
160
|
+
* differs from the last one received).
|
|
161
161
|
*/
|
|
162
162
|
ngDoCheck(): void;
|
|
163
163
|
/** Stops mirroring controller state into the signal (unmount). */
|
|
164
164
|
ngOnDestroy(): void;
|
|
165
165
|
/**
|
|
166
166
|
* Shows exactly the displayed value's projected children on the button —
|
|
167
|
-
* React renders exactly one label and no wrapper element
|
|
167
|
+
* React renders exactly one label and no wrapper element, with the right
|
|
168
|
+
* icon (or nothing) after it.
|
|
168
169
|
*/
|
|
169
170
|
private syncLabels;
|
|
170
|
-
/**
|
|
171
|
-
* Shows one slot's projected children on the button, parking whatever
|
|
172
|
-
* another slot was showing back inside its capture span.
|
|
173
|
-
*
|
|
174
|
-
* @param span - The capture span to show (null parks everything).
|
|
175
|
-
*/
|
|
176
|
-
private showSlot;
|
|
177
|
-
/**
|
|
178
|
-
* The insertion point for the visible projected label (a comment the DOM
|
|
179
|
-
* normalizer strips), kept after the left icon wrapper.
|
|
180
|
-
* @returns The anchor comment.
|
|
181
|
-
*/
|
|
182
|
-
private labelAnchor;
|
|
183
171
|
static ɵfac: i0.ɵɵFactoryDeclaration<OptimisticToggleButton, never>;
|
|
184
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<OptimisticToggleButton, "button[mol-optimistic-toggle-button]", never, { "value": { "alias": "value"; "required": false; }; "commit": { "alias": "commit"; "required": false; }; "activeLabel": { "alias": "activeLabel"; "required": false; }; "inactiveLabel": { "alias": "inactiveLabel"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "leftIcon": { "alias": "leftIcon"; "required": false; }; "rightIcon": { "alias": "rightIcon"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; }, {}, never, ["[slot=leftIcon]", "[slot=activeLabel]", "[slot=inactiveLabel]", "[slot=rightIcon]"], true,
|
|
172
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<OptimisticToggleButton, "button[mol-optimistic-toggle-button]", never, { "value": { "alias": "value"; "required": false; }; "commit": { "alias": "commit"; "required": false; }; "activeLabel": { "alias": "activeLabel"; "required": false; }; "inactiveLabel": { "alias": "inactiveLabel"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "leftIcon": { "alias": "leftIcon"; "required": false; }; "rightIcon": { "alias": "rightIcon"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; }, {}, never, ["[slot=leftIcon]", "[slot=activeLabel]", "[slot=inactiveLabel]", "[slot=rightIcon]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
185
173
|
}
|
|
186
174
|
//# sourceMappingURL=optimistic-toggle-button.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimistic-toggle-button.component.d.ts","sourceRoot":"","sources":["../../src/components/optimistic-toggle-button.component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"optimistic-toggle-button.component.d.ts","sourceRoot":"","sources":["../../src/components/optimistic-toggle-button.component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,OAAO,EACZ,UAAU,EAEV,KAAK,SAAS,EAEd,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAA;AAStB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGrF,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAmB,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;;;AAK7F;;;;;;;;GAQG;AACH,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAA;IACd,0EAA0E;IAC1E,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC9C,8CAA8C;IAC9C,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACnD,+CAA+C;IAC/C,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACrD,oFAAoF;IACpF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,sBAAsB;IACtB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,oBAAoB;IACpB,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,mBAAmB;IAC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