@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.
Files changed (308) hide show
  1. package/README.md +11740 -1143
  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 +6 -4
@@ -0,0 +1,322 @@
1
+ /**
2
+ * ConfirmButton component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, effect, ElementRef, inject, Renderer2, signal, ViewChild, } from '@angular/core';
7
+ import { getClassMap } from '@molecule/app-ui';
8
+ import { styleText } from '../utilities/style.js';
9
+ import { hasNodes, SlotWrapper } from './button.component.js';
10
+ import * as i0 from "@angular/core";
11
+ const _c0 = ["labelSlot"];
12
+ const _c1 = ["confirmSlot"];
13
+ const _c2 = ["pendingSlot"];
14
+ const _c3 = [[["", "slot", "label"]], [["", "slot", "confirmlabel"]], [["", "slot", "pendinglabel"]]];
15
+ const _c4 = ["[slot=label]", "[slot=confirmLabel]", "[slot=pendingLabel]"];
16
+ function ConfirmButton_Conditional_0_Template(rf, ctx) { if (rf & 1) {
17
+ i0.ɵɵtext(0, " Confirm? ");
18
+ } }
19
+ function ConfirmButton_Conditional_1_Template(rf, ctx) { if (rf & 1) {
20
+ i0.ɵɵtext(0, " Working\u2026 ");
21
+ } }
22
+ /**
23
+ * ConfirmButton component.
24
+ *
25
+ * The host is the `<button>` itself (`button[mol-confirm-button]`). The three
26
+ * labels are projected (`[slot=label]`, `[slot=confirmLabel]`,
27
+ * `[slot=pendingLabel]`); each capture span stays detached from the DOM and
28
+ * the visible phase's projected children are moved onto the button — React
29
+ * renders exactly one label and no wrapper element. When the slot for the
30
+ * armed/pending phase is empty, the localized default text renders instead
31
+ * (React's `confirmLabel ?? t(…)`).
32
+ */
33
+ export class ConfirmButton {
34
+ /** Button variant (passed through to the button classes). */
35
+ variant;
36
+ /** Button color; the armed state always shows the error color. */
37
+ color;
38
+ /** Button size. */
39
+ size;
40
+ /**
41
+ * The confirm callback (React's `onConfirm` prop). Fired ONLY on the
42
+ * confirming (second) click; while the returned promise is pending the
43
+ * button stays in its confirming state and ignores further clicks.
44
+ */
45
+ onConfirm;
46
+ /** Seconds before the armed state auto-disarms (`0` disables auto-disarm). */
47
+ disarmSeconds = 4;
48
+ /** Disables the control entirely (idle and confirming states). */
49
+ disabled = false;
50
+ /** `data-testid` for the button. */
51
+ testId;
52
+ /** Extra classes joined onto the button classes. */
53
+ className;
54
+ /** Inline style object (React camelCase). */
55
+ style;
56
+ /** The label slot capture span (kept out of the DOM). */
57
+ labelSlot;
58
+ /** The armed-state label capture span. */
59
+ confirmSlot;
60
+ /** The pending-state label capture span. */
61
+ pendingSlot;
62
+ /** Whether the armed label slot carries content (read at view init). */
63
+ hasConfirmLabel = false;
64
+ /** Whether the pending label slot carries content (read at view init). */
65
+ hasPendingLabel = false;
66
+ /** The current phase: idle → armed → pending → idle. */
67
+ phase = signal('idle', /* @ts-ignore */
68
+ ...(ngDevMode ? [{ debugName: "phase" }] : /* istanbul ignore next */ []));
69
+ el = inject(ElementRef);
70
+ renderer = inject(Renderer2);
71
+ sync = new SlotWrapper(this.el, this.renderer);
72
+ disarmTimer = null;
73
+ anchor = null;
74
+ /**
75
+ * Arms the auto-disarm timer for the armed phase (React's `useEffect` on
76
+ * `[phase, disarmSeconds]`).
77
+ */
78
+ constructor() {
79
+ effect(() => {
80
+ if (this.disarmTimer) {
81
+ clearTimeout(this.disarmTimer);
82
+ this.disarmTimer = null;
83
+ }
84
+ if (this.phase() === 'armed' && this.disarmSeconds > 0) {
85
+ this.disarmTimer = setTimeout(() => {
86
+ this.disarmTimer = null;
87
+ this.phase.set('idle');
88
+ }, this.disarmSeconds * 1000);
89
+ }
90
+ });
91
+ }
92
+ /**
93
+ * The current class map.
94
+ * @returns The UIClassMap.
95
+ */
96
+ cm() {
97
+ return getClassMap();
98
+ }
99
+ /**
100
+ * Computes the button class list (the armed state shows the error color).
101
+ * @returns The class string.
102
+ */
103
+ classes() {
104
+ return this.cm().cn(this.cm().button({
105
+ color: this.phase() === 'armed' ? 'error' : (this.color ?? 'primary'),
106
+ size: this.size,
107
+ variant: this.variant,
108
+ }), this.className);
109
+ }
110
+ /**
111
+ * Serializes the inline style.
112
+ * @returns The style attribute text.
113
+ */
114
+ hostStyle() {
115
+ return styleText(this.style);
116
+ }
117
+ /**
118
+ * React's click handler: idle arms, armed commits (awaiting the callback),
119
+ * pending ignores.
120
+ */
121
+ async handleClick() {
122
+ const current = this.phase();
123
+ if (current === 'idle') {
124
+ this.phase.set('armed');
125
+ return;
126
+ }
127
+ if (current === 'pending')
128
+ return;
129
+ this.phase.set('pending');
130
+ try {
131
+ await this.onConfirm?.();
132
+ }
133
+ catch (_error) {
134
+ // A rejected confirm means the action failed: the caller owns that
135
+ // error and shows its own message, and the button returns to idle so
136
+ // the user can retry. Ignoring it here only stops it becoming an
137
+ // unhandled rejection.
138
+ }
139
+ finally {
140
+ this.phase.set('idle');
141
+ }
142
+ }
143
+ /**
144
+ * Disarms an armed button (React's window Escape listener, bound while
145
+ * armed; disarming an idle button is a no-op).
146
+ */
147
+ handleEscape() {
148
+ if (this.phase() === 'armed')
149
+ this.disarm();
150
+ }
151
+ /**
152
+ * React's `disarm`: cancels the timer and returns to idle.
153
+ */
154
+ disarm() {
155
+ if (this.disarmTimer) {
156
+ clearTimeout(this.disarmTimer);
157
+ this.disarmTimer = null;
158
+ }
159
+ this.phase.set('idle');
160
+ }
161
+ /**
162
+ * Reads slot presence at view init (view queries resolve only then) and
163
+ * takes the capture spans out of the DOM.
164
+ */
165
+ ngAfterViewInit() {
166
+ this.hasConfirmLabel = hasNodes(this.confirmSlot?.nativeElement);
167
+ this.hasPendingLabel = hasNodes(this.pendingSlot?.nativeElement);
168
+ for (const span of [this.labelSlot, this.confirmSlot, this.pendingSlot])
169
+ this.sync.sync(span?.nativeElement, false);
170
+ this.syncLabels();
171
+ }
172
+ /**
173
+ * Re-reconciles the visible label on every pass (phase changes and later
174
+ * `props` steps both go through a refresh).
175
+ */
176
+ ngDoCheck() {
177
+ this.syncLabels();
178
+ }
179
+ /** The nodes currently shown on the button, and the slot they came from. */
180
+ visibleNodes = [];
181
+ visibleFrom = null;
182
+ /**
183
+ * Shows exactly the visible phase's projected children on the button —
184
+ * React renders exactly one label and no wrapper element.
185
+ */
186
+ syncLabels() {
187
+ const phase = this.phase();
188
+ const target = phase === 'idle'
189
+ ? (this.labelSlot?.nativeElement ?? null)
190
+ : phase === 'armed' && this.hasConfirmLabel
191
+ ? (this.confirmSlot?.nativeElement ?? null)
192
+ : phase === 'pending' && this.hasPendingLabel
193
+ ? (this.pendingSlot?.nativeElement ?? null)
194
+ : null;
195
+ this.showSlot(target);
196
+ }
197
+ /**
198
+ * Shows one slot's projected children on the button, parking whatever
199
+ * another slot was showing back inside its capture span.
200
+ *
201
+ * @param span - The capture span to show (null parks everything).
202
+ */
203
+ showSlot(span) {
204
+ const host = this.el.nativeElement;
205
+ if (span === this.visibleFrom)
206
+ return;
207
+ for (const node of this.visibleNodes) {
208
+ if (node.parentElement === host)
209
+ this.visibleFrom?.appendChild(node);
210
+ }
211
+ this.visibleNodes = [];
212
+ this.visibleFrom = null;
213
+ if (!span)
214
+ return;
215
+ const nodes = Array.from(span.childNodes);
216
+ for (const node of nodes)
217
+ host.insertBefore(node, this.labelAnchor());
218
+ this.visibleNodes = nodes;
219
+ this.visibleFrom = span;
220
+ }
221
+ /**
222
+ * The insertion point for the visible projected label (a comment the DOM
223
+ * normalizer strips), kept before the fallback texts.
224
+ * @returns The anchor comment.
225
+ */
226
+ labelAnchor() {
227
+ if (this.anchor)
228
+ return this.anchor;
229
+ const anchor = this.renderer.createComment('label');
230
+ const host = this.el.nativeElement;
231
+ host.insertBefore(anchor, host.firstChild);
232
+ this.anchor = anchor;
233
+ return anchor;
234
+ }
235
+ /** Clears the auto-disarm timer (React's unmount cleanup). */
236
+ ngOnDestroy() {
237
+ if (this.disarmTimer)
238
+ clearTimeout(this.disarmTimer);
239
+ }
240
+ static ɵfac = function ConfirmButton_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConfirmButton)(); };
241
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ConfirmButton, selectors: [["button", "mol-confirm-button", ""]], viewQuery: function ConfirmButton_Query(rf, ctx) { if (rf & 1) {
242
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5)(_c2, 5);
243
+ } if (rf & 2) {
244
+ let _t;
245
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelSlot = _t.first);
246
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.confirmSlot = _t.first);
247
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.pendingSlot = _t.first);
248
+ } }, hostVars: 9, hostBindings: function ConfirmButton_HostBindings(rf, ctx) { if (rf & 1) {
249
+ i0.ɵɵlistener("click", function ConfirmButton_click_HostBindingHandler() { return ctx.handleClick(); })("keydown.escape", function ConfirmButton_keydown_escape_HostBindingHandler() { return ctx.handleEscape(); }, i0.ɵɵresolveDocument);
250
+ } if (rf & 2) {
251
+ i0.ɵɵdomProperty("disabled", ctx.disabled || ctx.phase() === "pending");
252
+ i0.ɵɵattribute("type", "button")("aria-live", "polite")("data-state", ctx.phase())("data-testid", ctx.testId);
253
+ i0.ɵɵstyleMap(ctx.hostStyle());
254
+ i0.ɵɵclassMap(ctx.classes());
255
+ } }, inputs: { variant: "variant", color: "color", size: "size", onConfirm: "onConfirm", disarmSeconds: "disarmSeconds", disabled: "disabled", testId: "testId", className: "className", style: "style" }, ngContentSelectors: _c4, decls: 11, vars: 2, consts: [["labelSlot", ""], ["confirmSlot", ""], ["pendingSlot", ""]], template: function ConfirmButton_Template(rf, ctx) { if (rf & 1) {
256
+ i0.ɵɵprojectionDef(_c3);
257
+ i0.ɵɵconditionalCreate(0, ConfirmButton_Conditional_0_Template, 1, 0);
258
+ i0.ɵɵconditionalCreate(1, ConfirmButton_Conditional_1_Template, 1, 0);
259
+ i0.ɵɵdomElementStart(2, "span", null, 0);
260
+ i0.ɵɵprojection(4);
261
+ i0.ɵɵdomElementEnd();
262
+ i0.ɵɵdomElementStart(5, "span", null, 1);
263
+ i0.ɵɵprojection(7, 1);
264
+ i0.ɵɵdomElementEnd();
265
+ i0.ɵɵdomElementStart(8, "span", null, 2);
266
+ i0.ɵɵprojection(10, 2);
267
+ i0.ɵɵdomElementEnd();
268
+ } if (rf & 2) {
269
+ i0.ɵɵconditional(ctx.phase() === "armed" && !ctx.hasConfirmLabel ? 0 : -1);
270
+ i0.ɵɵadvance();
271
+ i0.ɵɵconditional(ctx.phase() === "pending" && !ctx.hasPendingLabel ? 1 : -1);
272
+ } }, encapsulation: 2 });
273
+ }
274
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmButton, [{
275
+ type: Component,
276
+ args: [{
277
+ selector: 'button[mol-confirm-button]',
278
+ standalone: true,
279
+ inputs: [
280
+ 'variant',
281
+ 'color',
282
+ 'size',
283
+ 'onConfirm',
284
+ 'disarmSeconds',
285
+ 'disabled',
286
+ 'testId',
287
+ 'className',
288
+ 'style',
289
+ ],
290
+ host: {
291
+ '[attr.type]': '"button"',
292
+ '(click)': 'handleClick()',
293
+ '(document:keydown.escape)': 'handleEscape()',
294
+ '[disabled]': 'disabled || phase() === "pending"',
295
+ '[attr.aria-live]': '"polite"',
296
+ '[attr.data-state]': 'phase()',
297
+ '[attr.data-testid]': 'testId',
298
+ '[class]': 'classes()',
299
+ '[style]': 'hostStyle()',
300
+ },
301
+ template: `@if (phase() === 'armed' && !hasConfirmLabel) {
302
+ Confirm?
303
+ }
304
+ @if (phase() === 'pending' && !hasPendingLabel) {
305
+ Working…
306
+ }
307
+ <span #labelSlot><ng-content select="[slot=label]"></ng-content></span
308
+ ><span #confirmSlot><ng-content select="[slot=confirmLabel]"></ng-content></span
309
+ ><span #pendingSlot><ng-content select="[slot=pendingLabel]"></ng-content></span>`,
310
+ }]
311
+ }], () => [], { labelSlot: [{
312
+ type: ViewChild,
313
+ args: ['labelSlot']
314
+ }], confirmSlot: [{
315
+ type: ViewChild,
316
+ args: ['confirmSlot']
317
+ }], pendingSlot: [{
318
+ type: ViewChild,
319
+ args: ['pendingSlot']
320
+ }] }); })();
321
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConfirmButton, { className: "ConfirmButton", filePath: "components/confirm-button.component.ts", lineNumber: 72 }); })();
322
+ //# sourceMappingURL=confirm-button.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-button.component.js","sourceRoot":"","sources":["../../src/components/confirm-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EAET,MAAM,EACN,UAAU,EACV,MAAM,EAEN,SAAS,EACT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;;;;;;;;IAuCvD,0BACF;;;IAEE,+BACF;;AAzCJ;;;;;;;;;;GAUG;AAoCH,MAAM,OAAO,aAAa;IACxB,6DAA6D;IAC7D,OAAO,CAAgB;IACvB,kEAAkE;IAClE,KAAK,CAAe;IACpB,mBAAmB;IACnB,IAAI,CAAO;IACX;;;;OAIG;IACH,SAAS,CAA6B;IACtC,8EAA8E;IAC9E,aAAa,GAAG,CAAC,CAAA;IACjB,kEAAkE;IAClE,QAAQ,GAAG,KAAK,CAAA;IAChB,oCAAoC;IACpC,MAAM,CAAS;IACf,oDAAoD;IACpD,SAAS,CAAS;IAClB,6CAA6C;IAC7C,KAAK,CAA0B;IAE/B,yDAAyD;IACjC,SAAS,CAA8B;IAC/D,0CAA0C;IAChB,WAAW,CAA8B;IACnE,4CAA4C;IAClB,WAAW,CAA8B;IAEnE,wEAAwE;IACxE,eAAe,GAAG,KAAK,CAAA;IACvB,0EAA0E;IAC1E,eAAe,GAAG,KAAK,CAAA;IAEvB,wDAAwD;IAC/C,KAAK,GAAG,MAAM,CAA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A+C;YAGxD,qEAAiD;YAGjD,wCAAiB;YAAA,kBAA+C;YAAA,oBAC/D;YAAA,wCAAmB;YAAA,qBAAsD;YAAA,oBACzE;YAAA,wCAAmB;YAAA,sBAAsD;YAAA,oBAAO;;YARxE,0EAER;YACD,cAEC;YAFD,4EAEC;;;iFAKQ,aAAa;cAnCzB,SAAS;eAAC;gBACT,QAAQ,EAAE,4BAA4B;gBACtC,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE;oBACN,SAAS;oBACT,OAAO;oBACP,MAAM;oBACN,WAAW;oBACX,eAAe;oBACf,UAAU;oBACV,QAAQ;oBACR,WAAW;oBACX,OAAO;iBACR;gBACD,IAAI,EAAE;oBACJ,aAAa,EAAE,UAAU;oBACzB,SAAS,EAAE,eAAe;oBAC1B,2BAA2B,EAAE,gBAAgB;oBAC7C,YAAY,EAAE,mCAAmC;oBACjD,kBAAkB,EAAE,UAAU;oBAC9B,mBAAmB,EAAE,SAAS;oBAC9B,oBAAoB,EAAE,QAAQ;oBAC9B,SAAS,EAAE,WAAW;oBACtB,SAAS,EAAE,aAAa;iBACzB;gBACD,QAAQ,EAAE;;;;;;;;sFAQ0E;aACrF;;kBA0BE,SAAS;mBAAC,WAAW;;kBAErB,SAAS;mBAAC,aAAa;;kBAEvB,SAAS;mBAAC,aAAa;;kFA7Bb,aAAa"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * ConfirmDialog component (React parity): the shared "Are you sure?" modal.
3
+ *
4
+ * @module
5
+ */
6
+ import { EventEmitter } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * ConfirmDialog component.
11
+ *
12
+ * Composed from `Modal` and `Button` exactly as React composes them; the
13
+ * dialog's own title/description/children are projected content (`[slot=title]`,
14
+ * `[slot=description]`, default). The host is unwrapped (`data-parity-unwrap`,
15
+ * React's `Modal` root is a fragment/portal).
16
+ */
17
+ export declare class ConfirmDialog {
18
+ /** Whether the dialog is open. */
19
+ open: boolean;
20
+ /** Title (node-valued prop). */
21
+ title?: unknown;
22
+ /** Body / warning text (node-valued prop). */
23
+ description?: unknown;
24
+ /** Confirm-button label. */
25
+ confirmLabel?: string;
26
+ /** Cancel-button label. */
27
+ cancelLabel?: string;
28
+ /** Whether the confirm action is destructive (default true). */
29
+ destructive: boolean;
30
+ /** Disables both buttons (the caller owns the pending state). */
31
+ loading?: boolean;
32
+ /** Fires when the dialog should close (escape, backdrop, cancel). */
33
+ readonly close: EventEmitter<unknown>;
34
+ /** Fires when the user confirms. */
35
+ readonly confirm: EventEmitter<void>;
36
+ /**
37
+ * Reactive translation, read in the injection context. Its `t` reads the
38
+ * locale, so the view re-renders the text on a locale switch (the static `t`
39
+ * does not).
40
+ */
41
+ private readonly i18n;
42
+ /**
43
+ * The current class map.
44
+ * @returns The UIClassMap.
45
+ */
46
+ cm(): UIClassMap;
47
+ /**
48
+ * The cancel button's label.
49
+ * @returns The label text.
50
+ */
51
+ cancelText(): string;
52
+ /**
53
+ * The confirm button's label (React shows an ellipsis while loading).
54
+ * @returns The label text.
55
+ */
56
+ confirmText(): string;
57
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmDialog, never>;
58
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmDialog, "mol-confirm-dialog", never, { "open": { "alias": "open"; "required": false; }; "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "confirmLabel": { "alias": "confirmLabel"; "required": false; }; "cancelLabel": { "alias": "cancelLabel"; "required": false; }; "destructive": { "alias": "destructive"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; }, { "close": "close"; "confirm": "confirm"; }, never, ["[slot=title]", "[slot=description]", "*"], true, never>;
59
+ }
60
+ //# sourceMappingURL=confirm-dialog.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-dialog.component.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,YAAY,EAAU,MAAM,eAAe,CAAA;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMlD;;;;;;;GAOG;AACH,qBAiCa,aAAa;IACxB,kCAAkC;IAClC,IAAI,UAAQ;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,WAAW,UAAO;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,qEAAqE;IAC3D,QAAQ,CAAC,KAAK,wBAA8B;IACtD,oCAAoC;IAC1B,QAAQ,CAAC,OAAO,qBAA2B;IAErD;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,WAAW,IAAI,MAAM;yCAhDV,aAAa;2CAAb,aAAa;CAqDzB"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * ConfirmDialog component (React parity): the shared "Are you sure?" modal.
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, EventEmitter, Output } from '@angular/core';
7
+ import { useTranslation } from '@molecule/app-angular';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ import { Button } from './button.component.js';
10
+ import { Modal } from './modal.component.js';
11
+ import * as i0 from "@angular/core";
12
+ const _c0 = [[["", "slot", "title"]], [["", "slot", "description"]], "*"];
13
+ const _c1 = ["[slot=title]", "[slot=description]", "*"];
14
+ const _c2 = () => ({ justify: "end", gap: "sm" });
15
+ /**
16
+ * ConfirmDialog component.
17
+ *
18
+ * Composed from `Modal` and `Button` exactly as React composes them; the
19
+ * dialog's own title/description/children are projected content (`[slot=title]`,
20
+ * `[slot=description]`, default). The host is unwrapped (`data-parity-unwrap`,
21
+ * React's `Modal` root is a fragment/portal).
22
+ */
23
+ export class ConfirmDialog {
24
+ /** Whether the dialog is open. */
25
+ open = false;
26
+ /** Title (node-valued prop). */
27
+ title;
28
+ /** Body / warning text (node-valued prop). */
29
+ description;
30
+ /** Confirm-button label. */
31
+ confirmLabel;
32
+ /** Cancel-button label. */
33
+ cancelLabel;
34
+ /** Whether the confirm action is destructive (default true). */
35
+ destructive = true;
36
+ /** Disables both buttons (the caller owns the pending state). */
37
+ loading;
38
+ /** Fires when the dialog should close (escape, backdrop, cancel). */
39
+ close = new EventEmitter();
40
+ /** Fires when the user confirms. */
41
+ confirm = new EventEmitter();
42
+ /**
43
+ * Reactive translation, read in the injection context. Its `t` reads the
44
+ * locale, so the view re-renders the text on a locale switch (the static `t`
45
+ * does not).
46
+ */
47
+ i18n = useTranslation();
48
+ /**
49
+ * The current class map.
50
+ * @returns The UIClassMap.
51
+ */
52
+ cm() {
53
+ return getClassMap();
54
+ }
55
+ /**
56
+ * The cancel button's label.
57
+ * @returns The label text.
58
+ */
59
+ cancelText() {
60
+ return this.cancelLabel ?? this.i18n.t('confirm.cancel', {}, { defaultValue: 'Cancel' });
61
+ }
62
+ /**
63
+ * The confirm button's label (React shows an ellipsis while loading).
64
+ * @returns The label text.
65
+ */
66
+ confirmText() {
67
+ return this.loading
68
+ ? '…'
69
+ : (this.confirmLabel ?? this.i18n.t('confirm.confirm', {}, { defaultValue: 'Confirm' }));
70
+ }
71
+ static ɵfac = function ConfirmDialog_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConfirmDialog)(); };
72
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ConfirmDialog, selectors: [["mol-confirm-dialog"]], hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { open: "open", title: "title", description: "description", confirmLabel: "confirmLabel", cancelLabel: "cancelLabel", destructive: "destructive", loading: "loading" }, outputs: { close: "close", confirm: "confirm" }, ngContentSelectors: _c1, decls: 12, vars: 17, consts: [[3, "close", "open"], ["mol-button", "", 3, "click", "variant", "disabled"], ["mol-button", "", 3, "click", "variant", "color", "disabled"]], template: function ConfirmDialog_Template(rf, ctx) { if (rf & 1) {
73
+ i0.ɵɵprojectionDef(_c0);
74
+ i0.ɵɵelementStart(0, "mol-modal", 0);
75
+ i0.ɵɵlistener("close", function ConfirmDialog_Template_mol_modal_close_0_listener($event) { return ctx.close.emit($event); });
76
+ i0.ɵɵelementStart(1, "div")(2, "h2");
77
+ i0.ɵɵprojection(3);
78
+ i0.ɵɵelementEnd();
79
+ i0.ɵɵelementStart(4, "p");
80
+ i0.ɵɵprojection(5, 1);
81
+ i0.ɵɵelementEnd();
82
+ i0.ɵɵprojection(6, 2);
83
+ i0.ɵɵelementStart(7, "div")(8, "button", 1);
84
+ i0.ɵɵlistener("click", function ConfirmDialog_Template_button_click_8_listener($event) { return ctx.close.emit($event); });
85
+ i0.ɵɵtext(9);
86
+ i0.ɵɵelementEnd();
87
+ i0.ɵɵelementStart(10, "button", 2);
88
+ i0.ɵɵlistener("click", function ConfirmDialog_Template_button_click_10_listener() { return ctx.confirm.emit(); });
89
+ i0.ɵɵtext(11);
90
+ i0.ɵɵelementEnd()()()();
91
+ } if (rf & 2) {
92
+ i0.ɵɵproperty("open", ctx.open);
93
+ i0.ɵɵadvance();
94
+ i0.ɵɵclassMap(ctx.cm().stack(3));
95
+ i0.ɵɵadvance();
96
+ i0.ɵɵclassMap(ctx.cm().cn(ctx.cm().textSize("lg"), ctx.cm().fontWeight("bold")));
97
+ i0.ɵɵadvance(2);
98
+ i0.ɵɵclassMap(ctx.cm().textSize("sm"));
99
+ i0.ɵɵadvance(3);
100
+ i0.ɵɵclassMap(ctx.cm().flex(i0.ɵɵpureFunction0(16, _c2)));
101
+ i0.ɵɵadvance();
102
+ i0.ɵɵproperty("variant", "ghost")("disabled", !!ctx.loading);
103
+ i0.ɵɵadvance();
104
+ i0.ɵɵtextInterpolate1(" ", ctx.cancelText());
105
+ i0.ɵɵadvance();
106
+ i0.ɵɵproperty("variant", "solid")("color", ctx.destructive === false ? "primary" : "error")("disabled", !!ctx.loading);
107
+ i0.ɵɵadvance();
108
+ i0.ɵɵtextInterpolate1(" ", ctx.confirmText(), " ");
109
+ } }, dependencies: [Button, Modal], encapsulation: 2 });
110
+ }
111
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmDialog, [{
112
+ type: Component,
113
+ args: [{
114
+ selector: 'mol-confirm-dialog',
115
+ standalone: true,
116
+ imports: [Button, Modal],
117
+ inputs: ['open', 'title', 'description', 'confirmLabel', 'cancelLabel', 'destructive', 'loading'],
118
+ outputs: ['close', 'confirm'],
119
+ host: {
120
+ 'data-parity-unwrap': '',
121
+ style: 'display: contents',
122
+ },
123
+ template: `<mol-modal [open]="open" (close)="close.emit($event)"
124
+ ><div [class]="cm().stack(3)">
125
+ <h2 [class]="cm().cn(cm().textSize('lg'), cm().fontWeight('bold'))">
126
+ <ng-content select="[slot=title]"></ng-content>
127
+ </h2>
128
+ <p [class]="cm().textSize('sm')"><ng-content select="[slot=description]"></ng-content></p>
129
+ <ng-content></ng-content>
130
+ <div [class]="cm().flex({ justify: 'end', gap: 'sm' })">
131
+ <button mol-button [variant]="'ghost'" [disabled]="!!loading" (click)="close.emit($event)">
132
+ {{ cancelText() }}</button
133
+ ><button
134
+ mol-button
135
+ [variant]="'solid'"
136
+ [color]="destructive === false ? 'primary' : 'error'"
137
+ [disabled]="!!loading"
138
+ (click)="confirm.emit()"
139
+ >
140
+ {{ confirmText() }}
141
+ </button>
142
+ </div>
143
+ </div></mol-modal
144
+ >`,
145
+ }]
146
+ }], null, { close: [{
147
+ type: Output
148
+ }], confirm: [{
149
+ type: Output
150
+ }] }); })();
151
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConfirmDialog, { className: "ConfirmDialog", filePath: "components/confirm-dialog.component.ts", lineNumber: 57 }); })();
152
+ //# sourceMappingURL=confirm-dialog.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-dialog.component.js","sourceRoot":"","sources":["../../src/components/confirm-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;;;;;AAE5C;;;;;;;GAOG;AAkCH,MAAM,OAAO,aAAa;IACxB,kCAAkC;IAClC,IAAI,GAAG,KAAK,CAAA;IACZ,gCAAgC;IAChC,KAAK,CAAU;IACf,8CAA8C;IAC9C,WAAW,CAAU;IACrB,4BAA4B;IAC5B,YAAY,CAAS;IACrB,2BAA2B;IAC3B,WAAW,CAAS;IACpB,gEAAgE;IAChE,WAAW,GAAG,IAAI,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAU;IAEjB,qEAAqE;IAClD,KAAK,GAAG,IAAI,YAAY,EAAW,CAAA;IACtD,oCAAoC;IACjB,OAAO,GAAG,IAAI,YAAY,EAAQ,CAAA;IAErD;;;;OAIG;IACc,IAAI,GAAG,cAAc,EAAE,CAAA;IAExC;;;OAGG;IACH,EAAE;QACA,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED;;;OAGG;IACH,WAAW;QACT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