Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exmg/exm-form-drawer

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exmg/exm-form-drawer

Form side drawer element

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-83.78%
Maintainers
0
Weekly downloads
 
Created
Source

<exm-form-drawer> Published on npm

This package provides dialog drawer functionality.

Components included:

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

Install

npm install @exmg/exm-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/exm-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

<exm-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.

<exm-form-drawer>

Wraps around exm-drawer.

Provides form functionality to drawer:

  • submit and cancel buttons
  • title
  • material styling

API

Slots

NameDescription
defaultForm elements within drawer

Properties/Attributes

NameTypeDefaultDescription
openedbooleanNonewhether or not drawer is visible
no-cancel-on-outside-clickbooleanNonewhether or not clicking outside drawer should close drawer
submit-btn-titlestringNonetitle of submit button. Default "Submit"
cancel-btn-titlestringNonetitle of cancel button. Default "Cancel"
keep-opened-on-submit-successbooleanNonewhether or not drawer should be hidden after successful form submission
reset-form-on-submit-successbooleanNonewhether or not drawer form should be reset after successful form submission

Events

NameDescription
exm-drawer-opened-changedwhen drawer shown/hidden

CSS Custom Properties

NameDescription
--exm-drawer-colorset the height of slot container - handy when wanting to control max-height of form.
--exm-drawer-bg-colorset the padding right for the form internal element.
--mdc-theme-primaryNone
--mdc-theme-on-surfaceNone
--mdc-theme-surfaceNone
--exm-form-drawer-header-separator-colorColor of header seperator of form
--exm-drawer-max-widthMax width of drawer
Notes about drawer form

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

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

Usage

Form drawer

<exm-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}"
  @exm-drawer-opened-changed="${this.handleOpenedChanged}"
  submit-btn-title="Create"
  @submit="${this.onSubmit}"
  @cancel="${this.onCancel}"
>
  <span slot="title">New event</span>
  <exm-paper-combobox label="Type" name="type" selected="0" always-float-label>
    <paper-item>Trivia</paper-item>
    <paper-item>Other</paper-item>
  </exm-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 />
  <exm-button unelevated> + Add answer </exm-button>
</exm-form-drawer>

Additional references

Keywords

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc