@molecule/app-ui-angular 1.2.0 → 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 +2796 -800
  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 +32 -5
  43. package/dist/components/dropdown.component.d.ts.map +1 -1
  44. package/dist/components/dropdown.component.js +86 -17
  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 +1 @@
1
- {"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,gBAAgB,EAErB,UAAU,EACV,YAAY,EAKb,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;;AAO1E;;;;;;;GAOG;AACH,qBA+Ca,QAAS,YAAW,gBAAgB;IAC/C,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CA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W,CAAQ;IAE3B;;;OAGG;IACH,kBAAkB,IAAI,IAAI;yCA3If,QAAQ;2CAAR,QAAQ;CA+JpB"}
1
+ {"version":3,"file":"checkbox.component.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,gBAAgB,EAErB,UAAU,EACV,YAAY,EAMb,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACX,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;;AAQ1E;;;;;;;GAOG;AACH,qBAyDa,QAAS,YAAW,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC;IAC7E,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,6EAA6E;IAC7E,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,4DAA4D;IAC5D,Y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I,MAAM,GAAG,IAAI;IAQlC;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;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;IAOpC;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMhC,OAAO,CAAC,WAAW,CAAQ;IAE3B;;;OAGG;IACH,kBAAkB,IAAI,IAAI;yCApLf,QAAQ;2CAAR,QAAQ;CAgNpB"}
@@ -3,10 +3,11 @@
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
8
  import { fieldContext } from '../utilities/form-field-context.js';
9
- import { moveRestAttributes } from '../utilities/rest-attrs.js';
9
+ import { nextInstanceId } from '../utilities/ids.js';
10
+ import { adoptHostDataMolId, moveRestAttributes } from '../utilities/rest-attrs.js';
10
11
  import { styleText } from '../utilities/style.js';
11
12
  import { hasNodes, SlotWrapper } from './button.component.js';
12
13
  import { MolControlledChecked } from './controlled-checked.directive.js';
@@ -59,17 +60,45 @@ export class Checkbox {
59
60
  id;
60
61
  /** Uncontrolled initial checked state (renders as the checked attribute). */
61
62
  defaultChecked;
63
+ /** `data-mol-id` automation id (React's `automationId`). */
64
+ automationId;
65
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
66
+ dataMolId;
67
+ /**
68
+ * A caller's click handler (React's `onClick`, which React spreads onto the input). Runs
69
+ * before `change`; its `preventDefault()` makes the browser restore the box.
70
+ */
71
+ onClick;
72
+ /** React's `onFocus`, which React spreads onto the <input>: its `currentTarget` is that element. */
73
+ onFocus;
74
+ /** React's `onBlur`, which React spreads onto the <input>: its `currentTarget` is that element. */
75
+ onBlur;
76
+ /** React's `onKeyDown`, which React spreads onto the <input>: its `currentTarget` is that element. */
77
+ onKeyDown;
62
78
  /** The genuine native `change` event. */
63
79
  change = new EventEmitter();
64
80
  /** The native input (React's `...rest` spread target). */
65
81
  input;
82
+ /** The native input view query; also feeds the caller's ref element. */
83
+ set inputQuery(ref) {
84
+ this.input = ref;
85
+ this.inner.set(ref?.nativeElement ?? null);
86
+ }
87
+ inner = signal(null, /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "inner" }] : /* istanbul ignore next */ []));
89
+ /** The element a caller's ref receives: the native `<input>`. */
90
+ element = this.inner.asReadonly();
66
91
  /** The label text wrapper. */
67
92
  labelSlot;
68
93
  host = inject(ElementRef);
94
+ /** The per-instance id used when the caller gives no `id` or `name` (React's `useId`). */
95
+ generatedId = nextInstanceId();
69
96
  /** The `aria-describedby` the caller spread onto the host (React's rest). */
70
97
  restDescribedBy = null;
71
98
  /** Whether the rest-describedby value was captured. */
72
99
  restDescribedByCaptured = false;
100
+ /** The `data-mol-id` a caller bound on the host (React spreads it onto the input). */
101
+ externalMolId;
73
102
  sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
74
103
  hasLabel = false;
75
104
  syncIndeterminate = false;
