import "@zag-js/shared/src/style.css" import { nanoid } from "nanoid" import { Progress } from "../src/progress" document.querySelectorAll(".progress").forEach((rootEl) => { const progressEl = new Progress(rootEl, { id: nanoid(), defaultValue: 50, }) progressEl.init() // Add button handlers const decreaseBtn = rootEl.querySelector(".progress-decrease") const increaseBtn = rootEl.querySelector(".progress-increase") const indeterminateBtn = rootEl.querySelector(".progress-indeterminate") if (decreaseBtn) { decreaseBtn.addEventListener("click", () => { progressEl.api.setValue((progressEl.api.value ?? 0) - 20) }) } if (increaseBtn) { increaseBtn.addEventListener("click", () => { progressEl.api.setValue((progressEl.api.value ?? 0) + 20) }) } if (indeterminateBtn) { indeterminateBtn.addEventListener("click", () => { progressEl.api.setValue(null) }) } })