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

mdl-components-ext

v1.7.1

Published

Component extensions for the official Material Design Lite library

Downloads

10

Readme

Email npm version Software License

Introduction

The Material Design Lite (MDL) from Google is a really great thing if you want to create semantic websites with nice looking elements that also fit for mobile devices.

But sooner or later you may face the problem that the components provided by the MDL are not covers all your needs. For example you will need a component that works similar to your phones contact form when you deal with multiple similar data, like phone numbers: add and remove, change type, set value. Or you need a file uploader that has the style of the MDL. And so on.

This library provides different components as extensions to the official MDL library. Please read the The Material Design Lite license.

Requirements

Installation

You can easily install it via the NPM package manager:

npm install

How to use

The easy way:

The "geek" way:

  • Run the following commands to compile the scss files and compress css and js files:
library/create-package.sh
  • Include the generated files into your HTML and use the syntax described in each components' README.md file.

Extras

The componentRegister

As of version 1.7.0 the componentRegister is being introduced. It's purpose to collect all the Material* components instances and make it retrievable by DOM search:

<div class="mdl-file mdl-js-file mdl-file--floating-label" id="myFileInputElement">
    <input type="file" name="avatar" id="avatar" multiple="multiple" accept=".jpg,.gif,.png,.svg">
    <label class="mdl-file__label" for="avatar">Avatar</label>
    <span class="mdl-textfield__error">You can upload only images.</span>
</div>
var materialComponent = componentRegister.getComponentById('myFileInputElement');
materialComponent.resetInput_();

Use it carefully! At Google the developers hid these component instances by purpose and not because they don't know how to code. But unfortunately, their concept has some disturbing behaviour:

  • the developers can't retrieve the Component instances for a DOM element easily
  • the Component instances are protected only by the componentHandler. But if you reach a component instance, all the properties and methods are public.

And of course the componentRegistry in one hand makes it easy to get a component instance for a DOM element (if exists and registered), but it also bring up the problem with the scope. So be very very careful.

Plans for the future

  • Supply a standardized reset() function for all the MDL-Ext components.
  • If possible, add reset() function for the original MDL components.

Change Log