@@ -93,7 +122,7 @@ export class Checkbox {
93
122
  * @returns The error element id.
94
123
  */
95
124
  errorId() {
96
- return `${this.checkboxId() ?? 'r0'}-error`;
125
+ return `${this.checkboxId() ?? this.generatedId}-error`;
97
126
  }
98
127
  /**
99
128
  * The nearest enclosing `FormField` context (React's cloned props).
@@ -126,6 +155,13 @@ export class Checkbox {
126
155
  hostStyle() {
127
156
  return styleText(this.style);
128
157
  }
158
+ /**
159
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
160
+ * @returns The attribute value.
161
+ */
162
+ molId() {
163
+ return this.automationId ?? this.dataMolId ?? this.externalMolId;
164
+ }
129
165
  /**
130
166
  * React's checkbox `onChange` fires on the checkbox's CLICK event (React's
131
167
  * change-event plugin maps checkbox/radio changes to the click), so the
@@ -134,6 +170,7 @@ export class Checkbox {
134
170
  * @param event - The native click event.
135
171
  */
136
172
  handleClick(event) {
173
+ this.onClick?.(event);
137
174
  this.justClicked = true;
138
175
  this.change.emit(event);
139
176
  queueMicrotask(() => (this.justClicked = false));
@@ -166,6 +203,9 @@ export class Checkbox {
166
203
  this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby');
167
204
  this.restDescribedByCaptured = true;
168
205
  }
206
+ adoptHostDataMolId(this.host.nativeElement, input, (id) => {
207
+ this.externalMolId = id;
208
+ }, () => this.molId());
169
209
  moveRestAttributes(this.host.nativeElement, input);
170
210
  if (this.syncIndeterminate !== !!this.indeterminate) {
171
211
  input.indeterminate = !!this.indeterminate;
@@ -180,14 +220,14 @@ export class Checkbox {
180
220
  i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
181
221
  } if (rf & 2) {
182
222
  let _t;
183
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.input = _t.first);
223
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputQuery = _t.first);
184
224
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelSlot = _t.first);
185
225
  } }, hostVars: 2, hostBindings: function Checkbox_HostBindings(rf, ctx) { if (rf & 2) {
186
226
  i0.ɵɵclassMap(ctx.cm().formFieldWrapper);
187
- } }, inputs: { label: "label", checked: "checked", indeterminate: "indeterminate", size: "size", error: "error", className: "className", style: "style", testId: "testId", disabled: "disabled", name: "name", id: "id", defaultChecked: "defaultChecked" }, outputs: { change: "change" }, ngContentSelectors: _c3, decls: 8, vars: 18, consts: [["input", ""], ["labelSlot", ""], ["type", "checkbox", 3, "click", "change", "molChecked", "molDefaultChecked", "disabled"], [3, "class"]], template: function Checkbox_Template(rf, ctx) { if (rf & 1) {
227
+ } }, inputs: { label: "label", checked: "checked", indeterminate: "indeterminate", size: "size", error: "error", className: "className", style: "style", testId: "testId", disabled: "disabled", name: "name", id: "id", defaultChecked: "defaultChecked", automationId: "automationId", dataMolId: [0, "data-mol-id", "dataMolId"], onClick: "onClick", onFocus: "onFocus", onBlur: "onBlur", onKeyDown: "onKeyDown" }, outputs: { change: "change" }, ngContentSelectors: _c3, decls: 8, vars: 19, consts: [["input", ""], ["labelSlot", ""], ["type", "checkbox", 3, "click", "change", "focusin", "focusout", "keydown", "molChecked", "molDefaultChecked", "disabled"], [3, "class"]], template: function Checkbox_Template(rf, ctx) { if (rf & 1) {
188
228
  i0.ɵɵprojectionDef(_c2);
189
229
  i0.ɵɵelementStart(0, "label")(1, "input", 2, 0);
190
- i0.ɵɵlistener("click", function Checkbox_Template_input_click_1_listener($event) { return ctx.handleClick($event); })("change", function Checkbox_Template_input_change_1_listener($event) { return ctx.handleChange($event); });
230
+ i0.ɵɵlistener("click", function Checkbox_Template_input_click_1_listener($event) { return ctx.handleClick($event); })("change", function Checkbox_Template_input_change_1_listener($event) { return ctx.handleChange($event); })("focusin", function Checkbox_Template_input_focusin_1_listener($event) { return ctx.onFocus?.($event); })("focusout", function Checkbox_Template_input_focusout_1_listener($event) { return ctx.onBlur?.($event); })("keydown", function Checkbox_Template_input_keydown_1_listener($event) { return ctx.onKeyDown?.($event); });
191
231
  i0.ɵɵelementEnd();
192
232
  i0.ɵɵelementStart(3, "span", null, 1);
193
233
  i0.ɵɵtext(5);
@@ -199,7 +239,7 @@ export class Checkbox {
199
239
  i0.ɵɵadvance();
200
240
  i0.ɵɵclassMap(ctx.classes());
201
241
  i0.ɵɵproperty("molChecked", ctx.checked)("molDefaultChecked", ctx.defaultChecked)("disabled", ctx.disabled);
202
- i0.ɵɵattribute("id", ctx.checkboxId())("name", ctx.name)("data-state", ctx.checked ? "checked" : "unchecked")("aria-invalid", ctx.error || ctx.fieldContext()?.invalid ? "true" : "false")("aria-describedby", ctx.mergedDescribedBy())("style", ctx.hostStyle(), i0.ɵɵsanitizeStyle)("data-testid", ctx.testId);
242
+ i0.ɵɵattribute("id", ctx.checkboxId())("name", ctx.name)("data-state", ctx.checked ? "checked" : "unchecked")("aria-invalid", ctx.error || ctx.fieldContext()?.invalid ? "true" : "false")("aria-describedby", ctx.mergedDescribedBy())("style", ctx.hostStyle(), i0.ɵɵsanitizeStyle)("data-testid", ctx.testId)("data-mol-id", ctx.molId());
203
243
  i0.ɵɵadvance(2);
204
244
  i0.ɵɵclassMap(ctx.cm().cn(ctx.cm().controlText, ctx.disabled && ctx.cm().controlDisabled));
205
245
  i0.ɵɵadvance(2);
@@ -227,6 +267,12 @@ export class Checkbox {
227
267
  'name',
228
268
  'id',
229
269
  'defaultChecked',
270
+ 'automationId',
271
+ 'dataMolId: data-mol-id',
272
+ 'onClick',
273
+ 'onFocus',
274
+ 'onBlur',
275
+ 'onKeyDown',
230
276
  ],
231
277
  host: {
232
278
  '[class]': 'cm().formFieldWrapper',
@@ -245,8 +291,12 @@ export class Checkbox {
245
291
  [class]="classes()"
246
292
  [attr.style]="hostStyle()"
247
293
  [attr.data-testid]="testId"
294
+ [attr.data-mol-id]="molId()"
248
295
  (click)="handleClick($event)"
249
296
  (change)="handleChange($event)"
297
+ (focusin)="onFocus?.($event)"
298
+ (focusout)="onBlur?.($event)"
299
+ (keydown)="onKeyDown?.($event)"
250
300
  #input
251
301
  />
252
302
  <span [class]="cm().cn(cm().controlText, disabled && cm().controlDisabled)" #labelSlot
@@ -259,12 +309,12 @@ export class Checkbox {
259
309
  }]
260
310
  }], null, { change: [{
261
311
  type: Output
262
- }], input: [{
312
+ }], inputQuery: [{
263
313
  type: ViewChild,
264
314
  args: ['input']
265
315
  }], labelSlot: [{
266
316
  type: ViewChild,
267
317
  args: ['labelSlot']
268
318
  }] }); })();
