@villedemontreal/angular-ui 2.2.0 → 3.1.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.
Files changed (62) hide show
  1. package/esm2020/lib/alert/alert.component.mjs +7 -9
  2. package/esm2020/lib/avatar/avatar.component.mjs +102 -0
  3. package/esm2020/lib/avatar/index.mjs +8 -0
  4. package/esm2020/lib/avatar/module.mjs +24 -0
  5. package/esm2020/lib/bao.module.mjs +16 -4
  6. package/esm2020/lib/breadcrumb/breadcrumb.component.mjs +5 -5
  7. package/esm2020/lib/button/button.component.mjs +3 -3
  8. package/esm2020/lib/checkbox/checkbox-group.component.mjs +5 -6
  9. package/esm2020/lib/checkbox/checkbox.component.mjs +38 -39
  10. package/esm2020/lib/core/colors.mjs +10 -27
  11. package/esm2020/lib/icon/icon.component.mjs +29 -33
  12. package/esm2020/lib/icon/icons-dictionary.mjs +3 -2
  13. package/esm2020/lib/modal/index.mjs +12 -0
  14. package/esm2020/lib/modal/modal-animations.mjs +29 -0
  15. package/esm2020/lib/modal/modal-config.mjs +65 -0
  16. package/esm2020/lib/modal/modal-container.mjs +254 -0
  17. package/esm2020/lib/modal/modal-directives.mjs +84 -0
  18. package/esm2020/lib/modal/modal-ref.mjs +195 -0
  19. package/esm2020/lib/modal/modal.mjs +291 -0
  20. package/esm2020/lib/modal/module.mjs +46 -0
  21. package/esm2020/lib/radio/radio-group.component.mjs +40 -41
  22. package/esm2020/lib/radio/radio.component.mjs +38 -39
  23. package/esm2020/lib/shared/enum/display-mode.mjs +2 -11
  24. package/esm2020/lib/summary/summary.component.mjs +5 -7
  25. package/esm2020/lib/tabs/index.mjs +8 -0
  26. package/esm2020/lib/tabs/module.mjs +35 -0
  27. package/esm2020/lib/tabs/tabs.component.mjs +295 -0
  28. package/esm2020/lib/tag/tag.component.mjs +3 -3
  29. package/esm2020/public-api.mjs +5 -1
  30. package/fesm2015/villedemontreal-angular-ui.mjs +1607 -230
  31. package/fesm2015/villedemontreal-angular-ui.mjs.map +1 -1
  32. package/fesm2020/villedemontreal-angular-ui.mjs +1597 -228
  33. package/fesm2020/villedemontreal-angular-ui.mjs.map +1 -1
  34. package/lib/alert/alert.component.d.ts +2 -3
  35. package/lib/avatar/avatar.component.d.ts +26 -0
  36. package/lib/avatar/index.d.ts +2 -0
  37. package/lib/avatar/module.d.ts +8 -0
  38. package/lib/bao.module.d.ts +4 -1
  39. package/lib/breadcrumb/breadcrumb.component.d.ts +1 -1
  40. package/lib/button/button.component.d.ts +1 -1
  41. package/lib/checkbox/checkbox-group.component.d.ts +2 -2
  42. package/lib/checkbox/checkbox.component.d.ts +27 -27
  43. package/lib/core/colors.d.ts +1 -1
  44. package/lib/icon/icon.component.d.ts +11 -11
  45. package/lib/modal/index.d.ts +6 -0
  46. package/lib/modal/modal-animations.d.ts +8 -0
  47. package/lib/modal/modal-config.d.ts +105 -0
  48. package/lib/modal/modal-container.d.ts +106 -0
  49. package/lib/modal/modal-directives.d.ts +25 -0
  50. package/lib/modal/modal-ref.d.ts +91 -0
  51. package/lib/modal/modal.d.ts +91 -0
  52. package/lib/modal/module.d.ts +12 -0
  53. package/lib/radio/radio-group.component.d.ts +19 -19
  54. package/lib/radio/radio.component.d.ts +27 -27
  55. package/lib/shared/enum/display-mode.d.ts +1 -1
  56. package/lib/summary/summary.component.d.ts +5 -5
  57. package/lib/tabs/index.d.ts +2 -0
  58. package/lib/tabs/module.d.ts +8 -0
  59. package/lib/tabs/tabs.component.d.ts +95 -0
  60. package/lib/tag/tag.component.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/public-api.d.ts +4 -0
