| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  | /*! | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   * Bootstrap button.js v5.3.0-alpha1 (https://getbootstrap.com/)
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
 | 
					
						
							| 
									
										
										
										
											2020-06-17 02:50:01 +08:00
										 |  |  |   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   */ | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | (function (global, factory) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index.js'), require('./dom/event-handler.js'), require('./base-component.js')) : | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component'], factory) : | 
					
						
							|  |  |  |   (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.Index, global.EventHandler, global.BaseComponent)); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | })(this, (function (index_js, EventHandler, BaseComponent) { 'use strict'; | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |    * Bootstrap (v5.3.0-alpha1): button.js | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |    * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-03 22:18:59 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Constants | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const NAME = 'button'; | 
					
						
							|  |  |  |   const DATA_KEY = 'bs.button'; | 
					
						
							|  |  |  |   const EVENT_KEY = `.${DATA_KEY}`; | 
					
						
							|  |  |  |   const DATA_API_KEY = '.data-api'; | 
					
						
							|  |  |  |   const CLASS_NAME_ACTIVE = 'active'; | 
					
						
							|  |  |  |   const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]'; | 
					
						
							|  |  |  |   const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Class definition | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-05-08 08:07:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   class Button extends BaseComponent { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     // Getters
 | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |     static get NAME() { | 
					
						
							|  |  |  |       return NAME; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-09-06 12:05:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Public
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     toggle() { | 
					
						
							| 
									
										
										
										
											2020-06-17 02:50:01 +08:00
										 |  |  |       // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
 | 
					
						
							|  |  |  |       this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE)); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Static
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     static jQueryInterface(config) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       return this.each(function () { | 
					
						
							| 
									
										
										
										
											2021-06-23 02:29:16 +08:00
										 |  |  |         const data = Button.getOrCreateInstance(this); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         if (config === 'toggle') { | 
					
						
							|  |  |  |           data[config](); | 
					
						
							| 
									
										
										
										
											2017-10-01 05:28:03 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Data API implementation | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-05-08 08:07:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |     event.preventDefault(); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     const button = event.target.closest(SELECTOR_DATA_TOGGLE); | 
					
						
							| 
									
										
										
										
											2021-06-23 02:29:16 +08:00
										 |  |  |     const data = Button.getOrCreateInstance(button); | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |     data.toggle(); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * jQuery | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-05-08 08:07:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   index_js.defineJQueryPlugin(Button); | 
					
						
							| 
									
										
										
										
											2015-05-08 08:07:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return Button; | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | //# sourceMappingURL=button.js.map
 |