@camaradesuk/m3e-angular 0.2.0-alpha.8 → 0.2.0-alpha.9

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.
Files changed (40) hide show
  1. package/fesm2022/camaradesuk-m3e-angular.mjs +226 -42
  2. package/fesm2022/camaradesuk-m3e-angular.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/src/lib/styles/_index.scss +1 -0
  5. package/src/lib/styles/components/all-buttons/_common-selectors.scss +7 -6
  6. package/src/lib/styles/components/all-buttons/button/_index.scss +12 -0
  7. package/src/lib/styles/components/all-buttons/button/tokens/_common.scss +18 -0
  8. package/src/lib/styles/components/all-buttons/button/tokens/_l.scss +25 -0
  9. package/src/lib/styles/components/all-buttons/button/tokens/_m.scss +25 -0
  10. package/src/lib/styles/components/all-buttons/button/tokens/_s.scss +25 -0
  11. package/src/lib/styles/components/all-buttons/button/tokens/_xl.scss +25 -0
  12. package/src/lib/styles/components/all-buttons/button/tokens/_xs.scss +30 -5
  13. package/src/lib/styles/components/all-buttons/button-group/_connected-l-corners.scss +2 -78
  14. package/src/lib/styles/components/all-buttons/button-group/_connected-m-corners.scss +2 -78
  15. package/src/lib/styles/components/all-buttons/button-group/_connected-s-corners.scss +2 -80
  16. package/src/lib/styles/components/all-buttons/button-group/_connected-xl-corners.scss +2 -78
  17. package/src/lib/styles/components/all-buttons/button-group/_connected-xs-corners.scss +2 -79
  18. package/src/lib/styles/components/all-buttons/button-group/_index.scss +6 -0
  19. package/src/lib/styles/components/all-buttons/fab/_index.scss +109 -0
  20. package/src/lib/styles/components/all-buttons/icon-button/_index.scss +26 -0
  21. package/src/lib/styles/components/all-buttons/icon-button/configs/_s.scss +1 -1
  22. package/src/lib/styles/components/all-buttons/icon-button/configs/_xl.scss +2 -2
  23. package/src/lib/styles/components/all-buttons/icon-button/tokens/_l.scss +1 -1
  24. package/src/lib/styles/components/all-buttons/icon-button/tokens/_m.scss +1 -1
  25. package/src/lib/styles/components/all-buttons/icon-button/tokens/_s.scss +2 -0
  26. package/src/lib/styles/components/all-buttons/icon-button/tokens/_xl.scss +3 -0
  27. package/src/lib/styles/components/all-buttons/icon-button/tokens/_xs.scss +1 -1
  28. package/src/lib/styles/components/all-buttons/split-button/_connected-l-corners.scss +15 -57
  29. package/src/lib/styles/components/all-buttons/split-button/_connected-m-corners.scss +15 -57
  30. package/src/lib/styles/components/all-buttons/split-button/_connected-s-corners.scss +15 -58
  31. package/src/lib/styles/components/all-buttons/split-button/_connected-xl-corners.scss +15 -57
  32. package/src/lib/styles/components/all-buttons/split-button/_connected-xs-corners.scss +15 -58
  33. package/src/lib/styles/components/all-buttons/split-button/_index.scss +16 -5
  34. package/src/lib/styles/components/all-buttons/utils/_connected-corners.scss +146 -0
  35. package/src/lib/styles/components/all-buttons/utils/_elevated-icon.scss +52 -0
  36. package/src/lib/styles/utils/mixins/_button-focus.scss +24 -0
  37. package/src/lib/styles/utils/mixins/_index.scss +1 -0
  38. package/src/styles/styles.css +1929 -269
  39. package/src/styles/styles.css.map +1 -1
  40. package/types/camaradesuk-m3e-angular.d.ts +34 -7
