@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.
Files changed (308) hide show
  1. package/README.md +11742 -1145
  2. package/dist/components/accordion.component.d.ts +114 -0
  3. package/dist/components/accordion.component.d.ts.map +1 -0
  4. package/dist/components/accordion.component.js +286 -0
  5. package/dist/components/accordion.component.js.map +1 -0
  6. package/dist/components/alert.component.d.ts +81 -37
  7. package/dist/components/alert.component.d.ts.map +1 -1
  8. package/dist/components/alert.component.js +232 -146
  9. package/dist/components/alert.component.js.map +1 -1
  10. package/dist/components/auth-guard.component.d.ts +94 -0
  11. package/dist/components/auth-guard.component.d.ts.map +1 -0
  12. package/dist/components/auth-guard.component.js +212 -0
  13. package/dist/components/auth-guard.component.js.map +1 -0
  14. package/dist/components/avatar.component.d.ts +97 -0
  15. package/dist/components/avatar.component.d.ts.map +1 -0
  16. package/dist/components/avatar.component.js +216 -0
  17. package/dist/components/avatar.component.js.map +1 -0
  18. package/dist/components/badge.component.d.ts +27 -12
  19. package/dist/components/badge.component.d.ts.map +1 -1
  20. package/dist/components/badge.component.js +47 -47
  21. package/dist/components/badge.component.js.map +1 -1
  22. package/dist/components/button.component.d.ts +96 -14
  23. package/dist/components/button.component.d.ts.map +1 -1
  24. package/dist/components/button.component.js +232 -87
  25. package/dist/components/button.component.js.map +1 -1
  26. package/dist/components/card.component.d.ts +135 -0
  27. package/dist/components/card.component.d.ts.map +1 -0
  28. package/dist/components/card.component.js +291 -0
  29. package/dist/components/card.component.js.map +1 -0
  30. package/dist/components/checkbox.component.d.ts +102 -29
  31. package/dist/components/checkbox.component.d.ts.map +1 -1
  32. package/dist/components/checkbox.component.js +222 -113
  33. package/dist/components/checkbox.component.js.map +1 -1
  34. package/dist/components/confirm-button.component.d.ts +130 -0
  35. package/dist/components/confirm-button.component.d.ts.map +1 -0
  36. package/dist/components/confirm-button.component.js +322 -0
  37. package/dist/components/confirm-button.component.js.map +1 -0
  38. package/dist/components/confirm-dialog.component.d.ts +60 -0
  39. package/dist/components/confirm-dialog.component.d.ts.map +1 -0
  40. package/dist/components/confirm-dialog.component.js +152 -0
  41. package/dist/components/confirm-dialog.component.js.map +1 -0
  42. package/dist/components/dropdown.component.d.ts +313 -0
  43. package/dist/components/dropdown.component.d.ts.map +1 -0
  44. package/dist/components/dropdown.component.js +919 -0
  45. package/dist/components/dropdown.component.js.map +1 -0
  46. package/dist/components/empty-state.component.d.ts +73 -0
  47. package/dist/components/empty-state.component.d.ts.map +1 -0
  48. package/dist/components/empty-state.component.js +180 -0
  49. package/dist/components/empty-state.component.js.map +1 -0
  50. package/dist/components/floating-input.component.d.ts +86 -0
  51. package/dist/components/floating-input.component.d.ts.map +1 -0
  52. package/dist/components/floating-input.component.js +167 -0
  53. package/dist/components/floating-input.component.js.map +1 -0
  54. package/dist/components/form-field.component.d.ts +111 -0
  55. package/dist/components/form-field.component.d.ts.map +1 -0
  56. package/dist/components/form-field.component.js +300 -0
  57. package/dist/components/form-field.component.js.map +1 -0
  58. package/dist/components/form.component.d.ts +77 -0
  59. package/dist/components/form.component.d.ts.map +1 -0
  60. package/dist/components/form.component.js +222 -0
  61. package/dist/components/form.component.js.map +1 -0
  62. package/dist/components/icon.component.d.ts +85 -0
  63. package/dist/components/icon.component.d.ts.map +1 -0
  64. package/dist/components/icon.component.js +187 -0
  65. package/dist/components/icon.component.js.map +1 -0
  66. package/dist/components/index.d.ts +49 -0
  67. package/dist/components/index.d.ts.map +1 -1
  68. package/dist/components/index.js +49 -0
  69. package/dist/components/index.js.map +1 -1
  70. package/dist/components/input.component.d.ts +157 -54
  71. package/dist/components/input.component.d.ts.map +1 -1
  72. package/dist/components/input.component.js +437 -222
  73. package/dist/components/input.component.js.map +1 -1
  74. package/dist/components/label.component.d.ts +29 -0
  75. package/dist/components/label.component.d.ts.map +1 -0
  76. package/dist/components/label.component.js +60 -0
  77. package/dist/components/label.component.js.map +1 -0
  78. package/dist/components/language-picker.component.d.ts +124 -0
  79. package/dist/components/language-picker.component.d.ts.map +1 -0
  80. package/dist/components/language-picker.component.js +305 -0
  81. package/dist/components/language-picker.component.js.map +1 -0
  82. package/dist/components/layout.component.d.ts +167 -0
  83. package/dist/components/layout.component.d.ts.map +1 -0
  84. package/dist/components/layout.component.js +364 -0
  85. package/dist/components/layout.component.js.map +1 -0
  86. package/dist/components/load-error-banner.component.d.ts +103 -0
  87. package/dist/components/load-error-banner.component.d.ts.map +1 -0
  88. package/dist/components/load-error-banner.component.js +263 -0
  89. package/dist/components/load-error-banner.component.js.map +1 -0
  90. package/dist/components/modal.component.d.ts +125 -95
  91. package/dist/components/modal.component.d.ts.map +1 -1
  92. package/dist/components/modal.component.js +458 -271
  93. package/dist/components/modal.component.js.map +1 -1
  94. package/dist/components/molecule/alert.component.d.ts +77 -0
  95. package/dist/components/molecule/alert.component.d.ts.map +1 -0
  96. package/dist/components/molecule/alert.component.js +229 -0
  97. package/dist/components/molecule/alert.component.js.map +1 -0
  98. package/dist/components/molecule/badge.component.d.ts +27 -0
  99. package/dist/components/molecule/badge.component.d.ts.map +1 -0
  100. package/dist/components/molecule/badge.component.js +79 -0
  101. package/dist/components/molecule/badge.component.js.map +1 -0
  102. package/dist/components/molecule/button.component.d.ts +38 -0
  103. package/dist/components/molecule/button.component.d.ts.map +1 -0
  104. package/dist/components/molecule/button.component.js +137 -0
  105. package/dist/components/molecule/button.component.js.map +1 -0
  106. package/dist/components/molecule/checkbox.component.d.ts +53 -0
  107. package/dist/components/molecule/checkbox.component.d.ts.map +1 -0
  108. package/dist/components/molecule/checkbox.component.js +166 -0
  109. package/dist/components/molecule/checkbox.component.js.map +1 -0
  110. package/dist/components/molecule/index.d.ts +18 -0
  111. package/dist/components/molecule/index.d.ts.map +1 -0
  112. package/dist/components/molecule/index.js +18 -0
  113. package/dist/components/molecule/index.js.map +1 -0
  114. package/dist/components/molecule/input.component.d.ts +93 -0
  115. package/dist/components/molecule/input.component.d.ts.map +1 -0
  116. package/dist/components/molecule/input.component.js +314 -0
  117. package/dist/components/molecule/input.component.js.map +1 -0
  118. package/dist/components/molecule/modal.component.d.ts +148 -0
  119. package/dist/components/molecule/modal.component.d.ts.map +1 -0
  120. package/dist/components/molecule/modal.component.js +382 -0
  121. package/dist/components/molecule/modal.component.js.map +1 -0
  122. package/dist/components/molecule/radio-group.component.d.ts +63 -0
  123. package/dist/components/molecule/radio-group.component.d.ts.map +1 -0
  124. package/dist/components/molecule/radio-group.component.js +208 -0
  125. package/dist/components/molecule/radio-group.component.js.map +1 -0
  126. package/dist/components/molecule/select.component.d.ts +72 -0
  127. package/dist/components/molecule/select.component.d.ts.map +1 -0
  128. package/dist/components/molecule/select.component.js +274 -0
  129. package/dist/components/molecule/select.component.js.map +1 -0
  130. package/dist/components/molecule/spinner.component.d.ts +42 -0
  131. package/dist/components/molecule/spinner.component.d.ts.map +1 -0
  132. package/dist/components/molecule/spinner.component.js +122 -0
  133. package/dist/components/molecule/spinner.component.js.map +1 -0
  134. package/dist/components/molecule/switch.component.d.ts +54 -0
  135. package/dist/components/molecule/switch.component.d.ts.map +1 -0
  136. package/dist/components/molecule/switch.component.js +148 -0
  137. package/dist/components/molecule/switch.component.js.map +1 -0
  138. package/dist/components/molecule/toast.component.d.ts +98 -0
  139. package/dist/components/molecule/toast.component.d.ts.map +1 -0
  140. package/dist/components/molecule/toast.component.js +305 -0
  141. package/dist/components/molecule/toast.component.js.map +1 -0
  142. package/dist/components/molecule/tooltip.component.d.ts +77 -0
  143. package/dist/components/molecule/tooltip.component.d.ts.map +1 -0
  144. package/dist/components/molecule/tooltip.component.js +316 -0
  145. package/dist/components/molecule/tooltip.component.js.map +1 -0
  146. package/dist/components/optimistic-toggle-button.component.d.ts +125 -0
  147. package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -0
  148. package/dist/components/optimistic-toggle-button.component.js +296 -0
  149. package/dist/components/optimistic-toggle-button.component.js.map +1 -0
  150. package/dist/components/page-header.component.d.ts +77 -0
  151. package/dist/components/page-header.component.d.ts.map +1 -0
  152. package/dist/components/page-header.component.js +225 -0
  153. package/dist/components/page-header.component.js.map +1 -0
  154. package/dist/components/page-shell.component.d.ts +101 -0
  155. package/dist/components/page-shell.component.d.ts.map +1 -0
  156. package/dist/components/page-shell.component.js +221 -0
  157. package/dist/components/page-shell.component.js.map +1 -0
  158. package/dist/components/pagination.component.d.ts +137 -0
  159. package/dist/components/pagination.component.d.ts.map +1 -0
  160. package/dist/components/pagination.component.js +419 -0
  161. package/dist/components/pagination.component.js.map +1 -0
  162. package/dist/components/panel-close.component.d.ts +43 -0
  163. package/dist/components/panel-close.component.d.ts.map +1 -0
  164. package/dist/components/panel-close.component.js +75 -0
  165. package/dist/components/panel-close.component.js.map +1 -0
  166. package/dist/components/progress.component.d.ts +84 -0
  167. package/dist/components/progress.component.d.ts.map +1 -0
  168. package/dist/components/progress.component.js +219 -0
  169. package/dist/components/progress.component.js.map +1 -0
  170. package/dist/components/prompt-dialog.component.d.ts +121 -0
  171. package/dist/components/prompt-dialog.component.d.ts.map +1 -0
  172. package/dist/components/prompt-dialog.component.js +332 -0
  173. package/dist/components/prompt-dialog.component.js.map +1 -0
  174. package/dist/components/radio-group.component.d.ts +66 -34
  175. package/dist/components/radio-group.component.d.ts.map +1 -1
  176. package/dist/components/radio-group.component.js +146 -125
  177. package/dist/components/radio-group.component.js.map +1 -1
  178. package/dist/components/responsive-app-shell.component.d.ts +408 -0
  179. package/dist/components/responsive-app-shell.component.d.ts.map +1 -0
  180. package/dist/components/responsive-app-shell.component.js +1144 -0
  181. package/dist/components/responsive-app-shell.component.js.map +1 -0
  182. package/dist/components/select.component.d.ts +135 -38
  183. package/dist/components/select.component.d.ts.map +1 -1
  184. package/dist/components/select.component.js +373 -181
  185. package/dist/components/select.component.js.map +1 -1
  186. package/dist/components/separator.component.d.ts +39 -0
  187. package/dist/components/separator.component.d.ts.map +1 -0
  188. package/dist/components/separator.component.js +73 -0
  189. package/dist/components/separator.component.js.map +1 -0
  190. package/dist/components/sidebar-user-card.component.d.ts +106 -0
  191. package/dist/components/sidebar-user-card.component.d.ts.map +1 -0
  192. package/dist/components/sidebar-user-card.component.js +277 -0
  193. package/dist/components/sidebar-user-card.component.js.map +1 -0
  194. package/dist/components/skeleton.component.d.ts +100 -0
  195. package/dist/components/skeleton.component.d.ts.map +1 -0
  196. package/dist/components/skeleton.component.js +214 -0
  197. package/dist/components/skeleton.component.js.map +1 -0
  198. package/dist/components/spinner.component.d.ts +36 -19
  199. package/dist/components/spinner.component.d.ts.map +1 -1
  200. package/dist/components/spinner.component.js +69 -71
  201. package/dist/components/spinner.component.js.map +1 -1
  202. package/dist/components/switch.component.d.ts +72 -29
  203. package/dist/components/switch.component.d.ts.map +1 -1
  204. package/dist/components/switch.component.js +163 -91
  205. package/dist/components/switch.component.js.map +1 -1
  206. package/dist/components/table.component.d.ts +193 -0
  207. package/dist/components/table.component.d.ts.map +1 -0
  208. package/dist/components/table.component.js +550 -0
  209. package/dist/components/table.component.js.map +1 -0
  210. package/dist/components/tabs.component.d.ts +140 -0
  211. package/dist/components/tabs.component.d.ts.map +1 -0
  212. package/dist/components/tabs.component.js +390 -0
  213. package/dist/components/tabs.component.js.map +1 -0
  214. package/dist/components/template-outlet.directive.d.ts +50 -0
  215. package/dist/components/template-outlet.directive.d.ts.map +1 -0
  216. package/dist/components/template-outlet.directive.js +81 -0
  217. package/dist/components/template-outlet.directive.js.map +1 -0
  218. package/dist/components/textarea.component.d.ts +151 -0
  219. package/dist/components/textarea.component.d.ts.map +1 -0
  220. package/dist/components/textarea.component.js +340 -0
  221. package/dist/components/textarea.component.js.map +1 -0
  222. package/dist/components/theme-toggle.component.d.ts +58 -0
  223. package/dist/components/theme-toggle.component.d.ts.map +1 -0
  224. package/dist/components/theme-toggle.component.js +124 -0
  225. package/dist/components/theme-toggle.component.js.map +1 -0
  226. package/dist/components/toast.component.d.ts +237 -49
  227. package/dist/components/toast.component.d.ts.map +1 -1
  228. package/dist/components/toast.component.js +636 -201
  229. package/dist/components/toast.component.js.map +1 -1
  230. package/dist/components/tooltip.component.d.ts +95 -45
  231. package/dist/components/tooltip.component.d.ts.map +1 -1
  232. package/dist/components/tooltip.component.js +372 -221
  233. package/dist/components/tooltip.component.js.map +1 -1
  234. package/dist/components/user-menu-popover.component.d.ts +283 -0
  235. package/dist/components/user-menu-popover.component.d.ts.map +1 -0
  236. package/dist/components/user-menu-popover.component.js +646 -0
  237. package/dist/components/user-menu-popover.component.js.map +1 -0
  238. package/dist/components/user-menu.component.d.ts +95 -0
  239. package/dist/components/user-menu.component.d.ts.map +1 -0
  240. package/dist/components/user-menu.component.js +218 -0
  241. package/dist/components/user-menu.component.js.map +1 -0
  242. package/dist/hooks/index.d.ts +7 -0
  243. package/dist/hooks/index.d.ts.map +1 -0
  244. package/dist/hooks/index.js +7 -0
  245. package/dist/hooks/index.js.map +1 -0
  246. package/dist/hooks/use-is-desktop.d.ts +22 -0
  247. package/dist/hooks/use-is-desktop.d.ts.map +1 -0
  248. package/dist/hooks/use-is-desktop.js +37 -0
  249. package/dist/hooks/use-is-desktop.js.map +1 -0
  250. package/dist/index.d.ts +32 -17
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js +32 -17
  253. package/dist/index.js.map +1 -1
  254. package/dist/types.d.ts +1 -1
  255. package/dist/types.d.ts.map +1 -1
  256. package/dist/utilities/dom-context.d.ts +42 -0
  257. package/dist/utilities/dom-context.d.ts.map +1 -0
  258. package/dist/utilities/dom-context.js +66 -0
  259. package/dist/utilities/dom-context.js.map +1 -0
  260. package/dist/utilities/focus.d.ts +32 -0
  261. package/dist/utilities/focus.d.ts.map +1 -0
  262. package/dist/utilities/focus.js +47 -0
  263. package/dist/utilities/focus.js.map +1 -0
  264. package/dist/utilities/form-field-context.d.ts +34 -0
  265. package/dist/utilities/form-field-context.d.ts.map +1 -0
  266. package/dist/utilities/form-field-context.js +28 -0
  267. package/dist/utilities/form-field-context.js.map +1 -0
  268. package/dist/utilities/form-submit-error.d.ts +17 -0
  269. package/dist/utilities/form-submit-error.d.ts.map +1 -0
  270. package/dist/utilities/form-submit-error.js +42 -0
  271. package/dist/utilities/form-submit-error.js.map +1 -0
  272. package/dist/utilities/icon-markup.d.ts +17 -0
  273. package/dist/utilities/icon-markup.d.ts.map +1 -0
  274. package/dist/utilities/icon-markup.js +46 -0
  275. package/dist/utilities/icon-markup.js.map +1 -0
  276. package/dist/utilities/ids.d.ts +15 -0
  277. package/dist/utilities/ids.d.ts.map +1 -0
  278. package/dist/utilities/ids.js +19 -0
  279. package/dist/utilities/ids.js.map +1 -0
  280. package/dist/utilities/index.d.ts +11 -0
  281. package/dist/utilities/index.d.ts.map +1 -1
  282. package/dist/utilities/index.js +11 -0
  283. package/dist/utilities/index.js.map +1 -1
  284. package/dist/utilities/initials.d.ts +13 -0
  285. package/dist/utilities/initials.d.ts.map +1 -0
  286. package/dist/utilities/initials.js +23 -0
  287. package/dist/utilities/initials.js.map +1 -0
  288. package/dist/utilities/node-value.d.ts +31 -0
  289. package/dist/utilities/node-value.d.ts.map +1 -0
  290. package/dist/utilities/node-value.js +37 -0
  291. package/dist/utilities/node-value.js.map +1 -0
  292. package/dist/utilities/optimistic-value.d.ts +81 -0
  293. package/dist/utilities/optimistic-value.d.ts.map +1 -0
  294. package/dist/utilities/optimistic-value.js +154 -0
  295. package/dist/utilities/optimistic-value.js.map +1 -0
  296. package/dist/utilities/render-icon.d.ts +77 -7
  297. package/dist/utilities/render-icon.d.ts.map +1 -1
  298. package/dist/utilities/render-icon.js +123 -33
  299. package/dist/utilities/render-icon.js.map +1 -1
  300. package/dist/utilities/rest-attrs.d.ts +21 -0
  301. package/dist/utilities/rest-attrs.d.ts.map +1 -0
  302. package/dist/utilities/rest-attrs.js +37 -0
  303. package/dist/utilities/rest-attrs.js.map +1 -0
  304. package/dist/utilities/style.d.ts +23 -0
  305. package/dist/utilities/style.d.ts.map +1 -0
  306. package/dist/utilities/style.js +86 -0
  307. package/dist/utilities/style.js.map +1 -0
  308. package/package.json +10 -5
