@molecule/app-ui-angular 1.13.3 → 1.13.5

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 (82) hide show
  1. package/README.md +444 -290
  2. package/dist/components/button.component.d.ts +10 -2
  3. package/dist/components/button.component.d.ts.map +1 -1
  4. package/dist/components/button.component.js +16 -5
  5. package/dist/components/button.component.js.map +1 -1
  6. package/dist/components/checkbox.component.d.ts +2 -2
  7. package/dist/components/checkbox.component.d.ts.map +1 -1
  8. package/dist/components/checkbox.component.js +1 -1
  9. package/dist/components/checkbox.component.js.map +1 -1
  10. package/dist/components/confirm-dialog.component.d.ts +1 -1
  11. package/dist/components/confirm-dialog.component.d.ts.map +1 -1
  12. package/dist/components/confirm-dialog.component.js.map +1 -1
  13. package/dist/components/form-field.component.d.ts +14 -5
  14. package/dist/components/form-field.component.d.ts.map +1 -1
  15. package/dist/components/form-field.component.js +79 -51
  16. package/dist/components/form-field.component.js.map +1 -1
  17. package/dist/components/input.component.d.ts +11 -8
  18. package/dist/components/input.component.d.ts.map +1 -1
  19. package/dist/components/input.component.js +33 -31
  20. package/dist/components/input.component.js.map +1 -1
  21. package/dist/components/layout.component.d.ts +7 -7
  22. package/dist/components/layout.component.d.ts.map +1 -1
  23. package/dist/components/layout.component.js +29 -20
  24. package/dist/components/layout.component.js.map +1 -1
  25. package/dist/components/molecule/input.component.d.ts +7 -4
  26. package/dist/components/molecule/input.component.d.ts.map +1 -1
  27. package/dist/components/molecule/input.component.js +18 -8
  28. package/dist/components/molecule/input.component.js.map +1 -1
  29. package/dist/components/molecule/modal.component.d.ts +9 -30
  30. package/dist/components/molecule/modal.component.d.ts.map +1 -1
  31. package/dist/components/molecule/modal.component.js +69 -81
  32. package/dist/components/molecule/modal.component.js.map +1 -1
  33. package/dist/components/molecule/select.component.d.ts +4 -3
  34. package/dist/components/molecule/select.component.d.ts.map +1 -1
  35. package/dist/components/molecule/select.component.js +13 -7
  36. package/dist/components/molecule/select.component.js.map +1 -1
  37. package/dist/components/prompt-dialog.component.d.ts +3 -3
  38. package/dist/components/prompt-dialog.component.d.ts.map +1 -1
  39. package/dist/components/prompt-dialog.component.js.map +1 -1
  40. package/dist/components/radio-group.component.d.ts +2 -2
  41. package/dist/components/radio-group.component.d.ts.map +1 -1
  42. package/dist/components/radio-group.component.js +2 -0
  43. package/dist/components/radio-group.component.js.map +1 -1
  44. package/dist/components/select.component.d.ts +13 -10
  45. package/dist/components/select.component.d.ts.map +1 -1
  46. package/dist/components/select.component.js +37 -33
  47. package/dist/components/select.component.js.map +1 -1
  48. package/dist/components/spinner.component.d.ts.map +1 -1
  49. package/dist/components/spinner.component.js +1 -3
  50. package/dist/components/spinner.component.js.map +1 -1
  51. package/dist/components/table.component.d.ts +16 -11
  52. package/dist/components/table.component.d.ts.map +1 -1
  53. package/dist/components/table.component.js +12 -14
  54. package/dist/components/table.component.js.map +1 -1
  55. package/dist/components/tabs.component.d.ts +1 -3
  56. package/dist/components/tabs.component.d.ts.map +1 -1
  57. package/dist/components/tabs.component.js +13 -11
  58. package/dist/components/tabs.component.js.map +1 -1
  59. package/dist/components/textarea.component.d.ts +14 -16
  60. package/dist/components/textarea.component.d.ts.map +1 -1
  61. package/dist/components/textarea.component.js +38 -39
  62. package/dist/components/textarea.component.js.map +1 -1
  63. package/dist/components/tooltip.component.js +1 -1
  64. package/dist/components/tooltip.component.js.map +1 -1
  65. package/dist/components/user-menu.component.d.ts +1 -1
  66. package/dist/components/user-menu.component.d.ts.map +1 -1
  67. package/dist/components/user-menu.component.js.map +1 -1
  68. package/dist/index.d.ts +1 -4
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +1 -4
  71. package/dist/index.js.map +1 -1
  72. package/dist/types.d.ts +1 -1
  73. package/dist/types.d.ts.map +1 -1
  74. package/dist/utilities/form-field-context.d.ts +10 -1
  75. package/dist/utilities/form-field-context.d.ts.map +1 -1
  76. package/dist/utilities/form-field-context.js +18 -0
  77. package/dist/utilities/form-field-context.js.map +1 -1
  78. package/dist/utilities/rest-attrs.d.ts +4 -1
  79. package/dist/utilities/rest-attrs.d.ts.map +1 -1
  80. package/dist/utilities/rest-attrs.js +6 -1
  81. package/dist/utilities/rest-attrs.js.map +1 -1
  82. package/package.json +3 -3
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-28T23:29:00.500Z
6
+ Generated: 2026-12-01T19:47:23.877Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-angular
@@ -50,16 +50,13 @@ setClassMap(classMap)
50
50
  standalone: true,
51
51
  imports: [Button, Input],
52
52
  template: `
53
- <input mol-input placeholder="Name" [value]="name" (change)="onName($event)" />
53
+ <div mol-input placeholder="Name" [value]="name" (change)="name = $event.target.value"></div>
54
54
  <button mol-button color="primary" [loading]="saving" (click)="save()">Save</button>
55
55
  `,
56
56
  })
57
57
  class SavePanel {
58
58
  name = ''
59
59
  saving = false
60
- onName(event: Event): void {
61
- this.name = (event.target as HTMLInputElement).value
62
- }
63
60
  save(): void {}
64
61
  }
65
62
  ```
@@ -78,6 +75,19 @@ npm install @molecule/app-ui-angular @angular/common @angular/core @angular/plat
78
75
 
79
76
  ### Interfaces
80
77
 
78
+ #### `KitFieldChangeEvent`
79
+
80
+ Both targets expose the field's string value during the callback.
81
+
82
+ ```typescript
83
+ interface KitFieldChangeEvent extends KitEvent {
84
+ /** The edited field, or its value snapshot on a device. */
85
+ readonly target: EventTarget & { value: string }
86
+ /** The field handling the change. */
87
+ readonly currentTarget: KitFieldChangeEvent['target']
88
+ }
89
+ ```
90
+
81
91
  #### `CSSProperties`
82
92
 
83
93
  Framework-agnostic CSS properties.
@@ -101,7 +111,7 @@ both satisfy this type. A handler that needs a member only one of them has (`nat
101
111
 
102
112
  ```typescript
103
113
  interface KitEvent {
104
- /** The element the event started on (`(event.target as HTMLInputElement).value` reads a field). */
114
+ /** The element the event started on. */
105
115
  readonly target: EventTarget | null
106
116
  /** The element of the component the handler was passed to. */
107
117
  readonly currentTarget: EventTarget | null
@@ -325,7 +335,7 @@ interface TextareaElementProps extends HTMLElementProps {
325
335
  minLength?: number
326
336
  wrap?: 'hard' | 'soft' | 'off'
327
337
  /** Web change event. {@link TextareaProps.onValueChange} also works on native. */
328
- onChange?: ChangeEventHandler
338
+ onChange?: EventHandler<KitFieldChangeEvent>
329
339
  onInput?: FormEventHandler
330
340
  }
331
341
  ```
@@ -341,7 +351,7 @@ interface SelectElementProps extends HTMLElementProps {
341
351
  autoFocus?: boolean
342
352
  multiple?: boolean
343
353
  /** Web change event. {@link SelectProps.onValueChange} also works on native. */
344
- onChange?: ChangeEventHandler
354
+ onChange?: EventHandler<KitFieldChangeEvent>
345
355
  }
346
356
  ```
347
357
 
@@ -423,6 +433,9 @@ Ref element: the native `<input>`.
423
433
 
424
434
  ```typescript
