@exmg/exmg-dialogs
TypeScript icon, indicating that this package has built-in type declarations

8.2.3 • Public • Published

<exmg-dialogs> Published on npm

Exmg Dialogs

Form Dialog

Form dialogs will handle styling, validation and make form submit easier. Also a loading indicator will be shown during the submit handling.

Example of implementation in html

<exmg-dialog-form title="Create account" button-copy="Save" @submit="${this.createAccount}">
  <paper-input name="name" label="Name" required></paper-input>
  <paper-input name="password" label="Password" required></paper-input>
</exmg-dialog-form>

Example of how submit could be handled

createAccount(e) {
  const {detail, target} = e;
  const {name, password} = detail;

  try {
    // Throw error to simulate error
    if(password.length < 6) {
      throw Error('User password to simple')
    }

    // Do server call

    // notify dialog successfull
    target.done();
  } catch (error) {
    target.handleError(error);
  }
}

Info Dialog

Info dialogs will handle styling, and content. Will throw a done event once the user clicked the button.

Example of implementation in html

<exmg-dialog-info button-copy="Continue" @done="${this.done}">
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet pharetra turpis. Nullam tincidunt aliquet
    condimentum.
  </p>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet pharetra turpis. Nullam tincidunt aliquet
    condimentum.
  </p>
</exmg-dialog-info>

Example of implementation in html without close button option

<exmg-dialog-info button-copy="Continue" hide-close-button @done="${this.done}">
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet pharetra turpis. Nullam tincidunt aliquet
    condimentum.
  </p>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet pharetra turpis. Nullam tincidunt aliquet
    condimentum.
  </p>
</exmg-dialog-info>

Example of how done could be handled

done(e) {
  const {target} = e;
  // Closes the dialog ...
  target.close();
}

Confirmation Dialogs

Easy way to display a pre styled confirmation dialog.

Example

<exmg-dialog-confirm
  title="Confirmation"
  message="Are you sure you want to delete this item?"
  button-copy="Delete account"
  @submit="${this.deleteItem}"
>
</exmg-dialog-confirm>
deleteItem(e) {
  const {target} = e;
  try {
    // Do server call

    // notify dialog successfull
    target.done();
  } catch (error) {
    target.error(error);
  }
}

API

<exmg-dialog-form />

Property Usage
title: string Displayed title of the Dialog
button-copy: string Displayed text of the submit button
hide-close-button: boolean If set to true the dialog will not show a close icon
error-message: string Error text to display when the form is in error state
@submit Event thrown when hitting the submit button, will serialize the form and return values in detail of the event
@cancel Event thrown when hitting the cancel button

<exmg-dialog-confirm />

Property Usage
title: string Displayed title of the Dialog
message: string Displayed message of the Dialog
button-copy: string Displayed text of the submit button
hide-close-button: boolean If set to true the dialog will not show a close icon
error-message: string Error text to display when the form is in error state
@submit Event thrown when hitting the submit button, will serialize the form and return values in detail of the event
@cancel Event thrown when hitting the cancel button

<exmg-dialog-confirm />

This element exposes a slot to wrap up any content you put in.

Property Usage
button-copy: string Displayed text of the submit button
hide-close-button: boolean If set to true the dialog will not show a close icon
button-secondary: boolean If set to true the button will be with secondary theme
@done Event thrown when hitting the main button

Additional references

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
8.2.367latest

Version History

VersionDownloads (Last 7 Days)Published
8.2.367
8.2.263
8.2.17
8.2.01
9.0.120
9.0.110
9.0.100
9.0.90
9.0.80
9.0.70
9.0.60
9.0.50
9.0.40
9.0.30
9.0.11
8.1.400
8.1.390
8.1.380
8.1.370
8.1.360
8.1.350
8.1.330
8.1.320
8.1.310
8.1.290
8.1.280
8.1.250
8.1.240
8.1.230
8.1.220
8.1.200
8.1.170
8.1.160
8.1.150
8.1.140
8.1.130
8.1.120
8.1.110
8.1.101
8.1.90
8.1.70
8.1.50
8.1.40
8.1.30
8.1.20
8.1.10
8.1.00
8.0.31
8.0.20
8.0.10
8.0.00
6.0.40
6.0.30
6.0.20
6.0.10
6.0.00
5.1.71
5.1.60
5.1.50
5.1.40
5.1.30
5.1.20
5.1.10
5.1.00
5.0.50
5.0.40
5.0.30
5.0.20
5.0.10
5.0.00
4.1.30
4.1.20
4.1.10
4.1.01
4.0.30
4.0.20

Package Sidebar

Install

npm i @exmg/exmg-dialogs

Weekly Downloads

143

Version

8.2.3

License

MIT

Unpacked Size

58.6 kB

Total Files

23

Last publish

Collaborators

  • licenses
  • livery-ci
  • exm_erwingoossen
  • martinkolkman
  • em-jeroenv
  • nicholas-exmachina
  • marksmits
  • difosfor
  • tylerexmg
  • padamieo_exmachina
  • albert_exm
  • rdrgcnn
  • sander_exmachina
  • joepadmiraal
  • exmachina-ci
  • remonvv
  • kjelles