@camaradesuk/m3e-angular 0.2.0-alpha.11 → 0.2.0-alpha.13
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/fesm2022/camaradesuk-m3e-angular.mjs +305 -20
- package/fesm2022/camaradesuk-m3e-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/styles/components/all-buttons/button/tokens/_common.scss +32 -5
- package/src/styles/styles.css +30 -15
- package/src/styles/styles.css.map +1 -1
- package/types/camaradesuk-m3e-angular.d.ts +160 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, signal, ElementRef, model, input, computed, Input, Directive, effect, forwardRef, booleanAttribute, output, contentChildren,
|
|
2
|
+
import { InjectionToken, inject, signal, ElementRef, model, input, ChangeDetectorRef, computed, Input, Directive, effect, forwardRef, booleanAttribute, output, contentChildren, NgZone, afterNextRender, afterRenderEffect, DestroyRef, ChangeDetectionStrategy, Component, ANIMATION_MODULE_TYPE, Injectable, viewChild, PLATFORM_ID, ViewEncapsulation, APP_ID, TemplateRef, ViewContainerRef, untracked, linkedSignal, isDevMode, afterEveryRender, Renderer2, QueryList, Injector, ViewChildren, ContentChildren, contentChild, HostAttributeToken } from '@angular/core';
|
|
3
3
|
import * as i1$2 from '@angular/material/button';
|
|
4
4
|
import { MatIconButton, MatButton, MatFabButton, MatButtonModule } from '@angular/material/button';
|
|
5
5
|
import { gsap } from 'gsap';
|
|
@@ -88,6 +88,7 @@ const MAT_EXP_BUTTON_GROUP_DEFAULT_OPTIONS = {
|
|
|
88
88
|
shape: 'round',
|
|
89
89
|
variant: 'standard',
|
|
90
90
|
selection: 'single-select',
|
|
91
|
+
semantics: 'toggle',
|
|
91
92
|
disableBounce: false,
|
|
92
93
|
// matExpButtonGroupClass: 'mat-exp-button-group',
|
|
93
94
|
};
|
|
@@ -437,6 +438,13 @@ const MAT_EXP_ICON_BUTTON_OPTIONS = _iconButtonOptions.token;
|
|
|
437
438
|
const provideMatExpIconButtonOptions = _iconButtonOptions.provide;
|
|
438
439
|
const injectMatExpIconButtonOptions = _iconButtonOptions.inject;
|
|
439
440
|
|
|
441
|
+
/**
|
|
442
|
+
* The attributes a radio-mode button group writes on each button, saved and restored around radio mode. Not exported
|
|
443
|
+
* from the package barrel.
|
|
444
|
+
* @internal
|
|
445
|
+
*/
|
|
446
|
+
const RADIO_ATTRIBUTES = ['role', 'aria-checked', 'aria-posinset', 'aria-setsize'];
|
|
447
|
+
|
|
440
448
|
/** @internal Shared open-state contract for Expressive triggers and button styling. */
|
|
441
449
|
const MAT_EXP_MENU_OPEN_STATE = new InjectionToken('MAT_EXP_MENU_OPEN_STATE');
|
|
442
450
|
|
|
@@ -499,6 +507,63 @@ class MatExpIconButton {
|
|
|
499
507
|
...(ngDevMode ? [{ debugName: "toggle" }] : /* istanbul ignore next */ []));
|
|
500
508
|
value = model(/* @ts-ignore */
|
|
501
509
|
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
510
|
+
/**
|
|
511
|
+
* This button's place in a radio-mode group (`semantics="radio"`), or `null` outside one.
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
_radioState = signal(null, { ...(ngDevMode ? { debugName: "_radioState" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b ||
|
|
515
|
+
(!!a &&
|
|
516
|
+
!!b &&
|
|
517
|
+
a.checked === b.checked &&
|
|
518
|
+
a.tabStop === b.tabStop &&
|
|
519
|
+
a.position === b.position &&
|
|
520
|
+
a.size === b.size) });
|
|
521
|
+
/** What the consumer had on the host before radio mode, restored when it ends (null while not in radio mode). */
|
|
522
|
+
/** The view that renders this button's host bindings (Material's `tabindex`), refreshed after a radio write. */
|
|
523
|
+
_changeDetector = inject(ChangeDetectorRef);
|
|
524
|
+
_savedRadioAttributes = null;
|
|
525
|
+
/**
|
|
526
|
+
* Applies or removes radio semantics for a radio-mode group. Outside radio mode the directive writes no ARIA, so a
|
|
527
|
+
* consumer's own `role` or `aria-*` stays as authored; in radio mode it sets `role="radio"`, `aria-checked`,
|
|
528
|
+
* `aria-posinset` and `aria-setsize` on the host itself and restores the consumer's values when the mode ends. The
|
|
529
|
+
* roving Tab stop is written to Material's own `tabIndex` input, so Material keeps one `tabindex` binding (and its
|
|
530
|
+
* disabled handling). The consumer's values are captured when radio mode starts: a consumer binding to `role` or
|
|
531
|
+
* `aria-*` that changes while the button is in radio mode is not supported (it would overwrite the radio value, and
|
|
532
|
+
* the captured value is what comes back).
|
|
533
|
+
* @internal
|
|
534
|
+
*/
|
|
535
|
+
_setRadioState(state) {
|
|
536
|
+
const host = this.matIconButton;
|
|
537
|
+
const element = this._hostElement;
|
|
538
|
+
if (state) {
|
|
539
|
+
if (!this._savedRadioAttributes) {
|
|
540
|
+
this._savedRadioAttributes = {
|
|
541
|
+
tabIndex: host.tabIndex,
|
|
542
|
+
attributes: Object.fromEntries(RADIO_ATTRIBUTES.map((name) => [name, element.getAttribute(name)])),
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
host.tabIndex = state.tabStop ? 0 : -1;
|
|
546
|
+
element.setAttribute('role', 'radio');
|
|
547
|
+
element.setAttribute('aria-checked', String(state.checked));
|
|
548
|
+
element.setAttribute('aria-posinset', String(state.position));
|
|
549
|
+
element.setAttribute('aria-setsize', String(state.size));
|
|
550
|
+
}
|
|
551
|
+
else if (this._savedRadioAttributes) {
|
|
552
|
+
const saved = this._savedRadioAttributes;
|
|
553
|
+
host.tabIndex = saved.tabIndex;
|
|
554
|
+
for (const [name, value] of Object.entries(saved.attributes)) {
|
|
555
|
+
if (value === null)
|
|
556
|
+
element.removeAttribute(name);
|
|
557
|
+
else
|
|
558
|
+
element.setAttribute(name, value);
|
|
559
|
+
}
|
|
560
|
+
this._savedRadioAttributes = null;
|
|
561
|
+
}
|
|
562
|
+
this._radioState.set(state);
|
|
563
|
+
// Material's `[attr.tabindex]` reads the plain `tabIndex` input, so mark this button's view: the new Tab stop
|
|
564
|
+
// reaches the DOM in zoneless apps and OnPush hosts without relying on anything else to refresh the view.
|
|
565
|
+
this._changeDetector.markForCheck();
|
|
566
|
+
}
|
|
502
567
|
/**
|
|
503
568
|
* `aria-pressed`, derived from `toggle()`. `null` when the button does not
|
|
504
569
|
* participate in toggle behavior, so the attribute is omitted entirely
|
|
@@ -507,6 +572,9 @@ class MatExpIconButton {
|
|
|
507
572
|
* @internal
|
|
508
573
|
*/
|
|
509
574
|
ariaPressed = computed(() => {
|
|
575
|
+
// A radio states its choice with `aria-checked` instead.
|
|
576
|
+
if (this._radioState())
|
|
577
|
+
return null;
|
|
510
578
|
const toggle = this.toggle();
|
|
511
579
|
return toggle === undefined ? null : toggle === 'selected' ? 'true' : 'false';
|
|
512
580
|
}, /* @ts-ignore */
|
|
@@ -677,6 +745,14 @@ const MAT_EXP_BUTTON_GROUP_VALUE_ACCESSOR = {
|
|
|
677
745
|
useExisting: forwardRef(() => MatExpButtonGroup),
|
|
678
746
|
multi: true,
|
|
679
747
|
};
|
|
748
|
+
/** A button that can take focus: not natively disabled (a `disabledInteractive` one can). */
|
|
749
|
+
function canTakeFocus(element) {
|
|
750
|
+
return !element.disabled;
|
|
751
|
+
}
|
|
752
|
+
/** A button that can be chosen: neither natively disabled nor `disabledInteractive`. */
|
|
753
|
+
function isEnabled(element) {
|
|
754
|
+
return canTakeFocus(element) && element.getAttribute('aria-disabled') !== 'true';
|
|
755
|
+
}
|
|
680
756
|
/**
|
|
681
757
|
* Component that groups buttons and provides single/multi-select behavior
|
|
682
758
|
* compatible with Angular reactive and template-driven forms.
|
|
@@ -694,6 +770,21 @@ class MatExpButtonGroup {
|
|
|
694
770
|
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
695
771
|
/** Prevents user interaction from clearing the last selected button. */
|
|
696
772
|
selectionRequired = input(this._options.selectionRequired ?? false, { ...(ngDevMode ? { debugName: "selectionRequired" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
773
|
+
/**
|
|
774
|
+
* How a single-select group presents itself to assistive technology.
|
|
775
|
+
*
|
|
776
|
+
* - `'toggle'` (default): `role="group"` of toggle buttons with `aria-pressed`. Every button is a
|
|
777
|
+
* Tab stop; arrow keys move focus only.
|
|
778
|
+
* - `'radio'`: the WAI-ARIA radio group pattern, as Angular Material's single-select button toggle
|
|
779
|
+
* group: `role="radiogroup"`, each button `role="radio"` with `aria-checked`, `aria-posinset` and
|
|
780
|
+
* `aria-setsize`; one Tab stop (the chosen button, or the first enabled one); arrow keys, Home and
|
|
781
|
+
* End move focus and choose; a choice cannot be cleared (`selectionRequired` is implied).
|
|
782
|
+
*
|
|
783
|
+
* Ignored (`'toggle'` behaviour) for `multi-select`.
|
|
784
|
+
* @default 'toggle'
|
|
785
|
+
*/
|
|
786
|
+
semantics = input(this._options.semantics ?? 'toggle', /* @ts-ignore */
|
|
787
|
+
...(ngDevMode ? [{ debugName: "semantics" }] : /* istanbul ignore next */ []));
|
|
697
788
|
/** @default 'standard' */
|
|
698
789
|
variant = input(this._options.variant, /* @ts-ignore */
|
|
699
790
|
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
@@ -727,6 +818,12 @@ class MatExpButtonGroup {
|
|
|
727
818
|
* @internal
|
|
728
819
|
*/
|
|
729
820
|
matExpButtonGroupClass = 'mat-exp-button-group';
|
|
821
|
+
/**
|
|
822
|
+
* Whether the radio group pattern applies: `semantics="radio"` on a single-select group.
|
|
823
|
+
* @internal
|
|
824
|
+
*/
|
|
825
|
+
_radio = computed(() => this.semantics() === 'radio' && this.selection() === 'single-select', /* @ts-ignore */
|
|
826
|
+
...(ngDevMode ? [{ debugName: "_radio" }] : /* istanbul ignore next */ []));
|
|
730
827
|
// Buttons inject this group; defer query tokens for partial-compiled JIT consumers.
|
|
731
828
|
_matExpButtons = contentChildren(forwardRef(() => MatExpButton), /* @ts-ignore */
|
|
732
829
|
...(ngDevMode ? [{ debugName: "_matExpButtons" }] : /* istanbul ignore next */ []));
|
|
@@ -799,6 +896,21 @@ class MatExpButtonGroup {
|
|
|
799
896
|
this._bounce?.destroy();
|
|
800
897
|
}, { signal: this._interactionAbort.signal });
|
|
801
898
|
this._ngZone.runOutsideAngular(() => this._setupBounceInteractions());
|
|
899
|
+
// A button's or the group's disabled state is not a signal the radio effect can track (a form
|
|
900
|
+
// control, Material's `disabled` input), so watch the attributes that carry it and re-choose
|
|
901
|
+
// the roving Tab stop when they change.
|
|
902
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
903
|
+
const observer = new MutationObserver(() => {
|
|
904
|
+
if (this._radio())
|
|
905
|
+
this._ngZone.run(() => this._syncRadioState());
|
|
906
|
+
});
|
|
907
|
+
observer.observe(this._hostElement, {
|
|
908
|
+
subtree: true,
|
|
909
|
+
attributes: true,
|
|
910
|
+
attributeFilter: ['disabled', 'aria-disabled'],
|
|
911
|
+
});
|
|
912
|
+
this._interactionAbort.signal.addEventListener('abort', () => observer.disconnect());
|
|
913
|
+
}
|
|
802
914
|
});
|
|
803
915
|
// Snap any in-flight bounce back to rest immediately when a consumer flips
|
|
804
916
|
// `disableBounce` mid-press, rather than leaving it stuck expanded until
|
|
@@ -808,6 +920,12 @@ class MatExpButtonGroup {
|
|
|
808
920
|
this._bounce?.destroy();
|
|
809
921
|
}
|
|
810
922
|
});
|
|
923
|
+
// Radio mode: roles, `aria-checked`, positions and the single roving Tab stop. Runs after render,
|
|
924
|
+
// so writing Material's `tabIndex` input never changes a binding mid-check; it re-runs whenever
|
|
925
|
+
// the mode, the projected buttons or any button's toggle state changes.
|
|
926
|
+
afterRenderEffect({
|
|
927
|
+
write: () => this._syncRadioState(),
|
|
928
|
+
});
|
|
811
929
|
inject(DestroyRef).onDestroy(() => {
|
|
812
930
|
this._interactionAbort.abort();
|
|
813
931
|
this._bounce?.destroy();
|
|
@@ -882,7 +1000,16 @@ class MatExpButtonGroup {
|
|
|
882
1000
|
}
|
|
883
1001
|
}, { signal });
|
|
884
1002
|
}
|
|
885
|
-
/**
|
|
1003
|
+
/**
|
|
1004
|
+
* Arrow keys, Home and End move focus between the group's buttons (mirrored in RTL).
|
|
1005
|
+
*
|
|
1006
|
+
* - Toggle semantics (default): native Tab order is kept, the arrows only move focus (manual
|
|
1007
|
+
* activation) and they skip natively disabled and `disabledInteractive` buttons.
|
|
1008
|
+
* - Radio semantics: the arrows move across every button that can take focus, the same set the
|
|
1009
|
+
* roving Tab stop is chosen from, and choose the button they land on (automatic activation).
|
|
1010
|
+
* A `disabledInteractive` button takes focus, so its reason can be read, but is not chosen.
|
|
1011
|
+
* @internal
|
|
1012
|
+
*/
|
|
886
1013
|
_onGroupKeydown(event) {
|
|
887
1014
|
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || this.disabled())
|
|
888
1015
|
return;
|
|
@@ -893,8 +1020,8 @@ class MatExpButtonGroup {
|
|
|
893
1020
|
if (!(target instanceof Element) ||
|
|
894
1021
|
target.closest('mat-exp-button-group') !== this._hostElement)
|
|
895
1022
|
return;
|
|
896
|
-
const
|
|
897
|
-
|
|
1023
|
+
const radio = this._radio();
|
|
1024
|
+
const controls = this._childButtonElements().filter((element) => radio ? canTakeFocus(element) : isEnabled(element));
|
|
898
1025
|
const current = controls.findIndex((element) => element === target || element.contains(target));
|
|
899
1026
|
if (current < 0 || !controls.length)
|
|
900
1027
|
return;
|
|
@@ -907,6 +1034,13 @@ class MatExpButtonGroup {
|
|
|
907
1034
|
: (current + (backwards ? -1 : 1) + controls.length) % controls.length;
|
|
908
1035
|
event.preventDefault();
|
|
909
1036
|
controls[next].focus();
|
|
1037
|
+
// Radio group pattern: moving focus also chooses (automatic activation), except a
|
|
1038
|
+
// `disabledInteractive` button, which takes focus but cannot be chosen.
|
|
1039
|
+
if (radio && isEnabled(controls[next])) {
|
|
1040
|
+
const button = this._allExpressiveButtons().find((candidate) => candidate._hostElement === controls[next]);
|
|
1041
|
+
if (button && !this._selectionModel.isSelected(button))
|
|
1042
|
+
this._onButtonClick(button);
|
|
1043
|
+
}
|
|
910
1044
|
}
|
|
911
1045
|
// ---- ControlValueAccessor ----
|
|
912
1046
|
writeValue(value) {
|
|
@@ -936,7 +1070,8 @@ class MatExpButtonGroup {
|
|
|
936
1070
|
return;
|
|
937
1071
|
const isSelected = this._selectionModel.isSelected(button);
|
|
938
1072
|
if (isSelected) {
|
|
939
|
-
|
|
1073
|
+
const required = this.selectionRequired() || this._radio();
|
|
1074
|
+
if (required && this._selectionModel.selected.length === 1) {
|
|
940
1075
|
this._onTouched();
|
|
941
1076
|
return;
|
|
942
1077
|
}
|
|
@@ -986,6 +1121,34 @@ class MatExpButtonGroup {
|
|
|
986
1121
|
});
|
|
987
1122
|
this._cdr.markForCheck();
|
|
988
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Applies radio semantics to every projected button in radio mode, or removes them. The Tab stop
|
|
1126
|
+
* comes from the same set the arrow keys move across (buttons that can take focus): the chosen
|
|
1127
|
+
* button when it can take focus, otherwise the first fully enabled button, otherwise the first
|
|
1128
|
+
* `disabledInteractive` one. A natively disabled button never takes focus.
|
|
1129
|
+
*/
|
|
1130
|
+
_syncRadioState() {
|
|
1131
|
+
const buttons = [...this._allExpressiveButtons()].sort((a, b) => a._hostElement.compareDocumentPosition(b._hostElement) & Node.DOCUMENT_POSITION_FOLLOWING
|
|
1132
|
+
? -1
|
|
1133
|
+
: 1);
|
|
1134
|
+
if (!this._radio()) {
|
|
1135
|
+
buttons.forEach((button) => button._setRadioState(null));
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
const checked = buttons.map((button) => button.toggle() === 'selected');
|
|
1139
|
+
const chosen = buttons.find((button, index) => checked[index] && canTakeFocus(button._hostElement));
|
|
1140
|
+
const tabStop = chosen ??
|
|
1141
|
+
buttons.find((button) => isEnabled(button._hostElement)) ??
|
|
1142
|
+
buttons.find((button) => canTakeFocus(button._hostElement)) ??
|
|
1143
|
+
null;
|
|
1144
|
+
buttons.forEach((button, index) => button._setRadioState({
|
|
1145
|
+
checked: checked[index],
|
|
1146
|
+
tabStop: button === tabStop,
|
|
1147
|
+
position: index + 1,
|
|
1148
|
+
size: buttons.length,
|
|
1149
|
+
}));
|
|
1150
|
+
this._cdr.markForCheck();
|
|
1151
|
+
}
|
|
989
1152
|
/** Derives `_value` from the current selection model state. */
|
|
990
1153
|
_updateValueFromModel() {
|
|
991
1154
|
const selected = this._selectionModel.selected;
|
|
@@ -997,7 +1160,7 @@ class MatExpButtonGroup {
|
|
|
997
1160
|
}
|
|
998
1161
|
}
|
|
999
1162
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpButtonGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1000
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.3", type: MatExpButtonGroup, isStandalone: true, selector: "mat-exp-button-group", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectionRequired: { classPropertyName: "selectionRequired", publicName: "selectionRequired", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disableBounce: { classPropertyName: "disableBounce", publicName: "disableBounce", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selectionChange: "selectionChange" }, host: {
|
|
1163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.3", type: MatExpButtonGroup, isStandalone: true, selector: "mat-exp-button-group", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectionRequired: { classPropertyName: "selectionRequired", publicName: "selectionRequired", isSignal: true, isRequired: false, transformFunction: null }, semantics: { classPropertyName: "semantics", publicName: "semantics", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disableBounce: { classPropertyName: "disableBounce", publicName: "disableBounce", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", selectionChange: "selectionChange" }, host: { listeners: { "keydown": "_onGroupKeydown($event)" }, properties: { "attr.role": "_radio() ? \"radiogroup\" : \"group\"", "class": "matExpButtonGroupClass", "attr.data-variant": "variant()", "attr.data-selection": "selection()", "attr.data-size": "size()", "attr.data-shape": "shape()", "attr.data-appearance": "appearance()", "attr.data-disabled": "disabled()", "attr.aria-disabled": "disabled()" } }, providers: [
|
|
1001
1164
|
MAT_EXP_BUTTON_GROUP_VALUE_ACCESSOR,
|
|
1002
1165
|
{ provide: MAT_EXP_BUTTON_GROUP, useExisting: MatExpButtonGroup },
|
|
1003
1166
|
], queries: [{ propertyName: "_matExpButtons", predicate: i0.forwardRef(() => MatExpButton), isSignal: true }, { propertyName: "_matExpIconButtons", predicate: i0.forwardRef(() => MatExpIconButton), isSignal: true }], ngImport: i0, template: "<ng-content></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -1008,7 +1171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
|
|
|
1008
1171
|
MAT_EXP_BUTTON_GROUP_VALUE_ACCESSOR,
|
|
1009
1172
|
{ provide: MAT_EXP_BUTTON_GROUP, useExisting: MatExpButtonGroup },
|
|
1010
1173
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1011
|
-
role: 'group',
|
|
1174
|
+
'[attr.role]': '_radio() ? "radiogroup" : "group"',
|
|
1012
1175
|
'[class]': 'matExpButtonGroupClass',
|
|
1013
1176
|
'[attr.data-variant]': 'variant()',
|
|
1014
1177
|
'[attr.data-selection]': 'selection()',
|
|
@@ -1019,7 +1182,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
|
|
|
1019
1182
|
'[attr.aria-disabled]': 'disabled()',
|
|
1020
1183
|
'(keydown)': '_onGroupKeydown($event)',
|
|
1021
1184
|
}, template: "<ng-content></ng-content>\n" }]
|
|
1022
|
-
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], selectionRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionRequired", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disableBounce: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBounce", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], value: [{
|
|
1185
|
+
}], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], selectionRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionRequired", required: false }] }], semantics: [{ type: i0.Input, args: [{ isSignal: true, alias: "semantics", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disableBounce: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableBounce", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], value: [{
|
|
1023
1186
|
type: Input
|
|
1024
1187
|
}], _matExpButtons: [{ type: i0.ContentChildren, args: [forwardRef(() => MatExpButton), { isSignal: true }] }], _matExpIconButtons: [{ type: i0.ContentChildren, args: [forwardRef(() => MatExpIconButton), { isSignal: true }] }] } });
|
|
1025
1188
|
|
|
@@ -1061,6 +1224,63 @@ class MatExpButton {
|
|
|
1061
1224
|
...(ngDevMode ? [{ debugName: "toggle" }] : /* istanbul ignore next */ []));
|
|
1062
1225
|
value = model(/* @ts-ignore */
|
|
1063
1226
|
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1227
|
+
/**
|
|
1228
|
+
* This button's place in a radio-mode group (`semantics="radio"`), or `null` outside one.
|
|
1229
|
+
* @internal
|
|
1230
|
+
*/
|
|
1231
|
+
_radioState = signal(null, { ...(ngDevMode ? { debugName: "_radioState" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b ||
|
|
1232
|
+
(!!a &&
|
|
1233
|
+
!!b &&
|
|
1234
|
+
a.checked === b.checked &&
|
|
1235
|
+
a.tabStop === b.tabStop &&
|
|
1236
|
+
a.position === b.position &&
|
|
1237
|
+
a.size === b.size) });
|
|
1238
|
+
/** What the consumer had on the host before radio mode, restored when it ends (null while not in radio mode). */
|
|
1239
|
+
/** The view that renders this button's host bindings (Material's `tabindex`), refreshed after a radio write. */
|
|
1240
|
+
_changeDetector = inject(ChangeDetectorRef);
|
|
1241
|
+
_savedRadioAttributes = null;
|
|
1242
|
+
/**
|
|
1243
|
+
* Applies or removes radio semantics for a radio-mode group. Outside radio mode the directive writes no ARIA, so a
|
|
1244
|
+
* consumer's own `role` or `aria-*` stays as authored; in radio mode it sets `role="radio"`, `aria-checked`,
|
|
1245
|
+
* `aria-posinset` and `aria-setsize` on the host itself and restores the consumer's values when the mode ends. The
|
|
1246
|
+
* roving Tab stop is written to Material's own `tabIndex` input, so Material keeps one `tabindex` binding (and its
|
|
1247
|
+
* disabled handling). The consumer's values are captured when radio mode starts: a consumer binding to `role` or
|
|
1248
|
+
* `aria-*` that changes while the button is in radio mode is not supported (it would overwrite the radio value, and
|
|
1249
|
+
* the captured value is what comes back).
|
|
1250
|
+
* @internal
|
|
1251
|
+
*/
|
|
1252
|
+
_setRadioState(state) {
|
|
1253
|
+
const host = this.materialHost;
|
|
1254
|
+
const element = this._hostElement;
|
|
1255
|
+
if (state) {
|
|
1256
|
+
if (!this._savedRadioAttributes) {
|
|
1257
|
+
this._savedRadioAttributes = {
|
|
1258
|
+
tabIndex: host.tabIndex,
|
|
1259
|
+
attributes: Object.fromEntries(RADIO_ATTRIBUTES.map((name) => [name, element.getAttribute(name)])),
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
host.tabIndex = state.tabStop ? 0 : -1;
|
|
1263
|
+
element.setAttribute('role', 'radio');
|
|
1264
|
+
element.setAttribute('aria-checked', String(state.checked));
|
|
1265
|
+
element.setAttribute('aria-posinset', String(state.position));
|
|
1266
|
+
element.setAttribute('aria-setsize', String(state.size));
|
|
1267
|
+
}
|
|
1268
|
+
else if (this._savedRadioAttributes) {
|
|
1269
|
+
const saved = this._savedRadioAttributes;
|
|
1270
|
+
host.tabIndex = saved.tabIndex;
|
|
1271
|
+
for (const [name, value] of Object.entries(saved.attributes)) {
|
|
1272
|
+
if (value === null)
|
|
1273
|
+
element.removeAttribute(name);
|
|
1274
|
+
else
|
|
1275
|
+
element.setAttribute(name, value);
|
|
1276
|
+
}
|
|
1277
|
+
this._savedRadioAttributes = null;
|
|
1278
|
+
}
|
|
1279
|
+
this._radioState.set(state);
|
|
1280
|
+
// Material's `[attr.tabindex]` reads the plain `tabIndex` input, so mark this button's view: the new Tab stop
|
|
1281
|
+
// reaches the DOM in zoneless apps and OnPush hosts without relying on anything else to refresh the view.
|
|
1282
|
+
this._changeDetector.markForCheck();
|
|
1283
|
+
}
|
|
1064
1284
|
/**
|
|
1065
1285
|
* `aria-pressed`, derived from `toggle()`. `null` when the button does not
|
|
1066
1286
|
* participate in toggle behavior, so the attribute is omitted entirely
|
|
@@ -1069,6 +1289,9 @@ class MatExpButton {
|
|
|
1069
1289
|
* @internal
|
|
1070
1290
|
*/
|
|
1071
1291
|
ariaPressed = computed(() => {
|
|
1292
|
+
// A radio states its choice with `aria-checked` instead.
|
|
1293
|
+
if (this._radioState())
|
|
1294
|
+
return null;
|
|
1072
1295
|
const toggle = this.toggle();
|
|
1073
1296
|
return toggle === undefined ? null : toggle === 'selected' ? 'true' : 'false';
|
|
1074
1297
|
}, /* @ts-ignore */
|
|
@@ -5457,6 +5680,7 @@ const options$2 = matExpCreateOptions({
|
|
|
5457
5680
|
closeLabel: 'Close dialog',
|
|
5458
5681
|
adaptiveWidth: undefined,
|
|
5459
5682
|
compactActions: 'header',
|
|
5683
|
+
closeButton: 'visible',
|
|
5460
5684
|
});
|
|
5461
5685
|
const MAT_EXP_DIALOG_OPTIONS = options$2.token;
|
|
5462
5686
|
const provideMatExpDialogOptions = options$2.provide;
|
|
@@ -8466,6 +8690,19 @@ class MatExpDialogRef {
|
|
|
8466
8690
|
*/
|
|
8467
8691
|
disableClose;
|
|
8468
8692
|
/** @internal */
|
|
8693
|
+
_closeButton = signal('visible', /* @ts-ignore */
|
|
8694
|
+
...(ngDevMode ? [{ debugName: "_closeButton" }] : /* istanbul ignore next */ []));
|
|
8695
|
+
/** @internal */
|
|
8696
|
+
_closeLabel = signal('', /* @ts-ignore */
|
|
8697
|
+
...(ngDevMode ? [{ debugName: "_closeLabel" }] : /* istanbul ignore next */ []));
|
|
8698
|
+
/**
|
|
8699
|
+
* Whether the adaptive layout shows its close button. Alert dialogs never have one.
|
|
8700
|
+
* @default 'visible'
|
|
8701
|
+
*/
|
|
8702
|
+
closeButton = this._closeButton.asReadonly();
|
|
8703
|
+
/** The adaptive close button's accessible label. @default 'Close dialog' */
|
|
8704
|
+
closeLabel = this._closeLabel.asReadonly();
|
|
8705
|
+
/** @internal */
|
|
8469
8706
|
_state = MatDialogState.OPEN;
|
|
8470
8707
|
/** @internal */
|
|
8471
8708
|
_result;
|
|
@@ -8492,6 +8729,8 @@ class MatExpDialogRef {
|
|
|
8492
8729
|
this._container = _container;
|
|
8493
8730
|
this._position = _position;
|
|
8494
8731
|
this.disableClose = !!_config.disableClose;
|
|
8732
|
+
this._closeButton.set(_config.closeButton ?? 'visible');
|
|
8733
|
+
this._closeLabel.set(_config.closeLabel ?? '');
|
|
8495
8734
|
_container.opened.subscribe(() => {
|
|
8496
8735
|
this._opened.next();
|
|
8497
8736
|
this._opened.complete();
|
|
@@ -8561,6 +8800,33 @@ class MatExpDialogRef {
|
|
|
8561
8800
|
closeButtonClick() {
|
|
8562
8801
|
return this._closeButtonClicks.asObservable();
|
|
8563
8802
|
}
|
|
8803
|
+
/**
|
|
8804
|
+
* Show or hide the adaptive layout's close button while the dialog is open, for example to hide
|
|
8805
|
+
* it while work that must not be interrupted runs. Escape and backdrop clicks keep following
|
|
8806
|
+
* `disableClose`, and focus stays trapped in the dialog. Hiding the button while it has focus
|
|
8807
|
+
* moves focus to the dialog's initial focus target (the first tabbable control by default).
|
|
8808
|
+
* No effect on alert dialogs, which have no close button.
|
|
8809
|
+
*/
|
|
8810
|
+
updateCloseButton(closeButton) {
|
|
8811
|
+
if (closeButton !== 'visible' && closeButton !== 'hidden')
|
|
8812
|
+
throw new Error("closeButton must be 'visible' or 'hidden'.");
|
|
8813
|
+
if (closeButton === this._closeButton())
|
|
8814
|
+
return this;
|
|
8815
|
+
if (closeButton === 'hidden')
|
|
8816
|
+
this._container.closeButtonHiding();
|
|
8817
|
+
this._closeButton.set(closeButton);
|
|
8818
|
+
return this;
|
|
8819
|
+
}
|
|
8820
|
+
/**
|
|
8821
|
+
* Change the adaptive close button's accessible label while the dialog is open, for example to
|
|
8822
|
+
* say what closing does in the current state. Must not be blank.
|
|
8823
|
+
*/
|
|
8824
|
+
updateCloseLabel(closeLabel) {
|
|
8825
|
+
if (!closeLabel.trim())
|
|
8826
|
+
throw new Error('closeLabel must not be empty.');
|
|
8827
|
+
this._closeLabel.set(closeLabel);
|
|
8828
|
+
return this;
|
|
8829
|
+
}
|
|
8564
8830
|
/** @internal The adaptive close button is a dismissal gesture, like Escape and the backdrop. */
|
|
8565
8831
|
_closeButtonClick(event) {
|
|
8566
8832
|
this._closeButtonClicks.next(event);
|
|
@@ -9077,6 +9343,15 @@ class MatExpDialogContainer extends CdkDialogContainer {
|
|
|
9077
9343
|
this.exited.next();
|
|
9078
9344
|
});
|
|
9079
9345
|
}
|
|
9346
|
+
/**
|
|
9347
|
+
* The layout's close button is about to be removed. If it has focus, move focus to the dialog's
|
|
9348
|
+
* initial focus target once it is gone, so focus never falls out of the trap to the page.
|
|
9349
|
+
*/
|
|
9350
|
+
closeButtonHiding() {
|
|
9351
|
+
const button = this._elementRef.nativeElement.querySelector('.mat-exp-dialog-close');
|
|
9352
|
+
if (button?.contains(this._document?.activeElement ?? null))
|
|
9353
|
+
this._trapFocus({ preventScroll: true });
|
|
9354
|
+
}
|
|
9080
9355
|
/** Follow content that animates its own size, without a competing surface spring. */
|
|
9081
9356
|
followContentSize(active) {
|
|
9082
9357
|
this._following = active;
|
|
@@ -9152,14 +9427,14 @@ class MatExpDialogLayout {
|
|
|
9152
9427
|
_actions = contentChild(MatExpDialogActions, /* @ts-ignore */
|
|
9153
9428
|
...(ngDevMode ? [{ debugName: "_actions" }] : /* istanbul ignore next */ []));
|
|
9154
9429
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpDialogLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
9155
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.3", type: MatExpDialogLayout, isStandalone: true, selector: "mat-exp-dialog-layout", host: { properties: { "attr.data-mode": "_context.mode", "attr.data-compact-actions": "_context.mode === 'adaptive' ? _context.compactActions : null" } }, queries: [{ propertyName: "_actions", first: true, predicate: MatExpDialogActions, descendants: true, isSignal: true }], exportAs: ["matExpDialogLayout"], ngImport: i0, template: `
|
|
9156
|
-
@if (_context.mode === 'adaptive') {
|
|
9430
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.3", type: MatExpDialogLayout, isStandalone: true, selector: "mat-exp-dialog-layout", host: { properties: { "attr.data-mode": "_context.mode", "attr.data-compact-actions": "_context.mode === 'adaptive' ? _context.compactActions : null", "attr.data-close-button": "_context.mode === 'adaptive' ? _ref.closeButton() : null" } }, queries: [{ propertyName: "_actions", first: true, predicate: MatExpDialogActions, descendants: true, isSignal: true }], exportAs: ["matExpDialogLayout"], ngImport: i0, template: `
|
|
9431
|
+
@if (_context.mode === 'adaptive' && _ref.closeButton() === 'visible') {
|
|
9157
9432
|
<button
|
|
9158
9433
|
type="button"
|
|
9159
9434
|
matIconButton
|
|
9160
9435
|
class="mat-exp-dialog-close"
|
|
9161
9436
|
(click)="_ref._closeButtonClick($event)"
|
|
9162
|
-
[attr.aria-label]="
|
|
9437
|
+
[attr.aria-label]="_ref.closeLabel()"
|
|
9163
9438
|
>
|
|
9164
9439
|
<svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24">
|
|
9165
9440
|
<path
|
|
@@ -9176,18 +9451,18 @@ class MatExpDialogLayout {
|
|
|
9176
9451
|
<ng-container [ngTemplateOutlet]="actions.template" />
|
|
9177
9452
|
</div>
|
|
9178
9453
|
}
|
|
9179
|
-
`, isInline: true, styles: ["mat-exp-dialog-layout{display:grid;grid-template:\"heading close\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/1fr auto;min-height:0;max-height:inherit;height:100%}mat-exp-dialog-layout>.mat-exp-dialog-heading{grid-area:heading;margin:0;min-width:0;overflow-wrap:anywhere}mat-exp-dialog-layout>.mat-exp-dialog-body{grid-area:body;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain}mat-exp-dialog-layout>.mat-exp-dialog-actions{grid-area:actions}mat-exp-dialog-layout>.mat-exp-dialog-close{grid-area:close;align-self:center;margin-inline-end:16px}mat-exp-dialog-layout>.mat-exp-dialog-close.cdk-program-focused:not(:focus-visible,:hover)>.mat-mdc-button-persistent-ripple:before{opacity:0}@media(max-width:599px){.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]{grid-template:\"close heading actions\" auto \"body body body\" minmax(0,1fr)/auto minmax(0,1fr) auto;padding-top:env(safe-area-inset-top,0px)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-close{grid-area:close;display:inline-flex;align-self:center;margin-inline-start:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading{align-self:center;padding:.75rem .5rem;font:var(--mat-sys-title-large)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading:before{display:none}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-actions{align-self:center;min-height:3.5rem;padding:0;padding-inline-end:max(8px,env(safe-area-inset-right,0px));border:0;flex-wrap:wrap;max-width:45vw}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-close{margin-inline-start:max(8px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-actions{padding-inline-end:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-body{padding-top:1.5rem;padding-bottom:max(24px,env(safe-area-inset-bottom,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]{grid-template:\"close heading\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/auto minmax(0,1fr)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-actions{align-self:stretch;max-width:none;min-height:0;padding:1rem max(24px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(24px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-body{padding-bottom:1.5rem}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]:dir(rtl)>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-left,0px))}}mat-exp-dialog-layout>.mat-exp-dialog-heading{padding:24px 24px 16px;color:var(--mat-sys-on-surface);font:var(--mat-sys-headline-small)}mat-exp-dialog-layout>.mat-exp-dialog-body{padding:0 24px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}mat-exp-dialog-layout>.mat-exp-dialog-body>:first-child{margin-top:0}mat-exp-dialog-layout>.mat-exp-dialog-body>:last-child{margin-bottom:0}mat-exp-dialog-layout>.mat-exp-dialog-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;padding:24px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
9454
|
+
`, isInline: true, styles: ["mat-exp-dialog-layout{display:grid;grid-template:\"heading close\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/1fr auto;min-height:0;max-height:inherit;height:100%}mat-exp-dialog-layout>.mat-exp-dialog-heading{grid-area:heading;margin:0;min-width:0;overflow-wrap:anywhere}mat-exp-dialog-layout>.mat-exp-dialog-body{grid-area:body;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain}mat-exp-dialog-layout>.mat-exp-dialog-actions{grid-area:actions}mat-exp-dialog-layout>.mat-exp-dialog-close{grid-area:close;align-self:center;margin-inline-end:16px}mat-exp-dialog-layout>.mat-exp-dialog-close.cdk-program-focused:not(:focus-visible,:hover)>.mat-mdc-button-persistent-ripple:before{opacity:0}@media(max-width:599px){.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]{grid-template:\"close heading actions\" auto \"body body body\" minmax(0,1fr)/auto minmax(0,1fr) auto;padding-top:env(safe-area-inset-top,0px)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-close{grid-area:close;display:inline-flex;align-self:center;margin-inline-start:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading{align-self:center;padding:.75rem .5rem;font:var(--mat-sys-title-large)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading:before{display:none}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-actions{align-self:center;min-height:3.5rem;padding:0;padding-inline-end:max(8px,env(safe-area-inset-right,0px));border:0;flex-wrap:wrap;max-width:45vw}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-close{margin-inline-start:max(8px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-actions{padding-inline-end:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-body{padding-top:1.5rem;padding-bottom:max(24px,env(safe-area-inset-bottom,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-close-button=hidden]>.mat-exp-dialog-heading{padding-inline-start:max(24px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-close-button=hidden]:dir(rtl)>.mat-exp-dialog-heading{padding-inline-start:max(24px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]{grid-template:\"close heading\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/auto minmax(0,1fr)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-actions{align-self:stretch;max-width:none;min-height:0;padding:1rem max(24px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(24px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-body{padding-bottom:1.5rem}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]:dir(rtl)>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-left,0px))}}mat-exp-dialog-layout>.mat-exp-dialog-heading{padding:24px 24px 16px;color:var(--mat-sys-on-surface);font:var(--mat-sys-headline-small)}mat-exp-dialog-layout>.mat-exp-dialog-body{padding:0 24px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}mat-exp-dialog-layout>.mat-exp-dialog-body>:first-child{margin-top:0}mat-exp-dialog-layout>.mat-exp-dialog-body>:last-child{margin-bottom:0}mat-exp-dialog-layout>.mat-exp-dialog-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;padding:24px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
9180
9455
|
}
|
|
9181
9456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpDialogLayout, decorators: [{
|
|
9182
9457
|
type: Component,
|
|
9183
9458
|
args: [{ selector: 'mat-exp-dialog-layout', exportAs: 'matExpDialogLayout', imports: [MatButtonModule, NgTemplateOutlet], template: `
|
|
9184
|
-
@if (_context.mode === 'adaptive') {
|
|
9459
|
+
@if (_context.mode === 'adaptive' && _ref.closeButton() === 'visible') {
|
|
9185
9460
|
<button
|
|
9186
9461
|
type="button"
|
|
9187
9462
|
matIconButton
|
|
9188
9463
|
class="mat-exp-dialog-close"
|
|
9189
9464
|
(click)="_ref._closeButtonClick($event)"
|
|
9190
|
-
[attr.aria-label]="
|
|
9465
|
+
[attr.aria-label]="_ref.closeLabel()"
|
|
9191
9466
|
>
|
|
9192
9467
|
<svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24">
|
|
9193
9468
|
<path
|
|
@@ -9207,7 +9482,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
|
|
|
9207
9482
|
`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
9208
9483
|
'[attr.data-mode]': '_context.mode',
|
|
9209
9484
|
'[attr.data-compact-actions]': "_context.mode === 'adaptive' ? _context.compactActions : null",
|
|
9210
|
-
|
|
9485
|
+
'[attr.data-close-button]': "_context.mode === 'adaptive' ? _ref.closeButton() : null",
|
|
9486
|
+
}, styles: ["mat-exp-dialog-layout{display:grid;grid-template:\"heading close\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/1fr auto;min-height:0;max-height:inherit;height:100%}mat-exp-dialog-layout>.mat-exp-dialog-heading{grid-area:heading;margin:0;min-width:0;overflow-wrap:anywhere}mat-exp-dialog-layout>.mat-exp-dialog-body{grid-area:body;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain}mat-exp-dialog-layout>.mat-exp-dialog-actions{grid-area:actions}mat-exp-dialog-layout>.mat-exp-dialog-close{grid-area:close;align-self:center;margin-inline-end:16px}mat-exp-dialog-layout>.mat-exp-dialog-close.cdk-program-focused:not(:focus-visible,:hover)>.mat-mdc-button-persistent-ripple:before{opacity:0}@media(max-width:599px){.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]{grid-template:\"close heading actions\" auto \"body body body\" minmax(0,1fr)/auto minmax(0,1fr) auto;padding-top:env(safe-area-inset-top,0px)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-close{grid-area:close;display:inline-flex;align-self:center;margin-inline-start:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading{align-self:center;padding:.75rem .5rem;font:var(--mat-sys-title-large)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-heading:before{display:none}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-actions{align-self:center;min-height:3.5rem;padding:0;padding-inline-end:max(8px,env(safe-area-inset-right,0px));border:0;flex-wrap:wrap;max-width:45vw}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-close{margin-inline-start:max(8px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]:dir(rtl)>.mat-exp-dialog-actions{padding-inline-end:max(8px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive]>.mat-exp-dialog-body{padding-top:1.5rem;padding-bottom:max(24px,env(safe-area-inset-bottom,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-close-button=hidden]>.mat-exp-dialog-heading{padding-inline-start:max(24px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-close-button=hidden]:dir(rtl)>.mat-exp-dialog-heading{padding-inline-start:max(24px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]{grid-template:\"close heading\" auto \"body body\" minmax(0,1fr) \"actions actions\" auto/auto minmax(0,1fr)}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-right,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-actions{align-self:stretch;max-width:none;min-height:0;padding:1rem max(24px,env(safe-area-inset-right,0px)) max(16px,env(safe-area-inset-bottom,0px)) max(24px,env(safe-area-inset-left,0px))}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]>.mat-exp-dialog-body{padding-bottom:1.5rem}.mat-exp-dialog-panel mat-exp-dialog-layout[data-mode=adaptive][data-compact-actions=footer]:dir(rtl)>.mat-exp-dialog-heading{padding-inline-end:max(16px,env(safe-area-inset-left,0px))}}mat-exp-dialog-layout>.mat-exp-dialog-heading{padding:24px 24px 16px;color:var(--mat-sys-on-surface);font:var(--mat-sys-headline-small)}mat-exp-dialog-layout>.mat-exp-dialog-body{padding:0 24px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}mat-exp-dialog-layout>.mat-exp-dialog-body>:first-child{margin-top:0}mat-exp-dialog-layout>.mat-exp-dialog-body>:last-child{margin-bottom:0}mat-exp-dialog-layout>.mat-exp-dialog-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;padding:24px}\n"] }]
|
|
9211
9487
|
}], propDecorators: { _actions: [{ type: i0.ContentChild, args: [i0.forwardRef(() => MatExpDialogActions), { isSignal: true }] }] } });
|
|
9212
9488
|
|
|
9213
9489
|
/** @internal Built-in content for the one-call plain-text confirmation. */
|
|
@@ -9308,7 +9584,7 @@ class MatExpDialog {
|
|
|
9308
9584
|
if (config.mode === 'alert' && (!config.role || !config.ariaDescribedBy?.trim())) {
|
|
9309
9585
|
throw new Error('Alert mode requires an explicit role and ariaDescribedBy.');
|
|
9310
9586
|
}
|
|
9311
|
-
const { mode, title, motion = this._options.motion, closeLabel = this._options.closeLabel, origin, adaptiveWidth = this._options.adaptiveWidth, compactActions = this._options.compactActions, ...native } = config;
|
|
9587
|
+
const { mode, title, motion = this._options.motion, closeLabel = this._options.closeLabel, origin, adaptiveWidth = this._options.adaptiveWidth, compactActions = this._options.compactActions, closeButton = this._options.closeButton, ...native } = config;
|
|
9312
9588
|
if (mode === 'adaptive' && !closeLabel.trim())
|
|
9313
9589
|
throw new Error('Adaptive mode requires a non-empty closeLabel.');
|
|
9314
9590
|
if (mode === 'adaptive' &&
|
|
@@ -9322,6 +9598,8 @@ class MatExpDialog {
|
|
|
9322
9598
|
throw new Error('Adaptive mode requires a valid CSS adaptiveWidth.');
|
|
9323
9599
|
if (compactActions !== 'header' && compactActions !== 'footer')
|
|
9324
9600
|
throw new Error("compactActions must be 'header' or 'footer'.");
|
|
9601
|
+
if (closeButton !== 'visible' && closeButton !== 'hidden')
|
|
9602
|
+
throw new Error("closeButton must be 'visible' or 'hidden'.");
|
|
9325
9603
|
const effective = { ...this._nativeDefaults, ...native };
|
|
9326
9604
|
const classes = (value) => typeof value === 'string' ? [value] : (value ?? []);
|
|
9327
9605
|
const injector = Injector.create({
|
|
@@ -9329,7 +9607,16 @@ class MatExpDialog {
|
|
|
9329
9607
|
providers: [
|
|
9330
9608
|
{
|
|
9331
9609
|
provide: MAT_EXP_DIALOG_CONTEXT,
|
|
9332
|
-
useValue: {
|
|
9610
|
+
useValue: {
|
|
9611
|
+
mode,
|
|
9612
|
+
title,
|
|
9613
|
+
closeLabel,
|
|
9614
|
+
motion,
|
|
9615
|
+
adaptiveWidth,
|
|
9616
|
+
origin,
|
|
9617
|
+
compactActions,
|
|
9618
|
+
closeButton,
|
|
9619
|
+
},
|
|
9333
9620
|
},
|
|
9334
9621
|
],
|
|
9335
9622
|
});
|
|
@@ -9343,7 +9630,7 @@ class MatExpDialog {
|
|
|
9343
9630
|
motion,
|
|
9344
9631
|
closeLabel,
|
|
9345
9632
|
origin,
|
|
9346
|
-
...(mode === 'adaptive' ? { adaptiveWidth, compactActions } : {}),
|
|
9633
|
+
...(mode === 'adaptive' ? { adaptiveWidth, compactActions, closeButton } : {}),
|
|
9347
9634
|
};
|
|
9348
9635
|
this._dialog.open(component, {
|
|
9349
9636
|
...effective,
|
|
@@ -9405,8 +9692,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
|
|
|
9405
9692
|
args: [{ providedIn: 'root' }]
|
|
9406
9693
|
}] });
|
|
9407
9694
|
|
|
9408
|
-
// | MatExpButtonGroupSelectionRequired;
|
|
9409
|
-
|
|
9410
9695
|
/*
|
|
9411
9696
|
* Public API Surface of mat-exp
|
|
9412
9697
|
*/
|