@@ -1,16 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ElementRef, model, input, computed, Input, Directive, effect, forwardRef, output, contentChildren, ChangeDetectorRef, NgZone, afterNextRender, DestroyRef, ChangeDetectionStrategy, Component, Injectable, booleanAttribute, signal, ANIMATION_MODULE_TYPE, afterRenderEffect, viewChild, PLATFORM_ID, ViewEncapsulation, APP_ID, TemplateRef, ViewContainerRef, untracked, linkedSignal, isDevMode, afterEveryRender, Renderer2, QueryList, Injector, ViewChildren, ContentChildren, contentChild, HostAttributeToken } from '@angular/core';
2
+ import { InjectionToken, inject, signal, ElementRef, model, input, computed, Input, Directive, effect, forwardRef, booleanAttribute, output, contentChildren, ChangeDetectorRef, NgZone, afterNextRender, DestroyRef, ChangeDetectionStrategy, Component, ANIMATION_MODULE_TYPE, afterRenderEffect, 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';
6
6
  import { MatMenuTrigger, MatMenu } from '@angular/material/menu';
7
+ import { toSignal } from '@angular/core/rxjs-interop';
8
+ import { merge, map, ReplaySubject, Subject } from 'rxjs';
7
9
  import { SelectionModel } from '@angular/cdk/collections';
8
10
  import { NG_VALUE_ACCESSOR, AbstractControl } from '@angular/forms';
9
11
  import { MediaMatcher } from '@angular/cdk/layout';
10
12
  import * as i1$1 from '@angular/material/core';
11
13
  import { MATERIAL_ANIMATIONS, MatRipple } from '@angular/material/core';
12
- import { toSignal } from '@angular/core/rxjs-interop';
13
- import { merge, map, ReplaySubject, Subject } from 'rxjs';
14
14
  import { isPlatformBrowser, DOCUMENT, NgTemplateOutlet } from '@angular/common';
15
15
  import { MorphSVGPlugin } from 'gsap/MorphSVGPlugin';
16
16
  import { CustomEase } from 'gsap/CustomEase';
@@ -282,6 +282,7 @@ function computeBouncedWidths(baseWidths, pressedIndex, pressedValue, compressio
282
282
  function createButtonGroupBounce(getButtons) {
283
283
  let buttons = [];
284
284
  let baseWidths = [];
285
+ let originalWidths = new Map();
285
286
  let compressionLimits = [];
286
287
  let pressedIndex = -1;
287
288
  let released = false;
@@ -297,8 +298,13 @@ function createButtonGroupBounce(getButtons) {
297
298
  };
298
299
  const clearWidths = () => {
299
300
  for (const button of buttons) {
300
- button.style.removeProperty('width');
301
+ const original = originalWidths.get(button);
302
+ if (original)
303
+ button.style.width = original;
304
+ else
305
+ button.style.removeProperty('width');
301
306
  }
307
+ originalWidths.clear();
302
308
  };
303
309
  /**
304
310
  * Runs one spring segment from the current (value, velocity) toward
@@ -372,6 +378,7 @@ function createButtonGroupBounce(getButtons) {
372
378
  value = 0;
373
379
  velocity = 0;
374
380
  buttons = nextButtons;
381
+ originalWidths = new Map(buttons.map((element) => [element, element.style.width]));
375
382
  pressedIndex = index;
376
383
  released = false;
377
384
  returning = false;
@@ -433,6 +440,28 @@ const injectMatExpIconButtonOptions = _iconButtonOptions.inject;
433
440
  /** @internal Shared open-state contract for Expressive triggers and button styling. */
434
441
  const MAT_EXP_MENU_OPEN_STATE = new InjectionToken('MAT_EXP_MENU_OPEN_STATE');
435
442
 
443
+ /**
444
+ * Tracks an Expressive trigger on this host, or the given Material trigger through
445
+ * its `menuOpened`/`menuClosed` outputs.
446
+ *
447
+ * This is the single implementation shared by every button-family directive that renders a
448
+ * `data-menu-open` host attribute (`MatExpButton`, `MatExpIconButton`,
449
+ * `MatExpFabMenuTrigger`), replacing a plain `get isMenuOpen()` getter that happened to
450
+ * work only because Angular Material's own state changes triggered change detection.
451
+ *
452
+ * Must be called within an injection context (e.g. a field initializer or the constructor of a
453
+ * directive/component). Returns a false signal when neither trigger is attached.
454
+ */
455
+ function injectIsMenuOpenSignal(matMenuTrigger) {
456
+ const expressive = inject(MAT_EXP_MENU_OPEN_STATE, { optional: true, self: true });
457
+ if (expressive)
458
+ return expressive;
459
+ if (!matMenuTrigger) {
460
+ return signal(false);
461
+ }
462
+ return toSignal(merge(matMenuTrigger.menuOpened.pipe(map(() => true)), matMenuTrigger.menuClosed.pipe(map(() => false))), { initialValue: matMenuTrigger.menuOpen });
463
+ }
464
+
436
465
  /**
437
466
  * Directive to style the Angular Material Icon Button component with latest Material 3 Design System Expressive styles.
438
467
  */
@@ -510,9 +539,10 @@ class MatExpIconButton {
510
539
  this.buttonGroup?._onButtonClick(this);
511
540
  }
512
541
  matMenu = inject(MatMenuTrigger, { optional: true });
513
- expressiveMenu = inject(MAT_EXP_MENU_OPEN_STATE, { optional: true, self: true });
542
+ /** @internal Reactive native/Expressive menu state for composed presentation. */
543
+ _isMenuOpen = injectIsMenuOpenSignal(this.matMenu);
514
544
  get isMenuOpen() {
515
- return this.expressiveMenu?.() ?? this.matMenu?.menuOpen ?? false;
545
+ return this._isMenuOpen();
516
546
  }
517
547
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpIconButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
518
548
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.3", type: MatExpIconButton, isStandalone: true, selector: "[matExpIconButton]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: false, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", shape: "shapeChange", toggle: "toggleChange", value: "valueChange" }, host: { listeners: { "click": "_onButtonClick()" }, properties: { "attr.data-size": "size()", "attr.data-shape": "shape()", "attr.data-appearance": "appearance", "attr.data-state": "state()", "attr.data-toggle": "toggle()", "attr.data-width": "width()", "attr.data-menu-open": "isMenuOpen", "attr.aria-pressed": "ariaPressed()", "class": "matExpIconButtonClass" } }, exportAs: ["matExpIconButton"], ngImport: i0 });
@@ -625,7 +655,8 @@ function bindButtonGroupChildren(config) {
625
655
  if (disabled) {
626
656
  effect(() => {
627
657
  const value = disabled();
628
- children().forEach((child) => child.setDisabled(value ?? false));
658
+ if (value !== undefined)
659
+ children().forEach((child) => child.setDisabled(value));
629
660
  });
630
661
  }
631
662
  }
@@ -661,6 +692,8 @@ class MatExpButtonGroup {
661
692
  /** @default 'single-select' */
662
693
  selection = input(this._options.selection, /* @ts-ignore */
663
694
  ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
695
+ /** Prevents user interaction from clearing the last selected button. */
696
+ selectionRequired = input(this._options.selectionRequired ?? false, { ...(ngDevMode ? { debugName: "selectionRequired" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
664
697
  /** @default 'standard' */
665
698
  variant = input(this._options.variant, /* @ts-ignore */
666
699
  ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
@@ -760,6 +793,11 @@ class MatExpButtonGroup {
760
793
  // change detection on every pointer/tick.
761
794
  afterNextRender(() => {
762
795
  this._bounce = createButtonGroupBounce(() => this._childButtonElements());
796
+ const reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)');
797
+ reducedMotion?.addEventListener?.('change', () => {
798
+ if (reducedMotion.matches)
799
+ this._bounce?.destroy();
800
+ }, { signal: this._interactionAbort.signal });
763
801
  this._ngZone.runOutsideAngular(() => this._setupBounceInteractions());
764
802
  });
765
803
  // Snap any in-flight bounce back to rest immediately when a consumer flips
@@ -844,6 +882,32 @@ class MatExpButtonGroup {
844
882
  }
845
883
  }, { signal });
846
884
  }
885
+ /** Arrow navigation preserves native Tab order and uses manual activation. @internal */
886
+ _onGroupKeydown(event) {
887
+ if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || this.disabled())
888
+ return;
889
+ const keys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'];
890
+ if (!keys.includes(event.key))
891
+ return;
892
+ const target = event.target;
893
+ if (!(target instanceof Element) ||
894
+ target.closest('mat-exp-button-group') !== this._hostElement)
895
+ return;
896
+ const controls = this._childButtonElements().filter((element) => !element.disabled &&
897
+ element.getAttribute('aria-disabled') !== 'true');
898
+ const current = controls.findIndex((element) => element === target || element.contains(target));
899
+ if (current < 0 || !controls.length)
900
+ return;
901
+ const rtl = getComputedStyle(this._hostElement).direction === 'rtl';
902
+ const backwards = event.key === 'ArrowUp' || event.key === (rtl ? 'ArrowRight' : 'ArrowLeft');
903
+ const next = event.key === 'Home'
904
+ ? 0
905
+ : event.key === 'End'
906
+ ? controls.length - 1
907
+ : (current + (backwards ? -1 : 1) + controls.length) % controls.length;
908
+ event.preventDefault();
909
+ controls[next].focus();
910
+ }
847
911
  // ---- ControlValueAccessor ----
848
912
  writeValue(value) {
849
913
  this._setValueAndSync(value);
@@ -855,6 +919,10 @@ class MatExpButtonGroup {
855
919
  this._onTouched = fn;
856
920
  }
857
921
  setDisabledState(isDisabled) {
922
+ // Forms initializes enabled controls with false. Preserve an omitted group
923
+ // override so that initialization does not enable individually disabled children.
924
+ if (!isDisabled && this.disabled() === undefined)
925
+ return;
858
926
  this.disabled.set(isDisabled);
859
927
  }
860
928
  // ---- Button click handler (called by child buttons) ----
@@ -864,8 +932,14 @@ class MatExpButtonGroup {
864
932
  * @internal
865
933
  */
866
934
  _onButtonClick(button) {
935
+ if (this.disabled() || ('disabled' in button && button.disabled))
936
+ return;
867
937
  const isSelected = this._selectionModel.isSelected(button);
868
938
  if (isSelected) {
939
+ if (this.selectionRequired() && this._selectionModel.selected.length === 1) {
940
+ this._onTouched();
941
+ return;
942
+ }
869
943
  this._selectionModel.deselect(button);
870
944
  }
871
945
  else {
@@ -923,7 +997,7 @@ class MatExpButtonGroup {
923
997
  }
924
998
  }
925
999
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpButtonGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
926
- 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 }, 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: { attributes: { "role": "group" }, properties: { "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: [
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: { attributes: { "role": "group" }, listeners: { "keydown": "_onGroupKeydown($event)" }, properties: { "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: [
927
1001
  MAT_EXP_BUTTON_GROUP_VALUE_ACCESSOR,
928
1002
  { provide: MAT_EXP_BUTTON_GROUP, useExisting: MatExpButtonGroup },
929
1003
  ], 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 });
@@ -943,8 +1017,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
943
1017
  '[attr.data-appearance]': 'appearance()',
944
1018
  '[attr.data-disabled]': 'disabled()',
945
1019
  '[attr.aria-disabled]': 'disabled()',
1020
+ '(keydown)': '_onGroupKeydown($event)',
946
1021
  }, template: "<ng-content></ng-content>\n" }]
947
- }], 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 }] }], 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: [{
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: [{
948
1023
  type: Input
949
1024
  }], _matExpButtons: [{ type: i0.ContentChildren, args: [forwardRef(() => MatExpButton), { isSignal: true }] }], _matExpIconButtons: [{ type: i0.ContentChildren, args: [forwardRef(() => MatExpIconButton), { isSignal: true }] }] } });
