@skyux/popovers 5.5.0 → 5.6.2
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/bundles/skyux-popovers.umd.js +8 -5
- package/documentation.json +203 -290
- package/esm2015/lib/modules/dropdown/dropdown-menu.component.js +2 -2
- package/esm2015/lib/modules/dropdown/dropdown-menu.component.js.map +1 -1
- package/esm2015/lib/modules/dropdown/dropdown.component.js +2 -2
- package/esm2015/lib/modules/dropdown/dropdown.component.js.map +1 -1
- package/esm2015/lib/modules/dropdown/dropdown.module.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-animation.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-content.component.js +9 -6
- package/esm2015/lib/modules/popover/popover-content.component.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-extensions.js.map +1 -1
- package/esm2015/lib/modules/popover/popover.component.js.map +1 -1
- package/esm2015/lib/modules/popover/popover.directive.js +1 -1
- package/esm2015/lib/modules/popover/popover.directive.js.map +1 -1
- package/esm2015/lib/modules/popover/popover.module.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-popovers-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-popovers-resources.module.js.map +1 -1
- package/esm2015/testing/dropdown/dropdown-fixture.js.map +1 -1
- package/esm2015/testing/dropdown/dropdown-testing.module.js.map +1 -1
- package/esm2015/testing/popover/popover-fixture.js.map +1 -1
- package/esm2015/testing/popover/popover-testing.module.js.map +1 -1
- package/fesm2015/skyux-popovers-testing.js.map +1 -1
- package/fesm2015/skyux-popovers.js +8 -5
- package/fesm2015/skyux-popovers.js.map +1 -1
- package/lib/modules/dropdown/dropdown-menu.component.d.ts +1 -1
- package/lib/modules/popover/popover-content.component.d.ts +4 -3
- package/lib/modules/popover/popover.directive.d.ts +2 -2
- package/package.json +15 -14
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* To update this file, simply rerun the command.
|
|
6
6
|
*/
|
|
7
7
|
import { NgModule } from '@angular/core';
|
|
8
|
-
import {
|
|
8
|
+
import { SKY_LIB_RESOURCES_PROVIDERS, SkyI18nModule, getLibStringForLocale, } from '@skyux/i18n';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
const RESOURCES = {
|
|
11
11
|
'EN-US': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sky-popovers-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/shared/sky-popovers-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"sky-popovers-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/shared/sky-popovers-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,yCAAyC,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;KACvE;CACF,CAAC;AAEF,MAAM,OAAO,4BAA4B;IAChC,SAAS,CAAC,UAA4B,EAAE,IAAY;QACzD,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAT3B,aAAa;yHASZ,0BAA0B,aAR1B;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,4BAA4B;YACtC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,0BAA0B;kBAVtC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,4BAA4B;4BACtC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-popovers' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_dropdown_context_menu_default_label: { message: 'Context menu' },\n },\n};\n\nexport class SkyPopoversResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyPopoversResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyPopoversResourcesModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"dropdown-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAuD7B,YAAoB,OAA8B,EAAE,SAAiB;QAAjD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AAC,CAAC;IACrD,CAAC;IAEO,kBAAkB;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,OAAO,OAAO,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IACxD,CAAC;IAEO,UAAU;QAChB,OAAO,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC;IAEO,cAAc,CAAC,UAAsC;QAC3D,IAAI,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACjC,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACjC,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IAEO,aAAa,CAAC,UAAsC;QAC1D,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,KAAK,IAAI,CAAC,IAAI,UAAU,EAAE;YACxB,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE;gBACjB,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;oBAC1B,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;iBAC9B;aACF;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyPopoversFixtureDropdown } from './popovers-fixture-dropdown';\nimport { SkyPopoversFixtureDropdownItem } from './popovers-fixture-dropdown-item';\nimport { SkyPopoversFixtureDropdownMenu } from './popovers-fixture-dropdown-menu';\n\n/**\n * Provides information for and interaction with a SKY UX dropdown component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyDropdownFixture {\n /**\n * Returns information about the dropdown component.\n */\n public get dropdown(): SkyPopoversFixtureDropdown {\n const button = this.buttonDebugElement;\n\n if (!button) {\n return;\n }\n\n return {\n buttonStyle: this.getButtonStyle(button.classes),\n buttonType: this.getButtonType(button.classes),\n disabled: button.nativeElement.disabled,\n label: button.nativeElement.getAttribute('aria-label'),\n title: button.nativeElement.getAttribute('title'),\n };\n }\n\n /**\n * Returns the dropdown button's text.\n */\n public get dropdownButtonText(): string {\n return SkyAppTestUtility.getText(this.buttonDebugElement.nativeElement);\n }\n\n /**\n * Returns information about the dropdown menu component.\n */\n public get dropdownMenu(): SkyPopoversFixtureDropdownMenu {\n const menu = this.getDropdownMenuContent();\n if (!menu) {\n return;\n }\n\n return {\n ariaLabelledBy: menu.getAttribute('aria-labelledby'),\n ariaRole: menu.getAttribute('role'),\n };\n }\n\n /**\n * Indicates if the dropdown menu is open and visible.\n */\n public get dropdownMenuIsVisible(): boolean {\n return this.getDropdownMenuContent() !== undefined;\n }\n\n private get buttonDebugElement(): DebugElement {\n return this.debugEl.query(By.css('.sky-dropdown-button'));\n }\n\n private debugEl: DebugElement;\n\n constructor(private fixture: ComponentFixture<any>, skyTestId: string) {\n this.debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-dropdown'\n );\n }\n\n /**\n * Click the dropdown button to open or close the dropdown menu.\n */\n public async clickDropdownButton(): Promise<any> {\n this.buttonDebugElement.nativeElement.click();\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Click the dropdown item at the provided index.\n */\n public async clickDropdownItem(index: number): Promise<any> {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n itemEls[index].querySelector('button,a').click();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns information about the dropdown item at the provided index.\n */\n public getDropdownItem(index: number): SkyPopoversFixtureDropdownItem {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n const item = itemEls[index];\n if (!item) {\n return;\n }\n\n return {\n ariaRole: item.getAttribute('role'),\n };\n }\n\n /**\n * Returns the contents of the dropdown menu.\n */\n public getDropdownMenuContent(): any {\n const overlay = this.getOverlay();\n if (!overlay) {\n return;\n }\n\n return overlay.querySelector('.sky-dropdown-menu');\n }\n\n private getDropdownItemEls(): NodeListOf<any> {\n const overlay = this.getOverlay();\n\n if (!overlay) {\n return;\n }\n\n return overlay.querySelectorAll('.sky-dropdown-item');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private getButtonStyle(classNames: { [key: string]: boolean }): string {\n if (classNames['sky-btn-primary']) {\n return 'primary';\n }\n if (classNames['sky-btn-default']) {\n return 'default';\n }\n }\n\n private getButtonType(classNames: { [key: string]: boolean }): string {\n const prefix = 'sky-dropdown-button-type-';\n\n for (let i in classNames) {\n if (classNames[i]) {\n if (i.indexOf(prefix) > -1) {\n return i.replace(prefix, '');\n }\n }\n }\n\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;;AAKpD,MAAM,OAAO,wBAAwB;;sHAAxB,wBAAwB;uHAAxB,wBAAwB,YAFzB,iBAAiB;uHAEhB,wBAAwB,YAFzB,iBAAiB;4FAEhB,wBAAwB;kBAHpC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;iBAC7B","sourcesContent":["import { NgModule } from '@angular/core';\nimport { SkyDropdownModule } from '@skyux/popovers';\n\n@NgModule({\n exports: [SkyDropdownModule],\n})\nexport class SkyDropdownTestingModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IA0C5B,YAAoB,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAzCtD;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,2BAA2B,CACrC,IAAI,CAAC,gBAAgB,EACrB,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,2BAA2B,CACrC,IAAI,CAAC,gBAAgB,EACrB,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC;IAC3C,CAAC;IAID;;OAEG;IACI,IAAI;QACT,0DAA0D;QAC1D,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE9D,IAAI,CAAC,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testing';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Provides information for and interaction with a SKY UX popover component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPopoverFixture {\n /**\n * Returns the popover alignment if the popover is open, otherwise undefined.\n */\n public get alignment(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-alignment-'\n );\n }\n\n /**\n * Returns the popover body element if the popover is open, otherwise undefined.\n */\n public get body(): HTMLElement {\n return this.bodyElement;\n }\n\n /**\n * Returns the popover position if the popover is open, otherwise undefined.\n */\n public get placement(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-placement-'\n );\n }\n\n /**\n * Returns the popover title text if the popover is open, otherwise undefined.\n */\n public get popoverTitle(): string {\n return SkyAppTestUtility.getText(this.titleElement);\n }\n\n /**\n * Indicates if the popover is open and visible.\n */\n public get popoverIsVisible(): boolean {\n return this.contentElement !== undefined;\n }\n\n constructor(private fixture: ComponentFixture<any>) {}\n\n /**\n * Triggers the blur event for the popover.\n */\n public blur(): Promise<any> {\n // close the popover by changing focus to the body element\n SkyAppTestUtility.fireDomEvent(window.document.body, 'click');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n //#region helpers\n private get contentElement(): HTMLElement {\n return this.queryOverlay('sky-popover-content');\n }\n\n private get containerElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-container');\n }\n\n private get titleElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-title');\n }\n\n private get bodyElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-body');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private queryOverlay(query: string): HTMLElement {\n const overlay = this.getOverlay();\n\n return !overlay ? undefined : overlay.querySelector(query);\n }\n\n /**\n * Searches the element's class names for a class which matches a given prefix.\n * If a match is found, the prefix is trimmed from the class name and the suffix is returned.\n * If no class matching the prefix is found, undefined is returned.\n *\n * Example:\n * For a class 'sky-popover-placement-right', passing the prefix 'sky-popover-placement-'\n * should return the value 'right'.\n * @param prefix\n */\n private getClassSuffixByClassPrefix(\n element: HTMLElement,\n prefix: string\n ): string {\n let containerClasses = element?.className.split(' ');\n let prefixedClass = containerClasses?.find((x) => x.startsWith(prefix));\n\n return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);\n }\n //#endregion\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"popover-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;;AAY9C,MAAM,OAAO,uBAAuB;;qHAAvB,uBAAuB;sHAAvB,uBAAuB,YAFxB,cAAc,aANtB,gBAAgB;QAEhB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;sHAIX,uBAAuB,YAFzB,CAAC,cAAc,CAAC,EANvB,gBAAgB;QAEhB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;4FAIX,uBAAuB;kBAVnC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,gBAAgB;wBAEhB,8DAA8D;wBAC9D,4DAA4D;wBAC5D,oBAAoB;qBACrB;oBACD,OAAO,EAAE,CAAC,cAAc,CAAC;iBAC1B","sourcesContent":["import { NgModule } from '@angular/core';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyPopoverModule } from '@skyux/popovers';\nimport { SkyThemeModule } from '@skyux/theme';\n\n@NgModule({\n exports: [\n SkyPopoverModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n imports: [SkyThemeModule],\n})\nexport class SkyPopoverTestingModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-popovers-testing.js","sources":["../../../../../libs/components/popovers/testing/src/dropdown/dropdown-testing.module.ts","../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts","../../../../../libs/components/popovers/testing/src/popover/popover-testing.module.ts","../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts","../../../../../libs/components/popovers/testing/src/skyux-popovers-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\n\nimport { SkyDropdownModule } from '@skyux/popovers';\n\n@NgModule({\n exports: [SkyDropdownModule],\n})\nexport class SkyDropdownTestingModule {}\n","import { DebugElement } from '@angular/core';\n\nimport { ComponentFixture } from '@angular/core/testing';\n\nimport { By } from '@angular/platform-browser';\n\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyPopoversFixtureDropdown } from './popovers-fixture-dropdown';\n\nimport { SkyPopoversFixtureDropdownItem } from './popovers-fixture-dropdown-item';\n\nimport { SkyPopoversFixtureDropdownMenu } from './popovers-fixture-dropdown-menu';\n\n/**\n * Provides information for and interaction with a SKY UX dropdown component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyDropdownFixture {\n /**\n * Returns information about the dropdown component.\n */\n public get dropdown(): SkyPopoversFixtureDropdown {\n const button = this.buttonDebugElement;\n\n if (!button) {\n return;\n }\n\n return {\n buttonStyle: this.getButtonStyle(button.classes),\n buttonType: this.getButtonType(button.classes),\n disabled: button.nativeElement.disabled,\n label: button.nativeElement.getAttribute('aria-label'),\n title: button.nativeElement.getAttribute('title'),\n };\n }\n\n /**\n * Returns the dropdown button's text.\n */\n public get dropdownButtonText(): string {\n return SkyAppTestUtility.getText(this.buttonDebugElement.nativeElement);\n }\n\n /**\n * Returns information about the dropdown menu component.\n */\n public get dropdownMenu(): SkyPopoversFixtureDropdownMenu {\n const menu = this.getDropdownMenuContent();\n if (!menu) {\n return;\n }\n\n return {\n ariaLabelledBy: menu.getAttribute('aria-labelledby'),\n ariaRole: menu.getAttribute('role'),\n };\n }\n\n /**\n * Indicates if the dropdown menu is open and visible.\n */\n public get dropdownMenuIsVisible(): boolean {\n return this.getDropdownMenuContent() !== undefined;\n }\n\n private get buttonDebugElement(): DebugElement {\n return this.debugEl.query(By.css('.sky-dropdown-button'));\n }\n\n private debugEl: DebugElement;\n\n constructor(private fixture: ComponentFixture<any>, skyTestId: string) {\n this.debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-dropdown'\n );\n }\n\n /**\n * Click the dropdown button to open or close the dropdown menu.\n */\n public async clickDropdownButton(): Promise<any> {\n this.buttonDebugElement.nativeElement.click();\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Click the dropdown item at the provided index.\n */\n public async clickDropdownItem(index: number): Promise<any> {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n itemEls[index].querySelector('button,a').click();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns information about the dropdown item at the provided index.\n */\n public getDropdownItem(index: number): SkyPopoversFixtureDropdownItem {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n const item = itemEls[index];\n if (!item) {\n return;\n }\n\n return {\n ariaRole: item.getAttribute('role'),\n };\n }\n\n /**\n * Returns the contents of the dropdown menu.\n */\n public getDropdownMenuContent(): any {\n const overlay = this.getOverlay();\n if (!overlay) {\n return;\n }\n\n return overlay.querySelector('.sky-dropdown-menu');\n }\n\n private getDropdownItemEls(): NodeListOf<any> {\n const overlay = this.getOverlay();\n\n if (!overlay) {\n return;\n }\n\n return overlay.querySelectorAll('.sky-dropdown-item');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private getButtonStyle(classNames: { [key: string]: boolean }): string {\n if (classNames['sky-btn-primary']) {\n return 'primary';\n }\n if (classNames['sky-btn-default']) {\n return 'default';\n }\n }\n\n private getButtonType(classNames: { [key: string]: boolean }): string {\n const prefix = 'sky-dropdown-button-type-';\n\n for (let i in classNames) {\n if (classNames[i]) {\n if (i.indexOf(prefix) > -1) {\n return i.replace(prefix, '');\n }\n }\n }\n\n return undefined;\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\n\nimport { SkyPopoverModule } from '@skyux/popovers';\n\nimport { SkyThemeModule } from '@skyux/theme';\n\n@NgModule({\n exports: [\n SkyPopoverModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n imports: [SkyThemeModule],\n})\nexport class SkyPopoverTestingModule {}\n","import { ComponentFixture } from '@angular/core/testing';\n\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Provides information for and interaction with a SKY UX popover component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPopoverFixture {\n /**\n * Returns the popover alignment if the popover is open, otherwise undefined.\n */\n public get alignment(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-alignment-'\n );\n }\n\n /**\n * Returns the popover body element if the popover is open, otherwise undefined.\n */\n public get body(): HTMLElement {\n return this.bodyElement;\n }\n\n /**\n * Returns the popover position if the popover is open, otherwise undefined.\n */\n public get placement(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-placement-'\n );\n }\n\n /**\n * Returns the popover title text if the popover is open, otherwise undefined.\n */\n public get popoverTitle(): string {\n return SkyAppTestUtility.getText(this.titleElement);\n }\n\n /**\n * Indicates if the popover is open and visible.\n */\n public get popoverIsVisible(): boolean {\n return this.contentElement !== undefined;\n }\n\n constructor(private fixture: ComponentFixture<any>) {}\n\n /**\n * Triggers the blur event for the popover.\n */\n public blur(): Promise<any> {\n // close the popover by changing focus to the body element\n SkyAppTestUtility.fireDomEvent(window.document.body, 'click');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n //#region helpers\n private get contentElement(): HTMLElement {\n return this.queryOverlay('sky-popover-content');\n }\n\n private get containerElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-container');\n }\n\n private get titleElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-title');\n }\n\n private get bodyElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-body');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private queryOverlay(query: string): HTMLElement {\n const overlay = this.getOverlay();\n\n return !overlay ? undefined : overlay.querySelector(query);\n }\n\n /**\n * Searches the element's class names for a class which matches a given prefix.\n * If a match is found, the prefix is trimmed from the class name and the suffix is returned.\n * If no class matching the prefix is found, undefined is returned.\n *\n * Example:\n * For a class 'sky-popover-placement-right', passing the prefix 'sky-popover-placement-'\n * should return the value 'right'.\n * @param prefix\n */\n private getClassSuffixByClassPrefix(\n element: HTMLElement,\n prefix: string\n ): string {\n let containerClasses = element?.className.split(' ');\n let prefixedClass = containerClasses?.find((x) => x.startsWith(prefix));\n\n return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);\n }\n //#endregion\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAOa,wBAAwB;;sHAAxB,wBAAwB;uHAAxB,wBAAwB,YAFzB,iBAAiB;uHAEhB,wBAAwB,YAFzB,iBAAiB;4FAEhB,wBAAwB;kBAHpC,QAAQ;mBAAC;oBACR,OAAO,EAA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B,MAAc;QAEd,IAAI,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrD,IAAI,aAAa,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAExE,OAAO,CAAC,aAAa,GAAG,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACxE;;;AC7GH;;;;;;"}
|
|
1
|
+
{"version":3,"file":"skyux-popovers-testing.js","sources":["../../../../../libs/components/popovers/testing/src/dropdown/dropdown-testing.module.ts","../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts","../../../../../libs/components/popovers/testing/src/popover/popover-testing.module.ts","../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts","../../../../../libs/components/popovers/testing/src/skyux-popovers-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { SkyDropdownModule } from '@skyux/popovers';\n\n@NgModule({\n exports: [SkyDropdownModule],\n})\nexport class SkyDropdownTestingModule {}\n","import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyPopoversFixtureDropdown } from './popovers-fixture-dropdown';\nimport { SkyPopoversFixtureDropdownItem } from './popovers-fixture-dropdown-item';\nimport { SkyPopoversFixtureDropdownMenu } from './popovers-fixture-dropdown-menu';\n\n/**\n * Provides information for and interaction with a SKY UX dropdown component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyDropdownFixture {\n /**\n * Returns information about the dropdown component.\n */\n public get dropdown(): SkyPopoversFixtureDropdown {\n const button = this.buttonDebugElement;\n\n if (!button) {\n return;\n }\n\n return {\n buttonStyle: this.getButtonStyle(button.classes),\n buttonType: this.getButtonType(button.classes),\n disabled: button.nativeElement.disabled,\n label: button.nativeElement.getAttribute('aria-label'),\n title: button.nativeElement.getAttribute('title'),\n };\n }\n\n /**\n * Returns the dropdown button's text.\n */\n public get dropdownButtonText(): string {\n return SkyAppTestUtility.getText(this.buttonDebugElement.nativeElement);\n }\n\n /**\n * Returns information about the dropdown menu component.\n */\n public get dropdownMenu(): SkyPopoversFixtureDropdownMenu {\n const menu = this.getDropdownMenuContent();\n if (!menu) {\n return;\n }\n\n return {\n ariaLabelledBy: menu.getAttribute('aria-labelledby'),\n ariaRole: menu.getAttribute('role'),\n };\n }\n\n /**\n * Indicates if the dropdown menu is open and visible.\n */\n public get dropdownMenuIsVisible(): boolean {\n return this.getDropdownMenuContent() !== undefined;\n }\n\n private get buttonDebugElement(): DebugElement {\n return this.debugEl.query(By.css('.sky-dropdown-button'));\n }\n\n private debugEl: DebugElement;\n\n constructor(private fixture: ComponentFixture<any>, skyTestId: string) {\n this.debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-dropdown'\n );\n }\n\n /**\n * Click the dropdown button to open or close the dropdown menu.\n */\n public async clickDropdownButton(): Promise<any> {\n this.buttonDebugElement.nativeElement.click();\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Click the dropdown item at the provided index.\n */\n public async clickDropdownItem(index: number): Promise<any> {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n itemEls[index].querySelector('button,a').click();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns information about the dropdown item at the provided index.\n */\n public getDropdownItem(index: number): SkyPopoversFixtureDropdownItem {\n const itemEls = this.getDropdownItemEls();\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n const item = itemEls[index];\n if (!item) {\n return;\n }\n\n return {\n ariaRole: item.getAttribute('role'),\n };\n }\n\n /**\n * Returns the contents of the dropdown menu.\n */\n public getDropdownMenuContent(): any {\n const overlay = this.getOverlay();\n if (!overlay) {\n return;\n }\n\n return overlay.querySelector('.sky-dropdown-menu');\n }\n\n private getDropdownItemEls(): NodeListOf<any> {\n const overlay = this.getOverlay();\n\n if (!overlay) {\n return;\n }\n\n return overlay.querySelectorAll('.sky-dropdown-item');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private getButtonStyle(classNames: { [key: string]: boolean }): string {\n if (classNames['sky-btn-primary']) {\n return 'primary';\n }\n if (classNames['sky-btn-default']) {\n return 'default';\n }\n }\n\n private getButtonType(classNames: { [key: string]: boolean }): string {\n const prefix = 'sky-dropdown-button-type-';\n\n for (let i in classNames) {\n if (classNames[i]) {\n if (i.indexOf(prefix) > -1) {\n return i.replace(prefix, '');\n }\n }\n }\n\n return undefined;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyPopoverModule } from '@skyux/popovers';\nimport { SkyThemeModule } from '@skyux/theme';\n\n@NgModule({\n exports: [\n SkyPopoverModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n imports: [SkyThemeModule],\n})\nexport class SkyPopoverTestingModule {}\n","import { ComponentFixture } from '@angular/core/testing';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Provides information for and interaction with a SKY UX popover component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPopoverFixture {\n /**\n * Returns the popover alignment if the popover is open, otherwise undefined.\n */\n public get alignment(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-alignment-'\n );\n }\n\n /**\n * Returns the popover body element if the popover is open, otherwise undefined.\n */\n public get body(): HTMLElement {\n return this.bodyElement;\n }\n\n /**\n * Returns the popover position if the popover is open, otherwise undefined.\n */\n public get placement(): string {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-placement-'\n );\n }\n\n /**\n * Returns the popover title text if the popover is open, otherwise undefined.\n */\n public get popoverTitle(): string {\n return SkyAppTestUtility.getText(this.titleElement);\n }\n\n /**\n * Indicates if the popover is open and visible.\n */\n public get popoverIsVisible(): boolean {\n return this.contentElement !== undefined;\n }\n\n constructor(private fixture: ComponentFixture<any>) {}\n\n /**\n * Triggers the blur event for the popover.\n */\n public blur(): Promise<any> {\n // close the popover by changing focus to the body element\n SkyAppTestUtility.fireDomEvent(window.document.body, 'click');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n //#region helpers\n private get contentElement(): HTMLElement {\n return this.queryOverlay('sky-popover-content');\n }\n\n private get containerElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-container');\n }\n\n private get titleElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-title');\n }\n\n private get bodyElement(): HTMLElement {\n return this.queryOverlay('.sky-popover-body');\n }\n\n private getOverlay(): HTMLElement {\n return document.querySelector('sky-overlay');\n }\n\n private queryOverlay(query: string): HTMLElement {\n const overlay = this.getOverlay();\n\n return !overlay ? undefined : overlay.querySelector(query);\n }\n\n /**\n * Searches the element's class names for a class which matches a given prefix.\n * If a match is found, the prefix is trimmed from the class name and the suffix is returned.\n * If no class matching the prefix is found, undefined is returned.\n *\n * Example:\n * For a class 'sky-popover-placement-right', passing the prefix 'sky-popover-placement-'\n * should return the value 'right'.\n * @param prefix\n */\n private getClassSuffixByClassPrefix(\n element: HTMLElement,\n prefix: string\n ): string {\n let containerClasses = element?.className.split(' ');\n let prefixedClass = containerClasses?.find((x) => x.startsWith(prefix));\n\n return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);\n }\n //#endregion\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAMa,wBAAwB;;sHAAxB,wBAAwB;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C,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC5D;;;;;;;;;;;IAYO,2BAA2B,CACjC,OAAoB,EACpB,MAAc;QAEd,IAAI,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrD,IAAI,aAAa,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAExE,OAAO,CAAC,aAAa,GAAG,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACxE;;;AC5GH;;;;;;"}
|
|
@@ -1189,6 +1189,13 @@ class SkyPopoverContentComponent {
|
|
|
1189
1189
|
this.arrowTop = top;
|
|
1190
1190
|
this.arrowLeft = left;
|
|
1191
1191
|
}
|
|
1192
|
+
isFocusLeavingElement(event) {
|
|
1193
|
+
const focusableItems = this.coreAdapterService.getFocusableChildren(this.elementRef.nativeElement);
|
|
1194
|
+
const isFirstItem = focusableItems[0] === event.target && event.shiftKey;
|
|
1195
|
+
const isLastItem = focusableItems[focusableItems.length - 1] === event.target &&
|
|
1196
|
+
!event.shiftKey;
|
|
1197
|
+
return focusableItems.length === 0 || isFirstItem || isLastItem;
|
|
1198
|
+
}
|
|
1192
1199
|
addEventListeners() {
|
|
1193
1200
|
const hostElement = this.elementRef.nativeElement;
|
|
1194
1201
|
fromEvent(hostElement, 'mouseenter')
|
|
@@ -1216,12 +1223,8 @@ class SkyPopoverContentComponent {
|
|
|
1216
1223
|
if (!this.dismissOnBlur) {
|
|
1217
1224
|
return;
|
|
1218
1225
|
}
|
|
1219
|
-
const focusableItems = this.coreAdapterService.getFocusableChildren(hostElement);
|
|
1220
|
-
const isFirstItem = focusableItems[0] === event.target && event.shiftKey;
|
|
1221
|
-
const isLastItem = focusableItems[focusableItems.length - 1] === event.target &&
|
|
1222
|
-
!event.shiftKey;
|
|
1223
1226
|
/*istanbul ignore else*/
|
|
1224
|
-
if (
|
|
1227
|
+
if (this.isFocusLeavingElement(event)) {
|
|
1225
1228
|
this.close();
|
|
1226
1229
|
this.caller.nativeElement.focus();
|
|
1227
1230
|
event.preventDefault();
|