bootstrap5-toggle 4.2.0 → 4.3.2

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 CHANGED
@@ -6,13 +6,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## [4.3.2](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.3.2) 2022-08-08
10
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v4.3.1...v4.3.2)
11
+ ### Fixed
12
+ * fix: Transparent inner border (#55) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/58
13
+
14
+ ## [4.3.1](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.3.1) 2022-07-28
15
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v4.3.0...v4.3.1)
16
+ ### Fixed
17
+ * fix: Toggle stay hover on Bootstrap 5.2.0 (#51) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/52
18
+
19
+ ## [4.3.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.3.0) 2022-07-25
20
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v4.2.0...v4.3.0)
21
+ ### Added
22
+ * feat: Distribution of ECMAS lib (#2) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/36
23
+ * feat: Support readonly attribute (#35) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/37
24
+ * feat: Toggles focusable from the keyboard (#38) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/41
25
+ * feat: Switch toggle from keyboard (#39) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/42
26
+ * feat: Custom value for on and off state on form submit (#34) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/43
27
+ * feat: Tristate toggle (#40) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/47
28
+
29
+ ## [4.2.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.2.0) 2022-07-12
30
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v4.1.0...v4.2.0)
31
+ ### Added
32
+ * feat: Support toggle silent method by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/30
33
+ ### Changed
34
+ * feat: Remove btn-light from handle by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/21
35
+ * feat: Change default btn off class to secondary by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/22
36
+ ### Fixed
37
+ * fix: Handle border color and btn-light border color by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/17
38
+ * fix: Render in input-group by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/29
39
+
9
40
  ## [4.1.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.1.0) 2022-06-30
10
- ### [Full Changelog](https://github.com/palcaraz/bootstrap4-toggle/compare/v4.0.0...v4.1.0)
41
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v4.0.0...v4.1.0)
11
42
  ### Added
12
43
  - feat: support for npm and yarn
13
44
 
14
45
  ## [4.0.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.0.0) 2022-06-30
15
- ### [Full Changelog](https://github.com/palcaraz/bootstrap4-toggle/compare/v3.6.0...v4.0.0)
46
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap5-toggle/compare/v3.6.0...v4.0.0)
16
47
  ### Added
17
48
  - feat: support for Boostrap 5
18
49
 
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
@@ -1,11 +1,11 @@
1
1
  [![GitHub license](https://img.shields.io/github/license/palcarazm/bootstrap5-toggle.svg)](https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE)
2
- [![Latest release](https://img.shields.io/github/v/release/palcarazm/bootstrap5-toggle.svg?display_name=tag&include_prereleases&sort=semver)](https://github.com/palcarazm/bootstrap5-toggle/releases/latest)
2
+ [![Latest release](https://img.shields.io/github/package-json/v/palcarazm/bootstrap5-toggle/master?logo=github)](https://github.com/palcarazm/bootstrap5-toggle/releases)
3
3
  [![JSDelivr Badge](https://img.shields.io/jsdelivr/npm/hm/bootstrap5-toggle?color=success&label=hits&logo=jsdelivr&logoColor=white)](https://www.jsdelivr.com/package/npm/bootstrap5-toggle)
4
4
  [![NPM Badge](https://img.shields.io/npm/dm/bootstrap5-toggle?logo=npm&color=success)](https://www.npmjs.com/package/bootstrap5-toggle)
5
- [![Bootstrap 5.1.3](https://img.shields.io/static/v1?label=bootstrap&message=5.1.3&logo=bootstrap&logoColor=white&color=success)](https://getbootstrap.com/docs/5.1)
6
5
  [![Build](https://img.shields.io/github/workflow/status/palcarazm/bootstrap5-toggle/Build%20Check?logo=npm)](https://github.com/palcarazm/bootstrap5-toggle/actions?query=workflow%3A%22Build+Check%22)
7
6
  [![Test](https://img.shields.io/github/workflow/status/palcarazm/bootstrap5-toggle/Cypress%20Tests?label=tests&logo=cypress)](https://github.com/palcarazm/bootstrap5-toggle/actions?query=workflow%3A%22Cypress+Tests%22)
8
7
  [![Maintenance](https://img.shields.io/badge/maintained%3F-yes-success.svg)](https://github.com/palcarazm/bootstrap5-toggle/graphs/contributors)
8
+ [![Funding](https://img.shields.io/badge/sponsor-30363D?style=flat&logo=GitHub-Sponsors&logoColor=#white)](https://github.com/sponsors/palcarazm)
9
9
  [![Rate this package](https://badges.openbase.com/js/rating/bootstrap5-toggle.svg?token=rNvznTVToo+EmX5g+KTvfYqI9+YTWJeUWTxPj7tLA6o=)](https://openbase.com/js/bootstrap5-toggle?utm_source=embedded&utm_medium=badge&utm_campaign=rating-badge&utm_term=js/bootstrap5-toggle)
10
10
 
11
11
  # Bootstrap 5 Toggle
@@ -15,27 +15,24 @@
15
15
  ***
16
16
 
17
17
  #### Library Distributions
18
- Project |Description
19
- ---|---
20
- [bootstrap5-toggle](https://github.com/palcarazm/bootstrap5-toggle) | Supports bootstrap5 (requires jQuery)
21
- [bootstrap4-toggle](https://github.com/gitbrent/bootstrap4-toggle) | Supports bootstrap4 (requires jQuery)
22
- [bootstrap-switch-button](https://github.com/gitbrent/bootstrap-switch-button) | Supports bootstrap4+ (ES6 class, no dependencies)
23
- [bootstrap-switch-button-react](https://github.com/gitbrent/bootstrap-switch-button-react) | Supports bootstrap4+ (React component, no dependencies)
24
-
18
+ Branch | Bootstrap Support | Last Release
19
+ ---|---|---
20
+ [bootstrap5-toggle](https://github.com/palcarazm/bootstrap5-toggle) | [![Bootstrap 5](https://img.shields.io/static/v1?label=bootstrap&message=v5.X.X&color=informational&logo=bootstrap&logoColor=white)](https://getbootstrap.com/docs/5.0) | [![Latest release](https://img.shields.io/github/package-json/v/palcarazm/bootstrap5-toggle/master?logo=github)](https://github.com/palcarazm/bootstrap5-toggle/releases)
21
+ [bootstrap5-toggle v3.X.X](https://github.com/palcarazm/bootstrap5-toggle/tree/v3.X.X) | [![Bootstrap 4](https://img.shields.io/static/v1?label=bootstrap&message=v4.X.X&color=informational&logo=bootstrap&logoColor=white)](https://getbootstrap.com/docs/4.0) | [![Latest release](https://img.shields.io/github/package-json/v/palcarazm/bootstrap5-toggle/v3.X.X?logo=github)](https://github.com/palcarazm/bootstrap5-toggle/releases)
25
22
  # Demos
26
23
  **Demos and API Docs:** https://palcarazm.github.io/bootstrap5-toggle/
27
24
 
28
25
  ![Demo GIF](img/bootstrap5-toggle-demo.gif)
29
26
 
27
+ <!-- To update TOC run .\node_modules\.bin\doctoc README.md --github -->
30
28
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
31
29
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
32
30
  **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
33
31
 
34
- - [Bootstrap 5 Toggle](#bootstrap-5-toggle)
35
- - [Library Distributions](#library-distributions)
36
- - [Demos](#demos)
37
32
  - [Installation](#installation)
38
33
  - [CDN](#cdn)
34
+ - [jQuery Interface](#jquery-interface)
35
+ - [ECMAS Interface](#ecmas-interface)
39
36
  - [Download](#download)
40
37
  - [NPM](#npm)
41
38
  - [Yarn](#yarn)
@@ -49,6 +46,7 @@ Project |Description
49
46
  - [Event Propagation](#event-propagation)
50
47
  - [Stopping Event Propagation](#stopping-event-propagation)
51
48
  - [API vs Input](#api-vs-input)
49
+ - [Collaborators welcom!](#collaborators-welcom)
52
50
 
53
51
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
54
52
 
@@ -58,13 +56,20 @@ Project |Description
58
56
 
59
57
  ## CDN
60
58
  [![JSDelivr Badge](https://img.shields.io/jsdelivr/npm/hm/bootstrap5-toggle?color=success&label=hits&logo=jsdelivr&logoColor=white)](https://www.jsdelivr.com/package/npm/bootstrap5-toggle)
59
+ ### jQuery Interface
60
+ ```html
61
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.2/css/bootstrap5-toggle.min.css" rel="stylesheet">
62
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.2/js/bootstrap5-toggle.min.js"></script>
63
+ ```
64
+
65
+ ### ECMAS Interface
61
66
  ```html
62
- <link href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.2.0/css/bootstrap5-toggle.min.css" rel="stylesheet">
63
- <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.2.0/js/bootstrap5-toggle.min.js"></script>
67
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.2/css/bootstrap5-toggle.min.css" rel="stylesheet">
68
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.2/js/bootstrap5-toggle.ecmas.min.js"></script>
64
69
  ```
65
70
 
66
71
  ## Download
67
- [![Latest release](https://img.shields.io/github/v/release/palcarazm/bootstrap5-toggle.svg?display_name=tag&include_prereleases&sort=semver)](https://github.com/palcarazm/bootstrap5-toggle/releases/latest)
72
+ [![Latest release](https://img.shields.io/github/package-json/v/palcarazm/bootstrap5-toggle/master?logo=github)](https://github.com/palcarazm/bootstrap5-toggle/releases)
68
73
 
69
74
  ## NPM
70
75
  [![NPM Badge](https://img.shields.io/npm/dm/bootstrap5-toggle?logo=npm&color=success)](https://www.npmjs.com/package/bootstrap5-toggle)
@@ -118,16 +123,20 @@ EX: Initialize id `chkToggle` with a single line of JavaScript.
118
123
  </script>
119
124
  ```
120
125
 
121
- Name |Type |Default |Description |
122
- ----------|-----------|----------|----------------------------|
123
- `on` |string/html|"On" |Text of the on toggle
124
- `off` |string/html|"Off" |Text of the off toggle
125
- `size` |string |"normal" |Size of the toggle. Possible values are: `large`, `normal`, `small`, `mini`.
126
- `onstyle` |string |"primary" |Style of the on toggle. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
127
- `offstyle`|string |"light" |Style of the off toggle. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
126
+ Name |Type |Default |Description |
127
+ ----------|-----------|-----------|----------------------------|
128
+ `on` |string/html|"On" |Text of the on toggle
129
+ `off` |string/html|"Off" |Text of the off toggle
130
+ `size` |string |"normal" |Size of the toggle. Possible values are: `large`, `normal`, `small`, `mini`.
131
+ `onstyle` |string |"primary" |Style of the on toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix
132
+ `offstyle`|string |"secondary"|Style of the off toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix
133
+ `onvalue` |string |*null* |Sets on state value
134
+ `offvalue`|string |*null* |Sets off state value
128
135
  `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.
129
136
  `width` |integer |*null* |Sets the width of the toggle. if set to *null*, width will be auto-calculated.
130
137
  `height` |integer |*null* |Sets the height of the toggle. if set to *null*, height will be auto-calculated.
138
+ `tabindex`|integer |0 |Sets the tabindex of the toggle.
139
+ `tristate`|boolean |false |Sets tristate support
131
140
 
132
141
  ## Methods
133
142
  Methods can be used to control toggles directly.
@@ -136,15 +145,18 @@ Methods can be used to control toggles directly.
136
145
  <input id="toggle-demo" type="checkbox" data-toggle="toggle">
137
146
  ```
138
147
 
139
- Method |Example |Description
140
- -----------|------------------------------------------------|------------------------------------------
141
- initialize | `$('#toggle-demo').bootstrapToggle()` |Initializes the toggle plugin with options
142
- destroy | `$('#toggle-demo').bootstrapToggle('destroy')` |Destroys the toggle
143
- on | `$('#toggle-demo').bootstrapToggle('on')` |Sets the toggle to 'On' state
144
- off | `$('#toggle-demo').bootstrapToggle('off')` |Sets the toggle to 'Off' state
145
- toggle | `$('#toggle-demo').bootstrapToggle('toggle')` |Toggles the state of the toggle on/off
146
- enable | `$('#toggle-demo').bootstrapToggle('enable')` |Enables the toggle
147
- disable | `$('#toggle-demo').bootstrapToggle('disable')` |Disables the toggle
148
+ Method |Example |Description
149
+ -------------|-----------------------------------------------------|------------------------------------------
150
+ initialize | `$('#toggle-demo').bootstrapToggle()` |Initializes the toggle plugin with options
151
+ destroy | `$('#toggle-demo').bootstrapToggle('destroy')` |Destroys the toggle
152
+ on | `$('#toggle-demo').bootstrapToggle('on')` |Sets the toggle to 'On' state
153
+ off | `$('#toggle-demo').bootstrapToggle('off')` |Sets the toggle to 'Off' state
154
+ toggle | `$('#toggle-demo').bootstrapToggle('toggle')` |Toggles the state of the toggle on/off
155
+ enable | `$('#toggle-demo').bootstrapToggle('enable')` |Enables the toggle
156
+ disable | `$('#toggle-demo').bootstrapToggle('disable')` |Disables the toggle
157
+ readonly | `$('#toggle-demo').bootstrapToggle('readonly')` |Disables the toggle but preserve checkbox enabled
158
+ indeterminate| `$('#toggle-demo').bootstrapToggle('indeterminate')`|Sets the toggle to 'indeterminate' state
159
+ determinate | `$('#toggle-demo').bootstrapToggle('determinate')` |Sets the toggle to 'determinate' state
148
160
 
149
161
  # Events
150
162
 
@@ -166,8 +178,7 @@ You should listen to events from the `<input type="checkbox">` directly rather t
166
178
  ```
167
179
 
168
180
  ## Stopping Event Propagation
169
- Passing `true` to the on, off and toggle methods will enable the silent option to prevent the control from propagating the change event in
170
- cases where you want to update the controls on/off state, but do not want to fire the onChange event.
181
+ 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.
171
182
 
172
183
  ```html
173
184
  <input id="toggle-silent" type="checkbox" data-toggle="toggle">
@@ -215,3 +226,12 @@ This also means that using the API or Input to trigger events will work both way
215
226
  }
216
227
  </script>
217
228
  ```
229
+ # Collaborators welcom!
230
+ - :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)
231
+ - :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)
232
+ - :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)
233
+ - :computer: ¿Do you know how to fix a bug? Open a pull request in [GitHub pull repuest](https://github.com/palcarazm/bootstrap5-toggle/compare).
234
+
235
+ [![GitHub Contributors](https://contrib.rocks/image?repo=palcarazm/bootstrap5-toggle)](https://github.com/palcarazm/bootstrap5-toggle/graphs/contributors)
236
+
237
+ ¿Do you like the project? Give us a :star: in [GitHub](https://github.com/palcarazm/bootstrap5-toggle).
@@ -1,9 +1,11 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.2
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
6
  * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
7
9
  * @license MIT
8
10
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
11
  */
@@ -29,6 +31,17 @@
29
31
  position: relative;
30
32
  overflow: hidden;
31
33
  }
34
+ .toggle:focus > .toggle-group > .btn,
35
+ .toggle:hover > .toggle-group > .btn{
36
+ color:var(--bs-btn-hover-color);
37
+ background-color: var(--bs-btn-hover-bg);
38
+ border-color: var(--bs-btn-hover-border-color);
39
+ }
40
+ .toggle:hover > .toggle-group > .toggle-handle,
41
+ .toggle:focus > .toggle-group > .toggle-handle {
42
+ background-color: var(--bs-light);
43
+ opacity: 0.5;
44
+ }
32
45
  .toggle input[type="checkbox"] {
33
46
  display: none;
34
47
  }
@@ -48,6 +61,9 @@
48
61
  .toggle.off .toggle-group {
49
62
  left: -100%;
50
63
  }
64
+ .toggle.indeterminate .toggle-group {
65
+ left: -50%;
66
+ }
51
67
  .toggle-on {
52
68
  position: absolute;
53
69
  top: 0;
@@ -77,8 +93,8 @@
77
93
  height: 100%;
78
94
  width: 0px;
79
95
  border-width: 0 1px;
80
- background-color: #fff;
81
- border-color: #fff;
96
+ background-color: var(--bs-light);
97
+ border-color: var(--bs-light);
82
98
  }
83
99
 
84
100
  /** Support for input-group
@@ -122,10 +138,6 @@
122
138
  background-color: var(--bs-dark);
123
139
  border-color: var(--bs-dark);
124
140
  }
125
- .toggle[class*="btn-outline"]:hover .toggle-handle {
126
- background-color: var(--bs-light);
127
- opacity: 0.5;
128
- }
129
141
 
130
142
  /* NOTE: Must come first, so classes below override as needed */
131
143
  /* [default] (bootstrap-4.1.3 - .btn - h:38px) */
@@ -1,12 +1,14 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.2
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
6
  * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
7
9
  * @license MIT
8
10
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
11
  */
10
12
 
11
- .btn-group-xs>.btn,.btn-xs{padding:.35rem .4rem .25rem .4rem;font-size:.875rem;line-height:.5;border-radius:.2rem}.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-1.25rem;margin-right:.35rem}.toggle{position:relative;overflow:hidden}.toggle input[type=checkbox]{display:none}.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;user-select:none;-moz-user-select:none;-webkit-user-select:none}.toggle-group label,.toggle-group span{cursor:pointer}.toggle.off .toggle-group{left:-100%}.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0;box-shadow:none}.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px;background-color:#fff;border-color:#fff}.input-group .toggle-off,.input-group .toggle-on{position:absolute}.toggle.btn-outline-primary .toggle-handle{background-color:var(--bs-primary);border-color:var(--bs-primary)}.toggle.btn-outline-secondary .toggle-handle{background-color:var(--bs-secondary);border-color:var(--bs-secondary)}.toggle.btn-outline-success .toggle-handle{background-color:var(--bs-success);border-color:var(--bs-success)}.toggle.btn-outline-danger .toggle-handle{background-color:var(--bs-danger);border-color:var(--bs-danger)}.toggle.btn-outline-warning .toggle-handle{background-color:var(--bs-warning);border-color:var(--bs-warning)}.toggle.btn-outline-info .toggle-handle{background-color:var(--bs-info);border-color:var(--bs-info)}.toggle.btn-outline-light .toggle-handle{background-color:var(--bs-light);border-color:var(--bs-light)}.toggle.btn-outline-dark .toggle-handle{background-color:var(--bs-dark);border-color:var(--bs-dark)}.toggle[class*=btn-outline]:hover .toggle-handle{background-color:var(--bs-light);opacity:.5}.toggle.btn{min-width:3.7rem;min-height:2.15rem}.toggle-on.btn{padding-right:1.5rem}.toggle-off.btn{padding-left:1.5rem}.toggle.btn-lg{min-width:5rem;min-height:2.815rem}.toggle-on.btn-lg{padding-right:2rem}.toggle-off.btn-lg{padding-left:2rem}.toggle-handle.btn-lg{width:2.5rem}.toggle.btn-sm{min-width:3.125rem;min-height:1.938rem}.toggle-on.btn-sm{padding-right:1rem}.toggle-off.btn-sm{padding-left:1rem}.toggle.btn-xs{min-width:2.19rem;min-height:1.375rem}.toggle-on.btn-xs{padding-right:.8rem}.toggle-off.btn-xs{padding-left:.8rem}
13
+ .btn-group-xs>.btn,.btn-xs{padding:.35rem .4rem .25rem .4rem;font-size:.875rem;line-height:.5;border-radius:.2rem}.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-1.25rem;margin-right:.35rem}.toggle{position:relative;overflow:hidden}.toggle:focus>.toggle-group>.btn,.toggle:hover>.toggle-group>.btn{color:var(--bs-btn-hover-color);background-color:var(--bs-btn-hover-bg);border-color:var(--bs-btn-hover-border-color)}.toggle:focus>.toggle-group>.toggle-handle,.toggle:hover>.toggle-group>.toggle-handle{background-color:var(--bs-light);opacity:.5}.toggle input[type=checkbox]{display:none}.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;user-select:none;-moz-user-select:none;-webkit-user-select:none}.toggle-group label,.toggle-group span{cursor:pointer}.toggle.off .toggle-group{left:-100%}.toggle.indeterminate .toggle-group{left:-50%}.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0;box-shadow:none}.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px;background-color:var(--bs-light);border-color:var(--bs-light)}.input-group .toggle-off,.input-group .toggle-on{position:absolute}.toggle.btn-outline-primary .toggle-handle{background-color:var(--bs-primary);border-color:var(--bs-primary)}.toggle.btn-outline-secondary .toggle-handle{background-color:var(--bs-secondary);border-color:var(--bs-secondary)}.toggle.btn-outline-success .toggle-handle{background-color:var(--bs-success);border-color:var(--bs-success)}.toggle.btn-outline-danger .toggle-handle{background-color:var(--bs-danger);border-color:var(--bs-danger)}.toggle.btn-outline-warning .toggle-handle{background-color:var(--bs-warning);border-color:var(--bs-warning)}.toggle.btn-outline-info .toggle-handle{background-color:var(--bs-info);border-color:var(--bs-info)}.toggle.btn-outline-light .toggle-handle{background-color:var(--bs-light);border-color:var(--bs-light)}.toggle.btn-outline-dark .toggle-handle{background-color:var(--bs-dark);border-color:var(--bs-dark)}.toggle.btn{min-width:3.7rem;min-height:2.15rem}.toggle-on.btn{padding-right:1.5rem}.toggle-off.btn{padding-left:1.5rem}.toggle.btn-lg{min-width:5rem;min-height:2.815rem}.toggle-on.btn-lg{padding-right:2rem}.toggle-off.btn-lg{padding-left:2rem}.toggle-handle.btn-lg{width:2.5rem}.toggle.btn-sm{min-width:3.125rem;min-height:1.938rem}.toggle-on.btn-sm{padding-right:1rem}.toggle-off.btn-sm{padding-left:1rem}.toggle.btn-xs{min-width:2.19rem;min-height:1.375rem}.toggle-on.btn-xs{padding-right:.8rem}.toggle-off.btn-xs{padding-left:.8rem}
12
14
  /*# sourceMappingURL=bootstrap5-toggle.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["css\\bootstrap5-toggle.css"],"names":[],"mappings":"AAeA,mBAAsB,QACrB,QAAS,OAAO,MAAM,OAAO,MAC7B,UAAW,QACX,YAAa,GACb,cAAe,MAGhB,wBAAyB,yBACxB,YAAa,SACb,aAAc,OAGf,QACC,SAAU,SACV,SAAU,OAEX,6BACC,QAAS,KAEV,cACC,SAAU,SACV,MAAO,KACP,IAAK,EACL,OAAQ,EACR,KAAM,EACN,WAAY,KAAK,KACjB,mBAAoB,KAAK,KACzB,YAAa,KACb,iBAAkB,KAClB,oBAAqB,KAEtB,oBAAqB,mBAAqB,OAAQ,QAClD,0BACC,KAAM,MAEP,WACC,SAAU,SACV,IAAK,EACL,OAAQ,EACR,KAAM,EACN,MAAO,IACP,OAAQ,EACR,OAAQ,EACR,cAAe,EAEhB,YACC,SAAU,SACV,IAAK,EACL,OAAQ,EACR,KAAM,IACN,MAAO,EACP,OAAQ,EACR,OAAQ,EACR,cAAe,EACf,WAAY,KAEb,eACC,SAAU,SACV,OAAQ,EAAE,KACV,YAAa,EACb,eAAgB,EAChB,OAAQ,KACR,MAAO,EACP,aAAc,EAAE,IAChB,iBAAkB,KAClB,aAAc,KAQf,yBADA,wBAEI,SAAU,SAGd,2CACC,iBAAkB,kBAClB,aAAc,kBAEf,6CACC,iBAAkB,oBAClB,aAAc,oBAEf,2CACC,iBAAkB,kBAClB,aAAc,kBAEf,0CACC,iBAAkB,iBAClB,aAAc,iBAEf,2CACC,iBAAkB,kBAClB,aAAc,kBAEf,wCACC,iBAAkB,eAClB,aAAc,eAEf,yCACC,iBAAkB,gBAClB,aAAc,gBAEf,wCACC,iBAAkB,eAClB,aAAc,eAEf,iDACC,iBAAkB,gBAClB,QAAS,GAKV,YAAc,UAAW,OAAQ,WAAY,QAC7C,eAAiB,cAAe,OAChC,gBAAkB,aAAc,OAGhC,eAAiB,UAAW,KAAM,WAAY,SAC9C,kBAAoB,cAAe,KACnC,mBA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Ef,wCACC,iBAAkB,eAClB,aAAc,eAEf,yCACC,iBAAkB,gBAClB,aAAc,gBAEf,wCACC,iBAAkB,eAClB,aAAc,eAKf,YAAc,UAAW,OAAQ,WAAY,QAC7C,eAAiB,cAAe,OAChC,gBAAkB,aAAc,OAGhC,eAAiB,UAAW,KAAM,WAAY,SAC9C,kBAAoB,cAAe,KACnC,mBAAqB,aAAc,KACnC,sBAAwB,MAAO,OAG/B,eAAiB,UAAW,SAAU,WAAY,SAClD,kBAAoB,cAAe,KACnC,mBAAqB,aAAc,KAGnC,eAAiB,UAAW,QAAS,WAAY,SACjD,kBAAoB,cAAe,MACnC,mBAAqB,aAAc"}
@@ -0,0 +1,2 @@
1
+ *
2
+ !.gitignore
@@ -0,0 +1,346 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v4.3.2
3
+ * https://palcarazm.github.io/bootstrap5-toggle/
4
+ * @author 2011-2014 Min Hur (https://github.com/minhur)
5
+ * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
+ * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
9
+ * @license MIT
10
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
11
+ */
12
+
13
+
14
+ 'use strict';
15
+
16
+ (function() {
17
+ /**
18
+ * `Toggle` is instantiated for each toggle-button
19
+ */
20
+ class Toggle {
21
+ constructor(element, options) {
22
+ const DEFAULTS = {
23
+ on: 'On',
24
+ onstyle: 'primary',
25
+ onvalue: null,
26
+ off: 'Off',
27
+ offstyle: 'secondary',
28
+ offvalue: null,
29
+ size: '',
30
+ style: '',
31
+ width: null,
32
+ height: null,
33
+ tabindex: 0,
34
+ tristate: false,
35
+ name: null
36
+ };
37
+ options = options || {};
38
+
39
+ // A: Capture ref to HMTL element
40
+ this.element = element;
41
+
42
+ // B: Set options
43
+ this.options = {
44
+ on: this.element.getAttribute('data-on') || options.on || DEFAULTS.on,
45
+ onstyle: this.element.getAttribute('data-onstyle') || options.onstyle || DEFAULTS.onstyle,
46
+ onvalue: this.element.getAttribute('value') || this.element.getAttribute('data-onvalue') || options.onvalue || DEFAULTS.onvalue,
47
+ off: this.element.getAttribute('data-off') || options.off || DEFAULTS.off,
48
+ offstyle: this.element.getAttribute('data-offstyle') || options.offstyle || DEFAULTS.offstyle,
49
+ offvalue: this.element.getAttribute('data-offvalue') || options.offvalue || DEFAULTS.offvalue,
50
+ size: this.element.getAttribute('data-size') || options.size || DEFAULTS.size,
51
+ style: this.element.getAttribute('data-style') || options.style || DEFAULTS.style,
52
+ width: this.element.getAttribute('data-width') || options.width || DEFAULTS.width,
53
+ height: this.element.getAttribute('data-height') || options.height || DEFAULTS.height,
54
+ tabindex: this.element.getAttribute('tabindex') || options.tabindex || DEFAULTS.tabindex,
55
+ tristate: this.element.hasAttribute('tristate') || options.tristate || DEFAULTS.tristate,
56
+ name: this.element.getAttribute('name') || options.name || DEFAULTS.name,
57
+ };
58
+
59
+ // LAST: Render Toggle
60
+ this.render();
61
+ }
62
+ render() {
63
+ function calcH(el) {
64
+ const styles = window.getComputedStyle(el);
65
+ const height = el.offsetHeight;
66
+ const borderTopWidth = parseFloat(styles.borderTopWidth);
67
+ const borderBottomWidth = parseFloat(styles.borderBottomWidth);
68
+ const paddingTop = parseFloat(styles.paddingTop);
69
+ const paddingBottom = parseFloat(styles.paddingBottom);
70
+
71
+ return height - borderBottomWidth - borderTopWidth - paddingTop - paddingBottom;
72
+ }
73
+ // 0: Parse size
74
+ let size;
75
+ switch (this.options.size ) {
76
+ case 'large':
77
+ case 'lg':
78
+ size = 'btn-lg';
79
+ break;
80
+ case 'small':
81
+ case 'sm':
82
+ size = 'btn-sm';
83
+ break;
84
+ case 'mini':
85
+ case 'xs':
86
+ size = 'btn-xs';
87
+ break;
88
+ default:
89
+ size = ''
90
+ break;
91
+ }
92
+
93
+ // 1: On
94
+ let ecmasToggleOn = document.createElement('label');
95
+ ecmasToggleOn.setAttribute('class', 'btn btn-' + this.options.onstyle + ' ' + size);
96
+ ecmasToggleOn.setAttribute('for', this.element.id);
97
+ ecmasToggleOn.innerHTML = this.options.on;
98
+
99
+ // 2: Off
100
+ let ecmasToggleOff = document.createElement('label');
101
+ ecmasToggleOff.setAttribute('class', 'btn btn-' + this.options.offstyle + ' ' + size);
102
+ ecmasToggleOff.setAttribute('for', this.element.id);
103
+ ecmasToggleOff.innerHTML = this.options.off;
104
+
105
+ // 3: Handle
106
+ let ecmasToggleHandle = document.createElement('span');
107
+ ecmasToggleHandle.setAttribute('class', 'toggle-handle btn ' + size);
108
+
109
+ // 4: Toggle Group
110
+ let ecmasToggleGroup = document.createElement('div');
111
+ ecmasToggleGroup.setAttribute('class', 'toggle-group');
112
+ ecmasToggleGroup.appendChild(ecmasToggleOn);
113
+ ecmasToggleGroup.appendChild(ecmasToggleOff);
114
+ ecmasToggleGroup.appendChild(ecmasToggleHandle);
115
+
116
+ // 5: Toggle
117
+ let ecmasToggle = document.createElement('div');
118
+ ecmasToggle.setAttribute('class', 'toggle btn');
119
+ ecmasToggle.classList.add(this.element.checked ? 'btn-' + this.options.onstyle : 'btn-' + this.options.offstyle);
120
+ ecmasToggle.setAttribute('tabindex',this.options.tabindex);
121
+ if (!this.element.checked) ecmasToggle.classList.add('off');
122
+ if (this.options.size) ecmasToggle.classList.add(size);
123
+ if (this.options.style) {
124
+ (this.options.style).split(' ').forEach((style)=>{
125
+ ecmasToggle.classList.add(style);
126
+ });
127
+ }
128
+ if (this.element.disabled || this.element.readOnly){
129
+ ecmasToggle.classList.add('disabled');
130
+ ecmasToggle.setAttribute('disabled', 'disabled');
131
+ }
132
+
133
+ // 6: Set form values
134
+ if(this.options.onvalue) this.element.setAttribute('value', this.options.onvalue);
135
+ let invElement = null;
136
+ if(this.options.offvalue){
137
+ invElement = this.element.cloneNode();
138
+ invElement.setAttribute('value',this.options.offvalue);
139
+ invElement.setAttribute('data-toggle', 'invert-toggle');
140
+ invElement.removeAttribute('id');
141
+ invElement.checked = !this.element.checked;
142
+ }
143
+
144
+ // 7: Replace HTML checkbox with Toggle-Button
145
+ this.element.parentElement.insertBefore(ecmasToggle, this.element);
146
+ ecmasToggle.appendChild(this.element);
147
+ if(invElement) ecmasToggle.appendChild(invElement);
148
+ ecmasToggle.appendChild(ecmasToggleGroup);
149
+
150
+ // 8: Set button W/H, lineHeight
151
+ {
152
+ // A: Set style W/H
153
+ // NOTE: `offsetWidth` returns *rounded* integer values, so use `getBoundingClientRect` instead.
154
+ ecmasToggle.style.width =
155
+ (this.options.width ||
156
+ Math.max(ecmasToggleOn.getBoundingClientRect().width, ecmasToggleOff.getBoundingClientRect().width) + ecmasToggleHandle.getBoundingClientRect().width / 2) + 'px';
157
+ ecmasToggle.style.height = (this.options.height || Math.max(ecmasToggleOn.getBoundingClientRect().height, ecmasToggleOff.getBoundingClientRect().height)) + 'px';
158
+
159
+ // B: Apply on/off class
160
+ ecmasToggleOn.classList.add('toggle-on');
161
+ ecmasToggleOff.classList.add('toggle-off');
162
+
163
+ // C: Finally, set lineHeight if needed
164
+ if (this.options.height) {
165
+ ecmasToggleOn.style.lineHeight = calcH(ecmasToggleOn) + 'px';
166
+ ecmasToggleOff.style.lineHeight = calcH(ecmasToggleOff) + 'px';
167
+ }
168
+ }
169
+
170
+ // 9: Add listeners
171
+ ecmasToggle.addEventListener('touchstart', (e)=>{
172
+ this.#toggleActionPerformed(e)
173
+ });
174
+ ecmasToggle.addEventListener('click', (e)=>{
175
+ this.#toggleActionPerformed(e)
176
+ });
177
+ ecmasToggle.addEventListener('keypress', (e)=>{
178
+ if(e.key == " "){
179
+ this.#toggleActionPerformed(e)
180
+ }
181
+ });
182
+
183
+ // 10: Set elements to bootstrap object
184
+ this.ecmasToggle = ecmasToggle;
185
+ this.invElement = invElement;
186
+
187
+ // 11: Keep reference to this instance for subsequent calls via `getElementById().bootstrapToggle()`
188
+ this.element.bsToggle = this;
189
+ }
190
+
191
+ /**
192
+ * Trigger actions
193
+ * @param {Event} e event
194
+ */
195
+ #toggleActionPerformed(e){
196
+ if(this.options.tristate){
197
+ if(this.ecmasToggle.classList.contains('indeterminate')){
198
+ this.determinate(true);
199
+ this.toggle();
200
+ }else{
201
+ this.indeterminate();
202
+ }
203
+ }else{
204
+ this.toggle()
205
+ }
206
+ e.preventDefault()
207
+ }
208
+
209
+ toggle(silent = false) {
210
+ if (this.element.checked) this.off(silent);
211
+ else this.on(silent);
212
+ }
213
+
214
+ on(silent = false) {
215
+ if (this.element.disabled || this.element.readOnly) return false;
216
+ this.ecmasToggle.classList.remove('btn-' + this.options.offstyle);
217
+ this.ecmasToggle.classList.add('btn-' + this.options.onstyle);
218
+ this.ecmasToggle.classList.remove('off');
219
+ this.element.checked = true;
220
+ if(this.invElement) this.invElement.checked = false;
221
+ if (!silent) this.trigger();
222
+ }
223
+
224
+ off(silent = false) {
225
+ if (this.element.disabled || this.element.readOnly) return false;
226
+ this.ecmasToggle.classList.remove('btn-' + this.options.onstyle);
227
+ this.ecmasToggle.classList.add('btn-' + this.options.offstyle);
228
+ this.ecmasToggle.classList.add('off');
229
+ this.element.checked = false;
230
+ if(this.invElement) this.invElement.checked = true;
231
+ if (!silent) this.trigger();
232
+ }
233
+
234
+ indeterminate(silent = false) {
235
+ if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false;
236
+ this.ecmasToggle.classList.add('indeterminate');
237
+ this.element.indeterminate = true;
238
+ this.element.removeAttribute('name');
239
+ if(this.invElement) this.invElement.indeterminate = true;
240
+ if(this.invElement) this.invElement.removeAttribute('name');
241
+ if (!silent) this.trigger()
242
+ }
243
+
244
+ determinate(silent = false) {
245
+ if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false;
246
+ this.ecmasToggle.classList.remove('indeterminate');
247
+ this.element.indeterminate = false;
248
+ if(this.options.name) this.element.setAttribute('name', this.options.name);
249
+ if(this.invElement) this.invElement.indeterminate = false;
250
+ if(this.invElement && this.options.name) this.invElement.setAttribute('name', this.options.name);
251
+ if (!silent) this.trigger()
252
+ }
253
+
254
+ enable() {
255
+ this.ecmasToggle.classList.remove('disabled');
256
+ this.ecmasToggle.removeAttribute('disabled');
257
+ this.element.removeAttribute('disabled');
258
+ this.element.removeAttribute('readonly');
259
+ if(this.invElement) {
260
+ this.invElement.removeAttribute('disabled');
261
+ this.invElement.removeAttribute('readonly');
262
+ }
263
+ }
264
+
265
+ disable() {
266
+ this.ecmasToggle.classList.add('disabled');
267
+ this.ecmasToggle.setAttribute('disabled', '');
268
+ this.element.setAttribute('disabled', '');
269
+ this.element.removeAttribute('readonly');
270
+ if(this.invElement) {
271
+ this.invElement.setAttribute('disabled', '');
272
+ this.invElement.removeAttribute('readonly');
273
+ }
274
+ }
275
+
276
+ readonly() {
277
+ this.ecmasToggle.classList.add('disabled');
278
+ this.ecmasToggle.setAttribute('disabled', '');
279
+ this.element.removeAttribute('disabled');
280
+ this.element.setAttribute('readonly', '');
281
+ if(this.invElement) {
282
+ this.invElement.removeAttribute('disabled');
283
+ this.invElement.setAttribute('readonly', '');
284
+ }
285
+ }
286
+
287
+ update(silent) {
288
+ if (this.element.disabled) this.disable();
289
+ else if (this.element.readOnly) this.readonly();
290
+ else this.enable();
291
+ if (this.element.checked) this.on(silent);
292
+ else this.off(silent);
293
+ }
294
+
295
+ trigger(silent) {
296
+ if (!silent) this.element.dispatchEvent(new Event('change', { bubbles: true }));
297
+ }
298
+
299
+ destroy() {
300
+ // A: Remove button-group from UI, replace checkbox element
301
+ this.ecmasToggle.parentNode.insertBefore(this.element, this.ecmasToggle);
302
+ this.ecmasToggle.parentNode.removeChild(this.ecmasToggle);
303
+
304
+ // B: Delete internal refs
305
+ delete this.element.bsToggle;
306
+ delete this.ecmasToggle;
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Add `bootstrapToggle` prototype function to HTML Elements
312
+ * Enables execution when used with HTML - ex: `document.getElementById('toggle').bootstrapToggle('on')`
313
+ */
314
+ Element.prototype.bootstrapToggle = function(options, silent) {
315
+ let _bsToggle = this.bsToggle || new Toggle(this, options);
316
+
317
+ // Execute method calls
318
+ if (options && typeof options === 'string') {
319
+ if (options.toLowerCase() == 'toggle') _bsToggle.toggle(silent);
320
+ else if (options.toLowerCase() == 'on') _bsToggle.on(silent);
321
+ else if (options.toLowerCase() == 'off') _bsToggle.off(silent);
322
+ else if (options.toLowerCase() == 'indeterminate') _bsToggle.indeterminate(silent);
323
+ else if (options.toLowerCase() == 'determinate') _bsToggle.determinate(silent);
324
+ else if (options.toLowerCase() == 'enable') _bsToggle.enable();
325
+ else if (options.toLowerCase() == 'disable') _bsToggle.disable();
326
+ else if (options.toLowerCase() == 'readonly') _bsToggle.readonly();
327
+ else if (options.toLowerCase() == 'destroy') _bsToggle.destroy();
328
+ }
329
+ };
330
+
331
+ /**
332
+ * Replace all `input[type=checkbox][data-toggle="toggle"]` inputs with "Bootstrap-Toggle"
333
+ * Executes once page elements have rendered enabling script to be placed in `<head>`
334
+ */
335
+ if (typeof window !== 'undefined')
336
+ window.onload = function() {
337
+ document.querySelectorAll('input[type=checkbox][data-toggle="toggle"]').forEach(function(ele) {
338
+ ele.bootstrapToggle();
339
+ });
340
+ };
341
+
342
+ // Export library if possible
343
+ if (typeof module !== 'undefined' && module.exports) {
344
+ module.exports = Toggle;
345
+ }
346
+ })();
@@ -0,0 +1,14 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v4.3.2
3
+ * https://palcarazm.github.io/bootstrap5-toggle/
4
+ * @author 2011-2014 Min Hur (https://github.com/minhur)
5
+ * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
+ * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
9
+ * @license MIT
10
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
11
+ */
12
+
13
+ "use strict";!function(){class s{constructor(e,t){const i="On",s="primary",n=null,l="Off",o="secondary",a=null,d="",h="",r=null,m=null,g=0,c=!1,b=null;t=t||{},this.element=e,this.options={on:this.element.getAttribute("data-on")||t.on||i,onstyle:this.element.getAttribute("data-onstyle")||t.onstyle||s,onvalue:this.element.getAttribute("value")||this.element.getAttribute("data-onvalue")||t.onvalue||n,off:this.element.getAttribute("data-off")||t.off||l,offstyle:this.element.getAttribute("data-offstyle")||t.offstyle||o,offvalue:this.element.getAttribute("data-offvalue")||t.offvalue||a,size:this.element.getAttribute("data-size")||t.size||d,style:this.element.getAttribute("data-style")||t.style||h,width:this.element.getAttribute("data-width")||t.width||r,height:this.element.getAttribute("data-height")||t.height||m,tabindex:this.element.getAttribute("tabindex")||t.tabindex||g,tristate:this.element.hasAttribute("tristate")||t.tristate||c,name:this.element.getAttribute("name")||t.name||b},this.render()}render(){function e(e){var t=window.getComputedStyle(e),e=e.offsetHeight,i=parseFloat(t.borderTopWidth);return e-parseFloat(t.borderBottomWidth)-i-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}let t;switch(this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}let i=document.createElement("label"),s=(i.setAttribute("class","btn btn-"+this.options.onstyle+" "+t),i.setAttribute("for",this.element.id),i.innerHTML=this.options.on,document.createElement("label")),n=(s.setAttribute("class","btn btn-"+this.options.offstyle+" "+t),s.setAttribute("for",this.element.id),s.innerHTML=this.options.off,document.createElement("span")),l=(n.setAttribute("class","toggle-handle btn "+t),document.createElement("div")),o=(l.setAttribute("class","toggle-group"),l.appendChild(i),l.appendChild(s),l.appendChild(n),document.createElement("div")),a=(o.setAttribute("class","toggle btn"),o.classList.add(this.element.checked?"btn-"+this.options.onstyle:"btn-"+this.options.offstyle),o.setAttribute("tabindex",this.options.tabindex),this.element.checked||o.classList.add("off"),this.options.size&&o.classList.add(t),this.options.style&&this.options.style.split(" ").forEach(e=>{o.classList.add(e)}),(this.element.disabled||this.element.readOnly)&&(o.classList.add("disabled"),o.setAttribute("disabled","disabled")),this.options.onvalue&&this.element.setAttribute("value",this.options.onvalue),null);this.options.offvalue&&((a=this.element.cloneNode()).setAttribute("value",this.options.offvalue),a.setAttribute("data-toggle","invert-toggle"),a.removeAttribute("id"),a.checked=!this.element.checked),this.element.parentElement.insertBefore(o,this.element),o.appendChild(this.element),a&&o.appendChild(a),o.appendChild(l),o.style.width=(this.options.width||Math.max(i.getBoundingClientRect().width,s.getBoundingClientRect().width)+n.getBoundingClientRect().width/2)+"px",o.style.height=(this.options.height||Math.max(i.getBoundingClientRect().height,s.getBoundingClientRect().height))+"px",i.classList.add("toggle-on"),s.classList.add("toggle-off"),this.options.height&&(i.style.lineHeight=e(i)+"px",s.style.lineHeight=e(s)+"px"),o.addEventListener("touchstart",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("click",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("keypress",e=>{" "==e.key&&this.#toggleActionPerformed(e)}),this.ecmasToggle=o,this.invElement=a,this.element.bsToggle=this}#toggleActionPerformed(e){this.options.tristate?this.ecmasToggle.classList.contains("indeterminate")?(this.determinate(!0),this.toggle()):this.indeterminate():this.toggle(),e.preventDefault()}toggle(e=!1){this.element.checked?this.off(e):this.on(e)}on(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("btn-"+this.options.onstyle),this.ecmasToggle.classList.remove("off"),this.element.checked=!0,this.invElement&&(this.invElement.checked=!1),e||this.trigger()}off(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.onstyle),this.ecmasToggle.classList.add("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("off"),this.element.checked=!1,this.invElement&&(this.invElement.checked=!0),e||this.trigger()}indeterminate(e=!1){if(!this.options.tristate||this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.add("indeterminate"),this.element.indeterminate=!0,this.element.removeAttribute("name"),this.invElement&&(this.invElement.indeterminate=!0),this.invElement&&this.invElement.removeAttribute("name"),e||this.trigger()}determinate(e=!1){if(!this.options.tristate||this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("indeterminate"),this.element.indeterminate=!1,this.options.name&&this.element.setAttribute("name",this.options.name),this.invElement&&(this.invElement.indeterminate=!1),this.invElement&&this.options.name&&this.invElement.setAttribute("name",this.options.name),e||this.trigger()}enable(){this.ecmasToggle.classList.remove("disabled"),this.ecmasToggle.removeAttribute("disabled"),this.element.removeAttribute("disabled"),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.removeAttribute("readonly"))}disable(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.setAttribute("disabled",""),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.setAttribute("disabled",""),this.invElement.removeAttribute("readonly"))}readonly(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.removeAttribute("disabled"),this.element.setAttribute("readonly",""),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.setAttribute("readonly",""))}update(e){this.element.disabled?this.disable():this.element.readOnly?this.readonly():this.enable(),this.element.checked?this.on(e):this.off(e)}trigger(e){e||this.element.dispatchEvent(new Event("change",{bubbles:!0}))}destroy(){this.ecmasToggle.parentNode.insertBefore(this.element,this.ecmasToggle),this.ecmasToggle.parentNode.removeChild(this.ecmasToggle),delete this.element.bsToggle,delete this.ecmasToggle}}Element.prototype.bootstrapToggle=function(e,t){let i=this.bsToggle||new s(this,e);e&&"string"==typeof e&&("toggle"==e.toLowerCase()?i.toggle(t):"on"==e.toLowerCase()?i.on(t):"off"==e.toLowerCase()?i.off(t):"indeterminate"==e.toLowerCase()?i.indeterminate(t):"determinate"==e.toLowerCase()?i.determinate(t):"enable"==e.toLowerCase()?i.enable():"disable"==e.toLowerCase()?i.disable():"readonly"==e.toLowerCase()?i.readonly():"destroy"==e.toLowerCase()&&i.destroy())},"undefined"!=typeof window&&(window.onload=function(){document.querySelectorAll('input[type=checkbox][data-toggle="toggle"]').forEach(function(e){e.bootstrapToggle()})}),"undefined"!=typeof module&&module.exports&&(module.exports=s)}();
14
+ //# sourceMappingURL=bootstrap5-toggle.ecmas.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap5-toggle.ecmas.min.js","sources":["bootstrap5-toggle.ecmas.js"],"names":["Toggle","constructor","element","options","DEFAULTS","this","on","getAttribute","onstyle","onvalue","off","offstyle","offvalue","size","style","width","height","tabindex","tristate","hasAttribute","name","render","calcH","el","styles","window","getComputedStyle","offsetHeight","borderTopWidth","parseFloat","borderBottomWidth","paddingTop","paddingBottom","let","ecmasToggleOn","document","createElement","ecmasToggleOff","setAttribute","id","innerHTML","ecmasToggleHandle","ecmasToggleGroup","ecmasToggle","appendChild","invElement","classList","add","checked","split","forEach","disabled","readOnly","cloneNode","removeAttribute","parentElement","insertBefore","Math","max","getBoundingClientRect","lineHeight","addEventListener","#toggleActionPerformed","e","key","bsToggle","contains","determinate","toggle","indeterminate","preventDefault","silent","remove","trigger","enable","disable","readonly","update","dispatchEvent","Event","bubbles","destroy","parentNode","removeChild","Element","prototype","bootstrapToggle","_bsToggle","toLowerCase","onload","querySelectorAll","ele","module","exports"],"mappings":"cAeA,iBAIOA,EACLC,YAAYC,EAASC,GACpB,MAAMC,EACD,KADCA,EAEI,UAFJA,EAGI,KAHJA,EAIA,MAJAA,EAKK,YALLA,EAMK,KANLA,EAOC,GAPDA,EAQE,GARFA,EASE,KATFA,EAUG,KAVHA,EAWK,EAXLA,GAYK,EAZLA,EAaC,KAEPD,EAAUA,GAAW,GAGrBE,KAAKH,QAAUA,EAGfG,KAAKF,QAAU,CACdG,GAAID,KAAKH,QAAQK,aAAa,YAAcJ,EAAQG,IAAMF,EAC1DI,QAASH,KAAKH,QAAQK,aAAa,iBAAmBJ,EAAQK,SAAWJ,EACzEK,QAASJ,KAAKH,QAAQK,aAAa,UAAYF,KAAKH,QA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ACrDtC,IAAIsD,EAAYlF,KAAK4D,UAAY,IAAIjE,EAAOK,KAAMF,GAG9CA,GAA8B,iBAAZA,IACQ,UAAzBA,EAAQqF,cAA2BD,EAAUnB,OAAOG,GACtB,MAAzBpE,EAAQqF,cAAuBD,EAAUjF,GAAGiE,GACnB,OAAzBpE,EAAQqF,cAAwBD,EAAU7E,IAAI6D,GACrB,iBAAzBpE,EAAQqF,cAAkCD,EAAUlB,cAAcE,GACzC,eAAzBpE,EAAQqF,cAAgCD,EAAUpB,YAAYI,GACrC,UAAzBpE,EAAQqF,cAA2BD,EAAUb,SACpB,WAAzBvE,EAAQqF,cAA4BD,EAAUZ,UACrB,YAAzBxE,EAAQqF,cAA6BD,EAAUX,WACtB,WAAzBzE,EAAQqF,eAA4BD,EAAUN,YAQnC,oBAAXxD,SACVA,OAAOgE,OAAS,WACftD,SAASuD,iBAAiB,8CAA8CxC,QAAQ,SAASyC,GACxFA,EAAIL,sBAKe,oBAAXM,QAA0BA,OAAOC,UAC3CD,OAAOC,QAAU7F,GAxUnB"}
@@ -1,9 +1,11 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.2
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
6
  * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
7
9
  * @license MIT
8
10
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
11
  */
@@ -15,9 +17,12 @@
15
17
  // TOGGLE PUBLIC CLASS DEFINITION
16
18
  // ==============================
17
19
 
18
- var Toggle = function (element, options) {
20
+ let Toggle = function (element, options) {
21
+ // A: Capture ref to HMTL element
19
22
  this.$element = $(element)
23
+ // B: Set options
20
24
  this.options = $.extend({}, this.defaults(), options)
25
+ // LAST: Render Toggle
21
26
  this.render()
22
27
  }
23
28
 
@@ -26,10 +31,15 @@
26
31
  off: 'Off',
27
32
  onstyle: 'primary',
28
33
  offstyle: 'secondary',
34
+ onvalue: null,
35
+ offvalue: null,
29
36
  size: 'normal',
30
37
  style: '',
31
38
  width: null,
32
- height: null
39
+ height: null,
40
+ tabindex: 0,
41
+ tristate: false,
42
+ name: null,
33
43
  }
34
44
 
35
45
  Toggle.prototype.defaults = function() {
@@ -38,17 +48,21 @@
38
48
  off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
39
49
  onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
40
50
  offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,
51
+ onvalue: this.$element.attr('value') || this.$element.attr('data-onvalue') || Toggle.DEFAULTS.onvalue,
52
+ offvalue: this.$element.attr('data-offvalue') || Toggle.DEFAULTS.offvalue,
41
53
  size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
42
54
  style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
43
55
  width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
44
- height: this.$element.attr('data-height') || Toggle.DEFAULTS.height
56
+ height: this.$element.attr('data-height') || Toggle.DEFAULTS.height,
57
+ tabindex: this.$element.attr('tabindex') || Toggle.DEFAULTS.tabindex,
58
+ tristate: this.$element.is('[tristate]') || Toggle.DEFAULTS.tristate,
59
+ name: this.$element.attr('name') || Toggle.DEFAULTS.name,
45
60
  }
46
61
  }
47
62
 
48
63
  Toggle.prototype.render = function () {
49
- this._onstyle = 'btn-' + this.options.onstyle
50
- this._offstyle = 'btn-' + this.options.offstyle
51
- var size;
64
+ // 0: Parse size
65
+ let size;
52
66
  switch (this.options.size ) {
53
67
  case 'large':
54
68
  case 'lg':
@@ -66,38 +80,106 @@
66
80
  size = ''
67
81
  break;
68
82
  }
69
- var $toggleOn = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.on)
70
- .addClass(this._onstyle + ' ' + size)
71
- var $toggleOff = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.off)
72
- .addClass(this._offstyle + ' ' + size)
73
- var $toggleHandle = $('<span class="toggle-handle btn">')
83
+
84
+ // 1: On
85
+ let $toggleOn = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.on)
86
+ .addClass('btn-' +this.options.onstyle + ' ' + size)
87
+
88
+ // 2: Off
89
+ let $toggleOff = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.off)
90
+ .addClass('btn-' +this.options.offstyle + ' ' + size)
91
+
92
+ // 3: Handle
93
+ let $toggleHandle = $('<span class="toggle-handle btn">')
74
94
  .addClass(size)
75
- var $toggleGroup = $('<div class="toggle-group">')
95
+
96
+ // 4: Toggle Group
97
+ let $toggleGroup = $('<div class="toggle-group">')
76
98
  .append($toggleOn, $toggleOff, $toggleHandle)
77
- var $toggle = $('<div class="toggle btn" data-toggle="toggle" role="button">')
78
- .addClass( this.$element.prop('checked') ? this._onstyle : this._offstyle+' off' )
99
+
100
+ // 5: Toggle
101
+ let $toggle = $('<div class="toggle btn" data-toggle="toggle" role="button">')
102
+ .addClass( this.$element.prop('checked') ? 'btn-' +this.options.onstyle : 'btn-' +this.options.offstyle+' off' )
79
103
  .addClass(size).addClass(this.options.style)
104
+ .attr('tabindex', this.options.tabindex)
105
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')){
106
+ $toggle.addClass('disabled')
107
+ $toggle.attr('disabled', 'disabled')
108
+ }
109
+
110
+ // 6: Set form values
111
+ if(this.options.onvalue) this.$element.val(this.options.onvalue)
112
+ let $invElement = null;
113
+ if(this.options.offvalue){
114
+ $invElement = this.$element.clone();
115
+ $invElement.val(this.options.offvalue);
116
+ $invElement.attr('data-toggle', 'invert-toggle');
117
+ $invElement.removeAttr('id');
118
+ $invElement.prop('checked', !this.$element.prop('checked'));
119
+ }
80
120
 
121
+ // 7: Replace HTML checkbox with Toggle-Button
81
122
  this.$element.wrap($toggle)
82
123
  $.extend(this, {
83
124
  $toggle: this.$element.parent(),
84
125
  $toggleOn: $toggleOn,
85
126
  $toggleOff: $toggleOff,
86
- $toggleGroup: $toggleGroup
127
+ $toggleGroup: $toggleGroup,
128
+ $invElement: $invElement
87
129
  })
88
- this.$toggle.append($toggleGroup)
89
-
90
- var width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2)
91
- var height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight())
92
- $toggleOn.addClass('toggle-on')
93
- $toggleOff.addClass('toggle-off')
94
- this.$toggle.css({ width: width, height: height })
95
- if (this.options.height) {
96
- $toggleOn.css('line-height', $toggleOn.height() + 'px')
97
- $toggleOff.css('line-height', $toggleOff.height() + 'px')
130
+ this.$toggle.append($invElement, $toggleGroup)
131
+
132
+ // 8: Set button W/H, lineHeight
133
+ {
134
+ // A: Set style W/H
135
+ let width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2)
136
+ let height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight())
137
+ this.$toggle.css({ width: width, height: height })
138
+
139
+ // B: Apply on/off class
140
+ $toggleOn.addClass('toggle-on')
141
+ $toggleOff.addClass('toggle-off')
142
+
143
+ // C: Finally, set lineHeight if needed
144
+ if (this.options.height) {
145
+ $toggleOn.css('line-height', $toggleOn.height() + 'px')
146
+ $toggleOff.css('line-height', $toggleOff.height() + 'px')
147
+ }
98
148
  }
99
- this.update(true)
100
- this.trigger(true)
149
+
150
+ // 9: Add listeners
151
+ this.$toggle.on('touchstart', (e)=>{
152
+ toggleActionPerformed(e, this)
153
+ });
154
+ this.$toggle.on('click', (e)=>{
155
+ toggleActionPerformed(e, this)
156
+ });
157
+ this.$toggle.on('keypress', (e)=>{
158
+ if(e.key == " "){
159
+ toggleActionPerformed(e, this)
160
+ }
161
+ });
162
+ // 10: Set elements to bootstrap object (NOT NEEDED)
163
+ // 11: Keep reference to this instance for subsequent calls via `getElementById().bootstrapToggle()` (NOT NEEDED)
164
+ }
165
+
166
+ /**
167
+ * Trigger actions
168
+ * @param {Event} e event
169
+ * @param {Toggle} target Toggle
170
+ */
171
+ function toggleActionPerformed(e , target){
172
+ if(target.options.tristate){
173
+ if(target.$toggle.hasClass('indeterminate')){
174
+ target.determinate(true);
175
+ target.toggle();
176
+ }else{
177
+ target.indeterminate();
178
+ }
179
+ }else{
180
+ target.toggle()
181
+ }
182
+ e.preventDefault()
101
183
  }
102
184
 
103
185
  Toggle.prototype.toggle = function (silent = false) {
@@ -106,16 +188,38 @@
106
188
  }
107
189
 
108
190
  Toggle.prototype.on = function (silent = false) {
109
- if (this.$element.prop('disabled')) return false
110
- this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle)
191
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')) return false
192
+ this.$toggle.removeClass('btn-' +this.options.offstyle + ' off').addClass('btn-' +this.options.onstyle)
111
193
  this.$element.prop('checked', true)
194
+ if(this.$invElement) this.$invElement.prop('checked', false);
112
195
  if (!silent) this.trigger()
113
196
  }
114
197
 
115
198
  Toggle.prototype.off = function (silent = false) {
116
- if (this.$element.prop('disabled')) return false
117
- this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off')
199
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')) return false
200
+ this.$toggle.removeClass('btn-' +this.options.onstyle).addClass('btn-' +this.options.offstyle + ' off')
118
201
  this.$element.prop('checked', false)
202
+ if(this.$invElement) this.$invElement.prop('checked', true);
203
+ if (!silent) this.trigger()
204
+ }
205
+
206
+ Toggle.prototype.indeterminate = function (silent = false) {
207
+ if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false;
208
+ this.$toggle.addClass('indeterminate');
209
+ this.$element.prop('indeterminate', true);
210
+ this.$element.removeAttr('name');
211
+ if(this.$invElement) this.$invElement.prop('indeterminate', true);
212
+ if(this.$invElement) this.$invElement.removeAttr('name');
213
+ if (!silent) this.trigger()
214
+ }
215
+
216
+ Toggle.prototype.determinate = function (silent = false) {
217
+ if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false;
218
+ this.$toggle.removeClass('indeterminate');
219
+ this.$element.prop('indeterminate', false);
220
+ if(this.options.name) this.$element.attr('name', this.options.name);
221
+ if(this.$invElement) this.$invElement.prop('indeterminate', false);
222
+ if(this.$invElement && this.options.name) this.$invElement.attr('name', this.options.name);
119
223
  if (!silent) this.trigger()
120
224
  }
121
225
 
@@ -123,16 +227,38 @@
123
227
  this.$toggle.removeClass('disabled')
124
228
  this.$toggle.removeAttr('disabled')
125
229
  this.$element.prop('disabled', false)
230
+ this.$element.prop('readonly',false)
231
+ if(this.$invElement){
232
+ this.$invElement.prop('disabled', false)
233
+ this.$invElement.prop('readonly',false)
234
+ }
126
235
  }
127
236
 
128
237
  Toggle.prototype.disable = function () {
129
238
  this.$toggle.addClass('disabled')
130
239
  this.$toggle.attr('disabled', 'disabled')
131
240
  this.$element.prop('disabled', true)
241
+ this.$element.prop('readonly', false)
242
+ if(this.$invElement){
243
+ this.$invElement.prop('disabled', true)
244
+ this.$invElement.prop('readonly', false)
245
+ }
246
+ }
247
+
248
+ Toggle.prototype.readonly = function () {
249
+ this.$toggle.addClass('disabled')
250
+ this.$toggle.attr('disabled', 'disabled')
251
+ this.$element.prop('disabled', false)
252
+ this.$element.prop('readonly', true)
253
+ if(this.$invElement){
254
+ this.$invElement.prop('disabled', false)
255
+ this.$invElement.prop('readonly', true)
256
+ }
132
257
  }
133
258
 
134
259
  Toggle.prototype.update = function (silent) {
135
260
  if (this.$element.prop('disabled')) this.disable()
261
+ else if (this.$element.prop('readonly')) this.readonly()
136
262
  else this.enable()
137
263
  if (this.$element.prop('checked')) this.on(silent)
138
264
  else this.off(silent)
@@ -147,8 +273,12 @@
147
273
  }
148
274
 
149
275
  Toggle.prototype.destroy = function() {
276
+ // A: Remove button-group from UI, replace checkbox element
150
277
  this.$element.off('change.bs.toggle')
151
278
  this.$toggleGroup.remove()
279
+ if(this.$invElement) this.$invElement.remove()
280
+
281
+ // B: Delete internal refs
152
282
  this.$element.removeData('bs.toggle')
153
283
  this.$element.unwrap()
154
284
  }
@@ -157,21 +287,24 @@
157
287
  // ========================
158
288
 
159
289
  function Plugin(option) {
160
- var optArg = Array.prototype.slice.call( arguments, 1 )[0]
290
+ let optArg = Array.prototype.slice.call( arguments, 1 )[0]
161
291
 
162
292
  return this.each(function () {
163
- var $this = $(this)
164
- var data = $this.data('bs.toggle')
165
- var options = typeof option == 'object' && option
293
+ let $this = $(this)
294
+ let data = $this.data('bs.toggle')
295
+ let options = typeof option == 'object' && option
166
296
 
167
- if (!data) $this.data('bs.toggle', (data = new Toggle(this, options)))
297
+ if (!data) {
298
+ data = new Toggle(this, options)
299
+ $this.data('bs.toggle', data)
300
+ }
168
301
  if (typeof option === 'string' && data[option] && typeof optArg === 'boolean') data[option](optArg)
169
302
  else if (typeof option === 'string' && data[option]) data[option]()
170
303
  //else if (option && !data[option]) console.log('bootstrap-toggle: error: method `'+ option +'` does not exist!');
171
304
  })
172
305
  }
173
306
 
174
- var old = $.fn.bootstrapToggle
307
+ let old = $.fn.bootstrapToggle
175
308
 
176
309
  $.fn.bootstrapToggle = Plugin
177
310
  $.fn.bootstrapToggle.Constructor = Toggle
@@ -184,16 +317,11 @@
184
317
  return this
185
318
  }
186
319
 
187
- // TOGGLE DATA-API
188
- // ===============
189
-
320
+ /**
321
+ * Replace all `input[type=checkbox][data-toggle="toggle"]` inputs with "Bootstrap-Toggle"
322
+ * Executes once page elements have rendered enabling script to be placed in `<head>`
323
+ */
190
324
  $(function() {
191
325
  $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
192
326
  })
193
-
194
- $(document).on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) {
195
- var $checkbox = $(this).find('input[type=checkbox]')
196
- $checkbox.bootstrapToggle('toggle')
197
- e.preventDefault()
198
- })
199
327
  }(jQuery);
@@ -1,12 +1,14 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.2
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
6
  * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
7
9
  * @license MIT
8
10
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
11
  */
10
12
 
11
- !function(n){"use strict";function i(t,e){this.$element=n(t),this.options=n.extend({},this.defaults(),e),this.render()}i.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"secondary",size:"normal",style:"",width:null,height:null},i.prototype.defaults=function(){return{on:this.$element.attr("data-on")||i.DEFAULTS.on,off:this.$element.attr("data-off")||i.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||i.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||i.DEFAULTS.offstyle,size:this.$element.attr("data-size")||i.DEFAULTS.size,style:this.$element.attr("data-style")||i.DEFAULTS.style,width:this.$element.attr("data-width")||i.DEFAULTS.width,height:this.$element.attr("data-height")||i.DEFAULTS.height}},i.prototype.render=function(){var t;switch(this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle,this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}var e=n('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.on).addClass(this._onstyle+" "+t),s=n('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.off).addClass(this._offstyle+" "+t),o=n('<span class="toggle-handle btn">').addClass(t),i=n('<div class="toggle-group">').append(e,s,o),l=n('<div class="toggle btn" data-toggle="toggle" role="button">').addClass(this.$element.prop("checked")?this._onstyle:this._offstyle+" off").addClass(t).addClass(this.options.style),l=(this.$element.wrap(l),n.extend(this,{$toggle:this.$element.parent(),$toggleOn:e,$toggleOff:s,$toggleGroup:i}),this.$toggle.append(i),this.options.width||Math.max(e.outerWidth(),s.outerWidth())+o.outerWidth()/2),i=this.options.height||Math.max(e.outerHeight(),s.outerHeight());e.addClass("toggle-on"),s.addClass("toggle-off"),this.$toggle.css({width:l,height:i}),this.options.height&&(e.css("line-height",e.height()+"px"),s.css("line-height",s.height()+"px")),this.update(!0),this.trigger(!0)},i.prototype.toggle=function(t=!1){this.$element.prop("checked")?this.off(t):this.on(t)},i.prototype.on=function(t=!1){if(this.$element.prop("disabled"))return!1;this.$toggle.removeClass(this._offstyle+" off").addClass(this._onstyle),this.$element.prop("checked",!0),t||this.trigger()},i.prototype.off=function(t=!1){if(this.$element.prop("disabled"))return!1;this.$toggle.removeClass(this._onstyle).addClass(this._offstyle+" off"),this.$element.prop("checked",!1),t||this.trigger()},i.prototype.enable=function(){this.$toggle.removeClass("disabled"),this.$toggle.removeAttr("disabled"),this.$element.prop("disabled",!1)},i.prototype.disable=function(){this.$toggle.addClass("disabled"),this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!0)},i.prototype.update=function(t){this.$element.prop("disabled")?this.disable():this.enable(),this.$element.prop("checked")?this.on(t):this.off(t)},i.prototype.trigger=function(t){this.$element.off("change.bs.toggle"),t||this.$element.change(),this.$element.on("change.bs.toggle",n.proxy(function(){this.update()},this))},i.prototype.destroy=function(){this.$element.off("change.bs.toggle"),this.$toggleGroup.remove(),this.$element.removeData("bs.toggle"),this.$element.unwrap()};var t=n.fn.bootstrapToggle;n.fn.bootstrapToggle=function(s){var o=Array.prototype.slice.call(arguments,1)[0];return this.each(function(){var t=n(this),e=t.data("bs.toggle");e||t.data("bs.toggle",e=new i(this,"object"==typeof s&&s)),"string"==typeof s&&e[s]&&"boolean"==typeof o?e[s](o):"string"==typeof s&&e[s]&&e[s]()})},n.fn.bootstrapToggle.Constructor=i,n.fn.toggle.noConflict=function(){return n.fn.bootstrapToggle=t,this},n(function(){n("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()}),n(document).on("click.bs.toggle","div[data-toggle^=toggle]",function(t){n(this).find("input[type=checkbox]").bootstrapToggle("toggle"),t.preventDefault()})}(jQuery);
13
+ !function(h){"use strict";function o(t,e){this.$element=h(t),this.options=h.extend({},this.defaults(),e),this.render()}function r(t,e){e.options.tristate?e.$toggle.hasClass("indeterminate")?(e.determinate(!0),e.toggle()):e.indeterminate():e.toggle(),t.preventDefault()}o.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"secondary",onvalue:null,offvalue:null,size:"normal",style:"",width:null,height:null,tabindex:0,tristate:!1,name:null},o.prototype.defaults=function(){return{on:this.$element.attr("data-on")||o.DEFAULTS.on,off:this.$element.attr("data-off")||o.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||o.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||o.DEFAULTS.offstyle,onvalue:this.$element.attr("value")||this.$element.attr("data-onvalue")||o.DEFAULTS.onvalue,offvalue:this.$element.attr("data-offvalue")||o.DEFAULTS.offvalue,size:this.$element.attr("data-size")||o.DEFAULTS.size,style:this.$element.attr("data-style")||o.DEFAULTS.style,width:this.$element.attr("data-width")||o.DEFAULTS.width,height:this.$element.attr("data-height")||o.DEFAULTS.height,tabindex:this.$element.attr("tabindex")||o.DEFAULTS.tabindex,tristate:this.$element.is("[tristate]")||o.DEFAULTS.tristate,name:this.$element.attr("name")||o.DEFAULTS.name}},o.prototype.render=function(){let t;switch(this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}let e=h('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.on).addClass("btn-"+this.options.onstyle+" "+t),i=h('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.off).addClass("btn-"+this.options.offstyle+" "+t),s=h('<span class="toggle-handle btn">').addClass(t);var n=h('<div class="toggle-group">').append(e,i,s);let o=h('<div class="toggle btn" data-toggle="toggle" role="button">').addClass(this.$element.prop("checked")?"btn-"+this.options.onstyle:"btn-"+this.options.offstyle+" off").addClass(t).addClass(this.options.style).attr("tabindex",this.options.tabindex),l=((this.$element.prop("disabled")||this.$element.prop("readonly"))&&(o.addClass("disabled"),o.attr("disabled","disabled")),this.options.onvalue&&this.$element.val(this.options.onvalue),null);this.options.offvalue&&((l=this.$element.clone()).val(this.options.offvalue),l.attr("data-toggle","invert-toggle"),l.removeAttr("id"),l.prop("checked",!this.$element.prop("checked"))),this.$element.wrap(o),h.extend(this,{$toggle:this.$element.parent(),$toggleOn:e,$toggleOff:i,$toggleGroup:n,$invElement:l}),this.$toggle.append(l,n);var n=this.options.width||Math.max(e.outerWidth(),i.outerWidth())+s.outerWidth()/2,a=this.options.height||Math.max(e.outerHeight(),i.outerHeight());this.$toggle.css({width:n,height:a}),e.addClass("toggle-on"),i.addClass("toggle-off"),this.options.height&&(e.css("line-height",e.height()+"px"),i.css("line-height",i.height()+"px")),this.$toggle.on("touchstart",t=>{r(t,this)}),this.$toggle.on("click",t=>{r(t,this)}),this.$toggle.on("keypress",t=>{" "==t.key&&r(t,this)})},o.prototype.toggle=function(t=!1){this.$element.prop("checked")?this.off(t):this.on(t)},o.prototype.on=function(t=!1){if(this.$element.prop("disabled")||this.$element.prop("readonly"))return!1;this.$toggle.removeClass("btn-"+this.options.offstyle+" off").addClass("btn-"+this.options.onstyle),this.$element.prop("checked",!0),this.$invElement&&this.$invElement.prop("checked",!1),t||this.trigger()},o.prototype.off=function(t=!1){if(this.$element.prop("disabled")||this.$element.prop("readonly"))return!1;this.$toggle.removeClass("btn-"+this.options.onstyle).addClass("btn-"+this.options.offstyle+" off"),this.$element.prop("checked",!1),this.$invElement&&this.$invElement.prop("checked",!0),t||this.trigger()},o.prototype.indeterminate=function(t=!1){if(!this.options.tristate||this.$element.prop("disabled")||this.$element.prop("readonly"))return!1;this.$toggle.addClass("indeterminate"),this.$element.prop("indeterminate",!0),this.$element.removeAttr("name"),this.$invElement&&this.$invElement.prop("indeterminate",!0),this.$invElement&&this.$invElement.removeAttr("name"),t||this.trigger()},o.prototype.determinate=function(t=!1){if(!this.options.tristate||this.$element.prop("disabled")||this.$element.prop("readonly"))return!1;this.$toggle.removeClass("indeterminate"),this.$element.prop("indeterminate",!1),this.options.name&&this.$element.attr("name",this.options.name),this.$invElement&&this.$invElement.prop("indeterminate",!1),this.$invElement&&this.options.name&&this.$invElement.attr("name",this.options.name),t||this.trigger()},o.prototype.enable=function(){this.$toggle.removeClass("disabled"),this.$toggle.removeAttr("disabled"),this.$element.prop("disabled",!1),this.$element.prop("readonly",!1),this.$invElement&&(this.$invElement.prop("disabled",!1),this.$invElement.prop("readonly",!1))},o.prototype.disable=function(){this.$toggle.addClass("disabled"),this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!0),this.$element.prop("readonly",!1),this.$invElement&&(this.$invElement.prop("disabled",!0),this.$invElement.prop("readonly",!1))},o.prototype.readonly=function(){this.$toggle.addClass("disabled"),this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!1),this.$element.prop("readonly",!0),this.$invElement&&(this.$invElement.prop("disabled",!1),this.$invElement.prop("readonly",!0))},o.prototype.update=function(t){this.$element.prop("disabled")?this.disable():this.$element.prop("readonly")?this.readonly():this.enable(),this.$element.prop("checked")?this.on(t):this.off(t)},o.prototype.trigger=function(t){this.$element.off("change.bs.toggle"),t||this.$element.change(),this.$element.on("change.bs.toggle",h.proxy(function(){this.update()},this))},o.prototype.destroy=function(){this.$element.off("change.bs.toggle"),this.$toggleGroup.remove(),this.$invElement&&this.$invElement.remove(),this.$element.removeData("bs.toggle"),this.$element.unwrap()};let t=h.fn.bootstrapToggle;h.fn.bootstrapToggle=function(s){let n=Array.prototype.slice.call(arguments,1)[0];return this.each(function(){let t=h(this),e=t.data("bs.toggle");var i="object"==typeof s&&s;e||(e=new o(this,i),t.data("bs.toggle",e)),"string"==typeof s&&e[s]&&"boolean"==typeof n?e[s](n):"string"==typeof s&&e[s]&&e[s]()})},h.fn.bootstrapToggle.Constructor=o,h.fn.toggle.noConflict=function(){return h.fn.bootstrapToggle=t,this},h(function(){h("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()})}(jQuery);
12
14
  //# sourceMappingURL=bootstrap5-toggle.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap5-toggle.min.js","sources":["bootstrap5-toggle.js"],"names":["$","Toggle","element","options","this","$element","extend","defaults","render","DEFAULTS","on","off","onstyle","offstyle","size","style","width","height","prototype","attr","_onstyle","_offstyle","$toggleOn","prop","html","addClass","$toggleOff","$toggleHandle","$toggleGroup","append","$toggle","wrap","parent","Math","max","outerWidth","outerHeight","css","update","trigger","toggle","silent","removeClass","enable","removeAttr","disable","change","proxy","destroy","remove","removeData","unwrap","old","fn","bootstrapToggle","option","optArg","Array","slice","call","arguments","each","$this","data","Constructor","noConflict","document","e","find","preventDefault","jQuery"],"mappings":"CAWC,SAAUA,gBAMG,SAATC,EAAmBC,EAASC,GAC/BC,KAAKC,SAAYL,EAAEE,GACnBE,KAAKD,QAAYH,EAAEM,OAAO,GAAIF,KAAKG,WAAYJ,GAC/CC,KAAKI,SAGNP,EAAOQ,SAAW,CACjBC,GAAI,KACJC,IAAK,MACLC,QAAS,UACTC,SAAU,YACVC,KAAM,SACNC,MAAO,GACPC,MAAO,KACPC,OAAQ,MAGThB,EAAOiB,UAAUX,SAAW,WAC3B,MAAO,CACNG,GAAIN,KAAKC,SAASc,KAAK,YAAclB,EAAOQ,SAASC,GACrDC,IAAKP,KAAKC,SAASc,KAAK,aAAelB,EAAOQ,SAASE,IACvDC,QAASR,KAAKC,SAASc,KAAK,iBAAmBlB,EAAOQ,SAASG,QAC/DC,SAAUT,KAAKC,SAASc,KAAK,kBAAoBlB,EAAOQ,SAASI,SACjEC,KAAMV,KAAKC,SAASc,KAAK,cAAgBlB,E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","this","$element","extend","defaults","render","toggleActionPerformed","e","target","tristate","$toggle","hasClass","determinate","toggle","indeterminate","preventDefault","DEFAULTS","on","off","onstyle","offstyle","onvalue","offvalue","size","style","width","height","tabindex","name","prototype","attr","is","let","$toggleOn","prop","html","addClass","$toggleOff","$toggleHandle","$toggleGroup","append","$invElement","val","clone","removeAttr","wrap","parent","Math","max","outerWidth","outerHeight","css","key","silent","removeClass","trigger","enable","disable","readonly","update","change","proxy","destroy","remove","removeData","unwrap","old","fn","bootstrapToggle","option","optArg","Array","slice","call","arguments","each","$this","data","Constructor","noConflict","jQuery"],"mappings":"CAaC,SAAUA,gBAMG,SAATC,EAAmBC,EAASC,GAE/BC,KAAKC,SAAYL,EAAEE,GAEnBE,KAAKD,QAAYH,EAAEM,OAAO,GAAIF,KAAKG,WAAYJ,GAE/CC,KAAKI,SAiJN,SAASC,EAAsBC,EAAIC,GAC/BA,EAAOR,QAAQS,SACdD,EAAOE,QAAQC,SAAS,kBAC1BH,EAAOI,aAAY,GACnBJ,EAAOK,UAEPL,EAAOM,gBAGRN,EAAOK,SAERN,EAAEQ,iBAzJHjB,EAAOkB,SAAW,CACjBC,GAAI,KACJC,IAAK,MACLC,QAAS,UACTC,SAAU,YACVC,QAAS,KACTC,SAAU,KACVC,KAAM,SACNC,MAAO,GACPC,MAAO,KACPC,OAAQ,KACRC,SAAU,EACVlB,UAAU,EACVmB,KAAM,MAGP9B,EAAO+B,UAAUzB,SAAW,WAC3B,MAAO,CACNa,GAAIhB,KAAKC,SAAS4B,KAAK,YAAchC,EAAOkB,SAASC,GACrDC,IAAKjB,KAAKC,SAAS4B,KAAK,aAAehC,EAAOkB,SAASE,IACvDC,QAASlB,KAAKC,SAAS4B,KAAK,iBAAmBhC,EAAOkB,SAASG,QAC/DC,SAAUnB,KAAKC,SAAS4B,KAAK,kBAAoBhC,EAAOkB,SAASI,SACjEC,QAASpB,KAAKC,SAAS4B,KAAK,UAAY7B,KAAKC,SAAS4B,KAAK,iBAAmBhC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GED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bootstrap5-toggle",
3
- "version": "4.2.0",
3
+ "version": "4.3.2",
4
4
  "author": {
5
5
  "name": "Pablo Alcaraz Martínez",
6
6
  "url": "https://github.com/palcarazm/"
@@ -8,6 +8,10 @@
8
8
  "description": "Bootstrap 5 Toggle is a bootstrap 5 plugin that converts checkboxes into toggles.",
9
9
  "homepage": "https://palcarazm.github.io/bootstrap5-toggle/",
10
10
  "license": "MIT",
11
+ "funding": {
12
+ "type": "GitHub Sponsors",
13
+ "url": "https://github.com/sponsors/palcarazm"
14
+ },
11
15
  "main": "js/bootstrap5-toggle.min.js",
12
16
  "files": [
13
17
  "css/*",
@@ -40,6 +44,7 @@
40
44
  },
41
45
  "devDependencies": {
42
46
  "cypress": "^10.3.0",
47
+ "cypress-plugin-tab": "^1.0.5",
43
48
  "doctoc": "^2.2.0",
44
49
  "grunt": "^1.5.3",
45
50
  "grunt-banner": "^0.6.0",
@@ -48,7 +53,7 @@
48
53
  "grunt-contrib-uglify": "^5.2.1"
49
54
  },
50
55
  "dependencies": {
51
- "bootstrap": "^5.1.3",
56
+ "bootstrap": "^5.0.0",
52
57
  "jquery": "^3.6.0"
53
58
  }
54
59
  }