@molecule/app-ui-angular 1.2.1 → 1.3.0

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 (212) hide show
  1. package/README.md +2744 -912
  2. package/dist/components/accordion.component.d.ts +17 -2
  3. package/dist/components/accordion.component.d.ts.map +1 -1
  4. package/dist/components/accordion.component.js +31 -7
  5. package/dist/components/accordion.component.js.map +1 -1
  6. package/dist/components/alert.component.d.ts +15 -2
  7. package/dist/components/alert.component.d.ts.map +1 -1
  8. package/dist/components/alert.component.js +25 -4
  9. package/dist/components/alert.component.js.map +1 -1
  10. package/dist/components/auth-guard.component.d.ts +41 -9
  11. package/dist/components/auth-guard.component.d.ts.map +1 -1
  12. package/dist/components/auth-guard.component.js +58 -23
  13. package/dist/components/auth-guard.component.js.map +1 -1
  14. package/dist/components/avatar.component.d.ts +15 -2
  15. package/dist/components/avatar.component.d.ts.map +1 -1
  16. package/dist/components/avatar.component.js +35 -5
  17. package/dist/components/avatar.component.js.map +1 -1
  18. package/dist/components/badge.component.d.ts +15 -2
  19. package/dist/components/badge.component.d.ts.map +1 -1
  20. package/dist/components/badge.component.js +35 -6
  21. package/dist/components/badge.component.js.map +1 -1
  22. package/dist/components/button.component.d.ts +20 -2
  23. package/dist/components/button.component.d.ts.map +1 -1
  24. package/dist/components/button.component.js +30 -4
  25. package/dist/components/button.component.js.map +1 -1
  26. package/dist/components/card.component.d.ts +67 -9
  27. package/dist/components/card.component.d.ts.map +1 -1
  28. package/dist/components/card.component.js +99 -17
  29. package/dist/components/card.component.js.map +1 -1
  30. package/dist/components/checkbox.component.d.ts +35 -5
  31. package/dist/components/checkbox.component.d.ts.map +1 -1
  32. package/dist/components/checkbox.component.js +59 -9
  33. package/dist/components/checkbox.component.js.map +1 -1
  34. package/dist/components/confirm-button.component.d.ts +85 -17
  35. package/dist/components/confirm-button.component.d.ts.map +1 -1
  36. package/dist/components/confirm-button.component.js +112 -25
  37. package/dist/components/confirm-button.component.js.map +1 -1
  38. package/dist/components/confirm-dialog.component.d.ts +50 -13
  39. package/dist/components/confirm-dialog.component.d.ts.map +1 -1
  40. package/dist/components/confirm-dialog.component.js +118 -31
  41. package/dist/components/confirm-dialog.component.js.map +1 -1
  42. package/dist/components/dropdown.component.d.ts +30 -4
  43. package/dist/components/dropdown.component.d.ts.map +1 -1
  44. package/dist/components/dropdown.component.js +80 -13
  45. package/dist/components/dropdown.component.js.map +1 -1
  46. package/dist/components/empty-state.component.d.ts +5 -1
  47. package/dist/components/empty-state.component.d.ts.map +1 -1
  48. package/dist/components/empty-state.component.js +5 -1
  49. package/dist/components/empty-state.component.js.map +1 -1
  50. package/dist/components/floating-input.component.d.ts +18 -4
  51. package/dist/components/floating-input.component.d.ts.map +1 -1
  52. package/dist/components/floating-input.component.js +38 -8
  53. package/dist/components/floating-input.component.js.map +1 -1
  54. package/dist/components/form-field.component.d.ts +14 -2
  55. package/dist/components/form-field.component.d.ts.map +1 -1
  56. package/dist/components/form-field.component.js +34 -5
  57. package/dist/components/form-field.component.js.map +1 -1
  58. package/dist/components/form.component.d.ts +61 -15
  59. package/dist/components/form.component.d.ts.map +1 -1
  60. package/dist/components/form.component.js +65 -14
  61. package/dist/components/form.component.js.map +1 -1
  62. package/dist/components/icon.component.d.ts +22 -4
  63. package/dist/components/icon.component.d.ts.map +1 -1
  64. package/dist/components/icon.component.js +1 -1
  65. package/dist/components/icon.component.js.map +1 -1
  66. package/dist/components/input.component.d.ts +34 -4
  67. package/dist/components/input.component.d.ts.map +1 -1
  68. package/dist/components/input.component.js +66 -11
  69. package/dist/components/input.component.js.map +1 -1
  70. package/dist/components/label.component.d.ts +5 -1
  71. package/dist/components/label.component.d.ts.map +1 -1
  72. package/dist/components/label.component.js +6 -2
  73. package/dist/components/label.component.js.map +1 -1
  74. package/dist/components/language-picker.component.d.ts +44 -8
  75. package/dist/components/language-picker.component.d.ts.map +1 -1
  76. package/dist/components/language-picker.component.js +29 -17
  77. package/dist/components/language-picker.component.js.map +1 -1
  78. package/dist/components/layout.component.d.ts +57 -8
  79. package/dist/components/layout.component.d.ts.map +1 -1
  80. package/dist/components/layout.component.js +134 -21
  81. package/dist/components/layout.component.js.map +1 -1
  82. package/dist/components/load-error-banner.component.d.ts +39 -7
  83. package/dist/components/load-error-banner.component.d.ts.map +1 -1
  84. package/dist/components/load-error-banner.component.js +68 -21
  85. package/dist/components/load-error-banner.component.js.map +1 -1
  86. package/dist/components/modal.component.d.ts +20 -3
  87. package/dist/components/modal.component.d.ts.map +1 -1
  88. package/dist/components/modal.component.js +40 -6
  89. package/dist/components/modal.component.js.map +1 -1
  90. package/dist/components/optimistic-toggle-button.component.d.ts +80 -19
  91. package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -1
  92. package/dist/components/optimistic-toggle-button.component.js +86 -25
  93. package/dist/components/optimistic-toggle-button.component.js.map +1 -1
  94. package/dist/components/page-header.component.d.ts +5 -1
  95. package/dist/components/page-header.component.d.ts.map +1 -1
  96. package/dist/components/page-header.component.js +5 -1
  97. package/dist/components/page-header.component.js.map +1 -1
  98. package/dist/components/page-shell.component.d.ts +5 -1
  99. package/dist/components/page-shell.component.d.ts.map +1 -1
  100. package/dist/components/page-shell.component.js +5 -1
  101. package/dist/components/page-shell.component.js.map +1 -1
  102. package/dist/components/pagination.component.d.ts +15 -2
  103. package/dist/components/pagination.component.d.ts.map +1 -1
  104. package/dist/components/pagination.component.js +26 -5
  105. package/dist/components/pagination.component.js.map +1 -1
  106. package/dist/components/panel-close.component.d.ts +10 -1
  107. package/dist/components/panel-close.component.d.ts.map +1 -1
  108. package/dist/components/panel-close.component.js +1 -1
  109. package/dist/components/panel-close.component.js.map +1 -1
  110. package/dist/components/progress.component.d.ts +51 -8
  111. package/dist/components/progress.component.d.ts.map +1 -1
  112. package/dist/components/progress.component.js +26 -5
  113. package/dist/components/progress.component.js.map +1 -1
  114. package/dist/components/prompt-dialog.component.d.ts +59 -16
  115. package/dist/components/prompt-dialog.component.d.ts.map +1 -1
  116. package/dist/components/prompt-dialog.component.js +129 -41
  117. package/dist/components/prompt-dialog.component.js.map +1 -1
  118. package/dist/components/radio-group.component.d.ts +16 -2
  119. package/dist/components/radio-group.component.d.ts.map +1 -1
  120. package/dist/components/radio-group.component.js +28 -5
  121. package/dist/components/radio-group.component.js.map +1 -1
  122. package/dist/components/responsive-app-shell.component.d.ts +155 -31
  123. package/dist/components/responsive-app-shell.component.d.ts.map +1 -1
  124. package/dist/components/responsive-app-shell.component.js +163 -54
  125. package/dist/components/responsive-app-shell.component.js.map +1 -1
  126. package/dist/components/select.component.d.ts +29 -4
  127. package/dist/components/select.component.d.ts.map +1 -1
  128. package/dist/components/select.component.js +55 -9
  129. package/dist/components/select.component.js.map +1 -1
  130. package/dist/components/separator.component.d.ts +37 -7
  131. package/dist/components/separator.component.d.ts.map +1 -1
  132. package/dist/components/separator.component.js +33 -6
  133. package/dist/components/separator.component.js.map +1 -1
  134. package/dist/components/sidebar-user-card.component.d.ts +28 -7
  135. package/dist/components/sidebar-user-card.component.d.ts.map +1 -1
  136. package/dist/components/sidebar-user-card.component.js +1 -1
  137. package/dist/components/sidebar-user-card.component.js.map +1 -1
  138. package/dist/components/skeleton.component.d.ts +23 -4
  139. package/dist/components/skeleton.component.d.ts.map +1 -1
  140. package/dist/components/skeleton.component.js +34 -7
  141. package/dist/components/skeleton.component.js.map +1 -1
  142. package/dist/components/spinner.component.d.ts +15 -2
  143. package/dist/components/spinner.component.d.ts.map +1 -1
  144. package/dist/components/spinner.component.js +34 -6
  145. package/dist/components/spinner.component.js.map +1 -1
  146. package/dist/components/switch.component.d.ts +30 -7
  147. package/dist/components/switch.component.d.ts.map +1 -1
  148. package/dist/components/switch.component.js +56 -11
  149. package/dist/components/switch.component.js.map +1 -1
  150. package/dist/components/table.component.d.ts +29 -3
  151. package/dist/components/table.component.d.ts.map +1 -1
  152. package/dist/components/table.component.js +63 -8
  153. package/dist/components/table.component.js.map +1 -1
  154. package/dist/components/tabs.component.d.ts +18 -3
  155. package/dist/components/tabs.component.d.ts.map +1 -1
  156. package/dist/components/tabs.component.js +74 -39
  157. package/dist/components/tabs.component.js.map +1 -1
  158. package/dist/components/textarea.component.d.ts +29 -4
  159. package/dist/components/textarea.component.d.ts.map +1 -1
  160. package/dist/components/textarea.component.js +55 -9
  161. package/dist/components/textarea.component.js.map +1 -1
  162. package/dist/components/theme-toggle.component.d.ts +25 -6
  163. package/dist/components/theme-toggle.component.d.ts.map +1 -1
  164. package/dist/components/theme-toggle.component.js +1 -1
  165. package/dist/components/theme-toggle.component.js.map +1 -1
  166. package/dist/components/toast.component.d.ts +27 -6
  167. package/dist/components/toast.component.d.ts.map +1 -1
  168. package/dist/components/toast.component.js +48 -14
  169. package/dist/components/toast.component.js.map +1 -1
  170. package/dist/components/tooltip.component.d.ts +57 -5
  171. package/dist/components/tooltip.component.d.ts.map +1 -1
  172. package/dist/components/tooltip.component.js +103 -11
  173. package/dist/components/tooltip.component.js.map +1 -1
  174. package/dist/components/user-menu-popover.component.d.ts +68 -14
  175. package/dist/components/user-menu-popover.component.d.ts.map +1 -1
  176. package/dist/components/user-menu-popover.component.js +4 -4
  177. package/dist/components/user-menu-popover.component.js.map +1 -1
  178. package/dist/components/user-menu.component.d.ts +33 -9
  179. package/dist/components/user-menu.component.d.ts.map +1 -1
  180. package/dist/components/user-menu.component.js +1 -1
  181. package/dist/components/user-menu.component.js.map +1 -1
  182. package/dist/index.d.ts +4 -0
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +4 -0
  185. package/dist/index.js.map +1 -1
  186. package/dist/types.d.ts +1 -1
  187. package/dist/types.d.ts.map +1 -1
  188. package/dist/utilities/element-props.d.ts +78 -0
  189. package/dist/utilities/element-props.d.ts.map +1 -0
  190. package/dist/utilities/element-props.js +166 -0
  191. package/dist/utilities/element-props.js.map +1 -0
  192. package/dist/utilities/element.d.ts +34 -0
  193. package/dist/utilities/element.d.ts.map +1 -0
  194. package/dist/utilities/element.js +24 -0
  195. package/dist/utilities/element.js.map +1 -0
  196. package/dist/utilities/index.d.ts +2 -0
  197. package/dist/utilities/index.d.ts.map +1 -1
  198. package/dist/utilities/index.js +2 -0
  199. package/dist/utilities/index.js.map +1 -1
  200. package/dist/utilities/node-value.d.ts +1 -1
  201. package/dist/utilities/node-value.d.ts.map +1 -1
  202. package/dist/utilities/node-value.js +6 -2
  203. package/dist/utilities/node-value.js.map +1 -1
  204. package/dist/utilities/render-icon.d.ts +3 -2
  205. package/dist/utilities/render-icon.d.ts.map +1 -1
  206. package/dist/utilities/render-icon.js +6 -3
  207. package/dist/utilities/render-icon.js.map +1 -1
  208. package/dist/utilities/rest-attrs.d.ts +26 -2
  209. package/dist/utilities/rest-attrs.d.ts.map +1 -1
  210. package/dist/utilities/rest-attrs.js +37 -0
  211. package/dist/utilities/rest-attrs.js.map +1 -1
  212. package/package.json +4 -3
