@molecule/app-ui-angular 1.13.4 → 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.
- package/README.md +416 -276
- package/dist/components/button.component.d.ts +10 -2
- package/dist/components/button.component.d.ts.map +1 -1
- package/dist/components/button.component.js +16 -5
- package/dist/components/button.component.js.map +1 -1
- package/dist/components/checkbox.component.d.ts +2 -2
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.component.js +1 -1
- package/dist/components/checkbox.component.js.map +1 -1
- package/dist/components/confirm-dialog.component.d.ts +1 -1
- package/dist/components/confirm-dialog.component.d.ts.map +1 -1
- package/dist/components/confirm-dialog.component.js.map +1 -1
- package/dist/components/form-field.component.d.ts +14 -5
- package/dist/components/form-field.component.d.ts.map +1 -1
- package/dist/components/form-field.component.js +79 -51
- package/dist/components/form-field.component.js.map +1 -1
- package/dist/components/input.component.d.ts +10 -7
- package/dist/components/input.component.d.ts.map +1 -1
- package/dist/components/input.component.js +30 -30
- package/dist/components/input.component.js.map +1 -1
- package/dist/components/layout.component.d.ts +7 -7
- package/dist/components/layout.component.d.ts.map +1 -1
- package/dist/components/layout.component.js +29 -20
- package/dist/components/layout.component.js.map +1 -1
- package/dist/components/molecule/input.component.d.ts +7 -4
- package/dist/components/molecule/input.component.d.ts.map +1 -1
- package/dist/components/molecule/input.component.js +18 -8
- package/dist/components/molecule/input.component.js.map +1 -1
- package/dist/components/molecule/modal.component.d.ts +9 -30
- package/dist/components/molecule/modal.component.d.ts.map +1 -1
- package/dist/components/molecule/modal.component.js +69 -81
- package/dist/components/molecule/modal.component.js.map +1 -1
- package/dist/components/molecule/select.component.d.ts +4 -3
- package/dist/components/molecule/select.component.d.ts.map +1 -1
- package/dist/components/molecule/select.component.js +13 -7
- package/dist/components/molecule/select.component.js.map +1 -1
- package/dist/components/prompt-dialog.component.d.ts +3 -3
- package/dist/components/prompt-dialog.component.d.ts.map +1 -1
- package/dist/components/prompt-dialog.component.js.map +1 -1
- package/dist/components/radio-group.component.d.ts +2 -2
- package/dist/components/radio-group.component.d.ts.map +1 -1
- package/dist/components/radio-group.component.js +2 -0
- package/dist/components/radio-group.component.js.map +1 -1
- package/dist/components/select.component.d.ts +12 -9
- package/dist/components/select.component.d.ts.map +1 -1
- package/dist/components/select.component.js +34 -32
- package/dist/components/select.component.js.map +1 -1
- package/dist/components/spinner.component.d.ts.map +1 -1
- package/dist/components/spinner.component.js +1 -3
- package/dist/components/spinner.component.js.map +1 -1
- package/dist/components/table.component.d.ts +16 -11
- package/dist/components/table.component.d.ts.map +1 -1
- package/dist/components/table.component.js +12 -14
- package/dist/components/table.component.js.map +1 -1
- package/dist/components/tabs.component.d.ts +1 -3
- package/dist/components/tabs.component.d.ts.map +1 -1
- package/dist/components/tabs.component.js +13 -11
- package/dist/components/tabs.component.js.map +1 -1
- package/dist/components/textarea.component.d.ts +13 -15
- package/dist/components/textarea.component.d.ts.map +1 -1
- package/dist/components/textarea.component.js +35 -38
- package/dist/components/textarea.component.js.map +1 -1
- package/dist/components/tooltip.component.js +1 -1
- package/dist/components/tooltip.component.js.map +1 -1
- package/dist/components/user-menu.component.d.ts +1 -1
- package/dist/components/user-menu.component.d.ts.map +1 -1
- package/dist/components/user-menu.component.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities/form-field-context.d.ts +10 -1
- package/dist/utilities/form-field-context.d.ts.map +1 -1
- package/dist/utilities/form-field-context.js +18 -0
- package/dist/utilities/form-field-context.js.map +1 -1
- package/dist/utilities/rest-attrs.d.ts +4 -1
- package/dist/utilities/rest-attrs.d.ts.map +1 -1
- package/dist/utilities/rest-attrs.js +6 -1
- package/dist/utilities/rest-attrs.js.map +1 -1
- package/package.json +1 -1
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-12-
|
|
6
|
+
Generated: 2026-12-01T19:47:23.877Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-ui-angular
|
|
@@ -983,6 +983,23 @@ interface CardProps extends HTMLElementProps {
|
|
|
983
983
|
}
|
|
984
984
|
```
|
|
985
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
|
+
|
|
986
1003
|
#### `ContainerProps`
|
|
987
1004
|
|
|
988
1005
|
Props for the Container layout component.
|
|
@@ -1612,6 +1629,59 @@ interface SkeletonProps extends BaseProps {
|
|
|
1612
1629
|
}
|
|
1613
1630
|
```
|
|
1614
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
|
+
|
|
1615
1685
|
#### `AccordionItemData`
|
|
1616
1686
|
|
|
1617
1687
|
One accordion item (React's `AccordionItem`).
|
|
@@ -2183,6 +2253,17 @@ interface SidebarUserCardProps {
|
|
|
2183
2253
|
}
|
|
2184
2254
|
```
|
|
2185
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
|
+
|
|
2186
2267
|
#### `ThemeToggleProps`
|
|
2187
2268
|
|
|
2188
2269
|
Props for {@link ThemeToggle} (React's `ThemeToggleProps`, in Angular's
|
|
@@ -2346,7 +2427,7 @@ interface UserMenuProps {
|
|
|
2346
2427
|
/** Whether the trigger is disabled. */
|
|
2347
2428
|
disabled?: boolean
|
|
2348
2429
|
/** Overrides the trigger click (called instead of opening the panel). */
|
|
2349
|
-
onClick?: () => void
|
|
2430
|
+
onClick?: (event: MouseEvent) => void
|
|
2350
2431
|
/** Which side the panel opens from (default `right`). */
|
|
2351
2432
|
side?: 'left' | 'right'
|
|
2352
2433
|
}
|
|
@@ -2403,7 +2484,7 @@ The values `FormField` injects into its single child field.
|
|
|
2403
2484
|
|
|
2404
2485
|
```typescript
|
|
2405
2486
|
interface FormFieldContext {
|
|
2406
|
-
/**
|
|
2487
|
+
/** Stable id supplied to a control without an explicit id. */
|
|
2407
2488
|
id?: string
|
|
2408
2489
|
/** The id of the error/hint paragraph the field should describe itself with. */
|
|
2409
2490
|
describedBy?: string
|
|
@@ -2518,6 +2599,8 @@ interface ReapplyRestAttributesOptions {
|
|
|
2518
2599
|
* `...rest` target has no merge to protect, so it opts in.
|
|
2519
2600
|
*/
|
|
2520
2601
|
includeDescribedBy?: boolean
|
|
2602
|
+
/** The field's validation binding owns aria-invalid on the control. */
|
|
2603
|
+
keepInvalid?: boolean
|
|
2521
2604
|
}
|
|
2522
2605
|
```
|
|
2523
2606
|
|
|
@@ -3687,6 +3770,7 @@ capture point, so the wrapper lives in the template unconditionally).
|
|
|
3687
3770
|
'testId',
|
|
3688
3771
|
'disabled',
|
|
3689
3772
|
'type',
|
|
3773
|
+
'ariaBusy: aria-busy',
|
|
3690
3774
|
'automationId',
|
|
3691
3775
|
'dataMolId: data-mol-id',
|
|
3692
3776
|
],
|
|
@@ -3695,9 +3779,9 @@ capture point, so the wrapper lives in the template unconditionally).
|
|
|
3695
3779
|
'[style]': 'hostStyle()',
|
|
3696
3780
|
'[attr.data-testid]': 'testId',
|
|
3697
3781
|
'[attr.data-mol-id]': 'molId()',
|
|
3698
|
-
'[attr.type]': 'type',
|
|
3782
|
+
'[attr.type]': 'type ?? "button"',
|
|
3699
3783
|
'[disabled]': 'disabled || loading',
|
|
3700
|
-
'[attr.aria-busy]': '
|
|
3784
|
+
'[attr.aria-busy]': 'ariaBusyAttr()',
|
|
3701
3785
|
},
|
|
3702
3786
|
template: `@if (loading) {
|
|
3703
3787
|
<div mol-spinner [size]="'sm'" [className]="cm().buttonIconLeft"></div>
|
|
@@ -3744,6 +3828,8 @@ export class Button implements HasElement<HTMLButtonElement> {
|
|
|
3744
3828
|
disabled = false
|
|
3745
3829
|
/** The button's `type` attribute. */
|
|
3746
3830
|
type: 'button' | 'submit' | 'reset' = 'button'
|
|
3831
|
+
/** Explicit `aria-busy` (`loading` stays busy even when this is false). */
|
|
3832
|
+
ariaBusy?: AriaBoolean
|
|
3747
3833
|
|
|
3748
3834
|
/** The left icon wrapper (always in the template; detached when unused). */
|
|
3749
3835
|
@ViewChild('leftSlot') leftSlot?: ElementRef<HTMLSpanElement>
|
|
@@ -3777,6 +3863,15 @@ export class Button implements HasElement<HTMLButtonElement> {
|
|
|
3777
3863
|
)
|
|
3778
3864
|
}
|
|
3779
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
|
+
|
|
3780
3875
|
/**
|
|
3781
3876
|
* Computes the button class list.
|
|
3782
3877
|
* @returns The class string.
|
|
@@ -4261,7 +4356,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
|
|
|
4261
4356
|
/** Whether the checkbox renders the indeterminate state. */
|
|
4262
4357
|
indeterminate?: boolean
|
|
4263
4358
|
/** Checkbox size (kept for prop parity). */
|
|
4264
|
-
size?:
|
|
4359
|
+
size?: Size
|
|
4265
4360
|
/** Error message (renders and associates via aria-describedby). */
|
|
4266
4361
|
error?: string
|
|
4267
4362
|
/** Extra classes joined onto the checkbox classes. */
|
|
@@ -4313,7 +4408,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
|
|
|
4313
4408
|
/** The label text wrapper. */
|
|
4314
4409
|
@ViewChild('labelSlot') labelSlot?: ElementRef<HTMLSpanElement>
|
|
4315
4410
|
|
|
4316
|
-
private readonly host = inject(ElementRef)
|
|
4411
|
+
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
4317
4412
|
|
|
4318
4413
|
/** The per-instance id used when the caller gives no `id` or `name` (React's `useId`). */
|
|
4319
4414
|
private readonly generatedId = nextInstanceId()
|
|
@@ -4351,7 +4446,7 @@ export class Checkbox implements AfterViewChecked, HasElement<HTMLInputElement>
|
|
|
4351
4446
|
|
|
4352
4447
|
/** The nearest enclosing `FormField` context (React's cloned props). */
|
|
4353
4448
|
fieldContext(): FormFieldContext | null {
|
|
4354
|
-
return fieldContext(this.host.nativeElement
|
|
4449
|
+
return fieldContext(this.host.nativeElement)
|
|
4355
4450
|
}
|
|
4356
4451
|
|
|
4357
4452
|
/** The final `aria-describedby`: the enclosing FormField's error/hint target, then this checkbox's own error (React's cloneElement join). */
|
|
@@ -4797,7 +4892,7 @@ export class ConfirmDialog {
|
|
|
4797
4892
|
readonly isGiven = isGiven
|
|
4798
4893
|
|
|
4799
4894
|
/** Fires when the dialog should close (escape, backdrop, cancel). */
|
|
4800
|
-
@Output() readonly close = new EventEmitter<
|
|
4895
|
+
@Output() readonly close = new EventEmitter<MouseEvent | undefined>()
|
|
4801
4896
|
/** Fires when the user confirms. */
|
|
4802
4897
|
@Output() readonly confirm = new EventEmitter<void>()
|
|
4803
4898
|
|
|
@@ -5701,7 +5796,7 @@ components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
|
|
|
5701
5796
|
},
|
|
5702
5797
|
template: `@if (label) {
|
|
5703
5798
|
<label
|
|
5704
|
-
[attr.for]="labelFor() || fieldId()"
|
|
5799
|
+
[attr.for]="singleChild() ? labelFor() || fieldId() : name || fieldId()"
|
|
5705
5800
|
[class]="cm().cn(cm().label({ required: !!required }), cm().labelBlock)"
|
|
5706
5801
|
>{{ label }}</label
|
|
5707
5802
|
>
|
|
@@ -5714,10 +5809,10 @@ components (`Input`, `Select`, `Textarea`, `Checkbox`) read.
|
|
|
5714
5809
|
<p [attr.id]="hintId" [class]="cm().formHint">{{ hint }}</p>
|
|
5715
5810
|
}`,
|
|
5716
5811
|
})
|
|
5717
|
-
export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
5812
|
+
export class FormField implements OnChanges, OnDestroy, HasElement<HTMLDivElement> {
|
|
5718
5813
|
/** Field label. */
|
|
5719
5814
|
label?: string
|
|
5720
|
-
/** Field name
|
|
5815
|
+
/** Field name. */
|
|
5721
5816
|
name?: string
|
|
5722
5817
|
/** Error message (renders and associates via aria-describedby). */
|
|
5723
5818
|
error?: string
|
|
@@ -5733,27 +5828,24 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5733
5828
|
testId?: string
|
|
5734
5829
|
/** `data-mol-id` automation id (React's `automationId`). */
|
|
5735
5830
|
automationId?: string
|
|
5736
|
-
/** A `data-mol-id` given as a plain rest attribute (React's `rootProps` precedence). */
|
|
5737
5831
|
dataMolId?: string
|
|
5738
5832
|
|
|
5739
5833
|
/** The projected-children capture point. */
|
|
5740
5834
|
@ViewChild('capture') capture?: ElementRef<HTMLSpanElement>
|
|
5741
5835
|
|
|
5742
|
-
/** The label's `for` target (the single child's control id, read after view init). */
|
|
5743
5836
|
readonly labelFor = signal('')
|
|
5744
5837
|
|
|
5745
|
-
/** A generated id used when `name` is absent (the normalizer renumbers it). */
|
|
5746
5838
|
private readonly generatedId = nextInstanceId()
|
|
5839
|
+
readonly context = signal<FormFieldContext>({})
|
|
5747
5840
|
private readonly host: ElementRef<HTMLDivElement> = inject(ElementRef)
|
|
5748
5841
|
/** The element a caller's ref receives: the host `<div>`. */
|
|
5749
5842
|
readonly element = hostElement(this.host)
|
|
5750
5843
|
private readonly singleState = signal<boolean | null>(null)
|
|
5751
|
-
/** The native control this field patched, with the attributes it had before. */
|
|
5752
5844
|
private patched: {
|
|
5753
5845
|
control: HTMLElement
|
|
5754
|
-
attributes:
|
|
5846
|
+
attributes: FieldAttributes
|
|
5847
|
+
applied: FieldAttributes
|
|
5755
5848
|
} | null = null
|
|
5756
|
-
/** The first projected node the last adoption saw: a different one is adopted again. */
|
|
5757
5849
|
private adopted: Node | null = null
|
|
5758
5850
|
/** Whether the adopted content was a single element child. */
|
|
5759
5851
|
private single = false
|
|
@@ -5769,9 +5861,9 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5769
5861
|
return getClassMap()
|
|
5770
5862
|
}
|
|
5771
5863
|
|
|
5772
|
-
/** The
|
|
5864
|
+
/** The stable id supplied to a child that has no explicit id. */
|
|
5773
5865
|
fieldId(): string {
|
|
5774
|
-
return this.
|
|
5866
|
+
return this.generatedId
|
|
5775
5867
|
}
|
|
5776
5868
|
|
|
5777
5869
|
/** The error paragraph's id. */
|
|
@@ -5801,7 +5893,6 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5801
5893
|
return styleText(this.style)
|
|
5802
5894
|
}
|
|
5803
5895
|
|
|
5804
|
-
/** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
|
|
5805
5896
|
molId(): string | undefined {
|
|
5806
5897
|
return (
|
|
5807
5898
|
this.automationId ??
|
|
@@ -5818,7 +5909,6 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5818
5909
|
)
|
|
5819
5910
|
}
|
|
5820
5911
|
|
|
5821
|
-
/** Whether the projected content is exactly one element (React clones only a single child). */
|
|
5822
5912
|
singleChild(): boolean {
|
|
5823
5913
|
const single = this.singleState()
|
|
5824
5914
|
if (single !== null) return single
|
|
@@ -5847,59 +5937,77 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5847
5937
|
// Angular inserts a list's nodes one at a time, and this runs after each:
|
|
5848
5938
|
// a second child arriving after the first makes the field "not single" again.
|
|
5849
5939
|
const single = children.length === 1 && first.nodeType === 1
|
|
5850
|
-
if (this.adopted === first && this.single === single) {
|
|
5851
|
-
// The adopted control's own id may bind after the first run; keep the
|
|
5852
|
-
// label pointed at it as it settles (React adopts the child's id).
|
|
5853
|
-
const control = this.single
|
|
5854
|
-
? this.host.nativeElement.querySelector<HTMLElement>(FIELD_SELECTOR)
|
|
5855
|
-
: null
|
|
5856
|
-
this.labelFor.set(control?.id || this.fieldId())
|
|
5857
|
-
setElementPresent(capture, false)
|
|
5858
|
-
return
|
|
5859
|
-
}
|
|
5860
5940
|
const host = this.host.nativeElement
|
|
5861
|
-
this.
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
if (single) {
|
|
5867
|
-
const child = first as HTMLElement
|
|
5868
|
-
const control = child.matches(FIELD_SELECTOR)
|
|
5869
|
-
? child
|
|
5870
|
-
: child.querySelector<HTMLElement>(FIELD_SELECTOR)
|
|
5871
|
-
if (child.matches(FIELD_SELECTOR)) this.patchNativeControl(child)
|
|
5872
|
-
this.labelFor.set(control?.id || this.fieldId())
|
|
5873
|
-
} else {
|
|
5874
|
-
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)
|
|
5875
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())
|
|
5876
5955
|
setElementPresent(capture, false)
|
|
5877
|
-
this.adopted = first
|
|
5878
5956
|
}
|
|
5879
5957
|
|
|
5880
5958
|
/** Applies React's cloned props to a plain native form control child. */
|
|
5881
5959
|
private patchNativeControl(control: HTMLElement): void {
|
|
5882
|
-
|
|
5883
|
-
control,
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
) 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'),
|
|
5887
5964
|
}
|
|
5888
|
-
control
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
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'],
|
|
5893
5994
|
}
|
|
5894
|
-
|
|
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)
|
|
6000
|
+
}
|
|
6001
|
+
this.patched.applied = next
|
|
6002
|
+
this.labelFor.set(control.id)
|
|
5895
6003
|
}
|
|
5896
6004
|
|
|
5897
|
-
/** Puts back the attributes a patched control had before this field cloned it. */
|
|
5898
6005
|
private unpatchNativeControl(): void {
|
|
5899
6006
|
if (this.patched === null) return
|
|
5900
|
-
const { control, attributes } = this.patched
|
|
6007
|
+
const { control, attributes, applied } = this.patched
|
|
5901
6008
|
this.patched = null
|
|
5902
6009
|
for (const name of PATCHED_ATTRIBUTES) {
|
|
6010
|
+
if (control.getAttribute(name) !== applied[name]) continue
|
|
5903
6011
|
const value = attributes[name]
|
|
5904
6012
|
if (value === null) control.removeAttribute(name)
|
|
5905
6013
|
else control.setAttribute(name, value)
|
|
@@ -5913,7 +6021,7 @@ export class FormField implements OnDestroy, HasElement<HTMLDivElement> {
|
|
|
5913
6021
|
}
|
|
5914
6022
|
```
|
|
5915
6023
|
|
|
5916
|
-
_(Member comments are shortened to their first sentence, and the
|
|
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`.)_
|
|
5917
6025
|
|
|
5918
6026
|
#### `Form`
|
|
5919
6027
|
|
|
@@ -6346,6 +6454,8 @@ DOM whenever React would render nothing (`setElementPresent`).
|
|
|
6346
6454
|
'label',
|
|
6347
6455
|
'error',
|
|
6348
6456
|
'hint',
|
|
6457
|
+
'externalDescription: aria-describedby',
|
|
6458
|
+
'externalInvalid: aria-invalid',
|
|
6349
6459
|
'leftElement',
|
|
6350
6460
|
'rightElement',
|
|
6351
6461
|
'clearable',
|
|
@@ -6393,7 +6503,9 @@ DOM whenever React would render nothing (`setElementPresent`).
|
|
|
6393
6503
|
[attr.placeholder]="placeholder"
|
|
6394
6504
|
[disabled]="disabled"
|
|
6395
6505
|
[attr.required]="required ? '' : null"
|
|
6396
|
-
[attr.aria-invalid]="
|
|
6506
|
+
[attr.aria-invalid]="
|
|
6507
|
+
error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
|
|
6508
|
+
"
|
|
6397
6509
|
[attr.aria-describedby]="mergedDescribedBy()"
|
|
6398
6510
|
[class]="classes()"
|
|
6399
6511
|
[attr.style]="hostStyle()"
|
|
@@ -6429,10 +6541,10 @@ DOM whenever React would render nothing (`setElementPresent`).
|
|
|
6429
6541
|
</div>
|
|
6430
6542
|
</div>
|
|
6431
6543
|
@if (error) {
|
|
6432
|
-
<p [attr.id]="
|
|
6544
|
+
<p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
|
|
6433
6545
|
}
|
|
6434
6546
|
@if (hint && !error) {
|
|
6435
|
-
<p [attr.id]="
|
|
6547
|
+
<p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
|
|
6436
6548
|
}`,
|
|
6437
6549
|
})
|
|
6438
6550
|
export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
|
|
@@ -6480,7 +6592,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
|
|
|
6480
6592
|
@ViewChild('rightSlot') rightSlot?: ElementRef<HTMLDivElement>
|
|
6481
6593
|
@ViewChild('rightInner') rightInner?: ElementRef<HTMLSpanElement>
|
|
6482
6594
|
|
|
6483
|
-
private readonly host = inject(ElementRef)
|
|
6595
|
+
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
6484
6596
|
|
|
6485
6597
|
private readonly hasLeft = signal(false)
|
|
6486
6598
|
private readonly hasRight = signal(false)
|
|
@@ -6494,7 +6606,9 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
|
|
|
6494
6606
|
private readonly i18n = useTranslation()
|
|
6495
6607
|
|
|
6496
6608
|
private movedRest = false
|
|
6497
|
-
|
|
6609
|
+
externalDescription?: string | null
|
|
6610
|
+
externalInvalid?: AriaBoolean
|
|
6611
|
+
protected readonly hostAria = new FieldHostAria()
|
|
6498
6612
|
private externalMolId: string | undefined
|
|
6499
6613
|
|
|
6500
6614
|
cm(): UIClassMap {
|
|
@@ -6506,23 +6620,25 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
|
|
|
6506
6620
|
}
|
|
6507
6621
|
|
|
6508
6622
|
inputId(): string {
|
|
6509
|
-
|
|
6623
|
+
const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
|
|
6624
|
+
return this.id || this.fieldContext()?.id || externalId || this.generatedId
|
|
6510
6625
|
}
|
|
6511
6626
|
|
|
6512
6627
|
describedBy(): string | null {
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
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
|
|
6516
6630
|
}
|
|
6517
6631
|
|
|
6518
6632
|
fieldContext(): FormFieldContext | null {
|
|
6519
|
-
return fieldContext(this.host.nativeElement
|
|
6633
|
+
return fieldContext(this.host.nativeElement)
|
|
6520
6634
|
}
|
|
6521
6635
|
|
|
6522
6636
|
mergedDescribedBy(): string | null {
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6637
|
+
return descriptionIds(
|
|
6638
|
+
this.externalDescription ?? this.hostAria.description(),
|
|
6639
|
+
this.fieldContext()?.describedBy,
|
|
6640
|
+
this.describedBy(),
|
|
6641
|
+
)
|
|
6526
6642
|
}
|
|
6527
6643
|
|
|
6528
6644
|
classes(): string {
|
|
@@ -6587,10 +6703,7 @@ export class Input implements AfterViewChecked, HasElement<HTMLInputElement> {
|
|
|
6587
6703
|
private syncAdornments(hasContent: SlotReader): void {
|
|
6588
6704
|
const left = this.leftSlot?.nativeElement
|
|
6589
6705
|
const right = this.rightSlot?.nativeElement
|
|
6590
|
-
const inner =
|
|
6591
|
-
this.rightInner?.nativeElement ??
|
|
6592
|
-
(right ? (right.querySelector('span') as HTMLElement | null) : null) ??
|
|
6593
|
-
undefined
|
|
6706
|
+
const inner = this.rightInner?.nativeElement ?? right?.querySelector('span') ?? undefined
|
|
6594
6707
|
const hasLeft = this.isGiven(this.leftElement) || hasContent(left)
|
|
6595
6708
|
const hasRight = this.isGiven(this.rightElement) || hasContent(inner)
|
|
6596
6709
|
this.hasLeft.set(hasLeft)
|
|
@@ -6931,12 +7044,12 @@ export class Container implements HasElement<HTMLDivElement> {
|
|
|
6931
7044
|
/** The element a caller's ref receives: the host `<div>`. */
|
|
6932
7045
|
readonly element = hostElement(this.host)
|
|
6933
7046
|
|
|
6934
|
-
/** Maximum width preset. */
|
|
6935
|
-
maxWidth: '
|
|
7047
|
+
/** Maximum width preset or CSS length. */
|
|
7048
|
+
maxWidth: NonNullable<ContainerProps['maxWidth']> = 'lg'
|
|
6936
7049
|
/** Whether the column is centered. */
|
|
6937
7050
|
centered = true
|
|
6938
7051
|
/** Horizontal padding (accepted for React parity, not rendered). */
|
|
6939
|
-
paddingX?:
|
|
7052
|
+
paddingX?: ContainerProps['paddingX']
|
|
6940
7053
|
/** Extra classes. */
|
|
6941
7054
|
className?: string
|
|
6942
7055
|
/** Inline style object (React camelCase). */
|
|
@@ -6961,10 +7074,9 @@ export class Container implements HasElement<HTMLDivElement> {
|
|
|
6961
7074
|
* @returns The class string.
|
|
6962
7075
|
*/
|
|
6963
7076
|
classes(): string {
|
|
7077
|
+
const namedWidth = isContainerSize(this.maxWidth) ? this.maxWidth : undefined
|
|
6964
7078
|
return this.cm().cn(
|
|
6965
|
-
this.cm().container({
|
|
6966
|
-
size: this.maxWidth as 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full',
|
|
6967
|
-
}),
|
|
7079
|
+
this.cm().container(namedWidth ? { size: namedWidth } : undefined),
|
|
6968
7080
|
this.centered && this.cm().mxAuto,
|
|
6969
7081
|
this.className,
|
|
6970
7082
|
)
|
|
@@ -6988,7 +7100,9 @@ export class Container implements HasElement<HTMLDivElement> {
|
|
|
6988
7100
|
* @returns The style attribute text.
|
|
6989
7101
|
*/
|
|
6990
7102
|
hostStyle(): string | null {
|
|
6991
|
-
|
|
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)
|
|
6992
7106
|
}
|
|
6993
7107
|
}
|
|
6994
7108
|
```
|
|
@@ -7031,11 +7145,11 @@ export class Flex implements HasElement<HTMLDivElement> {
|
|
|
7031
7145
|
/** Flex direction. */
|
|
7032
7146
|
direction: 'row' | 'column' | 'row-reverse' | 'column-reverse' = 'row'
|
|
7033
7147
|
/** Main-axis justification. */
|
|
7034
|
-
justify?:
|
|
7148
|
+
justify?: FlexProps['justify']
|
|
7035
7149
|
/** Cross-axis alignment. */
|
|
7036
|
-
align?:
|
|
7150
|
+
align?: FlexProps['align']
|
|
7037
7151
|
/** Wrapping behavior. */
|
|
7038
|
-
wrap?:
|
|
7152
|
+
wrap?: FlexProps['wrap']
|
|
7039
7153
|
/** Gap (preset name, number in px, or any CSS value). */
|
|
7040
7154
|
gap?: number | string
|
|
7041
7155
|
/** Extra classes. */
|
|
@@ -7062,16 +7176,13 @@ export class Flex implements HasElement<HTMLDivElement> {
|
|
|
7062
7176
|
* @returns The class string.
|
|
7063
7177
|
*/
|
|
7064
7178
|
classes(): string {
|
|
7065
|
-
const cmGap =
|
|
7066
|
-
typeof this.gap === 'string' && GAP_NAMES.includes(this.gap)
|
|
7067
|
-
? (this.gap as 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl')
|
|
7068
|
-
: undefined
|
|
7179
|
+
const cmGap = GAP_NAMES.find((name) => name === this.gap)
|
|
7069
7180
|
return this.cm().cn(
|
|
7070
7181
|
this.cm().flex({
|
|
7071
7182
|
direction: DIRECTION_MAP[this.direction] || 'row',
|
|
7072
|
-
align: this.align
|
|
7073
|
-
justify: this.justify
|
|
7074
|
-
wrap: this.wrap
|
|
7183
|
+
align: this.align,
|
|
7184
|
+
justify: this.justify,
|
|
7185
|
+
wrap: this.wrap,
|
|
7075
7186
|
gap: cmGap,
|
|
7076
7187
|
}),
|
|
7077
7188
|
this.className,
|
|
@@ -7099,7 +7210,7 @@ export class Flex implements HasElement<HTMLDivElement> {
|
|
|
7099
7210
|
const gapStyle =
|
|
7100
7211
|
typeof this.gap === 'number'
|
|
7101
7212
|
? { gap: this.gap }
|
|
7102
|
-
: typeof this.gap === 'string' && !GAP_NAMES.
|
|
7213
|
+
: typeof this.gap === 'string' && !GAP_NAMES.some((name) => name === this.gap)
|
|
7103
7214
|
? { gap: this.gap }
|
|
7104
7215
|
: undefined
|
|
7105
7216
|
return styleText({ ...this.style, ...gapStyle })
|
|
@@ -7177,10 +7288,7 @@ export class Grid implements HasElement<HTMLDivElement> {
|
|
|
7177
7288
|
* @returns The class string.
|
|
7178
7289
|
*/
|
|
7179
7290
|
classes(): string {
|
|
7180
|
-
const cmGap =
|
|
7181
|
-
typeof this.gap === 'string' && GAP_NAMES.includes(this.gap)
|
|
7182
|
-
? (this.gap as 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl')
|
|
7183
|
-
: undefined
|
|
7291
|
+
const cmGap = GAP_NAMES.find((name) => name === this.gap)
|
|
7184
7292
|
return this.cm().cn(
|
|
7185
7293
|
this.cm().grid({
|
|
7186
7294
|
cols: typeof this.columns === 'number' ? this.columns : undefined,
|
|
@@ -7215,7 +7323,7 @@ export class Grid implements HasElement<HTMLDivElement> {
|
|
|
7215
7323
|
if (typeof this.rows === 'string') own.gridTemplateRows = this.rows
|
|
7216
7324
|
if (
|
|
7217
7325
|
typeof this.gap === 'number' ||
|
|
7218
|
-
(typeof this.gap === 'string' && !GAP_NAMES.
|
|
7326
|
+
(typeof this.gap === 'string' && !GAP_NAMES.some((name) => name === this.gap))
|
|
7219
7327
|
)
|
|
7220
7328
|
own.gap = this.gap
|
|
7221
7329
|
if (typeof this.columnGap === 'number' || typeof this.columnGap === 'string')
|
|
@@ -7304,7 +7412,7 @@ export class Spacer implements HasElement<HTMLDivElement> {
|
|
|
7304
7412
|
* @returns True for preset names.
|
|
7305
7413
|
*/
|
|
7306
7414
|
get isNamedSize(): boolean {
|
|
7307
|
-
return
|
|
7415
|
+
return SPACER_SIZES.some((name) => name === this.size)
|
|
7308
7416
|
}
|
|
7309
7417
|
|
|
7310
7418
|
/**
|
|
@@ -7312,10 +7420,11 @@ export class Spacer implements HasElement<HTMLDivElement> {
|
|
|
7312
7420
|
* @returns The class string.
|
|
7313
7421
|
*/
|
|
7314
7422
|
classes(): string {
|
|
7423
|
+
const namedSize = SPACER_SIZES.find((name) => name === this.size)
|
|
7315
7424
|
return this.cm().cn(
|
|
7316
|
-
|
|
7425
|
+
namedSize
|
|
7317
7426
|
? this.cm().spacer({
|
|
7318
|
-
size:
|
|
7427
|
+
size: namedSize,
|
|
7319
7428
|
horizontal: !!this.horizontal,
|
|
7320
7429
|
})
|
|
7321
7430
|
: this.horizontal
|
|
@@ -8274,6 +8383,7 @@ Angular Input UI component with UIClassMap-driven styling.
|
|
|
8274
8383
|
selector: 'mol-input',
|
|
8275
8384
|
standalone: true,
|
|
8276
8385
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8386
|
+
host: { '[attr.id]': 'null' },
|
|
8277
8387
|
template: `
|
|
8278
8388
|
<div [class]="field.root">
|
|
8279
8389
|
@if (label) {
|
|
@@ -8300,8 +8410,8 @@ Angular Input UI component with UIClassMap-driven styling.
|
|
|
8300
8410
|
[attr.minlength]="minLength"
|
|
8301
8411
|
[attr.pattern]="pattern"
|
|
8302
8412
|
[attr.autocomplete]="autoComplete"
|
|
8303
|
-
(input)="handleInput
|
|
8304
|
-
(change)="handleChange
|
|
8413
|
+
(input)="emitFieldEvent(handleInput, $event)"
|
|
8414
|
+
(change)="emitFieldEvent(handleChange, $event)"
|
|
8305
8415
|
(focus)="handleFocus.emit($event)"
|
|
8306
8416
|
(blur)="handleBlur.emit($event)"
|
|
8307
8417
|
/>
|
|
@@ -8358,12 +8468,19 @@ export class MoleculeInput {
|
|
|
8358
8468
|
@Input() pattern?: string
|
|
8359
8469
|
@Input() autoComplete?: string
|
|
8360
8470
|
|
|
8361
|
-
|
|
8362
|
-
|
|
8471
|
+
private readonly generatedId = nextInstanceId()
|
|
8472
|
+
|
|
8473
|
+
@Output() handleInput = new EventEmitter<Event & KitFieldChangeEvent>()
|
|
8474
|
+
@Output() handleChange = new EventEmitter<Event & KitFieldChangeEvent>()
|
|
8363
8475
|
@Output() handleFocus = new EventEmitter<FocusEvent>()
|
|
8364
8476
|
@Output() handleBlur = new EventEmitter<FocusEvent>()
|
|
8365
8477
|
@Output() handleClear = new EventEmitter<void>()
|
|
8366
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
|
+
|
|
8367
8484
|
/**
|
|
8368
8485
|
* Reactive translation, read in the injection context. Its `t` reads the
|
|
8369
8486
|
* locale, so the view re-renders the text on a locale switch (the static `t`
|
|
@@ -8414,10 +8531,10 @@ export class MoleculeInput {
|
|
|
8414
8531
|
|
|
8415
8532
|
/**
|
|
8416
8533
|
* Resolves the input element ID.
|
|
8417
|
-
* @returns The
|
|
8534
|
+
* @returns The explicit id or this instance's stable fallback.
|
|
8418
8535
|
*/
|
|
8419
8536
|
get inputId(): string {
|
|
8420
|
-
return this.id || this.
|
|
8537
|
+
return this.id || this.generatedId
|
|
8421
8538
|
}
|
|
8422
8539
|
|
|
8423
8540
|
/**
|
|
@@ -8481,9 +8598,11 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
|
|
|
8481
8598
|
<div [class]="wrapperClass" [style]="wrapperStyle" (click)="onOverlayClick($event)">
|
|
8482
8599
|
<!-- Content -->
|
|
8483
8600
|
<div
|
|
8601
|
+
#dialog
|
|
8484
8602
|
role="dialog"
|
|
8603
|
+
tabindex="-1"
|
|
8485
8604
|
aria-modal="true"
|
|
8486
|
-
[attr.aria-labelledby]="title ?
|
|
8605
|
+
[attr.aria-labelledby]="title ? titleId : null"
|
|
8487
8606
|
[class]="contentClasses"
|
|
8488
8607
|
[style]="style"
|
|
8489
8608
|
[attr.data-testid]="testId"
|
|
@@ -8492,7 +8611,7 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
|
|
|
8492
8611
|
@if (title || showCloseButton) {
|
|
8493
8612
|
<div [class]="headerClass">
|
|
8494
8613
|
@if (title) {
|
|
8495
|
-
<h2 id="
|
|
8614
|
+
<h2 [id]="titleId" [class]="titleClass">{{ title }}</h2>
|
|
8496
8615
|
} @else if (showCloseButton) {
|
|
8497
8616
|
<div></div>
|
|
8498
8617
|
}
|
|
@@ -8527,7 +8646,7 @@ false` top-anchors it instead, via `getModalWrapperStyle()`.
|
|
|
8527
8646
|
* Molecule Modal class.
|
|
8528
8647
|
* @deprecated Use the React-named component `Modal` instead.
|
|
8529
8648
|
*/
|
|
8530
|
-
export class MoleculeModal implements
|
|
8649
|
+
export class MoleculeModal implements AfterViewChecked, OnDestroy {
|
|
8531
8650
|
@Input() open = false
|
|
8532
8651
|
@Input() title?: string
|
|
8533
8652
|
@Input() size: ModalSize = 'md'
|
|
@@ -8567,7 +8686,11 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
|
|
|
8567
8686
|
return this.closeLabel || this.i18n.t('ui.modal.close', undefined, { defaultValue: 'Close' })
|
|
8568
8687
|
}
|
|
8569
8688
|
|
|
8570
|
-
|
|
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()
|
|
8571
8694
|
|
|
8572
8695
|
/**
|
|
8573
8696
|
* Retrieves the CSS class for the modal wrapper.
|
|
@@ -8651,62 +8774,29 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
|
|
|
8651
8774
|
return this.cm.cn(this.cm.modal({ size: this.size }), this.className)
|
|
8652
8775
|
}
|
|
8653
8776
|
|
|
8654
|
-
/**
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
}
|
|
8660
|
-
|
|
8661
|
-
/**
|
|
8662
|
-
* Handles input property changes.
|
|
8663
|
-
* @param changes - The changed input properties.
|
|
8664
|
-
*/
|
|
8665
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
8666
|
-
if (changes['open']) {
|
|
8667
|
-
this.updateListeners()
|
|
8668
|
-
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
|
|
8669
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
|
+
})
|
|
8670
8793
|
}
|
|
8671
8794
|
|
|
8672
8795
|
/**
|
|
8673
8796
|
* Cleans up event listeners and body scroll on component destruction.
|
|
8674
8797
|
*/
|
|
8675
8798
|
ngOnDestroy(): void {
|
|
8676
|
-
|
|
8677
|
-
if (this.preventScroll) {
|
|
8678
|
-
document.body.style.overflow = ''
|
|
8679
|
-
}
|
|
8680
|
-
}
|
|
8681
|
-
|
|
8682
|
-
/**
|
|
8683
|
-
* Adds or removes the keyboard escape listener based on open state.
|
|
8684
|
-
*/
|
|
8685
|
-
private updateListeners(): void {
|
|
8686
|
-
if (this.open) {
|
|
8687
|
-
document.addEventListener('keydown', this.boundEscapeHandler)
|
|
8688
|
-
} else {
|
|
8689
|
-
document.removeEventListener('keydown', this.boundEscapeHandler)
|
|
8690
|
-
}
|
|
8691
|
-
}
|
|
8692
|
-
|
|
8693
|
-
/**
|
|
8694
|
-
* Updates the document body overflow based on open state.
|
|
8695
|
-
*/
|
|
8696
|
-
private updateBodyScroll(): void {
|
|
8697
|
-
if (this.preventScroll) {
|
|
8698
|
-
document.body.style.overflow = this.open ? 'hidden' : ''
|
|
8699
|
-
}
|
|
8700
|
-
}
|
|
8701
|
-
|
|
8702
|
-
/**
|
|
8703
|
-
* Handles escape key press to close the modal.
|
|
8704
|
-
* @param e - The keyboard event.
|
|
8705
|
-
*/
|
|
8706
|
-
private handleEscape(e: KeyboardEvent): void {
|
|
8707
|
-
if (this.closeOnEscape && e.key === 'Escape') {
|
|
8708
|
-
this.close.emit()
|
|
8709
|
-
}
|
|
8799
|
+
this.layer.release()
|
|
8710
8800
|
}
|
|
8711
8801
|
|
|
8712
8802
|
/**
|
|
@@ -8714,9 +8804,7 @@ export class MoleculeModal implements OnInit, OnDestroy, OnChanges {
|
|
|
8714
8804
|
* @param event - The mouse event from the overlay click.
|
|
8715
8805
|
*/
|
|
8716
8806
|
onOverlayClick(event: MouseEvent): void {
|
|
8717
|
-
if (
|
|
8718
|
-
this.close.emit()
|
|
8719
|
-
}
|
|
8807
|
+
if (event.target === event.currentTarget) this.layer.dismissBackdrop()
|
|
8720
8808
|
}
|
|
8721
8809
|
}
|
|
8722
8810
|
```
|
|
@@ -8851,6 +8939,7 @@ Angular Select UI component with UIClassMap-driven styling.
|
|
|
8851
8939
|
selector: 'mol-select',
|
|
8852
8940
|
standalone: true,
|
|
8853
8941
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8942
|
+
host: { '[attr.id]': 'null' },
|
|
8854
8943
|
template: `
|
|
8855
8944
|
<div [class]="field.root">
|
|
8856
8945
|
@if (label) {
|
|
@@ -8918,7 +9007,9 @@ export class MoleculeSelect {
|
|
|
8918
9007
|
@Input() id?: string
|
|
8919
9008
|
|
|
8920
9009
|
@Output() valueChange = new EventEmitter<string>()
|
|
8921
|
-
@Output() handleChange = new EventEmitter<Event>()
|
|
9010
|
+
@Output() handleChange = new EventEmitter<Event & KitFieldChangeEvent>()
|
|
9011
|
+
|
|
9012
|
+
private readonly generatedId = nextInstanceId()
|
|
8922
9013
|
|
|
8923
9014
|
/**
|
|
8924
9015
|
* Retrieves the current UI class map.
|
|
@@ -8955,10 +9046,10 @@ export class MoleculeSelect {
|
|
|
8955
9046
|
|
|
8956
9047
|
/**
|
|
8957
9048
|
* Resolves the select element ID.
|
|
8958
|
-
* @returns The
|
|
9049
|
+
* @returns The explicit id or this instance's stable fallback.
|
|
8959
9050
|
*/
|
|
8960
9051
|
get selectId(): string {
|
|
8961
|
-
return this.id || this.
|
|
9052
|
+
return this.id || this.generatedId
|
|
8962
9053
|
}
|
|
8963
9054
|
|
|
8964
9055
|
/**
|
|
@@ -8996,9 +9087,9 @@ export class MoleculeSelect {
|
|
|
8996
9087
|
* @param event - The change event from the select element.
|
|
8997
9088
|
*/
|
|
8998
9089
|
onSelectChange(event: Event): void {
|
|
8999
|
-
|
|
9090
|
+
if (!isFieldChangeEvent(event)) return
|
|
9000
9091
|
this.handleChange.emit(event)
|
|
9001
|
-
this.valueChange.emit(target.value)
|
|
9092
|
+
this.valueChange.emit(event.target.value)
|
|
9002
9093
|
}
|
|
9003
9094
|
}
|
|
9004
9095
|
```
|
|
@@ -10767,7 +10858,7 @@ export class PromptDialog implements AfterViewInit, DoCheck {
|
|
|
10767
10858
|
/** Whether a node-valued prop renders anything. */
|
|
10768
10859
|
readonly rendersNode = rendersNode
|
|
10769
10860
|
|
|
10770
|
-
@Output() readonly close = new EventEmitter<
|
|
10861
|
+
@Output() readonly close = new EventEmitter<MouseEvent | undefined>()
|
|
10771
10862
|
|
|
10772
10863
|
@ViewChild('titleSlot') titleSlot?: ElementRef<HTMLHeadingElement>
|
|
10773
10864
|
@ViewChild(Input) inputComponent?: Input
|
|
@@ -10867,8 +10958,8 @@ export class PromptDialog implements AfterViewInit, DoCheck {
|
|
|
10867
10958
|
else input.setAttribute('aria-label', label)
|
|
10868
10959
|
}
|
|
10869
10960
|
|
|
10870
|
-
onInput(event:
|
|
10871
|
-
this.value.set(
|
|
10961
|
+
onInput(event: KitFieldChangeEvent): void {
|
|
10962
|
+
this.value.set(event.target.value)
|
|
10872
10963
|
}
|
|
10873
10964
|
|
|
10874
10965
|
onModalClose(): void {
|
|
@@ -10967,7 +11058,7 @@ export class RadioGroup implements HasElement<HTMLDivElement> {
|
|
|
10967
11058
|
/** The selected option value. */
|
|
10968
11059
|
value?: string
|
|
10969
11060
|
/** Group size (kept for prop parity). */
|
|
10970
|
-
size?:
|
|
11061
|
+
size?: Size
|
|
10971
11062
|
/** Group label. */
|
|
10972
11063
|
label?: string
|
|
10973
11064
|
/** Native radio group name (defaults to a stable generated name). */
|
|
@@ -11055,11 +11146,11 @@ export class RadioGroup implements HasElement<HTMLDivElement> {
|
|
|
11055
11146
|
*/
|
|
11056
11147
|
select(event: Event): void {
|
|
11057
11148
|
event.stopPropagation()
|
|
11058
|
-
|
|
11149
|
+
if (!(event.target instanceof HTMLInputElement)) return
|
|
11150
|
+
this.change.emit(event.target.value)
|
|
11059
11151
|
// React always controls radios (checked={value === option.value}); restore.
|
|
11060
|
-
const radios =
|
|
11061
|
-
for (const radio of Array.from(radios)
|
|
11062
|
-
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
|
|
11063
11154
|
}
|
|
11064
11155
|
|
|
11065
11156
|
/** Fires the selected option's value. */
|
|
@@ -11886,6 +11977,8 @@ controlled-input state restore.
|
|
|
11886
11977
|
'placeholder',
|
|
11887
11978
|
'error',
|
|
11888
11979
|
'hint',
|
|
11980
|
+
'externalDescription: aria-describedby',
|
|
11981
|
+
'externalInvalid: aria-invalid',
|
|
11889
11982
|
'clearable',
|
|
11890
11983
|
'className',
|
|
11891
11984
|
'style',
|
|
@@ -11916,7 +12009,9 @@ controlled-input state restore.
|
|
|
11916
12009
|
[attr.name]="name"
|
|
11917
12010
|
[disabled]="disabled"
|
|
11918
12011
|
[attr.required]="required ? '' : null"
|
|
11919
|
-
[attr.aria-invalid]="
|
|
12012
|
+
[attr.aria-invalid]="
|
|
12013
|
+
error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
|
|
12014
|
+
"
|
|
11920
12015
|
[attr.aria-describedby]="mergedDescribedBy()"
|
|
11921
12016
|
[class]="classes()"
|
|
11922
12017
|
[attr.style]="hostStyle()"
|
|
@@ -11957,10 +12052,10 @@ controlled-input state restore.
|
|
|
11957
12052
|
</div>
|
|
11958
12053
|
</div>
|
|
11959
12054
|
@if (error) {
|
|
11960
|
-
<p [attr.id]="
|
|
12055
|
+
<p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
|
|
11961
12056
|
}
|
|
11962
12057
|
@if (hint && !error) {
|
|
11963
|
-
<p [attr.id]="
|
|
12058
|
+
<p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
|
|
11964
12059
|
}`,
|
|
11965
12060
|
})
|
|
11966
12061
|
export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLSelectElement> {
|
|
@@ -11968,7 +12063,6 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
11968
12063
|
options?: SelectPropsOption[]
|
|
11969
12064
|
/** Controlled value. */
|
|
11970
12065
|
value?: string
|
|
11971
|
-
/** Uncontrolled initial value. */
|
|
11972
12066
|
defaultValue?: string
|
|
11973
12067
|
/** Select size. */
|
|
11974
12068
|
size?: Size
|
|
@@ -11980,7 +12074,6 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
11980
12074
|
clearable?: boolean
|
|
11981
12075
|
className?: string
|
|
11982
12076
|
style?: Record<string, unknown>
|
|
11983
|
-
/** `data-testid` for the select. */
|
|
11984
12077
|
testId?: string
|
|
11985
12078
|
/** Disables the select. */
|
|
11986
12079
|
disabled?: boolean
|
|
@@ -11997,7 +12090,6 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
11997
12090
|
onKeyDown?: KeyboardEventHandler
|
|
11998
12091
|
|
|
11999
12092
|
@Output() readonly change = new EventEmitter<Event & KitFieldChangeEvent>()
|
|
12000
|
-
/** Fires the selected option's value. */
|
|
12001
12093
|
@Output() readonly valueChange = new EventEmitter<string>()
|
|
12002
12094
|
|
|
12003
12095
|
private selectEl?: ElementRef<HTMLSelectElement>
|
|
@@ -12010,14 +12102,15 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12010
12102
|
private readonly inner = signal<HTMLSelectElement | null>(null)
|
|
12011
12103
|
readonly element = this.inner.asReadonly()
|
|
12012
12104
|
|
|
12013
|
-
private readonly host = inject(ElementRef)
|
|
12105
|
+
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
12014
12106
|
|
|
12015
12107
|
private readonly generatedId = nextInstanceId()
|
|
12016
12108
|
|
|
12017
12109
|
private readonly i18n = useTranslation()
|
|
12018
12110
|
|
|
12019
|
-
|
|
12020
|
-
|
|
12111
|
+
externalDescription?: string | null
|
|
12112
|
+
externalInvalid?: AriaBoolean
|
|
12113
|
+
protected readonly hostAria = new FieldHostAria()
|
|
12021
12114
|
private externalMolId: string | undefined
|
|
12022
12115
|
|
|
12023
12116
|
/** The current class map. */
|
|
@@ -12030,25 +12123,26 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12030
12123
|
}
|
|
12031
12124
|
|
|
12032
12125
|
selectId(): string {
|
|
12033
|
-
|
|
12126
|
+
const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
|
|
12127
|
+
return this.id || this.fieldContext()?.id || externalId || this.generatedId
|
|
12034
12128
|
}
|
|
12035
12129
|
|
|
12036
12130
|
describedBy(): string | null {
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
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
|
|
12040
12133
|
}
|
|
12041
12134
|
fieldContext(): FormFieldContext | null {
|
|
12042
|
-
return fieldContext(this.host.nativeElement
|
|
12135
|
+
return fieldContext(this.host.nativeElement)
|
|
12043
12136
|
}
|
|
12044
12137
|
|
|
12045
12138
|
mergedDescribedBy(): string | null {
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12139
|
+
return descriptionIds(
|
|
12140
|
+
this.externalDescription ?? this.hostAria.description(),
|
|
12141
|
+
this.fieldContext()?.describedBy,
|
|
12142
|
+
this.describedBy(),
|
|
12143
|
+
)
|
|
12049
12144
|
}
|
|
12050
12145
|
|
|
12051
|
-
/** Computes the select class list. */
|
|
12052
12146
|
classes(): string {
|
|
12053
12147
|
return this.cm().cn(
|
|
12054
12148
|
this.cm().select({ error: !!this.error, size: this.size ?? 'md' }),
|
|
@@ -12072,8 +12166,8 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12072
12166
|
for (const option of this.options ?? []) {
|
|
12073
12167
|
const group = option.group || ''
|
|
12074
12168
|
const list = acc.get(group)
|
|
12075
|
-
if (list) list.push(option
|
|
12076
|
-
else acc.set(group, [option
|
|
12169
|
+
if (list) list.push(option)
|
|
12170
|
+
else acc.set(group, [option])
|
|
12077
12171
|
}
|
|
12078
12172
|
return [...acc.entries()].map(([group, options]) => ({ group, options }))
|
|
12079
12173
|
}
|
|
@@ -12094,11 +12188,11 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12094
12188
|
this.applyValue(false)
|
|
12095
12189
|
}
|
|
12096
12190
|
|
|
12191
|
+
ngDoCheck(): void {
|
|
12192
|
+
this.hostAria.read(this.host.nativeElement)
|
|
12193
|
+
}
|
|
12194
|
+
|
|
12097
12195
|
ngAfterViewInit(): void {
|
|
12098
|
-
if (!this.restDescribedByCaptured) {
|
|
12099
|
-
this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby')
|
|
12100
|
-
this.restDescribedByCaptured = true
|
|
12101
|
-
}
|
|
12102
12196
|
adoptHostDataMolId(
|
|
12103
12197
|
this.host.nativeElement,
|
|
12104
12198
|
this.selectEl?.nativeElement,
|
|
@@ -12107,7 +12201,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12107
12201
|
},
|
|
12108
12202
|
() => this.molId(),
|
|
12109
12203
|
)
|
|
12110
|
-
moveRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement)
|
|
12204
|
+
moveRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement, true)
|
|
12111
12205
|
this.applyValue(true)
|
|
12112
12206
|
}
|
|
12113
12207
|
|
|
@@ -12121,7 +12215,9 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12121
12215
|
},
|
|
12122
12216
|
() => this.molId(),
|
|
12123
12217
|
)
|
|
12124
|
-
reapplyRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement
|
|
12218
|
+
reapplyRestAttributes(this.host.nativeElement, this.selectEl?.nativeElement, {
|
|
12219
|
+
keepInvalid: true,
|
|
12220
|
+
})
|
|
12125
12221
|
this.applyValue(false)
|
|
12126
12222
|
}
|
|
12127
12223
|
|
|
@@ -12148,7 +12244,7 @@ export class Select implements AfterViewInit, AfterViewChecked, HasElement<HTMLS
|
|
|
12148
12244
|
}
|
|
12149
12245
|
```
|
|
12150
12246
|
|
|
12151
|
-
_(Member comments are shortened to their first sentence, and the
|
|
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`.)_
|
|
12152
12248
|
|
|
12153
12249
|
#### `Separator`
|
|
12154
12250
|
|
|
@@ -12815,9 +12911,7 @@ export class Spinner implements HasElement<HTMLDivElement> {
|
|
|
12815
12911
|
*/
|
|
12816
12912
|
hostStyle(): string | null {
|
|
12817
12913
|
const colorStyle =
|
|
12818
|
-
this.color &&
|
|
12819
|
-
typeof this.color === 'string' &&
|
|
12820
|
-
!NAMED_COLORS.includes(this.color as (typeof NAMED_COLORS)[number])
|
|
12914
|
+
this.color && typeof this.color === 'string' && !NAMED_COLORS.includes(this.color)
|
|
12821
12915
|
? { borderColor: this.color, borderTopColor: 'transparent' }
|
|
12822
12916
|
: undefined
|
|
12823
12917
|
return styleText({ ...this.style, ...colorStyle })
|
|
@@ -13167,7 +13261,7 @@ or plain functions returning text.
|
|
|
13167
13261
|
[molTemplateOutletContext]="cellContext(row, column, rowIdx)"
|
|
13168
13262
|
></ng-container>
|
|
13169
13263
|
} @else {
|
|
13170
|
-
{{ renderText(row, column,
|
|
13264
|
+
{{ renderText(row, column, rowIdx) }}
|
|
13171
13265
|
}
|
|
13172
13266
|
} @else {
|
|
13173
13267
|
{{ cellText(row, column) }}
|
|
@@ -13182,12 +13276,12 @@ or plain functions returning text.
|
|
|
13182
13276
|
})
|
|
13183
13277
|
export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTableElement> {
|
|
13184
13278
|
data: Record<string, unknown>[] = []
|
|
13185
|
-
columns:
|
|
13279
|
+
columns: AngularTableColumn[] = []
|
|
13186
13280
|
rowKey?: string | ((row: Record<string, unknown>) => string | number)
|
|
13187
13281
|
bordered?: boolean
|
|
13188
13282
|
striped?: boolean
|
|
13189
13283
|
hoverable = true
|
|
13190
|
-
size?:
|
|
13284
|
+
size?: Size
|
|
13191
13285
|
emptyContent?: unknown
|
|
13192
13286
|
loading?: boolean
|
|
13193
13287
|
sort?: { key: string; direction: 'asc' | 'desc' }
|
|
@@ -13239,7 +13333,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
|
|
|
13239
13333
|
return this.automationId ?? this.dataMolId ?? this.externalMolId
|
|
13240
13334
|
}
|
|
13241
13335
|
|
|
13242
|
-
headClasses(column:
|
|
13336
|
+
headClasses(column: AngularTableColumn): string {
|
|
13243
13337
|
return this.cm().cn(
|
|
13244
13338
|
this.cm().tableHead,
|
|
13245
13339
|
column.align === 'center' && this.cm().textCenter,
|
|
@@ -13248,11 +13342,11 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
|
|
|
13248
13342
|
)
|
|
13249
13343
|
}
|
|
13250
13344
|
|
|
13251
|
-
columnStyle(column:
|
|
13345
|
+
columnStyle(column: AngularTableColumn): string | null {
|
|
13252
13346
|
return styleText({ width: column.width })
|
|
13253
13347
|
}
|
|
13254
13348
|
|
|
13255
|
-
cellClasses(column:
|
|
13349
|
+
cellClasses(column: AngularTableColumn): string {
|
|
13256
13350
|
return this.cm().cn(
|
|
13257
13351
|
this.cm().tableCell,
|
|
13258
13352
|
column.align === 'center' && this.cm().textCenter,
|
|
@@ -13269,7 +13363,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
|
|
|
13269
13363
|
)
|
|
13270
13364
|
}
|
|
13271
13365
|
|
|
13272
|
-
ariaSort(column:
|
|
13366
|
+
ariaSort(column: AngularTableColumn): string | null {
|
|
13273
13367
|
if (!column.sortable) return null
|
|
13274
13368
|
if (this.sort?.key !== column.key) return 'none'
|
|
13275
13369
|
return this.sort.direction === 'asc' ? 'ascending' : 'descending'
|
|
@@ -13287,7 +13381,7 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
|
|
|
13287
13381
|
}
|
|
13288
13382
|
|
|
13289
13383
|
nodeText(value: unknown): string {
|
|
13290
|
-
return
|
|
13384
|
+
return nodeText(value)
|
|
13291
13385
|
}
|
|
13292
13386
|
|
|
13293
13387
|
asTemplate(value: unknown): TemplateRef<unknown> | null {
|
|
@@ -13296,43 +13390,41 @@ export class Table implements AfterViewInit, AfterViewChecked, HasElement<HTMLTa
|
|
|
13296
13390
|
|
|
13297
13391
|
rowKeyOf(row: Record<string, unknown>, index: number): string | number {
|
|
13298
13392
|
if (typeof this.rowKey === 'function') return this.rowKey(row)
|
|
13299
|
-
|
|
13300
|
-
return index
|
|
13393
|
+
const key = this.rowKey ? row[this.rowKey] : undefined
|
|
13394
|
+
return typeof key === 'string' || typeof key === 'number' ? key : index
|
|
13301
13395
|
}
|
|
13302
13396
|
|
|
13303
13397
|
cellContext(
|
|
13304
13398
|
row: Record<string, unknown>,
|
|
13305
|
-
column:
|
|
13399
|
+
column: AngularTableColumn,
|
|
13306
13400
|
index: number,
|
|
13307
13401
|
): Record<string, unknown> {
|
|
13308
|
-
const value = row[column.key
|
|
13402
|
+
const value = row[column.key]
|
|
13309
13403
|
return { $implicit: value, a0: value, a1: row, a2: index }
|
|
13310
13404
|
}
|
|
13311
13405
|
|
|
13312
|
-
renderText(
|
|
13313
|
-
|
|
13314
|
-
column: TableColumn<Record<string, unknown>>,
|
|
13315
|
-
index: number,
|
|
13316
|
-
): string {
|
|
13317
|
-
const render = column.render as unknown
|
|
13406
|
+
renderText(row: Record<string, unknown>, column: AngularTableColumn, index: number): string {
|
|
13407
|
+
const render = column.render
|
|
13318
13408
|
if (typeof render !== 'function') return ''
|
|
13319
|
-
|
|
13320
|
-
const result = (render as (v: unknown, r: unknown, i: number) => unknown)(value, row, index)
|
|
13321
|
-
return typeof result === 'string' ? result : ''
|
|
13409
|
+
return this.nodeText(render(row[column.key], row, index))
|
|
13322
13410
|
}
|
|
13323
13411
|
|
|
13324
|
-
cellText(row: Record<string, unknown>, column:
|
|
13325
|
-
const value = row[column.key
|
|
13412
|
+
cellText(row: Record<string, unknown>, column: AngularTableColumn): string {
|
|
13413
|
+
const value = row[column.key]
|
|
13326
13414
|
return value === undefined || value === null ? '' : String(value)
|
|
13327
13415
|
}
|
|
13328
13416
|
|
|
13329
|
-
handleSort(column:
|
|
13417
|
+
handleSort(column: AngularTableColumn): void {
|
|
13330
13418
|
if (!column.sortable || !this.onSort) return
|
|
13331
|
-
const key = column.key
|
|
13419
|
+
const key = column.key
|
|
13332
13420
|
const currentDirection = this.sort?.key === key ? this.sort.direction : undefined
|
|
13333
13421
|
this.onSort(key, currentDirection === 'asc' ? 'desc' : 'asc')
|
|
13334
13422
|
}
|
|
13335
|
-
|
|
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
|
|
13336
13428
|
```
|
|
13337
13429
|
|
|
13338
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`.)_
|
|
@@ -13471,13 +13563,16 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13471
13563
|
return getClassMap()
|
|
13472
13564
|
}
|
|
13473
13565
|
|
|
13566
|
+
/** Seeds the uncontrolled selection once so reordering tabs preserves it. */
|
|
13474
13567
|
ngOnInit(): void {
|
|
13475
|
-
this.internalValue.set(this.defaultValue
|
|
13568
|
+
this.internalValue.set(this.defaultValue ?? this.items.find((item) => !item.disabled)?.value)
|
|
13476
13569
|
}
|
|
13477
13570
|
|
|
13478
13571
|
activeValue(): string | undefined {
|
|
13479
|
-
|
|
13480
|
-
return this.
|
|
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
|
|
13481
13576
|
}
|
|
13482
13577
|
|
|
13483
13578
|
/** The tab button id for a value. */
|
|
@@ -13491,7 +13586,9 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13491
13586
|
}
|
|
13492
13587
|
|
|
13493
13588
|
controlsId(item: TabItem<string>): string | null {
|
|
13494
|
-
return item.value === this.activeValue() &&
|
|
13589
|
+
return item.value === this.activeValue() && rendersNode(item.content)
|
|
13590
|
+
? this.panelId(item.value)
|
|
13591
|
+
: null
|
|
13495
13592
|
}
|
|
13496
13593
|
|
|
13497
13594
|
/** The tab-list class list. */
|
|
@@ -13520,7 +13617,6 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13520
13617
|
return styleText(this.style)
|
|
13521
13618
|
}
|
|
13522
13619
|
|
|
13523
|
-
/** The `data-mol-id` value (`automationId` wins over a rest `data-mol-id`). */
|
|
13524
13620
|
molId(): string | undefined {
|
|
13525
13621
|
return (
|
|
13526
13622
|
this.automationId ??
|
|
@@ -13537,13 +13633,12 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13537
13633
|
|
|
13538
13634
|
/** A plain-string node value's text. */
|
|
13539
13635
|
nodeText(value: unknown): string {
|
|
13540
|
-
return
|
|
13636
|
+
return nodeText(value)
|
|
13541
13637
|
}
|
|
13542
13638
|
|
|
13543
|
-
/** Whether the active tab has content (React renders no panel without it). */
|
|
13544
13639
|
hasContent(): boolean {
|
|
13545
13640
|
const active = this.items.find((item) => item.value === this.activeValue())
|
|
13546
|
-
return
|
|
13641
|
+
return rendersNode(active?.content)
|
|
13547
13642
|
}
|
|
13548
13643
|
|
|
13549
13644
|
/** The active tab's content as a template. */
|
|
@@ -13594,7 +13689,6 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13594
13689
|
this.focusTab(nextValue)
|
|
13595
13690
|
}
|
|
13596
13691
|
|
|
13597
|
-
/** Moves focus to the tab with the given value (React's `tabRefs.focus()`). */
|
|
13598
13692
|
private focusTab(value: string): void {
|
|
13599
13693
|
const match = this.tabButtons?.find((ref) => ref.nativeElement.id === this.tabId(value))
|
|
13600
13694
|
match?.nativeElement.focus()
|
|
@@ -13602,7 +13696,7 @@ export class Tabs implements OnInit, HasElement<HTMLDivElement> {
|
|
|
13602
13696
|
}
|
|
13603
13697
|
```
|
|
13604
13698
|
|
|
13605
|
-
_(Member comments are shortened to their first sentence, and the
|
|
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`.)_
|
|
13606
13700
|
|
|
13607
13701
|
#### `Textarea`
|
|
13608
13702
|
|
|
@@ -13624,6 +13718,8 @@ user input exactly like React's controlled-input state restore.
|
|
|
13624
13718
|
'label',
|
|
13625
13719
|
'error',
|
|
13626
13720
|
'hint',
|
|
13721
|
+
'externalDescription: aria-describedby',
|
|
13722
|
+
'externalInvalid: aria-invalid',
|
|
13627
13723
|
'autoResize',
|
|
13628
13724
|
'minRows',
|
|
13629
13725
|
'maxRows',
|
|
@@ -13661,7 +13757,9 @@ user input exactly like React's controlled-input state restore.
|
|
|
13661
13757
|
[disabled]="disabled"
|
|
13662
13758
|
[attr.required]="required ? '' : null"
|
|
13663
13759
|
[attr.rows]="rows || minRows || 3"
|
|
13664
|
-
[attr.aria-invalid]="
|
|
13760
|
+
[attr.aria-invalid]="
|
|
13761
|
+
error || fieldContext()?.invalid ? true : (externalInvalid ?? hostAria.invalid() ?? false)
|
|
13762
|
+
"
|
|
13665
13763
|
[attr.aria-describedby]="mergedDescribedBy()"
|
|
13666
13764
|
[class]="classes()"
|
|
13667
13765
|
[attr.style]="hostStyle()"
|
|
@@ -13675,10 +13773,10 @@ user input exactly like React's controlled-input state restore.
|
|
|
13675
13773
|
#textareaEl
|
|
13676
13774
|
></textarea>
|
|
13677
13775
|
@if (error) {
|
|
13678
|
-
<p [attr.id]="
|
|
13776
|
+
<p [attr.id]="describedBy()" [class]="cm().formError">{{ error }}</p>
|
|
13679
13777
|
}
|
|
13680
13778
|
@if (hint && !error) {
|
|
13681
|
-
<p [attr.id]="
|
|
13779
|
+
<p [attr.id]="describedBy()" [class]="cm().formHint">{{ hint }}</p>
|
|
13682
13780
|
}`,
|
|
13683
13781
|
})
|
|
13684
13782
|
export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTMLTextAreaElement> {
|
|
@@ -13740,19 +13838,20 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13740
13838
|
}
|
|
13741
13839
|
|
|
13742
13840
|
private readonly inner = signal<HTMLTextAreaElement | null>(null)
|
|
13743
|
-
/** The element a caller's ref receives: the native `<textarea>`. */
|
|
13744
13841
|
readonly element = this.inner.asReadonly()
|
|
13745
13842
|
|
|
13746
|
-
private readonly host = inject(ElementRef)
|
|
13843
|
+
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
13747
13844
|
|
|
13845
|
+
/** Stable fallback for label and feedback associations. */
|
|
13748
13846
|
private readonly generatedId = nextInstanceId()
|
|
13749
13847
|
|
|
13750
13848
|
/** Reactive translation, read in the injection context. */
|
|
13751
13849
|
private readonly i18n = useTranslation()
|
|
13752
13850
|
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13851
|
+
/** Additional description ids supplied by the caller. */
|
|
13852
|
+
externalDescription?: string | null
|
|
13853
|
+
externalInvalid?: AriaBoolean
|
|
13854
|
+
protected readonly hostAria = new FieldHostAria()
|
|
13756
13855
|
private externalMolId: string | undefined
|
|
13757
13856
|
|
|
13758
13857
|
/** The current class map. */
|
|
@@ -13765,23 +13864,25 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13765
13864
|
}
|
|
13766
13865
|
|
|
13767
13866
|
textareaId(): string {
|
|
13768
|
-
|
|
13867
|
+
const externalId = !this.label && !this.hint && !this.error ? this.name : undefined
|
|
13868
|
+
return this.id || this.fieldContext()?.id || externalId || this.generatedId
|
|
13769
13869
|
}
|
|
13770
13870
|
|
|
13771
13871
|
/** The aria-describedby target (error or hint paragraph). */
|
|
13772
13872
|
describedBy(): string | null {
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
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
|
|
13776
13875
|
}
|
|
13777
13876
|
fieldContext(): FormFieldContext | null {
|
|
13778
|
-
return fieldContext(this.host.nativeElement
|
|
13877
|
+
return fieldContext(this.host.nativeElement)
|
|
13779
13878
|
}
|
|
13780
13879
|
|
|
13781
13880
|
mergedDescribedBy(): string | null {
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13881
|
+
return descriptionIds(
|
|
13882
|
+
this.externalDescription ?? this.hostAria.description(),
|
|
13883
|
+
this.fieldContext()?.describedBy,
|
|
13884
|
+
this.describedBy(),
|
|
13885
|
+
)
|
|
13785
13886
|
}
|
|
13786
13887
|
|
|
13787
13888
|
/** Computes the textarea class list. */
|
|
@@ -13833,11 +13934,11 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13833
13934
|
element.style.height = `${element.scrollHeight}px`
|
|
13834
13935
|
}
|
|
13835
13936
|
|
|
13937
|
+
ngDoCheck(): void {
|
|
13938
|
+
this.hostAria.read(this.host.nativeElement)
|
|
13939
|
+
}
|
|
13940
|
+
|
|
13836
13941
|
ngAfterViewInit(): void {
|
|
13837
|
-
if (!this.restDescribedByCaptured) {
|
|
13838
|
-
this.restDescribedBy = this.host.nativeElement.getAttribute('aria-describedby')
|
|
13839
|
-
this.restDescribedByCaptured = true
|
|
13840
|
-
}
|
|
13841
13942
|
adoptHostDataMolId(
|
|
13842
13943
|
this.host.nativeElement,
|
|
13843
13944
|
this.textareaEl?.nativeElement,
|
|
@@ -13846,14 +13947,12 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13846
13947
|
},
|
|
13847
13948
|
() => this.molId(),
|
|
13848
13949
|
)
|
|
13849
|
-
moveRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement)
|
|
13950
|
+
moveRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement, true)
|
|
13850
13951
|
this.applyValue(true)
|
|
13851
13952
|
this.resize()
|
|
13852
13953
|
}
|
|
13853
13954
|
|
|
13854
13955
|
ngAfterViewChecked(): void {
|
|
13855
|
-
// so this hook runs and the reapply below moves the caller's re-bound
|
|
13856
|
-
// rest attribute onto the textarea. Without the read, zoneless change
|
|
13857
13956
|
// detection never re-checks this view — the parent's re-bound
|
|
13858
13957
|
// `[attr.aria-label]` would land on the host and stay there.
|
|
13859
13958
|
void this.i18n.locale()
|
|
@@ -13865,7 +13964,9 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13865
13964
|
},
|
|
13866
13965
|
() => this.molId(),
|
|
13867
13966
|
)
|
|
13868
|
-
reapplyRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement
|
|
13967
|
+
reapplyRestAttributes(this.host.nativeElement, this.textareaEl?.nativeElement, {
|
|
13968
|
+
keepInvalid: true,
|
|
13969
|
+
})
|
|
13869
13970
|
this.applyValue(false)
|
|
13870
13971
|
this.resize()
|
|
13871
13972
|
}
|
|
@@ -13883,7 +13984,7 @@ export class Textarea implements AfterViewInit, AfterViewChecked, HasElement<HTM
|
|
|
13883
13984
|
}
|
|
13884
13985
|
```
|
|
13885
13986
|
|
|
13886
|
-
_(Member comments are shortened to their first sentence, and the
|
|
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`.)_
|
|
13887
13988
|
|
|
13888
13989
|
#### `ThemeToggle`
|
|
13889
13990
|
|
|
@@ -14667,9 +14768,9 @@ export class Tooltip
|
|
|
14667
14768
|
}
|
|
14668
14769
|
|
|
14669
14770
|
handleFocus(event: FocusEvent): void {
|
|
14670
|
-
const target = event.target
|
|
14771
|
+
const target = event.target
|
|
14671
14772
|
try {
|
|
14672
|
-
if (
|
|
14773
|
+
if (target instanceof Element && target.matches(':focus-visible')) this.show()
|
|
14673
14774
|
} catch (_error) {
|
|
14674
14775
|
}
|
|
14675
14776
|
}
|
|
@@ -14742,7 +14843,16 @@ export class Tooltip
|
|
|
14742
14843
|
onDismiss: this.hideListener,
|
|
14743
14844
|
})
|
|
14744
14845
|
}
|
|
14745
|
-
|
|
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
|
|
14746
14856
|
```
|
|
14747
14857
|
|
|
14748
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`.)_
|
|
@@ -15425,7 +15535,7 @@ export class UserMenu {
|
|
|
15425
15535
|
* @param event - The click event.
|
|
15426
15536
|
*/
|
|
15427
15537
|
handleTriggerClick(event: MouseEvent): void {
|
|
15428
|
-
if (this.onClick)
|
|
15538
|
+
if (this.onClick) this.onClick(event)
|
|
15429
15539
|
else this.isOpen.set(true)
|
|
15430
15540
|
}
|
|
15431
15541
|
}
|
|
@@ -15563,6 +15673,23 @@ class ElementPropsWriter {
|
|
|
15563
15673
|
}
|
|
15564
15674
|
```
|
|
15565
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
|
+
|
|
15566
15693
|
#### `MolIconSvg`
|
|
15567
15694
|
|
|
15568
15695
|
Internal SVG renderer used by every React-parity component where React
|
|
@@ -16022,6 +16149,14 @@ function createScrollLock(): {
|
|
|
16022
16149
|
|
|
16023
16150
|
**Returns:** Lock/unlock functions with a shared reference count.
|
|
16024
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
|
+
|
|
16025
16160
|
#### `fieldContext(host)`
|
|
16026
16161
|
|
|
16027
16162
|
Finds the nearest enclosing `FormField` context for a field's host element.
|
|
@@ -16183,7 +16318,7 @@ function resolveIcon(name: IconName, className?: string): ResolvedIcon
|
|
|
16183
16318
|
|
|
16184
16319
|
**Returns:** The resolved icon data.
|
|
16185
16320
|
|
|
16186
|
-
#### `moveRestAttributes(host, target)`
|
|
16321
|
+
#### `moveRestAttributes(host, target, keepFieldAria)`
|
|
16187
16322
|
|
|
16188
16323
|
Moves every rest attribute (`aria-*`, `data-*`, `id`, …) from the host
|
|
16189
16324
|
element onto the element React spreads `{...rest}` onto.
|
|
@@ -16193,11 +16328,16 @@ state (an accessible label that switches with the locale) re-moves the
|
|
|
16193
16328
|
re-bound ones with {@link reapplyRestAttributes}.
|
|
16194
16329
|
|
|
16195
16330
|
```typescript
|
|
16196
|
-
function moveRestAttributes(
|
|
16331
|
+
function moveRestAttributes(
|
|
16332
|
+
host: Element,
|
|
16333
|
+
target: Element | undefined | null,
|
|
16334
|
+
keepFieldAria?: boolean,
|
|
16335
|
+
): string[]
|
|
16197
16336
|
```
|
|
16198
16337
|
|
|
16199
16338
|
- `host` — The component host element.
|
|
16200
16339
|
- `target` — The element React's `...rest` targets.
|
|
16340
|
+
- `keepFieldAria` — Keep the host attributes used by a field's description and validation bindings.
|
|
16201
16341
|
|
|
16202
16342
|
**Returns:** The moved attribute names.
|
|
16203
16343
|
|