• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Ember CLI Addon that provides a variety of UI components.

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/sl-ember-components to work our issues.

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

Throughput Graph

What sl-ember-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/sl-ember-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/sl-ember-components/#/browsers

Demo

Live

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

Development Environment

Installation

  • git clone this repository
  • npm install
  • bower install

Running

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

Documentation

How to use this addon in your application

Installation

ember install sl-ember-components

Error Handling

The components in sl-ember-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 'sl-ember-components/utils/error';

var App;

...

Ember.onerror = function( error ) {

    if ( errorWasThrown( error ) ) {
        // This will catch any errors coming from the sl-ember-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 'sl-ember-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/sl-ember-components for these values.

Customizing a component's CSS prefix

All components share a common CSS prefix, namely, sl-ember-components. To target and style a particular component, for example the sl-grid component, one would use the CSS class selector .sl-ember-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 sl-ember-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, {
    'sl-ember-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 sl-ember-components as shown below.

@import 'sl-ember-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:

.sl-ember-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:

.sl-ember-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/sl-ember-components

Versioning

Employs Semantic Versioning 2.0.0

Contribution

See CONTRIBUTING.md

Copyright and License

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

sl-ember-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.

More Repositories

1

softlayer-python

A set of Python libraries that assist in calling the SoftLayer API.
Python
152
star
2

swftp

An FTP and SFTP interface for OpenStack Object Storage (swift).
Python
57
star
3

softlayer-ruby

http://softlayer.github.io/softlayer-ruby/
Ruby
54
star
4

softlayer-go

SoftLayer API Client for the Go Language
Go
53
star
5

jumpgate

A simple library to make more clouds compatible with OpenStack.
Python
46
star
6

softlayer-api-php-client

A set of PHP libraries that assist in calling the SoftLayer API.
PHP
44
star
7

terraform-provider-softlayer

a Terraform (http://terraform.io) provider for interacting with SoftLayer (https://www.softlayer.com)
Go
40
star
8

ember-style-guide

40
star
9

haproxy-statsd

Python
35
star
10

softlayer-object-storage-php

SoftLayer Object Storage PHP Client
PHP
28
star
11

chef-openstack

These are a concise set of recipes for OpenStack and SoftLayer servers. In addition, the following site provides a getting started guide for OpenStack on SoftLayer.
Ruby
27
star
12

knife-softlayer

Ruby
25
star
13

softlayer-java

SoftLayer API Client for Java
Java
24
star
14

ember-cli-jsdoc

An Ember CLI addon to generate HTML documentation from JSDoc comments in the source code.
JavaScript
21
star
15

softlayer-object-storage-python

SoftLayer Object Storage Python Client
Python
19
star
16

sl-ember-behavior

An Ember CLI Addon that provides the ability to define and enforce behaviors, combining the concepts of whether a user has permission to perform an action and whether that action can currently be performed.
JavaScript
17
star
17

xapi-go

A XAPI (XenServer API) go binding with native interfaces and structs. Still a work in progress, welcoming pull requests.
Go
15
star
18

.NET-REST-Tool

A handy .NET-based REST troubleshooting tool with C# and vb.NET source available.
C#
14
star
19

mq

Go
14
star
20

softlayer.github.io

A collection of SoftLayer API examples in a variety of languages
HTML
13
star
21

sl-ember-store

An Ember CLI Addon to provide a model layer for an Ember application.
JavaScript
12
star
22

softlayer-object-storage-backup

Python
11
star
23

softlayer-api-perl-client

A set of Perl libraries that assist in calling the SoftLayer API.
Perl
11
star
24

softlayer-object-storage-ruby

SoftLayer Object Storage Ruby Client
Ruby
10
star
25

sl-ember-modelize

An Ember CLI Addon that takes a nested Plain Old Javascript Object (POJO) and returns an Ember Object, resolving any keys to "models" by using the Ember resolver and creating new objects of that model type.
JavaScript
9
star
26

softlayer-object-storage-java

SoftLayer Object Storage Java Client
Java
9
star
27

slick

Python
8
star
28

Twitter-Search-Monitor

Python
6
star
29

stratos

A white-label SoftLayer portal
Ruby
6
star
30

sl-ember-test-helpers

An Ember CLI Addon that provides and registers test helpers for use in the testing of your application
JavaScript
6
star
31

sl-ember-translate

An Ember CLI Addon that provides the ability to lookup a dictionary value either through method calls or via a component in your templates.
JavaScript
4
star
32

softlayer-cinder-driver

Python
3
star
33

bluemix-cloudbase-init

Python
3
star
34

softlayer-cli

This repository houses the code that powers the ibmcloud-cli sl command
Go
2
star
35

devops101

A sample project to demo Bluemix Devops capabilities.
HTML
2
star
36

chef-swftp

Ruby
2
star
37

ironic-inventory-integrator

Python
1
star
38

githubio_source

Templates files for generating softlayer.github.io
HTML
1
star
39

kleiber

Python
1
star
40

keystone-pam

C
1
star
41

stack-dev-tools

Python
1
star