@@ -62,9 +62,8 @@ export declare class BaoAlertComponent implements OnChanges {
62
62
  /**
63
63
  * Alert type
64
64
  */
65
- type: '' | 'success' | 'danger' | 'warning' | 'info';
65
+ type: 'success' | 'danger' | 'warning' | 'emergency' | 'info';
66
66
  dismissible: boolean;
67
- showIcon: boolean;
68
67
  dismiss: EventEmitter<any>;
69
68
  iconType: string;
70
69
  iconTitle: string;
@@ -73,5 +72,5 @@ export declare class BaoAlertComponent implements OnChanges {
73
72
  alertTitleIcon(value: string): any;
74
73
  onDismissClicked(): void;
75
74
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoAlertComponent, never>;
76
- static ɵcmp: i0.ɵɵComponentDeclaration<BaoAlertComponent, "bao-alert", never, { "type": "type"; "dismissible": "dismissible"; "showIcon": "showIcon"; }, { "dismiss": "dismiss"; }, never, ["*"]>;
75
+ static ɵcmp: i0.ɵɵComponentDeclaration<BaoAlertComponent, "bao-alert", never, { "type": "type"; "dismissible": "dismissible"; }, { "dismiss": "dismiss"; }, never, ["*"]>;
77
76
  }
@@ -0,0 +1,26 @@
1
+ import { AfterViewInit, ElementRef, Renderer2 } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class BaoAvatarContent {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoAvatarContent, never>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaoAvatarContent, "bao-avatar-content, [bao-avatar-content]", ["baoAvatarContent"], {}, {}, never>;
6
+ }
7
+ export declare class BaoAvatarComponent implements AfterViewInit {
8
+ private renderer;
9
+ private elementRef;
10
+ /**
11
+ * Name of the profile to be used as title of the avatar.
12
+ */
13
+ profileName: string;
14
+ /**
15
+ * ID of the background color to be used if avatar's content is text.
16
+ */
17
+ color: 'background-color-1' | 'background-color-2' | 'background-color-3' | 'background-color-4' | 'background-color-5' | 'background-color-6' | 'background-color-7' | 'background-color-8' | 'background-color-9' | 'background-color-10';
18
+ constructor(renderer: Renderer2, elementRef: ElementRef<HTMLElement>);
19
+ get nativeElement(): HTMLElement;
20
+ ngAfterViewInit(): void;
21
+ private addIcon;
22
+ private setProfileName;
23
+ private formatInitials;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoAvatarComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<BaoAvatarComponent, "bao-avatar", never, { "profileName": "profileName"; "color": "color"; }, {}, never, ["bao-avatar-content, [bao-avatar-content]"]>;
26
+ }
@@ -0,0 +1,2 @@
1
+ export * from './module';
2
+ export * from './avatar.component';
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./avatar.component";
3
+ import * as i2 from "@angular/common";
4
+ export declare class BaoAvatarModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoAvatarModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<BaoAvatarModule, [typeof i1.BaoAvatarComponent, typeof i1.BaoAvatarContent], [typeof i2.CommonModule], [typeof i1.BaoAvatarComponent, typeof i1.BaoAvatarContent]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<BaoAvatarModule>;
8
+ }
@@ -11,8 +11,11 @@ import * as i9 from "./common-components/module";
11
11
  import * as i10 from "./checkbox/module";
12
12
  import * as i11 from "./radio/module";
13
13
  import * as i12 from "./summary/module";
