├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── config.yml
│ └── feature_request.yml
├── .gitignore
├── LICENSE
├── README.md
├── dist
├── accordion.d.ts
├── accordion.js
├── accordion.mjs
├── carousel.d.ts
├── carousel.js
├── carousel.mjs
├── collapse.d.ts
├── collapse.js
├── collapse.mjs
├── combobox.d.ts
├── combobox.js
├── combobox.mjs
├── copy-markup.d.ts
├── copy-markup.js
├── copy-markup.mjs
├── datatable.d.ts
├── datatable.js
├── datatable.mjs
├── datepicker.d.ts
├── datepicker.js
├── datepicker.mjs
├── dropdown.d.ts
├── dropdown.js
├── dropdown.mjs
├── file-upload.d.ts
├── file-upload.js
├── file-upload.mjs
├── helper-apexcharts.d.ts
├── helper-apexcharts.js
├── helper-apexcharts.mjs
├── helper-clipboard.d.ts
├── helper-clipboard.js
├── helper-clipboard.mjs
├── index.d.ts
├── index.js
├── index.mjs
├── input-number.d.ts
├── input-number.js
├── input-number.mjs
├── layout-splitter.d.ts
├── layout-splitter.js
├── layout-splitter.mjs
├── overlay.d.ts
├── overlay.js
├── overlay.mjs
├── pin-input.d.ts
├── pin-input.js
├── pin-input.mjs
├── preline.d.ts
├── preline.js
├── range-slider.d.ts
├── range-slider.js
├── range-slider.mjs
├── remove-element.d.ts
├── remove-element.js
├── remove-element.mjs
├── scroll-nav.d.ts
├── scroll-nav.js
├── scroll-nav.mjs
├── scrollspy.d.ts
├── scrollspy.js
├── scrollspy.mjs
├── select.d.ts
├── select.js
├── select.mjs
├── stepper.d.ts
├── stepper.js
├── stepper.mjs
├── strong-password.d.ts
├── strong-password.js
├── strong-password.mjs
├── tabs.d.ts
├── tabs.js
├── tabs.mjs
├── textarea-auto-height.d.ts
├── textarea-auto-height.js
├── textarea-auto-height.mjs
├── theme-switch.d.ts
├── theme-switch.js
├── theme-switch.mjs
├── toggle-count.d.ts
├── toggle-count.js
├── toggle-count.mjs
├── toggle-password.d.ts
├── toggle-password.js
├── toggle-password.mjs
├── tooltip.d.ts
├── tooltip.js
├── tooltip.mjs
├── tree-view.d.ts
├── tree-view.js
└── tree-view.mjs
├── dts-config.js
├── global.d.ts
├── index.d.ts
├── index.js
├── package-lock.json
├── package.json
├── preline.d.ts
├── preline.js
├── prettier.config.js
├── src
├── constants.ts
├── helpers
│ ├── apexcharts
│ │ ├── index.ts
│ │ └── interfaces.ts
│ ├── clipboard
│ │ └── index.ts
│ └── types.ts
├── index.ts
├── interfaces.ts
├── plugins
│ ├── accordion
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── base-plugin
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ └── types.ts
│ ├── carousel
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── collapse
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── combobox
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── copy-markup
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ └── types.ts
│ ├── datatable
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── datepicker
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── styles.css
│ │ ├── templates.ts
│ │ ├── types.ts
│ │ ├── vanilla-datepicker-pro.ts
│ │ └── variants.css
│ ├── dropdown
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── file-upload
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── input-number
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── layout-splitter
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── overlay
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── pin-input
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── range-slider
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── remove-element
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── scroll-nav
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── scrollspy
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── select
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── stepper
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── strong-password
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── tabs
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── textarea-auto-height
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ └── types.ts
│ ├── theme-switch
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ ├── toggle-count
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ └── types.ts
│ ├── toggle-password
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ └── types.ts
│ ├── tooltip
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
│ └── tree-view
│ │ ├── index.ts
│ │ ├── interfaces.ts
│ │ ├── types.ts
│ │ └── variants.css
├── spa
│ ├── index.ts
│ ├── interfaces.ts
│ └── types.ts
├── static
│ ├── index.ts
│ ├── interfaces.ts
│ └── types.ts
├── types.ts
└── utils
│ ├── index.ts
│ ├── interfaces.ts
│ └── types.ts
├── templates
├── admin
│ └── index.html
├── agency
│ └── index.html
├── ai-prompt
│ ├── ai-chat.html
│ ├── ai-classic.html
│ ├── ai-welcome-page.html
│ └── ai-with-sidebar.html
├── creative-agency
│ └── index.html
└── personal
│ └── index.html
├── tsconfig.json
├── tsconfig.mjs.json
├── variants.css
├── webpack.config.js
└── webpack.config.mjs.js
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Report a bug
2 | description: Please provide a clear and concise description of the problem.
3 | body:
4 | - type: markdown
5 | attributes:
6 | value: |
7 | ## Bug Report
8 |
9 | Thanks for taking the time to fill out this bug report!
10 | - type: input
11 | id: summary
12 | attributes:
13 | label: "Summary"
14 | description: "Provide a general summary of the issue."
15 | placeholder: "A short summary of the bug."
16 | validations:
17 | required: true
18 | - type: textarea
19 | id: steps-to-reproduce
20 | attributes:
21 | label: "Steps to Reproduce"
22 | description: "Describe the steps to reproduce the issue."
23 | placeholder: "1. Go to...\n2. Click on...\n3. Scroll down to...\n4. See error..."
24 | validations:
25 | required: true
26 | - type: input
27 | id: demo-link
28 | attributes:
29 | label: "Demo Link"
30 | description: "Provide a link to a demo on [CodeSandbox](https://codesandbox.io/) or [StackBlitz](https://stackblitz.com/) that reproduces the issue.\nYou can fork from an existing [Preline](https://preline.co/docs/frameworks.html) demo if needed."
31 | placeholder: "URL to the demo"
32 | validations:
33 | required: true
34 | - type: textarea
35 | id: expected-behavior
36 | attributes:
37 | label: "Expected Behavior"
38 | description: "Describe what you expected to happen."
39 | placeholder: "Describe the expected behavior."
40 | - type: textarea
41 | id: actual-behavior
42 | attributes:
43 | label: "Actual Behavior"
44 | description: "Describe what actually happened."
45 | placeholder: "Describe the actual behavior."
46 | - type: textarea
47 | id: screenshots
48 | attributes:
49 | label: "Screenshots"
50 | description: "Attach any screenshots that may help explain the problem. You can upload your screenshots to an image hosting service or drag and drop them directly into a GitHub comment, and then provide the link here."
51 | placeholder: "URL to screenshots"
52 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/htmlstreamofficial/preline/f0b65837734d3d3555881410f77f3ac6e258fac2/.github/ISSUE_TEMPLATE/config.yml
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.yml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest a new feature or enhancement.
3 | body:
4 | - type: markdown
5 | attributes:
6 | value: |
7 | ## Feature Request
8 |
9 | Please provide a detailed description of the feature you would like to see. Include as much detail as possible to help us understand your request.
10 | - type: input
11 | id: feature-summary
12 | attributes:
13 | label: "Summary"
14 | description: "Provide a brief summary of the feature."
15 | placeholder: "A short summary of the feature."
16 | validations:
17 | required: true
18 | - type: textarea
19 | id: detailed-description
20 | attributes:
21 | label: "Detailed Description"
22 | description: "Describe the feature in detail, including why it would be useful and how it should work."
23 | placeholder: "Provide a detailed description of the feature."
24 | validations:
25 | required: true
26 | - type: textarea
27 | id: use-cases
28 | attributes:
29 | label: "Use Cases"
30 | description: "Describe specific use cases or scenarios where this feature would be beneficial."
31 | placeholder: "Provide specific use cases or scenarios."
32 | validations:
33 | required: true
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /tmp
5 | /out-tsc
6 |
7 | # Runtime data
8 | pids
9 | *.pid
10 | *.seed
11 | *.pid.lock
12 |
13 | # Directory for instrumented libs generated by jscoverage/JSCover
14 | lib-cov
15 |
16 | # Coverage directory used by tools like istanbul
17 | coverage
18 |
19 | # nyc test coverage
20 | .nyc_output
21 |
22 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
23 | .grunt
24 |
25 | # Bower dependency directory (https://bower.io/)
26 | bower_components
27 |
28 | # node-waf configuration
29 | .lock-wscript
30 |
31 | # IDEs and editors
32 | .idea
33 | .project
34 | .classpath
35 | .c9/
36 | *.launch
37 | .settings/
38 | *.sublime-workspace
39 |
40 | # IDE - VSCode
41 | .vscode/*
42 | !.vscode/settings.json
43 | !.vscode/tasks.json
44 | !.vscode/launch.json
45 | !.vscode/extensions.json
46 |
47 | # misc
48 | .sass-cache
49 | connect.lock
50 | typings
51 |
52 | # Logs
53 | logs
54 | *.log
55 | npm-debug.log*
56 | yarn-debug.log*
57 | yarn-error.log*
58 |
59 |
60 | # Dependency directories
61 | node_modules/
62 | jspm_packages/
63 |
64 | # Optional npm cache directory
65 | .npm
66 |
67 | # Optional eslint cache
68 | .eslintcache
69 |
70 | # Optional REPL history
71 | .node_repl_history
72 |
73 | # Output of 'npm pack'
74 | *.tgz
75 |
76 | # Yarn Integrity file
77 | .yarn-integrity
78 |
79 | # dotenv environment variables file
80 | .env
81 |
82 | # next.js build output
83 | .next
84 |
85 | # Lerna
86 | lerna-debug.log
87 |
88 | # System Files
89 | .DS_Store
90 | Thumbs.db
91 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | @Author: Preline Labs Ltd.
2 | @Website: https://preline.co
3 | @License: Preline UI is free for both personal and commercial projects, released under dual license terms "MIT" and "Preline UI Fair Use License", and copyrighted 2024 by Preline Labs Ltd.
4 |
5 | MIT License
6 |
7 | Copyright (c) 2024 Preline Labs Ltd.
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy
10 | of this software and associated documentation files (the "Software"), to deal
11 | in the Software without restriction, including without limitation the rights
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | copies of the Software, and to permit persons to whom the Software is
14 | furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all
17 | copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | SOFTWARE.
26 |
27 |
28 | Preline UI Fair Use License
29 |
30 | 1. Usage Restrictions:
31 | - Competing Products: The Software shall not be used to create any product or service that directly competes with Preline UI. A competing product is defined as any software or service that replicates the primary functionalities of Preline UI.
32 | - Misuse and Abuse: The Software shall not be used for any activities that are deemed harmful, abusive, or intended to deceive end-users. This includes, but is not limited to, creating malware, engaging in fraudulent activities, or infringing on the rights of others.
33 |
34 | 2. Commercial Derivative Works:
35 | Users are permitted to create and sell derivative works such as templates, themes, and page builders, provided that:
36 | - The derivative works must not be marketed as competing products.
37 | - Proper attribution must be given to the original author, including the name "Preline UI" and a link to the original repository.
38 | - A clear distinction must be made between the original work and the derivative work, ensuring that users understand the source of each.
39 |
40 | 3. Distribution and Sublicensing:
41 | Redistribution of the Software in its original or modified form is allowed under the MIT License, with the following additional conditions:
42 | - Redistributions must include this Fair Use License in addition to the MIT License.
43 | - Redistributions must not remove or alter any licensing information or notices.
44 | - Must include clear attribution with a link to the original repository.
45 |
46 | 4. Termination:
47 | The author reserves the right to terminate the rights granted under this Fair Use License if the user fails to comply with the terms. Upon termination, the user must cease all use and distribution of the Software, and destroy all copies in their possession.
48 |
49 | 5. Enforcement and Compliance:
50 | - Users who believe that the terms of this Fair Use License have been violated are encouraged to report the violation to the author.
51 | - The author reserves the right to take legal action to enforce compliance with this Fair Use License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://preline.co)
2 |
3 |
4 |
5 | Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
6 |
7 | [](https://opensource.org/licenses/MIT)
8 |
9 | ## Why use Preline UI?
10 |
11 | Based on the Tailwind CSS utility classes, Preline UI's prebuilt components and UI elements help you quickly design and customize responsive mobile-first websites with the components a website needs, including buttons, dropdowns, navigation bars, modals, and more.
12 |
13 | ## What's in the box?
14 |
15 | Components are grouped by visual usability criteria (components, navigation, forms, etc.) and styled directly on top of Tailwind CSS, making them easy to extend and customize. This is a lifesaver for developers looking to create a unique and eye-catching design system without the hassle of creating each component by hand.
16 |
17 | ## Getting Started
18 |
19 | ### Quick Setup
20 |
21 | This guide will help you get started with Preline UI, including how to run, customize, update, and integrate your project!
22 |
23 | First, you need to make sure that you have a working Tailwind CSS project installed and that you also have Node and NPM installed on your machine.
24 |
25 | ### Require via NPM
26 |
27 | 1. Install preline
via npm
28 |
29 |
npm i preline
30 |
31 | 2. Import the Preline UI CSS Variants file variants.css
into your Tailwind CSS file, ensuring it comes after the tailwindcss
import.
32 |
33 | @import "./node_modules/preline/variants.css";
34 |
35 | 3. Include the JavaScript
that powers the interactive elements near the end of your <body>
tag:
36 |
37 |
38 |
39 | ## Documentation
40 |
41 | For full documentation of the Preline options, visit preline.co. The site also contains information on the wide variety of plugins that are available for TailwindCSS projects.
42 |
43 | ## Community
44 |
45 | For help, discussion about best practices, or any other conversation that would benefit from being searchable use [GitHub Discussions](https://github.com/htmlstreamofficial/preline/discussions)
46 |
47 | ## License
48 |
49 | Preline UI is free for both personal and commercial projects, released under dual license terms [MIT](https://preline.co/docs/license.html) and [Preline UI Fair Use License](https://preline.co/docs/license.html) , and copyrighted 2024 by Preline Labs Ltd.
50 |
51 | Preline UI Figma is free for both commercial and personal projects, learn more [here](https://preline.co/license.html).
52 |
53 | All brand icons are trademarks of their respective owners. The use of these trademarks does not indicate endorsement of the trademark holder by Preline UI, nor vice versa.
54 |
55 | ## A product of Htmlstream
56 |
57 | Preline UI is built and maintend by [Htmlstream](https://htmlstream.com) team. Over the last decade at Htmlstream, our journey has involved crafting UI Components and Templates. This process has allowed us to understand and explore a range of strategies for developing versatile UI designs that can adapt to a variety of needs.
58 |
59 | Share your thoughts about Preline on [Twitter](https://x.com/prelineUI) or leave supportive review on [ProductHunt](https://www.producthunt.com/products/preline-ui/reviews).
60 |
--------------------------------------------------------------------------------
/dist/accordion.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IAccordionTreeViewStaticOptions {
20 | }
21 | export interface IAccordionTreeView {
22 | el: HTMLElement | null;
23 | options?: IAccordionTreeViewStaticOptions;
24 | listeners?: {
25 | el: HTMLElement;
26 | listener: (evt: Event) => void;
27 | }[];
28 | }
29 | export interface IAccordionOptions {
30 | }
31 | export interface IAccordion {
32 | options?: IAccordionOptions;
33 | toggleClick(evt: Event): void;
34 | show(): void;
35 | hide(): void;
36 | update(): void;
37 | destroy(): void;
38 | }
39 | declare class HSAccordion extends HSBasePlugin implements IAccordion {
40 | private toggle;
41 | content: HTMLElement | null;
42 | private group;
43 | private isAlwaysOpened;
44 | private keepOneOpen;
45 | private isToggleStopPropagated;
46 | private onToggleClickListener;
47 | static selectable: IAccordionTreeView[];
48 | constructor(el: HTMLElement, options?: IAccordionOptions, events?: {});
49 | private init;
50 | toggleClick(evt: Event): boolean;
51 | show(): boolean;
52 | hide(): boolean;
53 | update(): boolean;
54 | destroy(): void;
55 | private static findInCollection;
56 | static autoInit(): void;
57 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
58 | static show(target: HSAccordion | HTMLElement | string): void;
59 | static hide(target: HSAccordion | HTMLElement | string): void;
60 | static onSelectableClick: (evt: Event, item: IAccordionTreeView, el: HTMLElement) => void;
61 | static treeView(): boolean;
62 | static toggleSelected(root: IAccordionTreeView, item: HTMLElement): void;
63 | static on(evt: string, target: HSAccordion | HTMLElement | string, cb: Function): void;
64 | }
65 |
66 | export {
67 | HSAccordion as default,
68 | };
69 |
70 | export {};
71 |
--------------------------------------------------------------------------------
/dist/carousel.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export type TCarouselOptionsSlidesQty = {
20 | [key: string]: number;
21 | };
22 | export interface ICarouselOptions {
23 | currentIndex: number;
24 | loadingClasses?: string | string[];
25 | dotsItemClasses?: string;
26 | mode?: "default" | "scroll-nav";
27 | isAutoHeight?: boolean;
28 | isAutoPlay?: boolean;
29 | isCentered?: boolean;
30 | isDraggable?: boolean;
31 | isInfiniteLoop?: boolean;
32 | isRTL?: boolean;
33 | isSnap?: boolean;
34 | hasSnapSpacers?: boolean;
35 | slidesQty?: TCarouselOptionsSlidesQty | number;
36 | speed?: number;
37 | updateDelay?: number;
38 | }
39 | export interface ICarousel {
40 | options?: ICarouselOptions;
41 | recalculateWidth(): void;
42 | goToPrev(): void;
43 | goToNext(): void;
44 | goTo(i: number): void;
45 | destroy(): void;
46 | }
47 | declare class HSCarousel extends HSBasePlugin implements ICarousel {
48 | private currentIndex;
49 | private readonly loadingClasses;
50 | private readonly dotsItemClasses;
51 | private readonly isAutoHeight;
52 | private readonly isAutoPlay;
53 | private readonly isCentered;
54 | private readonly isDraggable;
55 | private readonly isInfiniteLoop;
56 | private readonly isRTL;
57 | private readonly isSnap;
58 | private readonly hasSnapSpacers;
59 | private readonly slidesQty;
60 | private readonly speed;
61 | private readonly updateDelay;
62 | private readonly loadingClassesRemove;
63 | private readonly loadingClassesAdd;
64 | private readonly afterLoadingClassesAdd;
65 | private readonly container;
66 | private readonly inner;
67 | private readonly slides;
68 | private readonly prev;
69 | private readonly next;
70 | private readonly dots;
71 | private dotsItems;
72 | private readonly info;
73 | private readonly infoTotal;
74 | private readonly infoCurrent;
75 | private sliderWidth;
76 | private timer;
77 | private isScrolling;
78 | private isDragging;
79 | private dragStartX;
80 | private initialTranslateX;
81 | private readonly touchX;
82 | private resizeContainer;
83 | resizeContainerWidth: number;
84 | private onPrevClickListener;
85 | private onNextClickListener;
86 | private onContainerScrollListener;
87 | private onElementTouchStartListener;
88 | private onElementTouchEndListener;
89 | private onInnerMouseDownListener;
90 | private onInnerTouchStartListener;
91 | private onDocumentMouseMoveListener;
92 | private onDocumentTouchMoveListener;
93 | private onDocumentMouseUpListener;
94 | private onDocumentTouchEndListener;
95 | private onDotClickListener;
96 | constructor(el: HTMLElement, options?: ICarouselOptions);
97 | private setIsSnap;
98 | private prevClick;
99 | private nextClick;
100 | private containerScroll;
101 | private elementTouchStart;
102 | private elementTouchEnd;
103 | private innerMouseDown;
104 | private innerTouchStart;
105 | private documentMouseMove;
106 | private documentTouchMove;
107 | private documentMouseUp;
108 | private documentTouchEnd;
109 | private dotClick;
110 | private init;
111 | private initDragHandling;
112 | private getTranslateXValue;
113 | private removeClickEventWhileDragging;
114 | private handleDragStart;
115 | private handleDragMove;
116 | private handleDragEnd;
117 | private getEventX;
118 | private getCurrentSlidesQty;
119 | private buildSnapSpacers;
120 | private initDots;
121 | private buildDots;
122 | private setDots;
123 | private goToCurrentDot;
124 | private buildInfo;
125 | private setInfoTotal;
126 | private setInfoCurrent;
127 | private buildSingleDot;
128 | private singleDotEvents;
129 | private observeResize;
130 | private calculateWidth;
131 | private addCurrentClass;
132 | private setCurrentDot;
133 | private setElementToDisabled;
134 | private unsetElementToDisabled;
135 | private addDisabledClass;
136 | private autoPlay;
137 | private setTimer;
138 | private resetTimer;
139 | private detectDirection;
140 | private calculateTransform;
141 | private setTransform;
142 | private setTranslate;
143 | private setIndex;
144 | recalculateWidth(): void;
145 | goToPrev(): void;
146 | goToNext(): void;
147 | goTo(i: number): void;
148 | destroy(): void;
149 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSCarousel | ICollectionItem;
150 | static autoInit(): void;
151 | }
152 |
153 | export {
154 | HSCarousel as default,
155 | };
156 |
157 | export {};
158 |
--------------------------------------------------------------------------------
/dist/collapse.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ICollapse {
20 | options?: {};
21 | show(): void;
22 | hide(): void;
23 | destroy(): void;
24 | }
25 | declare class HSCollapse extends HSBasePlugin<{}> implements ICollapse {
26 | private readonly contentId;
27 | content: HTMLElement | null;
28 | private animationInProcess;
29 | private onElementClickListener;
30 | constructor(el: HTMLElement, options?: {}, events?: {});
31 | private elementClick;
32 | private init;
33 | private hideAllMegaMenuItems;
34 | show(): boolean;
35 | hide(): boolean;
36 | destroy(): void;
37 | private static findInCollection;
38 | static getInstance(target: HTMLElement, isInstance?: boolean): HTMLElement | ICollectionItem;
39 | static autoInit(): void;
40 | static show(target: HSCollapse | HTMLElement | string): void;
41 | static hide(target: HSCollapse | HTMLElement | string): void;
42 | static on(evt: string, target: HSCollapse | HTMLElement | string, cb: Function): void;
43 | }
44 |
45 | export {
46 | HSCollapse as default,
47 | };
48 |
49 | export {};
50 |
--------------------------------------------------------------------------------
/dist/collapse.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,n)=>{n.d(t,{A:()=>i});class i{constructor(e,t,n){this.el=e,this.options=t,this.events=n,this.el=e,this.options=t,this.events={}}createCollection(e,t){var n;e.push({id:(null===(n=null==t?void 0:t.el)||void 0===n?void 0:n.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,n)=>{n.d(t,{JD:()=>i,yd:()=>s});
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 | const i=(e,t,n=null)=>{const i=new CustomEvent(e,{detail:{payload:n},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(i)},s=(e,t)=>{const n=()=>{t(),e.removeEventListener("transitionend",n,!0)},i=window.getComputedStyle(e),s=i.getPropertyValue("transition-duration");"none"!==i.getPropertyValue("transition-property")&&parseFloat(s)>0?e.addEventListener("transitionend",n,!0):t()}}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};n.d(i,{A:()=>a});var s=n(926),o=n(615);
9 | /*
10 | * HSCollapse
11 | * @version: 3.0.1
12 | * @author: Preline Labs Ltd.
13 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14 | * Copyright 2024 Preline Labs Ltd.
15 | */
16 | class l extends o.A{constructor(e,t,n){super(e,t,n),this.contentId=this.el.dataset.hsCollapse,this.content=document.querySelector(this.contentId),this.animationInProcess=!1,this.content&&this.init()}elementClick(){this.content.classList.contains("open")?this.hide():this.show()}init(){var e;this.createCollection(window.$hsCollapseCollection,this),this.onElementClickListener=()=>this.elementClick(),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.classList.contains("open")?this.el.ariaExpanded="true":this.el.ariaExpanded="false"),this.el.addEventListener("click",this.onElementClickListener)}hideAllMegaMenuItems(){this.content.querySelectorAll(".hs-mega-menu-content.block").forEach((e=>{e.classList.remove("block"),e.classList.add("hidden")}))}show(){var e;if(this.animationInProcess||this.el.classList.contains("open"))return!1;this.animationInProcess=!0,this.el.classList.add("open"),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.ariaExpanded="true"),this.content.classList.add("open"),this.content.classList.remove("hidden"),this.content.style.height="0",setTimeout((()=>{this.content.style.height=`${this.content.scrollHeight}px`,this.fireEvent("beforeOpen",this.el),(0,s.JD)("beforeOpen.hs.collapse",this.el,this.el)})),(0,s.yd)(this.content,(()=>{this.content.style.height="",this.fireEvent("open",this.el),(0,s.JD)("open.hs.collapse",this.el,this.el),this.animationInProcess=!1}))}hide(){var e;if(this.animationInProcess||!this.el.classList.contains("open"))return!1;this.animationInProcess=!0,this.el.classList.remove("open"),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.ariaExpanded="false"),this.content.style.height=`${this.content.scrollHeight}px`,setTimeout((()=>{this.content.style.height="0"})),this.content.classList.remove("open"),(0,s.yd)(this.content,(()=>{this.content.classList.add("hidden"),this.content.style.height="",this.fireEvent("hide",this.el),(0,s.JD)("hide.hs.collapse",this.el,this.el),this.animationInProcess=!1})),this.content.querySelectorAll(".hs-mega-menu-content.block").length&&this.hideAllMegaMenuItems()}destroy(){this.el.removeEventListener("click",this.onElementClickListener),this.content=null,this.animationInProcess=!1,window.$hsCollapseCollection=window.$hsCollapseCollection.filter((({element:e})=>e.el!==this.el))}static findInCollection(e){return window.$hsCollapseCollection.find((t=>e instanceof l?t.element.el===e.el:"string"==typeof e?t.element.el===document.querySelector(e):t.element.el===e))||null}static getInstance(e,t=!1){const n=window.$hsCollapseCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return n?t?n:n.element.el:null}static autoInit(){window.$hsCollapseCollection||(window.$hsCollapseCollection=[]),window.$hsCollapseCollection&&(window.$hsCollapseCollection=window.$hsCollapseCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll(".hs-collapse-toggle:not(.--prevent-on-load-init)").forEach((e=>{window.$hsCollapseCollection.find((t=>{var n;return(null===(n=null==t?void 0:t.element)||void 0===n?void 0:n.el)===e}))||new l(e)}))}static show(e){const t=l.findInCollection(e);t&&t.element.content.classList.contains("hidden")&&t.element.show()}static hide(e){const t=l.findInCollection(e);t&&!t.element.content.classList.contains("hidden")&&t.element.hide()}static on(e,t,n){const i=l.findInCollection(t);i&&(i.element.events[e]=n)}}window.addEventListener("load",(()=>{l.autoInit()})),"undefined"!=typeof window&&(window.HSCollapse=l);const a=l;var h=i.A;export{h as default};
--------------------------------------------------------------------------------
/dist/combobox.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IComboBoxOptions {
20 | gap?: number;
21 | viewport?: string | HTMLElement | null;
22 | preventVisibility?: boolean;
23 | minSearchLength?: number;
24 | apiUrl?: string | null;
25 | apiDataPart?: string | null;
26 | apiQuery?: string | null;
27 | apiSearchQuery?: string | null;
28 | apiSearchPath?: string | null;
29 | apiSearchDefaultPath?: string | null;
30 | apiHeaders?: {};
31 | apiGroupField?: string | null;
32 | outputItemTemplate?: string | null;
33 | outputEmptyTemplate?: string | null;
34 | outputLoaderTemplate?: string | null;
35 | groupingType?: "default" | "tabs" | null;
36 | groupingTitleTemplate?: string | null;
37 | tabsWrapperTemplate?: string | null;
38 | preventSelection?: boolean;
39 | preventAutoPosition?: boolean;
40 | isOpenOnFocus?: boolean;
41 | }
42 | export interface IComboBox {
43 | options?: IComboBoxOptions;
44 | getCurrentData(): {} | {}[];
45 | open(): void;
46 | close(): void;
47 | recalculateDirection(): void;
48 | destroy(): void;
49 | }
50 | declare class HSComboBox extends HSBasePlugin implements IComboBox {
51 | gap: number;
52 | viewport: string | HTMLElement | null;
53 | preventVisibility: boolean;
54 | minSearchLength: number;
55 | apiUrl: string | null;
56 | apiDataPart: string | null;
57 | apiQuery: string | null;
58 | apiSearchQuery: string | null;
59 | apiSearchPath: string | null;
60 | apiSearchDefaultPath: string | null;
61 | apiHeaders: {};
62 | apiGroupField: string | null;
63 | outputItemTemplate: string | null;
64 | outputEmptyTemplate: string | null;
65 | outputLoaderTemplate: string | null;
66 | groupingType: "default" | "tabs" | null;
67 | groupingTitleTemplate: string | null;
68 | tabsWrapperTemplate: string | null;
69 | preventSelection: boolean;
70 | preventAutoPosition: boolean;
71 | isOpenOnFocus: boolean;
72 | private readonly input;
73 | private readonly output;
74 | private readonly itemsWrapper;
75 | private items;
76 | private tabs;
77 | private readonly toggle;
78 | private readonly toggleClose;
79 | private readonly toggleOpen;
80 | private outputPlaceholder;
81 | private outputLoader;
82 | private value;
83 | private selected;
84 | private currentData;
85 | private groups;
86 | private selectedGroup;
87 | isOpened: boolean;
88 | isCurrent: boolean;
89 | private animationInProcess;
90 | private isSearchLengthExceeded;
91 | private onInputFocusListener;
92 | private onInputInputListener;
93 | private onToggleClickListener;
94 | private onToggleCloseClickListener;
95 | private onToggleOpenClickListener;
96 | constructor(el: HTMLElement, options?: IComboBoxOptions, events?: {});
97 | private inputFocus;
98 | private inputInput;
99 | private toggleClick;
100 | private toggleCloseClick;
101 | private toggleOpenClick;
102 | private init;
103 | private build;
104 | private getNestedProperty;
105 | private setValue;
106 | private setValueAndOpen;
107 | private setValueAndClear;
108 | private setSelectedByValue;
109 | private setResultAndRender;
110 | private setResults;
111 | private setGroups;
112 | private setApiGroups;
113 | private setItemsVisibility;
114 | private isTextExists;
115 | private isTextExistsAny;
116 | private hasVisibleItems;
117 | private valuesBySelector;
118 | private sortItems;
119 | private buildInput;
120 | private buildItems;
121 | private buildOutputLoader;
122 | private buildToggle;
123 | private buildToggleClose;
124 | private buildToggleOpen;
125 | private buildOutputPlaceholder;
126 | private destroyOutputLoader;
127 | private itemRender;
128 | private plainRender;
129 | private jsonItemsRender;
130 | private groupDefaultRender;
131 | private groupTabsRender;
132 | private itemsFromHtml;
133 | private itemsFromJson;
134 | private appendItemsToWrapper;
135 | private resultItems;
136 | private destroyOutputPlaceholder;
137 | getCurrentData(): {} | {}[];
138 | setCurrent(): void;
139 | open(val?: string): boolean;
140 | close(val?: string | null, data?: {} | null): boolean;
141 | recalculateDirection(): void;
142 | destroy(): void;
143 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSComboBox | ICollectionItem;
144 | static autoInit(): void;
145 | static close(target: HTMLElement | string): void;
146 | static closeCurrentlyOpened(evtTarget?: HTMLElement | null): void;
147 | private static getPreparedItems;
148 | private static setHighlighted;
149 | static accessibility(evt: KeyboardEvent): void;
150 | static onEscape(): void;
151 | static onArrow(isArrowUp?: boolean): boolean;
152 | static onStartEnd(isStart?: boolean): boolean;
153 | static onEnter(evt: Event): void;
154 | }
155 |
156 | export {
157 | HSComboBox as default,
158 | };
159 |
160 | export {};
161 |
--------------------------------------------------------------------------------
/dist/copy-markup.d.ts:
--------------------------------------------------------------------------------
1 | export interface ICopyMarkupOptions {
2 | targetSelector: string;
3 | wrapperSelector: string;
4 | limit?: number;
5 | }
6 | export interface ICopyMarkup {
7 | options?: ICopyMarkupOptions;
8 | delete(target: HTMLElement): void;
9 | destroy(): void;
10 | }
11 | export interface IBasePlugin {
12 | el: E;
13 | options?: O;
14 | events?: {};
15 | }
16 | declare class HSBasePlugin implements IBasePlugin {
17 | el: E;
18 | options: O;
19 | events?: any;
20 | constructor(el: E, options: O, events?: any);
21 | createCollection(collection: any[], element: any): void;
22 | fireEvent(evt: string, payload?: any): any;
23 | on(evt: string, cb: Function): void;
24 | }
25 | export interface ICollectionItem {
26 | id: string | number;
27 | element: T;
28 | }
29 | declare class HSCopyMarkup extends HSBasePlugin implements ICopyMarkup {
30 | private readonly targetSelector;
31 | private readonly wrapperSelector;
32 | private readonly limit;
33 | private target;
34 | private wrapper;
35 | private items;
36 | private onElementClickListener;
37 | private onDeleteItemButtonClickListener;
38 | constructor(el: HTMLElement, options?: ICopyMarkupOptions);
39 | private elementClick;
40 | private deleteItemButtonClick;
41 | private init;
42 | private copy;
43 | private addPredefinedItems;
44 | private setTarget;
45 | private setWrapper;
46 | private addToItems;
47 | delete(target: HTMLElement): void;
48 | destroy(): void;
49 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSCopyMarkup | ICollectionItem;
50 | static autoInit(): void;
51 | }
52 |
53 | export {
54 | HSCopyMarkup as default,
55 | };
56 |
57 | export {};
58 |
--------------------------------------------------------------------------------
/dist/copy-markup.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,i)=>{i.d(t,{A:()=>s});class s{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i;e.push({id:(null===(i=null==t?void 0:t.el)||void 0===i?void 0:i.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,i)=>{i.d(t,{JD:()=>s});
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 | const s=(e,t,i=null)=>{const s=new CustomEvent(e,{detail:{payload:i},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(s)}}},t={};function i(s){var o=t[s];if(void 0!==o)return o.exports;var l=t[s]={exports:{}};return e[s](l,l.exports,i),l.exports}i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};i.d(s,{A:()=>n});var o=i(926),l=i(615);
9 | /*
10 | * HSCopyMarkup
11 | * @version: 3.0.1
12 | * @author: Preline Labs Ltd.
13 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14 | * Copyright 2024 Preline Labs Ltd.
15 | */
16 | class r extends l.A{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-copy-markup"),s=i?JSON.parse(i):{},o=Object.assign(Object.assign({},s),t);this.targetSelector=(null==o?void 0:o.targetSelector)||null,this.wrapperSelector=(null==o?void 0:o.wrapperSelector)||null,this.limit=(null==o?void 0:o.limit)||null,this.items=[],this.targetSelector&&this.init()}elementClick(){this.copy()}deleteItemButtonClick(e){this.delete(e)}init(){this.createCollection(window.$hsCopyMarkupCollection,this),this.onElementClickListener=()=>this.elementClick(),this.setTarget(),this.setWrapper(),this.addPredefinedItems(),this.el.addEventListener("click",this.onElementClickListener)}copy(){if(this.limit&&this.items.length>=this.limit)return!1;this.el.hasAttribute("disabled")&&this.el.setAttribute("disabled","");const e=this.target.cloneNode(!0);this.addToItems(e),this.limit&&this.items.length>=this.limit&&this.el.setAttribute("disabled","disabled"),this.fireEvent("copy",e),(0,o.JD)("copy.hs.copyMarkup",e,e)}addPredefinedItems(){Array.from(this.wrapper.children).filter((e=>!e.classList.contains("[--ignore-for-count]"))).forEach((e=>{this.addToItems(e)})),this.limit&&this.items.length>=this.limit&&this.el.setAttribute("disabled","disabled")}setTarget(){const e="string"==typeof this.targetSelector?document.querySelector(this.targetSelector).cloneNode(!0):this.targetSelector.cloneNode(!0);e.removeAttribute("id"),this.target=e}setWrapper(){this.wrapper="string"==typeof this.wrapperSelector?document.querySelector(this.wrapperSelector):this.wrapperSelector}addToItems(e){const t=e.querySelector("[data-hs-copy-markup-delete-item]");this.wrapper?this.wrapper.append(e):this.el.before(e),t&&(this.onDeleteItemButtonClickListener=()=>this.deleteItemButtonClick(e),t.addEventListener("click",this.onDeleteItemButtonClickListener)),this.items.push(e)}delete(e){const t=this.items.indexOf(e);-1!==t&&this.items.splice(t,1),e.remove(),this.fireEvent("delete",e),(0,o.JD)("delete.hs.copyMarkup",e,e)}destroy(){const e=this.wrapper.querySelectorAll("[data-hs-copy-markup-delete-item]");this.el.removeEventListener("click",this.onElementClickListener),e.length&&e.forEach((e=>e.removeEventListener("click",this.onDeleteItemButtonClickListener))),this.el.removeAttribute("disabled"),this.target=null,this.wrapper=null,this.items=null,window.$hsCopyMarkupCollection=window.$hsCopyMarkupCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const i=window.$hsCopyMarkupCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return i?t?i:i.element:null}static autoInit(){window.$hsCopyMarkupCollection||(window.$hsCopyMarkupCollection=[]),window.$hsCopyMarkupCollection&&(window.$hsCopyMarkupCollection=window.$hsCopyMarkupCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-copy-markup]:not(.--prevent-on-load-init)").forEach((e=>{if(!window.$hsCopyMarkupCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))){const t=e.getAttribute("data-hs-copy-markup"),i=t?JSON.parse(t):{};new r(e,i)}}))}}window.addEventListener("load",(()=>{r.autoInit()})),"undefined"!=typeof window&&(window.HSCopyMarkup=r);const n=r;var a=s.A;export{a as default};
--------------------------------------------------------------------------------
/dist/datatable.d.ts:
--------------------------------------------------------------------------------
1 | import { Config } from 'datatables.net-dt';
2 |
3 | export interface IBasePlugin {
4 | el: E;
5 | options?: O;
6 | events?: {};
7 | }
8 | declare class HSBasePlugin implements IBasePlugin {
9 | el: E;
10 | options: O;
11 | events?: any;
12 | constructor(el: E, options: O, events?: any);
13 | createCollection(collection: any[], element: any): void;
14 | fireEvent(evt: string, payload?: any): any;
15 | on(evt: string, cb: Function): void;
16 | }
17 | export interface ICollectionItem {
18 | id: string | number;
19 | element: T;
20 | }
21 | export interface IDataTablePagingOptions {
22 | pageBtnClasses?: string;
23 | }
24 | export interface IDataTableRowSelectingOptions {
25 | selectAllSelector?: string;
26 | individualSelector?: string;
27 | }
28 | export interface IDataTableOptions extends Config {
29 | rowSelectingOptions?: IDataTableRowSelectingOptions;
30 | pagingOptions?: IDataTablePagingOptions;
31 | }
32 | export interface IDataTable {
33 | options?: IDataTableOptions;
34 | destroy(): void;
35 | }
36 | declare class HSDataTable extends HSBasePlugin implements IDataTable {
37 | private concatOptions;
38 | private dataTable;
39 | private readonly table;
40 | private searches;
41 | private pageEntitiesList;
42 | private pagingList;
43 | private pagingPagesList;
44 | private pagingPrevList;
45 | private pagingNextList;
46 | private readonly infoList;
47 | private rowSelectingAll;
48 | private rowSelectingIndividual;
49 | private maxPagesToShow;
50 | private isRowSelecting;
51 | private readonly pageBtnClasses;
52 | private onSearchInputListener;
53 | private onPageEntitiesChangeListener;
54 | private onSinglePagingClickListener;
55 | private onPagingPrevClickListener;
56 | private onPagingNextClickListener;
57 | private onRowSelectingAllChangeListener;
58 | constructor(el: HTMLElement, options?: IDataTableOptions, events?: {});
59 | private init;
60 | private initTable;
61 | private searchInput;
62 | private pageEntitiesChange;
63 | private pagingPrevClick;
64 | private pagingNextClick;
65 | private rowSelectingAllChange;
66 | private singlePagingClick;
67 | private initSearch;
68 | private onSearchInput;
69 | private initPageEntities;
70 | private onEntitiesChange;
71 | private initInfo;
72 | private initInfoFrom;
73 | private initInfoTo;
74 | private initInfoLength;
75 | private updateInfo;
76 | private initPaging;
77 | private hidePagingIfSinglePage;
78 | private initPagingPrev;
79 | private onPrevClick;
80 | private disablePagingArrow;
81 | private initPagingNext;
82 | private onNextClick;
83 | private buildPagingPages;
84 | private updatePaging;
85 | private buildPagingPage;
86 | private onPageClick;
87 | private initRowSelecting;
88 | private triggerChangeEventToRow;
89 | private onSelectAllChange;
90 | private updateSelectAllCheckbox;
91 | destroy(): void;
92 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
93 | static autoInit(): void;
94 | }
95 |
96 | export {
97 | HSDataTable as default,
98 | };
99 |
100 | export {};
101 |
--------------------------------------------------------------------------------
/dist/datepicker.d.ts:
--------------------------------------------------------------------------------
1 | import { DatesArr } from 'vanilla-calendar-pro';
2 | import { Options } from 'vanilla-calendar-pro/types';
3 |
4 | export interface IBasePlugin {
5 | el: E;
6 | options?: O;
7 | events?: {};
8 | }
9 | declare class HSBasePlugin implements IBasePlugin {
10 | el: E;
11 | options: O;
12 | events?: any;
13 | constructor(el: E, options: O, events?: any);
14 | createCollection(collection: any[], element: any): void;
15 | fireEvent(evt: string, payload?: any): any;
16 | on(evt: string, cb: Function): void;
17 | }
18 | export interface ICollectionItem {
19 | id: string | number;
20 | element: T;
21 | }
22 | export interface IApiFieldMap {
23 | id: string;
24 | val: string;
25 | title: string;
26 | icon?: string | null;
27 | description?: string | null;
28 | [key: string]: unknown;
29 | }
30 | export interface ISelectOptions {
31 | value?: string | string[];
32 | isOpened?: boolean;
33 | placeholder?: string;
34 | hasSearch?: boolean;
35 | minSearchLength?: number;
36 | preventSearchFocus?: boolean;
37 | mode?: string;
38 | viewport?: string;
39 | wrapperClasses?: string;
40 | apiUrl?: string | null;
41 | apiQuery?: string | null;
42 | apiOptions?: RequestInit | null;
43 | apiDataPart?: string | null;
44 | apiSearchQueryKey?: string | null;
45 | apiFieldsMap?: IApiFieldMap | null;
46 | apiIconTag?: string | null;
47 | toggleTag?: string;
48 | toggleClasses?: string;
49 | toggleSeparators?: {
50 | items?: string;
51 | betweenItemsAndCounter?: string;
52 | };
53 | toggleCountText?: string | null;
54 | toggleCountTextPlacement?: "postfix" | "prefix" | "postfix-no-space" | "prefix-no-space";
55 | toggleCountTextMinItems?: number;
56 | toggleCountTextMode?: string;
57 | tagsItemTemplate?: string;
58 | tagsItemClasses?: string;
59 | tagsInputId?: string;
60 | tagsInputClasses?: string;
61 | dropdownTag?: string;
62 | dropdownClasses?: string;
63 | dropdownDirectionClasses?: {
64 | top?: string;
65 | bottom?: string;
66 | };
67 | dropdownSpace: number;
68 | dropdownPlacement: string | null;
69 | dropdownVerticalFixedPlacement: "top" | "bottom" | null;
70 | dropdownScope: "window" | "parent";
71 | extraMarkup?: string | string[] | null;
72 | searchTemplate?: string;
73 | searchWrapperTemplate?: string;
74 | searchId?: string;
75 | searchLimit?: number | typeof Infinity;
76 | isSearchDirectMatch?: boolean;
77 | searchClasses?: string;
78 | searchWrapperClasses?: string;
79 | searchPlaceholder?: string;
80 | searchNoResultTemplate?: string | null;
81 | searchNoResultText?: string | null;
82 | searchNoResultClasses?: string | null;
83 | optionAllowEmptyOption?: boolean;
84 | optionTemplate?: string;
85 | optionTag?: string;
86 | optionClasses?: string;
87 | descriptionClasses?: string;
88 | iconClasses?: string;
89 | isAddTagOnEnter?: boolean;
90 | }
91 | export interface ICustomDatepickerOptions extends Options {
92 | removeDefaultStyles?: boolean;
93 | mode?: "custom-select" | "default";
94 | inputModeOptions?: {
95 | dateSeparator?: string;
96 | itemsSeparator?: string;
97 | };
98 | templates?: {
99 | time?: string;
100 | arrowPrev?: string;
101 | arrowNext?: string;
102 | };
103 | styles?: Options["styles"] & {
104 | customSelect?: {
105 | shared?: ISelectOptions;
106 | years?: ISelectOptions;
107 | months?: ISelectOptions;
108 | hours?: ISelectOptions;
109 | minutes?: ISelectOptions;
110 | meridiem?: ISelectOptions;
111 | };
112 | };
113 | }
114 | export interface IDatepicker {
115 | options?: ICustomDatepickerOptions;
116 | }
117 | declare class HSDatepicker extends HSBasePlugin<{}> implements IDatepicker {
118 | private dataOptions;
119 | private updatedStyles;
120 | private vanillaCalendar;
121 | constructor(el: HTMLElement, options?: {}, events?: {});
122 | private init;
123 | private getTimeParts;
124 | private getCurrentMonthAndYear;
125 | private setInputValue;
126 | private changeDateSeparator;
127 | private formatDateArrayToIndividualDates;
128 | private hasTime;
129 | private createArrowFromTemplate;
130 | private concatObjectProperties;
131 | private updateTemplate;
132 | private initCustomTime;
133 | private initCustomMonths;
134 | private initCustomYears;
135 | private generateCustomTimeMarkup;
136 | private generateCustomMonthMarkup;
137 | private generateCustomYearMarkup;
138 | private generateCustomArrowPrevMarkup;
139 | private generateCustomArrowNextMarkup;
140 | private parseCustomTime;
141 | private parseCustomMonth;
142 | private parseCustomYear;
143 | private parseArrowPrev;
144 | private parseArrowNext;
145 | private processCustomTemplate;
146 | private disableOptions;
147 | private disableNav;
148 | private destroySelects;
149 | private updateSelect;
150 | private updateCalendar;
151 | private updateCustomSelects;
152 | getCurrentState(): {
153 | selectedDates: DatesArr;
154 | selectedTime: string;
155 | };
156 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
157 | static autoInit(): void;
158 | }
159 |
160 | export {
161 | HSDatepicker as default,
162 | };
163 |
164 | export {};
165 |
--------------------------------------------------------------------------------
/dist/dropdown.d.ts:
--------------------------------------------------------------------------------
1 | import { VirtualElement } from '@floating-ui/dom';
2 |
3 | export interface IBasePlugin {
4 | el: E;
5 | options?: O;
6 | events?: {};
7 | }
8 | declare class HSBasePlugin implements IBasePlugin {
9 | el: E;
10 | options: O;
11 | events?: any;
12 | constructor(el: E, options: O, events?: any);
13 | createCollection(collection: any[], element: any): void;
14 | fireEvent(evt: string, payload?: any): any;
15 | on(evt: string, cb: Function): void;
16 | }
17 | export interface ICollectionItem {
18 | id: string | number;
19 | element: T;
20 | }
21 | export interface IDropdown {
22 | options?: {};
23 | open(): void;
24 | close(isAnimated: boolean): void;
25 | forceClearState(): void;
26 | destroy(): void;
27 | }
28 | export interface IHTMLElementFloatingUI extends HTMLElement {
29 | _floatingUI: any;
30 | }
31 | declare class HSDropdown extends HSBasePlugin<{}, IHTMLElementFloatingUI> implements IDropdown {
32 | private static history;
33 | private readonly toggle;
34 | private readonly closers;
35 | menu: HTMLElement | null;
36 | private eventMode;
37 | private closeMode;
38 | private hasAutofocus;
39 | private animationInProcess;
40 | private longPressTimer;
41 | private onElementMouseEnterListener;
42 | private onElementMouseLeaveListener;
43 | private onToggleClickListener;
44 | private onToggleContextMenuListener;
45 | private onTouchStartListener;
46 | private onTouchEndListener;
47 | private onCloserClickListener;
48 | constructor(el: IHTMLElementFloatingUI, options?: {}, events?: {});
49 | private elementMouseEnter;
50 | private elementMouseLeave;
51 | private toggleClick;
52 | private toggleContextMenu;
53 | private handleTouchStart;
54 | private handleTouchEnd;
55 | private closerClick;
56 | private init;
57 | resizeHandler(): void;
58 | private buildToggle;
59 | private buildMenu;
60 | private buildClosers;
61 | private getScrollbarSize;
62 | private onContextMenuHandler;
63 | private onClickHandler;
64 | private onMouseEnterHandler;
65 | private onMouseLeaveHandler;
66 | private destroyFloatingUI;
67 | private focusElement;
68 | private setupFloatingUI;
69 | private selectCheckbox;
70 | private selectRadio;
71 | calculatePopperPosition(target?: VirtualElement | HTMLElement): string;
72 | open(target?: VirtualElement | HTMLElement): boolean;
73 | close(isAnimated?: boolean): boolean;
74 | forceClearState(): void;
75 | destroy(): void;
76 | private static findInCollection;
77 | static getInstance(target: HTMLElement | string, isInstance?: boolean): ICollectionItem | IHTMLElementFloatingUI;
78 | static autoInit(): void;
79 | static open(target: HSDropdown | HTMLElement | string): void;
80 | static close(target: HSDropdown | HTMLElement | string): void;
81 | static accessibility(evt: KeyboardEvent): void;
82 | static onEscape(evt: KeyboardEvent): void;
83 | static onEnter(evt: KeyboardEvent): boolean;
84 | static onArrow(isArrowUp?: boolean): boolean;
85 | static onArrowX(evt: KeyboardEvent, direction: "right" | "left"): boolean;
86 | static onStartEnd(isStart?: boolean): boolean;
87 | static onFirstLetter(code: string): boolean;
88 | static closeCurrentlyOpened(evtTarget?: HTMLElement | null, isAnimated?: boolean): void;
89 | static on(evt: string, target: HSDropdown | HTMLElement | string, cb: Function): void;
90 | }
91 |
92 | export {
93 | HSDropdown as default,
94 | };
95 |
96 | export {};
97 |
--------------------------------------------------------------------------------
/dist/file-upload.d.ts:
--------------------------------------------------------------------------------
1 | import { DropzoneOptions } from 'dropzone';
2 |
3 | export interface IBasePlugin {
4 | el: E;
5 | options?: O;
6 | events?: {};
7 | }
8 | declare class HSBasePlugin implements IBasePlugin {
9 | el: E;
10 | options: O;
11 | events?: any;
12 | constructor(el: E, options: O, events?: any);
13 | createCollection(collection: any[], element: any): void;
14 | fireEvent(evt: string, payload?: any): any;
15 | on(evt: string, cb: Function): void;
16 | }
17 | export interface ICollectionItem {
18 | id: string | number;
19 | element: T;
20 | }
21 | export interface IFileUploadOptions extends DropzoneOptions {
22 | extensions?: {};
23 | autoHideTrigger?: boolean;
24 | singleton?: boolean;
25 | }
26 | export interface IFileUpload {
27 | options?: IFileUploadOptions;
28 | destroy(): void;
29 | }
30 | declare class HSFileUpload extends HSBasePlugin implements IFileUpload {
31 | private concatOptions;
32 | private previewTemplate;
33 | private extensions;
34 | private singleton;
35 | dropzone: Dropzone | null;
36 | private onReloadButtonClickListener;
37 | private onTempFileInputChangeListener;
38 | constructor(el: HTMLElement, options?: IFileUploadOptions, events?: {});
39 | private tempFileInputChange;
40 | private reloadButtonClick;
41 | private init;
42 | private initDropzone;
43 | destroy(): void;
44 | private onAddFile;
45 | private previewAccepted;
46 | private onRemoveFile;
47 | private onUploadProgress;
48 | private onComplete;
49 | private setIcon;
50 | private createIcon;
51 | private formatFileSize;
52 | private splitFileName;
53 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
54 | static autoInit(): void;
55 | }
56 |
57 | export {
58 | HSFileUpload as default,
59 | };
60 |
61 | export {};
62 |
--------------------------------------------------------------------------------
/dist/helper-apexcharts.d.ts:
--------------------------------------------------------------------------------
1 | import { ApexOptions } from 'apexcharts';
2 |
3 | export interface IBuildTooltipHelperOptions {
4 | title: string;
5 | mode: string;
6 | valuePrefix: string;
7 | isValueDivided: boolean;
8 | valuePostfix: string;
9 | hasTextLabel: boolean;
10 | invertGroup: boolean;
11 | labelDivider: string;
12 | wrapperClasses: string;
13 | wrapperExtClasses: string;
14 | seriesClasses: string;
15 | seriesExtClasses: string;
16 | titleClasses: string;
17 | titleExtClasses: string;
18 | markerClasses: string;
19 | markerExtClasses: string;
20 | valueClasses: string;
21 | valueExtClasses: string;
22 | labelClasses: string;
23 | labelExtClasses: string;
24 | hasCategory?: boolean;
25 | }
26 | export interface IChartProps {
27 | dataPointIndex: number;
28 | ctx: {
29 | opts: ApexOptions;
30 | };
31 | series: [
32 | ][];
33 | }
34 | export interface IChartPropsSeries {
35 | name: string;
36 | altValue?: string;
37 | data: number[];
38 | }
39 | export interface IChartDonutProps {
40 | series: IChartPropsSeries[];
41 | seriesIndex: number;
42 | w: {
43 | globals: ApexOptions;
44 | };
45 | }
46 | export declare function buildTooltip(props: IChartProps, options: IBuildTooltipHelperOptions): string;
47 | export declare function buildTooltipCompareTwo(props: IChartProps, options: IBuildTooltipHelperOptions): string;
48 | export declare function buildTooltipCompareTwoAlt(props: IChartProps, options: IBuildTooltipHelperOptions): string;
49 | export declare function buildTooltipForDonut({ series, seriesIndex, w }: IChartDonutProps, textColor: string[]): string;
50 | export declare function buildChart(id: string, shared: Function, light: string, dark: string): any;
51 |
52 | export {};
53 |
--------------------------------------------------------------------------------
/dist/helper-clipboard.d.ts:
--------------------------------------------------------------------------------
1 | export {};
2 |
--------------------------------------------------------------------------------
/dist/helper-clipboard.js:
--------------------------------------------------------------------------------
1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var s in o)("object"==typeof exports?exports:e)[s]=o[s]}}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t,o=e;
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */Object.defineProperty(o,"__esModule",{value:!0});const s=null!==(t=null===window||void 0===window?void 0:window.HS_CLIPBOARD_SELECTOR)&&void 0!==t?t:".js-clipboard";window.addEventListener("load",(()=>{document.querySelectorAll(s).forEach((e=>{new ClipboardJS(e,{text:e=>{const t=e.dataset.clipboardText;if(t)return t;const o=e.dataset.clipboardTarget,s=document.querySelector(o);return"SELECT"===s.tagName||"INPUT"===s.tagName||"TEXTAREA"===s.tagName?s.value:s.textContent}}).on("success",(()=>{const t=e.querySelector(".js-clipboard-default"),o=e.querySelector(".js-clipboard-success"),s=e.querySelector(".js-clipboard-success-text"),l=e.dataset.clipboardSuccessText||"",n=e.closest(".hs-tooltip");let d;s&&(d=s.textContent,s.textContent=l),t&&o&&(t.style.display="none",o.style.display="block"),n&&window.HSTooltip.show(n),setTimeout((function(){s&&d&&(s.textContent=d),n&&window.HSTooltip.hide(n),t&&o&&(o.style.display="",t.style.display="")}),800)}))}))}))})(),e})()));
--------------------------------------------------------------------------------
/dist/helper-clipboard.mjs:
--------------------------------------------------------------------------------
1 | /*
2 | * @version: 3.0.1
3 | * @author: Preline Labs Ltd.
4 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
5 | * Copyright 2024 Preline Labs Ltd.
6 | */
7 | var t;const e=null!==(t=null===window||void 0===window?void 0:window.HS_CLIPBOARD_SELECTOR)&&void 0!==t?t:".js-clipboard";window.addEventListener("load",(()=>{document.querySelectorAll(e).forEach((t=>{new ClipboardJS(t,{text:t=>{const e=t.dataset.clipboardText;if(e)return e;const o=t.dataset.clipboardTarget,l=document.querySelector(o);return"SELECT"===l.tagName||"INPUT"===l.tagName||"TEXTAREA"===l.tagName?l.value:l.textContent}}).on("success",(()=>{const e=t.querySelector(".js-clipboard-default"),o=t.querySelector(".js-clipboard-success"),l=t.querySelector(".js-clipboard-success-text"),s=t.dataset.clipboardSuccessText||"",n=t.closest(".hs-tooltip");let a;l&&(a=l.textContent,l.textContent=s),e&&o&&(e.style.display="none",o.style.display="block"),n&&window.HSTooltip.show(n),setTimeout((function(){l&&a&&(l.textContent=a),n&&window.HSTooltip.hide(n),e&&o&&(o.style.display="",e.style.display="")}),800)}))}))}));
--------------------------------------------------------------------------------
/dist/input-number.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface IInputNumberOptions {
16 | min?: number;
17 | max?: number;
18 | step?: number;
19 | }
20 | export interface IInputNumber {
21 | options?: IInputNumberOptions;
22 | destroy(): void;
23 | }
24 | declare class HSInputNumber extends HSBasePlugin implements IInputNumber {
25 | private readonly input;
26 | private readonly increment;
27 | private readonly decrement;
28 | private inputValue;
29 | private readonly minInputValue;
30 | private readonly maxInputValue;
31 | private readonly step;
32 | private onInputInputListener;
33 | private onIncrementClickListener;
34 | private onDecrementClickListener;
35 | constructor(el: HTMLElement, options?: IInputNumberOptions);
36 | private inputInput;
37 | private incrementClick;
38 | private decrementClick;
39 | private init;
40 | private checkIsNumberAndConvert;
41 | private cleanAndExtractNumber;
42 | private build;
43 | private buildInput;
44 | private buildIncrement;
45 | private buildDecrement;
46 | private changeValue;
47 | private disableButtons;
48 | private enableButtons;
49 | destroy(): void;
50 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSInputNumber | {
51 | id: number;
52 | element: HSInputNumber;
53 | };
54 | static autoInit(): void;
55 | }
56 |
57 | export {
58 | HSInputNumber as default,
59 | };
60 |
61 | export {};
62 |
--------------------------------------------------------------------------------
/dist/layout-splitter.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ILayoutSplitterOptions {
20 | horizontalSplitterClasses?: string | null;
21 | horizontalSplitterTemplate?: string;
22 | verticalSplitterClasses?: string | null;
23 | verticalSplitterTemplate?: string;
24 | isSplittersAddedManually?: boolean;
25 | }
26 | export interface IControlLayoutSplitter {
27 | el: HTMLElement;
28 | direction: "horizontal" | "vertical";
29 | prev: HTMLElement | null;
30 | next: HTMLElement | null;
31 | }
32 | export interface ILayoutSplitter {
33 | options?: ILayoutSplitterOptions;
34 | getSplitterItemSingleParam(item: HTMLElement, name: string): any;
35 | getData(el: HTMLElement): any;
36 | setSplitterItemSize(el: HTMLElement, size: number): void;
37 | updateFlexValues(data: Array<{
38 | id: string;
39 | breakpoints: Record;
40 | }>): void;
41 | destroy(): void;
42 | }
43 | declare class HSLayoutSplitter extends HSBasePlugin implements ILayoutSplitter {
44 | static isListenersInitialized: boolean;
45 | private readonly horizontalSplitterClasses;
46 | private readonly horizontalSplitterTemplate;
47 | private readonly verticalSplitterClasses;
48 | private readonly verticalSplitterTemplate;
49 | private readonly isSplittersAddedManually;
50 | private horizontalSplitters;
51 | private horizontalControls;
52 | private verticalSplitters;
53 | private verticalControls;
54 | isDragging: boolean;
55 | activeSplitter: IControlLayoutSplitter | null;
56 | private onControlPointerDownListener;
57 | constructor(el: HTMLElement, options?: ILayoutSplitterOptions);
58 | private controlPointerDown;
59 | private controlPointerUp;
60 | private static onDocumentPointerMove;
61 | private static onDocumentPointerUp;
62 | private init;
63 | private buildSplitters;
64 | private buildHorizontalSplitters;
65 | private buildVerticalSplitters;
66 | private buildControl;
67 | private getSplitterItemParsedParam;
68 | private getContainerSize;
69 | private getMaxFlexSize;
70 | private updateHorizontalSplitter;
71 | private updateSingleSplitter;
72 | private updateVerticalSplitter;
73 | private updateSplitterItemParam;
74 | private onPointerDownHandler;
75 | private onPointerUpHandler;
76 | private onPointerMoveHandler;
77 | private bindListeners;
78 | private calculateAvailableSize;
79 | private calculateResizedSizes;
80 | private enforceLimits;
81 | private applySizes;
82 | getSplitterItemSingleParam(item: HTMLElement, name: string): any;
83 | getData(el: HTMLElement): any;
84 | setSplitterItemSize(el: HTMLElement, size: number): void;
85 | updateFlexValues(data: Array<{
86 | id: string;
87 | breakpoints: Record;
88 | }>): void;
89 | destroy(): void;
90 | private static findInCollection;
91 | static autoInit(): void;
92 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
93 | static on(evt: string, target: HSLayoutSplitter | HTMLElement | string, cb: Function): void;
94 | }
95 |
96 | export {
97 | HSLayoutSplitter as default,
98 | };
99 |
100 | export {};
101 |
--------------------------------------------------------------------------------
/dist/overlay.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IOverlayOptions {
20 | hiddenClass?: string | null;
21 | emulateScrollbarSpace?: boolean;
22 | isClosePrev?: boolean;
23 | backdropClasses?: string | null;
24 | backdropParent?: string | HTMLElement | Document;
25 | backdropExtraClasses?: string | null;
26 | moveOverlayToBody?: number | null;
27 | }
28 | export interface IOverlay {
29 | options?: IOverlayOptions;
30 | open(cb: Function | null): void;
31 | close(forceClose: boolean, cb: Function | null): void;
32 | destroy(): void;
33 | }
34 | export type TOverlayOptionsAutoCloseEqualityType = "less-than" | "more-than";
35 | declare class HSOverlay extends HSBasePlugin<{}> implements IOverlay {
36 | private readonly hiddenClass;
37 | private readonly emulateScrollbarSpace;
38 | private readonly isClosePrev;
39 | private readonly backdropClasses;
40 | private readonly backdropParent;
41 | private readonly backdropExtraClasses;
42 | private readonly animationTarget;
43 | private openNextOverlay;
44 | private autoHide;
45 | private toggleButtons;
46 | static openedItemsQty: number;
47 | initContainer: HTMLElement | null;
48 | isCloseWhenClickInside: boolean;
49 | isTabAccessibilityLimited: boolean;
50 | isLayoutAffect: boolean;
51 | hasAutofocus: boolean;
52 | hasDynamicZIndex: boolean;
53 | hasAbilityToCloseOnBackdropClick: boolean;
54 | openedBreakpoint: number | null;
55 | autoClose: number | null;
56 | autoCloseEqualityType: TOverlayOptionsAutoCloseEqualityType | null;
57 | moveOverlayToBody: number | null;
58 | private backdrop;
59 | private initialZIndex;
60 | static currentZIndex: number;
61 | private onElementClickListener;
62 | private onOverlayClickListener;
63 | private onBackdropClickListener;
64 | constructor(el: HTMLElement, options?: IOverlayOptions, events?: {});
65 | private elementClick;
66 | private overlayClick;
67 | private backdropClick;
68 | private init;
69 | private getElementsByZIndex;
70 | private buildToggleButtons;
71 | private hideAuto;
72 | private checkTimer;
73 | private buildBackdrop;
74 | private destroyBackdrop;
75 | private focusElement;
76 | private getScrollbarSize;
77 | private collectToggleParameters;
78 | open(cb?: Function | null): Promise;
79 | close(forceClose?: boolean, cb?: Function | null): Promise;
80 | destroy(): void;
81 | private static findInCollection;
82 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
83 | static autoInit(): void;
84 | static open(target: HSOverlay | HTMLElement | string): void;
85 | static close(target: HSOverlay | HTMLElement | string): void;
86 | static setOpened(breakpoint: number, el: ICollectionItem): void;
87 | static accessibility(evt: KeyboardEvent): boolean;
88 | static onEscape(target: ICollectionItem): void;
89 | static onTab(target: ICollectionItem): boolean;
90 | static on(evt: string, target: HSOverlay | HTMLElement | string, cb: Function): void;
91 | }
92 |
93 | export {
94 | HSOverlay as default,
95 | };
96 |
97 | export {};
98 |
--------------------------------------------------------------------------------
/dist/pin-input.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IPinInputOptions {
20 | availableCharsRE?: RegExp;
21 | }
22 | export interface IPinInput {
23 | options?: IPinInputOptions;
24 | destroy(): void;
25 | }
26 | declare class HSPinInput extends HSBasePlugin implements IPinInput {
27 | private items;
28 | private currentItem;
29 | private currentValue;
30 | private readonly placeholders;
31 | private readonly availableCharsRE;
32 | private onElementInputListener;
33 | private onElementPasteListener;
34 | private onElementKeydownListener;
35 | private onElementFocusinListener;
36 | private onElementFocusoutListener;
37 | private elementInput;
38 | private elementPaste;
39 | private elementKeydown;
40 | private elementFocusin;
41 | private elementFocusout;
42 | constructor(el: HTMLElement, options?: IPinInputOptions);
43 | private init;
44 | private build;
45 | private buildInputItems;
46 | private checkIfNumber;
47 | private autoFillAll;
48 | private setCurrentValue;
49 | private toggleCompleted;
50 | private onInput;
51 | private onKeydown;
52 | private onFocusIn;
53 | private onFocusOut;
54 | private onPaste;
55 | destroy(): void;
56 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSPinInput | ICollectionItem;
57 | static autoInit(): void;
58 | }
59 |
60 | export {
61 | HSPinInput as default,
62 | };
63 |
64 | export {};
65 |
--------------------------------------------------------------------------------
/dist/range-slider.d.ts:
--------------------------------------------------------------------------------
1 | import { Options } from 'nouislider';
2 |
3 | export interface IBasePlugin {
4 | el: E;
5 | options?: O;
6 | events?: {};
7 | }
8 | declare class HSBasePlugin implements IBasePlugin {
9 | el: E;
10 | options: O;
11 | events?: any;
12 | constructor(el: E, options: O, events?: any);
13 | createCollection(collection: any[], element: any): void;
14 | fireEvent(evt: string, payload?: any): any;
15 | on(evt: string, cb: Function): void;
16 | }
17 | export interface ICollectionItem {
18 | id: string | number;
19 | element: T;
20 | }
21 | export type TRangeSliderOptionsFormatterType = "integer" | "thousandsSeparatorAndDecimalPoints" | null;
22 | export interface IRangeSliderOptionsFormatterOptions {
23 | type?: TRangeSliderOptionsFormatterType;
24 | prefix?: string;
25 | postfix?: string;
26 | }
27 | export interface IRangeSliderOptions extends Options {
28 | disabled?: boolean;
29 | formatter?: IRangeSliderOptionsFormatterOptions | TRangeSliderOptionsFormatterType;
30 | }
31 | export interface IRangeSlider {
32 | options?: IRangeSliderOptions;
33 | destroy(): void;
34 | }
35 | declare class HSRangeSlider extends HSBasePlugin implements IRangeSlider {
36 | private readonly concatOptions;
37 | private format;
38 | constructor(el: HTMLElement, options?: IRangeSliderOptions, events?: {});
39 | get formattedValue(): any;
40 | private processClasses;
41 | private init;
42 | private formatValue;
43 | private integerFormatter;
44 | private prefixOrPostfixFormatter;
45 | private thousandsSeparatorAndDecimalPointsFormatter;
46 | private setDisabled;
47 | destroy(): void;
48 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
49 | static autoInit(): void;
50 | }
51 |
52 | export {
53 | HSRangeSlider as default,
54 | };
55 |
56 | export {};
57 |
--------------------------------------------------------------------------------
/dist/range-slider.js:
--------------------------------------------------------------------------------
1 | !function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var i=o();for(var e in i)("object"==typeof exports?exports:t)[e]=i[e]}}(self,(()=>(()=>{"use strict";var t={347:function(t,o,i){
2 | /*
3 | * HSRangeSlider
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */
9 | var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o,"__esModule",{value:!0});const s=e(i(961));class n extends s.default{constructor(t,o,i){super(t,o,i);const e=t.getAttribute("data-hs-range-slider"),s=e?JSON.parse(e):{};this.concatOptions=Object.assign(Object.assign(Object.assign({},s),o),{cssClasses:Object.assign(Object.assign({},noUiSlider.cssClasses),this.processClasses(s.cssClasses))}),this.init()}get formattedValue(){const t=this.el.noUiSlider.get();if(Array.isArray(t)&&this.format){const o=[];return t.forEach((t=>{o.push(this.format.to(t))})),o}return this.format?this.format.to(t):t}processClasses(t){const o={};return Object.keys(t).forEach((i=>{i&&(o[i]=`${noUiSlider.cssClasses[i]} ${t[i]}`)})),o}init(){var t,o,i,e,s,n,r,l,a,d,c,u,h;this.createCollection(window.$hsRangeSliderCollection,this),("object"==typeof(null===(t=this.concatOptions)||void 0===t?void 0:t.formatter)?"thousandsSeparatorAndDecimalPoints"===(null===(i=null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)||void 0===i?void 0:i.type):"thousandsSeparatorAndDecimalPoints"===(null===(e=this.concatOptions)||void 0===e?void 0:e.formatter))?this.thousandsSeparatorAndDecimalPointsFormatter():("object"==typeof(null===(s=this.concatOptions)||void 0===s?void 0:s.formatter)?"integer"===(null===(r=null===(n=this.concatOptions)||void 0===n?void 0:n.formatter)||void 0===r?void 0:r.type):"integer"===(null===(l=this.concatOptions)||void 0===l?void 0:l.formatter))?this.integerFormatter():"object"==typeof(null===(a=this.concatOptions)||void 0===a?void 0:a.formatter)&&((null===(c=null===(d=this.concatOptions)||void 0===d?void 0:d.formatter)||void 0===c?void 0:c.prefix)||(null===(h=null===(u=this.concatOptions)||void 0===u?void 0:u.formatter)||void 0===h?void 0:h.postfix))&&this.prefixOrPostfixFormatter(),noUiSlider.create(this.el,this.concatOptions),this.concatOptions.disabled&&this.setDisabled()}formatValue(t){var o,i,e,s,n,r,l,a,d;let c="";return"object"==typeof(null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)?((null===(e=null===(i=this.concatOptions)||void 0===i?void 0:i.formatter)||void 0===e?void 0:e.prefix)&&(c+=null===(n=null===(s=this.concatOptions)||void 0===s?void 0:s.formatter)||void 0===n?void 0:n.prefix),c+=t,(null===(l=null===(r=this.concatOptions)||void 0===r?void 0:r.formatter)||void 0===l?void 0:l.postfix)&&(c+=null===(d=null===(a=this.concatOptions)||void 0===a?void 0:a.formatter)||void 0===d?void 0:d.postfix)):c+=t,c}integerFormatter(){var t;this.format={to:t=>this.formatValue(Math.round(t)),from:t=>Math.round(+t)},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}prefixOrPostfixFormatter(){var t;this.format={to:t=>this.formatValue(t),from:t=>+t},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}thousandsSeparatorAndDecimalPointsFormatter(){var t;this.format={to:t=>this.formatValue(new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(t)),from:t=>parseFloat(t.replace(/,/g,""))},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}setDisabled(){this.el.setAttribute("disabled","disabled"),this.el.classList.add("disabled")}destroy(){this.el.noUiSlider.destroy(),this.format=null,window.$hsRangeSliderCollection=window.$hsRangeSliderCollection.filter((({element:t})=>t.el!==this.el))}static getInstance(t,o=!1){const i=window.$hsRangeSliderCollection.find((o=>o.element.el===("string"==typeof t?document.querySelector(t):t)));return i?o?i:i.element.el:null}static autoInit(){window.$hsRangeSliderCollection||(window.$hsRangeSliderCollection=[]),window.$hsRangeSliderCollection&&(window.$hsRangeSliderCollection=window.$hsRangeSliderCollection.filter((({element:t})=>document.contains(t.el)))),document.querySelectorAll("[data-hs-range-slider]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsRangeSliderCollection.find((o=>{var i;return(null===(i=null==o?void 0:o.element)||void 0===i?void 0:i.el)===t}))||new n(t)}))}}window.addEventListener("load",(()=>{n.autoInit()})),"undefined"!=typeof window&&(window.HSRangeSlider=n),o.default=n},961:(t,o)=>{Object.defineProperty(o,"__esModule",{value:!0});o.default=class{constructor(t,o,i){this.el=t,this.options=o,this.events=i,this.el=t,this.options=o,this.events={}}createCollection(t,o){var i;t.push({id:(null===(i=null==o?void 0:o.el)||void 0===i?void 0:i.id)||t.length+1,element:o})}fireEvent(t,o=null){if(this.events.hasOwnProperty(t))return this.events[t](o)}on(t,o){this.events[t]=o}}}},o={};var i=function i(e){var s=o[e];if(void 0!==s)return s.exports;var n=o[e]={exports:{}};return t[e].call(n.exports,n,n.exports,i),n.exports}(347);return i})()));
--------------------------------------------------------------------------------
/dist/range-slider.mjs:
--------------------------------------------------------------------------------
1 | var t={615:(t,o,i)=>{i.d(o,{A:()=>e});class e{constructor(t,o,i){this.el=t,this.options=o,this.events=i,this.el=t,this.options=o,this.events={}}createCollection(t,o){var i;t.push({id:(null===(i=null==o?void 0:o.el)||void 0===i?void 0:i.id)||t.length+1,element:o})}fireEvent(t,o=null){if(this.events.hasOwnProperty(t))return this.events[t](o)}on(t,o){this.events[t]=o}}}},o={};function i(e){var s=o[e];if(void 0!==s)return s.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,i),n.exports}i.d=(t,o)=>{for(var e in o)i.o(o,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:o[e]})},i.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o);var e={};i.d(e,{A:()=>r});var s=i(615);
2 | /*
3 | * HSRangeSlider
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */class n extends s.A{constructor(t,o,i){super(t,o,i);const e=t.getAttribute("data-hs-range-slider"),s=e?JSON.parse(e):{};this.concatOptions=Object.assign(Object.assign(Object.assign({},s),o),{cssClasses:Object.assign(Object.assign({},noUiSlider.cssClasses),this.processClasses(s.cssClasses))}),this.init()}get formattedValue(){const t=this.el.noUiSlider.get();if(Array.isArray(t)&&this.format){const o=[];return t.forEach((t=>{o.push(this.format.to(t))})),o}return this.format?this.format.to(t):t}processClasses(t){const o={};return Object.keys(t).forEach((i=>{i&&(o[i]=`${noUiSlider.cssClasses[i]} ${t[i]}`)})),o}init(){var t,o,i,e,s,n,r,l,a,d,c,h,v;this.createCollection(window.$hsRangeSliderCollection,this),("object"==typeof(null===(t=this.concatOptions)||void 0===t?void 0:t.formatter)?"thousandsSeparatorAndDecimalPoints"===(null===(i=null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)||void 0===i?void 0:i.type):"thousandsSeparatorAndDecimalPoints"===(null===(e=this.concatOptions)||void 0===e?void 0:e.formatter))?this.thousandsSeparatorAndDecimalPointsFormatter():("object"==typeof(null===(s=this.concatOptions)||void 0===s?void 0:s.formatter)?"integer"===(null===(r=null===(n=this.concatOptions)||void 0===n?void 0:n.formatter)||void 0===r?void 0:r.type):"integer"===(null===(l=this.concatOptions)||void 0===l?void 0:l.formatter))?this.integerFormatter():"object"==typeof(null===(a=this.concatOptions)||void 0===a?void 0:a.formatter)&&((null===(c=null===(d=this.concatOptions)||void 0===d?void 0:d.formatter)||void 0===c?void 0:c.prefix)||(null===(v=null===(h=this.concatOptions)||void 0===h?void 0:h.formatter)||void 0===v?void 0:v.postfix))&&this.prefixOrPostfixFormatter(),noUiSlider.create(this.el,this.concatOptions),this.concatOptions.disabled&&this.setDisabled()}formatValue(t){var o,i,e,s,n,r,l,a,d;let c="";return"object"==typeof(null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)?((null===(e=null===(i=this.concatOptions)||void 0===i?void 0:i.formatter)||void 0===e?void 0:e.prefix)&&(c+=null===(n=null===(s=this.concatOptions)||void 0===s?void 0:s.formatter)||void 0===n?void 0:n.prefix),c+=t,(null===(l=null===(r=this.concatOptions)||void 0===r?void 0:r.formatter)||void 0===l?void 0:l.postfix)&&(c+=null===(d=null===(a=this.concatOptions)||void 0===a?void 0:a.formatter)||void 0===d?void 0:d.postfix)):c+=t,c}integerFormatter(){var t;this.format={to:t=>this.formatValue(Math.round(t)),from:t=>Math.round(+t)},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}prefixOrPostfixFormatter(){var t;this.format={to:t=>this.formatValue(t),from:t=>+t},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}thousandsSeparatorAndDecimalPointsFormatter(){var t;this.format={to:t=>this.formatValue(new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(t)),from:t=>parseFloat(t.replace(/,/g,""))},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)}setDisabled(){this.el.setAttribute("disabled","disabled"),this.el.classList.add("disabled")}destroy(){this.el.noUiSlider.destroy(),this.format=null,window.$hsRangeSliderCollection=window.$hsRangeSliderCollection.filter((({element:t})=>t.el!==this.el))}static getInstance(t,o=!1){const i=window.$hsRangeSliderCollection.find((o=>o.element.el===("string"==typeof t?document.querySelector(t):t)));return i?o?i:i.element.el:null}static autoInit(){window.$hsRangeSliderCollection||(window.$hsRangeSliderCollection=[]),window.$hsRangeSliderCollection&&(window.$hsRangeSliderCollection=window.$hsRangeSliderCollection.filter((({element:t})=>document.contains(t.el)))),document.querySelectorAll("[data-hs-range-slider]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsRangeSliderCollection.find((o=>{var i;return(null===(i=null==o?void 0:o.element)||void 0===i?void 0:i.el)===t}))||new n(t)}))}}window.addEventListener("load",(()=>{n.autoInit()})),"undefined"!=typeof window&&(window.HSRangeSlider=n);const r=n;var l=e.A;export{l as default};
--------------------------------------------------------------------------------
/dist/remove-element.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IRemoveElementOptions {
20 | removeTargetAnimationClass: string;
21 | }
22 | export interface IRemoveElement {
23 | options?: IRemoveElementOptions;
24 | destroy(): void;
25 | }
26 | declare class HSRemoveElement extends HSBasePlugin implements IRemoveElement {
27 | private readonly removeTargetId;
28 | private readonly removeTarget;
29 | private readonly removeTargetAnimationClass;
30 | private onElementClickListener;
31 | constructor(el: HTMLElement, options?: IRemoveElementOptions);
32 | private elementClick;
33 | private init;
34 | private remove;
35 | destroy(): void;
36 | static getInstance(target: HTMLElement, isInstance?: boolean): HTMLElement | ICollectionItem;
37 | static autoInit(): void;
38 | }
39 |
40 | export {
41 | HSRemoveElement as default,
42 | };
43 |
44 | export {};
45 |
--------------------------------------------------------------------------------
/dist/remove-element.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,n)=>{n.d(t,{A:()=>o});class o{constructor(e,t,n){this.el=e,this.options=t,this.events=n,this.el=e,this.options=t,this.events={}}createCollection(e,t){var n;e.push({id:(null===(n=null==t?void 0:t.el)||void 0===n?void 0:n.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,n)=>{n.d(t,{yd:()=>o});
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 | const o=(e,t)=>{const n=()=>{t(),e.removeEventListener("transitionend",n,!0)},o=window.getComputedStyle(e),i=o.getPropertyValue("transition-duration");"none"!==o.getPropertyValue("transition-property")&&parseFloat(i)>0?e.addEventListener("transitionend",n,!0):t()}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};n.d(o,{A:()=>l});var i=n(926),r=n(615);
9 | /*
10 | * HSRemoveElement
11 | * @version: 3.0.1
12 | * @author: Preline Labs Ltd.
13 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14 | * Copyright 2024 Preline Labs Ltd.
15 | */
16 | class s extends r.A{constructor(e,t){super(e,t);const n=e.getAttribute("data-hs-remove-element-options"),o=n?JSON.parse(n):{},i=Object.assign(Object.assign({},o),t);this.removeTargetId=this.el.getAttribute("data-hs-remove-element"),this.removeTarget=document.querySelector(this.removeTargetId),this.removeTargetAnimationClass=(null==i?void 0:i.removeTargetAnimationClass)||"hs-removing",this.removeTarget&&this.init()}elementClick(){this.remove()}init(){this.createCollection(window.$hsRemoveElementCollection,this),this.onElementClickListener=()=>this.elementClick(),this.el.addEventListener("click",this.onElementClickListener)}remove(){if(!this.removeTarget)return!1;this.removeTarget.classList.add(this.removeTargetAnimationClass),(0,i.yd)(this.removeTarget,(()=>setTimeout((()=>this.removeTarget.remove()))))}destroy(){this.removeTarget.classList.remove(this.removeTargetAnimationClass),this.el.removeEventListener("click",this.onElementClickListener),window.$hsRemoveElementCollection=window.$hsRemoveElementCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const n=window.$hsRemoveElementCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)||t.element.el===("string"==typeof e?document.querySelector(e):e)));return n?t?n:n.element.el:null}static autoInit(){window.$hsRemoveElementCollection||(window.$hsRemoveElementCollection=[]),window.$hsRemoveElementCollection&&(window.$hsRemoveElementCollection=window.$hsRemoveElementCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-remove-element]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsRemoveElementCollection.find((t=>{var n;return(null===(n=null==t?void 0:t.element)||void 0===n?void 0:n.el)===e}))||new s(e)}))}}window.addEventListener("load",(()=>{s.autoInit()})),"undefined"!=typeof window&&(window.HSRemoveElement=s);const l=s;var a=o.A;export{a as default};
--------------------------------------------------------------------------------
/dist/scroll-nav.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IScrollNavOptions {
20 | paging?: boolean;
21 | autoCentering?: boolean;
22 | }
23 | export interface IScrollNavCurrentState {
24 | first: HTMLElement;
25 | last: HTMLElement;
26 | center: HTMLElement;
27 | }
28 | export interface IScrollNav {
29 | options?: IScrollNavOptions;
30 | getCurrentState(): IScrollNavCurrentState;
31 | goTo(el: Element, cb?: () => void): void;
32 | centerElement(el: HTMLElement, behavior: ScrollBehavior): void;
33 | destroy(): void;
34 | }
35 | declare class HSScrollNav extends HSBasePlugin implements IScrollNav {
36 | private readonly paging;
37 | private readonly autoCentering;
38 | private body;
39 | private items;
40 | private prev;
41 | private next;
42 | private currentState;
43 | constructor(el: HTMLElement, options?: IScrollNavOptions);
44 | private init;
45 | private setCurrentState;
46 | private setPrevToDisabled;
47 | private setNextToDisabled;
48 | private buildPrev;
49 | private buildNext;
50 | private buildPrevSingle;
51 | private buildNextSingle;
52 | private getCenterVisibleItem;
53 | private getFirstVisibleItem;
54 | private getLastVisibleItem;
55 | private getVisibleItemsCount;
56 | private scrollToActiveElement;
57 | getCurrentState(): IScrollNavCurrentState;
58 | goTo(el: Element, cb?: () => void): void;
59 | centerElement(el: HTMLElement, behavior?: ScrollBehavior): void;
60 | destroy(): void;
61 | static getInstance(target: HTMLElement, isInstance?: boolean): HTMLElement | ICollectionItem;
62 | static autoInit(): void;
63 | }
64 |
65 | export {
66 | HSScrollNav as default,
67 | };
68 |
69 | export {};
70 |
--------------------------------------------------------------------------------
/dist/scrollspy.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IScrollspyOptions {
20 | ignoreScrollUp?: boolean;
21 | }
22 | export interface IScrollspy {
23 | options?: IScrollspyOptions;
24 | destroy(): void;
25 | }
26 | declare class HSScrollspy extends HSBasePlugin implements IScrollspy {
27 | private readonly ignoreScrollUp;
28 | private readonly links;
29 | private readonly sections;
30 | private readonly scrollableId;
31 | private readonly scrollable;
32 | private isScrollingDown;
33 | private lastScrollTop;
34 | private onScrollableScrollListener;
35 | private onLinkClickListener;
36 | constructor(el: HTMLElement, options?: {});
37 | private scrollableScroll;
38 | private init;
39 | private determineScrollDirection;
40 | private linkClick;
41 | private update;
42 | private scrollTo;
43 | destroy(): void;
44 | static getInstance(target: HTMLElement, isInstance?: boolean): HTMLElement | ICollectionItem;
45 | static autoInit(): void;
46 | }
47 |
48 | export {
49 | HSScrollspy as default,
50 | };
51 |
52 | export {};
53 |
--------------------------------------------------------------------------------
/dist/scrollspy.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,l)=>{l.d(t,{A:()=>o});class o{constructor(e,t,l){this.el=e,this.options=t,this.events=l,this.el=e,this.options=t,this.events={}}createCollection(e,t){var l;e.push({id:(null===(l=null==t?void 0:t.el)||void 0===l?void 0:l.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,l)=>{l.d(t,{JD:()=>s,gj:()=>o});
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 | const o=(e,t,l="")=>(window.getComputedStyle(e).getPropertyValue(t)||l).replace(" ",""),s=(e,t,l=null)=>{const o=new CustomEvent(e,{detail:{payload:l},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(o)}}},t={};function l(o){var s=t[o];if(void 0!==s)return s.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,l),i.exports}l.d=(e,t)=>{for(var o in t)l.o(t,o)&&!l.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};l.d(o,{A:()=>n});var s=l(926),i=l(615);
9 | /*
10 | * HSScrollspy
11 | * @version: 3.0.1
12 | * @author: Preline Labs Ltd.
13 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14 | * Copyright 2024 Preline Labs Ltd.
15 | */
16 | class r extends i.A{constructor(e,t={}){super(e,t),this.isScrollingDown=!1,this.lastScrollTop=0;const l=e.getAttribute("data-hs-scrollspy-options"),o=l?JSON.parse(l):{},s=Object.assign(Object.assign({},o),t);this.ignoreScrollUp=void 0!==s.ignoreScrollUp&&s.ignoreScrollUp,this.links=this.el.querySelectorAll("[href]"),this.sections=[],this.scrollableId=this.el.getAttribute("data-hs-scrollspy-scrollable-parent"),this.scrollable=this.scrollableId?document.querySelector(this.scrollableId):document,this.onLinkClickListener=[],this.init()}scrollableScroll(e){const t=this.scrollable instanceof HTMLElement?this.scrollable.scrollTop:window.scrollY;this.isScrollingDown=t>this.lastScrollTop,this.lastScrollTop=t<=0?0:t,Array.from(this.sections).forEach((t=>{if(!t.getAttribute("id"))return!1;this.update(e,t)}))}init(){this.createCollection(window.$hsScrollspyCollection,this),this.links.forEach((e=>{this.sections.push(this.scrollable.querySelector(e.getAttribute("href")))})),this.onScrollableScrollListener=e=>this.scrollableScroll(e),this.scrollable.addEventListener("scroll",this.onScrollableScrollListener),this.links.forEach((e=>{this.onLinkClickListener.push({el:e,fn:t=>this.linkClick(t,e)}),e.addEventListener("click",this.onLinkClickListener.find((t=>t.el===e)).fn)}))}determineScrollDirection(e){const t=this.el.querySelector("a.active");if(!t)return!0;const l=Array.from(this.links).indexOf(t),o=Array.from(this.links).indexOf(e);return-1===o||o>l}linkClick(e,t){e.preventDefault();const l=t.getAttribute("href");if(!l||"javascript:;"===l)return;(l?document.querySelector(l):null)&&(this.isScrollingDown=this.determineScrollDirection(t),this.scrollTo(t))}update(e,t){const l=parseInt((0,s.gj)(this.el,"--scrollspy-offset","0")),o=parseInt((0,s.gj)(t,"--scrollspy-offset"))||l,i=e.target===document?0:parseInt(String(e.target.getBoundingClientRect().top)),r=parseInt(String(t.getBoundingClientRect().top))-o-i,n=t.offsetHeight;if(this.ignoreScrollUp||this.isScrollingDown?r<=0&&r+n>0:r<=0&&re.classList.remove("active")));const e=this.el.querySelector(`[href="#${t.getAttribute("id")}"]`);if(e){e.classList.add("active");const t=e.closest("[data-hs-scrollspy-group]");if(t){const e=t.querySelector("[href]");e&&e.classList.add("active")}}this.fireEvent("afterScroll",e),(0,s.JD)("afterScroll.hs.scrollspy",e,this.el)}}scrollTo(e){const t=e.getAttribute("href"),l=document.querySelector(t),o=parseInt((0,s.gj)(this.el,"--scrollspy-offset","0")),i=parseInt((0,s.gj)(l,"--scrollspy-offset"))||o,r=this.scrollable===document?0:this.scrollable.offsetTop,n=l.offsetTop-i-r,c=this.scrollable===document?window:this.scrollable,a=()=>{window.history.replaceState(null,null,e.getAttribute("href")),"scrollTo"in c&&c.scrollTo({top:n,left:0,behavior:"smooth"})},h=this.fireEvent("beforeScroll",this.el);(0,s.JD)("beforeScroll.hs.scrollspy",this.el,this.el),h instanceof Promise?h.then((()=>a())):a()}destroy(){this.el.querySelector("[href].active").classList.remove("active"),this.scrollable.removeEventListener("scroll",this.onScrollableScrollListener),this.onLinkClickListener.length&&this.onLinkClickListener.forEach((({el:e,fn:t})=>{e.removeEventListener("click",t)})),window.$hsScrollspyCollection=window.$hsScrollspyCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t=!1){const l=window.$hsScrollspyCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return l?t?l:l.element.el:null}static autoInit(){window.$hsScrollspyCollection||(window.$hsScrollspyCollection=[]),window.$hsScrollspyCollection&&(window.$hsScrollspyCollection=window.$hsScrollspyCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-scrollspy]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsScrollspyCollection.find((t=>{var l;return(null===(l=null==t?void 0:t.element)||void 0===l?void 0:l.el)===e}))||new r(e)}))}}window.addEventListener("load",(()=>{r.autoInit()})),"undefined"!=typeof window&&(window.HSScrollspy=r);const n=r;var c=o.A;export{c as default};
--------------------------------------------------------------------------------
/dist/stepper.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IStepperOptions {
20 | currentIndex?: number;
21 | isCompleted?: boolean;
22 | mode?: string;
23 | }
24 | export interface IStepper {
25 | options?: IStepperOptions;
26 | setProcessedNavItem(n?: number): void;
27 | unsetProcessedNavItem(n?: number): void;
28 | goToNext(): void;
29 | disableButtons(): void;
30 | enableButtons(): void;
31 | setErrorNavItem(n?: number): void;
32 | destroy(): void;
33 | }
34 | declare class HSStepper extends HSBasePlugin<{}> implements IStepper {
35 | private currentIndex;
36 | private readonly mode;
37 | private isCompleted;
38 | private totalSteps;
39 | private navItems;
40 | private contentItems;
41 | private backBtn;
42 | private nextBtn;
43 | private skipBtn;
44 | private completeStepBtn;
45 | private completeStepBtnDefaultText;
46 | private finishBtn;
47 | private resetBtn;
48 | private onNavItemClickListener;
49 | private onBackClickListener;
50 | private onNextClickListener;
51 | private onSkipClickListener;
52 | private onCompleteStepBtnClickListener;
53 | private onFinishBtnClickListener;
54 | private onResetBtnClickListener;
55 | constructor(el: HTMLElement, options?: IStepperOptions);
56 | private navItemClick;
57 | private backClick;
58 | private nextClick;
59 | private skipClick;
60 | private completeStepBtnClick;
61 | private finishBtnClick;
62 | private resetBtnClick;
63 | private init;
64 | private getUncompletedSteps;
65 | private setTotalSteps;
66 | private buildNav;
67 | private buildNavItem;
68 | private addNavItem;
69 | private setCurrentNavItem;
70 | private setCurrentNavItemActions;
71 | private getNavItem;
72 | private setProcessedNavItemActions;
73 | private setErrorNavItemActions;
74 | private unsetCurrentNavItemActions;
75 | private handleNavItemClick;
76 | private buildContent;
77 | private buildContentItem;
78 | private addContentItem;
79 | private setCurrentContentItem;
80 | private hideAllContentItems;
81 | private setCurrentContentItemActions;
82 | private unsetCurrentContentItemActions;
83 | private disableAll;
84 | private disableNavItemActions;
85 | private enableNavItemActions;
86 | private buildButtons;
87 | private buildBackButton;
88 | private handleBackButtonClick;
89 | private checkForTheFirstStep;
90 | private setToDisabled;
91 | private setToNonDisabled;
92 | private buildNextButton;
93 | private unsetProcessedNavItemActions;
94 | private handleNextButtonClick;
95 | private removeOptionalClasses;
96 | private buildSkipButton;
97 | private setSkipItem;
98 | private setSkipItemActions;
99 | private showSkipButton;
100 | private handleSkipButtonClick;
101 | private buildCompleteStepButton;
102 | private changeTextAndDisableCompleteButtonIfStepCompleted;
103 | private setCompleteItem;
104 | private setCompleteItemActions;
105 | private showCompleteStepButton;
106 | private handleCompleteStepButtonClick;
107 | private buildFinishButton;
108 | private setCompleted;
109 | private unsetCompleted;
110 | private showFinishButton;
111 | private handleFinishButtonClick;
112 | private buildResetButton;
113 | private handleResetButtonClick;
114 | setProcessedNavItem(n?: number): void;
115 | unsetProcessedNavItem(n?: number): void;
116 | goToNext(): void;
117 | disableButtons(): void;
118 | enableButtons(): void;
119 | setErrorNavItem(n?: number): void;
120 | destroy(): void;
121 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSStepper | ICollectionItem;
122 | static autoInit(): void;
123 | }
124 |
125 | export {
126 | HSStepper as default,
127 | };
128 |
129 | export {};
130 |
--------------------------------------------------------------------------------
/dist/strong-password.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IStrongPasswordOptions {
20 | target: string | HTMLInputElement;
21 | hints?: string;
22 | stripClasses?: string;
23 | minLength?: number;
24 | mode?: string;
25 | popoverSpace?: number;
26 | checksExclude?: string[];
27 | specialCharactersSet?: string;
28 | }
29 | export interface IStrongPassword {
30 | options?: IStrongPasswordOptions;
31 | recalculateDirection(): void;
32 | destroy(): void;
33 | }
34 | declare class HSStrongPassword extends HSBasePlugin implements IStrongPassword {
35 | private readonly target;
36 | private readonly hints;
37 | private readonly stripClasses;
38 | private readonly minLength;
39 | private readonly mode;
40 | private readonly popoverSpace;
41 | private readonly checksExclude;
42 | private readonly specialCharactersSet;
43 | isOpened: boolean;
44 | private strength;
45 | private passedRules;
46 | private weakness;
47 | private rules;
48 | private availableChecks;
49 | private onTargetInputListener;
50 | private onTargetFocusListener;
51 | private onTargetBlurListener;
52 | private onTargetInputSecondListener;
53 | private onTargetInputThirdListener;
54 | constructor(el: HTMLElement, options?: IStrongPasswordOptions);
55 | private targetInput;
56 | private targetFocus;
57 | private targetBlur;
58 | private targetInputSecond;
59 | private targetInputThird;
60 | private init;
61 | private build;
62 | private buildStrips;
63 | private buildHints;
64 | private buildWeakness;
65 | private buildRules;
66 | private setWeaknessText;
67 | private setRulesText;
68 | private togglePopover;
69 | private checkStrength;
70 | private checkIfPassed;
71 | private setStrength;
72 | private hideStrips;
73 | recalculateDirection(): void;
74 | destroy(): void;
75 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
76 | static autoInit(): void;
77 | }
78 |
79 | export {
80 | HSStrongPassword as default,
81 | };
82 |
83 | export {};
84 |
--------------------------------------------------------------------------------
/dist/tabs.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ITabsOptions {
20 | eventType: "click" | "hover";
21 | preventNavigationResolution: string | number | null;
22 | }
23 | export interface ITabs {
24 | options?: ITabsOptions;
25 | destroy(): void;
26 | }
27 | declare class HSTabs extends HSBasePlugin implements ITabs {
28 | private readonly eventType;
29 | private readonly preventNavigationResolution;
30 | toggles: NodeListOf | null;
31 | private readonly extraToggleId;
32 | private readonly extraToggle;
33 | private current;
34 | private currentContentId;
35 | currentContent: HTMLElement | null;
36 | private prev;
37 | private prevContentId;
38 | private prevContent;
39 | private onToggleHandler;
40 | private onExtraToggleChangeListener;
41 | constructor(el: HTMLElement, options?: ITabsOptions, events?: {});
42 | private toggle;
43 | private extraToggleChange;
44 | private init;
45 | private open;
46 | private change;
47 | destroy(): void;
48 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSTabs | ICollectionItem;
49 | static autoInit(): void;
50 | static open(target: HTMLElement): void;
51 | static accessibility(evt: KeyboardEvent): void;
52 | static onArrow(isOpposite?: boolean): void;
53 | static onStartEnd(isOpposite?: boolean): void;
54 | static on(evt: string, target: HTMLElement, cb: Function): void;
55 | }
56 |
57 | export {
58 | HSTabs as default,
59 | };
60 |
61 | export {};
62 |
--------------------------------------------------------------------------------
/dist/textarea-auto-height.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ITextareaAutoHeightOptions {
20 | defaultHeight: number;
21 | }
22 | export interface ITextareaAutoHeight {
23 | options?: ITextareaAutoHeightOptions;
24 | destroy(): void;
25 | }
26 | declare class HSTextareaAutoHeight extends HSBasePlugin implements ITextareaAutoHeight {
27 | private readonly defaultHeight;
28 | private onElementInputListener;
29 | constructor(el: HTMLTextAreaElement, options?: ITextareaAutoHeightOptions);
30 | private elementInput;
31 | private init;
32 | private setAutoHeight;
33 | private textareaSetHeight;
34 | private checkIfOneLine;
35 | private isParentHidden;
36 | private parentType;
37 | private callbackAccordingToType;
38 | destroy(): void;
39 | static getInstance(target: HTMLTextAreaElement | string, isInstance?: boolean): HSTextareaAutoHeight | ICollectionItem;
40 | static autoInit(): void;
41 | }
42 |
43 | export {
44 | HSTextareaAutoHeight as default,
45 | };
46 |
47 | export {};
48 |
--------------------------------------------------------------------------------
/dist/textarea-auto-height.js:
--------------------------------------------------------------------------------
1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(self,(()=>(()=>{"use strict";var e={144:function(e,t,i){
2 | /*
3 | * HSTextareaAutoHeight
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */
9 | var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(i(961));class l extends o.default{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-copy-markup"),n=i?JSON.parse(i):{},o=Object.assign(Object.assign({},n),t);this.defaultHeight=(null==o?void 0:o.defaultHeight)||0,this.init()}elementInput(){this.textareaSetHeight(3)}init(){this.createCollection(window.$hsTextareaAutoHeightCollection,this),this.setAutoHeight()}setAutoHeight(){this.isParentHidden()?this.callbackAccordingToType():this.textareaSetHeight(3),this.onElementInputListener=()=>this.elementInput(),this.el.addEventListener("input",this.onElementInputListener)}textareaSetHeight(e=0){this.el.style.height="auto",this.el.style.height=this.checkIfOneLine()&&this.defaultHeight?`${this.defaultHeight}px`:`${this.el.scrollHeight+e}px`}checkIfOneLine(){const e=this.el.clientHeight;return!(this.el.scrollHeight>e)}isParentHidden(){return this.el.closest(".hs-overlay.hidden")||this.el.closest('[role="tabpanel"].hidden')||this.el.closest(".hs-collapse.hidden")}parentType(){return this.el.closest(".hs-collapse")?"collapse":this.el.closest(".hs-overlay")?"overlay":!!this.el.closest('[role="tabpanel"]')&&"tabs"}callbackAccordingToType(){var e;if("collapse"===this.parentType()){const e=this.el.closest(".hs-collapse").id,{element:t}=window.HSCollapse.getInstance(`[data-hs-collapse="#${e}"]`,!0);t.on("beforeOpen",(()=>{if(!this.el)return!1;this.textareaSetHeight(3)}))}else if("overlay"===this.parentType()){const e=window.HSOverlay.getInstance(this.el.closest(".hs-overlay"),!0);e.element.on("open",(()=>{window.$hsTextareaAutoHeightCollection.filter((({element:t})=>t.el.closest(".hs-overlay")===e.element.el)).forEach((({element:e})=>e.textareaSetHeight(3)))}))}else{if("tabs"!==this.parentType())return!1;{const t=null===(e=this.el.closest('[role="tabpanel"]'))||void 0===e?void 0:e.id,i=document.querySelector(`[data-hs-tab="#${t}"]`).closest('[role="tablist"]'),{element:n}=window.HSTabs.getInstance(i,!0)||null;n.on("change",(e=>{const t=document.querySelectorAll(`${e.current} [data-hs-textarea-auto-height]`);if(!t.length)return!1;t.forEach((e=>{const t=window.HSTextareaAutoHeight.getInstance(e,!0)||null;t&&t.element.textareaSetHeight(3)}))}))}}}destroy(){this.el.removeEventListener("input",this.onElementInputListener),window.$hsTextareaAutoHeightCollection=window.$hsTextareaAutoHeightCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const i=window.$hsTextareaAutoHeightCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return i?t?i:i.element:null}static autoInit(){window.$hsTextareaAutoHeightCollection||(window.$hsTextareaAutoHeightCollection=[]),window.$hsTextareaAutoHeightCollection&&(window.$hsTextareaAutoHeightCollection=window.$hsTextareaAutoHeightCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-textarea-auto-height]:not(.--prevent-on-load-init)").forEach((e=>{if(!window.$hsTextareaAutoHeightCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))){const t=e.getAttribute("data-hs-textarea-auto-height"),i=t?JSON.parse(t):{};new l(e,i)}}))}}window.addEventListener("load",(()=>{l.autoInit()})),"undefined"!=typeof window&&(window.HSTextareaAutoHeight=l),t.default=l},961:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i;e.push({id:(null===(i=null==t?void 0:t.el)||void 0===i?void 0:i.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}}}},t={};var i=function i(n){var o=t[n];if(void 0!==o)return o.exports;var l=t[n]={exports:{}};return e[n].call(l.exports,l,l.exports,i),l.exports}(144);return i})()));
--------------------------------------------------------------------------------
/dist/textarea-auto-height.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,i)=>{i.d(t,{A:()=>n});class n{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i;e.push({id:(null===(i=null==t?void 0:t.el)||void 0===i?void 0:i.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}}}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var l=t[n]={exports:{}};return e[n](l,l.exports,i),l.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};i.d(n,{A:()=>s});var o=i(615);
2 | /*
3 | * HSTextareaAutoHeight
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */class l extends o.A{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-copy-markup"),n=i?JSON.parse(i):{},o=Object.assign(Object.assign({},n),t);this.defaultHeight=(null==o?void 0:o.defaultHeight)||0,this.init()}elementInput(){this.textareaSetHeight(3)}init(){this.createCollection(window.$hsTextareaAutoHeightCollection,this),this.setAutoHeight()}setAutoHeight(){this.isParentHidden()?this.callbackAccordingToType():this.textareaSetHeight(3),this.onElementInputListener=()=>this.elementInput(),this.el.addEventListener("input",this.onElementInputListener)}textareaSetHeight(e=0){this.el.style.height="auto",this.el.style.height=this.checkIfOneLine()&&this.defaultHeight?`${this.defaultHeight}px`:`${this.el.scrollHeight+e}px`}checkIfOneLine(){const e=this.el.clientHeight;return!(this.el.scrollHeight>e)}isParentHidden(){return this.el.closest(".hs-overlay.hidden")||this.el.closest('[role="tabpanel"].hidden')||this.el.closest(".hs-collapse.hidden")}parentType(){return this.el.closest(".hs-collapse")?"collapse":this.el.closest(".hs-overlay")?"overlay":!!this.el.closest('[role="tabpanel"]')&&"tabs"}callbackAccordingToType(){var e;if("collapse"===this.parentType()){const e=this.el.closest(".hs-collapse").id,{element:t}=window.HSCollapse.getInstance(`[data-hs-collapse="#${e}"]`,!0);t.on("beforeOpen",(()=>{if(!this.el)return!1;this.textareaSetHeight(3)}))}else if("overlay"===this.parentType()){const e=window.HSOverlay.getInstance(this.el.closest(".hs-overlay"),!0);e.element.on("open",(()=>{window.$hsTextareaAutoHeightCollection.filter((({element:t})=>t.el.closest(".hs-overlay")===e.element.el)).forEach((({element:e})=>e.textareaSetHeight(3)))}))}else{if("tabs"!==this.parentType())return!1;{const t=null===(e=this.el.closest('[role="tabpanel"]'))||void 0===e?void 0:e.id,i=document.querySelector(`[data-hs-tab="#${t}"]`).closest('[role="tablist"]'),{element:n}=window.HSTabs.getInstance(i,!0)||null;n.on("change",(e=>{const t=document.querySelectorAll(`${e.current} [data-hs-textarea-auto-height]`);if(!t.length)return!1;t.forEach((e=>{const t=window.HSTextareaAutoHeight.getInstance(e,!0)||null;t&&t.element.textareaSetHeight(3)}))}))}}}destroy(){this.el.removeEventListener("input",this.onElementInputListener),window.$hsTextareaAutoHeightCollection=window.$hsTextareaAutoHeightCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const i=window.$hsTextareaAutoHeightCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return i?t?i:i.element:null}static autoInit(){window.$hsTextareaAutoHeightCollection||(window.$hsTextareaAutoHeightCollection=[]),window.$hsTextareaAutoHeightCollection&&(window.$hsTextareaAutoHeightCollection=window.$hsTextareaAutoHeightCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-textarea-auto-height]:not(.--prevent-on-load-init)").forEach((e=>{if(!window.$hsTextareaAutoHeightCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))){const t=e.getAttribute("data-hs-textarea-auto-height"),i=t?JSON.parse(t):{};new l(e,i)}}))}}window.addEventListener("load",(()=>{l.autoInit()})),"undefined"!=typeof window&&(window.HSTextareaAutoHeight=l);const s=l;var a=n.A;export{a as default};
--------------------------------------------------------------------------------
/dist/theme-switch.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IThemeSwitchOptions {
20 | theme?: "dark" | "light" | "default";
21 | type?: "change" | "click";
22 | }
23 | export interface IThemeSwitch {
24 | options?: IThemeSwitchOptions;
25 | setAppearance(theme: string, isSaveToLocalStorage: boolean, isSetDispatchEvent: boolean): void;
26 | destroy(): void;
27 | }
28 | declare class HSThemeSwitch extends HSBasePlugin implements IThemeSwitch {
29 | theme: string;
30 | type: "change" | "click";
31 | private themeSet;
32 | private onElementChangeListener;
33 | private onElementClickListener;
34 | constructor(el: HTMLElement | HTMLInputElement, options?: IThemeSwitchOptions);
35 | private elementChange;
36 | private elementClick;
37 | private init;
38 | private buildSwitchTypeOfChange;
39 | private buildSwitchTypeOfClick;
40 | private setResetStyles;
41 | private addSystemThemeObserver;
42 | private removeSystemThemeObserver;
43 | private toggleObserveSystemTheme;
44 | setAppearance(theme?: string, isSaveToLocalStorage?: boolean, isSetDispatchEvent?: boolean): void;
45 | destroy(): void;
46 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
47 | static autoInit(): void;
48 | }
49 |
50 | export {
51 | HSThemeSwitch as default,
52 | };
53 |
54 | export {};
55 |
--------------------------------------------------------------------------------
/dist/theme-switch.js:
--------------------------------------------------------------------------------
1 | !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(self,(()=>(()=>{"use strict";var e={502:function(e,t,i){
2 | /*
3 | * HSThemeSwitch
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */
9 | var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(i(961));class o extends s.default{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-theme-switch"),n=i?JSON.parse(i):{},s=Object.assign(Object.assign({},n),t);this.theme=(null==s?void 0:s.theme)||localStorage.getItem("hs_theme")||"default",this.type=(null==s?void 0:s.type)||"change",this.themeSet=["light","dark","default"],this.init()}elementChange(e){const t=e.target.checked?"dark":"default";this.setAppearance(t),this.toggleObserveSystemTheme()}elementClick(e){this.setAppearance(e),this.toggleObserveSystemTheme()}init(){this.createCollection(window.$hsThemeSwitchCollection,this),"default"!==this.theme&&this.setAppearance(),"click"===this.type?this.buildSwitchTypeOfClick():this.buildSwitchTypeOfChange()}buildSwitchTypeOfChange(){this.el.checked="dark"===this.theme,this.toggleObserveSystemTheme(),this.onElementChangeListener=e=>this.elementChange(e),this.el.addEventListener("change",this.onElementChangeListener)}buildSwitchTypeOfClick(){const e=this.el.getAttribute("data-hs-theme-click-value");this.toggleObserveSystemTheme(),this.onElementClickListener=()=>this.elementClick(e),this.el.addEventListener("click",this.onElementClickListener)}setResetStyles(){const e=document.createElement("style");return e.innerText="*{transition: unset !important;}",e.setAttribute("data-hs-appearance-onload-styles",""),document.head.appendChild(e),e}addSystemThemeObserver(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{e?this.setAppearance("dark",!1):this.setAppearance("default",!1)}))}removeSystemThemeObserver(){window.matchMedia("(prefers-color-scheme: dark)").removeEventListener}toggleObserveSystemTheme(){"auto"===localStorage.getItem("hs_theme")?this.addSystemThemeObserver():this.removeSystemThemeObserver()}setAppearance(e=this.theme,t=!0,i=!0){const n=document.querySelector("html"),s=this.setResetStyles();t&&localStorage.setItem("hs_theme",e),"auto"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"default"),n.classList.remove("light","dark","default","auto"),n.classList.add(e),setTimeout((()=>s.remove())),i&&window.dispatchEvent(new CustomEvent("on-hs-appearance-change",{detail:e}))}destroy(){"change"===this.type&&this.el.removeEventListener("change",this.onElementChangeListener),"click"===this.type&&this.el.removeEventListener("click",this.onElementClickListener),window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const i=window.$hsThemeSwitchCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return i?t?i:i.element.el:null}static autoInit(){window.$hsThemeSwitchCollection||(window.$hsThemeSwitchCollection=[]),window.$hsThemeSwitchCollection&&(window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-theme-switch]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsThemeSwitchCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))||new o(e,{type:"change"})})),document.querySelectorAll("[data-hs-theme-click-value]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsThemeSwitchCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))||new o(e,{type:"click"})}))}}window.addEventListener("load",(()=>{o.autoInit()})),window.$hsThemeSwitchCollection&&window.addEventListener("on-hs-appearance-change",(e=>{window.$hsThemeSwitchCollection.forEach((t=>{t.element.el.checked="dark"===e.detail}))})),"undefined"!=typeof window&&(window.HSThemeSwitch=o),t.default=o},961:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i;e.push({id:(null===(i=null==t?void 0:t.el)||void 0===i?void 0:i.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}}}},t={};var i=function i(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(502);return i})()));
--------------------------------------------------------------------------------
/dist/theme-switch.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,i)=>{i.d(t,{A:()=>n});class n{constructor(e,t,i){this.el=e,this.options=t,this.events=i,this.el=e,this.options=t,this.events={}}createCollection(e,t){var i;e.push({id:(null===(i=null==t?void 0:t.el)||void 0===i?void 0:i.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}}}},t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var h=t[n]={exports:{}};return e[n](h,h.exports,i),h.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};i.d(n,{A:()=>o});var s=i(615);
2 | /*
3 | * HSThemeSwitch
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */class h extends s.A{constructor(e,t){super(e,t);const i=e.getAttribute("data-hs-theme-switch"),n=i?JSON.parse(i):{},s=Object.assign(Object.assign({},n),t);this.theme=(null==s?void 0:s.theme)||localStorage.getItem("hs_theme")||"default",this.type=(null==s?void 0:s.type)||"change",this.themeSet=["light","dark","default"],this.init()}elementChange(e){const t=e.target.checked?"dark":"default";this.setAppearance(t),this.toggleObserveSystemTheme()}elementClick(e){this.setAppearance(e),this.toggleObserveSystemTheme()}init(){this.createCollection(window.$hsThemeSwitchCollection,this),"default"!==this.theme&&this.setAppearance(),"click"===this.type?this.buildSwitchTypeOfClick():this.buildSwitchTypeOfChange()}buildSwitchTypeOfChange(){this.el.checked="dark"===this.theme,this.toggleObserveSystemTheme(),this.onElementChangeListener=e=>this.elementChange(e),this.el.addEventListener("change",this.onElementChangeListener)}buildSwitchTypeOfClick(){const e=this.el.getAttribute("data-hs-theme-click-value");this.toggleObserveSystemTheme(),this.onElementClickListener=()=>this.elementClick(e),this.el.addEventListener("click",this.onElementClickListener)}setResetStyles(){const e=document.createElement("style");return e.innerText="*{transition: unset !important;}",e.setAttribute("data-hs-appearance-onload-styles",""),document.head.appendChild(e),e}addSystemThemeObserver(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(({matches:e})=>{e?this.setAppearance("dark",!1):this.setAppearance("default",!1)}))}removeSystemThemeObserver(){window.matchMedia("(prefers-color-scheme: dark)").removeEventListener}toggleObserveSystemTheme(){"auto"===localStorage.getItem("hs_theme")?this.addSystemThemeObserver():this.removeSystemThemeObserver()}setAppearance(e=this.theme,t=!0,i=!0){const n=document.querySelector("html"),s=this.setResetStyles();t&&localStorage.setItem("hs_theme",e),"auto"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"default"),n.classList.remove("light","dark","default","auto"),n.classList.add(e),setTimeout((()=>s.remove())),i&&window.dispatchEvent(new CustomEvent("on-hs-appearance-change",{detail:e}))}destroy(){"change"===this.type&&this.el.removeEventListener("change",this.onElementChangeListener),"click"===this.type&&this.el.removeEventListener("click",this.onElementClickListener),window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const i=window.$hsThemeSwitchCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return i?t?i:i.element.el:null}static autoInit(){window.$hsThemeSwitchCollection||(window.$hsThemeSwitchCollection=[]),window.$hsThemeSwitchCollection&&(window.$hsThemeSwitchCollection=window.$hsThemeSwitchCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-theme-switch]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsThemeSwitchCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))||new h(e,{type:"change"})})),document.querySelectorAll("[data-hs-theme-click-value]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsThemeSwitchCollection.find((t=>{var i;return(null===(i=null==t?void 0:t.element)||void 0===i?void 0:i.el)===e}))||new h(e,{type:"click"})}))}}window.addEventListener("load",(()=>{h.autoInit()})),window.$hsThemeSwitchCollection&&window.addEventListener("on-hs-appearance-change",(e=>{window.$hsThemeSwitchCollection.forEach((t=>{t.element.el.checked="dark"===e.detail}))})),"undefined"!=typeof window&&(window.HSThemeSwitch=h);const o=h;var l=n.A;export{l as default};
--------------------------------------------------------------------------------
/dist/toggle-count.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface IToggleCountOptions {
20 | target: string | HTMLInputElement;
21 | min: number;
22 | max: number;
23 | duration: number;
24 | }
25 | export interface IToggleCount {
26 | options?: IToggleCountOptions;
27 | countUp(): void;
28 | countDown(): void;
29 | destroy(): void;
30 | }
31 | declare class HSToggleCount extends HSBasePlugin implements IToggleCount {
32 | private readonly target;
33 | private readonly min;
34 | private readonly max;
35 | private readonly duration;
36 | private isChecked;
37 | private onToggleChangeListener;
38 | constructor(el: HTMLElement, options?: IToggleCountOptions);
39 | private toggleChange;
40 | private init;
41 | private toggle;
42 | private animate;
43 | countUp(): void;
44 | countDown(): void;
45 | destroy(): void;
46 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSToggleCount | ICollectionItem;
47 | static autoInit(): void;
48 | }
49 |
50 | export {
51 | HSToggleCount as default,
52 | };
53 |
54 | export {};
55 |
--------------------------------------------------------------------------------
/dist/toggle-count.js:
--------------------------------------------------------------------------------
1 | !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(self,(()=>(()=>{"use strict";var t={684:function(t,e,n){
2 | /*
3 | * HSToggleCount
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */
9 | var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=o(n(961));class s extends i.default{constructor(t,e){super(t,e);const n=t.getAttribute("data-hs-toggle-count"),o=n?JSON.parse(n):{},i=Object.assign(Object.assign({},o),e);this.target=(null==i?void 0:i.target)?"string"==typeof(null==i?void 0:i.target)?document.querySelector(i.target):i.target:null,this.min=(null==i?void 0:i.min)||0,this.max=(null==i?void 0:i.max)||0,this.duration=(null==i?void 0:i.duration)||700,this.isChecked=this.target.checked||!1,this.target&&this.init()}toggleChange(){this.isChecked=!this.isChecked,this.toggle()}init(){this.createCollection(window.$hsToggleCountCollection,this),this.isChecked&&(this.el.innerText=String(this.max)),this.onToggleChangeListener=()=>this.toggleChange(),this.target.addEventListener("change",this.onToggleChangeListener)}toggle(){this.isChecked?this.countUp():this.countDown()}animate(t,e){let n=0;const o=i=>{n||(n=i);const s=Math.min((i-n)/this.duration,1);this.el.innerText=String(Math.floor(s*(e-t)+t)),s<1&&window.requestAnimationFrame(o)};window.requestAnimationFrame(o)}countUp(){this.animate(this.min,this.max)}countDown(){this.animate(this.max,this.min)}destroy(){this.target.removeEventListener("change",this.onToggleChangeListener),window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter((({element:t})=>t.el!==this.el))}static getInstance(t,e){const n=window.$hsToggleCountCollection.find((e=>e.element.el===("string"==typeof t?document.querySelector(t):t)));return n?e?n:n.element:null}static autoInit(){window.$hsToggleCountCollection||(window.$hsToggleCountCollection=[]),window.$hsToggleCountCollection&&(window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter((({element:t})=>document.contains(t.el)))),document.querySelectorAll("[data-hs-toggle-count]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsToggleCountCollection.find((e=>{var n;return(null===(n=null==e?void 0:e.element)||void 0===n?void 0:n.el)===t}))||new s(t)}))}}window.addEventListener("load",(()=>{s.autoInit()})),"undefined"!=typeof window&&(window.HSToggleCount=s),e.default=s},961:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(t,e,n){this.el=t,this.options=e,this.events=n,this.el=t,this.options=e,this.events={}}createCollection(t,e){var n;t.push({id:(null===(n=null==e?void 0:e.el)||void 0===n?void 0:n.id)||t.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}}},e={};var n=function n(o){var i=e[o];if(void 0!==i)return i.exports;var s=e[o]={exports:{}};return t[o].call(s.exports,s,s.exports,n),s.exports}(684);return n})()));
--------------------------------------------------------------------------------
/dist/toggle-count.mjs:
--------------------------------------------------------------------------------
1 | var t={615:(t,e,n)=>{n.d(e,{A:()=>o});class o{constructor(t,e,n){this.el=t,this.options=e,this.events=n,this.el=t,this.options=e,this.events={}}createCollection(t,e){var n;t.push({id:(null===(n=null==e?void 0:e.el)||void 0===n?void 0:n.id)||t.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var s=e[o]={exports:{}};return t[o](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};n.d(o,{A:()=>l});var i=n(615);
2 | /*
3 | * HSToggleCount
4 | * @version: 3.0.1
5 | * @author: Preline Labs Ltd.
6 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
7 | * Copyright 2024 Preline Labs Ltd.
8 | */class s extends i.A{constructor(t,e){super(t,e);const n=t.getAttribute("data-hs-toggle-count"),o=n?JSON.parse(n):{},i=Object.assign(Object.assign({},o),e);this.target=(null==i?void 0:i.target)?"string"==typeof(null==i?void 0:i.target)?document.querySelector(i.target):i.target:null,this.min=(null==i?void 0:i.min)||0,this.max=(null==i?void 0:i.max)||0,this.duration=(null==i?void 0:i.duration)||700,this.isChecked=this.target.checked||!1,this.target&&this.init()}toggleChange(){this.isChecked=!this.isChecked,this.toggle()}init(){this.createCollection(window.$hsToggleCountCollection,this),this.isChecked&&(this.el.innerText=String(this.max)),this.onToggleChangeListener=()=>this.toggleChange(),this.target.addEventListener("change",this.onToggleChangeListener)}toggle(){this.isChecked?this.countUp():this.countDown()}animate(t,e){let n=0;const o=i=>{n||(n=i);const s=Math.min((i-n)/this.duration,1);this.el.innerText=String(Math.floor(s*(e-t)+t)),s<1&&window.requestAnimationFrame(o)};window.requestAnimationFrame(o)}countUp(){this.animate(this.min,this.max)}countDown(){this.animate(this.max,this.min)}destroy(){this.target.removeEventListener("change",this.onToggleChangeListener),window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter((({element:t})=>t.el!==this.el))}static getInstance(t,e){const n=window.$hsToggleCountCollection.find((e=>e.element.el===("string"==typeof t?document.querySelector(t):t)));return n?e?n:n.element:null}static autoInit(){window.$hsToggleCountCollection||(window.$hsToggleCountCollection=[]),window.$hsToggleCountCollection&&(window.$hsToggleCountCollection=window.$hsToggleCountCollection.filter((({element:t})=>document.contains(t.el)))),document.querySelectorAll("[data-hs-toggle-count]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsToggleCountCollection.find((e=>{var n;return(null===(n=null==e?void 0:e.element)||void 0===n?void 0:n.el)===t}))||new s(t)}))}}window.addEventListener("load",(()=>{s.autoInit()})),"undefined"!=typeof window&&(window.HSToggleCount=s);const l=s;var r=o.A;export{r as default};
--------------------------------------------------------------------------------
/dist/toggle-password.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ITogglePasswordOptions {
20 | target: string | string[] | HTMLInputElement | HTMLInputElement[];
21 | }
22 | export interface ITogglePassword {
23 | options?: ITogglePasswordOptions;
24 | show(): void;
25 | hide(): void;
26 | destroy(): void;
27 | }
28 | declare class HSTogglePassword extends HSBasePlugin implements ITogglePassword {
29 | private readonly target;
30 | private isShown;
31 | private isMultiple;
32 | private eventType;
33 | private onElementActionListener;
34 | constructor(el: HTMLElement, options?: ITogglePasswordOptions);
35 | private elementAction;
36 | private init;
37 | private getMultipleToggles;
38 | show(): void;
39 | hide(): void;
40 | destroy(): void;
41 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HSTogglePassword | ICollectionItem;
42 | static autoInit(): void;
43 | }
44 |
45 | export {
46 | HSTogglePassword as default,
47 | };
48 |
49 | export {};
50 |
--------------------------------------------------------------------------------
/dist/toggle-password.mjs:
--------------------------------------------------------------------------------
1 | var e={615:(e,t,s)=>{s.d(t,{A:()=>o});class o{constructor(e,t,s){this.el=e,this.options=t,this.events=s,this.el=e,this.options=t,this.events={}}createCollection(e,t){var s;e.push({id:(null===(s=null==t?void 0:t.el)||void 0===s?void 0:s.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,s)=>{s.d(t,{JD:()=>i,V6:()=>o});
2 | /*
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 | const o=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,i=(e,t,s=null)=>{const o=new CustomEvent(e,{detail:{payload:s},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(o)}}},t={};function s(o){var i=t[o];if(void 0!==i)return i.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,s),l.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};s.d(o,{A:()=>r});var i=s(926),l=s(615);
9 | /*
10 | * HSTogglePassword
11 | * @version: 3.0.1
12 | * @author: Preline Labs Ltd.
13 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14 | * Copyright 2024 Preline Labs Ltd.
15 | */
16 | class n extends l.A{constructor(e,t){super(e,t);const s=e.getAttribute("data-hs-toggle-password"),o=s?JSON.parse(s):{},l=Object.assign(Object.assign({},o),t),n=[];if((null==l?void 0:l.target)&&"string"==typeof(null==l?void 0:l.target)){(null==l?void 0:l.target.split(",")).forEach((e=>{n.push(document.querySelector(e))}))}else(null==l?void 0:l.target)&&"object"==typeof(null==l?void 0:l.target)?l.target.forEach((e=>n.push(document.querySelector(e)))):l.target.forEach((e=>n.push(e)));this.target=n,this.isShown=!!this.el.hasAttribute("type")&&this.el.checked,this.eventType=(0,i.V6)(this.el)?"change":"click",this.isMultiple=this.target.length>1&&!!this.el.closest("[data-hs-toggle-password-group]"),this.target&&this.init()}elementAction(){this.isShown?this.hide():this.show(),this.fireEvent("toggle",this.target),(0,i.JD)("toggle.hs.toggle-select",this.el,this.target)}init(){this.createCollection(window.$hsTogglePasswordCollection,this),this.isShown?this.show():this.hide(),this.onElementActionListener=()=>this.elementAction(),this.el.addEventListener(this.eventType,this.onElementActionListener)}getMultipleToggles(){const e=this.el.closest("[data-hs-toggle-password-group]").querySelectorAll("[data-hs-toggle-password]"),t=[];return e.forEach((e=>{t.push(n.getInstance(e))})),t}show(){if(this.isMultiple){this.getMultipleToggles().forEach((e=>!!e&&(e.isShown=!0))),this.el.closest("[data-hs-toggle-password-group]").classList.add("active")}else this.isShown=!0,this.el.classList.add("active");this.target.forEach((e=>{e.type="text"}))}hide(){if(this.isMultiple){this.getMultipleToggles().forEach((e=>!!e&&(e.isShown=!1))),this.el.closest("[data-hs-toggle-password-group]").classList.remove("active")}else this.isShown=!1,this.el.classList.remove("active");this.target.forEach((e=>{e.type="password"}))}destroy(){this.isMultiple?this.el.closest("[data-hs-toggle-password-group]").classList.remove("active"):this.el.classList.remove("active"),this.target.forEach((e=>{e.type="password"})),this.el.removeEventListener(this.eventType,this.onElementActionListener),this.isShown=!1,window.$hsTogglePasswordCollection=window.$hsTogglePasswordCollection.filter((({element:e})=>e.el!==this.el))}static getInstance(e,t){const s=window.$hsTogglePasswordCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return s?t?s:s.element:null}static autoInit(){window.$hsTogglePasswordCollection||(window.$hsTogglePasswordCollection=[]),window.$hsTogglePasswordCollection&&(window.$hsTogglePasswordCollection=window.$hsTogglePasswordCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll("[data-hs-toggle-password]:not(.--prevent-on-load-init)").forEach((e=>{window.$hsTogglePasswordCollection.find((t=>{var s;return(null===(s=null==t?void 0:t.element)||void 0===s?void 0:s.el)===e}))||new n(e)}))}}window.addEventListener("load",(()=>{n.autoInit()})),"undefined"!=typeof window&&(window.HSTogglePassword=n);const r=n;var a=o.A;export{a as default};
--------------------------------------------------------------------------------
/dist/tooltip.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export interface ITooltip {
20 | options?: {};
21 | show(): void;
22 | hide(): void;
23 | destroy(): void;
24 | }
25 | declare class HSTooltip extends HSBasePlugin<{}> implements ITooltip {
26 | private readonly toggle;
27 | content: HTMLElement | null;
28 | readonly eventMode: string;
29 | private readonly preventFloatingUI;
30 | private readonly placement;
31 | private readonly strategy;
32 | private readonly scope;
33 | cleanupAutoUpdate: (() => void) | null;
34 | private onToggleClickListener;
35 | private onToggleFocusListener;
36 | private onToggleMouseEnterListener;
37 | private onToggleMouseLeaveListener;
38 | private onToggleHandleListener;
39 | constructor(el: HTMLElement, options?: {}, events?: {});
40 | private toggleClick;
41 | private toggleFocus;
42 | private toggleMouseEnter;
43 | private toggleMouseLeave;
44 | private toggleHandle;
45 | private init;
46 | private enter;
47 | private leave;
48 | private click;
49 | private focus;
50 | private buildFloatingUI;
51 | private _show;
52 | show(): void;
53 | hide(): void;
54 | destroy(): void;
55 | private static findInCollection;
56 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
57 | static autoInit(): void;
58 | static show(target: HSTooltip | HTMLElement | string): void;
59 | static hide(target: HSTooltip | HTMLElement | string): void;
60 | static on(evt: string, target: HSTooltip | HTMLElement | string, cb: Function): void;
61 | }
62 |
63 | export {
64 | HSTooltip as default,
65 | };
66 |
67 | export {};
68 |
--------------------------------------------------------------------------------
/dist/tree-view.d.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
6 | declare class HSBasePlugin implements IBasePlugin {
7 | el: E;
8 | options: O;
9 | events?: any;
10 | constructor(el: E, options: O, events?: any);
11 | createCollection(collection: any[], element: any): void;
12 | fireEvent(evt: string, payload?: any): any;
13 | on(evt: string, cb: Function): void;
14 | }
15 | export interface ICollectionItem {
16 | id: string | number;
17 | element: T;
18 | }
19 | export type ITreeViewOptionsControlBy = "checkbox" | "button";
20 | export interface ITreeViewItem {
21 | id: string;
22 | value: string;
23 | isDir: boolean;
24 | path: string;
25 | isSelected?: boolean;
26 | }
27 | export interface ITreeViewOptions {
28 | items: ITreeViewItem[] | null;
29 | controlBy?: ITreeViewOptionsControlBy;
30 | autoSelectChildren?: boolean;
31 | isIndeterminate?: boolean;
32 | }
33 | export interface ITreeView {
34 | options?: ITreeViewOptions;
35 | update(): void;
36 | getSelectedItems(): ITreeViewItem[];
37 | changeItemProp(id: string, prop: string, val: any): void;
38 | destroy(): void;
39 | }
40 | declare class HSTreeView extends HSBasePlugin implements ITreeView {
41 | private items;
42 | private readonly controlBy;
43 | private readonly autoSelectChildren;
44 | private readonly isIndeterminate;
45 | static group: number;
46 | private onElementClickListener;
47 | private onControlChangeListener;
48 | constructor(el: HTMLElement, options?: ITreeViewOptions, events?: {});
49 | private elementClick;
50 | private controlChange;
51 | private init;
52 | private initItems;
53 | private controlByButton;
54 | private controlByCheckbox;
55 | private getItem;
56 | private getPath;
57 | private unselectItem;
58 | private selectItem;
59 | private selectChildren;
60 | private toggleParent;
61 | update(): void;
62 | getSelectedItems(): ITreeViewItem[];
63 | changeItemProp(id: string, prop: string, val: any): void;
64 | destroy(): void;
65 | private static findInCollection;
66 | static getInstance(target: HTMLElement | string, isInstance?: boolean): HTMLElement | ICollectionItem;
67 | static autoInit(): void;
68 | static on(evt: string, target: HSTreeView | HTMLElement | string, cb: Function): void;
69 | }
70 |
71 | export {
72 | HSTreeView as default,
73 | };
74 |
75 | export {};
76 |
--------------------------------------------------------------------------------
/dts-config.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | const pluginsDir = './src/plugins';
4 | const helpersDir = './src/helpers';
5 | const distDir = './dist';
6 | const excludePlugins = ['base-plugin', 'docs-scrollspy'];
7 |
8 | const outputConfig = { noBanner: true };
9 |
10 | const config = {
11 | compilationOptions: {
12 | preferredConfigPath: './tsconfig.json',
13 | },
14 | entries: [
15 | {
16 | filePath: './src/index.ts',
17 | outFile: './dist/index.d.ts',
18 | output: outputConfig,
19 | },
20 | ...fs
21 | .readdirSync(pluginsDir)
22 | .map((pluginName) => writeFile(pluginsDir, pluginName))
23 | .filter(Boolean),
24 | ...fs
25 | .readdirSync(helpersDir)
26 | .map((pluginName) => writeFile(helpersDir, pluginName, 'helper-'))
27 | .filter(Boolean),
28 | ],
29 | };
30 |
31 | function writeFile(dir, plugin, prefix = '') {
32 | if (
33 | !fs.lstatSync(`${dir}/${plugin}`).isDirectory() ||
34 | excludePlugins.includes(plugin)
35 | ) {
36 | return null;
37 | }
38 |
39 | return {
40 | filePath: `${dir}/${plugin}/index.ts`,
41 | outFile: `${distDir}/${prefix}${plugin}.d.ts`,
42 | output: outputConfig,
43 | };
44 | }
45 |
46 | module.exports = config;
47 |
--------------------------------------------------------------------------------
/global.d.ts:
--------------------------------------------------------------------------------
1 | import type INoUiSlider from 'nouislider';
2 |
3 | import { ICollectionItem } from './src/interfaces';
4 |
5 | import { IStaticMethods } from './src/static/interfaces';
6 |
7 | import type HSCopyMarkup from './src/plugins/copy-markup';
8 | import type HSAccordion from './src/plugins/accordion';
9 | import type HSCarousel from './src/plugins/carousel';
10 | import type HSCollapse from './src/plugins/collapse';
11 | import type HSComboBox from './src/plugins/combobox';
12 | import type HSDataTable from './src/plugins/datatable';
13 | import type HSDropdown from './src/plugins/dropdown';
14 | import type HSFileUpload from './src/plugins/file-upload';
15 | import type HSInputNumber from './src/plugins/input-number';
16 | import type HSLayoutSplitter from './src/plugins/layout-splitter';
17 | import type HSOverlay from './src/plugins/overlay';
18 | import type HSPinInput from './src/plugins/pin-input';
19 | import type HSRangeSlider from './src/plugins/range-slider';
20 | import type HSRemoveElement from './src/plugins/remove-element';
21 | import type HSScrollNav from './src/plugins/scroll-nav';
22 | import type HSScrollspy from './src/plugins/scrollspy';
23 | import type HSSelect from './src/plugins/select';
24 | import type HSStepper from './src/plugins/stepper';
25 | import type HSStrongPassword from './src/plugins/strong-password';
26 | import type HSTabs from './src/plugins/tabs';
27 | import type HSTextareaAutoHeight from './src/plugins/textarea-auto-height';
28 | import type HSThemeSwitch from './src/plugins/theme-switch';
29 | import type HSToggleCount from './src/plugins/toggle-count';
30 | import type HSTogglePassword from './src/plugins/toggle-password';
31 | import type HSTooltip from './src/plugins/tooltip';
32 | import type HSTreeView from './src/plugins/tree-view';
33 |
34 | declare global {
35 | var noUiSlider: typeof INoUiSlider;
36 | var FloatingUIDOM: {
37 | computePosition: (
38 | reference: Element,
39 | floating: HTMLElement,
40 | options?: any
41 | ) => Promise<{ x: number; y: number; placement: string }>;
42 | autoUpdate: (
43 | reference: Element,
44 | floating: HTMLElement,
45 | update: () => void,
46 | ) => () => void;
47 | offset: (offset: number | [number, number]) => any;
48 | flip: () => any;
49 | };
50 |
51 | interface Window {
52 | HS_CLIPBOARD_SELECTOR: string;
53 |
54 | HSStaticMethods: IStaticMethods;
55 |
56 | $hsCopyMarkupCollection: ICollectionItem[];
57 | $hsAccordionCollection: ICollectionItem[];
58 | $hsCarouselCollection: ICollectionItem[];
59 | $hsCollapseCollection: ICollectionItem[];
60 | $hsComboBoxCollection: ICollectionItem[];
61 | $hsDataTableCollection: ICollectionItem[];
62 | $hsDropdownCollection: ICollectionItem[];
63 | $hsFileUploadCollection: ICollectionItem[];
64 | $hsInputNumberCollection: { id: number; element: HSInputNumber }[];
65 | $hsLayoutSplitterCollection: ICollectionItem[];
66 | $hsOverlayCollection: ICollectionItem[];
67 | $hsPinInputCollection: ICollectionItem[];
68 | $hsRemoveElementCollection: ICollectionItem[];
69 | $hsRangeSliderCollection: ICollectionItem[];
70 | $hsScrollNavCollection: ICollectionItem[];
71 | $hsScrollspyCollection: ICollectionItem[];
72 | $hsSelectCollection: ICollectionItem[];
73 | $hsStepperCollection: ICollectionItem[];
74 | $hsStrongPasswordCollection: ICollectionItem[];
75 | $hsTabsCollection: ICollectionItem[];
76 | $hsTextareaAutoHeightCollection: ICollectionItem[];
77 | $hsThemeSwitchCollection: ICollectionItem[];
78 | $hsToggleCountCollection: ICollectionItem[];
79 | $hsTogglePasswordCollection: ICollectionItem[];
80 | $hsTooltipCollection: ICollectionItem[];
81 | $hsTreeViewCollection: ICollectionItem[];
82 | }
83 | }
84 |
85 | export { };
86 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "preline",
3 | "version": "3.0.1",
4 | "description": "Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.",
5 | "main": "index.js",
6 | "module": "./src/index.ts",
7 | "repository": "https://github.com/htmlstreamofficial/preline.git",
8 | "homepage": "https://preline.co",
9 | "keywords": [
10 | "preline",
11 | "html",
12 | "css",
13 | "javascript",
14 | "typescript",
15 | "tailwind",
16 | "tailwind examples",
17 | "tailwind components",
18 | "tailwind components library",
19 | "tailwind elements",
20 | "tailwind library",
21 | "tailwind sections",
22 | "tailwind css",
23 | "tailwind ui",
24 | "tailwind css react",
25 | "tailwind css next",
26 | "tailwind css nextjs",
27 | "tailwind css vue",
28 | "tailwind css nuxtjs",
29 | "tailwind css angular",
30 | "tailwind css astro",
31 | "tailwind css solidjs",
32 | "tailwind css qwik",
33 | "tailwind css svelte",
34 | "tailwind css remix",
35 | "tailwind css laravel"
36 | ],
37 | "author": "Preline Labs Ltd.",
38 | "license": "Licensed under MIT and Preline UI Fair Use License",
39 | "publishConfig": {
40 | "access": "public"
41 | },
42 | "scripts": {
43 | "watch": "webpack --config webpack.config.js --watch",
44 | "watch:mjs": "webpack --config webpack.config.mjs.js --watch",
45 | "build": "webpack --config webpack.config.js",
46 | "build:mjs": "webpack --config webpack.config.mjs.js",
47 | "pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\"",
48 | "generate-dts": "dts-bundle-generator --config dts-config.js"
49 | },
50 | "dependencies": {
51 | "@floating-ui/dom": "^1.6.13"
52 | },
53 | "devDependencies": {
54 | "@types/clipboard": "^2.0.7",
55 | "@types/dropzone": "^5.7.8",
56 | "@types/jquery": "^3.5.30",
57 | "@types/lodash": "^4.17.6",
58 | "@types/nouislider": "^15.0.0",
59 | "@types/prismjs": "^1.26.4",
60 | "@types/vinyl": "^2.0.12",
61 | "dts-bundle-generator": "^9.0.0",
62 | "prettier": "^3.0.1",
63 | "source-map-loader": "^4.0.1",
64 | "terser-webpack-plugin": "^5.3.9",
65 | "ts-loader": "^9.5.1",
66 | "typescript": "^5.5.3",
67 | "webpack-cli": "^5.0.1"
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/prettier.config.js:
--------------------------------------------------------------------------------
1 | const config = {
2 | useTabs: true,
3 | singleQuote: true,
4 | bracketSameLine: true,
5 | arrowParens: 'always',
6 | };
7 |
8 | module.exports = config;
9 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | export const POSITIONS: any = {
2 | auto: 'auto',
3 | 'auto-start': 'auto-start',
4 | 'auto-end': 'auto-end',
5 | top: 'top',
6 | 'top-left': 'top-start',
7 | 'top-right': 'top-end',
8 | bottom: 'bottom',
9 | 'bottom-left': 'bottom-start',
10 | 'bottom-right': 'bottom-end',
11 | right: 'right',
12 | 'right-start': 'right-start',
13 | 'right-end': 'right-end',
14 | left: 'left',
15 | 'left-start': 'left-start',
16 | 'left-end': 'left-end',
17 | };
18 |
19 | export const DROPDOWN_ACCESSIBILITY_KEY_SET = [
20 | 'Escape',
21 | 'ArrowUp',
22 | 'ArrowDown',
23 | 'ArrowRight',
24 | 'ArrowLeft',
25 | 'Home',
26 | 'End',
27 | 'Enter',
28 | ];
29 |
30 | export const OVERLAY_ACCESSIBILITY_KEY_SET = ['Escape', 'Tab'];
31 |
32 | export const TABS_ACCESSIBILITY_KEY_SET = [
33 | 'ArrowUp',
34 | 'ArrowLeft',
35 | 'ArrowDown',
36 | 'ArrowRight',
37 | 'Home',
38 | 'End',
39 | ];
40 |
41 | export const SELECT_ACCESSIBILITY_KEY_SET = [
42 | 'ArrowUp',
43 | 'ArrowLeft',
44 | 'ArrowDown',
45 | 'ArrowRight',
46 | 'Home',
47 | 'End',
48 | 'Escape',
49 | 'Enter',
50 | 'Space',
51 | 'Tab',
52 | ];
53 |
54 | export const COMBO_BOX_ACCESSIBILITY_KEY_SET = [
55 | 'ArrowUp',
56 | 'ArrowLeft',
57 | 'ArrowDown',
58 | 'ArrowRight',
59 | 'Home',
60 | 'End',
61 | 'Escape',
62 | 'Enter',
63 | ];
64 |
65 | export const BREAKPOINTS: any = {
66 | xs: 0,
67 | sm: 640,
68 | md: 768,
69 | lg: 1024,
70 | xl: 1280,
71 | '2xl': 1536,
72 | };
--------------------------------------------------------------------------------
/src/helpers/apexcharts/interfaces.ts:
--------------------------------------------------------------------------------
1 | import { ApexOptions } from 'apexcharts';
2 |
3 | export interface IBuildTooltipHelperOptions {
4 | title: string;
5 | mode: string;
6 | valuePrefix: string;
7 | isValueDivided: boolean;
8 | valuePostfix: string;
9 | hasTextLabel: boolean;
10 | invertGroup: boolean;
11 | labelDivider: string;
12 | wrapperClasses: string;
13 | wrapperExtClasses: string;
14 | seriesClasses: string;
15 | seriesExtClasses: string;
16 | titleClasses: string;
17 | titleExtClasses: string;
18 | markerClasses: string;
19 | markerExtClasses: string;
20 | valueClasses: string;
21 | valueExtClasses: string;
22 | labelClasses: string;
23 | labelExtClasses: string;
24 | hasCategory?: boolean;
25 | }
26 |
27 | export interface IChartProps {
28 | dataPointIndex: number;
29 | ctx: {
30 | opts: ApexOptions;
31 | };
32 | series: [][];
33 | }
34 |
35 | export interface IChartPropsSeries {
36 | name: string;
37 | altValue?: string;
38 | data: number[];
39 | }
40 |
41 | export interface IChartDonutProps {
42 | series: IChartPropsSeries[];
43 | seriesIndex: number;
44 | w: {
45 | globals: ApexOptions;
46 | };
47 | }
48 |
--------------------------------------------------------------------------------
/src/helpers/clipboard/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * @version: 3.0.1
3 | * @author: Preline Labs Ltd.
4 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
5 | * Copyright 2024 Preline Labs Ltd.
6 | */
7 |
8 | declare var ClipboardJS: any;
9 |
10 | const clipboardSelector = window?.HS_CLIPBOARD_SELECTOR ?? '.js-clipboard';
11 |
12 | window.addEventListener('load', () => {
13 | const $clipboards = document.querySelectorAll(clipboardSelector);
14 |
15 | $clipboards.forEach((el: HTMLElement) => {
16 | const clipboard = new ClipboardJS(el, {
17 | text: (
18 | trigger: HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement,
19 | ) => {
20 | const clipboardText = trigger.dataset.clipboardText;
21 |
22 | if (clipboardText) return clipboardText;
23 |
24 | const clipboardTarget = trigger.dataset.clipboardTarget;
25 | const $element:
26 | | HTMLSelectElement
27 | | HTMLInputElement
28 | | HTMLTextAreaElement = document.querySelector(clipboardTarget);
29 |
30 | if (
31 | $element.tagName === 'SELECT' ||
32 | $element.tagName === 'INPUT' ||
33 | $element.tagName === 'TEXTAREA'
34 | )
35 | return $element.value;
36 | else return $element.textContent;
37 | },
38 | });
39 | clipboard.on('success', () => {
40 | const $default: HTMLElement = el.querySelector('.js-clipboard-default');
41 | const $success: HTMLElement = el.querySelector('.js-clipboard-success');
42 | const $successText = el.querySelector('.js-clipboard-success-text');
43 | const successText = el.dataset.clipboardSuccessText || '';
44 | const tooltip = el.closest('.hs-tooltip');
45 | let oldSuccessText: string;
46 |
47 | if ($successText) {
48 | oldSuccessText = $successText.textContent;
49 | $successText.textContent = successText;
50 | }
51 | if ($default && $success) {
52 | $default.style.display = 'none';
53 | $success.style.display = 'block';
54 | }
55 | if (tooltip) (window.HSTooltip as any).show(tooltip);
56 |
57 | setTimeout(function () {
58 | if ($successText && oldSuccessText)
59 | $successText.textContent = oldSuccessText;
60 | if (tooltip) (window.HSTooltip as any).hide(tooltip);
61 | if ($default && $success) {
62 | $success.style.display = '';
63 | $default.style.display = '';
64 | }
65 | }, 800);
66 | });
67 | });
68 | });
69 |
70 | export {};
71 |
--------------------------------------------------------------------------------
/src/helpers/types.ts:
--------------------------------------------------------------------------------
1 | export type EventProps = {
2 | detail: string;
3 | };
4 |
5 | export type OptionProps = {
6 | options: {
7 | toggleLight: string;
8 | isDark: boolean;
9 | };
10 | };
11 |
12 | export type EventWithProps = Event & EventProps;
13 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * @version: 3.0.1
3 | * @author: Preline Labs Ltd.
4 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
5 | * Copyright 2024 Preline Labs Ltd.
6 | */
7 |
8 | declare var _: any;
9 | declare var DataTable: any;
10 | declare var Dropzone: any;
11 | declare var noUiSlider: any;
12 | declare var VanillaCalendarPro: any;
13 |
14 | let HSDataTableModule;
15 | let HSFileUploadModule;
16 | let HSRangeSliderModule;
17 | let HSDatepickerModule;
18 |
19 | export { default as HSCopyMarkup } from "./plugins/copy-markup";
20 | export { default as HSAccordion } from "./plugins/accordion";
21 | export { default as HSCarousel } from "./plugins/carousel";
22 | export { default as HSCollapse } from "./plugins/collapse";
23 | export { default as HSComboBox } from "./plugins/combobox";
24 | export { default as HSDropdown } from "./plugins/dropdown";
25 | export { default as HSInputNumber } from "./plugins/input-number";
26 | export { default as HSLayoutSplitter } from "./plugins/layout-splitter";
27 | export { default as HSOverlay } from "./plugins/overlay";
28 | export { default as HSPinInput } from "./plugins/pin-input";
29 | export { default as HSRemoveElement } from "./plugins/remove-element";
30 | export { default as HSScrollNav } from "./plugins/scroll-nav";
31 | export { default as HSScrollspy } from "./plugins/scrollspy";
32 | export { default as HSSelect } from "./plugins/select";
33 | export { default as HSStepper } from "./plugins/stepper";
34 | export { default as HSStrongPassword } from "./plugins/strong-password";
35 | export { default as HSTabs } from "./plugins/tabs";
36 | export { default as HSTextareaAutoHeight } from "./plugins/textarea-auto-height";
37 | export { default as HSThemeSwitch } from "./plugins/theme-switch";
38 | export { default as HSToggleCount } from "./plugins/toggle-count";
39 | export { default as HSTogglePassword } from "./plugins/toggle-password";
40 | export { default as HSTooltip } from "./plugins/tooltip";
41 | export { default as HSTreeView } from "./plugins/tree-view";
42 | export { default as HSStaticMethods } from "./static";
43 |
44 | if (typeof window !== "undefined") {
45 | try {
46 | if (typeof DataTable !== "undefined" && typeof jQuery !== "undefined") {
47 | HSDataTableModule = require("./plugins/datatable").default;
48 | }
49 | } catch (e) {
50 | console.warn("HSDataTable: Required dependencies not found");
51 | HSDataTableModule = null;
52 | }
53 |
54 | try {
55 | if (typeof _ !== "undefined" && typeof Dropzone !== "undefined") {
56 | HSFileUploadModule = require("./plugins/file-upload").default;
57 | }
58 | } catch (e) {
59 | console.warn("HSFileUpload: Required dependencies not found");
60 | HSFileUploadModule = null;
61 | }
62 |
63 | try {
64 | if (typeof noUiSlider !== "undefined") {
65 | HSRangeSliderModule = require("./plugins/range-slider").default;
66 | }
67 | } catch (e) {
68 | console.warn("HSRangeSlider: Required dependencies not found");
69 | HSRangeSliderModule = null;
70 | }
71 |
72 | try {
73 | if (typeof VanillaCalendarPro !== "undefined") {
74 | HSDatepickerModule = require("./plugins/datepicker").default;
75 | }
76 | } catch (e) {
77 | console.warn("HSDatepicker: Required dependencies not found");
78 | HSDatepickerModule = null;
79 | }
80 | }
81 |
82 | export { HSDataTableModule as HSDataTable };
83 | export { HSFileUploadModule as HSFileUpload };
84 | export { HSRangeSliderModule as HSRangeSlider };
85 | export { HSDatepickerModule as HSDatepicker };
86 |
--------------------------------------------------------------------------------
/src/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ICollectionItem {
2 | id: string | number;
3 | element: T;
4 | }
5 |
--------------------------------------------------------------------------------
/src/plugins/accordion/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IAccordionTreeViewStaticOptions {}
2 |
3 | export interface IAccordionTreeView {
4 | el: HTMLElement | null;
5 | options?: IAccordionTreeViewStaticOptions;
6 | listeners?: { el: HTMLElement; listener: (evt: Event) => void }[];
7 | }
8 |
9 | export interface IAccordionOptions {}
10 |
11 | export interface IAccordion {
12 | options?: IAccordionOptions;
13 |
14 | toggleClick(evt: Event): void;
15 | show(): void;
16 | hide(): void;
17 | update(): void;
18 | destroy(): void;
19 | }
20 |
--------------------------------------------------------------------------------
/src/plugins/accordion/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/accordion/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-accordion-active {
2 | &.hs-accordion.active {
3 | @slot;
4 | }
5 |
6 | .hs-accordion.active>& {
7 | @slot;
8 | }
9 |
10 | .hs-accordion.active>.hs-accordion-toggle & {
11 | @slot;
12 | }
13 |
14 | .hs-accordion.active>.hs-accordion-heading>.hs-accordion-toggle & {
15 | @slot;
16 | }
17 |
18 | &.hs-accordion-toggle {
19 |
20 | .hs-accordion.active>& {
21 | @slot;
22 | }
23 | }
24 |
25 | &.hs-accordion-toggle {
26 |
27 | .hs-accordion.active>.hs-accordion-heading>& {
28 | @slot;
29 | }
30 | }
31 |
32 | &.hs-accordion-force-active {
33 | .hs-accordion.active & {
34 | @slot;
35 | }
36 | }
37 | }
38 |
39 | @custom-variant hs-accordion-selected {
40 | &.selected {
41 | .hs-accordion & {
42 | @slot;
43 | }
44 | }
45 | }
46 |
47 | @custom-variant hs-accordion-outside-active {
48 | &.active {
49 | @slot;
50 | }
51 | }
--------------------------------------------------------------------------------
/src/plugins/base-plugin/index.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | /*
4 | * HSBasePlugin
5 | * @version: 3.0.1
6 | * @author: Preline Labs Ltd.
7 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
8 | * Copyright 2024 Preline Labs Ltd.
9 | */
10 |
11 | import { IBasePlugin } from '../base-plugin/interfaces';
12 |
13 | export default class HSBasePlugin
14 | implements IBasePlugin
15 | {
16 | constructor(
17 | public el: E,
18 | public options: O,
19 | public events?: any,
20 | ) {
21 | this.el = el;
22 | this.options = options;
23 | this.events = {};
24 | }
25 |
26 | public createCollection(collection: any[], element: any) {
27 | collection.push({
28 | id: element?.el?.id || collection.length + 1,
29 | element,
30 | });
31 | }
32 |
33 | public fireEvent(evt: string, payload: any = null) {
34 | if (this.events.hasOwnProperty(evt)) return this.events[evt](payload);
35 | }
36 |
37 | public on(evt: string, cb: Function) {
38 | this.events[evt] = cb;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/plugins/base-plugin/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IBasePlugin {
2 | el: E;
3 | options?: O;
4 | events?: {};
5 | }
--------------------------------------------------------------------------------
/src/plugins/base-plugin/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/carousel/interfaces.ts:
--------------------------------------------------------------------------------
1 | import { TCarouselOptionsSlidesQty } from './types';
2 |
3 | export interface ICarouselOptions {
4 | currentIndex: number;
5 | loadingClasses?: string | string[];
6 | dotsItemClasses?: string;
7 | mode?: 'default' | 'scroll-nav';
8 | isAutoHeight?: boolean;
9 | isAutoPlay?: boolean;
10 | isCentered?: boolean;
11 | isDraggable?: boolean;
12 | isInfiniteLoop?: boolean;
13 | isRTL?: boolean;
14 | isSnap?: boolean;
15 | hasSnapSpacers?: boolean;
16 | slidesQty?: TCarouselOptionsSlidesQty | number;
17 | speed?: number;
18 | updateDelay?: number;
19 | }
20 |
21 | export interface ICarousel {
22 | options?: ICarouselOptions;
23 |
24 | recalculateWidth(): void;
25 | goToPrev(): void;
26 | goToNext(): void;
27 | goTo(i: number): void;
28 | destroy(): void;
29 | }
--------------------------------------------------------------------------------
/src/plugins/carousel/types.ts:
--------------------------------------------------------------------------------
1 | export type TCarouselOptionsSlidesQty = {
2 | [key: string]: number;
3 | };
4 |
--------------------------------------------------------------------------------
/src/plugins/carousel/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-carousel-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 |
7 | .active & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-carousel-disabled {
13 |
14 | &.disabled {
15 | @slot;
16 | }
17 |
18 | .disabled & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-carousel-dragging {
24 |
25 | &.dragging {
26 | @slot;
27 | }
28 |
29 | .dragging & {
30 | @slot;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/plugins/collapse/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ICollapse {
2 | options?: {};
3 |
4 | show(): void;
5 | hide(): void;
6 | destroy(): void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/plugins/collapse/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/collapse/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-collapse-open {
2 |
3 | &.hs-collapse.open {
4 | @slot;
5 | }
6 |
7 | &.hs-collapse-toggle.open {
8 | @slot;
9 | }
10 |
11 | .hs-collapse.open & {
12 | @slot;
13 | }
14 |
15 | .hs-collapse-toggle.open & {
16 | @slot;
17 | }
18 | }
--------------------------------------------------------------------------------
/src/plugins/combobox/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IComboBoxOptions {
2 | gap?: number;
3 | viewport?: string | HTMLElement | null;
4 | preventVisibility?: boolean;
5 | minSearchLength?: number;
6 | apiUrl?: string | null;
7 | apiDataPart?: string | null;
8 | apiQuery?: string | null;
9 | apiSearchQuery?: string | null;
10 | apiSearchPath?: string | null;
11 | apiSearchDefaultPath?: string | null;
12 | apiHeaders?: {};
13 | apiGroupField?: string | null;
14 | outputItemTemplate?: string | null;
15 | outputEmptyTemplate?: string | null;
16 | outputLoaderTemplate?: string | null;
17 | groupingType?: "default" | "tabs" | null;
18 | groupingTitleTemplate?: string | null;
19 | tabsWrapperTemplate?: string | null;
20 | preventSelection?: boolean;
21 | preventAutoPosition?: boolean;
22 | isOpenOnFocus?: boolean;
23 | }
24 |
25 | export interface IComboBox {
26 | options?: IComboBoxOptions;
27 |
28 | getCurrentData(): {} | {}[];
29 | open(): void;
30 | close(): void;
31 | recalculateDirection(): void;
32 | destroy(): void;
33 | }
34 |
35 | export interface IComboBoxItemAttr {
36 | valueFrom: string;
37 | attr: string;
38 | }
--------------------------------------------------------------------------------
/src/plugins/combobox/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/combobox/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-combo-box-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 |
7 | .active & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-combo-box-has-value {
13 |
14 | &.has-value {
15 | @slot;
16 | }
17 |
18 | .has-value & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-combo-box-selected {
24 |
25 | &.selected {
26 | @slot;
27 | }
28 |
29 | .selected & {
30 | @slot;
31 | }
32 | }
33 |
34 | @custom-variant hs-combo-box-tab-active {
35 | &.active {
36 | @slot;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/plugins/copy-markup/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ICopyMarkupOptions {
2 | targetSelector: string;
3 | wrapperSelector: string;
4 | limit?: number;
5 | }
6 |
7 | export interface ICopyMarkup {
8 | options?: ICopyMarkupOptions;
9 |
10 | delete(target: HTMLElement): void;
11 | destroy(): void;
12 | }
13 |
--------------------------------------------------------------------------------
/src/plugins/copy-markup/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/datatable/interfaces.ts:
--------------------------------------------------------------------------------
1 | import { Config } from 'datatables.net-dt';
2 |
3 | interface IDataTablePagingOptions {
4 | pageBtnClasses?: string;
5 | }
6 |
7 | interface IDataTableRowSelectingOptions {
8 | selectAllSelector?: string;
9 | individualSelector?: string;
10 | }
11 | export interface IDataTableOptions extends Config {
12 | rowSelectingOptions?: IDataTableRowSelectingOptions;
13 | pagingOptions?: IDataTablePagingOptions;
14 | }
15 |
16 | export interface IDataTable {
17 | options?: IDataTableOptions;
18 |
19 | destroy(): void;
20 | }
--------------------------------------------------------------------------------
/src/plugins/datatable/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/datatable/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-datatable-ordering-asc {
2 |
3 | &.dt-ordering-asc {
4 | @slot;
5 | }
6 |
7 | .dt-ordering-asc & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-datatable-ordering-desc {
13 |
14 | &.dt-ordering-desc {
15 | @slot;
16 | }
17 |
18 | .dt-ordering-desc & {
19 | @slot;
20 | }
21 | }
--------------------------------------------------------------------------------
/src/plugins/datepicker/interfaces.ts:
--------------------------------------------------------------------------------
1 | import { Options } from 'vanilla-calendar-pro/types';
2 | import { ISelectOptions } from '../select/interfaces';
3 |
4 | export interface ICustomDatepickerOptions extends Options {
5 | removeDefaultStyles?: boolean;
6 | mode?: 'custom-select' | 'default';
7 | inputModeOptions?: {
8 | dateSeparator?: string;
9 | itemsSeparator?: string;
10 | },
11 | templates?: {
12 | time?: string,
13 | arrowPrev?: string,
14 | arrowNext?: string
15 | },
16 | styles?: Options['styles'] & {
17 | customSelect?: {
18 | shared?: ISelectOptions;
19 | years?: ISelectOptions;
20 | months?: ISelectOptions;
21 | hours?: ISelectOptions;
22 | minutes?: ISelectOptions;
23 | meridiem?: ISelectOptions;
24 | }
25 | };
26 | }
27 |
28 | export interface IDatepicker {
29 | options?: ICustomDatepickerOptions;
30 | }
31 |
--------------------------------------------------------------------------------
/src/plugins/datepicker/types.ts:
--------------------------------------------------------------------------------
1 | export type TClassType =
2 | | 'days'
3 | | 'day'
4 | | 'today'
5 | | 'weekday'
6 | | 'weekend'
7 | | 'selected'
8 | | 'disabled';
9 |
--------------------------------------------------------------------------------
/src/plugins/datepicker/vanilla-datepicker-pro.ts:
--------------------------------------------------------------------------------
1 | import { Calendar } from "vanilla-calendar-pro";
2 | import { Options, Reset, Styles } from "vanilla-calendar-pro/types";
3 |
4 | class CustomVanillaCalendar extends Calendar {
5 | constructor(selector: HTMLElement | string, options?: Partial) {
6 | super(selector, options);
7 |
8 | const parentSet = this.set;
9 |
10 | this.set = (options: Options, resetOptions?: Partial) => {
11 | if (parentSet) parentSet.call(this, options, resetOptions);
12 |
13 | if (options.selectedTime && this.onChangeTime) {
14 | this.onChangeTime(this, null, true);
15 | }
16 | if (options.selectedMonth && this.onClickMonth) {
17 | this.onClickMonth(this, null);
18 | }
19 | if (options.selectedYear && this.onClickYear) {
20 | this.onClickYear(this, null);
21 | }
22 | };
23 | }
24 |
25 | static get defaultStyles() {
26 | return {
27 | calendar: "vc",
28 | controls: "vc-controls",
29 | grid: "vc-grid",
30 | column: "vc-column",
31 | header: "vc-header",
32 | headerContent: "vc-header__content",
33 | month: "vc-month",
34 | year: "vc-year",
35 | arrowPrev: "vc-arrow vc-arrow_prev",
36 | arrowNext: "vc-arrow vc-arrow_next",
37 | wrapper: "vc-wrapper",
38 | content: "vc-content",
39 | months: "vc-months",
40 | monthsMonth: "vc-months__month",
41 | years: "vc-years",
42 | yearsYear: "vc-years__year",
43 | week: "vc-week",
44 | weekDay: "vc-week__day",
45 | weekNumbers: "vc-week-numbers",
46 | weekNumbersTitle: "vc-week-numbers__title",
47 | weekNumbersContent: "vc-week-numbers__content",
48 | weekNumber: "vc-week-number",
49 | dates: "vc-dates",
50 | date: "vc-date",
51 | dateBtn: "vc-date__btn",
52 | datePopup: "vc-date__popup",
53 | dateRangeTooltip: "vc-date-range-tooltip",
54 | time: "vc-time",
55 | timeContent: "vc-time__content",
56 | timeHour: "vc-time__hour",
57 | timeMinute: "vc-time__minute",
58 | timeKeeping: "vc-time__keeping",
59 | timeRanges: "vc-time__ranges",
60 | timeRange: "vc-time__range",
61 | };
62 | }
63 |
64 | public logInfo() {
65 | console.log("This log is from CustomVanillaCalendar!", this);
66 | }
67 | }
68 |
69 | export default CustomVanillaCalendar;
70 |
--------------------------------------------------------------------------------
/src/plugins/datepicker/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-vc-date-today {
2 | &[data-vc-date-today] {
3 | @slot;
4 | }
5 | }
6 |
7 | @custom-variant hs-vc-date-hover {
8 | &[data-vc-date-hover] {
9 | @slot;
10 | }
11 | }
12 |
13 | @custom-variant hs-vc-date-hover-first {
14 |
15 | &[data-vc-date-hover='first'] {
16 | @slot;
17 | }
18 |
19 | [data-vc-date-hover='first'] & {
20 | @slot;
21 | }
22 | }
23 |
24 | @custom-variant hs-vc-date-hover-last {
25 |
26 | &[data-vc-date-hover='last'] {
27 | @slot;
28 | }
29 |
30 | [data-vc-date-hover='last'] & {
31 | @slot;
32 | }
33 | }
34 |
35 | @custom-variant hs-vc-date-selected {
36 | &[data-vc-date-selected] {
37 | @slot;
38 | }
39 | }
40 |
41 | @custom-variant hs-vc-calendar-selected-middle {
42 |
43 | &[data-vc-date-selected='middle'] {
44 | @slot;
45 | }
46 |
47 | [data-vc-date-selected='middle'] & {
48 | @slot;
49 | }
50 | }
51 |
52 | @custom-variant hs-vc-calendar-selected-first {
53 |
54 | &[data-vc-date-selected='first'] {
55 | @slot;
56 | }
57 |
58 | [data-vc-date-selected='first'] & {
59 | @slot;
60 | }
61 | }
62 |
63 | @custom-variant hs-vc-calendar-selected-last {
64 |
65 | &[data-vc-date-selected='last'] {
66 | @slot;
67 | }
68 |
69 | [data-vc-date-selected='last'] & {
70 | @slot;
71 | }
72 | }
73 |
74 | @custom-variant hs-vc-date-weekend {
75 | &[data-vc-date-weekend] {
76 | @slot;
77 | }
78 | }
79 |
80 | @custom-variant hs-vc-week-day-off {
81 | &[data-vc-week-day-off] {
82 | @slot;
83 | }
84 | }
85 |
86 | @custom-variant hs-vc-date-month-prev {
87 | &[data-vc-date-month='prev'] {
88 | @slot;
89 | }
90 | }
91 |
92 | @custom-variant hs-vc-date-month-next {
93 | &[data-vc-date-month='next'] {
94 | @slot;
95 | }
96 | }
97 |
98 | @custom-variant hs-vc-calendar-hidden {
99 |
100 | &[data-vc-calendar-hidden] {
101 | @slot;
102 | }
103 |
104 | [data-vc-calendar-hidden] & {
105 | @slot;
106 | }
107 | }
108 |
109 | @custom-variant hs-vc-months-month-selected {
110 | &[data-vc-months-month-selected] {
111 | @slot;
112 | }
113 | }
114 |
115 | @custom-variant hs-vc-years-year-selected {
116 | &[data-vc-years-year-selected] {
117 | @slot;
118 | }
119 | }
--------------------------------------------------------------------------------
/src/plugins/dropdown/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IDropdown {
2 | options?: {};
3 |
4 | open(): void;
5 | close(isAnimated: boolean): void;
6 | forceClearState(): void;
7 | destroy(): void;
8 | }
9 |
10 | export interface IHTMLElementFloatingUI extends HTMLElement {
11 | _floatingUI: any;
12 | }
13 |
--------------------------------------------------------------------------------
/src/plugins/dropdown/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/dropdown/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-dropdown-open {
2 | &.hs-dropdown-menu.open {
3 | @slot;
4 | }
5 |
6 | .hs-dropdown.open>& {
7 | @slot;
8 | }
9 |
10 | .hs-dropdown.open>.hs-dropdown-toggle & {
11 | @slot;
12 | }
13 |
14 | .hs-dropdown.open>.hs-dropdown-menu>& {
15 | @slot;
16 | }
17 | }
18 |
19 | @custom-variant hs-dropdown-item-disabled {
20 | .hs-dropdown.open>.hs-dropdown-menu &.disabled {
21 | @slot;
22 | }
23 | }
24 |
25 | @custom-variant hs-dropdown-item-checked {
26 | .hs-dropdown.open .hs-dropdown-menu [aria-checked='true'] & {
27 | @slot;
28 | }
29 |
30 | .hs-dropdown.open .hs-dropdown-menu &[aria-checked='true'] {
31 | @slot;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/plugins/file-upload/interfaces.ts:
--------------------------------------------------------------------------------
1 | import { DropzoneOptions } from 'dropzone';
2 |
3 | export interface IFileUploadOptions extends DropzoneOptions {
4 | extensions?: {};
5 | autoHideTrigger?: boolean;
6 | singleton?: boolean;
7 | }
8 |
9 | export interface IFileUpload {
10 | options?: IFileUploadOptions;
11 |
12 | destroy(): void;
13 | }
--------------------------------------------------------------------------------
/src/plugins/file-upload/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/file-upload/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-file-upload-complete {
2 |
3 | &.complete {
4 | @slot;
5 | }
6 |
7 | .complete & {
8 | @slot;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/plugins/input-number/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IInputNumberOptions {
2 | min?: number;
3 | max?: number;
4 | step?: number;
5 | }
6 |
7 | export interface IInputNumber {
8 | options?: IInputNumberOptions;
9 |
10 | destroy(): void;
11 | }
12 |
--------------------------------------------------------------------------------
/src/plugins/input-number/types.ts:
--------------------------------------------------------------------------------
1 | // no types
--------------------------------------------------------------------------------
/src/plugins/input-number/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-input-number-disabled {
2 |
3 | &.disabled {
4 | @slot;
5 | }
6 |
7 | .disabled & {
8 | @slot;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/plugins/layout-splitter/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ILayoutSplitterOptions {
2 | horizontalSplitterClasses?: string | null;
3 | horizontalSplitterTemplate?: string;
4 | verticalSplitterClasses?: string | null;
5 | verticalSplitterTemplate?: string;
6 | isSplittersAddedManually?: boolean;
7 | }
8 |
9 | export interface ISingleLayoutSplitter {
10 | el: HTMLElement;
11 | items: HTMLElement[];
12 | }
13 |
14 | export interface IControlLayoutSplitter {
15 | el: HTMLElement;
16 | direction: 'horizontal' | 'vertical';
17 | prev: HTMLElement | null;
18 | next: HTMLElement | null;
19 | }
20 |
21 | export interface ILayoutSplitter {
22 | options?: ILayoutSplitterOptions;
23 |
24 | getSplitterItemSingleParam(item: HTMLElement, name: string): any;
25 | getData(el: HTMLElement): any;
26 | setSplitterItemSize(el: HTMLElement, size: number): void;
27 | updateFlexValues(data: Array<{
28 | id: string;
29 | breakpoints: Record;
30 | }>): void;
31 | destroy(): void;
32 | }
33 |
--------------------------------------------------------------------------------
/src/plugins/layout-splitter/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/layout-splitter/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-layout-splitter-dragging {
2 |
3 | &.dragging {
4 | @slot;
5 | }
6 |
7 | .dragging & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-layout-splitter-prev-limit-reached {
13 |
14 | &.prev-limit-reached {
15 | @slot;
16 | }
17 |
18 | .prev-limit-reached & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-layout-splitter-next-limit-reached {
24 |
25 | &.next-limit-reached {
26 | @slot;
27 | }
28 |
29 | .next-limit-reached & {
30 | @slot;
31 | }
32 | }
33 |
34 | @custom-variant hs-layout-splitter-prev-pre-limit-reached {
35 |
36 | &.prev-pre-limit-reached {
37 | @slot;
38 | }
39 |
40 | .prev-pre-limit-reached & {
41 | @slot;
42 | }
43 | }
44 |
45 | @custom-variant hs-layout-splitter-next-pre-limit-reached {
46 |
47 | &.next-pre-limit-reached {
48 | @slot;
49 | }
50 |
51 | .next-pre-limit-reached & {
52 | @slot;
53 | }
54 | }
--------------------------------------------------------------------------------
/src/plugins/overlay/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IOverlayOptions {
2 | hiddenClass?: string | null;
3 | emulateScrollbarSpace?: boolean;
4 | isClosePrev?: boolean;
5 | backdropClasses?: string | null;
6 | backdropParent?: string | HTMLElement | Document;
7 | backdropExtraClasses?: string | null;
8 | moveOverlayToBody?: number | null;
9 | }
10 |
11 | export interface IOverlay {
12 | options?: IOverlayOptions;
13 |
14 | open(cb: Function | null): void;
15 | close(forceClose: boolean, cb: Function | null): void;
16 | destroy(): void;
17 | }
18 |
--------------------------------------------------------------------------------
/src/plugins/overlay/types.ts:
--------------------------------------------------------------------------------
1 | export type TOverlayOptionsAutoCloseEqualityType = 'less-than' | 'more-than';
2 |
--------------------------------------------------------------------------------
/src/plugins/overlay/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-overlay-open {
2 |
3 | &.open {
4 | @slot;
5 | }
6 |
7 | .open & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-overlay-layout-open {
13 |
14 | &.hs-overlay-body-open {
15 | @slot;
16 | }
17 |
18 | .hs-overlay-body-open & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-overlay-backdrop-open {
24 |
25 | &.hs-overlay-backdrop {
26 | @slot;
27 | }
28 |
29 | .hs-overlay-backdrop & {
30 | @slot;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/plugins/pin-input/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IPinInputOptions {
2 | availableCharsRE?: RegExp;
3 | }
4 |
5 | export interface IPinInput {
6 | options?: IPinInputOptions;
7 |
8 | destroy(): void;
9 | }
--------------------------------------------------------------------------------
/src/plugins/pin-input/types.ts:
--------------------------------------------------------------------------------
1 | // no types
--------------------------------------------------------------------------------
/src/plugins/pin-input/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-pin-input-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 |
7 | .active & {
8 | @slot;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/plugins/range-slider/interfaces.ts:
--------------------------------------------------------------------------------
1 | import type { Options } from 'nouislider';
2 |
3 | import { TRangeSliderOptionsFormatterType } from './types';
4 |
5 | export interface IRangeSliderCssClassesObject {
6 | [key: string]: any;
7 | }
8 |
9 | export interface IRangeSliderOptionsFormatterOptions {
10 | type?: TRangeSliderOptionsFormatterType;
11 | prefix?: string;
12 | postfix?: string;
13 | }
14 |
15 | export interface IRangeSliderOptions extends Options {
16 | disabled?: boolean;
17 | formatter?:
18 | | IRangeSliderOptionsFormatterOptions
19 | | TRangeSliderOptionsFormatterType;
20 | }
21 |
22 | export interface IRangeSlider {
23 | options?: IRangeSliderOptions;
24 |
25 | destroy(): void;
26 | }
27 |
--------------------------------------------------------------------------------
/src/plugins/range-slider/types.ts:
--------------------------------------------------------------------------------
1 | export type TRangeSliderOptionsFormatterType =
2 | | 'integer'
3 | | 'thousandsSeparatorAndDecimalPoints'
4 | | null;
5 |
--------------------------------------------------------------------------------
/src/plugins/range-slider/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-range-slider-disabled {
2 |
3 | &.disabled {
4 | @slot;
5 | }
6 |
7 | .disabled & {
8 | @slot;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/plugins/remove-element/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * HSRemoveElement
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 |
9 | import { afterTransition } from '../../utils';
10 |
11 | import {
12 | IRemoveElementOptions,
13 | IRemoveElement,
14 | } from '../remove-element/interfaces';
15 |
16 | import HSBasePlugin from '../base-plugin';
17 | import { ICollectionItem } from '../../interfaces';
18 |
19 | class HSRemoveElement
20 | extends HSBasePlugin
21 | implements IRemoveElement {
22 | private readonly removeTargetId: string | null;
23 | private readonly removeTarget: HTMLElement | null;
24 | private readonly removeTargetAnimationClass: string;
25 |
26 | private onElementClickListener: () => void;
27 |
28 | constructor(el: HTMLElement, options?: IRemoveElementOptions) {
29 | super(el, options);
30 |
31 | const data = el.getAttribute('data-hs-remove-element-options');
32 | const dataOptions: IRemoveElementOptions = data ? JSON.parse(data) : {};
33 | const concatOptions = {
34 | ...dataOptions,
35 | ...options,
36 | };
37 |
38 | this.removeTargetId = this.el.getAttribute('data-hs-remove-element');
39 | this.removeTarget = document.querySelector(this.removeTargetId);
40 | this.removeTargetAnimationClass =
41 | concatOptions?.removeTargetAnimationClass || 'hs-removing';
42 |
43 | if (this.removeTarget) this.init();
44 | }
45 |
46 | private elementClick() {
47 | this.remove();
48 | }
49 |
50 | private init() {
51 | this.createCollection(window.$hsRemoveElementCollection, this);
52 |
53 | this.onElementClickListener = () => this.elementClick();
54 |
55 | this.el.addEventListener('click', this.onElementClickListener);
56 | }
57 |
58 | private remove() {
59 | if (!this.removeTarget) return false;
60 |
61 | this.removeTarget.classList.add(this.removeTargetAnimationClass);
62 |
63 | afterTransition(this.removeTarget, () =>
64 | setTimeout(() => this.removeTarget.remove()),
65 | );
66 | }
67 |
68 | // Public methods
69 | public destroy() {
70 | // Remove classes
71 | this.removeTarget.classList.remove(this.removeTargetAnimationClass);
72 |
73 | // Remove listeners
74 | this.el.removeEventListener('click', this.onElementClickListener);
75 |
76 | window.$hsRemoveElementCollection =
77 | window.$hsRemoveElementCollection.filter(
78 | ({ element }) => element.el !== this.el,
79 | );
80 | }
81 |
82 | // Static method
83 | static getInstance(target: HTMLElement, isInstance?: boolean) {
84 | const elInCollection = window.$hsRemoveElementCollection.find(
85 | (el) =>
86 | el.element.el ===
87 | (typeof target === 'string'
88 | ? document.querySelector(target)
89 | : target) ||
90 | el.element.el ===
91 | (typeof target === 'string'
92 | ? document.querySelector(target)
93 | : target),
94 | );
95 |
96 | return elInCollection
97 | ? isInstance
98 | ? elInCollection
99 | : elInCollection.element.el
100 | : null;
101 | }
102 |
103 | static autoInit() {
104 | if (!window.$hsRemoveElementCollection)
105 | window.$hsRemoveElementCollection = [];
106 |
107 | if (window.$hsRemoveElementCollection)
108 | window.$hsRemoveElementCollection =
109 | window.$hsRemoveElementCollection.filter(({ element }) =>
110 | document.contains(element.el),
111 | );
112 |
113 | document
114 | .querySelectorAll('[data-hs-remove-element]:not(.--prevent-on-load-init)')
115 | .forEach((el: HTMLElement) => {
116 | if (
117 | !window.$hsRemoveElementCollection.find(
118 | (elC) => (elC?.element?.el as HTMLElement) === el,
119 | )
120 | )
121 | new HSRemoveElement(el);
122 | });
123 | }
124 | }
125 |
126 | declare global {
127 | interface Window {
128 | HSRemoveElement: Function;
129 | $hsRemoveElementCollection: ICollectionItem[];
130 | }
131 | }
132 |
133 | window.addEventListener('load', () => {
134 | HSRemoveElement.autoInit();
135 |
136 | // Uncomment for debug
137 | // console.log('Remove element collection:', window.$hsRemoveElementCollection);
138 | });
139 |
140 | if (typeof window !== 'undefined') {
141 | window.HSRemoveElement = HSRemoveElement;
142 | }
143 |
144 | export default HSRemoveElement;
145 |
--------------------------------------------------------------------------------
/src/plugins/remove-element/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IRemoveElementOptions {
2 | removeTargetAnimationClass: string;
3 | }
4 |
5 | export interface IRemoveElement {
6 | options?: IRemoveElementOptions;
7 |
8 | destroy(): void;
9 | }
10 |
--------------------------------------------------------------------------------
/src/plugins/remove-element/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/remove-element/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-removing {
2 | &.hs-removing {
3 | @slot;
4 | }
5 | }
--------------------------------------------------------------------------------
/src/plugins/scroll-nav/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IScrollNavOptions {
2 | paging?: boolean;
3 | autoCentering?: boolean;
4 | }
5 |
6 | export interface IScrollNavCurrentState {
7 | first: HTMLElement;
8 | last: HTMLElement;
9 | center: HTMLElement;
10 | }
11 |
12 | export interface IScrollNav {
13 | options?: IScrollNavOptions;
14 |
15 | getCurrentState(): IScrollNavCurrentState;
16 | goTo(el: Element, cb?: () => void): void;
17 | centerElement(el: HTMLElement, behavior: ScrollBehavior): void;
18 | destroy(): void;
19 | }
20 |
--------------------------------------------------------------------------------
/src/plugins/scroll-nav/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/scroll-nav/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-scroll-nav-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 | }
7 |
8 | @custom-variant hs-scroll-nav-disabled {
9 |
10 | &.disabled {
11 | @slot;
12 | }
13 |
14 | .disabled & {
15 | @slot;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/plugins/scrollspy/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IScrollspyOptions {
2 | ignoreScrollUp?: boolean;
3 | }
4 |
5 | export interface IScrollspy {
6 | options?: IScrollspyOptions;
7 |
8 | destroy(): void;
9 | }
10 |
--------------------------------------------------------------------------------
/src/plugins/scrollspy/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/scrollspy/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-scrollspy-active {
2 | &.active {
3 | @slot;
4 | }
5 | }
--------------------------------------------------------------------------------
/src/plugins/select/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ISingleOptionOptions {
2 | description: string;
3 | icon: string;
4 | }
5 |
6 | export interface ISingleOption {
7 | title: string;
8 | val: string;
9 | disabled?: boolean;
10 | selected?: boolean;
11 | options?: ISingleOptionOptions | null;
12 | }
13 |
14 | export interface IApiFieldMap {
15 | id: string;
16 | val: string;
17 | title: string;
18 | icon?: string | null;
19 | description?: string | null;
20 | [key: string]: unknown;
21 | }
22 |
23 | export interface ISelectOptions {
24 | value?: string | string[];
25 | isOpened?: boolean;
26 | placeholder?: string;
27 | hasSearch?: boolean;
28 | minSearchLength?: number;
29 | preventSearchFocus?: boolean;
30 | mode?: string;
31 |
32 | viewport?: string;
33 |
34 | wrapperClasses?: string;
35 |
36 | apiUrl?: string | null;
37 | apiQuery?: string | null;
38 | apiOptions?: RequestInit | null;
39 | apiDataPart?: string | null;
40 | apiSearchQueryKey?: string | null;
41 | apiFieldsMap?: IApiFieldMap | null;
42 | apiIconTag?: string | null;
43 |
44 | toggleTag?: string;
45 | toggleClasses?: string;
46 | toggleSeparators?: {
47 | items?: string;
48 | betweenItemsAndCounter?: string;
49 | };
50 | toggleCountText?: string | null;
51 | toggleCountTextPlacement?:
52 | | 'postfix'
53 | | 'prefix'
54 | | 'postfix-no-space'
55 | | 'prefix-no-space';
56 | toggleCountTextMinItems?: number;
57 | toggleCountTextMode?: string;
58 |
59 | tagsItemTemplate?: string;
60 | tagsItemClasses?: string;
61 | tagsInputId?: string;
62 | tagsInputClasses?: string;
63 |
64 | dropdownTag?: string;
65 | dropdownClasses?: string;
66 | dropdownDirectionClasses?: {
67 | top?: string;
68 | bottom?: string;
69 | };
70 | dropdownSpace: number;
71 | dropdownPlacement: string | null;
72 | dropdownVerticalFixedPlacement: 'top' | 'bottom' | null;
73 | dropdownScope: 'window' | 'parent';
74 |
75 | extraMarkup?: string | string[] | null;
76 |
77 | searchTemplate?: string;
78 | searchWrapperTemplate?: string;
79 | searchId?: string;
80 | searchLimit?: number | typeof Infinity;
81 | isSearchDirectMatch?: boolean;
82 | searchClasses?: string;
83 | searchWrapperClasses?: string;
84 | searchPlaceholder?: string;
85 | searchNoResultTemplate?: string | null;
86 | searchNoResultText?: string | null;
87 | searchNoResultClasses?: string | null;
88 | optionAllowEmptyOption?: boolean;
89 |
90 | optionTemplate?: string;
91 | optionTag?: string;
92 | optionClasses?: string;
93 |
94 | descriptionClasses?: string;
95 |
96 | iconClasses?: string;
97 |
98 | isAddTagOnEnter?: boolean;
99 | }
100 |
101 | export interface ISelect {
102 | options?: ISelectOptions;
103 |
104 | setValue(val: string | string[]): void;
105 | open(): void;
106 | close(): void;
107 | addOption(items: ISingleOption | ISingleOption[]): void;
108 | removeOption(values: string | string[]): void;
109 | recalculateDirection(): void;
110 | destroy(): void;
111 | }
112 |
--------------------------------------------------------------------------------
/src/plugins/select/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/select/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-selected {
2 |
3 | &.selected {
4 | @slot;
5 | }
6 |
7 | .selected & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-select-disabled {
13 |
14 | &.disabled {
15 | @slot;
16 | }
17 |
18 | .disabled & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-select-active {
24 |
25 | &.active {
26 | @slot;
27 | }
28 |
29 | .active & {
30 | @slot;
31 | }
32 | }
33 |
34 | @custom-variant hs-select-opened {
35 | &.opened {
36 | @slot;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/plugins/stepper/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IStepperOptions {
2 | currentIndex?: number;
3 | isCompleted?: boolean;
4 | mode?: string;
5 | }
6 |
7 | export interface IStepper {
8 | options?: IStepperOptions;
9 |
10 | setProcessedNavItem(n?: number): void;
11 | unsetProcessedNavItem(n?: number): void;
12 | goToNext(): void;
13 | disableButtons(): void;
14 | enableButtons(): void;
15 | setErrorNavItem(n?: number): void;
16 | destroy(): void;
17 | }
18 |
19 | export interface IStepperItem {
20 | index: number;
21 | isFinal: boolean;
22 | isCompleted: boolean;
23 | isSkip: boolean;
24 | isOptional?: boolean;
25 | isDisabled?: boolean;
26 | isProcessed?: boolean;
27 | hasError?: boolean;
28 | el: HTMLElement;
29 | }
--------------------------------------------------------------------------------
/src/plugins/stepper/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/stepper/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-stepper-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 |
7 | .active & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-stepper-success {
13 |
14 | &.success {
15 | @slot;
16 | }
17 |
18 | .success & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-stepper-completed {
24 |
25 | &.completed {
26 | @slot;
27 | }
28 |
29 | .completed & {
30 | @slot;
31 | }
32 | }
33 |
34 | @custom-variant hs-stepper-error {
35 |
36 | &.error {
37 | @slot;
38 | }
39 |
40 | .error & {
41 | @slot;
42 | }
43 | }
44 |
45 | @custom-variant hs-stepper-processed {
46 |
47 | &.processed {
48 | @slot;
49 | }
50 |
51 | .processed & {
52 | @slot;
53 | }
54 | }
55 |
56 | @custom-variant hs-stepper-disabled {
57 |
58 | &.disabled {
59 | @slot;
60 | }
61 |
62 | .disabled & {
63 | @slot;
64 | }
65 | }
66 |
67 | @custom-variant hs-stepper-skipped {
68 |
69 | &.skipped {
70 | @slot;
71 | }
72 |
73 | .skipped & {
74 | @slot;
75 | }
76 | }
--------------------------------------------------------------------------------
/src/plugins/strong-password/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IStrongPasswordOptions {
2 | target: string | HTMLInputElement;
3 | hints?: string;
4 | stripClasses?: string;
5 | minLength?: number;
6 | mode?: string;
7 | popoverSpace?: number;
8 | checksExclude?: string[];
9 | specialCharactersSet?: string;
10 | }
11 |
12 | export interface IStrongPassword {
13 | options?: IStrongPasswordOptions;
14 |
15 | recalculateDirection(): void;
16 | destroy(): void;
17 | }
18 |
--------------------------------------------------------------------------------
/src/plugins/strong-password/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/strong-password/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-password-active {
2 |
3 | &.active {
4 | @slot;
5 | }
6 |
7 | .active & {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-strong-password {
13 |
14 | &.passed {
15 | @slot;
16 | }
17 |
18 | .passed & {
19 | @slot;
20 | }
21 | }
22 |
23 | @custom-variant hs-strong-password-accepted {
24 |
25 | &.accepted {
26 | @slot;
27 | }
28 |
29 | .accepted & {
30 | @slot;
31 | }
32 | }
33 |
34 | @custom-variant hs-strong-password-active {
35 | &.active {
36 | @slot;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/plugins/tabs/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ITabsOnChangePayload {
2 | el: HTMLElement;
3 | tabsId: string;
4 | prev: string;
5 | current: string;
6 | }
7 |
8 | export interface ITabsOptions {
9 | eventType: 'click' | 'hover';
10 | preventNavigationResolution: string | number | null;
11 | }
12 |
13 | export interface ITabs {
14 | options?: ITabsOptions;
15 |
16 | destroy(): void;
17 | }
--------------------------------------------------------------------------------
/src/plugins/tabs/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/tabs/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-tab-active {
2 |
3 | &[data-hs-tab].active {
4 | @slot;
5 | }
6 |
7 | [data-hs-tab].active & {
8 | @slot;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/plugins/textarea-auto-height/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ITextareaAutoHeightOptions {
2 | defaultHeight: number;
3 | }
4 |
5 | export interface ITextareaAutoHeight {
6 | options?: ITextareaAutoHeightOptions;
7 |
8 | destroy(): void;
9 | }
10 |
--------------------------------------------------------------------------------
/src/plugins/textarea-auto-height/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/theme-switch/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IThemeSwitchOptions {
2 | theme?: 'dark' | 'light' | 'default';
3 | type?: 'change' | 'click';
4 | }
5 |
6 | export interface IThemeSwitch {
7 | options?: IThemeSwitchOptions;
8 |
9 | setAppearance(theme: string, isSaveToLocalStorage: boolean, isSetDispatchEvent: boolean): void;
10 | destroy(): void;
11 | }
12 |
--------------------------------------------------------------------------------
/src/plugins/theme-switch/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/theme-switch/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-default-mode-active {
2 | .default & {
3 | @slot;
4 | }
5 | }
6 |
7 | @custom-variant hs-dark-mode-active {
8 | .dark & {
9 | @slot;
10 | }
11 | }
12 |
13 | @custom-variant hs-auto-mode-active {
14 | .auto & {
15 | @slot;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/plugins/toggle-count/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * HSToggleCount
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 |
9 | import { IToggleCountOptions, IToggleCount } from '../toggle-count/interfaces';
10 |
11 | import HSBasePlugin from '../base-plugin';
12 | import { ICollectionItem } from '../../interfaces';
13 |
14 | class HSToggleCount
15 | extends HSBasePlugin
16 | implements IToggleCount
17 | {
18 | private readonly target: HTMLInputElement | null;
19 | private readonly min: number | null;
20 | private readonly max: number | null;
21 | private readonly duration: number | null;
22 | private isChecked: boolean;
23 |
24 | private onToggleChangeListener: () => void;
25 |
26 | constructor(el: HTMLElement, options?: IToggleCountOptions) {
27 | super(el, options);
28 |
29 | const data = el.getAttribute('data-hs-toggle-count');
30 | const dataOptions: IToggleCountOptions = data ? JSON.parse(data) : {};
31 | const concatOptions = {
32 | ...dataOptions,
33 | ...options,
34 | };
35 |
36 | this.target = concatOptions?.target
37 | ? typeof concatOptions?.target === 'string'
38 | ? (document.querySelector(concatOptions.target) as HTMLInputElement)
39 | : concatOptions.target
40 | : null;
41 | this.min = concatOptions?.min || 0;
42 | this.max = concatOptions?.max || 0;
43 | this.duration = concatOptions?.duration || 700;
44 |
45 | this.isChecked = (this.target as HTMLInputElement).checked || false;
46 |
47 | if (this.target) this.init();
48 | }
49 |
50 | private toggleChange() {
51 | this.isChecked = !this.isChecked;
52 |
53 | this.toggle();
54 | }
55 |
56 | private init() {
57 | this.createCollection(window.$hsToggleCountCollection, this);
58 |
59 | if (this.isChecked) this.el.innerText = String(this.max);
60 |
61 | this.onToggleChangeListener = () => this.toggleChange();
62 |
63 | this.target.addEventListener('change', this.onToggleChangeListener);
64 | }
65 |
66 | private toggle() {
67 | if (this.isChecked) this.countUp();
68 | else this.countDown();
69 | }
70 |
71 | private animate(from: number, to: number) {
72 | let startTimestamp = 0;
73 |
74 | const step = (timestamp: number) => {
75 | if (!startTimestamp) startTimestamp = timestamp;
76 | const progress = Math.min(
77 | (timestamp - startTimestamp) / this.duration,
78 | 1,
79 | );
80 |
81 | this.el.innerText = String(Math.floor(progress * (to - from) + from));
82 |
83 | if (progress < 1) window.requestAnimationFrame(step);
84 | };
85 |
86 | window.requestAnimationFrame(step);
87 | }
88 |
89 | // Public methods
90 | public countUp() {
91 | this.animate(this.min, this.max);
92 | }
93 |
94 | public countDown() {
95 | this.animate(this.max, this.min);
96 | }
97 |
98 | public destroy() {
99 | // Remove listeners
100 | this.target.removeEventListener('change', this.onToggleChangeListener);
101 |
102 | window.$hsToggleCountCollection = window.$hsToggleCountCollection.filter(
103 | ({ element }) => element.el !== this.el,
104 | );
105 | }
106 |
107 | // Static methods
108 | static getInstance(target: HTMLElement | string, isInstance?: boolean) {
109 | const elInCollection = window.$hsToggleCountCollection.find(
110 | (el) =>
111 | el.element.el ===
112 | (typeof target === 'string' ? document.querySelector(target) : target),
113 | );
114 |
115 | return elInCollection
116 | ? isInstance
117 | ? elInCollection
118 | : elInCollection.element
119 | : null;
120 | }
121 |
122 | static autoInit() {
123 | if (!window.$hsToggleCountCollection) window.$hsToggleCountCollection = [];
124 |
125 | if (window.$hsToggleCountCollection)
126 | window.$hsToggleCountCollection = window.$hsToggleCountCollection.filter(
127 | ({ element }) => document.contains(element.el),
128 | );
129 |
130 | document
131 | .querySelectorAll('[data-hs-toggle-count]:not(.--prevent-on-load-init)')
132 | .forEach((el: HTMLElement) => {
133 | if (
134 | !window.$hsToggleCountCollection.find(
135 | (elC) => (elC?.element?.el as HTMLElement) === el,
136 | )
137 | )
138 | new HSToggleCount(el);
139 | });
140 | }
141 | }
142 |
143 | declare global {
144 | interface Window {
145 | HSToggleCount: Function;
146 | $hsToggleCountCollection: ICollectionItem[];
147 | }
148 | }
149 |
150 | window.addEventListener('load', () => {
151 | HSToggleCount.autoInit();
152 |
153 | // Uncomment for debug
154 | // console.log('Toggle count collection:', window.$hsToggleCountCollection);
155 | });
156 |
157 | if (typeof window !== 'undefined') {
158 | window.HSToggleCount = HSToggleCount;
159 | }
160 |
161 | export default HSToggleCount;
162 |
--------------------------------------------------------------------------------
/src/plugins/toggle-count/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IToggleCountOptions {
2 | target: string | HTMLInputElement;
3 | min: number;
4 | max: number;
5 | duration: number;
6 | }
7 |
8 | export interface IToggleCount {
9 | options?: IToggleCountOptions;
10 |
11 | countUp(): void;
12 | countDown(): void;
13 | destroy(): void;
14 | }
15 |
--------------------------------------------------------------------------------
/src/plugins/toggle-count/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/toggle-password/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ITogglePasswordOptions {
2 | target: string | string[] | HTMLInputElement | HTMLInputElement[];
3 | }
4 |
5 | export interface ITogglePassword {
6 | options?: ITogglePasswordOptions;
7 |
8 | show(): void;
9 | hide(): void;
10 | destroy(): void;
11 | }
12 |
--------------------------------------------------------------------------------
/src/plugins/toggle-password/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/tooltip/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ITooltip {
2 | options?: {};
3 |
4 | show(): void;
5 | hide(): void;
6 | destroy(): void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/plugins/tooltip/types.ts:
--------------------------------------------------------------------------------
1 | export type TTooltipOptionsScope = 'parent' | 'window';
--------------------------------------------------------------------------------
/src/plugins/tooltip/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-tooltip-shown {
2 | &.hs-tooltip-content.show {
3 | @slot;
4 | }
5 |
6 | .hs-tooltip.show & {
7 | @slot;
8 | }
9 | }
--------------------------------------------------------------------------------
/src/plugins/tree-view/interfaces.ts:
--------------------------------------------------------------------------------
1 | export type ITreeViewOptionsControlBy = 'checkbox' | 'button';
2 |
3 | export interface ITreeViewItem {
4 | id: string;
5 | value: string;
6 | isDir: boolean;
7 | path: string;
8 | isSelected?: boolean;
9 | }
10 |
11 | export interface ITreeViewOptions {
12 | items: ITreeViewItem[] | null;
13 | controlBy?: ITreeViewOptionsControlBy;
14 | autoSelectChildren?: boolean;
15 | isIndeterminate?: boolean;
16 | }
17 |
18 | export interface ITreeView {
19 | options?: ITreeViewOptions;
20 |
21 | update(): void;
22 | getSelectedItems(): ITreeViewItem[];
23 | changeItemProp(id: string, prop: string, val: any): void;
24 | destroy(): void;
25 | }
26 |
--------------------------------------------------------------------------------
/src/plugins/tree-view/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/plugins/tree-view/variants.css:
--------------------------------------------------------------------------------
1 | @custom-variant hs-tree-view-selected {
2 |
3 | &[data-hs-tree-view-item].selected {
4 | @slot;
5 | }
6 |
7 | [data-hs-tree-view-item].selected>& {
8 | @slot;
9 | }
10 | }
11 |
12 | @custom-variant hs-tree-view-disabled {
13 |
14 | &[data-hs-tree-view-item].disabled {
15 | @slot;
16 | }
17 |
18 | [data-hs-tree-view-item].disabled>& {
19 | @slot;
20 | }
21 | }
--------------------------------------------------------------------------------
/src/spa/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface ISpaCollectionItem {
2 | key: string;
3 | fn: {
4 | autoInit: () => void;
5 | };
6 | collection: string;
7 | }
8 |
--------------------------------------------------------------------------------
/src/spa/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/static/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * HSStaticMethods
3 | * @version: 3.0.1
4 | * @author: Preline Labs Ltd.
5 | * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6 | * Copyright 2024 Preline Labs Ltd.
7 | */
8 |
9 | import { getClassProperty, afterTransition } from '../utils';
10 | import { COLLECTIONS } from '../spa/index';
11 | import { IStaticMethods } from '../static/interfaces';
12 | import { ICollectionItem } from '../interfaces';
13 | import type HSCopyMarkup from '../plugins/copy-markup';
14 | import type HSAccordion from '../plugins/accordion';
15 | import type HSCarousel from '../plugins/carousel';
16 | import type HSCollapse from '../plugins/collapse';
17 | import type HSComboBox from '../plugins/combobox';
18 | import type HSDataTable from '../plugins/datatable';
19 | import type HSDatepicker from '../plugins/datepicker';
20 | import type HSDropdown from '../plugins/dropdown';
21 | import type HSFileUpload from '../plugins/file-upload';
22 | import type HSInputNumber from '../plugins/input-number';
23 | import type HSLayoutSplitter from '../plugins/layout-splitter';
24 | import type HSOverlay from '../plugins/overlay';
25 | import type HSPinInput from '../plugins/pin-input';
26 | import type HSRangeSlider from '../plugins/range-slider';
27 | import type HSRemoveElement from '../plugins/remove-element';
28 | import type HSScrollNav from '../plugins/scroll-nav';
29 | import type HSScrollspy from '../plugins/scrollspy';
30 | import type HSSelect from '../plugins/select';
31 | import type HSStepper from '../plugins/stepper';
32 | import type HSStrongPassword from '../plugins/strong-password';
33 | import type HSTabs from '../plugins/tabs';
34 | import type HSTextareaAutoHeight from '../plugins/textarea-auto-height';
35 | import type HSThemeSwitch from '../plugins/theme-switch';
36 | import type HSToggleCount from '../plugins/toggle-count';
37 | import type HSTogglePassword from '../plugins/toggle-password';
38 | import type HSTooltip from '../plugins/tooltip';
39 | import type HSTreeView from '../plugins/tree-view';
40 |
41 | declare global {
42 | interface Window {
43 | HSStaticMethods: IStaticMethods;
44 | $hsCopyMarkupCollection: ICollectionItem[];
45 | $hsAccordionCollection: ICollectionItem[];
46 | $hsCarouselCollection: ICollectionItem[];
47 | $hsCollapseCollection: ICollectionItem[];
48 | $hsComboBoxCollection: ICollectionItem[];
49 | $hsDataTableCollection: ICollectionItem[];
50 | $hsDatepickerCollection: ICollectionItem[];
51 | $hsDropdownCollection: ICollectionItem[];
52 | $hsFileUploadCollection: ICollectionItem[];
53 | $hsInputNumberCollection: { id: number; element: HSInputNumber }[];
54 | $hsLayoutSplitterCollection: ICollectionItem[];
55 | $hsOverlayCollection: ICollectionItem[];
56 | $hsPinInputCollection: ICollectionItem[];
57 | $hsRangeSliderCollection: ICollectionItem[];
58 | $hsRemoveElementCollection: ICollectionItem[];
59 | $hsScrollNavCollection: ICollectionItem[];
60 | $hsScrollspyCollection: ICollectionItem[];
61 | $hsSelectCollection: ICollectionItem[];
62 | $hsStepperCollection: ICollectionItem[];
63 | $hsStrongPasswordCollection: ICollectionItem[];
64 | $hsTabsCollection: ICollectionItem[];
65 | $hsTextareaAutoHeightCollection: ICollectionItem[];
66 | $hsThemeSwitchCollection: ICollectionItem[];
67 | $hsToggleCountCollection: ICollectionItem[];
68 | $hsTogglePasswordCollection: ICollectionItem[];
69 | $hsTooltipCollection: ICollectionItem[];
70 | $hsTreeViewCollection: ICollectionItem[];
71 | }
72 | }
73 |
74 | const HSStaticMethods: IStaticMethods = {
75 | getClassProperty,
76 | afterTransition,
77 | autoInit(collection: string | string[] = 'all') {
78 | if (collection === 'all') {
79 | COLLECTIONS.forEach(({ fn }) => {
80 | fn?.autoInit();
81 | });
82 | } else {
83 | COLLECTIONS.forEach(({ key, fn }) => {
84 | if (collection.includes(key)) fn?.autoInit();
85 | });
86 | }
87 | },
88 | cleanCollection(name: string | string[] = 'all') {
89 | if (name === 'all') {
90 | COLLECTIONS.forEach(({ collection }) => {
91 | if ((window as any)[collection] instanceof Array) {
92 | (window as any)[collection] = [];
93 | }
94 | });
95 | } else {
96 | COLLECTIONS.forEach(({ key, collection }) => {
97 | if (
98 | name.includes(key) &&
99 | (window as any)[collection] instanceof Array
100 | ) {
101 | (window as any)[collection] = [];
102 | }
103 | });
104 | }
105 | },
106 | };
107 |
108 | if (typeof window !== 'undefined') {
109 | window.HSStaticMethods = HSStaticMethods;
110 | }
111 |
112 | export default HSStaticMethods;
113 |
--------------------------------------------------------------------------------
/src/static/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IStaticMethods {
2 | getClassProperty(el: HTMLElement, prop?: string, val?: string): string;
3 | afterTransition(el: HTMLElement, cb: Function): void;
4 | autoInit(collection?: string | string[]): void;
5 | cleanCollection(collection?: string | string[]): void;
6 | }
7 |
--------------------------------------------------------------------------------
/src/static/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/src/utils/interfaces.ts:
--------------------------------------------------------------------------------
1 | export interface IMenuSearchHistory {
2 | historyIndex: number;
3 |
4 | addHistory(index: number): void;
5 | existsInHistory(index: number): boolean;
6 | clearHistory(): void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/utils/types.ts:
--------------------------------------------------------------------------------
1 | // no types
2 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "outDir": "./dist/",
5 | "sourceMap": true,
6 | "noImplicitAny": true,
7 | "module": "commonjs",
8 | "target": "es2015", // Class extend requires using "es2015" instead of "es5"
9 | "allowJs": true,
10 | "moduleResolution": "node",
11 | "esModuleInterop": true
12 | },
13 | "include": [
14 | "src/**/*",
15 | "global.d.ts"
16 | ],
17 | "exclude": [
18 | "node_modules",
19 | "**/*.spec.ts"
20 | ]
21 | }
--------------------------------------------------------------------------------
/tsconfig.mjs.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "ESNext",
4 | "target": "ES6",
5 | "moduleResolution": "node",
6 | "esModuleInterop": true,
7 | "sourceMap": true,
8 | "noImplicitAny": true,
9 | "allowJs": true,
10 | "baseUrl": ".",
11 | "outDir": "./dist",
12 | "allowSyntheticDefaultImports": true
13 | },
14 | "include": [
15 | "src/**/*",
16 | "./global.d.ts"
17 | ],
18 | "exclude": [
19 | "node_modules",
20 | "**/*.spec.ts"
21 | ]
22 | }
--------------------------------------------------------------------------------
/variants.css:
--------------------------------------------------------------------------------
1 | /* States */
2 | @custom-variant hs-success {
3 |
4 | &.success {
5 | @slot;
6 | }
7 |
8 | .success & {
9 | @slot;
10 | }
11 | }
12 |
13 | @custom-variant hs-error {
14 |
15 | &.error {
16 | @slot;
17 | }
18 |
19 | .error & {
20 | @slot;
21 | }
22 | }
23 |
24 | /* Preline */
25 | @import './src/plugins/dropdown/variants.css';
26 | @import './src/plugins/remove-element/variants.css';
27 | @import './src/plugins/tooltip/variants.css';
28 | @import './src/plugins/accordion/variants.css';
29 | @import './src/plugins/tree-view/variants.css';
30 | @import './src/plugins/collapse/variants.css';
31 | @import './src/plugins/tabs/variants.css';
32 | @import './src/plugins/overlay/variants.css';
33 | @import './src/plugins/scrollspy/variants.css';
34 | @import './src/plugins/carousel/variants.css';
35 | @import './src/plugins/select/variants.css';
36 | @import './src/plugins/input-number/variants.css';
37 | @import './src/plugins/pin-input/variants.css';
38 | @import './src/plugins/strong-password/variants.css';
39 | @import './src/plugins/stepper/variants.css';
40 | @import './src/plugins/combobox/variants.css';
41 | @import './src/plugins/layout-splitter/variants.css';
42 | @import './src/plugins/scroll-nav/variants.css';
43 | @import './src/plugins/datatable/variants.css';
44 | @import './src/plugins/range-slider/variants.css';
45 | @import './src/plugins/file-upload/variants.css';
46 | @import './src/plugins/datepicker/variants.css';
47 | @import './src/plugins/theme-switch/variants.css';
48 |
49 | /* Apexcharts */
50 | @custom-variant hs-apexcharts-tooltip-dark {
51 | &.dark {
52 | @slot;
53 | }
54 | }
55 |
56 | /* Sortable.js */
57 | @custom-variant hs-dragged {
58 | &.dragged {
59 | @slot;
60 | }
61 | }
62 |
63 | /* Toastify */
64 | @custom-variant hs-toastify-on {
65 |
66 | &.toastify.on {
67 | @slot;
68 | }
69 |
70 | .toastify.on & {
71 | @slot;
72 | }
73 | }
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const TerserPlugin = require('terser-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: 'production',
6 | stats: 'minimal',
7 | entry: {
8 | index: './src/index.ts',
9 | accordion: './src/plugins/accordion/index.ts',
10 | carousel: './src/plugins/carousel/index.ts',
11 | collapse: './src/plugins/collapse/index.ts',
12 | combobox: './src/plugins/combobox/index.ts',
13 | 'copy-markup': './src/plugins/copy-markup/index.ts',
14 | datatable: './src/plugins/datatable/index.ts',
15 | datepicker: './src/plugins/datepicker/index.ts',
16 | dropdown: './src/plugins/dropdown/index.ts',
17 | 'file-upload': './src/plugins/file-upload/index.ts',
18 | 'input-number': './src/plugins/input-number/index.ts',
19 | 'layout-splitter': './src/plugins/layout-splitter/index.ts',
20 | overlay: './src/plugins/overlay/index.ts',
21 | 'pin-input': './src/plugins/pin-input/index.ts',
22 | 'range-slider': './src/plugins/range-slider/index.ts',
23 | 'remove-element': './src/plugins/remove-element/index.ts',
24 | 'scroll-nav': './src/plugins/scroll-nav/index.ts',
25 | scrollspy: './src/plugins/scrollspy/index.ts',
26 | select: './src/plugins/select/index.ts',
27 | stepper: './src/plugins/stepper/index.ts',
28 | 'strong-password': './src/plugins/strong-password/index.ts',
29 | tabs: './src/plugins/tabs/index.ts',
30 | 'textarea-auto-height': './src/plugins/textarea-auto-height/index.ts',
31 | 'theme-switch': './src/plugins/theme-switch/index.ts',
32 | 'toggle-count': './src/plugins/toggle-count/index.ts',
33 | 'toggle-password': './src/plugins/toggle-password/index.ts',
34 | tooltip: './src/plugins/tooltip/index.ts',
35 | 'tree-view': './src/plugins/tree-view/index.ts',
36 |
37 | // Helpers
38 | 'helper-apexcharts': './src/helpers/apexcharts/index.ts',
39 | 'helper-clipboard': './src/helpers/clipboard/index.ts',
40 | },
41 | module: {
42 | rules: [
43 | { test: /\.ts?$/, enforce: 'pre', use: ['source-map-loader'] },
44 | { test: /\.ts?$/, use: 'ts-loader', exclude: /node_modules/ },
45 | ],
46 | },
47 | resolve: {
48 | extensions: ['.ts', '.js'],
49 | },
50 | output: {
51 | path: path.resolve(__dirname, 'dist'),
52 | filename: '[name].js',
53 | library: { type: 'umd' },
54 | },
55 | externals: {
56 | jquery: 'jQuery',
57 | lodash: '_',
58 | 'datatable.net-dt': 'DataTable',
59 | dropzone: 'Dropzone',
60 | clipboard: 'ClipboardJS',
61 | noUiSlider: 'noUiSlider',
62 | VanillaCalendarPro: 'VanillaCalendarPro'
63 | },
64 | optimization: {
65 | minimize: true,
66 | minimizer: [
67 | new TerserPlugin({
68 | extractComments: false,
69 | }),
70 | ],
71 | },
72 | };
73 |
--------------------------------------------------------------------------------
/webpack.config.mjs.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const TerserPlugin = require('terser-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: 'production',
6 | stats: 'minimal',
7 | entry: {
8 | index: './src/index.ts',
9 | accordion: './src/plugins/accordion/index.ts',
10 | carousel: './src/plugins/carousel/index.ts',
11 | collapse: './src/plugins/collapse/index.ts',
12 | combobox: './src/plugins/combobox/index.ts',
13 | 'copy-markup': './src/plugins/copy-markup/index.ts',
14 | datatable: './src/plugins/datatable/index.ts',
15 | datepicker: './src/plugins/datepicker/index.ts',
16 | dropdown: './src/plugins/dropdown/index.ts',
17 | 'file-upload': './src/plugins/file-upload/index.ts',
18 | 'input-number': './src/plugins/input-number/index.ts',
19 | 'layout-splitter': './src/plugins/layout-splitter/index.ts',
20 | overlay: './src/plugins/overlay/index.ts',
21 | 'pin-input': './src/plugins/pin-input/index.ts',
22 | 'range-slider': './src/plugins/range-slider/index.ts',
23 | 'remove-element': './src/plugins/remove-element/index.ts',
24 | 'scroll-nav': './src/plugins/scroll-nav/index.ts',
25 | scrollspy: './src/plugins/scrollspy/index.ts',
26 | select: './src/plugins/select/index.ts',
27 | stepper: './src/plugins/stepper/index.ts',
28 | 'strong-password': './src/plugins/strong-password/index.ts',
29 | tabs: './src/plugins/tabs/index.ts',
30 | 'textarea-auto-height': './src/plugins/textarea-auto-height/index.ts',
31 | 'theme-switch': './src/plugins/theme-switch/index.ts',
32 | 'toggle-count': './src/plugins/toggle-count/index.ts',
33 | 'toggle-password': './src/plugins/toggle-password/index.ts',
34 | tooltip: './src/plugins/tooltip/index.ts',
35 | 'tree-view': './src/plugins/tree-view/index.ts',
36 |
37 | // Helpers
38 | 'helper-apexcharts': './src/helpers/apexcharts/index.ts',
39 | 'helper-clipboard': './src/helpers/clipboard/index.ts',
40 | },
41 | module: {
42 | rules: [
43 | { test: /\.ts?$/, enforce: 'pre', use: ['source-map-loader'] },
44 | {
45 | test: /\.ts?$/,
46 | use: [
47 | {
48 | loader: 'ts-loader',
49 | options: {
50 | configFile: 'tsconfig.mjs.json',
51 | },
52 | },
53 | ],
54 | exclude: /node_modules/,
55 | },
56 | ],
57 | },
58 | experiments: {
59 | outputModule: true,
60 | },
61 | resolve: {
62 | extensions: ['.ts', '.js'],
63 | },
64 | output: {
65 | path: path.resolve(__dirname, 'dist'),
66 | filename: '[name].mjs',
67 | libraryTarget: 'module',
68 | },
69 | externals: {
70 | jquery: 'jQuery',
71 | lodash: '_',
72 | 'datatable.net-dt': 'DataTable',
73 | dropzone: 'Dropzone',
74 | clipboard: 'ClipboardJS',
75 | noUiSlider: 'noUiSlider',
76 | VanillaCalendarPro: 'VanillaCalendarPro'
77 | },
78 | optimization: {
79 | minimize: true,
80 | minimizer: [
81 | new TerserPlugin({
82 | extractComments: false,
83 | }),
84 | ],
85 | },
86 | };
87 |
--------------------------------------------------------------------------------