@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,95 @@
1
+ /**
2
+ * UserMenu component (React parity): an avatar trigger that opens the app's
3
+ * settings panel in a drawer.
4
+ *
5
+ * @module
6
+ */
7
+ import { type AfterViewInit, ElementRef, type OnDestroy } from '@angular/core';
8
+ import type { IconName } from '@molecule/app-icons';
9
+ import type { UIClassMap } from '@molecule/app-ui';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * UserMenu component.
13
+ *
14
+ * React's root is a FRAGMENT (the trigger button plus a drawer), so the host
15
+ * is unwrapped (`data-parity-unwrap`, `display: contents`) and the trigger
16
+ * button is adopted beside it — the rendered tree and focus paths match
17
+ * React's (a route change must restore focus to the trigger). The panel
18
+ * content is projected inside the drawer through `PanelCloseProvider`.
19
+ */
20
+ export declare class UserMenu implements AfterViewInit, OnDestroy {
21
+ /** i18n key for the trigger's aria-label (default `userMenu.open`). */
22
+ ariaLabelKey?: string;
23
+ /** Fallback aria-label (default `Open user menu`). */
24
+ ariaLabelDefault?: string;
25
+ /** Icon name for the trigger (default `user`). */
26
+ triggerIcon?: IconName;
27
+ /** Pixel size for the trigger icon (default 20). */
28
+ triggerIconSize?: number;
29
+ /** `data-mol-id` for the trigger (default `user-menu`). */
30
+ dataMolId: string;
31
+ /** Extra classes composed onto the trigger. */
32
+ className?: string;
33
+ /** Whether the trigger is disabled. */
34
+ disabled?: boolean;
35
+ /** Overrides the trigger click (called instead of opening the panel). */
36
+ onClick?: () => void;
37
+ /** Which side the panel opens from (default `right`). */
38
+ side: 'left' | 'right';
39
+ /** Whether the drawer is open. */
40
+ readonly isOpen: import("@angular/core").WritableSignal<boolean>;
41
+ /** Router state: a route change closes the drawer (React's effect). */
42
+ readonly router: import("@molecule/app-angular").UseRouterResult;
43
+ /**
44
+ * Reactive translation, read in the injection context. Its `t` reads the
45
+ * locale, so the view re-renders the text on a locale switch (the static `t`
46
+ * does not).
47
+ */
48
+ private readonly i18n;
49
+ /** The trigger button (adopted beside the host). */
50
+ trigger?: ElementRef<HTMLButtonElement>;
51
+ private readonly host;
52
+ private adopted;
53
+ private readonly routeEffect;
54
+ /**
55
+ * The current class map.
56
+ * @returns The UIClassMap.
57
+ */
58
+ cm(): UIClassMap;
59
+ /**
60
+ * The trigger's accessible label.
61
+ * @returns The label text.
62
+ */
63
+ ariaLabel(): string;
64
+ /**
65
+ * The drawer panel's accessible label.
66
+ * @returns The label text.
67
+ */
68
+ panelLabel(): string;
69
+ /**
70
+ * The trigger's class list (a 40x40 minimum target plus the caller's classes).
71
+ * @returns The class string.
72
+ */
73
+ triggerClasses(): string;
74
+ /**
75
+ * The drawer's class list (side-aware).
76
+ * @returns The class string.
77
+ */
78
+ drawerClasses(): string;
79
+ /** Closes the drawer (the panel-close context's callback). */
80
+ closePanel: () => void;
81
+ /**
82
+ * Opens the drawer unless a custom click handler intercepts (React passes
83
+ * the handler straight to the button, so it receives the click event).
84
+ *
85
+ * @param event - The click event.
86
+ */
87
+ handleTriggerClick(event: MouseEvent): void;
88
+ /** Adopts the trigger beside the host (React's fragment root). */
89
+ ngAfterViewInit(): void;
90
+ /** Restores the adopted trigger (unmount). */
91
+ ngOnDestroy(): void;
92
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserMenu, never>;
93
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserMenu, "mol-user-menu", never, { "ariaLabelKey": { "alias": "ariaLabelKey"; "required": false; }; "ariaLabelDefault": { "alias": "ariaLabelDefault"; "required": false; }; "triggerIcon": { "alias": "triggerIcon"; "required": false; }; "triggerIconSize": { "alias": "triggerIconSize"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; "className": { "alias": "className"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "side": { "alias": "side"; "required": false; }; }, {}, never, ["*"], true, never>;
94
+ }
95
+ //# sourceMappingURL=user-menu.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-menu.component.d.ts","sourceR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AU,IAAI,MAAM;IAIpB;;;OAGG;IACH,cAAc,IAAI,MAAM;IAIxB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAMvB,8DAA8D;IAC9D,UAAU,QAAO,IAAI,CAEpB;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAK3C,kEAAkE;IAClE,eAAe,IAAI,IAAI;IASvB,8CAA8C;IAC9C,WAAW,IAAI,IAAI;yCAvHR,QAAQ;2CAAR,QAAQ;CA0HpB"}
@@ -0,0 +1,218 @@
1
+ /**
2
+ * UserMenu component (React parity): an avatar trigger that opens the app's
3
+ * settings panel in a drawer.
4
+ *
5
+ * @module
6
+ */
7
+ import { Component, effect, ElementRef, inject, signal, ViewChild, } from '@angular/core';
8
+ import { useRouter, useTranslation } from '@molecule/app-angular';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { Button } from './button.component.js';
11
+ import { Icon } from './icon.component.js';
12
+ import { Modal } from './modal.component.js';
13
+ import { PanelCloseProvider } from './panel-close.component.js';
14
+ import * as i0 from "@angular/core";
15
+ const _c0 = ["trigger"];
16
+ const _c1 = ["*"];
17
+ /**
18
+ * UserMenu component.
19
+ *
20
+ * React's root is a FRAGMENT (the trigger button plus a drawer), so the host
21
+ * is unwrapped (`data-parity-unwrap`, `display: contents`) and the trigger
22
+ * button is adopted beside it — the rendered tree and focus paths match
23
+ * React's (a route change must restore focus to the trigger). The panel
24
+ * content is projected inside the drawer through `PanelCloseProvider`.
25
+ */
26
+ export class UserMenu {
27
+ /** i18n key for the trigger's aria-label (default `userMenu.open`). */
28
+ ariaLabelKey;
29
+ /** Fallback aria-label (default `Open user menu`). */
30
+ ariaLabelDefault;
31
+ /** Icon name for the trigger (default `user`). */
32
+ triggerIcon;
33
+ /** Pixel size for the trigger icon (default 20). */
34
+ triggerIconSize;
35
+ /** `data-mol-id` for the trigger (default `user-menu`). */
36
+ dataMolId = 'user-menu';
37
+ /** Extra classes composed onto the trigger. */
38
+ className;
39
+ /** Whether the trigger is disabled. */
40
+ disabled;
41
+ /** Overrides the trigger click (called instead of opening the panel). */
42
+ onClick;
43
+ /** Which side the panel opens from (default `right`). */
44
+ side = 'right';
45
+ /** Whether the drawer is open. */
46
+ isOpen = signal(false, /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
48
+ /** Router state: a route change closes the drawer (React's effect). */
49
+ router = useRouter();
50
+ /**
51
+ * Reactive translation, read in the injection context. Its `t` reads the
52
+ * locale, so the view re-renders the text on a locale switch (the static `t`
53
+ * does not).
54
+ */
55
+ i18n = useTranslation();
56
+ /** The trigger button (adopted beside the host). */
57
+ trigger;
58
+ host = inject(ElementRef);
59
+ adopted = false;
60
+ routeEffect = effect(() => {
61
+ const location = this.router.location();
62
+ void `${location.pathname}${location.search}`;
63
+ // React's effect runs on mount too; closing an already-closed drawer is a no-op.
64
+ this.isOpen.set(false);
65
+ }, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "routeEffect" }] : /* istanbul ignore next */ []));
67
+ /**
68
+ * The current class map.
69
+ * @returns The UIClassMap.
70
+ */
71
+ cm() {
72
+ return getClassMap();
73
+ }
74
+ /**
75
+ * The trigger's accessible label.
76
+ * @returns The label text.
77
+ */
78
+ ariaLabel() {
79
+ return this.i18n.t(this.ariaLabelKey ?? 'userMenu.open', {}, {
80
+ defaultValue: this.ariaLabelDefault ?? 'Open user menu',
81
+ });
82
+ }
83
+ /**
84
+ * The drawer panel's accessible label.
85
+ * @returns The label text.
86
+ */
87
+ panelLabel() {
88
+ return this.i18n.t('userMenu.panelLabel', {}, { defaultValue: 'Account menu' });
89
+ }
90
+ /**
91
+ * The trigger's class list (a 40x40 minimum target plus the caller's classes).
92
+ * @returns The class string.
93
+ */
94
+ triggerClasses() {
95
+ return this.cm().cn(this.cm().minH(10), this.cm().minW(10), this.className);
96
+ }
97
+ /**
98
+ * The drawer's class list (side-aware).
99
+ * @returns The class string.
100
+ */
101
+ drawerClasses() {
102
+ return this.side === 'left'
103
+ ? this.cm().cn(this.cm().drawer, this.cm().drawerLeft)
104
+ : this.cm().drawer;
105
+ }
106
+ /** Closes the drawer (the panel-close context's callback). */
107
+ closePanel = () => {
108
+ this.isOpen.set(false);
109
+ };
110
+ /**
111
+ * Opens the drawer unless a custom click handler intercepts (React passes
112
+ * the handler straight to the button, so it receives the click event).
113
+ *
114
+ * @param event - The click event.
115
+ */
116
+ handleTriggerClick(event) {
117
+ if (this.onClick)
118
+ this.onClick(event);
119
+ else
120
+ this.isOpen.set(true);
121
+ }
122
+ /** Adopts the trigger beside the host (React's fragment root). */
123
+ ngAfterViewInit() {
124
+ const trigger = this.trigger?.nativeElement;
125
+ const host = this.host.nativeElement;
126
+ if (trigger && host.parentNode) {
127
+ host.parentNode.insertBefore(trigger, host);
128
+ this.adopted = true;
129
+ }
130
+ }
131
+ /** Restores the adopted trigger (unmount). */
132
+ ngOnDestroy() {
133
+ if (this.adopted)
134
+ this.host.nativeElement.appendChild(this.trigger?.nativeElement);
135
+ }
136
+ static ɵfac = function UserMenu_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || UserMenu)(); };
137
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserMenu, selectors: [["mol-user-menu"]], viewQuery: function UserMenu_Query(rf, ctx) { if (rf & 1) {
138
+ i0.ɵɵviewQuery(_c0, 5, ElementRef);
139
+ } if (rf & 2) {
140
+ let _t;
141
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.trigger = _t.first);
142
+ } }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { ariaLabelKey: "ariaLabelKey", ariaLabelDefault: "ariaLabelDefault", triggerIcon: "triggerIcon", triggerIconSize: "triggerIconSize", dataMolId: "dataMolId", className: "className", disabled: "disabled", onClick: "onClick", side: "side" }, ngContentSelectors: _c1, decls: 6, vars: 12, consts: [["trigger", ""], ["mol-button", "", 3, "click", "variant", "size", "className", "disabled"], ["mol-icon-root", "", 3, "name", "size"], [3, "close", "open", "className"], [3, "close"]], template: function UserMenu_Template(rf, ctx) { if (rf & 1) {
143
+ i0.ɵɵprojectionDef();
144
+ i0.ɵɵelementStart(0, "button", 1, 0);
145
+ i0.ɵɵlistener("click", function UserMenu_Template_button_click_0_listener($event) { return ctx.handleTriggerClick($event); });
146
+ i0.ɵɵnamespaceSVG();
147
+ i0.ɵɵelement(2, "svg", 2);
148
+ i0.ɵɵelementEnd();
149
+ i0.ɵɵnamespaceHTML();
150
+ i0.ɵɵelementStart(3, "mol-modal", 3);
151
+ i0.ɵɵlistener("close", function UserMenu_Template_mol_modal_close_3_listener() { return ctx.isOpen.set(false); });
152
+ i0.ɵɵelementStart(4, "mol-panel-close-provider", 4);
153
+ i0.ɵɵprojection(5);
154
+ i0.ɵɵelementEnd()();
155
+ } if (rf & 2) {
156
+ i0.ɵɵproperty("variant", "ghost")("size", "sm")("className", ctx.triggerClasses())("disabled", !!ctx.disabled);
157
+ i0.ɵɵattribute("aria-label", ctx.ariaLabel())("data-mol-id", ctx.dataMolId);
158
+ i0.ɵɵadvance(2);
159
+ i0.ɵɵproperty("name", ctx.triggerIcon ?? "user")("size", ctx.triggerIconSize ?? 20);
160
+ i0.ɵɵadvance();
161
+ i0.ɵɵproperty("open", ctx.isOpen())("className", ctx.drawerClasses());
162
+ i0.ɵɵattribute("aria-label", ctx.panelLabel());
163
+ i0.ɵɵadvance();
164
+ i0.ɵɵproperty("close", ctx.closePanel);
165
+ } }, dependencies: [Button, Icon, Modal, PanelCloseProvider], encapsulation: 2 });
166
+ }
167
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserMenu, [{
168
+ type: Component,
169
+ args: [{
170
+ selector: 'mol-user-menu',
171
+ standalone: true,
172
+ imports: [Button, Icon, Modal, PanelCloseProvider],
173
+ inputs: [
174
+ 'ariaLabelKey',
175
+ 'ariaLabelDefault',
176
+ 'triggerIcon',
177
+ 'triggerIconSize',
178
+ 'dataMolId',
179
+ 'className',
180
+ 'disabled',
181
+ 'onClick',
182
+ 'side',
183
+ ],
184
+ host: {
185
+ 'data-parity-unwrap': '',
186
+ style: 'display: contents',
187
+ },
188
+ template: `<button
189
+ #trigger
190
+ mol-button
191
+ [variant]="'ghost'"
192
+ [size]="'sm'"
193
+ [className]="triggerClasses()"
194
+ [disabled]="!!disabled"
195
+ (click)="handleTriggerClick($event)"
196
+ [attr.aria-label]="ariaLabel()"
197
+ [attr.data-mol-id]="dataMolId"
198
+ >
199
+ <svg
200
+ mol-icon-root
201
+ [name]="triggerIcon ?? 'user'"
202
+ [size]="triggerIconSize ?? 20"
203
+ ></svg></button
204
+ ><mol-modal
205
+ [open]="isOpen()"
206
+ (close)="isOpen.set(false)"
207
+ [className]="drawerClasses()"
208
+ [attr.aria-label]="panelLabel()"
209
+ ><mol-panel-close-provider [close]="closePanel"
210
+ ><ng-content></ng-content></mol-panel-close-provider
211
+ ></mol-modal>`,
212
+ }]
213
+ }], null, { trigger: [{
214
+ type: ViewChild,
215
+ args: ['trigger', { read: ElementRef }]
216
+ }] }); })();
217
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(UserMenu, { className: "UserMenu", filePath: "components/user-menu.component.ts", lineNumber: 82 }); })();
218
+ //# sourceMappingURL=user-menu.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-menu.component.js","sourceRoot":"","sources":["../../src/components/user-menu.component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,SAAS,EACT,MAAM,EACN,UAAU,EACV,MAAM,EAEN,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;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3B;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;kBAuBM;aACjB;;kBAkCE,SAAS;mBAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;;kFAjC/B,QAAQ"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook exports (React-compatible functions usable in an injection context).
3
+ *
4
+ * @module
5
+ */
6
+ export * from './use-is-desktop.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook exports (React-compatible functions usable in an injection context).
3
+ *
4
+ * @module
5
+ */
6
+ export * from './use-is-desktop.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Responsive hooks (React parity with `@molecule/app-ui-react`).
3
+ *
4
+ * @module
5
+ */
6
+ import { type Signal } from '@angular/core';
7
+ /**
8
+ * Whether the viewport is at least 768px wide (the fleet's `md` breakpoint).
9
+ *
10
+ * Reads `window.matchMedia` synchronously when the value is created, so the
11
+ * first render is already correct (no mobile-then-desktop swap frame), then
12
+ * follows `change` events. Guarded for non-browser environments (SSR/node):
13
+ * `false` (the mobile shell) when no `window.matchMedia` exists.
14
+ *
15
+ * Must be called in an injection context (a component field initializer or
16
+ * constructor).
17
+ *
18
+ * @param query - Override the media query. Defaults to `(min-width: 768px)`.
19
+ * @returns A signal of whether the desktop shell should mount.
20
+ */
21
+ export declare function useIsDesktop(query?: string): Signal<boolean>;
22
+ //# sourceMappingURL=use-is-desktop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-is-desktop.d.ts","sourceRoot":"","sources":["../../src/hooks/use-is-desktop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,KAAK,MAAM,EAAU,MAAM,eAAe,CAAA;AAKvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,CAAC,OAAO,CAAC,CAc3E"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Responsive hooks (React parity with `@molecule/app-ui-react`).
3
+ *
4
+ * @module
5
+ */
6
+ import { DestroyRef, inject, signal } from '@angular/core';
7
+ /** The fleet-wide responsive breakpoint, as a `matchMedia` query. */
8
+ const DESKTOP_QUERY = '(min-width: 768px)';
9
+ /**
10
+ * Whether the viewport is at least 768px wide (the fleet's `md` breakpoint).
11
+ *
12
+ * Reads `window.matchMedia` synchronously when the value is created, so the
13
+ * first render is already correct (no mobile-then-desktop swap frame), then
14
+ * follows `change` events. Guarded for non-browser environments (SSR/node):
15
+ * `false` (the mobile shell) when no `window.matchMedia` exists.
16
+ *
17
+ * Must be called in an injection context (a component field initializer or
18
+ * constructor).
19
+ *
20
+ * @param query - Override the media query. Defaults to `(min-width: 768px)`.
21
+ * @returns A signal of whether the desktop shell should mount.
22
+ */
23
+ export function useIsDesktop(query = DESKTOP_QUERY) {
24
+ const value = signal(typeof window === 'undefined' || typeof window.matchMedia !== 'function'
25
+ ? false
26
+ : window.matchMedia(query).matches, /* @ts-ignore */
27
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
28
+ const destroyRef = inject(DestroyRef);
29
+ if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
30
+ const mediaQuery = window.matchMedia(query);
31
+ const onChange = (event) => value.set(event.matches);
32
+ mediaQuery.addEventListener('change', onChange);
33
+ destroyRef.onDestroy(() => mediaQuery.removeEventListener('change', onChange));
34
+ }
35
+ return value.asReadonly();
36
+ }
37
+ //# sourceMappingURL=use-is-desktop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-is-desktop.js","sourceRoot":"","sources":["../../src/hooks/use-is-desktop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,eAAe,CAAA;AAEvE,qEAAqE;AACrE,MAAM,aAAa,GAAG,oBAAoB,CAAA;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB,aAAa;IACxD,MAAM,KAAK,GAAG,MAAM,CAClB,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;QACtE,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO;8EACrC,CAAA;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;IACrC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAC3C,MAAM,QAAQ,GAAG,CAAC,KAA0B,EAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC/E,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC/C,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,EAAE,CAAA;AAC3B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,22 +1,32 @@
1
1
  /**
2
2
  * Angular UI components for molecule.dev.
3
3
  *
4
- * Provides standalone Angular components implementing a SUBSET of the
5
- * `@molecule/app-ui` component interfaces, styled through the UIClassMap
6
- * abstraction. Ships 12 components — `MoleculeAlert`, `MoleculeBadge`,
7
- * `MoleculeButton`, `MoleculeCheckbox`, `MoleculeInput`, `MoleculeModal`,
8
- * `MoleculeRadioGroup`, `MoleculeSelect`, `MoleculeSpinner`,
9
- * `MoleculeSwitch`, `MoleculeToast`, `MoleculeTooltip` — each a standalone
10
- * component with a `mol-*` selector. Layout/data components (Card, Table,
11
- * Tabs, Accordion, Dropdown, Icon, …) are not implemented for Angular yet;
12
- * compose them from ClassMap classes via `getClassMap()`.
4
+ * Provides standalone Angular components at parity with `@molecule/app-ui-react`:
5
+ * every React export exists here under the same name, with the same props, the
6
+ * same rendered DOM (ClassMap classes, attributes, inline styles, text) and the
7
+ * same behaviour. The shared conformance kit
8
+ * (`@molecule/app-framework-conformance`) proves the parity.
9
+ *
10
+ * React-named exports include `Button`, `Card` (+ `CardHeader`, `CardTitle`,
11
+ * `CardDescription`, `CardContent`, `CardFooter`), `Input`, `Select`,
12
+ * `Textarea`, `Checkbox`, `RadioGroup`, `Switch`, `Accordion`, `Alert`,
13
+ * `Avatar`, `Badge`, `EmptyState`, `Icon`, `Label`, `Progress`, `Separator`,
14
+ * `Skeleton`, `Spinner`, `Tabs`, `Table`, `Pagination`, `Tooltip`, `Modal`,
15
+ * `Toast` (+ `ToastContainer`, `ToastProvider`), `ConfirmDialog`,
16
+ * `PromptDialog`, `Dropdown` (+ `DropdownLabel`, `DropdownSeparator`),
17
+ * `Form`, `FormField`, `LanguagePicker`, `PageHeader`, `PageShell`,
18
+ * `ResponsiveAppShell` (+ its `TopBar`, `Sidebar`, `Drawer`, `Content`
19
+ * parts), `SidebarUserCard`, `UserMenu`, `UserMenuPopover` (+ its `Trigger`,
20
+ * `Panel`, `SignOut` parts), `AuthGuard`, `ConfirmButton`,
21
+ * `OptimisticToggleButton`, `ThemeToggle`, and the hooks `useToast`,
22
+ * `usePanelClose`, `useIsDesktop` and `useUserMenuPopoverClose`.
13
23
  *
14
24
  * @example
15
25
  * ```ts
16
26
  * import { Component } from '@angular/core'
17
27
  * import { setClassMap } from '@molecule/app-ui'
18
28
  * import { classMap } from '@molecule/app-ui-tailwind'
19
- * import { MoleculeButton, MoleculeInput } from '@molecule/app-ui-angular'
29
+ * import { Button, Input } from '@molecule/app-ui-angular'
20
30
  *
21
31
  * // Once at startup, before the first component renders:
22
32
  * setClassMap(classMap)
@@ -24,10 +34,10 @@
24
34
  * @Component({
25
35
  * selector: 'app-save-panel',
26
36
  * standalone: true,
27
- * imports: [MoleculeButton, MoleculeInput],
37
+ * imports: [Button, Input],
28
38
  * template: `
29
- * <mol-input placeholder="Name" [value]="name" (handleInput)="onName($event)"></mol-input>
30
- * <mol-button color="primary" [loading]="saving" (handleClick)="save()">Save</mol-button>
39
+ * <input mol-input placeholder="Name" [value]="name" (change)="onName($event)" />
40
+ * <button mol-button color="primary" [loading]="saving" (click)="save()">Save</button>
31
41
  * `,
32
42
  * })
33
43
  * class SavePanel {
@@ -46,14 +56,19 @@
46
56
  * `@molecule/app-ui-tailwind`) is set. Call it in `main.ts` before `bootstrapApplication`.
47
57
  * - Components are standalone — add them to the `imports` array of the consuming component or
48
58
  * route; there is no NgModule.
49
- * - Event outputs are `handle*`, not the DOM names: `(handleClick)` on `mol-button`,
50
- * `(handleInput)`/`(handleChange)` on `mol-input` (both emit the raw DOM event — read the
51
- * value from `$event.target`). The host element uses `display: contents`, so the real
52
- * `<button>`/`<input>` lives inside the template.
59
+ * - A component's selector names the native element React renders at its root (an attribute
60
+ * selector such as `button[mol-button]`), so the host IS the root element. Components whose
61
+ * React root is a fragment or portal use an element selector whose host is
62
+ * `display: contents`.
63
+ * - Hooks (`useToast`, `usePanelClose`, `useIsDesktop`, `useUserMenuPopoverClose`) are called in
64
+ * an injection context (a component field initializer or constructor).
65
+ * - The original first-pass components remain exported under their `Molecule*` names
66
+ * (`MoleculeButton`, `MoleculeInput`, `MoleculeModal`, …) as deprecated aliases.
53
67
  *
54
68
  * @module
55
69
  */