425
435
  interface InputProps extends InputElementProps, Pick<TextFieldProps, 'onValueChange'> {
436
+ /** The edited field's text is available as `event.target.value`. */
437
+ onChange?: EventHandler<KitFieldChangeEvent>
438
+
426
439
  /**
427
440
  * Input type.
428
441
  */
@@ -970,6 +983,23 @@ interface CardProps extends HTMLElementProps {
970
983
  }
971
984
  ```
972
985
 
986
+ #### `CardSectionProps`
987
+
988
+ Props of a card's header, title, description, content and footer.
989
+
990
+ ```typescript
991
+ interface CardSectionProps extends ElementProps {
992
+ /** Tooltip text. */
993
+ title?: string
994
+
995
+ /** CSS for the web. */
996
+ style?: CSSProperties
997
+
998
+ /** Contents. */
999
+ children?: Children
1000
+ }
1001
+ ```
1002
+
973
1003
  #### `ContainerProps`
974
1004
 
975
1005
  Props for the Container layout component.
@@ -1599,6 +1629,59 @@ interface SkeletonProps extends BaseProps {
1599
1629
  }
1600
1630
  ```
1601
1631
 
1632
+ #### `PageShellProps`
1633
+
1634
+ Props for the PageShell component — authenticated page wrapper with navigation.
1635
+
1636
+ ```typescript
1637
+ interface PageShellProps extends BaseProps {
1638
+ /** Sidebar content (navigation links). */
1639
+ sidebar?: Children
1640
+ /** Top bar content (breadcrumbs, user menu). */
1641
+ topbar?: Children
1642
+ /** Whether the sidebar is collapsed. */
1643
+ sidebarCollapsed?: boolean
1644
+ /** Callback when sidebar toggle is clicked. */
1645
+ onSidebarToggle?: () => void
1646
+ /** Main content. */
1647
+ children?: Children
1648
+ }
1649
+ ```
1650
+
1651
+ #### `EmptyStateProps`
1652
+
1653
+ Props for the EmptyState component — shown when a list or section has no data.
1654
+
1655
+ ```typescript
1656
+ interface EmptyStateProps extends BaseProps {
1657
+ /** Icon or illustration to display. */
1658
+ icon?: Children
1659
+ /** Main heading text. */
1660
+ title: string
1661
+ /** Description text. */
1662
+ description?: string
1663
+ /** Primary action button (e.g., "Create first item"). */
1664
+ action?: Children
1665
+ }
1666
+ ```
1667
+
1668
+ #### `PageHeaderProps`
1669
+
1670
+ Props for the PageHeader component — consistent page title area.
1671
+
1672
+ ```typescript
1673
+ interface PageHeaderProps extends BaseProps {
1674
+ /** Page title. */
1675
+ title: string
1676
+ /** Page description. */
1677
+ description?: string
1678
+ /** Action buttons (e.g., "Create", "Export"). */
1679
+ actions?: Children
1680
+ /** Breadcrumb trail. */
1681
+ breadcrumbs?: Array<{ label: string; href?: string }>
1682
+ }
1683
+ ```
1684
+
1602
1685
  #### `AccordionItemData`
1603
1686
 
1604
1687
  One accordion item (React's `AccordionItem`).
@@ -2170,6 +2253,17 @@ interface SidebarUserCardProps {
2170
2253
  }
2171
2254
  ```
2172
2255
 
2256
+ #### `AngularTableColumn`
2257
+
2258
+ A table column accepts either a cell template or the shared render callback.
2259
+
2260
+ ```typescript
2261
+ interface AngularTableColumn extends Omit<TableColumn<Record<string, unknown>>, 'render'> {
2262
+ /** Renders the value, row and row index. */
2263
+ render?: TableColumn<Record<string, unknown>>['render'] | TemplateRef<unknown>
2264
+ }
2265
+ ```
2266
+
2173
2267
  #### `ThemeToggleProps`
2174
2268
 
2175
2269
  Props for {@link ThemeToggle} (React's `ThemeToggleProps`, in Angular's
@@ -2333,7 +2427,7 @@ interface UserMenuProps {
2333
2427
  /** Whether the trigger is disabled. */
2334
2428
  disabled?: boolean
2335
2429
  /** Overrides the trigger click (called instead of opening the panel). */
2336
- onClick?: () => void
2430
+ onClick?: (event: MouseEvent) => void
2337
2431
  /** Which side the panel opens from (default `right`). */
2338
2432
  side?: 'left' | 'right'
2339
2433
  }
@@ -2390,7 +2484,7 @@ The values `FormField` injects into its single child field.
2390
2484
 
2391
2485
  ```typescript
2392
2486
  interface FormFieldContext {
2393
- /** The field id (`FormField`'s `name`, or a generated id). */
2487
+ /** Stable id supplied to a control without an explicit id. */
2394
2488
  id?: string
2395
2489
  /** The id of the error/hint paragraph the field should describe itself with. */
2396
2490
  describedBy?: string
@@ -2505,6 +2599,8 @@ interface ReapplyRestAttributesOptions {
2505
2599
  * `...rest` target has no merge to protect, so it opts in.
2506
2600
  */
2507
2601
  includeDescribedBy?: boolean
2602
+ /** The field's validation binding owns aria-invalid on the control. */
2603
+ keepInvalid?: boolean
2508
2604
  }
2509
2605
  ```
2510
2606
 
@@ -3674,6 +3770,7 @@ capture point, so the wrapper lives in the template unconditionally).
3674
3770
  'testId',
3675
3771
  'disabled',
3676
3772
  'type',
3773
+ 'ariaBusy: aria-busy',
3677
3774
  'automationId',
3678
3775
  'dataMolId: data-mol-id',
3679
3776
  ],
@@ -3682,9 +3779,9 @@ capture point, so the wrapper lives in the template unconditionally).
3682
3779
  '[style]': 'hostStyle()',
3683
3780
  '[attr.data-testid]': 'testId',
3684
3781
  '[attr.data-mol-id]': 'molId()',
3685
- '[attr.type]': 'type',
3782
+ '[attr.type]': 'type ?? "button"',
3686
3783
  '[disabled]': 'disabled || loading',
3687
- '[attr.aria-busy]': 'loading ? "true" : "false"',
3784
+ '[attr.aria-busy]': 'ariaBusyAttr()',
3688
3785
  },
3689
3786
  template: `@if (loading) {
3690
3787
  <div mol-spinner [size]="'sm'" [className]="cm().buttonIconLeft"></div>
@@ -3731,6 +3828,8 @@ export class Button implements HasElement<HTMLButtonElement> {
3731
3828
  disabled = false
3732
3829
  /** The button's `type` attribute. */
3733
3830
  type: 'button' | 'submit' | 'reset' = 'button'
3831
+ /** Explicit `aria-busy` (`loading` stays busy even when this is false). */
3832
+ ariaBusy?: AriaBoolean
3734
3833
 
3735
3834
  /** The left icon wrapper (always in the template; detached when unused). */
3736
3835
  @ViewChild('leftSlot') leftSlot?: ElementRef<HTMLSpanElement>
@@ -3764,6 +3863,15 @@ export class Button implements HasElement<HTMLButtonElement> {
3764
3863
  )
3765
3864
  }
3766
3865
 
3866
+ /**
3867
+ * The `aria-busy` attribute value (`loading` stays busy even when an explicit
3868
+ * `aria-busy` is false; an explicit truthy `aria-busy` applies otherwise).
3869
+ * @returns `"true"` or `"false"`.
3870
+ */
3871
+ ariaBusyAttr(): 'true' | 'false' {
3872
+ return this.loading || this.ariaBusy === true || this.ariaBusy === 'true' ? 'true' : 'false'
3873
+ }
3874
+
3767
3875
  /**
3768
3876
  * Computes the button class list.
3769
3877
  * @returns The class string.
@@ -4248,7 +4356,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4248
4356
  /** Whether the checkbox renders the indeterminate state. */
4249
4357
  indeterminate?: boolean
4250
4358
  /** Checkbox size (kept for prop parity). */
4251
- size?: unknown
4359
+ size?: Size
4252
4360
  /** Error message (renders and associates via aria-describedby). */
4253
4361
  error?: string
4254
4362
  /** Extra classes joined onto the checkbox classes. */
@@ -4300,7 +4408,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4300
4408
  /** The label text wrapper. */
4301
4409
  @ViewChild('labelSlot') labelSlot?: ElementRef<HTMLSpanElement>
4302
4410
 
4303
- private readonly host = inject(ElementRef)
4411
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
4304
4412
 
4305
4413
  /** The per-instance id used when the caller gives no `id` or `name` (React's `useId`). */
4306
4414
  private readonly generatedId = nextInstanceId()
@@ -4338,7 +4446,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
4338
4446
 
4339
4447
  /** The nearest enclosing `FormField` context (React's cloned props). */
4340
4448
  fieldContext(): FormFieldContext | null {
4341
- return fieldContext(this.host.nativeElement as HTMLElement)
4449
+ return fieldContext(this.host.nativeElement)
4342
4450
  }
4343
4451
 
4344
4452
  /** The final `aria-describedby`: the enclosing FormField's error/hint target, then this checkbox's own error (React's cloneElement join). */
@@ -4784,7 +4892,7 @@ export class ConfirmDialog {
4784
4892
  readonly isGiven = isGiven
4785
4893
 
4786
4894
  /** Fires when the dialog should close (escape, backdrop, cancel). */
4787
- @Output() readonly close = new EventEmitter<unknown>()
4895
+ @Output() readonly close = new EventEmitter<MouseEvent | undefined>()
4788
4896
  /** Fires when the user confirms. */
4789
4897
  @Output() readonly confirm = new EventEmitter<void>()
4790
4898
 
@@ -5688,7 +5796,7 @@ components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
5688
5796
  },
5689
5797
  template: `@if (label) {
5690
5798
  <label
5691
- [attr.for]="labelFor() || fieldId()"
5799
+ [attr.for]="singleChild() ? labelFor() || fieldId() : name || fieldId()"
5692
5800
  [class]="cm().cn(cm().label({ required: !!required }), cm().labelBlock)"
5693
5801
  >{{ label }}</label
5694
5802
  >
@@ -5701,10 +5809,10 @@ components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
5701
5809
  <p [attr.id]="hintId" [class]="cm().formHint">{{ hint }}</p>
5702
5810
  }`,
5703
5811
  })
5704
- export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5812
+ export class FormField implements OnChanges, OnDestroy, HasElement<HTMLDivElement> {
5705
5813
  /** Field label. */
5706
5814
  label?: string
5707
- /** Field name (drives the ids). */
5815
+ /** Field name. */
5708
5816
  name?: string
5709
5817
  /** Error message (renders and associates via aria-describedby). */
5710
5818
  error?: string
@@ -5720,27 +5828,24 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5720
5828
  testId?: string
5721
5829
  /** `data-mol-id` automation id (React's `automationId`). */
5722
5830
  automationId?: string
5723
- /** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
5724
5831
  dataMolId?: string
5725
5832
 
5726
5833
  /** The projected-children capture point. */
5727
5834
  @ViewChild('capture') capture?: ElementRef<HTMLSpanElement>
5728
5835
 
5729
- /** The label's `for` target (the single child's control id, read after view init). */
5730
5836
  readonly labelFor = signal('')
5731
5837
 
5732
- /** A generated id used when `name` is absent (the normalizer renumbers it). */
5733
5838
  private readonly generatedId = nextInstanceId()
5839
+ readonly context = signal<FormFieldContext>({})
5734
5840
  private readonly host: ElementRef<HTMLDivElement> = inject(ElementRef)
5735
5841
  /** The element a caller's ref receives: the host `<div>`. */
5736
5842
  readonly element = hostElement(this.host)
5737
5843
  private readonly singleState = signal<boolean | null>(null)
5738
- /** The native control this field patched, with the attributes it had before. */
5739
5844
  private patched: {
5740
5845
  control: HTMLElement
5741
- attributes: Record<(typeof PATCHED_ATTRIBUTES)[number], string | null>
5846
+ attributes: FieldAttributes
5847
+ applied: FieldAttributes
5742
5848
  } | null = null
5743
- /** The first projected node the last adoption saw: a different one is adopted again. */
5744
5849
  private adopted: Node | null = null
5745
5850
  /** Whether the adopted content was a single element child. */
5746
5851
  private single = false
@@ -5756,9 +5861,9 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5756
5861
  return getClassMap()
5757
5862
  }
5758
5863
 
5759
- /** The field id (`name`, or a generated id). */
5864
+ /** The stable id supplied to a child that has no explicit id. */
5760
5865
  fieldId(): string {
5761
- return this.name || this.generatedId
5866
+ return this.generatedId
5762
5867
  }
5763
5868
 
5764
5869
  /** The error paragraph's id. */
@@ -5788,7 +5893,6 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5788
5893
  return styleText(this.style)
5789
5894
  }
5790
5895
 
5791
- /** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
5792
5896
  molId(): string | undefined {
5793
5897
  return (
5794
5898
  this.automationId ??
@@ -5805,7 +5909,6 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5805
5909
  )
5806
5910
  }
5807
5911
 
5808
- /** Whether the projected content is exactly one element (React clones only a single child). */
5809
5912
  singleChild(): boolean {
5810
5913
  const single = this.singleState()
5811
5914
  if (single !== null) return single
@@ -5834,59 +5937,77 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5834
5937
  // Angular inserts a list's nodes one at a time, and this runs after each:
5835
5938
  // a second child arriving after the first makes the field "not single" again.
5836
5939
  const single = children.length === 1 && first.nodeType === 1
5837
- if (this.adopted === first && this.single === single) {
5838
- // The adopted control's own id may bind after the first run; keep the
5839
- // label pointed at it as it settles (React adopts the child's id).
5840
- const control = this.single
5841
- ? this.host.nativeElement.querySelector<HTMLElement>(FIELD_SELECTOR)
5842
- : null
5843
- this.labelFor.set(control?.id || this.fieldId())
5844
- setElementPresent(capture, false)
5845
- return
5846
- }
5847
5940
  const host = this.host.nativeElement
5848
- this.singleState.set(single)
5849
- this.single = single
5850
- placeContent(capture, host, capture)
5851
- // React renders a child it no longer clones with its own props.
5852
- this.unpatchNativeControl()
5853
- if (single) {
5854
- const child = first as HTMLElement
5855
- const control = child.matches(FIELD_SELECTOR)
5856
- ? child
5857
- : child.querySelector<HTMLElement>(FIELD_SELECTOR)
5858
- if (child.matches(FIELD_SELECTOR)) this.patchNativeControl(child)
5859
- this.labelFor.set(control?.id || this.fieldId())
5860
- } else {
5861
- this.labelFor.set(this.fieldId())
5941
+ if (this.adopted !== first || this.single !== single) {
5942
+ this.singleState.set(single)
5943
+ this.single = single
5944
+ this.adopted = first
5945
+ placeContent(capture, host, capture)
5862
5946
  }
5947
+ const controls = single ? host.querySelectorAll<HTMLElement>(FIELD_SELECTOR) : null
5948
+ const control = controls?.length === 1 ? controls[0] : undefined
5949
+ const native = control && !control.closest(FIELD_COMPONENT) ? control : undefined
5950
+ if (this.patched?.control !== native) {
5951
+ this.unpatchNativeControl()
5952
+ if (native) this.patchNativeControl(native)
5953
+ }
5954
+ this.labelFor.set(control?.id || this.fieldId())
5863
5955
  setElementPresent(capture, false)
5864
- this.adopted = first
5865
5956
  }
5866
5957
 
5867
5958
  /** Applies React's cloned props to a plain native form control child. */
5868
5959
  private patchNativeControl(control: HTMLElement): void {
5869
- this.patched = {
5870
- control,
5871
- attributes: Object.fromEntries(
5872
- PATCHED_ATTRIBUTES.map((name) => [name, control.getAttribute(name)]),
5873
- ) as Record<(typeof PATCHED_ATTRIBUTES)[number], string | null>,
5960
+ const attributes = {
5961
+ id: control.getAttribute('id'),
5962
+ 'aria-describedby': control.getAttribute('aria-describedby'),
5963
+ 'aria-invalid': control.getAttribute('aria-invalid'),
5964
+ }
5965
+ this.patched = { control, attributes, applied: { ...attributes } }
5966
+ this.syncNativeControl()
5967
+ }
5968
+
5969
+ /** Keeps projected fields and plain controls in sync with field validation. */
5970
+ ngOnChanges(): void {
5971
+ this.context.set({
5972
+ id: this.fieldId(),
5973
+ describedBy: this.describedByTarget(),
5974
+ invalid: !!this.error,
5975
+ })
5976
+ }
5977
+
5978
+ /** Merges validation with the projected control's latest native bindings. */
5979
+ ngAfterContentChecked(): void {
5980
+ this.syncNativeControl()
5981
+ }
5982
+
5983
+ private syncNativeControl(): void {
5984
+ if (!this.patched) return
5985
+ const { control, attributes, applied } = this.patched
5986
+ for (const name of PATCHED_ATTRIBUTES) {
5987
+ const current = control.getAttribute(name)
5988
+ if (current !== applied[name]) attributes[name] = current
5989
+ }
5990
+ const next: FieldAttributes = {
5991
+ id: attributes.id || this.fieldId(),
5992
+ 'aria-describedby': descriptionIds(attributes['aria-describedby'], this.describedByTarget()),
5993
+ 'aria-invalid': this.error ? 'true' : attributes['aria-invalid'],
5874
5994
  }
5875
- control.setAttribute('id', this.fieldId())
5876
- const describedBy = this.describedByTarget()
5877
- if (describedBy) {
5878
- const existing = control.getAttribute('aria-describedby')
5879
- control.setAttribute('aria-describedby', [existing, describedBy].filter(Boolean).join(' '))
5995
+ for (const name of PATCHED_ATTRIBUTES) {
5996
+ const value = next[name]
5997
+ if (control.getAttribute(name) === value) continue
5998
+ if (value === null) control.removeAttribute(name)
5999
+ else control.setAttribute(name, value)
5880
6000
  }
5881
- if (this.error) control.setAttribute('aria-invalid', 'true')
6001
+ this.patched.applied = next
6002
+ this.labelFor.set(control.id)
5882
6003
  }
5883
6004
 
5884
- /** Puts back the attributes a patched control had before this field cloned it. */
5885
6005
  private unpatchNativeControl(): void {
5886
6006
  if (this.patched === null) return
5887
- const { control, attributes } = this.patched
6007
+ const { control, attributes, applied } = this.patched
5888
6008
  this.patched = null
5889
6009
  for (const name of PATCHED_ATTRIBUTES) {
6010
+ if (control.getAttribute(name) !== applied[name]) continue
5890
6011
  const value = attributes[name]
5891
6012
  if (value === null) control.removeAttribute(name)
5892
6013
  else control.setAttribute(name, value)
@@ -5900,7 +6021,7 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
5900
6021
  }
5901
6022
  ```
5902
6023
 
5903
- _(Member comments are shortened to their first sentence, and the 3 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/form-field.component.d.ts`.)_
6024
+ _(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/form-field.component.d.ts`.)_
5904
6025
 
5905
6026
  #### `Form`
5906
6027
 
@@ -6333,6 +6454,8 @@ DOM whenever React would render nothing (`setElementPresent`).
6333
6454
  'label',
6334
6455
  'error',
6335
6456
  'hint',
6457
+ 'externalDescription: aria-describedby',
6458
+ 'externalInvalid: aria-invalid',
6336
6459
  'leftElement',
6337
6460
  'rightElement',
6338
6461
  'clearable',
@@ -6380,7 +6503,9 @@ DOM whenever React would render nothing (`setElementPresent`).
6380
6503
  [attr.placeholder]="placeholder"
6381
6504
  [disabled]="disabled"
6382
6505
  [attr.required]="required ? '' : null"
6383
- [attr.aria-invalid]="error || fieldContext()?.invalid ? 'true' : 'false'"
6506
+ [attr.aria-invalid]="
6507
+ error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
6508
+ "
6384
6509
  [attr.aria-describedby]="mergedDescribedBy()"
6385
6510
  [class]="classes()"
6386
6511
  [attr.style]="hostStyle()"
@@ -6416,10 +6541,10 @@ DOM whenever React would render nothing (`setElementPresent`).
6416
6541
  </div>
6417
6542
  </div>
6418
6543
  @if (error) {
6419
- <p [attr.id]="inputId() + '-error'" [class]="cm().formError">{{ error }}</p>
6544
+ <p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
6420
6545
  }
6421
6546
  @if (hint && !error) {
6422
- <p [attr.id]="inputId() + '-hint'" [class]="cm().formHint">{{ hint }}</p>
6547
+ <p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
6423
6548
  }`,
6424
6549
  })
6425
6550
  export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
@@ -6450,7 +6575,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6450
6575
  onBlur?: FocusEventHandler
6451
6576
  onKeyDown?: KeyboardEventHandler
6452
6577
 
6453
- @Output() readonly change = new EventEmitter<Event>()
6578
+ @Output() readonly change = new EventEmitter<Event & KitFieldChangeEvent>()
6454
6579
  @Output() readonly valueChange = new EventEmitter<string>()
6455
6580
  @Output() readonly clear = new EventEmitter<Event>()
6456
6581
 
@@ -6467,7 +6592,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6467
6592
  @ViewChild('rightSlot') rightSlot?: ElementRef<HTMLDivElement>
6468
6593
  @ViewChild('rightInner') rightInner?: ElementRef<HTMLSpanElement>
6469
6594
 
6470
- private readonly host = inject(ElementRef)
6595
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
6471
6596
 
6472
6597
  private readonly hasLeft = signal(false)
6473
6598
  private readonly hasRight = signal(false)
@@ -6481,7 +6606,9 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6481
6606
  private readonly i18n = useTranslation()
6482
6607
 
6483
6608
  private movedRest = false
6484
- private restDescribedBy: string | null = null
6609
+ externalDescription?: string | null
6610
+ externalInvalid?: AriaBoolean
6611
+ protected readonly hostAria = new FieldHostAria()
6485
6612
  private externalMolId: string | undefined
6486
6613
 
6487
6614
  cm(): UIClassMap {
@@ -6493,23 +6620,25 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6493
6620
  }
6494
6621
 
6495
6622
  inputId(): string {
6496
- return this.id || this.fieldContext()?.id || this.name || this.generatedId
6623
+ const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
6624
+ return this.id || this.fieldContext()?.id || externalId || this.generatedId
6497
6625
  }
6498
6626
 
6499
6627
  describedBy(): string | null {
6500
- if (this.error) return `${this.inputId()}-error`
6501
- if (this.hint) return `${this.inputId()}-hint`
6502
- return null
6628
+ const id = this.fieldContext()?.id === this.inputId() ? this.generatedId : this.inputId()
6629
+ return this.error ? `${id}-error` : this.hint ? `${id}-hint` : null
6503
6630
  }
6504
6631
 
6505
6632
  fieldContext(): FormFieldContext | null {
6506
- return fieldContext(this.host.nativeElement as HTMLElement)
6633
+ return fieldContext(this.host.nativeElement)
6507
6634
  }
6508
6635
 
6509
6636
  mergedDescribedBy(): string | null {
6510
- const target = this.fieldContext()?.describedBy
6511
- if (target) return [this.restDescribedBy, target].filter(Boolean).join(' ')
6512
- return this.restDescribedBy ?? this.describedBy()
6637
+ return descriptionIds(
6638
+ this.externalDescription ?? this.hostAria.description(),
6639
+ this.fieldContext()?.describedBy,
6640
+ this.describedBy(),
6641
+ )
6513
6642
  }
6514
6643
 
6515
6644
  classes(): string {
@@ -6542,6 +6671,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6542
6671
  }
6543
6672
 
6544
6673
  handleInput(event: Event): void {
6674
+ if (!isFieldChangeEvent(event)) return
6545
6675
  event.stopPropagation()
6546
6676
  this.change.emit(event)
6547
6677
  const input = this.inputEl?.nativeElement
@@ -6573,10 +6703,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
6573
6703
  private syncAdornments(hasContent: SlotReader): void {
6574
6704
  const left = this.leftSlot?.nativeElement
6575
6705
  const right = this.rightSlot?.nativeElement
6576
- const inner =
6577
- this.rightInner?.nativeElement ??
6578
- (right ? (right.querySelector('span') as HTMLElement | null) : null) ??
6579
- undefined
6706
+ const inner = this.rightInner?.nativeElement ?? right?.querySelector('span') ?? undefined
6580
6707
  const hasLeft = this.isGiven(this.leftElement) || hasContent(left)
6581
6708
  const hasRight = this.isGiven(this.rightElement) || hasContent(inner)
6582
6709
  this.hasLeft.set(hasLeft)
@@ -6917,12 +7044,12 @@ export class Container implements HasElement<HTMLDivElement> {
6917
7044
  /** The element a caller's ref receives: the host `<div>`. */
6918
7045
  readonly element = hostElement(this.host)
6919
7046
 
6920
- /** Maximum width preset. */
6921
- maxWidth: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | string = 'lg'
7047
+ /** Maximum width preset or CSS length. */
7048
+ maxWidth: NonNullable<ContainerProps['maxWidth']> = 'lg'
6922
7049
  /** Whether the column is centered. */
6923
7050
  centered = true
6924
7051
  /** Horizontal padding (accepted for React parity, not rendered). */
6925
- paddingX?: unknown
7052
+ paddingX?: ContainerProps['paddingX']
6926
7053
  /** Extra classes. */
6927
7054
  className?: string
6928
7055
  /** Inline style object (React camelCase). */
@@ -6947,10 +7074,9 @@ export class Container implements HasElement<HTMLDivElement> {
6947
7074
  * @returns The class string.
6948
7075
  */
6949
7076
  classes(): string {
7077
+ const namedWidth = isContainerSize(this.maxWidth) ? this.maxWidth : undefined
6950
7078
  return this.cm().cn(
6951
- this.cm().container({
6952
- size: this.maxWidth as 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full',
6953
- }),
7079
+ this.cm().container(namedWidth ? { size: namedWidth } : undefined),
6954
7080
  this.centered && this.cm().mxAuto,
6955
7081
  this.className,
6956
7082
  )
@@ -6974,7 +7100,9 @@ export class Container implements HasElement<HTMLDivElement> {
6974
7100
  * @returns The style attribute text.
6975
7101
  */
6976
7102
  hostStyle(): string | null {
6977
- return styleText(this.style)
7103
+ const customWidth = !isContainerSize(this.maxWidth) && this.maxWidth ? this.maxWidth : undefined
7104
+ const merged = customWidth ? { maxWidth: customWidth, ...this.style } : this.style
7105
+ return styleText(merged)
6978
7106
  }
6979
7107
  }
6980
7108
  ```
@@ -7017,11 +7145,11 @@ export class Flex implements HasElement<HTMLDivElement> {
7017
7145
  /** Flex direction. */
7018
7146
  direction: 'row' | 'column' | 'row-reverse' | 'column-reverse' = 'row'
7019
7147
  /** Main-axis justification. */
7020
- justify?: string
7148
+ justify?: FlexProps['justify']
7021
7149
  /** Cross-axis alignment. */
7022
- align?: string
7150
+ align?: FlexProps['align']
7023
7151
  /** Wrapping behavior. */
7024
- wrap?: string
7152
+ wrap?: FlexProps['wrap']
7025
7153
  /** Gap (preset name, number in px, or any CSS value). */
7026
7154
  gap?: number | string
7027
7155
  /** Extra classes. */
@@ -7048,16 +7176,13 @@ export class Flex implements HasElement<HTMLDivElement> {
7048
7176
  * @returns The class string.
7049
7177
  */
7050
7178
  classes(): string {
7051
- const cmGap =
7052
- typeof this.gap === 'string' && GAP_NAMES.includes(this.gap)
7053
- ? (this.gap as 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl')
7054
- : undefined
7179
+ const cmGap = GAP_NAMES.find((name) => name === this.gap)
7055
7180
  return this.cm().cn(
7056
7181
  this.cm().flex({
7057
7182
  direction: DIRECTION_MAP[this.direction] || 'row',
7058
- align: this.align as never,
7059
- justify: this.justify as never,
7060
- wrap: this.wrap as never,
7183
+ align: this.align,
7184
+ justify: this.justify,
7185
+ wrap: this.wrap,
7061
7186
  gap: cmGap,
7062
7187
  }),
7063
7188
  this.className,
@@ -7085,7 +7210,7 @@ export class Flex implements HasElement<HTMLDivElement> {
7085
7210
  const gapStyle =
7086
7211
  typeof this.gap === 'number'
7087
7212
  ? { gap: this.gap }
7088
- : typeof this.gap === 'string' && !GAP_NAMES.includes(this.gap)
7213
+ : typeof this.gap === 'string' && !GAP_NAMES.some((name) => name === this.gap)
7089
7214
  ? { gap: this.gap }
7090
7215
  : undefined
7091
7216
  return styleText({ ...this.style, ...gapStyle })
@@ -7163,10 +7288,7 @@ export class Grid implements HasElement<HTMLDivElement> {
7163
7288
  * @returns The class string.
7164
7289
  */
7165
7290
  classes(): string {
7166
- const cmGap =
7167
- typeof this.gap === 'string' && GAP_NAMES.includes(this.gap)
7168
- ? (this.gap as 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl')
7169
- : undefined
7291
+ const cmGap = GAP_NAMES.find((name) => name === this.gap)
7170
7292
  return this.cm().cn(
7171
7293
  this.cm().grid({
7172
7294
  cols: typeof this.columns === 'number' ? this.columns : undefined,
@@ -7201,7 +7323,7 @@ export class Grid implements HasElement<HTMLDivElement> {
7201
7323
  if (typeof this.rows === 'string') own.gridTemplateRows = this.rows
7202
7324
  if (
7203
7325
  typeof this.gap === 'number' ||
7204
- (typeof this.gap === 'string' && !GAP_NAMES.includes(this.gap))
7326
+ (typeof this.gap === 'string' && !GAP_NAMES.some((name) => name === this.gap))
7205
7327
  )
7206
7328
  own.gap = this.gap
7207
7329
  if (typeof this.columnGap === 'number' || typeof this.columnGap === 'string')
@@ -7290,7 +7412,7 @@ export class Spacer implements HasElement<HTMLDivElement> {
7290
7412
  * @returns True for preset names.
7291
7413
  */
7292
7414
  get isNamedSize(): boolean {
7293
- return typeof this.size === 'string' && SPACER_SIZES.includes(this.size)
7415
+ return SPACER_SIZES.some((name) => name === this.size)
7294
7416
  }
7295
7417
 
7296
7418
  /**
@@ -7298,10 +7420,11 @@ export class Spacer implements HasElement<HTMLDivElement> {
7298
7420
  * @returns The class string.
7299
7421
  */
7300
7422
  classes(): string {
7423
+ const namedSize = SPACER_SIZES.find((name) => name === this.size)
7301
7424
  return this.cm().cn(
7302
- this.isNamedSize
7425
+ namedSize
7303
7426
  ? this.cm().spacer({
7304
- size: this.size as 'xs' | 'sm' | 'md' | 'lg' | 'xl',
7427
+ size: namedSize,
7305
7428
  horizontal: !!this.horizontal,
7306
7429
  })
7307
7430
  : this.horizontal
@@ -8260,6 +8383,7 @@ Angular Input UI component with UIClassMap-driven styling.
8260
8383
  selector: 'mol-input',
8261
8384
  standalone: true,
8262
8385
  changeDetection: ChangeDetectionStrategy.OnPush,
8386
+ host: { '[attr.id]': 'null' },
8263
8387
  template: `
8264
8388
  <div [class]="field.root">
8265
8389
  @if (label) {
@@ -8286,8 +8410,8 @@ Angular Input UI component with UIClassMap-driven styling.
8286
8410
  [attr.minlength]="minLength"
8287
8411
  [attr.pattern]="pattern"
8288
8412
  [attr.autocomplete]="autoComplete"
8289
- (input)="handleInput.emit($event)"
8290
- (change)="handleChange.emit($event)"
8413
+ (input)="emitFieldEvent(handleInput, $event)"
8414
+ (change)="emitFieldEvent(handleChange, $event)"
8291
8415
  (focus)="handleFocus.emit($event)"
8292
8416
  (blur)="handleBlur.emit($event)"
8293
8417
  />
@@ -8344,12 +8468,19 @@ export class MoleculeInput {
8344
8468
  @Input() pattern?: string
8345
8469
  @Input() autoComplete?: string
8346
8470
 
8347
- @Output() handleInput = new EventEmitter<Event>()
8348
- @Output() handleChange = new EventEmitter<Event>()
8471
+ private readonly generatedId = nextInstanceId()
8472
+
8473
+ @Output() handleInput = new EventEmitter<Event & KitFieldChangeEvent>()
8474
+ @Output() handleChange = new EventEmitter<Event & KitFieldChangeEvent>()
8349
8475
  @Output() handleFocus = new EventEmitter<FocusEvent>()
8350
8476
  @Output() handleBlur = new EventEmitter<FocusEvent>()
8351
8477
  @Output() handleClear = new EventEmitter<void>()
8352
8478
 
8479
+ /** Delivers the native event while its field targets are available. */
8480
+ emitFieldEvent(output: EventEmitter<Event & KitFieldChangeEvent>, event: Event): void {
8481
+ if (isFieldChangeEvent(event)) output.emit(event)
8482
+ }
8483
+
8353
8484
  /**
8354
8485
  * Reactive translation, read in the injection context. Its `t` reads the
8355
8486
  * locale, so the view re-renders the text on a locale switch (the static `t`
@@ -8400,10 +8531,10 @@ export class MoleculeInput {
8400
8531
 
8401
8532
  /**
8402
8533
  * Resolves the input element ID.
8403
- * @returns The resolved ID from the id or name input.
8534
+ * @returns The explicit id or this instance's stable fallback.
8404
8535
  */
8405
8536
  get inputId(): string {
8406
- return this.id || this.name || ''
8537
+ return this.id || this.generatedId
8407
8538
  }
8408
8539
 
8409
8540
  /**
@@ -8467,9 +8598,11 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
8467
8598
  <div [class]="wrapperClass" [style]="wrapperStyle" (click)="onOverlayClick($event)">
8468
8599
  <!-- Content -->
8469
8600
  <div
8601
+ #dialog
8470
8602
  role="dialog"
8603
+ tabindex="-1"
8471
8604
  aria-modal="true"
8472
- [attr.aria-labelledby]="title ? 'modal-title' : null"
8605
+ [attr.aria-labelledby]="title ? titleId : null"
8473
8606
  [class]="contentClasses"
8474
8607
  [style]="style"
8475
8608
  [attr.data-testid]="testId"
@@ -8478,7 +8611,7 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
8478
8611
  @if (title || showCloseButton) {
8479
8612
  <div [class]="headerClass">
8480
8613
  @if (title) {
8481
- <h2 id="modal-title" [class]="titleClass">{{ title }}</h2>
8614
+ <h2 [id]="titleId" [class]="titleClass">{{ title }}</h2>
8482
8615
  } @else if (showCloseButton) {
8483
8616
  <div></div>
8484
8617
  }
@@ -8513,7 +8646,7 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
8513
8646
  * Molecule Modal class.
8514
8647
  * @deprecated Use the React-named component `Modal` instead.
8515
8648
  */
8516
- export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
8649
+ export class MoleculeModal implements AfterViewChecked, OnDestroy {
8517
8650
  @Input() open = false
8518
8651
  @Input() title?: string
8519
8652
  @Input() size: ModalSize = 'md'
@@ -8553,7 +8686,11 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
8553
8686
  return this.closeLabel || this.i18n.t('ui.modal.close', undefined, { defaultValue: 'Close' })
8554
8687
  }
8555
8688
 
8556
- private boundEscapeHandler = this.handleEscape.bind(this)
8689
+ /** Unique heading for this dialog. */
8690
+ readonly titleId = nextInstanceId()
8691
+ @ViewChild('dialog') private dialog?: ElementRef<HTMLDivElement>
8692
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
8693
+ private readonly layer = new OverlayLayer()
8557
8694
 
8558
8695
  /**
8559
8696
  * Retrieves the CSS class for the modal wrapper.
@@ -8637,62 +8774,29 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
8637
8774
  return this.cm.cn(this.cm.modal({ size: this.size }), this.className)
8638
8775
  }
8639
8776
 
8640
- /**
8641
- * Initializes event listeners on component creation.
8642
- */
8643
- ngOnInit(): void {
8644
- this.updateListeners()
8645
- }
8646
-
8647
- /**
8648
- * Handles input property changes.
8649
- * @param changes - The changed input properties.
8650
- */
8651
- ngOnChanges(changes: SimpleChanges): void {
8652
- if (changes['open']) {
8653
- this.updateListeners()
8654
- this.updateBodyScroll()
8777
+ /** Registers the rendered dialog with the document's shared focus and dismissal stack. */
8778
+ ngAfterViewChecked(): void {
8779
+ if (!this.browser || !this.dialog) {
8780
+ this.layer.release()
8781
+ return
8655
8782
  }
8783
+ this.layer.sync({
8784
+ open: this.open,
8785
+ kind: 'modal',
8786
+ surface: { current: this.dialog.nativeElement },
8787
+ dismissKey: this.closeOnEscape,
8788
+ dismissBackdrop: this.closeOnOverlayClick,
8789
+ focus: { trap: true, restore: 'opener' },
8790
+ lockScroll: this.preventScroll,
8791
+ onDismiss: () => this.close.emit(),
8792
+ })
8656
8793
  }
8657
8794
 
8658
8795
  /**
8659
8796
  * Cleans up event listeners and body scroll on component destruction.
8660
8797
  */
8661
8798
  ngOnDestroy(): void {
8662
- document.removeEventListener('keydown', this.boundEscapeHandler)
8663
- if (this.preventScroll) {
8664
- document.body.style.overflow = ''
8665
- }
8666
- }
8667
-
8668
- /**
8669
- * Adds or removes the keyboard escape listener based on open state.
8670
- */
8671
- private updateListeners(): void {
8672
- if (this.open) {
8673
- document.addEventListener('keydown', this.boundEscapeHandler)
8674
- } else {
8675
- document.removeEventListener('keydown', this.boundEscapeHandler)
8676
- }
8677
- }
8678
-
8679
- /**
8680
- * Updates the document body overflow based on open state.
8681
- */
8682
- private updateBodyScroll(): void {
8683
- if (this.preventScroll) {
8684
- document.body.style.overflow = this.open ? 'hidden' : ''
8685
- }
8686
- }
8687
-
8688
- /**
8689
- * Handles escape key press to close the modal.
8690
- * @param e - The keyboard event.
8691
- */
8692
- private handleEscape(e: KeyboardEvent): void {
8693
- if (this.closeOnEscape && e.key === 'Escape') {
8694
- this.close.emit()
8695
- }
8799
+ this.layer.release()
8696
8800
  }
8697
8801
 
8698
8802
  /**
@@ -8700,9 +8804,7 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
8700
8804
  * @param event - The mouse event from the overlay click.
8701
8805
  */
8702
8806
  onOverlayClick(event: MouseEvent): void {
8703
- if (this.closeOnOverlayClick && event.target === event.currentTarget) {
8704
- this.close.emit()
8705
- }
8807
+ if (event.target === event.currentTarget) this.layer.dismissBackdrop()
8706
8808
  }
8707
8809
  }
8708
8810
  ```
@@ -8837,6 +8939,7 @@ Angular Select UI component with UIClassMap-driven styling.
8837
8939
  selector: 'mol-select',
8838
8940
  standalone: true,
8839
8941
  changeDetection: ChangeDetectionStrategy.OnPush,
8942
+ host: { '[attr.id]': 'null' },
8840
8943
  template: `
8841
8944
  <div [class]="field.root">
8842
8945
  @if (label) {
@@ -8904,7 +9007,9 @@ export class MoleculeSelect {
8904
9007
  @Input() id?: string
8905
9008
 
8906
9009
  @Output() valueChange = new EventEmitter<string>()
8907
- @Output() handleChange = new EventEmitter<Event>()
9010
+ @Output() handleChange = new EventEmitter<Event & KitFieldChangeEvent>()
9011
+
9012
+ private readonly generatedId = nextInstanceId()
8908
9013
 
8909
9014
  /**
8910
9015
  * Retrieves the current UI class map.
@@ -8941,10 +9046,10 @@ export class MoleculeSelect {
8941
9046
 
8942
9047
  /**
8943
9048
  * Resolves the select element ID.
8944
- * @returns The resolved ID from the id or name input.
9049
+ * @returns The explicit id or this instance's stable fallback.
8945
9050
  */
8946
9051
  get selectId(): string {
8947
- return this.id || this.name || ''
9052
+ return this.id || this.generatedId
8948
9053
  }
8949
9054
 
8950
9055
  /**
@@ -8982,9 +9087,9 @@ export class MoleculeSelect {
8982
9087
  * @param event - The change event from the select element.
8983
9088
  */
8984
9089
  onSelectChange(event: Event): void {
8985
- const target = event.target as HTMLSelectElement
9090
+ if (!isFieldChangeEvent(event)) return
8986
9091
  this.handleChange.emit(event)
8987
- this.valueChange.emit(target.value)
9092
+ this.valueChange.emit(event.target.value)
8988
9093
  }
8989
9094
  }
8990
9095
  ```
@@ -10753,7 +10858,7 @@ export class PromptDialog implements AfterViewInit, DoCheck {
10753
10858
  /** Whether a node-valued prop renders anything. */
10754
10859
  readonly rendersNode = rendersNode
10755
10860
 
10756
- @Output() readonly close = new EventEmitter<unknown>()
10861
+ @Output() readonly close = new EventEmitter<MouseEvent | undefined>()
10757
10862
 
10758
10863
  @ViewChild('titleSlot') titleSlot?: ElementRef<HTMLHeadingElement>
10759
10864
  @ViewChild(Input) inputComponent?: Input
@@ -10853,8 +10958,8 @@ export class PromptDialog implements AfterViewInit, DoCheck {
10853
10958
  else input.setAttribute('aria-label', label)
10854
10959
  }
10855
10960
 
10856
- onInput(event: Event): void {
10857
- this.value.set((event.target as HTMLInputElement).value)
10961
+ onInput(event: KitFieldChangeEvent): void {
10962
+ this.value.set(event.target.value)
10858
10963
  }
10859
10964
 
10860
10965
  onModalClose(): void {
@@ -10953,7 +11058,7 @@ export class RadioGroup implements HasElement<HTMLDivElement> {
10953
11058
  /** The selected option value. */
10954
11059
  value?: string
10955
11060
  /** Group size (kept for prop parity). */
10956
- size?: unknown
11061
+ size?: Size
10957
11062
  /** Group label. */
10958
11063
  label?: string
10959
11064
  /** Native radio group name (defaults to a stable generated name). */
@@ -11041,11 +11146,11 @@ export class RadioGroup implements HasElement<HTMLDivElement> {
11041
11146
  */
11042
11147
  select(event: Event): void {
11043
11148
  event.stopPropagation()
11044
- this.change.emit((event.target as HTMLInputElement).value)
11149
+ if (!(event.target instanceof HTMLInputElement)) return
11150
+ this.change.emit(event.target.value)
11045
11151
  // React always controls radios (checked={value === option.value}); restore.
11046
- const radios = (this.host.nativeElement as HTMLElement).querySelectorAll('input[type="radio"]')
11047
- for (const radio of Array.from(radios) as HTMLInputElement[])
11048
- radio.checked = this.value === radio.value
11152
+ const radios = this.host.nativeElement.querySelectorAll<HTMLInputElement>('input[type="radio"]')
11153
+ for (const radio of Array.from(radios)) radio.checked = this.value === radio.value
11049
11154
  }
11050
11155
 
11051
11156
  /** Fires the selected option's value. */
@@ -11872,6 +11977,8 @@ controlled-input state restore.
11872
11977
  'placeholder',
11873
11978
  'error',
11874
11979
  'hint',
11980
+ 'externalDescription: aria-describedby',
11981
+ 'externalInvalid: aria-invalid',
11875
11982
  'clearable',
11876
11983
  'className',
11877
11984
  'style',
@@ -11902,7 +12009,9 @@ controlled-input state restore.
11902
12009
  [attr.name]="name"
11903
12010
  [disabled]="disabled"
11904
12011
  [attr.required]="required ? '' : null"
11905
- [attr.aria-invalid]="error || fieldContext()?.invalid ? 'true' : 'false'"
12012
+ [attr.aria-invalid]="
12013
+ error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
12014
+ "
11906
12015
  [attr.aria-describedby]="mergedDescribedBy()"
11907
12016
  [class]="classes()"
11908
12017
  [attr.style]="hostStyle()"
@@ -11943,10 +12052,10 @@ controlled-input state restore.
11943
12052
  </div>
11944
12053
  </div>
11945
12054
  @if (error) {
11946
- <p [attr.id]="selectId() + '-error'" [class]="cm().formError">{{ error }}</p>
12055
+ <p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
11947
12056
  }
11948
12057
  @if (hint && !error) {
11949
- <p [attr.id]="selectId() + '-hint'" [class]="cm().formHint">{{ hint }}</p>
12058
+ <p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
11950
12059
  }`,
11951
12060
  })
11952
12061
  export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLSelectElement> {
@@ -11954,7 +12063,6 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11954
12063
  options?: SelectPropsOption[]
11955
12064
  /** Controlled value. */
11956
12065
  value?: string
11957
- /** Uncontrolled initial value. */
11958
12066
  defaultValue?: string
11959
12067
  /** Select size. */
11960
12068
  size?: Size
@@ -11962,12 +12070,10 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11962
12070
  label?: string
11963
12071
  placeholder?: string
11964
12072
  error?: string
11965
- /** Hint text (shown without an error). */
11966
12073
  hint?: string
11967
12074
  clearable?: boolean
11968
12075
  className?: string
11969
12076
  style?: Record<string, unknown>
11970
- /** `data-testid` for the select. */
11971
12077
  testId?: string
11972
12078
  /** Disables the select. */
11973
12079
  disabled?: boolean
@@ -11983,8 +12089,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11983
12089
  onBlur?: FocusEventHandler
11984
12090
  onKeyDown?: KeyboardEventHandler
11985
12091
 
11986
- @Output() readonly change = new EventEmitter<Event>()
11987
- /** Fires the selected option's value. */
12092
+ @Output() readonly change = new EventEmitter<Event & KitFieldChangeEvent>()
11988
12093
  @Output() readonly valueChange = new EventEmitter<string>()
11989
12094
 
11990
12095
  private selectEl?: ElementRef<HTMLSelectElement>
@@ -11997,14 +12102,15 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
11997
12102
  private readonly inner = signal<HTMLSelectElement | null>(null)
11998
12103
  readonly element = this.inner.asReadonly()
11999
12104
 
12000
- private readonly host = inject(ElementRef)
12105
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
12001
12106
 
12002
12107
  private readonly generatedId = nextInstanceId()
12003
12108
 
12004
12109
  private readonly i18n = useTranslation()
12005
12110
 
12006
- private restDescribedBy: string | null = null
12007
- private restDescribedByCaptured = false
12111
+ externalDescription?: string | null
12112
+ externalInvalid?: AriaBoolean
12113
+ protected readonly hostAria = new FieldHostAria()
12008
12114
  private externalMolId: string | undefined
12009
12115
 
12010
12116
  /** The current class map. */
@@ -12017,25 +12123,26 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12017
12123
  }
12018
12124
 
12019
12125
  selectId(): string {
12020
- return this.id || this.fieldContext()?.id || this.name || this.generatedId
12126
+ const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
12127
+ return this.id || this.fieldContext()?.id || externalId || this.generatedId
12021
12128
  }
12022
12129
 
12023
12130
  describedBy(): string | null {
12024
- if (this.error) return `${this.selectId()}-error`
12025
- if (this.hint) return `${this.selectId()}-hint`
12026
- return null
12131
+ const id = this.fieldContext()?.id === this.selectId() ? this.generatedId : this.selectId()
12132
+ return this.error ? `${id}-error` : this.hint ? `${id}-hint` : null
12027
12133
  }
12028
12134
  fieldContext(): FormFieldContext | null {
12029
- return fieldContext(this.host.nativeElement as HTMLElement)
12135
+ return fieldContext(this.host.nativeElement)
12030
12136
  }
12031
12137
 
12032
12138
  mergedDescribedBy(): string | null {
12033
- const target = this.fieldContext()?.describedBy
12034
- if (target) return [this.restDescribedBy, target].filter(Boolean).join(' ')
12035
- return this.restDescribedBy ?? this.describedBy()
12139
+ return descriptionIds(
12140
+ this.externalDescription ?? this.hostAria.description(),
12141
+ this.fieldContext()?.describedBy,
12142
+ this.describedBy(),
12143
+ )
12036
12144
  }
12037
12145
 
12038
- /** Computes the select class list. */
12039
12146
  classes(): string {
12040
12147
  return this.cm().cn(
12041
12148
  this.cm().select({ error: !!this.error, size: this.size ?? 'md' }),
@@ -12059,8 +12166,8 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12059
12166
  for (const option of this.options ?? []) {
12060
12167
  const group = option.group || ''
12061
12168
  const list = acc.get(group)
12062
- if (list) list.push(option as SelectPropsOption)
12063
- else acc.set(group, [option as SelectPropsOption])
12169
+ if (list) list.push(option)
12170
+ else acc.set(group, [option])
12064
12171
  }
12065
12172
  return [...acc.entries()].map(([group, options]) => ({ group, options }))
12066
12173
  }
@@ -12074,17 +12181,18 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12074
12181
  }
12075
12182
 
12076
12183
  handleChange(event: Event): void {
12184
+ if (!isFieldChangeEvent(event)) return
12077
12185
  event.stopPropagation()
12078
12186
  this.change.emit(event)
12079
- this.valueChange.emit((event.target as HTMLSelectElement).value)
12187
+ this.valueChange.emit(event.target.value)
12080
12188
  this.applyValue(false)
12081
12189
  }
12082
12190
 
12191
+ ngDoCheck(): void {
12192
+ this.hostAria.read(this.host.nativeElement)
12193
+ }
12194
+
12083
12195
  ngAfterViewInit(): void {
12084
- if (!this.restDescribedByCaptured) {
12085
- this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby')
12086
- this.restDescribedByCaptured = true
12087
- }
12088
12196
  adoptHostDataMolId(
12089
12197
  this.host.nativeElement,
12090
12198
  this.selectEl?.nativeElement,
@@ -12093,7 +12201,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12093
12201
  },
12094
12202
  () => this.molId(),
12095
12203
  )
12096
- moveRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement)
12204
+ moveRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement, true)
12097
12205
  this.applyValue(true)
12098
12206
  }
12099
12207
 
@@ -12107,7 +12215,9 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12107
12215
  },
12108
12216
  () => this.molId(),
12109
12217
  )
12110
- reapplyRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement)
12218
+ reapplyRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement, {
12219
+ keepInvalid: true,
12220
+ })
12111
12221
  this.applyValue(false)
12112
12222
  }
12113
12223
 
@@ -12134,7 +12244,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
12134
12244
  }
12135
12245
  ```
12136
12246
 
12137
- _(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`.)_
12247
+ _(Member comments are shortened to their first sentence, and the 45 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/select.component.d.ts`.)_
12138
12248
 
12139
12249
  #### `Separator`
12140
12250
 
@@ -12801,9 +12911,7 @@ export class Spinner implements HasElement<HTMLDivElement> {
12801
12911
  */
12802
12912
  hostStyle(): string | null {
12803
12913
  const colorStyle =
12804
- this.color &&
12805
- typeof this.color === 'string' &&
12806
- !NAMED_COLORS.includes(this.color as (typeof NAMED_COLORS)[number])
12914
+ this.color && typeof this.color === 'string' && !NAMED_COLORS.includes(this.color)
12807
12915
  ? { borderColor: this.color, borderTopColor: 'transparent' }
12808
12916
  : undefined
12809
12917
  return styleText({ ...this.style, ...colorStyle })
@@ -13153,7 +13261,7 @@ or plain functions returning text.
13153
13261
  [molTemplateOutletContext]="cellContext(row, column, rowIdx)"
13154
13262
  ></ng-container>
13155
13263
  } @else {
13156
- {{ renderText(row, column, $index) }}
13264
+ {{ renderText(row, column, rowIdx) }}
13157
13265
  }
13158
13266
  } @else {
13159
13267
  {{ cellText(row, column) }}
@@ -13168,12 +13276,12 @@ or plain functions returning text.
13168
13276
  })
13169
13277
  export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTableElement> {
13170
13278
  data: Record<string, unknown>[] = []
13171
- columns: TableColumn<Record<string, unknown>>[] = []
13279
+ columns: AngularTableColumn[] = []
13172
13280
  rowKey?: string | ((row: Record<string, unknown>) => string | number)
13173
13281
  bordered?: boolean
13174
13282
  striped?: boolean
13175
13283
  hoverable = true
13176
- size?: string
13284
+ size?: Size
13177
13285
  emptyContent?: unknown
13178
13286
  loading?: boolean
13179
13287
  sort?: { key: string; direction: 'asc' | 'desc' }
@@ -13225,7 +13333,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
13225
13333
  return this.automationId ?? this.dataMolId ?? this.externalMolId
13226
13334
  }
13227
13335
 
13228
- headClasses(column: TableColumn<Record<string, unknown>>): string {
13336
+ headClasses(column: AngularTableColumn): string {
13229
13337
  return this.cm().cn(
13230
13338
  this.cm().tableHead,
13231
13339
  column.align === 'center' && this.cm().textCenter,
@@ -13234,11 +13342,11 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
13234
13342
  )
13235
13343
  }
13236
13344
 
13237
- columnStyle(column: TableColumn<Record<string, unknown>>): string | null {
13345
+ columnStyle(column: AngularTableColumn): string | null {
13238
13346
  return styleText({ width: column.width })
13239
13347
  }
13240
13348
 
13241
- cellClasses(column: TableColumn<Record<string, unknown>>): string {
13349
+ cellClasses(column: AngularTableColumn): string {
13242
13350
  return this.cm().cn(
13243
13351
  this.cm().tableCell,
13244
13352
  column.align === 'center' && this.cm().textCenter,
@@ -13255,7 +13363,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
13255
13363
  )
13256
13364
  }
13257
13365
 
13258
- ariaSort(column: TableColumn<Record<string, unknown>>): string | null {
13366
+ ariaSort(column: AngularTableColumn): string | null {
13259
13367
  if (!column.sortable) return null
13260
13368
  if (this.sort?.key !== column.key) return 'none'
13261
13369
  return this.sort.direction === 'asc' ? 'ascending' : 'descending'
@@ -13273,7 +13381,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
13273
13381
  }
13274
13382
 
13275
13383
  nodeText(value: unknown): string {
13276
- return typeof value === 'string' ? value : ''
13384
+ return nodeText(value)
13277
13385
  }
13278
13386
 
13279
13387
  asTemplate(value: unknown): TemplateRef<unknown> | null {
@@ -13282,43 +13390,41 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
13282
13390
 
13283
13391
  rowKeyOf(row: Record<string, unknown>, index: number): string | number {
13284
13392
  if (typeof this.rowKey === 'function') return this.rowKey(row)
13285
- if (this.rowKey && row[this.rowKey] !== undefined) return row[this.rowKey] as string | number
13286
- return index
13393
+ const key = this.rowKey ? row[this.rowKey] : undefined
13394
+ return typeof key === 'string' || typeof key === 'number' ? key : index
13287
13395
  }
13288
13396
 
13289
13397
  cellContext(
13290
13398
  row: Record<string, unknown>,
13291
- column: TableColumn<Record<string, unknown>>,
13399
+ column: AngularTableColumn,
13292
13400
  index: number,
13293
13401
  ): Record<string, unknown> {
13294
- const value = row[column.key as string]
13402
+ const value = row[column.key]
13295
13403
  return { $implicit: value, a0: value, a1: row, a2: index }
13296
13404
  }
13297
13405
 
13298
- renderText(
13299
- row: Record<string, unknown>,
13300
- column: TableColumn<Record<string, unknown>>,
13301
- index: number,
13302
- ): string {
13303
- const render = column.render as unknown
13406
+ renderText(row: Record<string, unknown>, column: AngularTableColumn, index: number): string {
13407
+ const render = column.render
13304
13408
  if (typeof render !== 'function') return ''
13305
- const value = row[column.key as string]
13306
- const result = (render as (v: unknown, r: unknown, i: number) => unknown)(value, row, index)
13307
- return typeof result === 'string' ? result : ''
13409
+ return this.nodeText(render(row[column.key], row, index))
13308
13410
  }
13309
13411
 
13310
- cellText(row: Record<string, unknown>, column: TableColumn<Record<string, unknown>>): string {
13311
- const value = row[column.key as string]
13412
+ cellText(row: Record<string, unknown>, column: AngularTableColumn): string {
13413
+ const value = row[column.key]
13312
13414
  return value === undefined || value === null ? '' : String(value)
13313
13415
  }
13314
13416
 
13315
- handleSort(column: TableColumn<Record<string, unknown>>): void {
13417
+ handleSort(column: AngularTableColumn): void {
13316
13418
  if (!column.sortable || !this.onSort) return
13317
- const key = column.key as string
13419
+ const key = column.key
13318
13420
  const currentDirection = this.sort?.key === key ? this.sort.direction : undefined
13319
13421
  this.onSort(key, currentDirection === 'asc' ? 'desc' : 'asc')
13320
13422
  }
13321
- // … truncated — 6 more members: handleRowClick, ngAfterViewInit, ngAfterViewChecked, ngDoCheck, reconcile, placeEmptyContent; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/table.component.d.ts
13423
+
13424
+ handleRowClick(row: Record<string, unknown>, index: number): void {
13425
+ this.onRowClick?.(row, index)
13426
+ }
13427
+ // … truncated — 5 more members: ngAfterViewInit, ngAfterViewChecked, ngDoCheck, reconcile, placeEmptyContent; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/table.component.d.ts
13322
13428
  ```
13323
13429
 
13324
13430
  _(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/table.component.d.ts`.)_
@@ -13457,13 +13563,16 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13457
13563
  return getClassMap()
13458
13564
  }
13459
13565
 
13566
+ /** Seeds the uncontrolled selection once so reordering tabs preserves it. */
13460
13567
  ngOnInit(): void {
13461
- this.internalValue.set(this.defaultValue || this.items[0]?.value)
13568
+ this.internalValue.set(this.defaultValue ?? this.items.find((item) => !item.disabled)?.value)
13462
13569
  }
13463
13570
 
13464
13571
  activeValue(): string | undefined {
13465
- if (this.value !== undefined) return this.value
13466
- return this.internalValue()
13572
+ const selected = this.value ?? this.internalValue()
13573
+ return this.items.some((item) => item.value === selected && !item.disabled)
13574
+ ? selected
13575
+ : this.items.find((item) => !item.disabled)?.value
13467
13576
  }
13468
13577
 
13469
13578
  /** The tab button id for a value. */
@@ -13477,7 +13586,9 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13477
13586
  }
13478
13587
 
13479
13588
  controlsId(item: TabItem<string>): string | null {
13480
- return item.value === this.activeValue() && !!item.content ? this.panelId(item.value) : null
13589
+ return item.value === this.activeValue() && rendersNode(item.content)
13590
+ ? this.panelId(item.value)
13591
+ : null
13481
13592
  }
13482
13593
 
13483
13594
  /** The tab-list class list. */
@@ -13506,7 +13617,6 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13506
13617
  return styleText(this.style)
13507
13618
  }
13508
13619
 
13509
- /** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
13510
13620
  molId(): string | undefined {
13511
13621
  return (
13512
13622
  this.automationId ??
@@ -13523,13 +13633,12 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13523
13633
 
13524
13634
  /** A plain-string node value's text. */
13525
13635
  nodeText(value: unknown): string {
13526
- return typeof value === 'string' ? value : ''
13636
+ return nodeText(value)
13527
13637
  }
13528
13638
 
13529
- /** Whether the active tab has content (React renders no panel without it). */
13530
13639
  hasContent(): boolean {
13531
13640
  const active = this.items.find((item) => item.value === this.activeValue())
13532
- return !!active?.content
13641
+ return rendersNode(active?.content)
13533
13642
  }
13534
13643
 
13535
13644
  /** The active tab's content as a template. */
@@ -13580,7 +13689,6 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13580
13689
  this.focusTab(nextValue)
13581
13690
  }
13582
13691
 
13583
- /** Moves focus to the tab with the given value (React's `tabRefs.focus()`). */
13584
13692
  private focusTab(value: string): void {
13585
13693
  const match = this.tabButtons?.find((ref) => ref.nativeElement.id === this.tabId(value))
13586
13694
  match?.nativeElement.focus()
@@ -13588,7 +13696,7 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
13588
13696
  }
13589
13697
  ```
13590
13698
 
13591
- _(Member comments are shortened to their first sentence, and the 4 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/tabs.component.d.ts`.)_
13699
+ _(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/tabs.component.d.ts`.)_
13592
13700
 
13593
13701
  #### `Textarea`
13594
13702
 
@@ -13610,6 +13718,8 @@ user input exactly like React's controlled-input state restore.
13610
13718
  'label',
13611
13719
  'error',
13612
13720
  'hint',
13721
+ 'externalDescription: aria-describedby',
13722
+ 'externalInvalid: aria-invalid',
13613
13723
  'autoResize',
13614
13724
  'minRows',
13615
13725
  'maxRows',
@@ -13647,7 +13757,9 @@ user input exactly like React's controlled-input state restore.
13647
13757
  [disabled]="disabled"
13648
13758
  [attr.required]="required ? '' : null"
13649
13759
  [attr.rows]="rows || minRows || 3"
13650
- [attr.aria-invalid]="error || fieldContext()?.invalid ? 'true' : 'false'"
13760
+ [attr.aria-invalid]="
13761
+ error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
13762
+ "
13651
13763
  [attr.aria-describedby]="mergedDescribedBy()"
13652
13764
  [class]="classes()"
13653
13765
  [attr.style]="hostStyle()"
@@ -13661,10 +13773,10 @@ user input exactly like React's controlled-input state restore.
13661
13773
  #textareaEl
13662
13774
  ></textarea>
13663
13775
  @if (error) {
13664
- <p [attr.id]="textareaId() + '-error'" [class]="cm().formError">{{ error }}</p>
13776
+ <p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
13665
13777
  }
13666
13778
  @if (hint && !error) {
13667
- <p [attr.id]="textareaId() + '-hint'" [class]="cm().formHint">{{ hint }}</p>
13779
+ <p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
13668
13780
  }`,
13669
13781
  })
13670
13782
  export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTMLTextAreaElement> {
@@ -13713,7 +13825,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13713
13825
  onKeyDown?: KeyboardEventHandler
13714
13826
 
13715
13827
  /** Fires the raw `input` event (React's textarea onChange). */
13716
- @Output() readonly change = new EventEmitter<Event>()
13828
+ @Output() readonly change = new EventEmitter<Event & KitFieldChangeEvent>()
13717
13829
  /** Fires with the edited text. */
13718
13830
  @Output() readonly valueChange = new EventEmitter<string>()
13719
13831
 
@@ -13726,19 +13838,20 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13726
13838
  }
13727
13839
 
13728
13840
  private readonly inner = signal<HTMLTextAreaElement | null>(null)
13729
- /** The element a caller's ref receives: the native `<textarea>`. */
13730
13841
  readonly element = this.inner.asReadonly()
13731
13842
 
13732
- private readonly host = inject(ElementRef)
13843
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
13733
13844
 
13845
+ /** Stable fallback for label and feedback associations. */
13734
13846
  private readonly generatedId = nextInstanceId()
13735
13847
 
13736
13848
  /** Reactive translation, read in the injection context. */
13737
13849
  private readonly i18n = useTranslation()
13738
13850
 
13739
- private restDescribedBy: string | null = null
13740
- /** Whether the rest-describedby value was captured. */
13741
- private restDescribedByCaptured = false
13851
+ /** Additional description ids supplied by the caller. */
13852
+ externalDescription?: string | null
13853
+ externalInvalid?: AriaBoolean
13854
+ protected readonly hostAria = new FieldHostAria()
13742
13855
  private externalMolId: string | undefined
13743
13856
 
13744
13857
  /** The current class map. */
@@ -13751,24 +13864,25 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13751
13864
  }
13752
13865
 
13753
13866
  textareaId(): string {
13754
- return this.id || this.fieldContext()?.id || this.name || this.generatedId
13867
+ const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
13868
+ return this.id || this.fieldContext()?.id || externalId || this.generatedId
13755
13869
  }
13756
13870
 
13757
13871
  /** The aria-describedby target (error or hint paragraph). */
13758
13872
  describedBy(): string | null {
13759
- if (this.error) return `${this.textareaId()}-error`
13760
- if (this.hint) return `${this.textareaId()}-hint`
13761
- return null
13873
+ const id = this.fieldContext()?.id === this.textareaId() ? this.generatedId : this.textareaId()
13874
+ return this.error ? `${id}-error` : this.hint ? `${id}-hint` : null
13762
13875
  }
13763
- /** The nearest enclosing `FormField` context (React's cloned props). */
13764
13876
  fieldContext(): FormFieldContext | null {
13765
- return fieldContext(this.host.nativeElement as HTMLElement)
13877
+ return fieldContext(this.host.nativeElement)
13766
13878
  }
13767
13879
 
13768
13880
  mergedDescribedBy(): string | null {
13769
- const target = this.fieldContext()?.describedBy
13770
- if (target) return [this.restDescribedBy, target].filter(Boolean).join(' ')
13771
- return this.restDescribedBy ?? this.describedBy()
13881
+ return descriptionIds(
13882
+ this.externalDescription ?? this.hostAria.description(),
13883
+ this.fieldContext()?.describedBy,
13884
+ this.describedBy(),
13885
+ )
13772
13886
  }
13773
13887
 
13774
13888
  /** Computes the textarea class list. */
@@ -13798,6 +13912,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13798
13912
  }
13799
13913
 
13800
13914
  handleInput(event: Event): void {
13915
+ if (!isFieldChangeEvent(event)) return
13801
13916
  event.stopPropagation()
13802
13917
  this.change.emit(event)
13803
13918
  const textarea = this.textareaEl?.nativeElement
@@ -13819,11 +13934,11 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13819
13934
  element.style.height = `${element.scrollHeight}px`
13820
13935
  }
13821
13936
 
13937
+ ngDoCheck(): void {
13938
+ this.hostAria.read(this.host.nativeElement)
13939
+ }
13940
+
13822
13941
  ngAfterViewInit(): void {
13823
- if (!this.restDescribedByCaptured) {
13824
- this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby')
13825
- this.restDescribedByCaptured = true
13826
- }
13827
13942
  adoptHostDataMolId(
13828
13943
  this.host.nativeElement,
13829
13944
  this.textareaEl?.nativeElement,
@@ -13832,14 +13947,12 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13832
13947
  },
13833
13948
  () => this.molId(),
13834
13949
  )
13835
- moveRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement)
13950
+ moveRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement, true)
13836
13951
  this.applyValue(true)
13837
13952
  this.resize()
13838
13953
  }
13839
13954
 
13840
13955
  ngAfterViewChecked(): void {
13841
- // so this hook runs and the reapply below moves the caller's re-bound
13842
- // rest attribute onto the textarea. Without the read, zoneless change
13843
13956
  // detection never re-checks this view — the parent's re-bound
13844
13957
  // `[attr.aria-label]` would land on the host and stay there.
13845
13958
  void this.i18n.locale()
@@ -13851,7 +13964,9 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13851
13964
  },
13852
13965
  () => this.molId(),
13853
13966
  )
13854
- reapplyRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement)
13967
+ reapplyRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement, {
13968
+ keepInvalid: true,
13969
+ })
13855
13970
  this.applyValue(false)
13856
13971
  this.resize()
13857
13972
  }
@@ -13869,7 +13984,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
13869
13984
  }
13870
13985
  ```
13871
13986
 
13872
- _(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`.)_
13987
+ _(Member comments are shortened to their first sentence, and the 23 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/textarea.component.d.ts`.)_
13873
13988
 
13874
13989
  #### `ThemeToggle`
13875
13990
 
@@ -14653,9 +14768,9 @@ export class Tooltip
14653
14768
  }
14654
14769
 
14655
14770
  handleFocus(event: FocusEvent): void {
14656
- const target = event.target as HTMLElement
14771
+ const target = event.target
14657
14772
  try {
14658
- if (typeof target.matches === 'function' && target.matches(':focus-visible')) this.show()
14773
+ if (target instanceof Element && target.matches(':focus-visible')) this.show()
14659
14774
  } catch (_error) {
14660
14775
  }
14661
14776
  }
@@ -14728,7 +14843,16 @@ export class Tooltip
14728
14843
  onDismiss: this.hideListener,
14729
14844
  })
