@angular/material 19.0.0-next.9 → 19.0.0-rc.1
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/autocomplete/_autocomplete-theme.scss +8 -4
- package/autocomplete/index.d.ts +5 -6
- package/badge/_badge-theme.scss +10 -6
- package/badge/index.d.ts +1 -2
- package/bottom-sheet/_bottom-sheet-theme.scss +8 -4
- package/button/_button-theme.scss +10 -6
- package/button/_fab-theme.scss +10 -6
- package/button/_icon-button-theme.scss +8 -4
- package/button/index.d.ts +1 -1
- package/button-toggle/_button-toggle-theme.scss +11 -6
- package/button-toggle/index.d.ts +2 -1
- package/card/_card-theme.scss +8 -4
- package/card/index.d.ts +2 -3
- package/checkbox/_checkbox-theme.scss +10 -6
- package/chips/_chips-theme.scss +10 -6
- package/core/_core-theme.scss +4 -7
- package/core/_core.scss +2 -5
- package/core/m2/_theming.scss +2 -1
- package/core/option/_optgroup-theme.scss +8 -4
- package/core/option/_option-theme.scss +10 -6
- package/core/ripple/_ripple-theme.scss +8 -4
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +10 -6
- package/core/theming/_config-validation.scss +4 -4
- package/core/theming/_definition.scss +12 -2
- package/core/theming/_theming.scss +2 -1
- package/core/tokens/_m3-system.scss +55 -39
- package/core/tokens/_m3-tokens.scss +3 -3
- package/core/tokens/_token-definition.scss +4 -3
- package/core/tokens/m2/mat/_badge.scss +1 -1
- package/core/tokens/m2/mat/_datepicker.scss +1 -1
- package/core/tokens/m2/mat/_menu.scss +5 -3
- package/core/tokens/m2/mat/_sort.scss +1 -1
- package/core/tokens/m3/mat/_menu.scss +6 -3
- package/core/tokens/m3/mdc/_filled-text-field.scss +9 -11
- package/datepicker/_datepicker-theme.scss +10 -6
- package/datepicker/index.d.ts +36 -37
- package/dialog/_dialog-theme.scss +8 -4
- package/dialog/index.d.ts +1 -0
- package/divider/_divider-theme.scss +8 -4
- package/expansion/_expansion-theme.scss +8 -4
- package/fesm2022/autocomplete/testing.mjs +2 -5
- package/fesm2022/autocomplete/testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +225 -151
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge/testing.mjs +2 -5
- package/fesm2022/badge/testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +45 -36
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet/testing.mjs +1 -1
- package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +79 -57
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button/testing.mjs +2 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button-toggle/testing.mjs +4 -7
- package/fesm2022/button-toggle/testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +84 -47
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +98 -71
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card/testing.mjs +3 -6
- package/fesm2022/card/testing.mjs.map +1 -1
- package/fesm2022/card.mjs +53 -55
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox/testing.mjs +4 -7
- package/fesm2022/checkbox/testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +105 -63
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips/testing.mjs +11 -14
- package/fesm2022/chips/testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +317 -268
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core/testing.mjs +5 -11
- package/fesm2022/core/testing.mjs.map +1 -1
- package/fesm2022/core.mjs +237 -187
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker/testing.mjs +13 -22
- package/fesm2022/datepicker/testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +821 -568
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog/testing.mjs +15 -9
- package/fesm2022/dialog/testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +221 -153
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider/testing.mjs +1 -1
- package/fesm2022/divider/testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +9 -11
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion/testing.mjs +7 -10
- package/fesm2022/expansion/testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +85 -76
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field/testing.mjs +12 -15
- package/fesm2022/form-field/testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +179 -126
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list/testing.mjs +11 -17
- package/fesm2022/grid-list/testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +72 -50
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +8 -8
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +65 -45
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input/testing.mjs +3 -3
- package/fesm2022/input/testing.mjs.map +1 -1
- package/fesm2022/input.mjs +104 -72
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list/testing.mjs +21 -38
- package/fesm2022/list/testing.mjs.map +1 -1
- package/fesm2022/list.mjs +191 -180
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu/testing.mjs +3 -6
- package/fesm2022/menu/testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +178 -168
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator/testing.mjs +10 -13
- package/fesm2022/paginator/testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +84 -59
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar/testing.mjs +1 -1
- package/fesm2022/progress-bar/testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +35 -34
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner/testing.mjs +1 -1
- package/fesm2022/progress-spinner/testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +27 -13
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio/testing.mjs +6 -12
- package/fesm2022/radio/testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +123 -88
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select/testing.mjs +6 -9
- package/fesm2022/select/testing.mjs.map +1 -1
- package/fesm2022/select.mjs +220 -182
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav/testing.mjs +6 -6
- package/fesm2022/sidenav/testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +132 -119
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle/testing.mjs +3 -6
- package/fesm2022/slide-toggle/testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +78 -49
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider/testing.mjs +2 -2
- package/fesm2022/slider/testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +260 -190
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar/testing.mjs +4 -7
- package/fesm2022/snack-bar/testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +141 -107
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort/testing.mjs +3 -6
- package/fesm2022/sort/testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +93 -72
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper/testing.mjs +4 -4
- package/fesm2022/stepper/testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +143 -105
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table/testing.mjs +13 -25
- package/fesm2022/table/testing.mjs.map +1 -1
- package/fesm2022/table.mjs +182 -177
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs/testing.mjs +5 -5
- package/fesm2022/tabs/testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +326 -247
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker/testing.mjs +7 -16
- package/fesm2022/timepicker/testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +157 -153
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar/testing.mjs +2 -5
- package/fesm2022/toolbar/testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +25 -15
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip/testing.mjs +6 -9
- package/fesm2022/tooltip/testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +96 -72
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree/testing.mjs +3 -6
- package/fesm2022/tree/testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +56 -54
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/_form-field-theme.scss +9 -5
- package/form-field/index.d.ts +9 -9
- package/grid-list/_grid-list-theme.scss +8 -4
- package/icon/_icon-theme.scss +10 -6
- package/input/_input-theme.scss +8 -4
- package/list/_list-theme.scss +8 -4
- package/list/index.d.ts +20 -21
- package/menu/_menu-theme.scss +8 -4
- package/menu/index.d.ts +15 -17
- package/package.json +2 -2
- package/paginator/_paginator-theme.scss +8 -4
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress-bar/_progress-bar-theme.scss +11 -9
- package/progress-spinner/_progress-spinner-theme.scss +11 -9
- package/progress-spinner/index.d.ts +3 -4
- package/radio/_radio-theme.scss +10 -6
- package/radio/index.d.ts +2 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-add/theming/create-custom-theme.js +1 -6
- package/schematics/ng-add/theming/create-custom-theme.mjs +1 -6
- package/schematics/ng-generate/theme-color/index_bundled.js +35 -9
- package/schematics/ng-generate/theme-color/index_bundled.js.map +2 -2
- package/schematics/ng-update/index_bundled.js +6 -1
- package/schematics/ng-update/index_bundled.js.map +1 -1
- package/select/_select-theme.scss +10 -6
- package/select/index.d.ts +7 -7
- package/sidenav/_sidenav-theme.scss +8 -4
- package/slide-toggle/_slide-toggle-theme.scss +10 -6
- package/slider/_slider-theme.scss +10 -6
- package/snack-bar/_snack-bar-theme.scss +10 -6
- package/sort/_sort-theme.scss +8 -4
- package/stepper/_stepper-theme.scss +10 -6
- package/stepper/index.d.ts +14 -15
- package/table/_table-theme.scss +8 -4
- package/tabs/_tabs-theme.scss +10 -6
- package/timepicker/_timepicker-theme.scss +10 -6
- package/toolbar/_toolbar-theme.scss +10 -6
- package/tooltip/_tooltip-theme.scss +8 -4
- package/tooltip/index.d.ts +5 -6
- package/tree/_tree-theme.scss +8 -4
package/fesm2022/badge.mjs
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Component, ViewEncapsulation, ChangeDetectionStrategy, inject, NgZone, ElementRef, Renderer2, ANIMATION_MODULE_TYPE, booleanAttribute, Directive, Input, NgModule } from '@angular/core';
|
|
3
3
|
import { MatCommonModule } from '@angular/material/core';
|
|
4
|
-
import { AriaDescriber, InteractivityChecker, A11yModule } from '@angular/cdk/a11y';
|
|
4
|
+
import { AriaDescriber, _IdGenerator, InteractivityChecker, A11yModule } from '@angular/cdk/a11y';
|
|
5
5
|
import { DOCUMENT } from '@angular/common';
|
|
6
|
-
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
|
|
6
|
+
import { _CdkPrivateStyleLoader, _VisuallyHiddenLoader } from '@angular/cdk/private';
|
|
7
7
|
|
|
8
|
-
let nextId = 0;
|
|
9
8
|
const BADGE_CONTENT_CLASS = 'mat-badge-content';
|
|
10
9
|
/**
|
|
11
10
|
* Component used to load the structural styles of the badge.
|
|
12
11
|
* @docs-private
|
|
13
12
|
*/
|
|
14
13
|
class _MatBadgeStyleLoader {
|
|
15
|
-
static
|
|
16
|
-
static
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: _MatBadgeStyleLoader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.0-rc.0", type: _MatBadgeStyleLoader, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true, styles: [".mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
17
16
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: _MatBadgeStyleLoader, decorators: [{
|
|
19
18
|
type: Component,
|
|
20
19
|
args: [{ encapsulation: ViewEncapsulation.None, template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}"] }]
|
|
21
20
|
}] });
|
|
22
21
|
/** Directive to display a text badge. */
|
|
23
22
|
class MatBadge {
|
|
23
|
+
_ngZone = inject(NgZone);
|
|
24
|
+
_elementRef = inject(ElementRef);
|
|
25
|
+
_ariaDescriber = inject(AriaDescriber);
|
|
26
|
+
_renderer = inject(Renderer2);
|
|
27
|
+
_animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
|
|
28
|
+
_idGenerator = inject(_IdGenerator);
|
|
24
29
|
/**
|
|
25
30
|
* Theme color of the badge. This API is supported in M2 themes only, it
|
|
26
31
|
* has no effect in M3 themes.
|
|
@@ -35,6 +40,16 @@ class MatBadge {
|
|
|
35
40
|
this._setColor(value);
|
|
36
41
|
this._color = value;
|
|
37
42
|
}
|
|
43
|
+
_color = 'primary';
|
|
44
|
+
/** Whether the badge should overlap its contents or not */
|
|
45
|
+
overlap = true;
|
|
46
|
+
/** Whether the badge is disabled. */
|
|
47
|
+
disabled;
|
|
48
|
+
/**
|
|
49
|
+
* Position the badge should reside.
|
|
50
|
+
* Accepts any combination of 'above'|'below' and 'before'|'after'
|
|
51
|
+
*/
|
|
52
|
+
position = 'above after';
|
|
38
53
|
/** The content for the badge */
|
|
39
54
|
get content() {
|
|
40
55
|
return this._content;
|
|
@@ -42,6 +57,7 @@ class MatBadge {
|
|
|
42
57
|
set content(newContent) {
|
|
43
58
|
this._updateRenderedContent(newContent);
|
|
44
59
|
}
|
|
60
|
+
_content;
|
|
45
61
|
/** Message used to describe the decorated element via aria-describedby */
|
|
46
62
|
get description() {
|
|
47
63
|
return this._description;
|
|
@@ -49,30 +65,23 @@ class MatBadge {
|
|
|
49
65
|
set description(newDescription) {
|
|
50
66
|
this._updateDescription(newDescription);
|
|
51
67
|
}
|
|
68
|
+
_description;
|
|
69
|
+
/** Size of the badge. Can be 'small', 'medium', or 'large'. */
|
|
70
|
+
size = 'medium';
|
|
71
|
+
/** Whether the badge is hidden. */
|
|
72
|
+
hidden;
|
|
73
|
+
/** Visible badge element. */
|
|
74
|
+
_badgeElement;
|
|
75
|
+
/** Inline badge description. Used when the badge is applied to non-interactive host elements. */
|
|
76
|
+
_inlineBadgeDescription;
|
|
77
|
+
/** Whether the OnInit lifecycle hook has run yet */
|
|
78
|
+
_isInitialized = false;
|
|
79
|
+
/** InteractivityChecker to determine if the badge host is focusable. */
|
|
80
|
+
_interactivityChecker = inject(InteractivityChecker);
|
|
81
|
+
_document = inject(DOCUMENT);
|
|
52
82
|
constructor() {
|
|
53
|
-
this._ngZone = inject(NgZone);
|
|
54
|
-
this._elementRef = inject(ElementRef);
|
|
55
|
-
this._ariaDescriber = inject(AriaDescriber);
|
|
56
|
-
this._renderer = inject(Renderer2);
|
|
57
|
-
this._animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true });
|
|
58
|
-
this._color = 'primary';
|
|
59
|
-
/** Whether the badge should overlap its contents or not */
|
|
60
|
-
this.overlap = true;
|
|
61
|
-
/**
|
|
62
|
-
* Position the badge should reside.
|
|
63
|
-
* Accepts any combination of 'above'|'below' and 'before'|'after'
|
|
64
|
-
*/
|
|
65
|
-
this.position = 'above after';
|
|
66
|
-
/** Size of the badge. Can be 'small', 'medium', or 'large'. */
|
|
67
|
-
this.size = 'medium';
|
|
68
|
-
/** Unique id for the badge */
|
|
69
|
-
this._id = nextId++;
|
|
70
|
-
/** Whether the OnInit lifecycle hook has run yet */
|
|
71
|
-
this._isInitialized = false;
|
|
72
|
-
/** InteractivityChecker to determine if the badge host is focusable. */
|
|
73
|
-
this._interactivityChecker = inject(InteractivityChecker);
|
|
74
|
-
this._document = inject(DOCUMENT);
|
|
75
83
|
inject(_CdkPrivateStyleLoader).load(_MatBadgeStyleLoader);
|
|
84
|
+
inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
|
|
76
85
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
77
86
|
const nativeElement = this._elementRef.nativeElement;
|
|
78
87
|
if (nativeElement.nodeType !== nativeElement.ELEMENT_NODE) {
|
|
@@ -135,7 +144,7 @@ class MatBadge {
|
|
|
135
144
|
_createBadgeElement() {
|
|
136
145
|
const badgeElement = this._renderer.createElement('span');
|
|
137
146
|
const activeClass = 'mat-badge-active';
|
|
138
|
-
badgeElement.setAttribute('id',
|
|
147
|
+
badgeElement.setAttribute('id', this._idGenerator.getId('mat-badge-content-'));
|
|
139
148
|
// The badge is aria-hidden because we don't want it to appear in the page's navigation
|
|
140
149
|
// flow. Instead, we use the badge to describe the decorated element with aria-describedby.
|
|
141
150
|
badgeElement.setAttribute('aria-hidden', 'true');
|
|
@@ -226,10 +235,10 @@ class MatBadge {
|
|
|
226
235
|
}
|
|
227
236
|
}
|
|
228
237
|
}
|
|
229
|
-
static
|
|
230
|
-
static
|
|
238
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
239
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.0-rc.0", type: MatBadge, isStandalone: true, selector: "[matBadge]", inputs: { color: ["matBadgeColor", "color"], overlap: ["matBadgeOverlap", "overlap", booleanAttribute], disabled: ["matBadgeDisabled", "disabled", booleanAttribute], position: ["matBadgePosition", "position"], content: ["matBadge", "content"], description: ["matBadgeDescription", "description"], size: ["matBadgeSize", "size"], hidden: ["matBadgeHidden", "hidden", booleanAttribute] }, host: { properties: { "class.mat-badge-overlap": "overlap", "class.mat-badge-above": "isAbove()", "class.mat-badge-below": "!isAbove()", "class.mat-badge-before": "!isAfter()", "class.mat-badge-after": "isAfter()", "class.mat-badge-small": "size === \"small\"", "class.mat-badge-medium": "size === \"medium\"", "class.mat-badge-large": "size === \"large\"", "class.mat-badge-hidden": "hidden || !content", "class.mat-badge-disabled": "disabled" }, classAttribute: "mat-badge" }, ngImport: i0 });
|
|
231
240
|
}
|
|
232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
241
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadge, decorators: [{
|
|
233
242
|
type: Directive,
|
|
234
243
|
args: [{
|
|
235
244
|
selector: '[matBadge]',
|
|
@@ -274,11 +283,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10",
|
|
|
274
283
|
}] } });
|
|
275
284
|
|
|
276
285
|
class MatBadgeModule {
|
|
277
|
-
static
|
|
278
|
-
static
|
|
279
|
-
static
|
|
286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
287
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadgeModule, imports: [A11yModule, MatCommonModule, MatBadge, _MatBadgeStyleLoader], exports: [MatBadge, MatCommonModule] });
|
|
288
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadgeModule, imports: [A11yModule, MatCommonModule, MatCommonModule] });
|
|
280
289
|
}
|
|
281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBadgeModule, decorators: [{
|
|
282
291
|
type: NgModule,
|
|
283
292
|
args: [{
|
|
284
293
|
// Note: we _shouldn't_ have to import `_MatBadgeStyleLoader`,
|
package/fesm2022/badge.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.mjs","sources":["../../../../../../src/material/badge/badge.ts","../../../../../../src/material/badge/badge-module.ts","../../../../../../src/material/badge/badge_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AriaDescriber, InteractivityChecker} from '@angular/cdk/a11y';\nimport {DOCUMENT} from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n Directive,\n ElementRef,\n inject,\n Input,\n NgZone,\n OnDestroy,\n OnInit,\n Renderer2,\n ViewEncapsulation,\n ANIMATION_MODULE_TYPE,\n} from '@angular/core';\nimport {ThemePalette} from '@angular/material/core';\nimport {_CdkPrivateStyleLoader} from '@angular/cdk/private';\n\nlet nextId = 0;\n\n/** Allowed position options for matBadgePosition */\nexport type MatBadgePosition =\n | 'above after'\n | 'above before'\n | 'below before'\n | 'below after'\n | 'before'\n | 'after'\n | 'above'\n | 'below';\n\n/** Allowed size options for matBadgeSize */\nexport type MatBadgeSize = 'small' | 'medium' | 'large';\n\nconst BADGE_CONTENT_CLASS = 'mat-badge-content';\n\n/**\n * Component used to load the structural styles of the badge.\n * @docs-private\n */\n@Component({\n styleUrl: 'badge.css',\n encapsulation: ViewEncapsulation.None,\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class _MatBadgeStyleLoader {}\n\n/** Directive to display a text badge. */\n@Directive({\n selector: '[matBadge]',\n host: {\n 'class': 'mat-badge',\n '[class.mat-badge-overlap]': 'overlap',\n '[class.mat-badge-above]': 'isAbove()',\n '[class.mat-badge-below]': '!isAbove()',\n '[class.mat-badge-before]': '!isAfter()',\n '[class.mat-badge-after]': 'isAfter()',\n '[class.mat-badge-small]': 'size === \"small\"',\n '[class.mat-badge-medium]': 'size === \"medium\"',\n '[class.mat-badge-large]': 'size === \"large\"',\n '[class.mat-badge-hidden]': 'hidden || !content',\n '[class.mat-badge-disabled]': 'disabled',\n },\n})\nexport class MatBadge implements OnInit, OnDestroy {\n private _ngZone = inject(NgZone);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private _ariaDescriber = inject(AriaDescriber);\n private _renderer = inject(Renderer2);\n private _animationMode = inject(ANIMATION_MODULE_TYPE, {optional: true});\n\n /**\n * Theme color of the badge. This API is supported in M2 themes only, it\n * has no effect in M3 themes.\n *\n * For information on applying color variants in M3, see\n * https://material.angular.io/guide/theming#using-component-color-variants.\n */\n @Input('matBadgeColor')\n get color(): ThemePalette {\n return this._color;\n }\n set color(value: ThemePalette) {\n this._setColor(value);\n this._color = value;\n }\n private _color: ThemePalette = 'primary';\n\n /** Whether the badge should overlap its contents or not */\n @Input({alias: 'matBadgeOverlap', transform: booleanAttribute}) overlap: boolean = true;\n\n /** Whether the badge is disabled. */\n @Input({alias: 'matBadgeDisabled', transform: booleanAttribute}) disabled: boolean;\n\n /**\n * Position the badge should reside.\n * Accepts any combination of 'above'|'below' and 'before'|'after'\n */\n @Input('matBadgePosition') position: MatBadgePosition = 'above after';\n\n /** The content for the badge */\n @Input('matBadge')\n get content(): string | number | undefined | null {\n return this._content;\n }\n set content(newContent: string | number | undefined | null) {\n this._updateRenderedContent(newContent);\n }\n private _content: string | number | undefined | null;\n\n /** Message used to describe the decorated element via aria-describedby */\n @Input('matBadgeDescription')\n get description(): string {\n return this._description;\n }\n set description(newDescription: string) {\n this._updateDescription(newDescription);\n }\n private _description: string;\n\n /** Size of the badge. Can be 'small', 'medium', or 'large'. */\n @Input('matBadgeSize') size: MatBadgeSize = 'medium';\n\n /** Whether the badge is hidden. */\n @Input({alias: 'matBadgeHidden', transform: booleanAttribute}) hidden: boolean;\n\n /** Unique id for the badge */\n _id: number = nextId++;\n\n /** Visible badge element. */\n private _badgeElement: HTMLElement | undefined;\n\n /** Inline badge description. Used when the badge is applied to non-interactive host elements. */\n private _inlineBadgeDescription: HTMLElement | undefined;\n\n /** Whether the OnInit lifecycle hook has run yet */\n private _isInitialized = false;\n\n /** InteractivityChecker to determine if the badge host is focusable. */\n private _interactivityChecker = inject(InteractivityChecker);\n\n private _document = inject(DOCUMENT);\n\n constructor(...args: unknown[]);\n\n constructor() {\n inject(_CdkPrivateStyleLoader).load(_MatBadgeStyleLoader);\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const nativeElement = this._elementRef.nativeElement;\n if (nativeElement.nodeType !== nativeElement.ELEMENT_NODE) {\n throw Error('matBadge must be attached to an element node.');\n }\n\n // Heads-up for developers to avoid putting matBadge on <mat-icon>\n // as it is aria-hidden by default docs mention this at:\n // https://material.angular.io/components/badge/overview#accessibility\n if (\n nativeElement.tagName.toLowerCase() === 'mat-icon' &&\n nativeElement.getAttribute('aria-hidden') === 'true'\n ) {\n console.warn(\n `Detected a matBadge on an \"aria-hidden\" \"<mat-icon>\". ` +\n `Consider setting aria-hidden=\"false\" in order to surface the information assistive technology.` +\n `\\n${nativeElement.outerHTML}`,\n );\n }\n }\n }\n\n /** Whether the badge is above the host or not */\n isAbove(): boolean {\n return this.position.indexOf('below') === -1;\n }\n\n /** Whether the badge is after the host or not */\n isAfter(): boolean {\n return this.position.indexOf('before') === -1;\n }\n\n /**\n * Gets the element into which the badge's content is being rendered. Undefined if the element\n * hasn't been created (e.g. if the badge doesn't have content).\n */\n getBadgeElement(): HTMLElement | undefined {\n return this._badgeElement;\n }\n\n ngOnInit() {\n // We may have server-side rendered badge that we need to clear.\n // We need to do this in ngOnInit because the full content of the component\n // on which the badge is attached won't necessarily be in the DOM until this point.\n this._clearExistingBadges();\n\n if (this.content && !this._badgeElement) {\n this._badgeElement = this._createBadgeElement();\n this._updateRenderedContent(this.content);\n }\n\n this._isInitialized = true;\n }\n\n ngOnDestroy() {\n // ViewEngine only: when creating a badge through the Renderer, Angular remembers its index.\n // We have to destroy it ourselves, otherwise it'll be retained in memory.\n if (this._renderer.destroyNode) {\n this._renderer.destroyNode(this._badgeElement);\n this._inlineBadgeDescription?.remove();\n }\n\n this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.description);\n }\n\n /** Gets whether the badge's host element is interactive. */\n private _isHostInteractive(): boolean {\n // Ignore visibility since it requires an expensive style caluclation.\n return this._interactivityChecker.isFocusable(this._elementRef.nativeElement, {\n ignoreVisibility: true,\n });\n }\n\n /** Creates the badge element */\n private _createBadgeElement(): HTMLElement {\n const badgeElement = this._renderer.createElement('span');\n const activeClass = 'mat-badge-active';\n\n badgeElement.setAttribute('id', `mat-badge-content-${this._id}`);\n\n // The badge is aria-hidden because we don't want it to appear in the page's navigation\n // flow. Instead, we use the badge to describe the decorated element with aria-describedby.\n badgeElement.setAttribute('aria-hidden', 'true');\n badgeElement.classList.add(BADGE_CONTENT_CLASS);\n\n if (this._animationMode === 'NoopAnimations') {\n badgeElement.classList.add('_mat-animation-noopable');\n }\n\n this._elementRef.nativeElement.appendChild(badgeElement);\n\n // animate in after insertion\n if (typeof requestAnimationFrame === 'function' && this._animationMode !== 'NoopAnimations') {\n this._ngZone.runOutsideAngular(() => {\n requestAnimationFrame(() => {\n badgeElement.classList.add(activeClass);\n });\n });\n } else {\n badgeElement.classList.add(activeClass);\n }\n\n return badgeElement;\n }\n\n /** Update the text content of the badge element in the DOM, creating the element if necessary. */\n private _updateRenderedContent(newContent: string | number | undefined | null): void {\n const newContentNormalized: string = `${newContent ?? ''}`.trim();\n\n // Don't create the badge element if the directive isn't initialized because we want to\n // append the badge element to the *end* of the host element's content for backwards\n // compatibility.\n if (this._isInitialized && newContentNormalized && !this._badgeElement) {\n this._badgeElement = this._createBadgeElement();\n }\n\n if (this._badgeElement) {\n this._badgeElement.textContent = newContentNormalized;\n }\n\n this._content = newContentNormalized;\n }\n\n /** Updates the host element's aria description via AriaDescriber. */\n private _updateDescription(newDescription: string): void {\n // Always start by removing the aria-describedby; we will add a new one if necessary.\n this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.description);\n\n // NOTE: We only check whether the host is interactive here, which happens during\n // when then badge content changes. It is possible that the host changes\n // interactivity status separate from one of these. However, watching the interactivity\n // status of the host would require a `MutationObserver`, which is likely more code + overhead\n // than it's worth; from usages inside Google, we see that the vats majority of badges either\n // never change interactivity, or also set `matBadgeHidden` based on the same condition.\n\n if (!newDescription || this._isHostInteractive()) {\n this._removeInlineDescription();\n }\n\n this._description = newDescription;\n\n // We don't add `aria-describedby` for non-interactive hosts elements because we\n // instead insert the description inline.\n if (this._isHostInteractive()) {\n this._ariaDescriber.describe(this._elementRef.nativeElement, newDescription);\n } else {\n this._updateInlineDescription();\n }\n }\n\n private _updateInlineDescription() {\n // Create the inline description element if it doesn't exist\n if (!this._inlineBadgeDescription) {\n this._inlineBadgeDescription = this._document.createElement('span');\n this._inlineBadgeDescription.classList.add('cdk-visually-hidden');\n }\n\n this._inlineBadgeDescription.textContent = this.description;\n this._badgeElement?.appendChild(this._inlineBadgeDescription);\n }\n\n private _removeInlineDescription() {\n this._inlineBadgeDescription?.remove();\n this._inlineBadgeDescription = undefined;\n }\n\n /** Adds css theme class given the color to the component host */\n private _setColor(colorPalette: ThemePalette) {\n const classList = this._elementRef.nativeElement.classList;\n classList.remove(`mat-badge-${this._color}`);\n if (colorPalette) {\n classList.add(`mat-badge-${colorPalette}`);\n }\n }\n\n /** Clears any existing badges that might be left over from server-side rendering. */\n private _clearExistingBadges() {\n // Only check direct children of this host element in order to avoid deleting\n // any badges that might exist in descendant elements.\n const badges = this._elementRef.nativeElement.querySelectorAll(\n `:scope > .${BADGE_CONTENT_CLASS}`,\n );\n for (const badgeElement of Array.from(badges)) {\n if (badgeElement !== this._badgeElement) {\n badgeElement.remove();\n }\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {A11yModule} from '@angular/cdk/a11y';\nimport {MatBadge, _MatBadgeStyleLoader} from './badge';\n\n@NgModule({\n // Note: we _shouldn't_ have to import `_MatBadgeStyleLoader`,\n // but it seems to be necessary for tests.\n imports: [A11yModule, MatCommonModule, MatBadge, _MatBadgeStyleLoader],\n exports: [MatBadge, MatCommonModule],\n})\nexport class MatBadgeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA4BA,IAAI,MAAM,GAAG,CAAC,CAAC;AAgBf,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAEhD;;;AAGG;MAOU,oBAAoB,CAAA;sHAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,gBAAA,EAAA,IAAA,EAAA,oBAAoB,wEAHrB,EAAE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IrB,OAAO,EAAA,CAAA;sBADV,KAAK;uBAAC,UAAU,CAAA;gBAWb,WAAW,EAAA,CAAA;sBADd,KAAK;uBAAC,qBAAqB,CAAA;gBAUL,IAAI,EAAA,CAAA;sBAA1B,KAAK;uBAAC,cAAc,CAAA;gBAG0C,MAAM,EAAA,CAAA;sBAApE,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAC,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAA;;;MCpHlD,cAAc,CAAA;sHAAd,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;uHAAd,cAAc,EAAA,OAAA,EAAA,CAHf,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,CAAA,EAAA,OAAA,EAAA,CAC3D,QAAQ,EAAE,eAAe,CAAA,EAAA,CAAA,CAAA,EAAA;AAExB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,EAHf,OAAA,EAAA,CAAA,UAAU,EAAE,eAAe,EACjB,eAAe,CAAA,EAAA,CAAA,CAAA,EAAA;;mGAExB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAN1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;;;oBAGR,OAAO,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,CAAC;AACtE,oBAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;AACrC,iBAAA,CAAA;;;AClBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"badge.mjs","sources":["../../../../../../src/material/badge/badge.ts","../../../../../../src/material/badge/badge-module.ts","../../../../../../src/material/badge/badge_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {_IdGenerator, AriaDescriber, InteractivityChecker} from '@angular/cdk/a11y';\nimport {DOCUMENT} from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n Directive,\n ElementRef,\n inject,\n Input,\n NgZone,\n OnDestroy,\n OnInit,\n Renderer2,\n ViewEncapsulation,\n ANIMATION_MODULE_TYPE,\n} from '@angular/core';\nimport {ThemePalette} from '@angular/material/core';\nimport {_CdkPrivateStyleLoader, _VisuallyHiddenLoader} from '@angular/cdk/private';\n\n/** Allowed position options for matBadgePosition */\nexport type MatBadgePosition =\n | 'above after'\n | 'above before'\n | 'below before'\n | 'below after'\n | 'before'\n | 'after'\n | 'above'\n | 'below';\n\n/** Allowed size options for matBadgeSize */\nexport type MatBadgeSize = 'small' | 'medium' | 'large';\n\nconst BADGE_CONTENT_CLASS = 'mat-badge-content';\n\n/**\n * Component used to load the structural styles of the badge.\n * @docs-private\n */\n@Component({\n styleUrl: 'badge.css',\n encapsulation: ViewEncapsulation.None,\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class _MatBadgeStyleLoader {}\n\n/** Directive to display a text badge. */\n@Directive({\n selector: '[matBadge]',\n host: {\n 'class': 'mat-badge',\n '[class.mat-badge-overlap]': 'overlap',\n '[class.mat-badge-above]': 'isAbove()',\n '[class.mat-badge-below]': '!isAbove()',\n '[class.mat-badge-before]': '!isAfter()',\n '[class.mat-badge-after]': 'isAfter()',\n '[class.mat-badge-small]': 'size === \"small\"',\n '[class.mat-badge-medium]': 'size === \"medium\"',\n '[class.mat-badge-large]': 'size === \"large\"',\n '[class.mat-badge-hidden]': 'hidden || !content',\n '[class.mat-badge-disabled]': 'disabled',\n },\n})\nexport class MatBadge implements OnInit, OnDestroy {\n private _ngZone = inject(NgZone);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private _ariaDescriber = inject(AriaDescriber);\n private _renderer = inject(Renderer2);\n private _animationMode = inject(ANIMATION_MODULE_TYPE, {optional: true});\n private _idGenerator = inject(_IdGenerator);\n\n /**\n * Theme color of the badge. This API is supported in M2 themes only, it\n * has no effect in M3 themes.\n *\n * For information on applying color variants in M3, see\n * https://material.angular.io/guide/theming#using-component-color-variants.\n */\n @Input('matBadgeColor')\n get color(): ThemePalette {\n return this._color;\n }\n set color(value: ThemePalette) {\n this._setColor(value);\n this._color = value;\n }\n private _color: ThemePalette = 'primary';\n\n /** Whether the badge should overlap its contents or not */\n @Input({alias: 'matBadgeOverlap', transform: booleanAttribute}) overlap: boolean = true;\n\n /** Whether the badge is disabled. */\n @Input({alias: 'matBadgeDisabled', transform: booleanAttribute}) disabled: boolean;\n\n /**\n * Position the badge should reside.\n * Accepts any combination of 'above'|'below' and 'before'|'after'\n */\n @Input('matBadgePosition') position: MatBadgePosition = 'above after';\n\n /** The content for the badge */\n @Input('matBadge')\n get content(): string | number | undefined | null {\n return this._content;\n }\n set content(newContent: string | number | undefined | null) {\n this._updateRenderedContent(newContent);\n }\n private _content: string | number | undefined | null;\n\n /** Message used to describe the decorated element via aria-describedby */\n @Input('matBadgeDescription')\n get description(): string {\n return this._description;\n }\n set description(newDescription: string) {\n this._updateDescription(newDescription);\n }\n private _description: string;\n\n /** Size of the badge. Can be 'small', 'medium', or 'large'. */\n @Input('matBadgeSize') size: MatBadgeSize = 'medium';\n\n /** Whether the badge is hidden. */\n @Input({alias: 'matBadgeHidden', transform: booleanAttribute}) hidden: boolean;\n\n /** Visible badge element. */\n private _badgeElement: HTMLElement | undefined;\n\n /** Inline badge description. Used when the badge is applied to non-interactive host elements. */\n private _inlineBadgeDescription: HTMLElement | undefined;\n\n /** Whether the OnInit lifecycle hook has run yet */\n private _isInitialized = false;\n\n /** InteractivityChecker to determine if the badge host is focusable. */\n private _interactivityChecker = inject(InteractivityChecker);\n\n private _document = inject(DOCUMENT);\n\n constructor(...args: unknown[]);\n\n constructor() {\n inject(_CdkPrivateStyleLoader).load(_MatBadgeStyleLoader);\n inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const nativeElement = this._elementRef.nativeElement;\n if (nativeElement.nodeType !== nativeElement.ELEMENT_NODE) {\n throw Error('matBadge must be attached to an element node.');\n }\n\n // Heads-up for developers to avoid putting matBadge on <mat-icon>\n // as it is aria-hidden by default docs mention this at:\n // https://material.angular.io/components/badge/overview#accessibility\n if (\n nativeElement.tagName.toLowerCase() === 'mat-icon' &&\n nativeElement.getAttribute('aria-hidden') === 'true'\n ) {\n console.warn(\n `Detected a matBadge on an \"aria-hidden\" \"<mat-icon>\". ` +\n `Consider setting aria-hidden=\"false\" in order to surface the information assistive technology.` +\n `\\n${nativeElement.outerHTML}`,\n );\n }\n }\n }\n\n /** Whether the badge is above the host or not */\n isAbove(): boolean {\n return this.position.indexOf('below') === -1;\n }\n\n /** Whether the badge is after the host or not */\n isAfter(): boolean {\n return this.position.indexOf('before') === -1;\n }\n\n /**\n * Gets the element into which the badge's content is being rendered. Undefined if the element\n * hasn't been created (e.g. if the badge doesn't have content).\n */\n getBadgeElement(): HTMLElement | undefined {\n return this._badgeElement;\n }\n\n ngOnInit() {\n // We may have server-side rendered badge that we need to clear.\n // We need to do this in ngOnInit because the full content of the component\n // on which the badge is attached won't necessarily be in the DOM until this point.\n this._clearExistingBadges();\n\n if (this.content && !this._badgeElement) {\n this._badgeElement = this._createBadgeElement();\n this._updateRenderedContent(this.content);\n }\n\n this._isInitialized = true;\n }\n\n ngOnDestroy() {\n // ViewEngine only: when creating a badge through the Renderer, Angular remembers its index.\n // We have to destroy it ourselves, otherwise it'll be retained in memory.\n if (this._renderer.destroyNode) {\n this._renderer.destroyNode(this._badgeElement);\n this._inlineBadgeDescription?.remove();\n }\n\n this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.description);\n }\n\n /** Gets whether the badge's host element is interactive. */\n private _isHostInteractive(): boolean {\n // Ignore visibility since it requires an expensive style caluclation.\n return this._interactivityChecker.isFocusable(this._elementRef.nativeElement, {\n ignoreVisibility: true,\n });\n }\n\n /** Creates the badge element */\n private _createBadgeElement(): HTMLElement {\n const badgeElement = this._renderer.createElement('span');\n const activeClass = 'mat-badge-active';\n\n badgeElement.setAttribute('id', this._idGenerator.getId('mat-badge-content-'));\n\n // The badge is aria-hidden because we don't want it to appear in the page's navigation\n // flow. Instead, we use the badge to describe the decorated element with aria-describedby.\n badgeElement.setAttribute('aria-hidden', 'true');\n badgeElement.classList.add(BADGE_CONTENT_CLASS);\n\n if (this._animationMode === 'NoopAnimations') {\n badgeElement.classList.add('_mat-animation-noopable');\n }\n\n this._elementRef.nativeElement.appendChild(badgeElement);\n\n // animate in after insertion\n if (typeof requestAnimationFrame === 'function' && this._animationMode !== 'NoopAnimations') {\n this._ngZone.runOutsideAngular(() => {\n requestAnimationFrame(() => {\n badgeElement.classList.add(activeClass);\n });\n });\n } else {\n badgeElement.classList.add(activeClass);\n }\n\n return badgeElement;\n }\n\n /** Update the text content of the badge element in the DOM, creating the element if necessary. */\n private _updateRenderedContent(newContent: string | number | undefined | null): void {\n const newContentNormalized: string = `${newContent ?? ''}`.trim();\n\n // Don't create the badge element if the directive isn't initialized because we want to\n // append the badge element to the *end* of the host element's content for backwards\n // compatibility.\n if (this._isInitialized && newContentNormalized && !this._badgeElement) {\n this._badgeElement = this._createBadgeElement();\n }\n\n if (this._badgeElement) {\n this._badgeElement.textContent = newContentNormalized;\n }\n\n this._content = newContentNormalized;\n }\n\n /** Updates the host element's aria description via AriaDescriber. */\n private _updateDescription(newDescription: string): void {\n // Always start by removing the aria-describedby; we will add a new one if necessary.\n this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.description);\n\n // NOTE: We only check whether the host is interactive here, which happens during\n // when then badge content changes. It is possible that the host changes\n // interactivity status separate from one of these. However, watching the interactivity\n // status of the host would require a `MutationObserver`, which is likely more code + overhead\n // than it's worth; from usages inside Google, we see that the vats majority of badges either\n // never change interactivity, or also set `matBadgeHidden` based on the same condition.\n\n if (!newDescription || this._isHostInteractive()) {\n this._removeInlineDescription();\n }\n\n this._description = newDescription;\n\n // We don't add `aria-describedby` for non-interactive hosts elements because we\n // instead insert the description inline.\n if (this._isHostInteractive()) {\n this._ariaDescriber.describe(this._elementRef.nativeElement, newDescription);\n } else {\n this._updateInlineDescription();\n }\n }\n\n private _updateInlineDescription() {\n // Create the inline description element if it doesn't exist\n if (!this._inlineBadgeDescription) {\n this._inlineBadgeDescription = this._document.createElement('span');\n this._inlineBadgeDescription.classList.add('cdk-visually-hidden');\n }\n\n this._inlineBadgeDescription.textContent = this.description;\n this._badgeElement?.appendChild(this._inlineBadgeDescription);\n }\n\n private _removeInlineDescription() {\n this._inlineBadgeDescription?.remove();\n this._inlineBadgeDescription = undefined;\n }\n\n /** Adds css theme class given the color to the component host */\n private _setColor(colorPalette: ThemePalette) {\n const classList = this._elementRef.nativeElement.classList;\n classList.remove(`mat-badge-${this._color}`);\n if (colorPalette) {\n classList.add(`mat-badge-${colorPalette}`);\n }\n }\n\n /** Clears any existing badges that might be left over from server-side rendering. */\n private _clearExistingBadges() {\n // Only check direct children of this host element in order to avoid deleting\n // any badges that might exist in descendant elements.\n const badges = this._elementRef.nativeElement.querySelectorAll(\n `:scope > .${BADGE_CONTENT_CLASS}`,\n );\n for (const badgeElement of Array.from(badges)) {\n if (badgeElement !== this._badgeElement) {\n badgeElement.remove();\n }\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {A11yModule} from '@angular/cdk/a11y';\nimport {MatBadge, _MatBadgeStyleLoader} from './badge';\n\n@NgModule({\n // Note: we _shouldn't_ have to import `_MatBadgeStyleLoader`,\n // but it seems to be necessary for tests.\n imports: [A11yModule, MatCommonModule, MatBadge, _MatBadgeStyleLoader],\n exports: [MatBadge, MatCommonModule],\n})\nexport class MatBadgeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0CA,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAEhD;;;AAGG;MAOU,oBAAoB,CAAA;4GAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAApB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,aAAA,EAAA,IAAA,EAAA,oBAAoB,wEAHrB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,gyGAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;gGAGD,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBANhC,SAAS;AAEO,YAAA,IAAA,EAAA,CAAA,EAAA,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAC3B,EAAE,EACK,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,gyGAAA,CAAA,EAAA,CAAA;;AAIjD;MAiBa,QAAQ,CAAA;AACX,IAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACzB,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC,CAAC;AAC1D,IAAA,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AACvC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9B,cAAc,GAAG,MAAM,CAAC,qBAAqB,EAAE,EAAC,QAAQ,EAAE,IAAI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A,OAAA,EAAA,aAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,EAHf,OAAA,EAAA,CAAA,UAAU,EAAE,eAAe,EACjB,eAAe,CAAA,EAAA,CAAA,CAAA;;gGAExB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAN1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;;;oBAGR,OAAO,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,CAAC;AACtE,oBAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;AACrC,iBAAA,CAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -4,7 +4,7 @@ import { ContentContainerComponentHarness, HarnessPredicate, TestKey } from '@an
|
|
|
4
4
|
class MatBottomSheetHarness extends ContentContainerComponentHarness {
|
|
5
5
|
// Developers can provide a custom component or template for the
|
|
6
6
|
// bottom sheet. The canonical parent is the ".mat-bottom-sheet-container".
|
|
7
|
-
static
|
|
7
|
+
static hostSelector = '.mat-bottom-sheet-container';
|
|
8
8
|
/**
|
|
9
9
|
* Gets a `HarnessPredicate` that can be used to search for a bottom sheet with
|
|
10
10
|
* specific attributes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/bottom-sheet/testing/bottom-sheet-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ContentContainerComponentHarness, HarnessPredicate, TestKey} from '@angular/cdk/testing';\nimport {BottomSheetHarnessFilters} from './bottom-sheet-harness-filters';\n\n/** Harness for interacting with a standard MatBottomSheet in tests. */\nexport class MatBottomSheetHarness extends ContentContainerComponentHarness<string> {\n // Developers can provide a custom component or template for the\n // bottom sheet. The canonical parent is the \".mat-bottom-sheet-container\".\n static hostSelector = '.mat-bottom-sheet-container';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a bottom sheet with\n * specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: BottomSheetHarnessFilters = {}): HarnessPredicate<MatBottomSheetHarness> {\n return new HarnessPredicate(MatBottomSheetHarness, options);\n }\n\n /** Gets the value of the bottom sheet's \"aria-label\" attribute. */\n async getAriaLabel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /**\n * Dismisses the bottom sheet by pressing escape. Note that this method cannot\n * be used if \"disableClose\" has been set to true via the config.\n */\n async dismiss(): Promise<void> {\n await (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n}\n"],"names":[],"mappings":";;AAWA;AACM,MAAO,qBAAsB,SAAQ,gCAAwC,CAAA;;;
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/bottom-sheet/testing/bottom-sheet-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ContentContainerComponentHarness, HarnessPredicate, TestKey} from '@angular/cdk/testing';\nimport {BottomSheetHarnessFilters} from './bottom-sheet-harness-filters';\n\n/** Harness for interacting with a standard MatBottomSheet in tests. */\nexport class MatBottomSheetHarness extends ContentContainerComponentHarness<string> {\n // Developers can provide a custom component or template for the\n // bottom sheet. The canonical parent is the \".mat-bottom-sheet-container\".\n static hostSelector = '.mat-bottom-sheet-container';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a bottom sheet with\n * specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: BottomSheetHarnessFilters = {}): HarnessPredicate<MatBottomSheetHarness> {\n return new HarnessPredicate(MatBottomSheetHarness, options);\n }\n\n /** Gets the value of the bottom sheet's \"aria-label\" attribute. */\n async getAriaLabel(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /**\n * Dismisses the bottom sheet by pressing escape. Note that this method cannot\n * be used if \"disableClose\" has been set to true via the config.\n */\n async dismiss(): Promise<void> {\n await (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n}\n"],"names":[],"mappings":";;AAWA;AACM,MAAO,qBAAsB,SAAQ,gCAAwC,CAAA;;;AAGjF,IAAA,OAAO,YAAY,GAAG,6BAA6B,CAAC;AAEpD;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAqC,EAAE,EAAA;AACjD,QAAA,OAAO,IAAI,gBAAgB,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;KAC7D;;AAGD,IAAA,MAAM,YAAY,GAAA;AAChB,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACvD;AAED;;;AAGG;AACH,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpD;;;;;"}
|
|
@@ -32,12 +32,15 @@ const matBottomSheetAnimations = {
|
|
|
32
32
|
* @docs-private
|
|
33
33
|
*/
|
|
34
34
|
class MatBottomSheetContainer extends CdkDialogContainer {
|
|
35
|
+
_breakpointSubscription;
|
|
36
|
+
/** The state of the bottom sheet animations. */
|
|
37
|
+
_animationState = 'void';
|
|
38
|
+
/** Emits whenever the state of the animation changes. */
|
|
39
|
+
_animationStateChanged = new EventEmitter();
|
|
40
|
+
/** Whether the component has been destroyed. */
|
|
41
|
+
_destroyed;
|
|
35
42
|
constructor() {
|
|
36
43
|
super();
|
|
37
|
-
/** The state of the bottom sheet animations. */
|
|
38
|
-
this._animationState = 'void';
|
|
39
|
-
/** Emits whenever the state of the animation changes. */
|
|
40
|
-
this._animationStateChanged = new EventEmitter();
|
|
41
44
|
const breakpointObserver = inject(BreakpointObserver);
|
|
42
45
|
this._breakpointSubscription = breakpointObserver
|
|
43
46
|
.observe([Breakpoints.Medium, Breakpoints.Large, Breakpoints.XLarge])
|
|
@@ -78,10 +81,10 @@ class MatBottomSheetContainer extends CdkDialogContainer {
|
|
|
78
81
|
this._animationStateChanged.emit(event);
|
|
79
82
|
}
|
|
80
83
|
_captureInitialFocus() { }
|
|
81
|
-
static
|
|
82
|
-
static
|
|
84
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.0-rc.0", type: MatBottomSheetContainer, isStandalone: true, selector: "mat-bottom-sheet-container", host: { attributes: { "tabindex": "-1" }, listeners: { "@state.start": "_onAnimationStart($event)", "@state.done": "_onAnimationDone($event)" }, properties: { "attr.role": "_config.role", "attr.aria-modal": "_config.ariaModal", "attr.aria-label": "_config.ariaLabel", "@state": "_animationState" }, classAttribute: "mat-bottom-sheet-container" }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet></ng-template>\r\n", styles: [".mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [matBottomSheetAnimations.bottomSheetState], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
|
|
83
86
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetContainer, decorators: [{
|
|
85
88
|
type: Component,
|
|
86
89
|
args: [{ selector: 'mat-bottom-sheet-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, animations: [matBottomSheetAnimations.bottomSheetState], host: {
|
|
87
90
|
'class': 'mat-bottom-sheet-container',
|
|
@@ -101,44 +104,53 @@ const MAT_BOTTOM_SHEET_DATA = new InjectionToken('MatBottomSheetData');
|
|
|
101
104
|
* Configuration used when opening a bottom sheet.
|
|
102
105
|
*/
|
|
103
106
|
class MatBottomSheetConfig {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
107
|
+
/** The view container to place the overlay for the bottom sheet into. */
|
|
108
|
+
viewContainerRef;
|
|
109
|
+
/** Extra CSS classes to be added to the bottom sheet container. */
|
|
110
|
+
panelClass;
|
|
111
|
+
/** Text layout direction for the bottom sheet. */
|
|
112
|
+
direction;
|
|
113
|
+
/** Data being injected into the child component. */
|
|
114
|
+
data = null;
|
|
115
|
+
/** Whether the bottom sheet has a backdrop. */
|
|
116
|
+
hasBackdrop = true;
|
|
117
|
+
/** Custom class for the backdrop. */
|
|
118
|
+
backdropClass;
|
|
119
|
+
/** Whether the user can use escape or clicking outside to close the bottom sheet. */
|
|
120
|
+
disableClose = false;
|
|
121
|
+
/** Aria label to assign to the bottom sheet element. */
|
|
122
|
+
ariaLabel = null;
|
|
123
|
+
/** Whether this is a modal bottom sheet. Used to set the `aria-modal` attribute. */
|
|
124
|
+
ariaModal = true;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the bottom sheet should close when the user goes backwards/forwards in history.
|
|
127
|
+
* Note that this usually doesn't include clicking on links (unless the user is using
|
|
128
|
+
* the `HashLocationStrategy`).
|
|
129
|
+
*/
|
|
130
|
+
closeOnNavigation = true;
|
|
131
|
+
// Note that this is set to 'dialog' by default, because while the a11y recommendations
|
|
132
|
+
// are to focus the first focusable element, doing so prevents screen readers from reading out the
|
|
133
|
+
// rest of the bottom sheet content.
|
|
134
|
+
/**
|
|
135
|
+
* Where the bottom sheet should focus on open.
|
|
136
|
+
* @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
|
|
137
|
+
* AutoFocusTarget instead.
|
|
138
|
+
*/
|
|
139
|
+
autoFocus = 'dialog';
|
|
140
|
+
/**
|
|
141
|
+
* Whether the bottom sheet should restore focus to the
|
|
142
|
+
* previously-focused element, after it's closed.
|
|
143
|
+
*/
|
|
144
|
+
restoreFocus = true;
|
|
145
|
+
/** Scroll strategy to be used for the bottom sheet. */
|
|
146
|
+
scrollStrategy;
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
/**
|
|
139
150
|
* Reference to a bottom sheet dispatched from the bottom sheet service.
|
|
140
151
|
*/
|
|
141
152
|
class MatBottomSheetRef {
|
|
153
|
+
_ref;
|
|
142
154
|
/** Instance of the component making up the content of the bottom sheet. */
|
|
143
155
|
get instance() {
|
|
144
156
|
return this._ref.componentInstance;
|
|
@@ -150,10 +162,21 @@ class MatBottomSheetRef {
|
|
|
150
162
|
get componentRef() {
|
|
151
163
|
return this._ref.componentRef;
|
|
152
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Instance of the component into which the bottom sheet content is projected.
|
|
167
|
+
* @docs-private
|
|
168
|
+
*/
|
|
169
|
+
containerInstance;
|
|
170
|
+
/** Whether the user is allowed to close the bottom sheet. */
|
|
171
|
+
disableClose;
|
|
172
|
+
/** Subject for notifying the user that the bottom sheet has opened and appeared. */
|
|
173
|
+
_afterOpened = new Subject();
|
|
174
|
+
/** Result to be passed down to the `afterDismissed` stream. */
|
|
175
|
+
_result;
|
|
176
|
+
/** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
|
|
177
|
+
_closeFallbackTimeout;
|
|
153
178
|
constructor(_ref, config, containerInstance) {
|
|
154
179
|
this._ref = _ref;
|
|
155
|
-
/** Subject for notifying the user that the bottom sheet has opened and appeared. */
|
|
156
|
-
this._afterOpened = new Subject();
|
|
157
180
|
this.containerInstance = containerInstance;
|
|
158
181
|
this.disableClose = config.disableClose;
|
|
159
182
|
// Emit when opening animation completes
|
|
@@ -235,6 +258,13 @@ const MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = new InjectionToken('mat-bottom-sheet-de
|
|
|
235
258
|
* Service to trigger Material Design bottom sheets.
|
|
236
259
|
*/
|
|
237
260
|
class MatBottomSheet {
|
|
261
|
+
_overlay = inject(Overlay);
|
|
262
|
+
_parentBottomSheet = inject(MatBottomSheet, { optional: true, skipSelf: true });
|
|
263
|
+
_defaultOptions = inject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, {
|
|
264
|
+
optional: true,
|
|
265
|
+
});
|
|
266
|
+
_bottomSheetRefAtThisLevel = null;
|
|
267
|
+
_dialog = inject(Dialog);
|
|
238
268
|
/** Reference to the currently opened bottom sheet. */
|
|
239
269
|
get _openedBottomSheetRef() {
|
|
240
270
|
const parent = this._parentBottomSheet;
|
|
@@ -248,15 +278,7 @@ class MatBottomSheet {
|
|
|
248
278
|
this._bottomSheetRefAtThisLevel = value;
|
|
249
279
|
}
|
|
250
280
|
}
|
|
251
|
-
constructor() {
|
|
252
|
-
this._overlay = inject(Overlay);
|
|
253
|
-
this._parentBottomSheet = inject(MatBottomSheet, { optional: true, skipSelf: true });
|
|
254
|
-
this._defaultOptions = inject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, {
|
|
255
|
-
optional: true,
|
|
256
|
-
});
|
|
257
|
-
this._bottomSheetRefAtThisLevel = null;
|
|
258
|
-
this._dialog = inject(Dialog);
|
|
259
|
-
}
|
|
281
|
+
constructor() { }
|
|
260
282
|
open(componentOrTemplateRef, config) {
|
|
261
283
|
const _config = { ...(this._defaultOptions || new MatBottomSheetConfig()), ...config };
|
|
262
284
|
let ref;
|
|
@@ -313,20 +335,20 @@ class MatBottomSheet {
|
|
|
313
335
|
this._bottomSheetRefAtThisLevel.dismiss();
|
|
314
336
|
}
|
|
315
337
|
}
|
|
316
|
-
static
|
|
317
|
-
static
|
|
338
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheet, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
339
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheet, providedIn: 'root' });
|
|
318
340
|
}
|
|
319
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheet, decorators: [{
|
|
320
342
|
type: Injectable,
|
|
321
343
|
args: [{ providedIn: 'root' }]
|
|
322
344
|
}], ctorParameters: () => [] });
|
|
323
345
|
|
|
324
346
|
class MatBottomSheetModule {
|
|
325
|
-
static
|
|
326
|
-
static
|
|
327
|
-
static
|
|
347
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
348
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetModule, imports: [DialogModule, MatCommonModule, PortalModule, MatBottomSheetContainer], exports: [MatBottomSheetContainer, MatCommonModule] });
|
|
349
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetModule, providers: [MatBottomSheet], imports: [DialogModule, MatCommonModule, PortalModule, MatCommonModule] });
|
|
328
350
|
}
|
|
329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatBottomSheetModule, decorators: [{
|
|
330
352
|
type: NgModule,
|
|
331
353
|
args: [{
|
|
332
354
|
imports: [DialogModule, MatCommonModule, PortalModule, MatBottomSheetContainer],
|