@@ -1,375 +1,562 @@
1
1
  /**
2
- * Angular Modal UI component with UIClassMap-driven styling.
2
+ * Modal component (React parity): a `document.body` portal dialog.
3
3
  *
4
4
  * @module
5
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';
6
+ import { Component, ElementRef, EventEmitter, inject, Output, ViewChild, } from '@angular/core';
7
+ import { useTranslation } from '@molecule/app-angular';
9
8
  import { getClassMap } from '@molecule/app-ui';
10
- import { getIconSvg } from '../utilities/render-icon.js';
9
+ import { createScrollLock, getFocusableElements } from '../utilities/focus.js';
10
+ import { MolIconSvg, resolveIcon } from '../utilities/render-icon.js';
11
+ import { moveRestAttributes } from '../utilities/rest-attrs.js';
12
+ import { styleText } from '../utilities/style.js';
11
13
  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();
14
+ const _c0 = ["overlay"];
15
+ const _c1 = ["wrapper"];
16
+ const _c2 = ["dialog"];
17
+ const _c3 = ["footerSlot"];
18
+ const _c4 = ["*", [["", "slot", "footer"]]];
19
+ const _c5 = ["*", "[slot=footer]"];
20
+ function Modal_Conditional_6_Conditional_3_Template(rf, ctx) { if (rf & 1) {
21
+ const _r1 = i0.ɵɵgetCurrentView();
22
+ i0.ɵɵelementStart(0, "button", 10);
23
+ i0.ɵɵlistener("click", function Modal_Conditional_6_Conditional_3_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.requestCloseFromButton($event)); });
24
+ i0.ɵɵnamespaceSVG();
25
+ i0.ɵɵelement(1, "svg", 11);
26
+ i0.ɵɵelementEnd();
18
27
  } if (rf & 2) {
19
- const ctx_r1 = i0.ɵɵnextContext(3);
20
- i0.ɵɵclassMap(ctx_r1.titleClass);
28
+ const ctx_r1 = i0.ɵɵnextContext(2);
29
+ i0.ɵɵclassMap(ctx_r1.cm().dialogClose);
30
+ i0.ɵɵattribute("aria-label", ctx_r1.closeText());
21
31
  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");
32
+ i0.ɵɵproperty("data", ctx_r1.closeIcon());
26
33
  } }
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();
34
+ function Modal_Conditional_6_Template(rf, ctx) { if (rf & 1) {
35
+ i0.ɵɵelementStart(0, "div")(1, "h2", 8);
36
+ i0.ɵɵtext(2);
37
+ i0.ɵɵelementEnd();
38
+ i0.ɵɵconditionalCreate(3, Modal_Conditional_6_Conditional_3_Template, 2, 4, "button", 9);
39
+ i0.ɵɵelementEnd();
33
40
  } if (rf & 2) {
34
- const ctx_r1 = i0.ɵɵnextContext(3);
35
- i0.ɵɵclassMap(ctx_r1.closeClass);
36
- i0.ɵɵattribute("aria-label", ctx_r1.closeAriaLabel);
41
+ const ctx_r1 = i0.ɵɵnextContext();
42
+ i0.ɵɵclassMap(ctx_r1.cm().dialogHeader);
37
43
  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);
44
+ i0.ɵɵclassMap(ctx_r1.cm().dialogTitle);
45
+ i0.ɵɵproperty("id", ctx_r1.titleId);
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵtextInterpolate(ctx_r1.title);
48
48
  i0.ɵɵadvance();
49
- i0.ɵɵconditional(ctx_r1.title ? 1 : ctx_r1.showCloseButton ? 2 : -1);
50
- i0.ɵɵadvance(2);
51
49
  i0.ɵɵconditional(ctx_r1.showCloseButton ? 3 : -1);
52
50
  } }
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();
51
+ function Modal_Conditional_7_Conditional_0_Template(rf, ctx) { if (rf & 1) {
52
+ const _r3 = i0.ɵɵgetCurrentView();
53
+ i0.ɵɵelementStart(0, "button", 10);
54
+ i0.ɵɵlistener("click", function Modal_Conditional_7_Conditional_0_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.requestCloseFromButton($event)); });
55
+ i0.ɵɵnamespaceSVG();
56
+ i0.ɵɵelement(1, "svg", 11);
57
+ i0.ɵɵelementEnd();
57
58
  } if (rf & 2) {
58
59
  const ctx_r1 = i0.ɵɵnextContext(2);
59
- i0.ɵɵclassMap(ctx_r1.footerClass);
60
+ i0.ɵɵclassMap(ctx_r1.cm().dialogCloseFloating);
61
+ i0.ɵɵattribute("aria-label", ctx_r1.closeText());
62
+ i0.ɵɵadvance();
63
+ i0.ɵɵproperty("data", ctx_r1.closeIcon());
60
64
  } }
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()();
65
+ function Modal_Conditional_7_Template(rf, ctx) { if (rf & 1) {
66
+ i0.ɵɵconditionalCreate(0, Modal_Conditional_7_Conditional_0_Template, 2, 4, "button", 9);
74
67
  } if (rf & 2) {
75
68
  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);
69
+ i0.ɵɵconditional(ctx_r1.showCloseButton ? 0 : -1);
90
70
  } }
71
+ /** Module-level open-modal stack (Escape/Tab act only for the topmost). */
72
+ const openModalStack = [];
73
+ /** Pushes a modal onto the stack (it becomes the topmost). */
74
+ const pushModalStack = (id) => {
75
+ if (!openModalStack.includes(id))
76
+ openModalStack.push(id);
77
+ };
78
+ /** Removes a modal from the stack. */
79
+ const popModalStack = (id) => {
80
+ const index = openModalStack.indexOf(id);
81
+ if (index !== -1)
82
+ openModalStack.splice(index, 1);
83
+ };
84
+ /** Whether the given modal is currently the topmost of the stack. */
85
+ const isTopOfModalStack = (id) => openModalStack.length > 0 && openModalStack[openModalStack.length - 1] === id;
86
+ let modalInstance = 0;
91
87
  /**
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.
88
+ * Modal component.
110
89
  *
111
- * `centered` (default `true`) vertically centers the dialog; `centered:
112
- * false` top-anchors it instead, via `getModalWrapperStyle()`.
90
+ * React's root is a FRAGMENT portaled into `document.body` (an overlay
91
+ * `<div>` and a centering wrapper `<div>`), so the host is unwrapped
92
+ * (`data-parity-unwrap`, `display: contents`) and both elements are moved
93
+ * into the body. Implements the WAI-ARIA APG modal dialog pattern (focus
94
+ * into the dialog on open, trapped Tab, focus restored on close, Escape for
95
+ * the topmost dialog only, reference-counted body scroll lock).
113
96
  */
