# @webapp-suite/elements.dialog

Latest version **0.10.1** (published 2021-11-01) · 0 weekly downloads

## Install

```sh
npm install @webapp-suite/elements.dialog
pnpm add @webapp-suite/elements.dialog
yarn add @webapp-suite/elements.dialog
bun add @webapp-suite/elements.dialog
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.1 |
| Published | 2021-11-01 |
| First published | 2021-03-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 208 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | kimigao |

## Links

- npm: https://www.npmjs.com/package/@webapp-suite/elements.dialog
- Repository: https://github.com/webapp-suite/elements
- Homepage: https://github.com/webapp-suite/elements#readme
- Issues: https://github.com/webapp-suite/elements/issues
- npm.io page: https://npm.io/package/@webapp-suite/elements.dialog

## Dependencies (6)

- [@webapp-suite/elements](https://npm.io/package/@webapp-suite/elements.md) ^0.10.0
- [@webapp-suite/elements.icon](https://npm.io/package/@webapp-suite/elements.icon.md) ^0.10.0
- [@webapp-suite/elements.modal](https://npm.io/package/@webapp-suite/elements.modal.md) ^0.10.1
- [@webapp-suite/elements.button](https://npm.io/package/@webapp-suite/elements.button.md) ^0.10.1
- [@webapp-suite/elements.typography](https://npm.io/package/@webapp-suite/elements.typography.md) ^0.10.0
- [@webapp-suite/elements.button-group](https://npm.io/package/@webapp-suite/elements.button-group.md) ^0.10.0

## Recent versions

- 0.10.1 (latest) — 2021-11-01
- 0.10.0 — 2021-10-20
- 0.9.0 — 2021-07-21
- 0.8.2 — 2021-06-21
- 0.8.1 — 2021-06-21
- 0.8.0 — 2021-06-21
- 0.7.0 — 2021-06-21
- 0.6.0 — 2021-06-17
- 0.5.0 — 2021-05-31
- 0.4.0 — 2021-05-04
- 0.3.1 — 2021-04-07
- 0.3.0 — 2021-04-05
- 0.2.0 — 2021-03-17
- 0.1.0 — 2021-03-13

## README

<h1 align="center">
    <a href="">
      <img alt="webapp-suite" src="https://webapp-suite.com/wp-content/themes/webapp-suite/img/brand/logo-black.png"/>
    </a>
</h1>

<h1 align="center">Elements - dialog</h1>

<p align="center">
  Part of the reusable webapp-suite UI Components as Web Components.
    <a href="https://webapp-suite.github.io/elements/?path=/story/ts-dialog--default">
      Demo
    </a>
</p>

<p align="center">
    <a href="https://www.npmjs.com/package/@webapp-suite/elements.dialog">
      <img alt="NPM Version" src="https://badgen.net/npm/v/@webapp-suite/elements.dialog" height="20"/>
    </a>
    <a href="https://npmcharts.com/compare/@webapp-suite/elements.dialog?minimal=true">
		  <img alt="Downloads per month" src="https://badgen.net/npm/dm/@webapp-suite/elements.dialog" height="20"/>
		</a>
		<a href="https://www.npmjs.com/browse/depended/@webapp-suite/elements.dialog">
		  <img alt="Dependent packages" src="https://badgen.net/npm/dependents/@webapp-suite/elements.dialog" height="20"/>
		</a>
</p>

<style>
  table {
      width:100%;
  }
</style>

## ➤ Properties

| Property | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| visible | data-visible | Boolean | false | Dialog can be toggled by add/removing this attribute |
| text | text | String |  | Text content of the modal |
| icon | icon | String |  | If you need a different icon that default ones, you can use one of Elements icon names |
| type | type | String | dialogTypes.INFO | `info`, `warning`, `danger` |
| translations | translations | Object |  | can be used for customizing the buttons text and translations |
| focused | focused | String | 'cancel' | set the default focus on the button, either `accept` or `cancel` |
| primary | primary | String |  | either `accept` or `cancel` can be used to change the button type, based on the dialog type, by default both are secondary |
| renderButtons | renderButtons | Boolean | false | INTERNAL |

## ➤ Slots

| Name | Description |
| --- | --- |
| content | If in rare cases you need to have more complex content than text property, you can override the text by using this slot |
| extra-buttons | To add more options to the dialog, between accept and cancel buttons |

## ➤ Events

| Name   | Description                                    | Payload |
| ------ | ---------------------------------------------- | ------- |
| accept | Emitted when the user choose the accept option |         |
| cancel | Emitted when the user choose the cancel option |         |

## ➤ How to use it

- Install the package of dialog

```shell
$ npm i @webapp-suite/elements.dialog --save
```

- Import the component

```js
import '@webapp-suite/elements.dialog';
```

or

```html
<script src="node_modules/@webapp-suite/elements.dialog/lib/dialog.umd.js"></script>
```

- Use it like [demo]("https://webapp-suite.github.io/elements/?path=/story/ts-dialog--default")

- Our components rely on having the `Open Sans` available, You can see the `font-weight` and `font-style` you need to load [here](https://github.com/webapp-suite/elements/blob/master/packages/core/src/fonts.css), or you can just load it from our package (for now)

```html
<link rel="stylesheet" href="node_modules/@webapp-suite/elements/src/fonts.css" />
```

## ➤ Polyfills

For supporting IE11 you need to add couple of things

- Don't shim CSS Custom Properties in IE11

```html
<!-- Place this in the <head>, before the Web Component polyfills are loaded -->
<script>
	if (!window.Promise) {
		window.ShadyCSS = { nativeCss: true };
	}