14730
14845
  }
14731
- // … truncated — 2 more members: detachPortal, updatePosition; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/tooltip.component.d.ts
14846
+
14847
+ private detachPortal(): void {
14848
+ const portal = this.portalWrap?.nativeElement
14849
+ placeElement(portal, null)
14850
+ setElementPresent(portal, false)
14851
+ this.inner.set(null)
14852
+ this.associateEl?.removeAttribute('aria-describedby')
14853
+ this.layer.release()
14854
+ }
14855
+ // … truncated — 1 more member: updatePosition; the full declaration is in node_modules/@molecule/app-ui-angular/dist/components/tooltip.component.d.ts
14732
14856
  ```
14733
14857
 
14734
14858
  _(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-ui-angular/dist/components/tooltip.component.d.ts`.)_
@@ -15411,7 +15535,7 @@ export class UserMenu {
15411
15535
  * @param event - The click event.
15412
15536
  */
15413
15537
  handleTriggerClick(event: MouseEvent): void {
15414
- if (this.onClick) (this.onClick as (e: MouseEvent) => void)(event)
15538
+ if (this.onClick) this.onClick(event)
15415
15539
  else this.isOpen.set(true)
15416
15540
  }
15417
15541
  }
@@ -15549,6 +15673,23 @@ class ElementPropsWriter {
15549
15673
  }
