-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/toastr
- Loading branch information
Showing
42 changed files
with
1,307 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { NbFocusTrapFactoryService } from './focus-trap'; | ||
|
||
|
||
@NgModule({ | ||
providers: [ | ||
NbFocusTrapFactoryService, | ||
], | ||
}) | ||
export class NbA11yModule { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Inject, Injectable, NgZone } from '@angular/core'; | ||
import { FocusTrap, FocusTrapFactory, InteractivityChecker } from '@angular/cdk/a11y'; | ||
|
||
import { NB_DOCUMENT } from '../../../theme.options'; | ||
|
||
|
||
/** | ||
* Overrides angular cdk focus trap to keep restore functionality inside trap. | ||
* */ | ||
export class NbFocusTrap extends FocusTrap { | ||
protected previouslyFocusedElement: HTMLElement; | ||
|
||
constructor( | ||
protected element: HTMLElement, | ||
protected checker: InteractivityChecker, | ||
protected ngZone: NgZone, | ||
protected document: Document, | ||
deferAnchors) { | ||
super(element, checker, ngZone, document, deferAnchors); | ||
this.savePreviouslyFocusedElement(); | ||
} | ||
|
||
restoreFocus() { | ||
this.previouslyFocusedElement.focus(); | ||
this.destroy(); | ||
} | ||
|
||
blurPreviouslyFocusedElement() { | ||
this.previouslyFocusedElement.blur(); | ||
} | ||
|
||
protected savePreviouslyFocusedElement() { | ||
this.previouslyFocusedElement = this.document.activeElement as HTMLElement; | ||
} | ||
} | ||
|
||
@Injectable() | ||
export class NbFocusTrapFactoryService extends FocusTrapFactory { | ||
constructor( | ||
protected checker: InteractivityChecker, | ||
protected ngZone: NgZone, | ||
@Inject(NB_DOCUMENT) private document) { | ||
super(checker, ngZone, document); | ||
} | ||
|
||
create(element: HTMLElement, deferCaptureElements?: boolean): NbFocusTrap { | ||
return new NbFocusTrap(element, this.checker, this.ngZone, this.document, deferCaptureElements); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
export * from './overlay'; | ||
export * from './a11y/a11y.module'; | ||
export * from './a11y/focus-trap'; | ||
export * from './adapter/overlay-container-adapter'; | ||
export * from './adapter/scroll-dispatcher-adapter'; | ||
export * from './adapter/viewport-ruler-adapter'; |
4 changes: 3 additions & 1 deletion
4
src/framework/theme/components/cdk/overlay/_overlay.theme.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
@import '~@angular/cdk/overlay-prebuilt.css'; | ||
|
||
@mixin nb-overlay-theme { | ||
.overlay-backdrop { | ||
background: rgba(0, 0, 0, 0.288); | ||
background: nb-theme(overlay-backdrop-bg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.