bootstrap5-toggle 4.3.5 → 5.0.0-alpha

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/package.json CHANGED
@@ -1,59 +1,62 @@
1
- {
2
- "name": "bootstrap5-toggle",
3
- "version": "4.3.5",
4
- "author": {
5
- "name": "Pablo Alcaraz Martínez",
6
- "url": "https://github.com/palcarazm/"
7
- },
8
- "description": "Bootstrap 5 Toggle is a bootstrap 5 plugin that converts checkboxes into toggles.",
9
- "homepage": "https://palcarazm.github.io/bootstrap5-toggle/",
10
- "license": "MIT",
11
- "funding": {
12
- "type": "GitHub Sponsors",
13
- "url": "https://github.com/sponsors/palcarazm"
14
- },
15
- "main": "js/bootstrap5-toggle.min.js",
16
- "files": [
17
- "css/*",
18
- "js/*"
19
- ],
20
- "scripts": {
21
- "build": "grunt",
22
- "postversion": "grunt",
23
- "prepublishOnly": "grunt"
24
- },
25
- "keywords": [
26
- "bootstrap",
27
- "bootstrap5",
28
- "bootstrap-5",
29
- "bootstrap 5",
30
- "bootstrap 5 checkbox",
31
- "bootstrap 5 switch",
32
- "bootstrap 5 toggle",
33
- "bootstrap-checkbox",
34
- "bootstrap-switch",
35
- "bootstrap-switch-button",
36
- "bootstrap-toggle"
37
- ],
38
- "repository": {
39
- "type": "git",
40
- "url": "https://github.com/palcarazm/bootstrap5-toggle.git"
41
- },
42
- "bugs": {
43
- "url": "https://github.com/palcarazm/bootstrap5-toggle/issues"
44
- },
45
- "devDependencies": {
46
- "cypress": "^11.0.1",
47
- "cypress-plugin-tab": "^1.0.5",
48
- "doctoc": "^2.2.0",
49
- "grunt": "^1.5.3",
50
- "grunt-banner": "^0.6.0",
51
- "grunt-contrib-clean": "^2.0.1",
52
- "grunt-contrib-cssmin": "^4.0.0",
53
- "grunt-contrib-uglify": "^5.2.1"
54
- },
55
- "dependencies": {
56
- "bootstrap": "^5.0.0",
57
- "jquery": "^3.6.0"
58
- }
59
- }
1
+ {
2
+ "name": "bootstrap5-toggle",
3
+ "version": "5.0.0-alpha",
4
+ "author": {
5
+ "name": "Pablo Alcaraz Martínez",
6
+ "url": "https://github.com/palcarazm/"
7
+ },
8
+ "description": "Bootstrap Toggle is a bootstrap 5 plugin that converts checkboxes into toggles.",
9
+ "homepage": "https://palcarazm.github.io/bootstrap5-toggle/",
10
+ "license": "MIT",
11
+ "funding": {
12
+ "type": "GitHub Sponsors",
13
+ "url": "https://github.com/sponsors/palcarazm"
14
+ },
15
+ "main": "js/bootstrap5-toggle.ecmas.min.js",
16
+ "files": [
17
+ "css/*",
18
+ "js/*"
19
+ ],
20
+ "scripts": {
21
+ "build": "grunt",
22
+ "postversion": "grunt",
23
+ "prepublishOnly": "grunt"
24
+ },
25
+ "keywords": [
26
+ "bootstrap",
27
+ "bootstrap5",
28
+ "bootstrap-5",
29
+ "bootstrap 5",
30
+ "bootstrap checkbox",
31
+ "bootstrap switch",
32
+ "bootstrap toggle",
33
+ "bootstrap-checkbox",
34
+ "bootstrap-switch",
35
+ "bootstrap-switch-button",
36
+ "bootstrap-toggle"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/palcarazm/bootstrap5-toggle.git"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/palcarazm/bootstrap5-toggle/issues"
44
+ },
45
+ "devDependencies": {
46
+ "cypress": "^12.0.2",
47
+ "cypress-plugin-tab": "^1.0.5",
48
+ "doctoc": "^2.2.0",
49
+ "dompurify": "^2.4.1",
50
+ "grunt": "^1.5.3",
51
+ "grunt-banner": "^0.6.0",
52
+ "grunt-contrib-clean": "^2.0.1",
53
+ "grunt-contrib-cssmin": "^4.0.0",
54
+ "grunt-contrib-uglify": "^5.2.1"
55
+ },
56
+ "dependencies": {
57
+ "bootstrap": "^5.0.0"
58
+ },
59
+ "optionalDependencies": {
60
+ "jquery": "^3.6.0"
61
+ }
62
+ }
@@ -1,327 +0,0 @@
1
- /* Copyright Notice
2
- * bootstrap5-toggle v4.3.5
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
- +function ($) {
15
- 'use strict';
16
-
17
- // TOGGLE PUBLIC CLASS DEFINITION
18
- // ==============================
19
-
20
- let Toggle = function (element, options) {
21
- // A: Capture ref to HMTL element
22
- this.$element = $(element)
23
- // B: Set options
24
- this.options = $.extend({}, this.defaults(), options)
25
- // LAST: Render Toggle
26
- this.render()
27
- }
28
-
29
- Toggle.DEFAULTS = {
30
- on: 'On',
31
- off: 'Off',
32
- onstyle: 'primary',
33
- offstyle: 'secondary',
34
- onvalue: null,
35
- offvalue: null,
36
- size: 'normal',
37
- style: '',
38
- width: null,
39
- height: null,
40
- tabindex: 0,
41
- tristate: false,
42
- name: null,
43
- }
44
-
45
- Toggle.prototype.defaults = function() {
46
- return {
47
- on: this.$element.attr('data-on') || Toggle.DEFAULTS.on,
48
- off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
49
- onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
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,
53
- size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
54
- style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
55
- width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
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,
60
- }
61
- }
62
-
63
- Toggle.prototype.render = function () {
64
- // 0: Parse size
65
- let size;
66
- switch (this.options.size ) {
67
- case 'large':
68
- case 'lg':
69
- size = 'btn-lg';
70
- break;
71
- case 'small':
72
- case 'sm':
73
- size = 'btn-sm';
74
- break;
75
- case 'mini':
76
- case 'xs':
77
- size = 'btn-xs';
78
- break;
79
- default:
80
- size = ''
81
- break;
82
- }
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">')
94
- .addClass(size)
95
-
96
- // 4: Toggle Group
97
- let $toggleGroup = $('<div class="toggle-group">')
98
- .append($toggleOn, $toggleOff, $toggleHandle)
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' )
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
- }
120
-
121
- // 7: Replace HTML checkbox with Toggle-Button
122
- this.$element.wrap($toggle)
123
- $.extend(this, {
124
- $toggle: this.$element.parent(),
125
- $toggleOn: $toggleOn,
126
- $toggleOff: $toggleOff,
127
- $toggleGroup: $toggleGroup,
128
- $invElement: $invElement
129
- })
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
- }
148
- }
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()
183
- }
184
-
185
- Toggle.prototype.toggle = function (silent = false) {
186
- if (this.$element.prop('checked')) this.off(silent)
187
- else this.on(silent)
188
- }
189
-
190
- Toggle.prototype.on = function (silent = false) {
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)
193
- this.$element.prop('checked', true)
194
- if(this.$invElement) this.$invElement.prop('checked', false);
195
- if (!silent) this.trigger()
196
- }
197
-
198
- Toggle.prototype.off = function (silent = false) {
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')
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);
223
- if (!silent) this.trigger()
224
- }
225
-
226
- Toggle.prototype.enable = function () {
227
- this.$toggle.removeClass('disabled')
228
- this.$toggle.removeAttr('disabled')
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
- }
235
- }
236
-
237
- Toggle.prototype.disable = function () {
238
- this.$toggle.addClass('disabled')
239
- this.$toggle.attr('disabled', 'disabled')
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
- }
257
- }
258
-
259
- Toggle.prototype.update = function (silent) {
260
- if (this.$element.prop('disabled')) this.disable()
261
- else if (this.$element.prop('readonly')) this.readonly()
262
- else this.enable()
263
- if (this.$element.prop('checked')) this.on(silent)
264
- else this.off(silent)
265
- }
266
-
267
- Toggle.prototype.trigger = function (silent) {
268
- this.$element.off('change.bs.toggle')
269
- if (!silent) this.$element.change()
270
- this.$element.on('change.bs.toggle', $.proxy(function() {
271
- this.update()
272
- }, this))
273
- }
274
-
275
- Toggle.prototype.destroy = function() {
276
- // A: Remove button-group from UI, replace checkbox element
277
- this.$element.off('change.bs.toggle')
278
- this.$toggleGroup.remove()
279
- if(this.$invElement) this.$invElement.remove()
280
-
281
- // B: Delete internal refs
282
- this.$element.removeData('bs.toggle')
283
- this.$element.unwrap()
284
- }
285
-
286
- // TOGGLE PLUGIN DEFINITION
287
- // ========================
288
-
289
- function Plugin(option) {
290
- let optArg = Array.prototype.slice.call( arguments, 1 )[0]
291
-
292
- return this.each(function () {
293
- let $this = $(this)
294
- let data = $this.data('bs.toggle')
295
- let options = typeof option == 'object' && option
296
-
297
- if (!data) {
298
- data = new Toggle(this, options)
299
- $this.data('bs.toggle', data)
300
- }
301
- if (typeof option === 'string' && data[option] && typeof optArg === 'boolean') data[option](optArg)
302
- else if (typeof option === 'string' && data[option]) data[option]()
303
- //else if (option && !data[option]) console.log('bootstrap-toggle: error: method `'+ option +'` does not exist!');
304
- })
305
- }
306
-
307
- let old = $.fn.bootstrapToggle
308
-
309
- $.fn.bootstrapToggle = Plugin
310
- $.fn.bootstrapToggle.Constructor = Toggle
311
-
312
- // TOGGLE NO CONFLICT
313
- // ==================
314
-
315
- $.fn.toggle.noConflict = function () {
316
- $.fn.bootstrapToggle = old
317
- return this
318
- }
319
-
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
- */
324
- $(function() {
325
- $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
326
- })
327
- }(jQuery);
@@ -1,14 +0,0 @@
1
- /* Copyright Notice
2
- * bootstrap5-toggle v4.3.5
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
- !function(a){"use strict";function o(t,e){this.$element=a(t),this.options=a.extend({},this.defaults(),e),this.render()}function h(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=""}var e=a('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.on).addClass("btn-"+this.options.onstyle+" "+t),i=a('<label for="'+this.$element.prop("id")+'" class="btn">').html(this.options.off).addClass("btn-"+this.options.offstyle+" "+t),s=a('<span class="toggle-handle btn">').addClass(t),n=a('<div class="toggle-group">').append(e,i,s),o=a('<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);(this.$element.prop("disabled")||this.$element.prop("readonly"))&&(o.addClass("disabled"),o.attr("disabled","disabled")),this.options.onvalue&&this.$element.val(this.options.onvalue);let l=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),a.extend(this,{$toggle:this.$element.parent(),$toggleOn:e,$toggleOff:i,$toggleGroup:n,$invElement:l}),this.$toggle.append(l,n);o=this.options.width||Math.max(e.outerWidth(),i.outerWidth())+s.outerWidth()/2,n=this.options.height||Math.max(e.outerHeight(),i.outerHeight());this.$toggle.css({width:o,height:n}),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=>{h(t,this)}),this.$toggle.on("click",t=>{h(t,this)}),this.$toggle.on("keypress",t=>{" "==t.key&&h(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",a.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=a.fn.bootstrapToggle;a.fn.bootstrapToggle=function(s){let n=Array.prototype.slice.call(arguments,1)[0];return this.each(function(){var t=a(this);let 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]()})},a.fn.bootstrapToggle.Constructor=o,a.fn.toggle.noConflict=function(){return a.fn.bootstrapToggle=t,this},a(function(){a("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()})}(jQuery);
14
- //# sourceMappingURL=bootstrap5-toggle.min.js.map
@@ -1 +0,0 @@
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","val","$invElement","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":"AAaC,CAAA,SAA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