@molecule/app-ui-angular 1.5.2 → 1.11.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 (128) hide show
  1. package/README.md +762 -358
  2. package/dist/components/checkbox.component.d.ts +5 -1
  3. package/dist/components/checkbox.component.d.ts.map +1 -1
  4. package/dist/components/checkbox.component.js +14 -3
  5. package/dist/components/checkbox.component.js.map +1 -1
  6. package/dist/components/confirm-button.component.d.ts +1 -5
  7. package/dist/components/confirm-button.component.d.ts.map +1 -1
  8. package/dist/components/confirm-button.component.js +15 -11
  9. package/dist/components/confirm-button.component.js.map +1 -1
  10. package/dist/components/confirm-dialog.component.d.ts +1 -5
  11. package/dist/components/confirm-dialog.component.d.ts.map +1 -1
  12. package/dist/components/confirm-dialog.component.js +5 -3
  13. package/dist/components/confirm-dialog.component.js.map +1 -1
  14. package/dist/components/dropdown.component.d.ts +3 -11
  15. package/dist/components/dropdown.component.d.ts.map +1 -1
  16. package/dist/components/dropdown.component.js +45 -97
  17. package/dist/components/dropdown.component.js.map +1 -1
  18. package/dist/components/file-field.component.d.ts +44 -0
  19. package/dist/components/file-field.component.d.ts.map +1 -0
  20. package/dist/components/file-field.component.js +125 -0
  21. package/dist/components/file-field.component.js.map +1 -0
  22. package/dist/components/floating-input.component.d.ts +21 -3
  23. package/dist/components/floating-input.component.d.ts.map +1 -1
  24. package/dist/components/floating-input.component.js +34 -4
  25. package/dist/components/floating-input.component.js.map +1 -1
  26. package/dist/components/form.component.d.ts.map +1 -1
  27. package/dist/components/form.component.js +11 -6
  28. package/dist/components/form.component.js.map +1 -1
  29. package/dist/components/index.d.ts +1 -0
  30. package/dist/components/index.d.ts.map +1 -1
  31. package/dist/components/index.js +1 -0
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/input.component.d.ts +18 -2
  34. package/dist/components/input.component.d.ts.map +1 -1
  35. package/dist/components/input.component.js +37 -11
  36. package/dist/components/input.component.js.map +1 -1
  37. package/dist/components/language-picker.component.d.ts +9 -1
  38. package/dist/components/language-picker.component.d.ts.map +1 -1
  39. package/dist/components/language-picker.component.js +15 -8
  40. package/dist/components/language-picker.component.js.map +1 -1
  41. package/dist/components/load-error-banner.component.d.ts +21 -3
  42. package/dist/components/load-error-banner.component.d.ts.map +1 -1
  43. package/dist/components/load-error-banner.component.js +33 -5
  44. package/dist/components/load-error-banner.component.js.map +1 -1
  45. package/dist/components/modal.component.d.ts +14 -48
  46. package/dist/components/modal.component.d.ts.map +1 -1
  47. package/dist/components/modal.component.js +72 -184
  48. package/dist/components/modal.component.js.map +1 -1
  49. package/dist/components/molecule/input.component.d.ts +7 -0
  50. package/dist/components/molecule/input.component.d.ts.map +1 -1
  51. package/dist/components/molecule/input.component.js +13 -5
  52. package/dist/components/molecule/input.component.js.map +1 -1
  53. package/dist/components/molecule/select.component.d.ts +7 -0
  54. package/dist/components/molecule/select.component.d.ts.map +1 -1
  55. package/dist/components/molecule/select.component.js +13 -5
  56. package/dist/components/molecule/select.component.js.map +1 -1
  57. package/dist/components/page-header.component.d.ts.map +1 -1
  58. package/dist/components/page-header.component.js +22 -21
  59. package/dist/components/page-header.component.js.map +1 -1
  60. package/dist/components/prompt-dialog.component.d.ts +6 -30
  61. package/dist/components/prompt-dialog.component.d.ts.map +1 -1
  62. package/dist/components/prompt-dialog.component.js +25 -56
  63. package/dist/components/prompt-dialog.component.js.map +1 -1
  64. package/dist/components/responsive-app-shell.component.d.ts +4 -34
  65. package/dist/components/responsive-app-shell.component.d.ts.map +1 -1
  66. package/dist/components/responsive-app-shell.component.js +46 -141
  67. package/dist/components/responsive-app-shell.component.js.map +1 -1
  68. package/dist/components/select.component.d.ts +9 -1
  69. package/dist/components/select.component.d.ts.map +1 -1
  70. package/dist/components/select.component.js +16 -7
  71. package/dist/components/select.component.js.map +1 -1
  72. package/dist/components/sidebar-user-card.component.d.ts +5 -1
  73. package/dist/components/sidebar-user-card.component.d.ts.map +1 -1
  74. package/dist/components/sidebar-user-card.component.js +11 -7
  75. package/dist/components/sidebar-user-card.component.js.map +1 -1
  76. package/dist/components/switch.component.d.ts +3 -1
  77. package/dist/components/switch.component.d.ts.map +1 -1
  78. package/dist/components/switch.component.js +9 -2
  79. package/dist/components/switch.component.js.map +1 -1
  80. package/dist/components/textarea.component.d.ts +15 -9
  81. package/dist/components/textarea.component.d.ts.map +1 -1
  82. package/dist/components/textarea.component.js +33 -19
  83. package/dist/components/textarea.component.js.map +1 -1
  84. package/dist/components/theme-toggle.component.d.ts +14 -1
  85. package/dist/components/theme-toggle.component.d.ts.map +1 -1
  86. package/dist/components/theme-toggle.component.js +27 -6
  87. package/dist/components/theme-toggle.component.js.map +1 -1
  88. package/dist/components/toast.component.d.ts +13 -18
  89. package/dist/components/toast.component.d.ts.map +1 -1
  90. package/dist/components/toast.component.js +47 -63
  91. package/dist/components/toast.component.js.map +1 -1
  92. package/dist/components/tooltip.component.d.ts +4 -2
  93. package/dist/components/tooltip.component.d.ts.map +1 -1
  94. package/dist/components/tooltip.component.js +35 -90
  95. package/dist/components/tooltip.component.js.map +1 -1
  96. package/dist/components/user-menu-popover.component.d.ts +4 -8
  97. package/dist/components/user-menu-popover.component.d.ts.map +1 -1
  98. package/dist/components/user-menu-popover.component.js +28 -48
  99. package/dist/components/user-menu-popover.component.js.map +1 -1
  100. package/dist/index.d.ts +8 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +8 -0
  103. package/dist/index.js.map +1 -1
  104. package/dist/utilities/element-props.d.ts +1 -1
  105. package/dist/utilities/element-props.d.ts.map +1 -1
  106. package/dist/utilities/element-props.js +3 -13
  107. package/dist/utilities/element-props.js.map +1 -1
  108. package/dist/utilities/element.d.ts +10 -0
  109. package/dist/utilities/element.d.ts.map +1 -1
  110. package/dist/utilities/element.js +13 -0
  111. package/dist/utilities/element.js.map +1 -1
  112. package/dist/utilities/style.d.ts +6 -16
  113. package/dist/utilities/style.d.ts.map +1 -1
  114. package/dist/utilities/style.js +38 -117
  115. package/dist/utilities/style.js.map +1 -1
  116. package/dist/web-drag.directive.d.ts +25 -0
  117. package/dist/web-drag.directive.d.ts.map +1 -0
  118. package/dist/web-drag.directive.js +43 -0
  119. package/dist/web-drag.directive.js.map +1 -0
  120. package/dist/web-hover.directive.d.ts +24 -0
  121. package/dist/web-hover.directive.d.ts.map +1 -0
  122. package/dist/web-hover.directive.js +42 -0
  123. package/dist/web-hover.directive.js.map +1 -0
  124. package/dist/web-wheel-zoom.directive.d.ts +18 -0
  125. package/dist/web-wheel-zoom.directive.d.ts.map +1 -0
  126. package/dist/web-wheel-zoom.directive.js +28 -0
  127. package/dist/web-wheel-zoom.directive.js.map +1 -0
  128. package/package.json +13 -5
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-24T08:12:12.486Z
6
+ Generated: 2026-11-26T11:06:13.529Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-angular
@@ -71,7 +71,7 @@ class SavePanel {
71
71
  ## Installation
72
72
 
73
73
  ```bash
74
- npm install @molecule/app-ui-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-i18n @molecule/app-icons @molecule/app-ui
74
+ npm install @molecule/app-ui-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-filesystem @molecule/app-i18n @molecule/app-icons @molecule/app-inline-style-dom @molecule/app-overlay-dom @molecule/app-pointer-events-dom @molecule/app-ui
75
75
  ```
76
76
 
77
77
  ## API
@@ -91,8 +91,8 @@ interface CSSProperties {
91
91
 
92
92
  #### `KitEvent`
93
93
 
94
- The event a UI kit hands a component's handler: the members that behave the same on every kit. React's kit
95
- passes React's event (so `stopPropagation()` stops React parent handlers), the other kits pass the DOM event;
94
+ The event a web UI kit hands a component's handler: the members shared by the web kits. React's kit
95
+ passes React's event (so `stopPropagation()` stops React parent handlers), the other web kits pass the DOM event;
96
96
  both satisfy this type. A handler that needs a member only one of them has (`nativeEvent`, `composedPath()`,
97
97
  `isComposing`) takes the component's ref element (see {@link BaseProps}) and listens on it.
98
98
 
@@ -238,7 +238,7 @@ interface HTMLElementProps extends BaseProps {
238
238
  id?: string
239
239
  title?: string
240
240
  tabIndex?: number
241
- role?: string
241
+ role?: ElementRole
242
242
  'aria-label'?: string
243
243
  'aria-labelledby'?: string
244
244
  'aria-describedby'?: string
@@ -282,6 +282,7 @@ interface InputElementProps extends HTMLElementProps {
282
282
  maxLength?: number
283
283
  minLength?: number
284
284
  pattern?: string
285
+ /** Web change event. Prefer the control's value callback for shared web and native code. */
285
286
  onChange?: ChangeEventHandler
286
287
  onInput?: FormEventHandler
287
288
  }
@@ -323,6 +324,7 @@ interface TextareaElementProps extends HTMLElementProps {
323
324
  maxLength?: number
324
325
  minLength?: number
325
326
  wrap?: 'hard' | 'soft' | 'off'
327
+ /** Web change event. {@link TextareaProps.onValueChange} also works on native. */
326
328
  onChange?: ChangeEventHandler
327
329
  onInput?: FormEventHandler
328
330
  }
@@ -338,6 +340,7 @@ interface SelectElementProps extends HTMLElementProps {
338
340
  required?: boolean
339
341
  autoFocus?: boolean
340
342
  multiple?: boolean
343
+ /** Web change event. {@link SelectProps.onValueChange} also works on native. */
341
344
  onChange?: ChangeEventHandler
342
345
  }
343
346
  ```
@@ -419,7 +422,7 @@ Props for the Input component (text field, email, password, etc.).
419
422
  Ref element: the native `<input>`.
420
423
 
421
424
  ```typescript
422
- interface InputProps extends InputElementProps {
425
+ interface InputProps extends InputElementProps, Pick<TextFieldProps, 'onValueChange'> {
423
426
  /**
424
427
  * Input type.
425
428
  */
@@ -486,7 +489,7 @@ Props for the Textarea component.
486
489
  Ref element: the native `<textarea>`.
487
490
 
488
491
  ```typescript
489
- interface TextareaProps extends TextareaElementProps {
492
+ interface TextareaProps extends TextareaElementProps, Pick<TextFieldProps, 'onValueChange'> {
490
493
  /**
491
494
  * Text size tier (see {@link TextareaClassOptions.size}) — pass the same
492
495
  * `size` as a neighboring Input for identical font sizes.
@@ -572,7 +575,7 @@ interface SelectProps<T = string> extends SelectElementProps {
572
575
  value?: T
573
576
 
574
577
  /**
575
- * Change handler (with typed value).
578
+ * Called with the selected value on web and native.
576
579
  */
577
580
  onValueChange?: (value: T) => void
578
581
 
@@ -615,7 +618,7 @@ Props for the Checkbox component.
615
618
  Ref element: the native `<input type="checkbox">`.
616
619
 
617
620
  ```typescript
618
- interface CheckboxProps extends InputElementProps {
621
+ interface CheckboxProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
619
622
  /**
620
623
  * Checkbox label.
621
624
  */
@@ -703,7 +706,7 @@ Props for the Switch/Toggle component.
703
706
  Ref element: the `role="switch"` button.
704
707
 
705
708
  ```typescript
706
- interface SwitchProps extends InputElementProps {
709
+ interface SwitchProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
707
710
  /**
708
711
  * Switch label.
709
712
  */
@@ -794,6 +797,14 @@ interface ModalProps extends HTMLElementProps {
794
797
  * @default 'Close'
795
798
  */
796
799
  closeLabel?: string
800
+
801
+ /**
802
+ * The control that takes focus when the modal opens, such as the field a dialog exists to fill.
803
+ * Without it, focus goes to the first focusable control, or to the dialog when it has none. The
804
+ * modal reads it once the open dialog is in the document, so a control rendered in the
805
+ * children can be named here.
806
+ */
807
+ initialFocus?: OverlayTarget
797
808
  }
798
809
  ```
799
810
 
@@ -1775,6 +1786,10 @@ interface LanguagePickerProps {
1775
1786
  className?: string
1776
1787
  /** Inline style object for the trigger button (React camelCase). */
1777
1788
  style?: Record<string, unknown>
1789
+ /** `data-testid` for the trigger button. */
1790
+ testId?: string
1791
+ /** `data-mol-id` for the trigger button (React's `automationId`; default `language-picker-trigger`). */
1792
+ automationId?: string
1778
1793
  /** Optional trigger replacement (a node value rendered as a template). */
1779
1794
  renderTrigger?: TemplateRef<unknown>
1780
1795
  }
@@ -1800,6 +1815,10 @@ interface LoadErrorBannerProps {
1800
1815
  retryMolId?: string
1801
1816
  /** Extra classes for the root (React's rest `className`). */
1802
1817
  className?: string
1818
+ /** `data-testid` for the root. */
1819
+ testId?: string
1820
+ /** `data-mol-id` for the root (React's `automationId`). */
1821
+ automationId?: string
1803
1822
  }
1804
1823
  ```
1805
1824
 
@@ -2146,6 +2165,8 @@ interface SidebarUserCardProps {
2146
2165
  dataMolId?: string
2147
2166
  /** Extra classes for the trigger. */
2148
2167
  className?: string
2168
+ /** `data-testid` for the trigger. */
2169
+ testId?: string
2149
2170
  }
2150
2171
  ```
2151
2172
 
@@ -2169,6 +2190,10 @@ interface ThemeToggleProps {
2169
2190
  iconSize?: number
2170
2191
  /** Extra classes joined onto the toggle classes. */
2171
2192
  className?: string
2193
+ /** `data-testid` for the button. */
2194
+ testId?: string
2195
+ /** `data-mol-id` automation id (React's `automationId`; default `theme-toggle`). */
2196
+ automationId?: string
2172
2197
  }
2173
2198
  ```
2174
2199
 
@@ -4247,6 +4272,8 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4247
4272
 
4248
4273
  /** The genuine native `change` event. */
4249
4274
  @Output() readonly change = new EventEmitter<Event>()
4275
+ /** Fires with the new checked state. */
4276
+ @Output() readonly checkedChange = new EventEmitter<boolean>()
4250
4277
 
4251
4278
  /** The native input (React's `...rest` spread target). */
4252
4279
  private input?: ElementRef<HTMLInputElement>
@@ -4284,10 +4311,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4284
4311
  })
4285
4312
  }
4286
4313
 
4287
- /**
4288
- * The current class map.
4289
- * @returns The UIClassMap.
4290
- */
4314
+ /** The current class map. */
4291
4315
  cm(): UIClassMap {
4292
4316
  return getClassMap()
4293
4317
  }
@@ -4316,10 +4340,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4316
4340
  )
4317
4341
  }
4318
4342
 
4319
- /**
4320
- * Computes the checkbox class list.
4321
- * @returns The class string.
4322
- */
4343
+ /** Computes the checkbox class list. */
4323
4344
  classes(): string {
4324
4345
  return this.cm().cn(this.cm().checkbox({ error: !!this.error }), this.className)
4325
4346
  }
@@ -4334,26 +4355,29 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4334
4355
  return this.automationId ?? this.dataMolId ?? this.externalMolId
4335
4356
  }
4336
4357
 
4337
- /** React's checkbox `onChange` fires on the checkbox's CLICK event (React's change-event plugin maps checkbox/radio changes to the click), so the click event obje… */
4338
4358
  handleClick(event: MouseEvent): void {
4339
4359
  this.onClick?.(event)
4340
4360
  this.justClicked = true
4341
- this.change.emit(event)
4361
+ this.emitChange(event)
4342
4362
  queueMicrotask(() => (this.justClicked = false))
4343
4363
  }
4344
4364
 
4345
- /** A native change that did not come from this tick's click (a synthetic `dispatchEvent`) is forwarded like React would; the event never reaches the host, where t… */
4346
4365
  handleChange(event: Event): void {
4347
4366
  event.stopPropagation()
4348
- if (!this.justClicked) this.change.emit(event)
4367
+ if (!this.justClicked) this.emitChange(event)
4349
4368
  if (this.checked !== undefined && this.input) this.input.nativeElement.checked = !!this.checked
4350
4369
  }
4351
4370
 
4352
4371
  private justClicked = false
4353
4372
 
4354
- /**
4355
- * Applies the indeterminate DOM flag (a property, not an attribute).
4356
- */
4373
+ /** Reports the checkbox change and its new checked state. */
4374
+ private emitChange(event: Event): void {
4375
+ const next = this.input?.nativeElement.checked
4376
+ this.change.emit(event)
4377
+ if (next !== undefined) this.checkedChange.emit(next)
4378
+ }
4379
+
4380
+ /** Applies the indeterminate DOM flag (a property, not an attribute). */
4357
4381
  ngAfterViewChecked(): void {
4358
4382
  const input = this.input?.nativeElement
4359
4383
  if (input) {
@@ -4379,7 +4403,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4379
4403
  }
4380
4404
  ```
4381
4405
 
4382
- _(The 9 longest member comments are shortened to their first sentence to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/checkbox.component.d.ts`.)_
4406
+ _(Member comments are shortened to their first sentence, and the 2 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/checkbox.component.d.ts`.)_
4383
4407
 
4384
4408
  #### `ConfirmButton`
4385
4409
 
@@ -4419,7 +4443,6 @@ renders instead (React's `confirmLabel ?? t(…)`).
4419
4443
  host: {
4420
4444
  '[attr.type]': '"button"',
4421
4445
  '(click)': 'handleClick()',
4422
- '(document:keydown.escape)': 'handleEscape()',
4423
4446
  '[disabled]': 'disabled || phase() === "pending"',
4424
4447
  '[attr.aria-live]': '"polite"',
4425
4448
  '[attr.data-state]': 'phase()',
@@ -4492,9 +4515,7 @@ export class ConfirmButton implements OnDestroy, HasElement<HTMLButtonElement> {
4492
4515
  /** The pending-state label capture span. */
4493
4516
  @ViewChild('pendingSlot') pendingSlot?: ElementRef<HTMLSpanElement>
4494
4517
 
4495
- /** Whether the armed label slot carries content (a signal the template reads). */
4496
4518
  readonly hasConfirmLabel = signal(false)
4497
- /** Whether the pending label slot carries content (a signal the template reads). */
4498
4519
  readonly hasPendingLabel = signal(false)
4499
4520
 
4500
4521
  /** The current phase: idle → armed → pending → idle. */
@@ -4504,6 +4525,7 @@ export class ConfirmButton implements OnDestroy, HasElement<HTMLButtonElement> {
4504
4525
  /** The element a caller's ref receives: the host `<button>`. */
4505
4526
  readonly element = hostElement(this.el)
4506
4527
  private disarmTimer: ReturnType<typeof setTimeout> | null = null
4528
+ private readonly layer = new OverlayLayer()
4507
4529
 
4508
4530
  constructor() {
4509
4531
  usePlacement((hasContent) => this.syncLabels(hasContent))
@@ -4513,7 +4535,17 @@ export class ConfirmButton implements OnDestroy, HasElement<HTMLButtonElement> {
4513
4535
  this.disarmTimer = null
4514
4536
  }
4515
4537
  const disarmSeconds = this.disarmSeconds ?? 4
4516
- if (this.phase() === 'armed' && disarmSeconds > 0) {
4538
+ const armed = this.phase() === 'armed'
4539
+ const target = { current: this.el.nativeElement }
4540
+ this.layer.sync({
4541
+ open: armed,
4542
+ kind: 'popover',
4543
+ surface: target,
4544
+ anchor: target,
4545
+ dismissKey: true,
4546
+ onDismiss: () => this.disarm(),
4547
+ })
4548
+ if (armed && disarmSeconds > 0) {
4517
4549
  this.disarmTimer = setTimeout(() => {
4518
4550
  this.disarmTimer = null
4519
4551
  this.phase.set('idle')
@@ -4574,10 +4606,6 @@ export class ConfirmButton implements OnDestroy, HasElement<HTMLButtonElement> {
4574
4606
  }
4575
4607
  }
4576
4608
 
4577
- private handleEscape(): void {
4578
- if (this.phase() === 'armed') this.disarm()
4579
- }
4580
-
4581
4609
  /** React's `disarm`: cancels the timer and returns to idle. */
4582
4610
  private disarm(): void {
4583
4611
  if (this.disarmTimer) {
@@ -4618,12 +4646,13 @@ export class ConfirmButton implements OnDestroy, HasElement<HTMLButtonElement> {
4618
4646
 
4619
4647
  /** Clears the auto-disarm timer (React's unmount cleanup). */
4620
4648
  ngOnDestroy(): void {
4649
+ this.layer.release()
4621
4650
  if (this.disarmTimer) clearTimeout(this.disarmTimer)
4622
4651
  }
4623
4652
  }
4624
4653
  ```
4625
4654
 
4626
- _(Member comments are shortened to their first sentence, and the 6 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/confirm-button.component.d.ts`.)_
4655
+ _(Member comments are shortened to their first sentence, and the 7 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/confirm-button.component.d.ts`.)_
4627
4656
 
4628
4657
  #### `ConfirmDialog`
4629
4658
 
@@ -4781,6 +4810,7 @@ export class ConfirmDialog {
4781
4810
  @ViewChild('modal', { read: ElementRef }) modalElement?: ElementRef<HTMLElement>
4782
4811
 
4783
4812
  private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
4813
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
4784
4814
 
4785
4815
  /**
4786
4816
  * Recomputes {@link ariaLabelledBy} and {@link ariaDescribedBy} from the
@@ -4798,7 +4828,7 @@ export class ConfirmDialog {
4798
4828
  ? this.descriptionId
4799
4829
  : null,
4800
4830
  )
4801
- setElementPresent(this.host.nativeElement, false)
4831
+ setElementPresent(this.host.nativeElement, !this.browser && this.open)
4802
4832
  setHostRoot(this.host.nativeElement, this.modalElement?.nativeElement)
4803
4833
  })
4804
4834
  }
@@ -4945,6 +4975,8 @@ export class Dropdown implements AfterViewInit, DoCheck, OnDestroy, HasElement<H
4945
4975
  private readonly inner = signal<HTMLDivElement | null>(null)
4946
4976
  readonly element = this.inner.asReadonly()
4947
4977
  private readonly renderer = inject(Renderer2)
4978
+ private readonly layer = new OverlayLayer()
4979
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
4948
4980
  private readonly cdr = inject(ChangeDetectorRef)
4949
4981
  private readonly injector = inject(Injector)
4950
4982
  private readonly host: HTMLElement = this.el.nativeElement
@@ -4961,7 +4993,7 @@ export class Dropdown implements AfterViewInit, DoCheck, OnDestroy, HasElement<H
4961
4993
  private lastPlacement: DropdownPlacement = 'bottom-start'
4962
4994
  private lastAlign: DropdownAlign = 'start'
4963
4995
  private menuWidth: number | string | undefined
4964
- private removedListeners: (() => void)[] = []
4996
+ private cancelPosition?: () => void
4965
4997
  private lastRoute: string | null = null
4966
4998
  private pendingOpenFocus: 'first' | 'last' = 'first'
4967
4999
  private focusedItemEl: HTMLElement | null = null
@@ -5086,7 +5118,7 @@ export class Dropdown implements AfterViewInit, DoCheck, OnDestroy, HasElement<H
5086
5118
  if (!this.isOpen()) this.pendingOpenFocus = 'first'
5087
5119
  this.setOpen(!this.isOpen())
5088
5120
  }
5089
- // … truncated — 24 more members: handleTriggerKeyDown, handleClose, closeAndRefocusTrigger, ngAfterViewInit, ngDoCheck, ngOnDestroy, placeTrigger, adopt, release, focusableIndexes, itemElements, elementForIndex, focusActive, constructor, restoreItemFocus, syncMenu, openMenu, destroyMenu, updateMenuWidth, schedulePosition, updatePosition, addListeners, removeListeners, syncTrigger; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/dropdown.component.d.ts
5121
+ // … truncated — 22 more members: handleTriggerKeyDown, handleClose, closeAndRefocusTrigger, ngAfterViewInit, ngDoCheck, ngOnDestroy, placeTrigger, adopt, release, focusableIndexes, itemElements, elementForIndex, focusActive, constructor, restoreItemFocus, syncMenu, openMenu, destroyMenu, updateMenuWidth, schedulePosition, updatePosition, syncTrigger; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/dropdown.component.d.ts
5090
5122
  ```
5091
5123
 
5092
5124
  _(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/dropdown.component.d.ts`.)_
@@ -5296,6 +5328,87 @@ export class EmptyState implements HasElement<HTMLDivElement> {
5296
5328
  }
5297
5329
  ```
5298
5330
 
5331
+ #### `FileField`
5332
+
5333
+ Renders one focusable target and emits portable file selections.
5334
+
5335
+ ```typescript
5336
+ @Component({
5337
+ selector: 'div[mol-file-field]',
5338
+ standalone: true,
5339
+ host: {
5340
+ 'data-mol-id': 'file-field',
5341
+ '[attr.role]': 'role ?? "button"',
5342
+ '[class]': 'className',
5343
+ '[attr.tabindex]': 'disabled ? -1 : 0',
5344
+ '[attr.aria-disabled]': 'disabled ?? null',
5345
+ '(click)': 'handlers.onClick($event)',
5346
+ '(keydown)': 'handlers.onKeyDown($event)',
5347
+ '(dragover)': 'onDragOver($event)',
5348
+ '(drop)': 'handlers.onDrop($event)',
5349
+ },
5350
+ template: `<input
5351
+ #fileInput
5352
+ type="file"
5353
+ hidden
5354
+ [attr.accept]="accept ?? null"
5355
+ [multiple]="multiple"
5356
+ [disabled]="disabled ?? false"
5357
+ (change)="handlers.onChange()"
5358
+ /><ng-content />`,
5359
+ })
5360
+ export class FileField implements FileFieldHandle {
5361
+ /** Comma-separated accepted types and extensions. */
5362
+ @Input() accept?: string
5363
+ /** ClassMap classes for the host. */
5364
+ @Input() className?: string
5365
+ /** Prevents picking and delivering files. */
5366
+ @Input() disabled?: boolean
5367
+ /** Inclusive per-file limit in bytes. */
5368
+ @Input() maxSize?: number
5369
+ /** Delivers all accepted files in selection order. */
5370
+ @Input({ transform: booleanAttribute }) multiple = false
5371
+ /** Optional accessibility role for the host. */
5372
+ @Input() role?: FileFieldProps['role']
5373
+ /** The accepted files. */
5374
+ @Output() readonly valueChange = new EventEmitter<readonly PickedFile[]>()
5375
+ /** The files rejected by type or size. */
5376
+ @Output() readonly rejected = new EventEmitter<readonly PickedFile[]>()
5377
+ /** A failure opening or reading the chooser. */
5378
+ @Output() readonly pickError = new EventEmitter<Error>()
5379
+
5380
+ @ViewChild('fileInput') private fileInput?: ElementRef<HTMLInputElement>
5381
+
5382
+ /** Shared DOM event handlers for this host and its input. */
5383
+ protected readonly handlers = createBrowserFileInput(
5384
+ () => this.fileInput?.nativeElement,
5385
+ () => ({
5386
+ accept: this.accept,
5387
+ disabled: this.disabled,
5388
+ maxSize: this.maxSize,
5389
+ multiple: this.multiple,
5390
+ onFiles: (files) => this.valueChange.emit(files),
5391
+ onRejected: (files) => this.rejected.emit(files),
5392
+ onPickError: (error) => this.pickError.emit(error),
5393
+ }),
5394
+ fromBrowserFile,
5395
+ )
5396
+
5397
+ /** Opens the chooser when called on the field instance from a view query. */
5398
+ pick(): void {
5399
+ this.handlers.onClick({ target: null, defaultPrevented: false })
5400
+ }
5401
+
5402
+ /**
5403
+ * Enables dropping on the host when the field is enabled.
5404
+ * @param event - The native drag event.
5405
+ */
5406
+ protected onDragOver(event: DragEvent): void {
5407
+ this.handlers.onDragOver(event)
5408
+ }
5409
+ }
5410
+ ```
5411
+
5299
5412
  #### `FloatingInput`
5300
5413
 
5301
5414
  FloatingInput component.
@@ -5315,6 +5428,8 @@ uncontrolled (internal state seeded from `defaultValue`).
5315
5428
  'value',
5316
5429
  'defaultValue',
5317
5430
  'id',
5431
+ 'automationId',
5432
+ 'dataMolId: data-mol-id',
5318
5433
  'onFocus',
5319
5434
  'onBlur',
5320
5435
  'onKeyDown',
@@ -5327,6 +5442,7 @@ uncontrolled (internal state seeded from `defaultValue`).
5327
5442
  [attr.placeholder]="placeholder"
5328
5443
  [class]="classes()"
5329
5444
  [attr.value]="currentValue()"
5445
+ [attr.data-mol-id]="molId()"
5330
5446
  (input)="handleInput($event)"
5331
5447
  (change)="stopPropagation($event)"
5332
5448
  (focusin)="onFocus?.($event)"
@@ -5338,7 +5454,9 @@ uncontrolled (internal state seeded from `defaultValue`).
5338
5454
  <label [attr.for]="inputId()" [class]="cm().floatingLabel">{{ placeholder }}</label>
5339
5455
  }`,
5340
5456
  })
5341
- export class FloatingInput implements OnInit, AfterViewInit, HasElement<HTMLInputElement> {
5457
+ export class FloatingInput
5458
+ implements OnInit, AfterViewInit, AfterViewChecked, HasElement<HTMLInputElement>
5459
+ {
5342
5460
  /** Placeholder text, also rendered as the floating label. */
5343
5461
  placeholder?: string
5344
5462
  /** Extra classes joined onto the input classes. */
@@ -5349,6 +5467,10 @@ export class FloatingInput implements OnInit, AfterViewInit, HasElement<HTMLInpu
5349
5467
  defaultValue?: string
5350
5468
  /** Explicit input id. */
5351
5469
  id?: string
5470
+ /** `data-mol-id` automation id (React's `automationId`). */
5471
+ automationId?: string
5472
+ /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
5473
+ dataMolId?: string
5352
5474
 
5353
5475
  /** React's `onFocus`, which React spreads onto the <input>: its `currentTarget` is that element. */
5354
5476
  onFocus?: FocusEventHandler
@@ -5377,6 +5499,8 @@ export class FloatingInput implements OnInit, AfterViewInit, HasElement<HTMLInpu
5377
5499
  /** The per-instance id used when the caller gives none (React's `useId`). */
5378
5500
  private readonly generatedId = nextInstanceId()
5379
5501
  private internalValue = ''
5502
+ /** The `data-mol-id` a caller bound on the host (React spreads it onto the input). */
5503
+ private externalMolId: string | undefined
5380
5504
 
5381
5505
  /**
5382
5506
  * The current class map.
@@ -5395,6 +5519,14 @@ export class FloatingInput implements OnInit, AfterViewInit, HasElement<HTMLInpu
5395
5519
  return this.id || this.generatedId
5396
5520
  }
5397
5521
 
5522
+ /**
5523
+ * The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`).
5524
+ * @returns The attribute value.
5525
+ */
5526
+ molId(): string | undefined {
5527
+ return this.automationId ?? this.dataMolId ?? this.externalMolId
5528
+ }
5529
+
5398
5530
  /**
5399
5531
  * Computes the input class list.
5400
5532
  * @returns The class string.
@@ -5453,8 +5585,29 @@ export class FloatingInput implements OnInit, AfterViewInit, HasElement<HTMLInpu
5453
5585
  * spread puts them.
5454
5586
  */
5455
5587
  ngAfterViewInit(): void {
5588
+ this.adoptHostMolId()
5456
5589
  moveRestAttributes(this.host.nativeElement, this.inputEl?.nativeElement)
5457
5590
  }
5591
+
5592
+ /**
5593
+ * Puts a `data-mol-id` bound on the host onto the input in the pass that bound it (the host
5594
+ * attribute is written after this component's view is checked).
5595
+ */
5596
+ ngAfterViewChecked(): void {
5597
+ this.adoptHostMolId()
5598
+ }
5599
+
5600
+ /** Takes a `data-mol-id` off the host and keeps it for the input's binding. */
5601
+ private adoptHostMolId(): void {
5602
+ adoptHostDataMolId(
5603
+ this.host.nativeElement,
5604
+ this.inputEl?.nativeElement,
5605
+ (id) => {
5606
+ this.externalMolId = id
5607
+ },
5608
+ () => this.molId(),
5609
+ )
5610
+ }
5458
5611
  }
5459
5612
  ```
5460
5613
 
@@ -5907,11 +6060,18 @@ export class Form implements HasElement<HTMLFormElement> {
5907
6060
  const form = event.currentTarget instanceof HTMLFormElement ? event.currentTarget : null
5908
6061
  if (this.onFormSubmit) {
5909
6062
  event.preventDefault()
5910
- const formData = new FormData(form ?? undefined)
5911
- const data: Record<string, unknown> = {}
5912
- formData.forEach((value, key) => {
5913
- data[key] = value
5914
- })
6063
+ const entries = Array.from(new FormData(form ?? undefined))
6064
+ // `Object.fromEntries` defines every name as an own key: a repeated name
6065
+ // keeps its last value, and `__proto__` stays an ordinary field instead
6066
+ // of replacing the object's prototype.
6067
+ const data: Record<string, unknown> = Object.fromEntries(entries)
6068
+ // React reads `process.env.NODE_ENV`; Angular's CLI defines no such
6069
+ // global, and `isDevMode()` is false in its optimized (production) builds.
6070
+ if (isDevMode() && Object.keys(data).length < entries.length) {
6071
+ console.error(
6072
+ "Form.onFormSubmit received repeated field names and keeps only their last values. Use the form's onSubmit handler for repeated entries.",
6073
+ )
6074
+ }
5915
6075
  call(() => this.onFormSubmit?.(data))
5916
6076
  }
5917
6077
  call(() => this.onSubmit?.(event))
@@ -6108,7 +6268,8 @@ export class Icon implements OnChanges {
6108
6268
 
6109
6269
  Input component.
6110
6270
 
6111
- The host is the `div.inputWrapper` React renders. React's text-input
6271
+ The host is the field's outer wrapper React renders (the shared field layout's
6272
+ `root`, a flex column). React's text-input
6112
6273
  `onChange` fires on `input` events; a controlled `value` is restored after
6113
6274
  user input exactly like React's controlled-input state restore.
6114
6275
 
@@ -6151,7 +6312,7 @@ DOM whenever React would render nothing (`setElementPresent`).
6151
6312
  'onKeyDown',
6152
6313
  ],
6153
6314
  host: {
6154
- '[class]': 'cm().inputWrapper',
6315
+ '[class]': 'field().root',
6155
6316
  },
6156
6317
  template: `@if (label) {
6157
6318
  <label
@@ -6160,7 +6321,7 @@ DOM whenever React would render nothing (`setElementPresent`).
6160
6321
  >{{ label }}</label
6161
6322
  >
6162
6323
  }
6163
- <div [class]="cm().inputInner">
6324
+ <div [class]="field().inner">
6164
6325
  <div [class]="cm().inputLeftElement" #leftSlot>
6165
6326
  <ng-content select="[slot=leftElement]"></ng-content>
6166
6327
  @if (asTemplate(leftElement); as tpl) {
@@ -6194,7 +6355,8 @@ DOM whenever React would render nothing (`setElementPresent`).
6194
6355
  @if (clearable && value) {
6195
6356
  <button
6196
6357
  type="button"
6197
- (click)="clear.emit($event)"
6358
+ [disabled]="disabled"
6359
+ (click)="handleClear($event)"
6198
6360
  [class]="cm().inputClearButton"
6199
6361
  [attr.aria-label]="clearText()"
6200
6362
  >
@@ -6247,6 +6409,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6247
6409
  onKeyDown?: KeyboardEventHandler
6248
6410
 
6249
6411
  @Output() readonly change = new EventEmitter<Event>()
6412
+ @Output() readonly valueChange = new EventEmitter<string>()
6250
6413
  @Output() readonly clear = new EventEmitter<Event>()
6251
6414
 
6252
6415
  inputEl?: ElementRef<HTMLInputElement>
@@ -6283,6 +6446,10 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6283
6446
  return getClassMap()
6284
6447
  }
6285
6448
 
6449
+ field(): ReturnType<typeof fieldLayout> {
6450
+ return fieldLayout(this.cm())
6451
+ }
6452
+
6286
6453
  inputId(): string {
6287
6454
  return this.id || this.fieldContext()?.id || this.name || this.generatedId
6288
6455
  }
@@ -6336,10 +6503,16 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6336
6503
  event.stopPropagation()
6337
6504
  this.change.emit(event)
6338
6505
  const input = this.inputEl?.nativeElement
6506
+ if (input) this.valueChange.emit(input.value)
6339
6507
  if (this.value !== undefined && input && input.value !== String(this.value))
6340
6508
  input.value = String(this.value)
6341
6509
  }
6342
6510
 
6511
+ handleClear(event: MouseEvent): void {
6512
+ this.clear.emit(event)
6513
+ this.valueChange.emit('')
6514
+ }
6515
+
6343
6516
  handleChange(event: Event): void {
6344
6517
  event.stopPropagation()
6345
6518
  }
@@ -6451,6 +6624,8 @@ button in React; here they land on the host and are moved onto it.
6451
6624
  'display',
6452
6625
  'className',
6453
6626
  'style',
6627
+ 'testId',
6628
+ 'automationId',
6454
6629
  'renderTrigger',
6455
6630
  ],
6456
6631
  template: `@if (asTemplate(renderTrigger); as customTrigger) {
@@ -6462,7 +6637,8 @@ button in React; here they land on the host and are moved onto it.
6462
6637
  <button
6463
6638
  #trigger
6464
6639
  type="button"
6465
- data-mol-id="language-picker-trigger"
6640
+ [attr.data-mol-id]="automationId ?? 'language-picker-trigger'"
6641
+ [attr.data-testid]="testId"
6466
6642
  [attr.aria-label]="ariaLabel()"
6467
6643
  (click)="open()"
6468
6644
  [class]="classes()"
@@ -6515,6 +6691,10 @@ export class LanguagePicker {
6515
6691
  className?: LanguagePickerProps['className']
6516
6692
  /** Inline style object for the trigger button (React camelCase). */
6517
6693
  style?: LanguagePickerProps['style']
6694
+ /** `data-testid` for the trigger button. */
6695
+ testId?: LanguagePickerProps['testId']
6696
+ /** `data-mol-id` for the trigger button (React's `automationId`). */
6697
+ automationId?: LanguagePickerProps['automationId']
6518
6698
  /** Optional trigger replacement (a node value rendered as a template). */
6519
6699
  renderTrigger?: LanguagePickerProps['renderTrigger']
6520
6700
 
@@ -7137,9 +7317,10 @@ paragraph and the retry row render only when React would render them.
7137
7317
  standalone: true,
7138
7318
  hostDirectives: [MolPlacement],
7139
7319
  imports: [Alert, MolTemplateOutlet],
7140
- inputs: ['message', 'detail', 'retryLabel', 'retryMolId', 'onRetry'],
7320
+ inputs: ['message', 'detail', 'retryLabel', 'retryMolId', 'onRetry', 'testId', 'automationId'],
7141
7321
  host: {
7142
7322
  '[class]': 'className',
7323
+ '[attr.data-testid]': 'testId',
7143
7324
  },
7144
7325
  template: `<div mol-alert [status]="'error'" [live]="false">
7145
7326
  <div [class]="cm().stack(2)">
@@ -7173,7 +7354,7 @@ paragraph and the retry row render only when React would render them.
7173
7354
  </div>
7174
7355
  </div>`,
7175
7356
  })
7176
- export class LoadErrorBanner {
7357
+ export class LoadErrorBanner implements AfterViewChecked {
7177
7358
  /** The primary error line (node-valued prop). */
7178
7359
  message?: LoadErrorBannerProps['message']
7179
7360
  /** Secondary line under the message (node-valued prop). */
@@ -7186,6 +7367,10 @@ export class LoadErrorBanner {
7186
7367
  onRetry?: LoadErrorBannerProps['onRetry']
7187
7368
  /** Extra classes for the root (React's rest `className`). */
7188
7369
  className?: LoadErrorBannerProps['className']
7370
+ /** `data-testid` for the root. */
7371
+ testId?: LoadErrorBannerProps['testId']
7372
+ /** `data-mol-id` for the root (React's `automationId`). */
7373
+ automationId?: LoadErrorBannerProps['automationId']
7189
7374
 
7190
7375
  /** Template helpers (templates see only class members). */
7191
7376
  readonly asTemplate = asTemplate
@@ -7211,6 +7396,29 @@ export class LoadErrorBanner {
7211
7396
  */
7212
7397
  private readonly i18n = useTranslation()
7213
7398
 
7399
+ /** The host element, which is React's root `<div>`. */
7400
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
7401
+
7402
+ /** The `data-mol-id` this component last wrote (React's `automationId` wins over a rest `data-mol-id`). */
7403
+ private lastWrittenMolId: string | null = null
7404
+
7405
+ /**
7406
+ * Applies React's `rootProps` precedence on the root: a rest `data-mol-id`
7407
+ * bound on the tag stays, and `automationId` overrides it when given (and
7408
+ * leaves no stale value once cleared).
7409
+ */
7410
+ ngAfterViewChecked(): void {
7411
+ const host = this.host.nativeElement
7412
+ const current = host.getAttribute('data-mol-id')
7413
+ if (this.automationId !== undefined) {
7414
+ if (current !== this.automationId) host.setAttribute('data-mol-id', this.automationId)
7415
+ this.lastWrittenMolId = this.automationId
7416
+ return
7417
+ }
7418
+ if (current !== null && current === this.lastWrittenMolId) host.removeAttribute('data-mol-id')
7419
+ this.lastWrittenMolId = null
7420
+ }
7421
+
7214
7422
  /** Whether the projected retry label exists (a signal the placement function sets). */
7215
7423
  private readonly hasRetryLabel = signal(false)
7216
7424
 
@@ -7341,6 +7549,7 @@ again each time they show. Write content with state as `*molLazy` (`MolLazy` fro
7341
7549
  'centered',
7342
7550
  'closeLabel',
7343
7551
  'preventScroll',
7552
+ 'initialFocus',
7344
7553
  'className',
7345
7554
  'style',
7346
7555
  'testId',
@@ -7407,18 +7616,27 @@ again each time they show. Write content with state as `*molLazy` (`MolLazy` fro
7407
7616
  export class Modal
7408
7617
  implements AfterViewInit, AfterViewChecked, DoCheck, OnDestroy, HasElement<HTMLDivElement>
7409
7618
  {
7619
+ /** Whether the dialog is open. */
7410
7620
  open = false
7621
+ /** The dialog title. */
7411
7622
  title?: string
7623
+ /** Dialog width preset. */
7412
7624
  size: ModalSize = 'md'
7413
7625
  showCloseButton = true
7414
7626
  closeOnOverlayClick = true
7627
+ /** Whether Escape closes the dialog. */
7415
7628
  closeOnEscape = true
7629
+ /** Footer content (node-valued prop). */
7416
7630
  footer?: unknown
7417
7631
  centered = true
7632
+ /** The close button's accessible label. */
7418
7633
  closeLabel?: string
7419
7634
  preventScroll = true
7635
+ initialFocus?: OverlayTarget
7636
+ /** Extra classes for the dialog. */
7420
7637
  className?: string
7421
7638
  style?: Record<string, unknown>
7639
+ /** `data-testid` for the dialog. */
7422
7640
  testId?: string
7423
7641
  automationId?: string
7424
7642
  dataMolId?: string
@@ -7428,15 +7646,18 @@ export class Modal
7428
7646
 
7429
7647
  @ViewChild('overlay') overlay?: ElementRef<HTMLDivElement>
7430
7648
  @ViewChild('wrapper') wrapper?: ElementRef<HTMLDivElement>
7431
- @ViewChild('dialog') dialog?: ElementRef<HTMLDivElement>
7649
+ /** The dialog element. */
7650
+ @ViewChild('dialog', { static: true }) dialog?: ElementRef<HTMLDivElement>
7432
7651
  @ViewChild('footerSlot') footerSlot?: ElementRef<HTMLDivElement>
7433
7652
 
7434
7653
  readonly titleId = `mol-modal-title-${++modalInstance}`
7435
- private readonly stackId = modalInstance
7436
-
7437
7654
  private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
7438
- private readonly injector = inject(Injector)
7655
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
7439
7656
  private readonly environmentInjector = inject(EnvironmentInjector)
7657
+ private readonly layer = new OverlayLayer((focus) => {
7658
+ if (!this.environmentInjector.destroyed)
7659
+ afterNextRender({ read: focus }, { injector: this.environmentInjector })
7660
+ })
7440
7661
  private readonly inner = signal<HTMLDivElement | null>(null)
7441
7662
  readonly element = this.inner.asReadonly()
7442
7663
 
@@ -7446,22 +7667,21 @@ export class Modal
7446
7667
 
7447
7668
  private readonly i18n = useTranslation()
7448
7669
 
7449
- private readonly sync = createScrollLock()
7450
- private lastOpen = false
7670
+ private lastOpen: boolean | undefined
7451
7671
  private lastFooter = false
7452
- private previouslyFocused: HTMLElement | null = null
7453
- private listeners: (() => void)[] = []
7454
- private locked = false
7455
7672
  private externalMolId: string | undefined
7456
7673
 
7674
+ /** The current class map. */
7457
7675
  cm(): UIClassMap {
7458
7676
  return getClassMap()
7459
7677
  }
7460
7678
 
7679
+ /** The dialog class list. */
7461
7680
  dialogClasses(): string {
7462
7681
  return this.cm().cn(this.cm().modal({ size: this.size }), this.className)
7463
7682
  }
7464
7683
 
7684
+ /** Serializes the dialog's inline style. */
7465
7685
  dialogStyle(): string | null {
7466
7686
  return styleText(this.style)
7467
7687
  }
@@ -7474,10 +7694,12 @@ export class Modal
7474
7694
  return styleText(this.centered ? undefined : { alignItems: 'flex-start' })
7475
7695
  }
7476
7696
 
7697
+ /** The close button's accessible label. */
7477
7698
  closeText(): string {
7478
7699
  return this.closeLabel ?? this.i18n.t('ui.modal.close', undefined, { defaultValue: 'Close' })
7479
7700
  }
7480
7701
 
7702
+ /** The close button's X glyph. */
7481
7703
  closeIcon(): ResolvedIcon {
7482
7704
  return resolveIcon('x-mark', this.cm().iconMd)
7483
7705
  }
@@ -7487,7 +7709,7 @@ export class Modal
7487
7709
  event.stopPropagation()
7488
7710
  return
7489
7711
  }
7490
- if (this.closeOnOverlayClick) this.requestClose()
7712
+ this.layer.dismissBackdrop()
7491
7713
  }
7492
7714
 
7493
7715
  requestClose(): void {
@@ -7499,8 +7721,6 @@ export class Modal
7499
7721
  }
7500
7722
 
7501
7723
  ngAfterViewInit(): void {
7502
- const overlay = this.overlay?.nativeElement
7503
- const wrapper = this.wrapper?.nativeElement
7504
7724
  const dialog = this.dialog?.nativeElement
7505
7725
  if (dialog) {
7506
7726
  adoptHostDataMolId(
@@ -7512,26 +7732,11 @@ export class Modal
7512
7732
  () => this.molId(),
7513
7733
  )
7514
7734
  }
7515
- const open = !!this.open
7516
- if (open) {
7517
- this.previouslyFocused = (document.activeElement as HTMLElement | null) ?? null
7518
- pushModalStack(this.stackId)
7519
- if (overlay && wrapper) this.attachPortal()
7520
- this.focusFirstInDialog()
7521
- this.addListeners()
7522
- } else if (overlay && wrapper) {
7523
- this.detachPortal()
7524
- }
7525
- this.syncScrollLock()
7526
- this.lastOpen = open
7735
+ this.syncOpen()
7527
7736
  }
7737
+
7528
7738
  ngDoCheck(): void {
7529
- const open = !!this.open
7530
- if (open !== this.lastOpen) {
7531
- this.lastOpen = open
7532
- this.transition(open)
7533
- }
7534
- this.syncScrollLock()
7739
+ this.syncOpen()
7535
7740
  }
7536
7741
 
7537
7742
  ngAfterViewChecked(): void {
@@ -7546,67 +7751,74 @@ export class Modal
7546
7751
  }
7547
7752
 
7548
7753
  ngOnDestroy(): void {
7549
- this.removeListeners()
7550
- popModalStack(this.stackId)
7551
- const toRestore = this.lastOpen ? this.previouslyFocused : null
7552
- if (toRestore && !this.environmentInjector.destroyed)
7553
- afterNextRender(
7554
- () => {
7555
- if (document.contains(toRestore)) toRestore.focus()
7556
- },
7557
- { injector: this.environmentInjector },
7558
- )
7559
- if (this.locked) {
7560
- this.sync.unlock()
7561
- this.locked = false
7562
- }
7754
+ this.layer.release()
7563
7755
  }
7564
7756
 
7565
7757
  private reconcileFooter(hasContent: SlotReader): void {
7566
7758
  this.lastFooter = hasContent(this.footerSlot?.nativeElement)
7567
7759
  setElementPresent(this.footerSlot?.nativeElement, this.lastFooter)
7568
7760
  setElementPresent(this.host.nativeElement, false)
7569
- setHostRoot(this.host.nativeElement, this.dialog?.nativeElement, { except: ['data-mol-id'] })
7761
+ setHostRoot(this.host.nativeElement, this.wrapper ? this.dialog?.nativeElement : null, {
7762
+ except: ['data-mol-id'],
7763
+ })
7570
7764
  }
7571
7765
 
7572
- private transition(open: boolean): void {
7573
- if (open) {
7574
- this.previouslyFocused = (document.activeElement as HTMLElement | null) ?? null
7575
- pushModalStack(this.stackId)
7576
- this.attachPortal()
7577
- this.focusFirstInDialog()
7578
- this.addListeners()
7766
+ private syncOpen(): void {
7767
+ const dialog = this.dialog?.nativeElement
7768
+ if (!dialog) return
7769
+ const open = !!this.open
7770
+ if (open && this.browser) this.syncLayer(dialog)
7771
+ if (!this.wrapper) return
7772
+
7773
+ if (open !== this.lastOpen) {
7774
+ this.lastOpen = open
7775
+ if (open) this.attachPortal()
7776
+ else {
7777
+ this.layer.release()
7778
+ this.detachPortal()
7779
+ }
7780
+ }
7781
+ }
7782
+
7783
+ private syncLayer(dialog: HTMLDivElement): void {
7784
+ this.layer.sync({
7785
+ open: true,
7786
+ kind: 'modal',
7787
+ surface: { current: dialog },
7788
+ dismissKey: this.closeOnEscape,
7789
+ dismissBackdrop: this.closeOnOverlayClick,
7790
+ focus: { trap: true, initial: this.initialFocus, restore: 'opener' },
7791
+ lockScroll: this.preventScroll,
7792
+ onDismiss: () => this.requestClose(),
7793
+ })
7794
+ }
7795
+
7796
+ private attachPortal(): void {
7797
+ const overlay = this.overlay?.nativeElement
7798
+ const wrapper = this.wrapper?.nativeElement
7799
+ if (!overlay || !wrapper) return
7800
+ if (this.browser) {
7801
+ const { body } = wrapper.ownerDocument
7802
+ placeElement(overlay, body)
7803
+ placeElement(wrapper, body)
7579
7804
  } else {
7580
- popModalStack(this.stackId)
7581
- this.removeListeners()
7582
- this.detachPortal()
7583
- const toRestore = this.previouslyFocused
7584
- if (toRestore)
7585
- afterNextRender(
7586
- () => {
7587
- if (document.contains(toRestore)) toRestore.focus()
7588
- },
7589
- { injector: this.injector },
7590
- )
7805
+ placeElementBefore(overlay, this.host.nativeElement)
7806
+ placeElementBefore(wrapper, this.host.nativeElement)
7591
7807
  }
7592
- this.syncScrollLock()
7808
+ this.inner.set(this.dialog?.nativeElement ?? null)
7593
7809
  }
7594
7810
 
7595
- private focusFirstInDialog(): void {
7596
- afterNextRender(
7597
- () => {
7598
- const dialog = this.dialog?.nativeElement
7599
- if (!dialog) return
7600
- const focusables = getFocusableElements(dialog)
7601
- ;(focusables[0] ?? dialog).focus()
7602
- },
7603
- { injector: this.injector },
7604
- )
7811
+ private detachPortal(): void {
7812
+ placeElement(this.overlay?.nativeElement, null)
7813
+ setElementPresent(this.overlay?.nativeElement, false)
7814
+ placeElement(this.wrapper?.nativeElement, null)
7815
+ setElementPresent(this.wrapper?.nativeElement, false)
7816
+ this.inner.set(null)
7605
7817
  }
7606
- // … truncated — 6 more members: attachPortal, detachPortal, syncScrollLock, addListeners, removeListeners, handleKeyDown; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/modal.component.d.ts
7818
+ }
7607
7819
  ```
7608
7820
 
7609
- _(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/modal.component.d.ts`.)_
7821
+ _(Member comments are shortened to their first sentence, and the 37 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/modal.component.d.ts`.)_
7610
7822
 
7611
7823
  #### `MoleculeAlert`
7612
7824
 
@@ -8006,13 +8218,13 @@ Angular Input UI component with UIClassMap-driven styling.
8006
8218
  standalone: true,
8007
8219
  changeDetection: ChangeDetectionStrategy.OnPush,
8008
8220
  template: `
8009
- <div [class]="cm.inputWrapper">
8221
+ <div [class]="field.root">
8010
8222
  @if (label) {
8011
8223
  <label [attr.for]="inputId" [class]="labelClasses">
8012
8224
  {{ label }}
8013
8225
  </label>
8014
8226
  }
8015
- <div [class]="cm.inputInner">
8227
+ <div [class]="field.inner">
8016
8228
  <input
8017
8229
  [type]="type"
8018
8230
  [id]="inputId"
@@ -8110,6 +8322,15 @@ export class MoleculeInput {
8110
8322
  return getClassMap()
8111
8323
  }
8112
8324
 
8325
+ /**
8326
+ * The classes of the field's two wrappers, from the shared field layout: `root` for the
8327
+ * outer wrapper, `inner` for the row that holds the control.
8328
+ * @returns The outer wrapper's classes and the control row's classes.
8329
+ */
8330
+ get field(): ReturnType<typeof fieldLayout> {
8331
+ return fieldLayout(this.cm)
8332
+ }
8333
+
8113
8334
  /**
8114
8335
  * Computes the accessible clear button label.
8115
8336
  * @returns The localized aria-label for the clear button.
@@ -8574,13 +8795,13 @@ Angular Select UI component with UIClassMap-driven styling.
8574
8795
  standalone: true,
8575
8796
  changeDetection: ChangeDetectionStrategy.OnPush,
8576
8797
  template: `
8577
- <div [class]="cm.inputWrapper">
8798
+ <div [class]="field.root">
8578
8799
  @if (label) {
8579
8800
  <label [attr.for]="selectId" [class]="labelClasses">
8580
8801
  {{ label }}
8581
8802
  </label>
8582
8803
  }
8583
- <div [class]="cm.inputInner">
8804
+ <div [class]="field.inner">
8584
8805
  <select
8585
8806
  [id]="selectId"
8586
8807
  [name]="name"
@@ -8650,6 +8871,15 @@ export class MoleculeSelect {
8650
8871
  return getClassMap()
8651
8872
  }
8652
8873
 
8874
+ /**
8875
+ * The classes of the field's two wrappers, from the shared field layout: `root` for the
8876
+ * outer wrapper, `inner` for the row that holds the control.
8877
+ * @returns The outer wrapper's classes and the control row's classes.
8878
+ */
8879
+ get field(): ReturnType<typeof fieldLayout> {
8880
+ return fieldLayout(this.cm)
8881
+ }
8882
+
8653
8883
  /**
8654
8884
  * Retrieves the CSS class for form error messages.
8655
8885
  * @returns The form error class name string.
@@ -9527,6 +9757,7 @@ from the DOM — the projected nodes need an always-mounted capture point.
9527
9757
  selector: 'div[mol-page-header]',
9528
9758
  standalone: true,
9529
9759
  hostDirectives: [MolPlacement],
9760
+ imports: [Link],
9530
9761
  inputs: ['title', 'description', 'breadcrumbs', 'className', 'style', 'testId', 'automationId'],
9531
9762
  host: {
9532
9763
  // `title` is this component's heading, which React renders as text; Angular would also keep a
@@ -9544,7 +9775,7 @@ from the DOM — the projected nodes need an always-mounted capture point.
9544
9775
  <span [class]="cm().pageHeaderBreadcrumbSeparator" aria-hidden="true">/</span>
9545
9776
  }
9546
9777
  @if (crumb.href) {
9547
- <a [href]="crumb.href" [class]="cm().pageHeaderBreadcrumbItem">{{ crumb.label }}</a>
9778
+ <a [molLink]="crumb.href" [class]="cm().pageHeaderBreadcrumbItem">{{ crumb.label }}</a>
9548
9779
  } @else {
9549
9780
  <span [class]="cm().pageHeaderBreadcrumbItem">{{ crumb.label }}</span>
9550
9781
  }
@@ -10375,6 +10606,7 @@ leaves the page and the portal renders in `document.body`.
10375
10606
  template: `<mol-modal
10376
10607
  #modal
10377
10608
  [open]="open"
10609
+ [initialFocus]="inputTarget"
10378
10610
  (close)="onModalClose()"
10379
10611
  [attr.aria-labelledby]="ariaLabelledBy()"
10380
10612
  [attr.aria-describedby]="rendersNode(description) ? descriptionId : null"
@@ -10447,7 +10679,7 @@ leaves the page and the portal renders in `document.body`.
10447
10679
  </form></mol-modal
10448
10680
  >`,
10449
10681
  })
10450
- export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10682
+ export class PromptDialog implements AfterViewInit, DoCheck {
10451
10683
  /** Whether the dialog is open. */
10452
10684
  open: PromptDialogProps['open'] = false
10453
10685
  /** Dialog heading (node-valued prop). */
@@ -10456,8 +10688,11 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10456
10688
  /** Input placeholder. */
10457
10689
  placeholder?: PromptDialogProps['placeholder']
10458
10690
  initialValue?: PromptDialogProps['initialValue'] = ''
10691
+ /** Called with the entered value on confirm. */
10459
10692
  onSubmit?: PromptDialogProps['onSubmit']
10693
+ /** Confirm-button label (node-valued prop). */
10460
10694
  confirmLabel?: PromptDialogProps['confirmLabel']
10695
+ /** Cancel-button label (node-valued prop). */
10461
10696
  cancelLabel?: PromptDialogProps['cancelLabel']
10462
10697
  destructive?: PromptDialogProps['destructive'] = false
10463
10698
  /** `data-mol-id` for the text input. */
@@ -10468,9 +10703,11 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10468
10703
  cancelMolId?: PromptDialogProps['cancelMolId']
10469
10704
 
10470
10705
  readonly asTemplate = asTemplate
10706
+ /** Renders a plain-string/number node value. */
10471
10707
  readonly nodeText = nodeText
10472
10708
  /** Whether a node-valued prop was given. */
10473
10709
  readonly isGiven = isGiven
10710
+ /** Whether a node-valued prop renders anything. */
10474
10711
  readonly rendersNode = rendersNode
10475
10712
 
10476
10713
  @Output() readonly close = new EventEmitter<unknown>()
@@ -10496,8 +10733,8 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10496
10733
 
10497
10734
  private lastOpen = false
10498
10735
  private lastInitial = ''
10499
- private pendingInputFocus = false
10500
- private readonly injector = inject(Injector)
10736
+
10737
+ readonly inputTarget = elementTarget(() => this.inputComponent?.inputEl?.nativeElement)
10501
10738
 
10502
10739
  constructor() {
10503
10740
  usePlacement((hasContent) => {
@@ -10550,16 +10787,9 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10550
10787
  if (this.open) {
10551
10788
  this.value.set(this.initialValue ?? '')
10552
10789
  this.pending.set(false)
10553
- this.pendingInputFocus = true
10554
10790
  }
10555
10791
  }
10556
10792
 
10557
- ngAfterViewChecked(): void {
10558
- if (!this.pendingInputFocus) return
10559
- this.pendingInputFocus = false
10560
- afterNextRender(() => this.focusInput(), { injector: this.injector })
10561
- }
10562
-
10563
10793
  ngDoCheck(): void {
10564
10794
  const open = !!this.open
10565
10795
  if (open !== this.lastOpen || (open && this.initialValue !== this.lastInitial)) {
@@ -10568,15 +10798,10 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10568
10798
  if (open) {
10569
10799
  this.value.set(this.initialValue ?? '')
10570
10800
  this.pending.set(false)
10571
- this.pendingInputFocus = true
10572
10801
  }
10573
10802
  }
10574
10803
  }
10575
10804
 
10576
- focusInput(): void {
10577
- this.inputComponent?.inputEl?.nativeElement.focus()
10578
- }
10579
-
10580
10805
  private applyInputLabel(hasContent: SlotReader): void {
10581
10806
  const input = this.inputComponent?.inputEl?.nativeElement
10582
10807
  if (!input) return
@@ -10598,19 +10823,20 @@ export class PromptDialog implements AfterViewInit, AfterViewChecked, DoCheck {
10598
10823
  event.preventDefault()
10599
10824
  if (this.pending()) return
10600
10825
  this.pending.set(true)
10601
- void Promise.resolve(this.onSubmit?.(this.value()))
10602
- .then(() => {
10826
+ void (async (): Promise<void> => {
10827
+ try {
10828
+ await this.onSubmit?.(this.value())
10603
10829
  this.pending.set(false)
10604
10830
  this.close.emit()
10605
- })
10606
- .catch((_error: unknown) => {
10831
+ } catch (_error: unknown) {
10607
10832
  this.pending.set(false)
10608
- })
10833
+ }
10834
+ })()
10609
10835
  }
10610
10836
  }
10611
10837
  ```
10612
10838
 
10613
- _(Member comments are shortened to their first sentence, and the 35 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/prompt-dialog.component.d.ts`.)_
10839
+ _(Member comments are shortened to their first sentence, and the 25 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/prompt-dialog.component.d.ts`.)_
10614
10840
 
10615
10841
  #### `RadioGroup`
10616
10842
 
@@ -11348,16 +11574,21 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11348
11574
  navLabel?: ResponsiveAppShellDrawerProps['navLabel']
11349
11575
  footer?: ResponsiveAppShellDrawerProps['footer']
11350
11576
  showCloseButton?: ResponsiveAppShellDrawerProps['showCloseButton'] = true
11577
+ /** Extra classes on the dialog panel. */
11351
11578
  className?: ResponsiveAppShellDrawerProps['className']
11352
11579
  dataMolId?: ResponsiveAppShellDrawerProps['dataMolId'] = 'shell-drawer'
11353
11580
  closeDataMolId?: ResponsiveAppShellDrawerProps['closeDataMolId'] = 'shell-drawer-close'
11581
+ /** `data-testid` for the panel. */
11354
11582
  testId?: ResponsiveAppShellDrawerProps['testId']
11355
11583
 
11356
11584
  readonly asTemplate = asTemplate
11357
11585
  readonly nodeText = nodeText
11358
11586
 
11587
+ /** The backdrop element. */
11359
11588
  @ViewChild('overlay') overlay?: ElementRef<HTMLDivElement>
11589
+ /** The fixed wrapper. */
11360
11590
  @ViewChild('wrapper') wrapper?: ElementRef<HTMLDivElement>
11591
+ /** The dialog panel. */
11361
11592
  @ViewChild('panel') panel?: ElementRef<HTMLDivElement>
11362
11593
  @ViewChild('headerRow') headerRow?: ElementRef<HTMLDivElement>
11363
11594
  @ViewChild('headerSlot') headerSlot?: ElementRef<HTMLDivElement>
@@ -11369,14 +11600,14 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11369
11600
 
11370
11601
  private readonly i18n = useTranslation()
11371
11602
 
11372
- private readonly injector = inject(Injector)
11603
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
11373
11604
  private readonly environmentInjector = inject(EnvironmentInjector)
11374
- private readonly scrollLock = createScrollLock()
11605
+ private readonly layer = new OverlayLayer((focus) => {
11606
+ if (!this.environmentInjector.destroyed)
11607
+ afterNextRender({ read: focus }, { injector: this.environmentInjector })
11608
+ })
11375
11609
  private hasFooter = false
11376
- private locked = false
11377
- private lastOpen = false
11378
- private previouslyFocused: HTMLElement | null = null
11379
- private listeners: (() => void)[] = []
11610
+ private lastOpen: boolean | undefined
11380
11611
 
11381
11612
  constructor() {
11382
11613
  usePlacement((hasContent) => {
@@ -11386,6 +11617,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11386
11617
  })
11387
11618
  }
11388
11619
 
11620
+ /** The nearest shell context. */
11389
11621
  shell(): ShellContextValue {
11390
11622
  return this.readContext() ?? contextOrDefault(null)
11391
11623
  }
@@ -11394,10 +11626,12 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11394
11626
  return ShellDomContext.find(this.host.nativeElement) ?? null
11395
11627
  }
11396
11628
 
11629
+ /** The current class map. */
11397
11630
  cm(): UIClassMap {
11398
11631
  return getClassMap()
11399
11632
  }
11400
11633
 
11634
+ /** The panel class list. */
11401
11635
  panelClasses(): string {
11402
11636
  return this.cm().cn(this.cm().flex({ direction: 'col' }), this.cm().surface, this.className)
11403
11637
  }
@@ -11414,6 +11648,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11414
11648
  return styleText({ zIndex: 41 })
11415
11649
  }
11416
11650
 
11651
+ /** The close button's class list. */
11417
11652
  closeClasses(): string {
11418
11653
  return this.cm().cn(
11419
11654
  this.cm().flex({ align: 'center', justify: 'center' }),
@@ -11426,6 +11661,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11426
11661
  )
11427
11662
  }
11428
11663
 
11664
+ /** The nav/dialog accessible label. */
11429
11665
  navLabelText(): string {
11430
11666
  return (
11431
11667
  this.navLabel ??
@@ -11433,10 +11669,12 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11433
11669
  )
11434
11670
  }
11435
11671
 
11672
+ /** The close button's accessible label. */
11436
11673
  closeLabel(): string {
11437
11674
  return this.i18n.t('appShell.closeMenu', {}, { defaultValue: 'Close navigation menu' })
11438
11675
  }
11439
11676
 
11677
+ /** The close glyph. */
11440
11678
  closeIcon(): ResolvedIcon {
11441
11679
  return resolveIcon('x-mark', this.cm().iconMd)
11442
11680
  }
@@ -11446,7 +11684,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11446
11684
  event.stopPropagation()
11447
11685
  return
11448
11686
  }
11449
- this.shell().closeDrawer()
11687
+ this.layer.dismissBackdrop()
11450
11688
  }
11451
11689
 
11452
11690
  ngOnInit(): void {
@@ -11455,10 +11693,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11455
11693
 
11456
11694
  ngAfterViewInit(): void {
11457
11695
  this.shell().registerDrawer(true)
11458
- const open = this.shell().drawerOpen && !this.shell().isDesktop
11459
- this.lastOpen = open
11460
- if (open) this.openPanel()
11461
- else this.detachPortal()
11696
+ this.syncOpen()
11462
11697
  }
11463
11698
 
11464
11699
  ngDoCheck(): void {
@@ -11467,19 +11702,7 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11467
11702
 
11468
11703
  ngOnDestroy(): void {
11469
11704
  this.shell().registerDrawer(false)
11470
- this.removeListeners()
11471
- const toRestore = this.lastOpen ? this.previouslyFocused : null
11472
- if (toRestore && !this.environmentInjector.destroyed)
11473
- afterNextRender(
11474
- () => {
11475
- if (document.contains(toRestore)) toRestore.focus()
11476
- },
11477
- { injector: this.environmentInjector },
11478
- )
11479
- if (this.locked) {
11480
- this.scrollLock.unlock()
11481
- this.locked = false
11482
- }
11705
+ this.layer.release()
11483
11706
  }
11484
11707
 
11485
11708
  private syncWrappers(hasContent: SlotReader): void {
@@ -11495,32 +11718,39 @@ export class ResponsiveAppShellDrawer implements OnInit, AfterViewInit, DoCheck,
11495
11718
  }
11496
11719
 
11497
11720
  private syncOpen(): void {
11498
- const open = this.shell().drawerOpen && !this.shell().isDesktop
11499
- if (open === this.lastOpen) return
11721
+ const shell = this.shell()
11722
+ const open = this.browser && shell.drawerOpen && !shell.isDesktop
11723
+ const panel = this.panel?.nativeElement
11724
+ const overlay = this.overlay?.nativeElement
11725
+ const wrapper = this.wrapper?.nativeElement
11726
+ if (!panel || !overlay || !wrapper || open === this.lastOpen) return
11500
11727
  this.lastOpen = open
11501
11728
  if (open) {
11502
- this.openPanel()
11729
+ const { body } = panel.ownerDocument
11730
+ placeElement(overlay, body)
11731
+ placeElement(wrapper, body)
11732
+ this.layer.sync({
11733
+ open: true,
11734
+ kind: 'modal',
11735
+ surface: { current: panel },
11736
+ dismissKey: true,
11737
+ dismissBackdrop: true,
11738
+ focus: { trap: true, restore: 'opener' },
11739
+ lockScroll: true,
11740
+ onDismiss: () => shell.closeDrawer(),
11741
+ })
11503
11742
  } else {
11504
- this.removeListeners()
11505
- this.detachPortal()
11506
- if (this.locked) {
11507
- this.scrollLock.unlock()
11508
- this.locked = false
11509
- }
11510
- const toRestore = this.previouslyFocused
11511
- if (toRestore)
11512
- afterNextRender(
11513
- () => {
11514
- if (document.contains(toRestore)) toRestore.focus()
11515
- },
11516
- { injector: this.injector },
11517
- )
11743
+ this.layer.release()
11744
+ placeElement(overlay, null)
11745
+ setElementPresent(overlay, false)
11746
+ placeElement(wrapper, null)
11747
+ setElementPresent(wrapper, false)
11518
11748
  }
11519
11749
  }
11520
- // … truncated — 6 more members: openPanel, attachPortal, detachPortal, addListeners, removeListeners, handleKeyDown; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/responsive-app-shell.component.d.ts
11750
+ }
11521
11751
  ```
11522
11752
 
11523
- _(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/responsive-app-shell.component.d.ts`.)_
11753
+ _(Member comments are shortened to their first sentence, and the 34 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/responsive-app-shell.component.d.ts`.)_
11524
11754
 
11525
11755
  #### `ResponsiveAppShellContent`
11526
11756
 
@@ -11579,7 +11809,8 @@ export class ResponsiveAppShellContent {
11579
11809
 
11580
11810
  Select component.
11581
11811
 
11582
- The host is the `div.inputWrapper` React renders. React's select value is
11812
+ The host is the field's outer wrapper React renders (the shared field layout's
11813
+ `root`, a flex column). React's select value is
11583
11814
  written through the value PROPERTY (a `select` has no value attribute);
11584
11815
  a controlled `value` is restored after a change exactly like React's
11585
11816
  controlled-input state restore.
@@ -11613,7 +11844,7 @@ controlled-input state restore.
11613
11844
  'onKeyDown',
11614
11845
  ],
11615
11846
  host: {
11616
- '[class]': 'cm().inputWrapper',
11847
+ '[class]': 'field().root',
11617
11848
  },
11618
11849
  template: `@if (label) {
11619
11850
  <label
@@ -11622,7 +11853,7 @@ controlled-input state restore.
11622
11853
  >{{ label }}</label
11623
11854
  >
11624
11855
  }
11625
- <div [class]="cm().inputInner">
11856
+ <div [class]="field().inner">
11626
11857
  <select
11627
11858
  [attr.id]="selectId()"
11628
11859
  [attr.name]="name"
@@ -11692,7 +11923,6 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11692
11923
  hint?: string
11693
11924
  clearable?: boolean
11694
11925
  className?: string
11695
- /** Inline style object (React camelCase). */
11696
11926
  style?: Record<string, unknown>
11697
11927
  /** `data-testid` for the select. */
11698
11928
  testId?: string
@@ -11739,6 +11969,10 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11739
11969
  return getClassMap()
11740
11970
  }
11741
11971
 
11972
+ field(): ReturnType<typeof fieldLayout> {
11973
+ return fieldLayout(this.cm())
11974
+ }
11975
+
11742
11976
  selectId(): string {
11743
11977
  return this.id || this.fieldContext()?.id || this.name || this.generatedId
11744
11978
  }
@@ -11857,7 +12091,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11857
12091
  }
11858
12092
  ```
11859
12093
 
11860
- _(Member comments are shortened to their first sentence, and the 36 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/select.component.d.ts`.)_
12094
+ _(Member comments are shortened to their first sentence, and the 38 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/select.component.d.ts`.)_
11861
12095
 
11862
12096
  #### `Separator`
11863
12097
 
@@ -11972,6 +12206,7 @@ matching props override it.
11972
12206
  'ariaLabelDefault',
11973
12207
  'dataMolId',
11974
12208
  'className',
12209
+ 'testId',
11975
12210
  ],
11976
12211
  template: `<button
11977
12212
  #trigger
@@ -11979,6 +12214,7 @@ matching props override it.
11979
12214
  (click)="isOpen.set(true)"
11980
12215
  [attr.aria-label]="ariaLabel()"
11981
12216
  [attr.data-mol-id]="dataMolId"
12217
+ [attr.data-testid]="testId"
11982
12218
  [class]="triggerClasses()"
11983
12219
  >
11984
12220
  @if (displayAvatar(); as avatar) {
@@ -12018,6 +12254,8 @@ export class SidebarUserCard {
12018
12254
  dataMolId?: SidebarUserCardProps['dataMolId'] = 'sidebar-user-card'
12019
12255
  /** Extra classes for the trigger. */
12020
12256
  className?: SidebarUserCardProps['className']
12257
+ /** `data-testid` for the trigger. */
12258
+ testId?: SidebarUserCardProps['testId']
12021
12259
 
12022
12260
  /** Whether the drawer is open. */
12023
12261
  readonly isOpen = signal(false)
@@ -12620,6 +12858,8 @@ export class Switch implements AfterViewChecked, HasElement<HTMLButtonElement> {
12620
12858
 
12621
12859
  /** The genuine native `change` event of the hidden checkbox. */
12622
12860
  @Output() readonly change = new EventEmitter<Event>()
12861
+ /** Fires with the new checked state. */
12862
+ @Output() readonly checkedChange = new EventEmitter<boolean>()
12623
12863
 
12624
12864
  /** The hidden native checkbox. */
12625
12865
  @ViewChild('hiddenInput') hiddenInput?: ElementRef<HTMLInputElement>
@@ -12735,8 +12975,10 @@ export class Switch implements AfterViewChecked, HasElement<HTMLButtonElement> {
12735
12975
  */
12736
12976
  handleChange(event: Event): void {
12737
12977
  event.stopPropagation()
12738
- this.change.emit(event)
12739
12978
  const input = this.hiddenInput?.nativeElement
12979
+ const next = input?.checked
12980
+ this.change.emit(event)
12981
+ if (next !== undefined) this.checkedChange.emit(next)
12740
12982
  if (input) input.checked = !!this.checked
12741
12983
  }
12742
12984
 
@@ -13295,7 +13537,8 @@ _(Member comments are shortened to their first sentence, and the 4 longest are l
13295
13537
 
13296
13538
  Textarea component.
13297
13539
 
13298
- The host is the `div.inputWrapper` React renders. React's textarea
13540
+ The host is the field's outer wrapper React renders (the shared field layout's
13541
+ `root`, a flex column). React's textarea
13299
13542
  `onChange` fires on `input` events; a controlled `value` is restored after
13300
13543
  user input exactly like React's controlled-input state restore.
13301
13544
  `autoResize` recomputes the inline height after every check and on real
@@ -13331,7 +13574,7 @@ user input exactly like React's controlled-input state restore.
13331
13574
  'onKeyDown',
13332
13575
  ],
13333
13576
  host: {
13334
- '[class]': 'cm().inputWrapper',
13577
+ '[class]': 'field().root',
13335
13578
  },
13336
13579
  template: `@if (label) {
13337
13580
  <label
@@ -13414,10 +13657,11 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13414
13657
 
13415
13658
  /** Fires the raw `input` event (React's textarea onChange). */
13416
13659
  @Output() readonly change = new EventEmitter<Event>()
13660
+ /** Fires with the edited text. */
13661
+ @Output() readonly valueChange = new EventEmitter<string>()
13417
13662
 
13418
13663
  /** The native textarea (React's `...rest` spread target). */
13419
13664
  private textareaEl?: ElementRef<HTMLTextAreaElement>
13420
- /** The native textarea view query; also feeds the caller's ref element. */
13421
13665
  @ViewChild('textareaEl')
13422
13666
  set textareaElQuery(ref: ElementRef<HTMLTextAreaElement> | undefined) {
13423
13667
  this.textareaEl = ref
@@ -13435,7 +13679,6 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13435
13679
  /** Reactive translation, read in the injection context. */
13436
13680
  private readonly i18n = useTranslation()
13437
13681
 
13438
- /** The `aria-describedby` the caller spread onto the host (React's rest). */
13439
13682
  private restDescribedBy: string | null = null
13440
13683
  /** Whether the rest-describedby value was captured. */
13441
13684
  private restDescribedByCaptured = false
@@ -13446,6 +13689,10 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13446
13689
  return getClassMap()
13447
13690
  }
13448
13691
 
13692
+ field(): ReturnType<typeof fieldLayout> {
13693
+ return fieldLayout(this.cm())
13694
+ }
13695
+
13449
13696
  textareaId(): string {
13450
13697
  return this.id || this.fieldContext()?.id || this.name || this.generatedId
13451
13698
  }
@@ -13475,11 +13722,20 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13475
13722
  )
13476
13723
  }
13477
13724
 
13725
+ /** Serializes the inline style for the textarea. */
13478
13726
  hostStyle(): string | null {
13479
- return styleText(this.autoResize ? { minHeight: 0, resize: 'none', ...this.style } : this.style)
13727
+ return styleText(
13728
+ this.autoResize
13729
+ ? {
13730
+ resize: 'none',
13731
+ ...this.style,
13732
+ minHeight: `${Math.min(this.minRows ?? 3, this.maxRows ?? Infinity)}lh`,
13733
+ ...(this.maxRows === undefined ? {} : { maxHeight: `${this.maxRows}lh` }),
13734
+ }
13735
+ : this.style,
13736
+ )
13480
13737
  }
13481
13738
 
13482
- /** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
13483
13739
  molId(): string | undefined {
13484
13740
  return this.automationId ?? this.dataMolId ?? this.externalMolId
13485
13741
  }
@@ -13488,6 +13744,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13488
13744
  event.stopPropagation()
13489
13745
  this.change.emit(event)
13490
13746
  const textarea = this.textareaEl?.nativeElement
13747
+ if (textarea) this.valueChange.emit(textarea.value)
13491
13748
  if (this.value !== undefined && textarea && textarea.value !== this.value)
13492
13749
  textarea.value = this.value
13493
13750
  this.resize()
@@ -13497,15 +13754,12 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13497
13754
  event.stopPropagation()
13498
13755
  }
13499
13756
 
13757
+ /** Sizes the box to its content. */
13500
13758
  resize(): void {
13501
13759
  const element = this.textareaEl?.nativeElement
13502
13760
  if (!this.autoResize || !element) return
13503
13761
  element.style.height = 'auto'
13504
- const lineHeight = parseInt(window.getComputedStyle(element).lineHeight) || 20
13505
- const minHeight = (this.minRows ?? 3) * lineHeight
13506
- const maxHeight = this.maxRows ? this.maxRows * lineHeight : Infinity
13507
- const newHeight = Math.min(Math.max(element.scrollHeight, minHeight), maxHeight)
13508
- element.style.height = `${newHeight}px`
13762
+ element.style.height = `${element.scrollHeight}px`
13509
13763
  }
13510
13764
 
13511
13765
  ngAfterViewInit(): void {
@@ -13527,7 +13781,6 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13527
13781
  }
13528
13782
 
13529
13783
  ngAfterViewChecked(): void {
13530
- // Registering this view against the locale: a switch marks it for check,
13531
13784
  // so this hook runs and the reapply below moves the caller's re-bound
13532
13785
  // rest attribute onto the textarea. Without the read, zoneless change
13533
13786
  // detection never re-checks this view — the parent's re-bound
@@ -13559,7 +13812,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13559
13812
  }
13560
13813
  ```
13561
13814
 
13562
- _(Member comments are shortened to their first sentence, and the 15 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/textarea.component.d.ts`.)_
13815
+ _(Member comments are shortened to their first sentence, and the 18 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/textarea.component.d.ts`.)_
13563
13816
 
13564
13817
  #### `ThemeToggle`
13565
13818
 
@@ -13578,10 +13831,20 @@ directly, so the browser suppresses the click exactly as React does.
13578
13831
  selector: 'button[mol-theme-toggle]',
13579
13832
  standalone: true,
13580
13833
  imports: [Icon],
13581
- inputs: ['ariaLabelKey', 'ariaLabelDefault', 'darkIcon', 'lightIcon', 'iconSize', 'className'],
13834
+ inputs: [
13835
+ 'ariaLabelKey',
13836
+ 'ariaLabelDefault',
13837
+ 'darkIcon',
13838
+ 'lightIcon',
13839
+ 'iconSize',
13840
+ 'className',
13841
+ 'testId',
13842
+ 'automationId',
13843
+ ],
13582
13844
  host: {
13583
13845
  type: 'button',
13584
- 'data-mol-id': 'theme-toggle',
13846
+ '[attr.data-mol-id]': 'molId()',
13847
+ '[attr.data-testid]': 'testId',
13585
13848
  '[attr.data-mode]': 'mode()',
13586
13849
  '[attr.aria-pressed]': 'mode() === "dark" ? "true" : "false"',
13587
13850
  '[attr.aria-label]': 'labelText()',
@@ -13607,6 +13870,10 @@ export class ThemeToggle {
13607
13870
  iconSize?: ThemeToggleProps['iconSize']
13608
13871
  /** Extra classes joined onto the toggle classes. */
13609
13872
  className?: ThemeToggleProps['className']
13873
+ /** `data-testid` for the button. */
13874
+ testId?: ThemeToggleProps['testId']
13875
+ /** `data-mol-id` automation id (React's `automationId`). */
13876
+ automationId?: ThemeToggleProps['automationId']
13610
13877
 
13611
13878
  /** Theme state and actions, read in the component's injection context. */
13612
13879
  readonly theme = useTheme()
@@ -13649,6 +13916,14 @@ export class ThemeToggle {
13649
13916
  return cm.cn(cm.themeToggleButton, this.className)
13650
13917
  }
13651
13918
 
13919
+ /**
13920
+ * The `data-mol-id` value (`automationId` wins over the default).
13921
+ * @returns The automation id.
13922
+ */
13923
+ molId(): string {
13924
+ return this.automationId ?? 'theme-toggle'
13925
+ }
13926
+
13652
13927
  /**
13653
13928
  * The rendered icon pixel size.
13654
13929
  * @returns The size (default 20 when a later-bound write left it unset).
@@ -13688,6 +13963,8 @@ with the remaining time; the announced role follows `status`
13688
13963
  'automationId',
13689
13964
  'dataMolId: data-mol-id',
13690
13965
  'id',
13966
+ 'roleOverride: role',
13967
+ 'live: aria-live',
13691
13968
  ],
13692
13969
  outputs: ['dismiss'],
13693
13970
  host: {
@@ -13699,11 +13976,12 @@ with the remaining time; the announced role follows `status`
13699
13976
  '[attr.data-mol-id]': 'molId()',
13700
13977
  '[attr.id]': 'id',
13701
13978
  '[attr.role]': 'role()',
13979
+ '[attr.aria-live]': 'live',
13702
13980
  '[attr.data-state]': 'visible() ? "open" : null',
13703
- '(mouseenter)': 'pauseTimer()',
13704
- '(mouseleave)': 'resumeTimer()',
13705
- '(focusin)': 'pauseTimer()',
13706
- '(focusout)': 'resumeTimer()',
13981
+ '(mouseenter)': 'setHovered(true)',
13982
+ '(mouseleave)': 'setHovered(false)',
13983
+ '(focusin)': 'setFocused(true)',
13984
+ '(focusout)': 'leaveFocus($event)',
13707
13985
  },
13708
13986
  template: `@if (statusIcon(); as icon) {
13709
13987
  <span [class]="cm().toastIconWrapper"><svg mol-icon [data]="icon" /></span>
@@ -13734,6 +14012,7 @@ with the remaining time; the announced role follows `status`
13734
14012
  export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTMLDivElement> {
13735
14013
  /** The toast title. */
13736
14014
  title?: string
14015
+ /** The toast description (a string or a node value rendered as a template). */
13737
14016
  description?: unknown
13738
14017
  /** The toast status. */
13739
14018
  status: ColorVariant = 'info'
@@ -13755,9 +14034,15 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13755
14034
  automationId?: string
13756
14035
  dataMolId?: string
13757
14036
  id?: string
14037
+ /** Overrides the status-derived role. */
14038
+ roleOverride?: ToastProps['role']
14039
+ /** Overrides the live-region priority, including `off`. */
14040
+ live?: ToastProps['aria-live']
13758
14041
 
14042
+ /** Fires when the toast dismisses itself or its close button is pressed. */
13759
14043
  @Output() readonly dismiss = new EventEmitter<void>()
13760
14044
 
14045
+ /** The description wrapper (always in the template; detached when empty). */
13761
14046
  @ViewChild('descriptionSlot') descriptionSlot?: ElementRef<HTMLDivElement>
13762
14047
  /** The children capture point. */
13763
14048
  @ViewChild('childrenSlot') childrenSlot?: ElementRef<HTMLSpanElement>
@@ -13774,9 +14059,10 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13774
14059
  private readonly i18n = useTranslation()
13775
14060
 
13776
14061
  private readonly host: HTMLElement = this.el.nativeElement
13777
- private remaining: number
13778
- private startedAt: number | null = null
13779
- private timer: ReturnType<typeof setTimeout> | undefined
14062
+ private readonly countdown = new ToastCountdown(() => {
14063
+ this.visible.set(false)
14064
+ this.dismiss.emit()
14065
+ })
13780
14066
  private lastDuration: number
13781
14067
  private hasChildren = false
13782
14068
 
@@ -13784,7 +14070,6 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13784
14070
  constructor() {
13785
14071
  usePlacement((hasContent) => this.reconcile(hasContent))
13786
14072
  useHostPresence(() => this.visible())
13787
- this.remaining = this.duration
13788
14073
  this.lastDuration = this.duration
13789
14074
  }
13790
14075
 
@@ -13808,13 +14093,17 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13808
14093
  return styleText(this.style)
13809
14094
  }
13810
14095
 
14096
+ /** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
13811
14097
  molId(): string | undefined {
13812
14098
  return this.automationId ?? this.dataMolId ?? this.host.getAttribute('data-mol-id') ?? undefined
13813
14099
  }
13814
14100
 
13815
14101
  /** The announced role: assertive for warnings/errors, polite otherwise. */
13816
- role(): 'alert' | 'status' {
13817
- return this.variant() === 'warning' || this.variant() === 'error' ? 'alert' : 'status'
14102
+ role(): string {
14103
+ return (
14104
+ this.roleOverride ??
14105
+ (this.variant() === 'warning' || this.variant() === 'error' ? 'alert' : 'status')
14106
+ )
13818
14107
  }
13819
14108
 
13820
14109
  /** The status glyph, when the variant has one. */
@@ -13845,62 +14134,38 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13845
14134
 
13846
14135
  /** Dismisses the toast and calls the callback (React's `handleDismiss`). */
13847
14136
  handleDismiss(): void {
13848
- this.visible.set(false)
13849
- this.dismiss.emit()
14137
+ this.countdown.dismiss()
14138
+ }
14139
+
14140
+ /** Tracks the pointer's presence on the notification. */
14141
+ setHovered(hovered: boolean): void {
14142
+ this.countdown.setPaused('hover', hovered)
13850
14143
  }
13851
14144
 
13852
- /** Pauses the countdown, keeping the time left (React's `pauseTimer`). */
13853
- pauseTimer(): void {
13854
- if (this.startedAt === null) return
13855
- const elapsed = Date.now() - this.startedAt
13856
- this.remaining = Math.max(0, this.remaining - elapsed)
13857
- this.clearTimer()
14145
+ /** Tracks focus anywhere inside the notification. */
14146
+ setFocused(focused: boolean): void {
14147
+ this.countdown.setPaused('focus', focused)
13858
14148
  }
13859
14149
 
13860
- resumeTimer(): void {
13861
- if (this.remaining > 0) this.startTimer(this.remaining)
14150
+ /** Keeps the countdown paused when focus moves to another toast control. */
14151
+ leaveFocus(event: FocusEvent): void {
14152
+ if (!focusStaysWithin(event)) this.setFocused(false)
13862
14153
  }
13863
14154
 
13864
14155
  ngAfterViewInit(): void {
13865
- this.restart()
14156
+ this.countdown.start(this.duration)
13866
14157
  }
13867
14158
 
13868
14159
  ngDoCheck(): void {
13869
14160
  if (this.duration !== this.lastDuration) {
13870
14161
  this.lastDuration = this.duration
13871
- this.restart()
14162
+ this.countdown.start(this.duration)
13872
14163
  }
13873
14164
  }
13874
14165
 
13875
14166
  /** Stops the countdown (React's unmount cleanup). */
13876
14167
  ngOnDestroy(): void {
13877
- this.clearTimer()
13878
- }
13879
-
13880
- /** React's effect body: reset the remaining time and start counting. */
13881
- private restart(): void {
13882
- this.remaining = this.duration
13883
- this.startTimer(this.duration)
13884
- }
13885
-
13886
- /** Clears the running timer (React's `clearTimer`). */
13887
- private clearTimer(): void {
13888
- if (this.timer) {
13889
- clearTimeout(this.timer)
13890
- this.timer = undefined
13891
- }
13892
- this.startedAt = null
13893
- }
13894
-
13895
- /** Starts the countdown (React's `startTimer`). */
13896
- private startTimer(ms: number): void {
13897
- this.clearTimer()
13898
- if (ms <= 0) return
13899
- this.startedAt = Date.now()
13900
- this.timer = setTimeout(() => {
13901
- this.visible.set(false)
13902
- this.dismiss.emit()
13903
- }, ms)
14168
+ this.countdown.stop()
13904
14169
  }
13905
14170
 
13906
14171
  private reconcile(hasContent: SlotReader): void {
@@ -13929,7 +14194,7 @@ export class Toast implements AfterViewInit, DoCheck, OnDestroy, HasElement<HTML
13929
14194
  }
13930
14195
  ```
13931
14196
 
13932
- _(Member comments are shortened to their first sentence, and the 13 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/toast.component.d.ts`.)_
14197
+ _(Member comments are shortened to their first sentence, and the 8 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/toast.component.d.ts`.)_
13933
14198
 
13934
14199
  #### `ToastContainer`
13935
14200
 
@@ -14031,6 +14296,8 @@ children now belong to.
14031
14296
  [testId]="toast.testId"
14032
14297
  [automationId]="toast.automationId"
14033
14298
  [id]="toast.id"
14299
+ [role]="toast.role"
14300
+ [aria-live]="toast['aria-live']"
14034
14301
  (dismiss)="removeToast(toast.id)"
14035
14302
  ></div>
14036
14303
  }
@@ -14223,10 +14490,8 @@ export class Tooltip
14223
14490
  private showTimer: ReturnType<typeof setTimeout> | undefined
14224
14491
  private hideTimer: ReturnType<typeof setTimeout> | undefined
14225
14492
  private readonly hideListener = (): void => this.hide()
14226
- private readonly escapeListener = (event: KeyboardEvent): void => {
14227
- if (event.key === 'Escape') this.hide()
14228
- }
14229
- private escapeBound = false
14493
+ private readonly layer = new OverlayLayer()
14494
+ private owner?: Document
14230
14495
  private lastVisible = false
14231
14496
  private lastContentText: string | null = null
14232
14497
  private lastPlacement: TooltipPlacement | null = null
@@ -14291,10 +14556,13 @@ export class Tooltip
14291
14556
  }
14292
14557
 
14293
14558
  show(): void {
14294
- if (typeof document !== 'undefined') {
14295
- const previous = activeTooltips.get(document)
14559
+ const doc = this.triggerWrap?.nativeElement.ownerDocument
14560
+ if (doc) {
14561
+ this.releaseOwner()
14562
+ this.owner = doc
14563
+ const previous = activeTooltips.get(doc)
14296
14564
  if (previous !== this.hideListener) previous?.()
14297
- activeTooltips.set(document, this.hideListener)
14565
+ activeTooltips.set(doc, this.hideListener)
14298
14566
  }
14299
14567
  clearTimeout(this.hideTimer)
14300
14568
  clearTimeout(this.showTimer)
@@ -14312,9 +14580,7 @@ export class Tooltip
14312
14580
  hide(): void {
14313
14581
  clearTimeout(this.showTimer)
14314
14582
  clearTimeout(this.hideTimer)
14315
- if (typeof document !== 'undefined' && activeTooltips.get(document) === this.hideListener) {
14316
- activeTooltips.delete(document)
14317
- }
14583
+ this.releaseOwner()
14318
14584
  this.visible.set(false)
14319
14585
  this.cdr.markForCheck()
14320
14586
  }
@@ -14338,7 +14604,7 @@ export class Tooltip
14338
14604
  }
14339
14605
 
14340
14606
  handleKeyDown(event: KeyboardEvent): void {
14341
- if (event.key === 'Escape') this.hide()
14607
+ if (!this.visible() && event.key === 'Escape') this.hide()
14342
14608
  }
14343
14609
 
14344
14610
  ngAfterViewInit(): void {
@@ -14376,24 +14642,34 @@ export class Tooltip
14376
14642
  ngOnDestroy(): void {
14377
14643
  clearTimeout(this.showTimer)
14378
14644
  clearTimeout(this.hideTimer)
14379
- if (typeof document !== 'undefined' && activeTooltips.get(document) === this.hideListener) {
14380
- activeTooltips.delete(document)
14381
- }
14382
- if (this.escapeBound) document.removeEventListener('keydown', this.escapeListener)
14645
+ this.releaseOwner()
14646
+ this.layer.release()
14383
14647
  this.associateEl = null
14384
14648
  }
14385
14649
 
14650
+ private releaseOwner(): void {
14651
+ if (this.owner && activeTooltips.get(this.owner) === this.hideListener)
14652
+ activeTooltips.delete(this.owner)
14653
+ this.owner = undefined
14654
+ }
14655
+
14386
14656
  private attachPortal(): void {
14387
14657
  const portal = this.portalWrap?.nativeElement
14388
- if (!portal) return
14389
- placeElement(portal, document.body)
14390
- this.inner.set(this.contentEl?.nativeElement ?? null)
14658
+ const trigger = this.triggerWrap?.nativeElement
14659
+ if (!portal || !trigger) return
14660
+ placeElement(portal, trigger.ownerDocument.body)
14661
+ const surface = this.contentEl?.nativeElement ?? null
14662
+ this.inner.set(surface)
14391
14663
  this.updatePosition()
14392
14664
  this.associateEl?.setAttribute('aria-describedby', this.boxId())
14393
- if (!this.escapeBound) {
14394
- document.addEventListener('keydown', this.escapeListener)
14395
- this.escapeBound = true
14396
- }
14665
+ this.layer.sync({
14666
+ open: true,
14667
+ kind: 'tooltip',
14668
+ surface: { current: surface },
14669
+ anchor: { current: trigger },
14670
+ dismissKey: true,
14671
+ onDismiss: this.hideListener,
14672
+ })
14397
14673
  }
14398
14674
  // … truncated — 2 more members: detachPortal, updatePosition; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/tooltip.component.d.ts
14399
14675
  ```
@@ -14437,8 +14713,11 @@ export class UserMenuPopover implements AfterViewInit, DoCheck, OnDestroy {
14437
14713
 
14438
14714
  private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
14439
14715
  private readonly cdr = inject(ChangeDetectorRef)
14440
- private listeners: (() => void)[] = []
14441
- private openListener = false
14716
+ private readonly layer = new OverlayLayer()
14717
+ private readonly close = (): void => {
14718
+ this.isOpen.set(false)
14719
+ this.cdr.markForCheck()
14720
+ }
14442
14721
  private lastOpen = false
14443
14722
  private lastRoute: string | null = null
14444
14723
  /** Closes the popover on any route change (React's location effect). */
@@ -14496,60 +14775,34 @@ export class UserMenuPopover implements AfterViewInit, DoCheck, OnDestroy {
14496
14775
  this.cdr.markForCheck()
14497
14776
  }
14498
14777
 
14499
- /** Closes the popover on the first pass and keeps the outside listeners in sync. */
14778
+ /** Observes the host window's history, including navigation to the same URL. */
14500
14779
  ngAfterViewInit(): void {
14501
- // React's route effect runs on mount and closes the (closed) popover.
14502
- this.isOpen.set(false)
14503
- this.lastOpen = false
14780
+ this.host.nativeElement.ownerDocument.defaultView?.addEventListener('popstate', this.close)
14504
14781
  }
14505
14782
 
14506
- /** Reconciles the document listeners for the open state. */
14783
+ /** Registers the mounted disclosure with the document stack while open. */
14507
14784
  ngDoCheck(): void {
14508
14785
  const open = this.isOpen()
14509
- if (open !== this.lastOpen) {
14510
- this.lastOpen = open
14511
- if (open) this.addDocumentListeners()
14512
- else this.removeDocumentListeners()
14513
- }
14786
+ if (open === this.lastOpen) return
14787
+ this.lastOpen = open
14788
+ const target = { current: this.host.nativeElement }
14789
+ this.layer.sync({
14790
+ open,
14791
+ kind: 'popover',
14792
+ surface: target,
14793
+ anchor: target,
14794
+ dismissKey: true,
14795
+ outside: { inside: [target], phase: 'start' },
14796
+ onDismiss: this.close,
14797
+ })
14514
14798
  }
14515
14799
 
14516
14800
  /** Removes listeners and the context registration (unmount). */
14517
14801
  ngOnDestroy(): void {
14518
- this.removeDocumentListeners()
14802
+ this.host.nativeElement.ownerDocument.defaultView?.removeEventListener('popstate', this.close)
14803
+ this.layer.release()
14519
14804
  PopoverDomContext.remove(this.host.nativeElement)
14520
14805
  }
14521
-
14522
- /** Adds the outside-click and Escape dismiss listeners while open. */
14523
- private addDocumentListeners(): void {
14524
- this.removeDocumentListeners()
14525
- if (this.openListener) return
14526
- this.openListener = true
14527
- const onMouseDown = (event: MouseEvent): void => {
14528
- if (!this.host.nativeElement.contains(event.target as Node)) {
14529
- this.isOpen.set(false)
14530
- this.cdr.markForCheck()
14531
- }
14532
- }
14533
- const onKeyDown = (event: KeyboardEvent): void => {
14534
- if (event.key === 'Escape') {
14535
- this.isOpen.set(false)
14536
- this.cdr.markForCheck()
14537
- }
14538
- }
14539
- document.addEventListener('mousedown', onMouseDown)
14540
- document.addEventListener('keydown', onKeyDown)
14541
- this.listeners.push(
14542
- () => document.removeEventListener('mousedown', onMouseDown),
14543
- () => document.removeEventListener('keydown', onKeyDown),
14544
- )
14545
- }
14546
-
14547
- /** Removes the document listeners. */
14548
- private removeDocumentListeners(): void {
14549
- for (const off of this.listeners) off()
14550
- this.listeners = []
14551
- this.openListener = false
14552
- }
14553
14806
  }
14554
14807
  ```
14555
14808
 
@@ -15118,7 +15371,7 @@ The rules are React's spread:
15118
15371
  suffix → capture phase, `onDoubleClick` → `dblclick`); a non-function
15119
15372
  value removes the listener, and so does dropping the key.
15120
15373
  - `className` and `class` compose into one `class` attribute with `cn`.
15121
- - An object `style` is serialized with `styleText`.
15374
+ - An object `style` is serialized with `reactStyleText`.
15122
15375
  - Every other key becomes an attribute: `null`/`undefined` removes it,
15123
15376
  `false` removes it (except text booleans, which write `"false"`), and
15124
15377
  `true` writes `""` (text booleans write `"true"`). Any other value is
@@ -15163,7 +15416,7 @@ class ElementPropsWriter {
15163
15416
  if (skip?.has(key)) continue
15164
15417
  if (key === 'className' || key === 'class') continue
15165
15418
  if (key === 'style') {
15166
- next.set('style', styleAttribute(value))
15419
+ next.set('style', reactStyleText(value, ' '))
15167
15420
  continue
15168
15421
  }
15169
15422
  next.set(key, value)
@@ -15339,6 +15592,112 @@ export class MolIconSvg implements OnChanges {
15339
15592
  }
15340
15593
  ```
15341
15594
 
15595
+ #### `WebDragDirective`
15596
+
15597
+ Binds an HTML or SVG element to the web kits' shared drag gesture. Import
15598
+ `WebDragDirective` into a standalone component and bind `[molDrag]="handlers"`.
15599
+ Pass undefined to disable the gesture.
15600
+
15601
+ ```typescript
15602
+ @Directive({
15603
+ selector: '[molDrag]',
15604
+ standalone: true,
15605
+ host: { '(pointerdown)': 'onPointerDown($event)' },
15606
+ })
15607
+ export class WebDragDirective implements OnDestroy {
15608
+ private readonly host = inject<ElementRef<HTMLElement | SVGElement>>(ElementRef).nativeElement
15609
+ private readonly gesture = createWebDrag()
15610
+
15611
+ /** The current handlers for this host. */
15612
+ @Input()
15613
+ set molDrag(drag: ElementDrag | undefined) {
15614
+ this.gesture.update(drag)
15615
+ }
15616
+
15617
+ /**
15618
+ * Offers a primary pointer press to this directive's element.
15619
+ *
15620
+ * @param event - The native bubbling pointer event.
15621
+ */
15622
+ onPointerDown(event: PointerEvent): void {
15623
+ this.gesture.start(this.host, event)
15624
+ }
15625
+
15626
+ /** Cancels the gesture when Angular destroys its host. */
15627
+ ngOnDestroy(): void {
15628
+ this.gesture.cancel()
15629
+ }
15630
+ }
15631
+ ```
15632
+
15633
+ #### `WebHoverDirective`
15634
+
15635
+ Handles shared mouse and pen hover. Import `WebHoverDirective` into a
15636
+ standalone component, add `molHover` to the host and listen for
15637
+ `(molHoverEnter)` and `(molHoverLeave)`. Bind `[molHover]="false"`
15638
+ to disable hover.
15639
+
15640
+ ```typescript
15641
+ @Directive({
15642
+ selector: '[molHover]',
15643
+ standalone: true,
15644
+ outputs: ['molHoverEnter', 'molHoverLeave'],
15645
+ })
15646
+ export class WebHoverDirective implements OnDestroy {
15647
+ /** Emits when a mouse or pen enters the host. */
15648
+ readonly molHoverEnter = new EventEmitter<MouseEvent>()
15649
+
15650
+ /** Emits when the hovering mouse or pen leaves the host. */
15651
+ readonly molHoverLeave = new EventEmitter<MouseEvent>()
15652
+
15653
+ private readonly binding = bindWebHover(
15654
+ inject<ElementRef<HTMLElement | SVGElement>>(ElementRef).nativeElement,
15655
+ )
15656
+
15657
+ private readonly handlers = {
15658
+ onEnter: (event: MouseEvent) => this.molHoverEnter.emit(event),
15659
+ onLeave: (event: MouseEvent) => this.molHoverLeave.emit(event),
15660
+ }
15661
+
15662
+ /** Enables the gesture on this host. */
15663
+ @Input({ transform: booleanAttribute })
15664
+ set molHover(enabled: boolean) {
15665
+ this.binding.update(enabled ? this.handlers : undefined)
15666
+ }
15667
+
15668
+ /** Removes the hover listeners when Angular destroys the host. */
15669
+ ngOnDestroy(): void {
15670
+ this.binding.destroy()
15671
+ }
15672
+ }
15673
+ ```
15674
+
15675
+ #### `WebWheelZoomDirective`
15676
+
15677
+ Handles shared Ctrl-wheel zoom steps. Import `WebWheelZoomDirective`
15678
+ into a standalone component and bind `[molWheelZoom]="onStep"`.
15679
+ Pass undefined to leave the wheel to the browser.
15680
+
15681
+ ```typescript
15682
+ @Directive({ selector: '[molWheelZoom]', standalone: true })
15683
+ export class WebWheelZoomDirective implements OnDestroy {
15684
+ private readonly binding = bindWebWheelZoom(
15685
+ inject<ElementRef<HTMLElement | SVGElement>>(ElementRef).nativeElement,
15686
+ )
15687
+
15688
+ /** Sets the callback that receives each handled zoom step. */
15689
+ @Input()
15690
+ set molWheelZoom(onStep: WebWheelZoomHandler | undefined) {
15691
+ this.binding.update(onStep)
15692
+ }
15693
+
15694
+ /** Removes the wheel listener when Angular destroys the host. */
15695
+ ngOnDestroy(): void {
15696
+ this.binding.destroy()
15697
+ }
15698
+ }
15699
+ ```
15700
+
15342
15701
  ### Functions
15343
15702
 
15344
15703
  #### `hasNodes(el)` _(deprecated)_
@@ -15544,6 +15903,20 @@ function hostElement<E extends Element>(host: ElementRef<E>): Signal<E | null>
15544
15903
 
15545
15904
  **Returns:** A read-only signal holding the host element.
15546
15905
 
15906
+ #### `elementTarget(read)`
15907
+
15908
+ A target that reads an element each time an overlay asks for it, such as a Modal's
15909
+ `initialFocus` naming a control in the dialog's content. A class field can build it, since the
15910
+ arrow keeps `this`: `readonly emailTarget = elementTarget(() => this.email?.nativeElement)`.
15911
+
15912
+ ```typescript
15913
+ function elementTarget(read: () => ElementHandle | null | undefined): OverlayTarget
15914
+ ```
15915
+
15916
+ - `read` — Returns the element, or `null` or `undefined` while it is not rendered.
15917
+
15918
+ **Returns:** The target, whose `current` is the element or `null`.
15919
+
15547
15920
  #### `getFocusableElements(container)`
15548
15921
 
15549
15922
  Returns the tab-stop elements inside a container, in DOM (tab) order.
@@ -15824,34 +16197,18 @@ function adoptHostDataMolId(
15824
16197
  - `store` — Keeps the taken host id for the component's `molId()`.
15825
16198
  - `molId` — The id the component renders, read after `store`.
15826
16199
 
15827
- #### `kebab(key)`
15828
-
15829
- Converts a camelCase CSS property name to kebab-case.
15830
-
15831
- ```typescript
15832
- function kebab(key: string): string
15833
- ```
15834
-
15835
- - `key` — The camelCase property name.
15836
-
15837
- **Returns:** The kebab-case CSS property name.
15838
-
15839
16200
  #### `styleText(style)`
15840
16201
 
15841
- Serializes a React-style style object the way React writes it to the DOM:
15842
- camelCase keys become kebab-case, numbers gain `px` unless the property is
15843
- unitless, and declaration order follows object key order (the conformance
15844
- normalizer sorts declarations anyway). A shorthand and a longhand it covers
15845
- that Angular's sorted style binding would apply out of order come back
15846
- resolved, as the CSSOM applies them in object order.
16202
+ Serializes a React-shaped style object for Angular's `[style]` binding.
16203
+ Resolves overlapping properties that Angular would apply out of order.
15847
16204
 
15848
16205
  ```typescript
15849
16206
  function styleText(style: Record<string, unknown> | undefined | null): string | null
15850
16207
  ```
15851
16208
 
15852
- - `style` — The style object (or undefined).
16209
+ - `style` — The style object, or an absent value.
15853
16210
 
15854
- **Returns:** The `style` attribute text, or null when there is nothing to set.
16211
+ **Returns:** CSS declaration text, or null when there are no declarations.
15855
16212
 
15856
16213
  #### `cn(inputs)`
15857
16214
 
@@ -15865,6 +16222,44 @@ function cn(...inputs: (string | undefined | null | false)[]): string
15865
16222
 
15866
16223
  **Returns:** The resulting string.
15867
16224
 
16225
+ #### `kebab(name)`
16226
+
16227
+ Converts a React property name to its CSS spelling.
16228
+
16229
+ ```typescript
16230
+ function kebab(name: string): string
16231
+ ```
16232
+
16233
+ - `name` — A camelCase, vendor-prefixed or custom property name.
16234
+
16235
+ **Returns:** The CSS property name.
16236
+
16237
+ #### `reactStyleText(style, space)`
16238
+
16239
+ Serializes a React-shaped style object as React DOM's style attribute value.
16240
+ The renderer escapes the value when it writes HTML.
16241
+
16242
+ ```typescript
16243
+ function reactStyleText(style: unknown, space?: '' | ' '): string | undefined
16244
+ ```
16245
+
16246
+ - `style` — The style object, or an absent value.
16247
+ - `space` — An optional space after separators for existing bindings that use spaced CSS.
16248
+
16249
+ **Returns:** The CSS declaration text, or undefined when there are no declarations.
16250
+
16251
+ #### `toStyleProps(style)`
16252
+
16253
+ Normalizes a React-shaped style object for renderers that accept a CSS property map.
16254
+
16255
+ ```typescript
16256
+ function toStyleProps(style: unknown): Record<string, string> | undefined
16257
+ ```
16258
+
16259
+ - `style` — The style object, or an absent value.
16260
+
16261
+ **Returns:** CSS property names and string values, or undefined for an absent object.
16262
+
15868
16263
  ### Constants
15869
16264
 
15870
16265
  #### `FOCUSABLE_SELECTOR`
@@ -15892,10 +16287,11 @@ Peer dependencies:
15892
16287
  - `@angular/common` ^22.0.0
15893
16288
  - `@angular/core` ^22.0.0
15894
16289
  - `@angular/platform-browser` ^22.0.0
15895
- - `@molecule/app-angular` ^3.14.0
16290
+ - `@molecule/app-angular` ^3.16.1
16291
+ - `@molecule/app-filesystem` ^1.1.0
15896
16292
  - `@molecule/app-i18n` ^1.0.1
15897
16293
  - `@molecule/app-icons` ^1.0.1
15898
- - `@molecule/app-ui` ^1.5.0
16294
+ - `@molecule/app-ui` ^1.14.0
15899
16295
 
15900
16296
  ### Runtime Dependencies
15901
16297
 
@@ -15903,8 +16299,12 @@ Peer dependencies:
15903
16299
  - `@angular/core`
15904
16300
  - `@angular/platform-browser`
15905
16301
  - `@molecule/app-angular`
16302
+ - `@molecule/app-filesystem`
15906
16303
  - `@molecule/app-i18n`
15907
16304
  - `@molecule/app-icons`
16305
+ - `@molecule/app-inline-style-dom`
16306
+ - `@molecule/app-overlay-dom`
16307
+ - `@molecule/app-pointer-events-dom`
15908
16308
  - `@molecule/app-ui`
15909
16309
 
15910
16310
  - **`setClassMap()` must run before any component renders** — every component resolves its
@@ -15925,6 +16325,10 @@ Peer dependencies:
15925
16325
  - The original first-pass components remain exported under their `Molecule*` names
15926
16326
  (`MoleculeButton`, `MoleculeInput`, `MoleculeModal`, …) as deprecated aliases.
15927
16327
 
16328
+ Import `WebDragDirective`, `WebHoverDirective`, or `WebWheelZoomDirective` into a
16329
+ standalone component. Bind `[molDrag]` or `[molWheelZoom]` to the current handler,
16330
+ or add `molHover` and listen for `(molHoverEnter)` and `(molHoverLeave)`.
16331
+
15928
16332
  ## Translations
15929
16333
 
15930
16334
  Translation strings are provided by `@molecule/app-locales-ui`.