950
1025
 
@@ -962,6 +1037,9 @@ class MatExpButton {
962
1037
  /** @default 's' */
963
1038
  size = model(this._options.size, /* @ts-ignore */
964
1039
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
1040
+ /** FAB color role pair. Applies only on a Material FAB host. */
1041
+ fabColor = input(this._options.fabColor ?? 'primary-container', /* @ts-ignore */
1042
+ ...(ngDevMode ? [{ debugName: "fabColor" }] : /* istanbul ignore next */ []));
965
1043
  /** @default 'round' */
966
1044
  shape = model(this._options.shape, /* @ts-ignore */
967
1045
  ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
@@ -998,25 +1076,36 @@ class MatExpButton {
998
1076
  /**
999
1077
  * @internal
1000
1078
  */
1001
- matExpButtonClass = 'mat-exp-button';
1079
+ get matExpButtonClass() {
1080
+ return this.isFab ? 'mat-exp-fab' : 'mat-exp-button';
1081
+ }
1082
+ /** Whether this directive decorates a native Material FAB. */
1083
+ isFab;
1002
1084
  /**
1003
1085
  * @internal
1004
1086
  */
1005
1087
  state = input(this._options.state, /* @ts-ignore */
1006
1088
  ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
1089
+ /** Regular-button appearance. FAB presentation is controlled by fabColor. */
1007
1090
  get appearance() {
1008
- return this.matButton.appearance;
1091
+ return this.matButton?.appearance ?? 'text';
1009
1092
  }
1010
1093
  set appearance(appearance) {
1011
- this.matButton.appearance = appearance;
1094
+ if (this.matButton)
1095
+ this.matButton.appearance = appearance;
1012
1096
  }
1013
1097
  get disabled() {
1014
- return this.matButton.disabled;
1098
+ return this.materialHost.disabled;
1015
1099
  }
1016
1100
  set disabled(disabled) {
1017
- this.matButton.disabled = disabled;
1101
+ this.materialHost.disabled = disabled;
1102
+ }
1103
+ matButton = inject(MatButton, { optional: true, self: true });
1104
+ matFab = inject(MatFabButton, { optional: true, self: true });
1105
+ materialHost = this.matButton ?? this.matFab ?? inject(MatButton);
1106
+ constructor() {
1107
+ this.isFab = this.matFab !== null;
1018
1108
  }
1019
- matButton = inject(MatButton);
1020
1109
  buttonGroup = inject(MatExpButtonGroup, { optional: true });
1021
1110
  _onButtonClick() {
1022
1111
  this.buttonGroup?._onButtonClick(this);
@@ -1027,7 +1116,7 @@ class MatExpButton {
1027
1116
  return this.expressiveMenu?.() ?? this.matMenu?.menuOpen ?? false;
1028
1117
  }
1029
1118
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1030
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.3", type: MatExpButton, isStandalone: true, selector: "[matExpButton]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", shape: "shapeChange", toggle: "toggleChange", value: "valueChange" }, host: { listeners: { "click": "_onButtonClick()" }, properties: { "attr.data-size": "size()", "attr.data-shape": "shape()", "attr.data-state": "state()", "attr.data-toggle": "toggle()", "attr.data-menu-open": "isMenuOpen", "attr.aria-pressed": "ariaPressed()", "class": "matExpButtonClass" } }, exportAs: ["matExpButton"], ngImport: i0 });
1119
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.3", type: MatExpButton, isStandalone: true, selector: "[matExpButton]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fabColor: { classPropertyName: "fabColor", publicName: "fabColor", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", shape: "shapeChange", toggle: "toggleChange", value: "valueChange" }, host: { listeners: { "click": "_onButtonClick()" }, properties: { "attr.data-size": "size()", "attr.data-shape": "shape()", "attr.data-state": "state()", "attr.data-toggle": "toggle()", "attr.data-menu-open": "isMenuOpen", "attr.aria-pressed": "ariaPressed()", "class": "matExpButtonClass", "attr.data-fab-color": "isFab ? fabColor() : null" } }, exportAs: ["matExpButton"], ngImport: i0 });
1031
1120
  }
1032
1121
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpButton, decorators: [{
1033
1122
  type: Directive,
@@ -1041,11 +1130,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
1041
1130
  '[attr.data-menu-open]': 'isMenuOpen',
1042
1131
  '[attr.aria-pressed]': 'ariaPressed()',
1043
1132
  '[class]': 'matExpButtonClass',
1133
+ '[attr.data-fab-color]': 'isFab ? fabColor() : null',
1044
1134
  '(click)': '_onButtonClick()',
1045
1135
  },
1046
1136
  exportAs: 'matExpButton',
1047
1137
  }]
1048
- }], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }, { type: i0.Output, args: ["shapeChange"] }], toggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggle", required: false }] }, { type: i0.Output, args: ["toggleChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }] } });
1138
+ }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], fabColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "fabColor", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }, { type: i0.Output, args: ["shapeChange"] }], toggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggle", required: false }] }, { type: i0.Output, args: ["toggleChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }] } });
1139
+
1140
+ // StandardMotionTokens v0_14_0, DefaultSpatial. Split-button guidelines explicitly
1141
+ // choose the standard scheme for the inward 180-degree menu-chevron rotation.
1142
+ const STANDARD_SPATIAL = { dampingRatio: 0.9, stiffness: 700 };
1143
+ const PROPERTY = '--_mat-exp-split-icon-rotation';
1144
+ const PROGRESS = '--_mat-exp-split-icon-progress';
1145
+ /** @internal Native menu state owns the target; this controller owns only presentation. */
1146
+ function createSplitIconMotion(element, open, media) {
1147
+ let target = open ? 180 : 0;
1148
+ let state = { value: target, velocity: 0 };
1149
+ let from = state;
1150
+ let started = 0;
1151
+ let active = false;
1152
+ let rotationEnabled = true;
1153
+ const saved = [PROPERTY, PROGRESS].map((name) => [
1154
+ name,
1155
+ element.style.getPropertyValue(name),
1156
+ element.style.getPropertyPriority(name),
1157
+ ]);
1158
+ const write = () => {
1159
+ element.style.setProperty(PROPERTY, String(rotationEnabled ? state.value : 0));
1160
+ element.style.setProperty(PROGRESS, String(state.value / 180));
1161
+ };
1162
+ const sample = () => {
1163
+ state = sampleDampedSpring(from.value, target, from.velocity, Math.max(0, gsap.ticker.time - started), STANDARD_SPATIAL);
1164
+ };
1165
+ const stop = () => {
1166
+ gsap.ticker.remove(tick);
1167
+ active = false;
1168
+ };
1169
+ const settle = () => {
1170
+ stop();
1171
+ state = { value: target, velocity: 0 };
1172
+ write();
1173
+ };
1174
+ const tick = () => {
1175
+ sample();
1176
+ write();
1177
+ if (Math.abs(state.value - target) < 0.0001 && Math.abs(state.velocity) < 0.001)
1178
+ settle();
1179
+ };
1180
+ const preferenceChanged = () => {
1181
+ if (media.matches)
1182
+ settle();
1183
+ };
1184
+ if (media.addEventListener)
1185
+ media.addEventListener('change', preferenceChanged);
1186
+ else
1187
+ media.addListener(preferenceChanged);
1188
+ write();
1189
+ return {
1190
+ update(open, animate, rotate = true) {
1191
+ if (active)
1192
+ sample();
1193
+ rotationEnabled = rotate;
1194
+ const next = open ? 180 : 0, changed = next !== target;
1195
+ target = next;
1196
+ if (media.matches || !animate) {
1197
+ settle();
1198
+ return;
1199
+ }
1200
+ if (!changed) {
1201
+ write();
1202
+ return;
1203
+ }
1204
+ from = state;
1205
+ if (!active)
1206
+ gsap.ticker.wake();
1207
+ started = gsap.ticker.time;
1208
+ if (!active) {
1209
+ active = true;
1210
+ gsap.ticker.add(tick);
1211
+ }
1212
+ },
1213
+ destroy() {
1214
+ stop();
1215
+ if (media.removeEventListener)
1216
+ media.removeEventListener('change', preferenceChanged);
1217
+ else
1218
+ media.removeListener(preferenceChanged);
1219
+ for (const [name, value, priority] of saved) {
1220
+ if (value)
1221
+ element.style.setProperty(name, value, priority);
1222
+ else
1223
+ element.style.removeProperty(name);
1224
+ }
1225
+ },
1226
+ };
1227
+ }
1049
1228
 
