@molecule/app-ui-angular 1.0.6 → 1.1.2

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