bootstrap.esm.js 144 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
5001
5002
5003
5004
5005
5006
5007
5008
5009
  _createClass(Tab, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$9;
    }
  }]);

  return Tab;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
5010
5011
5012
5013
5014
5015
5016
5017
5018
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
5019
  var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
5020
5021
  data.show();
});
XhmikosR's avatar
XhmikosR committed
5022
var $$a = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
5023
5024
5025
5026
5027
5028
5029
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .tab to jQuery only if jQuery is present
 */

5030
5031
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5032
5033
5034
5035
if ($$a) {
  var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
  $$a.fn[NAME$9] = Tab.jQueryInterface;
  $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist.  
XhmikosR committed
5036

XhmikosR's avatar
XhmikosR committed
5037
5038
5039
  $$a.fn[NAME$9].noConflict = function () {
    $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
    return Tab.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
5040
5041
5042
5043
5044
5045
5046
5047
5048
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
var NAME$a = 'toast';
var VERSION$a = '4.3.1';
var DATA_KEY$a = 'bs.toast';
var EVENT_KEY$a = "." + DATA_KEY$a;
var Event$b = {
  CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  HIDE: "hide" + EVENT_KEY$a,
  HIDDEN: "hidden" + EVENT_KEY$a,
  SHOW: "show" + EVENT_KEY$a,
  SHOWN: "shown" + EVENT_KEY$a
XhmikosR's avatar
Dist.  
XhmikosR committed
5059
};
XhmikosR's avatar
XhmikosR committed
5060
var ClassName$a = {
XhmikosR's avatar
Dist.  
XhmikosR committed
5061
5062
5063
5064
5065
  FADE: 'fade',
  HIDE: 'hide',
  SHOW: 'show',
  SHOWING: 'showing'
};
XhmikosR's avatar
XhmikosR committed
5066
var DefaultType$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
5067
5068
5069
5070
  animation: 'boolean',
  autohide: 'boolean',
  delay: 'number'
};
XhmikosR's avatar
XhmikosR committed
5071
var Default$7 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
5072
5073
5074
5075
  animation: true,
  autohide: true,
  delay: 500
};
XhmikosR's avatar
XhmikosR committed
5076
var Selector$a = {
XhmikosR's avatar
Dist.  
XhmikosR committed
5077
5078
5079
5080
5081
5082
5083
5084
5085
  DATA_DISMISS: '[data-dismiss="toast"]'
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

};

