Socket
Socket
Sign inDemoInstall

@advanced-rest-client/arc-overlay-mixin

Package Overview
Dependencies
5
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @advanced-rest-client/arc-overlay-mixin

arc-overlay-mixin is a port of iron-overlay-behavior that works with web components


Version published
Weekly downloads
1.7K
increased by21.46%
Maintainers
4
Install size
1.17 MB
Created
Weekly downloads
 

Readme

Source

ArcOverlayMixin

Published on NPM

Tests and publishing

This mixin is a port of iron-overlay-behavior that works with LitElement.

Use ArcOverlayMixin to implement an element that can be hidden or shown, and displays on top of other content. It includes an optional backdrop, and can be used to implement a variety of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.

See the demo source code for an example.

Usage

Installation

npm i @advanced-rest-client/arc-overlay-mixin

Example

import { LitElement } from 'lit-element';
import { ArcOverlayMixin } from '@advanced-rest-client/arc-overlay-mixin';

class ArcOverlayImpl extends ArcOverlayMixin(LitElement) {
  static get properties() {
    return {
      myProp: { type: String }
    };
  }
}

Closing and canceling

An overlay may be hidden by closing or canceling. The difference between close and cancel is user intent. Closing generally implies that the user acknowledged the content on the overlay. By default, it will cancel whenever the user taps outside it or presses the escape key. This behavior is configurable with the nocancelonesckey and the nocancelonoutsideclick properties. close() should be called explicitly by the implementer when the user interacts with a control in the overlay element. When the dialog is canceled, the overlay fires an 'iron-overlay-canceled' event. Call preventDefault on this event to prevent the overlay from closing.

Positioning

By default the element is sized and positioned to fit and centered inside the window. You can position and size it manually using CSS. See ArcFitMixin.

Backdrop

Set the withbackdrop attribute to display a backdrop behind the overlay. The backdrop is appended to <body> and is of type <iron-overlay-backdrop>. See its doc page for styling options. In addition, with-backdrop will wrap the focus within the content in the light DOM. Override the _focusableNodes getter to achieve a different behavior.

Limitations

The element is styled to appear on top of other content by setting its z-index property. You must ensure no element has a stacking context with a higher z-index than its parent stacking context. You should place this element as a child of <body> whenever possible.

Development

Testing

npm run test

Demo

npm start

Keywords

FAQs

Last updated on 20 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc