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

parlor-sl-components

v0.13.6

Published

Ember CLI Addon - UI components library

Downloads

4

Readme

Latest Release Ember CLI version License Downloads

Dependencies Dev Dependencies

Build Status Code Climate Ember Observer Inch CI Join us on Slack

We use https://waffle.io/softlayer/parlor-sl-components to work our issues.

Stories in Ready Stories in In Progress Stories in Ready For Review Stories in In Review

Throughput Graph

What parlor-sl-components is

An Ember CLI Addon that provides UI components compatible with Ember.js and Twitter Bootstrap.

This addon is currently BETA. View the Roadmap we're following for a 1.0.0+ release.

Examples and documentation on how to use each component can be viewed at http://softlayer.github.io/parlor-sl-components/ which is served from the gh-pages branch of this repository.

Components provided

  • sl-alert
  • sl-button
  • sl-calendar
  • sl-chart (only free for non-commercial use without a Highcharts license)
  • sl-checkbox
  • sl-date-picker
  • sl-date-range-picker
  • sl-date-time
  • sl-drop-button
  • sl-grid
  • sl-input
  • sl-menu
  • sl-modal
  • sl-pagination
  • sl-panel
  • sl-progress-bar
  • sl-radio
  • sl-radio-group
  • sl-select
  • sl-span
  • sl-tab-panel
  • sl-textarea
  • sl-tooltip

Mixins provided

sl-component-input-id

Provides unique id that a component can assign to an input and a label's "for" attribute.

sl-input-based

Provides state properties for input element based components.

sl-namespace

Namespace component events by elementId

sl-tooltip-enabled

Provides Bootstrap tooltip functionality bindings, for both popovers and plain tooltips.

Utility Classes provided

containsValue

Check whether a value is a valid value in object.

warn

Provides a mechanism for initiating console.warn()s

error

Provides a way for individual components to throw errors that are able to be recognized by methods inside of a consuming application's Ember.onerror() function. For more details reference the Error Handling section below.

CSS Classes provided

sl-loading

Apply a loading indicator to an element. See the Loading Indicator section for more information.


All of this functionality is provided through a combination of leveraging the best-of-breed of other component offerings as well as our own implementations when the existing offerings were deficient. Existing offerings that were leveraged include:

LICENSE WARNING

While this library is MIT licensed not all of the third-party component libraries are. Specifically, Highcharts is only free for non-commercial use and requires a license for any other use. See this FAQ page for more information.

Other libraries that are not MIT licensed, though it should not pose a problem, are:

Supported browsers

See http://softlayer.github.io/parlor-sl-components/#/browsers

Demo

Live

http://softlayer.github.io/parlor-sl-components/#/demos

Development Environment

Installation

  • git clone this repository
  • npm install
  • bower install

Running

  • ember serve
  • View the demo at http://localhost:4200

For more information on using ember-cli, visit http://www.ember-cli.com/.

Documentation

  • ember ember-cli-jsoc or npm run docs (shortcut setup in this repo)
  • Visit http://localhost:4200/docs

How to use this addon in your application

Installation

ember install parlor-sl-components

Error Handling

The components in parlor-sl-components will throw errors if the components are used incorrectly. For example, the sl-radio-group component requires that a name property be passed with the component. If one is not passed an error will be thrown with the name of the component that is throwing the error (sl-radio-group) and the message saying "The name property must be set".

If you wish to capture these errors and pass them along to your error logging application you can do so by adding the following lines to your application's app/app.js file:

import { errorWasThrown, isErrorInstanceOf } from 'parlor-sl-components/utils/error';

var App;

...

Ember.onerror = function( error ) {

    if ( errorWasThrown( error ) ) {
        // This will catch any errors coming from the parlor-sl-components addon
        // Insert the code you would use to send to your error logging application here
    }

    if ( isErrorInstanceOf( 'radioGroup' ) ) {
        // Use this option if you want granularity at the individual component level
        // Insert the code you would use to send to your error logging application here
    }

    ...Repeat the above for each component that you want to watch for where "radioGroup"
    is the name of the component "sl-radio-group". So if you wanted to watch "sl-menu" you
    would replace "radioGroup" with "menu". To see what can be used look at addon/utils/error.js.

    console.error( error ); // Still send the error to the console
};

Fingerprinting Assets

If fingerprinting is enabled in the consuming application, then by default the following font types are fingerprinted:

eot, svg, ttf, woff, woff2

IMPORTANT: If you list extensions that are not exact matches to the default ones set by broccoli-asset-rev, you will need to add the desired font extensions to the extensions property in the consuming application's fingerprinting settings in the ember-cli-build.js file, as demonstrated below:

const EmberApp = require( 'ember-cli/lib/broccoli/ember-app' );
const env = require( './config/environment' );

