Skip to content

Commit

Permalink
feat: upgrade to material 0.35.0 Label is now compulsory. Remove is a…
Browse files Browse the repository at this point in the history
…nd has from props. Add additional event handler props BREAKING CHANGE: Label is now compulsory
  • Loading branch information
hvolschenk committed Apr 28, 2018
1 parent e67f3e8 commit 37a4105
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 281 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# switch
# MaterialR Switch

**@materialr/switch**

[![Build Status](https://travis-ci.org/materialr/switch.svg?branch=master)](https://travis-ci.org/materialr/switch)
[![Coverage Status](https://coveralls.io/repos/github/materialr/switch/badge.svg?branch=master)](https://coveralls.io/github/materialr/switch?branch=master)
[![NSP Status](https://nodesecurity.io/orgs/materialr/projects/a12ee5d7-912e-4ba2-a3ba-d2722e58df3a/badge)](https://nodesecurity.io/orgs/materialr/projects/a12ee5d7-912e-4ba2-a3ba-d2722e58df3a)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

React Material switch implementation

## Installation

```sh
$ npm install --save @materialr/switch
```

## Demo

A full demo is available on the [MaterialR website](https://materialr.github.io/components/switch)
showcasing all variants.

## Components

### Default export

```js
import Switch from '@materialr/switch';
```

**Props**

| Prop | Type | Required | Default | Description |
| ------------- | ------ | -------- | ---------- | ---------------------------------- |
| `checked` | bool | No | false | Whether the switch is on |
| `className` | string | No | undefined | Additional classNames to add |
| `disabled` | bool | No | false | Whether the switch is disabled |
| `id` | string | No | `uuidv1()` | The id attribute of the element |
| `label` | string | Yes | N/A | The label to render for the switch |
| `name` | string | No | undefined | The element's name attribute |
| `onBlur` | func | No | undefined | The `blur` event handler |
| `onChange` | func | No | undefined | The `change` event handler |
| `onDragStart` | func | No | undefined | The `dragstart` event handler |
| `onDrop` | func | No | undefined | The `drop` event handler |
| `onFocus` | func | No | undefined | The `focus` event handler |
180 changes: 80 additions & 100 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build:production": "babel src --out-dir lib --ignore **/*.test.js,**/*.test.jsx",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
"lint": "eslint --ext .js .",
"lint": "eslint --ext .js --ext .jsx .",
"semantic-release": "semantic-release",
"test": "npm run lint && npm run test:vulnerabilities && npm run test:scripts",
"test:scripts": "jest --coverage --config ./jest.config.json",
Expand All @@ -28,16 +28,16 @@
},
"homepage": "https://github.com/materialr/switch#readme",
"dependencies": {
"@materialr/form-field": "^1.1.3",
"@material/switch": "^0.34.0",
"@material/form-field": "^0.35.0",
"@material/switch": "^0.35.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"react": "^16.3.1",
"react": "^16.3.2",
"uuid": "^3.2.1"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-core": "^6.26.3",
"babel-jest": "^22.4.3",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
Expand All @@ -52,7 +52,7 @@
"eslint-plugin-react": "^7.7.0",
"jest": "^22.4.3",
"nsp": "^3.2.1",
"react-dom": "^16.3.1",
"react-dom": "^16.3.2",
"semantic-release": "^15.1.7"
}
}
Loading

0 comments on commit 37a4105

Please sign in to comment.