1050
1229
  /**
1051
1230
  * @internal
@@ -1070,6 +1249,13 @@ class MatExpSplitButton {
1070
1249
  /** @default 'tonal' */
1071
1250
  appearance = model(this._options.appearance, /* @ts-ignore */
1072
1251
  ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
1252
+ /** Rotate the menu chevron inward; opt out when application content owns its rotation. */
1253
+ rotateIcon = input(this._options.rotateIcon ?? true, { ...(ngDevMode ? { debugName: "rotateIcon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1254
+ _media = inject(MediaMatcher);
1255
+ _disabledMotion = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations' ||
1256
+ !!inject(MATERIAL_ANIMATIONS, { optional: true })?.animationsDisabled;
1257
+ _motion;
1258
+ _motionElement;
1073
1259
  /**
1074
1260
  * @internal
1075
1261
  */
@@ -1091,6 +1277,20 @@ class MatExpSplitButton {
1091
1277
  _allButtonGroupChildren = computed(() => this._allExpressiveButtons().map(toButtonGroupChild), /* @ts-ignore */
1092
1278
  ...(ngDevMode ? [{ debugName: "_allButtonGroupChildren" }] : /* istanbul ignore next */ []));
1093
1279
  constructor() {
1280
+ afterRenderEffect(() => {
1281
+ const icon = this._matExpIconButtons().at(-1);
1282
+ if (icon?._hostElement !== this._motionElement) {
1283
+ this._motion?.destroy();
1284
+ this._motion = undefined;
1285
+ this._motionElement = icon?._hostElement;
1286
+ }
1287
+ if (!icon)
1288
+ return;
1289
+ const open = icon._isMenuOpen();
1290
+ this._motion ??= createSplitIconMotion(icon._hostElement, open, this._media.matchMedia('(prefers-reduced-motion: reduce)'));
1291
+ this._motion.update(open, !this._disabledMotion, this.rotateIcon());
1292
+ });
1293
+ inject(DestroyRef).onDestroy(() => this._motion?.destroy());
1094
1294
  // Broadcast `size`/`appearance` down to the projected buttons via the narrow
1095
1295
  // `ButtonGroupChild` contract (shared with `MatExpButtonGroup`).
1096
1296
  bindButtonGroupChildren({
@@ -1100,7 +1300,7 @@ class MatExpSplitButton {
1100
1300
  });
1101
1301
  }
1102
1302
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpSplitButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
1103
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.3", type: MatExpSplitButton, isStandalone: true, selector: "mat-exp-split-button", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", appearance: "appearanceChange" }, host: { properties: { "attr.data-size": "size()", "attr.data-appearance": "appearance()", "class": "matExpSplitButtonClass" } }, queries: [{ propertyName: "_matExpButtons", predicate: MatExpButton, isSignal: true }, { propertyName: "_matExpIconButtons", predicate: MatExpIconButton, isSignal: true }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1303
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.2.3", type: MatExpSplitButton, isStandalone: true, selector: "mat-exp-split-button", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, rotateIcon: { classPropertyName: "rotateIcon", publicName: "rotateIcon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", appearance: "appearanceChange" }, host: { properties: { "attr.data-size": "size()", "attr.data-appearance": "appearance()", "class": "matExpSplitButtonClass" } }, queries: [{ propertyName: "_matExpButtons", predicate: MatExpButton, isSignal: true }, { propertyName: "_matExpIconButtons", predicate: MatExpIconButton, isSignal: true }], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1104
1304
  }
1105
1305
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: MatExpSplitButton, decorators: [{
1106
1306
  type: Component,
@@ -1114,7 +1314,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
1114
1314
  template: '<ng-content></ng-content>',
1115
1315
  changeDetection: ChangeDetectionStrategy.OnPush,
1116
1316
  }]
1117
- }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }, { type: i0.Output, args: ["appearanceChange"] }], _matExpButtons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatExpButton), { isSignal: true }] }], _matExpIconButtons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatExpIconButton), { isSignal: true }] }] } });
1317
+ }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }, { type: i0.Output, args: ["appearanceChange"] }], rotateIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "rotateIcon", required: false }] }], _matExpButtons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatExpButton), { isSignal: true }] }], _matExpIconButtons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatExpIconButton), { isSignal: true }] }] } });
1118
1318
 
