aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/button.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/button.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/button.js251
1 files changed, 123 insertions, 128 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/button.js b/vendor/twbs/bootstrap/js/dist/button.js
index 73b97a756..e8dfecbaf 100644
--- a/vendor/twbs/bootstrap/js/dist/button.js
+++ b/vendor/twbs/bootstrap/js/dist/button.js
@@ -1,8 +1,13 @@
+/*!
+ * Bootstrap button.js v4.3.1 (https://getbootstrap.com/)
+ * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
- (global.Button = factory(global.jQuery));
-}(this, (function ($) { 'use strict';
+ (global = global || self, global.Button = factory(global.jQuery));
+}(this, function ($) { 'use strict';
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
@@ -23,170 +28,160 @@
}
/**
- * --------------------------------------------------------------------------
- * Bootstrap (v4.1.3): button.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * --------------------------------------------------------------------------
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
*/
- var Button = function ($$$1) {
+ var NAME = 'button';
+ var VERSION = '4.3.1';
+ var DATA_KEY = 'bs.button';
+ var EVENT_KEY = "." + DATA_KEY;
+ var DATA_API_KEY = '.data-api';
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
+ var ClassName = {
+ ACTIVE: 'active',
+ BUTTON: 'btn',
+ FOCUS: 'focus'
+ };
+ var Selector = {
+ DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
+ DATA_TOGGLE: '[data-toggle="buttons"]',
+ INPUT: 'input:not([type="hidden"])',
+ ACTIVE: '.active',
+ BUTTON: '.btn'
+ };
+ var Event = {
+ CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
+ FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
/**
* ------------------------------------------------------------------------
- * Constants
+ * Class Definition
* ------------------------------------------------------------------------
*/
- var NAME = 'button';
- var VERSION = '4.1.3';
- var DATA_KEY = 'bs.button';
- var EVENT_KEY = "." + DATA_KEY;
- var DATA_API_KEY = '.data-api';
- var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
- var ClassName = {
- ACTIVE: 'active',
- BUTTON: 'btn',
- FOCUS: 'focus'
- };
- var Selector = {
- DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
- DATA_TOGGLE: '[data-toggle="buttons"]',
- INPUT: 'input',
- ACTIVE: '.active',
- BUTTON: '.btn'
- };
- var Event = {
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
- FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
- };
+ };
- var Button =
- /*#__PURE__*/
- function () {
- function Button(element) {
- this._element = element;
- } // Getters
+ var Button =
+ /*#__PURE__*/
+ function () {
+ function Button(element) {
+ this._element = element;
+ } // Getters
- var _proto = Button.prototype;
+ var _proto = Button.prototype;
- // Public
- _proto.toggle = function toggle() {
- var triggerChangeEvent = true;
- var addAriaPressed = true;
- var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
+ // Public
+ _proto.toggle = function toggle() {
+ var triggerChangeEvent = true;
+ var addAriaPressed = true;
+ var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
- if (rootElement) {
- var input = this._element.querySelector(Selector.INPUT);
+ if (rootElement) {
+ var input = this._element.querySelector(Selector.INPUT);
- if (input) {
- if (input.type === 'radio') {
- if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
- triggerChangeEvent = false;
- } else {
- var activeElement = rootElement.querySelector(Selector.ACTIVE);
+ if (input) {
+ if (input.type === 'radio') {
+ if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
+ triggerChangeEvent = false;
+ } else {
+ var activeElement = rootElement.querySelector(Selector.ACTIVE);
- if (activeElement) {
- $$$1(activeElement).removeClass(ClassName.ACTIVE);
- }
+ if (activeElement) {
+ $(activeElement).removeClass(ClassName.ACTIVE);
}
}
+ }
- if (triggerChangeEvent) {
- if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
- return;
- }
-
- input.checked = !this._element.classList.contains(ClassName.ACTIVE);
- $$$1(input).trigger('change');
+ if (triggerChangeEvent) {
+ if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
+ return;
}
- input.focus();
- addAriaPressed = false;
+ input.checked = !this._element.classList.contains(ClassName.ACTIVE);
+ $(input).trigger('change');
}
- }
-
- if (addAriaPressed) {
- this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
- }
- if (triggerChangeEvent) {
- $$$1(this._element).toggleClass(ClassName.ACTIVE);
+ input.focus();
+ addAriaPressed = false;
}
- };
+ }
- _proto.dispose = function dispose() {
- $$$1.removeData(this._element, DATA_KEY);
- this._element = null;
- }; // Static
+ if (addAriaPressed) {
+ this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
+ }
+ if (triggerChangeEvent) {
+ $(this._element).toggleClass(ClassName.ACTIVE);
+ }
+ };
- Button._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $$$1(this).data(DATA_KEY);
+ _proto.dispose = function dispose() {
+ $.removeData(this._element, DATA_KEY);
+ this._element = null;
+ } // Static
+ ;
- if (!data) {
- data = new Button(this);
- $$$1(this).data(DATA_KEY, data);
- }
+ Button._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $(this).data(DATA_KEY);
- if (config === 'toggle') {
- data[config]();
- }
- });
- };
+ if (!data) {
+ data = new Button(this);
+ $(this).data(DATA_KEY, data);
+ }
- _createClass(Button, null, [{
- key: "VERSION",
- get: function get() {
- return VERSION;
+ if (config === 'toggle') {
+ data[config]();
}
- }]);
+ });
+ };
- return Button;
- }();
- /**
- * ------------------------------------------------------------------------
- * Data Api implementation
- * ------------------------------------------------------------------------
- */
+ _createClass(Button, null, [{
+ key: "VERSION",
+ get: function get() {
+ return VERSION;
+ }
+ }]);
+ return Button;
+ }();
+ /**
+ * ------------------------------------------------------------------------
+ * Data Api implementation
+ * ------------------------------------------------------------------------
+ */
- $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
- event.preventDefault();
- var button = event.target;
- if (!$$$1(button).hasClass(ClassName.BUTTON)) {
- button = $$$1(button).closest(Selector.BUTTON);
- }
+ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
+ event.preventDefault();
+ var button = event.target;
- Button._jQueryInterface.call($$$1(button), 'toggle');
- }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
- var button = $$$1(event.target).closest(Selector.BUTTON)[0];
- $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
- });
- /**
- * ------------------------------------------------------------------------
- * jQuery
- * ------------------------------------------------------------------------
- */
+ if (!$(button).hasClass(ClassName.BUTTON)) {
+ button = $(button).closest(Selector.BUTTON);
+ }
- $$$1.fn[NAME] = Button._jQueryInterface;
- $$$1.fn[NAME].Constructor = Button;
+ Button._jQueryInterface.call($(button), 'toggle');
+ }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
+ var button = $(event.target).closest(Selector.BUTTON)[0];
+ $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
+ });
+ /**
+ * ------------------------------------------------------------------------
+ * jQuery
+ * ------------------------------------------------------------------------
+ */
- $$$1.fn[NAME].noConflict = function () {
- $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
- return Button._jQueryInterface;
- };
+ $.fn[NAME] = Button._jQueryInterface;
+ $.fn[NAME].Constructor = Button;
- return Button;
- }($);
+ $.fn[NAME].noConflict = function () {
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
+ return Button._jQueryInterface;
+ };
return Button;
-})));
+}));
//# sourceMappingURL=button.js.map