14
+ import * as i13 from "./avatar/module";
15
+ import * as i14 from "./tabs/module";
16
+ import * as i15 from "./modal/module";
14
17
  export declare class BaoModule {
15
18
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoModule, never>;
16
- static ɵmod: i0.ɵɵNgModuleDeclaration<BaoModule, never, [typeof i1.BaoIconModule, typeof i2.BaoButtonModule, typeof i3.BaoAlertModule, typeof i4.BaoCardModule, typeof i5.BaoBreadcrumbModule], [typeof i1.BaoIconModule, typeof i2.BaoButtonModule, typeof i3.BaoAlertModule, typeof i5.BaoBreadcrumbModule, typeof i4.BaoCardModule, typeof i6.BaoTagModule, typeof i7.BaoHeaderInfoModule, typeof i8.BaoListModule, typeof i9.BaoCommonComponentsModule, typeof i10.BaoCheckboxModule, typeof i11.BaoRadioModule, typeof i12.BaoSummaryModule]>;
19
+ static ɵmod: i0.ɵɵNgModuleDeclaration<BaoModule, never, [typeof i1.BaoIconModule, typeof i2.BaoButtonModule, typeof i3.BaoAlertModule, typeof i4.BaoCardModule, typeof i5.BaoBreadcrumbModule], [typeof i1.BaoIconModule, typeof i2.BaoButtonModule, typeof i3.BaoAlertModule, typeof i5.BaoBreadcrumbModule, typeof i4.BaoCardModule, typeof i6.BaoTagModule, typeof i7.BaoHeaderInfoModule, typeof i8.BaoListModule, typeof i9.BaoCommonComponentsModule, typeof i10.BaoCheckboxModule, typeof i11.BaoRadioModule, typeof i12.BaoSummaryModule, typeof i13.BaoAvatarModule, typeof i14.BaoTabsModule, typeof i15.BaoModalModule]>;
17
20
  static ɵinj: i0.ɵɵInjectorDeclaration<BaoModule>;
18
21
  }
@@ -4,9 +4,9 @@ export declare class BaoBreadcrumbComponent implements AfterViewInit {
4
4
  private renderer;
5
5
  private staticContainer;
6
6
  constructor(renderer: Renderer2);
7
- private setLastLinkAttribute;
8
7
  ngAfterViewInit(): void;
9
8
  onContentChange(): void;
9
+ private setLastLinkAttribute;
10
10
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoBreadcrumbComponent, never>;
11
11
  static ɵcmp: i0.ɵɵComponentDeclaration<BaoBreadcrumbComponent, "bao-breadcrumb", never, {}, {}, never, ["*"]>;
12
12
  }
