second commit

This commit is contained in:
2024-12-27 22:31:23 +09:00
parent 2353324570
commit 10a0f110ca
8819 changed files with 1307198 additions and 28 deletions

View File

@ -0,0 +1,26 @@
import type { AccordionItem, AccordionOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { AccordionInterface } from './interface';
declare class Accordion implements AccordionInterface {
_instanceId: string;
_accordionEl: HTMLElement;
_items: AccordionItem[];
_options: AccordionOptions;
_clickHandler: EventListenerOrEventListenerObject;
_initialized: boolean;
constructor(accordionEl?: HTMLElement | null, items?: AccordionItem[], options?: AccordionOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
getItem(id: string): AccordionItem;
open(id: string): void;
toggle(id: string): void;
close(id: string): void;
updateOnOpen(callback: () => void): void;
updateOnClose(callback: () => void): void;
updateOnToggle(callback: () => void): void;
}
export declare function initAccordions(): void;
export default Accordion;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiBjD,cAAM,SAAU,YAAW,kBAAkB;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,aAAa,EAAE,kCAAkC,CAAC;IAClD,YAAY,EAAE,OAAO,CAAC;gBAGlB,WAAW,GAAE,WAAW,GAAG,IAAW,EACtC,KAAK,GAAE,aAAa,EAAO,EAC3B,OAAO,GAAE,gBAA0B,EACnC,eAAe,GAAE,eAAwC;IAkB7D,IAAI;IAqBJ,OAAO;IAYP,cAAc;IAId,wBAAwB;IAKxB,OAAO,CAAC,EAAE,EAAE,MAAM;IAIlB,IAAI,CAAC,EAAE,EAAE,MAAM;IA2Cf,MAAM,CAAC,EAAE,EAAE,MAAM;IAajB,KAAK,CAAC,EAAE,EAAE,MAAM;IAsBhB,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIlC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,cAAc,SA2C7B;AAOD,eAAe,SAAS,CAAC"}

View File

@ -0,0 +1,194 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initAccordions = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
alwaysOpen: false,
activeClasses: 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white',
inactiveClasses: 'text-gray-500 dark:text-gray-400',
onOpen: function () { },
onClose: function () { },
onToggle: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Accordion = /** @class */ (function () {
function Accordion(accordionEl, items, options, instanceOptions) {
if (accordionEl === void 0) { accordionEl = null; }
if (items === void 0) { items = []; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: accordionEl.id;
this._accordionEl = accordionEl;
this._items = items;
this._options = __assign(__assign({}, Default), options);
this._initialized = false;
this.init();
instances_1.default.addInstance('Accordion', this, this._instanceId, instanceOptions.override);
}
Accordion.prototype.init = function () {
var _this = this;
if (this._items.length && !this._initialized) {
// show accordion item based on click
this._items.forEach(function (item) {
if (item.active) {
_this.open(item.id);
}
var clickHandler = function () {
_this.toggle(item.id);
};
item.triggerEl.addEventListener('click', clickHandler);
// Store the clickHandler in a property of the item for removal later
item.clickHandler = clickHandler;
});
this._initialized = true;
}
};
Accordion.prototype.destroy = function () {
if (this._items.length && this._initialized) {
this._items.forEach(function (item) {
item.triggerEl.removeEventListener('click', item.clickHandler);
// Clean up by deleting the clickHandler property from the item
delete item.clickHandler;
});
this._initialized = false;
}
};
Accordion.prototype.removeInstance = function () {
instances_1.default.removeInstance('Accordion', this._instanceId);
};
Accordion.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Accordion.prototype.getItem = function (id) {
return this._items.filter(function (item) { return item.id === id; })[0];
};
Accordion.prototype.open = function (id) {
var _a, _b;
var _this = this;
var item = this.getItem(id);
// don't hide other accordions if always open
if (!this._options.alwaysOpen) {
this._items.map(function (i) {
var _a, _b;
if (i !== item) {
(_a = i.triggerEl.classList).remove.apply(_a, _this._options.activeClasses.split(' '));
(_b = i.triggerEl.classList).add.apply(_b, _this._options.inactiveClasses.split(' '));
i.targetEl.classList.add('hidden');
i.triggerEl.setAttribute('aria-expanded', 'false');
i.active = false;
// rotate icon if set
if (i.iconEl) {
i.iconEl.classList.add('rotate-180');
}
}
});
}
// show active item
(_a = item.triggerEl.classList).add.apply(_a, this._options.activeClasses.split(' '));
(_b = item.triggerEl.classList).remove.apply(_b, this._options.inactiveClasses.split(' '));
item.triggerEl.setAttribute('aria-expanded', 'true');
item.targetEl.classList.remove('hidden');
item.active = true;
// rotate icon if set
if (item.iconEl) {
item.iconEl.classList.remove('rotate-180');
}
// callback function
this._options.onOpen(this, item);
};
Accordion.prototype.toggle = function (id) {
var item = this.getItem(id);
if (item.active) {
this.close(id);
}
else {
this.open(id);
}
// callback function
this._options.onToggle(this, item);
};
Accordion.prototype.close = function (id) {
var _a, _b;
var item = this.getItem(id);
(_a = item.triggerEl.classList).remove.apply(_a, this._options.activeClasses.split(' '));
(_b = item.triggerEl.classList).add.apply(_b, this._options.inactiveClasses.split(' '));
item.targetEl.classList.add('hidden');
item.triggerEl.setAttribute('aria-expanded', 'false');
item.active = false;
// rotate icon if set
if (item.iconEl) {
item.iconEl.classList.add('rotate-180');
}
// callback function
this._options.onClose(this, item);
};
Accordion.prototype.updateOnOpen = function (callback) {
this._options.onOpen = callback;
};
Accordion.prototype.updateOnClose = function (callback) {
this._options.onClose = callback;
};
Accordion.prototype.updateOnToggle = function (callback) {
this._options.onToggle = callback;
};
return Accordion;
}());
function initAccordions() {
document.querySelectorAll('[data-accordion]').forEach(function ($accordionEl) {
var alwaysOpen = $accordionEl.getAttribute('data-accordion');
var activeClasses = $accordionEl.getAttribute('data-active-classes');
var inactiveClasses = $accordionEl.getAttribute('data-inactive-classes');
var items = [];
$accordionEl
.querySelectorAll('[data-accordion-target]')
.forEach(function ($triggerEl) {
// Consider only items that directly belong to $accordionEl
// (to make nested accordions work).
if ($triggerEl.closest('[data-accordion]') === $accordionEl) {
var item = {
id: $triggerEl.getAttribute('data-accordion-target'),
triggerEl: $triggerEl,
targetEl: document.querySelector($triggerEl.getAttribute('data-accordion-target')),
iconEl: $triggerEl.querySelector('[data-accordion-icon]'),
active: $triggerEl.getAttribute('aria-expanded') === 'true'
? true
: false,
};
items.push(item);
}
});
new Accordion($accordionEl, items, {
alwaysOpen: alwaysOpen === 'open' ? true : false,
activeClasses: activeClasses
? activeClasses
: Default.activeClasses,
inactiveClasses: inactiveClasses
? inactiveClasses
: Default.inactiveClasses,
});
});
}
exports.initAccordions = initAccordions;
if (typeof window !== 'undefined') {
window.Accordion = Accordion;
window.initAccordions = initAccordions;
}
exports.default = Accordion;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
import { AccordionItem, AccordionOptions } from './types';
export declare interface AccordionInterface {
_items: AccordionItem[];
_options: AccordionOptions;
getItem(id: string): AccordionItem | undefined;
open(id: string): void;
toggle(id: string): void;
close(id: string): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/interface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG1D,MAAM,CAAC,OAAO,WAAW,kBAAkB;IACvC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IAC/C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/accordion/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,18 @@
import { AccordionInterface } from './interface';
export declare type AccordionItem = {
id: string;
triggerEl: HTMLElement;
targetEl: HTMLElement;
iconEl?: HTMLElement | null;
active?: boolean;
clickHandler?: EventListenerOrEventListenerObject;
};
export declare type AccordionOptions = {
alwaysOpen?: boolean;
activeClasses?: string;
inactiveClasses?: string;
onOpen?: (accordion: AccordionInterface, item: AccordionItem) => void;
onClose?: (accordion: AccordionInterface, item: AccordionItem) => void;
onToggle?: (accordion: AccordionInterface, item: AccordionItem) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,OAAO,MAAM,aAAa,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,WAAW,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,kCAAkC,CAAC;CACrD,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,gBAAgB,GAAG;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtE,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3E,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/accordion/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,64 @@
import type { CarouselOptions, CarouselItem, IndicatorItem, RotationItems } from './types';
import type { InstanceOptions } from '../../dom/types';
import { CarouselInterface } from './interface';
declare class Carousel implements CarouselInterface {
_instanceId: string;
_carouselEl: HTMLElement;
_items: CarouselItem[];
_indicators: IndicatorItem[];
_activeItem: CarouselItem;
_intervalDuration: number;
_intervalInstance: number;
_options: CarouselOptions;
_initialized: boolean;
constructor(carouselEl?: HTMLElement | null, items?: CarouselItem[], options?: CarouselOptions, instanceOptions?: InstanceOptions);
/**
* initialize carousel and items based on active one
*/
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
getItem(position: number): CarouselItem;
/**
* Slide to the element based on id
* @param {*} position
*/
slideTo(position: number): void;
/**
* Based on the currently active item it will go to the next position
*/
next(): void;
/**
* Based on the currently active item it will go to the previous position
*/
prev(): void;
/**
* This method applies the transform classes based on the left, middle, and right rotation carousel items
* @param {*} rotationItems
*/
_rotate(rotationItems: RotationItems): void;
/**
* Set an interval to cycle through the carousel items
*/
cycle(): void;
/**
* Clears the cycling interval
*/
pause(): void;
/**
* Get the currently active item
*/
getActiveItem(): CarouselItem;
/**
* Set the currently active item and data attribute
* @param {*} position
*/
_setActiveItem(item: CarouselItem): void;
updateOnNext(callback: () => void): void;
updateOnPrev(callback: () => void): void;
updateOnChange(callback: () => void): void;
}
export declare function initCarousels(): void;
export default Carousel;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAsBhD,cAAM,QAAS,YAAW,iBAAiB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;gBAGlB,UAAU,GAAE,WAAW,GAAG,IAAW,EACrC,KAAK,GAAE,YAAY,EAAO,EAC1B,OAAO,GAAE,eAAyB,EAClC,eAAe,GAAE,eAAwC;IA0B7D;;OAEG;IACH,IAAI;IA4BJ,OAAO;IAMP,cAAc;IAId,wBAAwB;IAKxB,OAAO,CAAC,QAAQ,EAAE,MAAM;IAIxB;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM;IAuBxB;;OAEG;IACH,IAAI;IAiBJ;;OAEG;IACH,IAAI;IAiBJ;;;OAGG;IACH,OAAO,CAAC,aAAa,EAAE,aAAa;IAmDpC;;OAEG;IACH,KAAK;IAQL;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,aAAa;IAIb;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,YAAY;IAyBjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,aAAa,SA0E5B;AAOD,eAAe,QAAQ,CAAC"}

View File

@ -0,0 +1,289 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initCarousels = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
defaultPosition: 0,
indicators: {
items: [],
activeClasses: 'bg-white dark:bg-gray-800',
inactiveClasses: 'bg-white/50 dark:bg-gray-800/50 hover:bg-white dark:hover:bg-gray-800',
},
interval: 3000,
onNext: function () { },
onPrev: function () { },
onChange: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Carousel = /** @class */ (function () {
function Carousel(carouselEl, items, options, instanceOptions) {
if (carouselEl === void 0) { carouselEl = null; }
if (items === void 0) { items = []; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: carouselEl.id;
this._carouselEl = carouselEl;
this._items = items;
this._options = __assign(__assign(__assign({}, Default), options), { indicators: __assign(__assign({}, Default.indicators), options.indicators) });
this._activeItem = this.getItem(this._options.defaultPosition);
this._indicators = this._options.indicators.items;
this._intervalDuration = this._options.interval;
this._intervalInstance = null;
this._initialized = false;
this.init();
instances_1.default.addInstance('Carousel', this, this._instanceId, instanceOptions.override);
}
/**
* initialize carousel and items based on active one
*/
Carousel.prototype.init = function () {
var _this = this;
if (this._items.length && !this._initialized) {
this._items.map(function (item) {
item.el.classList.add('absolute', 'inset-0', 'transition-transform', 'transform');
});
// if no active item is set then first position is default
if (this.getActiveItem()) {
this.slideTo(this.getActiveItem().position);
}
else {
this.slideTo(0);
}
this._indicators.map(function (indicator, position) {
indicator.el.addEventListener('click', function () {
_this.slideTo(position);
});
});
this._initialized = true;
}
};
Carousel.prototype.destroy = function () {
if (this._initialized) {
this._initialized = false;
}
};
Carousel.prototype.removeInstance = function () {
instances_1.default.removeInstance('Carousel', this._instanceId);
};
Carousel.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Carousel.prototype.getItem = function (position) {
return this._items[position];
};
/**
* Slide to the element based on id
* @param {*} position
*/
Carousel.prototype.slideTo = function (position) {
var nextItem = this._items[position];
var rotationItems = {
left: nextItem.position === 0
? this._items[this._items.length - 1]
: this._items[nextItem.position - 1],
middle: nextItem,
right: nextItem.position === this._items.length - 1
? this._items[0]
: this._items[nextItem.position + 1],
};
this._rotate(rotationItems);
this._setActiveItem(nextItem);
if (this._intervalInstance) {
this.pause();
this.cycle();
}
this._options.onChange(this);
};
/**
* Based on the currently active item it will go to the next position
*/
Carousel.prototype.next = function () {
var activeItem = this.getActiveItem();
var nextItem = null;
// check if last item
if (activeItem.position === this._items.length - 1) {
nextItem = this._items[0];
}
else {
nextItem = this._items[activeItem.position + 1];
}
this.slideTo(nextItem.position);
// callback function
this._options.onNext(this);
};
/**
* Based on the currently active item it will go to the previous position
*/
Carousel.prototype.prev = function () {
var activeItem = this.getActiveItem();
var prevItem = null;
// check if first item
if (activeItem.position === 0) {
prevItem = this._items[this._items.length - 1];
}
else {
prevItem = this._items[activeItem.position - 1];
}
this.slideTo(prevItem.position);
// callback function
this._options.onPrev(this);
};
/**
* This method applies the transform classes based on the left, middle, and right rotation carousel items
* @param {*} rotationItems
*/
Carousel.prototype._rotate = function (rotationItems) {
// reset
this._items.map(function (item) {
item.el.classList.add('hidden');
});
// Handling the case when there is only one item
if (this._items.length === 1) {
rotationItems.middle.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-10');
rotationItems.middle.el.classList.add('translate-x-0', 'z-20');
return;
}
// left item (previously active)
rotationItems.left.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-20');
rotationItems.left.el.classList.add('-translate-x-full', 'z-10');
// currently active item
rotationItems.middle.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-10');
rotationItems.middle.el.classList.add('translate-x-0', 'z-30');
// right item (upcoming active)
rotationItems.right.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-30');
rotationItems.right.el.classList.add('translate-x-full', 'z-20');
};
/**
* Set an interval to cycle through the carousel items
*/
Carousel.prototype.cycle = function () {
var _this = this;
if (typeof window !== 'undefined') {
this._intervalInstance = window.setInterval(function () {
_this.next();
}, this._intervalDuration);
}
};
/**
* Clears the cycling interval
*/
Carousel.prototype.pause = function () {
clearInterval(this._intervalInstance);
};
/**
* Get the currently active item
*/
Carousel.prototype.getActiveItem = function () {
return this._activeItem;
};
/**
* Set the currently active item and data attribute
* @param {*} position
*/
Carousel.prototype._setActiveItem = function (item) {
var _a, _b;
var _this = this;
this._activeItem = item;
var position = item.position;
// update the indicators if available
if (this._indicators.length) {
this._indicators.map(function (indicator) {
var _a, _b;
indicator.el.setAttribute('aria-current', 'false');
(_a = indicator.el.classList).remove.apply(_a, _this._options.indicators.activeClasses.split(' '));
(_b = indicator.el.classList).add.apply(_b, _this._options.indicators.inactiveClasses.split(' '));
});
(_a = this._indicators[position].el.classList).add.apply(_a, this._options.indicators.activeClasses.split(' '));
(_b = this._indicators[position].el.classList).remove.apply(_b, this._options.indicators.inactiveClasses.split(' '));
this._indicators[position].el.setAttribute('aria-current', 'true');
}
};
Carousel.prototype.updateOnNext = function (callback) {
this._options.onNext = callback;
};
Carousel.prototype.updateOnPrev = function (callback) {
this._options.onPrev = callback;
};
Carousel.prototype.updateOnChange = function (callback) {
this._options.onChange = callback;
};
return Carousel;
}());
function initCarousels() {
document.querySelectorAll('[data-carousel]').forEach(function ($carouselEl) {
var interval = $carouselEl.getAttribute('data-carousel-interval');
var slide = $carouselEl.getAttribute('data-carousel') === 'slide'
? true
: false;
var items = [];
var defaultPosition = 0;
if ($carouselEl.querySelectorAll('[data-carousel-item]').length) {
Array.from($carouselEl.querySelectorAll('[data-carousel-item]')).map(function ($carouselItemEl, position) {
items.push({
position: position,
el: $carouselItemEl,
});
if ($carouselItemEl.getAttribute('data-carousel-item') ===
'active') {
defaultPosition = position;
}
});
}
var indicators = [];
if ($carouselEl.querySelectorAll('[data-carousel-slide-to]').length) {
Array.from($carouselEl.querySelectorAll('[data-carousel-slide-to]')).map(function ($indicatorEl) {
indicators.push({
position: parseInt($indicatorEl.getAttribute('data-carousel-slide-to')),
el: $indicatorEl,
});
});
}
var carousel = new Carousel($carouselEl, items, {
defaultPosition: defaultPosition,
indicators: {
items: indicators,
},
interval: interval ? interval : Default.interval,
});
if (slide) {
carousel.cycle();
}
// check for controls
var carouselNextEl = $carouselEl.querySelector('[data-carousel-next]');
var carouselPrevEl = $carouselEl.querySelector('[data-carousel-prev]');
if (carouselNextEl) {
carouselNextEl.addEventListener('click', function () {
carousel.next();
});
}
if (carouselPrevEl) {
carouselPrevEl.addEventListener('click', function () {
carousel.prev();
});
}
});
}
exports.initCarousels = initCarousels;
if (typeof window !== 'undefined') {
window.Carousel = Carousel;
window.initCarousels = initCarousels;
}
exports.default = Carousel;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
import { CarouselOptions, CarouselItem, IndicatorItem, RotationItems } from './types';
export declare interface CarouselInterface {
_items: CarouselItem[];
_indicators: IndicatorItem[];
_activeItem: CarouselItem;
_intervalDuration: number;
_intervalInstance: number;
_options: CarouselOptions;
init(): void;
getItem(position: number): CarouselItem;
getActiveItem(): CarouselItem;
_setActiveItem(item: CarouselItem): void;
slideTo(position: number): void;
next(): void;
prev(): void;
_rotate(rotationItems: RotationItems): void;
cycle(): void;
pause(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EAChB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,WAAW,iBAAiB;IACtC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAE1B,IAAI,IAAI,IAAI,CAAC;IAEb,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;IACxC,aAAa,IAAI,YAAY,CAAC;IAE9B,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAEzC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IAEb,OAAO,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5C,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;IAEd,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/carousel/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,27 @@
import { CarouselInterface } from './interface';
export declare type CarouselItem = {
position: number;
el: HTMLElement;
};
export declare type IndicatorItem = {
position: number;
el: HTMLElement;
};
export declare type RotationItems = {
left: CarouselItem;
middle: CarouselItem;
right: CarouselItem;
};
export declare type CarouselOptions = {
defaultPosition?: number;
indicators?: {
items?: IndicatorItem[];
activeClasses?: string;
inactiveClasses?: string;
};
interval?: number;
onNext?: (carousel: CarouselInterface) => void;
onPrev?: (carousel: CarouselInterface) => void;
onChange?: (carousel: CarouselInterface) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,OAAO,MAAM,YAAY,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,aAAa,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,aAAa,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,eAAe,GAAG;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACpD,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/carousel/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,24 @@
import type { CopyClipboardOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { CopyClipboardInterface } from './interface';
declare class CopyClipboard implements CopyClipboardInterface {
_instanceId: string;
_triggerEl: HTMLElement | null;
_targetEl: HTMLInputElement | null;
_options: CopyClipboardOptions;
_initialized: boolean;
_triggerElClickHandler: EventListenerOrEventListenerObject;
_inputHandler: EventListenerOrEventListenerObject;
constructor(triggerEl?: HTMLElement | null, targetEl?: HTMLInputElement | null, options?: CopyClipboardOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
getTargetValue(): string;
copy(): string;
decodeHTML(html: string): string;
updateOnCopyCallback(callback: () => void): void;
}
export declare function initCopyClipboards(): void;
export default CopyClipboard;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/clipboard/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAcrD,cAAM,aAAc,YAAW,sBAAsB;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,sBAAsB,EAAE,kCAAkC,CAAC;IAC3D,aAAa,EAAE,kCAAkC,CAAC;gBAG9C,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,QAAQ,GAAE,gBAAgB,GAAG,IAAW,EACxC,OAAO,GAAE,oBAA8B,EACvC,eAAe,GAAE,eAAwC;IAoB7D,IAAI;IAkBJ,OAAO;IAYP,cAAc;IAId,wBAAwB;IAKxB,cAAc;IAcd,IAAI;IA4BJ,UAAU,CAAC,IAAI,EAAE,MAAM;IAMvB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI;CAG5C;AAED,wBAAgB,kBAAkB,SA2CjC;AAOD,eAAe,aAAa,CAAC"}

View File

@ -0,0 +1,143 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initCopyClipboards = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
htmlEntities: false,
contentType: 'input',
onCopy: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var CopyClipboard = /** @class */ (function () {
function CopyClipboard(triggerEl, targetEl, options, instanceOptions) {
if (triggerEl === void 0) { triggerEl = null; }
if (targetEl === void 0) { targetEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetEl.id;
this._triggerEl = triggerEl;
this._targetEl = targetEl;
this._options = __assign(__assign({}, Default), options);
this._initialized = false;
this.init();
instances_1.default.addInstance('CopyClipboard', this, this._instanceId, instanceOptions.override);
}
CopyClipboard.prototype.init = function () {
var _this = this;
if (this._targetEl && this._triggerEl && !this._initialized) {
this._triggerElClickHandler = function () {
_this.copy();
};
// clicking on the trigger element should copy the value of the target element
if (this._triggerEl) {
this._triggerEl.addEventListener('click', this._triggerElClickHandler);
}
this._initialized = true;
}
};
CopyClipboard.prototype.destroy = function () {
if (this._triggerEl && this._targetEl && this._initialized) {
if (this._triggerEl) {
this._triggerEl.removeEventListener('click', this._triggerElClickHandler);
}
this._initialized = false;
}
};
CopyClipboard.prototype.removeInstance = function () {
instances_1.default.removeInstance('CopyClipboard', this._instanceId);
};
CopyClipboard.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
CopyClipboard.prototype.getTargetValue = function () {
if (this._options.contentType === 'input') {
return this._targetEl.value;
}
if (this._options.contentType === 'innerHTML') {
return this._targetEl.innerHTML;
}
if (this._options.contentType === 'textContent') {
return this._targetEl.textContent.replace(/\s+/g, ' ').trim();
}
};
CopyClipboard.prototype.copy = function () {
var textToCopy = this.getTargetValue();
// Check if HTMLEntities option is enabled
if (this._options.htmlEntities) {
// Encode the text using HTML entities
textToCopy = this.decodeHTML(textToCopy);
}
// Create a temporary textarea element
var tempTextArea = document.createElement('textarea');
tempTextArea.value = textToCopy;
document.body.appendChild(tempTextArea);
// Select the text inside the textarea and copy it to the clipboard
tempTextArea.select();
document.execCommand('copy');
// Remove the temporary textarea
document.body.removeChild(tempTextArea);
// Callback function
this._options.onCopy(this);
return textToCopy;
};
// Function to encode text into HTML entities
CopyClipboard.prototype.decodeHTML = function (html) {
var textarea = document.createElement('textarea');
textarea.innerHTML = html;
return textarea.textContent;
};
CopyClipboard.prototype.updateOnCopyCallback = function (callback) {
this._options.onCopy = callback;
};
return CopyClipboard;
}());
function initCopyClipboards() {
document
.querySelectorAll('[data-copy-to-clipboard-target]')
.forEach(function ($triggerEl) {
var targetId = $triggerEl.getAttribute('data-copy-to-clipboard-target');
var $targetEl = document.getElementById(targetId);
var contentType = $triggerEl.getAttribute('data-copy-to-clipboard-content-type');
var htmlEntities = $triggerEl.getAttribute('data-copy-to-clipboard-html-entities');
// check if the target element exists
if ($targetEl) {
if (!instances_1.default.instanceExists('CopyClipboard', $targetEl.getAttribute('id'))) {
new CopyClipboard($triggerEl, $targetEl, {
htmlEntities: htmlEntities && htmlEntities === 'true'
? true
: Default.htmlEntities,
contentType: contentType
? contentType
: Default.contentType,
});
}
}
else {
console.error("The target element with id \"".concat(targetId, "\" does not exist. Please check the data-copy-to-clipboard-target attribute."));
}
});
}
exports.initCopyClipboards = initCopyClipboards;
if (typeof window !== 'undefined') {
window.CopyClipboard = CopyClipboard;
window.initClipboards = initCopyClipboards;
}
exports.default = CopyClipboard;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/clipboard/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,iDAA4C;AAE5C,IAAM,OAAO,GAAyB;IAClC,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,OAAO;IACpB,MAAM,EAAE,cAAO,CAAC;CACnB,CAAC;AAEF,IAAM,sBAAsB,GAAoB;IAC5C,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;CACjB,CAAC;AAEF;IASI,uBACI,SAAoC,EACpC,QAAwC,EACxC,OAAuC,EACvC,eAAyD;QAHz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AAC,WAAW;wBACb,CAAC,CAAC,OAAO,CAAC,WAAW;iBACJ,CAC5B,CAAC;aACL;SACJ;aAAM;YACH,OAAO,CAAC,KAAK,CACT,uCAA+B,QAAQ,iFAA6E,CACvH,CAAC;SACL;IACL,CAAC,CAAC,CAAC;AACX,CAAC;AA3CD,gDA2CC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,MAAM,CAAC,cAAc,GAAG,kBAAkB,CAAC;CAC9C;AAED,kBAAe,aAAa,CAAC"}

View File

@ -0,0 +1,12 @@
import { CopyClipboardOptions } from './types';
export declare interface CopyClipboardInterface {
_triggerEl: HTMLElement | null;
_targetEl: HTMLElement | HTMLInputElement | null;
_options: CopyClipboardOptions;
init(): void;
copy(): string;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/clipboard/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,CAAC,OAAO,WAAW,sBAAsB;IAC3C,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAAC;IACjD,QAAQ,EAAE,oBAAoB,CAAC;IAE/B,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,MAAM,CAAC;IAEf,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/clipboard/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,7 @@
import { CopyClipboardInterface } from './interface';
export declare type CopyClipboardOptions = {
htmlEntities: boolean;
contentType?: string;
onCopy?: (clipboard: CopyClipboardInterface) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/clipboard/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,OAAO,MAAM,oBAAoB,GAAG;IACvC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACxD,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/clipboard/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,26 @@
import type { CollapseOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { CollapseInterface } from './interface';
declare class Collapse implements CollapseInterface {
_instanceId: string;
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: CollapseOptions;
_visible: boolean;
_initialized: boolean;
_clickHandler: EventListenerOrEventListenerObject;
constructor(targetEl?: HTMLElement | null, triggerEl?: HTMLElement | null, options?: CollapseOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
collapse(): void;
expand(): void;
toggle(): void;
updateOnCollapse(callback: () => void): void;
updateOnExpand(callback: () => void): void;
updateOnToggle(callback: () => void): void;
}
export declare function initCollapses(): void;
export default Collapse;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/collapse/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAchD,cAAM,QAAS,YAAW,iBAAiB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,kCAAkC,CAAC;gBAG9C,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,OAAO,GAAE,eAAyB,EAClC,eAAe,GAAE,eAAwC;IAmB7D,IAAI;IAmBJ,OAAO;IAOP,cAAc;IAId,wBAAwB;IAKxB,QAAQ;IAWR,MAAM;IAWN,MAAM;IAUN,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIrC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;IAInC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,aAAa,SAuC5B;AAOD,eAAe,QAAQ,CAAC"}

View File

@ -0,0 +1,143 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initCollapses = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
onCollapse: function () { },
onExpand: function () { },
onToggle: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Collapse = /** @class */ (function () {
function Collapse(targetEl, triggerEl, options, instanceOptions) {
if (targetEl === void 0) { targetEl = null; }
if (triggerEl === void 0) { triggerEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetEl.id;
this._targetEl = targetEl;
this._triggerEl = triggerEl;
this._options = __assign(__assign({}, Default), options);
this._visible = false;
this._initialized = false;
this.init();
instances_1.default.addInstance('Collapse', this, this._instanceId, instanceOptions.override);
}
Collapse.prototype.init = function () {
var _this = this;
if (this._triggerEl && this._targetEl && !this._initialized) {
if (this._triggerEl.hasAttribute('aria-expanded')) {
this._visible =
this._triggerEl.getAttribute('aria-expanded') === 'true';
}
else {
// fix until v2 not to break previous single collapses which became dismiss
this._visible = !this._targetEl.classList.contains('hidden');
}
this._clickHandler = function () {
_this.toggle();
};
this._triggerEl.addEventListener('click', this._clickHandler);
this._initialized = true;
}
};
Collapse.prototype.destroy = function () {
if (this._triggerEl && this._initialized) {
this._triggerEl.removeEventListener('click', this._clickHandler);
this._initialized = false;
}
};
Collapse.prototype.removeInstance = function () {
instances_1.default.removeInstance('Collapse', this._instanceId);
};
Collapse.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Collapse.prototype.collapse = function () {
this._targetEl.classList.add('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'false');
}
this._visible = false;
// callback function
this._options.onCollapse(this);
};
Collapse.prototype.expand = function () {
this._targetEl.classList.remove('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'true');
}
this._visible = true;
// callback function
this._options.onExpand(this);
};
Collapse.prototype.toggle = function () {
if (this._visible) {
this.collapse();
}
else {
this.expand();
}
// callback function
this._options.onToggle(this);
};
Collapse.prototype.updateOnCollapse = function (callback) {
this._options.onCollapse = callback;
};
Collapse.prototype.updateOnExpand = function (callback) {
this._options.onExpand = callback;
};
Collapse.prototype.updateOnToggle = function (callback) {
this._options.onToggle = callback;
};
return Collapse;
}());
function initCollapses() {
document
.querySelectorAll('[data-collapse-toggle]')
.forEach(function ($triggerEl) {
var targetId = $triggerEl.getAttribute('data-collapse-toggle');
var $targetEl = document.getElementById(targetId);
// check if the target element exists
if ($targetEl) {
if (!instances_1.default.instanceExists('Collapse', $targetEl.getAttribute('id'))) {
new Collapse($targetEl, $triggerEl);
}
else {
// if instance exists already for the same target element then create a new one with a different trigger element
new Collapse($targetEl, $triggerEl, {}, {
id: $targetEl.getAttribute('id') +
'_' +
instances_1.default._generateRandomId(),
});
}
}
else {
console.error("The target element with id \"".concat(targetId, "\" does not exist. Please check the data-collapse-toggle attribute."));
}
});
}
exports.initCollapses = initCollapses;
if (typeof window !== 'undefined') {
window.Collapse = Collapse;
window.initCollapses = initCollapses;
}
exports.default = Collapse;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/collapse/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,iDAA4C;AAE5C,IAAM,OAAO,GAAoB;IAC7B,UAAU,EAAE,cAAO,CAAC;IACpB,QAAQ,EAAE,cAAO,CAAC;IAClB,QAAQ,EAAE,cAAO,CAAC;CACrB,CAAC;AAEF,IAAM,sBAAsB,GAAoB;IAC5C,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;CACjB,CAAC;AAEF;IASI,kBACI,QAAmC,EACnC,SAAoC,EACpC,OAAkC,EAClC,eAAyD;QAHzD,yBAAA,EAAA,eAAmC;QACnC,0BAAA,EAAA,gBAAoC;QACpC,wBAAA,EAAA,iBAAkC;QAClC,gCAAA,EAAA,wCAAyD;QAEzD,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,EAAE;YACjC,CAAC,CAAC,eAAe,CAAC,EAAE;YACpB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,UAAU,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;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,iCAAc,GAAd,UAAe,QAAoB;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtC,CAAC;IACL,eAAC;AAAD,CAAC,AA9GD,IA8GC;AAED,SAAgB,aAAa;IACzB,QAAQ;SACH,gBAAgB,CAAC,wBAAwB,CAAC;SAC1C,OAAO,CAAC,UAAC,UAAU;QAChB,IAAM,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;QACjE,IAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAEpD,qCAAqC;QACrC,IAAI,SAAS,EAAE;YACX,IACI,CAAC,mBAAS,CAAC,cAAc,CACrB,UAAU,EACV,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAC/B,EACH;gBACE,IAAI,QAAQ,CACR,SAAwB,EACxB,UAAyB,CAC5B,CAAC;aACL;iBAAM;gBACH,gHAAgH;gBAChH,IAAI,QAAQ,CACR,SAAwB,EACxB,UAAyB,EACzB,EAAE,EACF;oBACI,EAAE,EACE,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC;wBAC5B,GAAG;wBACH,mBAAS,CAAC,iBAAiB,EAAE;iBACpC,CACJ,CAAC;aACL;SACJ;aAAM;YACH,OAAO,CAAC,KAAK,CACT,uCAA+B,QAAQ,wEAAoE,CAC9G,CAAC;SACL;IACL,CAAC,CAAC,CAAC;AACX,CAAC;AAvCD,sCAuCC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;CACxC;AAED,kBAAe,QAAQ,CAAC"}

View File

@ -0,0 +1,15 @@
import { CollapseOptions } from './types';
export declare interface CollapseInterface {
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: CollapseOptions;
_visible: boolean;
init(): void;
collapse(): void;
expand(): void;
toggle(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/collapse/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,CAAC,OAAO,WAAW,iBAAiB;IACtC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAElB,IAAI,IAAI,IAAI,CAAC;IACb,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,IAAI,IAAI,CAAC;IAEf,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/collapse/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,7 @@
import { CollapseInterface } from './interface';
export declare type CollapseOptions = {
onCollapse?: (collapse: CollapseInterface) => void;
onExpand?: (collapse: CollapseInterface) => void;
onToggle?: (collapse: CollapseInterface) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/collapse/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,OAAO,MAAM,eAAe,GAAG;IAClC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACpD,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/collapse/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,27 @@
import type { DatepickerOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { DatepickerInterface } from './interface';
import { Datepicker as FlowbiteDatepicker, DateRangePicker as FlowbiteDateRangePicker } from 'flowbite-datepicker';
declare class Datepicker implements DatepickerInterface {
_instanceId: string;
_datepickerEl: HTMLElement;
_datepickerInstance: FlowbiteDatepicker | FlowbiteDateRangePicker | null;
_options: DatepickerOptions;
_initialized: boolean;
constructor(datepickerEl?: HTMLElement | null, options?: DatepickerOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
getDatepickerInstance(): FlowbiteDatepicker | FlowbiteDateRangePicker;
getDate(): string | string[];
setDate(date: any): void;
show(): void;
hide(): void;
_getDatepickerOptions(options: DatepickerOptions): any;
updateOnShow(callback: () => void): void;
updateOnHide(callback: () => void): void;
}
export declare function initDatepickers(): void;
export default Datepicker;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/datepicker/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EACH,UAAU,IAAI,kBAAkB,EAChC,eAAe,IAAI,uBAAuB,EAC7C,MAAM,qBAAqB,CAAC;AAuB7B,cAAM,UAAW,YAAW,mBAAmB;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,WAAW,CAAC;IAC3B,mBAAmB,EAAE,kBAAkB,GAAG,uBAAuB,GAAG,IAAI,CAAC;IACzE,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;gBAGlB,YAAY,GAAE,WAAW,GAAG,IAAW,EACvC,OAAO,GAAE,iBAA2B,EACpC,eAAe,GAAE,eAAwC;IAkB7D,IAAI;IAkBJ,OAAO;IAOP,cAAc;IAKd,wBAAwB;IAKxB,qBAAqB;IAIrB,OAAO;IAgBP,OAAO,CAAC,IAAI,EAAE,GAAG;IAgBjB,IAAI;IAKJ,IAAI;IAKJ,qBAAqB,CAAC,OAAO,EAAE,iBAAiB;IA2ChD,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGpC;AAED,wBAAgB,eAAe,SA0D9B;AAOD,eAAe,UAAU,CAAC"}

View File

@ -0,0 +1,192 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDatepickers = void 0;
var instances_1 = require("../../dom/instances");
var flowbite_datepicker_1 = require("flowbite-datepicker");
var Default = {
defaultDatepickerId: null,
autohide: false,
format: 'mm/dd/yyyy',
maxDate: null,
minDate: null,
orientation: 'bottom',
buttons: false,
autoSelectToday: 0,
title: null,
language: 'en',
rangePicker: false,
onShow: function () { },
onHide: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Datepicker = /** @class */ (function () {
function Datepicker(datepickerEl, options, instanceOptions) {
if (datepickerEl === void 0) { datepickerEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: datepickerEl.id;
this._datepickerEl = datepickerEl;
this._datepickerInstance = null;
this._options = __assign(__assign({}, Default), options);
this._initialized = false;
this.init();
instances_1.default.addInstance('Datepicker', this, this._instanceId, instanceOptions.override);
}
Datepicker.prototype.init = function () {
if (this._datepickerEl && !this._initialized) {
if (this._options.rangePicker) {
this._datepickerInstance = new flowbite_datepicker_1.DateRangePicker(this._datepickerEl, this._getDatepickerOptions(this._options));
}
else {
this._datepickerInstance = new flowbite_datepicker_1.Datepicker(this._datepickerEl, this._getDatepickerOptions(this._options));
}
this._initialized = true;
}
};
Datepicker.prototype.destroy = function () {
if (this._initialized) {
this._initialized = false;
this._datepickerInstance.destroy();
}
};
Datepicker.prototype.removeInstance = function () {
this.destroy();
instances_1.default.removeInstance('Datepicker', this._instanceId);
};
Datepicker.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Datepicker.prototype.getDatepickerInstance = function () {
return this._datepickerInstance;
};
Datepicker.prototype.getDate = function () {
if (this._options.rangePicker &&
this._datepickerInstance instanceof flowbite_datepicker_1.DateRangePicker) {
return this._datepickerInstance.getDates();
}
if (!this._options.rangePicker &&
this._datepickerInstance instanceof flowbite_datepicker_1.Datepicker) {
return this._datepickerInstance.getDate();
}
};
Datepicker.prototype.setDate = function (date) {
if (this._options.rangePicker &&
this._datepickerInstance instanceof flowbite_datepicker_1.DateRangePicker) {
return this._datepickerInstance.setDates(date);
}
if (!this._options.rangePicker &&
this._datepickerInstance instanceof flowbite_datepicker_1.Datepicker) {
return this._datepickerInstance.setDate(date);
}
};
Datepicker.prototype.show = function () {
this._datepickerInstance.show();
this._options.onShow(this);
};
Datepicker.prototype.hide = function () {
this._datepickerInstance.hide();
this._options.onHide(this);
};
Datepicker.prototype._getDatepickerOptions = function (options) {
var datepickerOptions = {};
if (options.buttons) {
datepickerOptions.todayBtn = true;
datepickerOptions.clearBtn = true;
if (options.autoSelectToday) {
datepickerOptions.todayBtnMode = 1;
}
}
if (options.autohide) {
datepickerOptions.autohide = true;
}
if (options.format) {
datepickerOptions.format = options.format;
}
if (options.maxDate) {
datepickerOptions.maxDate = options.maxDate;
}
if (options.minDate) {
datepickerOptions.minDate = options.minDate;
}
if (options.orientation) {
datepickerOptions.orientation = options.orientation;
}
if (options.title) {
datepickerOptions.title = options.title;
}
if (options.language) {
datepickerOptions.language = options.language;
}
return datepickerOptions;
};
Datepicker.prototype.updateOnShow = function (callback) {
this._options.onShow = callback;
};
Datepicker.prototype.updateOnHide = function (callback) {
this._options.onHide = callback;
};
return Datepicker;
}());
function initDatepickers() {
document
.querySelectorAll('[datepicker], [inline-datepicker], [date-rangepicker]')
.forEach(function ($datepickerEl) {
if ($datepickerEl) {
var buttons = $datepickerEl.hasAttribute('datepicker-buttons');
var autoselectToday = $datepickerEl.hasAttribute('datepicker-autoselect-today');
var autohide = $datepickerEl.hasAttribute('datepicker-autohide');
var format = $datepickerEl.getAttribute('datepicker-format');
var maxDate = $datepickerEl.getAttribute('datepicker-max-date');
var minDate = $datepickerEl.getAttribute('datepicker-min-date');
var orientation_1 = $datepickerEl.getAttribute('datepicker-orientation');
var title = $datepickerEl.getAttribute('datepicker-title');
var language = $datepickerEl.getAttribute('datepicker-language');
var rangePicker = $datepickerEl.hasAttribute('date-rangepicker');
new Datepicker($datepickerEl, {
buttons: buttons ? buttons : Default.buttons,
autoSelectToday: autoselectToday
? autoselectToday
: Default.autoSelectToday,
autohide: autohide ? autohide : Default.autohide,
format: format ? format : Default.format,
maxDate: maxDate ? maxDate : Default.maxDate,
minDate: minDate ? minDate : Default.minDate,
orientation: orientation_1
? orientation_1
: Default.orientation,
title: title ? title : Default.title,
language: language ? language : Default.language,
rangePicker: rangePicker
? rangePicker
: Default.rangePicker,
});
}
else {
console.error("The datepicker element does not exist. Please check the datepicker attribute.");
}
});
}
exports.initDatepickers = initDatepickers;
if (typeof window !== 'undefined') {
window.Datepicker = Datepicker;
window.initDatepickers = initDatepickers;
}
exports.default = Datepicker;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
import { DatepickerOptions } from './types';
export declare interface DatepickerInterface {
_datepickerEl: HTMLElement;
_datepickerInstance: any | null;
_options: DatepickerOptions;
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/datepicker/interface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,CAAC,OAAO,WAAW,mBAAmB;IACxC,aAAa,EAAE,WAAW,CAAC;IAC3B,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,IAAI,IAAI,IAAI,CAAC;IAEb,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/datepicker/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,20 @@
import { DatepickerInterface } from './interface';
export interface DatepickerOptions {
defaultDatepickerId?: string | null;
autohide?: boolean;
format?: string;
maxDate?: string | null;
minDate?: string | null;
orientation?: string;
buttons?: boolean;
autoSelectToday?: number;
title?: string | null;
language?: string;
locales?: {
[key: string]: any;
};
rangePicker?: boolean | false;
onShow?: (Datepicker: DatepickerInterface) => void;
onHide?: (Datepicker: DatepickerInterface) => void;
}
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/datepicker/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAC9B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACtD"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/datepicker/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,34 @@
import type { DialOptions, DialTriggerType } from './types';
import type { InstanceOptions } from '../../dom/types';
import { DialInterface } from './interface';
declare class Dial implements DialInterface {
_instanceId: string;
_parentEl: HTMLElement;
_triggerEl: HTMLElement;
_targetEl: HTMLElement;
_options: DialOptions;
_visible: boolean;
_initialized: boolean;
_showEventHandler: EventListenerOrEventListenerObject;
_hideEventHandler: EventListenerOrEventListenerObject;
constructor(parentEl?: HTMLElement | null, triggerEl?: HTMLElement | null, targetEl?: HTMLElement | null, options?: DialOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
hide(): void;
show(): void;
toggle(): void;
isHidden(): boolean;
isVisible(): boolean;
_getTriggerEventTypes(triggerType: DialTriggerType): {
showEvents: string[];
hideEvents: string[];
};
updateOnShow(callback: () => void): void;
updateOnHide(callback: () => void): void;
updateOnToggle(callback: () => void): void;
}
export declare function initDials(): void;
export default Dial;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dial/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAe5C,cAAM,IAAK,YAAW,aAAa;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,WAAW,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,kCAAkC,CAAC;IACtD,iBAAiB,EAAE,kCAAkC,CAAC;gBAGlD,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,OAAO,GAAE,WAAqB,EAC9B,eAAe,GAAE,eAAwC;IAoB7D,IAAI;IA4BJ,OAAO;IAmBP,cAAc;IAId,wBAAwB;IAKxB,IAAI;IAWJ,IAAI;IAWJ,MAAM;IAQN,QAAQ;IAIR,SAAS;IAIT,qBAAqB,CAAC,WAAW,EAAE,eAAe;;;;IAyBlD,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,SAAS,SAgCxB;AAOD,eAAe,IAAI,CAAC"}

184
node_modules/flowbite/lib/cjs/components/dial/index.js generated vendored Normal file
View File

@ -0,0 +1,184 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDials = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
triggerType: 'hover',
onShow: function () { },
onHide: function () { },
onToggle: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Dial = /** @class */ (function () {
function Dial(parentEl, triggerEl, targetEl, options, instanceOptions) {
if (parentEl === void 0) { parentEl = null; }
if (triggerEl === void 0) { triggerEl = null; }
if (targetEl === void 0) { targetEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetEl.id;
this._parentEl = parentEl;
this._triggerEl = triggerEl;
this._targetEl = targetEl;
this._options = __assign(__assign({}, Default), options);
this._visible = false;
this._initialized = false;
this.init();
instances_1.default.addInstance('Dial', this, this._instanceId, instanceOptions.override);
}
Dial.prototype.init = function () {
var _this = this;
if (this._triggerEl && this._targetEl && !this._initialized) {
var triggerEventTypes = this._getTriggerEventTypes(this._options.triggerType);
this._showEventHandler = function () {
_this.show();
};
triggerEventTypes.showEvents.forEach(function (ev) {
_this._triggerEl.addEventListener(ev, _this._showEventHandler);
_this._targetEl.addEventListener(ev, _this._showEventHandler);
});
this._hideEventHandler = function () {
if (!_this._parentEl.matches(':hover')) {
_this.hide();
}
};
triggerEventTypes.hideEvents.forEach(function (ev) {
_this._parentEl.addEventListener(ev, _this._hideEventHandler);
});
this._initialized = true;
}
};
Dial.prototype.destroy = function () {
var _this = this;
if (this._initialized) {
var triggerEventTypes = this._getTriggerEventTypes(this._options.triggerType);
triggerEventTypes.showEvents.forEach(function (ev) {
_this._triggerEl.removeEventListener(ev, _this._showEventHandler);
_this._targetEl.removeEventListener(ev, _this._showEventHandler);
});
triggerEventTypes.hideEvents.forEach(function (ev) {
_this._parentEl.removeEventListener(ev, _this._hideEventHandler);
});
this._initialized = false;
}
};
Dial.prototype.removeInstance = function () {
instances_1.default.removeInstance('Dial', this._instanceId);
};
Dial.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Dial.prototype.hide = function () {
this._targetEl.classList.add('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'false');
}
this._visible = false;
// callback function
this._options.onHide(this);
};
Dial.prototype.show = function () {
this._targetEl.classList.remove('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'true');
}
this._visible = true;
// callback function
this._options.onShow(this);
};
Dial.prototype.toggle = function () {
if (this._visible) {
this.hide();
}
else {
this.show();
}
};
Dial.prototype.isHidden = function () {
return !this._visible;
};
Dial.prototype.isVisible = function () {
return this._visible;
};
Dial.prototype._getTriggerEventTypes = function (triggerType) {
switch (triggerType) {
case 'hover':
return {
showEvents: ['mouseenter', 'focus'],
hideEvents: ['mouseleave', 'blur'],
};
case 'click':
return {
showEvents: ['click', 'focus'],
hideEvents: ['focusout', 'blur'],
};
case 'none':
return {
showEvents: [],
hideEvents: [],
};
default:
return {
showEvents: ['mouseenter', 'focus'],
hideEvents: ['mouseleave', 'blur'],
};
}
};
Dial.prototype.updateOnShow = function (callback) {
this._options.onShow = callback;
};
Dial.prototype.updateOnHide = function (callback) {
this._options.onHide = callback;
};
Dial.prototype.updateOnToggle = function (callback) {
this._options.onToggle = callback;
};
return Dial;
}());
function initDials() {
document.querySelectorAll('[data-dial-init]').forEach(function ($parentEl) {
var $triggerEl = $parentEl.querySelector('[data-dial-toggle]');
if ($triggerEl) {
var dialId = $triggerEl.getAttribute('data-dial-toggle');
var $dialEl = document.getElementById(dialId);
if ($dialEl) {
var triggerType = $triggerEl.getAttribute('data-dial-trigger');
new Dial($parentEl, $triggerEl, $dialEl, {
triggerType: triggerType
? triggerType
: Default.triggerType,
});
}
else {
console.error("Dial with id ".concat(dialId, " does not exist. Are you sure that the data-dial-toggle attribute points to the correct modal id?"));
}
}
else {
console.error("Dial with id ".concat($parentEl.id, " does not have a trigger element. Are you sure that the data-dial-toggle attribute exists?"));
}
});
}
exports.initDials = initDials;
if (typeof window !== 'undefined') {
window.Dial = Dial;
window.initDials = initDials;
}
exports.default = Dial;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
import { DialOptions, DialTriggerEventTypes, DialTriggerType } from './types';
export declare interface DialInterface {
_parentEl: HTMLElement;
_triggerEl: HTMLElement;
_targetEl: HTMLElement;
_options: DialOptions;
_visible: boolean;
init(): void;
isVisible(): boolean;
isHidden(): boolean;
hide(): void;
show(): void;
toggle(): void;
_getTriggerEventTypes(triggerType: DialTriggerType): DialTriggerEventTypes;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/dial/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,CAAC,OAAO,WAAW,aAAa;IAClC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,WAAW,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAElB,IAAI,IAAI,IAAI,CAAC;IACb,SAAS,IAAI,OAAO,CAAC;IACrB,QAAQ,IAAI,OAAO,CAAC;IACpB,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,IAAI,CAAC;IACf,qBAAqB,CAAC,WAAW,EAAE,eAAe,GAAG,qBAAqB,CAAC;IAE3E,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/dial/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,13 @@
import { DialInterface } from './interface';
export declare type DialTriggerType = 'click' | 'hover' | 'none';
export declare type DialTriggerEventTypes = {
showEvents: string[];
hideEvents: string[];
};
export declare type DialOptions = {
triggerType?: DialTriggerType;
onShow?: (dial: DialInterface) => void;
onHide?: (dial: DialInterface) => void;
onToggle?: (dial: DialInterface) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/dial/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,OAAO,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,MAAM,CAAC,OAAO,MAAM,qBAAqB,GAAG;IACxC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,WAAW,GAAG;IAC9B,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC5C,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/dial/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,21 @@
import type { DismissOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { DismissInterface } from './interface';
declare class Dismiss implements DismissInterface {
_instanceId: string;
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: DismissOptions;
_initialized: boolean;
_clickHandler: EventListenerOrEventListenerObject;
constructor(targetEl?: HTMLElement | null, triggerEl?: HTMLElement | null, options?: DismissOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
hide(): void;
updateOnHide(callback: () => void): void;
}
export declare function initDismisses(): void;
export default Dismiss;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dismiss/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAe/C,cAAM,OAAQ,YAAW,gBAAgB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,kCAAkC,CAAC;gBAG9C,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,OAAO,GAAE,cAAwB,EACjC,eAAe,GAAE,eAAwC;IAkB7D,IAAI;IAUJ,OAAO;IAOP,cAAc;IAId,wBAAwB;IAKxB,IAAI;IAeJ,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGpC;AAED,wBAAgB,aAAa,SAa5B;AAOD,eAAe,OAAO,CAAC"}

View File

@ -0,0 +1,97 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDismisses = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
transition: 'transition-opacity',
duration: 300,
timing: 'ease-out',
onHide: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Dismiss = /** @class */ (function () {
function Dismiss(targetEl, triggerEl, options, instanceOptions) {
if (targetEl === void 0) { targetEl = null; }
if (triggerEl === void 0) { triggerEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetEl.id;
this._targetEl = targetEl;
this._triggerEl = triggerEl;
this._options = __assign(__assign({}, Default), options);
this._initialized = false;
this.init();
instances_1.default.addInstance('Dismiss', this, this._instanceId, instanceOptions.override);
}
Dismiss.prototype.init = function () {
var _this = this;
if (this._triggerEl && this._targetEl && !this._initialized) {
this._clickHandler = function () {
_this.hide();
};
this._triggerEl.addEventListener('click', this._clickHandler);
this._initialized = true;
}
};
Dismiss.prototype.destroy = function () {
if (this._triggerEl && this._initialized) {
this._triggerEl.removeEventListener('click', this._clickHandler);
this._initialized = false;
}
};
Dismiss.prototype.removeInstance = function () {
instances_1.default.removeInstance('Dismiss', this._instanceId);
};
Dismiss.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Dismiss.prototype.hide = function () {
var _this = this;
this._targetEl.classList.add(this._options.transition, "duration-".concat(this._options.duration), this._options.timing, 'opacity-0');
setTimeout(function () {
_this._targetEl.classList.add('hidden');
}, this._options.duration);
// callback function
this._options.onHide(this, this._targetEl);
};
Dismiss.prototype.updateOnHide = function (callback) {
this._options.onHide = callback;
};
return Dismiss;
}());
function initDismisses() {
document.querySelectorAll('[data-dismiss-target]').forEach(function ($triggerEl) {
var targetId = $triggerEl.getAttribute('data-dismiss-target');
var $dismissEl = document.querySelector(targetId);
if ($dismissEl) {
new Dismiss($dismissEl, $triggerEl);
}
else {
console.error("The dismiss element with id \"".concat(targetId, "\" does not exist. Please check the data-dismiss-target attribute."));
}
});
}
exports.initDismisses = initDismisses;
if (typeof window !== 'undefined') {
window.Dismiss = Dismiss;
window.initDismisses = initDismisses;
}
exports.default = Dismiss;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/dismiss/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,iDAA4C;AAE5C,IAAM,OAAO,GAAmB;IAC5B,UAAU,EAAE,oBAAoB;IAChC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,cAAO,CAAC;CACnB,CAAC;AAEF,IAAM,sBAAsB,GAAoB;IAC5C,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;CACjB,CAAC;AAEF;IAQI,iBACI,QAAmC,EACnC,SAAoC,EACpC,OAAiC,EACjC,eAAyD;QAHzD,yBAAA,EAA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,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;CACxC;AAED,kBAAe,OAAO,CAAC"}

View File

@ -0,0 +1,12 @@
import { DismissOptions } from './types';
export declare interface DismissInterface {
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: DismissOptions;
init(): void;
hide(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/dismiss/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACrC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;IAEzB,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IAEb,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;CACpC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/dismiss/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,8 @@
import { DismissInterface } from './interface';
export declare type DismissOptions = {
transition?: string;
duration?: number;
timing?: string;
onHide?: (dismiss: DismissInterface, targetEl: HTMLElement) => void;
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/dismiss/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,OAAO,MAAM,cAAc,GAAG;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;CACvE,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/dismiss/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,35 @@
import type { DrawerOptions, PlacementClasses } from './types';
import type { InstanceOptions, EventListenerInstance } from '../../dom/types';
import { DrawerInterface } from './interface';
declare class Drawer implements DrawerInterface {
_instanceId: string;
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DrawerOptions;
_visible: boolean;
_eventListenerInstances: EventListenerInstance[];
_handleEscapeKey: EventListenerOrEventListenerObject;
_initialized: boolean;
constructor(targetEl?: HTMLElement | null, options?: DrawerOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
hide(): void;
show(): void;
toggle(): void;
_createBackdrop(): void;
_destroyBackdropEl(): void;
_getPlacementClasses(placement: string): PlacementClasses;
isHidden(): boolean;
isVisible(): boolean;
addEventListenerInstance(element: HTMLElement, type: string, handler: EventListenerOrEventListenerObject): void;
removeAllEventListenerInstances(): void;
getAllEventListenerInstances(): EventListenerInstance[];
updateOnShow(callback: () => void): void;
updateOnHide(callback: () => void): void;
updateOnToggle(callback: () => void): void;
}
export declare function initDrawers(): void;
export default Drawer;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoB9C,cAAM,MAAO,YAAW,eAAe;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,EAAE,qBAAqB,EAAE,CAAM;IACtD,gBAAgB,EAAE,kCAAkC,CAAC;IACrD,YAAY,EAAE,OAAO,CAAC;gBAGlB,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,OAAO,GAAE,aAAuB,EAChC,eAAe,GAAE,eAAwC;IAkB7D,IAAI;IA4BJ,OAAO;IAYP,cAAc;IAId,wBAAwB;IAKxB,IAAI;IA+CJ,IAAI;IA8CJ,MAAM;IAQN,eAAe;IAcf,kBAAkB;IASlB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAyCzD,QAAQ;IAIR,SAAS;IAIT,wBAAwB,CACpB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kCAAkC;IAS/C,+BAA+B;IAU/B,4BAA4B;IAI5B,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,WAAW,SA0I1B;AAOD,eAAe,MAAM,CAAC"}

View File

@ -0,0 +1,358 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDrawers = void 0;
var instances_1 = require("../../dom/instances");
var Default = {
placement: 'left',
bodyScrolling: false,
backdrop: true,
edge: false,
edgeOffset: 'bottom-[60px]',
backdropClasses: 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30',
onShow: function () { },
onHide: function () { },
onToggle: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Drawer = /** @class */ (function () {
function Drawer(targetEl, options, instanceOptions) {
if (targetEl === void 0) { targetEl = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._eventListenerInstances = [];
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetEl.id;
this._targetEl = targetEl;
this._options = __assign(__assign({}, Default), options);
this._visible = false;
this._initialized = false;
this.init();
instances_1.default.addInstance('Drawer', this, this._instanceId, instanceOptions.override);
}
Drawer.prototype.init = function () {
var _this = this;
// set initial accessibility attributes
if (this._targetEl && !this._initialized) {
this._targetEl.setAttribute('aria-hidden', 'true');
this._targetEl.classList.add('transition-transform');
// set base placement classes
this._getPlacementClasses(this._options.placement).base.map(function (c) {
_this._targetEl.classList.add(c);
});
this._handleEscapeKey = function (event) {
if (event.key === 'Escape') {
// if 'Escape' key is pressed
if (_this.isVisible()) {
// if the Drawer is visible
_this.hide(); // hide the Drawer
}
}
};
// add keyboard event listener to document
document.addEventListener('keydown', this._handleEscapeKey);
this._initialized = true;
}
};
Drawer.prototype.destroy = function () {
if (this._initialized) {
this.removeAllEventListenerInstances();
this._destroyBackdropEl();
// Remove the keyboard event listener
document.removeEventListener('keydown', this._handleEscapeKey);
this._initialized = false;
}
};
Drawer.prototype.removeInstance = function () {
instances_1.default.removeInstance('Drawer', this._instanceId);
};
Drawer.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Drawer.prototype.hide = function () {
var _this = this;
// based on the edge option show placement classes
if (this._options.edge) {
this._getPlacementClasses(this._options.placement + '-edge').active.map(function (c) {
_this._targetEl.classList.remove(c);
});
this._getPlacementClasses(this._options.placement + '-edge').inactive.map(function (c) {
_this._targetEl.classList.add(c);
});
}
else {
this._getPlacementClasses(this._options.placement).active.map(function (c) {
_this._targetEl.classList.remove(c);
});
this._getPlacementClasses(this._options.placement).inactive.map(function (c) {
_this._targetEl.classList.add(c);
});
}
// set accessibility attributes
this._targetEl.setAttribute('aria-hidden', 'true');
this._targetEl.removeAttribute('aria-modal');
this._targetEl.removeAttribute('role');
// enable body scroll
if (!this._options.bodyScrolling) {
document.body.classList.remove('overflow-hidden');
}
// destroy backdrop
if (this._options.backdrop) {
this._destroyBackdropEl();
}
this._visible = false;
// callback function
this._options.onHide(this);
};
Drawer.prototype.show = function () {
var _this = this;
if (this._options.edge) {
this._getPlacementClasses(this._options.placement + '-edge').active.map(function (c) {
_this._targetEl.classList.add(c);
});
this._getPlacementClasses(this._options.placement + '-edge').inactive.map(function (c) {
_this._targetEl.classList.remove(c);
});
}
else {
this._getPlacementClasses(this._options.placement).active.map(function (c) {
_this._targetEl.classList.add(c);
});
this._getPlacementClasses(this._options.placement).inactive.map(function (c) {
_this._targetEl.classList.remove(c);
});
}
// set accessibility attributes
this._targetEl.setAttribute('aria-modal', 'true');
this._targetEl.setAttribute('role', 'dialog');
this._targetEl.removeAttribute('aria-hidden');
// disable body scroll
if (!this._options.bodyScrolling) {
document.body.classList.add('overflow-hidden');
}
// show backdrop
if (this._options.backdrop) {
this._createBackdrop();
}
this._visible = true;
// callback function
this._options.onShow(this);
};
Drawer.prototype.toggle = function () {
if (this.isVisible()) {
this.hide();
}
else {
this.show();
}
};
Drawer.prototype._createBackdrop = function () {
var _a;
var _this = this;
if (!this._visible) {
var backdropEl = document.createElement('div');
backdropEl.setAttribute('drawer-backdrop', '');
(_a = backdropEl.classList).add.apply(_a, this._options.backdropClasses.split(' '));
document.querySelector('body').append(backdropEl);
backdropEl.addEventListener('click', function () {
_this.hide();
});
}
};
Drawer.prototype._destroyBackdropEl = function () {
if (this._visible &&
document.querySelector('[drawer-backdrop]') !== null) {
document.querySelector('[drawer-backdrop]').remove();
}
};
Drawer.prototype._getPlacementClasses = function (placement) {
switch (placement) {
case 'top':
return {
base: ['top-0', 'left-0', 'right-0'],
active: ['transform-none'],
inactive: ['-translate-y-full'],
};
case 'right':
return {
base: ['right-0', 'top-0'],
active: ['transform-none'],
inactive: ['translate-x-full'],
};
case 'bottom':
return {
base: ['bottom-0', 'left-0', 'right-0'],
active: ['transform-none'],
inactive: ['translate-y-full'],
};
case 'left':
return {
base: ['left-0', 'top-0'],
active: ['transform-none'],
inactive: ['-translate-x-full'],
};
case 'bottom-edge':
return {
base: ['left-0', 'top-0'],
active: ['transform-none'],
inactive: ['translate-y-full', this._options.edgeOffset],
};
default:
return {
base: ['left-0', 'top-0'],
active: ['transform-none'],
inactive: ['-translate-x-full'],
};
}
};
Drawer.prototype.isHidden = function () {
return !this._visible;
};
Drawer.prototype.isVisible = function () {
return this._visible;
};
Drawer.prototype.addEventListenerInstance = function (element, type, handler) {
this._eventListenerInstances.push({
element: element,
type: type,
handler: handler,
});
};
Drawer.prototype.removeAllEventListenerInstances = function () {
this._eventListenerInstances.map(function (eventListenerInstance) {
eventListenerInstance.element.removeEventListener(eventListenerInstance.type, eventListenerInstance.handler);
});
this._eventListenerInstances = [];
};
Drawer.prototype.getAllEventListenerInstances = function () {
return this._eventListenerInstances;
};
Drawer.prototype.updateOnShow = function (callback) {
this._options.onShow = callback;
};
Drawer.prototype.updateOnHide = function (callback) {
this._options.onHide = callback;
};
Drawer.prototype.updateOnToggle = function (callback) {
this._options.onToggle = callback;
};
return Drawer;
}());
function initDrawers() {
document.querySelectorAll('[data-drawer-target]').forEach(function ($triggerEl) {
// mandatory
var drawerId = $triggerEl.getAttribute('data-drawer-target');
var $drawerEl = document.getElementById(drawerId);
if ($drawerEl) {
var placement = $triggerEl.getAttribute('data-drawer-placement');
var bodyScrolling = $triggerEl.getAttribute('data-drawer-body-scrolling');
var backdrop = $triggerEl.getAttribute('data-drawer-backdrop');
var edge = $triggerEl.getAttribute('data-drawer-edge');
var edgeOffset = $triggerEl.getAttribute('data-drawer-edge-offset');
new Drawer($drawerEl, {
placement: placement ? placement : Default.placement,
bodyScrolling: bodyScrolling
? bodyScrolling === 'true'
? true
: false
: Default.bodyScrolling,
backdrop: backdrop
? backdrop === 'true'
? true
: false
: Default.backdrop,
edge: edge ? (edge === 'true' ? true : false) : Default.edge,
edgeOffset: edgeOffset ? edgeOffset : Default.edgeOffset,
});
}
else {
console.error("Drawer with id ".concat(drawerId, " not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"));
}
});
document.querySelectorAll('[data-drawer-toggle]').forEach(function ($triggerEl) {
var drawerId = $triggerEl.getAttribute('data-drawer-toggle');
var $drawerEl = document.getElementById(drawerId);
if ($drawerEl) {
var drawer_1 = instances_1.default.getInstance('Drawer', drawerId);
if (drawer_1) {
var toggleDrawer = function () {
drawer_1.toggle();
};
$triggerEl.addEventListener('click', toggleDrawer);
drawer_1.addEventListenerInstance($triggerEl, 'click', toggleDrawer);
}
else {
console.error("Drawer with id ".concat(drawerId, " has not been initialized. Please initialize it using the data-drawer-target attribute."));
}
}
else {
console.error("Drawer with id ".concat(drawerId, " not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"));
}
});
document
.querySelectorAll('[data-drawer-dismiss], [data-drawer-hide]')
.forEach(function ($triggerEl) {
var drawerId = $triggerEl.getAttribute('data-drawer-dismiss')
? $triggerEl.getAttribute('data-drawer-dismiss')
: $triggerEl.getAttribute('data-drawer-hide');
var $drawerEl = document.getElementById(drawerId);
if ($drawerEl) {
var drawer_2 = instances_1.default.getInstance('Drawer', drawerId);
if (drawer_2) {
var hideDrawer = function () {
drawer_2.hide();
};
$triggerEl.addEventListener('click', hideDrawer);
drawer_2.addEventListenerInstance($triggerEl, 'click', hideDrawer);
}
else {
console.error("Drawer with id ".concat(drawerId, " has not been initialized. Please initialize it using the data-drawer-target attribute."));
}
}
else {
console.error("Drawer with id ".concat(drawerId, " not found. Are you sure that the data-drawer-target attribute points to the correct drawer id"));
}
});
document.querySelectorAll('[data-drawer-show]').forEach(function ($triggerEl) {
var drawerId = $triggerEl.getAttribute('data-drawer-show');
var $drawerEl = document.getElementById(drawerId);
if ($drawerEl) {
var drawer_3 = instances_1.default.getInstance('Drawer', drawerId);
if (drawer_3) {
var showDrawer = function () {
drawer_3.show();
};
$triggerEl.addEventListener('click', showDrawer);
drawer_3.addEventListenerInstance($triggerEl, 'click', showDrawer);
}
else {
console.error("Drawer with id ".concat(drawerId, " has not been initialized. Please initialize it using the data-drawer-target attribute."));
}
}
else {
console.error("Drawer with id ".concat(drawerId, " not found. Are you sure that the data-drawer-target attribute points to the correct drawer id?"));
}
});
}
exports.initDrawers = initDrawers;
if (typeof window !== 'undefined') {
window.Drawer = Drawer;
window.initDrawers = initDrawers;
}
exports.default = Drawer;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
import { DrawerOptions, PlacementClasses } from './types';
export declare interface DrawerInterface {
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DrawerOptions;
_visible: boolean;
init(): void;
isVisible(): boolean;
isHidden(): boolean;
hide(): void;
show(): void;
toggle(): void;
_createBackdrop(): void;
_destroyBackdropEl(): void;
_getPlacementClasses(placement: string): PlacementClasses;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
addEventListenerInstance(element: HTMLElement, type: string, handler: EventListenerOrEventListenerObject): void;
removeAllEventListenerInstances(): void;
getAllEventListenerInstances(): void;
}
//# sourceMappingURL=interface.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,OAAO,WAAW,eAAe;IAEpC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAGlB,IAAI,IAAI,IAAI,CAAC;IACb,SAAS,IAAI,OAAO,CAAC;IACrB,QAAQ,IAAI,OAAO,CAAC;IACpB,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,IAAI,CAAC;IACf,eAAe,IAAI,IAAI,CAAC;IACxB,kBAAkB,IAAI,IAAI,CAAC;IAC3B,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAE1D,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,IAAI,IAAI,CAAC;IACvB,wBAAwB,IAAI,IAAI,CAAC;IAEjC,wBAAwB,CACpB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kCAAkC,GAC5C,IAAI,CAAC;IACR,+BAA+B,IAAI,IAAI,CAAC;IACxC,4BAA4B,IAAI,IAAI,CAAC;CACxC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/components/drawer/interface.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,18 @@
import { DrawerInterface } from './interface';
export declare type DrawerOptions = {
placement?: string;
bodyScrolling?: boolean;
backdrop?: boolean;
edge?: boolean;
edgeOffset?: string;
backdropClasses?: string;
onShow?: (drawer: DrawerInterface) => void;
onHide?: (drawer: DrawerInterface) => void;
onToggle?: (drawer: DrawerInterface) => void;
};
export declare type PlacementClasses = {
base: string[];
active: string[];
inactive: string[];
};
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,OAAO,MAAM,aAAa,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,gBAAgB,GAAG;IACnC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/drawer/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,42 @@
import type { Instance as PopperInstance } from '@popperjs/core';
import type { DropdownOptions } from './types';
import type { InstanceOptions } from '../../dom/types';
import { DropdownInterface } from './interface';
declare class Dropdown implements DropdownInterface {
_instanceId: string;
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DropdownOptions;
_visible: boolean;
_popperInstance: PopperInstance;
_initialized: boolean;
_clickOutsideEventListener: EventListenerOrEventListenerObject;
_hoverShowTriggerElHandler: EventListenerOrEventListenerObject;
_hoverShowTargetElHandler: EventListenerOrEventListenerObject;
_hoverHideHandler: EventListenerOrEventListenerObject;
_clickHandler: EventListenerOrEventListenerObject;
constructor(targetElement?: HTMLElement | null, triggerElement?: HTMLElement | null, options?: DropdownOptions, instanceOptions?: InstanceOptions);
init(): void;
destroy(): void;
removeInstance(): void;
destroyAndRemoveInstance(): void;
_setupEventListeners(): void;
_createPopperInstance(): PopperInstance;
_setupClickOutsideListener(): void;
_removeClickOutsideListener(): void;
_handleClickOutside(ev: Event, targetEl: HTMLElement): void;
_getTriggerEvents(): {
showEvents: string[];
hideEvents: string[];
};
toggle(): void;
isVisible(): boolean;
show(): void;
hide(): void;
updateOnShow(callback: () => void): void;
updateOnHide(callback: () => void): void;
updateOnToggle(callback: () => void): void;
}
export declare function initDropdowns(): void;
export default Dropdown;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,QAAQ,IAAI,cAAc,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAoBhD,cAAM,QAAS,YAAW,iBAAiB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,cAAc,CAAC;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,0BAA0B,EAAE,kCAAkC,CAAC;IAC/D,0BAA0B,EAAE,kCAAkC,CAAC;IAC/D,yBAAyB,EAAE,kCAAkC,CAAC;IAC9D,iBAAiB,EAAE,kCAAkC,CAAC;IACtD,aAAa,EAAE,kCAAkC,CAAC;gBAG9C,aAAa,GAAE,WAAW,GAAG,IAAW,EACxC,cAAc,GAAE,WAAW,GAAG,IAAW,EACzC,OAAO,GAAE,eAAyB,EAClC,eAAe,GAAE,eAAwC;IAoB7D,IAAI;IAQJ,OAAO;IAiCP,cAAc;IAId,wBAAwB;IAKxB,oBAAoB;IAuDpB,qBAAqB;IAiBrB,0BAA0B;IAW1B,2BAA2B;IAQ3B,mBAAmB,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW;IA+BpD,iBAAiB;;;;IAyBjB,MAAM;IASN,SAAS;IAIT,IAAI;IAwBJ,IAAI;IAsBJ,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI;IAIjC,cAAc,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC;AAED,wBAAgB,aAAa,SAmD5B;AAOD,eAAe,QAAQ,CAAC"}

View File

@ -0,0 +1,306 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDropdowns = void 0;
/* eslint-disable @typescript-eslint/no-empty-function */
var core_1 = require("@popperjs/core");
var instances_1 = require("../../dom/instances");
var Default = {
placement: 'bottom',
triggerType: 'click',
offsetSkidding: 0,
offsetDistance: 10,
delay: 300,
ignoreClickOutsideClass: false,
onShow: function () { },
onHide: function () { },
onToggle: function () { },
};
var DefaultInstanceOptions = {
id: null,
override: true,
};
var Dropdown = /** @class */ (function () {
function Dropdown(targetElement, triggerElement, options, instanceOptions) {
if (targetElement === void 0) { targetElement = null; }
if (triggerElement === void 0) { triggerElement = null; }
if (options === void 0) { options = Default; }
if (instanceOptions === void 0) { instanceOptions = DefaultInstanceOptions; }
this._instanceId = instanceOptions.id
? instanceOptions.id
: targetElement.id;
this._targetEl = targetElement;
this._triggerEl = triggerElement;
this._options = __assign(__assign({}, Default), options);
this._popperInstance = null;
this._visible = false;
this._initialized = false;
this.init();
instances_1.default.addInstance('Dropdown', this, this._instanceId, instanceOptions.override);
}
Dropdown.prototype.init = function () {
if (this._triggerEl && this._targetEl && !this._initialized) {
this._popperInstance = this._createPopperInstance();
this._setupEventListeners();
this._initialized = true;
}
};
Dropdown.prototype.destroy = function () {
var _this = this;
var triggerEvents = this._getTriggerEvents();
// Remove click event listeners for trigger element
if (this._options.triggerType === 'click') {
triggerEvents.showEvents.forEach(function (ev) {
_this._triggerEl.removeEventListener(ev, _this._clickHandler);
});
}
// Remove hover event listeners for trigger and target elements
if (this._options.triggerType === 'hover') {
triggerEvents.showEvents.forEach(function (ev) {
_this._triggerEl.removeEventListener(ev, _this._hoverShowTriggerElHandler);
_this._targetEl.removeEventListener(ev, _this._hoverShowTargetElHandler);
});
triggerEvents.hideEvents.forEach(function (ev) {
_this._triggerEl.removeEventListener(ev, _this._hoverHideHandler);
_this._targetEl.removeEventListener(ev, _this._hoverHideHandler);
});
}
this._popperInstance.destroy();
this._initialized = false;
};
Dropdown.prototype.removeInstance = function () {
instances_1.default.removeInstance('Dropdown', this._instanceId);
};
Dropdown.prototype.destroyAndRemoveInstance = function () {
this.destroy();
this.removeInstance();
};
Dropdown.prototype._setupEventListeners = function () {
var _this = this;
var triggerEvents = this._getTriggerEvents();
this._clickHandler = function () {
_this.toggle();
};
// click event handling for trigger element
if (this._options.triggerType === 'click') {
triggerEvents.showEvents.forEach(function (ev) {
_this._triggerEl.addEventListener(ev, _this._clickHandler);
});
}
this._hoverShowTriggerElHandler = function (ev) {
if (ev.type === 'click') {
_this.toggle();
}
else {
setTimeout(function () {
_this.show();
}, _this._options.delay);
}
};
this._hoverShowTargetElHandler = function () {
_this.show();
};
this._hoverHideHandler = function () {
setTimeout(function () {
if (!_this._targetEl.matches(':hover')) {
_this.hide();
}
}, _this._options.delay);
};
// hover event handling for trigger element
if (this._options.triggerType === 'hover') {
triggerEvents.showEvents.forEach(function (ev) {
_this._triggerEl.addEventListener(ev, _this._hoverShowTriggerElHandler);
_this._targetEl.addEventListener(ev, _this._hoverShowTargetElHandler);
});
triggerEvents.hideEvents.forEach(function (ev) {
_this._triggerEl.addEventListener(ev, _this._hoverHideHandler);
_this._targetEl.addEventListener(ev, _this._hoverHideHandler);
});
}
};
Dropdown.prototype._createPopperInstance = function () {
return (0, core_1.createPopper)(this._triggerEl, this._targetEl, {
placement: this._options.placement,
modifiers: [
{
name: 'offset',
options: {
offset: [
this._options.offsetSkidding,
this._options.offsetDistance,
],
},
},
],
});
};
Dropdown.prototype._setupClickOutsideListener = function () {
var _this = this;
this._clickOutsideEventListener = function (ev) {
_this._handleClickOutside(ev, _this._targetEl);
};
document.body.addEventListener('click', this._clickOutsideEventListener, true);
};
Dropdown.prototype._removeClickOutsideListener = function () {
document.body.removeEventListener('click', this._clickOutsideEventListener, true);
};
Dropdown.prototype._handleClickOutside = function (ev, targetEl) {
var clickedEl = ev.target;
// Ignore clicks on the trigger element (ie. a datepicker input)
var ignoreClickOutsideClass = this._options.ignoreClickOutsideClass;
var isIgnored = false;
if (ignoreClickOutsideClass) {
var ignoredClickOutsideEls = document.querySelectorAll(".".concat(ignoreClickOutsideClass));
ignoredClickOutsideEls.forEach(function (el) {
if (el.contains(clickedEl)) {
isIgnored = true;
return;
}
});
}
// Ignore clicks on the target element (ie. dropdown itself)
if (clickedEl !== targetEl &&
!targetEl.contains(clickedEl) &&
!this._triggerEl.contains(clickedEl) &&
!isIgnored &&
this.isVisible()) {
this.hide();
}
};
Dropdown.prototype._getTriggerEvents = function () {
switch (this._options.triggerType) {
case 'hover':
return {
showEvents: ['mouseenter', 'click'],
hideEvents: ['mouseleave'],
};
case 'click':
return {
showEvents: ['click'],
hideEvents: [],
};
case 'none':
return {
showEvents: [],
hideEvents: [],
};
default:
return {
showEvents: ['click'],
hideEvents: [],
};
}
};
Dropdown.prototype.toggle = function () {
if (this.isVisible()) {
this.hide();
}
else {
this.show();
}
this._options.onToggle(this);
};
Dropdown.prototype.isVisible = function () {
return this._visible;
};
Dropdown.prototype.show = function () {
this._targetEl.classList.remove('hidden');
this._targetEl.classList.add('block');
this._targetEl.removeAttribute('aria-hidden');
// Enable the event listeners
this._popperInstance.setOptions(function (options) { return (__assign(__assign({}, options), { modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [
{ name: 'eventListeners', enabled: true },
], false) })); });
this._setupClickOutsideListener();
// Update its position
this._popperInstance.update();
this._visible = true;
// callback function
this._options.onShow(this);
};
Dropdown.prototype.hide = function () {
this._targetEl.classList.remove('block');
this._targetEl.classList.add('hidden');
this._targetEl.setAttribute('aria-hidden', 'true');
// Disable the event listeners
this._popperInstance.setOptions(function (options) { return (__assign(__assign({}, options), { modifiers: __spreadArray(__spreadArray([], options.modifiers, true), [
{ name: 'eventListeners', enabled: false },
], false) })); });
this._visible = false;
this._removeClickOutsideListener();
// callback function
this._options.onHide(this);
};
Dropdown.prototype.updateOnShow = function (callback) {
this._options.onShow = callback;
};
Dropdown.prototype.updateOnHide = function (callback) {
this._options.onHide = callback;
};
Dropdown.prototype.updateOnToggle = function (callback) {
this._options.onToggle = callback;
};
return Dropdown;
}());
function initDropdowns() {
document
.querySelectorAll('[data-dropdown-toggle]')
.forEach(function ($triggerEl) {
var dropdownId = $triggerEl.getAttribute('data-dropdown-toggle');
var $dropdownEl = document.getElementById(dropdownId);
if ($dropdownEl) {
var placement = $triggerEl.getAttribute('data-dropdown-placement');
var offsetSkidding = $triggerEl.getAttribute('data-dropdown-offset-skidding');
var offsetDistance = $triggerEl.getAttribute('data-dropdown-offset-distance');
var triggerType = $triggerEl.getAttribute('data-dropdown-trigger');
var delay = $triggerEl.getAttribute('data-dropdown-delay');
var ignoreClickOutsideClass = $triggerEl.getAttribute('data-dropdown-ignore-click-outside-class');
new Dropdown($dropdownEl, $triggerEl, {
placement: placement ? placement : Default.placement,
triggerType: triggerType
? triggerType
: Default.triggerType,
offsetSkidding: offsetSkidding
? parseInt(offsetSkidding)
: Default.offsetSkidding,
offsetDistance: offsetDistance
? parseInt(offsetDistance)
: Default.offsetDistance,
delay: delay ? parseInt(delay) : Default.delay,
ignoreClickOutsideClass: ignoreClickOutsideClass
? ignoreClickOutsideClass
: Default.ignoreClickOutsideClass,
});
}
else {
console.error("The dropdown element with id \"".concat(dropdownId, "\" does not exist. Please check the data-dropdown-toggle attribute."));
}
});
}
exports.initDropdowns = initDropdowns;
if (typeof window !== 'undefined') {
window.Dropdown = Dropdown;
window.initDropdowns = initDropdowns;
}
exports.default = Dropdown;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More