</script>
```

##### You have two options for polyfills library:

1. Use [`@open-wc/polyfills-loader`](https://github.com/open-wc/open-wc/tree/master/packages/polyfills-loader)

- Installation

```shell
$ npm i @open-wc/polyfills-loader
```

- Load it

```js
import loadPolyfills from '@open-wc/polyfills-loader';

loadPolyfills().then(() => import('./my-app.js'));
```

2. Use [`@webcomponents/webcomponentsjs`](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs)

- Installation

```hell
$ npm i @webcomponents/webcomponentsjs --save
```

- Enable ES5 class-less Custom Elements

```html
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
```

- Load appropriate polyfills and shims with [`@webcomponents/webcomponentsjs`](https://github.com/webcomponents/webcomponentsjs)

```html
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js" defer></script>
```

## ➤ How to contribute

Thanks for your interest and help!

- First thing you need to do is read this [[Component Checklist](https://github.com/webapp-suite/elements/wiki/Component-checklist)] which contains lots of important information about what you need to consider when you are creating/changing components

##### [General info](https://github.com/webapp-suite/elements/wiki/Useful-materials-starter)

You can find some [links to useful materials](https://github.com/webapp-suite/elements/wiki/Useful-materials-starter) about what we are using and some tutorials and articles that can help you get started.

## ➤ [Polyfill Limitations](https://github.com/webapp-suite/elements/wiki/Polyfill-Limitations)

You can see a list of limitations that we should watch out for, [here](https://github.com/webapp-suite/elements/wiki/Polyfill-Limitations)

## ➤ License

- You can always create forks on GitHub, submit Issues and Pull Requests.
- You can only use webapp-suite Elements to make apps on a webapp-suite platform, e.g. webapp-suite.com.
- You can fix a bug until the bugfix is deployed by webapp-suite.
- You can host webapp-suite Elements yourself.
- If you want to make a bigger change or just want to talk with us, reach out to our team here on GitHub.

You can read the full license agreement in the [LICENSE.md](https://github.com/webapp-suite/elements/blob/master/LICENSE.md).

---
_Source: https://npm.io/package/@webapp-suite/elements.dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
