flowbite
flowbite copied to clipboard
[email protected] with Turbo on Rails7
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/flowbite/dist/flowbite.js b/node_modules/flowbite/dist/flowbite.js
index 5c7e402..85bd425 100644
--- a/node_modules/flowbite/dist/flowbite.js
+++ b/node_modules/flowbite/dist/flowbite.js
@@ -162,7 +162,7 @@ var Accordion = /*#__PURE__*/function () {
}();
window.Accordion = Accordion;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-accordion]').forEach(function (accordionEl) {
var alwaysOpen = accordionEl.getAttribute('data-accordion');
var activeClasses = accordionEl.getAttribute('data-active-classes');
@@ -280,7 +280,7 @@ var Collapse = /*#__PURE__*/function () {
}();
window.Collapse = Collapse;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-collapse-toggle]').forEach(function (triggerEl) {
var targetEl = document.getElementById(triggerEl.getAttribute('data-collapse-toggle'));
new Collapse(targetEl, {
@@ -536,7 +536,7 @@ var Carousel = /*#__PURE__*/function () {
}();
window.Carousel = Carousel;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-carousel]').forEach(function (carouselEl) {
var interval = carouselEl.getAttribute('data-carousel-interval');
var slide = carouselEl.getAttribute('data-carousel') === 'slide' ? true : false;
@@ -662,7 +662,7 @@ var Dismiss = /*#__PURE__*/function () {
}();
window.Dismiss = Dismiss;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-dismiss-target]').forEach(function (triggerEl) {
var targetEl = document.querySelector(triggerEl.getAttribute('data-dismiss-target'));
new Dismiss(targetEl, {
@@ -2801,7 +2801,7 @@ var Dropdown = /*#__PURE__*/function () {
}();
window.Dropdown = Dropdown;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-dropdown-toggle]').forEach(function (triggerEl) {
var targetEl = document.getElementById(triggerEl.getAttribute('data-dropdown-toggle'));
var placement = triggerEl.getAttribute('data-dropdown-placement');
@@ -2995,7 +2995,7 @@ var getModalInstance = function getModalInstance(id, instances) {
return false;
};
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
var modalInstances = [];
document.querySelectorAll('[data-modal-toggle]').forEach(function (el) {
var modalId = el.getAttribute('data-modal-toggle');
@@ -3160,7 +3160,7 @@ var Tabs = /*#__PURE__*/function () {
}();
window.Tabs = Tabs;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-tabs-toggle]').forEach(function (triggerEl) {
var tabElements = [];
var defaultTabId = null;
@@ -3337,7 +3337,7 @@ var Tooltip = /*#__PURE__*/function () {
}();
window.Tooltip = Tooltip;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('turbo:load', function () {
document.querySelectorAll('[data-tooltip-target]').forEach(function (triggerEl) {
var targetEl = document.getElementById(triggerEl.getAttribute('data-tooltip-target'));
var triggerType = triggerEl.getAttribute('data-tooltip-trigger');
This issue body was partially generated by patch-package.