269
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Checkbox, { className: "Checkbox", filePath: "components/checkbox.component.ts", lineNumber: 83 }); })();
319
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Checkbox, { className: "Checkbox", filePath: "components/checkbox.component.ts", lineNumber: 101 }); })();
270
320
  //# sourceMappingURL=checkbox.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.component.js","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;;;;;;;IAsDlE,yBAA6E;IAAA,YAAW;IAAA,iBAAI;;;IAAnE,6EAAmD;;IAAC,cAAW;IAAX,kCAAW;;AApD9F;;;;;;;GAOG;AAgDH,MAAM,OAAO,QAAQ;IACnB,gEAAgE;IAChE,KAAK,CAAU;IACf,uCAAuC;IACvC,OAAO,CAAU;IACjB,4DAA4D;IAC5D,aAAa,CAAU;IACvB,4CAA4C;IAC5C,IAAI,CAAU;IACd,mEAAmE;IACnE,KAAK,CAAS;IACd,sDAAsD;IACtD,SAAS,CAAS;IAClB,6CAA6C;IAC7C,KAAK,CAA0B;IAC/B,mCAAmC;IACnC,MAAM,CAAS;IACf,6BAA6B;IAC7B,QAAQ,CAAU;IAClB,uBAAuB;IACvB,IAAI,CAAS;IACb,0CAA0C;IAC1C,EAAE,CAAS;IACX,6EAA6E;IAC7E,cAAc,CAAU;IAExB,yCAAy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,SAAS,EAAE,uBAAuB;iBACnC;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;MAwBN;aACL;;kBA4BE,MAAM;;kBAGN,SAAS;mBAAC,OAAO;;kBAEjB,SAAS;mBAAC,WAAW;;kFAhCX,QAAQ"}
