bootstrap5-toggle 4.2.0 → 4.3.0

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,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## [4.3.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.3.0) 2022-07-25
10
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap4-toggle/compare/v4.2.0...v4.3.0)
11
+ ### Added
12
+ * feat: Distribution of ECMAS lib (#2) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/36
13
+ * feat: Support readonly attribute (#35) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/37
14
+ * feat: Toggles focusable from the keyboard (#38) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/41
15
+ * feat: Switch toggle from keyboard (#39) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/42
16
+ * feat: Custom value for on and off state on form submit (#34) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/43
17
+ * feat: Tristate toggle (#40) by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/47
18
+
19
+ ## [4.2.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.2.0) 2022-07-12
20
+ ### [Full Changelog](https://github.com/palcaraz/bootstrap4-toggle/compare/v4.1.0...v4.2.0)
21
+ ### Added
22
+ * feat: Support toggle silent method by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/30
23
+ ### Changed
24
+ * feat: Remove btn-light from handle by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/21
25
+ * feat: Change default btn off class to secondary by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/22
26
+ ### Fixed
27
+ * fix: Handle border color and btn-light border color by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/17
28
+ * fix: Render in input-group by @palcarazm in https://github.com/palcarazm/bootstrap5-toggle/pull/29
29
+
9
30
  ## [4.1.0](https://github.com/palcaraz/bootstrap5-toggle/tree/v4.1.0) 2022-06-30
10
31
  ### [Full Changelog](https://github.com/palcaraz/bootstrap4-toggle/compare/v4.0.0...v4.1.0)
11
32
  ### Added
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
@@ -17,7 +17,7 @@
17
17
  #### Library Distributions
18
18
  Project |Description
19
19
  ---|---
20
- [bootstrap5-toggle](https://github.com/palcarazm/bootstrap5-toggle) | Supports bootstrap5 (requires jQuery)
20
+ [bootstrap5-toggle](https://github.com/palcarazm/bootstrap5-toggle) | Supports bootstrap5 (jQuery and ECMAS distributions)
21
21
  [bootstrap4-toggle](https://github.com/gitbrent/bootstrap4-toggle) | Supports bootstrap4 (requires jQuery)
22
22
  [bootstrap-switch-button](https://github.com/gitbrent/bootstrap-switch-button) | Supports bootstrap4+ (ES6 class, no dependencies)
23
23
  [bootstrap-switch-button-react](https://github.com/gitbrent/bootstrap-switch-button-react) | Supports bootstrap4+ (React component, no dependencies)
@@ -27,6 +27,7 @@ Project |Description
27
27
 
28
28
  ![Demo GIF](img/bootstrap5-toggle-demo.gif)
29
29
 
30
+ <!-- To update TOC run .\node_modules\.bin\doctoc README.md --github -->
30
31
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
31
32
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
32
33
  **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
@@ -49,6 +50,7 @@ Project |Description
49
50
  - [Event Propagation](#event-propagation)
50
51
  - [Stopping Event Propagation](#stopping-event-propagation)
51
52
  - [API vs Input](#api-vs-input)
53
+ - [Collaborators welcom!](#collaborators-welcom)
52
54
 
53
55
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
54
56
 
@@ -59,8 +61,8 @@ Project |Description
59
61
  ## CDN
60
62
  [![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)
61
63
  ```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>
64
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.0/css/bootstrap5-toggle.min.css" rel="stylesheet">
65
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@4.3.0/js/bootstrap5-toggle.min.js"></script>
64
66
  ```
65
67
 
66
68
  ## Download
@@ -118,16 +120,20 @@ EX: Initialize id `chkToggle` with a single line of JavaScript.
118
120
  </script>
119
121
  ```
120
122
 
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`
123
+ Name |Type |Default |Description |
124
+ ----------|-----------|-----------|----------------------------|
125
+ `on` |string/html|"On" |Text of the on toggle
126
+ `off` |string/html|"Off" |Text of the off toggle
127
+ `size` |string |"normal" |Size of the toggle. Possible values are: `large`, `normal`, `small`, `mini`.
128
+ `onstyle` |string |"primary" |Style of the on toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix
129
+ `offstyle`|string |"secondary"|Style of the off toggle. Possible values are: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark` and with `outline-` prefix
130
+ `onvalue` |string |*null* |Sets on state value
131
+ `offvalue`|string |*null* |Sets off state value
128
132
  `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
133
  `width` |integer |*null* |Sets the width of the toggle. if set to *null*, width will be auto-calculated.
130
134
  `height` |integer |*null* |Sets the height of the toggle. if set to *null*, height will be auto-calculated.
135
+ `tabindex`|integer |0 |Sets the tabindex of the toggle.
136
+ `tristate`|boolean |false |Sets tristate support
131
137
 
132
138
  ## Methods
133
139
  Methods can be used to control toggles directly.
@@ -136,15 +142,18 @@ Methods can be used to control toggles directly.
136
142
  <input id="toggle-demo" type="checkbox" data-toggle="toggle">
137
143
  ```
138
144
 
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
145
+ Method |Example |Description
146
+ -------------|-----------------------------------------------------|------------------------------------------
147
+ initialize | `$('#toggle-demo').bootstrapToggle()` |Initializes the toggle plugin with options
148
+ destroy | `$('#toggle-demo').bootstrapToggle('destroy')` |Destroys the toggle
149
+ on | `$('#toggle-demo').bootstrapToggle('on')` |Sets the toggle to 'On' state
150
+ off | `$('#toggle-demo').bootstrapToggle('off')` |Sets the toggle to 'Off' state
151
+ toggle | `$('#toggle-demo').bootstrapToggle('toggle')` |Toggles the state of the toggle on/off
152
+ enable | `$('#toggle-demo').bootstrapToggle('enable')` |Enables the toggle
153
+ disable | `$('#toggle-demo').bootstrapToggle('disable')` |Disables the toggle
154
+ readonly | `$('#toggle-demo').bootstrapToggle('readonly')` |Disables the toggle but preserve checkbox enabled
155
+ indeterminate| `$('#toggle-demo').bootstrapToggle('indeterminate')`|Sets the toggle to 'indeterminate' state
156
+ determinate | `$('#toggle-demo').bootstrapToggle('determinate')` |Sets the toggle to 'determinate' state
148
157
 
149
158
  # Events
150
159
 
@@ -166,8 +175,7 @@ You should listen to events from the `<input type="checkbox">` directly rather t
166
175
  ```
167
176
 
168
177
  ## 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.
178
+ 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
179
 
172
180
  ```html
173
181
  <input id="toggle-silent" type="checkbox" data-toggle="toggle">
@@ -215,3 +223,12 @@ This also means that using the API or Input to trigger events will work both way
215
223
  }
216
224
  </script>
217
225
  ```
226
+ # Collaborators welcom!
227
+ - :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)
228
+ - :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)
229
+ - :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)
230
+ - :computer: ¿Do you know how to fix a bug? Open a pull request in [GitHub pull repuest](https://github.com/palcarazm/bootstrap5-toggle/compare).
231
+
232
+ [![GitHub Contributors](https://contrib.rocks/image?repo=palcarazm/bootstrap5-toggle)](https://github.com/palcarazm/bootstrap5-toggle/graphs/contributors)
233
+
234
+ ¿Do you like the project? Give us a :star: in [GitHub](https://github.com/palcarazm/bootstrap5-toggle).
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.0
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)
@@ -48,6 +48,9 @@
48
48
  .toggle.off .toggle-group {
49
49
  left: -100%;
50
50
  }
51
+ .toggle.indeterminate .toggle-group {
52
+ left: -50%;
53
+ }
51
54
  .toggle-on {
52
55
  position: absolute;
53
56
  top: 0;
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.0
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)
@@ -8,5 +8,5 @@
8
8
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
9
  */
10
10
 
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}
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.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:#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}
12
12
  /*# 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,kBA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AAc,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,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,344 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v4.3.0
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
+ * @license MIT
8
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
+ */
10
+
11
+
12
+ 'use strict';
13
+
14
+ (function() {
15
+ /**
16
+ * `Toggle` is instantiated for each toggle-button
17
+ */
18
+ class Toggle {
19
+ constructor(element, options) {
20
+ const DEFAULTS = {
21
+ on: 'On',
22
+ onstyle: 'primary',
23
+ onvalue: null,
24
+ off: 'Off',
25
+ offstyle: 'secondary',
26
+ offvalue: null,
27
+ size: '',
28
+ style: '',
29
+ width: null,
30
+ height: null,
31
+ tabindex: 0,
32
+ tristate: false,
33
+ name: null
34
+ };
35
+ options = options || {};
36
+
37
+ // A: Capture ref to HMTL element
38
+ this.element = element;
39
+
40
+ // B: Set options
41
+ this.options = {
42
+ on: this.element.getAttribute('data-on') || options.on || DEFAULTS.on,
43
+ onstyle: this.element.getAttribute('data-onstyle') || options.onstyle || DEFAULTS.onstyle,
44
+ onvalue: this.element.getAttribute('value') || this.element.getAttribute('data-onvalue') || options.onvalue || DEFAULTS.onvalue,
45
+ off: this.element.getAttribute('data-off') || options.off || DEFAULTS.off,
46
+ offstyle: this.element.getAttribute('data-offstyle') || options.offstyle || DEFAULTS.offstyle,
47
+ offvalue: this.element.getAttribute('data-offvalue') || options.offvalue || DEFAULTS.offvalue,
48
+ size: this.element.getAttribute('data-size') || options.size || DEFAULTS.size,
49
+ style: this.element.getAttribute('data-style') || options.style || DEFAULTS.style,
50
+ width: this.element.getAttribute('data-width') || options.width || DEFAULTS.width,
51
+ height: this.element.getAttribute('data-height') || options.height || DEFAULTS.height,
52
+ tabindex: this.element.getAttribute('tabindex') || options.tabindex || DEFAULTS.tabindex,
53
+ tristate: this.element.hasAttribute('tristate') || options.tristate || DEFAULTS.tristate,
54
+ name: this.element.getAttribute('name') || options.name || DEFAULTS.name,
55
+ };
56
+
57
+ // LAST: Render Toggle
58
+ this.render();
59
+ }
60
+ render() {
61
+ function calcH(el) {
62
+ const styles = window.getComputedStyle(el);
63
+ const height = el.offsetHeight;
64
+ const borderTopWidth = parseFloat(styles.borderTopWidth);
65
+ const borderBottomWidth = parseFloat(styles.borderBottomWidth);
66
+ const paddingTop = parseFloat(styles.paddingTop);
67
+ const paddingBottom = parseFloat(styles.paddingBottom);
68
+
69
+ return height - borderBottomWidth - borderTopWidth - paddingTop - paddingBottom;
70
+ }
71
+ // 0: Parse size
72
+ let size;
73
+ switch (this.options.size ) {
74
+ case 'large':
75
+ case 'lg':
76
+ size = 'btn-lg';
77
+ break;
78
+ case 'small':
79
+ case 'sm':
80
+ size = 'btn-sm';
81
+ break;
82
+ case 'mini':
83
+ case 'xs':
84
+ size = 'btn-xs';
85
+ break;
86
+ default:
87
+ size = ''
88
+ break;
89
+ }
90
+
91
+ // 1: On
92
+ let ecmasToggleOn = document.createElement('label');
93
+ ecmasToggleOn.setAttribute('class', 'btn btn-' + this.options.onstyle + ' ' + size);
94
+ ecmasToggleOn.setAttribute('for', this.element.id);
95
+ ecmasToggleOn.innerHTML = this.options.on;
96
+
97
+ // 2: Off
98
+ let ecmasToggleOff = document.createElement('label');
99
+ ecmasToggleOff.setAttribute('class', 'btn btn-' + this.options.offstyle + ' ' + size);
100
+ ecmasToggleOff.setAttribute('for', this.element.id);
101
+ ecmasToggleOff.innerHTML = this.options.off;
102
+
103
+ // 3: Handle
104
+ let ecmasToggleHandle = document.createElement('span');
105
+ ecmasToggleHandle.setAttribute('class', 'toggle-handle btn ' + size);
106
+
107
+ // 4: Toggle Group
108
+ let ecmasToggleGroup = document.createElement('div');
109
+ ecmasToggleGroup.setAttribute('class', 'toggle-group');
110
+ ecmasToggleGroup.appendChild(ecmasToggleOn);
111
+ ecmasToggleGroup.appendChild(ecmasToggleOff);
112
+ ecmasToggleGroup.appendChild(ecmasToggleHandle);
113
+
114
+ // 5: Toggle
115
+ let ecmasToggle = document.createElement('div');
116
+ ecmasToggle.setAttribute('class', 'toggle btn');
117
+ ecmasToggle.classList.add(this.element.checked ? 'btn-' + this.options.onstyle : 'btn-' + this.options.offstyle);
118
+ ecmasToggle.setAttribute('tabindex',this.options.tabindex);
119
+ if (!this.element.checked) ecmasToggle.classList.add('off');
120
+ if (this.options.size) ecmasToggle.classList.add(size);
121
+ if (this.options.style) {
122
+ (this.options.style).split(' ').forEach((style)=>{
123
+ ecmasToggle.classList.add(style);
124
+ });
125
+ }
126
+ if (this.element.disabled || this.element.readOnly){
127
+ ecmasToggle.classList.add('disabled');
128
+ ecmasToggle.setAttribute('disabled', 'disabled');
129
+ }
130
+
131
+ // 6: Set form values
132
+ if(this.options.onvalue) this.element.setAttribute('value', this.options.onvalue);
133
+ let invElement = null;
134
+ if(this.options.offvalue){
135
+ invElement = this.element.cloneNode();
136
+ invElement.setAttribute('value',this.options.offvalue);
137
+ invElement.setAttribute('data-toggle', 'invert-toggle');
138
+ invElement.removeAttribute('id');
139
+ invElement.checked = !this.element.checked;
140
+ }
141
+
142
+ // 7: Replace HTML checkbox with Toggle-Button
143
+ this.element.parentElement.insertBefore(ecmasToggle, this.element);
144
+ ecmasToggle.appendChild(this.element);
145
+ if(invElement) ecmasToggle.appendChild(invElement);
146
+ ecmasToggle.appendChild(ecmasToggleGroup);
147
+
148
+ // 8: Set button W/H, lineHeight
149
+ {
150
+ // A: Set style W/H
151
+ // NOTE: `offsetWidth` returns *rounded* integer values, so use `getBoundingClientRect` instead.
152
+ ecmasToggle.style.width =
153
+ (this.options.width ||
154
+ Math.max(ecmasToggleOn.getBoundingClientRect().width, ecmasToggleOff.getBoundingClientRect().width) + ecmasToggleHandle.getBoundingClientRect().width / 2) + 'px';
155
+ ecmasToggle.style.height = (this.options.height || Math.max(ecmasToggleOn.getBoundingClientRect().height, ecmasToggleOff.getBoundingClientRect().height)) + 'px';
156
+
157
+ // B: Apply on/off class
158
+ ecmasToggleOn.classList.add('toggle-on');
159
+ ecmasToggleOff.classList.add('toggle-off');
160
+
161
+ // C: Finally, set lineHeight if needed
162
+ if (this.options.height) {
163
+ ecmasToggleOn.style.lineHeight = calcH(ecmasToggleOn) + 'px';
164
+ ecmasToggleOff.style.lineHeight = calcH(ecmasToggleOff) + 'px';
165
+ }
166
+ }
167
+
168
+ // 9: Add listeners
169
+ ecmasToggle.addEventListener('touchstart', (e)=>{
170
+ this.#toggleActionPerformed(e)
171
+ });
172
+ ecmasToggle.addEventListener('click', (e)=>{
173
+ this.#toggleActionPerformed(e)
174
+ });
175
+ ecmasToggle.addEventListener('keypress', (e)=>{
176
+ if(e.key == " "){
177
+ this.#toggleActionPerformed(e)
178
+ }
179
+ });
180
+
181
+ // 10: Set elements to bootstrap object
182
+ this.ecmasToggle = ecmasToggle;
183
+ this.invElement = invElement;
184
+
185
+ // 11: Keep reference to this instance for subsequent calls via `getElementById().bootstrapToggle()`
186
+ this.element.bsToggle = this;
187
+ }
188
+
189
+ /**
190
+ * Trigger actions
191
+ * @param {Event} e event
192
+ */
193
+ #toggleActionPerformed(e){
194
+ if(this.options.tristate){
195
+ if(this.ecmasToggle.classList.contains('indeterminate')){
196
+ this.determinate(true);
197
+ this.toggle();
198
+ }else{
199
+ this.indeterminate();
200
+ }
201
+ }else{
202
+ this.toggle()
203
+ }
204
+ e.preventDefault()
205
+ }
206
+
207
+ toggle(silent = false) {
208
+ if (this.element.checked) this.off(silent);
209
+ else this.on(silent);
210
+ }
211
+
212
+ on(silent = false) {
213
+ if (this.element.disabled || this.element.readOnly) return false;
214
+ this.ecmasToggle.classList.remove('btn-' + this.options.offstyle);
215
+ this.ecmasToggle.classList.add('btn-' + this.options.onstyle);
216
+ this.ecmasToggle.classList.remove('off');
217
+ this.element.checked = true;
218
+ if(this.invElement) this.invElement.checked = false;
219
+ if (!silent) this.trigger();
220
+ }
221
+
222
+ off(silent = false) {
223
+ if (this.element.disabled || this.element.readOnly) return false;
224
+ this.ecmasToggle.classList.remove('btn-' + this.options.onstyle);
225
+ this.ecmasToggle.classList.add('btn-' + this.options.offstyle);
226
+ this.ecmasToggle.classList.add('off');
227
+ this.element.checked = false;
228
+ if(this.invElement) this.invElement.checked = true;
229
+ if (!silent) this.trigger();
230
+ }
231
+
232
+ indeterminate(silent = false) {
233
+ if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false;
234
+ this.ecmasToggle.classList.add('indeterminate');
235
+ this.element.indeterminate = true;
236
+ this.element.removeAttribute('name');
237
+ if(this.invElement) this.invElement.indeterminate = true;
238
+ if(this.invElement) this.invElement.removeAttribute('name');
239
+ if (!silent) this.trigger()
240
+ }
241
+
242
+ determinate(silent = false) {
243
+ if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false;
244
+ this.ecmasToggle.classList.remove('indeterminate');
245
+ this.element.indeterminate = false;
246
+ if(this.options.name) this.element.setAttribute('name', this.options.name);
247
+ if(this.invElement) this.invElement.indeterminate = false;
248
+ if(this.invElement && this.options.name) this.invElement.setAttribute('name', this.options.name);
249
+ if (!silent) this.trigger()
250
+ }
251
+
252
+ enable() {
253
+ this.ecmasToggle.classList.remove('disabled');
254
+ this.ecmasToggle.removeAttribute('disabled');
255
+ this.element.removeAttribute('disabled');
256
+ this.element.removeAttribute('readonly');
257
+ if(this.invElement) {
258
+ this.invElement.removeAttribute('disabled');
259
+ this.invElement.removeAttribute('readonly');
260
+ }
261
+ }
262
+
263
+ disable() {
264
+ this.ecmasToggle.classList.add('disabled');
265
+ this.ecmasToggle.setAttribute('disabled', '');
266
+ this.element.setAttribute('disabled', '');
267
+ this.element.removeAttribute('readonly');
268
+ if(this.invElement) {
269
+ this.invElement.setAttribute('disabled', '');
270
+ this.invElement.removeAttribute('readonly');
271
+ }
272
+ }
273
+
274
+ readonly() {
275
+ this.ecmasToggle.classList.add('disabled');
276
+ this.ecmasToggle.setAttribute('disabled', '');
277
+ this.element.removeAttribute('disabled');
278
+ this.element.setAttribute('readonly', '');
279
+ if(this.invElement) {
280
+ this.invElement.removeAttribute('disabled');
281
+ this.invElement.setAttribute('readonly', '');
282
+ }
283
+ }
284
+
285
+ update(silent) {
286
+ if (this.element.disabled) this.disable();
287
+ else if (this.element.readOnly) this.readonly();
288
+ else this.enable();
289
+ if (this.element.checked) this.on(silent);
290
+ else this.off(silent);
291
+ }
292
+
293
+ trigger(silent) {
294
+ if (!silent) this.element.dispatchEvent(new Event('change', { bubbles: true }));
295
+ }
296
+
297
+ destroy() {
298
+ // A: Remove button-group from UI, replace checkbox element
299
+ this.ecmasToggle.parentNode.insertBefore(this.element, this.ecmasToggle);
300
+ this.ecmasToggle.parentNode.removeChild(this.ecmasToggle);
301
+
302
+ // B: Delete internal refs
303
+ delete this.element.bsToggle;
304
+ delete this.ecmasToggle;
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Add `bootstrapToggle` prototype function to HTML Elements
310
+ * Enables execution when used with HTML - ex: `document.getElementById('toggle').bootstrapToggle('on')`
311
+ */
312
+ Element.prototype.bootstrapToggle = function(options, silent) {
313
+ let _bsToggle = this.bsToggle || new Toggle(this, options);
314
+
315
+ // Execute method calls
316
+ if (options && typeof options === 'string') {
317
+ if (options.toLowerCase() == 'toggle') _bsToggle.toggle(silent);
318
+ else if (options.toLowerCase() == 'on') _bsToggle.on(silent);
319
+ else if (options.toLowerCase() == 'off') _bsToggle.off(silent);
320
+ else if (options.toLowerCase() == 'indeterminate') _bsToggle.indeterminate(silent);
321
+ else if (options.toLowerCase() == 'determinate') _bsToggle.determinate(silent);
322
+ else if (options.toLowerCase() == 'enable') _bsToggle.enable();
323
+ else if (options.toLowerCase() == 'disable') _bsToggle.disable();
324
+ else if (options.toLowerCase() == 'readonly') _bsToggle.readonly();
325
+ else if (options.toLowerCase() == 'destroy') _bsToggle.destroy();
326
+ }
327
+ };
328
+
329
+ /**
330
+ * Replace all `input[type=checkbox][data-toggle="toggle"]` inputs with "Bootstrap-Toggle"
331
+ * Executes once page elements have rendered enabling script to be placed in `<head>`
332
+ */
333
+ if (typeof window !== 'undefined')
334
+ window.onload = function() {
335
+ document.querySelectorAll('input[type=checkbox][data-toggle="toggle"]').forEach(function(ele) {
336
+ ele.bootstrapToggle();
337
+ });
338
+ };
339
+
340
+ // Export library if possible
341
+ if (typeof module !== 'undefined' && module.exports) {
342
+ module.exports = Toggle;
343
+ }
344
+ })();
@@ -0,0 +1,12 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v4.3.0
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
+ * @license MIT
8
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
+ */
10
+
11
+ "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)}();
12
+ //# 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":"cAaA,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,QA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,aAAanD,KAAKH,QAASG,KAAKsC,aAC5DtC,KAAKsC,YAAYuC,WAAWC,YAAY9E,KAAKsC,oBAGtCtC,KAAKH,QAAQ+D,gBACb5D,KAAKsC,aAQdyC,QAAQC,UAAUC,gBAAkB,SAASnF,EAASoE,GACrDtC,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,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.0
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)
@@ -15,9 +15,12 @@
15
15
  // TOGGLE PUBLIC CLASS DEFINITION
16
16
  // ==============================
17
17
 
18
- var Toggle = function (element, options) {
18
+ let Toggle = function (element, options) {
19
+ // A: Capture ref to HMTL element
19
20
  this.$element = $(element)
21
+ // B: Set options
20
22
  this.options = $.extend({}, this.defaults(), options)
23
+ // LAST: Render Toggle
21
24
  this.render()
22
25
  }
23
26
 
@@ -26,10 +29,15 @@
26
29
  off: 'Off',
27
30
  onstyle: 'primary',
28
31
  offstyle: 'secondary',
32
+ onvalue: null,
33
+ offvalue: null,
29
34
  size: 'normal',
30
35
  style: '',
31
36
  width: null,
32
- height: null
37
+ height: null,
38
+ tabindex: 0,
39
+ tristate: false,
40
+ name: null,
33
41
  }
34
42
 
35
43
  Toggle.prototype.defaults = function() {
@@ -38,17 +46,21 @@
38
46
  off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
39
47
  onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
40
48
  offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,
49
+ onvalue: this.$element.attr('value') || this.$element.attr('data-onvalue') || Toggle.DEFAULTS.onvalue,
50
+ offvalue: this.$element.attr('data-offvalue') || Toggle.DEFAULTS.offvalue,
41
51
  size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
42
52
  style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
43
53
  width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
44
- height: this.$element.attr('data-height') || Toggle.DEFAULTS.height
54
+ height: this.$element.attr('data-height') || Toggle.DEFAULTS.height,
55
+ tabindex: this.$element.attr('tabindex') || Toggle.DEFAULTS.tabindex,
56
+ tristate: this.$element.is('[tristate]') || Toggle.DEFAULTS.tristate,
57
+ name: this.$element.attr('name') || Toggle.DEFAULTS.name,
45
58
  }
46
59
  }
47
60
 
48
61
  Toggle.prototype.render = function () {
49
- this._onstyle = 'btn-' + this.options.onstyle
50
- this._offstyle = 'btn-' + this.options.offstyle
51
- var size;
62
+ // 0: Parse size
63
+ let size;
52
64
  switch (this.options.size ) {
53
65
  case 'large':
54
66
  case 'lg':
@@ -66,38 +78,106 @@
66
78
  size = ''
67
79
  break;
68
80
  }
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">')
81
+
82
+ // 1: On
83
+ let $toggleOn = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.on)
84
+ .addClass('btn-' +this.options.onstyle + ' ' + size)
85
+
86
+ // 2: Off
87
+ let $toggleOff = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.off)
88
+ .addClass('btn-' +this.options.offstyle + ' ' + size)
89
+
90
+ // 3: Handle
91
+ let $toggleHandle = $('<span class="toggle-handle btn">')
74
92
  .addClass(size)
75
- var $toggleGroup = $('<div class="toggle-group">')
93
+
94
+ // 4: Toggle Group
95
+ let $toggleGroup = $('<div class="toggle-group">')
76
96
  .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' )
97
+
98
+ // 5: Toggle
99
+ let $toggle = $('<div class="toggle btn" data-toggle="toggle" role="button">')
100
+ .addClass( this.$element.prop('checked') ? 'btn-' +this.options.onstyle : 'btn-' +this.options.offstyle+' off' )
79
101
  .addClass(size).addClass(this.options.style)
102
+ .attr('tabindex', this.options.tabindex)
103
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')){
104
+ $toggle.addClass('disabled')
105
+ $toggle.attr('disabled', 'disabled')
106
+ }
107
+
108
+ // 6: Set form values
109
+ if(this.options.onvalue) this.$element.val(this.options.onvalue)
110
+ let $invElement = null;
111
+ if(this.options.offvalue){
112
+ $invElement = this.$element.clone();
113
+ $invElement.val(this.options.offvalue);
114
+ $invElement.attr('data-toggle', 'invert-toggle');
115
+ $invElement.removeAttr('id');
116
+ $invElement.prop('checked', !this.$element.prop('checked'));
117
+ }
80
118
 
119
+ // 7: Replace HTML checkbox with Toggle-Button
81
120
  this.$element.wrap($toggle)
82
121
  $.extend(this, {
83
122
  $toggle: this.$element.parent(),
84
123
  $toggleOn: $toggleOn,
85
124
  $toggleOff: $toggleOff,
86
- $toggleGroup: $toggleGroup
125
+ $toggleGroup: $toggleGroup,
126
+ $invElement: $invElement
87
127
  })
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')
128
+ this.$toggle.append($invElement, $toggleGroup)
129
+
130
+ // 8: Set button W/H, lineHeight
131
+ {
132
+ // A: Set style W/H
133
+ let width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2)
134
+ let height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight())
135
+ this.$toggle.css({ width: width, height: height })
136
+
137
+ // B: Apply on/off class
138
+ $toggleOn.addClass('toggle-on')
139
+ $toggleOff.addClass('toggle-off')
140
+
141
+ // C: Finally, set lineHeight if needed
142
+ if (this.options.height) {
143
+ $toggleOn.css('line-height', $toggleOn.height() + 'px')
144
+ $toggleOff.css('line-height', $toggleOff.height() + 'px')
145
+ }
98
146
  }
99
- this.update(true)
100
- this.trigger(true)
147
+
148
+ // 9: Add listeners
149
+ this.$toggle.on('touchstart', (e)=>{
150
+ toggleActionPerformed(e, this)
151
+ });
152
+ this.$toggle.on('click', (e)=>{
153
+ toggleActionPerformed(e, this)
154
+ });
155
+ this.$toggle.on('keypress', (e)=>{
156
+ if(e.key == " "){
157
+ toggleActionPerformed(e, this)
158
+ }
159
+ });
160
+ // 10: Set elements to bootstrap object (NOT NEEDED)
161
+ // 11: Keep reference to this instance for subsequent calls via `getElementById().bootstrapToggle()` (NOT NEEDED)
162
+ }
163
+
164
+ /**
165
+ * Trigger actions
166
+ * @param {Event} e event
167
+ * @param {Toggle} target Toggle
168
+ */
169
+ function toggleActionPerformed(e , target){
170
+ if(target.options.tristate){
171
+ if(target.$toggle.hasClass('indeterminate')){
172
+ target.determinate(true);
173
+ target.toggle();
174
+ }else{
175
+ target.indeterminate();
176
+ }
177
+ }else{
178
+ target.toggle()
179
+ }
180
+ e.preventDefault()
101
181
  }
102
182
 
103
183
  Toggle.prototype.toggle = function (silent = false) {
@@ -106,16 +186,38 @@
106
186
  }
107
187
 
108
188
  Toggle.prototype.on = function (silent = false) {
109
- if (this.$element.prop('disabled')) return false
110
- this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle)
189
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')) return false
190
+ this.$toggle.removeClass('btn-' +this.options.offstyle + ' off').addClass('btn-' +this.options.onstyle)
111
191
  this.$element.prop('checked', true)
192
+ if(this.$invElement) this.$invElement.prop('checked', false);
112
193
  if (!silent) this.trigger()
113
194
  }
114
195
 
115
196
  Toggle.prototype.off = function (silent = false) {
116
- if (this.$element.prop('disabled')) return false
117
- this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off')
197
+ if (this.$element.prop('disabled') || this.$element.prop('readonly')) return false
198
+ this.$toggle.removeClass('btn-' +this.options.onstyle).addClass('btn-' +this.options.offstyle + ' off')
118
199
  this.$element.prop('checked', false)
200
+ if(this.$invElement) this.$invElement.prop('checked', true);
201
+ if (!silent) this.trigger()
202
+ }
203
+
204
+ Toggle.prototype.indeterminate = function (silent = false) {
205
+ if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false;
206
+ this.$toggle.addClass('indeterminate');
207
+ this.$element.prop('indeterminate', true);
208
+ this.$element.removeAttr('name');
209
+ if(this.$invElement) this.$invElement.prop('indeterminate', true);
210
+ if(this.$invElement) this.$invElement.removeAttr('name');
211
+ if (!silent) this.trigger()
212
+ }
213
+
214
+ Toggle.prototype.determinate = function (silent = false) {
215
+ if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false;
216
+ this.$toggle.removeClass('indeterminate');
217
+ this.$element.prop('indeterminate', false);
218
+ if(this.options.name) this.$element.attr('name', this.options.name);
219
+ if(this.$invElement) this.$invElement.prop('indeterminate', false);
220
+ if(this.$invElement && this.options.name) this.$invElement.attr('name', this.options.name);
119
221
  if (!silent) this.trigger()
120
222
  }
121
223
 
@@ -123,16 +225,38 @@
123
225
  this.$toggle.removeClass('disabled')
124
226
  this.$toggle.removeAttr('disabled')
125
227
  this.$element.prop('disabled', false)
228
+ this.$element.prop('readonly',false)
229
+ if(this.$invElement){
230
+ this.$invElement.prop('disabled', false)
231
+ this.$invElement.prop('readonly',false)
232
+ }
126
233
  }
127
234
 
128
235
  Toggle.prototype.disable = function () {
129
236
  this.$toggle.addClass('disabled')
130
237
  this.$toggle.attr('disabled', 'disabled')
131
238
  this.$element.prop('disabled', true)
239
+ this.$element.prop('readonly', false)
240
+ if(this.$invElement){
241
+ this.$invElement.prop('disabled', true)
242
+ this.$invElement.prop('readonly', false)
243
+ }
244
+ }
245
+
246
+ Toggle.prototype.readonly = function () {
247
+ this.$toggle.addClass('disabled')
248
+ this.$toggle.attr('disabled', 'disabled')
249
+ this.$element.prop('disabled', false)
250
+ this.$element.prop('readonly', true)
251
+ if(this.$invElement){
252
+ this.$invElement.prop('disabled', false)
253
+ this.$invElement.prop('readonly', true)
254
+ }
132
255
  }
133
256
 
134
257
  Toggle.prototype.update = function (silent) {
135
258
  if (this.$element.prop('disabled')) this.disable()
259
+ else if (this.$element.prop('readonly')) this.readonly()
136
260
  else this.enable()
137
261
  if (this.$element.prop('checked')) this.on(silent)
138
262
  else this.off(silent)
@@ -147,8 +271,12 @@
147
271
  }
148
272
 
149
273
  Toggle.prototype.destroy = function() {
274
+ // A: Remove button-group from UI, replace checkbox element
150
275
  this.$element.off('change.bs.toggle')
151
276
  this.$toggleGroup.remove()
277
+ if(this.$invElement) this.$invElement.remove()
278
+
279
+ // B: Delete internal refs
152
280
  this.$element.removeData('bs.toggle')
153
281
  this.$element.unwrap()
154
282
  }
@@ -157,21 +285,24 @@
157
285
  // ========================
158
286
 
159
287
  function Plugin(option) {
160
- var optArg = Array.prototype.slice.call( arguments, 1 )[0]
288
+ let optArg = Array.prototype.slice.call( arguments, 1 )[0]
161
289
 
162
290
  return this.each(function () {
163
- var $this = $(this)
164
- var data = $this.data('bs.toggle')
165
- var options = typeof option == 'object' && option
291
+ let $this = $(this)
292
+ let data = $this.data('bs.toggle')
293
+ let options = typeof option == 'object' && option
166
294
 
167
- if (!data) $this.data('bs.toggle', (data = new Toggle(this, options)))
295
+ if (!data) {
296
+ data = new Toggle(this, options)
297
+ $this.data('bs.toggle', data)
298
+ }
168
299
  if (typeof option === 'string' && data[option] && typeof optArg === 'boolean') data[option](optArg)
169
300
  else if (typeof option === 'string' && data[option]) data[option]()
170
301
  //else if (option && !data[option]) console.log('bootstrap-toggle: error: method `'+ option +'` does not exist!');
171
302
  })
172
303
  }
173
304
 
174
- var old = $.fn.bootstrapToggle
305
+ let old = $.fn.bootstrapToggle
175
306
 
176
307
  $.fn.bootstrapToggle = Plugin
177
308
  $.fn.bootstrapToggle.Constructor = Toggle
@@ -184,16 +315,11 @@
184
315
  return this
185
316
  }
186
317
 
187
- // TOGGLE DATA-API
188
- // ===============
189
-
318
+ /**
319
+ * Replace all `input[type=checkbox][data-toggle="toggle"]` inputs with "Bootstrap-Toggle"
320
+ * Executes once page elements have rendered enabling script to be placed in `<head>`
321
+ */
190
322
  $(function() {
191
323
  $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
192
324
  })
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
325
  }(jQuery);
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v4.2.0
2
+ * bootstrap5-toggle v4.3.0
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)
@@ -8,5 +8,5 @@
8
8
  * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
9
9
  */
10
10
 
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);
11
+ !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
12
  //# 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,EAAOQ,SAASK,KACzDC,MAAOX,KAAKC,SAASc,KAAK,eAAiBlB,EAAOQ,SAASM,MAC3DC,MAAOZ,KAAKC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KAAKO,IAAI8B,IAGfxC,EAAOiB,UAAUqB,QAAU,SAAUE,GACpCrC,KAAKC,SAASM,IAAI,oBACb8B,GAAQrC,KAAKC,SAASyC,SAC3B1C,KAAKC,SAASK,GAAG,mBAAoBV,EAAE+C,MAAM,WAC5C3C,KAAKkC,UACHlC,QAGJH,EAAOiB,UAAU8B,QAAU,WAC1B5C,KAAKC,SAASM,IAAI,oBAClBP,KAAKwB,aAAaqB,SAClB7C,KAAKC,SAAS6C,WAAW,aACzB9C,KAAKC,SAAS8C,UAqBf,IAAIC,EAAMpD,EAAEqD,GAAGC,gBAEftD,EAAEqD,GAAGC,gBAjBL,SAAgBC,GACf,IAAIC,EAASC,MAAMvC,UAAUwC,MAAMC,KAAMC,UAAW,GAAI,GAExD,OAAOxD,KAAKyD,KAAK,WAChB,IAAIC,EAAU9D,EAAEI,MACZ2D,EAAUD,EAAMC,KAAK,aAGpBA,GAAMD,EAAMC,KAAK,YAAcA,EAAO,IAAI9D,EAAOG,KAFvB,iBAAVmD,GAAsBA,IAGrB,iBAAXA,GAAuBQ,EAAKR,IAA6B,kBAAXC,EAAsBO,EAAKR,GAAQC,GACjE,iBAAXD,GAAuBQ,EAAKR,IAASQ,EAAKR,QAQ5DvD,EAAEqD,GAAGC,gBAAgBU,YAAc/D,EAKnCD,EAAEqD,GAAGb,OAAOyB,WAAa,WAExB,OADAjE,EAAEqD,GAAGC,gBAAkBF,EAChBhD,MAMRJ,EAAE,WACDA,EAAE,6CAA6CsD,oBAGhDtD,EAAEkE,UAAUxD,GAAG,kBAAmB,2BAA4B,SAASyD,GACtDnE,EAAEI,MAAMgE,KAAK,wBACnBd,gBAAgB,UAC1Ba,EAAEE,mBAzLH,CA2LCC"}
1
+ {"version":3,"file":"bootstrap5-toggle.min.js","sources":["bootstrap5-toggle.js"],"names":["$","Toggle","element","options","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":"CAWC,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,EAAOkB,SAASK,QAC9FC,SAAUrB,KAAKC,SAAS4B,KAAK,kBAAoBhC,EAAOkB,SAASM,SACjEC,KAAMtB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4
  "author": {
5
5
  "name": "Pablo Alcaraz Martínez",
6
6
  "url": "https://github.com/palcarazm/"
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "cypress": "^10.3.0",
43
+ "cypress-plugin-tab": "^1.0.5",
43
44
  "doctoc": "^2.2.0",
44
45
  "grunt": "^1.5.3",
45
46
  "grunt-banner": "^0.6.0",