@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,111 @@
1
+ /**
2
+ * FormField component (React parity): label + field + error/hint wrapper.
3
+ *
4
+ * @module
5
+ */
6
+ import { type AfterViewInit, ElementRef, type OnDestroy } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * FormField component.
11
+ *
12
+ * The host is the root `<div>` (`div[mol-form-field]`). React clones a single
13
+ * child element, adding `id`, `aria-describedby` and `aria-invalid` to its
14
+ * props; Angular cannot clone a projected component, so those values are
15
+ * registered on the host as a {@link FormFieldContext} that the field
16
+ * components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
17
+ */
18
+ export declare class FormField implements AfterViewInit, OnDestroy {
19
+ /** Field label. */
20
+ label?: string;
21
+ /** Field name (drives the ids). */
22
+ name?: string;
23
+ /** Error message (renders and associates via aria-describedby). */
24
+ error?: string;
25
+ /** Hint text (shown without an error). */
26
+ hint?: string;
27
+ /** Marks the field required (label styling). */
28
+ required?: boolean;
29
+ /** Extra classes for the wrapper. */
30
+ className?: string;
31
+ /** Inline style object (React camelCase). */
32
+ style?: Record<string, unknown>;
33
+ /** `data-testid`. */
34
+ testId?: string;
35
+ /** The projected-children capture point. */
36
+ capture?: ElementRef<HTMLSpanElement>;
37
+ /** The label's `for` target (the single child's control id, read after view init). */
38
+ readonly labelFor: import("@angular/core").WritableSignal<string>;
39
+ /** A generated id used when `name` is absent (the normalizer renumbers it). */
40
+ private readonly generatedId;
41
+ private readonly host;
42
+ private readonly renderer;
43
+ private readonly sync;
44
+ /** Cached single-child determination (the capture empties at view init). */
45
+ private singleCache;
46
+ /** Registers the field context before any projected child resolves it. */
47
+ constructor();
48
+ /**
49
+ * The current class map.
50
+ * @returns The UIClassMap.
51
+ */
52
+ cm(): UIClassMap;
53
+ /**
54
+ * The field id (`name`, or a generated id).
55
+ * @returns The id.
56
+ */
57
+ fieldId(): string;
58
+ /**
59
+ * The error paragraph's id.
60
+ * @returns The id.
61
+ */
62
+ get errorId(): string;
63
+ /**
64
+ * The hint paragraph's id.
65
+ * @returns The id.
66
+ */
67
+ get hintId(): string;
68
+ /**
69
+ * The id the field should describe itself with (error wins over hint).
70
+ * @returns The id, or undefined.
71
+ */
72
+ describedByTarget(): string | undefined;
73
+ /**
74
+ * The wrapper class list.
75
+ * @returns The class string.
76
+ */
77
+ classes(): string;
78
+ /**
79
+ * Serializes the wrapper's inline style.
80
+ * @returns The style attribute text.
81
+ */
82
+ hostStyle(): string | null;
83
+ /**
84
+ * The capture span (a view query before view init, a DOM lookup after —
85
+ * the span lives directly under the host and is removed at view init).
86
+ * @returns The capture element, or null.
87
+ */
88
+ private captureEl;
89
+ /**
90
+ * Whether the projected content is exactly one element (React clones only a
91
+ * single child). Cached: the children leave the capture span at view init.
92
+ * @returns True for a single element child.
93
+ */
94
+ singleChild(): boolean;
95
+ /**
96
+ * Adopts the projected children bare into the host (React renders them
97
+ * directly), resolves the label target from the single child's control and
98
+ * patches a plain native control child (React's cloneElement props).
99
+ */
100
+ ngAfterViewInit(): void;
101
+ /**
102
+ * Applies React's cloned props to a plain native form control child.
103
+ * @param control - The native control element.
104
+ */
105
+ private patchNativeControl;
106
+ /** Removes the context registration (unmount). */
107
+ ngOnDestroy(): void;
108
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormField, never>;
109
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormField, "div[mol-form-field]", never, { "label": { "alias": "label"; "required": false; }; "name": { "alias": "name"; "required": false; }; "error": { "alias": "error"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "required": { "alias": "required"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, {}, never, ["*"], true, never>;
110
+ }
111
+ //# sourceMappingURL=form-field.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.component.d.ts","sourceRoot":"","sources":["../../src/components/form-field.component.ts"],"names":[],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GG;IACH,iBAAiB,IAAI,MAAM,GAAG,SAAS;IAMvC;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAOjB;;;;OAIG;IACH,WAAW,IAAI,OAAO;IAWtB;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAqBvB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAU1B,kDAAkD;IAClD,WAAW,IAAI,IAAI;yCApKR,SAAS;2CAAT,SAAS;CAuKrB"}
@@ -0,0 +1,300 @@
1
+ /**
2
+ * FormField component (React parity): label + field + error/hint wrapper.
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, ElementRef, inject, Renderer2, signal, ViewChild, } from '@angular/core';
7
+ import { getClassMap } from '@molecule/app-ui';
8
+ import { provideDomContext, removeDomContext } from '../utilities/dom-context.js';
9
+ import { nextInstanceId } from '../utilities/ids.js';
10
+ import { styleText } from '../utilities/style.js';
11
+ import { SlotWrapper } from './button.component.js';
12
+ import * as i0 from "@angular/core";
13
+ const _c0 = ["capture"];
14
+ const _c1 = ["*"];
15
+ const _c2 = a0 => ({ required: a0 });
16
+ function FormField_Conditional_0_Template(rf, ctx) { if (rf & 1) {
17
+ i0.ɵɵdomElementStart(0, "label");
18
+ i0.ɵɵtext(1);
19
+ i0.ɵɵdomElementEnd();
20
+ } if (rf & 2) {
21
+ const ctx_r0 = i0.ɵɵnextContext();
22
+ i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().label(i0.ɵɵpureFunction1(4, _c2, !!ctx_r0.required)), ctx_r0.cm().labelBlock));
23
+ i0.ɵɵattribute("for", ctx_r0.labelFor() || ctx_r0.fieldId());
24
+ i0.ɵɵadvance();
25
+ i0.ɵɵtextInterpolate(ctx_r0.label);
26
+ } }
27
+ function FormField_Conditional_4_Template(rf, ctx) { if (rf & 1) {
28
+ i0.ɵɵdomElementStart(0, "p");
29
+ i0.ɵɵtext(1);
30
+ i0.ɵɵdomElementEnd();
31
+ } if (rf & 2) {
32
+ const ctx_r0 = i0.ɵɵnextContext();
33
+ i0.ɵɵclassMap(ctx_r0.cm().formError);
34
+ i0.ɵɵattribute("id", ctx_r0.errorId);
35
+ i0.ɵɵadvance();
36
+ i0.ɵɵtextInterpolate(ctx_r0.error);
37
+ } }
38
+ function FormField_Conditional_5_Template(rf, ctx) { if (rf & 1) {
39
+ i0.ɵɵdomElementStart(0, "p");
40
+ i0.ɵɵtext(1);
41
+ i0.ɵɵdomElementEnd();
42
+ } if (rf & 2) {
43
+ const ctx_r0 = i0.ɵɵnextContext();
44
+ i0.ɵɵclassMap(ctx_r0.cm().formHint);
45
+ i0.ɵɵattribute("id", ctx_r0.hintId);
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵtextInterpolate(ctx_r0.hint);
48
+ } }
49
+ /** The native controls a single field child may render. */
50
+ const FIELD_SELECTOR = 'input, select, textarea';
51
+ /**
52
+ * FormField component.
53
+ *
54
+ * The host is the root `<div>` (`div[mol-form-field]`). React clones a single
55
+ * child element, adding `id`, `aria-describedby` and `aria-invalid` to its
56
+ * props; Angular cannot clone a projected component, so those values are
57
+ * registered on the host as a {@link FormFieldContext} that the field
58
+ * components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
59
+ */
60
+ export class FormField {
61
+ /** Field label. */
62
+ label;
63
+ /** Field name (drives the ids). */
64
+ name;
65
+ /** Error message (renders and associates via aria-describedby). */
66
+ error;
67
+ /** Hint text (shown without an error). */
68
+ hint;
69
+ /** Marks the field required (label styling). */
70
+ required;
71
+ /** Extra classes for the wrapper. */
72
+ className;
73
+ /** Inline style object (React camelCase). */
74
+ style;
75
+ /** `data-testid`. */
76
+ testId;
77
+ /** The projected-children capture point. */
78
+ capture;
79
+ /** The label's `for` target (the single child's control id, read after view init). */
80
+ labelFor = signal('', /* @ts-ignore */
81
+ ...(ngDevMode ? [{ debugName: "labelFor" }] : /* istanbul ignore next */ []));
82
+ /** A generated id used when `name` is absent (the normalizer renumbers it). */
83
+ generatedId = nextInstanceId();
84
+ host = inject(ElementRef);
85
+ renderer = inject(Renderer2);
86
+ sync = new SlotWrapper(this.host, this.renderer);
87
+ /** Cached single-child determination (the capture empties at view init). */
88
+ singleCache = null;
89
+ /** Registers the field context before any projected child resolves it. */
90
+ constructor() {
91
+ provideDomContext(this.host.nativeElement, new FormFieldContextValue(this));
92
+ }
93
+ /**
94
+ * The current class map.
95
+ * @returns The UIClassMap.
96
+ */
97
+ cm() {
98
+ return getClassMap();
99
+ }
100
+ /**
101
+ * The field id (`name`, or a generated id).
102
+ * @returns The id.
103
+ */
104
+ fieldId() {
105
+ return this.name || this.generatedId;
106
+ }
107
+ /**
108
+ * The error paragraph's id.
109
+ * @returns The id.
110
+ */
111
+ get errorId() {
112
+ return `${this.fieldId()}-error`;
113
+ }
114
+ /**
115
+ * The hint paragraph's id.
116
+ * @returns The id.
117
+ */
118
+ get hintId() {
119
+ return `${this.fieldId()}-hint`;
120
+ }
121
+ /**
122
+ * The id the field should describe itself with (error wins over hint).
123
+ * @returns The id, or undefined.
124
+ */
125
+ describedByTarget() {
126
+ if (this.error)
127
+ return this.errorId;
128
+ if (this.hint)
129
+ return this.hintId;
130
+ return undefined;
131
+ }
132
+ /**
133
+ * The wrapper class list.
134
+ * @returns The class string.
135
+ */
136
+ classes() {
137
+ return this.cm().cn(this.cm().inputWrapper, this.cm().sp('mb', 4), this.className);
138
+ }
139
+ /**
140
+ * Serializes the wrapper's inline style.
141
+ * @returns The style attribute text.
142
+ */
143
+ hostStyle() {
144
+ return styleText(this.style);
145
+ }
146
+ /**
147
+ * The capture span (a view query before view init, a DOM lookup after —
148
+ * the span lives directly under the host and is removed at view init).
149
+ * @returns The capture element, or null.
150
+ */
151
+ captureEl() {
152
+ return (this.capture?.nativeElement ??
153
+ this.host.nativeElement.querySelector('[data-mol-field-capture]'));
154
+ }
155
+ /**
156
+ * Whether the projected content is exactly one element (React clones only a
157
+ * single child). Cached: the children leave the capture span at view init.
158
+ * @returns True for a single element child.
159
+ */
160
+ singleChild() {
161
+ if (this.singleCache !== null)
162
+ return this.singleCache;
163
+ const capture = this.captureEl();
164
+ if (!capture)
165
+ return false;
166
+ const children = Array.from(capture.childNodes);
167
+ const elements = children.filter((node) => node.nodeType === 1);
168
+ const hasText = children.some((node) => node.nodeType === 3 && (node.textContent ?? '').trim());
169
+ this.singleCache = elements.length === 1 && !hasText;
170
+ return this.singleCache;
171
+ }
172
+ /**
173
+ * Adopts the projected children bare into the host (React renders them
174
+ * directly), resolves the label target from the single child's control and
175
+ * patches a plain native control child (React's cloneElement props).
176
+ */
177
+ ngAfterViewInit() {
178
+ const capture = this.captureEl();
179
+ if (!capture)
180
+ return;
181
+ const host = this.host.nativeElement;
182
+ const children = Array.from(capture.childNodes);
183
+ const elements = children.filter((node) => node.nodeType === 1);
184
+ const single = this.singleChild();
185
+ for (const node of children)
186
+ host.insertBefore(node, capture);
187
+ if (single) {
188
+ const child = elements[0];
189
+ const control = child.matches(FIELD_SELECTOR)
190
+ ? child
191
+ : child.querySelector(FIELD_SELECTOR);
192
+ if (child.matches(FIELD_SELECTOR))
193
+ this.patchNativeControl(child);
194
+ this.labelFor.set(control?.id || this.fieldId());
195
+ }
196
+ else {
197
+ this.labelFor.set(this.fieldId());
198
+ }
199
+ this.sync.sync(capture, false, host);
200
+ }
201
+ /**
202
+ * Applies React's cloned props to a plain native form control child.
203
+ * @param control - The native control element.
204
+ */
205
+ patchNativeControl(control) {
206
+ control.setAttribute('id', this.fieldId());
207
+ const describedBy = this.describedByTarget();
208
+ if (describedBy) {
209
+ const existing = control.getAttribute('aria-describedby');
210
+ control.setAttribute('aria-describedby', [existing, describedBy].filter(Boolean).join(' '));
211
+ }
212
+ if (this.error)
213
+ control.setAttribute('aria-invalid', 'true');
214
+ }
215
+ /** Removes the context registration (unmount). */
216
+ ngOnDestroy() {
217
+ removeDomContext(this.host.nativeElement);
218
+ }
219
+ static ɵfac = function FormField_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FormField)(); };
220
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormField, selectors: [["div", "mol-form-field", ""]], viewQuery: function FormField_Query(rf, ctx) { if (rf & 1) {
221
+ i0.ɵɵviewQuery(_c0, 5);
222
+ } if (rf & 2) {
223
+ let _t;
224
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.capture = _t.first);
225
+ } }, hostVars: 5, hostBindings: function FormField_HostBindings(rf, ctx) { if (rf & 2) {
226
+ i0.ɵɵattribute("data-testid", ctx.testId);
227
+ i0.ɵɵstyleMap(ctx.hostStyle());
228
+ i0.ɵɵclassMap(ctx.classes());
229
+ } }, inputs: { label: "label", name: "name", error: "error", hint: "hint", required: "required", className: "className", style: "style", testId: "testId" }, ngContentSelectors: _c1, decls: 6, vars: 3, consts: [["capture", ""], [3, "class"], ["data-mol-field-capture", ""]], template: function FormField_Template(rf, ctx) { if (rf & 1) {
230
+ i0.ɵɵprojectionDef();
231
+ i0.ɵɵconditionalCreate(0, FormField_Conditional_0_Template, 2, 6, "label", 1);
232
+ i0.ɵɵdomElementStart(1, "span", 2, 0);
233
+ i0.ɵɵprojection(3);
234
+ i0.ɵɵdomElementEnd();
235
+ i0.ɵɵconditionalCreate(4, FormField_Conditional_4_Template, 2, 4, "p", 1);
236
+ i0.ɵɵconditionalCreate(5, FormField_Conditional_5_Template, 2, 4, "p", 1);
237
+ } if (rf & 2) {
238
+ i0.ɵɵconditional(ctx.label ? 0 : -1);
239
+ i0.ɵɵadvance(4);
240
+ i0.ɵɵconditional(ctx.error ? 4 : -1);
241
+ i0.ɵɵadvance();
242
+ i0.ɵɵconditional(ctx.hint && !ctx.error ? 5 : -1);
243
+ } }, encapsulation: 2 });
244
+ }
245
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormField, [{
246
+ type: Component,
247
+ args: [{
248
+ selector: 'div[mol-form-field]',
249
+ standalone: true,
250
+ inputs: ['label', 'name', 'error', 'hint', 'required', 'className', 'style', 'testId'],
251
+ host: {
252
+ '[class]': 'classes()',
253
+ '[style]': 'hostStyle()',
254
+ '[attr.data-testid]': 'testId',
255
+ },
256
+ template: `@if (label) {
257
+ <label
258
+ [attr.for]="labelFor() || fieldId()"
259
+ [class]="cm().cn(cm().label({ required: !!required }), cm().labelBlock)"
260
+ >{{ label }}</label
261
+ >
262
+ }
263
+ <span #capture data-mol-field-capture><ng-content></ng-content></span>
264
+ @if (error) {
265
+ <p [attr.id]="errorId" [class]="cm().formError">{{ error }}</p>
266
+ }
267
+ @if (hint && !error) {
268
+ <p [attr.id]="hintId" [class]="cm().formHint">{{ hint }}</p>
269
+ }`,
270
+ }]
271
+ }], () => [], { capture: [{
272
+ type: ViewChild,
273
+ args: ['capture']
274
+ }] }); })();
275
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormField, { className: "FormField", filePath: "components/form-field.component.ts", lineNumber: 63 }); })();
276
+ /** The field context a `FormField` registers (React's cloned child props). */
277
+ class FormFieldContextValue {
278
+ field;
279
+ /**
280
+ * Creates the context for a field.
281
+ *
282
+ * @param field - The owning form field.
283
+ */
284
+ constructor(field) {
285
+ this.field = field;
286
+ }
287
+ /** The field id (only for a single cloned child). */
288
+ get id() {
289
+ return this.field.singleChild() ? this.field.fieldId() : undefined;
290
+ }
291
+ /** The error/hint target (only for a single cloned child). */
292
+ get describedBy() {
293
+ return this.field.singleChild() ? this.field.describedByTarget() : undefined;
294
+ }
295
+ /** Whether the field is invalid (only for a single cloned child). */
296
+ get invalid() {
297
+ return this.field.singleChild() ? !!this.field.error : undefined;
298
+ }
299
+ }
300
+ //# sourceMappingURL=form-field.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.component.js","sourceRoot":"","sources":["../../src/components/form-field.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,E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,iBAAiB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAC9E,CAAC;IAED,qEAAqE;IACrE,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAClE,CAAC;CACF"}
@@ -0,0 +1,77 @@
1
+ import type { UIClassMap } from '@molecule/app-ui';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Form component.
5
+ *
6
+ * The host is the `<form>` itself (`form[mol-form]`), exactly React's root.
7
+ * A rejected async handler renders an accessible server-error list by
8
+ * default; a new submit clears the previous failure. Native action/method
9
+ * forms keep native submission.
10
+ */
11
+ export declare class Form {
12
+ /** Collects the form's data on submit (React's `onFormSubmit`). */
13
+ onFormSubmit?: (data: Record<string, unknown>) => void | Promise<void>;
14
+ /** Receives the submit event (React's `onSubmit`). */
15
+ onSubmit?: (event: Event) => void | Promise<void>;
16
+ /** Receives the reset event (React's `onReset`). */
17
+ onReset?: (event: Event) => void;
18
+ /** Whether the form is submitting (disables the fieldset). */
19
+ submitting?: boolean;
20
+ /** A failure managed by an external form controller. */
21
+ submitError?: unknown;
22
+ /** Native form action. */
23
+ action?: string;
24
+ /** Native form method. */
25
+ method?: string;
26
+ /** Whether native validation is disabled. */
27
+ noValidate?: boolean;
28
+ /** Extra classes for the form. */
29
+ className?: string;
30
+ /** Inline style object (React camelCase). */
31
+ style?: Record<string, unknown>;
32
+ /** `data-testid`. */
33
+ testId?: string;
34
+ /** Whether a submit is in flight. */
35
+ readonly pending: import("@angular/core").WritableSignal<boolean>;
36
+ /** The failure the last submit produced. */
37
+ private readonly failure;
38
+ /** A submit counter: a later submit supersedes an earlier settling one. */
39
+ private attempt;
40
+ /**
41
+ * Reactive translation, read in the injection context. Its `t` reads the
42
+ * locale, so the view re-renders the text on a locale switch (the static `t`
43
+ * does not).
44
+ */
45
+ private readonly i18n;
46
+ /**
47
+ * The current class map.
48
+ * @returns The UIClassMap.
49
+ */
50
+ cm(): UIClassMap;
51
+ /**
52
+ * Serializes the form's inline style.
53
+ * @returns The style attribute text.
54
+ */
55
+ hostStyle(): string | null;
56
+ /**
57
+ * The error messages to announce (React's `submitError`/`failure` branch).
58
+ * @returns The messages.
59
+ */
60
+ messages(): string[];
61
+ /**
62
+ * Handles a submit event: collects `FormData` for `onFormSubmit`, calls
63
+ * both handlers, and tracks failure/pending (React's `handleSubmit`).
64
+ *
65
+ * @param event - The submit event.
66
+ */
67
+ handleSubmit(event: Event): Promise<void>;
68
+ /**
69
+ * Calls the reset handler (React's `onReset` through the rest spread).
70
+ *
71
+ * @param event - The reset event.
72
+ */
73
+ handleReset(event: Event): void;
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<Form, never>;
75
+ static ɵcmp: i0.ɵɵComponentDeclaration<Form, "form[mol-form]", never, { "onFormSubmit": { "alias": "onFormSubmit"; "required": false; }; "onSubmit": { "alias": "onSubmit"; "required": false; }; "onReset": { "alias": "onReset"; "required": false; }; "submitting": { "alias": "submitting"; "required": false; }; "submitError": { "alias": "submitError"; "required": false; }; "action": { "alias": "action"; "required": false; }; "method": { "alias": "method"; "required": false; }; "noValidate": { "alias": "noValidate"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, {}, never, ["*"], true, never>;
76
+ }
77
+ //# sourceMappingURL=form.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.component.d.ts","sourceRoot":"","sources":["../../src/components/form.component.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMlD;;;;;;;GAOG;AACH,qBAwCa,IAAI;IACf,mEAAmE;IACnE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO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