UNPKG

gentelella

Version:

Gentelella v4 — free admin template. 60 pages, 20 chart variants, fully interactive inbox & kanban, live theme generator, component playground, PWA-ready. Vite 8, vanilla JS, no Bootstrap, no jQuery.

1 lines 2.98 kB
import"./main-v4-BFwmMcfm.js";document.querySelectorAll('input[type="range"].slider').forEach(e=>{const t=document.querySelector(`[data-slider-display="${e.id}"]`);if(!t)return;const n="volume"===e.id?"%":"font-size"===e.id?"px":"";e.addEventListener("input",()=>{t.textContent=e.value+n})}),document.querySelectorAll(".color-grid").forEach(e=>{e.addEventListener("click",t=>{const n=t.target.closest(".color-swatch");n&&(e.querySelectorAll(".color-swatch").forEach(e=>e.classList.remove("active")),n.classList.add("active"))})}),document.querySelectorAll(".stepper").forEach(e=>{const t=e.querySelector("input");e.querySelectorAll("button[data-step]").forEach(e=>{e.addEventListener("click",()=>{const n=parseInt(e.dataset.step,10),r=parseInt(t.min||"-Infinity",10),o=parseInt(t.max||"Infinity",10),l=Math.max(r,Math.min(o,(parseInt(t.value,10)||0)+n));t.value=l,t.dispatchEvent(new Event("input",{bubbles:!0}))})})}),document.querySelectorAll(".tag-input").forEach(e=>{const t=e.querySelector("input");e.addEventListener("click",n=>{n.target===e&&t.focus();const r=n.target.closest(".tag-pill button");r&&r.closest(".tag-pill").remove()}),t.addEventListener("keydown",n=>{if("Enter"===n.key&&t.value.trim()){n.preventDefault();const r=document.createElement("span");r.className="tag-pill",r.innerHTML=t.value.trim().replace(/[<>&]/g,"")+'<button type="button" aria-label="Remove">×</button>',e.insertBefore(r,t),t.value=""}else if("Backspace"===n.key&&!t.value){const t=e.querySelector(".tag-pill:last-of-type");t&&t.remove()}})}),document.querySelectorAll(".rating").forEach(e=>{const t=[...e.querySelectorAll("button")];t.forEach((n,r)=>{n.addEventListener("click",()=>{t.forEach((e,t)=>e.classList.toggle("on",r>=t)),e.dataset.rating=String(r+1)})})}),document.querySelectorAll('.file-input input[type="file"]').forEach(e=>{const t=e.closest(".file-input").querySelector(".file-input-name");t&&e.addEventListener("change",()=>{e.files?.[0]&&(t.textContent=e.files[0].name)})}),document.querySelectorAll(".otp-grid").forEach(e=>{const t=[...e.querySelectorAll(".otp-input")];t.forEach((e,n)=>{e.addEventListener("input",()=>{e.value&&t.length-1>n&&t[n+1].focus()}),e.addEventListener("keydown",r=>{"Backspace"===r.key&&!e.value&&n>0&&t[n-1].focus()})})}),document.querySelectorAll("[data-char-counter]").forEach(e=>{const t=document.querySelector(`[data-char-display="${e.id}"]`);if(!t)return;const n=()=>{t.textContent=String(e.value.length)};e.addEventListener("input",n),n()});var e=document.getElementById("newPwd");if(e){const t=e.closest(".form-group")?.querySelector(".password-strength"),n=e.closest(".form-group")?.querySelector(".password-strength-label strong"),r=e=>{let t=0;return 8>e.length||t++,12>e.length||t++,/[A-Z]/.test(e)&&/[a-z]/.test(e)&&t++,/\d/.test(e)&&/[^A-Za-z0-9]/.test(e)&&t++,t},o=["Empty","Weak","Fair","Good","Strong"];e.addEventListener("input",()=>{const l=r(e.value);t&&(t.className=`password-strength s${l}`),n&&(n.textContent=o[l])})}