114
- /**
115
- * Molecule Modal class.
116
- */
117
- export class MoleculeModal {
97
+ export class Modal {
98
+ /** Whether the dialog is open. */
118
99
  open = false;
100
+ /** The dialog title. */
119
101
  title;
102
+ /** Dialog width preset. */
120
103
  size = 'md';
104
+ /** Whether the header/close button renders. */
121
105
  showCloseButton = true;
122
- closeLabel;
106
+ /** Whether clicking the overlay closes the dialog. */
123
107
  closeOnOverlayClick = true;
108
+ /** Whether Escape closes the dialog. */
124
109
  closeOnEscape = true;
110
+ /** Footer content (node-valued prop). */
111
+ footer;
112
+ /** Whether the dialog is vertically centered. */
125
113
  centered = true;
114
+ /** The close button's accessible label. */
115
+ closeLabel;
116
+ /** Whether body scroll is locked while open. */
126
117
  preventScroll = true;
127
- hasFooter = false;
118
+ /** Extra classes for the dialog. */
128
119
  className;
120
+ /** Inline style object for the dialog (React camelCase). */
129
121
  style;
122
+ /** `data-testid` for the dialog. */
130
123
  testId;
124
+ /** Fires when the dialog asks to close (React's `onClose`). */
131
125
  close = new EventEmitter();
126
+ /** The overlay element (moved to `document.body`). */
127
+ overlay;
128
+ /** The centering wrapper (moved to `document.body`). */
129
+ wrapper;
130
+ /** The dialog element. */
131
+ dialog;
132
+ /** The footer wrapper (detached when unused). */
133
+ footerSlot;
134
+ /** The per-instance title id (the normalizer renumbers it). */
135
+ titleId = `mol-modal-title-${++modalInstance}`;
136
+ /** The instance's stack id. */
137
+ stackId = modalInstance;
138
+ host = inject(ElementRef);
132
139
  /**
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.
140
+ * Reactive translation, read in the injection context. Its `t` reads the
141
+ * locale, so the view re-renders the text on a locale switch (the static `t`
142
+ * does not).
142
143
  */
143
- get closeAriaLabel() {
144
- return this.closeLabel || t('ui.modal.close', undefined, { defaultValue: 'Close' });
145
- }
146
- boundEscapeHandler = this.handleEscape.bind(this);
144
+ i18n = useTranslation();
145
+ sync = createScrollLock();
146
+ lastOpen = false;
147
+ lastFooter = false;
148
+ footerParent = null;
149
+ previouslyFocused = null;
150
+ listeners = [];
151
+ locked = false;
152
+ moved = false;
147
153
  /**
148
- * Retrieves the CSS class for the modal wrapper.
149
- * @returns The wrapper class name string.
154
+ * The current class map.
155
+ * @returns The UIClassMap.
150
156
  */
151
- get wrapperClass() {
152
- return this.cm.dialogWrapper;
157
+ cm() {
158
+ return getClassMap();
153
159
  }
154
160
  /**
155
- * Retrieves the inline style for the modal centering wrapper.
156
- * @returns An inline style object, or `undefined` when centered.
161
+ * The dialog class list.
162
+ * @returns The class string.
157
163
  */
158
- get wrapperStyle() {
159
- return getModalWrapperStyle(this.centered);
164
+ dialogClasses() {
165
+ return this.cm().cn(this.cm().modal({ size: this.size }), this.className);
160
166
  }
161
167
  /**
162
- * Retrieves the CSS class for the modal body.
163
- * @returns The body class name string.
168
+ * Serializes the dialog's inline style.
169
+ * @returns The style attribute text.
164
170
  */
165
- get bodyClass() {
166
- return this.cm.dialogBody;
171
+ dialogStyle() {
172
+ return styleText(this.style);
167
173
  }
168
174
  /**
169
- * Retrieves the CSS class for the modal overlay.
170
- * @returns The overlay class name string.
175
+ * The wrapper's inline style (top-anchored when not centered).
176
+ * @returns The style attribute text.
171
177
  */
172
- get overlayClass() {
173
- return this.cm.dialogOverlay;
178
+ wrapperStyle() {
179
+ return styleText(this.centered ? undefined : { alignItems: 'flex-start' });
174
180
  }
175
181
  /**
176
- * Retrieves the CSS class for the modal header.
177
- * @returns The header class name string.
182
+ * The close button's accessible label.
183
+ * @returns The label text.
178
184
  */
179
- get headerClass() {
180
- return this.cm.dialogHeader;
185
+ closeText() {
186
+ return this.closeLabel ?? this.i18n.t('ui.modal.close', undefined, { defaultValue: 'Close' });
181
187
  }
182
188
  /**
183
- * Retrieves the CSS class for the modal footer.
184
- * @returns The footer class name string.
189
+ * The close button's X glyph.
190
+ * @returns The resolved icon.
185
191
  */
186
- get footerClass() {
187
- return this.cm.dialogFooter;
192
+ closeIcon() {
193
+ return resolveIcon('x-mark', this.cm().iconMd);
188
194
  }
189
195
  /**
190
- * Retrieves the CSS class for the modal title.
191
- * @returns The title class name string.
196
+ * Stops a click inside the dialog from reaching the overlay handler.
197
+ *
198
+ * @param event - The click event.
192
199
  */
193
- get titleClass() {
194
- return this.cm.dialogTitle;
200
+ stopPropagation(event) {
201
+ event.stopPropagation();
195
202
  }
196
203
  /**
197
- * Retrieves the CSS class for the close button.
198
- * @returns The close button class name string.
204
+ * Closes when the click is on the wrapper itself (not bubbled content).
205
+ *
206
+ * @param event - The click event.
199
207
  */
200
- get closeClass() {
201
- return this.cm.dialogClose;
208
+ handleOverlayClick(event) {
209
+ if (this.closeOnOverlayClick && event.target === event.currentTarget)
210
+ this.requestClose();
202
211
  }
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));
212
+ /** Emits the close request (React's `onClose`). */
213
+ requestClose() {
214
+ this.close.emit();
210
215
  }
211
216
  /**
212
- * Computes the combined CSS classes for the modal content.
213
- * @returns The modal content class name string.
217
+ * Emits the close request from the close button — React's close button is
218
+ * `onClick={onClose}`, so the click event reaches the callback.
219
+ *
220
+ * @param event - The click event.
214
221
  */
215
- get contentClasses() {
216
- return this.cm.cn(this.cm.modal({ size: this.size }), this.className);
222
+ requestCloseFromButton(event) {
223
+ this.close.emit(event);
217
224
  }
218
225
  /**
219
- * Initializes event listeners on component creation.
226
+ * Reads the view queries (they resolve only at view init), moves the portal
227
+ * content into `document.body` and applies the initial open state.
220
228
  */
221
- ngOnInit() {
222
- this.updateListeners();
229
+ ngAfterViewInit() {
230
+ const overlay = this.overlay?.nativeElement;
231
+ const wrapper = this.wrapper?.nativeElement;
232
+ const dialog = this.dialog?.nativeElement;
233
+ this.footerParent = this.footerSlot?.nativeElement.parentElement ?? null;
234
+ if (dialog)
235
+ moveRestAttributes(this.host.nativeElement, dialog);
236
+ this.lastFooter = this.hasFooter();
237
+ this.syncFooter();
238
+ const open = !!this.open;
239
+ if (open) {
240
+ this.previouslyFocused = document.activeElement ?? null;
241
+ pushModalStack(this.stackId);
242
+ if (overlay && wrapper)
243
+ this.attachPortal();
244
+ if (dialog) {
245
+ const focusables = getFocusableElements(dialog);
246
+ (focusables[0] ?? dialog).focus();
247
+ }
248
+ this.addListeners();
249
+ }
250
+ else if (overlay && wrapper) {
251
+ // React renders nothing while closed.
252
+ this.detachPortal();
253
+ }
254
+ this.syncScrollLock();
255
+ this.lastOpen = open;
223
256
  }
224
257
  /**
225
- * Handles input property changes.
226
- * @param changes - The changed input properties.
258
+ * Reconciles the open state and the footer on later passes.
227
259
  */
228
- ngOnChanges(changes) {
229
- if (changes['open']) {
230
- this.updateListeners();
231
- this.updateBodyScroll();
260
+ ngDoCheck() {
261
+ const open = !!this.open;
262
+ if (open !== this.lastOpen) {
263
+ this.lastOpen = open;
264
+ this.transition(open);
232
265
  }
266
+ this.lastFooter = this.hasFooter();
267
+ this.syncFooter();
268
+ this.syncScrollLock();
233
269
  }
234
- /**
235
- * Cleans up event listeners and body scroll on component destruction.
236
- */
270
+ /** Removes listeners, unlocks scroll and restores the portal nodes (unmount). */
237
271
  ngOnDestroy() {
238
- document.removeEventListener('keydown', this.boundEscapeHandler);
239
- if (this.preventScroll) {
240
- document.body.style.overflow = '';
272
+ this.removeListeners();
273
+ popModalStack(this.stackId);
274
+ if (this.locked) {
275
+ this.sync.unlock();
276
+ this.locked = false;
277
+ }
278
+ // The portal nodes must be children of the host again for Angular's own
279
+ // removal to succeed.
280
+ const host = this.host.nativeElement;
281
+ if (this.moved) {
282
+ const overlay = this.overlay?.nativeElement;
283
+ const wrapper = this.wrapper?.nativeElement;
284
+ if (overlay?.parentNode === document.body)
285
+ host.appendChild(overlay);
286
+ if (wrapper?.parentNode === document.body)
287
+ host.appendChild(wrapper);
288
+ this.moved = false;
241
289
  }
242
290
  }
243
291
  /**
244
- * Adds or removes the keyboard escape listener based on open state.
292
+ * Whether the footer slot carries nodes (read each pass so a later props
293
+ * step adding it still renders).
294
+ * @returns True when the footer wrapper should render.
245
295
  */
246
- updateListeners() {
247
- if (this.open) {
248
- document.addEventListener('keydown', this.boundEscapeHandler);
296
+ hasFooter() {
297
+ const slot = this.footerSlot?.nativeElement;
298
+ if (!slot)
299
+ return false;
300
+ for (const node of Array.from(slot.childNodes)) {
301
+ if (node.nodeType === 1)
302
+ return true;
303
+ if (node.nodeType === 3 && (node.textContent ?? '').trim())
304
+ return true;
249
305
  }
250
- else {
251
- document.removeEventListener('keydown', this.boundEscapeHandler);
306
+ return false;
307
+ }
308
+ /** Applies React's `{!!footer && <div className={dialogFooter}>…</div>}`. */
309
+ syncFooter() {
310
+ const slot = this.footerSlot?.nativeElement;
311
+ if (!slot)
312
+ return;
313
+ const shouldRender = this.lastFooter;
314
+ if (shouldRender && !slot.isConnected) {
315
+ ;
316
+ (this.footerParent ?? this.dialog?.nativeElement ?? null)?.appendChild(slot);
317
+ }
318
+ else if (!shouldRender && slot.isConnected) {
319
+ slot.remove();
252
320
  }
253
321
  }
254
322
  /**
255
- * Updates the document body overflow based on open state.
323
+ * Applies an open/closed transition (React mounts/unmounts the portal and
324
+ * its effects).
325
+ *
326
+ * @param open - The new open state.
256
327
  */
257
- updateBodyScroll() {
258
- if (this.preventScroll) {
259
- document.body.style.overflow = this.open ? 'hidden' : '';
328
+ transition(open) {
329
+ if (open) {
330
+ this.previouslyFocused = document.activeElement ?? null;
331
+ pushModalStack(this.stackId);
332
+ this.attachPortal();
333
+ const dialog = this.dialog?.nativeElement;
334
+ if (dialog) {
335
+ const focusables = getFocusableElements(dialog);
336
+ (focusables[0] ?? dialog).focus();
337
+ }
338
+ this.addListeners();
339
+ }
340
+ else {
341
+ popModalStack(this.stackId);
342
+ this.removeListeners();
343
+ this.detachPortal();
344
+ const toRestore = this.previouslyFocused;
345
+ if (toRestore && document.contains(toRestore))
346
+ toRestore.focus();
260
347
  }
348
+ this.syncScrollLock();
261
349
  }
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();
350
+ /** Re-inserts the portal nodes into `document.body` (in React's order). */
351
+ attachPortal() {
352
+ const overlay = this.overlay?.nativeElement;
353
+ const wrapper = this.wrapper?.nativeElement;
354
+ if (!overlay || !wrapper)
355
+ return;
356
+ document.body.appendChild(overlay);
357
+ document.body.appendChild(wrapper);
358
+ this.moved = true;
359
+ }
360
+ /** Removes the portal nodes from the document (React renders null). */
361
+ detachPortal() {
362
+ this.overlay?.nativeElement.remove();
363
+ this.wrapper?.nativeElement.remove();
364
+ this.moved = false;
365
+ }
366
+ /** Locks or unlocks body scroll for React's `open && preventScroll`. */
367
+ syncScrollLock() {
368
+ const shouldLock = !!this.open && this.preventScroll;
369
+ if (shouldLock && !this.locked) {
370
+ this.sync.lock();
371
+ this.locked = true;
269
372
  }
373
+ else if (!shouldLock && this.locked) {
374
+ this.sync.unlock();
375
+ this.locked = false;
376
+ }
377
+ }
378
+ /** Adds Escape and the Tab focus trap while open (React's effect). */
379
+ addListeners() {
380
+ this.removeListeners();
381
+ const onKeyDown = (event) => this.handleKeyDown(event);
382
+ document.addEventListener('keydown', onKeyDown);
383
+ this.listeners.push(() => document.removeEventListener('keydown', onKeyDown));
384
+ }
385
+ /** Removes the document listeners. */
386
+ removeListeners() {
387
+ for (const off of this.listeners)
388
+ off();
389
+ this.listeners = [];
270
390
  }
271
391
  /**
272
- * Handles overlay click to close the modal.
273
- * @param event - The mouse event from the overlay click.
392
+ * Escape closes the topmost dialog; Tab wraps inside it.
393
+ *
394
+ * @param event - The key event.
274
395
  */
275
- onOverlayClick(event) {
276
- if (this.closeOnOverlayClick && event.target === event.currentTarget) {
277
- this.close.emit();
396
+ handleKeyDown(event) {
397
+ if (event.key === 'Escape') {
398
+ if (this.closeOnEscape && isTopOfModalStack(this.stackId))
399
+ this.requestClose();
400
+ return;
401
+ }
402
+ if (event.key !== 'Tab' || !isTopOfModalStack(this.stackId))
403
+ return;
404
+ const el = this.dialog?.nativeElement;
405
+ if (!el)
406
+ return;
407
+ const focusables = getFocusableElements(el);
408
+ if (focusables.length === 0) {
409
+ event.preventDefault();
410
+ el.focus();
411
+ return;
412
+ }
413
+ const first = focusables[0];
414
+ const last = focusables[focusables.length - 1];
415
+ const active = document.activeElement;
416
+ if (event.shiftKey) {
417
+ if (active === first || !el.contains(active)) {
418
+ event.preventDefault();
419
+ last.focus();
420
+ }
421
+ }
422
+ else if (active === last || !el.contains(active)) {
423
+ event.preventDefault();
424
+ first.focus();
278
425
  }
279
426
  }
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);
427
+ static ɵfac = function Modal_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Modal)(); };
428
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Modal, selectors: [["mol-modal"]], viewQuery: function Modal_Query(rf, ctx) { if (rf & 1) {
429
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5)(_c2, 5)(_c3, 5);
430
+ } if (rf & 2) {
431
+ let _t;
432
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.overlay = _t.first);
433
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.wrapper = _t.first);
434
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dialog = _t.first);
435
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.footerSlot = _t.first);
436
+ } }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { open: "open", title: "title", size: "size", showCloseButton: "showCloseButton", closeOnOverlayClick: "closeOnOverlayClick", closeOnEscape: "closeOnEscape", footer: "footer", centered: "centered", closeLabel: "closeLabel", preventScroll: "preventScroll", className: "className", style: "style", testId: "testId" }, outputs: { close: "close" }, ngContentSelectors: _c5, decls: 13, vars: 17, consts: [["overlay", ""], ["wrapper", ""], ["dialog", ""], ["footerSlot", ""], ["aria-hidden", "true"], [3, "click"], ["role", "dialog", "aria-modal", "true", "tabindex", "-1", 3, "click"], [3, "class"], [3, "id"], ["type", "button", "data-mol-id", "modal-close", 3, "class"], ["type", "button", "data-mol-id", "modal-close", 3, "click"], ["mol-icon", "", 3, "data"]], template: function Modal_Template(rf, ctx) { if (rf & 1) {
437
+ i0.ɵɵprojectionDef(_c4);
438
+ i0.ɵɵelement(0, "div", 4, 0);
439
+ i0.ɵɵelementStart(2, "div", 5, 1);
440
+ i0.ɵɵlistener("click", function Modal_Template_div_click_2_listener($event) { return ctx.handleOverlayClick($event); });
441
+ i0.ɵɵelementStart(4, "div", 6, 2);
442
+ i0.ɵɵlistener("click", function Modal_Template_div_click_4_listener($event) { return ctx.stopPropagation($event); });
443
+ i0.ɵɵconditionalCreate(6, Modal_Conditional_6_Template, 4, 7, "div", 7)(7, Modal_Conditional_7_Template, 1, 1);
444
+ i0.ɵɵelementStart(8, "div");
445
+ i0.ɵɵprojection(9);
446
+ i0.ɵɵelementEnd();
447
+ i0.ɵɵelementStart(10, "div", null, 3);
448
+ i0.ɵɵprojection(12, 1);
449
+ i0.ɵɵelementEnd()()();
284
450
  } if (rf & 2) {
285
- i0.ɵɵconditional(ctx.open ? 0 : -1);
286
- } }, encapsulation: 2 });
451
+ i0.ɵɵclassMap(ctx.cm().dialogOverlay);
452
+ i0.ɵɵadvance(2);
453
+ i0.ɵɵstyleMap(ctx.wrapperStyle());
454
+ i0.ɵɵclassMap(ctx.cm().dialogWrapper);
455
+ i0.ɵɵadvance(2);
456
+ i0.ɵɵstyleMap(ctx.dialogStyle());
457
+ i0.ɵɵclassMap(ctx.dialogClasses());
458
+ i0.ɵɵattribute("aria-labelledby", ctx.title ? ctx.titleId : null)("data-testid", ctx.testId);
459
+ i0.ɵɵadvance(2);
460
+ i0.ɵɵconditional(ctx.title ? 6 : 7);
461
+ i0.ɵɵadvance(2);
462
+ i0.ɵɵclassMap(ctx.cm().dialogBody);
463
+ i0.ɵɵadvance(2);
464
+ i0.ɵɵclassMap(ctx.cm().dialogFooter);
465
+ } }, dependencies: [MolIconSvg], encapsulation: 2 });
287
466
  }
288
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeModal, [{
467
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Modal, [{
289
468
  type: Component,
290
469
  args: [{
291
470
  selector: 'mol-modal',
292
471
  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>
472
+ imports: [MolIconSvg],
473
+ inputs: [
474
+ 'open',
475
+ 'title',
476
+ 'size',
477
+ 'showCloseButton',
478
+ 'closeOnOverlayClick',
479
+ 'closeOnEscape',
480
+ 'footer',
481
+ 'centered',
482
+ 'closeLabel',
483
+ 'preventScroll',
484
+ 'className',
485
+ 'style',
486
+ 'testId',
487
+ ],
488
+ outputs: ['close'],
489
+ host: {
490
+ 'data-parity-unwrap': '',
491
+ style: 'display: contents',
492
+ },
493
+ template: `<div #overlay [class]="cm().dialogOverlay" aria-hidden="true"></div>
494
+ <div
495
+ #wrapper
496
+ [class]="cm().dialogWrapper"
497
+ [style]="wrapperStyle()"
498
+ (click)="handleOverlayClick($event)"
499
+ >
500
+ <div
501
+ #dialog
502
+ role="dialog"
503
+ aria-modal="true"
504
+ [attr.aria-labelledby]="title ? titleId : null"
505
+ tabindex="-1"
506
+ [class]="dialogClasses()"
507
+ [style]="dialogStyle()"
508
+ [attr.data-testid]="testId"
509
+ (click)="stopPropagation($event)"
510
+ >
511
+ @if (title) {
512
+ <div [class]="cm().dialogHeader">
513
+ <h2 [id]="titleId" [class]="cm().dialogTitle">{{ title }}</h2>
514
+ @if (showCloseButton) {
515
+ <button
516
+ type="button"
517
+ (click)="requestCloseFromButton($event)"
518
+ [class]="cm().dialogClose"
519
+ data-mol-id="modal-close"
520
+ [attr.aria-label]="closeText()"
521
+ >
522
+ <svg mol-icon [data]="closeIcon()" />
523
+ </button>
524
+ }
333
525
  </div>
334
-
335
- @if (hasFooter) {
336
- <div [class]="footerClass">
337
- <ng-content select="[modal-footer]"></ng-content>
338
- </div>
526
+ } @else {
527
+ @if (showCloseButton) {
528
+ <button
529
+ type="button"
530
+ (click)="requestCloseFromButton($event)"
531
+ [class]="cm().dialogCloseFloating"
532
+ data-mol-id="modal-close"
533
+ [attr.aria-label]="closeText()"
534
+ >
535
+ <svg mol-icon [data]="closeIcon()" />
536
+ </button>
339
537
  }
538
+ }
539
+ <div [class]="cm().dialogBody"><ng-content></ng-content></div>
540
+ <div #footerSlot [class]="cm().dialogFooter">
541
+ <ng-content select="[slot=footer]"></ng-content>
340
542
  </div>
341
543
  </div>
342
- }
343
- `,
544
+ </div>`,
344
545
  }]
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: [{
546
+ }], null, { close: [{
372
547
  type: Output
548
+ }], overlay: [{
549
+ type: ViewChild,
550
+ args: ['overlay']
551
+ }], wrapper: [{
552
+ type: ViewChild,
553
+ args: ['wrapper']
554
+ }], dialog: [{
555
+ type: ViewChild,
556
+ args: ['dialog']
557
+ }], footerSlot: [{
558
+ type: ViewChild,
559
+ args: ['footerSlot']
373
560
  }] }); })();
374
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeModal, { className: "MoleculeModal", filePath: "components/modal.component.ts", lineNumber: 109 }); })();
561
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Modal, { className: "Modal", filePath: "components/modal.component.ts", lineNumber: 136 }); })();
375
562
  //# sourceMappingURL=modal.component.js.map