@molecule/app-ui-angular 1.0.0

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.
Files changed (75) hide show
  1. package/LICENSE +115 -0
  2. package/README.md +1591 -0
  3. package/dist/components/alert.component.d.ts +71 -0
  4. package/dist/components/alert.component.d.ts.map +1 -0
  5. package/dist/components/alert.component.js +222 -0
  6. package/dist/components/alert.component.js.map +1 -0
  7. package/dist/components/badge.component.d.ts +27 -0
  8. package/dist/components/badge.component.d.ts.map +1 -0
  9. package/dist/components/badge.component.js +78 -0
  10. package/dist/components/badge.component.js.map +1 -0
  11. package/dist/components/button.component.d.ts +38 -0
  12. package/dist/components/button.component.d.ts.map +1 -0
  13. package/dist/components/button.component.js +136 -0
  14. package/dist/components/button.component.js.map +1 -0
  15. package/dist/components/checkbox.component.d.ts +53 -0
  16. package/dist/components/checkbox.component.d.ts.map +1 -0
  17. package/dist/components/checkbox.component.js +165 -0
  18. package/dist/components/checkbox.component.js.map +1 -0
  19. package/dist/components/index.d.ts +18 -0
  20. package/dist/components/index.d.ts.map +1 -0
  21. package/dist/components/index.js +18 -0
  22. package/dist/components/index.js.map +1 -0
  23. package/dist/components/input.component.d.ts +87 -0
  24. package/dist/components/input.component.d.ts.map +1 -0
  25. package/dist/components/input.component.js +307 -0
  26. package/dist/components/input.component.js.map +1 -0
  27. package/dist/components/modal.component.d.ts +142 -0
  28. package/dist/components/modal.component.d.ts.map +1 -0
  29. package/dist/components/modal.component.js +375 -0
  30. package/dist/components/modal.component.js.map +1 -0
  31. package/dist/components/radio-group.component.d.ts +63 -0
  32. package/dist/components/radio-group.component.d.ts.map +1 -0
  33. package/dist/components/radio-group.component.js +207 -0
  34. package/dist/components/radio-group.component.js.map +1 -0
  35. package/dist/components/select.component.d.ts +72 -0
  36. package/dist/components/select.component.d.ts.map +1 -0
  37. package/dist/components/select.component.js +273 -0
  38. package/dist/components/select.component.js.map +1 -0
  39. package/dist/components/spinner.component.d.ts +36 -0
  40. package/dist/components/spinner.component.d.ts.map +1 -0
  41. package/dist/components/spinner.component.js +115 -0
  42. package/dist/components/spinner.component.js.map +1 -0
  43. package/dist/components/switch.component.d.ts +54 -0
  44. package/dist/components/switch.component.d.ts.map +1 -0
  45. package/dist/components/switch.component.js +147 -0
  46. package/dist/components/switch.component.js.map +1 -0
  47. package/dist/components/toast.component.d.ts +92 -0
  48. package/dist/components/toast.component.d.ts.map +1 -0
  49. package/dist/components/toast.component.js +298 -0
  50. package/dist/components/toast.component.js.map +1 -0
  51. package/dist/components/tooltip.component.d.ts +77 -0
  52. package/dist/components/tooltip.component.d.ts.map +1 -0
  53. package/dist/components/tooltip.component.js +315 -0
  54. package/dist/components/tooltip.component.js.map +1 -0
  55. package/dist/index.d.ts +59 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +59 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/types.d.ts +7 -0
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +7 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/utilities/index.d.ts +8 -0
  64. package/dist/utilities/index.d.ts.map +1 -0
  65. package/dist/utilities/index.js +8 -0
  66. package/dist/utilities/index.js.map +1 -0
  67. package/dist/utilities/render-icon.d.ts +15 -0
  68. package/dist/utilities/render-icon.d.ts.map +1 -0
  69. package/dist/utilities/render-icon.js +44 -0
  70. package/dist/utilities/render-icon.js.map +1 -0
  71. package/dist/utilities/utilities.d.ts +12 -0
  72. package/dist/utilities/utilities.d.ts.map +1 -0
  73. package/dist/utilities/utilities.js +14 -0
  74. package/dist/utilities/utilities.js.map +1 -0
  75. package/package.json +54 -0
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Angular Modal UI component with UIClassMap-driven styling.
3
+ *
4
+ * @module
5
+ */
6
+ import { EventEmitter, type OnChanges, type OnDestroy, type OnInit, type SimpleChanges } from '@angular/core';
7
+ import { type SafeHtml } from '@angular/platform-browser';
8
+ import type { ModalSize, UIClassMap } from '@molecule/app-ui';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * Get the inline style for the modal centering wrapper. `dialogWrapper` has
12
+ * no dedicated ClassMap resolver option (it's a fixed token, not a
13
+ * `{ centered }`-parameterized one), so a top-anchored (non-centered) layout
14
+ * is expressed via the one inline-style exception the workspace styling rule
15
+ * allows for values ClassMap genuinely cannot express.
16
+ *
17
+ * A standalone function (rather than a class member) so it's unit-testable
18
+ * without constructing `MoleculeModal` — the class can't be `new`'d outside
19
+ * an Angular injection context (`sanitizer = inject(DomSanitizer)` runs at
20
+ * field-initializer time).
21
+ * @param centered - Whether the modal is vertically centered.
22
+ * @returns An inline style object, or `undefined` when centered.
23
+ */
24
+ export declare function getModalWrapperStyle(centered: boolean): Record<string, string> | undefined;
25
+ /**
26
+ * Angular Modal UI component with UIClassMap-driven styling.
27
+ *
28
+ * `centered` (default `true`) vertically centers the dialog; `centered:
29
+ * false` top-anchors it instead, via `getModalWrapperStyle()`.
30
+ */
31
+ export declare class MoleculeModal implements OnInit, OnDestroy, OnChanges {
32
+ open: boolean;
33
+ title?: string;
34
+ size: ModalSize;
35
+ showCloseButton: boolean;
36
+ closeLabel?: string;
37
+ closeOnOverlayClick: boolean;
38
+ closeOnEscape: boolean;
39
+ centered: boolean;
40
+ preventScroll: boolean;
41
+ hasFooter: boolean;
42
+ className?: string;
43
+ style?: Record<string, string>;
44
+ testId?: string;
45
+ close: EventEmitter<void>;
46
+ /**
47
+ * Retrieves the current UI class map.
48
+ * @returns The UIClassMap instance for styling.
49
+ */
50
+ get cm(): UIClassMap;
51
+ /**
52
+ * Computes the accessible close button label.
53
+ * @returns The localized aria-label for the close button.
54
+ */
55
+ get closeAriaLabel(): string;
56
+ private boundEscapeHandler;
57
+ /**
58
+ * Retrieves the CSS class for the modal wrapper.
59
+ * @returns The wrapper class name string.
60
+ */
61
+ get wrapperClass(): string;
62
+ /**
63
+ * Retrieves the inline style for the modal centering wrapper.
64
+ * @returns An inline style object, or `undefined` when centered.
65
+ */
66
+ get wrapperStyle(): Record<string, string> | undefined;
67
+ /**
68
+ * Retrieves the CSS class for the modal body.
69
+ * @returns The body class name string.
70
+ */
71
+ get bodyClass(): string;
72
+ /**
73
+ * Retrieves the CSS class for the modal overlay.
74
+ * @returns The overlay class name string.
75
+ */
76
+ get overlayClass(): string;
77
+ /**
78
+ * Retrieves the CSS class for the modal header.
79
+ * @returns The header class name string.
80
+ */
81
+ get headerClass(): string;
82
+ /**
83
+ * Retrieves the CSS class for the modal footer.
84
+ * @returns The footer class name string.
85
+ */
86
+ get footerClass(): string;
87
+ /**
88
+ * Retrieves the CSS class for the modal title.
89
+ * @returns The title class name string.
90
+ */
91
+ get titleClass(): string;
92
+ /**
93
+ * Retrieves the CSS class for the close button.
94
+ * @returns The close button class name string.
95
+ */
96
+ get closeClass(): string;
97
+ private sanitizer;
98
+ /**
99
+ * Generates the SVG markup for the close button icon.
100
+ * @returns The sanitized SVG for the close icon.
101
+ */
102
+ get closeIconSvg(): SafeHtml;
103
+ /**
104
+ * Computes the combined CSS classes for the modal content.
105
+ * @returns The modal content class name string.
106
+ */
107
+ get contentClasses(): string;
108
+ /**
109
+ * Initializes event listeners on component creation.
110
+ */
111
+ ngOnInit(): void;
112
+ /**
113
+ * Handles input property changes.
114
+ * @param changes - The changed input properties.
115
+ */
116
+ ngOnChanges(changes: SimpleChanges): void;
117
+ /**
118
+ * Cleans up event listeners and body scroll on component destruction.
119
+ */
120
+ ngOnDestroy(): void;
121
+ /**
122
+ * Adds or removes the keyboard escape listener based on open state.
123
+ */
124
+ private updateListeners;
125
+ /**
126
+ * Updates the document body overflow based on open state.
127
+ */
128
+ private updateBodyScroll;
129
+ /**
130
+ * Handles escape key press to close the modal.
131
+ * @param e - The keyboard event.
132
+ */
133
+ private handleEscape;
134
+ /**
135
+ * Handles overlay click to close the modal.
136
+ * @param event - The mouse event from the overlay click.
137
+ */
138
+ onOverlayClick(event: MouseEvent): void;
139
+ static ɵfac: i0.ɵɵFactoryDeclaration<MoleculeModal, never>;
140
+ static ɵcmp: i0.ɵɵComponentDeclaration<MoleculeModal, "mol-modal", never, { "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "size": { "alias": "size"; "required": false; }; "showCloseButton": { "alias": "showCloseButton"; "required": false; }; "closeLabel": { "alias": "closeLabel"; "required": false; }; "closeOnOverlayClick": { "alias": "closeOnOverlayClick"; "required": false; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; }; "centered": { "alias": "centered"; "required": false; }; "preventScroll": { "alias": "preventScroll"; "required": false; }; "hasFooter": { "alias": "hasFooter"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, { "close": "close"; }, never, ["*", "[modal-footer]"], true, never>;
141
+ }
142
+ //# sourceMappingURL=modal.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.component.d.ts","sourceRoot":"","sources":["../../src/components/modal.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,YAAY,EAGZ,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,MAAM,EAEX,KAAK,aAAa,EACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAGvE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAK7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAE1F;AAED;;;;;GAKG;AACH,qBA0Da,aAAc,YAAW,MAAM,EAAE,SAAS,EAAE,SAAS;IACvD,IAAI,UAAQ;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,SAAS,CAAO;IACtB,eAAe,UAAO;IACtB,UAAU,CAAC,EAAE,MAAM,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,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;yCAnL5B,aAAa;2CAAb,aAAa;CAwLzB"}
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Angular Modal UI component with UIClassMap-driven styling.
3
+ *
4
+ * @module
5
+ */
6
+ import { ChangeDetectionStrategy, Component, EventEmitter, inject, Input, Output, } from '@angular/core';
7
+ import { DomSanitizer } from '@angular/platform-browser';
8
+ import { t } from '@molecule/app-i18n';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { getIconSvg } from '../utilities/render-icon.js';
11
+ import * as i0 from "@angular/core";
12
+ const _c0 = ["*", [["", "modal-footer", ""]]];
13
+ const _c1 = ["*", "[modal-footer]"];
14
+ function MoleculeModal_Conditional_0_Conditional_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
15
+ i0.ɵɵdomElementStart(0, "h2", 6);
16
+ i0.ɵɵtext(1);
17
+ i0.ɵɵdomElementEnd();
18
+ } if (rf & 2) {
19
+ const ctx_r1 = i0.ɵɵnextContext(3);
20
+ i0.ɵɵclassMap(ctx_r1.titleClass);
21
+ i0.ɵɵadvance();
22
+ i0.ɵɵtextInterpolate(ctx_r1.title);
23
+ } }
24
+ function MoleculeModal_Conditional_0_Conditional_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
25
+ i0.ɵɵdomElement(0, "div");
26
+ } }
27
+ function MoleculeModal_Conditional_0_Conditional_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
28
+ const _r3 = i0.ɵɵgetCurrentView();
29
+ i0.ɵɵdomElementStart(0, "button", 7);
30
+ i0.ɵɵdomListener("click", function MoleculeModal_Conditional_0_Conditional_3_Conditional_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.close.emit()); });
31
+ i0.ɵɵdomElement(1, "span", 8);
32
+ i0.ɵɵdomElementEnd();
33
+ } if (rf & 2) {
34
+ const ctx_r1 = i0.ɵɵnextContext(3);
35
+ i0.ɵɵclassMap(ctx_r1.closeClass);
36
+ i0.ɵɵattribute("aria-label", ctx_r1.closeAriaLabel);
37
+ i0.ɵɵadvance();
38
+ i0.ɵɵdomProperty("innerHTML", ctx_r1.closeIconSvg, i0.ɵɵsanitizeHtml);
39
+ } }
40
+ function MoleculeModal_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
41
+ i0.ɵɵdomElementStart(0, "div");
42
+ i0.ɵɵconditionalCreate(1, MoleculeModal_Conditional_0_Conditional_3_Conditional_1_Template, 2, 3, "h2", 4)(2, MoleculeModal_Conditional_0_Conditional_3_Conditional_2_Template, 1, 0, "div");
43
+ i0.ɵɵconditionalCreate(3, MoleculeModal_Conditional_0_Conditional_3_Conditional_3_Template, 2, 4, "button", 5);
44
+ i0.ɵɵdomElementEnd();
45
+ } if (rf & 2) {
46
+ const ctx_r1 = i0.ɵɵnextContext(2);
47
+ i0.ɵɵclassMap(ctx_r1.headerClass);
48
+ i0.ɵɵadvance();
49
+ i0.ɵɵconditional(ctx_r1.title ? 1 : ctx_r1.showCloseButton ? 2 : -1);
50
+ i0.ɵɵadvance(2);
51
+ i0.ɵɵconditional(ctx_r1.showCloseButton ? 3 : -1);
52
+ } }
53
+ function MoleculeModal_Conditional_0_Conditional_6_Template(rf, ctx) { if (rf & 1) {
54
+ i0.ɵɵdomElementStart(0, "div");
55
+ i0.ɵɵprojection(1, 1);
56
+ i0.ɵɵdomElementEnd();
57
+ } if (rf & 2) {
58
+ const ctx_r1 = i0.ɵɵnextContext(2);
59
+ i0.ɵɵclassMap(ctx_r1.footerClass);
60
+ } }
61
+ function MoleculeModal_Conditional_0_Template(rf, ctx) { if (rf & 1) {
62
+ const _r1 = i0.ɵɵgetCurrentView();
63
+ i0.ɵɵdomElement(0, "div", 0);
64
+ i0.ɵɵdomElementStart(1, "div", 1);
65
+ i0.ɵɵdomListener("click", function MoleculeModal_Conditional_0_Template_div_click_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onOverlayClick($event)); });
66
+ i0.ɵɵdomElementStart(2, "div", 2);
67
+ i0.ɵɵdomListener("click", function MoleculeModal_Conditional_0_Template_div_click_2_listener($event) { return $event.stopPropagation(); });
68
+ i0.ɵɵconditionalCreate(3, MoleculeModal_Conditional_0_Conditional_3_Template, 4, 4, "div", 3);
69
+ i0.ɵɵdomElementStart(4, "div");
70
+ i0.ɵɵprojection(5);
71
+ i0.ɵɵdomElementEnd();
72
+ i0.ɵɵconditionalCreate(6, MoleculeModal_Conditional_0_Conditional_6_Template, 2, 2, "div", 3);
73
+ i0.ɵɵdomElementEnd()();
74
+ } if (rf & 2) {
75
+ const ctx_r1 = i0.ɵɵnextContext();
76
+ i0.ɵɵclassMap(ctx_r1.overlayClass);
77
+ i0.ɵɵadvance();
78
+ i0.ɵɵstyleMap(ctx_r1.wrapperStyle);
79
+ i0.ɵɵclassMap(ctx_r1.wrapperClass);
80
+ i0.ɵɵadvance();
81
+ i0.ɵɵstyleMap(ctx_r1.style);
82
+ i0.ɵɵclassMap(ctx_r1.contentClasses);
83
+ i0.ɵɵattribute("aria-labelledby", ctx_r1.title ? "modal-title" : null)("data-testid", ctx_r1.testId);
84
+ i0.ɵɵadvance();
85
+ i0.ɵɵconditional(ctx_r1.title || ctx_r1.showCloseButton ? 3 : -1);
86
+ i0.ɵɵadvance();
87
+ i0.ɵɵclassMap(ctx_r1.bodyClass);
88
+ i0.ɵɵadvance(2);
89
+ i0.ɵɵconditional(ctx_r1.hasFooter ? 6 : -1);
90
+ } }
91
+ /**
92
+ * Get the inline style for the modal centering wrapper. `dialogWrapper` has
93
+ * no dedicated ClassMap resolver option (it's a fixed token, not a
94
+ * `{ centered }`-parameterized one), so a top-anchored (non-centered) layout
95
+ * is expressed via the one inline-style exception the workspace styling rule
96
+ * allows for values ClassMap genuinely cannot express.
97
+ *
98
+ * A standalone function (rather than a class member) so it's unit-testable
99
+ * without constructing `MoleculeModal` — the class can't be `new`'d outside
100
+ * an Angular injection context (`sanitizer = inject(DomSanitizer)` runs at
101
+ * field-initializer time).
102
+ * @param centered - Whether the modal is vertically centered.
103
+ * @returns An inline style object, or `undefined` when centered.
104
+ */
105
+ export function getModalWrapperStyle(centered) {
106
+ return centered ? undefined : { alignItems: 'flex-start' };
107
+ }
108
+ /**
109
+ * Angular Modal UI component with UIClassMap-driven styling.
110
+ *
111
+ * `centered` (default `true`) vertically centers the dialog; `centered:
112
+ * false` top-anchors it instead, via `getModalWrapperStyle()`.
113
+ */
114
+ /**
115
+ * Molecule Modal class.
116
+ */
117
+ export class MoleculeModal {
118
+ open = false;
119
+ title;
120
+ size = 'md';
121
+ showCloseButton = true;
122
+ closeLabel;
123
+ closeOnOverlayClick = true;
124
+ closeOnEscape = true;
125
+ centered = true;
126
+ preventScroll = true;
127
+ hasFooter = false;
128
+ className;
129
+ style;
130
+ testId;
131
+ close = new EventEmitter();
132
+ /**
133
+ * Retrieves the current UI class map.
134
+ * @returns The UIClassMap instance for styling.
135
+ */
136
+ get cm() {
137
+ return getClassMap();
138
+ }
139
+ /**
140
+ * Computes the accessible close button label.
141
+ * @returns The localized aria-label for the close button.
142
+ */
143
+ get closeAriaLabel() {
144
+ return this.closeLabel || t('ui.modal.close', undefined, { defaultValue: 'Close' });
145
+ }
146
+ boundEscapeHandler = this.handleEscape.bind(this);
147
+ /**
148
+ * Retrieves the CSS class for the modal wrapper.
149
+ * @returns The wrapper class name string.
150
+ */
151
+ get wrapperClass() {
152
+ return this.cm.dialogWrapper;
153
+ }
154
+ /**
155
+ * Retrieves the inline style for the modal centering wrapper.
156
+ * @returns An inline style object, or `undefined` when centered.
157
+ */
158
+ get wrapperStyle() {
159
+ return getModalWrapperStyle(this.centered);
160
+ }
161
+ /**
162
+ * Retrieves the CSS class for the modal body.
163
+ * @returns The body class name string.
164
+ */
165
+ get bodyClass() {
166
+ return this.cm.dialogBody;
167
+ }
168
+ /**
169
+ * Retrieves the CSS class for the modal overlay.
170
+ * @returns The overlay class name string.
171
+ */
172
+ get overlayClass() {
173
+ return this.cm.dialogOverlay;
174
+ }
175
+ /**
176
+ * Retrieves the CSS class for the modal header.
177
+ * @returns The header class name string.
178
+ */
179
+ get headerClass() {
180
+ return this.cm.dialogHeader;
181
+ }
182
+ /**
183
+ * Retrieves the CSS class for the modal footer.
184
+ * @returns The footer class name string.
185
+ */
186
+ get footerClass() {
187
+ return this.cm.dialogFooter;
188
+ }
189
+ /**
190
+ * Retrieves the CSS class for the modal title.
191
+ * @returns The title class name string.
192
+ */
193
+ get titleClass() {
194
+ return this.cm.dialogTitle;
195
+ }
196
+ /**
197
+ * Retrieves the CSS class for the close button.
198
+ * @returns The close button class name string.
199
+ */
200
+ get closeClass() {
201
+ return this.cm.dialogClose;
202
+ }
203
+ sanitizer = inject(DomSanitizer);
204
+ /**
205
+ * Generates the SVG markup for the close button icon.
206
+ * @returns The sanitized SVG for the close icon.
207
+ */
208
+ get closeIconSvg() {
209
+ return this.sanitizer.bypassSecurityTrustHtml(getIconSvg('x-mark', this.cm.iconMd));
210
+ }
211
+ /**
212
+ * Computes the combined CSS classes for the modal content.
213
+ * @returns The modal content class name string.
214
+ */
215
+ get contentClasses() {
216
+ return this.cm.cn(this.cm.modal({ size: this.size }), this.className);
217
+ }
218
+ /**
219
+ * Initializes event listeners on component creation.
220
+ */
221
+ ngOnInit() {
222
+ this.updateListeners();
223
+ }
224
+ /**
225
+ * Handles input property changes.
226
+ * @param changes - The changed input properties.
227
+ */
228
+ ngOnChanges(changes) {
229
+ if (changes['open']) {
230
+ this.updateListeners();
231
+ this.updateBodyScroll();
232
+ }
233
+ }
234
+ /**
235
+ * Cleans up event listeners and body scroll on component destruction.
236
+ */
237
+ ngOnDestroy() {
238
+ document.removeEventListener('keydown', this.boundEscapeHandler);
239
+ if (this.preventScroll) {
240
+ document.body.style.overflow = '';
241
+ }
242
+ }
243
+ /**
244
+ * Adds or removes the keyboard escape listener based on open state.
245
+ */
246
+ updateListeners() {
247
+ if (this.open) {
248
+ document.addEventListener('keydown', this.boundEscapeHandler);
249
+ }
250
+ else {
251
+ document.removeEventListener('keydown', this.boundEscapeHandler);
252
+ }
253
+ }
254
+ /**
255
+ * Updates the document body overflow based on open state.
256
+ */
257
+ updateBodyScroll() {
258
+ if (this.preventScroll) {
259
+ document.body.style.overflow = this.open ? 'hidden' : '';
260
+ }
261
+ }
262
+ /**
263
+ * Handles escape key press to close the modal.
264
+ * @param e - The keyboard event.
265
+ */
266
+ handleEscape(e) {
267
+ if (this.closeOnEscape && e.key === 'Escape') {
268
+ this.close.emit();
269
+ }
270
+ }
271
+ /**
272
+ * Handles overlay click to close the modal.
273
+ * @param event - The mouse event from the overlay click.
274
+ */
275
+ onOverlayClick(event) {
276
+ if (this.closeOnOverlayClick && event.target === event.currentTarget) {
277
+ this.close.emit();
278
+ }
279
+ }
280
+ static ɵfac = function MoleculeModal_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MoleculeModal)(); };
281
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MoleculeModal, selectors: [["mol-modal"]], inputs: { open: "open", title: "title", size: "size", showCloseButton: "showCloseButton", closeLabel: "closeLabel", closeOnOverlayClick: "closeOnOverlayClick", closeOnEscape: "closeOnEscape", centered: "centered", preventScroll: "preventScroll", hasFooter: "hasFooter", className: "className", style: "style", testId: "testId" }, outputs: { close: "close" }, features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c1, decls: 1, vars: 1, consts: [["aria-hidden", "true"], [3, "click"], ["role", "dialog", "aria-modal", "true", 3, "click"], [3, "class"], ["id", "modal-title", 3, "class"], ["type", "button", 3, "class"], ["id", "modal-title"], ["type", "button", 3, "click"], [3, "innerHTML"]], template: function MoleculeModal_Template(rf, ctx) { if (rf & 1) {
282
+ i0.ɵɵprojectionDef(_c0);
283
+ i0.ɵɵconditionalCreate(0, MoleculeModal_Conditional_0_Template, 7, 16);
284
+ } if (rf & 2) {
285
+ i0.ɵɵconditional(ctx.open ? 0 : -1);
286
+ } }, encapsulation: 2 });
287
+ }
288
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeModal, [{
289
+ type: Component,
290
+ args: [{
291
+ selector: 'mol-modal',
292
+ standalone: true,
293
+ changeDetection: ChangeDetectionStrategy.OnPush,
294
+ template: `
295
+ @if (open) {
296
+ <!-- Overlay background -->
297
+ <div [class]="overlayClass" aria-hidden="true"></div>
298
+
299
+ <!-- Centering wrapper -->
300
+ <div [class]="wrapperClass" [style]="wrapperStyle" (click)="onOverlayClick($event)">
301
+ <!-- Content -->
302
+ <div
303
+ role="dialog"
304
+ aria-modal="true"
305
+ [attr.aria-labelledby]="title ? 'modal-title' : null"
306
+ [class]="contentClasses"
307
+ [style]="style"
308
+ [attr.data-testid]="testId"
309
+ (click)="$event.stopPropagation()"
310
+ >
311
+ @if (title || showCloseButton) {
312
+ <div [class]="headerClass">
313
+ @if (title) {
314
+ <h2 id="modal-title" [class]="titleClass">{{ title }}</h2>
315
+ } @else if (showCloseButton) {
316
+ <div></div>
317
+ }
318
+ @if (showCloseButton) {
319
+ <button
320
+ type="button"
321
+ (click)="close.emit()"
322
+ [class]="closeClass"
323
+ [attr.aria-label]="closeAriaLabel"
324
+ >
325
+ <span [innerHTML]="closeIconSvg"></span>
326
+ </button>
327
+ }
328
+ </div>
329
+ }
330
+
331
+ <div [class]="bodyClass">
332
+ <ng-content></ng-content>
333
+ </div>
334
+
335
+ @if (hasFooter) {
336
+ <div [class]="footerClass">
337
+ <ng-content select="[modal-footer]"></ng-content>
338
+ </div>
339
+ }
340
+ </div>
341
+ </div>
342
+ }
343
+ `,
344
+ }]
345
+ }], null, { open: [{
346
+ type: Input
347
+ }], title: [{
348
+ type: Input
349
+ }], size: [{
350
+ type: Input
351
+ }], showCloseButton: [{
352
+ type: Input
353
+ }], closeLabel: [{
354
+ type: Input
355
+ }], closeOnOverlayClick: [{
356
+ type: Input
357
+ }], closeOnEscape: [{
358
+ type: Input
359
+ }], centered: [{
360
+ type: Input
361
+ }], preventScroll: [{
362
+ type: Input
363
+ }], hasFooter: [{
364
+ type: Input
365
+ }], className: [{
366
+ type: Input
367
+ }], style: [{
368
+ type: Input
369
+ }], testId: [{
370
+ type: Input
371
+ }], close: [{
372
+ type: Output
373
+ }] }); })();
374
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeModal, { className: "MoleculeModal", filePath: "components/modal.component.ts", lineNumber: 109 }); })();
375
+ //# sourceMappingURL=modal.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.component.js","sourceRoot":"","sources":["../../src/components/modal.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,KAAK,EAIL,MAAM,GAEP,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAiB,MAAM,2BAA2B,CAAA;AAEvE,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;;;;;IAkDxC,gCAA0C;IAAA,YAAW;IAAA,oBAAK;;;IAArC,gCAAoB;IAAC,cAAW;IAAX,kCAAW;;;IAErD,yBAAW;;;;IAGX,oCAKC;IAHC,iNAAS,mBAAY,KAAC;IAItB,6BAAwC;IAC1C,oBAAS;;;IAJP,gCAAoB;;IAGd,cAA0B;IAA1B,qEAA0B;;;IAbtC,8BAA2B;IAGvB,AAFF,0GAAa,kFAEiB;IAG9B,8GAAuB;IAUzB,oBAAM;;;IAhBD,iCAAqB;IACxB,cAIC;IAJD,oEAIC;IACD,eASC;IATD,iDASC;;;IASH,8BAA2B;IACzB,qBAAiD;IACnD,oBAAM;;;IAFD,iCAAqB;;;;IAvChC,4BAAqD;IAG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AAC,MAAM,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;YACrE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;uGAvLU,aAAa;6DAAb,aAAa;;YArDtB,sEAAY;;YAAZ,mCA+CC;;;iFAMQ,aAAa;cA1DzB,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDT;aACF;;kBAKE,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kFAfI,aAAa"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Angular RadioGroup UI component with UIClassMap-driven styling.
3
+ *
4
+ * @module
5
+ */
6
+ import { EventEmitter } from '@angular/core';
7
+ import type { RadioOption, Size, UIClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * Angular RadioGroup UI component with UIClassMap-driven styling.
11
+ */
12
+ export declare class MoleculeRadioGroup {
13
+ options: RadioOption<string>[];
14
+ value?: string;
15
+ size?: Size;
16
+ label?: string;
17
+ direction: 'horizontal' | 'vertical';
18
+ error?: string;
19
+ className?: string;
20
+ style?: Record<string, string>;
21
+ testId?: string;
22
+ disabled: boolean;
23
+ valueChange: EventEmitter<string>;
24
+ /**
25
+ * Retrieves the current UI class map.
26
+ * @returns The UIClassMap instance for styling.
27
+ */
28
+ get cm(): UIClassMap;
29
+ /**
30
+ * Computes the CSS classes for the radio group label.
31
+ * @returns The group label class name string.
32
+ */
33
+ get groupLabelClasses(): string;
34
+ /**
35
+ * Computes the CSS classes for the layout direction.
36
+ * @returns The direction layout class name string.
37
+ */
38
+ get directionClasses(): string;
39
+ /**
40
+ * Computes the CSS classes for radio input elements.
41
+ * @returns The radio input class name string.
42
+ */
43
+ get radioClasses(): string;
44
+ /**
45
+ * Computes the CSS classes for the error message.
46
+ * @returns The error class name string.
47
+ */
48
+ get errorClasses(): string;
49
+ /**
50
+ * Computes the CSS classes for an individual radio option label.
51
+ * @param option - The radio option to compute classes for.
52
+ * @returns The option label class name string.
53
+ */
54
+ getOptionLabelClasses(option: RadioOption<string>): string;
55
+ /**
56
+ * Handles radio option selection change.
57
+ * @param optionValue - The value of the selected radio option.
58
+ */
59
+ onRadioChange(optionValue: string): void;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<MoleculeRadioGroup, never>;
61
+ static ɵcmp: i0.ɵɵComponentDeclaration<MoleculeRadioGroup, "mol-radio-group", never, { "options": { "alias": "options"; "required": false; }; "value": { "alias": "value"; "required": false; }; "size": { "alias": "size"; "required": false; }; "label": { "alias": "label"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "error": { "alias": "error"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
62
+ }
63
+ //# sourceMappingURL=radio-group.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.component.d.ts","sourceRoot":"","sources":["../../src/components/radio-group.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsC,YAAY,EAAiB,MAAM,eAAe,CAAA;AAE/F,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAGrE;;GAEG;AACH,qBAyCa,kBAAkB;IACpB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAK;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,YAAY,GAAG,UAAU,CAAa;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,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;IAEf,WAAW,uBAA6B;IAElD;;;OAGG;IACH,IAAI,EAAE,IAAI,UAAU,CAEnB;IAED;;;OAGG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM;IAK1D;;;OAGG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;yCApE7B,kBAAkB;2CAAlB,kBAAkB;CAuE9B"}