56
70
  export * from './components/index.js';
71
+ export * from './hooks/index.js';
57
72
  export * from './types.js';
58
73
  export * from './utilities/index.js';
59
74
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA"}
package/dist/index.js CHANGED
@@ -1,22 +1,32 @@
1
1
  /**
2
2
  * Angular UI components for molecule.dev.
3
3
  *
4
- * Provides standalone Angular components implementing a SUBSET of the
5
- * `@molecule/app-ui` component interfaces, styled through the UIClassMap
6
- * abstraction. Ships 12 components — `MoleculeAlert`, `MoleculeBadge`,
7
- * `MoleculeButton`, `MoleculeCheckbox`, `MoleculeInput`, `MoleculeModal`,
8
- * `MoleculeRadioGroup`, `MoleculeSelect`, `MoleculeSpinner`,
9
- * `MoleculeSwitch`, `MoleculeToast`, `MoleculeTooltip` — each a standalone
10
- * component with a `mol-*` selector. Layout/data components (Card, Table,
11
- * Tabs, Accordion, Dropdown, Icon, …) are not implemented for Angular yet;
12
- * compose them from ClassMap classes via `getClassMap()`.
4
+ * Provides standalone Angular components at parity with `@molecule/app-ui-react`:
5
+ * every React export exists here under the same name, with the same props, the
6
+ * same rendered DOM (ClassMap classes, attributes, inline styles, text) and the
7
+ * same behaviour. The shared conformance kit
8
+ * (`@molecule/app-framework-conformance`) proves the parity.
9
+ *
10
+ * React-named exports include `Button`, `Card` (+ `CardHeader`, `CardTitle`,
11
+ * `CardDescription`, `CardContent`, `CardFooter`), `Input`, `Select`,
12
+ * `Textarea`, `Checkbox`, `RadioGroup`, `Switch`, `Accordion`, `Alert`,
13
+ * `Avatar`, `Badge`, `EmptyState`, `Icon`, `Label`, `Progress`, `Separator`,
14
+ * `Skeleton`, `Spinner`, `Tabs`, `Table`, `Pagination`, `Tooltip`, `Modal`,
15
+ * `Toast` (+ `ToastContainer`, `ToastProvider`), `ConfirmDialog`,
16
+ * `PromptDialog`, `Dropdown` (+ `DropdownLabel`, `DropdownSeparator`),
17
+ * `Form`, `FormField`, `LanguagePicker`, `PageHeader`, `PageShell`,
18
+ * `ResponsiveAppShell` (+ its `TopBar`, `Sidebar`, `Drawer`, `Content`
19
+ * parts), `SidebarUserCard`, `UserMenu`, `UserMenuPopover` (+ its `Trigger`,
20
+ * `Panel`, `SignOut` parts), `AuthGuard`, `ConfirmButton`,
21
+ * `OptimisticToggleButton`, `ThemeToggle`, and the hooks `useToast`,
22
+ * `usePanelClose`, `useIsDesktop` and `useUserMenuPopoverClose`.
13
23
  *
14
24
  * @example
15
25
  * ```ts
16
26
  * import { Component } from '@angular/core'
17
27
  * import { setClassMap } from '@molecule/app-ui'
18
28
  * import { classMap } from '@molecule/app-ui-tailwind'
19
- * import { MoleculeButton, MoleculeInput } from '@molecule/app-ui-angular'
29
+ * import { Button, Input } from '@molecule/app-ui-angular'
20
30
  *
21
31
  * // Once at startup, before the first component renders:
22
32
  * setClassMap(classMap)
@@ -24,10 +34,10 @@
24
34
  * @Component({
25
35
  * selector: 'app-save-panel',
26
36
  * standalone: true,
27
- * imports: [MoleculeButton, MoleculeInput],
37
+ * imports: [Button, Input],
28
38
  * template: `
29
- * <mol-input placeholder="Name" [value]="name" (handleInput)="onName($event)"></mol-input>
30
- * <mol-button color="primary" [loading]="saving" (handleClick)="save()">Save</mol-button>
39
+ * <input mol-input placeholder="Name" [value]="name" (change)="onName($event)" />
40
+ * <button mol-button color="primary" [loading]="saving" (click)="save()">Save</button>
31
41
  * `,
32
42
  * })
33
43
  * class SavePanel {
@@ -46,14 +56,19 @@
46
56
  * `@molecule/app-ui-tailwind`) is set. Call it in `main.ts` before `bootstrapApplication`.
47
57
  * - Components are standalone — add them to the `imports` array of the consuming component or
48
58
  * route; there is no NgModule.
49
- * - Event outputs are `handle*`, not the DOM names: `(handleClick)` on `mol-button`,
50
- * `(handleInput)`/`(handleChange)` on `mol-input` (both emit the raw DOM event — read the
51
- * value from `$event.target`). The host element uses `display: contents`, so the real
52
- * `<button>`/`<input>` lives inside the template.
59
+ * - A component's selector names the native element React renders at its root (an attribute
60
+ * selector such as `button[mol-button]`), so the host IS the root element. Components whose
61
+ * React root is a fragment or portal use an element selector whose host is
62
+ * `display: contents`.
63
+ * - Hooks (`useToast`, `usePanelClose`, `useIsDesktop`, `useUserMenuPopoverClose`) are called in
64
+ * an injection context (a component field initializer or constructor).
65
+ * - The original first-pass components remain exported under their `Molecule*` names
66
+ * (`MoleculeButton`, `MoleculeInput`, `MoleculeModal`, …) as deprecated aliases.
53
67
  *
54
68
  * @module
55
69
  */