@@ -39,7 +39,7 @@ export declare class BaoButtonComponent implements AfterViewInit {
39
39
  * If the icon is on the right of the label, the loading spinner will need to be on the right of the label
40
40
  */
41
41
  rightIcon: boolean;
42
- constructor(elementRef: ElementRef, cdr: ChangeDetectorRef);
42
+ constructor(elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef);
43
43
  get nativeElement(): HTMLElement;
44
44
  ngAfterViewInit(): void;
45
45
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoButtonComponent, never>;
@@ -2,16 +2,16 @@ import { AfterViewInit, ChangeDetectorRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class BaoCheckboxGroupComponent implements AfterViewInit {
4
4
  private cdr;
5
- private _uniqueId;
6
5
  /**
7
6
  * The checkbox group ID. It is set dynamically with an unique ID by default
8
7
  */
9
8
  id: string;
9
+ private staticContainer;
10
10
  /**
11
11
  * The aria-describedby id for web accessibilty
12
12
  */
13
13
  ariaDescribedby?: string;
14
- private staticContainer;
14
+ private _uniqueId;
15
15
  constructor(cdr: ChangeDetectorRef);
16
16
  ngAfterViewInit(): void;
17
17
  onContentChange(): void;
@@ -14,31 +14,6 @@ export declare class BaoCheckboxComponent implements ControlValueAccessor, After
14
14
  private elementRef;
15
15
  private cdr;
16
16
  private focusMonitor;
17
- private _disabled;
18
- private _checked;
19
- private _indeterminate;
20
- private _uniqueId;
21
- /**
22
- * Whether the checkbox is checked. Default value : false
23
- */
24
- get checked(): boolean;
25
- set checked(value: boolean);
26
- /**
27
- * Whether the checkbox is disabled. Default value : false
28
- */
29
- get disabled(): boolean;
30
- set disabled(value: boolean);
31
- /**
32
- * Whether the checkbox is required. Default value : false
33
- */
34
- get required(): boolean;
35
- set required(value: boolean);
36
- private _required;
37
- /**
38
- * Whether the checkbox is indeterminate. Default value : false
39
- */
40
- get indeterminate(): boolean;
41
- set indeterminate(value: boolean);
42
17
  /**
43
18
  * The checkbox ID. It is set dynamically with an unique ID by default
44
19
  */
@@ -87,8 +62,33 @@ export declare class BaoCheckboxComponent implements ControlValueAccessor, After
87
62
  * The ID of the input html element
88
63
  */
89
64
  inputID: string;
90
- constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, focusMonitor: FocusMonitor);
65
+ private _disabled;
66
+ private _checked;
67
+ private _indeterminate;
68
+ private _uniqueId;
69
+ private _required;
70
+ constructor(elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, focusMonitor: FocusMonitor);
71
+ /**
72
+ * Whether the checkbox is checked. Default value : false
73
+ */
74
+ get checked(): boolean;
75
+ /**
76
+ * Whether the checkbox is disabled. Default value : false
77
+ */
78
+ get disabled(): boolean;
79
+ /**
80
+ * Whether the checkbox is required. Default value : false
81
+ */
82
+ get required(): boolean;
83
+ /**
84
+ * Whether the checkbox is indeterminate. Default value : false
85
+ */
86
+ get indeterminate(): boolean;
91
87
  get nativeElement(): HTMLElement;
88
+ set checked(value: boolean);
89
+ set disabled(value: boolean);
90
+ set required(value: boolean);
91
+ set indeterminate(value: boolean);
92
92
  ngOnInit(): void;
93
93
  ngAfterViewInit(): void;
94
94
  ngOnDestroy(): void;
@@ -144,7 +144,7 @@ export declare class BaoCheckboxComponent implements ControlValueAccessor, After
144
144
  private onModelChange;
145
145
  private onTouch;
146
146
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoCheckboxComponent, never>;
147
- static ɵcmp: i0.ɵɵComponentDeclaration<BaoCheckboxComponent, "bao-checkbox, [bao-checkbox]", never, { "checked": "checked"; "disabled": "disabled"; "required": "required"; "indeterminate": "indeterminate"; "id": "id"; "ariaLabel": "aria-label"; "brandBorder": "brandBorder"; "inline": "inline"; "name": "name"; "hiddenLabel": "hiddenLabel"; }, { "change": "change"; "indeterminateChange": "indeterminateChange"; }, never, ["*", "bao-checkbox-description, [bao-checkbox-description], [baoCheckboxDescription]"]>;
147
+ static ɵcmp: i0.ɵɵComponentDeclaration<BaoCheckboxComponent, "bao-checkbox, [bao-checkbox]", never, { "id": "id"; "ariaLabel": "aria-label"; "brandBorder": "brandBorder"; "inline": "inline"; "name": "name"; "hiddenLabel": "hiddenLabel"; "checked": "checked"; "disabled": "disabled"; "required": "required"; "indeterminate": "indeterminate"; }, { "change": "change"; "indeterminateChange": "indeterminateChange"; }, never, ["*", "bao-checkbox-description, [bao-checkbox-description], [baoCheckboxDescription]"]>;
148
148
  }
149
149
  export declare class BaoCheckBoxDescription {
150
150
  static ɵfac: i0.ɵɵFactoryDeclaration<BaoCheckBoxDescription, never>;
@@ -1,4 +1,4 @@
1
- export declare enum BaoColors {
1
+ export declare const enum BaoColors {
2
2
  ACTION = "action",
3
3
  PRIMARY = "primary",
4
4
  PRIMARY_REVERSED = "primary-reversed",
@@ -13,16 +13,8 @@ export declare class BaoIconComponent implements OnDestroy {
13
13
  private elementRef;
14
14
  private iconRegistry;
15
15
  private renderer;
16
- /** Name of the icon in the SVG icon set. */
17
- get svgIcon(): string;
18
- set svgIcon(value: string);
19
16
  /** The color of the icon, if not specified the icon's parent current text color will be used */
20
17
  color: BaoColors;
21
- get hexColor(): string | void;
22
- /** Title that will be used as an aria-label for the icon */
23
- get title(): string;
24
- set title(value: string);
25
- get titleId(): string;
26
18
  /**
27
19
  * The size of the icon
28
20
  */
@@ -31,13 +23,21 @@ export declare class BaoIconComponent implements OnDestroy {
31
23
  private _title;
32
24
  private _titleId;
33
25
  private _elementsWithExternalReferences?;
34
- constructor(elementRef: ElementRef<HTMLElement>, iconRegistry: BaoIconRegistry, renderer: Renderer2, ariaHidden: string);
26
+ constructor(elementRef: ElementRef<HTMLElement>, iconRegistry: BaoIconRegistry, renderer: Renderer2);
27
+ /** Name of the icon in the SVG icon set. */
28
+ get svgIcon(): string;
29
+ /** Title that will be used as an aria-label for the icon */
30
+ get title(): string;
31
+ get hexColor(): string | void;
32
+ get titleId(): string;
33
+ set svgIcon(value: string);
34
+ set title(value: string);
35
35
  ngOnDestroy(): void;
36
36
  private setSvgElement;
37
37
  private clearSvgElement;
38
38
  private updateSvgIcon;
39
39
  private addTitleToSVG;
40
40
  private generateUniqueTitleId;
41
- static ɵfac: i0.ɵɵFactoryDeclaration<BaoIconComponent, [null, null, null, { attribute: "aria-hidden"; }]>;
42
- static ɵcmp: i0.ɵɵComponentDeclaration<BaoIconComponent, "bao-icon", ["baoIcon"], { "svgIcon": "svgIcon"; "color": "color"; "title": "title"; "size": "size"; }, {}, never, ["*"]>;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoIconComponent, never>;
42
+ static ɵcmp: i0.ɵɵComponentDeclaration<BaoIconComponent, "bao-icon", ["baoIcon"], { "color": "color"; "size": "size"; "svgIcon": "svgIcon"; "title": "title"; }, {}, never, ["*"]>;
43
43
  }
@@ -0,0 +1,6 @@
1
+ export * from './module';
2
+ export * from './modal';
3
+ export * from './modal-container';
4
+ export * from './modal-config';
5
+ export * from './modal-ref';
6
+ export * from './modal-directives';
@@ -0,0 +1,8 @@
1
+ import { AnimationTriggerMetadata } from '@angular/animations';
2
+ /**
3
+ * Animations used by MatDialog.
4
+ * @docs-private
5
+ */
6
+ export declare const baoModalAnimations: {
7
+ readonly modalContainer: AnimationTriggerMetadata;
8
+ };
@@ -0,0 +1,105 @@
1
+ import { ViewContainerRef, Injector } from '@angular/core';
2
+ import { Direction } from '@angular/cdk/bidi';
3
+ import { ScrollStrategy } from '@angular/cdk/overlay';
4
+ export declare enum eModalDesktopWidthSize {
5
+ SMALL = "bao-modal-sm",
6
+ MEDIUM = "bao-modal-md",
7
+ LARGE = "bao-modal-lg"
8
+ }
9
+ export declare enum eModalMobileWidthSize {
10
+ FULL = "bao-modal-mobil-full",
11
+ COMPACT = "bao-modal-mobil-compact"
12
+ }
13
+ export interface BaoModalConfig {
14
+ size?: eModalDesktopWidthSize;
15
+ mobileSize?: eModalMobileWidthSize;
16
+ data?: unknown;
17
+ ariaLabelledBy?: string;
18
+ }
19
+ /** Options for where to set focus to automatically on dialog open */
20
+ export declare type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';
21
+ /** Valid ARIA roles for a dialog element. */
22
+ export declare type ModalRole = 'dialog' | 'alertdialog';
23
+ /** Possible overrides for a dialog's position. */
24
+ export interface ModalPosition {
25
+ /** Override for the dialog's top position. */
26
+ top?: string;
27
+ /** Override for the dialog's bottom position. */
28
+ bottom?: string;
29
+ /** Override for the dialog's left position. */
30
+ left?: string;
31
+ /** Override for the dialog's right position. */
32
+ right?: string;
33
+ }
34
+ /**
35
+ * Configuration for opening a modal dialog with the BaoModal service.
36
+ */
37
+ export declare class BaoModalInitialConfig<D = unknown> {
38
+ /**
39
+ * Where the attached component should live in Angular's *logical* component tree.
40
+ * This affects what is available for injection and the change detection order for the
41
+ * component instantiated inside of the dialog. This does not affect where the dialog
42
+ * content will be rendered.
43
+ */
44
+ viewContainerRef?: ViewContainerRef;
45
+ /**
46
+ * Injector used for the instantiation of the component to be attached. If provided,
47
+ * takes precedence over the injector indirectly provided by `ViewContainerRef`.
48
+ */
49
+ injector?: Injector;
50
+ /** ID for the dialog. If omitted, a unique one will be generated. */
51
+ id?: string;
52
+ /** The ARIA role of the dialog element. */
53
+ role?: ModalRole;
54
+ /** Custom class for the overlay pane. */
55
+ panelClass?: string | string[];
56
+ /** Whether the dialog has a backdrop. */
57
+ hasBackdrop?: boolean;
58
+ /** Custom class for the backdrop. */
59
+ backdropClass?: string | string[];
60
+ /** Whether the user can use escape or clicking on the backdrop to close the modal. */
61
+ disableClose?: boolean;
62
+ /** Width of the dialog. */
63
+ width?: string;
64
+ /** Height of the dialog. */
65
+ height?: string;
66
+ /** Min-width of the dialog. If a number is provided, assumes pixel units. */
67
+ minWidth?: number | string;
68
+ /** Min-height of the dialog. If a number is provided, assumes pixel units. */
69
+ minHeight?: number | string;
70
+ /** Max-width of the dialog. If a number is provided, assumes pixel units. Defaults to 80vw. */
71
+ maxWidth?: number | string;
72
+ /** Max-height of the dialog. If a number is provided, assumes pixel units. */
73
+ maxHeight?: number | string;
74
+ /** Position overrides. */
75
+ position?: ModalPosition;
76
+ /** Data being injected into the child component. */
77
+ data?: D | null;
78
+ /** Layout direction for the dialog's content. */
79
+ direction?: Direction;
80
+ /** ID of the element that describes the dialog. */
81
+ ariaDescribedBy?: string | null;
82
+ /** ID of the element that labels the dialog. */
83
+ ariaLabelledBy?: string | null;
84
+ /** Aria label to assign to the dialog element. */
85
+ ariaLabel?: string | null;
86
+ /**
87
+ * Where the dialog should focus on open.
88
+ */
89
+ autoFocus?: AutoFocusTarget | string;
90
+ /**
91
+ * Whether the dialog should restore focus to the
92
+ * previously-focused element, after it's closed.
93
+ */
94
+ restoreFocus?: boolean;
95
+ /** Whether to wait for the opening animation to finish before trapping focus. */
96
+ delayFocusTrap?: boolean;
97
+ /** Scroll strategy to be used for the dialog. */
98
+ scrollStrategy?: ScrollStrategy;
99
+ /**
100
+ * Whether the dialog should close when the user goes backwards/forwards in history.
101
+ * Note that this usually doesn't include clicking on links (unless the user is using
102
+ * the `HashLocationStrategy`).
103
+ */
104
+ closeOnNavigation?: boolean;
105
+ }
@@ -0,0 +1,106 @@
1
+ import { AnimationEvent } from '@angular/animations';
2
+ import { FocusMonitor, FocusOrigin, ConfigurableFocusTrapFactory, InteractivityChecker } from '@angular/cdk/a11y';
3
+ import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
4
+ import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter, NgZone } from '@angular/core';
5
+ import { BaoModalInitialConfig } from './modal-config';
6
+ import * as i0 from "@angular/core";
7
+ /** Event that captures the state of modal container animations. */
8
+ interface DialogAnimationEvent {
9
+ state: 'opened' | 'opening' | 'closing' | 'closed';
10
+ totalTime: number;
11
+ }
12
+ /**
13
+ * Throws an exception for the case when a ComponentPortal is
14
+ * attached to a DomPortalOutlet without an origin.
15
+ * @docs-private
16
+ */
17
+ export declare function throwBaoModalContentAlreadyAttachedError(): void;
18
+ /**
19
+ * Base class for the `BaoModalContainer`. The base class does not implement
20
+ * animations as these are left to implementers of the modal container.
21
+ */
22
+ export declare abstract class _BaoModalContainerBase extends BasePortalOutlet {
23
+ protected _elementRef: ElementRef;
24
+ protected _focusTrapFactory: ConfigurableFocusTrapFactory;
25
+ protected _changeDetectorRef: ChangeDetectorRef;
26
+ /** The modal configuration. */
27
+ _config: BaoModalInitialConfig;
28
+ private readonly _interactivityChecker;
29
+ private readonly _ngZone;
30
+ private _focusMonitor?;
31
+ /** The portal outlet inside of this container into which the modal content will be loaded. */
32
+ _portalOutlet: CdkPortalOutlet;
33
+ /** Emits when an animation state changes. */
34
+ _animationStateChanged: EventEmitter<DialogAnimationEvent>;
35
+ /**
36
+ * Type of interaction that led to the modal being closed. This is used to determine
37
+ * whether the focus style will be applied when returning focus to its original location
38
+ * after the modal is closed.
39
+ */
40
+ _closeInteractionType: FocusOrigin | null;
41
+ /** ID of the element that should be considered as the modal's label. */
42
+ _ariaLabelledBy: string | null;
43
+ /** ID for the container DOM element. */
44
+ _id: string;
45
+ protected _document: Document;
46
+ /** The class that traps and manages focus within the modal. */
47
+ private _focusTrap;
48
+ /** Element that was focused before the modal was opened. Save this to restore upon close. */
49
+ private _elementFocusedBeforeDialogWasOpened;
50
+ constructor(_elementRef: ElementRef, _focusTrapFactory: ConfigurableFocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _document: any,
51
+ /** The modal configuration. */
52
+ _config: BaoModalInitialConfig, _interactivityChecker: InteractivityChecker, _ngZone: NgZone, _focusMonitor?: FocusMonitor);
53
+ /** Initializes the modal container with the attached content. */
54
+ _initializeWithAttachedContent(): void;
55
+ /**
56
+ * Attach a ComponentPortal as content to this modal container.
57
+ */
58
+ attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
59
+ /**
60
+ * Attach a TemplatePortal as content to this modal container.
61
+ */
62
+ attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
63
+ /** Moves focus back into the modal if it was moved out. */
64
+ _recaptureFocus(): Promise<void>;
65
+ /**
66
+ * Moves the focus inside the focus trap. When autoFocus is not set to 'modal', if focus
67
+ * cannot be moved then focus will go to the modal container.
68
+ */
69
+ protected _trapFocus(): Promise<void>;
70
+ /** Restores focus to the element that was focused before the modal opened. */
71
+ protected _restoreFocus(): void;
72
+ /**
73
+ * Focuses the provided element. If the element is not focusable, it will add a tabIndex
74
+ * attribute to forcefully focus it. The attribute is removed after focus is moved.
75
+ */
76
+ private _forceFocus;
77
+ /**
78
+ * Focuses the first element that matches the given selector within the focus trap.
79
+ */
80
+ private _focusByCssSelector;
81
+ /** Sets up the focus trap. */
82
+ private _setupFocusTrap;
83
+ /** Captures the element that was focused before the modal was opened. */
84
+ private _capturePreviouslyFocusedElement;
85
+ /** Focuses the modal container. */
86
+ private _focusDialogContainer;
87
+ /** Returns whether focus is inside the modal. */
88
+ private _containsFocus;
89
+ /** Starts the modal exit animation. */
90
+ abstract _startExitAnimation(): void;
91
+ static ɵfac: i0.ɵɵFactoryDeclaration<_BaoModalContainerBase, [null, null, null, { optional: true; }, null, null, null, null]>;
92
+ static ɵdir: i0.ɵɵDirectiveDeclaration<_BaoModalContainerBase, never, never, {}, {}, never>;
93
+ }
94
+ export declare class BaoModalContainer extends _BaoModalContainerBase {
95
+ /** State of the modal animation. */
96
+ _state: 'void' | 'enter' | 'exit';
97
+ /** Callback, invoked whenever an animation on the host completes. */
98
+ _onAnimationDone({ toState, totalTime }: AnimationEvent): Promise<void>;
99
+ /** Callback, invoked when an animation on the host starts. */
100
+ _onAnimationStart({ toState, totalTime }: AnimationEvent): void;
101
+ /** Starts the modal exit animation. */
102
+ _startExitAnimation(): void;
103
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoModalContainer, never>;
104
+ static ɵcmp: i0.ɵɵComponentDeclaration<BaoModalContainer, "bao-modal-container", never, {}, {}, never, never>;
105
+ }
106
+ export {};
@@ -0,0 +1,25 @@
1
+ import { OnChanges, OnInit, SimpleChanges, ElementRef } from '@angular/core';
2
+ import { BaoModal } from './modal';
3
+ import { BaoModalRef } from './modal-ref';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Button that will close the current dialog.
7
+ */
8
+ export declare class BaoModalClose implements OnInit, OnChanges {
9
+ modalRef: BaoModalRef<unknown> | null;
10
+ private _elementRef;
11
+ private _dialog;
12
+ /** Screenreader label for the button. */
13
+ ariaLabel: string;
14
+ /** Default to "button" to prevents accidental form submits. */
15
+ type: 'submit' | 'button' | 'reset';
16
+ /** Dialog close input. */
17
+ dialogResult: unknown;
18
+ _baoModalClose: unknown;
19
+ constructor(modalRef: BaoModalRef<unknown> | null, _elementRef: ElementRef<HTMLElement>, _dialog: BaoModal);
20
+ ngOnInit(): void;
21
+ ngOnChanges(changes: SimpleChanges): void;
22
+ _onButtonClick(event: MouseEvent): void;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaoModalClose, [{ optional: true; }, null, null]>;
24
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaoModalClose, "[bao-modal-close], [baoModalClose]", ["BaoModalClose"], { "ariaLabel": "aria-label"; "type": "type"; "dialogResult": "bao-modal-close"; "_baoModalClose": "baoModalClose"; }, {}, never>;
25
+ }
@@ -0,0 +1,91 @@
1
+ import { FocusOrigin } from '@angular/cdk/a11y';
2
+ import { OverlayRef } from '@angular/cdk/overlay';
3
+ import { Observable } from 'rxjs';
4
+ import { ModalPosition } from './modal-config';
5
+ import { _BaoModalContainerBase } from './modal-container';
6
+ /** Possible states of the lifecycle of a modal. */
7
+ export declare const enum BaoModalState {
8
+ OPEN = 0,
9
+ CLOSING = 1,
10
+ CLOSED = 2
11
+ }
12
+ /**
13
+ * Reference to a modal opened via the BaoModalService.
14
+ */
15
+ export declare class BaoModalRef<T, R = unknown> {
16
+ private _overlayRef;
17
+ _containerInstance: _BaoModalContainerBase;
18
+ /** Id of the modal. */
19
+ readonly id: string;
20
+ /** The instance of component opened into the modal. */
21
+ componentInstance: T;
22
+ /** Whether the user is allowed to close the modal. */
23
+ disableClose: boolean | undefined;
24
+ /** Subject for notifying the user that the modal has finished opening. */
25
+ private readonly _afterOpened;
26
+ /** Subject for notifying the user that the modal has finished closing. */
27
+ private readonly _afterClosed;
28
+ /** Subject for notifying the user that the modal has started closing. */
29
+ private readonly _beforeClosed;
30
+ /** Result to be passed to afterClosed. */
31
+ private _result;
32
+ /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
33
+ private _closeFallbackTimeout;
34
+ /** Current state of the modal. */
35
+ private _state;
36
+ constructor(_overlayRef: OverlayRef, _containerInstance: _BaoModalContainerBase,
37
+ /** Id of the modal. */
38
+ id?: string);
39
+ /**
40
+ * Close the modal.
41
+ * @param modalResult Optional result to return to the modal opener.
42
+ */
43
+ close(modalResult?: R): void;
44
+ /**
45
+ * Gets an observable that is notified when the modal is finished opening.
46
+ */
47
+ afterOpened(): Observable<void>;
48
+ /**
49
+ * Gets an observable that is notified when the modal is finished closing.
50
+ */
51
+ afterClosed(): Observable<R | undefined>;
52
+ /**
53
+ * Gets an observable that is notified when the modal has started closing.
54
+ */
55
+ beforeClosed(): Observable<R | undefined>;
56
+ /**
57
+ * Gets an observable that emits when the overlay's backdrop has been clicked.
58
+ */
59
+ backdropClick(): Observable<MouseEvent>;
60
+ /**
61
+ * Gets an observable that emits when keydown events are targeted on the overlay.
62
+ */
63
+ keydownEvents(): Observable<KeyboardEvent>;
64
+ /**
65
+ * Updates the dialog's position.
66
+ */
67
+ updatePosition(position?: ModalPosition): this;
68
+ /**
69
+ * Updates the modal's width and height.
70
+ */
71
+ updateSize(width?: string, height?: string): this;
72
+ /** Add a CSS class or an array of classes to the overlay pane. */
73
+ addPanelClass(classes: string | string[]): this;
74
+ /** Remove a CSS class or an array of classes from the overlay pane. */
75
+ removePanelClass(classes: string | string[]): this;
76
+ /** Gets the current state of the modal's lifecycle. */
77
+ getState(): BaoModalState;
78
+ /**
79
+ * Finishes the modal close by updating the state of the modal
80
+ * and disposing the overlay.
81
+ */
82
+ private _finishModalClose;
83
+ /** Fetches the position strategy object from the overlay ref. */
84
+ private _getPositionStrategy;
85
+ }
86
+ /**
87
+ * Closes the modal with the specified interaction type. This is currently not part of
88
+ * `BaoModalRef` as that would conflict with custom modal ref mocks provided in tests.
89
+ * More details. See: https://github.com/angular/components/pull/9257#issuecomment-651342226.
90
+ */
91
+ export declare function _closeModalVia<R>(ref: BaoModalRef<R>, interactionType: FocusOrigin, result?: R): void;