mn-angular-lib 1.0.158 → 1.0.160

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.158",
3
+ "version": "1.0.160",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3",
@@ -13,6 +13,11 @@
13
13
  so this is a no-op outside the native shell. */
14
14
  padding-bottom: env(safe-area-inset-bottom);
15
15
 
16
+ /* Scrolling the sheet's own content to either end must not hand the remaining delta
17
+ to whatever is behind it. The component's guard blocks gestures that start outside
18
+ the sheet; this stops the ones that start inside it from chaining out. */
19
+ overscroll-behavior: contain;
20
+
16
21
  /* Defined resting floor so the keyboard-grow (min-height -> max) animates from a set
17
22
  value instead of jumping from `auto`. A consumer-supplied `minHeightPx` (inline
18
23
  style) overrides this without disturbing the transition. */
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Provider, TemplateRef, OnInit, EventEmitter, OnChanges, ElementRef, PipeTransform, OnDestroy, DoCheck, ChangeDetectorRef, Type, ComponentRef, AfterViewInit, QueryList, ViewContainerRef, SimpleChanges, Signal } from '@angular/core';
2
+ import { InjectionToken, Provider, TemplateRef, OnInit, EventEmitter, OnChanges, ElementRef, OnDestroy, PipeTransform, DoCheck, ChangeDetectorRef, Type, ComponentRef, AfterViewInit, QueryList, ViewContainerRef, SimpleChanges, Signal } from '@angular/core';
3
3
  export { TemplateRef, Type } from '@angular/core';
4
4
  import * as tailwind_variants from 'tailwind-variants';
5
5
  import { VariantProps } from 'tailwind-variants';
@@ -2886,8 +2886,8 @@ declare class MnMultiSelect implements OnInit {
2886
2886
  * card) used to leave the portalled panel floating at its stale coordinates.
2887
2887
  */
2888
2888
  private scrollCapture;
2889
- /** The bottom-sheet host currently moved into `document.body`, if any. */
2890
- private movedSheet;
2889
+ /** The bottom-sheet host, for outside-click tests. The sheet owns its own placement. */
2890
+ private sheetHost;
2891
2891
  /**
2892
2892
  * The dropdown panel element, queried while it is rendered by the `@if` block.
2893
2893
  * The setter relocates the panel to `document.body` so that its `position: fixed`
@@ -2918,10 +2918,9 @@ declare class MnMultiSelect implements OnInit {
2918
2918
  private readonly builtInErrorMessages;
2919
2919
  constructor();
2920
2920
  /**
2921
- * The bottom-sheet host, read as an `ElementRef` so it can be relocated to
2922
- * `document.body` its `position: fixed` children (backdrop + container) must anchor
2923
- * to the viewport, not to any transformed/filtered ancestor of this component. On open
2924
- * its container height is captured as the sheet's `min-height` floor.
2921
+ * The bottom-sheet host, kept as a reference for outside-click tests. The sheet
2922
+ * relocates itself to `document.body`, so nothing is moved here. On open its
2923
+ * container height is captured as the sheet's `min-height` floor.
2925
2924
  */
2926
2925
  set sheetRef(ref: ElementRef<HTMLElement> | undefined);
2927
2926
  /**
@@ -3165,6 +3164,15 @@ type MnDropdownAction = {
3165
3164
  run: () => void;
3166
3165
  /** When true the item is shown dimmed and cannot be chosen. */
3167
3166
  disabled?: boolean;
3167
+ /**
3168
+ * Marks this item as the current choice — e.g. the active language in a language
3169
+ * picker. Display-only: the item still {@link run}s and closes on choice like any
3170
+ * other, but it renders highlighted with a trailing check so the user can see which
3171
+ * one is selected without reading. The caller owns the flag (there is no single
3172
+ * source of truth inside this command menu, which holds no value); typically at most
3173
+ * one action carries it, though the component does not enforce that.
3174
+ */
3175
+ active?: boolean;
3168
3176
  /**
3169
3177
  * Tints the item's label and icon. When omitted the item uses the default foreground
3170
3178
  * ({@link danger} still forces the destructive red). Lets a host carry a per-item
@@ -3311,6 +3319,8 @@ declare const MN_DROPDOWN_CONFIG: InjectionToken<MnDropdownUIConfig>;
3311
3319
  declare class MnDropdown implements OnInit {
3312
3320
  datasource: MnDropdownProps;
3313
3321
  protected uiConfig: MnDropdownUIConfig;
3322
+ /** Lucide data for the trailing check shown on the {@link MnDropdownAction.active} row. */
3323
+ protected readonly checkIcon: LucideIconData;
3314
3324
  private readonly configService;
3315
3325
  private readonly sectionPath;
3316
3326
  private readonly explicitInstanceId;