@@ -1,4 +1,5 @@
1
1
  import type { UIClassMap } from '@molecule/app-ui';
2
+ import { type HasElement } from '../utilities/element.js';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
4
5
  * Skeleton loading placeholder.
@@ -7,7 +8,10 @@ import * as i0 from "@angular/core";
7
8
  * number-or-string shapes (numbers become px), and a circle skeleton without
8
9
  * a height uses the width for both, exactly like React.
9
10
  */
10
- export declare class Skeleton {
11
+ export declare class Skeleton implements HasElement<HTMLDivElement> {
12
+ private readonly host;
13
+ /** The element a caller's ref receives: the host `<div>`. */
14
+ readonly element: import("@angular/core").Signal<HTMLDivElement | null>;
11
15
  /** Width (number = px, or any CSS value). */
12
16
  width?: number | string;
13
17
  /** Height (number = px, or any CSS value). */
@@ -24,6 +28,10 @@ export declare class Skeleton {
24
28
  style?: Record<string, unknown>;
25
29
  /** `data-testid`. */
26
30
  testId?: string;
31
+ /** `data-mol-id` automation id (React's `automationId`). */
32
+ automationId?: string;
33
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
34
+ dataMolId?: string;
27
35
  /**
28
36
  * The current class map.
29
37
  * @returns The UIClassMap.
@@ -34,18 +42,26 @@ export declare class Skeleton {
34
42
  * @returns The class string.
35
43
  */
36
44
  classes(): string;
45
+ /**
46
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
47
+ * @returns The attribute value.
48
+ */
49
+ molId(): string | undefined;
37
50
  /**
38
51
  * Serializes the merged inline style.
39
52
  * @returns The style attribute text.
40
53
  */
41
54
  hostStyle(): string | null;
42
55
  static ɵfac: i0.ɵɵFactoryDeclaration<Skeleton, never>;
43
- static ɵcmp: i0.ɵɵComponentDeclaration<Skeleton, "div[mol-skeleton]", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "circle": { "alias": "circle"; "required": false; }; "borderRadius": { "alias": "borderRadius"; "required": false; }; "animation": { "alias": "animation"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, {}, never, never, true, never>;
56
+ static ɵcmp: i0.ɵɵComponentDeclaration<Skeleton, "div[mol-skeleton]", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "circle": { "alias": "circle"; "required": false; }; "borderRadius": { "alias": "borderRadius"; "required": false; }; "animation": { "alias": "animation"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; }, {}, never, never, true, never>;
44
57
  }
45
58
  /**
46
59
  * Skeleton text lines (a container with N skeleton bars; the last one is 60%).
47
60
  */
48
- export declare class SkeletonText {
61
+ export declare class SkeletonText implements HasElement<HTMLDivElement> {
62
+ private readonly host;
63
+ /** The element a caller's ref receives: the host `<div>`. */
64
+ readonly element: import("@angular/core").Signal<HTMLDivElement | null>;
49
65
  /** Number of skeleton lines. */
50
66
  lines: number;
51
67
  /** Extra classes. */
@@ -74,7 +90,10 @@ export declare class SkeletonText {
74
90
  * React renders `<Skeleton circle width={size} height={size} className/>` —
75
91
  * a single div; the host IS that div (no wrapper).
76
92
  */
77
- export declare class SkeletonCircle {
93
+ export declare class SkeletonCircle implements HasElement<HTMLDivElement> {
94
+ private readonly host;
95
+ /** The element a caller's ref receives: the host `<div>` (the skeleton itself). */
96
+ readonly element: import("@angular/core").Signal<HTMLDivElement | null>;
78
97
  /** Circle diameter in pixels. */
79
98
  size: number;
80
99
  /** Extra classes. */
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton.component.d.ts","sourceRoot":"","sources":["../../src/components/skeleton.component.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAKlD;;;;;;GAMG;AACH,qBAoBa,QAAQ;IACnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,wCAAwC;IACxC,MAAM,UAAQ;IACd,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,uBAAuB;IACvB,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAU;IAC9C,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAUjB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;yCA5Cf,QAAQ;2CAAR,QAAQ;CA6DpB;AAED;;GAEG;AACH,qBAYa,YAAY;IACvB,gCAAgC;IAChC,KAAK,SAAI;IACT,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAEl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6
- import { Component } from '@angular/core';
6
+ import { Component, ElementRef, inject } from '@angular/core';
7
7
  import { getClassMap } from '@molecule/app-ui';
8
+ import { hostElement } from '../utilities/element.js';
8
9
  import { styleText } from '../utilities/style.js';
9
10
  import * as i0 from "@angular/core";
10
11
  function SkeletonText_For_1_Template(rf, ctx) { if (rf & 1) {
@@ -22,6 +23,9 @@ function SkeletonText_For_1_Template(rf, ctx) { if (rf & 1) {
22
23
  * a height uses the width for both, exactly like React.
23
24
  */
24
25
  export class Skeleton {
26
+ host = inject(ElementRef);
27
+ /** The element a caller's ref receives: the host `<div>`. */
28
+ element = hostElement(this.host);
25
29
  /** Width (number = px, or any CSS value). */
26
30
  width;
27
31
  /** Height (number = px, or any CSS value). */
@@ -38,6 +42,10 @@ export class Skeleton {
38
42
  style;
39
43
  /** `data-testid`. */
40
44
  testId;
45
+ /** `data-mol-id` automation id (React's `automationId`). */
46
+ automationId;
47
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
48
+ dataMolId;
41
49
  /**
42
50
  * The current class map.
43
51
  * @returns The UIClassMap.
@@ -52,6 +60,16 @@ export class Skeleton {
52
60
  classes() {
53
61
  return this.cm().cn(this.cm().skeleton(), this.circle && this.cm().skeletonCircle, this.animation === 'none' && this.cm().skeletonNone, this.animation === 'wave' && this.cm().skeletonWave, this.className);
54
62
  }
63
+ /**
64
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
65
+ * @returns The attribute value.
66
+ */
67
+ molId() {
68
+ return (this.automationId ??
69
+ this.dataMolId ??
70
+ this.host.nativeElement.getAttribute('data-mol-id') ??
71
+ undefined);
72
+ }
55
73
  /**
56
74
  * Serializes the merged inline style.
57
75
  * @returns The style attribute text.
@@ -74,11 +92,11 @@ export class Skeleton {
74
92
  return styleText(computed);
75
93
  }
76
94
  static ɵfac = function Skeleton_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Skeleton)(); };
77
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Skeleton, selectors: [["div", "mol-skeleton", ""]], hostVars: 5, hostBindings: function Skeleton_HostBindings(rf, ctx) { if (rf & 2) {
78
- i0.ɵɵattribute("data-testid", ctx.testId);
95
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Skeleton, selectors: [["div", "mol-skeleton", ""]], hostVars: 6, hostBindings: function Skeleton_HostBindings(rf, ctx) { if (rf & 2) {
96
+ i0.ɵɵattribute("data-testid", ctx.testId)("data-mol-id", ctx.molId());
79
97
  i0.ɵɵstyleMap(ctx.hostStyle());
80
98
  i0.ɵɵclassMap(ctx.classes());
81
- } }, inputs: { width: "width", height: "height", circle: "circle", borderRadius: "borderRadius", animation: "animation", className: "className", style: "style", testId: "testId" }, decls: 0, vars: 0, template: function Skeleton_Template(rf, ctx) { }, encapsulation: 2 });
99
+ } }, inputs: { width: "width", height: "height", circle: "circle", borderRadius: "borderRadius", animation: "animation", className: "className", style: "style", testId: "testId", automationId: "automationId", dataMolId: [0, "data-mol-id", "dataMolId"] }, decls: 0, vars: 0, template: function Skeleton_Template(rf, ctx) { }, encapsulation: 2 });
82
100
  }
83
101
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Skeleton, [{
84
102
  type: Component,
@@ -94,20 +112,26 @@ export class Skeleton {
94
112
  'className',
95
113
  'style',
96
114
  'testId',
115
+ 'automationId',
116
+ 'dataMolId: data-mol-id',
97
117
  ],
98
118
  host: {
99
119
  '[class]': 'classes()',
100
120
  '[style]': 'hostStyle()',
101
121
  '[attr.data-testid]': 'testId',
122
+ '[attr.data-mol-id]': 'molId()',
102
123
  },
103
124
  template: '',
104
125
  }]
105
126
  }], null, null); })();
106
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Skeleton, { className: "Skeleton", filePath: "components/skeleton.component.ts", lineNumber: 41 }); })();
127
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Skeleton, { className: "Skeleton", filePath: "components/skeleton.component.ts", lineNumber: 45 }); })();
107
128
  /**
108
129
  * Skeleton text lines (a container with N skeleton bars; the last one is 60%).
109
130
  */
110
131
  export class SkeletonText {
132
+ host = inject(ElementRef);
133
+ /** The element a caller's ref receives: the host `<div>`. */
134
+ element = hostElement(this.host);
111
135
  /** Number of skeleton lines. */
112
136
  lines = 3;
113
137
  /** Extra classes. */
@@ -157,7 +181,7 @@ export class SkeletonText {
157
181
  }`,
158
182
  }]
159
183
  }], null, null); })();
160
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkeletonText, { className: "SkeletonText", filePath: "components/skeleton.component.ts", lineNumber: 119 }); })();
184
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkeletonText, { className: "SkeletonText", filePath: "components/skeleton.component.ts", lineNumber: 144 }); })();
161
185
  /**
162
186
  * Skeleton circle (avatar placeholder).
163
187
  *
@@ -165,6 +189,9 @@ export class SkeletonText {
165
189
  * a single div; the host IS that div (no wrapper).
166
190
  */
167
191
  export class SkeletonCircle {
192
+ host = inject(ElementRef);
193
+ /** The element a caller's ref receives: the host `<div>` (the skeleton itself). */
194
+ element = hostElement(this.host);
168
195
  /** Circle diameter in pixels. */
169
196
  size = 40;
170
197
  /** Extra classes. */
@@ -210,5 +237,5 @@ export class SkeletonCircle {
210
237
  template: '',
211
238
  }]
212
239
  }], null, null); })();
213
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkeletonCircle, { className: "SkeletonCircle", filePath: "components/skeleton.component.ts", lineNumber: 166 }); })();
240
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkeletonCircle, { className: "SkeletonCircle", filePath: "components/skeleton.component.ts", lineNumber: 195 }); })();
214
241
  //# sourceMappingURL=skeleton.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton.component.js","s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IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACvE,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrE,CAAC;wGAjCU,cAAc;6DAAd,cAAc;YAAd,cAAA,eAAW,CAAG;YAAd,cAAA,aAAS,CAAK;;;iFAAd,cAAc;cAV1B,SAAS;eAAC;gBACT,QAAQ,EAAE,0BAA0B;gBACpC,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;gBAC7B,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,SAAS,EAAE,aAAa;iBACzB;gBACD,QAAQ,EAAE,EAAE;aACb;;kFACY,cAAc"}
@@ -1,4 +1,5 @@
1
1
  import type { Size, UIClassMap } from '@molecule/app-ui';
2
+ import { type HasElement } from '../utilities/element.js';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
4
5
  * Spinner component.
@@ -7,7 +8,10 @@ import * as i0 from "@angular/core";
7
8
  * color (not a known color name) is expressed as inline border colors, and
8
9
  * `data-*`/`aria-*` rest props land on the host (React's spread target).
9
10
  */
10
- export declare class Spinner {
11
+ export declare class Spinner implements HasElement<HTMLDivElement> {
12
+ private readonly host;
13
+ /** The element a caller's ref receives: the host `<div role="status">`. */
14
+ readonly element: import("@angular/core").Signal<HTMLDivElement | null>;
11
15
  /** Spinner size. */
12
16
  size: Size;
13
17
  /** Named color variant or a raw CSS color. */
@@ -20,6 +24,10 @@ export declare class Spinner {
20
24
  style?: Record<string, unknown>;
21
25
  /** `data-testid`. */
22
26
  testId?: string;
27
+ /** `data-mol-id` automation id (React's `automationId`). */
28
+ automationId?: string;
29
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
30
+ dataMolId?: string;
23
31
  /**
24
32
  * Reactive translation, read in the injection context. Its `t` reads the
25
33
  * locale, so the view re-renders the text on a locale switch (the static `t`
@@ -41,6 +49,11 @@ export declare class Spinner {
41
49
  * @returns The class string.
42
50
  */
43
51
  classes(): string;
52
+ /**
53
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
54
+ * @returns The attribute value.
55
+ */
56
+ molId(): string | undefined;
44
57
  /**
45
58
  * Serializes the merged inline style (caller style plus a raw-color border
46
59
  * override when `color` is a CSS color rather than a named variant).
@@ -48,6 +61,6 @@ export declare class Spinner {
48
61
  */
49
62
  hostStyle(): string | null;
50
63
  static ɵfac: i0.ɵɵFactoryDeclaration<Spinner, never>;
51
- static ɵcmp: i0.ɵɵComponentDeclaration<Spinner, "div[mol-spinner]", never, { "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "label": { "alias": "label"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; }, {}, never, never, true, never>;
64
+ static ɵcmp: i0.ɵɵComponentDeclaration<Spinner, "div[mol-spinner]", never, { "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "label": { "alias": "label"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; }, {}, never, never, true, never>;
52
65
  }
53
66
  //# sourceMappingURL=spinner.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.component.d.ts","sourceRoot":"","sources":["../../src/components/spinner.component.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAQxD;;;;;;GAMG;AACH,qBAea,OAAO;IAClB,oBAAoB;IACpB,IAAI,EAAE,IAAI,CAAO;IACjB,8CAA8C;IA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4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,KAAK,IAAI,MAAM,GAAG,SAAS;IAS3B;;;;OAIG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;yCAvEf,OAAO;2CAAP,OAAO;CAgFnB"}
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { Component } from '@angular/core';
6
+ import { Component, ElementRef, inject } from '@angular/core';
7
7
  import { useTranslation } from '@molecule/app-angular';
8
8
  import { getClassMap } from '@molecule/app-ui';
9
+ import { hostElement } from '../utilities/element.js';
9
10
  import { styleText } from '../utilities/style.js';
10
11
  import * as i0 from "@angular/core";
11
12
  function Spinner_Conditional_0_Template(rf, ctx) { if (rf & 1) {
@@ -28,6 +29,9 @@ const NAMED_COLORS = ['primary', 'secondary', 'success', 'warning', 'error', 'in
28
29
  * `data-*`/`aria-*` rest props land on the host (React's spread target).
29
30
  */
30
31
  export class Spinner {
32
+ host = inject(ElementRef);
33
+ /** The element a caller's ref receives: the host `<div role="status">`. */
34
+ element = hostElement(this.host);
31
35
  /** Spinner size. */
32
36
  size = 'md';
33
37
  /** Named color variant or a raw CSS color. */
@@ -40,6 +44,10 @@ export class Spinner {
40
44
  style;
41
45
  /** `data-testid`. */
42
46
  testId;
47
+ /** `data-mol-id` automation id (React's `automationId`). */
48
+ automationId;
49
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
50
+ dataMolId;
43
51
  /**
44
52
  * Reactive translation, read in the injection context. Its `t` reads the
45
53
  * locale, so the view re-renders the text on a locale switch (the static `t`
@@ -67,6 +75,16 @@ export class Spinner {
67
75
  classes() {
68
76
  return this.cm().cn(this.cm().spinner({ size: this.size }), this.className);
69
77
  }
78
+ /**
79
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
80
+ * @returns The attribute value.
81
+ */
82
+ molId() {
83
+ return (this.automationId ??
84
+ this.dataMolId ??
85
+ this.host.nativeElement.getAttribute('data-mol-id') ??
86
+ undefined);
87
+ }
70
88
  /**
71
89
  * Serializes the merged inline style (caller style plus a raw-color border
72
90
  * override when `color` is a CSS color rather than a named variant).
@@ -81,11 +99,11 @@ export class Spinner {
81
99
  return styleText({ ...this.style, ...colorStyle });
82
100
  }
83
101
  static ɵfac = function Spinner_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Spinner)(); };
84
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Spinner, selectors: [["div", "mol-spinner", ""]], hostVars: 7, hostBindings: function Spinner_HostBindings(rf, ctx) { if (rf & 2) {
85
- i0.ɵɵattribute("role", "status")("aria-label", ctx.ariaLabel())("data-testid", ctx.testId);
102
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Spinner, selectors: [["div", "mol-spinner", ""]], hostVars: 8, hostBindings: function Spinner_HostBindings(rf, ctx) { if (rf & 2) {
103
+ i0.ɵɵattribute("role", "status")("aria-label", ctx.ariaLabel())("data-testid", ctx.testId)("data-mol-id", ctx.molId());
86
104
  i0.ɵɵstyleMap(ctx.hostStyle());
87
105
  i0.ɵɵclassMap(ctx.classes());
88
- } }, inputs: { size: "size", color: "color", label: "label", className: "className", style: "style", testId: "testId" }, decls: 1, vars: 1, consts: [[3, "class"]], template: function Spinner_Template(rf, ctx) { if (rf & 1) {
106
+ } }, inputs: { size: "size", color: "color", label: "label", className: "className", style: "style", testId: "testId", automationId: "automationId", dataMolId: [0, "data-mol-id", "dataMolId"] }, decls: 1, vars: 1, consts: [[3, "class"]], template: function Spinner_Template(rf, ctx) { if (rf & 1) {
89
107
  i0.ɵɵconditionalCreate(0, Spinner_Conditional_0_Template, 2, 3, "span", 0);
90
108
  } if (rf & 2) {
91
109
  i0.ɵɵconditional(ctx.label ? 0 : -1);
@@ -96,18 +114,28 @@ export class Spinner {
96
114
  args: [{
97
115
  selector: 'div[mol-spinner]',
98
116
  standalone: true,
99
- inputs: ['size', 'color', 'label', 'className', 'style', 'testId'],
117
+ inputs: [
118
+ 'size',
119
+ 'color',
120
+ 'label',
121
+ 'className',
122
+ 'style',
123
+ 'testId',
124
+ 'automationId',
125
+ 'dataMolId: data-mol-id',
126
+ ],
100
127
  host: {
101
128
  '[attr.role]': '"status"',
102
129
  '[attr.aria-label]': 'ariaLabel()',
103
130
  '[class]': 'classes()',
104
131
  '[style]': 'hostStyle()',
105
132
  '[attr.data-testid]': 'testId',
133
+ '[attr.data-mol-id]': 'molId()',
106
134
  },
107
135
  template: `@if (label) {
108
136
  <span [class]="cm().srOnly">{{ label }}</span>
109
137
  }`,
110
138
  }]
111
139
  }], null, null); })();
112
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Spinner, { className: "Spinner", filePath: "components/spinner.component.ts", lineNumber: 40 }); })();
140
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Spinner, { className: "Spinner", filePath: "components/spinner.component.ts", lineNumber: 51 }); })();
113
141
  //# sourceMappingURL=spinner.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.component.js","sourceRoot":"","sources":["../../src/components/spinner.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;;;IAwB7C,+BAA4B;IAAA,YAAW;IAAA,oBAAO;;;IAAxC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AC,IAAI,CAAC,KAAsC,CAAC;YACjE,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE;YAC5D,CAAC,CAAC,SAAS,CAAA;QACf,OAAO,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,UAAU,EAAE,CAAC,CAAA;IACpD,CAAC;iGA/EU,OAAO;6DAAP,OAAO;mCAAP,QAAQ,gBAAR,eAAW,4CAAX,WAAO;YAAP,cAAA,eAAW,CAAJ;YAAP,cAAA,aAAS,CAAF;;YAJP,0EAAa;;YAAb,oCAEV;;;iFAEU,OAAO;cAzBnB,SAAS;eAAC;gBACT,QAAQ,EAAE,kBAAkB;gBAC5B,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE;oBACN,MAAM;oBACN,OAAO;oBACP,OAAO;oBACP,WAAW;oBACX,OAAO;oBACP,QAAQ;oBACR,cAAc;oBACd,wBAAwB;iBACzB;gBACD,IAAI,EAAE;oBACJ,aAAa,EAAE,UAAU;oBACzB,mBAAmB,EAAE,aAAa;oBAClC,SAAS,EAAE,WAAW;oBACtB,SAAS,EAAE,aAAa;oBACxB,oBAAoB,EAAE,QAAQ;oBAC9B,oBAAoB,EAAE,SAAS;iBAChC;gBACD,QAAQ,EAAE;;IAER;aACH;;kFACY,OAAO"}
@@ -4,7 +4,8 @@
4
4
  * @module
5
5
  */
6
6
  import { type AfterViewChecked, ElementRef, EventEmitter } from '@angular/core';
7
- import type { ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
7
+ import type { ColorVariant, MouseEventHandler, Size, UIClassMap } from '@molecule/app-ui';
8
+ import type { HasElement } from '../utilities/element.js';
8
9
  import * as i0 from "@angular/core";
9
10
  /**
10
11
  * Switch component.
@@ -15,7 +16,7 @@ import * as i0 from "@angular/core";
15
16
  * button clicks the hidden checkbox, whose GENUINE native `change` event is
16
17
  * forwarded as the `change` output.
17
18
  */
18
- export declare class Switch implements AfterViewChecked {
19
+ export declare class Switch implements AfterViewChecked, HasElement<HTMLButtonElement> {
19
20
  /** Switch label (text, or projected `[slot=label]` nodes). */
20
21
  label?: unknown;
21
22
  /** Whether the switch is on. */
@@ -32,16 +33,32 @@ export declare class Switch implements AfterViewChecked {
32
33
  testId?: string;
33
34
  /** Disables the switch. */
34
35
  disabled?: boolean;
36
+ /** `data-mol-id` automation id (React's `automationId`). */
37
+ automationId?: string;
38
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
39
+ dataMolId?: string;
40
+ /**
41
+ * A caller's click handler (React's `onClick` prop). Runs BEFORE the toggle
42
+ * and can veto it with `preventDefault()`.
43
+ */
44
+ onClick?: MouseEventHandler;
35
45
  /** The genuine native `change` event of the hidden checkbox. */
36
46
  readonly change: EventEmitter<Event>;
37
47
  /** The hidden native checkbox. */
38
48
  hiddenInput?: ElementRef<HTMLInputElement>;
39
49
  /** The visible trigger button (React's `...rest` spread target). */
40
- trigger?: ElementRef<HTMLButtonElement>;
50
+ private trigger?;
51
+ /** The trigger button view query; also feeds the caller's ref element. */
52
+ set triggerQuery(ref: ElementRef<HTMLButtonElement> | undefined);
53
+ private readonly inner;
54
+ /** The element a caller's ref receives: the `role="switch"` button. */
55
+ readonly element: import("@angular/core").Signal<HTMLButtonElement | null>;
41
56
  /** The label text wrapper. */
42
57
  labelSlot?: ElementRef<HTMLSpanElement>;
43
58
  private readonly host;
44
59
  private hasLabel;
60
+ /** The `data-mol-id` a caller bound on the host (React spreads it onto the trigger). */
61
+ private externalMolId;
45
62
  private readonly sync;
46
63
  /**
47
64
  * The current class map.
@@ -69,12 +86,18 @@ export declare class Switch implements AfterViewChecked {
69
86
  */
70
87
  hostStyle(): string | null;
71
88
  /**
72
- * Clicking the button clicks the hidden checkbox (unless disabled or the
73
- * event was vetoed), exactly like React's handler.
89
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
90
+ * @returns The attribute value.
91
+ */
92
+ molId(): string | undefined;
93
+ /**
94
+ * Clicking the button runs the caller's `onClick` first (it may veto the
95
+ * toggle with `preventDefault()`), then clicks the hidden checkbox (unless
96
+ * disabled or the event was vetoed), exactly like React's handler.
74
97
  *
75
98
  * @param event - The button click event.
76
99
  */
77
- handleClick(event: Event): void;
100
+ handleClick(event: MouseEvent): void;
78
101
  /**
79
102
  * Forwards the hidden checkbox's genuine native `change` event (React
80
103
  * forwards the raw browser event, not a React synthetic one) and then
@@ -92,6 +115,6 @@ export declare class Switch implements AfterViewChecked {
92
115
  */
93
116
  ngAfterViewChecked(): void;
94
117
  static ɵfac: i0.ɵɵFactoryDeclaration<Switch, never>;
95
- static ɵcmp: i0.ɵɵComponentDeclaration<Switch, "mol-switch", never, { "label": { "alias": "label"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "change": "change"; }, never, ["[slot=label]"], true, never>;
118
+ static ɵcmp: i0.ɵɵComponentDeclaration<Switch, "mol-switch", never, { "label": { "alias": "label"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; }, { "change": "change"; }, never, ["[slot=label]"], true, never>;
96
119
  }
97
120
  //# sourceMappingURL=switch.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.component.d.ts","sourceRoot":"","sources":["../../src/components/switch.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,gBAAgB,EAErB,UAAU,EACV,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sBAA4B;IAErD,kCAAkC;IACR,WAAW,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IACpE,oEAAoE;IACpE,OAAO,CAAC,OAAO,CAAC,CAA+B;IAC/C,0EAA0E;IAC1E,IACI,YAAY,CAAC,GAAG,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,SAAS,EAG9D;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAC/D,uEAAuE;IACvE,QAAQ,CAAC,OAAO,2DAA0B;IAC1C,8BAA8B;IACN,SAAS,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAE/D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAQ;IACxB,wFAAwF;IACxF,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyD;IAE9E;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,KAAK,IAAI,SAAS,GAAG,WAAW;IAIhC;;;OAGG;IACH,OAAO,IAAI,MAAM;IAOjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B;;;OAGG;IACH,KAAK,IAAI,MAAM,GAAG,SAAS;IAI3B;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAKpC;;;;;;;;;OASG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAOhC;;;OAGG;IACH,kBAAkB,IAAI,IAAI;yCA1If,MAAM;2CAAN,MAAM;CA2JlB"}
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { Component, ElementRef, EventEmitter, inject, Output, Renderer2, ViewChild, } from '@angular/core';
6
+ import { Component, ElementRef, EventEmitter, inject, Output, Renderer2, signal, ViewChild, } from '@angular/core';
7
7
  import { getClassMap } from '@molecule/app-ui';
8
- import { moveRestAttributes } from '../utilities/rest-attrs.js';
8
+ import { adoptHostDataMolId, moveRestAttributes } from '../utilities/rest-attrs.js';
9
9
  import { styleText } from '../utilities/style.js';
10
10
  import { hasNodes, SlotWrapper } from './button.component.js';
11
11
  import { MolControlledChecked } from './controlled-checked.directive.js';
@@ -42,16 +42,36 @@ export class Switch {
42
42
  testId;
43
43
  /** Disables the switch. */
44
44
  disabled;
45
+ /** `data-mol-id` automation id (React's `automationId`). */
46
+ automationId;
47
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
48
+ dataMolId;
49
+ /**
50
+ * A caller's click handler (React's `onClick` prop). Runs BEFORE the toggle
51
+ * and can veto it with `preventDefault()`.
52
+ */
53
+ onClick;
45
54
  /** The genuine native `change` event of the hidden checkbox. */
46
55
  change = new EventEmitter();
47
56
  /** The hidden native checkbox. */
48
57
  hiddenInput;
49
58
  /** The visible trigger button (React's `...rest` spread target). */
50
59
  trigger;
60
+ /** The trigger button view query; also feeds the caller's ref element. */
61
+ set triggerQuery(ref) {
62
+ this.trigger = ref;
63
+ this.inner.set(ref?.nativeElement ?? null);
64
+ }
65
+ inner = signal(null, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "inner" }] : /* istanbul ignore next */ []));
67
+ /** The element a caller's ref receives: the `role="switch"` button. */
68
+ element = this.inner.asReadonly();
51
69
  /** The label text wrapper. */
52
70
  labelSlot;
53
71
  host = inject(ElementRef);
54
72
  hasLabel = false;
73
+ /** The `data-mol-id` a caller bound on the host (React spreads it onto the trigger). */
74
+ externalMolId;
55
75
  sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
56
76
  /**
57
77
  * The current class map.
@@ -89,12 +109,21 @@ export class Switch {
89
109
  return styleText(this.style);
90
110
  }
91
111
  /**
92
- * Clicking the button clicks the hidden checkbox (unless disabled or the
93
- * event was vetoed), exactly like React's handler.
112
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
113
+ * @returns The attribute value.
114
+ */
115
+ molId() {
116
+ return this.automationId ?? this.dataMolId ?? this.externalMolId;
117
+ }
118
+ /**
119
+ * Clicking the button runs the caller's `onClick` first (it may veto the
120
+ * toggle with `preventDefault()`), then clicks the hidden checkbox (unless
121
+ * disabled or the event was vetoed), exactly like React's handler.
94
122
  *
95
123
  * @param event - The button click event.
96
124
  */
97
125
  handleClick(event) {
126
+ this.onClick?.(event);
98
127
  if (!this.disabled && !event.defaultPrevented)
99
128
  this.hiddenInput?.nativeElement.click();
100
129
  }
@@ -120,6 +149,9 @@ export class Switch {
120
149
  * `{!!label && <span>}` label condition after queries resolve.
121
150
  */
122
151
  ngAfterViewChecked() {
152
+ adoptHostDataMolId(this.host.nativeElement, this.trigger?.nativeElement, (id) => {
153
+ this.externalMolId = id;
154
+ }, () => this.molId());
123
155
  moveRestAttributes(this.host.nativeElement, this.trigger?.nativeElement);
124
156
  this.hasLabel = !!this.label || hasNodes(this.labelSlot?.nativeElement);
125
157
  this.sync.sync(this.labelSlot?.nativeElement, this.hasLabel, this.labelSlot?.nativeElement.parentElement ?? undefined);
@@ -130,9 +162,9 @@ export class Switch {
130
162
  } if (rf & 2) {
131
163
  let _t;
132
164
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.hiddenInput = _t.first);
133
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.trigger = _t.first);
165
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.triggerQuery = _t.first);
134
166
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelSlot = _t.first);
135
- } }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { label: "label", checked: "checked", size: "size", color: "color", className: "className", style: "style", testId: "testId", disabled: "disabled" }, outputs: { change: "change" }, ngContentSelectors: _c4, decls: 10, vars: 21, consts: [["hiddenInput", ""], ["trigger", ""], ["labelSlot", ""], ["type", "checkbox", "aria-hidden", "true", "tabindex", "-1", 3, "change", "molChecked", "disabled"], ["type", "button", "role", "switch", 3, "click", "disabled"]], template: function Switch_Template(rf, ctx) { if (rf & 1) {
167
+ } }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { label: "label", checked: "checked", size: "size", color: "color", className: "className", style: "style", testId: "testId", disabled: "disabled", automationId: "automationId", dataMolId: [0, "data-mol-id", "dataMolId"], onClick: "onClick" }, outputs: { change: "change" }, ngContentSelectors: _c4, decls: 10, vars: 22, consts: [["hiddenInput", ""], ["trigger", ""], ["labelSlot", ""], ["type", "checkbox", "aria-hidden", "true", "tabindex", "-1", 3, "change", "molChecked", "disabled"], ["type", "button", "role", "switch", 3, "click", "disabled"]], template: function Switch_Template(rf, ctx) { if (rf & 1) {
136
168
  i0.ɵɵprojectionDef(_c3);
137
169
  i0.ɵɵelementStart(0, "input", 3, 0);
138
170
  i0.ɵɵlistener("change", function Switch_Template_input_change_0_listener($event) { return ctx.handleChange($event); });
@@ -153,9 +185,9 @@ export class Switch {
153
185
  i0.ɵɵadvance();
154
186
  i0.ɵɵclassMap(ctx.classes());
155
187
  i0.ɵɵproperty("disabled", ctx.disabled);
156
- i0.ɵɵattribute("aria-checked", ctx.checked ? "true" : "false")("data-state", ctx.state())("style", ctx.hostStyle(), i0.ɵɵsanitizeStyle)("data-testid", ctx.testId);
188
+ i0.ɵɵattribute("aria-checked", ctx.checked ? "true" : "false")("data-state", ctx.state())("style", ctx.hostStyle(), i0.ɵɵsanitizeStyle)("data-testid", ctx.testId)("data-mol-id", ctx.molId());
157
189
  i0.ɵɵadvance(2);
158
- i0.ɵɵclassMap(ctx.cm().switchThumb(i0.ɵɵpureFunction1(19, _c5, ctx.size ?? "md")));
190
+ i0.ɵɵclassMap(ctx.cm().switchThumb(i0.ɵɵpureFunction1(20, _c5, ctx.size ?? "md")));
159
191
  i0.ɵɵattribute("data-state", ctx.state());
160
192
  i0.ɵɵadvance();
161
193
  i0.ɵɵclassMap(ctx.cm().controlText);
@@ -169,7 +201,19 @@ export class Switch {
169
201
  selector: 'mol-switch',
170
202
  standalone: true,
171
203
  imports: [MolControlledChecked],
172
- inputs: ['label', 'checked', 'size', 'color', 'className', 'style', 'testId', 'disabled'],
204
+ inputs: [
205
+ 'label',
206
+ 'checked',
207
+ 'size',
208
+ 'color',
209
+ 'className',
210
+ 'style',
211
+ 'testId',
212
+ 'disabled',
213
+ 'automationId',
214
+ 'dataMolId: data-mol-id',
215
+ 'onClick',
216
+ ],
173
217
  host: {
174
218
  'data-parity-unwrap': '',
175
219
  style: 'display: contents',
@@ -195,6 +239,7 @@ export class Switch {
195
239
  [class]="classes()"
196
240
  [attr.style]="hostStyle()"
197
241
  [attr.data-testid]="testId"
242
+ [attr.data-mol-id]="molId()"
198
243
  #trigger
199
244
  >
200
245
  <span [attr.data-state]="state()" [class]="cm().switchThumb({ size: size ?? 'md' })"></span>
@@ -209,12 +254,12 @@ export class Switch {
209
254
  }], hiddenInput: [{
210
255
  type: ViewChild,
211
256
  args: ['hiddenInput']
212
- }], trigger: [{
257
+ }], triggerQuery: [{
213
258
  type: ViewChild,
214
259
  args: ['trigger']
215
260
  }], labelSlot: [{
216
261
  type: ViewChild,
217
262
  args: ['labelSlot']
218
263
  }] }); })();
219
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Switch, { className: "Switch", filePath: "components/switch.component.ts", lineNumber: 74 }); })();
264
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Switch, { className: "Switch", filePath: "components/switch.component.ts", lineNumber: 89 }); })();
220
265
  //# sourceMappingURL=switch.component.js.map