@molecule/app-ui-angular 1.0.6 → 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 +11740 -1143
- 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 +6 -4
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Badge component (React parity).
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Component } from '@angular/core';
|
|
7
7
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import { styleText } from '../utilities/style.js';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
const _c0 = ["*"];
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
12
|
+
* Badge component.
|
|
13
|
+
*
|
|
14
|
+
* The host element is the `<span>` React renders (`span[mol-badge]`); the
|
|
15
|
+
* color variant maps to `badge({ variant })` exactly as React's `Badge`.
|
|
15
16
|
*/
|
|
16
|
-
export class
|
|
17
|
+
export class Badge {
|
|
18
|
+
/** Named color variant (`primary`, `success`, …). */
|
|
17
19
|
color = 'primary';
|
|
20
|
+
/** Visual style (kept for React prop parity; the class map keys off `color`). */
|
|
18
21
|
variant = 'solid';
|
|
22
|
+
/** Badge size. */
|
|
19
23
|
size;
|
|
24
|
+
/** Whether the badge is fully rounded (default) or square. */
|
|
20
25
|
rounded = true;
|
|
26
|
+
/** Extra classes joined onto the badge classes. */
|
|
21
27
|
className;
|
|
28
|
+
/** Inline style object (React camelCase). */
|
|
22
29
|
style;
|
|
30
|
+
/** `data-testid` for the badge. */
|
|
23
31
|
testId;
|
|
24
32
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @returns The UIClassMap
|
|
33
|
+
* The current class map.
|
|
34
|
+
* @returns The UIClassMap.
|
|
27
35
|
*/
|
|
28
|
-
|
|
36
|
+
cm() {
|
|
29
37
|
return getClassMap();
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
|
-
* Computes the
|
|
33
|
-
* @returns The
|
|
40
|
+
* Computes the badge class list.
|
|
41
|
+
* @returns The class string.
|
|
34
42
|
*/
|
|
35
|
-
|
|
36
|
-
return this.cm.cn(this.cm.badge({ variant: this.color, size: this.size }), !this.rounded && this.cm.badgeSquare, this.className);
|
|
43
|
+
classes() {
|
|
44
|
+
return this.cm().cn(this.cm().badge({ variant: this.color, size: this.size }), !this.rounded && this.cm().badgeSquare, this.className);
|
|
37
45
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Serializes the inline style.
|
|
48
|
+
* @returns The style attribute text.
|
|
49
|
+
*/
|
|
50
|
+
hostStyle() {
|
|
51
|
+
return styleText(this.style);
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = function Badge_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Badge)(); };
|
|
54
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Badge, selectors: [["span", "mol-badge", ""]], hostVars: 5, hostBindings: function Badge_HostBindings(rf, ctx) { if (rf & 2) {
|
|
47
55
|
i0.ɵɵattribute("data-testid", ctx.testId);
|
|
56
|
+
i0.ɵɵstyleMap(ctx.hostStyle());
|
|
57
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
58
|
+
} }, inputs: { color: "color", variant: "variant", size: "size", rounded: "rounded", className: "className", style: "style", testId: "testId" }, ngContentSelectors: _c0, decls: 1, vars: 0, template: function Badge_Template(rf, ctx) { if (rf & 1) {
|
|
59
|
+
i0.ɵɵprojectionDef();
|
|
60
|
+
i0.ɵɵprojection(0);
|
|
48
61
|
} }, encapsulation: 2 });
|
|
49
62
|
}
|
|
50
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
63
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Badge, [{
|
|
51
64
|
type: Component,
|
|
52
65
|
args: [{
|
|
53
|
-
selector: 'mol-badge',
|
|
66
|
+
selector: 'span[mol-badge]',
|
|
54
67
|
standalone: true,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
inputs: ['color', 'variant', 'size', 'rounded', 'className', 'style', 'testId'],
|
|
69
|
+
host: {
|
|
70
|
+
'[class]': 'classes()',
|
|
71
|
+
'[style]': 'hostStyle()',
|
|
72
|
+
'[attr.data-testid]': 'testId',
|
|
73
|
+
},
|
|
74
|
+
template: `<ng-content></ng-content>`,
|
|
61
75
|
}]
|
|
62
|
-
}], null,
|
|
63
|
-
|
|
64
|
-
}], variant: [{
|
|
65
|
-
type: Input
|
|
66
|
-
}], size: [{
|
|
67
|
-
type: Input
|
|
68
|
-
}], rounded: [{
|
|
69
|
-
type: Input
|
|
70
|
-
}], className: [{
|
|
71
|
-
type: Input
|
|
72
|
-
}], style: [{
|
|
73
|
-
type: Input
|
|
74
|
-
}], testId: [{
|
|
75
|
-
type: Input
|
|
76
|
-
}] }); })();
|
|
77
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeBadge, { className: "MoleculeBadge", filePath: "components/badge.component.ts", lineNumber: 28 }); })();
|
|
76
|
+
}], null, null); })();
|
|
77
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Badge, { className: "Badge", filePath: "components/badge.component.ts", lineNumber: 31 }); })();
|
|
78
78
|
//# sourceMappingURL=badge.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.component.js","sourceRoot":"","sources":["../../src/components/badge.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"badge.component.js","sourceRoot":"","sources":["../../src/components/badge.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;;;AAEjD;;;;;GAKG;AAYH,MAAM,OAAO,KAAK;IAChB,qDAAqD;IACrD,KAAK,GAAiB,SAAS,CAAA;IAC/B,iFAAiF;IACjF,OAAO,GAAmC,OAAO,CAAA;IACjD,kBAAkB;IAClB,IAAI,CAAO;IACX,8DAA8D;IAC9D,OAAO,GAAG,IAAI,CAAA;IACd,mDAAmD;IACnD,SAAS,CAAS;IAClB,6CAA6C;IAC7C,KAAK,CAA0B;IAC/B,mCAAmC;IACnC,MAAM,CAAS;IAEf;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CACjB,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EACzD,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,WAAW,EACtC,IAAI,CAAC,SAAS,CACf,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;+FA1CU,KAAK;6DAAL,KAAK;;YAAL,cAAA,eACV,CADe;YAAL,cAAA,aACZ,CADiB;;;YAFL,kBAAyB;;;iFAEzB,KAAK;cAXjB,SAAS;eAAC;gBACT,QAAQ,EAAE,iBAAiB;gBAC3B,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC;gBAC/E,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,SAAS,EAAE,aAAa;oBACxB,oBAAoB,EAAE,QAAQ;iBAC/B;gBACD,QAAQ,EAAE,2BAA2B;aACtC;;kFACY,KAAK"}
|
|
@@ -1,38 +1,120 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Button component (React parity).
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { type AfterViewInit, type DoCheck, ElementRef, Renderer2 } from '@angular/core';
|
|
7
7
|
import type { ButtonVariant, ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Whether an ng-content wrapper captured any element or text node.
|
|
11
|
+
*
|
|
12
|
+
* @param el - The wrapper element.
|
|
13
|
+
* @returns True when at least one projected node exists.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasNodes(el: Element | undefined | null): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Attaches or detaches an always-mounted projection wrapper element from its
|
|
18
|
+
* parent, remembering the re-insertion position with a comment anchor the DOM
|
|
19
|
+
* normalizer strips.
|
|
20
|
+
*
|
|
21
|
+
* React renders `{cond && <span>{slot}</span>}` — nothing when the condition
|
|
22
|
+
* is false. Angular needs the `<ng-content>` capture point to stay mounted,
|
|
23
|
+
* so the wrapper span always exists in the template and this helper removes
|
|
24
|
+
* it from the DOM whenever React would not render it.
|
|
25
|
+
*/
|
|
26
|
+
export declare class SlotWrapper {
|
|
27
|
+
private readonly host;
|
|
28
|
+
private readonly renderer;
|
|
29
|
+
private readonly anchors;
|
|
30
|
+
/**
|
|
31
|
+
* Creates the wrapper helper.
|
|
32
|
+
*
|
|
33
|
+
* @param host - The component host element (default detach parent).
|
|
34
|
+
* @param renderer - The DOM renderer.
|
|
35
|
+
*/
|
|
36
|
+
constructor(host: ElementRef<HTMLElement>, renderer: Renderer2);
|
|
37
|
+
/**
|
|
38
|
+
* Attaches or detaches the element (default parent: the component host).
|
|
39
|
+
*
|
|
40
|
+
* @param el - The wrapper element.
|
|
41
|
+
* @param shouldAttach - Whether it should be in the DOM.
|
|
42
|
+
* @param parent - Where the element lives when attached (default: host).
|
|
43
|
+
*/
|
|
44
|
+
sync(el: Element | undefined | null, shouldAttach: boolean, parent?: Node): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Button component.
|
|
48
|
+
*
|
|
49
|
+
* While `loading` is true, the native button is disabled and marked busy.
|
|
50
|
+
* The host element is the `<button>` itself (`button[mol-button]`), matching
|
|
51
|
+
* React's root exactly. Icon slots are projected as `[slot=leftIcon]` /
|
|
52
|
+
* `[slot=rightIcon]`; each wrapping `<span>` renders only while the slot
|
|
53
|
+
* carries nodes AND the button is not loading — React's
|
|
54
|
+
* `{!loading && !!leftIcon && <span>…}` — implemented by detaching the
|
|
55
|
+
* wrapper from the DOM (the projected nodes must have an always-mounted
|
|
56
|
+
* capture point, so the wrapper lives in the template unconditionally).
|
|
11
57
|
*/
|
|
12
|
-
export declare class
|
|
58
|
+
export declare class Button implements AfterViewInit, DoCheck {
|
|
59
|
+
/** Button variant. */
|
|
13
60
|
variant: ButtonVariant;
|
|
61
|
+
/** Button color. */
|
|
14
62
|
color: ColorVariant;
|
|
63
|
+
/** Button size. */
|
|
15
64
|
size: Size;
|
|
65
|
+
/** Whether the button is in its loading (busy) state. */
|
|
16
66
|
loading: boolean;
|
|
67
|
+
/** Text shown instead of children while loading. */
|
|
17
68
|
loadingText?: string;
|
|
69
|
+
/** Whether the button stretches to fill its container. */
|
|
18
70
|
fullWidth: boolean;
|
|
71
|
+
/** Extra classes joined onto the button classes. */
|
|
19
72
|
className?: string;
|
|
20
|
-
style
|
|
73
|
+
/** Inline style object (React camelCase). */
|
|
74
|
+
style?: Record<string, unknown>;
|
|
75
|
+
/** `data-testid` for the button. */
|
|
21
76
|
testId?: string;
|
|
77
|
+
/** Disables the button. */
|
|
22
78
|
disabled: boolean;
|
|
79
|
+
/** The button's `type` attribute. */
|
|
23
80
|
type: 'button' | 'submit' | 'reset';
|
|
24
|
-
|
|
81
|
+
/** The left icon wrapper (always in the template; detached when unused). */
|
|
82
|
+
leftSlot?: ElementRef<HTMLSpanElement>;
|
|
83
|
+
/** The right icon wrapper. */
|
|
84
|
+
rightSlot?: ElementRef<HTMLSpanElement>;
|
|
85
|
+
private readonly sync;
|
|
86
|
+
/**
|
|
87
|
+
* The current class map.
|
|
88
|
+
* @returns The UIClassMap.
|
|
89
|
+
*/
|
|
90
|
+
cm(): UIClassMap;
|
|
91
|
+
/**
|
|
92
|
+
* Computes the button class list.
|
|
93
|
+
* @returns The class string.
|
|
94
|
+
*/
|
|
95
|
+
classes(): string;
|
|
96
|
+
/**
|
|
97
|
+
* Serializes the inline style.
|
|
98
|
+
* @returns The style attribute text.
|
|
99
|
+
*/
|
|
100
|
+
hostStyle(): string | null;
|
|
101
|
+
private hasLeft;
|
|
102
|
+
private hasRight;
|
|
103
|
+
/**
|
|
104
|
+
* Detects slot content and detaches the wrappers React would not render.
|
|
105
|
+
* View queries resolve only by view init (the first pass), so presence is
|
|
106
|
+
* read here rather than at content init.
|
|
107
|
+
*/
|
|
108
|
+
ngAfterViewInit(): void;
|
|
25
109
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @returns The UIClassMap instance for styling.
|
|
110
|
+
* Re-reconciles the wrappers when `loading` changes.
|
|
28
111
|
*/
|
|
29
|
-
|
|
112
|
+
ngDoCheck(): void;
|
|
30
113
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @returns The button class name string.
|
|
114
|
+
* Applies React's `{!loading && !!icon}` wrapper conditions.
|
|
33
115
|
*/
|
|
34
|
-
|
|
35
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
36
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
116
|
+
private syncWrappers;
|
|
117
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Button, never>;
|
|
118
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Button, "button[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; }; }, {}, never, ["[slot=leftIcon]", "*", "[slot=rightIcon]"], true, never>;
|
|
37
119
|
}
|
|
38
120
|
//# sourceMappingURL=button.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.component.d.ts","sourceRoot":"","sources":["../../src/components/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"button.component.d.ts","sourceRoot":"","sources":["../../src/components/button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,UAAU,EAEV,SAAS,EAEV,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMrF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAOhE;AAED;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAUpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAV3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD;;;;;OAKG;gBAEgB,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,QAAQ,EAAE,SAAS;IAGtC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI;CAqBjF;AAED;;;;;;;;;;;GAWG;AACH,qBAwCa,MAAO,YAAW,aAAa,EAAE,OAAO;IACnD,sBAAsB;IACtB,OAAO,EAAE,aAAa,CAAU;IAChC,oBAAoB;IACpB,KAAK,EAAE,YAAY,CAAY;IAC/B,mBAAmB;IACnB,IAAI,EAAE,IAAI,CAAO;IACjB,yDAAyD;IACzD,OAAO,UAAQ;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0DAA0D;IAC1D,SAAS,UAAQ;IACjB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2BAA2B;IAC3B,QAAQ,UAAQ;IAChB,qCAAqC;IACrC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAW;IAE9C,4EAA4E;IACrD,QAAQ,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC7D,8BAA8B;IACN,SAAS,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAE/D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyD;IAE9E;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAYjB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAQ;IAExB;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAQvB;;OAEG;IACH,SAAS,IAAI,IAAI;IAIjB;;OAEG;IACH,OAAO,CAAC,YAAY;yCAzFT,MAAM;2CAAN,MAAM;CA6FlB"}
|
|
@@ -1,136 +1,281 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Button component (React parity).
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Component, ElementRef, inject, Renderer2, ViewChild, } from '@angular/core';
|
|
7
7
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import { styleText } from '../utilities/style.js';
|
|
9
|
+
import { Spinner } from './spinner.component.js';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
|
-
const _c0 = ["
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const _c0 = ["leftSlot"];
|
|
12
|
+
const _c1 = ["rightSlot"];
|
|
13
|
+
const _c2 = [[["", "slot", "lefticon"]], [["", "slot", "righticon"]], "*"];
|
|
14
|
+
const _c3 = ["[slot=leftIcon]", "[slot=rightIcon]", "*"];
|
|
15
|
+
function Button_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
16
|
+
i0.ɵɵelement(0, "div", 2);
|
|
12
17
|
} if (rf & 2) {
|
|
13
18
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
14
|
-
i0.ɵɵ
|
|
19
|
+
i0.ɵɵproperty("size", "sm")("className", ctx_r0.cm().buttonIconLeft);
|
|
15
20
|
} }
|
|
16
|
-
function
|
|
17
|
-
i0.ɵɵ
|
|
21
|
+
function Button_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
22
|
+
i0.ɵɵelementContainerStart(0);
|
|
23
|
+
i0.ɵɵtext(1);
|
|
24
|
+
i0.ɵɵelementContainerEnd();
|
|
18
25
|
} if (rf & 2) {
|
|
19
26
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
20
|
-
i0.ɵɵ
|
|
27
|
+
i0.ɵɵadvance();
|
|
28
|
+
i0.ɵɵtextInterpolate(ctx_r0.loadingText);
|
|
21
29
|
} }
|
|
22
|
-
function
|
|
23
|
-
i0.ɵɵprojection(0);
|
|
30
|
+
function Button_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
31
|
+
i0.ɵɵprojection(0, 2);
|
|
24
32
|
} }
|
|
25
33
|
/**
|
|
26
|
-
*
|
|
34
|
+
* Whether an ng-content wrapper captured any element or text node.
|
|
35
|
+
*
|
|
36
|
+
* @param el - The wrapper element.
|
|
37
|
+
* @returns True when at least one projected node exists.
|
|
27
38
|
*/
|
|
39
|
+
export function hasNodes(el) {
|
|
40
|
+
if (!el)
|
|
41
|
+
return false;
|
|
42
|
+
for (const node of Array.from(el.childNodes)) {
|
|
43
|
+
if (node.nodeType === 1)
|
|
44
|
+
return true;
|
|
45
|
+
if (node.nodeType === 3 && (node.textContent ?? '').trim())
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
28
50
|
/**
|
|
29
|
-
*
|
|
51
|
+
* Attaches or detaches an always-mounted projection wrapper element from its
|
|
52
|
+
* parent, remembering the re-insertion position with a comment anchor the DOM
|
|
53
|
+
* normalizer strips.
|
|
54
|
+
*
|
|
55
|
+
* React renders `{cond && <span>{slot}</span>}` — nothing when the condition
|
|
56
|
+
* is false. Angular needs the `<ng-content>` capture point to stay mounted,
|
|
57
|
+
* so the wrapper span always exists in the template and this helper removes
|
|
58
|
+
* it from the DOM whenever React would not render it.
|
|
30
59
|
*/
|
|
31
|
-
export class
|
|
60
|
+
export class SlotWrapper {
|
|
61
|
+
host;
|
|
62
|
+
renderer;
|
|
63
|
+
anchors = new Map();
|
|
64
|
+
/**
|
|
65
|
+
* Creates the wrapper helper.
|
|
66
|
+
*
|
|
67
|
+
* @param host - The component host element (default detach parent).
|
|
68
|
+
* @param renderer - The DOM renderer.
|
|
69
|
+
*/
|
|
70
|
+
constructor(host, renderer) {
|
|
71
|
+
this.host = host;
|
|
72
|
+
this.renderer = renderer;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Attaches or detaches the element (default parent: the component host).
|
|
76
|
+
*
|
|
77
|
+
* @param el - The wrapper element.
|
|
78
|
+
* @param shouldAttach - Whether it should be in the DOM.
|
|
79
|
+
* @param parent - Where the element lives when attached (default: host).
|
|
80
|
+
*/
|
|
81
|
+
sync(el, shouldAttach, parent) {
|
|
82
|
+
if (!el)
|
|
83
|
+
return;
|
|
84
|
+
const host = parent ?? this.host.nativeElement;
|
|
85
|
+
if (shouldAttach && !el.isConnected) {
|
|
86
|
+
const anchor = this.anchors.get(el);
|
|
87
|
+
if (anchor?.isConnected) {
|
|
88
|
+
host.insertBefore(el, anchor);
|
|
89
|
+
this.renderer.removeChild(host, anchor);
|
|
90
|
+
this.anchors.delete(el);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
host.appendChild(el);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else if (!shouldAttach && el.isConnected) {
|
|
97
|
+
// Placeholder comment keeps the re-insertion position stable; the
|
|
98
|
+
// normalizer strips comment nodes, so it never shows in snapshots.
|
|
99
|
+
const placeholder = this.renderer.createComment('slot');
|
|
100
|
+
host.insertBefore(placeholder, el);
|
|
101
|
+
this.anchors.set(el, placeholder);
|
|
102
|
+
this.renderer.removeChild(host, el);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Button component.
|
|
108
|
+
*
|
|
109
|
+
* While `loading` is true, the native button is disabled and marked busy.
|
|
110
|
+
* The host element is the `<button>` itself (`button[mol-button]`), matching
|
|
111
|
+
* React's root exactly. Icon slots are projected as `[slot=leftIcon]` /
|
|
112
|
+
* `[slot=rightIcon]`; each wrapping `<span>` renders only while the slot
|
|
113
|
+
* carries nodes AND the button is not loading — React's
|
|
114
|
+
* `{!loading && !!leftIcon && <span>…}` — implemented by detaching the
|
|
115
|
+
* wrapper from the DOM (the projected nodes must have an always-mounted
|
|
116
|
+
* capture point, so the wrapper lives in the template unconditionally).
|
|
117
|
+
*/
|
|
118
|
+
export class Button {
|
|
119
|
+
/** Button variant. */
|
|
32
120
|
variant = 'solid';
|
|
121
|
+
/** Button color. */
|
|
33
122
|
color = 'primary';
|
|
123
|
+
/** Button size. */
|
|
34
124
|
size = 'md';
|
|
125
|
+
/** Whether the button is in its loading (busy) state. */
|
|
35
126
|
loading = false;
|
|
127
|
+
/** Text shown instead of children while loading. */
|
|
36
128
|
loadingText;
|
|
129
|
+
/** Whether the button stretches to fill its container. */
|
|
37
130
|
fullWidth = false;
|
|
131
|
+
/** Extra classes joined onto the button classes. */
|
|
38
132
|
className;
|
|
133
|
+
/** Inline style object (React camelCase). */
|
|
39
134
|
style;
|
|
135
|
+
/** `data-testid` for the button. */
|
|
40
136
|
testId;
|
|
137
|
+
/** Disables the button. */
|
|
41
138
|
disabled = false;
|
|
139
|
+
/** The button's `type` attribute. */
|
|
42
140
|
type = 'button';
|
|
43
|
-
|
|
141
|
+
/** The left icon wrapper (always in the template; detached when unused). */
|
|
142
|
+
leftSlot;
|
|
143
|
+
/** The right icon wrapper. */
|
|
144
|
+
rightSlot;
|
|
145
|
+
sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
|
|
44
146
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @returns The UIClassMap
|
|
147
|
+
* The current class map.
|
|
148
|
+
* @returns The UIClassMap.
|
|
47
149
|
*/
|
|
48
|
-
|
|
150
|
+
cm() {
|
|
49
151
|
return getClassMap();
|
|
50
152
|
}
|
|
51
153
|
/**
|
|
52
|
-
* Computes the
|
|
53
|
-
* @returns The
|
|
154
|
+
* Computes the button class list.
|
|
155
|
+
* @returns The class string.
|
|
54
156
|
*/
|
|
55
|
-
|
|
56
|
-
return this.cm.cn(this.cm.button({
|
|
157
|
+
classes() {
|
|
158
|
+
return this.cm().cn(this.cm().button({
|
|
57
159
|
variant: this.variant,
|
|
58
160
|
color: this.color,
|
|
59
161
|
size: this.size,
|
|
60
162
|
fullWidth: this.fullWidth,
|
|
61
163
|
}), this.className);
|
|
62
164
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Serializes the inline style.
|
|
167
|
+
* @returns The style attribute text.
|
|
168
|
+
*/
|
|
169
|
+
hostStyle() {
|
|
170
|
+
return styleText(this.style);
|
|
171
|
+
}
|
|
172
|
+
hasLeft = false;
|
|
173
|
+
hasRight = false;
|
|
174
|
+
/**
|
|
175
|
+
* Detects slot content and detaches the wrappers React would not render.
|
|
176
|
+
* View queries resolve only by view init (the first pass), so presence is
|
|
177
|
+
* read here rather than at content init.
|
|
178
|
+
*/
|
|
179
|
+
ngAfterViewInit() {
|
|
180
|
+
const left = this.leftSlot?.nativeElement;
|
|
181
|
+
const right = this.rightSlot?.nativeElement;
|
|
182
|
+
this.hasLeft = left ? hasNodes(left) : false;
|
|
183
|
+
this.hasRight = right ? hasNodes(right) : false;
|
|
184
|
+
this.syncWrappers();
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Re-reconciles the wrappers when `loading` changes.
|
|
188
|
+
*/
|
|
189
|
+
ngDoCheck() {
|
|
190
|
+
this.syncWrappers();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Applies React's `{!loading && !!icon}` wrapper conditions.
|
|
194
|
+
*/
|
|
195
|
+
syncWrappers() {
|
|
196
|
+
this.sync.sync(this.leftSlot?.nativeElement, this.hasLeft && !this.loading);
|
|
197
|
+
this.sync.sync(this.rightSlot?.nativeElement, this.hasRight && !this.loading);
|
|
198
|
+
}
|
|
199
|
+
static ɵfac = function Button_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Button)(); };
|
|
200
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Button, selectors: [["button", "mol-button", ""]], viewQuery: function Button_Query(rf, ctx) { if (rf & 1) {
|
|
201
|
+
i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
|
|
71
202
|
} if (rf & 2) {
|
|
72
|
-
|
|
73
|
-
i0.ɵɵ
|
|
74
|
-
i0.ɵɵ
|
|
75
|
-
|
|
76
|
-
i0.ɵɵ
|
|
77
|
-
i0.ɵɵ
|
|
203
|
+
let _t;
|
|
204
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.leftSlot = _t.first);
|
|
205
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rightSlot = _t.first);
|
|
206
|
+
} }, hostVars: 8, hostBindings: function Button_HostBindings(rf, ctx) { if (rf & 2) {
|
|
207
|
+
i0.ɵɵdomProperty("disabled", ctx.disabled || ctx.loading);
|
|
208
|
+
i0.ɵɵattribute("data-testid", ctx.testId)("type", ctx.type)("aria-busy", ctx.loading ? "true" : "false");
|
|
209
|
+
i0.ɵɵstyleMap(ctx.hostStyle());
|
|
210
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
211
|
+
} }, inputs: { variant: "variant", color: "color", size: "size", loading: "loading", loadingText: "loadingText", fullWidth: "fullWidth", className: "className", style: "style", testId: "testId", disabled: "disabled", type: "type" }, ngContentSelectors: _c3, decls: 9, vars: 6, consts: [["leftSlot", ""], ["rightSlot", ""], ["mol-spinner", "", 3, "size", "className"]], template: function Button_Template(rf, ctx) { if (rf & 1) {
|
|
212
|
+
i0.ɵɵprojectionDef(_c2);
|
|
213
|
+
i0.ɵɵconditionalCreate(0, Button_Conditional_0_Template, 1, 2, "div", 2);
|
|
214
|
+
i0.ɵɵelementStart(1, "span", null, 0);
|
|
215
|
+
i0.ɵɵprojection(3);
|
|
216
|
+
i0.ɵɵelementEnd();
|
|
217
|
+
i0.ɵɵconditionalCreate(4, Button_Conditional_4_Template, 2, 1, "ng-container")(5, Button_Conditional_5_Template, 1, 0);
|
|
218
|
+
i0.ɵɵelementStart(6, "span", null, 1);
|
|
219
|
+
i0.ɵɵprojection(8, 1);
|
|
220
|
+
i0.ɵɵelementEnd();
|
|
221
|
+
} if (rf & 2) {
|
|
222
|
+
i0.ɵɵconditional(ctx.loading ? 0 : -1);
|
|
78
223
|
i0.ɵɵadvance();
|
|
79
|
-
i0.ɵɵ
|
|
80
|
-
|
|
224
|
+
i0.ɵɵclassMap(ctx.cm().buttonIconLeft);
|
|
225
|
+
i0.ɵɵadvance(3);
|
|
226
|
+
i0.ɵɵconditional(ctx.loading && ctx.loadingText ? 4 : 5);
|
|
227
|
+
i0.ɵɵadvance(2);
|
|
228
|
+
i0.ɵɵclassMap(ctx.cm().buttonIconRight);
|
|
229
|
+
} }, dependencies: [Spinner], encapsulation: 2 });
|
|
81
230
|
}
|
|
82
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(
|
|
231
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Button, [{
|
|
83
232
|
type: Component,
|
|
84
233
|
args: [{
|
|
85
|
-
selector: 'mol-button',
|
|
234
|
+
selector: 'button[mol-button]',
|
|
86
235
|
standalone: true,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
236
|
+
imports: [Spinner],
|
|
237
|
+
inputs: [
|
|
238
|
+
'variant',
|
|
239
|
+
'color',
|
|
240
|
+
'size',
|
|
241
|
+
'loading',
|
|
242
|
+
'loadingText',
|
|
243
|
+
'fullWidth',
|
|
244
|
+
'className',
|
|
245
|
+
'style',
|
|
246
|
+
'testId',
|
|
247
|
+
'disabled',
|
|
248
|
+
'type',
|
|
249
|
+
],
|
|
250
|
+
host: {
|
|
251
|
+
'[class]': 'classes()',
|
|
252
|
+
'[style]': 'hostStyle()',
|
|
253
|
+
'[attr.data-testid]': 'testId',
|
|
254
|
+
'[attr.type]': 'type',
|
|
255
|
+
'[disabled]': 'disabled || loading',
|
|
256
|
+
'[attr.aria-busy]': 'loading ? "true" : "false"',
|
|
257
|
+
},
|
|
258
|
+
template: `@if (loading) {
|
|
259
|
+
<div mol-spinner [size]="'sm'" [className]="cm().buttonIconLeft"></div>
|
|
260
|
+
}
|
|
261
|
+
<span [class]="cm().buttonIconLeft" #leftSlot
|
|
262
|
+
><ng-content select="[slot=leftIcon]"></ng-content
|
|
263
|
+
></span>
|
|
264
|
+
@if (loading && loadingText) {
|
|
265
|
+
<ng-container>{{ loadingText }}</ng-container>
|
|
266
|
+
} @else {
|
|
267
|
+
<ng-content></ng-content>
|
|
268
|
+
}
|
|
269
|
+
<span [class]="cm().buttonIconRight" #rightSlot
|
|
270
|
+
><ng-content select="[slot=rightIcon]"></ng-content
|
|
271
|
+
></span>`,
|
|
109
272
|
}]
|
|
110
|
-
}], null, {
|
|
111
|
-
type:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}], loading: [{
|
|
117
|
-
type: Input
|
|
118
|
-
}], loadingText: [{
|
|
119
|
-
type: Input
|
|
120
|
-
}], fullWidth: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}], className: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], style: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}], testId: [{
|
|
127
|
-
type: Input
|
|
128
|
-
}], disabled: [{
|
|
129
|
-
type: Input
|
|
130
|
-
}], type: [{
|
|
131
|
-
type: Input
|
|
132
|
-
}], handleClick: [{
|
|
133
|
-
type: Output
|
|
273
|
+
}], null, { leftSlot: [{
|
|
274
|
+
type: ViewChild,
|
|
275
|
+
args: ['leftSlot']
|
|
276
|
+
}], rightSlot: [{
|
|
277
|
+
type: ViewChild,
|
|
278
|
+
args: ['rightSlot']
|
|
134
279
|
}] }); })();
|
|
135
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(
|
|
280
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Button, { className: "Button", filePath: "components/button.component.ts", lineNumber: 144 }); })();
|
|
136
281
|
//# sourceMappingURL=button.component.js.map
|