@molecule/app-ui-angular 1.0.5 → 1.1.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 +11742 -1145
- package/dist/components/accordion.component.d.ts +114 -0
- package/dist/components/accordion.component.d.ts.map +1 -0
- package/dist/components/accordion.component.js +286 -0
- package/dist/components/accordion.component.js.map +1 -0
- package/dist/components/alert.component.d.ts +81 -37
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.component.js +232 -146
- package/dist/components/alert.component.js.map +1 -1
- package/dist/components/auth-guard.component.d.ts +94 -0
- package/dist/components/auth-guard.component.d.ts.map +1 -0
- package/dist/components/auth-guard.component.js +212 -0
- package/dist/components/auth-guard.component.js.map +1 -0
- package/dist/components/avatar.component.d.ts +97 -0
- package/dist/components/avatar.component.d.ts.map +1 -0
- package/dist/components/avatar.component.js +216 -0
- package/dist/components/avatar.component.js.map +1 -0
- package/dist/components/badge.component.d.ts +27 -12
- package/dist/components/badge.component.d.ts.map +1 -1
- package/dist/components/badge.component.js +47 -47
- package/dist/components/badge.component.js.map +1 -1
- package/dist/components/button.component.d.ts +96 -14
- package/dist/components/button.component.d.ts.map +1 -1
- package/dist/components/button.component.js +232 -87
- package/dist/components/button.component.js.map +1 -1
- package/dist/components/card.component.d.ts +135 -0
- package/dist/components/card.component.d.ts.map +1 -0
- package/dist/components/card.component.js +291 -0
- package/dist/components/card.component.js.map +1 -0
- package/dist/components/checkbox.component.d.ts +102 -29
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.component.js +222 -113
- package/dist/components/checkbox.component.js.map +1 -1
- package/dist/components/confirm-button.component.d.ts +130 -0
- package/dist/components/confirm-button.component.d.ts.map +1 -0
- package/dist/components/confirm-button.component.js +322 -0
- package/dist/components/confirm-button.component.js.map +1 -0
- package/dist/components/confirm-dialog.component.d.ts +60 -0
- package/dist/components/confirm-dialog.component.d.ts.map +1 -0
- package/dist/components/confirm-dialog.component.js +152 -0
- package/dist/components/confirm-dialog.component.js.map +1 -0
- package/dist/components/dropdown.component.d.ts +313 -0
- package/dist/components/dropdown.component.d.ts.map +1 -0
- package/dist/components/dropdown.component.js +919 -0
- package/dist/components/dropdown.component.js.map +1 -0
- package/dist/components/empty-state.component.d.ts +73 -0
- package/dist/components/empty-state.component.d.ts.map +1 -0
- package/dist/components/empty-state.component.js +180 -0
- package/dist/components/empty-state.component.js.map +1 -0
- package/dist/components/floating-input.component.d.ts +86 -0
- package/dist/components/floating-input.component.d.ts.map +1 -0
- package/dist/components/floating-input.component.js +167 -0
- package/dist/components/floating-input.component.js.map +1 -0
- package/dist/components/form-field.component.d.ts +111 -0
- package/dist/components/form-field.component.d.ts.map +1 -0
- package/dist/components/form-field.component.js +300 -0
- package/dist/components/form-field.component.js.map +1 -0
- package/dist/components/form.component.d.ts +77 -0
- package/dist/components/form.component.d.ts.map +1 -0
- package/dist/components/form.component.js +222 -0
- package/dist/components/form.component.js.map +1 -0
- package/dist/components/icon.component.d.ts +85 -0
- package/dist/components/icon.component.d.ts.map +1 -0
- package/dist/components/icon.component.js +187 -0
- package/dist/components/icon.component.js.map +1 -0
- package/dist/components/index.d.ts +49 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +49 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/input.component.d.ts +157 -54
- package/dist/components/input.component.d.ts.map +1 -1
- package/dist/components/input.component.js +437 -222
- package/dist/components/input.component.js.map +1 -1
- package/dist/components/label.component.d.ts +29 -0
- package/dist/components/label.component.d.ts.map +1 -0
- package/dist/components/label.component.js +60 -0
- package/dist/components/label.component.js.map +1 -0
- package/dist/components/language-picker.component.d.ts +124 -0
- package/dist/components/language-picker.component.d.ts.map +1 -0
- package/dist/components/language-picker.component.js +305 -0
- package/dist/components/language-picker.component.js.map +1 -0
- package/dist/components/layout.component.d.ts +167 -0
- package/dist/components/layout.component.d.ts.map +1 -0
- package/dist/components/layout.component.js +364 -0
- package/dist/components/layout.component.js.map +1 -0
- package/dist/components/load-error-banner.component.d.ts +103 -0
- package/dist/components/load-error-banner.component.d.ts.map +1 -0
- package/dist/components/load-error-banner.component.js +263 -0
- package/dist/components/load-error-banner.component.js.map +1 -0
- package/dist/components/modal.component.d.ts +125 -95
- package/dist/components/modal.component.d.ts.map +1 -1
- package/dist/components/modal.component.js +458 -271
- package/dist/components/modal.component.js.map +1 -1
- package/dist/components/molecule/alert.component.d.ts +77 -0
- package/dist/components/molecule/alert.component.d.ts.map +1 -0
- package/dist/components/molecule/alert.component.js +229 -0
- package/dist/components/molecule/alert.component.js.map +1 -0
- package/dist/components/molecule/badge.component.d.ts +27 -0
- package/dist/components/molecule/badge.component.d.ts.map +1 -0
- package/dist/components/molecule/badge.component.js +79 -0
- package/dist/components/molecule/badge.component.js.map +1 -0
- package/dist/components/molecule/button.component.d.ts +38 -0
- package/dist/components/molecule/button.component.d.ts.map +1 -0
- package/dist/components/molecule/button.component.js +137 -0
- package/dist/components/molecule/button.component.js.map +1 -0
- package/dist/components/molecule/checkbox.component.d.ts +53 -0
- package/dist/components/molecule/checkbox.component.d.ts.map +1 -0
- package/dist/components/molecule/checkbox.component.js +166 -0
- package/dist/components/molecule/checkbox.component.js.map +1 -0
- package/dist/components/molecule/index.d.ts +18 -0
- package/dist/components/molecule/index.d.ts.map +1 -0
- package/dist/components/molecule/index.js +18 -0
- package/dist/components/molecule/index.js.map +1 -0
- package/dist/components/molecule/input.component.d.ts +93 -0
- package/dist/components/molecule/input.component.d.ts.map +1 -0
- package/dist/components/molecule/input.component.js +314 -0
- package/dist/components/molecule/input.component.js.map +1 -0
- package/dist/components/molecule/modal.component.d.ts +148 -0
- package/dist/components/molecule/modal.component.d.ts.map +1 -0
- package/dist/components/molecule/modal.component.js +382 -0
- package/dist/components/molecule/modal.component.js.map +1 -0
- package/dist/components/molecule/radio-group.component.d.ts +63 -0
- package/dist/components/molecule/radio-group.component.d.ts.map +1 -0
- package/dist/components/molecule/radio-group.component.js +208 -0
- package/dist/components/molecule/radio-group.component.js.map +1 -0
- package/dist/components/molecule/select.component.d.ts +72 -0
- package/dist/components/molecule/select.component.d.ts.map +1 -0
- package/dist/components/molecule/select.component.js +274 -0
- package/dist/components/molecule/select.component.js.map +1 -0
- package/dist/components/molecule/spinner.component.d.ts +42 -0
- package/dist/components/molecule/spinner.component.d.ts.map +1 -0
- package/dist/components/molecule/spinner.component.js +122 -0
- package/dist/components/molecule/spinner.component.js.map +1 -0
- package/dist/components/molecule/switch.component.d.ts +54 -0
- package/dist/components/molecule/switch.component.d.ts.map +1 -0
- package/dist/components/molecule/switch.component.js +148 -0
- package/dist/components/molecule/switch.component.js.map +1 -0
- package/dist/components/molecule/toast.component.d.ts +98 -0
- package/dist/components/molecule/toast.component.d.ts.map +1 -0
- package/dist/components/molecule/toast.component.js +305 -0
- package/dist/components/molecule/toast.component.js.map +1 -0
- package/dist/components/molecule/tooltip.component.d.ts +77 -0
- package/dist/components/molecule/tooltip.component.d.ts.map +1 -0
- package/dist/components/molecule/tooltip.component.js +316 -0
- package/dist/components/molecule/tooltip.component.js.map +1 -0
- package/dist/components/optimistic-toggle-button.component.d.ts +125 -0
- package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -0
- package/dist/components/optimistic-toggle-button.component.js +296 -0
- package/dist/components/optimistic-toggle-button.component.js.map +1 -0
- package/dist/components/page-header.component.d.ts +77 -0
- package/dist/components/page-header.component.d.ts.map +1 -0
- package/dist/components/page-header.component.js +225 -0
- package/dist/components/page-header.component.js.map +1 -0
- package/dist/components/page-shell.component.d.ts +101 -0
- package/dist/components/page-shell.component.d.ts.map +1 -0
- package/dist/components/page-shell.component.js +221 -0
- package/dist/components/page-shell.component.js.map +1 -0
- package/dist/components/pagination.component.d.ts +137 -0
- package/dist/components/pagination.component.d.ts.map +1 -0
- package/dist/components/pagination.component.js +419 -0
- package/dist/components/pagination.component.js.map +1 -0
- package/dist/components/panel-close.component.d.ts +43 -0
- package/dist/components/panel-close.component.d.ts.map +1 -0
- package/dist/components/panel-close.component.js +75 -0
- package/dist/components/panel-close.component.js.map +1 -0
- package/dist/components/progress.component.d.ts +84 -0
- package/dist/components/progress.component.d.ts.map +1 -0
- package/dist/components/progress.component.js +219 -0
- package/dist/components/progress.component.js.map +1 -0
- package/dist/components/prompt-dialog.component.d.ts +121 -0
- package/dist/components/prompt-dialog.component.d.ts.map +1 -0
- package/dist/components/prompt-dialog.component.js +332 -0
- package/dist/components/prompt-dialog.component.js.map +1 -0
- package/dist/components/radio-group.component.d.ts +66 -34
- package/dist/components/radio-group.component.d.ts.map +1 -1
- package/dist/components/radio-group.component.js +146 -125
- package/dist/components/radio-group.component.js.map +1 -1
- package/dist/components/responsive-app-shell.component.d.ts +408 -0
- package/dist/components/responsive-app-shell.component.d.ts.map +1 -0
- package/dist/components/responsive-app-shell.component.js +1144 -0
- package/dist/components/responsive-app-shell.component.js.map +1 -0
- package/dist/components/select.component.d.ts +135 -38
- package/dist/components/select.component.d.ts.map +1 -1
- package/dist/components/select.component.js +373 -181
- package/dist/components/select.component.js.map +1 -1
- package/dist/components/separator.component.d.ts +39 -0
- package/dist/components/separator.component.d.ts.map +1 -0
- package/dist/components/separator.component.js +73 -0
- package/dist/components/separator.component.js.map +1 -0
- package/dist/components/sidebar-user-card.component.d.ts +106 -0
- package/dist/components/sidebar-user-card.component.d.ts.map +1 -0
- package/dist/components/sidebar-user-card.component.js +277 -0
- package/dist/components/sidebar-user-card.component.js.map +1 -0
- package/dist/components/skeleton.component.d.ts +100 -0
- package/dist/components/skeleton.component.d.ts.map +1 -0
- package/dist/components/skeleton.component.js +214 -0
- package/dist/components/skeleton.component.js.map +1 -0
- package/dist/components/spinner.component.d.ts +36 -19
- package/dist/components/spinner.component.d.ts.map +1 -1
- package/dist/components/spinner.component.js +69 -71
- package/dist/components/spinner.component.js.map +1 -1
- package/dist/components/switch.component.d.ts +72 -29
- package/dist/components/switch.component.d.ts.map +1 -1
- package/dist/components/switch.component.js +163 -91
- package/dist/components/switch.component.js.map +1 -1
- package/dist/components/table.component.d.ts +193 -0
- package/dist/components/table.component.d.ts.map +1 -0
- package/dist/components/table.component.js +550 -0
- package/dist/components/table.component.js.map +1 -0
- package/dist/components/tabs.component.d.ts +140 -0
- package/dist/components/tabs.component.d.ts.map +1 -0
- package/dist/components/tabs.component.js +390 -0
- package/dist/components/tabs.component.js.map +1 -0
- package/dist/components/template-outlet.directive.d.ts +50 -0
- package/dist/components/template-outlet.directive.d.ts.map +1 -0
- package/dist/components/template-outlet.directive.js +81 -0
- package/dist/components/template-outlet.directive.js.map +1 -0
- package/dist/components/textarea.component.d.ts +151 -0
- package/dist/components/textarea.component.d.ts.map +1 -0
- package/dist/components/textarea.component.js +340 -0
- package/dist/components/textarea.component.js.map +1 -0
- package/dist/components/theme-toggle.component.d.ts +58 -0
- package/dist/components/theme-toggle.component.d.ts.map +1 -0
- package/dist/components/theme-toggle.component.js +124 -0
- package/dist/components/theme-toggle.component.js.map +1 -0
- package/dist/components/toast.component.d.ts +237 -49
- package/dist/components/toast.component.d.ts.map +1 -1
- package/dist/components/toast.component.js +636 -201
- package/dist/components/toast.component.js.map +1 -1
- package/dist/components/tooltip.component.d.ts +95 -45
- package/dist/components/tooltip.component.d.ts.map +1 -1
- package/dist/components/tooltip.component.js +372 -221
- package/dist/components/tooltip.component.js.map +1 -1
- package/dist/components/user-menu-popover.component.d.ts +283 -0
- package/dist/components/user-menu-popover.component.d.ts.map +1 -0
- package/dist/components/user-menu-popover.component.js +646 -0
- package/dist/components/user-menu-popover.component.js.map +1 -0
- package/dist/components/user-menu.component.d.ts +95 -0
- package/dist/components/user-menu.component.d.ts.map +1 -0
- package/dist/components/user-menu.component.js +218 -0
- package/dist/components/user-menu.component.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-is-desktop.d.ts +22 -0
- package/dist/hooks/use-is-desktop.d.ts.map +1 -0
- package/dist/hooks/use-is-desktop.js +37 -0
- package/dist/hooks/use-is-desktop.js.map +1 -0
- package/dist/index.d.ts +32 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities/dom-context.d.ts +42 -0
- package/dist/utilities/dom-context.d.ts.map +1 -0
- package/dist/utilities/dom-context.js +66 -0
- package/dist/utilities/dom-context.js.map +1 -0
- package/dist/utilities/focus.d.ts +32 -0
- package/dist/utilities/focus.d.ts.map +1 -0
- package/dist/utilities/focus.js +47 -0
- package/dist/utilities/focus.js.map +1 -0
- package/dist/utilities/form-field-context.d.ts +34 -0
- package/dist/utilities/form-field-context.d.ts.map +1 -0
- package/dist/utilities/form-field-context.js +28 -0
- package/dist/utilities/form-field-context.js.map +1 -0
- package/dist/utilities/form-submit-error.d.ts +17 -0
- package/dist/utilities/form-submit-error.d.ts.map +1 -0
- package/dist/utilities/form-submit-error.js +42 -0
- package/dist/utilities/form-submit-error.js.map +1 -0
- package/dist/utilities/icon-markup.d.ts +17 -0
- package/dist/utilities/icon-markup.d.ts.map +1 -0
- package/dist/utilities/icon-markup.js +46 -0
- package/dist/utilities/icon-markup.js.map +1 -0
- package/dist/utilities/ids.d.ts +15 -0
- package/dist/utilities/ids.d.ts.map +1 -0
- package/dist/utilities/ids.js +19 -0
- package/dist/utilities/ids.js.map +1 -0
- package/dist/utilities/index.d.ts +11 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +11 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/initials.d.ts +13 -0
- package/dist/utilities/initials.d.ts.map +1 -0
- package/dist/utilities/initials.js +23 -0
- package/dist/utilities/initials.js.map +1 -0
- package/dist/utilities/node-value.d.ts +31 -0
- package/dist/utilities/node-value.d.ts.map +1 -0
- package/dist/utilities/node-value.js +37 -0
- package/dist/utilities/node-value.js.map +1 -0
- package/dist/utilities/optimistic-value.d.ts +81 -0
- package/dist/utilities/optimistic-value.d.ts.map +1 -0
- package/dist/utilities/optimistic-value.js +154 -0
- package/dist/utilities/optimistic-value.js.map +1 -0
- package/dist/utilities/render-icon.d.ts +77 -7
- package/dist/utilities/render-icon.d.ts.map +1 -1
- package/dist/utilities/render-icon.js +123 -33
- package/dist/utilities/render-icon.js.map +1 -1
- package/dist/utilities/rest-attrs.d.ts +21 -0
- package/dist/utilities/rest-attrs.d.ts.map +1 -0
- package/dist/utilities/rest-attrs.js +37 -0
- package/dist/utilities/rest-attrs.js.map +1 -0
- package/dist/utilities/style.d.ts +23 -0
- package/dist/utilities/style.d.ts.map +1 -0
- package/dist/utilities/style.js +86 -0
- package/dist/utilities/style.js.map +1 -0
- package/package.json +10 -5
|
@@ -1,165 +1,274 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Checkbox component (React parity).
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Component, ElementRef, EventEmitter, inject, Output, Renderer2, ViewChild, } from '@angular/core';
|
|
7
7
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import { fieldContext } from '../utilities/form-field-context.js';
|
|
9
|
+
import { moveRestAttributes } from '../utilities/rest-attrs.js';
|
|
10
|
+
import { styleText } from '../utilities/style.js';
|
|
11
|
+
import { hasNodes, SlotWrapper } from './button.component.js';
|
|
8
12
|
import * as i0 from "@angular/core";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const ctx_r0 = i0.ɵɵnextContext();
|
|
15
|
-
i0.ɵɵclassMap(ctx_r0.labelClasses);
|
|
16
|
-
i0.ɵɵadvance();
|
|
17
|
-
i0.ɵɵtextInterpolate(ctx_r0.label);
|
|
18
|
-
} }
|
|
19
|
-
function MoleculeCheckbox_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
+
const _c0 = ["input"];
|
|
14
|
+
const _c1 = ["labelSlot"];
|
|
15
|
+
const _c2 = [[["", "slot", "label"]]];
|
|
16
|
+
const _c3 = ["[slot=label]"];
|
|
17
|
+
function Checkbox_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
20
18
|
i0.ɵɵdomElementStart(0, "p");
|
|
21
19
|
i0.ɵɵtext(1);
|
|
22
20
|
i0.ɵɵdomElementEnd();
|
|
23
21
|
} if (rf & 2) {
|
|
24
22
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
25
|
-
i0.ɵɵclassMap(ctx_r0.
|
|
23
|
+
i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().formError, ctx_r0.cm().sp("mt", 1)));
|
|
24
|
+
i0.ɵɵattribute("id", ctx_r0.errorId());
|
|
26
25
|
i0.ɵɵadvance();
|
|
27
26
|
i0.ɵɵtextInterpolate(ctx_r0.error);
|
|
28
27
|
} }
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
29
|
+
* Checkbox component.
|
|
30
|
+
*
|
|
31
|
+
* The host is the `div.formFieldWrapper` React renders. The error message is
|
|
32
|
+
* programmatically associated with the input through `aria-describedby`;
|
|
33
|
+
* the input is React's `...rest` spread target, so rest attributes move
|
|
34
|
+
* there at view init.
|
|
34
35
|
*/
|
|
35
|
-
export class
|
|
36
|
+
export class Checkbox {
|
|
37
|
+
/** Checkbox label (text, or projected `[slot=label]` nodes). */
|
|
36
38
|
label;
|
|
37
|
-
checked
|
|
38
|
-
|
|
39
|
+
/** Whether the checkbox is checked. */
|
|
40
|
+
checked;
|
|
41
|
+
/** Whether the checkbox renders the indeterminate state. */
|
|
42
|
+
indeterminate;
|
|
43
|
+
/** Checkbox size (kept for prop parity). */
|
|
39
44
|
size;
|
|
45
|
+
/** Error message (renders and associates via aria-describedby). */
|
|
40
46
|
error;
|
|
47
|
+
/** Extra classes joined onto the checkbox classes. */
|
|
41
48
|
className;
|
|
49
|
+
/** Inline style object (React camelCase). */
|
|
42
50
|
style;
|
|
51
|
+
/** `data-testid` for the input. */
|
|
43
52
|
testId;
|
|
44
|
-
|
|
53
|
+
/** Disables the checkbox. */
|
|
54
|
+
disabled;
|
|
55
|
+
/** Form field name. */
|
|
45
56
|
name;
|
|
57
|
+
/** Explicit id (defaults to the name). */
|
|
46
58
|
id;
|
|
47
|
-
|
|
59
|
+
/** Uncontrolled initial checked state (renders as the checked attribute). */
|
|
60
|
+
defaultChecked;
|
|
48
61
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @returns
|
|
62
|
+
* The controlled-or-default checked state (React: `checked ?? defaultChecked`).
|
|
63
|
+
* @returns True when the checked attribute renders.
|
|
51
64
|
*/
|
|
52
|
-
|
|
65
|
+
isChecked() {
|
|
66
|
+
return (this.checked ?? this.defaultChecked) === true;
|
|
67
|
+
}
|
|
68
|
+
/** The genuine native `change` event. */
|
|
69
|
+
change = new EventEmitter();
|
|
70
|
+
/** The native input (React's `...rest` spread target). */
|
|
71
|
+
input;
|
|
72
|
+
/** The label text wrapper. */
|
|
73
|
+
labelSlot;
|
|
74
|
+
host = inject(ElementRef);
|
|
75
|
+
/** The `aria-describedby` the caller spread onto the host (React's rest). */
|
|
76
|
+
restDescribedBy = null;
|
|
77
|
+
/** Whether the rest-describedby value was captured. */
|
|
78
|
+
restDescribedByCaptured = false;
|
|
79
|
+
sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
|
|
80
|
+
hasLabel = false;
|
|
81
|
+
syncIndeterminate = false;
|
|
82
|
+
/**
|
|
83
|
+
* The current class map.
|
|
84
|
+
* @returns The UIClassMap.
|
|
85
|
+
*/
|
|
86
|
+
cm() {
|
|
53
87
|
return getClassMap();
|
|
54
88
|
}
|
|
55
89
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @returns The
|
|
90
|
+
* The id of the label-side element (`id` or `name`).
|
|
91
|
+
* @returns The id value or undefined.
|
|
58
92
|
*/
|
|
59
|
-
|
|
60
|
-
return this.id || this.
|
|
93
|
+
checkboxId() {
|
|
94
|
+
return this.id || this.fieldContext()?.id || this.name;
|
|
61
95
|
}
|
|
62
96
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
97
|
+
* The error message id (a stable generated id, renumbered consistently by
|
|
98
|
+
* the DOM normalizer like React's `useId`).
|
|
99
|
+
* @returns The error element id.
|
|
65
100
|
*/
|
|
66
|
-
|
|
67
|
-
return this.
|
|
101
|
+
errorId() {
|
|
102
|
+
return `${this.checkboxId() ?? 'r0'}-error`;
|
|
68
103
|
}
|
|
69
104
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @returns The
|
|
105
|
+
* The nearest enclosing `FormField` context (React's cloned props).
|
|
106
|
+
* @returns The context, or null.
|
|
72
107
|
*/
|
|
73
|
-
|
|
74
|
-
return
|
|
108
|
+
fieldContext() {
|
|
109
|
+
return fieldContext(this.host.nativeElement);
|
|
75
110
|
}
|
|
76
111
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
112
|
+
* The final `aria-describedby`: the enclosing FormField's error/hint
|
|
113
|
+
* target, then this checkbox's own error (React's cloneElement join).
|
|
114
|
+
* @returns The attribute value, or null.
|
|
79
115
|
*/
|
|
80
|
-
|
|
81
|
-
return
|
|
116
|
+
mergedDescribedBy() {
|
|
117
|
+
return (this.fieldContext()?.describedBy ??
|
|
118
|
+
this.restDescribedBy ??
|
|
119
|
+
(this.error ? this.errorId() : null));
|
|
82
120
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Computes the checkbox class list.
|
|
123
|
+
* @returns The class string.
|
|
124
|
+
*/
|
|
125
|
+
classes() {
|
|
126
|
+
return this.cm().cn(this.cm().checkbox({ error: !!this.error }), this.className);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Serializes the inline style for the input.
|
|
130
|
+
* @returns The style attribute text.
|
|
131
|
+
*/
|
|
132
|
+
hostStyle() {
|
|
133
|
+
return styleText(this.style);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* React's checkbox `onChange` fires on the checkbox's CLICK event (React's
|
|
137
|
+
* change-event plugin maps checkbox/radio changes to the click), so the
|
|
138
|
+
* click event object is what callers receive.
|
|
139
|
+
*
|
|
140
|
+
* @param event - The native click event.
|
|
141
|
+
*/
|
|
142
|
+
handleClick(event) {
|
|
143
|
+
this.justClicked = true;
|
|
144
|
+
this.change.emit(event);
|
|
145
|
+
queueMicrotask(() => (this.justClicked = false));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* A native change that did not come from this tick's click (a synthetic
|
|
149
|
+
* `dispatchEvent`) is forwarded like React would; the event never reaches
|
|
150
|
+
* the host, where the `change` output binding would record it twice. A
|
|
151
|
+
* CONTROLLED checkbox (`checked` prop given) is restored to the prop value
|
|
152
|
+
* afterwards, exactly like React's controlled-input state restore.
|
|
153
|
+
*
|
|
154
|
+
* @param event - The native change event.
|
|
155
|
+
*/
|
|
156
|
+
handleChange(event) {
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
if (!this.justClicked)
|
|
159
|
+
this.change.emit(event);
|
|
160
|
+
if (this.checked !== undefined && this.input)
|
|
161
|
+
this.input.nativeElement.checked = !!this.checked;
|
|
162
|
+
}
|
|
163
|
+
justClicked = false;
|
|
164
|
+
/**
|
|
165
|
+
* Applies the indeterminate DOM flag (a property, not an attribute) and
|
|
166
|
+
* React's `{!!label && <span>}` label condition.
|
|
167
|
+
*/
|
|
168
|
+
ngAfterViewChecked() {
|
|
169
|
+
const input = this.input?.nativeElement;
|
|
170
|
+
if (input) {
|
|
171
|
+
if (!this.restDescribedByCaptured) {
|
|
172
|
+
this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby');
|
|
173
|
+
this.restDescribedByCaptured = true;
|
|
174
|
+
}
|
|
175
|
+
moveRestAttributes(this.host.nativeElement, input);
|
|
176
|
+
if (this.syncIndeterminate !== !!this.indeterminate) {
|
|
177
|
+
input.indeterminate = !!this.indeterminate;
|
|
178
|
+
this.syncIndeterminate = !!this.indeterminate;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
this.hasLabel = !!this.label || hasNodes(this.labelSlot?.nativeElement);
|
|
182
|
+
this.sync.sync(this.labelSlot?.nativeElement, this.hasLabel, this.labelSlot?.nativeElement.parentElement ?? undefined);
|
|
183
|
+
}
|
|
184
|
+
static ɵfac = function Checkbox_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Checkbox)(); };
|
|
185
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Checkbox, selectors: [["div", "mol-checkbox", ""]], viewQuery: function Checkbox_Query(rf, ctx) { if (rf & 1) {
|
|
186
|
+
i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
|
|
187
|
+
} if (rf & 2) {
|
|
188
|
+
let _t;
|
|
189
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.input = _t.first);
|
|
190
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelSlot = _t.first);
|
|
191
|
+
} }, hostVars: 2, hostBindings: function Checkbox_HostBindings(rf, ctx) { if (rf & 2) {
|
|
192
|
+
i0.ɵɵclassMap(ctx.cm().formFieldWrapper);
|
|
193
|
+
} }, inputs: { label: "label", checked: "checked", indeterminate: "indeterminate", size: "size", error: "error", className: "className", style: "style", testId: "testId", disabled: "disabled", name: "name", id: "id", defaultChecked: "defaultChecked" }, outputs: { change: "change" }, ngContentSelectors: _c3, decls: 8, vars: 17, consts: [["input", ""], ["labelSlot", ""], ["type", "checkbox", 3, "click", "change", "disabled"], [3, "class"]], template: function Checkbox_Template(rf, ctx) { if (rf & 1) {
|
|
194
|
+
i0.ɵɵprojectionDef(_c2);
|
|
195
|
+
i0.ɵɵdomElementStart(0, "label")(1, "input", 2, 0);
|
|
196
|
+
i0.ɵɵdomListener("click", function Checkbox_Template_input_click_1_listener($event) { return ctx.handleClick($event); })("change", function Checkbox_Template_input_change_1_listener($event) { return ctx.handleChange($event); });
|
|
91
197
|
i0.ɵɵdomElementEnd();
|
|
198
|
+
i0.ɵɵdomElementStart(3, "span", null, 1);
|
|
199
|
+
i0.ɵɵtext(5);
|
|
200
|
+
i0.ɵɵprojection(6);
|
|
201
|
+
i0.ɵɵdomElementEnd()();
|
|
202
|
+
i0.ɵɵconditionalCreate(7, Checkbox_Conditional_7_Template, 2, 4, "p", 3);
|
|
92
203
|
} if (rf & 2) {
|
|
93
|
-
i0.ɵɵclassMap(ctx.cm.
|
|
204
|
+
i0.ɵɵclassMap(ctx.cm().controlLabel);
|
|
94
205
|
i0.ɵɵadvance();
|
|
95
|
-
i0.ɵɵclassMap(ctx.
|
|
96
|
-
i0.ɵɵ
|
|
97
|
-
i0.ɵɵ
|
|
98
|
-
i0.ɵɵ
|
|
99
|
-
i0.ɵɵ
|
|
100
|
-
i0.ɵɵ
|
|
101
|
-
i0.ɵɵ
|
|
102
|
-
i0.ɵɵ
|
|
103
|
-
i0.ɵɵ
|
|
104
|
-
i0.ɵɵconditional(ctx.error ? 4 : -1);
|
|
206
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
207
|
+
i0.ɵɵdomProperty("disabled", ctx.disabled);
|
|
208
|
+
i0.ɵɵattribute("id", ctx.checkboxId())("name", ctx.name)("checked", ctx.isChecked() ? "" : null)("data-state", ctx.checked ? "checked" : "unchecked")("aria-invalid", ctx.error || ctx.fieldContext()?.invalid ? "true" : "false")("aria-describedby", ctx.mergedDescribedBy())("style", ctx.hostStyle(), i0.ɵɵsanitizeStyle)("data-testid", ctx.testId);
|
|
209
|
+
i0.ɵɵadvance(2);
|
|
210
|
+
i0.ɵɵclassMap(ctx.cm().cn(ctx.cm().controlText, ctx.disabled && ctx.cm().controlDisabled));
|
|
211
|
+
i0.ɵɵadvance(2);
|
|
212
|
+
i0.ɵɵtextInterpolate(ctx.label);
|
|
213
|
+
i0.ɵɵadvance(2);
|
|
214
|
+
i0.ɵɵconditional(ctx.error ? 7 : -1);
|
|
105
215
|
} }, encapsulation: 2 });
|
|
106
216
|
}
|
|
107
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
217
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Checkbox, [{
|
|
108
218
|
type: Component,
|
|
109
219
|
args: [{
|
|
110
|
-
selector: 'mol-checkbox',
|
|
220
|
+
selector: 'div[mol-checkbox]',
|
|
111
221
|
standalone: true,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
222
|
+
inputs: [
|
|
223
|
+
'label',
|
|
224
|
+
'checked',
|
|
225
|
+
'indeterminate',
|
|
226
|
+
'size',
|
|
227
|
+
'error',
|
|
228
|
+
'className',
|
|
229
|
+
'style',
|
|
230
|
+
'testId',
|
|
231
|
+
'disabled',
|
|
232
|
+
'name',
|
|
233
|
+
'id',
|
|
234
|
+
'defaultChecked',
|
|
235
|
+
],
|
|
236
|
+
host: {
|
|
237
|
+
'[class]': 'cm().formFieldWrapper',
|
|
238
|
+
},
|
|
239
|
+
template: `<label [class]="cm().controlLabel">
|
|
240
|
+
<input
|
|
241
|
+
type="checkbox"
|
|
242
|
+
[attr.id]="checkboxId()"
|
|
243
|
+
[attr.name]="name"
|
|
244
|
+
[attr.checked]="isChecked() ? '' : null"
|
|
245
|
+
[disabled]="disabled"
|
|
246
|
+
[attr.data-state]="checked ? 'checked' : 'unchecked'"
|
|
247
|
+
[attr.aria-invalid]="error || fieldContext()?.invalid ? 'true' : 'false'"
|
|
248
|
+
[attr.aria-describedby]="mergedDescribedBy()"
|
|
249
|
+
[class]="classes()"
|
|
250
|
+
[attr.style]="hostStyle()"
|
|
251
|
+
[attr.data-testid]="testId"
|
|
252
|
+
(click)="handleClick($event)"
|
|
253
|
+
(change)="handleChange($event)"
|
|
254
|
+
#input
|
|
255
|
+
/>
|
|
256
|
+
<span [class]="cm().cn(cm().controlText, disabled && cm().controlDisabled)" #labelSlot
|
|
257
|
+
>{{ label }}<ng-content select="[slot=label]"></ng-content
|
|
258
|
+
></span>
|
|
259
|
+
</label>
|
|
260
|
+
@if (error) {
|
|
261
|
+
<p [attr.id]="errorId()" [class]="cm().cn(cm().formError, cm().sp('mt', 1))">{{ error }}</p>
|
|
262
|
+
}`,
|
|
138
263
|
}]
|
|
139
|
-
}], null, {
|
|
140
|
-
type: Input
|
|
141
|
-
}], checked: [{
|
|
142
|
-
type: Input
|
|
143
|
-
}], indeterminate: [{
|
|
144
|
-
type: Input
|
|
145
|
-
}], size: [{
|
|
146
|
-
type: Input
|
|
147
|
-
}], error: [{
|
|
148
|
-
type: Input
|
|
149
|
-
}], className: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}], style: [{
|
|
152
|
-
type: Input
|
|
153
|
-
}], testId: [{
|
|
154
|
-
type: Input
|
|
155
|
-
}], disabled: [{
|
|
156
|
-
type: Input
|
|
157
|
-
}], name: [{
|
|
158
|
-
type: Input
|
|
159
|
-
}], id: [{
|
|
160
|
-
type: Input
|
|
161
|
-
}], handleChange: [{
|
|
264
|
+
}], null, { change: [{
|
|
162
265
|
type: Output
|
|
266
|
+
}], input: [{
|
|
267
|
+
type: ViewChild,
|
|
268
|
+
args: ['input']
|
|
269
|
+
}], labelSlot: [{
|
|
270
|
+
type: ViewChild,
|
|
271
|
+
args: ['labelSlot']
|
|
163
272
|
}] }); })();
|
|
164
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(
|
|
273
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Checkbox, { className: "Checkbox", filePath: "components/checkbox.component.ts", lineNumber: 80 }); })();
|
|
165
274
|
//# sourceMappingURL=checkbox.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.component.js","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox.component.js","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;;;;;;;IAoDvD,4BAA6E;IAAA,YAAW;IAAA,oBAAI;;;IAAnE,6EAAmD;;IAAC,cAAW;IAAX,kCAAW;;AAlD9F;;;;;;;GAOG;AA8CH,MAAM,OAAO,QAAQ;IACnB,gEAAgE;IAChE,KAAK,CAAU;IACf,uCAAuC;IACvC,OAAO,CAAU;IACjB,4DAA4D;IAC5D,aAAa,CAAU;IACvB,4CAA4C;IAC5C,IAAI,CAAU;IACd,mEAAmE;IACnE,KAAK,CAAS;IACd,sDAAsD;IACtD,SAAS,CAAS;IAClB,6CAA6C;IAC7C,KAAK,CAA0B;IA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EAAE,IAAI;gBAChB,MAAM,EAAE;oBACN,OAAO;oBACP,SAAS;oBACT,eAAe;oBACf,MAAM;oBACN,OAAO;oBACP,WAAW;oBACX,OAAO;oBACP,QAAQ;oBACR,UAAU;oBACV,MAAM;oBACN,IAAI;oBACJ,gBAAgB;iBACjB;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,uBAAuB;iBACnC;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;MAuBN;aACL;;kBAoCE,MAAM;;kBAGN,SAAS;mBAAC,OAAO;;kBAEjB,SAAS;mBAAC,WAAW;;kFAxCX,QAAQ"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfirmButton component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type AfterViewInit, type DoCheck, ElementRef, type OnDestroy } from '@angular/core';
|
|
7
|
+
import type { ButtonVariant, ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* ConfirmButton component.
|
|
11
|
+
*
|
|
12
|
+
* The host is the `<button>` itself (`button[mol-confirm-button]`). The three
|
|
13
|
+
* labels are projected (`[slot=label]`, `[slot=confirmLabel]`,
|
|
14
|
+
* `[slot=pendingLabel]`); each capture span stays detached from the DOM and
|
|
15
|
+
* the visible phase's projected children are moved onto the button — React
|
|
16
|
+
* renders exactly one label and no wrapper element. When the slot for the
|
|
17
|
+
* armed/pending phase is empty, the localized default text renders instead
|
|
18
|
+
* (React's `confirmLabel ?? t(…)`).
|
|
19
|
+
*/
|
|
20
|
+
export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy {
|
|
21
|
+
/** Button variant (passed through to the button classes). */
|
|
22
|
+
variant?: ButtonVariant;
|
|
23
|
+
/** Button color; the armed state always shows the error color. */
|
|
24
|
+
color?: ColorVariant;
|
|
25
|
+
/** Button size. */
|
|
26
|
+
size?: Size;
|
|
27
|
+
/**
|
|
28
|
+
* The confirm callback (React's `onConfirm` prop). Fired ONLY on the
|
|
29
|
+
* confirming (second) click; while the returned promise is pending the
|
|
30
|
+
* button stays in its confirming state and ignores further clicks.
|
|
31
|
+
*/
|
|
32
|
+
onConfirm?: () => void | Promise<void>;
|
|
33
|
+
/** Seconds before the armed state auto-disarms (`0` disables auto-disarm). */
|
|
34
|
+
disarmSeconds: number;
|
|
35
|
+
/** Disables the control entirely (idle and confirming states). */
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
/** `data-testid` for the button. */
|
|
38
|
+
testId?: string;
|
|
39
|
+
/** Extra classes joined onto the button classes. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Inline style object (React camelCase). */
|
|
42
|
+
style?: Record<string, unknown>;
|
|
43
|
+
/** The label slot capture span (kept out of the DOM). */
|
|
44
|
+
labelSlot?: ElementRef<HTMLSpanElement>;
|
|
45
|
+
/** The armed-state label capture span. */
|
|
46
|
+
confirmSlot?: ElementRef<HTMLSpanElement>;
|
|
47
|
+
/** The pending-state label capture span. */
|
|
48
|
+
pendingSlot?: ElementRef<HTMLSpanElement>;
|
|
49
|
+
/** Whether the armed label slot carries content (read at view init). */
|
|
50
|
+
hasConfirmLabel: boolean;
|
|
51
|
+
/** Whether the pending label slot carries content (read at view init). */
|
|
52
|
+
hasPendingLabel: boolean;
|
|
53
|
+
/** The current phase: idle → armed → pending → idle. */
|
|
54
|
+
readonly phase: import("@angular/core").WritableSignal<"idle" | "armed" | "pending">;
|
|
55
|
+
private readonly el;
|
|
56
|
+
private readonly renderer;
|
|
57
|
+
private readonly sync;
|
|
58
|
+
private disarmTimer;
|
|
59
|
+
private anchor;
|
|
60
|
+
/**
|
|
61
|
+
* Arms the auto-disarm timer for the armed phase (React's `useEffect` on
|
|
62
|
+
* `[phase, disarmSeconds]`).
|
|
63
|
+
*/
|
|
64
|
+
constructor();
|
|
65
|
+
/**
|
|
66
|
+
* The current class map.
|
|
67
|
+
* @returns The UIClassMap.
|
|
68
|
+
*/
|
|
69
|
+
cm(): UIClassMap;
|
|
70
|
+
/**
|
|
71
|
+
* Computes the button class list (the armed state shows the error color).
|
|
72
|
+
* @returns The class string.
|
|
73
|
+
*/
|
|
74
|
+
classes(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Serializes the inline style.
|
|
77
|
+
* @returns The style attribute text.
|
|
78
|
+
*/
|
|
79
|
+
hostStyle(): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* React's click handler: idle arms, armed commits (awaiting the callback),
|
|
82
|
+
* pending ignores.
|
|
83
|
+
*/
|
|
84
|
+
private handleClick;
|
|
85
|
+
/**
|
|
86
|
+
* Disarms an armed button (React's window Escape listener, bound while
|
|
87
|
+
* armed; disarming an idle button is a no-op).
|
|
88
|
+
*/
|
|
89
|
+
private handleEscape;
|
|
90
|
+
/**
|
|
91
|
+
* React's `disarm`: cancels the timer and returns to idle.
|
|
92
|
+
*/
|
|
93
|
+
private disarm;
|
|
94
|
+
/**
|
|
95
|
+
* Reads slot presence at view init (view queries resolve only then) and
|
|
96
|
+
* takes the capture spans out of the DOM.
|
|
97
|
+
*/
|
|
98
|
+
ngAfterViewInit(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Re-reconciles the visible label on every pass (phase changes and later
|
|
101
|
+
* `props` steps both go through a refresh).
|
|
102
|
+
*/
|
|
103
|
+
ngDoCheck(): void;
|
|
104
|
+
/** The nodes currently shown on the button, and the slot they came from. */
|
|
105
|
+
private visibleNodes;
|
|
106
|
+
private visibleFrom;
|
|
107
|
+
/**
|
|
108
|
+
* Shows exactly the visible phase's projected children on the button —
|
|
109
|
+
* React renders exactly one label and no wrapper element.
|
|
110
|
+
*/
|
|
111
|
+
private syncLabels;
|
|
112
|
+
/**
|
|
113
|
+
* Shows one slot's projected children on the button, parking whatever
|
|
114
|
+
* another slot was showing back inside its capture span.
|
|
115
|
+
*
|
|
116
|
+
* @param span - The capture span to show (null parks everything).
|
|
117
|
+
*/
|
|
118
|
+
private showSlot;
|
|
119
|
+
/**
|
|
120
|
+
* The insertion point for the visible projected label (a comment the DOM
|
|
121
|
+
* normalizer strips), kept before the fallback texts.
|
|
122
|
+
* @returns The anchor comment.
|
|
123
|
+
*/
|
|
124
|
+
private labelAnchor;
|
|
125
|
+
/** Clears the auto-disarm timer (React's unmount cleanup). */
|
|
126
|
+
ngOnDestroy(): void;
|
|
127
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmButton, never>;
|
|
128
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmButton, "button[mol-confirm-button]", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "onConfirm": { "alias": "onConfirm"; "required": false; }; "disarmSeconds": { "alias": "disarmSeconds"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; }, {}, never, ["[slot=label]", "[slot=confirmLabel]", "[slot=pendingLabel]"], true, never>;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=confirm-button.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-button.component.d.ts","sourceRoot":"","sources":["../../src/components/confirm-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EAEZ,UAAU,EAEV,KAAK,SAAS,EAIf,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMrF;;;;;;;;;;GAUG;AACH,qBAmCa,aAAc,YAAW,aAAa,EAAE,OAAO,EAAE,SAAS;IACrE,6DAA6D;IAC7D,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,kEAAkE;IAClE,KAAK,CAAC,EAAE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