@@ -3336,8 +3346,8 @@ declare class MnDropdown implements OnInit {
3336
3346
  private static readonly SHEET_MAX_WIDTH;
3337
3347
  /** The anchored popover panel currently moved into `document.body`, if any. */
3338
3348
  private movedPanel;
3339
- /** The bottom-sheet host currently moved into `document.body`, if any. */
3340
- private movedSheet;
3349
+ /** The bottom-sheet host, for outside-click tests. The sheet owns its own placement. */
3350
+ private sheetHost;
3341
3351
  /** Whether the viewport is currently narrow enough for the sheet layout. */
3342
3352
  private isNarrowViewport;
3343
3353
  /** Live breakpoint match, so rotating the device re-evaluates the layout. */
@@ -3525,12 +3535,19 @@ declare class MnDropdown implements OnInit {
3525
3535
  * dismissal is reported through {@link dismiss} for the host to act on (run a close
3526
3536
  * guard, tear down its overlay, …) rather than being handled here.
3527
3537
  *
3528
- * Positioning is `position: fixed` against the viewport, so a consumer whose sheet
3529
- * lives inside a `transform`/`filter` ancestor (which would otherwise become the
3530
- * containing block) must relocate this host to `document.body` as the
3531
- * multi-select does with its portal helper.
3538
+ * Positioning is `position: fixed` against the viewport, so the host relocates itself
3539
+ * to `document.body` on init and blocks scrolling behind it while open. Both are
3540
+ * unconditional: rendering viewport-fixed chrome in place made correctness depend on
3541
+ * where a consumer happened to write the tag. A `transform`/`filter`/`contain`
3542
+ * ancestor becomes the containing block and pushes the sheet to the middle of the
3543
+ * screen — which a *stacked* modal did to its own sheet — and, because `position:
3544
+ * fixed` moves where an element paints but not where it sits in the DOM, a gesture on
3545
+ * the backdrop still scrolled whichever ancestor was the scroll container.
3546
+ *
3547
+ * The multi-select and dropdown used to do the relocating themselves; that is why the
3548
+ * behaviour reads as new here but is not new to them.
3532
3549
  */
3533
- declare class MnBottomSheet {
3550
+ declare class MnBottomSheet implements OnInit, OnDestroy {
3534
3551
  /** Tailwind's `sm` breakpoint — at or below this the swipe gesture is armed.
3535
3552
  * Kept in step with the same constant in the modal shell and multi-select. */
3536
3553
  private static readonly SHEET_MAX_WIDTH;
@@ -3600,6 +3617,39 @@ declare class MnBottomSheet {
3600
3617
  /** In-flight exit animation, so a swipe-dismiss and a follow-up programmatic
3601
3618
  * {@link startClosing} share one glide instead of re-triggering it. */
3602
3619
  private exitPromise;
3620
+ /** The host node once moved to `document.body`, so it is only detached if we moved it. */
3621
+ private portalledHost;
3622
+ /** Blocks scroll gestures aimed at anything behind the sheet, while it is open. */
3623
+ private scrollGuard;
3624
+ /** Moves the host out to `document.body` and stops the page behind scrolling. */
3625
+ ngOnInit(): void;
3626
+ /**
3627
+ * Stops pointer scrolling behind the sheet for as long as it is open.
3628
+ *
3629
+ * Cancels the gesture rather than setting `overflow: hidden` on `document.body`: an
3630
+ * app whose scroll container is a layout element (a `<main>`, a drawer body) leaves
3631
+ * `body` unscrollable, so locking it there is a no-op and the page still slides about
3632
+ * under the sheet. Cancelling `wheel` and `touchmove` before anything acts on them
3633
+ * holds regardless of which element does the scrolling.
3634
+ *
3635
+ * Gestures that begin inside the sheet are let through so its own content still
3636
+ * scrolls; `overscroll-behavior: contain` keeps those from chaining out at the ends.
3637
+ *
3638
+ * Pointer input only. Page Down and the arrows still reach the page behind when focus
3639
+ * is left there — closing that needs either a key filter or moving focus into the
3640
+ * sheet, and neither belongs in this change.
3641
+ */
3642
+ private lockScroll;
3643
+ /** Releases the scroll guard. Idempotent. */
3644
+ private unlockScroll;
3645
+ /**
3646
+ * Detaches the relocated host.
3647
+ *
3648
+ * Angular tears a view down by removing the nodes it created from their parent; a
3649
+ * host we moved to `body` is no longer among the parent's children, so without
3650
+ * this the sheet would outlive the view that declared it.
3651
+ */
3652
+ ngOnDestroy(): void;
3603
3653
  get hostClasses(): string;
3604
3654
  /** Whether the viewport is currently narrow enough for the sheet to accept a swipe. */
3605
3655
  private get isNarrow();
@@ -4810,7 +4860,7 @@ type MnTableRowAction<T> = {
4810
4860
  /** Predicate deciding whether the action is disabled (shown but non-interactive) for a row. */
4811
4861
  disabled?: (row: T) => boolean;
4812
4862
  /**
4813
- * Tints the action's button and its ⋯-menu item. Defaults to `'secondary'` (or
4863
+ * Tints the action's button and its ⋯-menu item. Defaults to `'primary'` (or
4814
4864
  * `'danger'` when {@link danger} is set), matching the built-in look. Whatever colour
4815
4865
  * an action shows inline is carried into the collapsed bottom-sheet item too.
4816
4866
  */
@@ -5227,7 +5277,7 @@ declare class MnTable<T = object> extends MnSelectableCollectionBase<T, TableDat
5227
5277
  /**
5228
5278
  * The effective colour for an action, used identically by the inline button and the
5229
5279
  * collapsed ⋯-menu item so the two never diverge: an explicit `color`, else `'danger'`
5230
- * for a destructive action, else the default `'secondary'`.
5280
+ * for a destructive action, else the default `'primary'`.
5231
5281
  */
5232
5282
  rowActionColor(action: MnTableRowAction<T>, row: T): MnDropdownActionColor;
5233
5283
  /** Invokes an action for a row. */