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

ember-ladda-button

v2.2.2

Published

Ember wrapper for Ladda spinner buttons.

Downloads

452

Readme

ember-ladda-button

Ember wrapper for Ladda spinner buttons.

Installation

ember install ember-ladda-button

Usage

The button is themeless, so you will need to style it yourself.

Example usage:

<LaddaButton
  @action={{this.functionThatDoesNotReturnPromise}}
  @buttonStyle="zoom-out"
  @inFlight={{this.inFlight}}
  @text="My Button"
  @type="submit"
/>

<LaddaButton
  @action={{this.functionThatReturnsPromise}}
  @buttonStyle="expand-down"
  @longAction={{this.otherFunctionThatReturnsPromise}}
  @longDelay={{400}}
  as |longPress longProgress|
>
  {{#if longPress}}
    Long Press Text
  {{else}}
    Short Press Text
  {{/if}}

  {{longProgress}}% of the way to a long press!
</LaddaButton>

You can set the default spinner style attributes using the included service:

@service laddaButton;

constructor() {
  super(...arguments);

  this.laddaButton.buttonStyle = 'expand-left';
  this.laddaButton.spinnerColor = '#007eff';
  this.laddaButton.spinnerLines = 10;
  this.laddaButton.spinnerSize = 30;
}

The arguments you can pass are:

  • action - The function to call when the button is clicked. If this returns a promise, the button will start spinning when it is clicked, and stop spinning when the promise resolves or rejects. (defaults to undefined)

  • actionWithEvent - Identical to action except the click event is passed through as the first arg. (defaults to undefined)

  • buttonStyle - How the spinner should appear while it is active - 'expand-left' | 'expand-right' | 'expand-up' | 'expand-down' | 'contract' | 'contract-overlay' | 'zoom-in' | 'zoom-out' | 'slide-left' | 'slide-right' | 'slide-up' | 'slide-down' - (defaults to 'expand-right')

  • disabled - The disabled attribute for the button element - (defaults to false)

  • inFlight - Whether the button should currently be spinning (alternative to returning a promise in action) - (defaults to false)

  • longAction - Identical to action except will be called after the button is held for longDelayms (see below) (defaults to undefined)

  • longActionWithEvent - Identical to longAction except the click event is passed through as the first arg. (defaults to undefined)

  • longDelay - How many milliseconds it should take before the button has been considered long pressed (see longAction). If no value is passed, long press functionality will be disabled. longPress and longProgress are yielded when passing a block for updating the appearance (defaults to undefined)

  • spinnerColor - The colour of the spinner - any valid CSS colour value - (defaults to #fff)

  • spinnerLines - The number of lines to be displayed in the spinner - (defaults to 12)

  • spinnerSize- Pixel dimensions of the spinner - (defaults to dynamic size based on the button height)

  • text - Text to be displayed on the button (alternative to passing a block) (defaults to undefined)

  • type - The type attribute for the button element - button | reset | submit - (defaults to button)