Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Housekeeping #732

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{
"presets": [
["env", {
"modules": "umd",
"targets": {
"browsers": ["last 2 versions"]
}
}],
"stage-0",
["@babel/preset-env", { "modules": "umd" }]
],
"env": {
"production": {
"presets": ["babili"]
"presets": ["minify"]
}
}
}
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last 2 versions
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: 'airbnb-base',
parser: 'babel-eslint',
env: {
browser: true,
jest: true,
},
};
8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ typings/
# custom
test/
test.html
.DS_Store
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9
14.15
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
language: node_js
node_js: 9
node_js: 14.15
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Contributing

Prerequisites:

- Node and NPM
- Node 14 and Yarn 1.22

Flow:

- Fork the repository and checkout `master` branch
- Run `npm install` to get or update the dependencies
- Run `npm start` to build `dist/` and `docs/` directories
- Change JavaScript or LESS files in `src/` directories
- Do not commit changes to dist/ or docs/. These will only be built on merge.
- Once finished, submit a [Pull Request](https://github.com/nostalgiaz/bootstrap-switch/compare/master...master). Remember to target `master` as destination branch
- Install or update dependencies running `yarn`
- Build `dist/` and `docs/` directories running `yarn start`
- Change files in `src/` directory
- Do *not* change any files inside `dist/` or `docs/`. These are automatically generated on merge.
- Once finished, submit a [Pull Request](https://github.com/Bttstrp/bootstrap-switch/compare/master...master). Remember to target `master` as destination branch

Thank you.
80 changes: 50 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,77 @@
# Bootstrap Switch

[![Dependency Status](https://david-dm.org/Bttstrp/bootstrap-switch.svg?style=flat)](https://david-dm.org/Bttstrp/bootstrap-switch)
[![devDependency Status](https://david-dm.org/Bttstrp/bootstrap-switch/dev-status.svg?style=flat)](https://david-dm.org/Bttstrp/bootstrap-switch#info=devDependencies)
[![NPM Version](http://img.shields.io/npm/v/bootstrap-switch.svg?style=flat)](https://www.npmjs.org/)

Turn checkboxes and radio buttons into toggle switches. Created by [Mattia Larentis](http://github.com/nostalgiaz), maintained by [Emanuele Marchi](http://github.com/lostcrew) and [Peter Stein](http://www.bdmdesign.org) with the help of the community.
Compatible with Bootstrap 4, Bootstrap 3 and Bootstrap 2.
- Turn checkboxes and radio buttons into toggle switches.
- Compatible with Bootstrap 4, 3 and 2 (legacy).
- Use with or without bundlers/build tools
- Supports IE9+ and all the other modern browsers.
- [Quick Demo](https://jsfiddle.net/djibe89/vL87w0j8/).

## Getting started

### Installation

The library is available on various package managers:

- npm: `npm install bootstrap-switch`
- yarn: `yarn add bootstrap-switch`
- Composer: `composer require components/bootstrap-switch`
- Bower: `bower install bootstrap-switch`
- NuGet: `PM> Install-Package Bootstrap.Switch` ([NuGet package](https://github.com/blachniet/bootstrap-switch-nuget))

Play with [demo on my fiddle](https://jsfiddle.net/djibe89/vL87w0j8/).
You can also install it manually by downloading the [latest release](https://github.com/Bttstrp/bootstrap-switch/releases/latest) or clone the repo: `git clone https://github.com/Bttstrp/bootstrap-switch.git`.

### Inclusion

#### With build tools

If you use a bundler (Webpack, Rollup, Parcel…) or a task runner (Gulp, Grunt…) that supports SASS (or LESS, for Boostrap 3 or 2) and the JS module syntax, include the appropriate entry point file:

```scss
// boostrap 4
@import "bootstrap-switch/src/sass/bootstrap4/bootstrap-switch.scss"
// or 3
@import "bootstrap-switch/src/less/bootstrap3/bootstrap-switch.less"
// or 2
@import "bootstrap-switch/src/less/bootstrap2/bootstrap-switch.less"
```

## Quick start
Then import the library in your JavaScript as well:

Several quick start options are available:
```js
import 'bootstrap-switch';
```

- Download the [latest release](https://github.com/Bttstrp/bootstrap-switch/releases/latest)
- Clone the repo: `git clone https://github.com/Bttstrp/bootstrap-switch.git`
- Install with npm: `npm install bootstrap-switch`
- Install with yarn: `yarn add bootstrap-switch`
- Install with Composer: `composer require components/bootstrap-switch`
- Install with Bower: `bower install bootstrap-switch`
- Install with NuGet: `PM> Install-Package Bootstrap.Switch` ([NuGet package](https://github.com/blachniet/bootstrap-switch-nuget))
#### Without build tools

Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript:
Include the dependences (jQuery, Bootstrap) and the already compiled JavaScript and CSS files in your HTML:

``` html
```html
<!-- somewhere in <head> tag -->
<link href="bootstrap.css" rel="stylesheet">
<link href="bootstrap-switch.css" rel="stylesheet">
<script src="jquery.js"></script>
<script src="bootstrap-switch.js"></script>
```

Add your checkbox:
### Your first switch

Add a checkbox:

```html
<input type="checkbox" name="my-checkbox" checked>
```

Initialize Bootstrap Switch on it:
Finally, initialize Bootstrap Switch on it:

```javascript
$("[name='my-checkbox']").bootstrapSwitch();
```

Enjoy.

## Supported browsers

IE9+ and all the other modern browsers.

## LESS

- For Bootstrap 2 (no longer officially supported), import `src/less/bootstrap2/bootstrap-switch.less`
- For Bootstrap 3, import `src/less/bootstrap3/bootstrap-switch.less`

## SASS/SCSS

- For Bootstrap 4, import `src/sass/bootstrap4/bootstrap-switch.scss`
Profit!

## Bugs and feature requests

Expand All @@ -79,3 +96,6 @@ Please do not use the issue tracker for personal support requests: [Stack Overfl

Licensed under the [MIT License](https://github.com/Bttstrp/bootstrap-switch/blob/master/LICENSE).

## Credits

Created by [Mattia Larentis](http://github.com/nostalgiaz). Maintained by [Emanuele Marchi](http://github.com/lostcrew), [Martin Hradil](https://github.com/himdel). Formerly maintained by [Thomas Grainger](https://github.com/graingert) and [Peter Stein](http://www.bdmdesign.org). Forever supported by the generosity of this community.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "Apache-2.0",
"main": [
"./dist/js/bootstrap-switch.js",
"./dist/css/bootstrap3/bootstrap-switch.css"
"./dist/css/bootstrap4/bootstrap-switch.css"
],
"ignore": [
"docs",
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap2/bootstrap-switch.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
*
* @version v3.3.5
* @version v3.4.0
* @homepage https://bttstrp.github.io/bootstrap-switch
* @author Mattia Larentis <[email protected]> (http://larentis.eu)
* @license MIT
Expand Down
4 changes: 2 additions & 2 deletions dist/css/bootstrap2/bootstrap-switch.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap3/bootstrap-switch.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
*
* @version v3.3.5
* @version v3.4.0
* @homepage https://bttstrp.github.io/bootstrap-switch
* @author Mattia Larentis <[email protected]> (http://larentis.eu)
* @license MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap3/bootstrap-switch.min.css

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

33 changes: 12 additions & 21 deletions dist/css/bootstrap4/bootstrap-switch.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
*
* @version v3.4 for Bootstrap 4.x
* @version v3.4.0
* @homepage https://bttstrp.github.io/bootstrap-switch
* @author Mattia Larentis <[email protected]> (http://larentis.eu)
* & djibe
* @license Apache-2.0
* @license MIT
*/

@charset "UTF-8";
.bootstrap-switch {
display: inline-block;
direction: ltr;
Expand All @@ -18,28 +19,20 @@
overflow: hidden;
line-height: 8px;
z-index: 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
vertical-align: middle;
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.bootstrap-switch .bootstrap-switch-container {
display: inline-block;
top: 0;
border-radius: 4px;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.bootstrap-switch .bootstrap-switch-handle-on,
.bootstrap-switch .bootstrap-switch-handle-off,
.bootstrap-switch .bootstrap-switch-label {
-webkit-box-sizing: border-box;
box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
display: table-cell;
vertical-align: middle;
Expand Down Expand Up @@ -98,7 +91,7 @@
padding: 8px 12px;
}
.bootstrap-switch span::before {
content: "\200b";
content: "";
}
.bootstrap-switch .bootstrap-switch-handle-on {
border-bottom-left-radius: 3px;
Expand All @@ -108,8 +101,8 @@
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
}
.bootstrap-switch input[type='radio'],
.bootstrap-switch input[type='checkbox'] {
.bootstrap-switch input[type=radio],
.bootstrap-switch input[type=checkbox] {
position: absolute !important;
top: 0;
left: 0;
Expand Down Expand Up @@ -149,7 +142,6 @@
cursor: default !important;
}
.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
-webkit-transition: margin-left 0.5s;
transition: margin-left 0.5s;
}
.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
Expand All @@ -161,8 +153,7 @@
.bootstrap-switch.bootstrap-switch-focused {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label, .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
border-bottom-right-radius: 3px;
Expand Down
Loading