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