56
70
  export * from './components/index.js';
71
+ export * from './hooks/index.js';
57
72
  export * from './types.js';
58
73
  export * from './utilities/index.js';
59
74
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA"}
package/dist/types.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- export type { AccordionItem, AccordionProps, AlertProps, AvatarProps, BadgeProps, BaseProps, ButtonElementProps, ButtonProps, ButtonVariant, CardProps, ChangeEventHandler, CheckboxProps, Children, ColorVariant, ContainerProps, CSSProperties, EventHandler, FlexProps, FocusEventHandler, FormElementProps, FormEventHandler, FormFieldProps, FormProps, GridProps, HTMLElementProps, InputElementProps, InputProps, InputType, KeyboardEventHandler, ModalProps, ModalSize, MouseEventHandler, PaginationProps, RadioGroupProps, RadioOption, SelectElementProps, SelectOption, SelectProps, Size, SkeletonProps, SpacerProps, SpinnerProps, SwitchProps, TabItem, TableColumn, TableProps, TabsProps, TextareaElementProps, TextareaProps, ToastProps, TooltipPlacement, TooltipProps, } from '@molecule/app-ui';
6
+ export type { AccordionItem, AccordionProps, AlertProps, AvatarProps, BadgeProps, BaseProps, ButtonElementProps, ButtonProps, ButtonVariant, CardProps, ChangeEventHandler, CheckboxProps, Children, ColorVariant, ContainerProps, CSSProperties, EventHandler, FlexProps, FocusEventHandler, FormElementProps, FormEventHandler, FormFieldProps, FormProps, GridProps, HTMLElementProps, InputElementProps, InputProps, InputType, KeyboardEventHandler, ModalProps, ModalSize, MouseEventHandler, PaginationProps, RadioGroupProps, SelectElementProps, SelectOption, SelectProps, Size, SkeletonProps, SpacerProps, SpinnerProps, SwitchProps, TabItem, TableColumn, TableProps, TabsProps, TextareaElementProps, TextareaProps, ToastProps, TooltipPlacement, TooltipProps, } from '@molecule/app-ui';
7
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAE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