This commit is contained in:
sasha-astiadi
2024-05-03 06:39:20 +02:00
parent 6bf49421d6
commit 324d5960af
1737 changed files with 254531 additions and 0 deletions

BIN
node_modules/flowbite/.DS_Store generated vendored Normal file

Binary file not shown.

21
node_modules/flowbite/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Bergside Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

778
node_modules/flowbite/README.md generated vendored Normal file
View File

@@ -0,0 +1,778 @@
<p>
<a href="https://flowbite.com" >
<img alt="Flowbite - Tailwind CSS components" width="350" src="https://flowbite.s3.amazonaws.com/github/logo-github.png">
</a><br>
Build websites even faster with components on top of Tailwind CSS
</p>
<p>
<a href="https://discord.com/invite/4eeurUVvTy"><img src="https://img.shields.io/discord/902911619032576090?color=%237289da&label=Discord" alt="Discord"></a>
<a href="https://www.npmjs.com/package/flowbite"><img src="https://img.shields.io/npm/dt/flowbite.svg" alt="Total Downloads"></a>
<a href="https://github.com/themesberg/flowbite/releases"><img src="https://img.shields.io/npm/v/flowbite.svg" alt="Latest Release"></a>
<a href="https://flowbite.com/docs/getting-started/license/"><img src="https://img.shields.io/badge/license-MIT-blue" alt="Licenese"></a>
</p>
------
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Documentation](#documentation)
- [Getting started](#getting-started)
- [Install using NPM](#install-using-npm)
- [Include via CDN](#include-via-cdn)
- [Bundled JavaScript](#bundled-javascript)
- [Data attributes](#data-attributes)
- [Init functions](#init-functions)
- [ESM and CJS](#esm-and-cjs)
- [TypeScript](#typescript)
- [JavaScript Frameworks](#javascript-frameworks)
- [Back-end Frameworks](#back-end-frameworks)
- [Components](#components)
- [Figma Design System](#figma-design-system)
- [Flowbite Blocks](#flowbite-blocks)
- [Flowbite Icons](#flowbite-icons)
- [Pro version](#pro-version)
- [Learn Design Concepts](#learn-design-concepts)
- [Community](#community)
- [Copyright and license](#copyright-and-license)
## Documentation
For full documentation, visit [flowbite.com](https://flowbite.com/).
## Getting started
Flowbite can be included as a plugin into an existing Tailwind CSS project and it is supposed to help you build websites faster by having a set of web components to work with built with the utility classes from Tailwind CSS.
### Install using NPM
Make sure that you have <a href="https://nodejs.org/en/" rel="nofollow" >Node.js</a> and <a href="https://tailwindcss.com/" rel="nofollow" >Tailwind CSS</a> installed.
1. Install Flowbite as a dependency using NPM by running the following command:
```bash
npm install flowbite
```
2. Require Flowbite as a plugin inside the `tailwind.config.js` file:
```javascript
module.exports = {
plugins: [
require('flowbite/plugin')
]
}
```
3. Make sure that you add the template path to the `tailwind.config.js` file:
```javascript
module.exports = {
content: [
"./node_modules/flowbite/**/*.js"
]
}
```
4. Include the main JavaScript file to make interactive elements work:
```html
<script src="../path/to/flowbite/dist/flowbite.js"></script>
```
### Include via CDN
The quickest way to get started working with Flowbite is to simply include the CSS and JavaScript into your project via a CDN service such as UNPKG or CDNJS (content delivery networks).
Require the following minified stylesheet inside the `head` tag:
```html
<link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.1/flowbite.min.css" rel="stylesheet" />
```
And include the following javascript file before the end of the `body` tag:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.1/flowbite.min.js"></script>
```
### Bundled JavaScript
One of the most popular way of using Flowbite is to include the bundled Javascript file which is UMD ready using a bundler such as Webpack or Parcel which makes sure that all of the data attributes and functionality will work out-of-the-box.
You can directly import the main JavaScript file inside your bundled `app-bundle.js` file like this:
```javascript
import 'flowbite';
```
This file has access to all of the components and it automatically applies event listeners to the data attributes.
### Data attributes
The preferred way to use the interactive UI components from Flowbite is via the data attributes interface which allows us to add functionality via the HTML element attributes and most of the examples on our documentation applies this strategy.
For example, to set up a modal component all you need to do is use `data-modal-target` and `data-modal-{toggle|show|hide}` to toggle, show, or hide the component by clicking on any trigger element.
```html
<button data-modal-target="defaultModal" data-modal-toggle="defaultModal" class="block text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" type="button">
Toggle modal
</button>
<!-- Main modal -->
<div id="defaultModal" tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-2xl max-h-full">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<!-- Modal header -->
<div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
Terms of Service
</h3>
<button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="defaultModal">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Close modal</span>
</button>
</div>
<!-- Modal body -->
<div class="p-6 space-y-6">
<p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its citizens, companies around the world are updating their terms of service agreements to comply.
</p>
<p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Unions General Data Protection Regulation (G.D.P.R.) goes into effect on May 25 and is meant to ensure a common set of data rights in the European Union. It requires organizations to notify users as soon as possible of high-risk data breaches that could personally affect them.
</p>
</div>
<!-- Modal footer -->
<div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
<button data-modal-hide="defaultModal" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">I accept</button>
<button data-modal-hide="defaultModal" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-blue-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">Decline</button>
</div>
</div>
</div>
</div>
```
#### Init functions
You can also use the init functions to set up the event listeners yourself. Here's an example how you can do it with Vue or Nuxt:
```
<script setup>
import { onMounted } from 'vue'
import { initFlowbite } from 'flowbite'
// initialize components based on data attribute selectors
onMounted(() => {
initFlowbite();
})
</script>
<template>
// Modal HTML markup with data attributes from Flowbite
</template>
```
The `initFlowbite` function sets up all of the init functions for dropdowns, modals, navbars, tooltips and so on to hook onto the data attributes. Alternatively, you can also initialise each component category class separately with `initDropdowns` or `initModals`.
You can view more examples by browsing the [components from Flowbite](#components).
### ESM and CJS
Flowbite also offers an API for using the components programmatically and it supports both CJS and ESM for JavaScript which can be helpful if you need to expand the default capabilities of the data attributes interface and get access to function callbacks.
Here's an example how you can import and create a new Modal component inside JavaScript:
```javascript
import { Modal } from 'flowbite'
const $modalElement = document.querySelector('#modalEl');
const modalOptions = {
placement: 'bottom-right',
backdrop: 'dynamic',
backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40',
onHide: () => {
console.log('modal is hidden');
},
onShow: () => {
console.log('modal is shown');
},
onToggle: () => {
console.log('modal has been toggled');
}
}
const modal = new Modal($modalElement, modalOptions);
modal.show();
```
Check out the JavaScript behaviour section of each component's page to learn how you can use this.
### TypeScript
Flowbite supports type declarations for the interactive UI components including object interfaces and parameter types. Check out the following examples to learn how you can use types with Flowbite.
Additionally to our code above, we will now import some relevant types from the Flowbite package, namely the `ModalOptions` and `ModalInterface`:
```javascript
import { Modal } from 'flowbite'
import type { ModalOptions, ModalInterface } from 'flowbite'
// other code
```
Generally speaking, all of the components have an interface definition that you can use whenever you create a new object to make sure that you're using the correct types of parameters and methods.
When creating a new modal you can set the `ModalInterface` as the main type:
```javascript
const modal: ModalInterface = new Modal($modalElement, modalOptions);
```
Flowbite also supports type definitions for the options object so if you want to set the placement of the modal based on types, here's how you would do that:
```javascript
const modalOptions: ModalOptions = {
placement: 'top-right'
}
const modal: ModalInterface = new Modal($modalElement, modalOptions);
```
Learn more about Flowbite and TypeScript in the [quickstart guide](https://flowbite.com/docs/getting-started/typescript/).
### JavaScript Frameworks
The awesome open-source community also built and currently maintains the following standalone libraries for React, Vue, Svelte, and Angular:
- [🌀 Flowbite React Library](https://github.com/themesberg/flowbite-react)
- [🍀 Flowbite Vue Library](https://github.com/themesberg/flowbite-vue)
- [🎸 Flowbite Svelte Library](https://github.com/themesberg/flowbite-svelte)
- [📕 Flowbite Angular Library](https://github.com/themesberg/flowbite-angular)
We also wrote integration guides for the following front-end frameworks and libraries:
- [📝 Flowbite with React guide](https://flowbite.com/docs/getting-started/react/)
- [📝 Flowbite with Next.js guide](https://flowbite.com/docs/getting-started/next-js/)
- [📝 Flowbite with Remix guide](https://flowbite.com/docs/getting-started/remix/)
- [📝 Flowbite with Vue guide](https://flowbite.com/docs/getting-started/vue/)
- [📝 Flowbite with Nuxt guide](https://flowbite.com/docs/getting-started/nuxt-js/)
- [📝 Flowbite with Svelte guide](https://flowbite.com/docs/getting-started/svelte/)
- [📝 Flowbite with Astro guide](https://flowbite.com/docs/getting-started/astro/)
- [📝 Flowbite with Gatsby guide](https://flowbite.com/docs/getting-started/gatsby/)
- [📝 Flowbite with SolidJS guide](https://flowbite.com/docs/getting-started/solid-js/)
### Back-end Frameworks
Flowbite has a great integration with most of the back-end frameworks because it relies on vanilla JavaScript:
- [📚 Using Flowbite with Laravel](https://flowbite.com/docs/getting-started/laravel/)
- [🎼 Using Flowbite with Symfony](https://flowbite.com/docs/getting-started/symfony/)
- [🚊 Using Flowbite with Ruby on Rails 7](https://flowbite.com/docs/getting-started/rails/)
- [🐉 Using Flowbite with Phoenix (Elixir)](https://flowbite.com/docs/getting-started/phoenix/)
- [🐸 Using Flowbite with Django](https://flowbite.com/docs/getting-started/django/)
- [🌶 Using Flowbite with Flask](https://flowbite.com/docs/getting-started/flask/)
## Components
Flowbite is an open source collection of UI components built with the utility classes from Tailwind CSS that you can use as a starting point when coding user interfaces and websites.
<table>
<tr>
<td width="33.3333%">Alerts</td>
<td width="33.3333%">Badge</td>
<td width="33.3333%">Breadcrumbs</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/alerts/">
<img alt="Tailwind CSS Alerts" src="https://flowbite.s3.amazonaws.com/github/alerts.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/badge/">
<img alt="Tailwind CSS Badge" src="https://flowbite.s3.amazonaws.com/github/badge.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/breadcrumb/">
<img alt="Tailwind CSS Breadcrumbs" src="https://flowbite.s3.amazonaws.com/github/breadcrumbs.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Buttons</td>
<td width="33.3333%">Button group</td>
<td width="33.3333%">Cards</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/buttons/">
<img alt="Tailwind CSS Buttons" src="https://flowbite.s3.amazonaws.com/github/buttons.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/button-group/">
<img alt="Tailwind CSS Button Group" src="https://flowbite.s3.amazonaws.com/github/button-group.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/card/">
<img alt="Tailwind CSS Cards" src="https://flowbite.s3.amazonaws.com/github/cards.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Dropdown</td>
<td width="33.3333%">Forms</td>
<td width="33.3333%">List group</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/dropdowns/">
<img alt="Tailwind CSS Dropdown" src="https://flowbite.s3.amazonaws.com/github/dropdown.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/forms/">
<img alt="Tailwind CSS Forms" src="https://flowbite.s3.amazonaws.com/github/forms.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/list-group/">
<img alt="Tailwind CSS List group" src="https://flowbite.s3.amazonaws.com/github/list-group.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Typography</td>
<td width="33.3333%">Modal</td>
<td width="33.3333%">Tabs</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/typography/">
<img alt="Tailwind CSS Typography" src="https://flowbite.s3.amazonaws.com/github/typography.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/modal/">
<img alt="Tailwind CSS Modal" src="https://flowbite.s3.amazonaws.com/github/modal.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/tabs/">
<img alt="Tailwind CSS Tabs" src="https://flowbite.s3.amazonaws.com/github/tabs.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Navbar</td>
<td width="33.3333%">Pagination</td>
<td width="33.3333%">Timeline</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/navbar/">
<img alt="Tailwind CSS Navbar" src="https://flowbite.s3.amazonaws.com/github/navbar.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/pagination/">
<img alt="Tailwind CSS Pagination" src="https://flowbite.s3.amazonaws.com/github/pagination.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/timeline/">
<img alt="Tailwind CSS Timeline" src="https://flowbite.s3.amazonaws.com/github/timeline.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Progress bar</td>
<td width="33.3333%">Tables</td>
<td width="33.3333%">Toast</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/progress/">
<img alt="Tailwind CSS Progress Bar" src="https://flowbite.s3.amazonaws.com/github/progress.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/tables/">
<img alt="Tailwind CSS Tables" src="https://flowbite.s3.amazonaws.com/github/tables.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/toast/">
<img alt="Tailwind CSS Toast" src="https://flowbite.s3.amazonaws.com/github/toast.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Tooltips</td>
<td width="33.3333%">Datepicker</td>
<td width="33.3333%">Spinner</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/tooltips/">
<img alt="Tailwind CSS Tooltips" src="https://flowbite.s3.amazonaws.com/github/tooltips.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/plugins/datepicker/">
<img alt="Tailwind CSS Datepicker" src="https://flowbite.s3.amazonaws.com/github/datepicker.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/spinner/">
<img alt="Tailwind CSS Spinner" src="https://flowbite.s3.amazonaws.com/github/spinner.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Footer</td>
<td width="33.3333%">Accordion</td>
<td width="33.3333%">Sidebar</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/footer/">
<img alt="Tailwind CSS Footer" src="https://flowbite.s3.amazonaws.com/github/footer.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/accordion/">
<img alt="Tailwind CSS Accordion" src="https://flowbite.s3.amazonaws.com/github/accordion.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/sidebar/">
<img alt="Tailwind CSS Sidebar" src="https://flowbite.s3.amazonaws.com/github/sidebar.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Carousel</td>
<td width="33.3333%">Avatar</td>
<td width="33.3333%">Rating</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/carousel/">
<img alt="Tailwind CSS Carousel" src="https://flowbite.s3.amazonaws.com/github/carousel.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/avatar/">
<img alt="Tailwind CSS Avatar" src="https://flowbite.s3.amazonaws.com/github/avatar.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/rating/">
<img alt="Tailwind CSS Rating" src="https://flowbite.s3.amazonaws.com/github/rating.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Input Field</td>
<td width="33.3333%">File Input</td>
<td width="33.3333%">Search Input</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/input-field/">
<img alt="Tailwind CSS Input Field" src="https://flowbite.s3.amazonaws.com/github/input-field.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/file-input/">
<img alt="Tailwind CSS File Input" src="https://flowbite.s3.amazonaws.com/github/file-input.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/search-input/">
<img alt="Tailwind CSS Search Input" src="https://flowbite.s3.amazonaws.com/github/search-input.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Select</td>
<td width="33.3333%">Textarea</td>
<td width="33.3333%">Checkbox</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/select/">
<img alt="Tailwind CSS Select" src="https://flowbite.s3.amazonaws.com/github/select.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/textarea/">
<img alt="Tailwind CSS Textarea" src="https://flowbite.s3.amazonaws.com/github/textarea.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/checkbox/">
<img alt="Tailwind CSS Checkbox" src="https://flowbite.s3.amazonaws.com/github/checkbox.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Radio</td>
<td width="33.3333%">Toggle</td>
<td width="33.3333%">Range Slider</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/radio/">
<img alt="Tailwind CSS Radio" src="https://flowbite.s3.amazonaws.com/github/radio.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/toggle/">
<img alt="Tailwind CSS Toggle" src="https://flowbite.s3.amazonaws.com/github/toggle.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/range/">
<img alt="Tailwind CSS Range Slider" src="https://flowbite.s3.amazonaws.com/github/range-slider.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Floating Label</td>
<td width="33.3333%">Mega Menu</td>
<td width="33.3333%">Skeleton</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/forms/floating-label/">
<img alt="Tailwind CSS Floating Label" src="https://flowbite.s3.amazonaws.com/github/floating-label.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/mega-menu/">
<img alt="Tailwind CSS Mega Menu" src="https://flowbite.s3.amazonaws.com/github/mega-menu.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/skeleton/">
<img alt="Tailwind CSS Skeleton" src="https://flowbite.s3.amazonaws.com/github/skeleton.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">KBD (keyboard)</td>
<td width="33.3333%">Drawer (offcanvas)</td>
<td width="33.3333%">Popover</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/kbd/">
<img alt="Tailwind CSS KBD (Keyboard)" src="https://flowbite.s3.amazonaws.com/github/kbd.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/drawer/">
<img alt="Tailwind CSS Drawer (offcanvas)" src="https://flowbite.s3.amazonaws.com/github/drawer.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/popover/">
<img alt="Tailwind CSS Popover" src="https://flowbite.s3.amazonaws.com/github/popover.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Video</td>
<td width="33.3333%">Heading</td>
<td width="33.3333%">Paragraph</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/video/">
<img alt="Tailwind CSS Video" src="https://flowbite.s3.amazonaws.com/github/video.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/headings/">
<img alt="Tailwind CSS Heading" src="https://flowbite.s3.amazonaws.com/github/heading.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/paragraphs/">
<img alt="Tailwind CSS Paragraph" src="https://flowbite.s3.amazonaws.com/github/paragraph.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Blockquote</td>
<td width="33.3333%">Image</td>
<td width="33.3333%">List</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/blockquote/">
<img alt="Tailwind CSS Blockquote" src="https://flowbite.s3.amazonaws.com/github/blockquote.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/images/">
<img alt="Tailwind CSS Image" src="https://flowbite.s3.amazonaws.com/github/image.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/lists/">
<img alt="Tailwind CSS List" src="https://flowbite.s3.amazonaws.com/github/list.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Link</td>
<td width="33.3333%">Text</td>
<td width="33.3333%">Horizontal line (HR)</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/links/">
<img alt="Tailwind CSS Link" src="https://flowbite.s3.amazonaws.com/github/link.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/text/">
<img alt="Tailwind CSS Text" src="https://flowbite.s3.amazonaws.com/github/text.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/typography/hr/">
<img alt="Tailwind CSS HR" src="https://flowbite.s3.amazonaws.com/github/hr.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Speed Dial</td>
<td width="33.3333%">Stepper</td>
<td width="33.3333%">Indicators</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/speed-dial/">
<img alt="Tailwind CSS Speed Dial" src="https://flowbite.s3.amazonaws.com/github/dial.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/stepper/">
<img alt="Tailwind CSS Stepper" src="https://flowbite.s3.amazonaws.com/github/stepper.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/indicators/">
<img alt="Tailwind CSS Indicators" src="https://flowbite.s3.amazonaws.com/github/indicators.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Bottom Navigation</td>
<td width="33.3333%">Sticky Banner</td>
<td width="33.3333%">Gallery (Masonry)</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/bottom-navigation/">
<img alt="Tailwind CSS Bottom Navigation Bar" src="https://flowbite.s3.amazonaws.com/github/bottom-bar.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/banner/">
<img alt="Tailwind CSS Bottom Sticky Banner" src="https://flowbite.s3.amazonaws.com/github/banner.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/gallery/">
<img alt="Tailwind CSS Image Gallery (Masonry)" src="https://flowbite.s3.amazonaws.com/github/gallery.jpg">
</a>
</td>
</tr>
<tr>
<td width="33.3333%">Jumbotron</td>
<td width="33.3333%">Device mockups</td>
<td width="33.3333%">Charts</td>
</tr>
<tr>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/jumbotron/">
<img alt="Tailwind CSS Jumbotron" src="https://flowbite.s3.amazonaws.com/github/jumbotron.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/components/device-mockups/">
<img alt="Tailwind CSS Device Mockups" src="https://flowbite.s3.amazonaws.com/github/device-mockups.jpg">
</a>
</td>
<td width="33.3333%">
<a href="https://flowbite.com/docs/plugins/charts/">
<img alt="Tailwind CSS Charts" src="https://flowbite.s3.amazonaws.com/github/charts.jpg">
</a>
</td>
</tr>
</table>
## Figma Design System
If you need the Figma files for the components you can check out our website for more information:
🎨 [Get access to the Figma design files](https://flowbite.com/figma/)
## Flowbite Blocks
Check out Flowbite Blocks to get access to over 330+ website sections coded in Tailwind CSS and Flowbite:
📦 [Check out Flowbite Blocks](https://flowbite.com/blocks/)
## Flowbite Icons
Start using over 430+ free and open-source collection of solid and outline SVG icons built for Tailwind CSS and with support for Figma and JSX (React):
🔍 [Check out the icons](https://flowbite.com/icons/)
## Pro version
Get access to all premium features including the Figma design system, access to all Flowbite Block sections and a dashboard UI interface:
💎 [Check out Flowbite Pro](https://flowbite.com/pro/)
## Learn Design Concepts
If you want to create even better Flowbite pages, learn design fundamentals from Teach Me Design - Enhance UI, a book that covers color theory, typography, UI and UX so you can make the most to implement the Flowbite Ecosystem!
📖 [Learn with Enhance UI](https://www.enhanceui.com/?ref=flowbite-github)
## Community
If you need help or just want to discuss about the library join the community on Github:
⌨️ [Discuss about Flowbite on GitHub](https://github.com/themesberg/flowbite/discussions)
For casual chatting with others using the library:
💬 [Join the Flowbite Discord Server](https://discord.gg/4eeurUVvTy)
Video tutorials and presentations using Flowbite:
🎥 [Subscribe to our YouTube channel](https://www.youtube.com/channel/UC_Ms4V2kYDsh7F_CSsHyQ6A)
## Copyright and license
The Flowbite name and logos are trademarks of Bergside Inc.
- 📝 [Read about the licensing terms](https://flowbite.com/docs/getting-started/license/)
- 📀 [Brand guideline and trademark usage agreement](https://flowbite.com/brand/)

3119
node_modules/flowbite/dist/datepicker.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/flowbite/dist/datepicker.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/flowbite/dist/datepicker.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

3141
node_modules/flowbite/dist/datepicker.turbo.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/flowbite/dist/datepicker.turbo.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/flowbite/dist/datepicker.turbo.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

7979
node_modules/flowbite/dist/flowbite.css generated vendored Normal file

File diff suppressed because it is too large Load Diff

4434
node_modules/flowbite/dist/flowbite.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/flowbite/dist/flowbite.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/flowbite/dist/flowbite.min.css generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/flowbite/dist/flowbite.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/flowbite/dist/flowbite.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

4438
node_modules/flowbite/dist/flowbite.phoenix.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/flowbite/dist/flowbite.phoenix.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/flowbite/dist/flowbite.phoenix.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4438
node_modules/flowbite/dist/flowbite.turbo.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/flowbite/dist/flowbite.turbo.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/flowbite/dist/flowbite.turbo.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/flowbite/dist/flowbite.turbo.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
import type { AccordionItem, AccordionOptions } from './types';
import { AccordionInterface } from './interface';
declare class Accordion implements AccordionInterface {
_items: AccordionItem[];
_options: AccordionOptions;
constructor(items?: AccordionItem[], options?: AccordionOptions);
private _init;
getItem(id: string): AccordionItem;
open(id: string): void;
toggle(id: string): void;
close(id: string): void;
}
export declare function initAccordions(): void;
export default Accordion;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,cAAM,SAAU,YAAW,kBAAkB;IACzC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;gBAGvB,KAAK,GAAE,aAAa,EAAO,EAC3B,OAAO,GAAE,gBAA0B;IAOvC,OAAO,CAAC,KAAK;IAeb,OAAO,CAAC,EAAE,EAAE,MAAM;IAIlB,IAAI,CAAC,EAAE,EAAE,MAAM;IA2Cf,MAAM,CAAC,EAAE,EAAE,MAAM;IAajB,KAAK,CAAC,EAAE,EAAE,MAAM;CAqBnB;AAED,wBAAgB,cAAc,SA2C7B;AAOD,eAAe,SAAS,CAAC"}

View File

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

View File

@@ -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I,CAAC,CAAC;aACpB;QACL,CAAC,CAAC,CAAC;QAEP,IAAI,SAAS,CAAC,KAAK,EAAE;YACjB,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YAChD,aAAa,EAAE,aAAa;gBACxB,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,OAAO,CAAC,aAAa;YAC3B,eAAe,EAAE,eAAe;gBAC5B,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,OAAO,CAAC,eAAe;SACZ,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC;AA3CD,wCA2CC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;CAC1C;AAED,kBAAe,SAAS,CAAC"}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,54 @@
import type { CarouselOptions, CarouselItem, IndicatorItem, RotationItems } from './types';
import { CarouselInterface } from './interface';
declare class Carousel implements CarouselInterface {
_items: CarouselItem[];
_indicators: IndicatorItem[];
_activeItem: CarouselItem;
_intervalDuration: number;
_intervalInstance: number;
_options: CarouselOptions;
constructor(items?: CarouselItem[], options?: CarouselOptions);
/**
* initialize carousel and items based on active one
*/
_init(): void;
getItem(position: number): CarouselItem;
/**
* Slide to the element based on id
* @param {*} position
*/
slideTo(position: number): void;
/**
* Based on the currently active item it will go to the next position
*/
next(): void;
/**
* Based on the currently active item it will go to the previous position
*/
prev(): void;
/**
* This method applies the transform classes based on the left, middle, and right rotation carousel items
* @param {*} rotationItems
*/
_rotate(rotationItems: RotationItems): void;
/**
* Set an interval to cycle through the carousel items
*/
cycle(): void;
/**
* Clears the cycling interval
*/
pause(): void;
/**
* Get the currently active item
*/
_getActiveItem(): CarouselItem;
/**
* Set the currently active item and data attribute
* @param {*} position
*/
_setActiveItem(item: CarouselItem): void;
}
export declare function initCarousels(): void;
export default Carousel;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBhD,cAAM,QAAS,YAAW,iBAAiB;IACvC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,WAAW,EAAE,YAAY,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;gBAGtB,KAAK,GAAE,YAAY,EAAO,EAC1B,OAAO,GAAE,eAAyB;IAetC;;OAEG;IACH,KAAK;IAwBL,OAAO,CAAC,QAAQ,EAAE,MAAM;IAIxB;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM;IAuBxB;;OAEG;IACH,IAAI;IAiBJ;;OAEG;IACH,IAAI;IAiBJ;;;OAGG;IACH,OAAO,CAAC,aAAa,EAAE,aAAa;IAqCpC;;OAEG;IACH,KAAK;IAQL;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,cAAc;IAId;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,YAAY;CAwBpC;AAED,wBAAgB,aAAa,SA0E5B;AAOD,eAAe,QAAQ,CAAC"}

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,16 @@
import type { CollapseOptions } from './types';
import { CollapseInterface } from './interface';
declare class Collapse implements CollapseInterface {
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: CollapseOptions;
_visible: boolean;
constructor(targetEl?: HTMLElement | null, triggerEl?: HTMLElement | null, options?: CollapseOptions);
_init(): void;
collapse(): void;
expand(): void;
toggle(): void;
}
export declare function initCollapses(): void;
export default Collapse;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/collapse/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,cAAM,QAAS,YAAW,iBAAiB;IACvC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;gBAGd,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,OAAO,GAAE,eAAyB;IAStC,KAAK;IAgBL,QAAQ;IAWR,MAAM;IAWN,MAAM;CAST;AAED,wBAAgB,aAAa,SAmB5B;AAOD,eAAe,QAAQ,CAAC"}

View File

@@ -0,0 +1,98 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initCollapses = void 0;
var Default = {
onCollapse: function () { },
onExpand: function () { },
onToggle: function () { },
};
var Collapse = /** @class */ (function () {
function Collapse(targetEl, triggerEl, options) {
if (targetEl === void 0) { targetEl = null; }
if (triggerEl === void 0) { triggerEl = null; }
if (options === void 0) { options = Default; }
this._targetEl = targetEl;
this._triggerEl = triggerEl;
this._options = __assign(__assign({}, Default), options);
this._visible = false;
this._init();
}
Collapse.prototype._init = function () {
var _this = this;
if (this._triggerEl) {
if (this._triggerEl.hasAttribute('aria-expanded')) {
this._visible =
this._triggerEl.getAttribute('aria-expanded') === 'true';
}
else {
// fix until v2 not to break previous single collapses which became dismiss
this._visible = !this._targetEl.classList.contains('hidden');
}
this._triggerEl.addEventListener('click', function () {
_this.toggle();
});
}
};
Collapse.prototype.collapse = function () {
this._targetEl.classList.add('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'false');
}
this._visible = false;
// callback function
this._options.onCollapse(this);
};
Collapse.prototype.expand = function () {
this._targetEl.classList.remove('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'true');
}
this._visible = true;
// callback function
this._options.onExpand(this);
};
Collapse.prototype.toggle = function () {
if (this._visible) {
this.collapse();
}
else {
this.expand();
}
// callback function
this._options.onToggle(this);
};
return Collapse;
}());
function initCollapses() {
document
.querySelectorAll('[data-collapse-toggle]')
.forEach(function ($triggerEl) {
var targetId = $triggerEl.getAttribute('data-collapse-toggle');
var $targetEl = document.getElementById(targetId);
// check if the target element exists
if ($targetEl) {
new Collapse($targetEl, $triggerEl);
}
else {
console.error("The target element with id \"".concat(targetId, "\" does not exist. Please check the data-collapse-toggle attribute."));
}
});
}
exports.initCollapses = initCollapses;
if (typeof window !== 'undefined') {
window.Collapse = Collapse;
window.initCollapses = initCollapses;
}
exports.default = Collapse;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/collapse/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,IAAM,OAAO,GAAoB;IAC7B,UAAU,EAAE,cAAO,CAAC;IACpB,QAAQ,EAAE,cAAO,CAAC;IAClB,QAAQ,EAAE,cAAO,CAAC;CACrB,CAAC;AAEF;IAMI,kBACI,QAAmC,EACnC,SAAoC,EACpC,OAAkC;QAFlC,yBAAA,EAAA,eAAmC;QACnC,0BAAA,EAA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IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;SACzD;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,yBAAM,GAAN;QACI,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,EAAE,CAAC;SACnB;aAAM;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;SACjB;QACD,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACL,eAAC;AAAD,CAAC,AAjED,IAiEC;AAED,SAAgB,aAAa;IACzB,QAAQ;SACH,gBAAgB,CAAC,wBAAwB,CAAC;SAC1C,OAAO,CAAC,UAAC,UAAU;QAChB,IAAM,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;QACjE,IAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAEpD,qCAAqC;QACrC,IAAI,SAAS,EAAE;YACX,IAAI,QAAQ,CACR,SAAwB,EACxB,UAAyB,CAC5B,CAAC;SACL;aAAM;YACH,OAAO,CAAC,KAAK,CACT,uCAA+B,QAAQ,wEAAoE,CAC9G,CAAC;SACL;IACL,CAAC,CAAC,CAAC;AACX,CAAC;AAnBD,sCAmBC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;CACxC;AAED,kBAAe,QAAQ,CAAC"}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,23 @@
import type { DialOptions, DialTriggerType } from './types';
import { DialInterface } from './interface';
declare class Dial implements DialInterface {
_parentEl: HTMLElement;
_triggerEl: HTMLElement;
_targetEl: HTMLElement;
_options: DialOptions;
_visible: boolean;
constructor(parentEl?: HTMLElement | null, triggerEl?: HTMLElement | null, targetEl?: HTMLElement | null, options?: DialOptions);
_init(): void;
hide(): void;
show(): void;
toggle(): void;
isHidden(): boolean;
isVisible(): boolean;
_getTriggerEventTypes(triggerType: DialTriggerType): {
showEvents: string[];
hideEvents: string[];
};
}
export declare function initDials(): void;
export default Dial;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dial/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5C,cAAM,IAAK,YAAW,aAAa;IAC/B,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,WAAW,CAAC;IACvB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;gBAGd,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,OAAO,GAAE,WAAqB;IAUlC,KAAK;IAuBL,IAAI;IAWJ,IAAI;IAWJ,MAAM;IAQN,QAAQ;IAIR,SAAS;IAIT,qBAAqB,CAAC,WAAW,EAAE,eAAe;;;;CAwBrD;AAED,wBAAgB,SAAS,SAgCxB;AAOD,eAAe,IAAI,CAAC"}

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

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/dial/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,IAAM,OAAO,GAAgB;IACzB,WAAW,EAAE,OAAO;IACpB,MAAM,EAAE,cAAO,CAAC;IAChB,MAAM,EAAE,cAAO,CAAC;IAChB,QAAQ,EAAE,cAAO,CAAC;CACrB,CAAC;AAEF;IAOI,cACI,QAAmC,EACnC,SAAoC,EACpC,QAAmC,EACnC,OAA8B;QAH9B,yBAAA,EAAA,eAAmC;QACnC,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}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
import type { DismissOptions } from './types';
import { DismissInterface } from './interface';
declare class Dismiss implements DismissInterface {
_targetEl: HTMLElement | null;
_triggerEl: HTMLElement | null;
_options: DismissOptions;
constructor(targetEl?: HTMLElement | null, triggerEl?: HTMLElement | null, options?: DismissOptions);
_init(): void;
hide(): void;
}
export declare function initDismisses(): void;
export default Dismiss;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dismiss/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAS/C,cAAM,OAAQ,YAAW,gBAAgB;IACrC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;gBAGrB,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,SAAS,GAAE,WAAW,GAAG,IAAW,EACpC,OAAO,GAAE,cAAwB;IAQrC,KAAK;IAQL,IAAI;CAcP;AAED,wBAAgB,aAAa,SAa5B;AAOD,eAAe,OAAO,CAAC"}

View File

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

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/dismiss/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,IAAM,OAAO,GAAmB;IAC5B,UAAU,EAAE,oBAAoB;IAChC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,cAAO,CAAC;CACnB,CAAC;AAEF;IAKI,iBACI,QAAmC,EACnC,SAAoC,EACpC,OAAiC;QAFjC,yBAAA,EAAA,eAAmC;QACnC,0BAAA,EAAA,gBAAoC;QACpC,wBAAA,EAAA,iBAAiC;QAEjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,yBAAQ,OAAO,GAAK,OAAO,CAAE,CAAC;QAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,uBAAK,GAAL;QAAA,iBAMC;QALG,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE;gBACtC,KAAI,CAAC,IAAI,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED,sBAAI,GAAJ;QAAA,iBAaC;QAZG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CACxB,IAAI,CAAC,QAAQ,CAAC,UAAU,EACxB,mBAAY,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAE,EACpC,IAAI,CAAC,QAAQ,CAAC,MAAM,EACpB,WAAW,CACd,CAAC;QACF,UAAU,CAAC;YACP,KAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE3B,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IACL,cAAC;AAAD,CAAC,AAtCD,IAsCC;AAED,SAAgB,aAAa;IACzB,QAAQ,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,UAAC,UAAU;QAClE,IAAM,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAChE,IAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAEpD,IAAI,UAAU,EAAE;YACZ,IAAI,OAAO,CAAC,UAAyB,EAAE,UAAyB,CAAC,CAAC;SACrE;aAAM;YACH,OAAO,CAAC,KAAK,CACT,wCAAgC,QAAQ,uEAAmE,CAC9G,CAAC;SACL;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,sCAaC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;CACxC;AAED,kBAAe,OAAO,CAAC"}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,21 @@
import type { DrawerOptions, PlacementClasses } from './types';
import { DrawerInterface } from './interface';
declare class Drawer implements DrawerInterface {
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DrawerOptions;
_visible: boolean;
constructor(targetEl?: HTMLElement | null, options?: DrawerOptions);
_init(): void;
hide(): void;
show(): void;
toggle(): void;
_createBackdrop(): void;
_destroyBackdropEl(): void;
_getPlacementClasses(placement: string): PlacementClasses;
isHidden(): boolean;
isVisible(): boolean;
}
export declare function initDrawers(): void;
export default Drawer;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAe9C,cAAM,MAAO,YAAW,eAAe;IACnC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;gBAGd,QAAQ,GAAE,WAAW,GAAG,IAAW,EACnC,OAAO,GAAE,aAAuB;IAQpC,KAAK;IAwBL,IAAI;IA+CJ,IAAI;IA8CJ,MAAM;IAQN,eAAe;IAcf,kBAAkB;IAMlB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAyCzD,QAAQ;IAIR,SAAS;CAGZ;AAQD,wBAAgB,WAAW,SA+H1B;AAOD,eAAe,MAAM,CAAC"}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
import { DrawerOptions, PlacementClasses } from './types';
export declare interface DrawerInterface {
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DrawerOptions;
_visible: boolean;
_init(): void;
isVisible(): boolean;
isHidden(): boolean;
hide(): void;
show(): void;
toggle(): void;
_createBackdrop(): void;
_destroyBackdropEl(): void;
_getPlacementClasses(placement: string): PlacementClasses;
}
//# sourceMappingURL=interface.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,OAAO,WAAW,eAAe;IAEpC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAGlB,KAAK,IAAI,IAAI,CAAC;IACd,SAAS,IAAI,OAAO,CAAC;IACrB,QAAQ,IAAI,OAAO,CAAC;IACpB,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,IAAI,CAAC;IACf,eAAe,IAAI,IAAI,CAAC;IACxB,kBAAkB,IAAI,IAAI,CAAC;IAC3B,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC7D"}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,29 @@
import type { Instance as PopperInstance } from '@popperjs/core';
import type { DropdownOptions } from './types';
import { DropdownInterface } from './interface';
declare class Dropdown implements DropdownInterface {
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DropdownOptions;
_visible: boolean;
_popperInstance: PopperInstance;
_clickOutsideEventListener: EventListenerOrEventListenerObject;
constructor(targetElement?: HTMLElement | null, triggerElement?: HTMLElement | null, options?: DropdownOptions);
_init(): void;
_setupEventListeners(): void;
_createPopperInstance(): PopperInstance;
_setupClickOutsideListener(): void;
_removeClickOutsideListener(): void;
_handleClickOutside(ev: Event, targetEl: HTMLElement): void;
_getTriggerEvents(): {
showEvents: string[];
hideEvents: string[];
};
toggle(): void;
isVisible(): boolean;
show(): void;
hide(): void;
}
export declare function initDropdowns(): void;
export default Dropdown;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,QAAQ,IAAI,cAAc,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAchD,cAAM,QAAS,YAAW,iBAAiB;IACvC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,cAAc,CAAC;IAChC,0BAA0B,EAAE,kCAAkC,CAAC;gBAG3D,aAAa,GAAE,WAAW,GAAG,IAAW,EACxC,cAAc,GAAE,WAAW,GAAG,IAAW,EACzC,OAAO,GAAE,eAAyB;IAUtC,KAAK;IAML,oBAAoB;IA+CpB,qBAAqB;IAiBrB,0BAA0B;IAW1B,2BAA2B;IAQ3B,mBAAmB,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW;IA+BpD,iBAAiB;;;;IAyBjB,MAAM;IASN,SAAS;IAIT,IAAI;IAuBJ,IAAI;CAoBP;AAED,wBAAgB,aAAa,SAmD5B;AAOD,eAAe,QAAQ,CAAC"}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
import { DropdownOptions, DropdownTriggerType, DropdownTriggerEventTypes } from './types';
import type { Instance as PopperInstance } from '@popperjs/core';
export declare interface DropdownInterface {
_targetEl: HTMLElement;
_triggerEl: HTMLElement;
_options: DropdownOptions;
_visible: boolean;
_popperInstance: PopperInstance;
_clickOutsideEventListener: EventListenerOrEventListenerObject;
_init(): void;
_createPopperInstance(): PopperInstance;
_setupEventListeners(): void;
_setupClickOutsideListener(): void;
_removeClickOutsideListener(): void;
_handleClickOutside(ev: Event, targetEl: HTMLElement): void;
_getTriggerEvents(triggerType: DropdownTriggerType): DropdownTriggerEventTypes;
isVisible(): boolean;
toggle(): void;
show(): void;
hide(): void;
}
//# sourceMappingURL=interface.d.ts.map

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