From cb4eb90bbb3deb6e397ec80f1599003509819094 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Thu, 21 Mar 2024 16:50:53 -0500 Subject: [PATCH] Update dist --- dist/tailwindcss-stimulus-components.cjs | 2 +- dist/tailwindcss-stimulus-components.cjs.map | 6 +- .../tailwindcss-stimulus-components.module.js | 938 +++++++++++++++++- ...lwindcss-stimulus-components.module.js.map | 6 +- 4 files changed, 944 insertions(+), 8 deletions(-) diff --git a/dist/tailwindcss-stimulus-components.cjs b/dist/tailwindcss-stimulus-components.cjs index e3b66f4..2574068 100644 --- a/dist/tailwindcss-stimulus-components.cjs +++ b/dist/tailwindcss-stimulus-components.cjs @@ -1 +1 @@ -var T=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var U=(t,e,s)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var _=(t,e)=>{for(var s in e)T(t,s,{get:e[s],enumerable:!0})},P=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of M(e))!N.call(t,i)&&i!==s&&T(t,i,{get:()=>e[i],enumerable:!(o=q(e,i))||o.enumerable});return t};var O=t=>P(T({},"__esModule",{value:!0}),t);var a=(t,e,s)=>(U(t,typeof e!="symbol"?e+"":e,s),s),z=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var V=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)};var C=(t,e,s)=>(z(t,e,"access private method"),s);var Q={};_(Q,{Alert:()=>p,Autosave:()=>u,ColorPreview:()=>h,Dropdown:()=>n,Modal:()=>c,Popover:()=>d,Slideover:()=>f,Tabs:()=>l,Toggle:()=>m});module.exports=O(Q);var I=require("@hotwired/stimulus");async function r(t,e,s={}){e?x(t,s):b(t,s)}async function x(t,e={}){let s=t.dataset.transitionEnter||e.enter||"enter",o=t.dataset.transitionEnterFrom||e.enterFrom||"enter-from",i=t.dataset.transitionEnterTo||e.enterTo||"enter-to",g=t.dataset.toggleClass||e.toggleClass||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...o.split(" ")),t.classList.remove(...i.split(" ")),t.classList.remove(...g.split(" ")),await w(),t.classList.remove(...o.split(" ")),t.classList.add(...i.split(" "));try{await y(t)}finally{t.classList.remove(...s.split(" "))}}async function b(t,e={}){let s=t.dataset.transitionLeave||e.leave||"leave",o=t.dataset.transitionLeaveFrom||e.leaveFrom||"leave-from",i=t.dataset.transitionLeaveTo||e.leaveTo||"leave-to",g=t.dataset.toggleClass||e.toogle||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...o.split(" ")),t.classList.remove(...i.split(" ")),await w(),t.classList.remove(...o.split(" ")),t.classList.add(...i.split(" "));try{await y(t)}finally{t.classList.remove(...s.split(" ")),t.classList.add(...g.split(" "))}}function w(){return new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(t)})})}function y(t){return Promise.all(t.getAnimations().map(e=>e.finished))}var p=class extends I.Controller{connect(){setTimeout(()=>{x(this.element)},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){b(this.element).then(()=>{this.element.remove()})}};a(p,"values",{dismissAfter:Number,showDelay:{type:Number,default:0},removeDelay:{type:Number,default:1100}});var L=require("@hotwired/stimulus");var u=class extends L.Controller{connect(){this.timeout=null}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=this.submittingTextValue,this.formTarget.requestSubmit()},this.submitDurationValue)}success(){this.setStatus(this.successTextValue)}error(){this.setStatus(this.errorTextValue)}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout(()=>{this.statusTarget.textContent=""},this.statusDurationValue)}};a(u,"targets",["form","status"]),a(u,"values",{submitDuration:{type:Number,default:1e3},statusDuration:{type:Number,default:2e3},submittingText:{type:String,default:"Saving..."},successText:{type:String,default:"Saved!"},errorText:{type:String,default:"Unable to save."}});var A=require("@hotwired/stimulus");var h=class extends A.Controller{update(){this.preview=this.colorTarget.value}set preview(t){this.previewTarget.style[this.styleValue]=t;let e=this._getContrastYIQ(t);this.styleValue==="color"?this.previewTarget.style.backgroundColor=e:this.previewTarget.style.color=e}_getContrastYIQ(t){t=t.replace("#","");let e=128,s=parseInt(t.substr(0,2),16),o=parseInt(t.substr(2,2),16),i=parseInt(t.substr(4,2),16);return(s*299+o*587+i*114)/1e3>=e?"#000":"#fff"}};a(h,"targets",["preview","color"]),a(h,"values",{style:{type:String,default:"backgroundColor"}});var D=require("@hotwired/stimulus");var v,E,n=class extends D.Controller{constructor(){super(...arguments);V(this,v)}connect(){document.addEventListener("turbo:before-cache",this.beforeCache.bind(this)),C(this,v,E).call(this)}disconnect(){document.removeEventListener("turbo:before-cache",this.beforeCache.bind(this)),this.hasButtonTarget&&(this.buttonTarget.removeEventListener("keydown",this._onMenuButtonKeydown),this.buttonTarget.removeAttribute("aria-haspopup"))}openValueChanged(){r(this.menuTarget,this.openValue,this.transitionOptions),this.openValue===!0&&this.hasMenuItemTarget&&this.menuItemTargets[0].focus()}show(){this.openValue=!0}close(){this.openValue=!1}hide(e){this.closeOnClickOutsideValue&&e.target.nodeType&&this.element.contains(e.target)===!1&&this.openValue&&(this.openValue=!1),this.closeOnEscapeValue&&e.key==="Escape"&&this.openValue&&(this.openValue=!1)}toggle(){this.openValue=!this.openValue}nextItem(e){e.preventDefault(),this.menuItemTargets[this.nextIndex].focus()}previousItem(e){e.preventDefault(),this.menuItemTargets[this.previousIndex].focus()}get currentItemIndex(){return this.menuItemTargets.indexOf(document.activeElement)}get nextIndex(){return Math.min(this.currentItemIndex+1,this.menuItemTargets.length-1)}get previousIndex(){return Math.max(this.currentItemIndex-1,0)}get transitionOptions(){return{enter:this.hasEnterClass?this.enterClass:"transition ease-out duration-100",enterFrom:this.hasEnterFromClass?this.enterFromClass:"transform opacity-0 scale-95",enterTo:this.hasEnterToClass?this.enterToClass:"transform opacity-100 scale-100",leave:this.hasLeaveClass?this.leaveClass:"transition ease-in duration-75",leaveFrom:this.hasLeaveFromClass?this.leaveFromClass:"transform opacity-100 scale-100",leaveTo:this.hasLeaveToClass?this.leaveToClass:"transform opacity-0 scale-95",toggleClass:this.hasToggleClass?this.toggleClass:"hidden"}}beforeCache(){this.openValue=!1,this.menuTarget.classList.add("hidden")}};v=new WeakSet,E=function(){let e=this.element.dataset.action?this.element.dataset.action.split(" "):[];e.push("click->dropdown#toggle"),e.push("click@window->dropdown#hide"),e.push("keydown.up->dropdown#previousItem"),e.push("keydown.down->dropdown#nextItem"),e.push("keydown.esc->dropdown#hide"),this.element.dataset.action=[...new Set(e)].join(" ")},a(n,"targets",["menu","button","menuItem"]),a(n,"values",{open:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}}),a(n,"classes",["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","toggle"]);var S=require("@hotwired/stimulus");var c=class extends S.Controller{connect(){this.openValue&&this.open()}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.close()}show(){this.dialogTarget.show()}};a(c,"targets",["dialog"]),a(c,"values",{open:Boolean});var F=require("@hotwired/stimulus");var d=class extends F.Controller{openValueChanged(){r(this.contentTarget,this.openValue),this.shouldAutoDismiss&&this.scheduleDismissal()}show(t){this.shouldAutoDismiss&&this.scheduleDismissal(),this.openValue=!0}hide(){this.openValue=!1}toggle(){this.openValue=!this.openValue}get shouldAutoDismiss(){return this.openValue&&this.hasDismissAfterValue}scheduleDismissal(){this.hasDismissAfterValue&&(this.cancelDismissal(),this.timeoutId=setTimeout(()=>{this.hide(),this.timeoutId=void 0},this.dismissAfterValue))}cancelDismissal(){typeof this.timeoutId=="number"&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)}};a(d,"targets",["content"]),a(d,"values",{dismissAfter:Number,open:{type:Boolean,default:!1}});var f=class extends n{openValueChanged(){r(this.overlayTarget,this.openValue),r(this.menuTarget,this.openValue),this.hasCloseTarget&&r(this.closeTarget,this.openValue)}};a(f,"targets",["overlay","close"]);var k=require("@hotwired/stimulus");var l=class extends k.Controller{initialize(){this.anchor&&(this.indexValue=this.tabTargets.findIndex(t=>t.id===this.anchor))}connect(){this.showTab()}change(t){t.currentTarget.tagName==="SELECT"?this.indexValue=t.currentTarget.selectedIndex:t.currentTarget.dataset.index?this.indexValue=t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.indexValue=this.tabTargets.findIndex(e=>e.id==t.currentTarget.dataset.id):this.indexValue=this.tabTargets.indexOf(t.currentTarget),window.dispatchEvent(new CustomEvent("tsc:tab-change"))}nextTab(){this.indexValue=Math.min(this.indexValue+1,this.tabsCount-1)}previousTab(){this.indexValue=Math.max(this.indexValue-1,0)}firstTab(){this.indexValue=0}lastTab(){this.indexValue=this.tabsCount-1}indexValueChanged(){if(this.showTab(),this.updateAnchorValue){let t=this.tabTargets[this.indexValue].id;if(this.scrollToAnchorValue)location.hash=t;else{let s=window.location.href.split("#")[0]+"#"+t;history.replaceState({},document.title,s)}}}showTab(){this.panelTargets.forEach((t,e)=>{let s=this.tabTargets[e];e===this.indexValue?(t.classList.remove("hidden"),s.ariaSelected="true",this.hasInactiveTabClass&&s?.classList?.remove(...this.inactiveTabClasses),this.hasActiveTabClass&&s?.classList?.add(...this.activeTabClasses)):(t.classList.add("hidden"),s.ariaSelected=null,this.hasActiveTabClass&&s?.classList?.remove(...this.activeTabClasses),this.hasInactiveTabClass&&s?.classList?.add(...this.inactiveTabClasses))}),this.hasSelectTarget&&(this.selectTarget.selectedIndex=this.indexValue),this.scrollActiveTabIntoView()}scrollActiveTabIntoView(){let t=this.element.querySelector("[aria-selected]");t&&t.scrollIntoView({inline:"center"})}get tabsCount(){return this.tabTargets.length}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}};a(l,"classes",["activeTab","inactiveTab"]),a(l,"targets",["tab","panel","select"]),a(l,"values",{index:0,updateAnchor:Boolean,scrollToAnchor:Boolean});var B=require("@hotwired/stimulus");var m=class extends B.Controller{toggle(t){this.openValue=!this.openValue,this.animate()}toggleInput(t){this.openValue=t.target.checked,this.animate()}hide(){this.openValue=!1,this.animate()}show(){this.openValue=!0,this.animate()}animate(){this.toggleableTargets.forEach(t=>{r(t,this.openValue)})}};a(m,"targets",["toggleable"]),a(m,"values",{open:{type:Boolean,default:!1}}); +var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var M=(t,e,s)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var N=(t,e)=>{for(var s in e)T(t,s,{get:e[s],enumerable:!0})},k=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of B(e))!q.call(t,i)&&i!==s&&T(t,i,{get:()=>e[i],enumerable:!(o=F(e,i))||o.enumerable});return t};var U=t=>k(T({},"__esModule",{value:!0}),t);var a=(t,e,s)=>(M(t,typeof e!="symbol"?e+"":e,s),s);var P={};N(P,{Alert:()=>p,Autosave:()=>h,ColorPreview:()=>u,Dropdown:()=>r,Modal:()=>c,Popover:()=>d,Slideover:()=>m,Tabs:()=>l,Toggle:()=>f});module.exports=U(P);var V=require("@hotwired/stimulus");async function n(t,e,s={}){e?b(t,s):v(t,s)}async function b(t,e={}){let s=t.dataset.transitionEnter||e.enter||"enter",o=t.dataset.transitionEnterFrom||e.enterFrom||"enter-from",i=t.dataset.transitionEnterTo||e.enterTo||"enter-to",g=t.dataset.toggleClass||e.toggleClass||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...o.split(" ")),t.classList.remove(...i.split(" ")),t.classList.remove(...g.split(" ")),await x(),t.classList.remove(...o.split(" ")),t.classList.add(...i.split(" "));try{await C(t)}finally{t.classList.remove(...s.split(" "))}}async function v(t,e={}){let s=t.dataset.transitionLeave||e.leave||"leave",o=t.dataset.transitionLeaveFrom||e.leaveFrom||"leave-from",i=t.dataset.transitionLeaveTo||e.leaveTo||"leave-to",g=t.dataset.toggleClass||e.toogle||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...o.split(" ")),t.classList.remove(...i.split(" ")),await x(),t.classList.remove(...o.split(" ")),t.classList.add(...i.split(" "));try{await C(t)}finally{t.classList.remove(...s.split(" ")),t.classList.add(...g.split(" "))}}function x(){return new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(t)})})}function C(t){return Promise.all(t.getAnimations().map(e=>e.finished))}var p=class extends V.Controller{connect(){setTimeout(()=>{b(this.element)},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){v(this.element).then(()=>{this.element.remove()})}};a(p,"values",{dismissAfter:Number,showDelay:{type:Number,default:0},removeDelay:{type:Number,default:1100}});var y=require("@hotwired/stimulus");var h=class extends y.Controller{connect(){this.timeout=null}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=this.submittingTextValue,this.formTarget.requestSubmit()},this.submitDurationValue)}success(){this.setStatus(this.successTextValue)}error(){this.setStatus(this.errorTextValue)}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout(()=>{this.statusTarget.textContent=""},this.statusDurationValue)}};a(h,"targets",["form","status"]),a(h,"values",{submitDuration:{type:Number,default:1e3},statusDuration:{type:Number,default:2e3},submittingText:{type:String,default:"Saving..."},successText:{type:String,default:"Saved!"},errorText:{type:String,default:"Unable to save."}});var I=require("@hotwired/stimulus");var u=class extends I.Controller{update(){this.preview=this.colorTarget.value}set preview(t){this.previewTarget.style[this.styleValue]=t;let e=this._getContrastYIQ(t);this.styleValue==="color"?this.previewTarget.style.backgroundColor=e:this.previewTarget.style.color=e}_getContrastYIQ(t){t=t.replace("#","");let e=128,s=parseInt(t.substr(0,2),16),o=parseInt(t.substr(2,2),16),i=parseInt(t.substr(4,2),16);return(s*299+o*587+i*114)/1e3>=e?"#000":"#fff"}};a(u,"targets",["preview","color"]),a(u,"values",{style:{type:String,default:"backgroundColor"}});var L=require("@hotwired/stimulus");var r=class extends L.Controller{connect(){document.addEventListener("turbo:before-cache",this.beforeCache.bind(this))}disconnect(){document.removeEventListener("turbo:before-cache",this.beforeCache.bind(this))}openValueChanged(){n(this.menuTarget,this.openValue,this.transitionOptions),this.openValue===!0&&this.hasMenuItemTarget&&this.menuItemTargets[0].focus()}show(){this.openValue=!0}close(){this.openValue=!1}hide(t){this.closeOnClickOutsideValue&&t.target.nodeType&&this.element.contains(t.target)===!1&&this.openValue&&(this.openValue=!1),this.closeOnEscapeValue&&t.key==="Escape"&&this.openValue&&(this.openValue=!1)}toggle(){this.openValue=!this.openValue}nextItem(t){t.preventDefault(),this.menuItemTargets[this.nextIndex].focus()}previousItem(t){t.preventDefault(),this.menuItemTargets[this.previousIndex].focus()}get currentItemIndex(){return this.menuItemTargets.indexOf(document.activeElement)}get nextIndex(){return Math.min(this.currentItemIndex+1,this.menuItemTargets.length-1)}get previousIndex(){return Math.max(this.currentItemIndex-1,0)}get transitionOptions(){return{enter:this.hasEnterClass?this.enterClass:"transition ease-out duration-100",enterFrom:this.hasEnterFromClass?this.enterFromClass:"transform opacity-0 scale-95",enterTo:this.hasEnterToClass?this.enterToClass:"transform opacity-100 scale-100",leave:this.hasLeaveClass?this.leaveClass:"transition ease-in duration-75",leaveFrom:this.hasLeaveFromClass?this.leaveFromClass:"transform opacity-100 scale-100",leaveTo:this.hasLeaveToClass?this.leaveToClass:"transform opacity-0 scale-95",toggleClass:this.hasToggleClass?this.toggleClass:"hidden"}}beforeCache(){this.openValue=!1,this.menuTarget.classList.add("hidden")}};a(r,"targets",["menu","button","menuItem"]),a(r,"values",{open:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}}),a(r,"classes",["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","toggle"]);var w=require("@hotwired/stimulus");var c=class extends w.Controller{connect(){this.openValue&&this.open(),document.addEventListener("turbo:before-cache",this.beforeCache.bind(this))}disconnect(){document.removeEventListener("turbo:before-cache",this.beforeCache.bind(this))}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.close()}backdropClose(t){console.log(t),t.target.nodeName&&this.dialogTarget.close()}show(){this.dialogTarget.show()}beforeCache(){this.close()}};a(c,"targets",["dialog"]),a(c,"values",{open:Boolean});var A=require("@hotwired/stimulus");var d=class extends A.Controller{openValueChanged(){n(this.contentTarget,this.openValue),this.shouldAutoDismiss&&this.scheduleDismissal()}show(t){this.shouldAutoDismiss&&this.scheduleDismissal(),this.openValue=!0}hide(){this.openValue=!1}toggle(){this.openValue=!this.openValue}get shouldAutoDismiss(){return this.openValue&&this.hasDismissAfterValue}scheduleDismissal(){this.hasDismissAfterValue&&(this.cancelDismissal(),this.timeoutId=setTimeout(()=>{this.hide(),this.timeoutId=void 0},this.dismissAfterValue))}cancelDismissal(){typeof this.timeoutId=="number"&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)}};a(d,"targets",["content"]),a(d,"values",{dismissAfter:Number,open:{type:Boolean,default:!1}});var E=require("@hotwired/stimulus");var m=class extends E.Controller{connect(){this.openValue&&this.open(),document.addEventListener("turbo:before-cache",this.beforeCache.bind(this))}disconnect(){document.removeEventListener("turbo:before-cache",this.beforeCache.bind(this))}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.close()}beforeCache(){this.close()}};a(m,"targets",["dialog"]),a(m,"values",{open:Boolean});var D=require("@hotwired/stimulus");var l=class extends D.Controller{initialize(){this.anchor&&(this.indexValue=this.tabTargets.findIndex(t=>t.id===this.anchor))}connect(){this.showTab()}change(t){t.currentTarget.tagName==="SELECT"?this.indexValue=t.currentTarget.selectedIndex:t.currentTarget.dataset.index?this.indexValue=t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.indexValue=this.tabTargets.findIndex(e=>e.id==t.currentTarget.dataset.id):this.indexValue=this.tabTargets.indexOf(t.currentTarget),window.dispatchEvent(new CustomEvent("tsc:tab-change"))}nextTab(){this.indexValue=Math.min(this.indexValue+1,this.tabsCount-1)}previousTab(){this.indexValue=Math.max(this.indexValue-1,0)}firstTab(){this.indexValue=0}lastTab(){this.indexValue=this.tabsCount-1}indexValueChanged(){if(this.showTab(),this.updateAnchorValue){let t=this.tabTargets[this.indexValue].id;if(this.scrollToAnchorValue)location.hash=t;else{let s=window.location.href.split("#")[0]+"#"+t;history.replaceState({},document.title,s)}}}showTab(){this.panelTargets.forEach((t,e)=>{let s=this.tabTargets[e];e===this.indexValue?(t.classList.remove("hidden"),s.ariaSelected="true",this.hasInactiveTabClass&&s?.classList?.remove(...this.inactiveTabClasses),this.hasActiveTabClass&&s?.classList?.add(...this.activeTabClasses)):(t.classList.add("hidden"),s.ariaSelected=null,this.hasActiveTabClass&&s?.classList?.remove(...this.activeTabClasses),this.hasInactiveTabClass&&s?.classList?.add(...this.inactiveTabClasses))}),this.hasSelectTarget&&(this.selectTarget.selectedIndex=this.indexValue),this.scrollActiveTabIntoViewValue&&this.scrollToActiveTab()}scrollToActiveTab(){let t=this.element.querySelector("[aria-selected]");t&&t.scrollIntoView({inline:"center"})}get tabsCount(){return this.tabTargets.length}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}};a(l,"classes",["activeTab","inactiveTab"]),a(l,"targets",["tab","panel","select"]),a(l,"values",{index:0,updateAnchor:Boolean,scrollToAnchor:Boolean,scrollActiveTabIntoView:Boolean});var S=require("@hotwired/stimulus");var f=class extends S.Controller{toggle(t){this.openValue=!this.openValue,this.animate()}toggleInput(t){this.openValue=t.target.checked,this.animate()}hide(){this.openValue=!1,this.animate()}show(){this.openValue=!0,this.animate()}animate(){this.toggleableTargets.forEach(t=>{n(t,this.openValue)})}};a(f,"targets",["toggleable"]),a(f,"values",{open:{type:Boolean,default:!1}}); diff --git a/dist/tailwindcss-stimulus-components.cjs.map b/dist/tailwindcss-stimulus-components.cjs.map index fa44d84..78c26dc 100644 --- a/dist/tailwindcss-stimulus-components.cjs.map +++ b/dist/tailwindcss-stimulus-components.cjs.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/index.js", "../src/alert.js", "../src/transition.js", "../src/autosave.js", "../src/color_preview.js", "../src/dropdown.js", "../src/modal.js", "../src/popover.js", "../src/slideover.js", "../src/tabs.js", "../src/toggle.js"], - "sourcesContent": ["export { default as Alert } from './alert'\nexport { default as Autosave } from './autosave'\nexport { default as ColorPreview } from './color_preview'\nexport { default as Dropdown } from './dropdown'\nexport { default as Modal } from './modal'\nexport { default as Popover } from './popover'\nexport { default as Slideover } from './slideover'\nexport { default as Tabs } from './tabs'\nexport { default as Toggle } from './toggle'\n", "import { Controller } from '@hotwired/stimulus'\nimport { enter, leave } from \"./transition\"\n\nexport default class extends Controller {\n static values = {\n dismissAfter: Number,\n showDelay: { type: Number, default: 0 },\n removeDelay: { type: Number, default: 1100 }\n }\n\n connect() {\n setTimeout(() => {\n enter(this.element)\n }, this.showDelayValue)\n\n // Auto dimiss if defined\n if (this.hasDismissAfterValue) {\n setTimeout(() => {\n this.close()\n }, this.dismissAfterValue)\n }\n }\n\n // Runs hide animation and then removes element from the page\n close() {\n leave(this.element).then(() => {\n this.element.remove()\n })\n }\n}\n", "// Enter transition:\n//\n// transition(this.element, true)\n//\n// Leave transition:\n//\n// transition(this.element, false)\nexport async function transition(element, state, transitionOptions = {}) {\n if (!!state) {\n enter(element, transitionOptions)\n } else {\n leave(element, transitionOptions)\n }\n}\n\n// class=\"fixed inset-0 bg-black overflow-y-auto flex items-center justify-center bg-opacity-80 hidden\"\n// data-transition-enter=\"transition-all ease-in-out duration-300\"\n// data-transition-enter-from=\"bg-opacity-0\"\n// data-transition-enter-to=\"bg-opacity-80\"\n// data-transition-leave=\"transition-all ease-in-out duration-300\"\n// data-transition-leave-from=\"bg-opacity-80\"\n// data-transition-leave-to=\"bg-opacity-0\"\nexport async function enter(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionEnter || transitionOptions.enter || 'enter'\n const fromClasses =\n element.dataset.transitionEnterFrom || transitionOptions.enterFrom || 'enter-from'\n const toClasses = element.dataset.transitionEnterTo || transitionOptions.enterTo || 'enter-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n element.classList.remove(...toggleClass.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n }\n}\n\nexport async function leave(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionLeave || transitionOptions.leave || 'leave'\n const fromClasses =\n element.dataset.transitionLeaveFrom || transitionOptions.leaveFrom || 'leave-from'\n const toClasses = element.dataset.transitionLeaveTo || transitionOptions.leaveTo || 'leave-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toogle || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n element.classList.add(...toggleClass.split(' '))\n }\n}\n\nfunction nextFrame() {\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n requestAnimationFrame(resolve)\n })\n })\n}\n\nfunction afterTransition(element) {\n return Promise.all(element.getAnimations().map(animation => animation.finished))\n}\n", "// Form autosave\n//\n// <%= form_with(model: post, data: { controller: \"autosave\", autosave_target: \"form\", action: \"turbo:submit-end->autosave#success turbo:fetch-request-error->autosave#error\" }) do |form| %>\n//
\n// <%= form.label :title %>\n// <%= form.text_field :title, class: 'form-control', data: { action: \"keyup->autosave#save\" } %>\n//
\n//\n//
\n// <% end %>\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['form', 'status']\n static values = {\n submitDuration: {type: Number, default: 1000},\n statusDuration: {type: Number, default: 2000},\n submittingText: {type: String, default: \"Saving...\"},\n successText: {type: String, default: \"Saved!\"},\n errorText: {type: String, default: \"Unable to save.\"}\n }\n\n connect() {\n this.timeout = null\n }\n\n save() {\n clearTimeout(this.timeout)\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = this.submittingTextValue\n this.formTarget.requestSubmit()\n }, this.submitDurationValue)\n }\n\n success() {\n this.setStatus(this.successTextValue)\n }\n\n error() {\n this.setStatus(this.errorTextValue)\n }\n\n setStatus(message) {\n this.statusTarget.textContent = message\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = ''\n }, this.statusDurationValue)\n }\n}\n", "// A color picker preview where you can choose to have the color or backgroundColor\n// get updated based on the result of a color picker. It also supports ensuring\n// the foreground text is always readable by performing a YIQ calculation to\n// set the text to black or white based on the contrast of the color and backgroundColor.\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['preview', 'color'];\n static values = {\n style: {type: String, default: \"backgroundColor\"}\n }\n\n update() {\n this.preview = this.colorTarget.value\n }\n\n set preview(color) {\n this.previewTarget.style[this.styleValue] = color\n\n // Ensure the foreground text is always readable by setting either the\n // backgroundColor or color to black or white.\n const yiqColor = this._getContrastYIQ(color)\n\n if (this.styleValue === 'color') {\n this.previewTarget.style.backgroundColor = yiqColor\n } else {\n this.previewTarget.style.color = yiqColor\n }\n }\n\n _getContrastYIQ(hexColor) {\n // Taken from: https://24ways.org/2010/calculating-color-contrast/\n hexColor = hexColor.replace('#', '');\n\n const yiqThreshold = 128;\n const r = parseInt(hexColor.substr(0, 2), 16);\n const g = parseInt(hexColor.substr(2, 2), 16);\n const b = parseInt(hexColor.substr(4, 2), 16);\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n\n return (yiq >= yiqThreshold) ? '#000' : '#fff';\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = ['menu', 'button', 'menuItem']\n static values = {\n open: { type: Boolean, default: false },\n closeOnEscape: { type: Boolean, default: true },\n closeOnClickOutside: { type: Boolean, default: true },\n }\n\n static classes = ['enter', 'enterFrom', 'enterTo', 'leave', 'leaveFrom', 'leaveTo', 'toggle']\n\n // lifecycle\n connect() {\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n this.#initializeDropdownActions()\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n\n if (this.hasButtonTarget) {\n this.buttonTarget.removeEventListener(\"keydown\", this._onMenuButtonKeydown)\n this.buttonTarget.removeAttribute(\"aria-haspopup\")\n }\n }\n\n // callbacks\n openValueChanged() {\n transition(this.menuTarget, this.openValue, this.transitionOptions)\n\n if (this.openValue === true && this.hasMenuItemTarget) {\n this.menuItemTargets[0].focus()\n }\n }\n\n // actions\n show() {\n this.openValue = true\n }\n\n close() {\n this.openValue = false\n }\n\n hide(event) {\n // if the event is a click and the target is not inside the dropdown, then close it\n if (\n this.closeOnClickOutsideValue &&\n event.target.nodeType &&\n this.element.contains(event.target) === false &&\n this.openValue\n ) {\n this.openValue = false\n }\n\n // if the event is a keydown and the key is escape, then close it\n if (this.closeOnEscapeValue && event.key === 'Escape' && this.openValue) {\n this.openValue = false\n }\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n nextItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.nextIndex].focus()\n }\n\n previousItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.previousIndex].focus()\n }\n\n // getters and setters\n get currentItemIndex() {\n return this.menuItemTargets.indexOf(document.activeElement)\n }\n\n get nextIndex() {\n return Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1)\n }\n\n get previousIndex() {\n return Math.max(this.currentItemIndex - 1, 0)\n }\n\n get transitionOptions() {\n // once the Class API default values are available, we can simplify this\n return {\n enter: this.hasEnterClass ? this.enterClass : 'transition ease-out duration-100',\n enterFrom: this.hasEnterFromClass ? this.enterFromClass : 'transform opacity-0 scale-95',\n enterTo: this.hasEnterToClass ? this.enterToClass : 'transform opacity-100 scale-100',\n leave: this.hasLeaveClass ? this.leaveClass : 'transition ease-in duration-75',\n leaveFrom: this.hasLeaveFromClass ? this.leaveFromClass : 'transform opacity-100 scale-100',\n leaveTo: this.hasLeaveToClass ? this.leaveToClass : 'transform opacity-0 scale-95',\n toggleClass: this.hasToggleClass ? this.toggleClass : 'hidden',\n }\n }\n\n // private\n\n #initializeDropdownActions() {\n // this will set the necessary actions on the dropdown element for it to work\n // data-action=\"click->dropdown#toggle click@window->dropdown#hide keydown.up->dropdown#previousItem keydown.down->dropdown#nextItem\"\n // Note: If existing actions are already specified by the user, they will be preserved and augmented without any redundancy.\n\n const actions = this.element.dataset.action ? this.element.dataset.action.split(' ') : []\n actions.push('click->dropdown#toggle')\n actions.push('click@window->dropdown#hide')\n actions.push('keydown.up->dropdown#previousItem')\n actions.push('keydown.down->dropdown#nextItem')\n actions.push('keydown.esc->dropdown#hide')\n this.element.dataset.action = [...new Set(actions)].join(' ')\n }\n\n // Ensures the menu is hidden before Turbo caches the page\n beforeCache() {\n this.openValue = false\n this.menuTarget.classList.add(\"hidden\")\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n // For showing non-modally\n show() {\n this.dialogTarget.show()\n }\n}\n", "// A simple inline popover to be used wherever needed, with a configurable offset.\n// Visit The Stimulus Handbook for more details\n// https://stimulusjs.org/handbook/introduction\n//\n// This example controller works with specially annotated HTML like:\n//\n//

