@hummingbirdui/hummingbird
Version:
An open-source system designed for rapid development, without sacrificing the granular control of utility-first CSS.
80 lines (79 loc) • 3.11 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const baseComponent = require("../utils/base-component.js");
const componentFunctions = require("../utils/component-functions.js");
var alert$1 = { exports: {} };
/*!
* Bootstrap alert.js v5.3.8 (https://getbootstrap.com/)
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
var alert = alert$1.exports;
var hasRequiredAlert;
function requireAlert() {
if (hasRequiredAlert) return alert$1.exports;
hasRequiredAlert = 1;
(function(module2, exports2) {
(function(global, factory) {
module2.exports = factory(baseComponent.requireBaseComponent(), baseComponent.requireEventHandler(), componentFunctions.requireComponentFunctions(), baseComponent.requireUtil());
})(alert, function(BaseComponent, EventHandler, componentFunctions_js, index_js) {
const NAME = "alert";
const DATA_KEY = "bs.alert";
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_CLOSE = `close${EVENT_KEY}`;
const EVENT_CLOSED = `closed${EVENT_KEY}`;
const CLASS_NAME_FADE = "fade";
const CLASS_NAME_SHOW = "show";
class Alert2 extends BaseComponent {
// Getters
static get NAME() {
return NAME;
}
// Public
close() {
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
if (closeEvent.defaultPrevented) {
return;
}
this._element.classList.remove(CLASS_NAME_SHOW);
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
}
// Private
_destroyElement() {
this._element.remove();
EventHandler.trigger(this._element, EVENT_CLOSED);
this.dispose();
}
// Static
static jQueryInterface(config) {
return this.each(function() {
const data = Alert2.getOrCreateInstance(this);
if (typeof config !== "string") {
return;
}
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
throw new TypeError(`No method named "${config}"`);
}
data[config](this);
});
}
}
componentFunctions_js.enableDismissTrigger(Alert2, "close");
index_js.defineJQueryPlugin(Alert2);
return Alert2;
});
})(alert$1);
return alert$1.exports;
}
var alertExports = requireAlert();
const BsAlert = /* @__PURE__ */ baseComponent.getDefaultExportFromCjs(alertExports);
var AlertEvents = /* @__PURE__ */ ((AlertEvents2) => {
AlertEvents2["close"] = "close.bs.alert";
AlertEvents2["closed"] = "closed.bs.alert";
return AlertEvents2;
})(AlertEvents || {});
const Alert = BsAlert;
Alert.Events = AlertEvents;
exports.default = Alert;
//# sourceMappingURL=alert.js.map