@almoamendev/ngx-md3 0.3.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { ViewContainerRef, Injector, ElementRef, AfterViewInit, OnDestroy, OnInit, Renderer2,
|
|
2
|
+
import { ViewContainerRef, Injector, Signal, ElementRef, AfterViewInit, OnDestroy, OnInit, Renderer2, InputSignal, InjectionToken, Type, AfterContentInit, ComponentRef, TemplateRef } from '@angular/core';
|
|
3
3
|
import { FlexibleConnectedPositionStrategyOrigin, ConnectedPosition, OverlayRef } from '@angular/cdk/overlay';
|
|
4
|
+
import { Observable, Subject } from 'rxjs';
|
|
4
5
|
import * as i1 from '@angular/cdk/scrolling';
|
|
5
6
|
import { AbstractControl } from '@angular/forms';
|
|
6
7
|
import * as i1$1 from '@angular/router';
|
|
7
8
|
import { CdkDialogContainer, DialogRef as DialogRef$1 } from '@angular/cdk/dialog';
|
|
8
|
-
import { Observable } from 'rxjs';
|
|
9
9
|
import { CdkPortalOutlet } from '@angular/cdk/portal';
|
|
10
10
|
|
|
11
11
|
type TextSize = 'large' | 'medium' | 'small';
|
|
@@ -226,6 +226,80 @@ interface SideSheetContainer {
|
|
|
226
226
|
setHidden(value: boolean): void;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* How the sheet sits in the layout. A modal sheet floats above the page in an overlay with a
|
|
231
|
+
* scrim; a standard sheet docks into the scaffold, reserves its collapsed height and leaves the
|
|
232
|
+
* rest of the page usable.
|
|
233
|
+
*/
|
|
234
|
+
type BottomSheetType = 'standard' | 'modal';
|
|
235
|
+
/** Which of a standard sheet's two heights it is resting at. */
|
|
236
|
+
type BottomSheetState = 'collapsed' | 'expanded';
|
|
237
|
+
interface BottomSheetConfig<D = unknown> {
|
|
238
|
+
data?: D;
|
|
239
|
+
bindDataToInputs?: boolean;
|
|
240
|
+
/** @default 'modal' */
|
|
241
|
+
type?: BottomSheetType;
|
|
242
|
+
/** Shows the MD3 drag handle centered above the sheet's content. */
|
|
243
|
+
handle?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Lets the sheet be dragged, and flung. A modal sheet is dragged down to dismiss it; a
|
|
246
|
+
* standard sheet is dragged between its collapsed and expanded heights.
|
|
247
|
+
*/
|
|
248
|
+
gestures?: boolean;
|
|
249
|
+
/** Standard only. How much of the sheet shows when it is collapsed. */
|
|
250
|
+
collapsedHeight?: number | string;
|
|
251
|
+
/** Standard only. Height the sheet grows to when it is expanded. */
|
|
252
|
+
expandedHeight?: number | string;
|
|
253
|
+
/** Standard only. Which height the sheet opens at. */
|
|
254
|
+
initialState?: BottomSheetState;
|
|
255
|
+
/** Standard only. Whether dragging below the collapsed height closes the sheet. */
|
|
256
|
+
dismissible?: boolean;
|
|
257
|
+
/** Standard only. Accessible name for the region the sheet occupies. */
|
|
258
|
+
label?: string;
|
|
259
|
+
/** Standard only. Id of the element naming the sheet, when it already has a visible title. */
|
|
260
|
+
labelledBy?: string;
|
|
261
|
+
scheme?: 'inherit' | 'dark' | 'light';
|
|
262
|
+
direction?: null | 'ltr' | 'rtl';
|
|
263
|
+
viewContainerRef?: ViewContainerRef;
|
|
264
|
+
injector?: Injector;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* What BottomSheetRef needs from the surface hosting a sheet, whichever shell it was created
|
|
268
|
+
* in. The surface reports gestures rather than acting on them, because it is created before
|
|
269
|
+
* the reference exists and cannot reach it through DI.
|
|
270
|
+
*/
|
|
271
|
+
interface BottomSheetSurfaceHost {
|
|
272
|
+
readonly surfaceElement: HTMLElement | null;
|
|
273
|
+
/** Emits when a drag gesture asks for the sheet to be dismissed. */
|
|
274
|
+
readonly dismissed: Observable<void>;
|
|
275
|
+
/** Emits how far a drag has taken the sheet towards being dismissed, from 0 to 1. */
|
|
276
|
+
readonly dragProgress: Observable<number>;
|
|
277
|
+
/** Emits the height a drag settled the sheet at. Standard sheets only. */
|
|
278
|
+
readonly stateChanges: Observable<BottomSheetState>;
|
|
279
|
+
startEnterAnimation(): void;
|
|
280
|
+
setActive(value: boolean): void;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The modal shell, which is a CDK dialog container underneath and so has focus handling the
|
|
284
|
+
* standard shell deliberately does without.
|
|
285
|
+
*/
|
|
286
|
+
interface BottomSheetContainer extends BottomSheetSurfaceHost {
|
|
287
|
+
recaptureFocus(): void;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The docked shell, which owns the two heights a standard sheet moves between. Typed as an
|
|
291
|
+
* interface so BottomSheetRef can drive the shell without importing the component it lives in.
|
|
292
|
+
*/
|
|
293
|
+
interface StandardBottomSheetHost extends BottomSheetSurfaceHost {
|
|
294
|
+
readonly state: Signal<BottomSheetState>;
|
|
295
|
+
expand(): void;
|
|
296
|
+
collapse(): void;
|
|
297
|
+
toggle(): void;
|
|
298
|
+
setCollapsedHeight(value: number | string): void;
|
|
299
|
+
setExpandedHeight(value: number | string): void;
|
|
300
|
+
setDismissible(value: boolean): void;
|
|
301
|
+
}
|
|
302
|
+
|
|
229
303
|
type SnackbarPoliteness = 'polite' | 'assertive';
|
|
230
304
|
interface SnackbarConfig<D = unknown> {
|
|
231
305
|
/**
|
|
@@ -548,8 +622,10 @@ declare class LayoutService {
|
|
|
548
622
|
declare class Scaffold implements AfterViewInit, OnDestroy {
|
|
549
623
|
private startOutlet;
|
|
550
624
|
private endOutlet;
|
|
625
|
+
private bottomOutlet;
|
|
551
626
|
private panesContainer;
|
|
552
627
|
private sheets;
|
|
628
|
+
private bottomSheets;
|
|
553
629
|
private layout;
|
|
554
630
|
ngAfterViewInit(): void;
|
|
555
631
|
ngOnDestroy(): void;
|
|
@@ -1842,6 +1918,140 @@ declare class SideSheetActions {
|
|
|
1842
1918
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SideSheetActions, "md3-side-sheet-actions", never, { "showDivider": { "alias": "show-divider"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
1843
1919
|
}
|
|
1844
1920
|
|
|
1921
|
+
declare const BOTTOM_SHEET_DATA: InjectionToken<unknown>;
|
|
1922
|
+
declare const BOTTOM_SHEET_CONFIG: InjectionToken<BottomSheetConfig<unknown>>;
|
|
1923
|
+
declare const BOTTOM_SHEET_COMPONENT: InjectionToken<Type<unknown>>;
|
|
1924
|
+
/**
|
|
1925
|
+
* What both kinds of bottom sheet have in common: closing once, animating out before the shell
|
|
1926
|
+
* goes away, and reporting the result. The two shells differ in what they are hosted by — a CDK
|
|
1927
|
+
* overlay or a scaffold outlet — so each subclass owns its own exit and teardown.
|
|
1928
|
+
*
|
|
1929
|
+
* This class stays the DI token, so a component written for one kind of sheet can be opened as
|
|
1930
|
+
* the other without changing how it injects its reference.
|
|
1931
|
+
*/
|
|
1932
|
+
declare abstract class BottomSheetRef<T = unknown, R = unknown> {
|
|
1933
|
+
protected readonly closed: Subject<R | undefined>;
|
|
1934
|
+
protected closeStarted: boolean;
|
|
1935
|
+
private closeSettled;
|
|
1936
|
+
/** Surface hosting the sheet. Filled in by BottomSheetService once the shell is created. */
|
|
1937
|
+
sheetInstance?: BottomSheetSurfaceHost;
|
|
1938
|
+
/** Filled by BottomSheetService after the sheet component is attached. */
|
|
1939
|
+
componentInstance?: T;
|
|
1940
|
+
/** Whether the sheet started closing. */
|
|
1941
|
+
get isClosing(): boolean;
|
|
1942
|
+
/** Height the sheet is resting at. A modal sheet is only ever fully open. */
|
|
1943
|
+
get state(): Signal<BottomSheetState>;
|
|
1944
|
+
/** Closes the sheet. The promise resolves once the exit animation is done. */
|
|
1945
|
+
close(result?: R): Promise<void>;
|
|
1946
|
+
afterClosed(): Observable<R | undefined>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Wires the shell to this reference. Called by BottomSheetService, since the shell is
|
|
1949
|
+
* created before this reference exists and cannot reach it through DI.
|
|
1950
|
+
*/
|
|
1951
|
+
attachContainer(container: BottomSheetSurfaceHost): void;
|
|
1952
|
+
/** Moves a standard sheet to its expanded height. Modal sheets have only one height. */
|
|
1953
|
+
expand(): void;
|
|
1954
|
+
/** Moves a standard sheet back to its collapsed height. */
|
|
1955
|
+
collapse(): void;
|
|
1956
|
+
/** Switches a standard sheet between its two heights. */
|
|
1957
|
+
toggle(): void;
|
|
1958
|
+
setCollapsedHeight(height: number | string): void;
|
|
1959
|
+
setExpandedHeight(height: number | string): void;
|
|
1960
|
+
setDismissible(value: boolean): void;
|
|
1961
|
+
protected abstract startCloseAnimation(): Promise<void>;
|
|
1962
|
+
protected abstract finishClose(result?: R): void;
|
|
1963
|
+
/** Resolves when the surface finished animating, with a timeout as a safety net. */
|
|
1964
|
+
protected waitForSurfaceAnimation(fallback?: HTMLElement | null): Promise<void>;
|
|
1965
|
+
/** Emits the result once the sheet is gone. */
|
|
1966
|
+
protected settle(result?: R): void;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* A modal bottom sheet is a single overlay, not a stack like dialogs can be, so this is a
|
|
1970
|
+
* smaller version of DialogRef: no hide/show, no full screen variant, closing is always the
|
|
1971
|
+
* only way out.
|
|
1972
|
+
*/
|
|
1973
|
+
declare class ModalBottomSheetRef<T = unknown, R = unknown> extends BottomSheetRef<T, R> {
|
|
1974
|
+
private readonly cdkRef;
|
|
1975
|
+
constructor(cdkRef: DialogRef$1<R, T>);
|
|
1976
|
+
/** Overlay hosting the sheet, useful to reach the panel and the scrim. */
|
|
1977
|
+
get overlayRef(): OverlayRef;
|
|
1978
|
+
attachContainer(container: BottomSheetSurfaceHost): void;
|
|
1979
|
+
protected startCloseAnimation(): Promise<void>;
|
|
1980
|
+
protected finishClose(result?: R): void;
|
|
1981
|
+
private connectCloseEvents;
|
|
1982
|
+
/** Fades the scrim along with the sheet being dragged, and hands it back to CSS on release. */
|
|
1983
|
+
private trackDragProgress;
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* A standard bottom sheet lives in a scaffold outlet rather than an overlay, so there is no
|
|
1987
|
+
* scrim to fade and nothing to dispose but the component itself. In exchange it can be moved
|
|
1988
|
+
* between its two heights while it is open.
|
|
1989
|
+
*/
|
|
1990
|
+
declare class StandardBottomSheetRef<T = unknown, R = unknown> extends BottomSheetRef<T, R> {
|
|
1991
|
+
private readonly onClosed;
|
|
1992
|
+
private sheetComponentRef?;
|
|
1993
|
+
private host?;
|
|
1994
|
+
constructor(onClosed: () => void);
|
|
1995
|
+
get state(): Signal<BottomSheetState>;
|
|
1996
|
+
/** Called by BottomSheetService once the shell has been created in the outlet. */
|
|
1997
|
+
attachSheet(componentRef: ComponentRef<unknown>, host: StandardBottomSheetHost): void;
|
|
1998
|
+
expand(): void;
|
|
1999
|
+
collapse(): void;
|
|
2000
|
+
toggle(): void;
|
|
2001
|
+
setCollapsedHeight(height: number | string): void;
|
|
2002
|
+
setExpandedHeight(height: number | string): void;
|
|
2003
|
+
setDismissible(value: boolean): void;
|
|
2004
|
+
/**
|
|
2005
|
+
* Tears the sheet down without an exit animation, for when the outlet holding it is going
|
|
2006
|
+
* away and there is nothing left to animate in.
|
|
2007
|
+
*/
|
|
2008
|
+
dispose(result?: R): void;
|
|
2009
|
+
protected startCloseAnimation(): Promise<void>;
|
|
2010
|
+
protected finishClose(result?: R): void;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* Opens bottom sheets, in either of the two ways MD3 describes them.
|
|
2015
|
+
*
|
|
2016
|
+
* A modal sheet is a CDK dialog anchored to the bottom of the viewport, the same way a regular
|
|
2017
|
+
* dialog is always an overlay, so that path mirrors DialogService. A standard sheet is docked
|
|
2018
|
+
* into the scaffold instead, following the side sheet outlet model: it floats over the content
|
|
2019
|
+
* without a scrim, leaves the rest of the page usable, and needs an outlet to open into.
|
|
2020
|
+
*
|
|
2021
|
+
* One of each may be open at a time, and they replace only their own kind.
|
|
2022
|
+
*/
|
|
2023
|
+
declare class BottomSheetService {
|
|
2024
|
+
private readonly cdkDialog;
|
|
2025
|
+
private readonly overlay;
|
|
2026
|
+
private readonly injector;
|
|
2027
|
+
/**
|
|
2028
|
+
* Outlets registered from the page scaffold up to whatever took them over last. Standard
|
|
2029
|
+
* sheets always open in the outlet on top.
|
|
2030
|
+
*/
|
|
2031
|
+
private readonly outlets;
|
|
2032
|
+
private modalRef?;
|
|
2033
|
+
private standardRef?;
|
|
2034
|
+
/** Registers the outlet standard bottom sheets open into. Called by Scaffold. */
|
|
2035
|
+
registerBottomSheetOutlet(outlet: CdkPortalOutlet): void;
|
|
2036
|
+
unregisterBottomSheetOutlet(outlet: CdkPortalOutlet): void;
|
|
2037
|
+
open<T, D = unknown, R = unknown>(component: Type<T>, config?: BottomSheetConfig<D>): BottomSheetRef<T, R>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Closes the bottom sheet that is open. A modal sheet goes first when both kinds are up,
|
|
2040
|
+
* since it is the one covering the page.
|
|
2041
|
+
*/
|
|
2042
|
+
close<R = unknown>(result?: R): void;
|
|
2043
|
+
private openModal;
|
|
2044
|
+
private openStandard;
|
|
2045
|
+
private activeOutlet;
|
|
2046
|
+
private createInjector;
|
|
2047
|
+
private startOpenAnimation;
|
|
2048
|
+
private mergeConfig;
|
|
2049
|
+
private bindDataToInputs;
|
|
2050
|
+
private canBindDataToInputs;
|
|
2051
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BottomSheetService, never>;
|
|
2052
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<BottomSheetService>;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
1845
2055
|
declare class Snackbar implements OnInit, OnDestroy {
|
|
1846
2056
|
private readonly el;
|
|
1847
2057
|
private readonly snackbarRef;
|
|
@@ -1937,5 +2147,5 @@ declare class SnackbarService {
|
|
|
1937
2147
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SnackbarService>;
|
|
1938
2148
|
}
|
|
1939
2149
|
|
|
1940
|
-
export { AppBar, AppBarLogo, Avatar, Badge, Button, ButtonGroup, CAROUSEL_STRATEGIES, Card, Carousel, CarouselItem, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, FullScreenDialog, FullScreenDialogHeader, Grid, GridItem, IconButton, IconElement, InputElement, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StateComponent, SupportingText, Switch, TextField, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle, buildGeometry, clampIndex, indexForScrollOffset, multiBrowseStrategy, parseCarouselAspectRatio, resolveItemGeometry, resolveState, scrollOffsetForIndex, sizeBandFor };
|
|
1941
|
-
export type { AppBarScrollingStyle, AppBarType, ButtonGroupSelection, ButtonGroupType, ButtonSize, ButtonType, CardType, CarouselAlignment, CarouselArrangement, CarouselGeometry, CarouselItemGeometry, CarouselItemSize, CarouselKeyline, CarouselKeylineState, CarouselLayout, CarouselOrientation, CarouselStrategy, CarouselStrategyContext, ChipStyle, ChipType, DialogConfig, DialogContainer, DialogRole, FabSize, FabType, FullScreenDialogConfig, IconButtonType, IconButtonWidth, ListLeadingSize, ListLeadingType, Md3NavigationMode, MenuConfig, MenuPositionOrigin, MenuPositionX, MenuPositionY, MenuScrollStrategy, PreviousDialog, SideSheetConfig, SideSheetContainer, SideSheetSide, SideSheetType, SliderSize, SnackbarConfig, SnackbarDismiss, SnackbarDismissReason, SnackbarPoliteness, SplitButtonType, TextColor, TextSize };
|
|
2150
|
+
export { AppBar, AppBarLogo, Avatar, BOTTOM_SHEET_COMPONENT, BOTTOM_SHEET_CONFIG, BOTTOM_SHEET_DATA, Badge, BottomSheetRef, BottomSheetService, Button, ButtonGroup, CAROUSEL_STRATEGIES, Card, Carousel, CarouselItem, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, FullScreenDialog, FullScreenDialogHeader, Grid, GridItem, IconButton, IconElement, InputElement, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, ModalBottomSheetRef, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StandardBottomSheetRef, StateComponent, SupportingText, Switch, TextField, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle, buildGeometry, clampIndex, indexForScrollOffset, multiBrowseStrategy, parseCarouselAspectRatio, resolveItemGeometry, resolveState, scrollOffsetForIndex, sizeBandFor };
|
|
2151
|
+
export type { AppBarScrollingStyle, AppBarType, BottomSheetConfig, BottomSheetContainer, BottomSheetState, BottomSheetSurfaceHost, BottomSheetType, ButtonGroupSelection, ButtonGroupType, ButtonSize, ButtonType, CardType, CarouselAlignment, CarouselArrangement, CarouselGeometry, CarouselItemGeometry, CarouselItemSize, CarouselKeyline, CarouselKeylineState, CarouselLayout, CarouselOrientation, CarouselStrategy, CarouselStrategyContext, ChipStyle, ChipType, DialogConfig, DialogContainer, DialogRole, FabSize, FabType, FullScreenDialogConfig, IconButtonType, IconButtonWidth, ListLeadingSize, ListLeadingType, Md3NavigationMode, MenuConfig, MenuPositionOrigin, MenuPositionX, MenuPositionY, MenuScrollStrategy, PreviousDialog, SideSheetConfig, SideSheetContainer, SideSheetSide, SideSheetType, SliderSize, SnackbarConfig, SnackbarDismiss, SnackbarDismissReason, SnackbarPoliteness, SplitButtonType, StandardBottomSheetHost, TextColor, TextSize };
|