@mintplayer/ng-bootstrap 22.31.0 → 22.33.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 +12 -11
- package/_bootstrap.scss +2 -4
- package/a11y/forms/package.json +4 -0
- package/fesm2022/mintplayer-ng-bootstrap-a11y-forms.mjs +120 -0
- package/fesm2022/mintplayer-ng-bootstrap-a11y-forms.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs +3 -273
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs +72 -139
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs +34 -60
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +24 -27
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-breadcrumb.mjs +39 -17
- package/fesm2022/mintplayer-ng-bootstrap-breadcrumb.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-button-group.mjs +26 -6
- package/fesm2022/mintplayer-ng-bootstrap-button-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs +4 -8
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-card.mjs +169 -240
- package/fesm2022/mintplayer-ng-bootstrap-card.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs +9 -8
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-hierarchy.mjs +6 -8
- package/fesm2022/mintplayer-ng-bootstrap-charts-hierarchy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-sparkline.mjs +31 -40
- package/fesm2022/mintplayer-ng-bootstrap-charts-sparkline.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-charts-trend.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-charts-trend.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-checkbox.mjs +316 -211
- package/fesm2022/mintplayer-ng-bootstrap-checkbox.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-close.mjs +26 -12
- package/fesm2022/mintplayer-ng-bootstrap-close.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs +87 -676
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs +52 -119
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs +16 -24
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs +9 -11
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datetime-picker.mjs +9 -9
- package/fesm2022/mintplayer-ng-bootstrap-datetime-picker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dock.mjs +5 -7
- package/fesm2022/mintplayer-ng-bootstrap-dock.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +201 -197
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-file-manager.mjs +11 -19
- package/fesm2022/mintplayer-ng-bootstrap-file-manager.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs +64 -123
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-floating-labels.mjs +19 -29
- package/fesm2022/mintplayer-ng-bootstrap-floating-labels.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-for.mjs +8 -4
- package/fesm2022/mintplayer-ng-bootstrap-for.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-form.mjs +54 -35
- package/fesm2022/mintplayer-ng-bootstrap-form.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-grid.mjs +72 -99
- package/fesm2022/mintplayer-ng-bootstrap-grid.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-input-group.mjs +23 -36
- package/fesm2022/mintplayer-ng-bootstrap-input-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-list-group.mjs +45 -28
- package/fesm2022/mintplayer-ng-bootstrap-list-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs +214 -19
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-marquee.mjs +27 -12
- package/fesm2022/mintplayer-ng-bootstrap-marquee.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs +61 -245
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-multi-range.mjs +9 -11
- package/fesm2022/mintplayer-ng-bootstrap-multi-range.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-nav.mjs +92 -0
- package/fesm2022/mintplayer-ng-bootstrap-nav.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs +31 -15
- package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +49 -77
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs +53 -393
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-otp-input.mjs +11 -9
- package/fesm2022/mintplayer-ng-bootstrap-otp-input.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs +29 -49
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-parallax.mjs +21 -12
- package/fesm2022/mintplayer-ng-bootstrap-parallax.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-phone-input.mjs +12 -12
- package/fesm2022/mintplayer-ng-bootstrap-phone-input.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs +27 -49
- package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs +29 -15
- package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-popover.mjs +57 -253
- package/fesm2022/mintplayer-ng-bootstrap-popover.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-priority-nav.mjs +60 -335
- package/fesm2022/mintplayer-ng-bootstrap-priority-nav.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs +48 -57
- package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-query-builder.mjs +11 -15
- package/fesm2022/mintplayer-ng-bootstrap-query-builder.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-radio.mjs +235 -168
- package/fesm2022/mintplayer-ng-bootstrap-radio.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs +86 -44
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-rating.mjs +80 -137
- package/fesm2022/mintplayer-ng-bootstrap-rating.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs +29 -326
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-ribbon.mjs +47 -63
- package/fesm2022/mintplayer-ng-bootstrap-ribbon.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs +16 -22
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs +48 -171
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs +12 -10
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-shell.mjs +52 -108
- package/fesm2022/mintplayer-ng-bootstrap-shell.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs +9 -9
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs +25 -11
- package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs +6 -6
- package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs +37 -32
- package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs +61 -99
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-table.mjs +31 -30
- package/fesm2022/mintplayer-ng-bootstrap-table.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-theming.mjs +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-theming.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tile-manager.mjs +67 -306
- package/fesm2022/mintplayer-ng-bootstrap-tile-manager.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-timeline.mjs +7 -9
- package/fesm2022/mintplayer-ng-bootstrap-timeline.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs +14 -15
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-toast.mjs +109 -143
- package/fesm2022/mintplayer-ng-bootstrap-toast.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs +51 -154
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tree-select.mjs +9 -11
- package/fesm2022/mintplayer-ng-bootstrap-tree-select.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs +11 -13
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +160 -232
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
- package/nav/package.json +4 -0
- package/package.json +11 -28
- package/types/mintplayer-ng-bootstrap-a11y-forms.d.ts +64 -0
- package/types/mintplayer-ng-bootstrap-a11y.d.ts +3 -142
- package/types/mintplayer-ng-bootstrap-accordion.d.ts +51 -86
- package/types/mintplayer-ng-bootstrap-alert.d.ts +21 -28
- package/types/mintplayer-ng-bootstrap-badge.d.ts +13 -12
- package/types/mintplayer-ng-bootstrap-breadcrumb.d.ts +31 -8
- package/types/mintplayer-ng-bootstrap-button-group.d.ts +15 -4
- package/types/mintplayer-ng-bootstrap-calendar.d.ts +1 -5
- package/types/mintplayer-ng-bootstrap-card.d.ts +102 -76
- package/types/mintplayer-ng-bootstrap-carousel.d.ts +4 -6
- package/types/mintplayer-ng-bootstrap-charts-hierarchy.d.ts +4 -6
- package/types/mintplayer-ng-bootstrap-charts-sparkline.d.ts +24 -17
- package/types/mintplayer-ng-bootstrap-charts-trend.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-checkbox.d.ts +144 -92
- package/types/mintplayer-ng-bootstrap-close.d.ts +17 -5
- package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-color-picker.d.ts +42 -226
- package/types/mintplayer-ng-bootstrap-context-menu.d.ts +35 -17
- package/types/mintplayer-ng-bootstrap-datatable.d.ts +23 -35
- package/types/mintplayer-ng-bootstrap-datepicker.d.ts +3 -7
- package/types/mintplayer-ng-bootstrap-datetime-picker.d.ts +3 -5
- package/types/mintplayer-ng-bootstrap-dock.d.ts +6 -8
- package/types/mintplayer-ng-bootstrap-dropdown.d.ts +122 -54
- package/types/mintplayer-ng-bootstrap-file-manager.d.ts +10 -20
- package/types/mintplayer-ng-bootstrap-file-upload.d.ts +62 -44
- package/types/mintplayer-ng-bootstrap-floating-labels.d.ts +12 -15
- package/types/mintplayer-ng-bootstrap-for.d.ts +5 -5
- package/types/mintplayer-ng-bootstrap-form.d.ts +33 -11
- package/types/mintplayer-ng-bootstrap-grid.d.ts +42 -21
- package/types/mintplayer-ng-bootstrap-input-group.d.ts +11 -22
- package/types/mintplayer-ng-bootstrap-list-group.d.ts +31 -10
- package/types/mintplayer-ng-bootstrap-machine.d.ts +107 -5
- package/types/mintplayer-ng-bootstrap-marquee.d.ts +18 -5
- package/types/mintplayer-ng-bootstrap-modal.d.ts +43 -84
- package/types/mintplayer-ng-bootstrap-multi-range.d.ts +4 -6
- package/types/mintplayer-ng-bootstrap-nav.d.ts +52 -0
- package/types/mintplayer-ng-bootstrap-navbar-toggler.d.ts +22 -6
- package/types/mintplayer-ng-bootstrap-navbar.d.ts +27 -38
- package/types/mintplayer-ng-bootstrap-offcanvas.d.ts +35 -112
- package/types/mintplayer-ng-bootstrap-otp-input.d.ts +5 -4
- package/types/mintplayer-ng-bootstrap-pagination.d.ts +22 -34
- package/types/mintplayer-ng-bootstrap-parallax.d.ts +14 -4
- package/types/mintplayer-ng-bootstrap-phone-input.d.ts +6 -7
- package/types/mintplayer-ng-bootstrap-placeholder.d.ts +19 -18
- package/types/mintplayer-ng-bootstrap-playlist-toggler.d.ts +22 -6
- package/types/mintplayer-ng-bootstrap-popover.d.ts +36 -59
- package/types/mintplayer-ng-bootstrap-priority-nav.d.ts +80 -68
- package/types/mintplayer-ng-bootstrap-progress-bar.d.ts +35 -18
- package/types/mintplayer-ng-bootstrap-query-builder.d.ts +12 -20
- package/types/mintplayer-ng-bootstrap-radio.d.ts +112 -84
- package/types/mintplayer-ng-bootstrap-range.d.ts +36 -13
- package/types/mintplayer-ng-bootstrap-rating.d.ts +33 -42
- package/types/mintplayer-ng-bootstrap-resizable.d.ts +24 -114
- package/types/mintplayer-ng-bootstrap-ribbon.d.ts +21 -37
- package/types/mintplayer-ng-bootstrap-scheduler.d.ts +19 -27
- package/types/mintplayer-ng-bootstrap-scrollspy.d.ts +26 -50
- package/types/mintplayer-ng-bootstrap-select.d.ts +9 -8
- package/types/mintplayer-ng-bootstrap-shell.d.ts +40 -63
- package/types/mintplayer-ng-bootstrap-signature-pad.d.ts +5 -7
- package/types/mintplayer-ng-bootstrap-spinner.d.ts +14 -7
- package/types/mintplayer-ng-bootstrap-splitter.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-sticky-footer.d.ts +23 -13
- package/types/mintplayer-ng-bootstrap-tab-control.d.ts +61 -57
- package/types/mintplayer-ng-bootstrap-table.d.ts +23 -18
- package/types/mintplayer-ng-bootstrap-tile-manager.d.ts +94 -154
- package/types/mintplayer-ng-bootstrap-timeline.d.ts +23 -25
- package/types/mintplayer-ng-bootstrap-timepicker.d.ts +4 -8
- package/types/mintplayer-ng-bootstrap-toast.d.ts +94 -55
- package/types/mintplayer-ng-bootstrap-tooltip.d.ts +34 -33
- package/types/mintplayer-ng-bootstrap-tree-select.d.ts +14 -16
- package/types/mintplayer-ng-bootstrap-treeview.d.ts +12 -13
- package/types/mintplayer-ng-bootstrap-typeahead.d.ts +109 -133
- package/calendar-month/package.json +0 -4
- package/container/package.json +0 -4
- package/dropdown-divider/package.json +0 -4
- package/dropdown-menu/package.json +0 -4
- package/fesm2022/mintplayer-ng-bootstrap-calendar-month.mjs +0 -136
- package/fesm2022/mintplayer-ng-bootstrap-calendar-month.mjs.map +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-container.mjs +0 -18
- package/fesm2022/mintplayer-ng-bootstrap-container.mjs.map +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-divider.mjs +0 -23
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-divider.mjs.map +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +0 -161
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-has-overlay.mjs +0 -32
- package/fesm2022/mintplayer-ng-bootstrap-has-overlay.mjs.map +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-no-noscript.mjs +0 -31
- package/fesm2022/mintplayer-ng-bootstrap-no-noscript.mjs.map +0 -1
- package/has-overlay/package.json +0 -4
- package/no-noscript/package.json +0 -4
- package/types/mintplayer-ng-bootstrap-calendar-month.d.ts +0 -54
- package/types/mintplayer-ng-bootstrap-container.d.ts +0 -8
- package/types/mintplayer-ng-bootstrap-dropdown-divider.d.ts +0 -8
- package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +0 -94
- package/types/mintplayer-ng-bootstrap-has-overlay.d.ts +0 -22
- package/types/mintplayer-ng-bootstrap-no-noscript.d.ts +0 -11
package/README.md
CHANGED
|
@@ -6,17 +6,18 @@ This library was generated with [Nx](https://nx.dev).
|
|
|
6
6
|
|
|
7
7
|
Run `nx test mintplayer-ng-bootstrap` to execute the unit tests.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Architecture and styling
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Each component here is the Angular front of a framework-neutral TypeScript core in
|
|
12
|
+
`@mintplayer/ui-core` (state, keyboard, ARIA, async lifecycles). It renders its own HTML from that
|
|
13
|
+
core. It does **not** wrap or render a web component, so server rendering emits real markup.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
- **Styles ship per component.** A component installs its own scoped sheet and the Bootstrap partial
|
|
16
|
+
its markup uses, once per page, when it first renders (written into `<head>` during SSR). Your
|
|
17
|
+
global stylesheet loads only the page-level Bootstrap baseline, never component partials. A component
|
|
18
|
+
and its styles can ship in the lazy chunk of the page that uses it.
|
|
19
|
+
- **Light DOM, emulated encapsulation.** No shadow root. The component's CSS is scoped at build time onto
|
|
20
|
+
a `data-mps` attribute, like Angular's `_ngcontent`. Your CSS and Bootstrap's utilities reach anything
|
|
21
|
+
you render into a component, page CSS also reaches its internals, and its own rules cannot leak out.
|
|
20
22
|
|
|
21
|
-
See **Styling and encapsulation** in the [workspace README](../../README.md)
|
|
22
|
-
and the migration table.
|
|
23
|
+
See **Styling and encapsulation** in the [workspace README](../../README.md).
|
package/_bootstrap.scss
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
@use '@mintplayer/web-components/theming/color-mode.css';
|
|
4
|
-
// The Bootstrap baseline, in @layer mp.bootstrap (PRD #437 §6). Shared with the
|
|
1
|
+
// The Bootstrap baseline, in @layer mp.bootstrap (PRD #437 §6), including the
|
|
2
|
+
// --mp-color-mode dark-mode token (PRD dark-mode D6). Shared with the
|
|
5
3
|
// React and Vue libraries; see libs/mintplayer-ui-core/styles/bootstrap.scss.
|
|
6
4
|
@use '@mintplayer/ui-core/styles/bootstrap';
|
|
7
5
|
// CDK a11y utility styles: BsLiveAnnouncerService wraps CDK's LiveAnnouncer,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injector, ElementRef, input, signal, Directive } from '@angular/core';
|
|
3
|
+
import { NgControl, Validators } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads the host form control's validity: `invalid` (only once touched —
|
|
7
|
+
* Bootstrap's own convention, and untouched pristine forms must not scream),
|
|
8
|
+
* `required` (from the control's validators) and, when `[errorMessages]`
|
|
9
|
+
* supplies one, the message for the first active error.
|
|
10
|
+
*
|
|
11
|
+
* A front that renders its own template injects this directive and reads the
|
|
12
|
+
* signals into its core's attribute bags, so `aria-invalid` /
|
|
13
|
+
* `aria-errormessage` / `aria-describedby` land on the role-bearing node it
|
|
14
|
+
* owns. A wrapper that still renders an `mp-*` element as its template root
|
|
15
|
+
* (#437, until that component converts) gets the same state mirrored as the
|
|
16
|
+
* WC's `invalid` / `required` / `error-text` attributes instead.
|
|
17
|
+
*
|
|
18
|
+
* NgControl is resolved lazily via the injector: injecting it in the
|
|
19
|
+
* constructor recurses (NgControl resolution needs the value accessor being
|
|
20
|
+
* constructed). ngDoCheck keeps the state live at every CD pass, which is
|
|
21
|
+
* exactly the cadence Angular updates control state at (PRD 11a); it runs
|
|
22
|
+
* before the host's own view is checked, so the signals are fresh for it.
|
|
23
|
+
*/
|
|
24
|
+
class BsControlValidityDirective {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.injector = inject(Injector);
|
|
27
|
+
this.host = inject(ElementRef);
|
|
28
|
+
/**
|
|
29
|
+
* Validation messages by `NgControl` error key, e.g.
|
|
30
|
+
* `{ required: 'Pick a fruit.', minlength: 'Too short.' }`.
|
|
31
|
+
*
|
|
32
|
+
* The message for the first active error becomes the control's error
|
|
33
|
+
* message node. A key with no message simply produces no message, so a
|
|
34
|
+
* consumer can spell out the errors worth announcing and leave the rest to
|
|
35
|
+
* the visible form summary.
|
|
36
|
+
*/
|
|
37
|
+
this.errorMessages = input(null, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []));
|
|
39
|
+
this.invalidState = signal(false, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this.requiredState = signal(false, /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "requiredState" }] : /* istanbul ignore next */ []));
|
|
43
|
+
this.errorTextState = signal(null, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "errorTextState" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/** The control is invalid AND touched. */
|
|
46
|
+
this.invalid = this.invalidState.asReadonly();
|
|
47
|
+
this.required = this.requiredState.asReadonly();
|
|
48
|
+
/** Tied to `invalid`: `aria-errormessage` is only defined while the control is `aria-invalid`. */
|
|
49
|
+
this.errorText = this.errorTextState.asReadonly();
|
|
50
|
+
}
|
|
51
|
+
ngDoCheck() {
|
|
52
|
+
if (this.ngControl === undefined) {
|
|
53
|
+
this.ngControl = this.injector.get(NgControl, null);
|
|
54
|
+
}
|
|
55
|
+
const control = this.ngControl;
|
|
56
|
+
if (!control)
|
|
57
|
+
return;
|
|
58
|
+
const invalid = !!control.invalid && !!control.touched;
|
|
59
|
+
// requiredTrue is the checkbox-shaped required; hasValidator compares by
|
|
60
|
+
// reference, so both spellings must be probed.
|
|
61
|
+
const required = (control.control?.hasValidator(Validators.required) ?? false) ||
|
|
62
|
+
(control.control?.hasValidator(Validators.requiredTrue) ?? false);
|
|
63
|
+
const errorText = invalid ? this.activeMessage(control) : null;
|
|
64
|
+
this.invalidState.set(invalid);
|
|
65
|
+
this.requiredState.set(required);
|
|
66
|
+
this.errorTextState.set(errorText);
|
|
67
|
+
const target = this.host.nativeElement.firstElementChild;
|
|
68
|
+
if (target?.localName.includes('-')) {
|
|
69
|
+
this.mirror(target, 'invalid', invalid ? '' : null);
|
|
70
|
+
this.mirror(target, 'required', required ? '' : null);
|
|
71
|
+
this.mirror(target, 'error-text', errorText);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The message for the first of the control's active errors that has one.
|
|
76
|
+
* Validators report in the order they were composed, so a required-then-pattern
|
|
77
|
+
* field announces "required" until it has a value — the order the user meets
|
|
78
|
+
* them in.
|
|
79
|
+
*/
|
|
80
|
+
activeMessage(control) {
|
|
81
|
+
const messages = this.errorMessages();
|
|
82
|
+
if (!messages)
|
|
83
|
+
return null;
|
|
84
|
+
const key = Object.keys(control.errors ?? {}).find((error) => error in messages);
|
|
85
|
+
return key ? messages[key] : null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Writes only on a real change. `ngDoCheck` runs on every CD pass, and an
|
|
89
|
+
* unconditional `setAttribute` fires the WC's `attributeChangedCallback` even
|
|
90
|
+
* when the value is identical — which schedules a Lit render.
|
|
91
|
+
*/
|
|
92
|
+
mirror(target, name, value) {
|
|
93
|
+
if (value === null) {
|
|
94
|
+
if (target.hasAttribute(name))
|
|
95
|
+
target.removeAttribute(name);
|
|
96
|
+
}
|
|
97
|
+
else if (target.getAttribute(name) !== value) {
|
|
98
|
+
target.setAttribute(name, value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsControlValidityDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
102
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: BsControlValidityDirective, isStandalone: true, selector: "[bsControlValidity]", inputs: { errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
103
|
+
}
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsControlValidityDirective, decorators: [{
|
|
105
|
+
type: Directive,
|
|
106
|
+
args: [{
|
|
107
|
+
selector: '[bsControlValidity]',
|
|
108
|
+
}]
|
|
109
|
+
}], propDecorators: { errorMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessages", required: false }] }] } });
|
|
110
|
+
|
|
111
|
+
// The a11y helpers that need @angular/forms (#452). A separate entry so that
|
|
112
|
+
// importing `@mintplayer/ng-bootstrap/a11y` (id service, roving focus, overlay
|
|
113
|
+
// focus, …) never pulls @angular/forms into an app's bundle.
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generated bundle index. Do not edit.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export { BsControlValidityDirective };
|
|
120
|
+
//# sourceMappingURL=mintplayer-ng-bootstrap-a11y-forms.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-bootstrap-a11y-forms.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/a11y/forms/src/control-validity/control-validity.directive.ts","../../../../libs/mintplayer-ng-bootstrap/a11y/forms/src/index.ts","../../../../libs/mintplayer-ng-bootstrap/a11y/forms/mintplayer-ng-bootstrap-a11y-forms.ts"],"sourcesContent":["import { Directive, DoCheck, ElementRef, Injector, inject, input, signal } from '@angular/core';\nimport { NgControl, Validators } from '@angular/forms';\n\n/**\n * Reads the host form control's validity: `invalid` (only once touched —\n * Bootstrap's own convention, and untouched pristine forms must not scream),\n * `required` (from the control's validators) and, when `[errorMessages]`\n * supplies one, the message for the first active error.\n *\n * A front that renders its own template injects this directive and reads the\n * signals into its core's attribute bags, so `aria-invalid` /\n * `aria-errormessage` / `aria-describedby` land on the role-bearing node it\n * owns. A wrapper that still renders an `mp-*` element as its template root\n * (#437, until that component converts) gets the same state mirrored as the\n * WC's `invalid` / `required` / `error-text` attributes instead.\n *\n * NgControl is resolved lazily via the injector: injecting it in the\n * constructor recurses (NgControl resolution needs the value accessor being\n * constructed). ngDoCheck keeps the state live at every CD pass, which is\n * exactly the cadence Angular updates control state at (PRD 11a); it runs\n * before the host's own view is checked, so the signals are fresh for it.\n */\n@Directive({\n selector: '[bsControlValidity]',\n})\nexport class BsControlValidityDirective implements DoCheck {\n private readonly injector = inject(Injector);\n private readonly host = inject(ElementRef) as ElementRef<HTMLElement>;\n /** undefined = not resolved yet; null = no form control on this host. */\n private ngControl: NgControl | null | undefined;\n\n /**\n * Validation messages by `NgControl` error key, e.g.\n * `{ required: 'Pick a fruit.', minlength: 'Too short.' }`.\n *\n * The message for the first active error becomes the control's error\n * message node. A key with no message simply produces no message, so a\n * consumer can spell out the errors worth announcing and leave the rest to\n * the visible form summary.\n */\n readonly errorMessages = input<Record<string, string> | null>(null);\n\n private readonly invalidState = signal(false);\n private readonly requiredState = signal(false);\n private readonly errorTextState = signal<string | null>(null);\n\n /** The control is invalid AND touched. */\n readonly invalid = this.invalidState.asReadonly();\n readonly required = this.requiredState.asReadonly();\n /** Tied to `invalid`: `aria-errormessage` is only defined while the control is `aria-invalid`. */\n readonly errorText = this.errorTextState.asReadonly();\n\n ngDoCheck(): void {\n if (this.ngControl === undefined) {\n this.ngControl = this.injector.get(NgControl, null);\n }\n const control = this.ngControl;\n if (!control) return;\n\n const invalid = !!control.invalid && !!control.touched;\n // requiredTrue is the checkbox-shaped required; hasValidator compares by\n // reference, so both spellings must be probed.\n const required =\n (control.control?.hasValidator(Validators.required) ?? false) ||\n (control.control?.hasValidator(Validators.requiredTrue) ?? false);\n const errorText = invalid ? this.activeMessage(control) : null;\n\n this.invalidState.set(invalid);\n this.requiredState.set(required);\n this.errorTextState.set(errorText);\n\n const target = this.host.nativeElement.firstElementChild;\n if (target?.localName.includes('-')) {\n this.mirror(target, 'invalid', invalid ? '' : null);\n this.mirror(target, 'required', required ? '' : null);\n this.mirror(target, 'error-text', errorText);\n }\n }\n\n /**\n * The message for the first of the control's active errors that has one.\n * Validators report in the order they were composed, so a required-then-pattern\n * field announces \"required\" until it has a value — the order the user meets\n * them in.\n */\n private activeMessage(control: NgControl): string | null {\n const messages = this.errorMessages();\n if (!messages) return null;\n const key = Object.keys(control.errors ?? {}).find((error) => error in messages);\n return key ? messages[key] : null;\n }\n\n /**\n * Writes only on a real change. `ngDoCheck` runs on every CD pass, and an\n * unconditional `setAttribute` fires the WC's `attributeChangedCallback` even\n * when the value is identical — which schedules a Lit render.\n */\n private mirror(target: Element, name: string, value: string | null): void {\n if (value === null) {\n if (target.hasAttribute(name)) target.removeAttribute(name);\n } else if (target.getAttribute(name) !== value) {\n target.setAttribute(name, value);\n }\n }\n}\n","// The a11y helpers that need @angular/forms (#452). A separate entry so that\n// importing `@mintplayer/ng-bootstrap/a11y` (id service, roving focus, overlay\n// focus, …) never pulls @angular/forms into an app's bundle.\nexport * from './control-validity/control-validity.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, ElementRef, PLATFORM_ID, DestroyRef, afterNextRender, Directive, forwardRef, input, signal, computed, contentChildren
|
|
2
|
+
import { Injectable, inject, ElementRef, PLATFORM_ID, DestroyRef, afterNextRender, Directive, forwardRef, input, signal, computed, contentChildren } from '@angular/core';
|
|
3
3
|
import { isPlatformServer } from '@angular/common';
|
|
4
4
|
import { firstEnabledIndex, lastEnabledIndex, nextEnabledIndex } from '@mintplayer/ui-core/roving';
|
|
5
|
-
import {
|
|
6
|
-
import { dismissStack } from '@mintplayer/ui-core/overlay';
|
|
7
|
-
import { NgControl, Validators } from '@angular/forms';
|
|
5
|
+
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* App-wide unique ID generator for ARIA wiring (`aria-controls`,
|
|
@@ -370,106 +368,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
370
368
|
}]
|
|
371
369
|
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrap", required: false }] }], items: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => BsRovingFocusItemDirective), { isSignal: true }] }] } });
|
|
372
370
|
|
|
373
|
-
/**
|
|
374
|
-
* Activates a CDK focus trap on the host element while `bsOverlayFocus` is true,
|
|
375
|
-
* captures the trigger before activation, and returns focus to it on deactivation.
|
|
376
|
-
*
|
|
377
|
-
* Initial focus inside the trap defaults to the first tabbable descendant; pass
|
|
378
|
-
* an explicit HTMLElement, 'self' (focus the host), or 'none' to opt out.
|
|
379
|
-
*
|
|
380
|
-
* Background `inert` / `aria-hidden` is intentionally not handled here — it is
|
|
381
|
-
* the consuming component's job (a modal hides app-root, a popover does not).
|
|
382
|
-
*/
|
|
383
|
-
class BsOverlayFocusDirective {
|
|
384
|
-
constructor() {
|
|
385
|
-
this.elementRef = inject(ElementRef);
|
|
386
|
-
this.trapFactory = inject(ConfigurableFocusTrapFactory);
|
|
387
|
-
this.interactivityChecker = inject(InteractivityChecker);
|
|
388
|
-
this.destroyRef = inject(DestroyRef);
|
|
389
|
-
this.active = input(true, { ...(ngDevMode ? { debugName: "active" } : /* istanbul ignore next */ {}), alias: 'bsOverlayFocus' });
|
|
390
|
-
this.initialFocus = input('first', /* @ts-ignore */
|
|
391
|
-
...(ngDevMode ? [{ debugName: "initialFocus" }] : /* istanbul ignore next */ []));
|
|
392
|
-
this.returnFocus = input(true, /* @ts-ignore */
|
|
393
|
-
...(ngDevMode ? [{ debugName: "returnFocus" }] : /* istanbul ignore next */ []));
|
|
394
|
-
this.trap = null;
|
|
395
|
-
this.restoreTo = null;
|
|
396
|
-
effect(() => {
|
|
397
|
-
if (this.active())
|
|
398
|
-
this.engage();
|
|
399
|
-
else
|
|
400
|
-
this.disengage();
|
|
401
|
-
});
|
|
402
|
-
this.destroyRef.onDestroy(() => this.disengage());
|
|
403
|
-
}
|
|
404
|
-
engage() {
|
|
405
|
-
if (this.trap)
|
|
406
|
-
return;
|
|
407
|
-
this.restoreTo = (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement)
|
|
408
|
-
? document.activeElement
|
|
409
|
-
: null;
|
|
410
|
-
this.trap = this.trapFactory.create(this.elementRef.nativeElement);
|
|
411
|
-
const target = this.initialFocus();
|
|
412
|
-
if (target instanceof HTMLElement) {
|
|
413
|
-
target.focus({ preventScroll: true });
|
|
414
|
-
}
|
|
415
|
-
else if (target === 'self') {
|
|
416
|
-
this.elementRef.nativeElement.focus({ preventScroll: true });
|
|
417
|
-
}
|
|
418
|
-
else if (target === 'first') {
|
|
419
|
-
this.focusFirstTabbable();
|
|
420
|
-
}
|
|
421
|
-
// 'none' — caller manages focus
|
|
422
|
-
}
|
|
423
|
-
focusFirstTabbable() {
|
|
424
|
-
// Walk the host's subtree and let CDK decide what's focusable — handles
|
|
425
|
-
// disabled fieldsets, inert ancestors, and the long tail of edge cases
|
|
426
|
-
// the inline selector would have to re-implement.
|
|
427
|
-
//
|
|
428
|
-
// `isFocusable({ ignoreVisibility: true })` because jsdom doesn't lay
|
|
429
|
-
// elements out, so CDK's default visibility check (`getClientRects()`)
|
|
430
|
-
// would reject everything in tests; in real browsers visible elements
|
|
431
|
-
// pass either way. Tabindex < 0 is filtered manually so the host (which
|
|
432
|
-
// we set `tabindex="-1"` on for the focus trap) doesn't get selected.
|
|
433
|
-
const root = this.elementRef.nativeElement;
|
|
434
|
-
const walker = (root.ownerDocument ?? document).createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
|
|
435
|
-
let node = walker.currentNode;
|
|
436
|
-
while (node) {
|
|
437
|
-
if (node instanceof HTMLElement
|
|
438
|
-
&& node.tabIndex >= 0
|
|
439
|
-
// `:disabled` catches both own `disabled` and the inherited form of
|
|
440
|
-
// it from an ancestor `<fieldset disabled>` — CDK's isFocusable only
|
|
441
|
-
// looks at own attributes.
|
|
442
|
-
&& !node.matches(':disabled')
|
|
443
|
-
&& this.interactivityChecker.isFocusable(node, { ignoreVisibility: true })) {
|
|
444
|
-
node.focus({ preventScroll: true });
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
node = walker.nextNode();
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
disengage() {
|
|
451
|
-
if (!this.trap)
|
|
452
|
-
return;
|
|
453
|
-
this.trap.destroy();
|
|
454
|
-
this.trap = null;
|
|
455
|
-
if (this.returnFocus() && this.restoreTo && typeof document !== 'undefined' && document.contains(this.restoreTo)) {
|
|
456
|
-
// preventScroll so closing an overlay never yanks the page back to the
|
|
457
|
-
// trigger's position — the user's scroll position is their choice.
|
|
458
|
-
this.restoreTo.focus({ preventScroll: true });
|
|
459
|
-
}
|
|
460
|
-
this.restoreTo = null;
|
|
461
|
-
}
|
|
462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsOverlayFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
463
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: BsOverlayFocusDirective, isStandalone: true, selector: "[bsOverlayFocus]", inputs: { active: { classPropertyName: "active", publicName: "bsOverlayFocus", isSignal: true, isRequired: false, transformFunction: null }, initialFocus: { classPropertyName: "initialFocus", publicName: "initialFocus", isSignal: true, isRequired: false, transformFunction: null }, returnFocus: { classPropertyName: "returnFocus", publicName: "returnFocus", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["bsOverlayFocus"], ngImport: i0 }); }
|
|
464
|
-
}
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsOverlayFocusDirective, decorators: [{
|
|
466
|
-
type: Directive,
|
|
467
|
-
args: [{
|
|
468
|
-
selector: '[bsOverlayFocus]',
|
|
469
|
-
exportAs: 'bsOverlayFocus',
|
|
470
|
-
}]
|
|
471
|
-
}], ctorParameters: () => [], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "bsOverlayFocus", required: false }] }], initialFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialFocus", required: false }] }], returnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "returnFocus", required: false }] }] } });
|
|
472
|
-
|
|
473
371
|
/**
|
|
474
372
|
* Thin wrapper over CDK's LiveAnnouncer that dedupes consecutive identical
|
|
475
373
|
* messages — typeahead-style "5 results" announcements often re-fire with the
|
|
@@ -499,174 +397,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
499
397
|
args: [{ providedIn: 'root' }]
|
|
500
398
|
}] });
|
|
501
399
|
|
|
502
|
-
/**
|
|
503
|
-
* Angular facade over the document's single dismiss stack, so each overlay can
|
|
504
|
-
* decide whether its global Escape listener should fire.
|
|
505
|
-
*
|
|
506
|
-
* The problem: popover, tooltip, dropdown-menu, priority-nav, and modal each
|
|
507
|
-
* bind a `(document:keydown.escape)` (or equivalent host listener) that closes
|
|
508
|
-
* the overlay unconditionally. With nesting (popover-under-modal,
|
|
509
|
-
* tooltip-under-popover), a single Escape closes both because both handlers
|
|
510
|
-
* fire on the same event.
|
|
511
|
-
*
|
|
512
|
-
* The fix: every overlay calls `push()` when it opens and `release(token)`
|
|
513
|
-
* when it closes; its Escape handler runs only when `isTop(token)` returns
|
|
514
|
-
* true. The top-most overlay consumes Escape; lower frames stay open.
|
|
515
|
-
*
|
|
516
|
-
* **This is now a facade, and that matters.** The state lives in
|
|
517
|
-
* `@mintplayer/ui-core/overlay`'s `dismissStack`, shared with
|
|
518
|
-
* `OverlayController`. It used to be a private array here, and the web
|
|
519
|
-
* components had their own — so an Angular overlay wrapping a web-component
|
|
520
|
-
* overlay (`bs-tree-select` inside `bs-modal`, the ordinary case) had one frame
|
|
521
|
-
* on each stack, both believed they were top-most, and one Escape closed both.
|
|
522
|
-
* Angular keeps the DI ergonomics; there is exactly one array.
|
|
523
|
-
*
|
|
524
|
-
* Identity is a per-call `symbol` token rather than a string, so two opens of
|
|
525
|
-
* the same directive don't collide and a stale token can't accidentally match
|
|
526
|
-
* a future frame.
|
|
527
|
-
*
|
|
528
|
-
* **What this does NOT promise:**
|
|
529
|
-
* - **Visual z-order.** The stack tracks logical open-order (the sequence of
|
|
530
|
-
* `push()` calls). A consumer that manually reorders overlays in the DOM
|
|
531
|
-
* could see Escape close a logically-deeper overlay. We don't support that.
|
|
532
|
-
* - **Coordination with non-overlay listeners.** A consumer's own
|
|
533
|
-
* `keydown.escape` listener that doesn't ask the stack will still fire.
|
|
534
|
-
*/
|
|
535
|
-
class BsOverlayStackService {
|
|
536
|
-
/** Allocate a new frame on top of the stack and return its token. */
|
|
537
|
-
push() {
|
|
538
|
-
return dismissStack.push('bs-overlay-frame');
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Remove `token` from the stack. Releasing a non-top token is allowed —
|
|
542
|
-
* it's how an inner overlay closes itself programmatically without an
|
|
543
|
-
* Escape press (e.g. a popover closed by clicking its trigger again).
|
|
544
|
-
*/
|
|
545
|
-
release(token) {
|
|
546
|
-
dismissStack.release(token);
|
|
547
|
-
}
|
|
548
|
-
/** True if `token` is the top of the stack. */
|
|
549
|
-
isTop(token) {
|
|
550
|
-
return dismissStack.isTop(token);
|
|
551
|
-
}
|
|
552
|
-
/** Token at the top of the stack, or null if empty. */
|
|
553
|
-
peek() {
|
|
554
|
-
return dismissStack.peek();
|
|
555
|
-
}
|
|
556
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsOverlayStackService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
557
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsOverlayStackService, providedIn: 'root' }); }
|
|
558
|
-
}
|
|
559
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsOverlayStackService, decorators: [{
|
|
560
|
-
type: Injectable,
|
|
561
|
-
args: [{ providedIn: 'root' }]
|
|
562
|
-
}] });
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Reads the host form control's validity: `invalid` (only once touched —
|
|
566
|
-
* Bootstrap's own convention, and untouched pristine forms must not scream),
|
|
567
|
-
* `required` (from the control's validators) and, when `[errorMessages]`
|
|
568
|
-
* supplies one, the message for the first active error.
|
|
569
|
-
*
|
|
570
|
-
* A front that renders its own template injects this directive and reads the
|
|
571
|
-
* signals into its core's attribute bags, so `aria-invalid` /
|
|
572
|
-
* `aria-errormessage` / `aria-describedby` land on the role-bearing node it
|
|
573
|
-
* owns. A wrapper that still renders an `mp-*` element as its template root
|
|
574
|
-
* (#437, until that component converts) gets the same state mirrored as the
|
|
575
|
-
* WC's `invalid` / `required` / `error-text` attributes instead.
|
|
576
|
-
*
|
|
577
|
-
* NgControl is resolved lazily via the injector: injecting it in the
|
|
578
|
-
* constructor recurses (NgControl resolution needs the value accessor being
|
|
579
|
-
* constructed). ngDoCheck keeps the state live at every CD pass, which is
|
|
580
|
-
* exactly the cadence Angular updates control state at (PRD 11a); it runs
|
|
581
|
-
* before the host's own view is checked, so the signals are fresh for it.
|
|
582
|
-
*/
|
|
583
|
-
class BsControlValidityDirective {
|
|
584
|
-
constructor() {
|
|
585
|
-
this.injector = inject(Injector);
|
|
586
|
-
this.host = inject(ElementRef);
|
|
587
|
-
/**
|
|
588
|
-
* Validation messages by `NgControl` error key, e.g.
|
|
589
|
-
* `{ required: 'Pick a fruit.', minlength: 'Too short.' }`.
|
|
590
|
-
*
|
|
591
|
-
* The message for the first active error becomes the control's error
|
|
592
|
-
* message node. A key with no message simply produces no message, so a
|
|
593
|
-
* consumer can spell out the errors worth announcing and leave the rest to
|
|
594
|
-
* the visible form summary.
|
|
595
|
-
*/
|
|
596
|
-
this.errorMessages = input(null, /* @ts-ignore */
|
|
597
|
-
...(ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []));
|
|
598
|
-
this.invalidState = signal(false, /* @ts-ignore */
|
|
599
|
-
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
600
|
-
this.requiredState = signal(false, /* @ts-ignore */
|
|
601
|
-
...(ngDevMode ? [{ debugName: "requiredState" }] : /* istanbul ignore next */ []));
|
|
602
|
-
this.errorTextState = signal(null, /* @ts-ignore */
|
|
603
|
-
...(ngDevMode ? [{ debugName: "errorTextState" }] : /* istanbul ignore next */ []));
|
|
604
|
-
/** The control is invalid AND touched. */
|
|
605
|
-
this.invalid = this.invalidState.asReadonly();
|
|
606
|
-
this.required = this.requiredState.asReadonly();
|
|
607
|
-
/** Tied to `invalid`: `aria-errormessage` is only defined while the control is `aria-invalid`. */
|
|
608
|
-
this.errorText = this.errorTextState.asReadonly();
|
|
609
|
-
}
|
|
610
|
-
ngDoCheck() {
|
|
611
|
-
if (this.ngControl === undefined) {
|
|
612
|
-
this.ngControl = this.injector.get(NgControl, null);
|
|
613
|
-
}
|
|
614
|
-
const control = this.ngControl;
|
|
615
|
-
if (!control)
|
|
616
|
-
return;
|
|
617
|
-
const invalid = !!control.invalid && !!control.touched;
|
|
618
|
-
// requiredTrue is the checkbox-shaped required; hasValidator compares by
|
|
619
|
-
// reference, so both spellings must be probed.
|
|
620
|
-
const required = (control.control?.hasValidator(Validators.required) ?? false) ||
|
|
621
|
-
(control.control?.hasValidator(Validators.requiredTrue) ?? false);
|
|
622
|
-
const errorText = invalid ? this.activeMessage(control) : null;
|
|
623
|
-
this.invalidState.set(invalid);
|
|
624
|
-
this.requiredState.set(required);
|
|
625
|
-
this.errorTextState.set(errorText);
|
|
626
|
-
const target = this.host.nativeElement.firstElementChild;
|
|
627
|
-
if (target?.localName.includes('-')) {
|
|
628
|
-
this.mirror(target, 'invalid', invalid ? '' : null);
|
|
629
|
-
this.mirror(target, 'required', required ? '' : null);
|
|
630
|
-
this.mirror(target, 'error-text', errorText);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* The message for the first of the control's active errors that has one.
|
|
635
|
-
* Validators report in the order they were composed, so a required-then-pattern
|
|
636
|
-
* field announces "required" until it has a value — the order the user meets
|
|
637
|
-
* them in.
|
|
638
|
-
*/
|
|
639
|
-
activeMessage(control) {
|
|
640
|
-
const messages = this.errorMessages();
|
|
641
|
-
if (!messages)
|
|
642
|
-
return null;
|
|
643
|
-
const key = Object.keys(control.errors ?? {}).find((error) => error in messages);
|
|
644
|
-
return key ? messages[key] : null;
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Writes only on a real change. `ngDoCheck` runs on every CD pass, and an
|
|
648
|
-
* unconditional `setAttribute` fires the WC's `attributeChangedCallback` even
|
|
649
|
-
* when the value is identical — which schedules a Lit render.
|
|
650
|
-
*/
|
|
651
|
-
mirror(target, name, value) {
|
|
652
|
-
if (value === null) {
|
|
653
|
-
if (target.hasAttribute(name))
|
|
654
|
-
target.removeAttribute(name);
|
|
655
|
-
}
|
|
656
|
-
else if (target.getAttribute(name) !== value) {
|
|
657
|
-
target.setAttribute(name, value);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsControlValidityDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
661
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: BsControlValidityDirective, isStandalone: true, selector: "[bsControlValidity]", inputs: { errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
662
|
-
}
|
|
663
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsControlValidityDirective, decorators: [{
|
|
664
|
-
type: Directive,
|
|
665
|
-
args: [{
|
|
666
|
-
selector: '[bsControlValidity]',
|
|
667
|
-
}]
|
|
668
|
-
}], propDecorators: { errorMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessages", required: false }] }] } });
|
|
669
|
-
|
|
670
400
|
/**
|
|
671
401
|
* Collects a front's host attributes that belong on its role-bearing inner
|
|
672
402
|
* node: `aria-*` are copied (harmless on a roleless host), `id` and `tabindex`
|
|
@@ -688,5 +418,5 @@ function takeHostAria(host) {
|
|
|
688
418
|
* Generated bundle index. Do not edit.
|
|
689
419
|
*/
|
|
690
420
|
|
|
691
|
-
export {
|
|
421
|
+
export { BsForwardAriaDirective, BsIdService, BsLiveAnnouncerService, BsRovingFocusDirective, BsRovingFocusItemDirective, takeHostAria };
|
|
692
422
|
//# sourceMappingURL=mintplayer-ng-bootstrap-a11y.mjs.map
|