\n// Beginning in 2015, Google introduced what is called the\n//

popover#mouseOver mouseout->popover#mouseOut\">\n// 'local snack pack',\n// \n//
\n// which shows you local search results before normal organic results.\n//

\n//\n// You can also toggle the popover using the click action.\n//
popover#toggle\" data-action=\"mouseenter->popover#show mouseleave->popover#hide\">\n\nimport { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['content']\n static values = {\n dismissAfter: Number,\n open: { type: Boolean, default: false }\n }\n\n openValueChanged() {\n transition(this.contentTarget, this.openValue)\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n }\n\n // If already true, extend the dismissal another X seconds since this will not trigger openValueChanged\n show(event) {\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n this.openValue = true\n }\n\n hide() {\n this.openValue = false\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n get shouldAutoDismiss() {\n return (this.openValue && this.hasDismissAfterValue)\n }\n\n scheduleDismissal() {\n if (!this.hasDismissAfterValue) return\n\n // Cancel any existing dismissals\n this.cancelDismissal()\n\n // Schedule the next dismissal\n this.timeoutId = setTimeout(() => {\n this.hide()\n this.timeoutId = undefined\n }, this.dismissAfterValue)\n }\n\n cancelDismissal() {\n if (typeof this.timeoutId === \"number\") {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n}\n", "import Dropdown from './dropdown.js'\nimport { transition } from './transition'\n\nexport default class extends Dropdown {\n static targets = ['overlay', 'close']\n\n openValueChanged() {\n transition(this.overlayTarget, this.openValue)\n transition(this.menuTarget, this.openValue)\n if (this.hasCloseTarget) transition(this.closeTarget, this.openValue)\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static classes = [ \"activeTab\", \"inactiveTab\" ]\n static targets = ['tab', 'panel', 'select']\n static values = {\n index: 0,\n updateAnchor: Boolean,\n scrollToAnchor: Boolean,\n }\n\n initialize() {\n if (this.anchor) this.indexValue = this.tabTargets.findIndex((tab) => tab.id === this.anchor)\n }\n\n connect() {\n this.showTab()\n }\n\n // Changes to the clicked tab\n change(event) {\n if (event.currentTarget.tagName === \"SELECT\") {\n this.indexValue = event.currentTarget.selectedIndex\n\n // If target specifies an index, use that\n } else if (event.currentTarget.dataset.index) {\n this.indexValue = event.currentTarget.dataset.index\n\n // If target specifies an id, use that\n } else if (event.currentTarget.dataset.id) {\n this.indexValue = this.tabTargets.findIndex((tab) => tab.id == event.currentTarget.dataset.id)\n\n // Otherwise, use the index of the current target\n } else {\n this.indexValue = this.tabTargets.indexOf(event.currentTarget)\n }\n\n window.dispatchEvent(new CustomEvent('tsc:tab-change'))\n }\n\n nextTab() {\n this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1)\n }\n\n previousTab() {\n this.indexValue = Math.max(this.indexValue - 1, 0)\n }\n\n firstTab() {\n this.indexValue = 0\n }\n\n lastTab() {\n this.indexValue = this.tabsCount - 1\n }\n\n indexValueChanged() {\n this.showTab()\n\n // Update URL with the tab ID if it has one\n // This will be automatically selected on page load\n if (this.updateAnchorValue) {\n const new_tab_id = this.tabTargets[this.indexValue].id // Grab the id from the newly activated tab\n if (this.scrollToAnchorValue){\n location.hash = new_tab_id // Use location.hash to change the URL with scrolling\n } else {\n const currentUrl = window.location.href // Get the current URL\n const newUrl = currentUrl.split('#')[0] + '#' + new_tab_id // Create a new URL with the updated ID\n history.replaceState({}, document.title, newUrl) // Use history.replaceState to change the URL without scrolling\n }\n }\n }\n\n showTab() {\n this.panelTargets.forEach((panel, index) => {\n const tab = this.tabTargets[index]\n\n if (index === this.indexValue) {\n panel.classList.remove('hidden')\n tab.ariaSelected = 'true'\n if (this.hasInactiveTabClass) tab?.classList?.remove(...this.inactiveTabClasses)\n if (this.hasActiveTabClass) tab?.classList?.add(...this.activeTabClasses)\n } else {\n panel.classList.add('hidden')\n tab.ariaSelected = null\n if (this.hasActiveTabClass) tab?.classList?.remove(...this.activeTabClasses)\n if (this.hasInactiveTabClass) tab?.classList?.add(...this.inactiveTabClasses)\n }\n })\n\n if (this.hasSelectTarget) {\n this.selectTarget.selectedIndex = this.indexValue\n }\n\n this.scrollActiveTabIntoView()\n }\n\n // If tabs have horizontal scrolling, the active tab may be out of sight.\n // Make sure the active tab is visible by scrolling it into the view.\n scrollActiveTabIntoView() {\n const activeTab = this.element.querySelector('[aria-selected]');\n if (activeTab)\n activeTab.scrollIntoView({\n inline: 'center',\n });\n }\n\n get tabsCount() {\n return this.tabTargets.length\n }\n\n get anchor() {\n return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['toggleable']\n static values = {\n open: { type: Boolean, default: false }\n }\n\n toggle(event) {\n this.openValue = !this.openValue\n this.animate()\n }\n\n // Sets open to value of checkbox or radio\n toggleInput(event) {\n this.openValue = event.target.checked\n this.animate()\n }\n\n hide() {\n this.openValue = false\n this.animate()\n }\n\n show() {\n this.openValue = true\n this.animate()\n }\n\n animate() {\n this.toggleableTargets.forEach(target => {\n transition(target, this.openValue)\n })\n }\n}\n"], - "mappings": "4xBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,aAAAC,EAAA,iBAAAC,EAAA,aAAAC,EAAA,UAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAX,GCAA,IAAAY,EAA2B,8BCO3B,eAAsBC,EAAWC,EAASC,EAAOC,EAAoB,CAAC,EAAG,CACjED,EACJE,EAAMH,EAASE,CAAiB,EAEhCE,EAAMJ,EAASE,CAAiB,CAEpC,CASA,eAAsBC,EAAMH,EAASE,EAAoB,CAAC,EAAG,CAC3D,IAAMG,EAAoBL,EAAQ,QAAQ,iBAAmBE,EAAkB,OAAS,QAClFI,EACJN,EAAQ,QAAQ,qBAAuBE,EAAkB,WAAa,aAClEK,EAAYP,EAAQ,QAAQ,mBAAqBE,EAAkB,SAAW,WAC9EM,EAAcR,EAAQ,QAAQ,aAAeE,EAAkB,aAAe,SAGpFF,EAAQ,UAAU,IAAI,GAAGK,EAAkB,MAAM,GAAG,CAAC,EACrDL,EAAQ,U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CACxB,IAAMM,EAAY,KAAK,QAAQ,cAAc,iBAAiB,EAC1DA,GACFA,EAAU,eAAe,CACvB,OAAQ,QACV,CAAC,CACL,CAEA,IAAI,WAAY,CACd,OAAO,KAAK,WAAW,MACzB,CAEA,IAAI,QAAS,CACX,OAAQ,SAAS,IAAI,MAAM,GAAG,EAAE,OAAS,EAAK,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC,EAAI,IAC7E,CACF,EA/GEC,EADKR,EACE,UAAU,CAAE,YAAa,aAAc,GAC9CQ,EAFKR,EAEE,UAAU,CAAC,MAAO,QAAS,QAAQ,GAC1CQ,EAHKR,EAGE,SAAS,CACd,MAAO,EACP,aAAc,QACd,eAAgB,OAClB,GCTF,IAAAS,EAA2B,8BAG3B,IAAOC,EAAP,cAA6B,YAAW,CAMtC,OAAOC,EAAO,CACZ,KAAK,UAAY,CAAC,KAAK,UACvB,KAAK,QAAQ,CACf,CAGA,YAAYA,EAAO,CACjB,KAAK,UAAYA,EAAM,OAAO,QAC9B,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,SAAU,CACR,KAAK,kBAAkB,QAAQC,GAAU,CACvCC,EAAWD,EAAQ,KAAK,SAAS,CACnC,CAAC,CACH,CACF,EA/BEE,EADKJ,EACE,UAAU,CAAC,YAAY,GAC9BI,EAFKJ,EAEE,SAAS,CACd,KAAM,CAAE,KAAM,QAAS,QAAS,EAAM,CACxC", - "names": ["src_exports", "__export", "alert_default", "autosave_default", "color_preview_default", "dropdown_default", "modal_default", "popover_default", "slideover_default", "tabs_default", "toggle_default", "__toCommonJS", "import_stimulus", "transition", "element", "state", "transitionOptions", "enter", "leave", "transitionClasses", "fromClasses", "toClasses", "toggleClass", "nextFrame", "afterTransition", "resolve", "animation", "alert_default", "enter", "leave", "__publicField", "import_stimulus", "autosave_default", "message", "__publicField", "import_stimulus", "color_preview_default", "color", "yiqColor", "hexColor", "yiqThreshold", "r", "g", "b", "__publicField", "import_stimulus", "_initializeDropdownActions", "initializeDropdownActions_fn", "dropdown_default", "__privateAdd", "__privateMethod", "transition", "event", "actions", "__publicField", "import_stimulus", "modal_default", "__publicField", "import_stimulus", "popover_default", "transition", "event", "__publicField", "slideover_default", "dropdown_default", "transition", "__publicField", "import_stimulus", "tabs_default", "tab", "event", "new_tab_id", "newUrl", "panel", "index", "activeTab", "__publicField", "import_stimulus", "toggle_default", "event", "target", "transition", "__publicField"] + "sourcesContent": ["export { default as Alert } from './alert'\nexport { default as Autosave } from './autosave'\nexport { default as ColorPreview } from './color_preview'\nexport { default as Dropdown } from './dropdown'\nexport { default as Modal } from './modal'\nexport { default as Popover } from './popover'\nexport { default as Slideover } from './slideover'\nexport { default as Tabs } from './tabs'\nexport { default as Toggle } from './toggle'\n", "import { Controller } from '@hotwired/stimulus'\nimport { enter, leave } from \"./transition\"\n\nexport default class extends Controller {\n static values = {\n dismissAfter: Number,\n showDelay: { type: Number, default: 0 },\n removeDelay: { type: Number, default: 1100 }\n }\n\n connect() {\n setTimeout(() => {\n enter(this.element)\n }, this.showDelayValue)\n\n // Auto dimiss if defined\n if (this.hasDismissAfterValue) {\n setTimeout(() => {\n this.close()\n }, this.dismissAfterValue)\n }\n }\n\n // Runs hide animation and then removes element from the page\n close() {\n leave(this.element).then(() => {\n this.element.remove()\n })\n }\n}\n", "// Enter transition:\n//\n// transition(this.element, true)\n//\n// Leave transition:\n//\n// transition(this.element, false)\nexport async function transition(element, state, transitionOptions = {}) {\n if (!!state) {\n enter(element, transitionOptions)\n } else {\n leave(element, transitionOptions)\n }\n}\n\n// class=\"fixed inset-0 bg-black overflow-y-auto flex items-center justify-center bg-opacity-80 hidden\"\n// data-transition-enter=\"transition-all ease-in-out duration-300\"\n// data-transition-enter-from=\"bg-opacity-0\"\n// data-transition-enter-to=\"bg-opacity-80\"\n// data-transition-leave=\"transition-all ease-in-out duration-300\"\n// data-transition-leave-from=\"bg-opacity-80\"\n// data-transition-leave-to=\"bg-opacity-0\"\nexport async function enter(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionEnter || transitionOptions.enter || 'enter'\n const fromClasses =\n element.dataset.transitionEnterFrom || transitionOptions.enterFrom || 'enter-from'\n const toClasses = element.dataset.transitionEnterTo || transitionOptions.enterTo || 'enter-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n element.classList.remove(...toggleClass.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n }\n}\n\nexport async function leave(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionLeave || transitionOptions.leave || 'leave'\n const fromClasses =\n element.dataset.transitionLeaveFrom || transitionOptions.leaveFrom || 'leave-from'\n const toClasses = element.dataset.transitionLeaveTo || transitionOptions.leaveTo || 'leave-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toogle || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n element.classList.add(...toggleClass.split(' '))\n }\n}\n\nfunction nextFrame() {\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n requestAnimationFrame(resolve)\n })\n })\n}\n\nfunction afterTransition(element) {\n return Promise.all(element.getAnimations().map(animation => animation.finished))\n}\n", "// Form autosave\n//\n// <%= form_with(model: post, data: { controller: \"autosave\", autosave_target: \"form\", action: \"turbo:submit-end->autosave#success turbo:fetch-request-error->autosave#error\" }) do |form| %>\n//
\n// <%= form.label :title %>\n// <%= form.text_field :title, class: 'form-control', data: { action: \"keyup->autosave#save\" } %>\n//
\n//\n//
\n// <% end %>\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['form', 'status']\n static values = {\n submitDuration: {type: Number, default: 1000},\n statusDuration: {type: Number, default: 2000},\n submittingText: {type: String, default: \"Saving...\"},\n successText: {type: String, default: \"Saved!\"},\n errorText: {type: String, default: \"Unable to save.\"}\n }\n\n connect() {\n this.timeout = null\n }\n\n save() {\n clearTimeout(this.timeout)\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = this.submittingTextValue\n this.formTarget.requestSubmit()\n }, this.submitDurationValue)\n }\n\n success() {\n this.setStatus(this.successTextValue)\n }\n\n error() {\n this.setStatus(this.errorTextValue)\n }\n\n setStatus(message) {\n this.statusTarget.textContent = message\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = ''\n }, this.statusDurationValue)\n }\n}\n", "// A color picker preview where you can choose to have the color or backgroundColor\n// get updated based on the result of a color picker. It also supports ensuring\n// the foreground text is always readable by performing a YIQ calculation to\n// set the text to black or white based on the contrast of the color and backgroundColor.\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['preview', 'color'];\n static values = {\n style: {type: String, default: \"backgroundColor\"}\n }\n\n update() {\n this.preview = this.colorTarget.value\n }\n\n set preview(color) {\n this.previewTarget.style[this.styleValue] = color\n\n // Ensure the foreground text is always readable by setting either the\n // backgroundColor or color to black or white.\n const yiqColor = this._getContrastYIQ(color)\n\n if (this.styleValue === 'color') {\n this.previewTarget.style.backgroundColor = yiqColor\n } else {\n this.previewTarget.style.color = yiqColor\n }\n }\n\n _getContrastYIQ(hexColor) {\n // Taken from: https://24ways.org/2010/calculating-color-contrast/\n hexColor = hexColor.replace('#', '');\n\n const yiqThreshold = 128;\n const r = parseInt(hexColor.substr(0, 2), 16);\n const g = parseInt(hexColor.substr(2, 2), 16);\n const b = parseInt(hexColor.substr(4, 2), 16);\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n\n return (yiq >= yiqThreshold) ? '#000' : '#fff';\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = ['menu', 'button', 'menuItem']\n static values = {\n open: { type: Boolean, default: false },\n closeOnEscape: { type: Boolean, default: true },\n closeOnClickOutside: { type: Boolean, default: true }\n }\n static classes = ['enter', 'enterFrom', 'enterTo', 'leave', 'leaveFrom', 'leaveTo', 'toggle']\n\n connect() {\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n openValueChanged() {\n transition(this.menuTarget, this.openValue, this.transitionOptions)\n\n if (this.openValue === true && this.hasMenuItemTarget) {\n this.menuItemTargets[0].focus()\n }\n }\n\n show() {\n this.openValue = true\n }\n\n close() {\n this.openValue = false\n }\n\n // Closes dropdown from outside click or keyboard\n hide(event) {\n // if the event is a click and the target is not inside the dropdown, then close it\n if (\n this.closeOnClickOutsideValue &&\n event.target.nodeType &&\n this.element.contains(event.target) === false &&\n this.openValue\n ) {\n this.openValue = false\n }\n\n // if the event is a keydown and the key is escape, then close it\n if (this.closeOnEscapeValue && event.key === 'Escape' && this.openValue) {\n this.openValue = false\n }\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n nextItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.nextIndex].focus()\n }\n\n previousItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.previousIndex].focus()\n }\n\n // getters and setters\n get currentItemIndex() {\n return this.menuItemTargets.indexOf(document.activeElement)\n }\n\n get nextIndex() {\n return Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1)\n }\n\n get previousIndex() {\n return Math.max(this.currentItemIndex - 1, 0)\n }\n\n get transitionOptions() {\n // once the Class API default values are available, we can simplify this\n return {\n enter: this.hasEnterClass ? this.enterClass : 'transition ease-out duration-100',\n enterFrom: this.hasEnterFromClass ? this.enterFromClass : 'transform opacity-0 scale-95',\n enterTo: this.hasEnterToClass ? this.enterToClass : 'transform opacity-100 scale-100',\n leave: this.hasLeaveClass ? this.leaveClass : 'transition ease-in duration-75',\n leaveFrom: this.hasLeaveFromClass ? this.leaveFromClass : 'transform opacity-100 scale-100',\n leaveTo: this.hasLeaveToClass ? this.leaveToClass : 'transform opacity-0 scale-95',\n toggleClass: this.hasToggleClass ? this.toggleClass : 'hidden',\n }\n }\n\n // Ensures the menu is hidden before Turbo caches the page\n beforeCache() {\n this.openValue = false\n this.menuTarget.classList.add(\"hidden\")\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n backdropClose(event) {\n console.log(event)\n if (event.target.nodeName) this.dialogTarget.close()\n }\n\n // For showing non-modally\n show() {\n this.dialogTarget.show()\n }\n\n beforeCache() {\n this.close()\n }\n}\n", "// A simple inline popover to be used wherever needed, with a configurable offset.\n// Visit The Stimulus Handbook for more details\n// https://stimulusjs.org/handbook/introduction\n//\n// This example controller works with specially annotated HTML like:\n//\n//