XhmikosR's avatar
XhmikosR committed
5086
5087
5088
5089
var Toast =
/*#__PURE__*/
function () {
  function Toast(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
    this._element = element;
    this._config = this._getConfig(config);
    this._timeout = null;

    this._setListeners();

    Data.setData(element, DATA_KEY$a, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
5100
  var _proto = Toast.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
5101

XhmikosR's avatar
XhmikosR committed
5102
5103
5104
  // Public
  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
5105

Mark Otto's avatar
dist v5    
Mark Otto committed
5106
5107
5108
5109
5110
    var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

    if (showEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
5111
5112
5113
5114
5115

    if (this._config.animation) {
      this._element.classList.add(ClassName$a.FADE);
    }

XhmikosR's avatar
XhmikosR committed
5116
5117
    var complete = function complete() {
      _this._element.classList.remove(ClassName$a.SHOWING);
XhmikosR's avatar
Dist.  
XhmikosR committed
5118

XhmikosR's avatar
XhmikosR committed
5119
      _this._element.classList.add(ClassName$a.SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
5120

XhmikosR's avatar
XhmikosR committed
5121
      EventHandler.trigger(_this._element, Event$b.SHOWN);
XhmikosR's avatar
Dist.  
XhmikosR committed
5122

XhmikosR's avatar
XhmikosR committed
5123
5124
5125
5126
      if (_this._config.autohide) {
        _this._timeout = setTimeout(function () {
          _this.hide();
        }, _this._config.delay);
XhmikosR's avatar
Dist.  
XhmikosR committed
5127
5128
5129
5130
5131
      }
    };

    this._element.classList.remove(ClassName$a.HIDE);

5132
5133
    reflow(this._element);

XhmikosR's avatar
Dist.  
XhmikosR committed
5134
5135
5136
    this._element.classList.add(ClassName$a.SHOWING);

    if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
5137
      var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
5138
5139
5140
5141
5142
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
    } else {
      complete();
    }
XhmikosR's avatar
XhmikosR committed
5143
5144
5145
5146
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
5147
5148
5149
5150
5151

    if (!this._element.classList.contains(ClassName$a.SHOW)) {
      return;
    }

Mark Otto's avatar
dist v5    
Mark Otto committed
5152
5153
5154
5155
5156
    var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

    if (hideEvent.defaultPrevented) {
      return;
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
5157

XhmikosR's avatar
XhmikosR committed
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
    var complete = function complete() {
      _this2._element.classList.add(ClassName$a.HIDE);

      EventHandler.trigger(_this2._element, Event$b.HIDDEN);
    };

    this._element.classList.remove(ClassName$a.SHOW);

    if (this._config.animation) {
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist.  
XhmikosR committed
5170
    } else {
XhmikosR's avatar
XhmikosR committed
5171
      complete();
XhmikosR's avatar
Dist.  
XhmikosR committed
5172
    }
XhmikosR's avatar
XhmikosR committed
5173
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5174

XhmikosR's avatar
XhmikosR committed
5175
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
    clearTimeout(this._timeout);
    this._timeout = null;

    if (this._element.classList.contains(ClassName$a.SHOW)) {
      this._element.classList.remove(ClassName$a.SHOW);
    }

    EventHandler.off(this._element, Event$b.CLICK_DISMISS);
    Data.removeData(this._element, DATA_KEY$a);
    this._element = null;
    this._config = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
5188
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
5189

XhmikosR's avatar
XhmikosR committed
5190
  _proto._getConfig = function _getConfig(config) {
5191
    config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist.  
XhmikosR committed
5192
5193
    typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
5194
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5195

XhmikosR's avatar
XhmikosR committed
5196
5197
  _proto._setListeners = function _setListeners() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
5198

XhmikosR's avatar
XhmikosR committed
5199
5200
5201
    EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
      return _this3.hide();
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
5202
  } // Static
XhmikosR's avatar
XhmikosR committed
5203
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
5204

XhmikosR's avatar
XhmikosR committed
5205
  Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5206
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5207
      var data = Data.getData(this, DATA_KEY$a);
XhmikosR's avatar
Dist.  
XhmikosR committed
5208

XhmikosR's avatar
XhmikosR committed
5209
      var _config = typeof config === 'object' && config;
XhmikosR's avatar
Dist.  
XhmikosR committed
5210
5211
5212
5213
5214
5215
5216

      if (!data) {
        data = new Toast(this, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
5217
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
5218
5219
5220
5221
5222
        }

        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
5223
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5224

XhmikosR's avatar
XhmikosR committed
5225
  Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
5226
    return Data.getData(element, DATA_KEY$a);
XhmikosR's avatar
XhmikosR committed
5227
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
5228

XhmikosR's avatar
XhmikosR committed
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
  _createClass(Toast, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$a;
    }
  }, {
    key: "DefaultType",
    get: function get() {
      return DefaultType$7;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default$7;
    }
  }]);

  return Toast;
}();
XhmikosR's avatar
XhmikosR committed
5248
5249

var $$b = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
5250
5251
5252
5253
5254
5255
5256
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 *  add .toast to jQuery only if jQuery is present
 */

5257
5258
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5259
5260
5261
5262
if ($$b) {
  var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
  $$b.fn[NAME$a] = Toast.jQueryInterface;
  $$b.fn[NAME$a].Constructor = Toast;
XhmikosR's avatar
Dist.  
XhmikosR committed
5263

XhmikosR's avatar
XhmikosR committed
5264
5265
5266
  $$b.fn[NAME$a].noConflict = function () {
    $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
    return Toast.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
5267
5268
5269
5270
5271
  };
}

export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Popover, ScrollSpy, Tab, Toast, Tooltip };
//# sourceMappingURL=bootstrap.esm.js.map
For faster browsing, not all history is shown. View entire blame