1
+ {"version":3,"file":"checkbox.component.js","sourceRoot":"","sources":["../../src/components/checkbox.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAQtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;;;;;;;IAgElE,yBAA6E;IAAA,YAAW;IAAA,iBAAI;;;IAAnE,6EAAmD;;IAAC,cAAW;IAAX,kCAAW;;AA9D9F;;;;;;;GAOG;AA0DH,MAAM,OAAO,QAAQ;IACnB,gEAAgE;IAChE,KAAK,CAAU;IACf,uCAAuC;IACvC,OAAO,CAAU;IACjB,4DAA4D;IAC5D,aAAa,CAAU;IACvB,4CAA4C;IAC5C,IAAI,CAAU;IACd,mEAAmE;IACnE,KAAK,CAAS;IACd,sDAAsD;IACtD,SAAS,CAAS;IAClB,6CAA6C;IAC7C,KAAK,CAA0B;IAC/B,mCAAmC;IACnC,MAAM,CAAS;IACf,6BAA6B;IAC7B,QAAQ,CAAU;IAClB,uB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BACD,IAAI,EAAE;oBACJ,SAAS,EAAE,uBAAuB;iBACnC;gBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4BN;aACL;;kBA6CE,MAAM;;kBAKN,SAAS;mBAAC,OAAO;;kBAUjB,SAAS;mBAAC,WAAW;;kFA3DX,QAAQ"}
@@ -3,43 +3,104 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { type AfterViewInit, type DoCheck, ElementRef, type OnDestroy } from '@angular/core';
6
+ import { type AfterViewInit, type DoCheck, ElementRef, type OnDestroy, type TemplateRef } from '@angular/core';
7
7
  import type { ButtonVariant, ColorVariant, Size, UIClassMap } from '@molecule/app-ui';
8
+ import { type HasElement } from '../utilities/element.js';
9
+ import { asTemplate, isGiven, nodeText } from '../utilities/node-value.js';
8
10
  import * as i0 from "@angular/core";
9
11
  /**
10
- * ConfirmButton component.
12
+ * Props for {@link ConfirmButton} (React's `ConfirmButtonProps`, in Angular's
13
+ * form).
11
14
  *
12
- * The host is the `<button>` itself (`button[mol-confirm-button]`). The three
13
- * labels are projected (`[slot=label]`, `[slot=confirmLabel]`,
14
- * `[slot=pendingLabel]`); each capture span stays detached from the DOM and
15
- * the visible phase's projected children are moved onto the button — React
16
- * renders exactly one label and no wrapper element. When the slot for the
17
- * armed/pending phase is empty, the localized default text renders instead
18
- * (React's `confirmLabel ?? t(…)`).
15
+ * The three labels are node-valued in React; here each is a
16
+ * `string | number | TemplateRef<unknown>` input, and a caller may project the
17
+ * same label as `[slot=label]` / `[slot=confirmLabel]` / `[slot=pendingLabel]`
18
+ * instead. The button members React keeps from `ButtonProps` (`variant`,
19
+ * `color`, `size`, `className`, `style`, `testId`, `automationId`,
20
+ * `disabled`) are all accepted here too.
19
21
  */
20
- export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy {
22
+ export interface ConfirmButtonProps {
23
+ /**
24
+ * Fired ONLY on the confirming (second) click — i.e. when the action
25
+ * actually commits.
26
+ */
27
+ onConfirm?: () => void | Promise<void>;
28
+ /** Visible label in the idle (armed-to-be-clicked) state. */
29
+ label?: string | number | TemplateRef<unknown>;
30
+ /** Visible label in the armed state (defaults to a localized "Confirm?"). */
31
+ confirmLabel?: string | number | TemplateRef<unknown>;
32
+ /** Visible label while {@link ConfirmButtonProps.onConfirm} is pending. */
33
+ pendingLabel?: string | number | TemplateRef<unknown>;
34
+ /** Seconds before the armed state auto-disarms (`0` disables auto-disarm). */
35
+ disarmSeconds?: number;
36
+ /** Disables the control entirely (idle and confirming states). */
37
+ disabled?: boolean;
38
+ /** `data-testid` for the button. */
39
+ testId?: string;
40
+ /** Extra classes joined onto the button classes. */
41
+ className?: string;
42
+ /** Inline style object (React camelCase). */
43
+ style?: Record<string, unknown>;
21
44
  /** Button variant (passed through to the button classes). */
22
45
  variant?: ButtonVariant;
23
46
  /** Button color; the armed state always shows the error color. */
24
47
  color?: ColorVariant;
25
48
  /** Button size. */
26
49
  size?: Size;
50
+ /** `data-mol-id` automation id (React's `automationId`). */
51
+ automationId?: string;
52
+ }
53
+ /**
54
+ * ConfirmButton component.
55
+ *
56
+ * The host is the `<button>` itself (`button[mol-confirm-button]`). Each label
57
+ * is a node-valued input (`label`, `confirmLabel`, `pendingLabel`) or the
58
+ * matching projected slot (`[slot=label]`, `[slot=confirmLabel]`,
59
+ * `[slot=pendingLabel]`); each capture span stays detached from the DOM and
60
+ * the visible phase's projected children are moved onto the button — React
61
+ * renders exactly one label and no wrapper element. When neither the input nor
62
+ * the slot for the armed/pending phase is given, the localized default text
63
+ * renders instead (React's `confirmLabel ?? t(…)`).
64
+ */
65
+ export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTMLButtonElement> {
66
+ /** Button variant (passed through to the button classes). */
67
+ variant?: ConfirmButtonProps['variant'];
68
+ /** Button color; the armed state always shows the error color. */
69
+ color?: ConfirmButtonProps['color'];
70
+ /** Button size. */
71
+ size?: ConfirmButtonProps['size'];
27
72
  /**
28
73
  * The confirm callback (React's `onConfirm` prop). Fired ONLY on the
29
74
  * confirming (second) click; while the returned promise is pending the
30
75
  * button stays in its confirming state and ignores further clicks.
31
76
  */
32
- onConfirm?: () => void | Promise<void>;
77
+ onConfirm?: ConfirmButtonProps['onConfirm'];
78
+ /** Visible label in the idle state (React's `label` node value). */
79
+ label?: ConfirmButtonProps['label'];
80
+ /** Visible label in the armed state (React's `confirmLabel` node value). */
81
+ confirmLabel?: ConfirmButtonProps['confirmLabel'];
82
+ /** Visible label while the confirm callback is pending. */
83
+ pendingLabel?: ConfirmButtonProps['pendingLabel'];
33
84
  /** Seconds before the armed state auto-disarms (`0` disables auto-disarm). */
34
- disarmSeconds: number;
85
+ disarmSeconds?: ConfirmButtonProps['disarmSeconds'];
35
86
  /** Disables the control entirely (idle and confirming states). */
36
- disabled: boolean;
87
+ disabled?: ConfirmButtonProps['disabled'];
37
88
  /** `data-testid` for the button. */
38
- testId?: string;
89
+ testId?: ConfirmButtonProps['testId'];
90
+ /** `data-mol-id` automation id (React's `automationId`). */
91
+ automationId?: ConfirmButtonProps['automationId'];
92
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
93
+ dataMolId?: string;
39
94
  /** Extra classes joined onto the button classes. */
40
- className?: string;
95
+ className?: ConfirmButtonProps['className'];
41
96
  /** Inline style object (React camelCase). */
42
- style?: Record<string, unknown>;
97
+ style?: ConfirmButtonProps['style'];
98
+ /** Template helpers (templates see only class members). */
99
+ readonly asTemplate: typeof asTemplate;
100
+ /** Renders a plain-string/number node value. */
101
+ readonly nodeText: typeof nodeText;
102
+ /** Whether a node-valued prop was given. */
103
+ readonly isGiven: typeof isGiven;
43
104
  /** The label slot capture span (kept out of the DOM). */
44
105
  labelSlot?: ElementRef<HTMLSpanElement>;
45
106
  /** The armed-state label capture span. */
@@ -53,6 +114,8 @@ export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy
53
114
  /** The current phase: idle → armed → pending → idle. */
54
115
  readonly phase: import("@angular/core").WritableSignal<"idle" | "armed" | "pending">;
55
116
  private readonly el;
117
+ /** The element a caller's ref receives: the host `<button>`. */
118
+ readonly element: import("@angular/core").Signal<HTMLButtonElement | null>;
56
119
  private readonly renderer;
57
120
  private readonly sync;
58
121
  private disarmTimer;
@@ -77,6 +140,11 @@ export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy
77
140
  * @returns The style attribute text.
78
141
  */
79
142
  hostStyle(): string | null;
143
+ /**
144
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
145
+ * @returns The attribute value.
146
+ */
147
+ molId(): string | undefined;
80
148
  /**
81
149
  * React's click handler: idle arms, armed commits (awaiting the callback),
82
150
  * pending ignores.
@@ -125,6 +193,6 @@ export declare class ConfirmButton implements AfterViewInit, DoCheck, OnDestroy
125
193
  /** Clears the auto-disarm timer (React's unmount cleanup). */
126
194
  ngOnDestroy(): void;
127
195
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmButton, never>;
128
- static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmButton, "button[mol-confirm-button]", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "onConfirm": { "alias": "onConfirm"; "required": false; }; "disarmSeconds": { "alias": "disarmSeconds"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; }, {}, never, ["[slot=label]", "[slot=confirmLabel]", "[slot=pendingLabel]"], true, never>;
196
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmButton, "button[mol-confirm-button]", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "onConfirm": { "alias": "onConfirm"; "required": false; }; "label": { "alias": "label"; "required": false; }; "confirmLabel": { "alias": "confirmLabel"; "required": false; }; "pendingLabel": { "alias": "pendingLabel"; "required": false; }; "disarmSeconds": { "alias": "disarmSeconds"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "testId": { "alias": "testId"; "required": false; }; "className": { "alias": "className"; "required": false; }; "style": { "alias": "style"; "required": false; }; "automationId": { "alias": "automationId"; "required": false; }; "dataMolId": { "alias": "data-mol-id"; "required": false; }; }, {}, never, ["[slot=label]", "[slot=confirmLabel]", "[slot=pendingLabel]"], true, never>;
129
197
  }
130
198
  //# sourceMappingURL=confirm-button.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirm-button.component.d.ts","sourceRoot":"","sources":["../../src/components/confirm-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EAEZ,UAAU,EAEV,KAAK,SAAS,EAIf,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMrF;;;;;;;;;;GAUG;AACH,qBAmCa,aAAc,YAAW,aAAa,EAAE,OAAO,EAAE,SAAS;IACrE,6DAA6D;IAC7D,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,kEAAkE;IAClE,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,8EAA8E;IAC9E,aAAa,SAAI;IACjB,kEAAkE;IAClE,QAAQ,UAAQ;IAChB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE/B,yDAAyD;IACjC,SAAS,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC/D,0CAA0C;IAChB,WAAW,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACnE,4CAA4C;IAClB,WAAW,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAEnE,wEAAwE;IACxE,eAAe,UAAQ;IACvB,0EAA0E;IAC1E,eAAe,UAAQ;IAEvB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,uEAA+C;IAE7D,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0C;IAC/D,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,MAAM,CAAuB;IAErC;;;OAGG;;IAgBH;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAWjB;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B;;;OAGG;YACW,WAAW;IAoBzB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,MAAM;IAQd;;;OAGG;IACH,eAAe,IAAI,IAAI;IAQvB;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB,4EAA4E;IAC5E,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,WAAW,CAA+B;IAElD;;;OAGG;IACH,OAAO,CAAC,UAAU;IAalB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAehB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IASnB,8DAA8D;IAC9D,WAAW,IAAI,IAAI;yCAvNR,aAAa;2CAAb,aAAa;CA0NzB"}
1
+ {"version":3,"file":"confirm-button.component.d.ts","sourceRoot":"","sources":["../../src/components/confirm-button.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EAEZ,UAAU,EAEV,KAAK,SAAS,EA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Ref, inject, Renderer2, signal, ViewChild, } from '@angular/core';
7
7
  import { getClassMap } from '@molecule/app-ui';
8
+ import { hostElement } from '../utilities/element.js';
9
+ import { asTemplate, isGiven, nodeText } from '../utilities/node-value.js';
8
10
  import { styleText } from '../utilities/style.js';
9
11
  import { hasNodes, SlotWrapper } from './button.component.js';
12
+ import { MolTemplateOutlet } from './template-outlet.directive.js';
10
13
  import * as i0 from "@angular/core";
11
14
  const _c0 = ["labelSlot"];
12
15
  const _c1 = ["confirmSlot"];
@@ -19,16 +22,44 @@ function ConfirmButton_Conditional_0_Template(rf, ctx) { if (rf & 1) {
19
22
  function ConfirmButton_Conditional_1_Template(rf, ctx) { if (rf & 1) {
20
23
  i0.ɵɵtext(0, " Working\u2026 ");
21
24
  } }
25
+ function ConfirmButton_Conditional_2_Template(rf, ctx) { if (rf & 1) {
26
+ i0.ɵɵelementContainer(0, 3);
27
+ i0.ɵɵtext(1);
28
+ } if (rf & 2) {
29
+ const ctx_r0 = i0.ɵɵnextContext();
30
+ i0.ɵɵproperty("molTemplateOutlet", ctx_r0.asTemplate(ctx_r0.label));
31
+ i0.ɵɵadvance();
32
+ i0.ɵɵtextInterpolate1("", ctx_r0.nodeText(ctx_r0.label), " ");
33
+ } }
34
+ function ConfirmButton_Conditional_3_Template(rf, ctx) { if (rf & 1) {
35
+ i0.ɵɵelementContainer(0, 3);
36
+ i0.ɵɵtext(1);
37
+ } if (rf & 2) {
38
+ const ctx_r0 = i0.ɵɵnextContext();
39
+ i0.ɵɵproperty("molTemplateOutlet", ctx_r0.asTemplate(ctx_r0.confirmLabel));
40
+ i0.ɵɵadvance();
41
+ i0.ɵɵtextInterpolate1("", ctx_r0.nodeText(ctx_r0.confirmLabel), " ");
42
+ } }
43
+ function ConfirmButton_Conditional_4_Template(rf, ctx) { if (rf & 1) {
44
+ i0.ɵɵelementContainer(0, 3);
45
+ i0.ɵɵtext(1);
46
+ } if (rf & 2) {
47
+ const ctx_r0 = i0.ɵɵnextContext();
48
+ i0.ɵɵproperty("molTemplateOutlet", ctx_r0.asTemplate(ctx_r0.pendingLabel));
49
+ i0.ɵɵadvance();
50
+ i0.ɵɵtextInterpolate1("", ctx_r0.nodeText(ctx_r0.pendingLabel), " ");
51
+ } }
22
52
  /**
23
53
  * ConfirmButton component.
24
54
  *
25
- * The host is the `<button>` itself (`button[mol-confirm-button]`). The three
26
- * labels are projected (`[slot=label]`, `[slot=confirmLabel]`,
55
+ * The host is the `<button>` itself (`button[mol-confirm-button]`). Each label
56
+ * is a node-valued input (`label`, `confirmLabel`, `pendingLabel`) or the
57
+ * matching projected slot (`[slot=label]`, `[slot=confirmLabel]`,
27
58
  * `[slot=pendingLabel]`); each capture span stays detached from the DOM and
28
59
  * the visible phase's projected children are moved onto the button — React
29
- * renders exactly one label and no wrapper element. When the slot for the
30
- * armed/pending phase is empty, the localized default text renders instead
31
- * (React's `confirmLabel ?? t(…)`).
60
+ * renders exactly one label and no wrapper element. When neither the input nor
61
+ * the slot for the armed/pending phase is given, the localized default text
62
+ * renders instead (React's `confirmLabel ?? t(…)`).
32
63
  */
33
64
  export class ConfirmButton {
34
65
  /** Button variant (passed through to the button classes). */
@@ -43,16 +74,32 @@ export class ConfirmButton {
43
74
  * button stays in its confirming state and ignores further clicks.
44
75
  */
45
76
  onConfirm;
77
+ /** Visible label in the idle state (React's `label` node value). */
78
+ label;
79
+ /** Visible label in the armed state (React's `confirmLabel` node value). */
80
+ confirmLabel;
81
+ /** Visible label while the confirm callback is pending. */
82
+ pendingLabel;
46
83
  /** Seconds before the armed state auto-disarms (`0` disables auto-disarm). */
47
84
  disarmSeconds = 4;
48
85
  /** Disables the control entirely (idle and confirming states). */
49
86
  disabled = false;
50
87
  /** `data-testid` for the button. */
51
88
  testId;
89
+ /** `data-mol-id` automation id (React's `automationId`). */
90
+ automationId;
91
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
92
+ dataMolId;
52
93
  /** Extra classes joined onto the button classes. */
53
94
  className;
54
95
  /** Inline style object (React camelCase). */
55
96
  style;
97
+ /** Template helpers (templates see only class members). */
98
+ asTemplate = asTemplate;
99
+ /** Renders a plain-string/number node value. */
100
+ nodeText = nodeText;
101
+ /** Whether a node-valued prop was given. */
102
+ isGiven = isGiven;
56
103
  /** The label slot capture span (kept out of the DOM). */
57
104
  labelSlot;
58
105
  /** The armed-state label capture span. */
@@ -67,6 +114,8 @@ export class ConfirmButton {
67
114
  phase = signal('idle', /* @ts-ignore */
68
115
  ...(ngDevMode ? [{ debugName: "phase" }] : /* istanbul ignore next */ []));
69
116
  el = inject(ElementRef);
117
+ /** The element a caller's ref receives: the host `<button>`. */
118
+ element = hostElement(this.el);
70
119
  renderer = inject(Renderer2);
71
120
  sync = new SlotWrapper(this.el, this.renderer);
72
121
  disarmTimer = null;
@@ -81,11 +130,12 @@ export class ConfirmButton {
81
130
  clearTimeout(this.disarmTimer);
82
131
  this.disarmTimer = null;
83
132
  }
84
- if (this.phase() === 'armed' && this.disarmSeconds > 0) {
133
+ const disarmSeconds = this.disarmSeconds ?? 4;
134
+ if (this.phase() === 'armed' && disarmSeconds > 0) {
85
135
  this.disarmTimer = setTimeout(() => {
86
136
  this.disarmTimer = null;
87
137
  this.phase.set('idle');
88
- }, this.disarmSeconds * 1000);
138
+ }, disarmSeconds * 1000);
89
139
  }
90
140
  });
91
141
  }
@@ -114,6 +164,16 @@ export class ConfirmButton {
114
164
  hostStyle() {
115
165
  return styleText(this.style);
116
166
  }
167
+ /**
168
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
169
+ * @returns The attribute value.
170
+ */
171
+ molId() {
172
+ return (this.automationId ??
173
+ this.dataMolId ??
174
+ this.el.nativeElement.getAttribute('data-mol-id') ??
175
+ undefined);
176
+ }
117
177
  /**
118
178
  * React's click handler: idle arms, armed commits (awaiting the callback),
119
179
  * pending ignores.
@@ -245,47 +305,62 @@ export class ConfirmButton {
245
305
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelSlot = _t.first);
246
306
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.confirmSlot = _t.first);
247
307
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.pendingSlot = _t.first);
248
- } }, hostVars: 9, hostBindings: function ConfirmButton_HostBindings(rf, ctx) { if (rf & 1) {
308
+ } }, hostVars: 10, hostBindings: function ConfirmButton_HostBindings(rf, ctx) { if (rf & 1) {
249
309
  i0.ɵɵlistener("click", function ConfirmButton_click_HostBindingHandler() { return ctx.handleClick(); })("keydown.escape", function ConfirmButton_keydown_escape_HostBindingHandler() { return ctx.handleEscape(); }, i0.ɵɵresolveDocument);
250
310
  } if (rf & 2) {
251
311
  i0.ɵɵdomProperty("disabled", ctx.disabled || ctx.phase() === "pending");
252
- i0.ɵɵattribute("type", "button")("aria-live", "polite")("data-state", ctx.phase())("data-testid", ctx.testId);
312
+ i0.ɵɵattribute("type", "button")("aria-live", "polite")("data-state", ctx.phase())("data-testid", ctx.testId)("data-mol-id", ctx.molId());
253
313
  i0.ɵɵstyleMap(ctx.hostStyle());
254
314
  i0.ɵɵclassMap(ctx.classes());
255
- } }, inputs: { variant: "variant", color: "color", size: "size", onConfirm: "onConfirm", disarmSeconds: "disarmSeconds", disabled: "disabled", testId: "testId", className: "className", style: "style" }, ngContentSelectors: _c4, decls: 11, vars: 2, consts: [["labelSlot", ""], ["confirmSlot", ""], ["pendingSlot", ""]], template: function ConfirmButton_Template(rf, ctx) { if (rf & 1) {
315
+ } }, inputs: { variant: "variant", color: "color", size: "size", onConfirm: "onConfirm", label: "label", confirmLabel: "confirmLabel", pendingLabel: "pendingLabel", disarmSeconds: "disarmSeconds", disabled: "disabled", testId: "testId", className: "className", style: "style", automationId: "automationId", dataMolId: [0, "data-mol-id", "dataMolId"] }, ngContentSelectors: _c4, decls: 14, vars: 5, consts: [["labelSlot", ""], ["confirmSlot", ""], ["pendingSlot", ""], [3, "molTemplateOutlet"]], template: function ConfirmButton_Template(rf, ctx) { if (rf & 1) {
256
316
  i0.ɵɵprojectionDef(_c3);
257
317
  i0.ɵɵconditionalCreate(0, ConfirmButton_Conditional_0_Template, 1, 0);
258
318
  i0.ɵɵconditionalCreate(1, ConfirmButton_Conditional_1_Template, 1, 0);
259
- i0.ɵɵdomElementStart(2, "span", null, 0);
260
- i0.ɵɵprojection(4);
261
- i0.ɵɵdomElementEnd();
262
- i0.ɵɵdomElementStart(5, "span", null, 1);
263
- i0.ɵɵprojection(7, 1);
264
- i0.ɵɵdomElementEnd();
265
- i0.ɵɵdomElementStart(8, "span", null, 2);
266
- i0.ɵɵprojection(10, 2);
267
- i0.ɵɵdomElementEnd();
319
+ i0.ɵɵconditionalCreate(2, ConfirmButton_Conditional_2_Template, 2, 2);
320
+ i0.ɵɵconditionalCreate(3, ConfirmButton_Conditional_3_Template, 2, 2);
321
+ i0.ɵɵconditionalCreate(4, ConfirmButton_Conditional_4_Template, 2, 2);
322
+ i0.ɵɵelementStart(5, "span", null, 0);
323
+ i0.ɵɵprojection(7);
324
+ i0.ɵɵelementEnd();
325
+ i0.ɵɵelementStart(8, "span", null, 1);
326
+ i0.ɵɵprojection(10, 1);
327
+ i0.ɵɵelementEnd();
328
+ i0.ɵɵelementStart(11, "span", null, 2);
329
+ i0.ɵɵprojection(13, 2);
330
+ i0.ɵɵelementEnd();
268
331
  } if (rf & 2) {
269
- i0.ɵɵconditional(ctx.phase() === "armed" && !ctx.hasConfirmLabel ? 0 : -1);
332
+ i0.ɵɵconditional(ctx.phase() === "armed" && !ctx.hasConfirmLabel && !ctx.isGiven(ctx.confirmLabel) ? 0 : -1);
270
333
  i0.ɵɵadvance();
271
- i0.ɵɵconditional(ctx.phase() === "pending" && !ctx.hasPendingLabel ? 1 : -1);
272
- } }, encapsulation: 2 });
334
+ i0.ɵɵconditional(ctx.phase() === "pending" && !ctx.hasPendingLabel && !ctx.isGiven(ctx.pendingLabel) ? 1 : -1);
335
+ i0.ɵɵadvance();
336
+ i0.ɵɵconditional(ctx.phase() === "idle" && ctx.isGiven(ctx.label) ? 2 : -1);
337
+ i0.ɵɵadvance();
338
+ i0.ɵɵconditional(ctx.phase() === "armed" && ctx.isGiven(ctx.confirmLabel) ? 3 : -1);
339
+ i0.ɵɵadvance();
340
+ i0.ɵɵconditional(ctx.phase() === "pending" && ctx.isGiven(ctx.pendingLabel) ? 4 : -1);
341
+ } }, dependencies: [MolTemplateOutlet], encapsulation: 2 });
273
342
  }
274
343
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmButton, [{
275
344
  type: Component,
276
345
  args: [{
277
346
  selector: 'button[mol-confirm-button]',
278
347
  standalone: true,
348
+ imports: [MolTemplateOutlet],
279
349
  inputs: [
280
350
  'variant',
281
351
  'color',
282
352
  'size',
283
353
  'onConfirm',
354
+ 'label',
355
+ 'confirmLabel',
356
+ 'pendingLabel',
284
357
  'disarmSeconds',
285
358
  'disabled',
286
359
  'testId',
287
360
  'className',
288
361
  'style',
362
+ 'automationId',
363
+ 'dataMolId: data-mol-id',
289
364
  ],
290
365
  host: {
291
366
  '[attr.type]': '"button"',
@@ -295,15 +370,27 @@ export class ConfirmButton {
295
370
  '[attr.aria-live]': '"polite"',
296
371
  '[attr.data-state]': 'phase()',
297
372
  '[attr.data-testid]': 'testId',
373
+ '[attr.data-mol-id]': 'molId()',
298
374
  '[class]': 'classes()',
299
375
  '[style]': 'hostStyle()',
300
376
  },
301
- template: `@if (phase() === 'armed' && !hasConfirmLabel) {
377
+ template: `@if (phase() === 'armed' && !hasConfirmLabel && !isGiven(confirmLabel)) {
302
378
  Confirm?
303
379
  }
304
- @if (phase() === 'pending' && !hasPendingLabel) {
380
+ @if (phase() === 'pending' && !hasPendingLabel && !isGiven(pendingLabel)) {
305
381
  Working…
306
382
  }
383
+ @if (phase() === 'idle' && isGiven(label)) {
384
+ <ng-container [molTemplateOutlet]="asTemplate(label)"></ng-container>{{ nodeText(label) }}
385
+ }
386
+ @if (phase() === 'armed' && isGiven(confirmLabel)) {
387
+ <ng-container [molTemplateOutlet]="asTemplate(confirmLabel)"></ng-container
388
+ >{{ nodeText(confirmLabel) }}
389
+ }
390
+ @if (phase() === 'pending' && isGiven(pendingLabel)) {
391
+ <ng-container [molTemplateOutlet]="asTemplate(pendingLabel)"></ng-container
392
+ >{{ nodeText(pendingLabel) }}
393
+ }
307
394
  <span #labelSlot><ng-content select="[slot=label]"></ng-content></span
308
395
  ><span #confirmSlot><ng-content select="[slot=confirmLabel]"></ng-content></span
309
396
  ><span #pendingSlot><ng-content select="[slot=pendingLabel]"></ng-content></span>`,
@@ -318,5 +405,5 @@ export class ConfirmButton {
318
405
  type: ViewChild,
319
406
  args: ['pendingSlot']
320
407
  }] }); })();
321
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConfirmButton, { className: "ConfirmButton", filePath: "components/confirm-button.component.ts", lineNumber: 72 }); })();
408
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConfirmButton, { className: "ConfirmButton", filePath: "components/confirm-button.component.ts", lineNumber: 138 }); })();
322
409
  //# sourceMappingURL=confirm-button.component.js.map