\n// Beginning in 2015, Google introduced what is called the\n//

popover#mouseOver mouseout->popover#mouseOut\">\n// 'local snack pack',\n// \n//
\n// which shows you local search results before normal organic results.\n//

\n//\n// You can also toggle the popover using the click action.\n//
popover#toggle\" data-action=\"mouseenter->popover#show mouseleave->popover#hide\">\n\nimport { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['content']\n static values = {\n dismissAfter: Number,\n open: { type: Boolean, default: false }\n }\n\n openValueChanged() {\n transition(this.contentTarget, this.openValue)\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n }\n\n // If already true, extend the dismissal another X seconds since this will not trigger openValueChanged\n show(event) {\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n this.openValue = true\n }\n\n hide() {\n this.openValue = false\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n get shouldAutoDismiss() {\n return (this.openValue && this.hasDismissAfterValue)\n }\n\n scheduleDismissal() {\n if (!this.hasDismissAfterValue) return\n\n // Cancel any existing dismissals\n this.cancelDismissal()\n\n // Schedule the next dismissal\n this.timeoutId = setTimeout(() => {\n this.hide()\n this.timeoutId = undefined\n }, this.dismissAfterValue)\n }\n\n cancelDismissal() {\n if (typeof this.timeoutId === \"number\") {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n beforeCache() {\n this.close()\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static classes = [ \"activeTab\", \"inactiveTab\" ]\n static targets = ['tab', 'panel', 'select']\n static values = {\n index: 0,\n updateAnchor: Boolean,\n scrollToAnchor: Boolean,\n scrollActiveTabIntoView: Boolean\n }\n\n initialize() {\n if (this.anchor) this.indexValue = this.tabTargets.findIndex((tab) => tab.id === this.anchor)\n }\n\n connect() {\n this.showTab()\n }\n\n // Changes to the clicked tab\n change(event) {\n if (event.currentTarget.tagName === \"SELECT\") {\n this.indexValue = event.currentTarget.selectedIndex\n\n // If target specifies an index, use that\n } else if (event.currentTarget.dataset.index) {\n this.indexValue = event.currentTarget.dataset.index\n\n // If target specifies an id, use that\n } else if (event.currentTarget.dataset.id) {\n this.indexValue = this.tabTargets.findIndex((tab) => tab.id == event.currentTarget.dataset.id)\n\n // Otherwise, use the index of the current target\n } else {\n this.indexValue = this.tabTargets.indexOf(event.currentTarget)\n }\n\n window.dispatchEvent(new CustomEvent('tsc:tab-change'))\n }\n\n nextTab() {\n this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1)\n }\n\n previousTab() {\n this.indexValue = Math.max(this.indexValue - 1, 0)\n }\n\n firstTab() {\n this.indexValue = 0\n }\n\n lastTab() {\n this.indexValue = this.tabsCount - 1\n }\n\n indexValueChanged() {\n this.showTab()\n\n // Update URL with the tab ID if it has one\n // This will be automatically selected on page load\n if (this.updateAnchorValue) {\n const new_tab_id = this.tabTargets[this.indexValue].id // Grab the id from the newly activated tab\n if (this.scrollToAnchorValue){\n location.hash = new_tab_id // Use location.hash to change the URL with scrolling\n } else {\n const currentUrl = window.location.href // Get the current URL\n const newUrl = currentUrl.split('#')[0] + '#' + new_tab_id // Create a new URL with the updated ID\n history.replaceState({}, document.title, newUrl) // Use history.replaceState to change the URL without scrolling\n }\n }\n }\n\n showTab() {\n this.panelTargets.forEach((panel, index) => {\n const tab = this.tabTargets[index]\n\n if (index === this.indexValue) {\n panel.classList.remove('hidden')\n tab.ariaSelected = 'true'\n if (this.hasInactiveTabClass) tab?.classList?.remove(...this.inactiveTabClasses)\n if (this.hasActiveTabClass) tab?.classList?.add(...this.activeTabClasses)\n } else {\n panel.classList.add('hidden')\n tab.ariaSelected = null\n if (this.hasActiveTabClass) tab?.classList?.remove(...this.activeTabClasses)\n if (this.hasInactiveTabClass) tab?.classList?.add(...this.inactiveTabClasses)\n }\n })\n\n if (this.hasSelectTarget) {\n this.selectTarget.selectedIndex = this.indexValue\n }\n\n if (this.scrollActiveTabIntoViewValue) this.scrollToActiveTab()\n }\n\n // If tabs have horizontal scrolling, the active tab may be out of sight.\n // Make sure the active tab is visible by scrolling it into the view.\n scrollToActiveTab() {\n const activeTab = this.element.querySelector('[aria-selected]')\n if (activeTab) activeTab.scrollIntoView({ inline: 'center', })\n }\n\n get tabsCount() {\n return this.tabTargets.length\n }\n\n get anchor() {\n return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['toggleable']\n static values = {\n open: { type: Boolean, default: false }\n }\n\n toggle(event) {\n this.openValue = !this.openValue\n this.animate()\n }\n\n // Sets open to value of checkbox or radio\n toggleInput(event) {\n this.openValue = event.target.checked\n this.animate()\n }\n\n hide() {\n this.openValue = false\n this.animate()\n }\n\n show() {\n this.openValue = true\n this.animate()\n }\n\n animate() {\n this.toggleableTargets.forEach(target => {\n transition(target, this.openValue)\n })\n }\n}\n"], + "mappings": "wiBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,aAAAC,EAAA,iBAAAC,EAAA,aAAAC,EAAA,UAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAX,GCAA,IAAAY,EAA2B,8BCO3B,eAAsBC,EAAWC,EAASC,EAAOC,EAAoB,CAAC,EAAG,CACjED,EACJE,EAAMH,EAASE,CAAiB,EAEhCE,EAAMJ,EAASE,CAAiB,CAEpC,CASA,eAAsBC,EAAMH,EAASE,EAAoB,CAAC,EAAG,CAC3D,IAAMG,EAAoBL,EAAQ,QAAQ,iBAAmBE,EAAkB,OAAS,QAClFI,EACJN,EAAQ,QAAQ,qBAAuBE,EAAkB,WAAa,aAClEK,EAAYP,EAAQ,QAAQ,mBAAqBE,EAAkB,SAAW,WAC9EM,EAAcR,EAAQ,QAAQ,aAAeE,EAAkB,aAAe,SAGpFF,EAAQ,UAAU,IAAI,GAAGK,EAAkB,MAAM,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AK,QAAQ,cAAc,iBAAiB,EAC1DA,GAAWA,EAAU,eAAe,CAAE,OAAQ,QAAU,CAAC,CAC/D,CAEA,IAAI,WAAY,CACd,OAAO,KAAK,WAAW,MACzB,CAEA,IAAI,QAAS,CACX,OAAQ,SAAS,IAAI,MAAM,GAAG,EAAE,OAAS,EAAK,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC,EAAI,IAC7E,CACF,EA7GEC,EADKR,EACE,UAAU,CAAE,YAAa,aAAc,GAC9CQ,EAFKR,EAEE,UAAU,CAAC,MAAO,QAAS,QAAQ,GAC1CQ,EAHKR,EAGE,SAAS,CACd,MAAO,EACP,aAAc,QACd,eAAgB,QAChB,wBAAyB,OAC3B,GCVF,IAAAS,EAA2B,8BAG3B,IAAOC,EAAP,cAA6B,YAAW,CAMtC,OAAOC,EAAO,CACZ,KAAK,UAAY,CAAC,KAAK,UACvB,KAAK,QAAQ,CACf,CAGA,YAAYA,EAAO,CACjB,KAAK,UAAYA,EAAM,OAAO,QAC9B,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,SAAU,CACR,KAAK,kBAAkB,QAAQC,GAAU,CACvCC,EAAWD,EAAQ,KAAK,SAAS,CACnC,CAAC,CACH,CACF,EA/BEE,EADKJ,EACE,UAAU,CAAC,YAAY,GAC9BI,EAFKJ,EAEE,SAAS,CACd,KAAM,CAAE,KAAM,QAAS,QAAS,EAAM,CACxC", + "names": ["src_exports", "__export", "alert_default", "autosave_default", "color_preview_default", "dropdown_default", "modal_default", "popover_default", "slideover_default", "tabs_default", "toggle_default", "__toCommonJS", "import_stimulus", "transition", "element", "state", "transitionOptions", "enter", "leave", "transitionClasses", "fromClasses", "toClasses", "toggleClass", "nextFrame", "afterTransition", "resolve", "animation", "alert_default", "enter", "leave", "__publicField", "import_stimulus", "autosave_default", "message", "__publicField", "import_stimulus", "color_preview_default", "color", "yiqColor", "hexColor", "yiqThreshold", "r", "g", "b", "__publicField", "import_stimulus", "dropdown_default", "transition", "event", "__publicField", "import_stimulus", "modal_default", "event", "__publicField", "import_stimulus", "popover_default", "transition", "event", "__publicField", "import_stimulus", "slideover_default", "__publicField", "import_stimulus", "tabs_default", "tab", "event", "new_tab_id", "newUrl", "panel", "index", "activeTab", "__publicField", "import_stimulus", "toggle_default", "event", "target", "transition", "__publicField"] } diff --git a/dist/tailwindcss-stimulus-components.module.js b/dist/tailwindcss-stimulus-components.module.js index 01bbddf..fde9a5c 100644 --- a/dist/tailwindcss-stimulus-components.module.js +++ b/dist/tailwindcss-stimulus-components.module.js @@ -1 +1,937 @@ -var I=Object.defineProperty;var L=(t,e,s)=>e in t?I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var a=(t,e,s)=>(L(t,typeof e!="symbol"?e+"":e,s),s),A=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var b=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)};var V=(t,e,s)=>(A(t,e,"access private method"),s);import{Controller as D}from"@hotwired/stimulus";async function i(t,e,s={}){e?v(t,s):x(t,s)}async function v(t,e={}){let s=t.dataset.transitionEnter||e.enter||"enter",r=t.dataset.transitionEnterFrom||e.enterFrom||"enter-from",n=t.dataset.transitionEnterTo||e.enterTo||"enter-to",p=t.dataset.toggleClass||e.toggleClass||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...r.split(" ")),t.classList.remove(...n.split(" ")),t.classList.remove(...p.split(" ")),await C(),t.classList.remove(...r.split(" ")),t.classList.add(...n.split(" "));try{await w(t)}finally{t.classList.remove(...s.split(" "))}}async function x(t,e={}){let s=t.dataset.transitionLeave||e.leave||"leave",r=t.dataset.transitionLeaveFrom||e.leaveFrom||"leave-from",n=t.dataset.transitionLeaveTo||e.leaveTo||"leave-to",p=t.dataset.toggleClass||e.toogle||"hidden";t.classList.add(...s.split(" ")),t.classList.add(...r.split(" ")),t.classList.remove(...n.split(" ")),await C(),t.classList.remove(...r.split(" ")),t.classList.add(...n.split(" "));try{await w(t)}finally{t.classList.remove(...s.split(" ")),t.classList.add(...p.split(" "))}}function C(){return new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(t)})})}function w(t){return Promise.all(t.getAnimations().map(e=>e.finished))}var f=class extends D{connect(){setTimeout(()=>{v(this.element)},this.showDelayValue),this.hasDismissAfterValue&&setTimeout(()=>{this.close()},this.dismissAfterValue)}close(){x(this.element).then(()=>{this.element.remove()})}};a(f,"values",{dismissAfter:Number,showDelay:{type:Number,default:0},removeDelay:{type:Number,default:1100}});import{Controller as E}from"@hotwired/stimulus";var u=class extends E{connect(){this.timeout=null}save(){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.statusTarget.textContent=this.submittingTextValue,this.formTarget.requestSubmit()},this.submitDurationValue)}success(){this.setStatus(this.successTextValue)}error(){this.setStatus(this.errorTextValue)}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout(()=>{this.statusTarget.textContent=""},this.statusDurationValue)}};a(u,"targets",["form","status"]),a(u,"values",{submitDuration:{type:Number,default:1e3},statusDuration:{type:Number,default:2e3},submittingText:{type:String,default:"Saving..."},successText:{type:String,default:"Saved!"},errorText:{type:String,default:"Unable to save."}});import{Controller as S}from"@hotwired/stimulus";var h=class extends S{update(){this.preview=this.colorTarget.value}set preview(t){this.previewTarget.style[this.styleValue]=t;let e=this._getContrastYIQ(t);this.styleValue==="color"?this.previewTarget.style.backgroundColor=e:this.previewTarget.style.color=e}_getContrastYIQ(t){t=t.replace("#","");let e=128,s=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2,2),16),n=parseInt(t.substr(4,2),16);return(s*299+r*587+n*114)/1e3>=e?"#000":"#fff"}};a(h,"targets",["preview","color"]),a(h,"values",{style:{type:String,default:"backgroundColor"}});import{Controller as F}from"@hotwired/stimulus";var g,y,o=class extends F{constructor(){super(...arguments);b(this,g)}connect(){document.addEventListener("turbo:before-cache",this.beforeCache.bind(this)),V(this,g,y).call(this)}disconnect(){document.removeEventListener("turbo:before-cache",this.beforeCache.bind(this)),this.hasButtonTarget&&(this.buttonTarget.removeEventListener("keydown",this._onMenuButtonKeydown),this.buttonTarget.removeAttribute("aria-haspopup"))}openValueChanged(){i(this.menuTarget,this.openValue,this.transitionOptions),this.openValue===!0&&this.hasMenuItemTarget&&this.menuItemTargets[0].focus()}show(){this.openValue=!0}close(){this.openValue=!1}hide(e){this.closeOnClickOutsideValue&&e.target.nodeType&&this.element.contains(e.target)===!1&&this.openValue&&(this.openValue=!1),this.closeOnEscapeValue&&e.key==="Escape"&&this.openValue&&(this.openValue=!1)}toggle(){this.openValue=!this.openValue}nextItem(e){e.preventDefault(),this.menuItemTargets[this.nextIndex].focus()}previousItem(e){e.preventDefault(),this.menuItemTargets[this.previousIndex].focus()}get currentItemIndex(){return this.menuItemTargets.indexOf(document.activeElement)}get nextIndex(){return Math.min(this.currentItemIndex+1,this.menuItemTargets.length-1)}get previousIndex(){return Math.max(this.currentItemIndex-1,0)}get transitionOptions(){return{enter:this.hasEnterClass?this.enterClass:"transition ease-out duration-100",enterFrom:this.hasEnterFromClass?this.enterFromClass:"transform opacity-0 scale-95",enterTo:this.hasEnterToClass?this.enterToClass:"transform opacity-100 scale-100",leave:this.hasLeaveClass?this.leaveClass:"transition ease-in duration-75",leaveFrom:this.hasLeaveFromClass?this.leaveFromClass:"transform opacity-100 scale-100",leaveTo:this.hasLeaveToClass?this.leaveToClass:"transform opacity-0 scale-95",toggleClass:this.hasToggleClass?this.toggleClass:"hidden"}}beforeCache(){this.openValue=!1,this.menuTarget.classList.add("hidden")}};g=new WeakSet,y=function(){let e=this.element.dataset.action?this.element.dataset.action.split(" "):[];e.push("click->dropdown#toggle"),e.push("click@window->dropdown#hide"),e.push("keydown.up->dropdown#previousItem"),e.push("keydown.down->dropdown#nextItem"),e.push("keydown.esc->dropdown#hide"),this.element.dataset.action=[...new Set(e)].join(" ")},a(o,"targets",["menu","button","menuItem"]),a(o,"values",{open:{type:Boolean,default:!1},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0}}),a(o,"classes",["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","toggle"]);import{Controller as k}from"@hotwired/stimulus";var c=class extends k{connect(){this.openValue&&this.open()}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.close()}show(){this.dialogTarget.show()}};a(c,"targets",["dialog"]),a(c,"values",{open:Boolean});import{Controller as B}from"@hotwired/stimulus";var d=class extends B{openValueChanged(){i(this.contentTarget,this.openValue),this.shouldAutoDismiss&&this.scheduleDismissal()}show(t){this.shouldAutoDismiss&&this.scheduleDismissal(),this.openValue=!0}hide(){this.openValue=!1}toggle(){this.openValue=!this.openValue}get shouldAutoDismiss(){return this.openValue&&this.hasDismissAfterValue}scheduleDismissal(){this.hasDismissAfterValue&&(this.cancelDismissal(),this.timeoutId=setTimeout(()=>{this.hide(),this.timeoutId=void 0},this.dismissAfterValue))}cancelDismissal(){typeof this.timeoutId=="number"&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)}};a(d,"targets",["content"]),a(d,"values",{dismissAfter:Number,open:{type:Boolean,default:!1}});var T=class extends o{openValueChanged(){i(this.overlayTarget,this.openValue),i(this.menuTarget,this.openValue),this.hasCloseTarget&&i(this.closeTarget,this.openValue)}};a(T,"targets",["overlay","close"]);import{Controller as q}from"@hotwired/stimulus";var l=class extends q{initialize(){this.anchor&&(this.indexValue=this.tabTargets.findIndex(t=>t.id===this.anchor))}connect(){this.showTab()}change(t){t.currentTarget.tagName==="SELECT"?this.indexValue=t.currentTarget.selectedIndex:t.currentTarget.dataset.index?this.indexValue=t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.indexValue=this.tabTargets.findIndex(e=>e.id==t.currentTarget.dataset.id):this.indexValue=this.tabTargets.indexOf(t.currentTarget),window.dispatchEvent(new CustomEvent("tsc:tab-change"))}nextTab(){this.indexValue=Math.min(this.indexValue+1,this.tabsCount-1)}previousTab(){this.indexValue=Math.max(this.indexValue-1,0)}firstTab(){this.indexValue=0}lastTab(){this.indexValue=this.tabsCount-1}indexValueChanged(){if(this.showTab(),this.updateAnchorValue){let t=this.tabTargets[this.indexValue].id;if(this.scrollToAnchorValue)location.hash=t;else{let s=window.location.href.split("#")[0]+"#"+t;history.replaceState({},document.title,s)}}}showTab(){this.panelTargets.forEach((t,e)=>{let s=this.tabTargets[e];e===this.indexValue?(t.classList.remove("hidden"),s.ariaSelected="true",this.hasInactiveTabClass&&s?.classList?.remove(...this.inactiveTabClasses),this.hasActiveTabClass&&s?.classList?.add(...this.activeTabClasses)):(t.classList.add("hidden"),s.ariaSelected=null,this.hasActiveTabClass&&s?.classList?.remove(...this.activeTabClasses),this.hasInactiveTabClass&&s?.classList?.add(...this.inactiveTabClasses))}),this.hasSelectTarget&&(this.selectTarget.selectedIndex=this.indexValue),this.scrollActiveTabIntoView()}scrollActiveTabIntoView(){let t=this.element.querySelector("[aria-selected]");t&&t.scrollIntoView({inline:"center"})}get tabsCount(){return this.tabTargets.length}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}};a(l,"classes",["activeTab","inactiveTab"]),a(l,"targets",["tab","panel","select"]),a(l,"values",{index:0,updateAnchor:Boolean,scrollToAnchor:Boolean});import{Controller as M}from"@hotwired/stimulus";var m=class extends M{toggle(t){this.openValue=!this.openValue,this.animate()}toggleInput(t){this.openValue=t.target.checked,this.animate()}hide(){this.openValue=!1,this.animate()}show(){this.openValue=!0,this.animate()}animate(){this.toggleableTargets.forEach(t=>{i(t,this.openValue)})}};a(m,"targets",["toggleable"]),a(m,"values",{open:{type:Boolean,default:!1}});export{f as Alert,u as Autosave,h as ColorPreview,o as Dropdown,c as Modal,d as Popover,T as Slideover,l as Tabs,m as Toggle}; +// node_modules/@hotwired/stimulus/dist/stimulus.js +function camelize(value) { + return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase()); +} +function namespaceCamelize(value) { + return camelize(value.replace(/--/g, "-").replace(/__/g, "_")); +} +function capitalize(value) { + return value.charAt(0).toUpperCase() + value.slice(1); +} +function dasherize(value) { + return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`); +} +function isSomething(object) { + return object !== null && object !== void 0; +} +function hasProperty(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); +} +function readInheritableStaticArrayValues(constructor, propertyName) { + const ancestors = getAncestorsForConstructor(constructor); + return Array.from(ancestors.reduce((values, constructor2) => { + getOwnStaticArrayValues(constructor2, propertyName).forEach((name) => values.add(name)); + return values; + }, /* @__PURE__ */ new Set())); +} +function readInheritableStaticObjectPairs(constructor, propertyName) { + const ancestors = getAncestorsForConstructor(constructor); + return ancestors.reduce((pairs, constructor2) => { + pairs.push(...getOwnStaticObjectPairs(constructor2, propertyName)); + return pairs; + }, []); +} +function getAncestorsForConstructor(constructor) { + const ancestors = []; + while (constructor) { + ancestors.push(constructor); + constructor = Object.getPrototypeOf(constructor); + } + return ancestors.reverse(); +} +function getOwnStaticArrayValues(constructor, propertyName) { + const definition = constructor[propertyName]; + return Array.isArray(definition) ? definition : []; +} +function getOwnStaticObjectPairs(constructor, propertyName) { + const definition = constructor[propertyName]; + return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : []; +} +var getOwnKeys = (() => { + if (typeof Object.getOwnPropertySymbols == "function") { + return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]; + } else { + return Object.getOwnPropertyNames; + } +})(); +var extend = (() => { + function extendWithReflect(constructor) { + function extended() { + return Reflect.construct(constructor, arguments, new.target); + } + extended.prototype = Object.create(constructor.prototype, { + constructor: { value: extended } + }); + Reflect.setPrototypeOf(extended, constructor); + return extended; + } + function testReflectExtension() { + const a = function() { + this.a.call(this); + }; + const b = extendWithReflect(a); + b.prototype.a = function() { + }; + return new b(); + } + try { + testReflectExtension(); + return extendWithReflect; + } catch (error) { + return (constructor) => class extended extends constructor { + }; + } +})(); +var defaultSchema = { + controllerAttribute: "data-controller", + actionAttribute: "data-action", + targetAttribute: "data-target", + targetAttributeForScope: (identifier) => `data-${identifier}-target`, + outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`, + keyMappings: Object.assign(Object.assign({ enter: "Enter", tab: "Tab", esc: "Escape", space: " ", up: "ArrowUp", down: "ArrowDown", left: "ArrowLeft", right: "ArrowRight", home: "Home", end: "End", page_up: "PageUp", page_down: "PageDown" }, objectFromEntries("abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, c]))), objectFromEntries("0123456789".split("").map((n) => [n, n]))) +}; +function objectFromEntries(array) { + return array.reduce((memo, [k, v]) => Object.assign(Object.assign({}, memo), { [k]: v }), {}); +} +function ClassPropertiesBlessing(constructor) { + const classes = readInheritableStaticArrayValues(constructor, "classes"); + return classes.reduce((properties, classDefinition) => { + return Object.assign(properties, propertiesForClassDefinition(classDefinition)); + }, {}); +} +function propertiesForClassDefinition(key) { + return { + [`${key}Class`]: { + get() { + const { classes } = this; + if (classes.has(key)) { + return classes.get(key); + } else { + const attribute = classes.getAttributeName(key); + throw new Error(`Missing attribute "${attribute}"`); + } + } + }, + [`${key}Classes`]: { + get() { + return this.classes.getAll(key); + } + }, + [`has${capitalize(key)}Class`]: { + get() { + return this.classes.has(key); + } + } + }; +} +function OutletPropertiesBlessing(constructor) { + const outlets = readInheritableStaticArrayValues(constructor, "outlets"); + return outlets.reduce((properties, outletDefinition) => { + return Object.assign(properties, propertiesForOutletDefinition(outletDefinition)); + }, {}); +} +function getOutletController(controller, element, identifier) { + return controller.application.getControllerForElementAndIdentifier(element, identifier); +} +function getControllerAndEnsureConnectedScope(controller, element, outletName) { + let outletController = getOutletController(controller, element, outletName); + if (outletController) + return outletController; + controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName); + outletController = getOutletController(controller, element, outletName); + if (outletController) + return outletController; +} +function propertiesForOutletDefinition(name) { + const camelizedName = namespaceCamelize(name); + return { + [`${camelizedName}Outlet`]: { + get() { + const outletElement = this.outlets.find(name); + const selector = this.outlets.getSelectorForOutletName(name); + if (outletElement) { + const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); + if (outletController) + return outletController; + throw new Error(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`); + } + throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); + } + }, + [`${camelizedName}Outlets`]: { + get() { + const outlets = this.outlets.findAll(name); + if (outlets.length > 0) { + return outlets.map((outletElement) => { + const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); + if (outletController) + return outletController; + console.warn(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`, outletElement); + }).filter((controller) => controller); + } + return []; + } + }, + [`${camelizedName}OutletElement`]: { + get() { + const outletElement = this.outlets.find(name); + const selector = this.outlets.getSelectorForOutletName(name); + if (outletElement) { + return outletElement; + } else { + throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); + } + } + }, + [`${camelizedName}OutletElements`]: { + get() { + return this.outlets.findAll(name); + } + }, + [`has${capitalize(camelizedName)}Outlet`]: { + get() { + return this.outlets.has(name); + } + } + }; +} +function TargetPropertiesBlessing(constructor) { + const targets = readInheritableStaticArrayValues(constructor, "targets"); + return targets.reduce((properties, targetDefinition) => { + return Object.assign(properties, propertiesForTargetDefinition(targetDefinition)); + }, {}); +} +function propertiesForTargetDefinition(name) { + return { + [`${name}Target`]: { + get() { + const target = this.targets.find(name); + if (target) { + return target; + } else { + throw new Error(`Missing target element "${name}" for "${this.identifier}" controller`); + } + } + }, + [`${name}Targets`]: { + get() { + return this.targets.findAll(name); + } + }, + [`has${capitalize(name)}Target`]: { + get() { + return this.targets.has(name); + } + } + }; +} +function ValuePropertiesBlessing(constructor) { + const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, "values"); + const propertyDescriptorMap = { + valueDescriptorMap: { + get() { + return valueDefinitionPairs.reduce((result, valueDefinitionPair) => { + const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier); + const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key); + return Object.assign(result, { [attributeName]: valueDescriptor }); + }, {}); + } + } + }; + return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => { + return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair)); + }, propertyDescriptorMap); +} +function propertiesForValueDefinitionPair(valueDefinitionPair, controller) { + const definition = parseValueDefinitionPair(valueDefinitionPair, controller); + const { key, name, reader: read, writer: write } = definition; + return { + [name]: { + get() { + const value = this.data.get(key); + if (value !== null) { + return read(value); + } else { + return definition.defaultValue; + } + }, + set(value) { + if (value === void 0) { + this.data.delete(key); + } else { + this.data.set(key, write(value)); + } + } + }, + [`has${capitalize(name)}`]: { + get() { + return this.data.has(key) || definition.hasCustomDefaultValue; + } + } + }; +} +function parseValueDefinitionPair([token, typeDefinition], controller) { + return valueDescriptorForTokenAndTypeDefinition({ + controller, + token, + typeDefinition + }); +} +function parseValueTypeConstant(constant) { + switch (constant) { + case Array: + return "array"; + case Boolean: + return "boolean"; + case Number: + return "number"; + case Object: + return "object"; + case String: + return "string"; + } +} +function parseValueTypeDefault(defaultValue) { + switch (typeof defaultValue) { + case "boolean": + return "boolean"; + case "number": + return "number"; + case "string": + return "string"; + } + if (Array.isArray(defaultValue)) + return "array"; + if (Object.prototype.toString.call(defaultValue) === "[object Object]") + return "object"; +} +function parseValueTypeObject(payload) { + const { controller, token, typeObject } = payload; + const hasType = isSomething(typeObject.type); + const hasDefault = isSomething(typeObject.default); + const fullObject = hasType && hasDefault; + const onlyType = hasType && !hasDefault; + const onlyDefault = !hasType && hasDefault; + const typeFromObject = parseValueTypeConstant(typeObject.type); + const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default); + if (onlyType) + return typeFromObject; + if (onlyDefault) + return typeFromDefaultValue; + if (typeFromObject !== typeFromDefaultValue) { + const propertyPath = controller ? `${controller}.${token}` : token; + throw new Error(`The specified default value for the Stimulus Value "${propertyPath}" must match the defined type "${typeFromObject}". The provided default value of "${typeObject.default}" is of type "${typeFromDefaultValue}".`); + } + if (fullObject) + return typeFromObject; +} +function parseValueTypeDefinition(payload) { + const { controller, token, typeDefinition } = payload; + const typeObject = { controller, token, typeObject: typeDefinition }; + const typeFromObject = parseValueTypeObject(typeObject); + const typeFromDefaultValue = parseValueTypeDefault(typeDefinition); + const typeFromConstant = parseValueTypeConstant(typeDefinition); + const type = typeFromObject || typeFromDefaultValue || typeFromConstant; + if (type) + return type; + const propertyPath = controller ? `${controller}.${typeDefinition}` : token; + throw new Error(`Unknown value type "${propertyPath}" for "${token}" value`); +} +function defaultValueForDefinition(typeDefinition) { + const constant = parseValueTypeConstant(typeDefinition); + if (constant) + return defaultValuesByType[constant]; + const hasDefault = hasProperty(typeDefinition, "default"); + const hasType = hasProperty(typeDefinition, "type"); + const typeObject = typeDefinition; + if (hasDefault) + return typeObject.default; + if (hasType) { + const { type } = typeObject; + const constantFromType = parseValueTypeConstant(type); + if (constantFromType) + return defaultValuesByType[constantFromType]; + } + return typeDefinition; +} +function valueDescriptorForTokenAndTypeDefinition(payload) { + const { token, typeDefinition } = payload; + const key = `${dasherize(token)}-value`; + const type = parseValueTypeDefinition(payload); + return { + type, + key, + name: camelize(key), + get defaultValue() { + return defaultValueForDefinition(typeDefinition); + }, + get hasCustomDefaultValue() { + return parseValueTypeDefault(typeDefinition) !== void 0; + }, + reader: readers[type], + writer: writers[type] || writers.default + }; +} +var defaultValuesByType = { + get array() { + return []; + }, + boolean: false, + number: 0, + get object() { + return {}; + }, + string: "" +}; +var readers = { + array(value) { + const array = JSON.parse(value); + if (!Array.isArray(array)) { + throw new TypeError(`expected value of type "array" but instead got value "${value}" of type "${parseValueTypeDefault(array)}"`); + } + return array; + }, + boolean(value) { + return !(value == "0" || String(value).toLowerCase() == "false"); + }, + number(value) { + return Number(value.replace(/_/g, "")); + }, + object(value) { + const object = JSON.parse(value); + if (object === null || typeof object != "object" || Array.isArray(object)) { + throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseValueTypeDefault(object)}"`); + } + return object; + }, + string(value) { + return value; + } +}; +var writers = { + default: writeString, + array: writeJSON, + object: writeJSON +}; +function writeJSON(value) { + return JSON.stringify(value); +} +function writeString(value) { + return `${value}`; +} +var Controller = class { + constructor(context) { + this.context = context; + } + static get shouldLoad() { + return true; + } + static afterLoad(_identifier, _application) { + return; + } + get application() { + return this.context.application; + } + get scope() { + return this.context.scope; + } + get element() { + return this.scope.element; + } + get identifier() { + return this.scope.identifier; + } + get targets() { + return this.scope.targets; + } + get outlets() { + return this.scope.outlets; + } + get classes() { + return this.scope.classes; + } + get data() { + return this.scope.data; + } + initialize() { + } + connect() { + } + disconnect() { + } + dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) { + const type = prefix ? `${prefix}:${eventName}` : eventName; + const event = new CustomEvent(type, { detail, bubbles, cancelable }); + target.dispatchEvent(event); + return event; + } +}; +Controller.blessings = [ + ClassPropertiesBlessing, + TargetPropertiesBlessing, + ValuePropertiesBlessing, + OutletPropertiesBlessing +]; +Controller.targets = []; +Controller.outlets = []; +Controller.values = {}; + +// src/transition.js +async function transition(element, state, transitionOptions = {}) { + if (!!state) { + enter(element, transitionOptions); + } else { + leave(element, transitionOptions); + } +} +async function enter(element, transitionOptions = {}) { + const transitionClasses = element.dataset.transitionEnter || transitionOptions.enter || "enter"; + const fromClasses = element.dataset.transitionEnterFrom || transitionOptions.enterFrom || "enter-from"; + const toClasses = element.dataset.transitionEnterTo || transitionOptions.enterTo || "enter-to"; + const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || "hidden"; + element.classList.add(...transitionClasses.split(" ")); + element.classList.add(...fromClasses.split(" ")); + element.classList.remove(...toClasses.split(" ")); + element.classList.remove(...toggleClass.split(" ")); + await nextFrame(); + element.classList.remove(...fromClasses.split(" ")); + element.classList.add(...toClasses.split(" ")); + try { + await afterTransition(element); + } finally { + element.classList.remove(...transitionClasses.split(" ")); + } +} +async function leave(element, transitionOptions = {}) { + const transitionClasses = element.dataset.transitionLeave || transitionOptions.leave || "leave"; + const fromClasses = element.dataset.transitionLeaveFrom || transitionOptions.leaveFrom || "leave-from"; + const toClasses = element.dataset.transitionLeaveTo || transitionOptions.leaveTo || "leave-to"; + const toggleClass = element.dataset.toggleClass || transitionOptions.toggle || "hidden"; + element.classList.add(...transitionClasses.split(" ")); + element.classList.add(...fromClasses.split(" ")); + element.classList.remove(...toClasses.split(" ")); + await nextFrame(); + element.classList.remove(...fromClasses.split(" ")); + element.classList.add(...toClasses.split(" ")); + try { + await afterTransition(element); + } finally { + element.classList.remove(...transitionClasses.split(" ")); + element.classList.add(...toggleClass.split(" ")); + } +} +function nextFrame() { + return new Promise((resolve) => { + requestAnimationFrame(() => { + requestAnimationFrame(resolve); + }); + }); +} +function afterTransition(element) { + return Promise.all(element.getAnimations().map((animation) => animation.finished)); +} + +// src/alert.js +var alert_default = class extends Controller { + static values = { + dismissAfter: Number, + showDelay: { type: Number, default: 0 }, + removeDelay: { type: Number, default: 1100 } + }; + connect() { + setTimeout(() => { + enter(this.element); + }, this.showDelayValue); + if (this.hasDismissAfterValue) { + setTimeout(() => { + this.close(); + }, this.dismissAfterValue); + } + } + // Runs hide animation and then removes element from the page + close() { + leave(this.element).then(() => { + this.element.remove(); + }); + } +}; + +// src/autosave.js +var autosave_default = class extends Controller { + static targets = ["form", "status"]; + static values = { + submitDuration: { type: Number, default: 1e3 }, + statusDuration: { type: Number, default: 2e3 }, + submittingText: { type: String, default: "Saving..." }, + successText: { type: String, default: "Saved!" }, + errorText: { type: String, default: "Unable to save." } + }; + connect() { + this.timeout = null; + } + save() { + clearTimeout(this.timeout); + this.timeout = setTimeout(() => { + this.statusTarget.textContent = this.submittingTextValue; + this.formTarget.requestSubmit(); + }, this.submitDurationValue); + } + success() { + this.setStatus(this.successTextValue); + } + error() { + this.setStatus(this.errorTextValue); + } + setStatus(message) { + this.statusTarget.textContent = message; + this.timeout = setTimeout(() => { + this.statusTarget.textContent = ""; + }, this.statusDurationValue); + } +}; + +// src/color_preview.js +var color_preview_default = class extends Controller { + static targets = ["preview", "color"]; + static values = { + style: { type: String, default: "backgroundColor" } + }; + update() { + this.preview = this.colorTarget.value; + } + set preview(color) { + this.previewTarget.style[this.styleValue] = color; + const yiqColor = this._getContrastYIQ(color); + if (this.styleValue === "color") { + this.previewTarget.style.backgroundColor = yiqColor; + } else { + this.previewTarget.style.color = yiqColor; + } + } + _getContrastYIQ(hexColor) { + hexColor = hexColor.replace("#", ""); + const yiqThreshold = 128; + const r = parseInt(hexColor.substr(0, 2), 16); + const g = parseInt(hexColor.substr(2, 2), 16); + const b = parseInt(hexColor.substr(4, 2), 16); + const yiq = (r * 299 + g * 587 + b * 114) / 1e3; + return yiq >= yiqThreshold ? "#000" : "#fff"; + } +}; + +// src/dropdown.js +var dropdown_default = class extends Controller { + static targets = ["menu", "button", "menuItem"]; + static values = { + open: { type: Boolean, default: false }, + closeOnEscape: { type: Boolean, default: true }, + closeOnClickOutside: { type: Boolean, default: true } + }; + static classes = ["enter", "enterFrom", "enterTo", "leave", "leaveFrom", "leaveTo", "toggle"]; + connect() { + document.addEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + disconnect() { + document.removeEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + openValueChanged() { + transition(this.menuTarget, this.openValue, this.transitionOptions); + if (this.openValue === true && this.hasMenuItemTarget) { + this.menuItemTargets[0].focus(); + } + } + show() { + this.openValue = true; + } + close() { + this.openValue = false; + } + // Closes dropdown from outside click or keyboard + hide(event) { + if (this.closeOnClickOutsideValue && event.target.nodeType && this.element.contains(event.target) === false && this.openValue) { + this.openValue = false; + } + if (this.closeOnEscapeValue && event.key === "Escape" && this.openValue) { + this.openValue = false; + } + } + toggle() { + this.openValue = !this.openValue; + } + nextItem(event) { + event.preventDefault(); + this.menuItemTargets[this.nextIndex].focus(); + } + previousItem(event) { + event.preventDefault(); + this.menuItemTargets[this.previousIndex].focus(); + } + // getters and setters + get currentItemIndex() { + return this.menuItemTargets.indexOf(document.activeElement); + } + get nextIndex() { + return Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1); + } + get previousIndex() { + return Math.max(this.currentItemIndex - 1, 0); + } + get transitionOptions() { + return { + enter: this.hasEnterClass ? this.enterClass : "transition ease-out duration-100", + enterFrom: this.hasEnterFromClass ? this.enterFromClass : "transform opacity-0 scale-95", + enterTo: this.hasEnterToClass ? this.enterToClass : "transform opacity-100 scale-100", + leave: this.hasLeaveClass ? this.leaveClass : "transition ease-in duration-75", + leaveFrom: this.hasLeaveFromClass ? this.leaveFromClass : "transform opacity-100 scale-100", + leaveTo: this.hasLeaveToClass ? this.leaveToClass : "transform opacity-0 scale-95", + toggleClass: this.hasToggleClass ? this.toggleClass : "hidden" + }; + } + // Ensures the menu is hidden before Turbo caches the page + beforeCache() { + this.openValue = false; + this.menuTarget.classList.add("hidden"); + } +}; + +// src/modal.js +var modal_default = class extends Controller { + static targets = ["dialog"]; + static values = { + open: Boolean + }; + connect() { + if (this.openValue) + this.open(); + document.addEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + disconnect() { + document.removeEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + open() { + this.dialogTarget.showModal(); + } + close() { + this.dialogTarget.close(); + } + backdropClose(event) { + if (event.target.nodeName == "DIALOG") + this.dialogTarget.close(); + } + // For showing non-modally + show() { + this.dialogTarget.show(); + } + beforeCache() { + this.close(); + } +}; + +// src/popover.js +var popover_default = class extends Controller { + static targets = ["content"]; + static values = { + dismissAfter: Number, + open: { type: Boolean, default: false } + }; + openValueChanged() { + transition(this.contentTarget, this.openValue); + if (this.shouldAutoDismiss) + this.scheduleDismissal(); + } + // If already true, extend the dismissal another X seconds since this will not trigger openValueChanged + show(event) { + if (this.shouldAutoDismiss) + this.scheduleDismissal(); + this.openValue = true; + } + hide() { + this.openValue = false; + } + toggle() { + this.openValue = !this.openValue; + } + get shouldAutoDismiss() { + return this.openValue && this.hasDismissAfterValue; + } + scheduleDismissal() { + if (!this.hasDismissAfterValue) + return; + this.cancelDismissal(); + this.timeoutId = setTimeout(() => { + this.hide(); + this.timeoutId = void 0; + }, this.dismissAfterValue); + } + cancelDismissal() { + if (typeof this.timeoutId === "number") { + clearTimeout(this.timeoutId); + this.timeoutId = void 0; + } + } +}; + +// src/slideover.js +var slideover_default = class extends Controller { + static targets = ["dialog"]; + static values = { + open: Boolean + }; + connect() { + if (this.openValue) + this.open(); + document.addEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + disconnect() { + document.removeEventListener("turbo:before-cache", this.beforeCache.bind(this)); + } + open() { + this.dialogTarget.showModal(); + } + close() { + this.dialogTarget.close(); + } + backdropClose(event) { + if (event.target.nodeName == "DIALOG") + this.dialogTarget.close(); + } + beforeCache() { + this.close(); + } +}; + +// src/tabs.js +var tabs_default = class extends Controller { + static classes = ["activeTab", "inactiveTab"]; + static targets = ["tab", "panel", "select"]; + static values = { + index: 0, + updateAnchor: Boolean, + scrollToAnchor: Boolean, + scrollActiveTabIntoView: Boolean + }; + initialize() { + if (this.anchor) + this.indexValue = this.tabTargets.findIndex((tab) => tab.id === this.anchor); + } + connect() { + this.showTab(); + } + // Changes to the clicked tab + change(event) { + if (event.currentTarget.tagName === "SELECT") { + this.indexValue = event.currentTarget.selectedIndex; + } else if (event.currentTarget.dataset.index) { + this.indexValue = event.currentTarget.dataset.index; + } else if (event.currentTarget.dataset.id) { + this.indexValue = this.tabTargets.findIndex((tab) => tab.id == event.currentTarget.dataset.id); + } else { + this.indexValue = this.tabTargets.indexOf(event.currentTarget); + } + window.dispatchEvent(new CustomEvent("tsc:tab-change")); + } + nextTab() { + this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1); + } + previousTab() { + this.indexValue = Math.max(this.indexValue - 1, 0); + } + firstTab() { + this.indexValue = 0; + } + lastTab() { + this.indexValue = this.tabsCount - 1; + } + indexValueChanged() { + this.showTab(); + if (this.updateAnchorValue) { + const new_tab_id = this.tabTargets[this.indexValue].id; + if (this.scrollToAnchorValue) { + location.hash = new_tab_id; + } else { + const currentUrl = window.location.href; + const newUrl = currentUrl.split("#")[0] + "#" + new_tab_id; + history.replaceState({}, document.title, newUrl); + } + } + } + showTab() { + this.panelTargets.forEach((panel, index) => { + const tab = this.tabTargets[index]; + if (index === this.indexValue) { + panel.classList.remove("hidden"); + tab.ariaSelected = "true"; + if (this.hasInactiveTabClass) + tab?.classList?.remove(...this.inactiveTabClasses); + if (this.hasActiveTabClass) + tab?.classList?.add(...this.activeTabClasses); + } else { + panel.classList.add("hidden"); + tab.ariaSelected = null; + if (this.hasActiveTabClass) + tab?.classList?.remove(...this.activeTabClasses); + if (this.hasInactiveTabClass) + tab?.classList?.add(...this.inactiveTabClasses); + } + }); + if (this.hasSelectTarget) { + this.selectTarget.selectedIndex = this.indexValue; + } + if (this.scrollActiveTabIntoViewValue) + this.scrollToActiveTab(); + } + // If tabs have horizontal scrolling, the active tab may be out of sight. + // Make sure the active tab is visible by scrolling it into the view. + scrollToActiveTab() { + const activeTab = this.element.querySelector("[aria-selected]"); + if (activeTab) + activeTab.scrollIntoView({ inline: "center" }); + } + get tabsCount() { + return this.tabTargets.length; + } + get anchor() { + return document.URL.split("#").length > 1 ? document.URL.split("#")[1] : null; + } +}; + +// src/toggle.js +var toggle_default = class extends Controller { + static targets = ["toggleable"]; + static values = { + open: { type: Boolean, default: false } + }; + toggle(event) { + this.openValue = !this.openValue; + this.animate(); + } + // Sets open to value of checkbox or radio + toggleInput(event) { + this.openValue = event.target.checked; + this.animate(); + } + hide() { + this.openValue = false; + this.animate(); + } + show() { + this.openValue = true; + this.animate(); + } + animate() { + this.toggleableTargets.forEach((target) => { + transition(target, this.openValue); + }); + } +}; +export { + alert_default as Alert, + autosave_default as Autosave, + color_preview_default as ColorPreview, + dropdown_default as Dropdown, + modal_default as Modal, + popover_default as Popover, + slideover_default as Slideover, + tabs_default as Tabs, + toggle_default as Toggle +}; diff --git a/dist/tailwindcss-stimulus-components.module.js.map b/dist/tailwindcss-stimulus-components.module.js.map index bae4900..c6770a4 100644 --- a/dist/tailwindcss-stimulus-components.module.js.map +++ b/dist/tailwindcss-stimulus-components.module.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/alert.js", "../src/transition.js", "../src/autosave.js", "../src/color_preview.js", "../src/dropdown.js", "../src/modal.js", "../src/popover.js", "../src/slideover.js", "../src/tabs.js", "../src/toggle.js"], - "sourcesContent": ["import { Controller } from '@hotwired/stimulus'\nimport { enter, leave } from \"./transition\"\n\nexport default class extends Controller {\n static values = {\n dismissAfter: Number,\n showDelay: { type: Number, default: 0 },\n removeDelay: { type: Number, default: 1100 }\n }\n\n connect() {\n setTimeout(() => {\n enter(this.element)\n }, this.showDelayValue)\n\n // Auto dimiss if defined\n if (this.hasDismissAfterValue) {\n setTimeout(() => {\n this.close()\n }, this.dismissAfterValue)\n }\n }\n\n // Runs hide animation and then removes element from the page\n close() {\n leave(this.element).then(() => {\n this.element.remove()\n })\n }\n}\n", "// Enter transition:\n//\n// transition(this.element, true)\n//\n// Leave transition:\n//\n// transition(this.element, false)\nexport async function transition(element, state, transitionOptions = {}) {\n if (!!state) {\n enter(element, transitionOptions)\n } else {\n leave(element, transitionOptions)\n }\n}\n\n// class=\"fixed inset-0 bg-black overflow-y-auto flex items-center justify-center bg-opacity-80 hidden\"\n// data-transition-enter=\"transition-all ease-in-out duration-300\"\n// data-transition-enter-from=\"bg-opacity-0\"\n// data-transition-enter-to=\"bg-opacity-80\"\n// data-transition-leave=\"transition-all ease-in-out duration-300\"\n// data-transition-leave-from=\"bg-opacity-80\"\n// data-transition-leave-to=\"bg-opacity-0\"\nexport async function enter(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionEnter || transitionOptions.enter || 'enter'\n const fromClasses =\n element.dataset.transitionEnterFrom || transitionOptions.enterFrom || 'enter-from'\n const toClasses = element.dataset.transitionEnterTo || transitionOptions.enterTo || 'enter-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n element.classList.remove(...toggleClass.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n }\n}\n\nexport async function leave(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionLeave || transitionOptions.leave || 'leave'\n const fromClasses =\n element.dataset.transitionLeaveFrom || transitionOptions.leaveFrom || 'leave-from'\n const toClasses = element.dataset.transitionLeaveTo || transitionOptions.leaveTo || 'leave-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toogle || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n element.classList.add(...toggleClass.split(' '))\n }\n}\n\nfunction nextFrame() {\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n requestAnimationFrame(resolve)\n })\n })\n}\n\nfunction afterTransition(element) {\n return Promise.all(element.getAnimations().map(animation => animation.finished))\n}\n", "// Form autosave\n//\n// <%= form_with(model: post, data: { controller: \"autosave\", autosave_target: \"form\", action: \"turbo:submit-end->autosave#success turbo:fetch-request-error->autosave#error\" }) do |form| %>\n//
\n// <%= form.label :title %>\n// <%= form.text_field :title, class: 'form-control', data: { action: \"keyup->autosave#save\" } %>\n//
\n//\n//
\n// <% end %>\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['form', 'status']\n static values = {\n submitDuration: {type: Number, default: 1000},\n statusDuration: {type: Number, default: 2000},\n submittingText: {type: String, default: \"Saving...\"},\n successText: {type: String, default: \"Saved!\"},\n errorText: {type: String, default: \"Unable to save.\"}\n }\n\n connect() {\n this.timeout = null\n }\n\n save() {\n clearTimeout(this.timeout)\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = this.submittingTextValue\n this.formTarget.requestSubmit()\n }, this.submitDurationValue)\n }\n\n success() {\n this.setStatus(this.successTextValue)\n }\n\n error() {\n this.setStatus(this.errorTextValue)\n }\n\n setStatus(message) {\n this.statusTarget.textContent = message\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = ''\n }, this.statusDurationValue)\n }\n}\n", "// A color picker preview where you can choose to have the color or backgroundColor\n// get updated based on the result of a color picker. It also supports ensuring\n// the foreground text is always readable by performing a YIQ calculation to\n// set the text to black or white based on the contrast of the color and backgroundColor.\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['preview', 'color'];\n static values = {\n style: {type: String, default: \"backgroundColor\"}\n }\n\n update() {\n this.preview = this.colorTarget.value\n }\n\n set preview(color) {\n this.previewTarget.style[this.styleValue] = color\n\n // Ensure the foreground text is always readable by setting either the\n // backgroundColor or color to black or white.\n const yiqColor = this._getContrastYIQ(color)\n\n if (this.styleValue === 'color') {\n this.previewTarget.style.backgroundColor = yiqColor\n } else {\n this.previewTarget.style.color = yiqColor\n }\n }\n\n _getContrastYIQ(hexColor) {\n // Taken from: https://24ways.org/2010/calculating-color-contrast/\n hexColor = hexColor.replace('#', '');\n\n const yiqThreshold = 128;\n const r = parseInt(hexColor.substr(0, 2), 16);\n const g = parseInt(hexColor.substr(2, 2), 16);\n const b = parseInt(hexColor.substr(4, 2), 16);\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n\n return (yiq >= yiqThreshold) ? '#000' : '#fff';\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = ['menu', 'button', 'menuItem']\n static values = {\n open: { type: Boolean, default: false },\n closeOnEscape: { type: Boolean, default: true },\n closeOnClickOutside: { type: Boolean, default: true },\n }\n\n static classes = ['enter', 'enterFrom', 'enterTo', 'leave', 'leaveFrom', 'leaveTo', 'toggle']\n\n // lifecycle\n connect() {\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n this.#initializeDropdownActions()\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n\n if (this.hasButtonTarget) {\n this.buttonTarget.removeEventListener(\"keydown\", this._onMenuButtonKeydown)\n this.buttonTarget.removeAttribute(\"aria-haspopup\")\n }\n }\n\n // callbacks\n openValueChanged() {\n transition(this.menuTarget, this.openValue, this.transitionOptions)\n\n if (this.openValue === true && this.hasMenuItemTarget) {\n this.menuItemTargets[0].focus()\n }\n }\n\n // actions\n show() {\n this.openValue = true\n }\n\n close() {\n this.openValue = false\n }\n\n hide(event) {\n // if the event is a click and the target is not inside the dropdown, then close it\n if (\n this.closeOnClickOutsideValue &&\n event.target.nodeType &&\n this.element.contains(event.target) === false &&\n this.openValue\n ) {\n this.openValue = false\n }\n\n // if the event is a keydown and the key is escape, then close it\n if (this.closeOnEscapeValue && event.key === 'Escape' && this.openValue) {\n this.openValue = false\n }\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n nextItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.nextIndex].focus()\n }\n\n previousItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.previousIndex].focus()\n }\n\n // getters and setters\n get currentItemIndex() {\n return this.menuItemTargets.indexOf(document.activeElement)\n }\n\n get nextIndex() {\n return Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1)\n }\n\n get previousIndex() {\n return Math.max(this.currentItemIndex - 1, 0)\n }\n\n get transitionOptions() {\n // once the Class API default values are available, we can simplify this\n return {\n enter: this.hasEnterClass ? this.enterClass : 'transition ease-out duration-100',\n enterFrom: this.hasEnterFromClass ? this.enterFromClass : 'transform opacity-0 scale-95',\n enterTo: this.hasEnterToClass ? this.enterToClass : 'transform opacity-100 scale-100',\n leave: this.hasLeaveClass ? this.leaveClass : 'transition ease-in duration-75',\n leaveFrom: this.hasLeaveFromClass ? this.leaveFromClass : 'transform opacity-100 scale-100',\n leaveTo: this.hasLeaveToClass ? this.leaveToClass : 'transform opacity-0 scale-95',\n toggleClass: this.hasToggleClass ? this.toggleClass : 'hidden',\n }\n }\n\n // private\n\n #initializeDropdownActions() {\n // this will set the necessary actions on the dropdown element for it to work\n // data-action=\"click->dropdown#toggle click@window->dropdown#hide keydown.up->dropdown#previousItem keydown.down->dropdown#nextItem\"\n // Note: If existing actions are already specified by the user, they will be preserved and augmented without any redundancy.\n\n const actions = this.element.dataset.action ? this.element.dataset.action.split(' ') : []\n actions.push('click->dropdown#toggle')\n actions.push('click@window->dropdown#hide')\n actions.push('keydown.up->dropdown#previousItem')\n actions.push('keydown.down->dropdown#nextItem')\n actions.push('keydown.esc->dropdown#hide')\n this.element.dataset.action = [...new Set(actions)].join(' ')\n }\n\n // Ensures the menu is hidden before Turbo caches the page\n beforeCache() {\n this.openValue = false\n this.menuTarget.classList.add(\"hidden\")\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n // For showing non-modally\n show() {\n this.dialogTarget.show()\n }\n}\n", "// A simple inline popover to be used wherever needed, with a configurable offset.\n// Visit The Stimulus Handbook for more details\n// https://stimulusjs.org/handbook/introduction\n//\n// This example controller works with specially annotated HTML like:\n//\n//

