Skip to content

Commit

Permalink
feat(popover): rm Design pages & use closeSurface methods
Browse files Browse the repository at this point in the history
Signed-off-by: aurore.stagnol <[email protected]>
  • Loading branch information
astagnol committed Jun 26, 2023
1 parent bd5f796 commit 52e75ad
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 59 deletions.
Binary file not shown.
Binary file not shown.
28 changes: 0 additions & 28 deletions packages/design/components/popover/design-popover.mdx

This file was deleted.

9 changes: 0 additions & 9 deletions packages/libraries/cdk/src/components/surface/ocdk-surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,6 @@ export class OcdkSurface extends HTMLElement implements OcdkSurfaceBehaviour {
this.controller.setOriginCorner(originCorner);
}

/**
* Check if a click is outside of the surface
* @param event - event reference
*/
isClickOutsideSurface(event: Event): boolean {
const srcElement = event.composedPath()[0];
return this.anchorElement?.contains(event.target as Node) || this.anchorElement?.shadowRoot?.contains(srcElement as Node) || false;
}

private getDefaultAdapter() {
const adapter: OcdkSurfaceAdapter = {
addClass: (className) => this.classList.add(className),
Expand Down
1 change: 0 additions & 1 deletion packages/libraries/core/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ const args = process.argv.slice(2);
* ```
*/
const config: Config.InitialOptions = OdsGetJestConfig({ basePath: '<rootDir>/../../..', stencil: false, args });
console.log(config);
export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ export class OdsPopoverController extends OdsComponentController<OdsPopover> {

if(event.key === "Escape") {
this.logger.log('EscapeKey on trigger');
if(this.component.surface) {
this.component.surface.opened = false;
}
this.closeSurface();
}
}

Expand All @@ -59,9 +57,7 @@ export class OdsPopoverController extends OdsComponentController<OdsPopover> {
handleSurfaceKey(event: KeyboardEvent): void {
if (event.key === "Escape") {
this.logger.log('EscapeKey in surface');
if(this.component.surface) {
this.component.surface.opened = false;
}
this.closeSurface();
}
}

Expand All @@ -73,7 +69,7 @@ export class OdsPopoverController extends OdsComponentController<OdsPopover> {
return;
} else {
this.logger.log('Click outside component while it is opened');
this.component.surface.opened = false;
this.closeSurface();
}
}

Expand All @@ -82,7 +78,7 @@ export class OdsPopoverController extends OdsComponentController<OdsPopover> {
*/
closeSurface(): void {
if (this.component.surface && this.component.surface.opened) {
this.component.surface.opened = false;
this.component.surface.close();
}
}

Expand Down

This file was deleted.

0 comments on commit 52e75ad

Please sign in to comment.