Skip to content

Commit

Permalink
v2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Baxa0707 committed Sep 23, 2024
1 parent 3f8c2fc commit 0c521a3
Show file tree
Hide file tree
Showing 129 changed files with 5,829 additions and 1,068 deletions.
5 changes: 3 additions & 2 deletions dist/accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ export interface IAccordion {
declare class HSAccordion extends HSBasePlugin<IAccordionOptions> implements IAccordion {
private readonly toggle;
content: HTMLElement | null;
private readonly group;
private readonly isAlwaysOpened;
private group;
private isAlwaysOpened;
static selectable: IAccordionTreeView[];
constructor(el: HTMLElement, options?: IAccordionOptions, events?: {});
private init;
show(): boolean;
hide(): boolean;
update(): boolean;
static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem<HSAccordion>;
static show(target: HTMLElement): void;
static hide(target: HTMLElement): void;
Expand Down
9 changes: 4 additions & 5 deletions dist/accordion.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dist/accordion.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var e={615:(e,t,o)=>{o.d(t,{A:()=>i});class i{constructor(e,t,o){this.el=e,this.options=t,this.events=o,this.el=e,this.options=t,this.events={}}createCollection(e,t){var o;e.push({id:(null===(o=null==t?void 0:t.el)||void 0===o?void 0:o.id)||e.length+1,element:t})}fireEvent(e,t=null){if(this.events.hasOwnProperty(e))return this.events[e](t)}on(e,t){this.events[e]=t}}},926:(e,t,o)=>{o.d(t,{JD:()=>i,yd:()=>s});const i=(e,t,o=null)=>{const i=new CustomEvent(e,{detail:{payload:o},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(i)},s=(e,t)=>{const o=()=>{t(),e.removeEventListener("transitionend",o,!0)},i=window.getComputedStyle(e),s=i.getPropertyValue("transition-duration");"none"!==i.getPropertyValue("transition-property")&&parseFloat(s)>0?e.addEventListener("transitionend",o,!0):t()}}},t={};function o(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};o.d(i,{A:()=>c});var s=o(926),n=o(615);
/*
* HSAccordion
* @version: 2.5.0
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
class l extends n.A{constructor(e,t,o){super(e,t,o),this.toggle=this.el.querySelector(".hs-accordion-toggle")||null,this.content=this.el.querySelector(".hs-accordion-content")||null,this.update(),this.toggle&&this.content&&this.init()}init(){this.createCollection(window.$hsAccordionCollection,this),this.toggle.addEventListener("click",(e=>{e.stopPropagation(),this.el.classList.contains("active")?this.hide():this.show()}))}show(){var e;if(this.group&&!this.isAlwaysOpened&&this.group.querySelector(":scope > .hs-accordion.active")&&this.group.querySelector(":scope > .hs-accordion.active")!==this.el){window.$hsAccordionCollection.find((e=>e.element.el===this.group.querySelector(":scope > .hs-accordion.active"))).element.hide()}if(this.el.classList.contains("active"))return!1;this.el.classList.add("active"),(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="true"),this.content.style.display="block",this.content.style.height="0",setTimeout((()=>{this.content.style.height=`${this.content.scrollHeight}px`})),(0,s.yd)(this.content,(()=>{this.content.style.display="block",this.content.style.height="",this.fireEvent("open",this.el),(0,s.JD)("open.hs.accordion",this.el,this.el)}))}hide(){var e;if(!this.el.classList.contains("active"))return!1;this.el.classList.remove("active"),(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="false"),this.content.style.height=`${this.content.scrollHeight}px`,setTimeout((()=>{this.content.style.height="0"})),(0,s.yd)(this.content,(()=>{this.content.style.display="",this.content.style.height="0",this.fireEvent("close",this.el),(0,s.JD)("close.hs.accordion",this.el,this.el)}))}update(){if(this.group=this.el.closest(".hs-accordion-group")||null,!this.group)return!1;this.isAlwaysOpened=this.group.hasAttribute("data-hs-accordion-always-open")||!1,window.$hsAccordionCollection.map((e=>(e.id===this.el.id&&(e.element.group=this.group,e.element.isAlwaysOpened=this.isAlwaysOpened),e)))}static getInstance(e,t){const o=window.$hsAccordionCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return o?t?o:o.element.el:null}static show(e){const t=window.$hsAccordionCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));t&&"block"!==t.element.content.style.display&&t.element.show()}static hide(e){const t=window.$hsAccordionCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));t&&"block"===t.element.content.style.display&&t.element.hide()}static autoInit(){window.$hsAccordionCollection||(window.$hsAccordionCollection=[]),document.querySelectorAll(".hs-accordion:not(.--prevent-on-load-init)").forEach((e=>{window.$hsAccordionCollection.find((t=>{var o;return(null===(o=null==t?void 0:t.element)||void 0===o?void 0:o.el)===e}))||new l(e)}))}static treeView(){if(!document.querySelectorAll(".hs-accordion-treeview-root").length)return!1;this.selectable=[],document.querySelectorAll(".hs-accordion-treeview-root").forEach((e=>{const t=null==e?void 0:e.getAttribute("data-hs-accordion-options"),o=t?JSON.parse(t):{};this.selectable.push({el:e,options:Object.assign({},o)})})),this.selectable.length&&this.selectable.forEach((e=>{const{el:t}=e;t.querySelectorAll(".hs-accordion-selectable").forEach((t=>{t.addEventListener("click",(o=>{o.stopPropagation(),this.toggleSelected(e,t)}))}))}))}static toggleSelected(e,t){t.classList.contains("selected")?t.classList.remove("selected"):(e.el.querySelectorAll(".hs-accordion-selectable").forEach((e=>e.classList.remove("selected"))),t.classList.add("selected"))}static on(e,t,o){const i=window.$hsAccordionCollection.find((e=>e.element.el===("string"==typeof t?document.querySelector(t):t)));i&&(i.element.events[e]=o)}}window.addEventListener("load",(()=>{l.autoInit(),document.querySelectorAll(".hs-accordion-treeview-root").length&&l.treeView()})),"undefined"!=typeof window&&(window.HSAccordion=l);const c=l;var r=i.A;export{r as default};
74 changes: 64 additions & 10 deletions dist/carousel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ export interface ICollectionItem<T> {
id: string | number;
element: T;
}
export type TCarouselOptionsSlidesQty = {
[key: string]: number;
};
export interface ICarouselOptions {
currentIndex: number;
loadingClasses?: string | string[];
dotsItemClasses?: string;
isAutoHeight?: boolean;
isAutoPlay?: boolean;
speed?: number;
isCentered?: boolean;
isDraggable?: boolean;
isInfiniteLoop?: boolean;
isRTL?: boolean;
isSnap?: boolean;
hasSnapSpacers?: boolean;
slidesQty?: TCarouselOptionsSlidesQty | number;
speed?: number;
updateDelay?: number;
}
export interface ICarousel {
options?: ICarouselOptions;
Expand All @@ -32,38 +43,81 @@ export interface ICarousel {
goTo(i: number): void;
}
declare class HSCarousel extends HSBasePlugin<ICarouselOptions> implements ICarousel {
private currentIndex;
private readonly loadingClasses;
private readonly dotsItemClasses;
private readonly isAutoHeight;
private readonly isAutoPlay;
private readonly isCentered;
private readonly isDraggable;
private readonly isInfiniteLoop;
private readonly isRTL;
private readonly isSnap;
private readonly hasSnapSpacers;
private readonly slidesQty;
private readonly speed;
private readonly updateDelay;
private readonly loadingClassesRemove;
private readonly loadingClassesAdd;
private readonly afterLoadingClassesAdd;
private readonly container;
private readonly inner;
private readonly slides;
private readonly prev;
private readonly next;
private readonly dots;
private dotsItems;
private readonly info;
private readonly infoTotal;
private readonly infoCurrent;
private sliderWidth;
private currentIndex;
private readonly loadingClasses;
private readonly loadingClassesRemove;
private readonly loadingClassesAdd;
private readonly afterLoadingClassesAdd;
private readonly isAutoPlay;
private readonly isRTL;
private readonly speed;
private readonly isInfiniteLoop;
private timer;
private isScrolling;
private isDragging;
private dragStartX;
private initialTranslateX;
private readonly touchX;
private resizeContainer;
resizeContainerWidth: number;
constructor(el: HTMLElement, options?: ICarouselOptions);
private setIsSnap;
private init;
private initDragHandling;
private getTranslateXValue;
private removeClickEventWhileDragging;
private handleDragStart;
private handleDragMove;
private handleDragEnd;
private getEventX;
private getCurrentSlidesQty;
private buildSnapSpacers;
private initDots;
private buildDots;
private setDots;
private goToCurrentDot;
private buildInfo;
private setInfoTotal;
private setInfoCurrent;
private buildSingleDot;
private singleDotEvents;
private observeResize;
private calculateWidth;
private addCurrentClass;
private setCurrentDot;
private setElementToDisabled;
private unsetElementToDisabled;
private addDisabledClass;
private autoPlay;
private setTimer;
private resetTimer;
private detectDirection;
recalculateWidth(): void;
private calculateTransform;
private setTranslate;
goToPrev(): void;
goToNext(): void;
goTo(i: number): void;
private setIndex;
static getInstance(target: HTMLElement | string, isInstance?: boolean): HSCarousel | ICollectionItem<HSCarousel>;
static autoInit(): void;
}
Expand Down
13 changes: 6 additions & 7 deletions dist/carousel.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dist/carousel.mjs

Large diffs are not rendered by default.

Loading

0 comments on commit 0c521a3

Please sign in to comment.