bootstrap5-toggle 4.3.4 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -39
- package/LICENSE +23 -23
- package/README.md +121 -83
- package/css/bootstrap5-toggle.css +1 -1
- package/css/bootstrap5-toggle.min.css +1 -1
- package/js/bootstrap5-toggle.ecmas.js +1 -1
- package/js/bootstrap5-toggle.ecmas.min.js +1 -1
- package/js/bootstrap5-toggle.js +1 -1
- package/js/bootstrap5-toggle.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
4
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
@@ -6,126 +7,198 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## Unreleased
|
|
8
9
|
|
|
9
|
-
## [4.3.
|
|
10
|
-
|
|
10
|
+
## [4.3.5](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.5) 2022-11-23
|
|
11
|
+
|
|
12
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.3.4...v4.3.5)
|
|
13
|
+
|
|
14
|
+
### Bump
|
|
15
|
+
|
|
16
|
+
- bump: Bump Bootstrap from 5.2.2 to 5.2.3
|
|
17
|
+
- bump: Bump Cypress from 10.3.0 to 11.0.1
|
|
18
|
+
|
|
19
|
+
## [4.3.4](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.4) 2022-10-09
|
|
20
|
+
|
|
21
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.3.3...v4.3.4)
|
|
22
|
+
|
|
11
23
|
### Fixed
|
|
12
|
-
* fix: Handle's background color of outline toggles on hover or focus (#71)
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
- fix: Handle's background color of outline toggles on hover or focus (#71)
|
|
26
|
+
|
|
27
|
+
## [4.3.3](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.3) 2022-10-07
|
|
28
|
+
|
|
29
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.3.2...v4.3.3)
|
|
30
|
+
|
|
16
31
|
### Changed
|
|
17
|
-
* refactor: More specific CSS selectors
|
|
18
|
-
* Update dependencies. Support for Bootstrap v5.2.2
|
|
19
32
|
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
- refactor: More specific CSS selectors
|
|
34
|
+
- Update dependencies. Support for Bootstrap v5.2.2
|
|
35
|
+
|
|
36
|
+
## [4.3.2](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.2) 2022-08-08
|
|
37
|
+
|
|
38
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.3.1...v4.3.2)
|
|
39
|
+
|
|
22
40
|
### Fixed
|
|
23
|
-
* fix: Transparent inner border (#55) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/58
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
|
|
42
|
+
- fix: Transparent inner border (#55) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/58
|
|
43
|
+
|
|
44
|
+
## [4.3.1](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.1) 2022-07-28
|
|
45
|
+
|
|
46
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.3.0...v4.3.1)
|
|
47
|
+
|
|
27
48
|
### Fixed
|
|
28
|
-
* fix: Toggle stay hover on Bootstrap 5.2.0 (#51) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/52
|
|
29
49
|
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
- fix: Toggle stay hover on Bootstrap 5.2.0 (#51) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/52
|
|
51
|
+
|
|
52
|
+
## [4.3.0](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.3.0) 2022-07-25
|
|
53
|
+
|
|
54
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.2.0...v4.3.0)
|
|
55
|
+
|
|
32
56
|
### Added
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
|
|
58
|
+
- feat: Distribution of ECMAS lib (#2) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/36
|
|
59
|
+
- feat: Support readonly attribute (#35) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/37
|
|
60
|
+
- feat: Toggles focusable from the keyboard (#38) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/41
|
|
61
|
+
- feat: Switch toggle from keyboard (#39) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/42
|
|
62
|
+
- feat: Custom value for on and off state on form submit (#34) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/43
|
|
63
|
+
- feat: Tristate toggle (#40) by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/47
|
|
64
|
+
|
|
65
|
+
## [4.2.0](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.2.0) 2022-07-12
|
|
66
|
+
|
|
67
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.1.0...v4.2.0)
|
|
68
|
+
|
|
42
69
|
### Added
|
|
43
|
-
|
|
70
|
+
|
|
71
|
+
- feat: Support toggle silent method by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/30
|
|
72
|
+
|
|
44
73
|
### Changed
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
|
|
75
|
+
- feat: Remove btn-light from handle by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/21
|
|
76
|
+
- feat: Change default btn off class to secondary by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/22
|
|
77
|
+
|
|
47
78
|
### Fixed
|
|
48
|
-
* fix: Handle border color and btn-light border color by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/17
|
|
49
|
-
* fix: Render in input-group by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/29
|
|
50
79
|
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
- fix: Handle border color and btn-light border color by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/17
|
|
81
|
+
- fix: Render in input-group by @palcarazm in https://github.com/palcarazmm/bootstrap5-toggle/pull/29
|
|
82
|
+
|
|
83
|
+
## [4.1.0](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.1.0) 2022-06-30
|
|
84
|
+
|
|
85
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v4.0.0...v4.1.0)
|
|
86
|
+
|
|
53
87
|
### Added
|
|
88
|
+
|
|
54
89
|
- feat: support for npm and yarn
|
|
55
90
|
|
|
56
|
-
## [4.0.0](https://github.com/
|
|
57
|
-
|
|
91
|
+
## [4.0.0](https://github.com/palcarazm/bootstrap5-toggle/tree/v4.0.0) 2022-06-30
|
|
92
|
+
|
|
93
|
+
### [Full Changelog](https://github.com/palcarazm/bootstrap5-toggle/compare/v3.6.0...v4.0.0)
|
|
94
|
+
|
|
58
95
|
### Added
|
|
96
|
+
|
|
59
97
|
- feat: support for Boostrap 5
|
|
60
98
|
|
|
61
99
|
## [3.6.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.6.0) 2019-10-17
|
|
100
|
+
|
|
62
101
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.5.0...v3.6.0)
|
|
102
|
+
|
|
63
103
|
### Added
|
|
104
|
+
|
|
64
105
|
- Added option to change toggle without triggering onChange event (silent toggle) [\#7](https://github.com/gitbrent/bootstrap4-toggle/issue/7) ([aswin1980](https://github.com/aswin1980))
|
|
65
106
|
- Added accessibility properties to labels [\#11](https://github.com/gitbrent/bootstrap4-toggle/issue/11) ([aproquot](https://github.com/aproquot))
|
|
107
|
+
|
|
66
108
|
### Changed
|
|
109
|
+
|
|
67
110
|
- Fixed URLs in js and css file top comment [\#5](https://github.com/gitbrent/bootstrap4-toggle/issue/5) ([wilecoyte78](https://github.com/wilecoyte78))
|
|
68
111
|
- Disable style is not working [\#18](https://github.com/gitbrent/bootstrap4-toggle/issue/18) ([rychlym](https://github.com/rychlym))
|
|
69
112
|
|
|
70
113
|
## [3.5.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.5.0) 2019-07-02
|
|
114
|
+
|
|
71
115
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.4.0...v3.5.0)
|
|
116
|
+
|
|
72
117
|
### Added
|
|
118
|
+
|
|
73
119
|
- Added ARIA `role="button"` tag to toggle
|
|
74
120
|
- Added `cursor: pointer;` style to toggle
|
|
121
|
+
|
|
75
122
|
### Changed
|
|
123
|
+
|
|
76
124
|
- Fixed: Touch not working on mobile [\#2](https://github.com/gitbrent/bootstrap4-toggle/issue/2) ([wilecoyte78](https://github.com/wilecoyte78))
|
|
77
125
|
- Updated to Bootstrap version 4.3.1
|
|
78
126
|
- Updated README with better Yarn instructions
|
|
79
127
|
|
|
80
128
|
## [3.4.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.4.0) 2019-01-03
|
|
129
|
+
|
|
81
130
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.3.0...v3.4.0)
|
|
131
|
+
|
|
82
132
|
### Added
|
|
133
|
+
|
|
83
134
|
- Outline button styles are now available
|
|
135
|
+
|
|
84
136
|
### Changed
|
|
137
|
+
|
|
85
138
|
- Updated to Bootstrap version 4.2.1
|
|
86
139
|
|
|
87
140
|
## [3.3.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.3.0) 2018-12-19
|
|
141
|
+
|
|
88
142
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.2.0...v3.3.0)
|
|
143
|
+
|
|
89
144
|
### Added
|
|
145
|
+
|
|
90
146
|
- New test created to compare core bootstrap sizes to bootstrap4-toggle
|
|
147
|
+
|
|
91
148
|
### Changed
|
|
149
|
+
|
|
92
150
|
- Introduced new `size` values that mirror bootstrap 4: (`lg`, `sm`, `xs`)
|
|
93
151
|
- Converted all css units from `px` to `rem`
|
|
94
152
|
- Properly added border on `light` button (moved from .toggle class)
|
|
153
|
+
|
|
95
154
|
### Removed
|
|
96
|
-
**DEPRECATED** Classic `size` values (`large`, `small`, `mini`)
|
|
97
155
|
|
|
156
|
+
**DEPRECATED** Classic `size` values (`large`, `small`, `mini`)
|
|
98
157
|
|
|
99
158
|
## [3.2.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.2.0) 2018-11-27
|
|
159
|
+
|
|
100
160
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.1.0...v3.2.0)
|
|
161
|
+
|
|
101
162
|
### Added
|
|
163
|
+
|
|
102
164
|
### Changed
|
|
103
|
-
- Removed permanent `active` state from "Off" label so mouse-over highlighting works the same as "On"
|
|
104
|
-
### Removed
|
|
105
165
|
|
|
166
|
+
- Removed permanent `active` state from "Off" label so mouse-over highlighting works the same as "On"
|
|
106
167
|
|
|
168
|
+
### Removed
|
|
107
169
|
|
|
108
170
|
## [3.1.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.1.0) 2018-10-25
|
|
171
|
+
|
|
109
172
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v3.0.0...v3.1.0)
|
|
173
|
+
|
|
110
174
|
### Added
|
|
175
|
+
|
|
111
176
|
- `index.html` includes new section with dark mode colors
|
|
177
|
+
|
|
112
178
|
### Changed
|
|
179
|
+
|
|
113
180
|
- `index.html` now fully responsive, better menu, rearranged sections
|
|
114
181
|
- Tweaked `border` property to work with all backgrounds and colors
|
|
115
|
-
### Removed
|
|
116
|
-
|
|
117
182
|
|
|
183
|
+
### Removed
|
|
118
184
|
|
|
119
185
|
## [3.0.0](https://github.com/gitbrent/bootstrap4-toggle/tree/v3.0.0) 2018-10-21
|
|
186
|
+
|
|
120
187
|
### [Full Changelog](https://github.com/gitbrent/bootstrap4-toggle/compare/v2.2.2...v3.0.0)
|
|
188
|
+
|
|
121
189
|
### Added
|
|
190
|
+
|
|
122
191
|
- Touch support
|
|
192
|
+
|
|
123
193
|
### Changed
|
|
194
|
+
|
|
124
195
|
- Implements Bootstrap 4 colors/styles
|
|
196
|
+
|
|
125
197
|
### Removed
|
|
198
|
+
|
|
126
199
|
- Old Bootstrap 2 files
|
|
127
200
|
|
|
128
|
-
[
|
|
201
|
+
[unreleased]: https://github.com/gitbrent/bootstrap4-toggle/compare/v1.9.0...HEAD
|
|
129
202
|
[3.2.0]: https://github.com/gitbrent/bootstrap4-toggle/compare/v3.1.0...v3.2.0
|
|
130
203
|
[3.1.0]: https://github.com/gitbrent/bootstrap4-toggle/compare/v3.0.0...v3.1.0
|
|
131
204
|
[3.0.0]: https://github.com/gitbrent/bootstrap4-toggle/compare/v2.2.2...v3.0.0
|
package/LICENSE
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
- Copyright (c) 2011-2014 Min Hur, The New York Times Company
|
|
4
|
-
- Copyright (c) 2018-2019 Brent Ely
|
|
5
|
-
- Copyright (c) 2022 Pablo Alcaraz Martínez
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
in the Software without restriction, including without limitation the rights
|
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
|
15
|
-
all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
- Copyright (c) 2011-2014 Min Hur, The New York Times Company
|
|
4
|
+
- Copyright (c) 2018-2019 Brent Ely
|
|
5
|
+
- Copyright (c) 2022 Pablo Alcaraz Martínez
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -12,20 +12,23 @@
|
|
|
12
12
|
|
|
13
13
|
**Bootstrap 5 Toggle** is a bootstrap plugin/widget that converts checkboxes into toggles.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
---
|
|
16
16
|
|
|
17
17
|
#### Library Distributions
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[bootstrap5-toggle
|
|
18
|
+
|
|
19
|
+
| Branch | Bootstrap Support | Last Release |
|
|
20
|
+
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| [bootstrap5-toggle](https://github.com/palcarazm/bootstrap5-toggle) | [](https://getbootstrap.com/docs/5.0) | [](https://github.com/palcarazm/bootstrap5-toggle/releases) |
|
|
22
|
+
| [bootstrap5-toggle v3.X.X](https://github.com/palcarazm/bootstrap5-toggle/tree/v3.X.X) | [](https://getbootstrap.com/docs/4.0) | [](https://github.com/palcarazm/bootstrap5-toggle/releases) |
|
|
22
23
|
|
|
23
24
|
# Demos
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
**Demos and API Docs:** https://palcarazm.github.io/bootstrap5-toggle/
|
|
25
27
|
|
|
26
28
|

|
|
27
29
|
|
|
28
30
|
# Related Bootstrap Puglins
|
|
31
|
+
|
|
29
32
|
<div align="center">
|
|
30
33
|
<a href="https://github.com/palcarazm/bs-darkmode" title="Boostrap Darkmode"
|
|
31
34
|
><img
|
|
@@ -33,12 +36,13 @@ Branch | Bootstrap Support | Last Release
|
|
|
33
36
|
/></a>
|
|
34
37
|
</div>
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
---
|
|
37
40
|
|
|
38
41
|
<!-- To update TOC run .\node_modules\.bin\doctoc README.md --github -->
|
|
39
42
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
40
43
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_
|
|
42
46
|
|
|
43
47
|
- [Installation](#installation)
|
|
44
48
|
- [CDN](#cdn)
|
|
@@ -61,56 +65,71 @@ Branch | Bootstrap Support | Last Release
|
|
|
61
65
|
|
|
62
66
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
---
|
|
65
69
|
|
|
66
70
|
# Installation
|
|
67
71
|
|
|
68
72
|
## CDN
|
|
73
|
+
|
|
69
74
|
[](https://www.jsdelivr.com/package/npm/bootstrap5-toggle)
|
|
75
|
+
|
|
70
76
|
### jQuery Interface
|
|
77
|
+
|
|
71
78
|
```html
|
|
72
|
-
<link
|
|
73
|
-
|
|
79
|
+
<link
|
|
80
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.5/css/bootstrap5-toggle.min.css"
|
|
81
|
+
rel="stylesheet" />
|
|
82
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.5/js/bootstrap5-toggle.min.js"></script>
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
### ECMAS Interface
|
|
86
|
+
|
|
77
87
|
```html
|
|
78
|
-
<link
|
|
79
|
-
|
|
88
|
+
<link
|
|
89
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.5/css/bootstrap5-toggle.min.css"
|
|
90
|
+
rel="stylesheet" />
|
|
91
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.5/js/bootstrap5-toggle.ecmas.min.js"></script>
|
|
80
92
|
```
|
|
81
93
|
|
|
82
94
|
## Download
|
|
95
|
+
|
|
83
96
|
[](https://github.com/palcarazm/bootstrap5-toggle/releases)
|
|
84
97
|
|
|
85
98
|
## NPM
|
|
99
|
+
|
|
86
100
|
[](https://www.npmjs.com/package/bootstrap5-toggle)
|
|
101
|
+
|
|
87
102
|
```ksh
|
|
88
|
-
npm install bootstrap5-toggle
|
|
103
|
+
npm install bootstrap5-toggle@4.3.5
|
|
89
104
|
```
|
|
90
105
|
|
|
91
106
|
## Yarn
|
|
107
|
+
|
|
92
108
|
```ksh
|
|
93
|
-
yarn add bootstrap5-toggle
|
|
109
|
+
yarn add bootstrap5-toggle@4.3.5
|
|
94
110
|
```
|
|
95
111
|
|
|
96
112
|
# Usage
|
|
97
113
|
|
|
98
114
|
## Initialize With HTML
|
|
115
|
+
|
|
99
116
|
Simply add `data-toggle="toggle"` to automatically convert a plain checkbox into a bootstrap 5 toggle.
|
|
100
117
|
|
|
101
118
|
```html
|
|
102
|
-
<input id="chkToggle" type="checkbox" data-toggle="toggle"
|
|
119
|
+
<input id="chkToggle" type="checkbox" data-toggle="toggle" />
|
|
103
120
|
```
|
|
104
121
|
|
|
105
122
|
## Initialize With Code
|
|
106
|
-
|
|
123
|
+
|
|
124
|
+
Toggles can also be initialized via JavaScript code.
|
|
107
125
|
|
|
108
126
|
EX: Initialize id `chkToggle` with a single line of JavaScript.
|
|
127
|
+
|
|
109
128
|
```html
|
|
110
|
-
<input id="chkToggle" type="checkbox" checked
|
|
129
|
+
<input id="chkToggle" type="checkbox" checked />
|
|
111
130
|
<script>
|
|
112
|
-
$(function(){
|
|
113
|
-
$(
|
|
131
|
+
$(function () {
|
|
132
|
+
$("#chkToggle").bootstrapToggle();
|
|
114
133
|
});
|
|
115
134
|
</script>
|
|
116
135
|
```
|
|
@@ -118,130 +137,149 @@ EX: Initialize id `chkToggle` with a single line of JavaScript.
|
|
|
118
137
|
# API
|
|
119
138
|
|
|
120
139
|
## Options
|
|
121
|
-
|
|
122
|
-
|
|
140
|
+
|
|
141
|
+
- Options can be passed via data attributes or JavaScript
|
|
142
|
+
- For data attributes, append the option name to `data-` (ex: `data-on="Enabled"`)
|
|
123
143
|
|
|
124
144
|
```html
|
|
125
|
-
<input
|
|
126
|
-
|
|
145
|
+
<input
|
|
146
|
+
type="checkbox"
|
|
147
|
+
data-toggle="toggle"
|
|
148
|
+
data-on="Enabled"
|
|
149
|
+
data-off="Disabled" />
|
|
150
|
+
<input type="checkbox" id="toggle-two" />
|
|
127
151
|
<script>
|
|
128
|
-
$(function() {
|
|
129
|
-
$(
|
|
130
|
-
on:
|
|
131
|
-
off:
|
|
152
|
+
$(function () {
|
|
153
|
+
$("#toggle-two").bootstrapToggle({
|
|
154
|
+
on: "Enabled",
|
|
155
|
+
off: "Disabled",
|
|
132
156
|
});
|
|
133
|
-
})
|
|
157
|
+
});
|
|
134
158
|
</script>
|
|
135
159
|
```
|
|
136
160
|
|
|
137
|
-
Name
|
|
138
|
-
|
|
139
|
-
`on`
|
|
140
|
-
`off`
|
|
141
|
-
`size`
|
|
142
|
-
`onstyle`
|
|
143
|
-
`offstyle
|
|
144
|
-
`onvalue`
|
|
145
|
-
`offvalue
|
|
146
|
-
`style`
|
|
147
|
-
`width`
|
|
148
|
-
`height`
|
|
149
|
-
`tabindex
|
|
150
|
-
`tristate
|
|
161
|
+
| Name | Type | Default | Description |
|
|
162
|
+
| ---------- | ----------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
163
|
+
| `on` | string/html | "On" | Text of the on toggle |
|
|
164
|
+
| `off` | string/html | "Off" | Text of the off toggle |
|
|
165
|
+
| `size` | string | "normal" | Size of the toggle. Possible values are: `large`, `normal`, `small`, `mini`. |
|
|
166
|
+
| `onstyle` | string | "primary" | Style of the on toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix |
|
|
167
|
+
| `offstyle` | string | "secondary" | Style of the off toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix |
|
|
168
|
+
| `onvalue` | string | _null_ | Sets on state value |
|
|
169
|
+
| `offvalue` | string | _null_ | Sets off state value |
|
|
170
|
+
| `style` | string | | Appends the value to the class attribute of the toggle. This can be used to apply custom styles. Refer to Custom Styles for reference. |
|
|
171
|
+
| `width` | integer | _null_ | Sets the width of the toggle. if set to _null_, width will be auto-calculated. |
|
|
172
|
+
| `height` | integer | _null_ | Sets the height of the toggle. if set to _null_, height will be auto-calculated. |
|
|
173
|
+
| `tabindex` | integer | 0 | Sets the tabindex of the toggle. |
|
|
174
|
+
| `tristate` | boolean | false | Sets tristate support |
|
|
151
175
|
|
|
152
176
|
## Methods
|
|
177
|
+
|
|
153
178
|
Methods can be used to control toggles directly.
|
|
154
179
|
|
|
155
180
|
```html
|
|
156
|
-
<input id="toggle-demo" type="checkbox" data-toggle="toggle"
|
|
181
|
+
<input id="toggle-demo" type="checkbox" data-toggle="toggle" />
|
|
157
182
|
```
|
|
158
183
|
|
|
159
|
-
Method
|
|
160
|
-
|
|
161
|
-
initialize
|
|
162
|
-
destroy
|
|
163
|
-
on
|
|
164
|
-
off
|
|
165
|
-
toggle
|
|
166
|
-
enable
|
|
167
|
-
disable
|
|
168
|
-
readonly
|
|
169
|
-
indeterminate| `$('#toggle-demo').bootstrapToggle('indeterminate')
|
|
170
|
-
determinate
|
|
184
|
+
| Method | Example | Description |
|
|
185
|
+
| ------------- | ---------------------------------------------------- | ------------------------------------------------- |
|
|
186
|
+
| initialize | `$('#toggle-demo').bootstrapToggle()` | Initializes the toggle plugin with options |
|
|
187
|
+
| destroy | `$('#toggle-demo').bootstrapToggle('destroy')` | Destroys the toggle |
|
|
188
|
+
| on | `$('#toggle-demo').bootstrapToggle('on')` | Sets the toggle to 'On' state |
|
|
189
|
+
| off | `$('#toggle-demo').bootstrapToggle('off')` | Sets the toggle to 'Off' state |
|
|
190
|
+
| toggle | `$('#toggle-demo').bootstrapToggle('toggle')` | Toggles the state of the toggle on/off |
|
|
191
|
+
| enable | `$('#toggle-demo').bootstrapToggle('enable')` | Enables the toggle |
|
|
192
|
+
| disable | `$('#toggle-demo').bootstrapToggle('disable')` | Disables the toggle |
|
|
193
|
+
| readonly | `$('#toggle-demo').bootstrapToggle('readonly')` | Disables the toggle but preserve checkbox enabled |
|
|
194
|
+
| indeterminate | `$('#toggle-demo').bootstrapToggle('indeterminate')` | Sets the toggle to 'indeterminate' state |
|
|
195
|
+
| determinate | `$('#toggle-demo').bootstrapToggle('determinate')` | Sets the toggle to 'determinate' state |
|
|
171
196
|
|
|
172
197
|
# Events
|
|
173
198
|
|
|
174
199
|
## Event Propagation
|
|
200
|
+
|
|
175
201
|
Note All events are propagated to and from input element to the toggle.
|
|
176
202
|
|
|
177
203
|
You should listen to events from the `<input type="checkbox">` directly rather than look for custom events.
|
|
178
204
|
|
|
179
205
|
```html
|
|
180
|
-
<input id="toggle-event" type="checkbox" data-toggle="toggle"
|
|
206
|
+
<input id="toggle-event" type="checkbox" data-toggle="toggle" />
|
|
181
207
|
<div id="console-event"></div>
|
|
182
208
|
<script>
|
|
183
|
-
$(function() {
|
|
184
|
-
$(
|
|
185
|
-
$(
|
|
186
|
-
})
|
|
187
|
-
})
|
|
209
|
+
$(function () {
|
|
210
|
+
$("#toggle-event").change(function () {
|
|
211
|
+
$("#console-event").html("Toggle: " + $(this).prop("checked"));
|
|
212
|
+
});
|
|
213
|
+
});
|
|
188
214
|
</script>
|
|
189
215
|
```
|
|
190
216
|
|
|
191
217
|
## Stopping Event Propagation
|
|
218
|
+
|
|
192
219
|
Passing `true` to the on, off, toggle, determinate and indeterminate methods will enable the silent option to prevent the control from propagating the change event in cases where you want to update the controls on/off state, but do not want to fire the onChange event.
|
|
193
220
|
|
|
194
221
|
```html
|
|
195
|
-
<input id="toggle-silent" type="checkbox" data-toggle="toggle"
|
|
196
|
-
<button class="btn btn-success" onclick="toggleApiOnSilent()"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<button class="btn btn-
|
|
222
|
+
<input id="toggle-silent" type="checkbox" data-toggle="toggle" />
|
|
223
|
+
<button class="btn btn-success" onclick="toggleApiOnSilent()">
|
|
224
|
+
On by API (silent)
|
|
225
|
+
</button>
|
|
226
|
+
<button class="btn btn-success" onclick="toggleApiOffSilent()">
|
|
227
|
+
Off by API (silent)
|
|
228
|
+
</button>
|
|
229
|
+
<button class="btn btn-warning" onclick="toggleApiOnNotSilent()">
|
|
230
|
+
On by API (not silent)
|
|
231
|
+
</button>
|
|
232
|
+
<button class="btn btn-warning" onclick="toggleApiOffNotSilent()">
|
|
233
|
+
On by API (not silent)
|
|
234
|
+
</button>
|
|
200
235
|
<script>
|
|
201
236
|
function toggleApiOnSilent() {
|
|
202
|
-
$(
|
|
237
|
+
$("#toggle-silent").bootstrapToggle("on", true);
|
|
203
238
|
}
|
|
204
239
|
function toggleApiOffSilent() {
|
|
205
|
-
$(
|
|
240
|
+
$("#toggle-silent").bootstrapToggle("off", true);
|
|
206
241
|
}
|
|
207
242
|
function toggleApiOnNotSilent() {
|
|
208
|
-
$(
|
|
243
|
+
$("#toggle-silent").bootstrapToggle("on");
|
|
209
244
|
}
|
|
210
245
|
function toggleApiOffNotSilent() {
|
|
211
|
-
$(
|
|
246
|
+
$("#toggle-silent").bootstrapToggle("off");
|
|
212
247
|
}
|
|
213
248
|
</script>
|
|
214
249
|
```
|
|
215
250
|
|
|
216
251
|
## API vs Input
|
|
252
|
+
|
|
217
253
|
This also means that using the API or Input to trigger events will work both ways.
|
|
218
254
|
|
|
219
255
|
```html
|
|
220
|
-
<input id="toggle-trigger" type="checkbox" data-toggle="toggle"
|
|
221
|
-
<button class="btn btn-success" onclick="toggleApiOn()"
|
|
222
|
-
<button class="btn btn-danger"
|
|
223
|
-
<button class="btn btn-success" onclick="toggleInpOn()"
|
|
224
|
-
<button class="btn btn-danger"
|
|
256
|
+
<input id="toggle-trigger" type="checkbox" data-toggle="toggle" />
|
|
257
|
+
<button class="btn btn-success" onclick="toggleApiOn()">On by API</button>
|
|
258
|
+
<button class="btn btn-danger" onclick="toggleApiOff()">Off by API</button>
|
|
259
|
+
<button class="btn btn-success" onclick="toggleInpOn()">On by Input</button>
|
|
260
|
+
<button class="btn btn-danger" onclick="toggleInpOff()">Off by Input</button>
|
|
225
261
|
<script>
|
|
226
262
|
function toggleApiOn() {
|
|
227
|
-
$(
|
|
263
|
+
$("#toggle-trigger").bootstrapToggle("on");
|
|
228
264
|
}
|
|
229
265
|
function toggleApiOff() {
|
|
230
|
-
$(
|
|
266
|
+
$("#toggle-trigger").bootstrapToggle("off");
|
|
231
267
|
}
|
|
232
268
|
function toggleInpOn() {
|
|
233
|
-
$(
|
|
269
|
+
$("#toggle-trigger").prop("checked", true).change();
|
|
234
270
|
}
|
|
235
271
|
function toggleInpOff() {
|
|
236
|
-
$(
|
|
272
|
+
$("#toggle-trigger").prop("checked", false).change();
|
|
237
273
|
}
|
|
238
274
|
</script>
|
|
239
275
|
```
|
|
276
|
+
|
|
240
277
|
# Collaborators welcom!
|
|
278
|
+
|
|
241
279
|
- :sos: ¿Do you need some help? Open a issue in [GitHub help wanted](https://github.com/palcarazm/bootstrap5-toggle/issues/new?assignees=&labels=help+wanted&template=help-wanted.md&title=%5BHELP%5D)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
280
|
+
- :bug: ¿Do you find a bug? Open a issue in [GitHub bug report](https://github.com/palcarazm/bootstrap5-toggle/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D)
|
|
281
|
+
- :bulb: ¿Do you have a great idea? Open a issue in [GitHub feature request](https://github.com/palcarazm/bootstrap5-toggle/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=%5BFEATURE%5D)
|
|
282
|
+
- :computer: ¿Do you know how to fix a bug? Open a pull request in [GitHub pull repuest](https://github.com/palcarazm/bootstrap5-toggle/compare).
|
|
245
283
|
|
|
246
284
|
[](https://github.com/palcarazm/bootstrap5-toggle/graphs/contributors)
|
|
247
285
|
|
package/js/bootstrap5-toggle.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bootstrap5-toggle",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.5",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Pablo Alcaraz Martínez",
|
|
6
6
|
"url": "https://github.com/palcarazm/"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"url": "https://github.com/palcarazm/bootstrap5-toggle/issues"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"cypress": "^
|
|
46
|
+
"cypress": "^11.0.1",
|
|
47
47
|
"cypress-plugin-tab": "^1.0.5",
|
|
48
48
|
"doctoc": "^2.2.0",
|
|
49
49
|
"grunt": "^1.5.3",
|