\n// Beginning in 2015, Google introduced what is called the\n//

popover#mouseOver mouseout->popover#mouseOut\">\n// 'local snack pack',\n// \n//
\n// which shows you local search results before normal organic results.\n//

\n//\n// You can also toggle the popover using the click action.\n//
popover#toggle\" data-action=\"mouseenter->popover#show mouseleave->popover#hide\">\n\nimport { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['content']\n static values = {\n dismissAfter: Number,\n open: { type: Boolean, default: false }\n }\n\n openValueChanged() {\n transition(this.contentTarget, this.openValue)\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n }\n\n // If already true, extend the dismissal another X seconds since this will not trigger openValueChanged\n show(event) {\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n this.openValue = true\n }\n\n hide() {\n this.openValue = false\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n get shouldAutoDismiss() {\n return (this.openValue && this.hasDismissAfterValue)\n }\n\n scheduleDismissal() {\n if (!this.hasDismissAfterValue) return\n\n // Cancel any existing dismissals\n this.cancelDismissal()\n\n // Schedule the next dismissal\n this.timeoutId = setTimeout(() => {\n this.hide()\n this.timeoutId = undefined\n }, this.dismissAfterValue)\n }\n\n cancelDismissal() {\n if (typeof this.timeoutId === \"number\") {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n}\n", "import Dropdown from './dropdown.js'\nimport { transition } from './transition'\n\nexport default class extends Dropdown {\n static targets = ['overlay', 'close']\n\n openValueChanged() {\n transition(this.overlayTarget, this.openValue)\n transition(this.menuTarget, this.openValue)\n if (this.hasCloseTarget) transition(this.closeTarget, this.openValue)\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static classes = [ \"activeTab\", \"inactiveTab\" ]\n static targets = ['tab', 'panel', 'select']\n static values = {\n index: 0,\n updateAnchor: Boolean,\n scrollToAnchor: Boolean,\n }\n\n initialize() {\n if (this.anchor) this.indexValue = this.tabTargets.findIndex((tab) => tab.id === this.anchor)\n }\n\n connect() {\n this.showTab()\n }\n\n // Changes to the clicked tab\n change(event) {\n if (event.currentTarget.tagName === \"SELECT\") {\n this.indexValue = event.currentTarget.selectedIndex\n\n // If target specifies an index, use that\n } else if (event.currentTarget.dataset.index) {\n this.indexValue = event.currentTarget.dataset.index\n\n // If target specifies an id, use that\n } else if (event.currentTarget.dataset.id) {\n this.indexValue = this.tabTargets.findIndex((tab) => tab.id == event.currentTarget.dataset.id)\n\n // Otherwise, use the index of the current target\n } else {\n this.indexValue = this.tabTargets.indexOf(event.currentTarget)\n }\n\n window.dispatchEvent(new CustomEvent('tsc:tab-change'))\n }\n\n nextTab() {\n this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1)\n }\n\n previousTab() {\n this.indexValue = Math.max(this.indexValue - 1, 0)\n }\n\n firstTab() {\n this.indexValue = 0\n }\n\n lastTab() {\n this.indexValue = this.tabsCount - 1\n }\n\n indexValueChanged() {\n this.showTab()\n\n // Update URL with the tab ID if it has one\n // This will be automatically selected on page load\n if (this.updateAnchorValue) {\n const new_tab_id = this.tabTargets[this.indexValue].id // Grab the id from the newly activated tab\n if (this.scrollToAnchorValue){\n location.hash = new_tab_id // Use location.hash to change the URL with scrolling\n } else {\n const currentUrl = window.location.href // Get the current URL\n const newUrl = currentUrl.split('#')[0] + '#' + new_tab_id // Create a new URL with the updated ID\n history.replaceState({}, document.title, newUrl) // Use history.replaceState to change the URL without scrolling\n }\n }\n }\n\n showTab() {\n this.panelTargets.forEach((panel, index) => {\n const tab = this.tabTargets[index]\n\n if (index === this.indexValue) {\n panel.classList.remove('hidden')\n tab.ariaSelected = 'true'\n if (this.hasInactiveTabClass) tab?.classList?.remove(...this.inactiveTabClasses)\n if (this.hasActiveTabClass) tab?.classList?.add(...this.activeTabClasses)\n } else {\n panel.classList.add('hidden')\n tab.ariaSelected = null\n if (this.hasActiveTabClass) tab?.classList?.remove(...this.activeTabClasses)\n if (this.hasInactiveTabClass) tab?.classList?.add(...this.inactiveTabClasses)\n }\n })\n\n if (this.hasSelectTarget) {\n this.selectTarget.selectedIndex = this.indexValue\n }\n\n this.scrollActiveTabIntoView()\n }\n\n // If tabs have horizontal scrolling, the active tab may be out of sight.\n // Make sure the active tab is visible by scrolling it into the view.\n scrollActiveTabIntoView() {\n const activeTab = this.element.querySelector('[aria-selected]');\n if (activeTab)\n activeTab.scrollIntoView({\n inline: 'center',\n });\n }\n\n get tabsCount() {\n return this.tabTargets.length\n }\n\n get anchor() {\n return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['toggleable']\n static values = {\n open: { type: Boolean, default: false }\n }\n\n toggle(event) {\n this.openValue = !this.openValue\n this.animate()\n }\n\n // Sets open to value of checkbox or radio\n toggleInput(event) {\n this.openValue = event.target.checked\n this.animate()\n }\n\n hide() {\n this.openValue = false\n this.animate()\n }\n\n show() {\n this.openValue = true\n this.animate()\n }\n\n animate() {\n this.toggleableTargets.forEach(target => {\n transition(target, this.openValue)\n })\n }\n}\n"], - "mappings": "4ZAAA,OAAS,cAAAA,MAAkB,qBCO3B,eAAsBC,EAAWC,EAASC,EAAOC,EAAoB,CAAC,EAAG,CACjED,EACJE,EAAMH,EAASE,CAAiB,EAEhCE,EAAMJ,EAASE,CAAiB,CAEpC,CASA,eAAsBC,EAAMH,EAASE,EAAoB,CAAC,EAAG,CAC3D,IAAMG,EAAoBL,EAAQ,QAAQ,iBAAmBE,EAAkB,OAAS,QAClFI,EACJN,EAAQ,QAAQ,qBAAuBE,EAAkB,WAAa,aAClEK,EAAYP,EAAQ,QAAQ,mBAAqBE,EAAkB,SAAW,WAC9EM,EAAcR,EAAQ,QAAQ,aAAeE,EAAkB,aAAe,SAGpFF,EAAQ,UAAU,IAAI,GAAGK,EAAkB,MAAM,GAAG,CAAC,EACrDL,EAAQ,UAAU,IAAI,GAAGM,EAAY,MAAM,GAAG,CAAC,EAC/CN,EAAQ,UAAU,OAAO,GAAGO,EAAU,MAAM,GAAG,CAAC,EAChDP,EAAQ,UAAU,OAAO,GAAGQ,EAAY,M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C,CACL,CAEA,IAAI,WAAY,CACd,OAAO,KAAK,WAAW,MACzB,CAEA,IAAI,QAAS,CACX,OAAQ,SAAS,IAAI,MAAM,GAAG,EAAE,OAAS,EAAK,SAAS,IAAI,MAAM,GAAG,EAAE,CAAC,EAAI,IAC7E,CACF,EA/GEC,EADKT,EACE,UAAU,CAAE,YAAa,aAAc,GAC9CS,EAFKT,EAEE,UAAU,CAAC,MAAO,QAAS,QAAQ,GAC1CS,EAHKT,EAGE,SAAS,CACd,MAAO,EACP,aAAc,QACd,eAAgB,OAClB,GCTF,OAAS,cAAAU,MAAkB,qBAG3B,IAAOC,EAAP,cAA6BC,CAAW,CAMtC,OAAOC,EAAO,CACZ,KAAK,UAAY,CAAC,KAAK,UACvB,KAAK,QAAQ,CACf,CAGA,YAAYA,EAAO,CACjB,KAAK,UAAYA,EAAM,OAAO,QAC9B,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,SAAU,CACR,KAAK,kBAAkB,QAAQC,GAAU,CACvCC,EAAWD,EAAQ,KAAK,SAAS,CACnC,CAAC,CACH,CACF,EA/BEE,EADKL,EACE,UAAU,CAAC,YAAY,GAC9BK,EAFKL,EAEE,SAAS,CACd,KAAM,CAAE,KAAM,QAAS,QAAS,EAAM,CACxC", - "names": ["Controller", "transition", "element", "state", "transitionOptions", "enter", "leave", "transitionClasses", "fromClasses", "toClasses", "toggleClass", "nextFrame", "afterTransition", "resolve", "animation", "alert_default", "Controller", "enter", "leave", "__publicField", "Controller", "autosave_default", "Controller", "message", "__publicField", "Controller", "color_preview_default", "Controller", "color", "yiqColor", "hexColor", "yiqThreshold", "r", "g", "b", "__publicField", "Controller", "_initializeDropdownActions", "initializeDropdownActions_fn", "dropdown_default", "Controller", "__privateAdd", "__privateMethod", "transition", "event", "actions", "__publicField", "Controller", "modal_default", "Controller", "__publicField", "Controller", "popover_default", "Controller", "transition", "event", "__publicField", "slideover_default", "dropdown_default", "transition", "__publicField", "Controller", "tabs_default", "Controller", "tab", "event", "new_tab_id", "newUrl", "panel", "index", "activeTab", "__publicField", "Controller", "toggle_default", "Controller", "event", "target", "transition", "__publicField"] + "sourcesContent": ["import { Controller } from '@hotwired/stimulus'\nimport { enter, leave } from \"./transition\"\n\nexport default class extends Controller {\n static values = {\n dismissAfter: Number,\n showDelay: { type: Number, default: 0 },\n removeDelay: { type: Number, default: 1100 }\n }\n\n connect() {\n setTimeout(() => {\n enter(this.element)\n }, this.showDelayValue)\n\n // Auto dimiss if defined\n if (this.hasDismissAfterValue) {\n setTimeout(() => {\n this.close()\n }, this.dismissAfterValue)\n }\n }\n\n // Runs hide animation and then removes element from the page\n close() {\n leave(this.element).then(() => {\n this.element.remove()\n })\n }\n}\n", "// Enter transition:\n//\n// transition(this.element, true)\n//\n// Leave transition:\n//\n// transition(this.element, false)\nexport async function transition(element, state, transitionOptions = {}) {\n if (!!state) {\n enter(element, transitionOptions)\n } else {\n leave(element, transitionOptions)\n }\n}\n\n// class=\"fixed inset-0 bg-black overflow-y-auto flex items-center justify-center bg-opacity-80 hidden\"\n// data-transition-enter=\"transition-all ease-in-out duration-300\"\n// data-transition-enter-from=\"bg-opacity-0\"\n// data-transition-enter-to=\"bg-opacity-80\"\n// data-transition-leave=\"transition-all ease-in-out duration-300\"\n// data-transition-leave-from=\"bg-opacity-80\"\n// data-transition-leave-to=\"bg-opacity-0\"\nexport async function enter(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionEnter || transitionOptions.enter || 'enter'\n const fromClasses =\n element.dataset.transitionEnterFrom || transitionOptions.enterFrom || 'enter-from'\n const toClasses = element.dataset.transitionEnterTo || transitionOptions.enterTo || 'enter-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n element.classList.remove(...toggleClass.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n }\n}\n\nexport async function leave(element, transitionOptions = {}) {\n const transitionClasses = element.dataset.transitionLeave || transitionOptions.leave || 'leave'\n const fromClasses =\n element.dataset.transitionLeaveFrom || transitionOptions.leaveFrom || 'leave-from'\n const toClasses = element.dataset.transitionLeaveTo || transitionOptions.leaveTo || 'leave-to'\n const toggleClass = element.dataset.toggleClass || transitionOptions.toogle || 'hidden'\n\n // Prepare transition\n element.classList.add(...transitionClasses.split(' '))\n element.classList.add(...fromClasses.split(' '))\n element.classList.remove(...toClasses.split(' '))\n\n await nextFrame()\n\n element.classList.remove(...fromClasses.split(' '))\n element.classList.add(...toClasses.split(' '))\n\n try {\n await afterTransition(element)\n } finally {\n element.classList.remove(...transitionClasses.split(' '))\n element.classList.add(...toggleClass.split(' '))\n }\n}\n\nfunction nextFrame() {\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n requestAnimationFrame(resolve)\n })\n })\n}\n\nfunction afterTransition(element) {\n return Promise.all(element.getAnimations().map(animation => animation.finished))\n}\n", "// Form autosave\n//\n// <%= form_with(model: post, data: { controller: \"autosave\", autosave_target: \"form\", action: \"turbo:submit-end->autosave#success turbo:fetch-request-error->autosave#error\" }) do |form| %>\n//
\n// <%= form.label :title %>\n// <%= form.text_field :title, class: 'form-control', data: { action: \"keyup->autosave#save\" } %>\n//
\n//\n//
\n// <% end %>\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['form', 'status']\n static values = {\n submitDuration: {type: Number, default: 1000},\n statusDuration: {type: Number, default: 2000},\n submittingText: {type: String, default: \"Saving...\"},\n successText: {type: String, default: \"Saved!\"},\n errorText: {type: String, default: \"Unable to save.\"}\n }\n\n connect() {\n this.timeout = null\n }\n\n save() {\n clearTimeout(this.timeout)\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = this.submittingTextValue\n this.formTarget.requestSubmit()\n }, this.submitDurationValue)\n }\n\n success() {\n this.setStatus(this.successTextValue)\n }\n\n error() {\n this.setStatus(this.errorTextValue)\n }\n\n setStatus(message) {\n this.statusTarget.textContent = message\n\n this.timeout = setTimeout(() => {\n this.statusTarget.textContent = ''\n }, this.statusDurationValue)\n }\n}\n", "// A color picker preview where you can choose to have the color or backgroundColor\n// get updated based on the result of a color picker. It also supports ensuring\n// the foreground text is always readable by performing a YIQ calculation to\n// set the text to black or white based on the contrast of the color and backgroundColor.\n\nimport { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static targets = ['preview', 'color'];\n static values = {\n style: {type: String, default: \"backgroundColor\"}\n }\n\n update() {\n this.preview = this.colorTarget.value\n }\n\n set preview(color) {\n this.previewTarget.style[this.styleValue] = color\n\n // Ensure the foreground text is always readable by setting either the\n // backgroundColor or color to black or white.\n const yiqColor = this._getContrastYIQ(color)\n\n if (this.styleValue === 'color') {\n this.previewTarget.style.backgroundColor = yiqColor\n } else {\n this.previewTarget.style.color = yiqColor\n }\n }\n\n _getContrastYIQ(hexColor) {\n // Taken from: https://24ways.org/2010/calculating-color-contrast/\n hexColor = hexColor.replace('#', '');\n\n const yiqThreshold = 128;\n const r = parseInt(hexColor.substr(0, 2), 16);\n const g = parseInt(hexColor.substr(2, 2), 16);\n const b = parseInt(hexColor.substr(4, 2), 16);\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\n\n return (yiq >= yiqThreshold) ? '#000' : '#fff';\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = ['menu', 'button', 'menuItem']\n static values = {\n open: { type: Boolean, default: false },\n closeOnEscape: { type: Boolean, default: true },\n closeOnClickOutside: { type: Boolean, default: true }\n }\n static classes = ['enter', 'enterFrom', 'enterTo', 'leave', 'leaveFrom', 'leaveTo', 'toggle']\n\n connect() {\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n openValueChanged() {\n transition(this.menuTarget, this.openValue, this.transitionOptions)\n\n if (this.openValue === true && this.hasMenuItemTarget) {\n this.menuItemTargets[0].focus()\n }\n }\n\n show() {\n this.openValue = true\n }\n\n close() {\n this.openValue = false\n }\n\n // Closes dropdown from outside click or keyboard\n hide(event) {\n // if the event is a click and the target is not inside the dropdown, then close it\n if (\n this.closeOnClickOutsideValue &&\n event.target.nodeType &&\n this.element.contains(event.target) === false &&\n this.openValue\n ) {\n this.openValue = false\n }\n\n // if the event is a keydown and the key is escape, then close it\n if (this.closeOnEscapeValue && event.key === 'Escape' && this.openValue) {\n this.openValue = false\n }\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n nextItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.nextIndex].focus()\n }\n\n previousItem(event) {\n event.preventDefault()\n\n this.menuItemTargets[this.previousIndex].focus()\n }\n\n // getters and setters\n get currentItemIndex() {\n return this.menuItemTargets.indexOf(document.activeElement)\n }\n\n get nextIndex() {\n return Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1)\n }\n\n get previousIndex() {\n return Math.max(this.currentItemIndex - 1, 0)\n }\n\n get transitionOptions() {\n // once the Class API default values are available, we can simplify this\n return {\n enter: this.hasEnterClass ? this.enterClass : 'transition ease-out duration-100',\n enterFrom: this.hasEnterFromClass ? this.enterFromClass : 'transform opacity-0 scale-95',\n enterTo: this.hasEnterToClass ? this.enterToClass : 'transform opacity-100 scale-100',\n leave: this.hasLeaveClass ? this.leaveClass : 'transition ease-in duration-75',\n leaveFrom: this.hasLeaveFromClass ? this.leaveFromClass : 'transform opacity-100 scale-100',\n leaveTo: this.hasLeaveToClass ? this.leaveToClass : 'transform opacity-0 scale-95',\n toggleClass: this.hasToggleClass ? this.toggleClass : 'hidden',\n }\n }\n\n // Ensures the menu is hidden before Turbo caches the page\n beforeCache() {\n this.openValue = false\n this.menuTarget.classList.add(\"hidden\")\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n backdropClose(event) {\n console.log(event)\n if (event.target.nodeName) this.dialogTarget.close()\n }\n\n // For showing non-modally\n show() {\n this.dialogTarget.show()\n }\n\n beforeCache() {\n this.close()\n }\n}\n", "// A simple inline popover to be used wherever needed, with a configurable offset.\n// Visit The Stimulus Handbook for more details\n// https://stimulusjs.org/handbook/introduction\n//\n// This example controller works with specially annotated HTML like:\n//\n//