1119
1319
  /** @internal Associates native menu instances with their expressive configuration. */
1120
1320
  class FabMenuRegistry {
@@ -1168,28 +1368,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
1168
1368
  args: [{ selector: 'mat-menu[matExpFabMenu]', exportAs: 'matExpFabMenu' }]
1169
1369
  }], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], motion: [{ type: i0.Input, args: [{ isSignal: true, alias: "motion", required: false }] }] } });
1170
1370
 
1171
- /**
1172
- * Tracks an Expressive trigger on this host, or the given Material trigger through
1173
- * its `menuOpened`/`menuClosed` outputs.
1174
- *
1175
- * This is the single implementation shared by every button-family directive that renders a
1176
- * `data-menu-open` host attribute (`MatExpButton`, `MatExpIconButton`,
1177
- * `MatExpFabMenuTrigger`), replacing a plain `get isMenuOpen()` getter that happened to
1178
- * work only because Angular Material's own state changes triggered change detection.
1179
- *
1180
- * Must be called within an injection context (e.g. a field initializer or the constructor of a
1181
- * directive/component). Returns a false signal when neither trigger is attached.
1182
- */
1183
- function injectIsMenuOpenSignal(matMenuTrigger) {
1184
- const expressive = inject(MAT_EXP_MENU_OPEN_STATE, { optional: true, self: true });
1185
- if (expressive)
1186
- return expressive;
1187
- if (!matMenuTrigger) {
1188
- return signal(false);
1189
- }
1190
- return toSignal(merge(matMenuTrigger.menuOpened.pipe(map(() => true)), matMenuTrigger.menuClosed.pipe(map(() => false))), { initialValue: matMenuTrigger.menuOpen });
1191
- }
1192
-
1193
1371
  /** @internal Browser-only controller. GSAP supplies the clock, springs preserve velocity. */
1194
1372
  function createFabTriggerMotion(element, open, media) {
1195
1373
  let target = Number(open);
@@ -6293,11 +6471,17 @@ function createMenuMotion(panel, media) {
6293
6471
  springs.clear();
6294
6472
  media.removeEventListener('change', preferenceChanged);
6295
6473
  for (const [element, styles] of saved) {
6296
- gsap.set(element, { clearProps: [...styles.keys()].join(',') });
6297
6474
  for (const [property, [value, priority]] of styles) {
6298
6475
  if (value)
6299
6476
  element.style.setProperty(property, value, priority);
6477
+ else
6478
+ element.style.removeProperty(property);
6300
6479
  }
6480
+ // CSSPlugin clearProps reparses transforms immediately, temporarily attaching
6481
+ // detached rows and forcing layout for each one. Invalidate the same cache
6482
+ // lazily so the next GSAP consumer reads the restored styles instead.
6483
+ if (element._gsap)
6484
+ element._gsap['uncache'] = 1;
6301
6485
  }
6302
6486
  saved.clear();
6303
6487
  },