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

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

Latest version **1.2.0** (published 2021-03-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @advanced-rest-client/arc-overlay-mixin
pnpm add @advanced-rest-client/arc-overlay-mixin
yarn add @advanced-rest-client/arc-overlay-mixin
bun add @advanced-rest-client/arc-overlay-mixin
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-03-20 |
| First published | 2019-06-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 97.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | carowright, jarrodek, twoplustwoone, lbauret |
| Keywords | api-components, arc-components, mixins, web-components, overlay |

## Links

- npm: https://www.npmjs.com/package/@advanced-rest-client/arc-overlay-mixin
- Repository: https://github.com/advanced-rest-client/arc-overlay-mixin
- Issues: https://github.com/advanced-rest-client/arc-overlay-mixin/issues
- npm.io page: https://npm.io/package/@advanced-rest-client/arc-overlay-mixin

## Dependencies (5)

- [lit-html](https://npm.io/package/lit-html.md) ^1.3.0
- [lit-element](https://npm.io/package/lit-element.md) ^2.4.0
- [@open-wc/dedupe-mixin](https://npm.io/package/@open-wc/dedupe-mixin.md) ^1.3.0
- [@advanced-rest-client/arc-fit-mixin](https://npm.io/package/@advanced-rest-client/arc-fit-mixin.md) ^1.2.2
- [@advanced-rest-client/arc-resizable-mixin](https://npm.io/package/@advanced-rest-client/arc-resizable-mixin.md) ^1.2.0

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-03-20
- 1.2.0-preview (1.2-preview) — 2021-03-19
- 1.1.8 — 2021-03-12
- 1.1.7 — 2020-11-25
- 1.1.6 — 2020-10-02
- 1.1.5 — 2020-07-02
- 1.1.4 — 2020-06-24
- 1.1.3 — 2020-06-22
- 1.1.2 — 2020-06-17
- 1.1.1 — 2020-06-09
- 1.1.0 — 2020-06-09
- 1.0.4 — 2019-11-20
- 1.0.3 — 2019-07-26
- 1.0.2 — 2019-07-25
- 1.0.1 — 2019-06-10
- … 1 more at https://npm.io/package/@advanced-rest-client/arc-overlay-mixin/versions

## README

# ArcOverlayMixin

[![Published on NPM](https://img.shields.io/npm/v/@advanced-rest-client/arc-overlay-mixin.svg)](https://www.npmjs.com/package/@advanced-rest-client/arc-overlay-mixin)

[![Tests and publishing](https://github.com/advanced-rest-client/arc-overlay-mixin/actions/workflows/deployment.yml/badge.svg)](https://github.com/advanced-rest-client/arc-overlay-mixin/actions/workflows/deployment.yml)

This mixin is a port of [iron-overlay-behavior](https://github.com/PolymerElements/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](https://github.com/advanced-rest-client/arc-overlay-mixin/blob/master/demo/simple-overlay.html)
for an example.

## Usage

### Installation

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

### Example

```javascript
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

```bash
npm run test
```

### Demo

```bash
npm start
```

---
_Source: https://npm.io/package/@advanced-rest-client/arc-overlay-mixin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
