All Projects → smile-io → ember-polaris

smile-io / ember-polaris

Licence: MIT License
An Ember addon for Shopify's Polaris design system

Programming Languages

javascript
184084 projects - #8 most used programming language
Handlebars
879 projects

Projects that are alternatives of or similar to ember-polaris

ember-cli-geo
Geolocation service for Ember.js web apps
Stars: ✭ 48 (-18.64%)
Mutual labels:  ember-cli, ember
git-task-list
Git Task Lists
Stars: ✭ 25 (-57.63%)
Mutual labels:  ember-cli, ember
ember-app-shell
No description or website provided.
Stars: ✭ 23 (-61.02%)
Mutual labels:  ember-cli, ember
ember-cli-new-version
A convention based update notification for Ember. With this addon, you can detect a new version and notify the user to refresh the page
Stars: ✭ 22 (-62.71%)
Mutual labels:  ember-cli, ember
ember-cli-ifa
Ember CLI addon for injecting fingerprinted asset map file into Ember app
Stars: ✭ 54 (-8.47%)
Mutual labels:  ember-cli, ember
ember-cli-qunit
QUnit testing package for ember-cli applications
Stars: ✭ 29 (-50.85%)
Mutual labels:  ember-cli, ember
labs-factfinder
New York City Census Reporting Tool
Stars: ✭ 34 (-42.37%)
Mutual labels:  ember-cli, ember
Ember Cli Notifications
⚛ Atom inspired notification messages for ember-cli
Stars: ✭ 168 (+184.75%)
Mutual labels:  ember-cli, ember
ember-link-action
Fire an action when LinkTo component transition happens
Stars: ✭ 86 (+45.76%)
Mutual labels:  ember-cli, ember
ember-popper
Popper.js for Ember
Stars: ✭ 38 (-35.59%)
Mutual labels:  ember-cli, ember
ember-cli-nouislider
{{range-slider}} component for ember-cli powered by noUiSlider
Stars: ✭ 43 (-27.12%)
Mutual labels:  ember-cli, ember
cli-guides
Step-by-step guides and tutorials for using the ember-cli to create apps and addons
Stars: ✭ 22 (-62.71%)
Mutual labels:  ember-cli, ember
ember-template-inspector
An ember add-on which opens the template file in the code editor while inspecting an element.
Stars: ✭ 15 (-74.58%)
Mutual labels:  ember-cli, ember
ember-cli-string-helpers
Set of the String helpers extracted from DockYard's ember-composable-helpers.
Stars: ✭ 73 (+23.73%)
Mutual labels:  ember-cli, ember
Intellij Emberjs
Ember.js support for JetBrains IDEs (IntelliJ, WebStorm, ...)
Stars: ✭ 202 (+242.37%)
Mutual labels:  ember-cli, ember
ember-cli-blog
Tom Dale's blog example updated for the Ember CLI
Stars: ✭ 87 (+47.46%)
Mutual labels:  ember-cli, ember
Ember Web App
NOTICE: official repository moved to https://github.com/zonkyio/ember-web-app
Stars: ✭ 143 (+142.37%)
Mutual labels:  ember-cli, ember
Ember Cli Mocha
Mocha and Chai tests for ember-cli applications
Stars: ✭ 147 (+149.15%)
Mutual labels:  ember-cli, ember
ember-content-loader
Easy, customizable content placeholders / skeletons screens
Stars: ✭ 41 (-30.51%)
Mutual labels:  ember-cli, ember
ember-language-server
Language Server Protocol implementation for Ember.js projects
Stars: ✭ 93 (+57.63%)
Mutual labels:  ember-cli, ember

ember-polaris

image

ember-polaris is an ember-cli addon to make Shopify's Polaris design system accessible to Ember developers.

Status

NOTE: this addon is still in development. As such, not all of the components available in the React component library have been built yet, and some features of those which have been built are currently unimplemented. Check the component list for a list of those which are currently available.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

Install ember-polaris using ember-cli:

$ ember install @smile-io/ember-polaris

Styles

This addon will install ember-cli-sass in the host app. It will also set up your app's app/styles/app.scss to @import "ember-polaris";, creating the file if it does not already exist.

Icons

For icons to work you will need to:

  • copy Polaris SVG's into a folder in public, ex: public/assets/images/svg/polaris
  • install ember-svg-jar
  • add the following ember-svg-jar options to your ember-cli-build.js:
// ember-cli-build.js
var app = new EmberApp(defaults, {
  ...

  svgJar: {
    strategy: 'inline',
    inline: {
      stripPath: false,
      optimizer: {
        removeDimensions: true,
      },
      sourceDirs: [
        'public/assets/images/svg',
      ],
    }
  },

  ...
});

Template compiler

If your app does not already import ember-template-compiler, you may get an error similar to this one when passing a hash of componentName and props into one of the ember-polaris components:

Uncaught TypeError: _ember.default.HTMLBars.compile is not a function

If that happens, you need to add an import statement to its ember-cli-build.js.

// ember-cli-build.js
app.import('node_modules/ember-source/dist/ember-template-compiler.js');

NOTE: This setup will be handled by ember-polaris in the future.

Usage

ember-polaris provides a set of Ember components intended to implement the same behavior and functionality as the Shopify Polaris React components. In general the usage can be inferred from the Polaris component documentation, with some exceptions as described below.

Differences with Polaris React components

We have tried to keep the components provided by ember-polaris as similar to the original Polaris React components as possible. However, there are cases where it makes sense to do things in a more Ember-friendly way, and where this is true we will describe the ember-polaris usage and how it differs from the original Shopify components.

General Differences

children property

A large number of the Polaris React components have a children property listed in their documentation. In these cases, the corresponding ember-polaris component can be given a text attribute which will take the place of the children property and specify the text to be rendered by the component. Alternatively these components can be used in block form to achieve the same result. Note that the block content will take precedence over the text attribute (if one is supplied):

{{polaris-button text="Attribute text"}}
 => renders a button with the content "Attribute text"

{{#polaris-button}}
  Block text
{{/polaris-button}}
 => renders a button with the content "Block text"

{{#polaris-button text="Attribute text"}}
  Block text
{{/polaris-button}}
 => renders a button with the content "Block text"
element property

Some Polaris React components accept an element property which changes the tag rendered by the component. In ember-polaris, this is replaced by the tagName attribute unless otherwise noted. This attribute cannot be dynamic - the following code would cause an error:

{{#polaris-display-text tagName=displayTextTagName}}
  Displays fine to start with...
{{/polaris-display-text}}

{{#polaris-button onClick=(action (mut displayTextTagName) "h5")}}
  ... but clicking this button will cause an error
{{/polaris-button}}
actions property

Some Polaris React components accept an actions property as a list of actions which can be performed. In ember-polaris, this is renamed to avoid collisions with the Ember actions hash. The new name will be different based on the component - check the documentation for the specific component to find out what attribute to pass the actions list as.

Components

Below is a categorised list of the components available in ember-polaris. Click an item to see more information and usage examples for that component.

Actions

Images and icons

Feedback indicators

Structure

Titles and text

Forms

Lists and tables

Navigation

Overlays

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].