\n// Beginning in 2015, Google introduced what is called the\n//

popover#mouseOver mouseout->popover#mouseOut\">\n// 'local snack pack',\n// \n//
\n// which shows you local search results before normal organic results.\n//

\n//\n// You can also toggle the popover using the click action.\n//
popover#toggle\" data-action=\"mouseenter->popover#show mouseleave->popover#hide\">\n\nimport { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['content']\n static values = {\n dismissAfter: Number,\n open: { type: Boolean, default: false }\n }\n\n openValueChanged() {\n transition(this.contentTarget, this.openValue)\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n }\n\n // If already true, extend the dismissal another X seconds since this will not trigger openValueChanged\n show(event) {\n if (this.shouldAutoDismiss) this.scheduleDismissal()\n this.openValue = true\n }\n\n hide() {\n this.openValue = false\n }\n\n toggle() {\n this.openValue = !this.openValue\n }\n\n get shouldAutoDismiss() {\n return (this.openValue && this.hasDismissAfterValue)\n }\n\n scheduleDismissal() {\n if (!this.hasDismissAfterValue) return\n\n // Cancel any existing dismissals\n this.cancelDismissal()\n\n // Schedule the next dismissal\n this.timeoutId = setTimeout(() => {\n this.hide()\n this.timeoutId = undefined\n }, this.dismissAfterValue)\n }\n\n cancelDismissal() {\n if (typeof this.timeoutId === \"number\") {\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n }\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from './transition'\n\nexport default class extends Controller {\n static targets = [\"dialog\"]\n static values = {\n open: Boolean\n }\n\n connect() {\n if (this.openValue) this.open()\n document.addEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n disconnect() {\n document.removeEventListener(\"turbo:before-cache\", this.beforeCache.bind(this))\n }\n\n open() {\n this.dialogTarget.showModal()\n }\n\n close() {\n this.dialogTarget.close()\n }\n\n beforeCache() {\n this.close()\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\n\nexport default class extends Controller {\n static classes = [ \"activeTab\", \"inactiveTab\" ]\n static targets = ['tab', 'panel', 'select']\n static values = {\n index: 0,\n updateAnchor: Boolean,\n scrollToAnchor: Boolean,\n scrollActiveTabIntoView: Boolean\n }\n\n initialize() {\n if (this.anchor) this.indexValue = this.tabTargets.findIndex((tab) => tab.id === this.anchor)\n }\n\n connect() {\n this.showTab()\n }\n\n // Changes to the clicked tab\n change(event) {\n if (event.currentTarget.tagName === \"SELECT\") {\n this.indexValue = event.currentTarget.selectedIndex\n\n // If target specifies an index, use that\n } else if (event.currentTarget.dataset.index) {\n this.indexValue = event.currentTarget.dataset.index\n\n // If target specifies an id, use that\n } else if (event.currentTarget.dataset.id) {\n this.indexValue = this.tabTargets.findIndex((tab) => tab.id == event.currentTarget.dataset.id)\n\n // Otherwise, use the index of the current target\n } else {\n this.indexValue = this.tabTargets.indexOf(event.currentTarget)\n }\n\n window.dispatchEvent(new CustomEvent('tsc:tab-change'))\n }\n\n nextTab() {\n this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1)\n }\n\n previousTab() {\n this.indexValue = Math.max(this.indexValue - 1, 0)\n }\n\n firstTab() {\n this.indexValue = 0\n }\n\n lastTab() {\n this.indexValue = this.tabsCount - 1\n }\n\n indexValueChanged() {\n this.showTab()\n\n // Update URL with the tab ID if it has one\n // This will be automatically selected on page load\n if (this.updateAnchorValue) {\n const new_tab_id = this.tabTargets[this.indexValue].id // Grab the id from the newly activated tab\n if (this.scrollToAnchorValue){\n location.hash = new_tab_id // Use location.hash to change the URL with scrolling\n } else {\n const currentUrl = window.location.href // Get the current URL\n const newUrl = currentUrl.split('#')[0] + '#' + new_tab_id // Create a new URL with the updated ID\n history.replaceState({}, document.title, newUrl) // Use history.replaceState to change the URL without scrolling\n }\n }\n }\n\n showTab() {\n this.panelTargets.forEach((panel, index) => {\n const tab = this.tabTargets[index]\n\n if (index === this.indexValue) {\n panel.classList.remove('hidden')\n tab.ariaSelected = 'true'\n if (this.hasInactiveTabClass) tab?.classList?.remove(...this.inactiveTabClasses)\n if (this.hasActiveTabClass) tab?.classList?.add(...this.activeTabClasses)\n } else {\n panel.classList.add('hidden')\n tab.ariaSelected = null\n if (this.hasActiveTabClass) tab?.classList?.remove(...this.activeTabClasses)\n if (this.hasInactiveTabClass) tab?.classList?.add(...this.inactiveTabClasses)\n }\n })\n\n if (this.hasSelectTarget) {\n this.selectTarget.selectedIndex = this.indexValue\n }\n\n if (this.scrollActiveTabIntoViewValue) this.scrollToActiveTab()\n }\n\n // If tabs have horizontal scrolling, the active tab may be out of sight.\n // Make sure the active tab is visible by scrolling it into the view.\n scrollToActiveTab() {\n const activeTab = this.element.querySelector('[aria-selected]')\n if (activeTab) activeTab.scrollIntoView({ inline: 'center', })\n }\n\n get tabsCount() {\n return this.tabTargets.length\n }\n\n get anchor() {\n return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;\n }\n}\n", "import { Controller } from '@hotwired/stimulus'\nimport { transition } from \"./transition\"\n\nexport default class extends Controller {\n static targets = ['toggleable']\n static values = {\n open: { type: Boolean, default: false }\n }\n\n toggle(event) {\n this.openValue = !this.openValue\n this.animate()\n }\n\n // Sets open to value of checkbox or radio\n toggleInput(event) {\n this.openValue = event.target.checked\n this.animate()\n }\n\n hide() {\n this.openValue = false\n this.animate()\n }\n\n show() {\n this.openValue = true\n this.animate()\n }\n\n animate() {\n this.toggleableTargets.forEach(target => {\n transition(target, this.openValue)\n })\n }\n}\n"], + "mappings": "wKAAA,OAAS,cAAAA,MAAkB,qBCO3B,eAAsBC,EAAWC,EAASC,EAAOC,EAAoB,CAAC,EAAG,CACjED,EACJE,EAAMH,EAASE,CAAiB,EAEhCE,EAAMJ,EAASE,CAAiB,CAEpC,CASA,eAAsBC,EAAMH,EAASE,EAAoB,CAAC,EAAG,CAC3D,IAAMG,EAAoBL,EAAQ,QAAQ,iBAAmBE,EAAkB,OAAS,QAClFI,EACJN,EAAQ,QAAQ,qBAAuBE,EAAkB,WAAa,aAClEK,EAAYP,EAAQ,QAAQ,mBAAqBE,EAAkB,SAAW,WAC9EM,EAAcR,EAAQ,QAAQ,aAAeE,EAAkB,aAAe,SAGpFF,EAAQ,UAAU,IAAI,GAAGK,EAAkB,MAAM,GAAG,CAAC,EACrDL,EAAQ,UAAU,IAAI,GAAGM,EAAY,MAAM,GAAG,CAAC,EAC/CN,EAAQ,UAAU,OAAO,GAAGO,EAAU,MAAM,GAAG,CAAC,EAChDP,EAAQ,UAAU,OAAO,GAAGQ,EAAY,MAAM,GAAG,CAAC,EAElD,MAAMC,EAAU,EAEhBT,EAAQ,UAAU,OAAO,GAAGM,EAAY,MAAM,GAAG,CAAC,EAClDN,EAAQ,UAAU,IAAI,GAAGO,EAAU,MAAM,GAAG,CAAC,EAE7C,GAAI,CACF,MAAMG,EAAgBV,CAAO,CAC/B,QAAE,CACAA,EAAQ,UAAU,OAAO,GAAGK,EAAkB,MAAM,GAAG,CAAC,CAC1D,CACF,CAEA,eAAsBD,EAAMJ,EAASE,EAAoB,CAAC,EAAG,CAC3D,IAAMG,EAAoBL,EAAQ,QAAQ,iBA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C,EAAP,cAA6BC,CAAW,CAMtC,OAAOC,EAAO,CACZ,KAAK,UAAY,CAAC,KAAK,UACvB,KAAK,QAAQ,CACf,CAGA,YAAYA,EAAO,CACjB,KAAK,UAAYA,EAAM,OAAO,QAC9B,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,MAAO,CACL,KAAK,UAAY,GACjB,KAAK,QAAQ,CACf,CAEA,SAAU,CACR,KAAK,kBAAkB,QAAQC,GAAU,CACvCC,EAAWD,EAAQ,KAAK,SAAS,CACnC,CAAC,CACH,CACF,EA/BEE,EADKL,EACE,UAAU,CAAC,YAAY,GAC9BK,EAFKL,EAEE,SAAS,CACd,KAAM,CAAE,KAAM,QAAS,QAAS,EAAM,CACxC", + "names": ["Controller", "transition", "element", "state", "transitionOptions", "enter", "leave", "transitionClasses", "fromClasses", "toClasses", "toggleClass", "nextFrame", "afterTransition", "resolve", "animation", "alert_default", "Controller", "enter", "leave", "__publicField", "Controller", "autosave_default", "Controller", "message", "__publicField", "Controller", "color_preview_default", "Controller", "color", "yiqColor", "hexColor", "yiqThreshold", "r", "g", "b", "__publicField", "Controller", "dropdown_default", "Controller", "transition", "event", "__publicField", "Controller", "modal_default", "Controller", "event", "__publicField", "Controller", "popover_default", "Controller", "transition", "event", "__publicField", "Controller", "slideover_default", "Controller", "__publicField", "Controller", "tabs_default", "Controller", "tab", "event", "new_tab_id", "newUrl", "panel", "index", "activeTab", "__publicField", "Controller", "toggle_default", "Controller", "event", "target", "transition", "__publicField"] }