15550
15674
  ```
15551
15675
 
15676
+ #### `FieldHostAria`
15677
+
15678
+ Reflects native attribute bindings from a field's Angular host into its control.
15679
+
15680
+ ```typescript
15681
+ class FieldHostAria {
15682
+ readonly description = signal<string | null>(null)
15683
+ readonly invalid = signal<string | null>(null)
15684
+
15685
+ /** Reads the caller's latest native bindings during each parent check. */
15686
+ read(host: Element): void {
15687
+ this.description.set(host.getAttribute('aria-describedby'))
15688
+ this.invalid.set(host.getAttribute('aria-invalid'))
15689
+ }
15690
+ }
15691
+ ```
15692
+
15552
15693
  #### `MolIconSvg`
15553
15694
 
15554
15695
  Internal SVG renderer used by every React-parity component where React
@@ -16008,6 +16149,14 @@ function createScrollLock(): {
16008
16149
 
16009
16150
  **Returns:** Lock/unlock functions with a shared reference count.
16010
16151
 
16152
+ #### `descriptionIds(values)`
16153
+
16154
+ Combines ARIA ID references while preserving their order.
16155
+
16156
+ ```typescript
16157
+ function descriptionIds(...values: (string | null | undefined)[]): string | null
16158
+ ```
16159
+
16011
16160
  #### `fieldContext(host)`
16012
16161
 
16013
16162
  Finds the nearest enclosing `FormField` context for a field's host element.
@@ -16169,7 +16318,7 @@ function resolveIcon(name: IconName, className?: string): ResolvedIcon
16169
16318
 
16170
16319
  **Returns:** The resolved icon data.
16171
16320
 
16172
- #### `moveRestAttributes(host, target)`
16321
+ #### `moveRestAttributes(host, target, keepFieldAria)`
16173
16322
 
16174
16323
  Moves every rest attribute (`aria-*`, `data-*`, `id`, …) from the host
16175
16324
  element onto the element React spreads `{...rest}` onto.
@@ -16179,11 +16328,16 @@ state (an accessible label that switches with the locale) re-moves the
16179
16328
  re-bound ones with {@link reapplyRestAttributes}.
16180
16329
 
16181
16330
  ```typescript
16182
- function moveRestAttributes(host: Element, target: Element | undefined | null): string[]
16331
+ function moveRestAttributes(
16332
+ host: Element,
16333
+ target: Element | undefined | null,
16334
+ keepFieldAria?: boolean,
16335
+ ): string[]
16183
16336
  ```
16184
16337
 
16185
16338
  - `host` — The component host element.
16186
16339
  - `target` — The element React's `...rest` targets.
16340
+ - `keepFieldAria` — Keep the host attributes used by a field's description and validation bindings.
16187
16341
 
16188
16342
  **Returns:** The moved attribute names.
16189
16343
 
@@ -16349,7 +16503,7 @@ Peer dependencies:
16349
16503
  - `@molecule/app-filesystem` ^1.1.0
16350
16504
  - `@molecule/app-i18n` ^1.0.1
16351
16505
  - `@molecule/app-icons` ^1.0.1
16352
- - `@molecule/app-ui` ^1.16.0
16506
+ - `@molecule/app-ui` ^1.18.0
16353
16507
 
16354
16508
  ### Runtime Dependencies
16355
16509