npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@exmg/exmg-form-drawer

v8.2.3

Published

Form side drawer element

Downloads

271

Readme

<exmg-form-drawer> Published on npm

This package provides dialog drawer functionality.

Components included:

  1. exmg-drawer - basic component
  2. exmg-form-drawer - form drawer

Install

npm install @exmg/exmg-form-drawer

Before start ensure that you have installed web-animation-js. It is required by @polymer/paper-dialog.

npm install web-animation-js

Load this script in index.html

<!-- Ensure Web Animations polyfill is loaded -->
<script src="../node_modules/web-animations-js/web-animations-next-lite.min.js"></script>

Some dependencies @exmg/exmg-paper-combobox use @apply to apply css mixins. This require to load script in index.html

<script src="../node_modules/@webcomponents/shadycss/apply-shim.min.js"></script>

Components

<exmg-drawer>

It is basic component that probably should not be used directly. It serves only as drawer without form functionality, so it is content agnostic. You can pass any dom markup as children of this component.

<exmg-form-drawer>

Wraps around exmg-drawer.

Provides form functionality to drawer:

  • submit and cancel buttons
  • title
  • material styling

API

Slots

| Name | Description | | --------- | --------------------------- | | default | Form elements within drawer |

Properties/Attributes

| Name | Type | Default | Description | | ------------------------------- | --------- | ------- | --------------------------------------------------------------------------- | | opened | boolean | None | whether or not drawer is visible | | no-cancel-on-outside-click | boolean | None | whether or not clicking outside drawer should close drawer | | submit-btn-title | string | None | title of submit button. Default "Submit" | | cancel-btn-title | string | None | title of cancel button. Default "Cancel" | | keep-opened-on-submit-success | boolean | None | whether or not drawer should be hidden after successful form submission | | reset-form-on-submit-success | boolean | None | whether or not drawer form should be reset after successful form submission |

Events

| Name | Description | | ---------------------------- | ------------------------ | | exmg-drawer-opened-changed | when drawer shown/hidden |

CSS Custom Properties

| Name | Description | | ------------------------------------------- | ------------------------------------------------------------------------------------ | | --exmg-drawer-color | set the height of slot container - handy when wanting to control max-height of form. | | --exmg-drawer-bg-color | set the padding right for the form internal element. | | --mdc-theme-primary | None | | --mdc-theme-on-surface | None | | --mdc-theme-surface | None | | --exmg-form-drawer-header-separator-color | Color of header seperator of form | | --exmg-drawer-max-width | Max width of drawer |

Notes about drawer form

All dom markup passed as children into exmg-form-drawer will be wrapped into exmg-form underhood.

To properly handle form submission, you should call done() or error() on form instance after receiving submit event from exmg-form-drawer. Please read https://github.com/ExmgElements/exmg-form docs for more info.

Usage

Form drawer

<exmg-form-drawer
  ?opened="${this.opened}"
  ?keep-opened-on-submit-success="${this.keepOpenedOnSubmitSuccess}"
  ?reset-form-on-submit-success="${this.resetFormOnSubmitSuccess}"
  ?no-cancel-on-outside-click="${this.noCancelOnOutsideClick}"
  @exmg-drawer-opened-changed="${this.handleOpenedChanged}"
  submit-btn-title="Create"
  @submit="${this.onSubmit}"
  @cancel="${this.onCancel}"
>
  <span slot="title">New event</span>
  <exmg-paper-combobox label="Type" name="type" selected="0" always-float-label>
    <paper-item>Trivia</paper-item>
    <paper-item>Other</paper-item>
  </exmg-paper-combobox>
  <paper-input name="question" label="Question" value="Who's Dylan Hartigan's favorite artist?" required></paper-input>
  <paper-input name="answer_a" label="Answer A" value="Beyoncé"></paper-input>
  <paper-input name="answer_b" label="Answer B" value="Eminem"></paper-input>
  <paper-input name="answer_c" label="Answer C" value="Ariana Grande"></paper-input>
  <br />
  <exmg-button unelevated> + Add answer </exmg-button>
</exmg-form-drawer>

Additional references