module.exports = function( defaults ) {
    const app = new EmberApp( defaults, {
        fingerprint: {
            enabled: true,
            exclude: [],
            extensions: [ 'png', 'jpg', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2' ],
            prepend: env().baseAssetsURL,
            replaceExtensions: [ 'html', 'css', 'js' ]
        }
    });

    return app.toTree();
};

Styling

If you wish to modify the styling of the components you have two options for doing so.

The first is to define your CSS declarations in your application's app/styles folder.

The second is to build the CSS declarations from the LESS source files. This will layer any of your LESS values on top of this addon's LESS values which are then in turn laid on top of Twitter Bootstrap's. This does require you though to use LESS for your entire application's CSS generation. To use LESS, run

npm install --save-dev ember-cli-less

then create a app/styles/app.less file and add this to it:

@import 'parlor-sl-components';

Finally, you will need to run broccoli-autoprefixer against the updated Twitter Bootstrap and/or LESS files. To do so, run

npm install --save-dev broccoli-autoprefixer

and set the browsers option in your ember-cli-build.js file to:

var autoprefixer = require( 'broccoli-autoprefixer' );
...
tree = autoprefixer(
    tree,
    {
        browsers: [
            'Android 2.3',
            'Android >= 4',
            'Chrome >= 20',
            'Firefox >= 24',
            'Explorer >= 8',
            'iOS >= 6',
            'Opera >= 12',
            'Safari >= 6'
        ]
    }
);

The options listed in browsers above are the recommended settings by Twitter Bootstrap

Component Classes

Each component has its own unique CSS class selector so that it is easy to target and style specific components. Refer to each component's respective documentation at http://softlayer.github.io/parlor-sl-components for these values.

Customizing a component's CSS prefix

All components share a common CSS prefix, namely, parlor-sl-components. To target and style a particular component, for example the sl-grid component, one would use the CSS class selector .parlor-sl-components-grid. The reason for such a verbose selector is to prevent styling conflicts with other libraries. You can customize the prefix value and change it from the default parlor-sl-components to whatever you would like. Depending on what option you picked in the Styling section, the steps below describe how you would go about customizing the CSS prefix.

To get started, you will need to add a config value to your ember-cli-build.js

var app = new EmberApp(defaults, {
    'parlor-sl-components': {
        componentClassPrefix: 'custom-prefix' // specify your custom prefix here
    }
});

If you are not using LESS as a preprocessor then nothing else needs to be done on your part. You should now be able to target components using your custom prefix (e.g. in the case of sl-grid you should now be able to use the CSS class selector .custom-prefix-grid).

If you are using LESS then you will need to set a @component-class-prefix variable below the line of code which imports the parlor-sl-components as shown below.

@import 'parlor-sl-components'
@component-class-prefix: custom-prefix;

You should now be able to target components using your custom prefix (e.g. in the case of sl-grid you should now be able to use the CSS class selector .custom-prefix-grid).

Note: If you have already served your application, remember to re-serve after making changes to the ember-cli-build.js file so changes can take affect.

Icons

If you wish to use different Glyphicons than the defaut ones, you simply only need to redefine the content definition for the appropriate styles. For example, to replace the "Show All" icon used for the sl-menu component, use the following declaration:

.parlor-sl-components-menu .sl-icon-show-all:before {
    content: "\e011";
}

If you wish to use a font library other than Glyphicons Halflings you will need to take a few extra steps but it is still very easy to do. The first step is to make sure you have properly installed, and are including, your desired font library. Next, you need to define a [class^="sl-icon-"], [class*=" sl-icon-"] declaration and copy your font library's main css declaration into it. The example below demonstrates this, replacing Glyphicons Halflings with Font Awesome:

[class^="sl-icon-"], [class*=" sl-icon-"] {
    display: inline-block;
    font: normal normal normal 14px/1 FontAwesome;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

Then you only need to redefine the content definition in the appropriate styles, as previously explained above:

.parlor-sl-components-menu .sl-icon-show-all:before {
    content: "\f270";
}

Loading indicator

A loading indicator can be made to display over an element's content, masking it from view, by simply adding the "sl-loading" class to it. This class blurs the content via a dark-colored mask. If a lighter mask is desired then add the additional "inverse" class to the same element.

Examples

Dark Mask Example Light Mask Example

If you wish to modify the loading image displayed when applying the "sl-loading" class you can do so by either defining CSS declarations or setting LESS variable values, depending on which Styling approach you are using in your application.

To do so via CSS declarations, define the background-image property for the .sl-loading:after and .sl-loading.inverse:after selectors.

To do so via LESS, assign values to the @loading-spinner-light and @loading-spinner-dark variables.

Additional modifications can be applied to any of these selectors as well:

  • .sl-loading
  • .sl-loading:before
  • .sl-loading:after
  • .sl-loading.inverse:before
  • .sl-loading.inverse:after

Examples and documentation on how to use each component

Examples and documentation on how to use each component can be viewed at http://softlayer.github.io/parlor-sl-components

Versioning

Employs Semantic Versioning 2.0.0

Contribution

See CONTRIBUTING.md

Copyright and License

parlor-sl-components and its source files are Copyright © 2014-2015 SoftLayer Technologies, Inc. The software is MIT Licensed

parlor-sl-components leverages several third-party libraries which are not all MIT licensed. Specifically, Highcharts is only free for non-commercial use and requires a license for any other use. See this FAQ page for more information.

Other libraries that are not MIT licensed, though it should not pose a problem, are:

Warranty

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.